import-plugin-default.ts — astro Source File
Architecture documentation for import-plugin-default.ts, a typescript file in the astro codebase. 4 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 58892a04_421a_ce1a_f6f5_aaa947266446["import-plugin-default.ts"] 3955a637_4c78_0528_fe7c_92190a232cb0["node:module"] 58892a04_421a_ce1a_f6f5_aaa947266446 --> 3955a637_4c78_0528_fe7c_92190a232cb0 c52a5f83_66e3_37d7_9ebb_767f7129bc62["node:path"] 58892a04_421a_ce1a_f6f5_aaa947266446 --> c52a5f83_66e3_37d7_9ebb_767f7129bc62 d9a92db9_c95e_9165_13ac_24b3d859d946["node:url"] 58892a04_421a_ce1a_f6f5_aaa947266446 --> d9a92db9_c95e_9165_13ac_24b3d859d946 54ce55cc_9dc1_4ebd_28dd_358c1e22d4e7["unified"] 58892a04_421a_ce1a_f6f5_aaa947266446 --> 54ce55cc_9dc1_4ebd_28dd_358c1e22d4e7 style 58892a04_421a_ce1a_f6f5_aaa947266446 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
// This file should be imported as `#import-plugin`
import { createRequire } from 'node:module';
import path from 'node:path';
import { pathToFileURL } from 'node:url';
import type * as unified from 'unified';
let cwdUrlStr: string | undefined;
const require = createRequire(import.meta.url);
// In non-browser environments, we can try to resolve from the filesystem too
export async function importPlugin(p: string): Promise<unified.Plugin> {
// Try import from this package first
try {
const importResult = await import(/* @vite-ignore */ p);
return importResult.default;
} catch {}
// Try import from user project
cwdUrlStr ??= pathToFileURL(path.join(process.cwd(), 'package.json')).toString();
const resolved = pathToFileURL(require.resolve(p, { paths: [cwdUrlStr] })).toString();
const importResult = await import(/* @vite-ignore */ resolved);
return importResult.default;
}
Domain
Subdomains
Functions
Dependencies
- node:module
- node:path
- node:url
- unified
Source
Frequently Asked Questions
What does import-plugin-default.ts do?
import-plugin-default.ts is a source file in the astro codebase, written in typescript. It belongs to the CoreAstro domain, RenderingEngine subdomain.
What functions are defined in import-plugin-default.ts?
import-plugin-default.ts defines 1 function(s): importPlugin.
What does import-plugin-default.ts depend on?
import-plugin-default.ts imports 4 module(s): node:module, node:path, node:url, unified.
Where is import-plugin-default.ts in the architecture?
import-plugin-default.ts is located at packages/markdown/remark/src/import-plugin-default.ts (domain: CoreAstro, subdomain: RenderingEngine, directory: packages/markdown/remark/src).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free