@nodejs-loaders/alias
Advanced tools
@@ -1,6 +0,6 @@ | ||
| export function resolveAliases(url: string, context: import("module").LoadHookContext, nextLoad: (url: string, context?: Partial<import("module").LoadHookContext>) => import("module").LoadFnOutput | Promise<import("module").LoadFnOutput>): import("module").LoadFnOutput | Promise<import("module").LoadFnOutput>; | ||
| export function resolveAliases(specifier: string, context: import("module").ResolveHookContext, nextResolve: (specifier: string, context?: Partial<import("module").ResolveHookContext>) => import("module").ResolveFnOutput | Promise<import("module").ResolveFnOutput>): import("module").ResolveFnOutput | Promise<import("module").ResolveFnOutput>; | ||
| export function readConfigFile(filename: any): Promise<void | AliasMap>; | ||
| export { resolveAlias as resolve }; | ||
| export type AliasMap = Map<string, string>; | ||
| declare function resolveAlias(url: string, context: import("module").LoadHookContext, nextLoad: (url: string, context?: Partial<import("module").LoadHookContext>) => import("module").LoadFnOutput | Promise<import("module").LoadFnOutput>): import("module").LoadFnOutput | Promise<import("module").LoadFnOutput>; | ||
| declare function resolveAlias(specifier: string, context: import("module").ResolveHookContext, nextResolve: (specifier: string, context?: Partial<import("module").ResolveHookContext>) => import("module").ResolveFnOutput | Promise<import("module").ResolveFnOutput>): import("module").ResolveFnOutput | Promise<import("module").ResolveFnOutput>; | ||
| //# sourceMappingURL=alias.loader.d.mts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"alias.loader.d.mts","sourceRoot":"","sources":["alias.loader.mjs"],"names":[],"mappings":"sHAiF83f,CAAC;AA1C/3f,wEAcC;;uBAGY,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC;qHAyB81f,CAAC"} | ||
| {"version":3,"file":"alias.loader.d.mts","sourceRoot":"","sources":["alias.loader.mjs"],"names":[],"mappings":"wIAmFs5c,CAAC;AA1Cv5c,wEAcC;;uBAGY,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC;uIAyBs3c,CAAC"} |
+5
-3
@@ -5,2 +5,4 @@ import { readFile } from 'node:fs/promises'; | ||
| import JSON5 from 'json5'; | ||
| const projectRoot = pathToFileURL(`${process.cwd()}/`); | ||
@@ -17,3 +19,3 @@ | ||
| /** | ||
| * @type {import('node:module').LoadHook} | ||
| * @type {import('node:module').ResolveHook} | ||
| */ | ||
@@ -26,3 +28,3 @@ function resolveAlias(specifier, ctx, next) { | ||
| /** | ||
| * @type {import('node:module').LoadHook} | ||
| * @type {import('node:module').ResolveHook} | ||
| */ | ||
@@ -49,3 +51,3 @@ export function resolveAliases(specifier, ctx, next) { | ||
| .then((contents) => contents.toString()) | ||
| .then((contents) => JSON.parse(contents)) | ||
| .then((contents) => JSON5.parse(contents)) | ||
| // Get the `compilerOptions.paths` object from the parsed JSON | ||
@@ -52,0 +54,0 @@ .then((contents) => contents?.compilerOptions?.paths) |
+4
-1
| { | ||
| "version": "2.0.0", | ||
| "version": "2.0.1", | ||
| "name": "@nodejs-loaders/alias", | ||
@@ -32,3 +32,6 @@ "description": "Extend node to support TypeScript 'paths' via customization hooks.", | ||
| "directory": "packages/alias" | ||
| }, | ||
| "dependencies": { | ||
| "json5": "^2.2.3" | ||
| } | ||
| } |
7137
2.12%73
1.39%1
Infinity%+ Added
+ Added