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

@parcel/runtime-js

Package Overview
Dependencies
Maintainers
0
Versions
895
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@parcel/runtime-js - npm Package Compare versions

Comparing version 2.0.0-canary.1766 to 2.0.0-canary.1768

lib/helpers/node/node-loader.js

16

lib/JSRuntime.js

@@ -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()`;

12

package.json
{
"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).

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