Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@chialab/esbuild-plugin-meta-url

Package Overview
Dependencies
Maintainers
2
Versions
114
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@chialab/esbuild-plugin-meta-url - npm Package Compare versions

Comparing version 0.17.6 to 0.17.7

19

lib/index.js
import path from 'path';
import mime from 'mime-types';
import { appendSearchParam, getSearchParam, isUrl } from '@chialab/node-resolve';
import { getSearchParam, isUrl } from '@chialab/node-resolve';
import { parse, walk, getIdentifierValue, getBlock, getLocation, TokenType } from '@chialab/estransform';

@@ -199,14 +199,15 @@ import { Build, useRna } from '@chialab/esbuild-rna';

const isIIFE = format === 'iife' && bundle;
const searchParams = new URLSearchParams();
let entryPoint;
let entryPoint = resolvedPath;
if (emit && !isIIFE) {
if (isChunk) {
const chunk = await build.emitChunk({ path: resolvedPath });
entryPoint = appendSearchParam(chunk.path, 'hash', chunk.id);
searchParams.set('hash', chunk.id);
entryPoint = chunk.path;
} else {
const file = await build.emitFile(resolvedPath);
entryPoint = appendSearchParam(file.path, 'hash', file.id);
searchParams.set('hash', file.id);
entryPoint = file.path;
}
} else {
entryPoint = path.relative(path.dirname(args.path), resolvedPath);
}

@@ -220,3 +221,3 @@

write: false,
});
}, false);
if (outputFiles) {

@@ -246,3 +247,5 @@ mimeType = mime.lookup(outputFiles[0].path);

helpers.overwrite(startToken.start, endToken.end, `new URL('./${entryPoint.split(path.sep).join('/')}', ${baseUrl})`);
const outputPath = build.resolveRelativePath(entryPoint);
const searchParamsString = searchParams.toString();
helpers.overwrite(startToken.start, endToken.end, `new URL('${outputPath}${searchParamsString ? `?${searchParamsString}` : ''}', ${baseUrl})`);
return;

@@ -249,0 +252,0 @@ }

{
"name": "@chialab/esbuild-plugin-meta-url",
"type": "module",
"version": "0.17.6",
"version": "0.17.7",
"description": "A file loader plugin for esbuild for constructed URLs using import metadata.",

@@ -33,5 +33,5 @@ "main": "lib/index.js",

"dependencies": {
"@chialab/esbuild-rna": "^0.17.6",
"@chialab/estransform": "^0.17.1",
"@chialab/node-resolve": "^0.17.0",
"@chialab/esbuild-rna": "^0.17.8",
"@chialab/estransform": "^0.17.4",
"@chialab/node-resolve": "^0.17.1",
"mime-types": "^2.1.35"

@@ -38,0 +38,0 @@ },

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc