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

@parcel/core

Package Overview
Dependencies
Maintainers
1
Versions
890
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.355 to 2.0.0-nightly.357

3

lib/applyRuntimes.js

@@ -72,3 +72,4 @@ "use strict";

// e.g. compiled to run in the target environment
isSource: true
isSource: true,
query: {}
};

@@ -75,0 +76,0 @@ connections.push({

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

filePath: options.filePath,
query: options.query || {},
isIsolated: (_options$isIsolated = options.isIsolated) !== null && _options$isIsolated !== void 0 ? _options$isIsolated : false,

@@ -44,0 +45,0 @@ isInline: (_options$isInline = options.isInline) !== null && _options$isInline !== void 0 ? _options$isInline : false,

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

var _querystring = _interopRequireDefault(require("querystring"));
var _assert = _interopRequireDefault(require("assert"));

@@ -443,7 +445,7 @@

getParentBundles(bundle) {
return (0, _utils.flatMap)(this._graph.getNodesConnectedTo((0, _nullthrows.default)(this._graph.getNode(bundle.id)), 'bundle'), bundleGroupNode => this._graph.getNodesConnectedTo(bundleGroupNode, 'bundle') // Entry bundle groups have the root node as their parent
return (0, _utils.unique)((0, _utils.flatMap)(this._graph.getNodesConnectedTo((0, _nullthrows.default)(this._graph.getNode(bundle.id)), 'bundle'), bundleGroupNode => this._graph.getNodesConnectedTo(bundleGroupNode, 'bundle') // Entry bundle groups have the root node as their parent
.filter(node => node.type !== 'root')).map(node => {
(0, _assert.default)(node.type === 'bundle');
return node.value;
});
}));
}

@@ -636,3 +638,3 @@

getSiblingBundles(bundle) {
let siblings = [];
let siblings = new Set();
let bundleGroups = this.getBundleGroupsContainingBundle(bundle);

@@ -645,3 +647,3 @@

if (b.id !== bundle.id) {
siblings.push(b);
siblings.add(b);
}

@@ -651,3 +653,3 @@ }

return siblings;
return [...siblings];
}

@@ -874,3 +876,3 @@

this.traverseAssets(bundle, asset => {
hash.update([this.getAssetPublicId(asset), asset.outputHash, asset.filePath, asset.type, asset.uniqueKey].join(':'));
hash.update([this.getAssetPublicId(asset), asset.outputHash, asset.filePath, _querystring.default.stringify(asset.query), asset.type, asset.uniqueKey].join(':'));
});

@@ -877,0 +879,0 @@ let hashHex = hash.digest('hex');

@@ -91,2 +91,6 @@ "use strict";

get query() {
return _classPrivateFieldGet(this, _asset).value.query;
}
get meta() {

@@ -93,0 +97,0 @@ return _classPrivateFieldGet(this, _asset).value.meta;

@@ -200,5 +200,11 @@ "use strict";

addBundleToBundleGroup(bundle, bundleGroup) {
bundleGroup.bundleIds.push(bundle.id);
let bundleGroupId = (0, _utils2.getBundleGroupId)(bundleGroup);
if (_classPrivateFieldGet(this, _graph)._graph.hasEdge(bundleGroupId, bundle.id, 'bundle')) {
// Bundle group already has bundle
return;
}
bundleGroup.bundleIds.push(bundle.id);
_classPrivateFieldGet(this, _graph)._graph.addEdge(bundleGroupId, bundle.id);

@@ -205,0 +211,0 @@

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

var _querystring = _interopRequireDefault(require("querystring"));
var _ReporterRunner = require("../ReporterRunner");

@@ -41,2 +43,3 @@

const type = 'path_request';
const QUERY_PARAMS_REGEX = /^([^\t\r\n\v\f?]*)(\?.*)?/;

@@ -121,2 +124,3 @@ function createPathRequest(input) {

let filePath;
let query = {};
let validPipelines = new Set(this.config.getNamedPipelines());

@@ -157,2 +161,9 @@

let matchesQuerystring = filePath.match(QUERY_PARAMS_REGEX);
if (matchesQuerystring && matchesQuerystring.length > 2) {
filePath = matchesQuerystring[1];
query = matchesQuerystring[2] ? _querystring.default.parse(matchesQuerystring[2].substr(1)) : {};
}
let errors = [];

@@ -181,2 +192,3 @@

filePath: result.filePath,
query,
sideEffects: result.sideEffects,

@@ -183,0 +195,0 @@ code: result.code,

@@ -153,3 +153,4 @@ "use strict";

isSource: isSourceOverride,
sideEffects
sideEffects,
query
} = this.request;

@@ -180,2 +181,3 @@ let {

env,
query,
stats: {

@@ -182,0 +184,0 @@ time: 0,

@@ -185,3 +185,4 @@ "use strict";

code,
sideEffects
sideEffects,
query
} = request;

@@ -207,2 +208,3 @@ let {

hash,
query,
env: env,

@@ -209,0 +211,0 @@ stats: {

{
"name": "@parcel/core",
"version": "2.0.0-nightly.355+ca2af736",
"version": "2.0.0-nightly.357+6231ca1d",
"license": "MIT",

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

"dependencies": {
"@parcel/cache": "2.0.0-nightly.357+ca2af736",
"@parcel/diagnostic": "2.0.0-nightly.357+ca2af736",
"@parcel/events": "2.0.0-nightly.357+ca2af736",
"@parcel/fs": "2.0.0-nightly.357+ca2af736",
"@parcel/logger": "2.0.0-nightly.357+ca2af736",
"@parcel/package-manager": "2.0.0-nightly.357+ca2af736",
"@parcel/plugin": "2.0.0-nightly.357+ca2af736",
"@parcel/cache": "2.0.0-nightly.359+6231ca1d",
"@parcel/diagnostic": "2.0.0-nightly.359+6231ca1d",
"@parcel/events": "2.0.0-nightly.359+6231ca1d",
"@parcel/fs": "2.0.0-nightly.359+6231ca1d",
"@parcel/logger": "2.0.0-nightly.359+6231ca1d",
"@parcel/package-manager": "2.0.0-nightly.359+6231ca1d",
"@parcel/plugin": "2.0.0-nightly.359+6231ca1d",
"@parcel/source-map": "2.0.0-alpha.4.13",
"@parcel/types": "2.0.0-nightly.357+ca2af736",
"@parcel/utils": "2.0.0-nightly.357+ca2af736",
"@parcel/workers": "2.0.0-nightly.357+ca2af736",
"@parcel/types": "2.0.0-nightly.359+6231ca1d",
"@parcel/utils": "2.0.0-nightly.359+6231ca1d",
"@parcel/workers": "2.0.0-nightly.359+6231ca1d",
"abortcontroller-polyfill": "^1.1.9",

@@ -45,2 +45,3 @@ "base-x": "^3.0.8",

"nullthrows": "^1.1.1",
"querystring": "^0.2.0",
"semver": "^5.4.1"

@@ -52,3 +53,3 @@ },

},
"gitHead": "ca2af73663c5d77d61c598d374cd118ba00ab2c8"
"gitHead": "6231ca1d7a5a43c16ae9ec037de2efea6d3abc8f"
}

@@ -73,3 +73,5 @@ // @flow strict-local

isSource: true,
query: {},
};
connections.push({

@@ -76,0 +78,0 @@ bundle,

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

Transformer,
QueryParameters,
} from '@parcel/types';

@@ -36,2 +37,3 @@ import type {Asset, Dependency, Environment} from './types';

filePath: FilePath,
query?: QueryParameters,
type: string,

@@ -77,2 +79,3 @@ contentKey?: ?string,

filePath: options.filePath,
query: options.query || {},
isIsolated: options.isIsolated ?? false,

@@ -79,0 +82,0 @@ isInline: options.isInline ?? false,

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

} from '@parcel/types';
import querystring from 'querystring';

@@ -25,3 +26,3 @@ import type {

import nullthrows from 'nullthrows';
import {flatMap, objectSortedEntriesDeep} from '@parcel/utils';
import {flatMap, objectSortedEntriesDeep, unique} from '@parcel/utils';

@@ -573,16 +574,18 @@ import {getBundleGroupId, getPublicId} from './utils';

getParentBundles(bundle: Bundle): Array<Bundle> {
return flatMap(
this._graph.getNodesConnectedTo(
nullthrows(this._graph.getNode(bundle.id)),
'bundle',
),
bundleGroupNode =>
this._graph
.getNodesConnectedTo(bundleGroupNode, 'bundle')
// Entry bundle groups have the root node as their parent
.filter(node => node.type !== 'root'),
).map(node => {
invariant(node.type === 'bundle');
return node.value;
});
return unique(
flatMap(
this._graph.getNodesConnectedTo(
nullthrows(this._graph.getNode(bundle.id)),
'bundle',
),
bundleGroupNode =>
this._graph
.getNodesConnectedTo(bundleGroupNode, 'bundle')
// Entry bundle groups have the root node as their parent
.filter(node => node.type !== 'root'),
).map(node => {
invariant(node.type === 'bundle');
return node.value;
}),
);
}

@@ -831,3 +834,3 @@

getSiblingBundles(bundle: Bundle): Array<Bundle> {
let siblings = [];
let siblings = new Set();

@@ -839,3 +842,3 @@ let bundleGroups = this.getBundleGroupsContainingBundle(bundle);

if (b.id !== bundle.id) {
siblings.push(b);
siblings.add(b);
}

@@ -845,3 +848,3 @@ }

return siblings;
return [...siblings];
}

@@ -1069,2 +1072,3 @@

asset.filePath,
querystring.stringify(asset.query),
asset.type,

@@ -1071,0 +1075,0 @@ asset.uniqueKey,

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

Symbols as ISymbols,
QueryParameters,
} from '@parcel/types';

@@ -112,2 +113,6 @@ import type {Asset as AssetValue, ParcelOptions} from '../types';

get query(): QueryParameters {
return this.#asset.value.query;
}
get meta(): Meta {

@@ -114,0 +119,0 @@ return this.#asset.value.meta;

@@ -189,4 +189,9 @@ // @flow strict-local

addBundleToBundleGroup(bundle: IBundle, bundleGroup: BundleGroup) {
let bundleGroupId = getBundleGroupId(bundleGroup);
if (this.#graph._graph.hasEdge(bundleGroupId, bundle.id, 'bundle')) {
// Bundle group already has bundle
return;
}
bundleGroup.bundleIds.push(bundle.id);
let bundleGroupId = getBundleGroupId(bundleGroup);
this.#graph._graph.addEdge(bundleGroupId, bundle.id);

@@ -193,0 +198,0 @@ this.#graph._graph.addEdge(bundleGroupId, bundle.id, 'bundle');

// @flow strict-local
import type {Diagnostic} from '@parcel/diagnostic';
import type {Async} from '@parcel/types';
import type {Async, QueryParameters} from '@parcel/types';
import type {StaticRunOpts} from '../RequestTracker';

@@ -14,2 +14,3 @@ import type {AssetGroup, Dependency, ParcelOptions} from '../types';

import URL from 'url';
import querystring from 'querystring';
import {report} from '../ReporterRunner';

@@ -36,2 +37,3 @@ import PublicDependency from '../public/Dependency';

const type = 'path_request';
const QUERY_PARAMS_REGEX = /^([^\t\r\n\v\f?]*)(\?.*)?/;

@@ -127,2 +129,3 @@ export default function createPathRequest(

let filePath;
let query: QueryParameters = {};
let validPipelines = new Set(this.config.getNamedPipelines());

@@ -161,2 +164,10 @@ if (

let matchesQuerystring = filePath.match(QUERY_PARAMS_REGEX);
if (matchesQuerystring && matchesQuerystring.length > 2) {
filePath = matchesQuerystring[1];
query = matchesQuerystring[2]
? querystring.parse(matchesQuerystring[2].substr(1))
: {};
}
let errors: Array<ThrowableDiagnostic> = [];

@@ -180,2 +191,3 @@ for (let resolver of resolvers) {

filePath: result.filePath,
query,
sideEffects: result.sideEffects,

@@ -182,0 +194,0 @@ code: result.code,

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

sideEffects,
query,
} = this.request;

@@ -183,2 +184,3 @@ let {

env,
query,
stats: {

@@ -185,0 +187,0 @@ time: 0,

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

HMROptions,
QueryParameters,
} from '@parcel/types';

@@ -111,2 +112,3 @@ import type {SharedReference} from '@parcel/workers';

filePath: FilePath,
query: QueryParameters,
type: string,

@@ -214,2 +216,3 @@ dependencies: Map<string, Dependency>,

isURL?: boolean,
query: QueryParameters,
|};

@@ -216,0 +219,0 @@

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

async loadAsset(request: AssetGroup): Promise<UncommittedAsset> {
let {filePath, env, code, sideEffects} = request;
let {filePath, env, code, sideEffects, query} = request;
let {content, size, hash, isSource} = await summarizeRequest(

@@ -209,2 +209,3 @@ this.options.inputFS,

hash,
query,
env: env,

@@ -211,0 +212,0 @@ stats: {

@@ -199,3 +199,3 @@ // @flow

});
let req = {filePath: '/index.js', env: DEFAULT_ENV};
let req = {filePath: '/index.js', env: DEFAULT_ENV, query: {}};

@@ -206,3 +206,3 @@ graph.resolveDependency(dep, req, '3');

let req2 = {filePath: '/index.jsx', env: DEFAULT_ENV};
let req2 = {filePath: '/index.jsx', env: DEFAULT_ENV, query: {}};
graph.resolveDependency(dep, req2, '4');

@@ -244,3 +244,3 @@ assert(!graph.nodes.has(nodeFromAssetGroup(req).id));

let filePath = '/index.js';
let req = {filePath, env: DEFAULT_ENV};
let req = {filePath, env: DEFAULT_ENV, query: {}};
graph.resolveDependency(dep, req, '3');

@@ -385,3 +385,3 @@ let sourcePath = filePath;

let filePath = '/index.js';
let req = {filePath, env: DEFAULT_ENV};
let req = {filePath, env: DEFAULT_ENV, query: {}};
graph.resolveDependency(dep, req, '123');

@@ -449,3 +449,3 @@ let sourcePath = filePath;

let assetGroup = {filePath: '/index.js', env: DEFAULT_ENV};
let assetGroup = {filePath: '/index.js', env: DEFAULT_ENV, query: {}};
let assetGroupNode = nodeFromAssetGroup(assetGroup);

@@ -452,0 +452,0 @@ graph.initialize({assetGroups: [assetGroup]});

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

let filePath = '/index.js';
let req = {filePath, env: DEFAULT_ENV};
let req = {filePath, env: DEFAULT_ENV, query: {}};
graph.resolveDependency(dep, nodeFromAssetGroup(req).value, '3');

@@ -70,0 +70,0 @@

// @flow strict-local
import type {Dependency} from '@parcel/types';
import assert from 'assert';
import invariant from 'assert';
import InternalBundleGraph from '../src/BundleGraph';

@@ -50,2 +53,36 @@ import MutableBundleGraph from '../src/public/MutableBundleGraph';

});
it('is safe to add a bundle to a bundleGroup multiple times', () => {
let internalBundleGraph = InternalBundleGraph.fromAssetGraph(
createMockAssetGraph(),
);
let mutableBundleGraph = new MutableBundleGraph(
internalBundleGraph,
DEFAULT_OPTIONS,
);
let dependency: Dependency;
mutableBundleGraph.traverse((node, _, actions) => {
if (node.type === 'dependency') {
dependency = node.value;
actions.stop();
}
});
invariant(dependency != null);
let target = nullthrows(dependency.target);
let bundleGroup = mutableBundleGraph.createBundleGroup(dependency, target);
let bundle = mutableBundleGraph.createBundle({
entryAsset: nullthrows(
mutableBundleGraph.getDependencyResolution(dependency),
),
target,
});
mutableBundleGraph.addBundleToBundleGroup(bundle, bundleGroup);
mutableBundleGraph.addBundleToBundleGroup(bundle, bundleGroup);
assert.deepEqual(bundleGroup.bundleIds, [bundle.id]);
});
});

@@ -96,3 +133,3 @@

let filePath = '/index.js';
let req1 = {filePath, env: DEFAULT_ENV};
let req1 = {filePath, env: DEFAULT_ENV, query: {}};
graph.resolveDependency(dep1, nodeFromAssetGroup(req1).value, '5');

@@ -116,3 +153,3 @@ graph.resolveAssetGroup(

filePath = '/index2.js';
let req2 = {filePath, env: DEFAULT_ENV};
let req2 = {filePath, env: DEFAULT_ENV, query: {}};
graph.resolveDependency(dep2, nodeFromAssetGroup(req2).value, '7');

@@ -119,0 +156,0 @@ graph.resolveAssetGroup(

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