@chialab/esbuild-plugin-meta-url
Advanced tools
Comparing version 0.15.23 to 0.15.28
import path from 'path'; | ||
import { isUrl, hasSearchParam } from '@chialab/node-resolve'; | ||
import { isUrl, hasSearchParam, appendSearchParam } from '@chialab/node-resolve'; | ||
import { parse, walk, getIdentifierValue, getBlock, getLocation, TokenType } from '@chialab/estransform'; | ||
@@ -8,3 +8,3 @@ import { useRna } from '@chialab/esbuild-rna'; | ||
* @param {import('@chialab/estransform').TokenProcessor} processor Token processor. | ||
* @return {string|undefined} The path value. | ||
* @returns {string|undefined} The path value. | ||
*/ | ||
@@ -104,3 +104,3 @@ export function getMetaUrl(processor) { | ||
* @param {PluginOptions} options | ||
* @return An esbuild plugin. | ||
* @returns An esbuild plugin. | ||
*/ | ||
@@ -209,5 +209,12 @@ export default function({ emit = true } = {}) { | ||
const entryLoader = buildLoaders[path.extname(resolvedPath)] || 'file'; | ||
const entryPoint = emit ? | ||
(entryLoader !== 'file' && entryLoader !== 'json' ? await emitChunk({ entryPoint: resolvedPath }) : await emitFile(resolvedPath)).path : | ||
`./${path.relative(path.dirname(args.path), resolvedPath)}`; | ||
let entryPoint; | ||
if (emit) { | ||
if (entryLoader !== 'file' && entryLoader !== 'json') { | ||
entryPoint = (await emitChunk({ entryPoint: resolvedPath })).path; | ||
} else { | ||
entryPoint = appendSearchParam((await emitFile(resolvedPath)).path, 'emit', 'file'); | ||
} | ||
} else { | ||
entryPoint = `./${path.relative(path.dirname(args.path), resolvedPath)}`; | ||
} | ||
@@ -214,0 +221,0 @@ helpers.overwrite(startToken.start, endToken.end, `new URL('${entryPoint}', ${baseUrl})`); |
{ | ||
"name": "@chialab/esbuild-plugin-meta-url", | ||
"type": "module", | ||
"version": "0.15.23", | ||
"version": "0.15.28", | ||
"description": "A file loader plugin for esbuild for constructed URLs using import metadata.", | ||
@@ -37,5 +37,5 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"@chialab/esbuild-rna": "^0.15.23", | ||
"@chialab/estransform": "^0.15.17", | ||
"@chialab/node-resolve": "^0.15.9" | ||
"@chialab/esbuild-rna": "^0.15.28", | ||
"@chialab/estransform": "^0.15.28", | ||
"@chialab/node-resolve": "^0.15.28" | ||
}, | ||
@@ -46,3 +46,3 @@ "devDependencies": { | ||
}, | ||
"gitHead": "e7f2116569b07b6f81cddd17e489ffd8790b441a" | ||
"gitHead": "b6070e0cc98f6d8b7b4a8a59b9d88ee9364aebb1" | ||
} |
@@ -36,3 +36,2 @@ <p align="center"> | ||
import esbuild from 'esbuild'; | ||
import transfrom from '@chialab/esbuild-plugin-transform'; | ||
import metaUrlPlugin from '@chialab/esbuild-plugin-meta-url'; | ||
@@ -42,5 +41,3 @@ | ||
plugins: [ | ||
transfrom([ | ||
metaUrlPlugin(), | ||
]), | ||
metaUrlPlugin(), | ||
], | ||
@@ -47,0 +44,0 @@ }); |
/** | ||
* @param {import('@chialab/estransform').TokenProcessor} processor Token processor. | ||
* @return {string|undefined} The path value. | ||
* @returns {string|undefined} The path value. | ||
*/ | ||
@@ -13,3 +13,3 @@ export function getMetaUrl(processor: any): string | undefined; | ||
* @param {PluginOptions} options | ||
* @return An esbuild plugin. | ||
* @returns An esbuild plugin. | ||
*/ | ||
@@ -16,0 +16,0 @@ export default function _default({ emit }?: PluginOptions): import("esbuild").Plugin; |
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
13349
228
50