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

@parcel/core

Package Overview
Dependencies
Maintainers
1
Versions
897
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@parcel/core - npm Package Compare versions

Comparing version 2.0.0-nightly.370 to 2.0.0-nightly.372

55

lib/AssetGraph.js

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

id: (0, _utils.md5FromObject)({ ...assetGroup,
// only influences building the asset graph
canDefer: undefined,
// if only the isURL property is different, no need to re-run transformation.

@@ -74,20 +76,30 @@ isURL: undefined

class AssetGraph extends _Graph.default {
constructor(...args) {
super(...args);
constructor(opts) {
if (opts) {
let {
hash,
...rest
} = opts;
super(rest);
_defineProperty(this, "onNodeRemoved", void 0);
_defineProperty(this, "onNodeRemoved", void 0);
_defineProperty(this, "hash", void 0);
}
_defineProperty(this, "hash", void 0);
// $FlowFixMe
static deserialize(opts) {
// $FlowFixMe Added in Flow 0.121.0 upgrade in #4381
let res = new AssetGraph(opts); // $FlowFixMe Added in Flow 0.121.0 upgrade in #4381
this.hash = hash;
} else {
super();
res.hash = opts.hash;
return res;
_defineProperty(this, "onNodeRemoved", void 0);
_defineProperty(this, "hash", void 0);
}
} // $FlowFixMe
static deserialize(opts) {
return new AssetGraph(opts);
} // $FlowFixMe
serialize() {

@@ -176,3 +188,11 @@ // $FlowFixMe Added in Flow 0.121.0 upgrade in #4381

this.replaceNodesConnectedTo(depNode, [nodeFromAssetGroup(assetGroup)]);
let assetGroupNode = nodeFromAssetGroup(assetGroup);
let existing = this.getNode(assetGroupNode.id);
if (existing) {
(0, _assert.default)(existing.type === 'asset_group');
assetGroupNode.value.canDefer = assetGroupNode.value.canDefer && existing.value.canDefer;
}
this.replaceNodesConnectedTo(depNode, [assetGroupNode]);
}

@@ -185,6 +205,9 @@

let sideEffects = childNode.value.sideEffects;
let {
sideEffects,
canDefer = true
} = childNode.value;
let dependency = node.value;
let previouslyDeferred = childNode.deferred;
let defer = this.shouldDeferDependency(dependency, sideEffects);
let defer = this.shouldDeferDependency(dependency, sideEffects, canDefer);
node.hasDeferred = defer;

@@ -244,6 +267,6 @@ childNode.deferred = defer;

shouldDeferDependency(dependency, sideEffects) {
shouldDeferDependency(dependency, sideEffects, canDefer) {
let defer = false;
if (dependency.isWeak && sideEffects === false && !dependency.symbols.has('*')) {
if (dependency.isWeak && sideEffects === false && canDefer && !dependency.symbols.has('*')) {
let depNode = this.getNode(dependency.id);

@@ -250,0 +273,0 @@ (0, _assert.default)(depNode);

@@ -187,2 +187,3 @@ "use strict";

return {
canDefer: result.canDefer,
filePath: result.filePath,

@@ -189,0 +190,0 @@ query,

@@ -86,2 +86,5 @@ "use strict";

type: 'boolean'
},
scopeHoist: {
type: 'boolean'
}

@@ -88,0 +91,0 @@ },

{
"name": "@parcel/core",
"version": "2.0.0-nightly.370+64ebc375",
"version": "2.0.0-nightly.372+94739964",
"license": "MIT",

@@ -23,13 +23,13 @@ "publishConfig": {

"dependencies": {
"@parcel/cache": "2.0.0-nightly.372+64ebc375",
"@parcel/diagnostic": "2.0.0-nightly.372+64ebc375",
"@parcel/events": "2.0.0-nightly.372+64ebc375",
"@parcel/fs": "2.0.0-nightly.372+64ebc375",
"@parcel/logger": "2.0.0-nightly.372+64ebc375",
"@parcel/package-manager": "2.0.0-nightly.372+64ebc375",
"@parcel/plugin": "2.0.0-nightly.372+64ebc375",
"@parcel/cache": "2.0.0-nightly.374+94739964",
"@parcel/diagnostic": "2.0.0-nightly.374+94739964",
"@parcel/events": "2.0.0-nightly.374+94739964",
"@parcel/fs": "2.0.0-nightly.374+94739964",
"@parcel/logger": "2.0.0-nightly.374+94739964",
"@parcel/package-manager": "2.0.0-nightly.374+94739964",
"@parcel/plugin": "2.0.0-nightly.374+94739964",
"@parcel/source-map": "2.0.0-alpha.4.13",
"@parcel/types": "2.0.0-nightly.372+64ebc375",
"@parcel/utils": "2.0.0-nightly.372+64ebc375",
"@parcel/workers": "2.0.0-nightly.372+64ebc375",
"@parcel/types": "2.0.0-nightly.374+94739964",
"@parcel/utils": "2.0.0-nightly.374+94739964",
"@parcel/workers": "2.0.0-nightly.374+94739964",
"abortcontroller-polyfill": "^1.1.9",

@@ -52,3 +52,3 @@ "base-x": "^3.0.8",

},
"gitHead": "64ebc3757a7c36432d55ee4d791e96e30dab242f"
"gitHead": "947399643bd37b2dd91b8606d7fd3204cbd8b43e"
}

@@ -38,3 +38,3 @@ // @flow strict-local

...GraphOpts<AssetGraphNode>,
hash: ?string,
hash?: ?string,
|};

@@ -54,2 +54,4 @@

...assetGroup,
// only influences building the asset graph
canDefer: undefined,
// if only the isURL property is different, no need to re-run transformation.

@@ -91,9 +93,15 @@ isURL: undefined,

constructor(opts: ?SerializedAssetGraph) {
if (opts) {
let {hash, ...rest} = opts;
super(rest);
this.hash = hash;
} else {
super();
}
}
// $FlowFixMe
static deserialize(opts: SerializedAssetGraph): AssetGraph {
// $FlowFixMe Added in Flow 0.121.0 upgrade in #4381
let res = new AssetGraph(opts);
// $FlowFixMe Added in Flow 0.121.0 upgrade in #4381
res.hash = opts.hash;
return res;
return new AssetGraph(opts);
}

@@ -196,3 +204,11 @@

this.replaceNodesConnectedTo(depNode, [nodeFromAssetGroup(assetGroup)]);
let assetGroupNode = nodeFromAssetGroup(assetGroup);
let existing = this.getNode(assetGroupNode.id);
if (existing) {
invariant(existing.type === 'asset_group');
assetGroupNode.value.canDefer =
assetGroupNode.value.canDefer && existing.value.canDefer;
}
this.replaceNodesConnectedTo(depNode, [assetGroupNode]);
}

@@ -209,6 +225,6 @@

let sideEffects = childNode.value.sideEffects;
let {sideEffects, canDefer = true} = childNode.value;
let dependency = node.value;
let previouslyDeferred = childNode.deferred;
let defer = this.shouldDeferDependency(dependency, sideEffects);
let defer = this.shouldDeferDependency(dependency, sideEffects, canDefer);
node.hasDeferred = defer;

@@ -268,2 +284,3 @@ childNode.deferred = defer;

sideEffects: ?boolean,
canDefer: boolean,
): boolean {

@@ -274,2 +291,3 @@ let defer = false;

sideEffects === false &&
canDefer &&
!dependency.symbols.has('*')

@@ -276,0 +294,0 @@ ) {

@@ -186,2 +186,3 @@ // @flow strict-local

return {
canDefer: result.canDefer,
filePath: result.filePath,

@@ -188,0 +189,0 @@ query,

@@ -100,2 +100,5 @@ // @flow strict-local

},
scopeHoist: {
type: 'boolean',
},
},

@@ -102,0 +105,0 @@ additionalProperties: false,

@@ -209,2 +209,3 @@ // @flow strict-local

isSource?: boolean,
canDefer?: boolean,
sideEffects?: boolean,

@@ -211,0 +212,0 @@ code?: string,

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