Enhance refactor commands with controller-aware Route() updates and fix code quality violations
Add semantic token highlighting for 'that' variable and comment file references in VS Code extension Add Phone_Text_Input and Currency_Input components with formatting utilities Implement client widgets, form standardization, and soft delete functionality Add modal scroll lock and update documentation Implement comprehensive modal system with form integration and validation Fix modal component instantiation using jQuery plugin API Implement modal system with responsive sizing, queuing, and validation support Implement form submission with validation, error handling, and loading states Implement country/state selectors with dynamic data loading and Bootstrap styling Revert Rsx::Route() highlighting in Blade/PHP files Target specific PHP scopes for Rsx::Route() highlighting in Blade Expand injection selector for Rsx::Route() highlighting Add custom syntax highlighting for Rsx::Route() and Rsx.Route() calls Update jqhtml packages to v2.2.165 Add bundle path validation for common mistakes (development mode only) Create Ajax_Select_Input widget and Rsx_Reference_Data controller Create Country_Select_Input widget with default country support Initialize Tom Select on Select_Input widgets Add Tom Select bundle for enhanced select dropdowns Implement ISO 3166 geographic data system for country/region selection Implement widget-based form system with disabled state support 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
4
node_modules/webpack/lib/library/AbstractLibraryPlugin.js
generated
vendored
Executable file → Normal file
4
node_modules/webpack/lib/library/AbstractLibraryPlugin.js
generated
vendored
Executable file → Normal file
@@ -17,9 +17,9 @@ const JavascriptModulesPlugin = require("../javascript/JavascriptModulesPlugin")
|
||||
/** @typedef {import("../Compilation").ChunkHashContext} ChunkHashContext */
|
||||
/** @typedef {import("../Compiler")} Compiler */
|
||||
/** @typedef {import("../Module")} Module */
|
||||
/** @typedef {import("../Module").RuntimeRequirements} RuntimeRequirements */
|
||||
/** @typedef {import("../javascript/JavascriptModulesPlugin").RenderContext} RenderContext */
|
||||
/** @typedef {import("../javascript/JavascriptModulesPlugin").StartupRenderContext} StartupRenderContext */
|
||||
/** @typedef {import("../javascript/JavascriptModulesPlugin").ChunkRenderContext} ChunkRenderContext */
|
||||
/** @typedef {import("../javascript/JavascriptModulesPlugin").ModuleRenderContext} ModuleRenderContext */
|
||||
/** @typedef {import("../util/Hash")} Hash */
|
||||
|
||||
@@ -273,7 +273,7 @@ class AbstractLibraryPlugin {
|
||||
|
||||
/**
|
||||
* @param {Chunk} chunk the chunk
|
||||
* @param {Set<string>} set runtime requirements
|
||||
* @param {RuntimeRequirements} set runtime requirements
|
||||
* @param {LibraryContext<T>} libraryContext context
|
||||
* @returns {void}
|
||||
*/
|
||||
|
||||
1
node_modules/webpack/lib/library/AmdLibraryPlugin.js
generated
vendored
1
node_modules/webpack/lib/library/AmdLibraryPlugin.js
generated
vendored
@@ -15,7 +15,6 @@ const AbstractLibraryPlugin = require("./AbstractLibraryPlugin");
|
||||
/** @typedef {import("../../declarations/WebpackOptions").LibraryType} LibraryType */
|
||||
/** @typedef {import("../Chunk")} Chunk */
|
||||
/** @typedef {import("../Compilation").ChunkHashContext} ChunkHashContext */
|
||||
/** @typedef {import("../Compiler")} Compiler */
|
||||
/** @typedef {import("../javascript/JavascriptModulesPlugin").RenderContext} RenderContext */
|
||||
/** @typedef {import("../util/Hash")} Hash */
|
||||
/** @template T @typedef {import("./AbstractLibraryPlugin").LibraryContext<T>} LibraryContext<T> */
|
||||
|
||||
35
node_modules/webpack/lib/library/AssignLibraryPlugin.js
generated
vendored
35
node_modules/webpack/lib/library/AssignLibraryPlugin.js
generated
vendored
@@ -16,14 +16,21 @@ const AbstractLibraryPlugin = require("./AbstractLibraryPlugin");
|
||||
/** @typedef {import("webpack-sources").Source} Source */
|
||||
/** @typedef {import("../../declarations/WebpackOptions").LibraryOptions} LibraryOptions */
|
||||
/** @typedef {import("../../declarations/WebpackOptions").LibraryType} LibraryType */
|
||||
/** @typedef {import("../../declarations/WebpackOptions").LibraryExport} LibraryExport */
|
||||
/** @typedef {import("../Chunk")} Chunk */
|
||||
/** @typedef {import("../Compilation")} Compilation */
|
||||
/** @typedef {import("../Compilation").ChunkHashContext} ChunkHashContext */
|
||||
/** @typedef {import("../Module")} Module */
|
||||
/** @typedef {import("../Module").RuntimeRequirements} RuntimeRequirements */
|
||||
/** @typedef {import("../ExportsInfo").ExportInfoName} ExportInfoName */
|
||||
/** @typedef {import("../javascript/JavascriptModulesPlugin").RenderContext} RenderContext */
|
||||
/** @typedef {import("../javascript/JavascriptModulesPlugin").StartupRenderContext} StartupRenderContext */
|
||||
/** @typedef {import("../util/Hash")} Hash */
|
||||
/** @template T @typedef {import("./AbstractLibraryPlugin").LibraryContext<T>} LibraryContext<T> */
|
||||
|
||||
/**
|
||||
* @template T
|
||||
* @typedef {import("./AbstractLibraryPlugin").LibraryContext<T>} LibraryContext<T>
|
||||
*/
|
||||
|
||||
const KEYWORD_REGEX =
|
||||
/^(await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|false|finally|for|function|if|implements|import|in|instanceof|interface|let|new|null|package|private|protected|public|return|super|switch|static|this|throw|try|true|typeof|var|void|while|with|yield)$/;
|
||||
@@ -89,19 +96,23 @@ const accessWithInit = (accessor, existingLength, initLast = false) => {
|
||||
return current;
|
||||
};
|
||||
|
||||
/** @typedef {string[] | "global"} LibraryPrefix */
|
||||
|
||||
/**
|
||||
* @typedef {object} AssignLibraryPluginOptions
|
||||
* @property {LibraryType} type
|
||||
* @property {string[] | "global"} prefix name prefix
|
||||
* @property {LibraryPrefix} prefix name prefix
|
||||
* @property {string | false} declare declare name as variable
|
||||
* @property {"error"|"static"|"copy"|"assign"} unnamed behavior for unnamed library name
|
||||
* @property {"copy"|"assign"=} named behavior for named library name
|
||||
* @property {"error" | "static" | "copy" | "assign"} unnamed behavior for unnamed library name
|
||||
* @property {"copy" | "assign"=} named behavior for named library name
|
||||
*/
|
||||
|
||||
/** @typedef {string | string[]} LibraryName */
|
||||
|
||||
/**
|
||||
* @typedef {object} AssignLibraryPluginParsed
|
||||
* @property {string | string[]} name
|
||||
* @property {string | string[] | undefined} export
|
||||
* @property {LibraryName} name
|
||||
* @property {LibraryExport=} export
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -140,7 +151,7 @@ class AssignLibraryPlugin extends AbstractLibraryPlugin {
|
||||
`Library name must be a string, string array or unset. ${AbstractLibraryPlugin.COMMON_LIBRARY_NAME_MESSAGE}`
|
||||
);
|
||||
}
|
||||
const _name = /** @type {string | string[]} */ (name);
|
||||
const _name = /** @type {LibraryName} */ (name);
|
||||
return {
|
||||
name: _name,
|
||||
export: library.export
|
||||
@@ -175,7 +186,7 @@ class AssignLibraryPlugin extends AbstractLibraryPlugin {
|
||||
|
||||
/**
|
||||
* @param {Compilation} compilation the compilation
|
||||
* @returns {string[]} the prefix
|
||||
* @returns {LibraryPrefix} the prefix
|
||||
*/
|
||||
_getPrefix(compilation) {
|
||||
return this.prefix === "global"
|
||||
@@ -187,7 +198,7 @@ class AssignLibraryPlugin extends AbstractLibraryPlugin {
|
||||
* @param {AssignLibraryPluginParsed} options the library options
|
||||
* @param {Chunk} chunk the chunk
|
||||
* @param {Compilation} compilation the compilation
|
||||
* @returns {Array<string>} the resolved full name
|
||||
* @returns {string[]} the resolved full name
|
||||
*/
|
||||
_getResolvedFullName(options, chunk, compilation) {
|
||||
const prefix = this._getPrefix(compilation);
|
||||
@@ -196,7 +207,7 @@ class AssignLibraryPlugin extends AbstractLibraryPlugin {
|
||||
...prefix,
|
||||
...(Array.isArray(options.name) ? options.name : [options.name])
|
||||
]
|
||||
: prefix;
|
||||
: /** @type {string[]} */ (prefix);
|
||||
return fullName.map((n) =>
|
||||
compilation.getPath(n, {
|
||||
chunk
|
||||
@@ -311,7 +322,7 @@ class AssignLibraryPlugin extends AbstractLibraryPlugin {
|
||||
true
|
||||
);
|
||||
|
||||
/** @type {string[]} */
|
||||
/** @type {ExportInfoName[]} */
|
||||
const provided = [];
|
||||
for (const exportInfo of exportsInfo.orderedExports) {
|
||||
if (!exportInfo.provided) continue;
|
||||
@@ -392,7 +403,7 @@ class AssignLibraryPlugin extends AbstractLibraryPlugin {
|
||||
|
||||
/**
|
||||
* @param {Chunk} chunk the chunk
|
||||
* @param {Set<string>} set runtime requirements
|
||||
* @param {RuntimeRequirements} set runtime requirements
|
||||
* @param {LibraryContext<T>} libraryContext context
|
||||
* @returns {void}
|
||||
*/
|
||||
|
||||
18
node_modules/webpack/lib/library/EnableLibraryPlugin.js
generated
vendored
18
node_modules/webpack/lib/library/EnableLibraryPlugin.js
generated
vendored
@@ -5,11 +5,12 @@
|
||||
|
||||
"use strict";
|
||||
|
||||
/** @typedef {import("../../declarations/WebpackOptions").LibraryOptions} LibraryOptions */
|
||||
/** @typedef {import("../../declarations/WebpackOptions").LibraryType} LibraryType */
|
||||
/** @typedef {import("../Compiler")} Compiler */
|
||||
|
||||
/** @type {WeakMap<Compiler, Set<LibraryType>>} */
|
||||
/** @typedef {Set<LibraryType>} LibraryTypes */
|
||||
|
||||
/** @type {WeakMap<Compiler, LibraryTypes>} */
|
||||
const enabledTypes = new WeakMap();
|
||||
|
||||
/**
|
||||
@@ -19,7 +20,7 @@ const enabledTypes = new WeakMap();
|
||||
|
||||
/**
|
||||
* @param {Compiler} compiler the compiler instance
|
||||
* @returns {Set<LibraryType>} enabled types
|
||||
* @returns {LibraryTypes} enabled types
|
||||
*/
|
||||
const getEnabledTypes = (compiler) => {
|
||||
let set = enabledTypes.get(compiler);
|
||||
@@ -87,13 +88,10 @@ class EnableLibraryPlugin {
|
||||
|
||||
if (typeof type === "string") {
|
||||
const enableExportProperty = () => {
|
||||
const ExportPropertyTemplatePlugin = require("./ExportPropertyLibraryPlugin");
|
||||
const ExportPropertyLibraryPlugin = require("./ExportPropertyLibraryPlugin");
|
||||
|
||||
new ExportPropertyTemplatePlugin({
|
||||
type,
|
||||
nsObjectUsed: !["module", "modern-module"].includes(type),
|
||||
runtimeExportsUsed: !["module", "modern-module"].includes(type),
|
||||
renderStartupUsed: !["module", "modern-module"].includes(type)
|
||||
new ExportPropertyLibraryPlugin({
|
||||
type
|
||||
}).apply(compiler);
|
||||
};
|
||||
switch (type) {
|
||||
@@ -286,8 +284,6 @@ class EnableLibraryPlugin {
|
||||
}
|
||||
case "module":
|
||||
case "modern-module": {
|
||||
enableExportProperty();
|
||||
|
||||
const ModuleLibraryPlugin = require("./ModuleLibraryPlugin");
|
||||
|
||||
new ModuleLibraryPlugin({
|
||||
|
||||
28
node_modules/webpack/lib/library/ExportPropertyLibraryPlugin.js
generated
vendored
28
node_modules/webpack/lib/library/ExportPropertyLibraryPlugin.js
generated
vendored
@@ -15,23 +15,21 @@ const AbstractLibraryPlugin = require("./AbstractLibraryPlugin");
|
||||
/** @typedef {import("webpack-sources").Source} Source */
|
||||
/** @typedef {import("../../declarations/WebpackOptions").LibraryOptions} LibraryOptions */
|
||||
/** @typedef {import("../../declarations/WebpackOptions").LibraryType} LibraryType */
|
||||
/** @typedef {import("../../declarations/WebpackOptions").LibraryExport} LibraryExport */
|
||||
/** @typedef {import("../Chunk")} Chunk */
|
||||
/** @typedef {import("../Compiler")} Compiler */
|
||||
/** @typedef {import("../Module")} Module */
|
||||
/** @typedef {import("../Module").RuntimeRequirements} RuntimeRequirements */
|
||||
/** @typedef {import("../javascript/JavascriptModulesPlugin").StartupRenderContext} StartupRenderContext */
|
||||
/** @template T @typedef {import("./AbstractLibraryPlugin").LibraryContext<T>} LibraryContext<T> */
|
||||
|
||||
/**
|
||||
* @typedef {object} ExportPropertyLibraryPluginParsed
|
||||
* @property {string | string[]} export
|
||||
* @property {LibraryExport=} export
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {object} ExportPropertyLibraryPluginOptions
|
||||
* @property {LibraryType} type
|
||||
* @property {boolean} nsObjectUsed the namespace object is used
|
||||
* @property {boolean} runtimeExportsUsed runtime exports are used
|
||||
* @property {boolean} renderStartupUsed render startup is used
|
||||
*/
|
||||
/**
|
||||
* @typedef {ExportPropertyLibraryPluginParsed} T
|
||||
@@ -41,14 +39,11 @@ class ExportPropertyLibraryPlugin extends AbstractLibraryPlugin {
|
||||
/**
|
||||
* @param {ExportPropertyLibraryPluginOptions} options options
|
||||
*/
|
||||
constructor({ type, nsObjectUsed, runtimeExportsUsed, renderStartupUsed }) {
|
||||
constructor({ type }) {
|
||||
super({
|
||||
pluginName: "ExportPropertyLibraryPlugin",
|
||||
type
|
||||
});
|
||||
this.nsObjectUsed = nsObjectUsed;
|
||||
this.runtimeExportsUsed = runtimeExportsUsed;
|
||||
this.renderStartupUsed = renderStartupUsed;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -57,7 +52,7 @@ class ExportPropertyLibraryPlugin extends AbstractLibraryPlugin {
|
||||
*/
|
||||
parseOptions(library) {
|
||||
return {
|
||||
export: /** @type {string | string[]} */ (library.export)
|
||||
export: library.export
|
||||
};
|
||||
}
|
||||
|
||||
@@ -82,25 +77,19 @@ class ExportPropertyLibraryPlugin extends AbstractLibraryPlugin {
|
||||
exportsInfo.canMangleUse = false;
|
||||
} else {
|
||||
const exportsInfo = moduleGraph.getExportsInfo(module);
|
||||
if (this.nsObjectUsed) {
|
||||
exportsInfo.setUsedInUnknownWay(runtime);
|
||||
} else {
|
||||
exportsInfo.setAllKnownExportsUsed(runtime);
|
||||
}
|
||||
exportsInfo.setUsedInUnknownWay(runtime);
|
||||
}
|
||||
moduleGraph.addExtraReason(module, "used as library export");
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Chunk} chunk the chunk
|
||||
* @param {Set<string>} set runtime requirements
|
||||
* @param {RuntimeRequirements} set runtime requirements
|
||||
* @param {LibraryContext<T>} libraryContext context
|
||||
* @returns {void}
|
||||
*/
|
||||
runtimeRequirements(chunk, set, libraryContext) {
|
||||
if (this.runtimeExportsUsed) {
|
||||
set.add(RuntimeGlobals.exports);
|
||||
}
|
||||
set.add(RuntimeGlobals.exports);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -111,7 +100,6 @@ class ExportPropertyLibraryPlugin extends AbstractLibraryPlugin {
|
||||
* @returns {Source} source with library export
|
||||
*/
|
||||
renderStartup(source, module, renderContext, { options }) {
|
||||
if (!this.renderStartupUsed) return source;
|
||||
if (!options.export) return source;
|
||||
const postfix = `${RuntimeGlobals.exports} = ${
|
||||
RuntimeGlobals.exports
|
||||
|
||||
7
node_modules/webpack/lib/library/JsonpLibraryPlugin.js
generated
vendored
7
node_modules/webpack/lib/library/JsonpLibraryPlugin.js
generated
vendored
@@ -13,10 +13,13 @@ const AbstractLibraryPlugin = require("./AbstractLibraryPlugin");
|
||||
/** @typedef {import("../../declarations/WebpackOptions").LibraryType} LibraryType */
|
||||
/** @typedef {import("../Chunk")} Chunk */
|
||||
/** @typedef {import("../Compilation").ChunkHashContext} ChunkHashContext */
|
||||
/** @typedef {import("../Compiler")} Compiler */
|
||||
/** @typedef {import("../javascript/JavascriptModulesPlugin").RenderContext} RenderContext */
|
||||
/** @typedef {import("../util/Hash")} Hash */
|
||||
/** @template T @typedef {import("./AbstractLibraryPlugin").LibraryContext<T>} LibraryContext<T> */
|
||||
|
||||
/**
|
||||
* @template T
|
||||
* @typedef {import("./AbstractLibraryPlugin").LibraryContext<T>} LibraryContext<T>
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {object} JsonpLibraryPluginOptions
|
||||
|
||||
131
node_modules/webpack/lib/library/ModuleLibraryPlugin.js
generated
vendored
131
node_modules/webpack/lib/library/ModuleLibraryPlugin.js
generated
vendored
@@ -6,24 +6,24 @@
|
||||
"use strict";
|
||||
|
||||
const { ConcatSource } = require("webpack-sources");
|
||||
const { UsageState } = require("../ExportsInfo");
|
||||
const RuntimeGlobals = require("../RuntimeGlobals");
|
||||
const Template = require("../Template");
|
||||
const CommonJsSelfReferenceDependency = require("../dependencies/CommonJsSelfReferenceDependency");
|
||||
const ConcatenatedModule = require("../optimize/ConcatenatedModule");
|
||||
const propertyAccess = require("../util/propertyAccess");
|
||||
const { getEntryRuntime } = require("../util/runtime");
|
||||
const AbstractLibraryPlugin = require("./AbstractLibraryPlugin");
|
||||
|
||||
/** @typedef {import("webpack-sources").Source} Source */
|
||||
/** @typedef {import("../../declarations/WebpackOptions").LibraryOptions} LibraryOptions */
|
||||
/** @typedef {import("../../declarations/WebpackOptions").LibraryType} LibraryType */
|
||||
/** @typedef {import("../../declarations/WebpackOptions").LibraryExport} LibraryExport */
|
||||
/** @typedef {import("../Chunk")} Chunk */
|
||||
/** @typedef {import("../Compilation").ChunkHashContext} ChunkHashContext */
|
||||
/** @typedef {import("../Compiler")} Compiler */
|
||||
/** @typedef {import("../Module")} Module */
|
||||
/** @typedef {import("../Module").BuildMeta} BuildMeta */
|
||||
/** @typedef {import("../Module").RuntimeRequirements} RuntimeRequirements */
|
||||
/** @typedef {import("../javascript/JavascriptModulesPlugin").StartupRenderContext} StartupRenderContext */
|
||||
/** @typedef {import("../javascript/JavascriptModulesPlugin").ModuleRenderContext} ModuleRenderContext */
|
||||
/** @typedef {import("../util/Hash")} Hash */
|
||||
|
||||
/**
|
||||
* @template T
|
||||
@@ -38,7 +38,7 @@ const AbstractLibraryPlugin = require("./AbstractLibraryPlugin");
|
||||
/**
|
||||
* @typedef {object} ModuleLibraryPluginParsed
|
||||
* @property {string} name
|
||||
* @property {string | string[]=} export
|
||||
* @property {LibraryExport=} export
|
||||
*/
|
||||
|
||||
const PLUGIN_NAME = "ModuleLibraryPlugin";
|
||||
@@ -73,6 +73,47 @@ class ModuleLibraryPlugin extends AbstractLibraryPlugin {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Module} module the exporting entry module
|
||||
* @param {string} entryName the name of the entrypoint
|
||||
* @param {LibraryContext<T>} libraryContext context
|
||||
* @returns {void}
|
||||
*/
|
||||
finishEntryModule(
|
||||
module,
|
||||
entryName,
|
||||
{ options, compilation, compilation: { moduleGraph } }
|
||||
) {
|
||||
const runtime = getEntryRuntime(compilation, entryName);
|
||||
if (options.export) {
|
||||
const exportsInfo = moduleGraph.getExportInfo(
|
||||
module,
|
||||
Array.isArray(options.export) ? options.export[0] : options.export
|
||||
);
|
||||
exportsInfo.setUsed(UsageState.Used, runtime);
|
||||
exportsInfo.canMangleUse = false;
|
||||
} else {
|
||||
const exportsInfo = moduleGraph.getExportsInfo(module);
|
||||
// If the entry module is commonjs, its exports cannot be mangled
|
||||
if (module.buildMeta && module.buildMeta.treatAsCommonJs) {
|
||||
exportsInfo.setUsedInUnknownWay(runtime);
|
||||
} else {
|
||||
exportsInfo.setAllKnownExportsUsed(runtime);
|
||||
}
|
||||
}
|
||||
moduleGraph.addExtraReason(module, "used as library export");
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Chunk} chunk the chunk
|
||||
* @param {RuntimeRequirements} set runtime requirements
|
||||
* @param {LibraryContext<T>} libraryContext context
|
||||
* @returns {void}
|
||||
*/
|
||||
runtimeRequirements(chunk, set, libraryContext) {
|
||||
set.add(RuntimeGlobals.exports);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {LibraryOptions} library normalized library option
|
||||
* @returns {T | false} preprocess as needed by overriding
|
||||
@@ -101,21 +142,18 @@ class ModuleLibraryPlugin extends AbstractLibraryPlugin {
|
||||
renderStartup(
|
||||
source,
|
||||
module,
|
||||
{ moduleGraph, chunk, codeGenerationResults, inlined, inlinedInIIFE },
|
||||
{
|
||||
moduleGraph,
|
||||
chunk,
|
||||
codeGenerationResults,
|
||||
inlined,
|
||||
inlinedInIIFE,
|
||||
runtimeTemplate
|
||||
},
|
||||
{ options, compilation }
|
||||
) {
|
||||
const result = new ConcatSource(source);
|
||||
|
||||
if (!module.buildMeta || !module.buildMeta.exportsType) {
|
||||
for (const dependency of module.dependencies) {
|
||||
if (dependency instanceof CommonJsSelfReferenceDependency) {
|
||||
result.add(`export { ${RuntimeGlobals.exports} as default }`);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
const exportsInfo = options.export
|
||||
? [
|
||||
moduleGraph.getExportInfo(
|
||||
@@ -126,9 +164,7 @@ class ModuleLibraryPlugin extends AbstractLibraryPlugin {
|
||||
: moduleGraph.getExportsInfo(module).orderedExports;
|
||||
const definitions =
|
||||
inlined && !inlinedInIIFE
|
||||
? (module.buildMeta &&
|
||||
/** @type {GenerationMeta} */ module.buildMeta.exportsFinalName) ||
|
||||
{}
|
||||
? (module.buildMeta && module.buildMeta.exportsFinalName) || {}
|
||||
: {};
|
||||
/** @type {string[]} */
|
||||
const shortHandedExports = [];
|
||||
@@ -136,54 +172,55 @@ class ModuleLibraryPlugin extends AbstractLibraryPlugin {
|
||||
const exports = [];
|
||||
const isAsync = moduleGraph.isAsync(module);
|
||||
|
||||
const treatAsCommonJs =
|
||||
module.buildMeta && module.buildMeta.treatAsCommonJs;
|
||||
const skipRenderDefaultExport = Boolean(treatAsCommonJs);
|
||||
|
||||
if (isAsync) {
|
||||
result.add(
|
||||
`${RuntimeGlobals.exports} = await ${RuntimeGlobals.exports};\n`
|
||||
);
|
||||
}
|
||||
|
||||
const varType = compilation.outputOptions.environment.const
|
||||
? "const"
|
||||
: "var";
|
||||
|
||||
for (const exportInfo of exportsInfo) {
|
||||
outer: for (const exportInfo of exportsInfo) {
|
||||
if (!exportInfo.provided) continue;
|
||||
|
||||
let shouldContinue = false;
|
||||
const originalName = exportInfo.name;
|
||||
|
||||
const reexport = exportInfo.findTarget(moduleGraph, (_m) => true);
|
||||
if (skipRenderDefaultExport && originalName === "default") continue;
|
||||
|
||||
if (reexport) {
|
||||
const exp = moduleGraph.getExportsInfo(reexport.module);
|
||||
const target = exportInfo.findTarget(moduleGraph, (_m) => true);
|
||||
if (target) {
|
||||
const reexportsInfo = moduleGraph.getExportsInfo(target.module);
|
||||
|
||||
for (const reexportInfo of exp.orderedExports) {
|
||||
for (const reexportInfo of reexportsInfo.orderedExports) {
|
||||
if (
|
||||
reexportInfo.provided === false &&
|
||||
reexportInfo.name !== "default" &&
|
||||
reexportInfo.name === /** @type {string[]} */ (reexport.export)[0]
|
||||
reexportInfo.name === /** @type {string[]} */ (target.export)[0]
|
||||
) {
|
||||
shouldContinue = true;
|
||||
continue outer;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (shouldContinue) continue;
|
||||
|
||||
const originalName = exportInfo.name;
|
||||
const usedName =
|
||||
/** @type {string} */
|
||||
(exportInfo.getUsedName(originalName, chunk.runtime));
|
||||
/** @type {string | undefined} */
|
||||
const definition = definitions[usedName];
|
||||
const finalName =
|
||||
definition ||
|
||||
`${RuntimeGlobals.exports}${Template.toIdentifier(originalName)}`;
|
||||
|
||||
if (!definition) {
|
||||
/** @type {string | undefined} */
|
||||
let finalName;
|
||||
|
||||
if (definition) {
|
||||
finalName = definition;
|
||||
} else {
|
||||
finalName = `${RuntimeGlobals.exports}${Template.toIdentifier(originalName)}`;
|
||||
result.add(
|
||||
`${varType} ${finalName} = ${RuntimeGlobals.exports}${propertyAccess([
|
||||
usedName
|
||||
])};\n`
|
||||
`${runtimeTemplate.renderConst()} ${finalName} = ${RuntimeGlobals.exports}${propertyAccess(
|
||||
[usedName]
|
||||
)};\n`
|
||||
);
|
||||
}
|
||||
|
||||
@@ -201,7 +238,9 @@ class ModuleLibraryPlugin extends AbstractLibraryPlugin {
|
||||
|
||||
if (topLevelDeclarations && topLevelDeclarations.has(originalName)) {
|
||||
const name = `${RuntimeGlobals.exports}${Template.toIdentifier(originalName)}`;
|
||||
result.add(`${varType} ${name} = ${finalName};\n`);
|
||||
result.add(
|
||||
`${runtimeTemplate.renderConst()} ${name} = ${finalName};\n`
|
||||
);
|
||||
shortHandedExports.push(`${name} as ${originalName}`);
|
||||
} else {
|
||||
exports.push([originalName, finalName]);
|
||||
@@ -218,12 +257,18 @@ class ModuleLibraryPlugin extends AbstractLibraryPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
if (treatAsCommonJs) {
|
||||
shortHandedExports.push(`${RuntimeGlobals.exports} as default`);
|
||||
}
|
||||
|
||||
if (shortHandedExports.length > 0) {
|
||||
result.add(`export { ${shortHandedExports.join(", ")} };\n`);
|
||||
}
|
||||
|
||||
for (const [exportName, final] of exports) {
|
||||
result.add(`export ${varType} ${exportName} = ${final};\n`);
|
||||
result.add(
|
||||
`export ${runtimeTemplate.renderConst()} ${exportName} = ${final};\n`
|
||||
);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
21
node_modules/webpack/lib/library/SystemLibraryPlugin.js
generated
vendored
21
node_modules/webpack/lib/library/SystemLibraryPlugin.js
generated
vendored
@@ -17,7 +17,6 @@ const AbstractLibraryPlugin = require("./AbstractLibraryPlugin");
|
||||
/** @typedef {import("../../declarations/WebpackOptions").LibraryType} LibraryType */
|
||||
/** @typedef {import("../Chunk")} Chunk */
|
||||
/** @typedef {import("../Compilation").ChunkHashContext} ChunkHashContext */
|
||||
/** @typedef {import("../Compiler")} Compiler */
|
||||
/** @typedef {import("../javascript/JavascriptModulesPlugin").RenderContext} RenderContext */
|
||||
/** @typedef {import("../util/Hash")} Hash */
|
||||
/** @template T @typedef {import("./AbstractLibraryPlugin").LibraryContext<T>} LibraryContext<T> */
|
||||
@@ -135,11 +134,21 @@ class SystemLibraryPlugin extends AbstractLibraryPlugin {
|
||||
);
|
||||
if (used) {
|
||||
if (otherUnused || used !== exportInfo.name) {
|
||||
instructions.push(
|
||||
`${external}${propertyAccess([
|
||||
used
|
||||
])} = module${propertyAccess([exportInfo.name])};`
|
||||
);
|
||||
if (exportInfo.name === "default") {
|
||||
// Ideally we should use `module && module.__esModule ? module['default'] : module`
|
||||
// But we need to keep compatibility with SystemJS format libraries (they are using `default`) and bundled SystemJS libraries from commonjs format
|
||||
instructions.push(
|
||||
`${external}${propertyAccess([
|
||||
used
|
||||
])} = module["default"] || module;`
|
||||
);
|
||||
} else {
|
||||
instructions.push(
|
||||
`${external}${propertyAccess([
|
||||
used
|
||||
])} = module${propertyAccess([exportInfo.name])};`
|
||||
);
|
||||
}
|
||||
handledNames.push(exportInfo.name);
|
||||
}
|
||||
} else {
|
||||
|
||||
30
node_modules/webpack/lib/library/UmdLibraryPlugin.js
generated
vendored
30
node_modules/webpack/lib/library/UmdLibraryPlugin.js
generated
vendored
@@ -16,14 +16,12 @@ const AbstractLibraryPlugin = require("./AbstractLibraryPlugin");
|
||||
/** @typedef {import("../../declarations/WebpackOptions").LibraryName} LibraryName */
|
||||
/** @typedef {import("../../declarations/WebpackOptions").LibraryOptions} LibraryOptions */
|
||||
/** @typedef {import("../../declarations/WebpackOptions").LibraryType} LibraryType */
|
||||
/** @typedef {import("../Compiler")} Compiler */
|
||||
/** @typedef {import("../javascript/JavascriptModulesPlugin").RenderContext} RenderContext */
|
||||
/** @typedef {import("../ExternalModule").RequestRecord} RequestRecord */
|
||||
/** @typedef {import("../util/Hash")} Hash */
|
||||
|
||||
/**
|
||||
* @template T
|
||||
* @typedef {import("./AbstractLibraryPlugin").LibraryContext<T>}
|
||||
* LibraryContext<T>
|
||||
* @typedef {import("./AbstractLibraryPlugin").LibraryContext<T>} LibraryContext<T>
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -33,9 +31,11 @@ const AbstractLibraryPlugin = require("./AbstractLibraryPlugin");
|
||||
const accessorToObjectAccess = (accessor) =>
|
||||
accessor.map((a) => `[${JSON.stringify(a)}]`).join("");
|
||||
|
||||
/** @typedef {string | string[]} Accessor */
|
||||
|
||||
/**
|
||||
* @param {string|undefined} base the path prefix
|
||||
* @param {string|string[]} accessor the accessor
|
||||
* @param {Accessor} accessor the accessor
|
||||
* @param {string=} joinWith the element separator
|
||||
* @returns {string} the path
|
||||
*/
|
||||
@@ -55,8 +55,6 @@ const accessorAccess = (base, accessor, joinWith = ", ") => {
|
||||
.join(joinWith);
|
||||
};
|
||||
|
||||
/** @typedef {string | string[] | LibraryCustomUmdObject} UmdLibraryPluginName */
|
||||
|
||||
/**
|
||||
* @typedef {object} UmdLibraryPluginOptions
|
||||
* @property {LibraryType} type
|
||||
@@ -194,10 +192,9 @@ class UmdLibraryPlugin extends AbstractLibraryPlugin {
|
||||
/** @type {RequestRecord} */
|
||||
(request).root;
|
||||
}
|
||||
return `root${accessorToObjectAccess(
|
||||
/** @type {string[]} */
|
||||
([...(Array.isArray(request) ? request : [request])])
|
||||
)}`;
|
||||
return `root${accessorToObjectAccess([
|
||||
...(Array.isArray(request) ? request : [request])
|
||||
])}`;
|
||||
})
|
||||
.join(", ")
|
||||
);
|
||||
@@ -250,17 +247,14 @@ class UmdLibraryPlugin extends AbstractLibraryPlugin {
|
||||
.join(", ");
|
||||
|
||||
/**
|
||||
* @param {string| string[]} library library name
|
||||
* @param {Accessor} library library name
|
||||
* @returns {string} stringified library name
|
||||
*/
|
||||
const libraryName = (library) =>
|
||||
JSON.stringify(
|
||||
replaceKeys(
|
||||
/** @type {string} */
|
||||
(
|
||||
/** @type {string[]} */
|
||||
([...(Array.isArray(library) ? library : [library])]).pop()
|
||||
)
|
||||
([...(Array.isArray(library) ? library : [library])].pop())
|
||||
)
|
||||
);
|
||||
|
||||
@@ -324,7 +318,7 @@ class UmdLibraryPlugin extends AbstractLibraryPlugin {
|
||||
"commonjs"
|
||||
)} else if(typeof exports === 'object')\n` +
|
||||
` exports[${libraryName(
|
||||
/** @type {string | string[]} */
|
||||
/** @type {Accessor} */
|
||||
(names.commonjs || names.root)
|
||||
)}] = factory(${externalsRequireArray(
|
||||
"commonjs"
|
||||
@@ -332,7 +326,7 @@ class UmdLibraryPlugin extends AbstractLibraryPlugin {
|
||||
` ${replaceKeys(
|
||||
accessorAccess(
|
||||
"root",
|
||||
/** @type {string | string[]} */
|
||||
/** @type {Accessor} */
|
||||
(names.root || names.commonjs)
|
||||
)
|
||||
)} = factory(${externalsRootArray(externals)});\n`
|
||||
|
||||
Reference in New Issue
Block a user