From 9bdb95c9e34cef640534e5e5a1e2225a80442000 Mon Sep 17 00:00:00 2001 From: HelenHuang <LinHuang@pollex.com.tw> Date: 星期四, 09 六月 2022 15:48:15 +0800 Subject: [PATCH] TODO#139894 [ footer -最下方說明與保經代合作 ] 文案修改 --- PAMapp/node_modules/@babel/core/lib/config/full.js | 80 ++++++++++++++++++++++++++++++---------- 1 files changed, 60 insertions(+), 20 deletions(-) diff --git a/PAMapp/node_modules/@babel/core/lib/config/full.js b/PAMapp/node_modules/@babel/core/lib/config/full.js index a583dd6..e1df648 100644 --- a/PAMapp/node_modules/@babel/core/lib/config/full.js +++ b/PAMapp/node_modules/@babel/core/lib/config/full.js @@ -27,6 +27,8 @@ var _configChain = require("./config-chain"); +var _deepArray = require("./helpers/deep-array"); + function _traverse() { const data = require("@babel/traverse"); @@ -96,6 +98,7 @@ const initialPluginsDescriptors = plugins.map(toDescriptor); const pluginDescriptorsByPass = [[]]; const passes = []; + const externalDependencies = []; const ignored = yield* enhanceError(context, function* recursePresetDescriptors(rawPresets, pluginDescriptorsPass) { const presets = []; @@ -104,23 +107,27 @@ if (descriptor.options !== false) { try { - if (descriptor.ownPass) { - presets.push({ - preset: yield* loadPresetDescriptor(descriptor, presetContext), - pass: [] - }); - } else { - presets.unshift({ - preset: yield* loadPresetDescriptor(descriptor, presetContext), - pass: pluginDescriptorsPass - }); - } + var preset = yield* loadPresetDescriptor(descriptor, presetContext); } catch (e) { if (e.code === "BABEL_UNKNOWN_OPTION") { (0, _options.checkNoUnwrappedItemOptionPairs)(rawPresets, i, "preset", e); } throw e; + } + + externalDependencies.push(preset.externalDependencies); + + if (descriptor.ownPass) { + presets.push({ + preset: preset.chain, + pass: [] + }); + } else { + presets.unshift({ + preset: preset.chain, + pass: pluginDescriptorsPass + }); } } } @@ -160,7 +167,7 @@ if (descriptor.options !== false) { try { - pass.push(yield* loadPluginDescriptor(descriptor, pluginContext)); + var plugin = yield* loadPluginDescriptor(descriptor, pluginContext); } catch (e) { if (e.code === "BABEL_UNKNOWN_PLUGIN_PROPERTY") { (0, _options.checkNoUnwrappedItemOptionPairs)(descs, i, "plugin", e); @@ -168,6 +175,9 @@ throw e; } + + pass.push(plugin); + externalDependencies.push(plugin.externalDependencies); } } } @@ -179,7 +189,8 @@ opts.passPerPreset = opts.presets.length > 0; return { options: opts, - passes: passes + passes: passes, + externalDependencies: (0, _deepArray.finalize)(externalDependencies) }; }); @@ -207,11 +218,12 @@ }, cache) { if (options === false) throw new Error("Assertion failure"); options = options || {}; + const externalDependencies = []; let item = value; if (typeof value === "function") { const factory = (0, _async.maybeAsync)(value, `You appear to be using an async plugin/preset, but Babel has been called synchronously`); - const api = Object.assign({}, context, apiFactory(cache)); + const api = Object.assign({}, context, apiFactory(cache, externalDependencies)); try { item = yield* factory(api, options, dirname); @@ -233,11 +245,25 @@ throw new Error(`You appear to be using a promise as a plugin, ` + `which your current version of Babel does not support. ` + `If you're using a published plugin, ` + `you may need to upgrade your @babel/core version. ` + `As an alternative, you can prefix the promise with "await". ` + `(While processing: ${JSON.stringify(alias)})`); } + if (externalDependencies.length > 0 && (!cache.configured() || cache.mode() === "forever")) { + let error = `A plugin/preset has external untracked dependencies ` + `(${externalDependencies[0]}), but the cache `; + + if (!cache.configured()) { + error += `has not been configured to be invalidated when the external dependencies change. `; + } else { + error += ` has been configured to never be invalidated. `; + } + + error += `Plugins/presets should configure their cache to be invalidated when the external ` + `dependencies change, for example using \`api.cache.invalidate(() => ` + `statSync(filepath).mtimeMs)\` or \`api.cache.never()\`\n` + `(While processing: ${JSON.stringify(alias)})`; + throw new Error(error); + } + return { value: item, options, dirname, - alias + alias, + externalDependencies: (0, _deepArray.finalize)(externalDependencies) }; }); @@ -260,7 +286,8 @@ value, options, dirname, - alias + alias, + externalDependencies }, cache) { const pluginObj = (0, _plugins.validatePluginObject)(value); const plugin = Object.assign({}, pluginObj); @@ -284,9 +311,17 @@ plugin.post = chain(inherits.post, plugin.post); plugin.manipulateOptions = chain(inherits.manipulateOptions, plugin.manipulateOptions); plugin.visitor = _traverse().default.visitors.merge([inherits.visitor || {}, plugin.visitor || {}]); + + if (inherits.externalDependencies.length > 0) { + if (externalDependencies.length === 0) { + externalDependencies = inherits.externalDependencies; + } else { + externalDependencies = (0, _deepArray.finalize)([externalDependencies, inherits.externalDependencies]); + } + } } - return new _plugin.default(plugin, options, alias); + return new _plugin.default(plugin, options, alias, externalDependencies); }); const validateIfOptionNeedsFilename = (options, descriptor) => { @@ -312,18 +347,23 @@ function* loadPresetDescriptor(descriptor, context) { const preset = instantiatePreset(yield* presetDescriptorLoader(descriptor, context)); validatePreset(preset, context, descriptor); - return yield* (0, _configChain.buildPresetChain)(preset, context); + return { + chain: yield* (0, _configChain.buildPresetChain)(preset, context), + externalDependencies: preset.externalDependencies + }; } const instantiatePreset = (0, _caching.makeWeakCacheSync)(({ value, dirname, - alias + alias, + externalDependencies }) => { return { options: (0, _options.validate)("preset", value), alias, - dirname + dirname, + externalDependencies }; }); -- Gitblit v1.8.0