@parcel/runtime-js
Advanced tools
Comparing version 2.0.0-canary.1766 to 2.0.0-canary.1768
@@ -190,5 +190,17 @@ "use strict"; | ||
let mainAsset = mainBundle.getEntryAssets().find(e => e.id === bundleGroup.entryAssetId); | ||
if (dependency.specifierType === 'url' || mainBundle.type !== 'js' || (mainAsset === null || mainAsset === void 0 ? void 0 : mainAsset.meta.jsRuntime) === 'url') { | ||
if (dependency.specifierType === 'url' || (mainAsset === null || mainAsset === void 0 ? void 0 : mainAsset.meta.jsRuntime) === 'url') { | ||
assets.push(getURLRuntime(dependency, bundle, mainBundle, options)); | ||
continue; | ||
} | ||
if (mainBundle.type === 'node' && mainBundle.env.isNode()) { | ||
let relativePathExpr = getAbsoluteUrlExpr(getRelativePathExpr(bundle, mainBundle, options), mainBundle); | ||
assets.push({ | ||
filePath: __filename, | ||
code: `module.exports = require('./helpers/node/node-loader.js')(${relativePathExpr});`, | ||
dependency, | ||
env: { | ||
sourceType: 'module' | ||
} | ||
}); | ||
} | ||
} | ||
@@ -504,3 +516,3 @@ | ||
function getAbsoluteUrlExpr(relativePathExpr, bundle) { | ||
if (bundle.env.outputFormat === 'esmodule' && bundle.env.supports('import-meta-url') || bundle.env.outputFormat === 'commonjs') { | ||
if (bundle.env.outputFormat === 'esmodule' && bundle.env.supports('import-meta-url') || bundle.env.outputFormat === 'commonjs' || bundle.env.isNode()) { | ||
// This will be compiled to new URL(url, import.meta.url) or new URL(url, 'file:' + __filename). | ||
@@ -507,0 +519,0 @@ return `new __parcel__URL__(${relativePathExpr}).toString()`; |
{ | ||
"name": "@parcel/runtime-js", | ||
"version": "2.0.0-canary.1766+3d91d155a", | ||
"version": "2.0.0-canary.1768+4f3bcaaef", | ||
"license": "MIT", | ||
@@ -20,11 +20,11 @@ "publishConfig": { | ||
"node": ">= 16.0.0", | ||
"parcel": "^2.0.0-canary.1764+3d91d155a" | ||
"parcel": "^2.0.0-canary.1766+4f3bcaaef" | ||
}, | ||
"dependencies": { | ||
"@parcel/diagnostic": "2.0.0-canary.1766+3d91d155a", | ||
"@parcel/plugin": "2.0.0-canary.1766+3d91d155a", | ||
"@parcel/utils": "2.0.0-canary.1766+3d91d155a", | ||
"@parcel/diagnostic": "2.0.0-canary.1768+4f3bcaaef", | ||
"@parcel/plugin": "2.0.0-canary.1768+4f3bcaaef", | ||
"@parcel/utils": "2.0.0-canary.1768+4f3bcaaef", | ||
"nullthrows": "^1.1.1" | ||
}, | ||
"gitHead": "3d91d155a53e5195a6bc0e4f02c9c916ac2357e4" | ||
"gitHead": "4f3bcaaef1b8af1e8b2a0c932738713d788285e3" | ||
} |
@@ -196,7 +196,20 @@ // @flow strict-local | ||
dependency.specifierType === 'url' || | ||
mainBundle.type !== 'js' || | ||
mainAsset?.meta.jsRuntime === 'url' | ||
) { | ||
assets.push(getURLRuntime(dependency, bundle, mainBundle, options)); | ||
continue; | ||
} | ||
if (mainBundle.type === 'node' && mainBundle.env.isNode()) { | ||
let relativePathExpr = getAbsoluteUrlExpr( | ||
getRelativePathExpr(bundle, mainBundle, options), | ||
mainBundle, | ||
); | ||
assets.push({ | ||
filePath: __filename, | ||
code: `module.exports = require('./helpers/node/node-loader.js')(${relativePathExpr});`, | ||
dependency, | ||
env: {sourceType: 'module'}, | ||
}); | ||
} | ||
} | ||
@@ -659,3 +672,4 @@ | ||
bundle.env.supports('import-meta-url')) || | ||
bundle.env.outputFormat === 'commonjs' | ||
bundle.env.outputFormat === 'commonjs' || | ||
bundle.env.isNode() | ||
) { | ||
@@ -662,0 +676,0 @@ // This will be compiled to new URL(url, import.meta.url) or new URL(url, 'file:' + __filename). |
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
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
Debug access
Supply chain riskUses debug, reflection and dynamic code execution features.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
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
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
76739
46
1896
10