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

@parcel/packager-js

Package Overview
Dependencies
Maintainers
1
Versions
896
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@parcel/packager-js - npm Package Compare versions

Comparing version 2.0.0-nightly.151 to 2.0.0-nightly.155

60

lib/JSPackager.js

@@ -89,3 +89,4 @@ "use strict";

let map = new _sourceMap.default();
let lineOffset = (0, _utils.countLines)(PRELUDE);
let prefix = getPrefix(bundle, bundleGraph);
let lineOffset = (0, _utils.countLines)(prefix);
let stubsWritten = new Set();

@@ -96,3 +97,3 @@ bundle.traverse(node => {

if (node.type === 'dependency') {
let resolved = bundleGraph.getDependencyResolution(node.value);
let resolved = bundleGraph.getDependencyResolution(node.value, bundle);

@@ -116,3 +117,3 @@ if (resolved && resolved.type !== 'js' && !stubsWritten.has(resolved.id)) {

for (let dep of dependencies) {
let resolved = bundleGraph.getDependencyResolution(dep);
let resolved = bundleGraph.getDependencyResolution(dep, bundle);

@@ -144,10 +145,4 @@ if (resolved) {

let entries = bundle.getEntryAssets();
let interpreter = null;
let isEntry = !bundleGraph.hasParentBundleOfType(bundle, 'js') || bundle.env.isIsolated();
if (isEntry) {
let entryAsset = entries[entries.length - 1]; // $FlowFixMe
interpreter = bundle.target.env.isBrowser() ? null : entryAsset.meta.interpreter;
} else if (bundle.env.outputFormat === 'global') {
if (!isEntry(bundle, bundleGraph) && bundle.env.outputFormat === 'global') {
// The last entry is the main entry, but in async bundles we don't want it to execute until we require it

@@ -158,16 +153,4 @@ // as there might be dependencies in a sibling bundle that hasn't loaded yet.

let importScripts = '';
if (bundle.env.isWorker()) {
let bundles = bundleGraph.getSiblingBundles(bundle);
for (let b of bundles) {
importScripts += `importScripts("${(0, _utils.relativeBundlePath)(bundle, b)}");\n`;
}
}
let sourceMapReference = await getSourceMapReference(map);
return replaceReferences({
contents: // If the entry asset included a hashbang, repeat it at the top of the bundle
(interpreter != null ? `#!${interpreter}\n` : '') + importScripts + (PRELUDE + '({' + assets + '},{},' + JSON.stringify(entries.map(asset => asset.id)) + ', ' + 'null' + ')\n\n' + '//# sourceMappingURL=' + sourceMapReference + '\n'),
contents: prefix + '({' + assets + '},{},' + JSON.stringify(entries.map(asset => asset.id)) + ', ' + 'null' + ')' + '\n\n' + '//# sourceMappingURL=' + (await getSourceMapReference(map)) + '\n',
map

@@ -179,2 +162,31 @@ });

exports.default = _default;
exports.default = _default;
function getPrefix(bundle, bundleGraph) {
let interpreter = null;
if (isEntry(bundle, bundleGraph)) {
let entries = bundle.getEntryAssets();
let entryAsset = entries[entries.length - 1]; // $FlowFixMe
interpreter = bundle.target.env.isBrowser() ? null : entryAsset.meta.interpreter;
}
let importScripts = '';
if (bundle.env.isWorker()) {
let bundles = bundleGraph.getSiblingBundles(bundle);
for (let b of bundles) {
importScripts += `importScripts("${(0, _utils.relativeBundlePath)(bundle, b)}");\n`;
}
}
return (// If the entry asset included a hashbang, repeat it at the top of the bundle
(interpreter != null ? `#!${interpreter}\n` : '') + importScripts + PRELUDE
);
}
function isEntry(bundle, bundleGraph) {
return !bundleGraph.hasParentBundleOfType(bundle, 'js') || bundle.env.isIsolated();
}

12

package.json
{
"name": "@parcel/packager-js",
"version": "2.0.0-nightly.151+1af603e1",
"version": "2.0.0-nightly.155+9007d6ac",
"license": "MIT",

@@ -19,8 +19,8 @@ "publishConfig": {

"dependencies": {
"@parcel/plugin": "2.0.0-nightly.151+1af603e1",
"@parcel/scope-hoisting": "2.0.0-nightly.151+1af603e1",
"@parcel/source-map": "2.0.0-nightly.151+1af603e1",
"@parcel/utils": "2.0.0-nightly.151+1af603e1"
"@parcel/plugin": "2.0.0-nightly.155+9007d6ac",
"@parcel/scope-hoisting": "2.0.0-nightly.155+9007d6ac",
"@parcel/source-map": "2.0.0-nightly.155+9007d6ac",
"@parcel/utils": "2.0.0-nightly.155+9007d6ac"
},
"gitHead": "1af603e1cfab014585ded8aec4d3dcdb7e685987"
"gitHead": "9007d6ac51a44cca44ff216ee103baca76be5504"
}
// @flow strict-local
import type {Bundle, BundleGraph} from '@parcel/types';
import invariant from 'assert';

@@ -76,4 +78,6 @@ import {Packager} from '@parcel/plugin';

let map = new SourceMap();
let lineOffset = countLines(PRELUDE);
let prefix = getPrefix(bundle, bundleGraph);
let lineOffset = countLines(prefix);
let stubsWritten = new Set();

@@ -84,3 +88,3 @@ bundle.traverse(node => {

if (node.type === 'dependency') {
let resolved = bundleGraph.getDependencyResolution(node.value);
let resolved = bundleGraph.getDependencyResolution(node.value, bundle);
if (

@@ -110,3 +114,3 @@ resolved &&

for (let dep of dependencies) {
let resolved = bundleGraph.getDependencyResolution(dep);
let resolved = bundleGraph.getDependencyResolution(dep, bundle);
if (resolved) {

@@ -147,14 +151,3 @@ deps[dep.moduleSpecifier] = resolved.id;

let entries = bundle.getEntryAssets();
let interpreter: ?string = null;
let isEntry =
!bundleGraph.hasParentBundleOfType(bundle, 'js') ||
bundle.env.isIsolated();
if (isEntry) {
let entryAsset = entries[entries.length - 1];
// $FlowFixMe
interpreter = bundle.target.env.isBrowser()
? null
: entryAsset.meta.interpreter;
} else if (bundle.env.outputFormat === 'global') {
if (!isEntry(bundle, bundleGraph) && bundle.env.outputFormat === 'global') {
// The last entry is the main entry, but in async bundles we don't want it to execute until we require it

@@ -165,28 +158,16 @@ // as there might be dependencies in a sibling bundle that hasn't loaded yet.

let importScripts = '';
if (bundle.env.isWorker()) {
let bundles = bundleGraph.getSiblingBundles(bundle);
for (let b of bundles) {
importScripts += `importScripts("${relativeBundlePath(bundle, b)}");\n`;
}
}
let sourceMapReference = await getSourceMapReference(map);
return replaceReferences({
contents:
// If the entry asset included a hashbang, repeat it at the top of the bundle
(interpreter != null ? `#!${interpreter}\n` : '') +
importScripts +
(PRELUDE +
'({' +
assets +
'},{},' +
JSON.stringify(entries.map(asset => asset.id)) +
', ' +
'null' +
')\n\n' +
'//# sourceMappingURL=' +
sourceMapReference +
'\n'),
prefix +
'({' +
assets +
'},{},' +
JSON.stringify(entries.map(asset => asset.id)) +
', ' +
'null' +
')' +
'\n\n' +
'//# sourceMappingURL=' +
(await getSourceMapReference(map)) +
'\n',
map,

@@ -196,1 +177,32 @@ });

});
function getPrefix(bundle: Bundle, bundleGraph: BundleGraph): string {
let interpreter: ?string = null;
if (isEntry(bundle, bundleGraph)) {
let entries = bundle.getEntryAssets();
let entryAsset = entries[entries.length - 1];
// $FlowFixMe
interpreter = bundle.target.env.isBrowser()
? null
: entryAsset.meta.interpreter;
}
let importScripts = '';
if (bundle.env.isWorker()) {
let bundles = bundleGraph.getSiblingBundles(bundle);
for (let b of bundles) {
importScripts += `importScripts("${relativeBundlePath(bundle, b)}");\n`;
}
}
return (
// If the entry asset included a hashbang, repeat it at the top of the bundle
(interpreter != null ? `#!${interpreter}\n` : '') + importScripts + PRELUDE
);
}
function isEntry(bundle: Bundle, bundleGraph: BundleGraph): boolean {
return (
!bundleGraph.hasParentBundleOfType(bundle, 'js') || bundle.env.isIsolated()
);
}
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