@chialab/node-resolve
Advanced tools
Comparing version 0.12.26 to 0.13.0
@@ -14,3 +14,3 @@ /** | ||
export function escapeRegexBody(source) { | ||
return source.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); | ||
return source.replace(/[.*+?^${}()|[\]\\/]/g, '\\$&'); | ||
} | ||
@@ -39,3 +39,3 @@ | ||
if (mode === ALIAS_MODE.START) { | ||
return new RegExp(`^${regexBody}`); | ||
return new RegExp(`^${regexBody}(\\/|$)`); | ||
} | ||
@@ -42,0 +42,0 @@ |
@@ -16,2 +16,10 @@ import path from 'path'; | ||
/** | ||
* @typedef {(specifier: string, impporter: string) => Promise<string>} Resolver | ||
*/ | ||
/** | ||
* @typedef {(specifier: string, impporter: string) => string|false} SyncResolver | ||
*/ | ||
/** | ||
* A promise based node resolution method based on enhanced-resolve | ||
@@ -23,2 +31,3 @@ * @param {ResolveOptions} [options] | ||
symlinks: false, | ||
preferRelative: true, | ||
...options, | ||
@@ -28,4 +37,3 @@ }); | ||
/** | ||
* @param {string} specifier | ||
* @param {string} importer | ||
* @type {Resolver} | ||
*/ | ||
@@ -68,4 +76,3 @@ const resolve = async function(specifier, importer) { | ||
/** | ||
* @param {string} specifier | ||
* @param {string} importer | ||
* @type {SyncResolver} | ||
*/ | ||
@@ -72,0 +79,0 @@ const resolve = function(specifier, importer) { |
{ | ||
"name": "@chialab/node-resolve", | ||
"type": "module", | ||
"version": "0.12.26", | ||
"version": "0.13.0", | ||
"description": "A promise based node resolution library based on enhanced-resolve.", | ||
@@ -43,4 +43,3 @@ "main": "lib/index.js", | ||
"typescript": "^4.3.0" | ||
}, | ||
"gitHead": "e44a09bfc01475ad93df4e8f24ac50508b58d6af" | ||
} | ||
} |
@@ -11,6 +11,12 @@ /** | ||
/** | ||
* @typedef {(specifier: string, impporter: string) => Promise<string>} Resolver | ||
*/ | ||
/** | ||
* @typedef {(specifier: string, impporter: string) => string|false} SyncResolver | ||
*/ | ||
/** | ||
* A promise based node resolution method based on enhanced-resolve | ||
* @param {ResolveOptions} [options] | ||
*/ | ||
export function createResolver(options?: ResolveOptions | undefined): (specifier: string, importer: string) => Promise<any>; | ||
export function createResolver(options?: ResolveOptions | undefined): Resolver; | ||
/** | ||
@@ -20,3 +26,3 @@ * A sync node resolution method based on enhanced-resolve | ||
*/ | ||
export function createSyncResolver(options?: ResolveOptions | undefined): (specifier: string, importer: string) => string | false; | ||
export function createSyncResolver(options?: ResolveOptions | undefined): SyncResolver; | ||
/** | ||
@@ -107,22 +113,6 @@ * Check if a file is a JavaSript source. | ||
export const HTML_EXTENSIONS: string[]; | ||
/** | ||
* @param {string} specifier | ||
* @param {string} importer | ||
*/ | ||
export function resolve(specifier: string, importer: string): Promise<any>; | ||
/** | ||
* @param {string} specifier | ||
* @param {string} importer | ||
*/ | ||
export function styleResolve(specifier: string, importer: string): Promise<any>; | ||
/** | ||
* @param {string} specifier | ||
* @param {string} importer | ||
*/ | ||
export function syncStyleResolve(specifier: string, importer: string): string | false; | ||
/** | ||
* @param {string} specifier | ||
* @param {string} importer | ||
*/ | ||
export function browserResolve(specifier: string, importer: string): Promise<any>; | ||
export function resolve(specifier: string, impporter: string): Promise<string>; | ||
export function styleResolve(specifier: string, impporter: string): Promise<string>; | ||
export function syncStyleResolve(specifier: string, impporter: string): string | false; | ||
export function browserResolve(specifier: string, impporter: string): Promise<string>; | ||
export * from "./alias.js"; | ||
@@ -137,2 +127,4 @@ export type ResolveOptions = { | ||
}; | ||
export type Resolver = (specifier: string, impporter: string) => Promise<string>; | ||
export type SyncResolver = (specifier: string, impporter: string) => string | false; | ||
import isCore from "is-core-module"; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
18580
529