New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@parcel/scope-hoisting

Package Overview
Dependencies
Maintainers
1
Versions
293
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@parcel/scope-hoisting - npm Package Compare versions

Comparing version 2.0.0-nightly.203 to 2.0.0-nightly.205

6

lib/formats/global.js

@@ -28,2 +28,4 @@ "use strict";

const EXPORT_FN_TEMPLATE = _template.default.statement('parcelRequire.register(ASSET_ID, function() { return IDENTIFIER; })');
const IMPORTSCRIPTS_TEMPLATE = _template.default.statement('importScripts(BUNDLE);');

@@ -72,3 +74,5 @@

exported.add(exportsId);
statements.push(EXPORT_TEMPLATE({
statements.push( // Export a function returning the exports, as other cases of global output
// register init functions.
EXPORT_FN_TEMPLATE({
ASSET_ID: t.stringLiteral(entry.id),

@@ -75,0 +79,0 @@ IDENTIFIER: t.identifier((0, _utils2.assertString)(entry.meta.exportsIdentifier))

24

lib/link.js

@@ -590,18 +590,18 @@ "use strict";

if (imports.length > 0) {
if (imports.length > 0 || referencedAssets.size > 0) {
// Add import statements and update scope to collect references
path.unshiftContainer('body', imports);
path.unshiftContainer('body', imports); // Insert fake init functions that will be imported in other bundles,
// because `asset.meta.shouldWrap` isn't set in a packager if `asset` is
// not in the current bundle:
path.pushContainer('body', [...referencedAssets].filter(a => !a.meta.shouldWrap).map(a => {
return FAKE_INIT_TEMPLATE({
INIT: (0, _utils.getIdentifier)(a, 'init'),
EXPORTS: t.identifier((0, _utils.assertString)(a.meta.exportsIdentifier))
});
}));
path.scope.crawl();
} // Insert fake init functions that will be imported in other bundles,
// because `asset.meta.shouldWrap` isn't set in a packager if `asset` is
// not in the current bundle:
} // Generate exports
path.pushContainer('body', [...referencedAssets].filter(a => !a.meta.shouldWrap).map(a => {
return FAKE_INIT_TEMPLATE({
INIT: (0, _utils.getIdentifier)(a, 'init'),
EXPORTS: t.identifier((0, _utils.assertString)(a.meta.exportsIdentifier))
});
})); // Generate exports
let exported = format.generateExports(bundleGraph, bundle, referencedAssets, path, replacements, options);

@@ -608,0 +608,0 @@ (0, _shake.default)(path.scope, exported);

@@ -44,3 +44,8 @@ "use strict";

return isEntry(bundle, bundleGraph) && (hasAsyncDescendant(bundle, bundleGraph) || isReferenced(bundle, bundleGraph));
return isEntry(bundle, bundleGraph) && ( // If this bundle has an async descendant, it will use the JSRuntime,
// which uses parcelRequire. It's also possible that the descendant needs
// to register exports for its own descendants.
hasAsyncDescendant(bundle, bundleGraph) || // If an asset in this bundle is referenced, this bundle will use
//`parcelRequire.register` to register the asset.
isReferenced(bundle, bundleGraph));
}

@@ -47,0 +52,0 @@

{
"name": "@parcel/scope-hoisting",
"version": "2.0.0-nightly.203+f6d2a707",
"version": "2.0.0-nightly.205+68b5050a",
"description": "Blazing fast, zero configuration web application bundler",

@@ -24,9 +24,9 @@ "license": "MIT",

"@babel/types": "^7.3.3",
"@parcel/babylon-walk": "2.0.0-nightly.1825+f6d2a707",
"@parcel/diagnostic": "2.0.0-nightly.203+f6d2a707",
"@parcel/babylon-walk": "2.0.0-nightly.1827+68b5050a",
"@parcel/diagnostic": "2.0.0-nightly.205+68b5050a",
"@parcel/source-map": "^2.0.0-alpha.4.6",
"@parcel/utils": "2.0.0-nightly.203+f6d2a707",
"@parcel/utils": "2.0.0-nightly.205+68b5050a",
"nullthrows": "^1.1.1"
},
"gitHead": "f6d2a707c932032c39064cf53dd74b2b687e310e"
"gitHead": "68b5050ae0e84c4a65ebdc2e57415c1ed0ceacd2"
}

@@ -32,2 +32,6 @@ // @flow

>('parcelRequire.register(ASSET_ID, IDENTIFIER)');
const EXPORT_FN_TEMPLATE = template.statement<
{|IDENTIFIER: Identifier, ASSET_ID: StringLiteral|},
Statement,
>('parcelRequire.register(ASSET_ID, function() { return IDENTIFIER; })');
const IMPORTSCRIPTS_TEMPLATE = template.statement<

@@ -101,3 +105,5 @@ {|BUNDLE: StringLiteral|},

statements.push(
EXPORT_TEMPLATE({
// Export a function returning the exports, as other cases of global output
// register init functions.
EXPORT_FN_TEMPLATE({
ASSET_ID: t.stringLiteral(entry.id),

@@ -104,0 +110,0 @@ IDENTIFIER: t.identifier(assertString(entry.meta.exportsIdentifier)),

@@ -635,23 +635,24 @@ // @flow

if (imports.length > 0) {
if (imports.length > 0 || referencedAssets.size > 0) {
// Add import statements and update scope to collect references
path.unshiftContainer('body', imports);
// Insert fake init functions that will be imported in other bundles,
// because `asset.meta.shouldWrap` isn't set in a packager if `asset` is
// not in the current bundle:
path.pushContainer(
'body',
[...referencedAssets]
.filter(a => !a.meta.shouldWrap)
.map(a => {
return FAKE_INIT_TEMPLATE({
INIT: getIdentifier(a, 'init'),
EXPORTS: t.identifier(assertString(a.meta.exportsIdentifier)),
});
}),
);
path.scope.crawl();
}
// Insert fake init functions that will be imported in other bundles,
// because `asset.meta.shouldWrap` isn't set in a packager if `asset` is
// not in the current bundle:
path.pushContainer(
'body',
[...referencedAssets]
.filter(a => !a.meta.shouldWrap)
.map(a => {
return FAKE_INIT_TEMPLATE({
INIT: getIdentifier(a, 'init'),
EXPORTS: t.identifier(assertString(a.meta.exportsIdentifier)),
});
}),
);
// Generate exports

@@ -658,0 +659,0 @@ let exported = format.generateExports(

@@ -48,3 +48,8 @@ // @flow

isEntry(bundle, bundleGraph) &&
// If this bundle has an async descendant, it will use the JSRuntime,
// which uses parcelRequire. It's also possible that the descendant needs
// to register exports for its own descendants.
(hasAsyncDescendant(bundle, bundleGraph) ||
// If an asset in this bundle is referenced, this bundle will use
//`parcelRequire.register` to register the asset.
isReferenced(bundle, bundleGraph))

@@ -51,0 +56,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