From 855bbb69dc1ad2cea424d4abadac0ceac367a018 Mon Sep 17 00:00:00 2001 From: Agnieszka Gawrys Date: Mon, 22 Jan 2024 17:38:45 -0800 Subject: [PATCH] rename parentAsset to root for msb config and remove unstable (#9486) --- .../bundlers/default/src/DefaultBundler.js | 22 +++++++++---------- .../core/integration-tests/test/bundler.js | 20 ++++++++--------- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/packages/bundlers/default/src/DefaultBundler.js b/packages/bundlers/default/src/DefaultBundler.js index 171ce67dcdd..20af3564e1e 100644 --- a/packages/bundlers/default/src/DefaultBundler.js +++ b/packages/bundlers/default/src/DefaultBundler.js @@ -37,7 +37,7 @@ type ManualSharedBundles = Array<{| name: string, assets: Array, types?: Array, - parent?: string, + root?: string, split?: number, |}>; @@ -47,7 +47,7 @@ type BaseBundlerConfig = {| minBundleSize?: number, maxParallelRequests?: number, disableSharedBundles?: boolean, - unstable_manualSharedBundles?: ManualSharedBundles, + manualSharedBundles?: ManualSharedBundles, |}; type BundlerConfig = {| @@ -443,8 +443,8 @@ function createIdealGraph( let parentsToConfig = new DefaultMap(() => []); for (let c of config.manualSharedBundles) { - if (c.parent != null) { - parentsToConfig.get(path.join(config.projectRoot, c.parent)).push(c); + if (c.root != null) { + parentsToConfig.get(path.join(config.projectRoot, c.root)).push(c); } } let numParentsToFind = parentsToConfig.size; @@ -468,7 +468,7 @@ function createIdealGraph( // Process in reverse order so earlier configs take precedence for (let c of config.manualSharedBundles.reverse()) { invariant( - c.parent == null || configToParentAsset.has(c), + c.root == null || configToParentAsset.has(c), 'Invalid manual shared bundle. Could not find parent asset.', ); @@ -1812,7 +1812,7 @@ const CONFIG_SCHEMA: SchemaEntity = { type: 'number', enum: Object.keys(HTTP_OPTIONS).map(k => Number(k)), }, - unstable_manualSharedBundles: { + manualSharedBundles: { type: 'array', items: { type: 'object', @@ -1832,7 +1832,7 @@ const CONFIG_SCHEMA: SchemaEntity = { type: 'string', }, }, - parent: { + root: { type: 'string', }, split: { @@ -2001,12 +2001,12 @@ async function loadBundlerConfig( }); } - if (modeConfig.unstable_manualSharedBundles) { - let nameArray = modeConfig.unstable_manualSharedBundles.map(a => a.name); + if (modeConfig.manualSharedBundles) { + let nameArray = modeConfig.manualSharedBundles.map(a => a.name); let nameSet = new Set(nameArray); invariant( nameSet.size == nameArray.length, - 'The name field must be unique for property unstable_manualSharedBundles', + 'The name field must be unique for property manualSharedBundles', ); } @@ -2034,7 +2034,7 @@ async function loadBundlerConfig( disableSharedBundles: modeConfig.disableSharedBundles ?? defaults.disableSharedBundles, manualSharedBundles: - modeConfig.unstable_manualSharedBundles ?? defaults.manualSharedBundles, + modeConfig.manualSharedBundles ?? defaults.manualSharedBundles, }; } diff --git a/packages/core/integration-tests/test/bundler.js b/packages/core/integration-tests/test/bundler.js index 33c1eed0421..9252b00e181 100644 --- a/packages/core/integration-tests/test/bundler.js +++ b/packages/core/integration-tests/test/bundler.js @@ -1223,7 +1223,7 @@ describe('bundler', function () { { "@parcel/bundler-default": { "minBundleSize": 0, - "unstable_manualSharedBundles": [{ + "manualSharedBundles": [{ "name": "vendor", "assets": ["vendor*.*"] }] @@ -1305,7 +1305,7 @@ describe('bundler', function () { package.json: { "@parcel/bundler-default": { - "unstable_manualSharedBundles": [{ + "manualSharedBundles": [{ "name": "manual-inline", "assets": ["shared.js"] }] @@ -1386,7 +1386,7 @@ describe('bundler', function () { { "@parcel/bundler-default": { "minBundleSize": 0, - "unstable_manualSharedBundles": [{ + "manualSharedBundles": [{ "name": "vendor", "assets": ["vendor*.*"], "types": ["js"] @@ -1471,9 +1471,9 @@ describe('bundler', function () { { "@parcel/bundler-default": { "minBundleSize": 0, - "unstable_manualSharedBundles": [{ + "manualSharedBundles": [{ "name": "vendor", - "parent": "math/math.js", + "root": "math/math.js", "assets": ["math/!(divide).js"] }] } @@ -1542,7 +1542,7 @@ describe('bundler', function () { }, "@parcel/bundler-default": { "minBundleSize": 0, - "unstable_manualSharedBundles": [{ + "manualSharedBundles": [{ "name": "vendor", "assets": ["vendor*.*"], "types": ["js"] @@ -1614,9 +1614,9 @@ describe('bundler', function () { }, "@parcel/bundler-default": { "minBundleSize": 0, - "unstable_manualSharedBundles": [{ + "manualSharedBundles": [{ "name": "vendor", - "parent": "manual.js", + "root": "manual.js", "assets": ["**/*"], "types": ["js"] }] @@ -1682,9 +1682,9 @@ describe('bundler', function () { { "@parcel/bundler-default": { "minBundleSize": 0, - "unstable_manualSharedBundles": [{ + "manualSharedBundles": [{ "name": "vendor", - "parent": "vendor.js", + "root": "vendor.js", "assets": ["**/*"], "split": 3 }]