@parcel/packager-html
Advanced tools
Comparing version 2.0.0-nightly.201 to 2.0.0-nightly.203
@@ -37,7 +37,16 @@ "use strict"; | ||
let asset = assets[0]; | ||
let code = await asset.getCode(); // Insert references to sibling bundles. For example, a <script> tag in the original HTML | ||
let code = await asset.getCode(); | ||
let dependencies = []; | ||
bundle.traverse(node => { | ||
if (node.type === 'dependency') { | ||
dependencies.push(node.value); | ||
} | ||
}); // Insert references to sibling bundles. For example, a <script> tag in the original HTML | ||
// may import CSS files. This will result in a sibling bundle in the same bundle group as the | ||
// JS. This will be inserted as a <link> element into the HTML here. | ||
let bundleGroups = bundleGraph.getExternalDependencies(bundle).map(dependency => bundleGraph.resolveExternalDependency(dependency)).filter(Boolean); | ||
let bundleGroups = dependencies.map(dependency => bundleGraph.resolveExternalDependency(dependency, bundle)).filter(resolved => resolved != null && resolved.type === 'bundle_group').map(resolved => { | ||
(0, _assert.default)(resolved != null && resolved.type === 'bundle_group'); | ||
return resolved.value; | ||
}); | ||
let bundles = bundleGroups.reduce((p, bundleGroup) => { | ||
@@ -44,0 +53,0 @@ let bundles = bundleGraph.getBundlesInBundleGroup(bundleGroup).filter(bundle => !bundle.getEntryAssets().some(asset => asset.id === bundleGroup.entryAssetId)); |
{ | ||
"name": "@parcel/packager-html", | ||
"version": "2.0.0-nightly.201+83e272ba", | ||
"version": "2.0.0-nightly.203+f6d2a707", | ||
"license": "MIT", | ||
@@ -19,9 +19,9 @@ "publishConfig": { | ||
"dependencies": { | ||
"@parcel/plugin": "2.0.0-nightly.201+83e272ba", | ||
"@parcel/types": "2.0.0-nightly.201+83e272ba", | ||
"@parcel/utils": "2.0.0-nightly.201+83e272ba", | ||
"@parcel/plugin": "2.0.0-nightly.203+f6d2a707", | ||
"@parcel/types": "2.0.0-nightly.203+f6d2a707", | ||
"@parcel/utils": "2.0.0-nightly.203+f6d2a707", | ||
"nullthrows": "^1.1.1", | ||
"posthtml": "^0.11.3" | ||
}, | ||
"gitHead": "83e272ba8b6fc51651f564da9edbb69576695e2f" | ||
"gitHead": "f6d2a707c932032c39064cf53dd74b2b687e310e" | ||
} |
@@ -5,2 +5,3 @@ // @flow strict-local | ||
import assert from 'assert'; | ||
import invariant from 'assert'; | ||
import {Packager} from '@parcel/plugin'; | ||
@@ -35,9 +36,21 @@ import posthtml from 'posthtml'; | ||
let dependencies = []; | ||
bundle.traverse(node => { | ||
if (node.type === 'dependency') { | ||
dependencies.push(node.value); | ||
} | ||
}); | ||
// Insert references to sibling bundles. For example, a <script> tag in the original HTML | ||
// may import CSS files. This will result in a sibling bundle in the same bundle group as the | ||
// JS. This will be inserted as a <link> element into the HTML here. | ||
let bundleGroups = bundleGraph | ||
.getExternalDependencies(bundle) | ||
.map(dependency => bundleGraph.resolveExternalDependency(dependency)) | ||
.filter(Boolean); | ||
let bundleGroups = dependencies | ||
.map(dependency => | ||
bundleGraph.resolveExternalDependency(dependency, bundle), | ||
) | ||
.filter(resolved => resolved != null && resolved.type === 'bundle_group') | ||
.map(resolved => { | ||
invariant(resolved != null && resolved.type === 'bundle_group'); | ||
return resolved.value; | ||
}); | ||
let bundles = bundleGroups.reduce((p, bundleGroup) => { | ||
@@ -44,0 +57,0 @@ let bundles = bundleGraph |
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
13798
368