@parcel/utils
Advanced tools
Comparing version 2.0.0-nightly.201 to 2.0.0-nightly.203
@@ -9,2 +9,4 @@ "use strict"; | ||
var _assert = _interopRequireDefault(require("assert")); | ||
var _stream = require("stream"); | ||
@@ -35,4 +37,10 @@ | ||
let replacements = new Map(); | ||
let urlDependencies = []; | ||
bundle.traverse(node => { | ||
if (node.type === 'dependency' && node.value.isURL) { | ||
urlDependencies.push(node.value); | ||
} | ||
}); | ||
for (let dependency of bundleGraph.getExternalDependencies(bundle)) { | ||
for (let dependency of urlDependencies) { | ||
if (!dependency.isURL) { | ||
@@ -42,5 +50,5 @@ continue; | ||
let bundleGroup = bundleGraph.resolveExternalDependency(dependency); | ||
let resolved = bundleGraph.resolveExternalDependency(dependency, bundle); | ||
if (bundleGroup == null) { | ||
if (resolved == null) { | ||
replacements.set(dependency.id, { | ||
@@ -53,3 +61,4 @@ from: dependency.id, | ||
let [entryBundle] = bundleGraph.getBundlesInBundleGroup(bundleGroup); | ||
(0, _assert.default)(resolved.type === 'bundle_group'); | ||
let [entryBundle] = bundleGraph.getBundlesInBundleGroup(resolved.value); | ||
@@ -87,11 +96,17 @@ if (entryBundle.isInline) { | ||
let replacements = new Map(); | ||
let dependencies = []; | ||
bundle.traverse(node => { | ||
if (node.type === 'dependency') { | ||
dependencies.push(node.value); | ||
} | ||
}); | ||
for (let dependency of bundleGraph.getExternalDependencies(bundle)) { | ||
let bundleGroup = bundleGraph.resolveExternalDependency(dependency); | ||
for (let dependency of dependencies) { | ||
let resolved = bundleGraph.resolveExternalDependency(dependency, bundle); | ||
if (bundleGroup == null) { | ||
if (resolved == null || resolved.type === 'asset') { | ||
continue; | ||
} | ||
let [entryBundle] = bundleGraph.getBundlesInBundleGroup(bundleGroup); | ||
let [entryBundle] = bundleGraph.getBundlesInBundleGroup(resolved.value); | ||
@@ -98,0 +113,0 @@ if (!entryBundle.isInline) { |
{ | ||
"name": "@parcel/utils", | ||
"version": "2.0.0-nightly.201+83e272ba", | ||
"version": "2.0.0-nightly.203+f6d2a707", | ||
"description": "Blazing fast, zero configuration web application bundler", | ||
@@ -20,6 +20,6 @@ "license": "MIT", | ||
"@iarna/toml": "^2.2.0", | ||
"@parcel/codeframe": "2.0.0-nightly.201+83e272ba", | ||
"@parcel/diagnostic": "2.0.0-nightly.201+83e272ba", | ||
"@parcel/logger": "2.0.0-nightly.201+83e272ba", | ||
"@parcel/markdown-ansi": "2.0.0-nightly.201+83e272ba", | ||
"@parcel/codeframe": "2.0.0-nightly.203+f6d2a707", | ||
"@parcel/diagnostic": "2.0.0-nightly.203+f6d2a707", | ||
"@parcel/logger": "2.0.0-nightly.203+f6d2a707", | ||
"@parcel/markdown-ansi": "2.0.0-nightly.203+f6d2a707", | ||
"ansi-html": "^0.0.7", | ||
@@ -44,3 +44,3 @@ "chalk": "^2.4.2", | ||
}, | ||
"gitHead": "83e272ba8b6fc51651f564da9edbb69576695e2f" | ||
"gitHead": "f6d2a707c932032c39064cf53dd74b2b687e310e" | ||
} |
@@ -6,2 +6,3 @@ // @flow strict-local | ||
import invariant from 'assert'; | ||
import {Readable} from 'stream'; | ||
@@ -38,4 +39,10 @@ import nullthrows from 'nullthrows'; | ||
let replacements = new Map(); | ||
let urlDependencies = []; | ||
bundle.traverse(node => { | ||
if (node.type === 'dependency' && node.value.isURL) { | ||
urlDependencies.push(node.value); | ||
} | ||
}); | ||
for (let dependency of bundleGraph.getExternalDependencies(bundle)) { | ||
for (let dependency of urlDependencies) { | ||
if (!dependency.isURL) { | ||
@@ -45,4 +52,4 @@ continue; | ||
let bundleGroup = bundleGraph.resolveExternalDependency(dependency); | ||
if (bundleGroup == null) { | ||
let resolved = bundleGraph.resolveExternalDependency(dependency, bundle); | ||
if (resolved == null) { | ||
replacements.set(dependency.id, { | ||
@@ -55,3 +62,4 @@ from: dependency.id, | ||
let [entryBundle] = bundleGraph.getBundlesInBundleGroup(bundleGroup); | ||
invariant(resolved.type === 'bundle_group'); | ||
let [entryBundle] = bundleGraph.getBundlesInBundleGroup(resolved.value); | ||
if (entryBundle.isInline) { | ||
@@ -102,9 +110,16 @@ // If a bundle is inline, it should be replaced with inline contents, | ||
for (let dependency of bundleGraph.getExternalDependencies(bundle)) { | ||
let bundleGroup = bundleGraph.resolveExternalDependency(dependency); | ||
if (bundleGroup == null) { | ||
let dependencies = []; | ||
bundle.traverse(node => { | ||
if (node.type === 'dependency') { | ||
dependencies.push(node.value); | ||
} | ||
}); | ||
for (let dependency of dependencies) { | ||
let resolved = bundleGraph.resolveExternalDependency(dependency, bundle); | ||
if (resolved == null || resolved.type === 'asset') { | ||
continue; | ||
} | ||
let [entryBundle] = bundleGraph.getBundlesInBundleGroup(bundleGroup); | ||
let [entryBundle] = bundleGraph.getBundlesInBundleGroup(resolved.value); | ||
if (!entryBundle.isInline) { | ||
@@ -111,0 +126,0 @@ continue; |
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
133157
95
4175