@parcel/core
Advanced tools
Comparing version 2.0.0-nightly.118 to 2.0.0-nightly.119
@@ -26,2 +26,4 @@ "use strict"; | ||
var _constants = require("./constants"); | ||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; } | ||
@@ -41,2 +43,3 @@ | ||
let connections = []; | ||
let bundleReferences = []; | ||
@@ -66,2 +69,4 @@ for (let bundle of bundleGraph.getBundles()) { | ||
} of runtimeAssets) { | ||
var _code$match; | ||
let assetRequest = { | ||
@@ -78,2 +83,10 @@ code, | ||
}); | ||
let hashRefs = (_code$match = code.match(_constants.HASH_REF_REGEX)) !== null && _code$match !== void 0 ? _code$match : []; | ||
for (let hashRef of hashRefs) { | ||
bundleReferences.push({ | ||
from: bundle.id, | ||
to: hashRef.slice(_constants.HASH_REF_PREFIX.length) | ||
}); | ||
} | ||
} | ||
@@ -141,2 +154,9 @@ } | ||
} | ||
for (let { | ||
from, | ||
to | ||
} of bundleReferences) { | ||
bundleGraph._graph.addEdge(from, to, 'references'); | ||
} | ||
} | ||
@@ -143,0 +163,0 @@ |
@@ -483,7 +483,12 @@ "use strict"; | ||
this.traverseBundles((childBundle, ctx, traversal) => { | ||
if (childBundle.id === bundle.id || childBundle.isInline) { | ||
if (childBundle.id === bundle.id || (ctx === null || ctx === void 0 ? void 0 : ctx.parentBundle) === bundle.id && childBundle.isInline) { | ||
hash.update(this.getContentHash(childBundle)); | ||
} else { | ||
hash.update(childBundle.id); | ||
traversal.skipChildren(); | ||
} | ||
return { | ||
parentBundle: childBundle.id | ||
}; | ||
}, bundle); | ||
@@ -490,0 +495,0 @@ hash.update(JSON.stringify((0, _utils.objectSortedEntriesDeep)(bundle.env))); |
@@ -6,3 +6,3 @@ "use strict"; | ||
}); | ||
exports.HASH_REF_PREFIX = exports.PARCEL_VERSION = void 0; | ||
exports.HASH_REF_REGEX = exports.HASH_REF_PREFIX = exports.PARCEL_VERSION = void 0; | ||
@@ -15,2 +15,4 @@ var _package = require("../package.json"); | ||
const HASH_REF_PREFIX = 'HASH_REF_'; | ||
exports.HASH_REF_PREFIX = HASH_REF_PREFIX; | ||
exports.HASH_REF_PREFIX = HASH_REF_PREFIX; | ||
const HASH_REF_REGEX = new RegExp(`${HASH_REF_PREFIX}\\w{32}`, 'g'); | ||
exports.HASH_REF_REGEX = HASH_REF_REGEX; |
@@ -41,3 +41,2 @@ "use strict"; | ||
const BOUNDARY_LENGTH = _constants.HASH_REF_PREFIX.length + 32 - 1; | ||
const HASH_REF_REGEX = new RegExp(`${_constants.HASH_REF_PREFIX}\\w{32}`, 'g'); | ||
@@ -378,3 +377,3 @@ class PackagerRunner { | ||
let str = boundaryStr + buf.toString(); | ||
hashReferences = hashReferences.concat((_str$match = str.match(HASH_REF_REGEX)) !== null && _str$match !== void 0 ? _str$match : []); | ||
hashReferences = hashReferences.concat((_str$match = str.match(_constants.HASH_REF_REGEX)) !== null && _str$match !== void 0 ? _str$match : []); | ||
size += buf.length; | ||
@@ -416,3 +415,3 @@ hash.update(buf); | ||
let str = boundaryStr + chunk.toString(); | ||
let replaced = str.replace(HASH_REF_REGEX, match => { | ||
let replaced = str.replace(_constants.HASH_REF_REGEX, match => { | ||
return hashRefToNameHash.get(match) || match; | ||
@@ -419,0 +418,0 @@ }); |
{ | ||
"name": "@parcel/core", | ||
"version": "2.0.0-nightly.118+cf6c31c7", | ||
"version": "2.0.0-nightly.119+8dc29d37", | ||
"license": "MIT", | ||
@@ -19,13 +19,13 @@ "publishConfig": { | ||
"dependencies": { | ||
"@parcel/cache": "2.0.0-nightly.120+cf6c31c7", | ||
"@parcel/diagnostic": "2.0.0-nightly.120+cf6c31c7", | ||
"@parcel/events": "2.0.0-nightly.120+cf6c31c7", | ||
"@parcel/fs": "2.0.0-nightly.120+cf6c31c7", | ||
"@parcel/logger": "2.0.0-nightly.120+cf6c31c7", | ||
"@parcel/package-manager": "2.0.0-nightly.120+cf6c31c7", | ||
"@parcel/plugin": "2.0.0-nightly.120+cf6c31c7", | ||
"@parcel/source-map": "2.0.0-nightly.120+cf6c31c7", | ||
"@parcel/types": "2.0.0-nightly.120+cf6c31c7", | ||
"@parcel/utils": "2.0.0-nightly.120+cf6c31c7", | ||
"@parcel/workers": "2.0.0-nightly.120+cf6c31c7", | ||
"@parcel/cache": "2.0.0-nightly.121+8dc29d37", | ||
"@parcel/diagnostic": "2.0.0-nightly.121+8dc29d37", | ||
"@parcel/events": "2.0.0-nightly.121+8dc29d37", | ||
"@parcel/fs": "2.0.0-nightly.121+8dc29d37", | ||
"@parcel/logger": "2.0.0-nightly.121+8dc29d37", | ||
"@parcel/package-manager": "2.0.0-nightly.121+8dc29d37", | ||
"@parcel/plugin": "2.0.0-nightly.121+8dc29d37", | ||
"@parcel/source-map": "2.0.0-nightly.121+8dc29d37", | ||
"@parcel/types": "2.0.0-nightly.121+8dc29d37", | ||
"@parcel/utils": "2.0.0-nightly.121+8dc29d37", | ||
"@parcel/workers": "2.0.0-nightly.121+8dc29d37", | ||
"abortcontroller-polyfill": "^1.1.9", | ||
@@ -46,3 +46,3 @@ "browserslist": "^4.6.6", | ||
}, | ||
"gitHead": "cf6c31c7b35c67e0e23bd334d62aca375c18d712" | ||
"gitHead": "8dc29d37664b24556ce0d2e91771b2ce30ae3f69" | ||
} |
@@ -24,2 +24,3 @@ // @flow strict-local | ||
import ThrowableDiagnostic, {errorToDiagnostic} from '@parcel/diagnostic'; | ||
import {HASH_REF_PREFIX, HASH_REF_REGEX} from './constants'; | ||
@@ -47,2 +48,3 @@ type RuntimeConnection = {| | ||
let connections: Array<RuntimeConnection> = []; | ||
let bundleReferences = []; | ||
@@ -74,2 +76,9 @@ for (let bundle of bundleGraph.getBundles()) { | ||
}); | ||
let hashRefs = code.match(HASH_REF_REGEX) ?? []; | ||
for (let hashRef of hashRefs) { | ||
bundleReferences.push({ | ||
from: bundle.id, | ||
to: hashRef.slice(HASH_REF_PREFIX.length), | ||
}); | ||
} | ||
} | ||
@@ -146,2 +155,6 @@ } | ||
} | ||
for (let {from, to} of bundleReferences) { | ||
bundleGraph._graph.addEdge(from, to, 'references'); | ||
} | ||
} | ||
@@ -148,0 +161,0 @@ |
@@ -580,7 +580,12 @@ // @flow strict-local | ||
this.traverseBundles((childBundle, ctx, traversal) => { | ||
if (childBundle.id === bundle.id || childBundle.isInline) { | ||
if ( | ||
childBundle.id === bundle.id || | ||
(ctx?.parentBundle === bundle.id && childBundle.isInline) | ||
) { | ||
hash.update(this.getContentHash(childBundle)); | ||
} else { | ||
hash.update(childBundle.id); | ||
traversal.skipChildren(); | ||
} | ||
return {parentBundle: childBundle.id}; | ||
}, bundle); | ||
@@ -587,0 +592,0 @@ |
@@ -8,1 +8,2 @@ // @flow strict-local | ||
export const HASH_REF_PREFIX = 'HASH_REF_'; | ||
export const HASH_REF_REGEX = new RegExp(`${HASH_REF_PREFIX}\\w{32}`, 'g'); |
@@ -36,3 +36,3 @@ // @flow strict-local | ||
import PluginOptions from './public/PluginOptions'; | ||
import {PARCEL_VERSION, HASH_REF_PREFIX} from './constants'; | ||
import {PARCEL_VERSION, HASH_REF_PREFIX, HASH_REF_REGEX} from './constants'; | ||
@@ -59,3 +59,2 @@ type Opts = {| | ||
const BOUNDARY_LENGTH = HASH_REF_PREFIX.length + 32 - 1; | ||
const HASH_REF_REGEX = new RegExp(`${HASH_REF_PREFIX}\\w{32}`, 'g'); | ||
@@ -62,0 +61,0 @@ export default class PackagerRunner { |
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
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
643025
18406