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>
139 lines
4.0 KiB
JavaScript
139 lines
4.0 KiB
JavaScript
/*
|
|
MIT License http://www.opensource.org/licenses/mit-license.php
|
|
Author Tobias Koppers @sokra
|
|
*/
|
|
|
|
"use strict";
|
|
|
|
/** @typedef {import("../../declarations/WebpackOptions").WasmLoadingType} WasmLoadingType */
|
|
/** @typedef {import("../Compiler")} Compiler */
|
|
|
|
/** @typedef {Set<WasmLoadingType>} WasmLoadingTypes */
|
|
|
|
/** @type {WeakMap<Compiler, Set<WasmLoadingType>>} */
|
|
const enabledTypes = new WeakMap();
|
|
|
|
/**
|
|
* @param {Compiler} compiler compiler instance
|
|
* @returns {WasmLoadingTypes} enabled types
|
|
*/
|
|
const getEnabledTypes = (compiler) => {
|
|
let set = enabledTypes.get(compiler);
|
|
if (set === undefined) {
|
|
set = new Set();
|
|
enabledTypes.set(compiler, set);
|
|
}
|
|
return set;
|
|
};
|
|
|
|
class EnableWasmLoadingPlugin {
|
|
/**
|
|
* @param {WasmLoadingType} type library type that should be available
|
|
*/
|
|
constructor(type) {
|
|
this.type = type;
|
|
}
|
|
|
|
/**
|
|
* @param {Compiler} compiler the compiler instance
|
|
* @param {WasmLoadingType} type type of library
|
|
* @returns {void}
|
|
*/
|
|
static setEnabled(compiler, type) {
|
|
getEnabledTypes(compiler).add(type);
|
|
}
|
|
|
|
/**
|
|
* @param {Compiler} compiler the compiler instance
|
|
* @param {WasmLoadingType} type type of library
|
|
* @returns {void}
|
|
*/
|
|
static checkEnabled(compiler, type) {
|
|
if (!getEnabledTypes(compiler).has(type)) {
|
|
throw new Error(
|
|
`Library type "${type}" is not enabled. ` +
|
|
"EnableWasmLoadingPlugin need to be used to enable this type of wasm loading. " +
|
|
'This usually happens through the "output.enabledWasmLoadingTypes" option. ' +
|
|
'If you are using a function as entry which sets "wasmLoading", you need to add all potential library types to "output.enabledWasmLoadingTypes". ' +
|
|
`These types are enabled: ${[...getEnabledTypes(compiler)].join(", ")}`
|
|
);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Apply the plugin
|
|
* @param {Compiler} compiler the compiler instance
|
|
* @returns {void}
|
|
*/
|
|
apply(compiler) {
|
|
const { type } = this;
|
|
|
|
// Only enable once
|
|
const enabled = getEnabledTypes(compiler);
|
|
if (enabled.has(type)) return;
|
|
enabled.add(type);
|
|
|
|
if (typeof type === "string") {
|
|
switch (type) {
|
|
case "fetch": {
|
|
if (compiler.options.experiments.syncWebAssembly) {
|
|
// TODO webpack 6 remove FetchCompileWasmPlugin
|
|
const FetchCompileWasmPlugin = require("../web/FetchCompileWasmPlugin");
|
|
|
|
new FetchCompileWasmPlugin({
|
|
mangleImports: compiler.options.optimization.mangleWasmImports
|
|
}).apply(compiler);
|
|
}
|
|
|
|
if (compiler.options.experiments.asyncWebAssembly) {
|
|
const FetchCompileAsyncWasmPlugin = require("../web/FetchCompileAsyncWasmPlugin");
|
|
|
|
new FetchCompileAsyncWasmPlugin().apply(compiler);
|
|
}
|
|
|
|
break;
|
|
}
|
|
case "async-node": {
|
|
if (compiler.options.experiments.syncWebAssembly) {
|
|
// TODO webpack 6 remove ReadFileCompileWasmPlugin
|
|
const ReadFileCompileWasmPlugin = require("../node/ReadFileCompileWasmPlugin");
|
|
|
|
new ReadFileCompileWasmPlugin({
|
|
mangleImports: compiler.options.optimization.mangleWasmImports,
|
|
import:
|
|
compiler.options.output.module &&
|
|
compiler.options.output.environment.dynamicImport
|
|
}).apply(compiler);
|
|
}
|
|
|
|
if (compiler.options.experiments.asyncWebAssembly) {
|
|
const ReadFileCompileAsyncWasmPlugin = require("../node/ReadFileCompileAsyncWasmPlugin");
|
|
|
|
new ReadFileCompileAsyncWasmPlugin({
|
|
import:
|
|
compiler.options.output.module &&
|
|
compiler.options.output.environment.dynamicImport
|
|
}).apply(compiler);
|
|
}
|
|
|
|
break;
|
|
}
|
|
case "universal": {
|
|
const UniversalCompileAsyncWasmPlugin = require("../wasm-async/UniversalCompileAsyncWasmPlugin");
|
|
|
|
new UniversalCompileAsyncWasmPlugin().apply(compiler);
|
|
break;
|
|
}
|
|
default:
|
|
throw new Error(`Unsupported wasm loading type ${type}.
|
|
Plugins which provide custom wasm loading types must call EnableWasmLoadingPlugin.setEnabled(compiler, type) to disable this error.`);
|
|
}
|
|
} else {
|
|
// TODO support plugin instances here
|
|
// apply them to the compiler
|
|
}
|
|
}
|
|
}
|
|
|
|
module.exports = EnableWasmLoadingPlugin;
|