@chialab/esbuild-plugin-meta-url
Advanced tools
Comparing version 0.18.1 to 0.18.2
@@ -7,6 +7,26 @@ import { Buffer } from 'buffer'; | ||
import { getBlock, getIdentifierValue, getLocation, parse, TokenType, walk } from '@chialab/estransform'; | ||
import { getSearchParam, isUrl } from '@chialab/node-resolve'; | ||
import mime from 'mime-types'; | ||
/** | ||
* Check if the given path is a valid url. | ||
* @param {string} url | ||
*/ | ||
function isUrl(url) { | ||
try { | ||
return !!new URL(url); | ||
} catch (err) { | ||
// | ||
} | ||
return false; | ||
} | ||
/** | ||
* Get hash param (if available) in the url. | ||
* @param {string} source | ||
*/ | ||
export function getHashParam(source) { | ||
return new URLSearchParams(source.split('?').slice(1).join('?')).get('hash') || null; | ||
} | ||
/** | ||
* @param {import('@chialab/estransform').TokenProcessor} processor Token processor. | ||
@@ -165,3 +185,3 @@ * @returns {string|undefined} The path value. | ||
const id = getSearchParam(value, 'hash'); | ||
const id = getHashParam(value); | ||
if (id && build.isEmittedPath(id)) { | ||
@@ -168,0 +188,0 @@ return; |
{ | ||
"name": "@chialab/esbuild-plugin-meta-url", | ||
"type": "module", | ||
"version": "0.18.1", | ||
"version": "0.18.2", | ||
"description": "A file loader plugin for esbuild for constructed URLs using import metadata.", | ||
@@ -34,4 +34,3 @@ "main": "lib/index.js", | ||
"@chialab/esbuild-rna": "^0.18.1", | ||
"@chialab/estransform": "^0.18.0", | ||
"@chialab/node-resolve": "^0.18.0", | ||
"@chialab/estransform": "^0.18.1", | ||
"mime-types": "^2.1.35" | ||
@@ -38,0 +37,0 @@ }, |
/** | ||
* Get hash param (if available) in the url. | ||
* @param {string} source | ||
*/ | ||
export function getHashParam(source: string): string | null; | ||
/** | ||
* @param {import('@chialab/estransform').TokenProcessor} processor Token processor. | ||
* @returns {string|undefined} The path value. | ||
*/ | ||
export function getMetaUrl(processor: any): string | undefined; | ||
export function getMetaUrl(processor: import("sucrase/dist/types/TokenProcessor").default): string | undefined; | ||
/** | ||
@@ -7,0 +12,0 @@ * @typedef {{ emit?: boolean }} PluginOptions |
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
16746
3
320
- Removed@chialab/node-resolve@^0.18.0
Updated@chialab/estransform@^0.18.1