Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@parcel/utils

Package Overview
Dependencies
Maintainers
1
Versions
884
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@parcel/utils - npm Package Compare versions

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

31

lib/replaceBundleReferences.js

@@ -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;

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