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

@parcel/core

Package Overview
Dependencies
Maintainers
0
Versions
895
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-canary.1759 to 2.0.0-canary.1762

17

lib/applyRuntimes.js

@@ -111,5 +111,6 @@ "use strict";

isEntry,
env
env,
shouldReplaceResolution
} of runtimeAssets) {
let sourceName = _path().default.join(_path().default.dirname(filePath), `runtime-${(0, _rust().hashString)(code)}.${bundle.type}`);
let sourceName = _path().default.join(_path().default.dirname(filePath), `runtime-${(0, _rust().hashString)(code)}${_path().default.extname(filePath)}`);
let assetGroup = {

@@ -127,3 +128,4 @@ code,

dependency,
isEntry
isEntry,
shouldReplaceResolution
});

@@ -169,3 +171,4 @@ }

dependency,
isEntry
isEntry,
shouldReplaceResolution
} of connections) {

@@ -222,2 +225,8 @@ let assetGroupNode = (0, _AssetGraph.nodeFromAssetGroup)(assetGroup);

bundleGraph._graph.addEdge(dependencyNodeId, bundleGraphRuntimeNodeId);
if (shouldReplaceResolution && resolution) {
let resolutionNodeId = bundleGraph._graph.getNodeIdByContentKey(resolution.id);
bundleGraph._graph.removeEdge(dependencyNodeId, resolutionNodeId);
bundleGraph._graph.addEdge(dependencyNodeId, resolutionNodeId);
// TODO: remove asset from bundle?
}
}

@@ -224,0 +233,0 @@ }

@@ -21,3 +21,3 @@ "use strict";

browsers: ['> 0.25%'],
node: '>= 8.0.0'
node: '>= 18.0.0'
};

@@ -52,2 +52,3 @@ function createEnvironment({

case 'electron-main':
case 'react-server':
engines = {

@@ -61,2 +62,3 @@ node: DEFAULT_ENGINES.node

case 'electron-renderer':
case 'react-client':
engines = {

@@ -90,2 +92,3 @@ browsers: DEFAULT_ENGINES.browsers

case 'electron-renderer':
case 'react-server':
outputFormat = 'commonjs';

@@ -92,0 +95,0 @@ break;

@@ -192,3 +192,6 @@ "use strict";

}
getEntryBundles() {
return this.#graph.getEntryBundles().map(b => this.#createBundle(b, this.#graph, this.#options));
}
}
exports.default = BundleGraph;

@@ -32,7 +32,8 @@ "use strict";

const inspect = Symbol.for('nodejs.util.inspect.custom');
const BROWSER_ENVS = exports.BROWSER_ENVS = new Set(['browser', 'web-worker', 'service-worker', 'worklet', 'electron-renderer']);
const BROWSER_ENVS = exports.BROWSER_ENVS = new Set(['browser', 'web-worker', 'service-worker', 'worklet', 'electron-renderer', 'react-client']);
const ELECTRON_ENVS = new Set(['electron-main', 'electron-renderer']);
const NODE_ENVS = new Set(['node', ...ELECTRON_ENVS]);
const NODE_ENVS = new Set(['node', 'react-server', ...ELECTRON_ENVS]);
const WORKER_ENVS = new Set(['web-worker', 'service-worker']);
const ISOLATED_ENVS = exports.ISOLATED_ENVS = new Set([...WORKER_ENVS, 'worklet']);
const SERVER_ENVS = new Set(['node', 'react-server']);
const ALL_BROWSERS = ['chrome', 'and_chr', 'edge', 'firefox', 'and_ff', 'safari', 'ios', 'samsung', 'opera', 'ie', 'op_mini', 'blackberry', 'op_mob', 'ie_mob', 'and_uc', 'and_qq', 'baidu', 'kaios'];

@@ -68,3 +69,4 @@

and_qq: '10.4',
op_mob: '64'
op_mob: '64',
node: '13.2.0'
},

@@ -93,3 +95,4 @@ 'worker-module': {

and_qq: '10.4',
op_mob: '64'
op_mob: '64',
node: '10.4.0'
},

@@ -190,2 +193,5 @@ 'arrow-functions': {

}
isServer() {
return SERVER_ENVS.has(this.#environment.context);
}
isElectron() {

@@ -192,0 +198,0 @@ return ELECTRON_ENVS.has(this.#environment.context);

@@ -68,6 +68,6 @@ "use strict";

var _TargetDescriptor = require("../TargetDescriptor.schema");
var _Environment2 = require("../public/Environment");
var _utils2 = require("../utils");
var _projectPath = require("../projectPath");
var _RequestTracker = require("../RequestTracker");
var _Environment2 = require("../public/Environment");
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }

@@ -100,3 +100,3 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }

const DEFAULT_ENGINES = {
node: 'current',
node: process.versions.node,
browsers: ['last 1 Chrome version', 'last 1 Safari version', 'last 1 Firefox version', 'last 1 Edge version']

@@ -249,13 +249,9 @@ };

}
if (!_Environment2.BROWSER_ENVS.has(targets[0].env.context)) {
throw new (_diagnostic().default)({
diagnostic: {
message: `Only browser targets are supported in serve mode`,
origin: '@parcel/core'
}
});
}
targets[0].distDir = (0, _projectPath.toProjectPath)(this.options.projectRoot, serve.distDir);
}
} else {
targets = Array.from(packageTargets.values()).filter(Boolean).filter(descriptor => {
return descriptor && !skipTarget(descriptor.name, exclusiveTarget, descriptor.source);
});
// Explicit targets were not provided. Either use a modern target for server

@@ -266,13 +262,20 @@ // mode, or simply use the package.json targets.

// hasn't specified a target, use one targeting modern browsers for development
let distDir = (0, _projectPath.toProjectPath)(this.options.projectRoot, this.options.serveOptions.distDir);
let mainTarget = targets.length === 1 ? targets[0] : null;
let context = (mainTarget === null || mainTarget === void 0 ? void 0 : mainTarget.env.context) ?? 'browser';
let engines = _Environment2.BROWSER_ENVS.has(context) ? {
browsers: DEFAULT_ENGINES.browsers
} : {
node: DEFAULT_ENGINES.node
};
targets = [{
name: 'default',
distDir: (0, _projectPath.toProjectPath)(this.options.projectRoot, this.options.serveOptions.distDir),
distDir,
publicUrl: this.options.defaultTargetOptions.publicUrl ?? '/',
env: (0, _Environment.createEnvironment)({
context: 'browser',
engines: {
browsers: DEFAULT_ENGINES.browsers
},
context,
engines,
includeNodeModules: mainTarget === null || mainTarget === void 0 ? void 0 : mainTarget.env.includeNodeModules,
shouldOptimize: this.options.defaultTargetOptions.shouldOptimize,
outputFormat: this.options.defaultTargetOptions.outputFormat,
outputFormat: (mainTarget === null || mainTarget === void 0 ? void 0 : mainTarget.env.outputFormat) ?? this.options.defaultTargetOptions.outputFormat,
shouldScopeHoist: this.options.defaultTargetOptions.shouldScopeHoist,

@@ -282,6 +285,2 @@ sourceMap: this.options.defaultTargetOptions.sourceMaps ? {} : undefined

}];
} else {
targets = Array.from(packageTargets.values()).filter(Boolean).filter(descriptor => {
return descriptor && !skipTarget(descriptor.name, exclusiveTarget, descriptor.source);
});
}

@@ -288,0 +287,0 @@ }

@@ -31,3 +31,3 @@ "use strict";

type: 'string',
enum: ['node', 'browser', 'web-worker', 'electron-main', 'electron-renderer', 'service-worker']
enum: ['node', 'browser', 'web-worker', 'electron-main', 'electron-renderer', 'service-worker', 'react-server', 'react-client']
},

@@ -34,0 +34,0 @@ includeNodeModules: {

{
"name": "@parcel/core",
"version": "2.0.0-canary.1759+d19b1f6bd",
"version": "2.0.0-canary.1762+8a15d0c64",
"license": "MIT",

@@ -28,17 +28,17 @@ "publishConfig": {

"@mischnic/json-sourcemap": "^0.1.0",
"@parcel/cache": "2.0.0-canary.1761+d19b1f6bd",
"@parcel/diagnostic": "2.0.0-canary.1761+d19b1f6bd",
"@parcel/events": "2.0.0-canary.1761+d19b1f6bd",
"@parcel/feature-flags": "2.13.4-canary.3384+d19b1f6bd",
"@parcel/fs": "2.0.0-canary.1761+d19b1f6bd",
"@parcel/graph": "3.3.4-canary.3384+d19b1f6bd",
"@parcel/logger": "2.0.0-canary.1761+d19b1f6bd",
"@parcel/package-manager": "2.0.0-canary.1761+d19b1f6bd",
"@parcel/plugin": "2.0.0-canary.1761+d19b1f6bd",
"@parcel/profiler": "2.13.4-canary.3384+d19b1f6bd",
"@parcel/rust": "2.13.4-canary.3384+d19b1f6bd",
"@parcel/cache": "2.0.0-canary.1764+8a15d0c64",
"@parcel/diagnostic": "2.0.0-canary.1764+8a15d0c64",
"@parcel/events": "2.0.0-canary.1764+8a15d0c64",
"@parcel/feature-flags": "2.13.4-canary.3387+8a15d0c64",
"@parcel/fs": "2.0.0-canary.1764+8a15d0c64",
"@parcel/graph": "3.3.4-canary.3387+8a15d0c64",
"@parcel/logger": "2.0.0-canary.1764+8a15d0c64",
"@parcel/package-manager": "2.0.0-canary.1764+8a15d0c64",
"@parcel/plugin": "2.0.0-canary.1764+8a15d0c64",
"@parcel/profiler": "2.13.4-canary.3387+8a15d0c64",
"@parcel/rust": "2.13.4-canary.3387+8a15d0c64",
"@parcel/source-map": "^2.1.1",
"@parcel/types": "2.0.0-canary.1761+d19b1f6bd",
"@parcel/utils": "2.0.0-canary.1761+d19b1f6bd",
"@parcel/workers": "2.0.0-canary.1761+d19b1f6bd",
"@parcel/types": "2.0.0-canary.1764+8a15d0c64",
"@parcel/utils": "2.0.0-canary.1764+8a15d0c64",
"@parcel/workers": "2.0.0-canary.1764+8a15d0c64",
"base-x": "^3.0.8",

@@ -63,3 +63,3 @@ "browserslist": "^4.6.6",

},
"gitHead": "d19b1f6bdb05eb5a3085f44daae15c0fe2709ab9"
"gitHead": "8a15d0c64fc95a151bcf8b3f0428acc4cda745ee"
}

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

isEntry: ?boolean,
shouldReplaceResolution: ?boolean,
|};

@@ -103,6 +104,7 @@

env,
shouldReplaceResolution,
} of runtimeAssets) {
let sourceName = path.join(
path.dirname(filePath),
`runtime-${hashString(code)}.${bundle.type}`,
`runtime-${hashString(code)}${path.extname(filePath)}`,
);

@@ -124,2 +126,3 @@

isEntry,
shouldReplaceResolution,
});

@@ -176,3 +179,9 @@ }

for (let {bundle, assetGroup, dependency, isEntry} of connections) {
for (let {
bundle,
assetGroup,
dependency,
isEntry,
shouldReplaceResolution,
} of connections) {
let assetGroupNode = nodeFromAssetGroup(assetGroup);

@@ -264,2 +273,11 @@ let assetGroupAssetNodeIds = runtimesAssetGraph.getNodeIdsConnectedFrom(

bundleGraph._graph.addEdge(dependencyNodeId, bundleGraphRuntimeNodeId);
if (shouldReplaceResolution && resolution) {
let resolutionNodeId = bundleGraph._graph.getNodeIdByContentKey(
resolution.id,
);
bundleGraph._graph.removeEdge(dependencyNodeId, resolutionNodeId);
bundleGraph._graph.addEdge(dependencyNodeId, resolutionNodeId);
// TODO: remove asset from bundle?
}
}

@@ -266,0 +284,0 @@ }

@@ -15,3 +15,3 @@ // @flow

browsers: ['> 0.25%'],
node: '>= 8.0.0',
node: '>= 18.0.0',
};

@@ -52,2 +52,3 @@

case 'electron-main':
case 'react-server':
engines = {

@@ -61,2 +62,3 @@ node: DEFAULT_ENGINES.node,

case 'electron-renderer':
case 'react-client':
engines = {

@@ -92,2 +94,3 @@ browsers: DEFAULT_ENGINES.browsers,

case 'electron-renderer':
case 'react-server':
outputFormat = 'commonjs';

@@ -94,0 +97,0 @@ break;

@@ -335,2 +335,8 @@ // @flow strict-local

}
getEntryBundles(): Array<TBundle> {
return this.#graph
.getEntryBundles()
.map(b => this.#createBundle(b, this.#graph, this.#options));
}
}

@@ -28,7 +28,9 @@ // @flow strict-local

'electron-renderer',
'react-client',
]);
const ELECTRON_ENVS = new Set(['electron-main', 'electron-renderer']);
const NODE_ENVS = new Set(['node', ...ELECTRON_ENVS]);
const NODE_ENVS = new Set(['node', 'react-server', ...ELECTRON_ENVS]);
const WORKER_ENVS = new Set(['web-worker', 'service-worker']);
export const ISOLATED_ENVS: Set<string> = new Set([...WORKER_ENVS, 'worklet']);
const SERVER_ENVS = new Set(['node', 'react-server']);

@@ -85,2 +87,3 @@ const ALL_BROWSERS = [

op_mob: '64',
node: '13.2.0',
},

@@ -110,2 +113,3 @@ 'worker-module': {

op_mob: '64',
node: '10.4.0',
},

@@ -238,2 +242,6 @@ 'arrow-functions': {

isServer(): boolean {
return SERVER_ENVS.has(this.#environment.context);
}
isElectron(): boolean {

@@ -240,0 +248,0 @@ return ELECTRON_ENVS.has(this.#environment.context);

@@ -48,6 +48,6 @@ // @flow strict-local

} from '../TargetDescriptor.schema';
import {BROWSER_ENVS} from '../public/Environment';
import {optionsProxy, toInternalSourceLocation} from '../utils';
import {fromProjectPath, toProjectPath, joinProjectPath} from '../projectPath';
import {requestTypes} from '../RequestTracker';
import {BROWSER_ENVS} from '../public/Environment';

@@ -83,3 +83,3 @@ type RunOpts<TResult> = {|

const DEFAULT_ENGINES = {
node: 'current',
node: process.versions.node,
browsers: [

@@ -345,10 +345,2 @@ 'last 1 Chrome version',

}
if (!BROWSER_ENVS.has(targets[0].env.context)) {
throw new ThrowableDiagnostic({
diagnostic: {
message: `Only browser targets are supported in serve mode`,
origin: '@parcel/core',
},
});
}
targets[0].distDir = toProjectPath(

@@ -360,2 +352,11 @@ this.options.projectRoot,

} else {
targets = Array.from(packageTargets.values())
.filter(Boolean)
.filter(descriptor => {
return (
descriptor &&
!skipTarget(descriptor.name, exclusiveTarget, descriptor.source)
);
});
// Explicit targets were not provided. Either use a modern target for server

@@ -366,17 +367,24 @@ // mode, or simply use the package.json targets.

// hasn't specified a target, use one targeting modern browsers for development
let distDir = toProjectPath(
this.options.projectRoot,
this.options.serveOptions.distDir,
);
let mainTarget = targets.length === 1 ? targets[0] : null;
let context = mainTarget?.env.context ?? 'browser';
let engines = BROWSER_ENVS.has(context)
? {browsers: DEFAULT_ENGINES.browsers}
: {node: DEFAULT_ENGINES.node};
targets = [
{
name: 'default',
distDir: toProjectPath(
this.options.projectRoot,
this.options.serveOptions.distDir,
),
distDir,
publicUrl: this.options.defaultTargetOptions.publicUrl ?? '/',
env: createEnvironment({
context: 'browser',
engines: {
browsers: DEFAULT_ENGINES.browsers,
},
context,
engines,
includeNodeModules: mainTarget?.env.includeNodeModules,
shouldOptimize: this.options.defaultTargetOptions.shouldOptimize,
outputFormat: this.options.defaultTargetOptions.outputFormat,
outputFormat:
mainTarget?.env.outputFormat ??
this.options.defaultTargetOptions.outputFormat,
shouldScopeHoist:

@@ -390,11 +398,2 @@ this.options.defaultTargetOptions.shouldScopeHoist,

];
} else {
targets = Array.from(packageTargets.values())
.filter(Boolean)
.filter(descriptor => {
return (
descriptor &&
!skipTarget(descriptor.name, exclusiveTarget, descriptor.source)
);
});
}

@@ -401,0 +400,0 @@ }

@@ -39,2 +39,4 @@ // @flow strict-local

'service-worker',
'react-server',
'react-client',
],

@@ -41,0 +43,0 @@ },

@@ -66,6 +66,6 @@ // @flow strict-local

assert.deepEqual(createEnvironment({context: 'node'}), {
id: 'f7c9644283a8698f',
id: 'b9b60fc7dcc0ae9c',
context: 'node',
engines: {
node: '>= 8.0.0',
node: '>= 18.0.0',
},

@@ -72,0 +72,0 @@ includeNodeModules: false,

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

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