
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
astro-import-tree
Advanced tools
A library to parse Astro page URL paths and import trees using AST
A library to parse Astro page URL paths and import trees using AST analysis.
.astro
, .js
, .jsx
, .ts
, .tsx
files)npm install astro-import-tree
# Or install globally for CLI usage
npm install -g astro-import-tree
# Display LLM-friendly import tree
astro-import-tree llm ./my-astro-project
# Display JSON import tree
astro-import-tree json ./my-astro-project
# Specify custom pages directory
astro-import-tree llm ./my-astro-project --pages-dir src/content
# Suppress warning messages
astro-import-tree llm ./my-astro-project --quiet
# Show help
astro-import-tree --help
When developing, you can use yarn commands to debug the CLI:
# Run CLI with arguments
yarn cli llm ./testdata/astro
# Quick run for LLM output
yarn cli:llm ./testdata/astro
// Recommended: Named import
import { astroImportTree } from 'astro-import-tree';
// Parse an Astro project
const tree = await astroImportTree.parse({
dir: './', // Root directory of your Astro project
pagesDir: 'src/pages' // Optional, defaults to 'src/pages'
});
console.log(tree);
// Output:
// {
// "pages": [
// {
// "path": "/",
// "imports": [
// "@src/pages/index.astro",
// "@src/components/Header.astro",
// "@src/components/Hero.astro",
// "@src/components/Hero/Image.astro",
// "@src/components/Footer.astro"
// ]
// },
// {
// "path": "/about",
// "imports": [
// "@src/pages/about.astro",
// "@src/components/Header.astro",
// "@src/components/Footer.astro"
// ]
// }
// ]
// }
// Generate LLM-friendly text
const llmText = astroImportTree.toLLM(tree);
console.log(llmText);
// Output:
// ## /, /index.html
//
// - @src/pages/index.astro
// - @src/components/Header.astro
// - @src/components/Hero.astro
// - @src/components/Hero/Image.astro
// - @src/components/Footer.astro
//
// ## /about, /about/index.html
//
// - @src/pages/about.astro
// - @src/components/Header.astro
// - @src/components/Footer.astro
const astroImportTree = require('astro-import-tree').default;
// Parse an Astro project
const tree = await astroImportTree.parse({
dir: './',
pagesDir: 'src/pages'
});
// Import the class directly if you need multiple instances
import { AstroImportTree } from 'astro-import-tree';
const myInstance = new AstroImportTree();
// Default import (requires .default access in some environments)
import astroImportTreeModule from 'astro-import-tree';
const astroImportTree = astroImportTreeModule.default || astroImportTreeModule;
astroImportTree.parse(options)
Parses an Astro project and returns the import tree.
dir
(string, required): The root directory of your Astro projectpagesDir
(string, optional): The pages directory relative to root. Defaults to 'src/pages'
Returns a Promise that resolves to an ImportTree
object:
interface ImportTree {
pages: ImportTreePage[];
}
interface ImportTreePage {
path: string; // URL path (e.g., "/", "/about")
imports: string[]; // Array of import paths (e.g., "@src/components/Header.astro")
}
astroImportTree.toLLM(tree)
Converts an import tree to an LLM-friendly text format.
tree
(ImportTree): The import tree object from parse()
Returns a string with formatted import information for each page.
.astro
files in the pages directorysrc/pages/about.astro
→ /about
)Astro.glob()
The library formats all import paths with an @
prefix followed by the relative path from the project root:
@src/pages/index.astro
@src/components/Header.astro
@src/layouts/BaseLayout.astro
MIT
FAQs
A library to parse Astro page URL paths and import trees using AST
The npm package astro-import-tree receives a total of 6 weekly downloads. As such, astro-import-tree popularity was classified as not popular.
We found that astro-import-tree demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.