Website : rimsha.abasa.com
backdoor
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
var
/
canvas
/
node_modules
/
@rspack
/
core
/
dist
/
builtin-plugin
/
Filename :
EnableLibraryPlugin.js
back
Copy
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.EnableLibraryPlugin = void 0; const binding_1 = require("@rspack/binding"); const base_1 = require("./base"); const enabledTypes = new WeakMap(); const getEnabledTypes = (compiler) => { let set = enabledTypes.get(compiler); if (set === undefined) { set = new Set(); enabledTypes.set(compiler, set); } return set; }; class EnableLibraryPlugin extends base_1.RspackBuiltinPlugin { constructor(type) { super(); this.type = type; this.name = binding_1.BuiltinPluginName.EnableLibraryPlugin; } static setEnabled(compiler, type) { getEnabledTypes(compiler).add(type); } static checkEnabled(compiler, type) { if (!getEnabledTypes(compiler).has(type)) { throw new Error(`Library type "${type}" is not enabled. ` + "EnableLibraryPlugin need to be used to enable this type of library. " + 'This usually happens through the "output.enabledLibraryTypes" option. ' + 'If you are using a function as entry which sets "library", you need to add all potential library types to "output.enabledLibraryTypes". ' + "These types are enabled: " + Array.from(getEnabledTypes(compiler)).join(", ")); } } raw(compiler) { const { type } = this; // Only enable once const enabled = getEnabledTypes(compiler); if (enabled.has(type)) return; enabled.add(type); return (0, base_1.createBuiltinPlugin)(this.name, type); } } exports.EnableLibraryPlugin = EnableLibraryPlugin;