@chialab/esbuild-plugin-meta-url
Advanced tools
Comparing version 0.16.0 to 0.16.1
@@ -113,3 +113,3 @@ import path from 'path'; | ||
const { platform, format, sourcesContent, sourcemap } = build.initialOptions; | ||
const { onTransform, isEmittedPath, emitFile, emitChunk, loaders: buildLoaders } = useRna(build); | ||
const { onTransform, isEmittedPath, resolveLocallyFirst, emitFile, emitChunk, loaders: buildLoaders } = useRna(build); | ||
@@ -167,28 +167,16 @@ const usePlainScript = platform === 'browser' && format !== 'esm'; | ||
const requestName = value.split('?')[0]; | ||
const candidates = []; | ||
if (requestName.startsWith('./') || requestName.startsWith('../')) { | ||
candidates.push(requestName); | ||
} else { | ||
candidates.push(`./${requestName}`, requestName); | ||
} | ||
const { path: resolvedPath, pluginData: localFile } = await resolveLocallyFirst(requestName, { | ||
kind: 'dynamic-import', | ||
importer: args.path, | ||
namespace: 'file', | ||
resolveDir: path.dirname(args.path), | ||
pluginData: null, | ||
}); | ||
while (candidates.length) { | ||
const pathName = /** @type {string} */ (candidates.shift()); | ||
const { path: resolvedPath } = await build.resolve(pathName, { | ||
kind: 'dynamic-import', | ||
importer: args.path, | ||
namespace: 'file', | ||
resolveDir: path.dirname(args.path), | ||
pluginData: null, | ||
}); | ||
if (!resolvedPath) { | ||
continue; | ||
} | ||
if (!pathName.startsWith('./') && !pathName.startsWith('../')) { | ||
if (resolvedPath) { | ||
if (!localFile) { | ||
const location = getLocation(code, startToken.start); | ||
warnings.push({ | ||
pluginName: 'meta-url', | ||
text: `Resolving '${pathName}' as module is not a standard behavior and may be removed in a future relase of the plugin.`, | ||
text: `Resolving '${requestName}' as module is not a standard behavior and may be removed in a future relase of the plugin.`, | ||
location: { | ||
@@ -195,0 +183,0 @@ file: args.path, |
{ | ||
"name": "@chialab/esbuild-plugin-meta-url", | ||
"type": "module", | ||
"version": "0.16.0", | ||
"version": "0.16.1", | ||
"description": "A file loader plugin for esbuild for constructed URLs using import metadata.", | ||
@@ -33,3 +33,3 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"@chialab/esbuild-rna": "^0.16.0", | ||
"@chialab/esbuild-rna": "^0.16.1", | ||
"@chialab/estransform": "^0.16.0", | ||
@@ -36,0 +36,0 @@ "@chialab/node-resolve": "^0.16.0" |
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
13591
237
Updated@chialab/esbuild-rna@^0.16.1