diff --git a/.changeset/three-trains-type.md b/.changeset/three-trains-type.md new file mode 100644 index 0000000000..aaa4aca552 --- /dev/null +++ b/.changeset/three-trains-type.md @@ -0,0 +1,8 @@ +--- +'@ice/rspack-config': minor +'@ice/shared-config': minor +'@ice/bundles': minor +'@ice/app': minor +--- + +feat: support @ice/pack-binding diff --git a/.eslintignore b/.eslintignore index af2e497fb8..93f43288ef 100644 --- a/.eslintignore +++ b/.eslintignore @@ -18,6 +18,7 @@ coverage/ # 忽略第三方包 /vendor/loader.js +override/ # 忽略文件 **/*-min.js diff --git a/packages/bundles/override/rspack/adapter.js b/packages/bundles/override/rspack/adapter.js new file mode 100644 index 0000000000..4b481b3e0f --- /dev/null +++ b/packages/bundles/override/rspack/adapter.js @@ -0,0 +1,626 @@ +// Copy from @rspack/core/dist/config/adapter.js +'use strict'; +let __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { default: mod }; +}; +Object.defineProperty(exports, '__esModule', { value: true }); +exports.getRawLibrary = exports.getRawOptions = void 0; +const assert_1 = __importDefault(require('assert')); +const Stats_1 = require('../Stats'); +const util_1 = require('../util'); +const identifier_1 = require('../util/identifier'); +const adapterRuleUse_1 = require('./adapterRuleUse'); +const getRawOptions = (options, compiler, processResource) => { + let _a, +_b; + (0, assert_1.default)(!(0, util_1.isNil)(options.context) && !(0, util_1.isNil)(options.devtool) && !(0, util_1.isNil)(options.cache), 'context, devtool, cache should not be nil after defaults'); + const devtool = options.devtool === false ? '' : options.devtool; + const { mode } = options; + const experiments = getRawExperiments(options.experiments); + return { + // CUSTOM: add options of features. + features: options.features, + mode, + target: getRawTarget(options.target), + context: options.context, + output: getRawOutput(options.output), + resolve: getRawResolve(options.resolve), + resolveLoader: getRawResolve(options.resolveLoader), + module: getRawModule(options.module, { + compiler, + devtool, + mode, + context: options.context, + experiments, + }), + devtool, + optimization: getRawOptimization(options.optimization), + stats: getRawStats(options.stats), + devServer: { + hot: (_b = (_a = options.devServer) === null || _a === void 0 ? void 0 : _a.hot) !== null && _b !== void 0 ? _b : false, + }, + snapshot: getRawSnapshotOptions(options.snapshot), + cache: { + type: options.cache ? 'memory' : 'disable', + // TODO: implement below cache options + maxGenerations: 0, + maxAge: 0, + profile: false, + buildDependencies: [], + cacheDirectory: '', + cacheLocation: '', + name: '', + version: '', + }, + experiments, + node: getRawNode(options.node), + profile: options.profile, + // TODO: remove this + builtins: options.builtins, + }; +}; +exports.getRawOptions = getRawOptions; +function getRawTarget(target) { + if (!target) { + return []; + } + if (typeof target === 'string') { + return [target]; + } + return target; +} +function getRawAlias(alias = {}) { + const entires = Object.entries(alias).map(([key, value]) => { + if (Array.isArray(value)) { + return [key, value]; + } else { + return [key, [value]]; + } + }); + return Object.fromEntries(entires); +} +function getRawResolveByDependency(byDependency) { + if (byDependency === undefined) return byDependency; + return Object.fromEntries(Object.entries(byDependency).map(([k, v]) => [k, getRawResolve(v)])); +} +function getRawResolve(resolve) { + let _a, +_b, +_c; + let references = (_a = resolve.tsConfig) === null || _a === void 0 ? void 0 : _a.references; + let tsconfigConfigFile = (_b = resolve.tsConfigPath) !== null && _b !== void 0 ? _b : (_c = resolve.tsConfig) === null || _c === void 0 ? void 0 : _c.configFile; + return { + ...resolve, + alias: getRawAlias(resolve.alias), + fallback: getRawAlias(resolve.fallback), + extensionAlias: getRawAlias(resolve.extensionAlias), + tsconfig: tsconfigConfigFile + ? { + configFile: tsconfigConfigFile, + referencesType: references == 'auto' ? 'auto' : references ? 'manual' : 'disabled', + references: references == 'auto' ? undefined : references, + } + : undefined, + byDependency: getRawResolveByDependency(resolve.byDependency), + }; +} +function getRawCrossOriginLoading(crossOriginLoading) { + if (typeof crossOriginLoading === 'boolean') { + return { type: 'bool', boolPayload: crossOriginLoading }; + } + return { type: 'string', stringPayload: crossOriginLoading }; +} +function getRawOutput(output) { + const { chunkLoading } = output; + const { wasmLoading } = output; + const { workerChunkLoading } = output; + const { workerWasmLoading } = output; + return { + path: output.path, + publicPath: output.publicPath, + clean: output.clean, + assetModuleFilename: output.assetModuleFilename, + filename: output.filename, + chunkFilename: output.chunkFilename, + chunkLoading: chunkLoading === false ? 'false' : chunkLoading, + crossOriginLoading: getRawCrossOriginLoading(output.crossOriginLoading), + cssFilename: output.cssFilename, + cssChunkFilename: output.cssChunkFilename, + hotUpdateChunkFilename: output.hotUpdateChunkFilename, + hotUpdateMainFilename: output.hotUpdateMainFilename, + hotUpdateGlobal: output.hotUpdateGlobal, + uniqueName: output.uniqueName, + chunkLoadingGlobal: output.chunkLoadingGlobal, + enabledLibraryTypes: output.enabledLibraryTypes, + library: output.library && getRawLibrary(output.library), + strictModuleErrorHandling: output.strictModuleErrorHandling, + globalObject: output.globalObject, + importFunctionName: output.importFunctionName, + iife: output.iife, + module: output.module, + wasmLoading: wasmLoading === false ? 'false' : wasmLoading, + enabledWasmLoadingTypes: output.enabledWasmLoadingTypes, + enabledChunkLoadingTypes: output.enabledChunkLoadingTypes, + webassemblyModuleFilename: output.webassemblyModuleFilename, + trustedTypes: output.trustedTypes, + sourceMapFilename: output.sourceMapFilename, + hashFunction: output.hashFunction, + hashDigest: output.hashDigest, + hashDigestLength: output.hashDigestLength, + hashSalt: output.hashSalt, + asyncChunks: output.asyncChunks, + workerChunkLoading: workerChunkLoading === false ? 'false' : workerChunkLoading, + workerWasmLoading: workerWasmLoading === false ? 'false' : workerWasmLoading, + workerPublicPath: output.workerPublicPath, + }; +} +function getRawLibrary(library) { + const { type, name, export: libraryExport, umdNamedDefine, auxiliaryComment, amdContainer } = library; + return { + amdContainer, + auxiliaryComment: typeof auxiliaryComment === 'string' + ? { + commonjs: auxiliaryComment, + commonjs2: auxiliaryComment, + amd: auxiliaryComment, + root: auxiliaryComment, + } + : auxiliaryComment, + libraryType: type, + name: (0, util_1.isNil)(name) ? name : getRawLibraryName(name), + export: Array.isArray(libraryExport) || libraryExport == null + ? libraryExport + : [libraryExport], + umdNamedDefine, + }; +} +exports.getRawLibrary = getRawLibrary; +function getRawLibraryName(name) { + if (typeof name === 'string') { + return { + type: 'string', + stringPayload: name, + }; + } + if (Array.isArray(name)) { + return { + type: 'array', + arrayPayload: name, + }; + } + if (typeof name === 'object' && !Array.isArray(name)) { + return { + type: 'umdObject', + umdObjectPayload: { + commonjs: name.commonjs, + root: Array.isArray(name.root) || (0, util_1.isNil)(name.root) + ? name.root + : [name.root], + amd: name.amd, + }, + }; + } + throw new Error('unreachable'); +} +function getRawModule(module, options) { + (0, assert_1.default)(!(0, util_1.isNil)(module.defaultRules), 'module.defaultRules should not be nil after defaults'); + // "..." in defaultRules will be flatten in `applyModuleDefaults`, and "..." in rules is empty, so it's safe to use `as RuleSetRule[]` at here + const ruleSet = [ + { rules: module.defaultRules }, + { rules: module.rules }, + ]; + const rules = ruleSet.map((rule, index) => getRawModuleRule(rule, `ruleSet[${index}]`, options)); + return { + rules, + parser: getRawParserOptionsByModuleType(module.parser), + generator: getRawGeneratorOptionsByModuleType(module.generator), + }; +} +function tryMatch(payload, condition) { + if (typeof condition === 'string') { + return payload.startsWith(condition); + } + if (condition instanceof RegExp) { + return condition.test(payload); + } + if (typeof condition === 'function') { + return condition(payload); + } + if (Array.isArray(condition)) { + return condition.some(c => tryMatch(payload, c)); + } + if (condition && typeof condition === 'object') { + if (condition.and) { + return condition.and.every(c => tryMatch(payload, c)); + } + if (condition.or) { + return condition.or.some(c => tryMatch(payload, c)); + } + if (condition.not) { + return condition.not.every(c => !tryMatch(payload, c)); + } + } + return false; +} +const deprecatedRuleType = (type) => { + type !== null && type !== void 0 ? type : (type = 'javascript/auto'); + if (/ts|typescript|tsx|typescriptx|jsx|javascriptx/.test(type)) { + (0, util_1.deprecatedWarn)(`'Rule.type: ${type}' has been deprecated, please migrate to builtin:swc-loader with type 'javascript/auto'`); + } +}; +const getRawModuleRule = (rule, path, options) => { + let _a, +_b, +_c; + // Rule.loader is a shortcut to Rule.use: [ { loader } ]. + // See: https://webpack.js.org/configuration/module/#ruleloader + if (rule.loader) { + rule.use = [ + { + loader: rule.loader, + options: rule.options, + }, + ]; + } + let funcUse; + if (typeof rule.use === 'function') { + funcUse = (rawContext) => { + const context = { + ...rawContext, + compiler: options.compiler, + }; + const uses = rule.use(context); + return (0, adapterRuleUse_1.createRawModuleRuleUses)(uses !== null && uses !== void 0 ? uses : [], `${path}.use`, options); + }; + } + let rawModuleRule = { + test: rule.test ? getRawRuleSetCondition(rule.test) : undefined, + include: rule.include ? getRawRuleSetCondition(rule.include) : undefined, + exclude: rule.exclude ? getRawRuleSetCondition(rule.exclude) : undefined, + issuer: rule.issuer ? getRawRuleSetCondition(rule.issuer) : undefined, + dependency: rule.dependency + ? getRawRuleSetCondition(rule.dependency) + : undefined, + descriptionData: rule.descriptionData + ? Object.fromEntries(Object.entries(rule.descriptionData).map(([k, v]) => [ + k, + getRawRuleSetCondition(v), + ])) + : undefined, + resource: rule.resource ? getRawRuleSetCondition(rule.resource) : undefined, + resourceQuery: rule.resourceQuery + ? getRawRuleSetCondition(rule.resourceQuery) + : undefined, + resourceFragment: rule.resourceFragment + ? getRawRuleSetCondition(rule.resourceFragment) + : undefined, + scheme: rule.scheme ? getRawRuleSetCondition(rule.scheme) : undefined, + mimetype: rule.mimetype ? getRawRuleSetCondition(rule.mimetype) : undefined, + sideEffects: rule.sideEffects, + use: typeof rule.use === 'function' + ? { type: 'function', funcUse } + : { + type: 'array', + arrayUse: (0, adapterRuleUse_1.createRawModuleRuleUses)((_a = rule.use) !== null && _a !== void 0 ? _a : [], `${path}.use`, options), + }, + type: rule.type, + parser: rule.parser + ? getRawParserOptions(rule.parser, (_b = rule.type) !== null && _b !== void 0 ? _b : 'javascript/auto') + : undefined, + generator: rule.generator + ? getRawGeneratorOptions(rule.generator, (_c = rule.type) !== null && _c !== void 0 ? _c : 'javascript/auto') + : undefined, + resolve: rule.resolve ? getRawResolve(rule.resolve) : undefined, + oneOf: rule.oneOf + ? rule.oneOf.map((rule, index) => getRawModuleRule(rule, `${path}.oneOf[${index}]`, options)) + : undefined, + rules: rule.rules + ? rule.rules.map((rule, index) => getRawModuleRule(rule, `${path}.rules[${index}]`, options)) + : undefined, + enforce: rule.enforce, + }; + // Function calls may contain side-effects when interoperating with single-threaded environment. + // In order to mitigate the issue, Rspack tries to merge these calls together. + // See: https://github.com/web-infra-dev/rspack/issues/4003#issuecomment-1689662380 + if (typeof rule.test === 'function' || + typeof rule.resource === 'function' || + typeof rule.resourceQuery === 'function' || + typeof rule.resourceFragment === 'function') { + delete rawModuleRule.test; + delete rawModuleRule.resource; + delete rawModuleRule.resourceQuery; + delete rawModuleRule.resourceFragment; + rawModuleRule.rspackResource = getRawRuleSetCondition((resourceQueryFragment) => { + const { path, query, fragment } = (0, identifier_1.parseResource)(resourceQueryFragment); + if (rule.test && !tryMatch(path, rule.test)) { + return false; + } else if (rule.resource && !tryMatch(path, rule.resource)) { + return false; + } + if (rule.resourceQuery && !tryMatch(query, rule.resourceQuery)) { + return false; + } + if (rule.resourceFragment && !tryMatch(fragment, rule.resourceFragment)) { + return false; + } + return true; + }); + } + if (options.experiments.rspackFuture.disableTransformByDefault) { + deprecatedRuleType(rule.type); + } + return rawModuleRule; +}; +function getRawRuleSetCondition(condition) { + if (typeof condition === 'string') { + return { + type: 'string', + stringMatcher: condition, + }; + } + if (condition instanceof RegExp) { + return { + type: 'regexp', + regexpMatcher: condition.source, + }; + } + if (typeof condition === 'function') { + return { + type: 'function', + funcMatcher: condition, + }; + } + if (Array.isArray(condition)) { + return { + type: 'array', + arrayMatcher: condition.map(i => getRawRuleSetCondition(i)), + }; + } + if (typeof condition === 'object' && condition !== null) { + return { + type: 'logical', + logicalMatcher: [getRawRuleSetLogicalConditions(condition)], + }; + } + throw new Error('unreachable: condition should be one of string, RegExp, Array, Object'); +} +function getRawRuleSetLogicalConditions(logical) { + return { + and: logical.and + ? logical.and.map(i => getRawRuleSetCondition(i)) + : undefined, + or: logical.or ? logical.or.map(i => getRawRuleSetCondition(i)) : undefined, + not: logical.not ? getRawRuleSetCondition(logical.not) : undefined, + }; +} +function getRawParserOptionsByModuleType(parser) { + return Object.fromEntries(Object.entries(parser).map(([k, v]) => [k, getRawParserOptions(v, k)])); +} +function getRawGeneratorOptionsByModuleType(parser) { + return Object.fromEntries(Object.entries(parser).map(([k, v]) => [k, getRawGeneratorOptions(v, k)])); +} +function getRawParserOptions(parser, type) { + if (type === 'asset') { + return { + type: 'asset', + asset: getRawAssetParserOptions(parser), + }; + } else if (type === 'javascript') { + return { + type: 'javascript', + javascript: getRawJavascriptParserOptions(parser), + }; + } + return { + type: 'unknown', + }; +} +function getRawJavascriptParserOptions(parser) { + let _a; + return { + dynamicImportMode: (_a = parser.dynamicImportMode) !== null && _a !== void 0 ? _a : 'lazy', + }; +} +function getRawAssetParserOptions(parser) { + return { + dataUrlCondition: parser.dataUrlCondition + ? getRawAssetParserDataUrl(parser.dataUrlCondition) + : undefined, + }; +} +function getRawAssetParserDataUrl(dataUrlCondition) { + if (typeof dataUrlCondition === 'object' && dataUrlCondition !== null) { + return { + type: 'options', + options: { + maxSize: dataUrlCondition.maxSize, + }, + }; + } + throw new Error(`unreachable: AssetParserDataUrl type should be one of "options", but got ${dataUrlCondition}`); +} +function getRawGeneratorOptions(generator, type) { + if (type === 'asset') { + return { + type: 'asset', + asset: generator ? getRawAssetGeneratorOptions(generator) : undefined, + }; + } + if (type === 'asset/inline') { + return { + type: 'asset/inline', + assetInline: generator + ? getRawAssetInlineGeneratorOptions(generator) + : undefined, + }; + } + if (type === 'asset/resource') { + return { + type: 'asset/resource', + assetResource: generator + ? getRawAssetResourceGeneratorOptions(generator) + : undefined, + }; + } + return { + type: 'unknown', + }; +} +function getRawAssetGeneratorOptions(options) { + return { + ...getRawAssetInlineGeneratorOptions(options), + ...getRawAssetResourceGeneratorOptions(options), + }; +} +function getRawAssetInlineGeneratorOptions(options) { + return { + dataUrl: options.dataUrl + ? getRawAssetGeneratorDaraUrl(options.dataUrl) + : undefined, + }; +} +function getRawAssetResourceGeneratorOptions(options) { + return { + filename: options.filename, + publicPath: options.publicPath, + }; +} +function getRawAssetGeneratorDaraUrl(dataUrl) { + if (typeof dataUrl === 'object' && dataUrl !== null) { + return { + type: 'options', + options: { + encoding: dataUrl.encoding === false ? 'false' : dataUrl.encoding, + mimetype: dataUrl.mimetype, + }, + }; + } + throw new Error(`unreachable: AssetGeneratorDataUrl type should be one of "options", but got ${dataUrl}`); +} +function getRawOptimization(optimization) { + (0, assert_1.default)(!(0, util_1.isNil)(optimization.moduleIds) && + !(0, util_1.isNil)(optimization.chunkIds) && + !(0, util_1.isNil)(optimization.removeAvailableModules) && + !(0, util_1.isNil)(optimization.removeEmptyChunks) && + !(0, util_1.isNil)(optimization.sideEffects) && + !(0, util_1.isNil)(optimization.realContentHash) && + !(0, util_1.isNil)(optimization.providedExports) && + !(0, util_1.isNil)(optimization.usedExports) && + !(0, util_1.isNil)(optimization.innerGraph), 'optimization.moduleIds, optimization.removeAvailableModules, optimization.removeEmptyChunks, optimization.sideEffects, optimization.realContentHash, optimization.providedExports, optimization.usedExports, optimization.innerGraph should not be nil after defaults'); + return { + chunkIds: optimization.chunkIds, + splitChunks: toRawSplitChunksOptions(optimization.splitChunks), + moduleIds: optimization.moduleIds, + removeAvailableModules: optimization.removeAvailableModules, + removeEmptyChunks: optimization.removeEmptyChunks, + sideEffects: String(optimization.sideEffects), + realContentHash: optimization.realContentHash, + usedExports: String(optimization.usedExports), + providedExports: optimization.providedExports, + innerGraph: optimization.innerGraph, + }; +} +function toRawSplitChunksOptions(sc) { + if (!sc) { + return; + } + const { name, cacheGroups = {}, ...passThrough } = sc; + return { + name: name === false ? undefined : name, + cacheGroups: Object.entries(cacheGroups) + .filter(([_key, group]) => group !== false) + .map(([key, group]) => { + group = group; + const { test, name, ...passThrough } = group; + const rawGroup = { + key, + test, + name: name === false ? undefined : name, + ...passThrough, + }; + return rawGroup; + }), + ...passThrough, + }; +} +function getRawSnapshotOptions(snapshot) { + const { resolve, module } = snapshot; + (0, assert_1.default)(!(0, util_1.isNil)(resolve) && !(0, util_1.isNil)(module)); + const { timestamp: resolveTimestamp, hash: resolveHash } = resolve; + const { timestamp: moduleTimestamp, hash: moduleHash } = module; + (0, assert_1.default)(!(0, util_1.isNil)(resolveTimestamp) && + !(0, util_1.isNil)(resolveHash) && + !(0, util_1.isNil)(moduleTimestamp) && + !(0, util_1.isNil)(moduleHash)); + return { + resolve: { + timestamp: resolveTimestamp, + hash: resolveHash, + }, + module: { + timestamp: moduleTimestamp, + hash: moduleHash, + }, + }; +} +function getRawExperiments(experiments) { + const { lazyCompilation, incrementalRebuild, asyncWebAssembly, newSplitChunks, topLevelAwait, css, rspackFuture } = experiments; + (0, assert_1.default)(!(0, util_1.isNil)(lazyCompilation) && + !(0, util_1.isNil)(incrementalRebuild) && + !(0, util_1.isNil)(asyncWebAssembly) && + !(0, util_1.isNil)(newSplitChunks) && + !(0, util_1.isNil)(topLevelAwait) && + !(0, util_1.isNil)(css) && + !(0, util_1.isNil)(rspackFuture)); + return { + lazyCompilation, + incrementalRebuild: getRawIncrementalRebuild(incrementalRebuild), + asyncWebAssembly, + newSplitChunks, + topLevelAwait, + css, + rspackFuture: getRawRspackFutureOptions(rspackFuture), + }; +} +function getRawRspackFutureOptions(future) { + (0, assert_1.default)(!(0, util_1.isNil)(future.newResolver)); + (0, assert_1.default)(!(0, util_1.isNil)(future.newTreeshaking)); + (0, assert_1.default)(!(0, util_1.isNil)(future.disableTransformByDefault)); + return { + newResolver: future.newResolver, + newTreeshaking: future.newTreeshaking, + disableTransformByDefault: future.disableTransformByDefault, + }; +} +function getRawIncrementalRebuild(inc) { + if (inc === false) { + return { + make: false, + emitAsset: false, + }; + } + const { make, emitAsset } = inc; + (0, assert_1.default)(!(0, util_1.isNil)(make) && !(0, util_1.isNil)(emitAsset)); + return { + make, + emitAsset, + }; +} +function getRawNode(node) { + if (node === false) { + return undefined; + } + (0, assert_1.default)(!(0, util_1.isNil)(node.__dirname) && !(0, util_1.isNil)(node.global) && !(0, util_1.isNil)(node.__filename)); + return { + dirname: String(node.__dirname), + filename: String(node.__filename), + global: String(node.global), + }; +} +function getRawStats(stats) { + let _a; + const statsOptions = (0, Stats_1.normalizeStatsPreset)(stats); + return { + colors: (_a = statsOptions.colors) !== null && _a !== void 0 ? _a : false, + }; +} diff --git a/packages/bundles/override/rspack/bindingVersionCheck.js b/packages/bundles/override/rspack/bindingVersionCheck.js new file mode 100644 index 0000000000..447f1ca336 --- /dev/null +++ b/packages/bundles/override/rspack/bindingVersionCheck.js @@ -0,0 +1,6 @@ +"use strict"; +const checkVersion = function() { + // Skip binding version check, framework will lock the binding version. + return null; +} +exports.checkVersion = checkVersion; diff --git a/packages/bundles/override/rspack/defaults.js b/packages/bundles/override/rspack/defaults.js new file mode 100644 index 0000000000..6b98cf87aa --- /dev/null +++ b/packages/bundles/override/rspack/defaults.js @@ -0,0 +1,699 @@ +// Copy from @rspack/core/dist/config/defaults.js +'use strict'; +/** + * The following code is modified based on + * https://github.com/webpack/webpack/blob/4b4ca3b/lib/config/defaults.js + * + * MIT Licensed + * Author Tobias Koppers @sokra + * Copyright (c) JS Foundation and other contributors + * https://github.com/webpack/webpack/blob/main/LICENSE + */ +let __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { default: mod }; +}; +Object.defineProperty(exports, '__esModule', { value: true }); +exports.applyRspackOptionsBaseDefaults = exports.applyRspackOptionsDefaults = void 0; +const assert_1 = __importDefault(require('assert')); +const fs_1 = __importDefault(require('fs')); +const path_1 = __importDefault(require('path')); +const util_1 = require('../util'); +const cleverMerge_1 = require('../util/cleverMerge'); +const Template_1 = __importDefault(require('../Template')); +const assertNotNil_1 = require('../util/assertNotNil'); +const ModuleTypeConstants_1 = require('../ModuleTypeConstants'); +const target_1 = require('./target'); +const applyRspackOptionsDefaults = (options) => { + let _a; + F(options, 'context', () => process.cwd()); + F(options, 'target', () => { + return (0, target_1.getDefaultTarget)(options.context); + }); + const { mode, target } = options; + (0, assert_1.default)(!(0, util_1.isNil)(target)); + let targetProperties = target === false + ? false + : typeof target === 'string' + ? (0, target_1.getTargetProperties)(target, options.context) + : (0, target_1.getTargetsProperties)(target, options.context); + const development = mode === 'development'; + const production = mode === 'production' || !mode; + if (typeof options.entry !== 'function') { + for (const key of Object.keys(options.entry)) { + F(options.entry[key], 'import', () => ['./src']); + } + } + F(options, 'devtool', () => false); + D(options, 'watch', false); + D(options, 'profile', false); + const futureDefaults = (_a = options.experiments.futureDefaults) !== null && _a !== void 0 ? _a : false; + F(options, 'cache', () => development); + applyExperimentsDefaults(options.experiments, { + cache: options.cache, + }); + // CUSTOM: add default rules for features options. + if (options.features) { + applyFeaturesDefaults(options.features); + } else { + D(options, 'features', {}); + } + applySnapshotDefaults(options.snapshot, { production }); + applyModuleDefaults(options.module, { + // syncWebAssembly: options.experiments.syncWebAssembly, + asyncWebAssembly: options.experiments.asyncWebAssembly, + disableTransformByDefault: options.experiments.rspackFuture.disableTransformByDefault, + css: options.experiments.css, + }); + applyOutputDefaults(options.output, { + context: options.context, + targetProperties, + isAffectedByBrowserslist: target === undefined || + (typeof target === 'string' && target.startsWith('browserslist')) || + (Array.isArray(target) && + target.some(target => target.startsWith('browserslist'))), + outputModule: options.experiments.outputModule, + entry: options.entry, + futureDefaults, + }); + applyExternalsPresetsDefaults(options.externalsPresets, { + targetProperties, + }); + // @ts-expect-error + F(options, 'externalsType', () => { + return options.output.library + ? options.output.library.type + : options.output.module + ? 'module' + : 'var'; + }); + applyNodeDefaults(options.node, { targetProperties }); + applyOptimizationDefaults(options.optimization, { production, development }); + options.resolve = (0, cleverMerge_1.cleverMerge)(getResolveDefaults({ + targetProperties, + mode: options.mode, + }), options.resolve); + options.resolveLoader = (0, cleverMerge_1.cleverMerge)(getResolveLoaderDefaults(), options.resolveLoader); +}; +exports.applyRspackOptionsDefaults = applyRspackOptionsDefaults; +const applyRspackOptionsBaseDefaults = (options) => { + F(options, 'context', () => process.cwd()); + applyInfrastructureLoggingDefaults(options.infrastructureLogging); +}; +exports.applyRspackOptionsBaseDefaults = applyRspackOptionsBaseDefaults; +const applyInfrastructureLoggingDefaults = (infrastructureLogging) => { + F(infrastructureLogging, 'stream', () => process.stderr); + const tty = infrastructureLogging.stream.isTTY && process.env.TERM !== 'dumb'; + D(infrastructureLogging, 'level', 'info'); + D(infrastructureLogging, 'debug', false); + D(infrastructureLogging, 'colors', tty); + D(infrastructureLogging, 'appendOnly', !tty); +}; +const applyExperimentsDefaults = (experiments, { cache }) => { + D(experiments, 'lazyCompilation', false); + D(experiments, 'asyncWebAssembly', false); + D(experiments, 'newSplitChunks', true); + D(experiments, 'css', true); // we not align with webpack about the default value for better DX + D(experiments, 'topLevelAwait', true); + D(experiments, 'incrementalRebuild', {}); + if (typeof experiments.incrementalRebuild === 'object') { + D(experiments.incrementalRebuild, 'make', true); + D(experiments.incrementalRebuild, 'emitAsset', true); + } + if (cache === false && + experiments.incrementalRebuild && + experiments.incrementalRebuild.make) { + experiments.incrementalRebuild.make = false; + // TODO: use logger to warn user enable cache for incrementalRebuild.make + } + D(experiments, 'rspackFuture', {}); + if (typeof experiments.rspackFuture === 'object') { + D(experiments.rspackFuture, 'newResolver', true); + D(experiments.rspackFuture, 'newTreeshaking', false); + D(experiments.rspackFuture, 'disableTransformByDefault', true); + } +}; +const applyFeaturesDefaults = (features) => { + D(features, 'split_chunks_strategy', {}); + if (typeof features.split_chunks_strategy === 'object') { + D(features.split_chunks_strategy, 'name', ''); + D(features.split_chunks_strategy, 'topLevelFrameworks', []); + } +}; +const applySnapshotDefaults = (snapshot, { production }) => { + F(snapshot, 'module', () => (production + ? { timestamp: true, hash: true } + : { timestamp: true, hash: false })); + F(snapshot, 'resolve', () => (production + ? { timestamp: true, hash: true } + : { timestamp: true, hash: false })); +}; +const applyJavascriptParserOptionsDefaults = (parserOptions) => { + D(parserOptions, 'dynamicImportMode', 'lazy'); +}; +const applyModuleDefaults = (module, { asyncWebAssembly, css, disableTransformByDefault }) => { + (0, assertNotNil_1.assertNotNill)(module.parser); + F(module.parser, ModuleTypeConstants_1.ASSET_MODULE_TYPE, () => ({})); + (0, assertNotNil_1.assertNotNill)(module.parser.asset); + F(module.parser.asset, 'dataUrlCondition', () => ({})); + if (typeof module.parser.asset.dataUrlCondition === 'object') { + D(module.parser.asset.dataUrlCondition, 'maxSize', 8096); + } + F(module.parser, 'javascript', () => ({})); + (0, assertNotNil_1.assertNotNill)(module.parser.javascript); + applyJavascriptParserOptionsDefaults(module.parser.javascript); + A(module, 'defaultRules', () => { + const esm = { + type: 'javascript/esm', + resolve: { + byDependency: { + esm: { + fullySpecified: true, + }, + }, + }, + }; + const commonjs = { + type: 'javascript/dynamic', + }; + const rules = [ + { + mimetype: 'application/node', + type: 'javascript/auto', + }, + { + test: /\.json$/i, + type: 'json', + }, + { + mimetype: 'application/json', + type: 'json', + }, + { + test: /\.mjs$/i, + ...esm, + }, + { + test: /\.js$/i, + descriptionData: { + type: 'module', + }, + ...esm, + }, + { + test: /\.cjs$/i, + ...commonjs, + }, + { + test: /\.js$/i, + descriptionData: { + type: 'commonjs', + }, + ...commonjs, + }, + { + mimetype: { + or: ['text/javascript', 'application/javascript'], + }, + ...esm, + }, + ]; + // TODO: remove in 0.5.0 + if (!disableTransformByDefault) { + rules.push({ + test: /\.jsx$/i, + type: 'jsx', + }, { + test: /\.ts$/i, + type: 'ts', + }, { + test: /\.tsx$/i, + type: 'tsx', + }); + } + if (asyncWebAssembly) { + const wasm = { + type: 'webassembly/async', + rules: [ + { + descriptionData: { + type: 'module', + }, + resolve: { + fullySpecified: true, + }, + }, + ], + }; + rules.push({ + test: /\.wasm$/i, + ...wasm, + }); + rules.push({ + mimetype: 'application/wasm', + ...wasm, + }); + } + if (css) { + const cssRule = { + type: 'css', + resolve: { + fullySpecified: true, + preferRelative: true, + }, + }; + const cssModulesRule = { + type: 'css/module', + resolve: { + fullySpecified: true, + }, + }; + rules.push({ + test: /\.css$/i, + oneOf: [ + { + test: /\.module\.css$/i, + ...cssModulesRule, + }, + { + ...cssRule, + }, + ], + }); + rules.push({ + mimetype: 'text/css+module', + ...cssModulesRule, + }); + rules.push({ + mimetype: 'text/css', + ...cssRule, + }); + } + rules.push({ + dependency: 'url', + oneOf: [ + { + scheme: /^data$/, + type: 'asset/inline', + }, + { + type: 'asset/resource', + }, + ], + }); + return rules; + }); +}; +const applyOutputDefaults = (output, { context, outputModule, targetProperties: tp, isAffectedByBrowserslist, entry, futureDefaults }) => { + F(output, 'uniqueName', () => { + const pkgPath = path_1.default.resolve(context, 'package.json'); + try { + const packageInfo = JSON.parse(fs_1.default.readFileSync(pkgPath, 'utf-8')); + return packageInfo.name || ''; + } catch (e) { + if (e.code !== 'ENOENT') { + e.message += `\nwhile determining default 'output.uniqueName' from 'name' in ${pkgPath}`; + throw e; + } + return ''; + } + }); + F(output, 'chunkLoadingGlobal', () => Template_1.default.toIdentifier(`webpackChunk${Template_1.default.toIdentifier(output.uniqueName)}`)); + F(output, 'module', () => !!outputModule); + D(output, 'filename', output.module ? '[name].mjs' : '[name].js'); + F(output, 'iife', () => !output.module); + F(output, 'chunkFilename', () => { + const { filename } = output; + if (typeof filename !== 'function') { + const hasName = filename.includes('[name]'); + const hasId = filename.includes('[id]'); + const hasChunkHash = filename.includes('[chunkhash]'); + const hasContentHash = filename.includes('[contenthash]'); + // Anything changing depending on chunk is fine + if (hasChunkHash || hasContentHash || hasName || hasId) return filename; + // Otherwise prefix "[id]." in front of the basename to make it changing + return filename.replace(/(^|\/)([^/]*(?:\?|$))/, '$1[id].$2'); + } + return '[id].js'; + }); + F(output, 'cssFilename', () => { + const { filename } = output; + if (typeof filename !== 'function') { + return filename.replace(/\.[mc]?js(\?|$)/, '.css$1'); + } + return '[id].css'; + }); + F(output, 'cssChunkFilename', () => { + const { chunkFilename } = output; + if (typeof chunkFilename !== 'function') { + return chunkFilename.replace(/\.[mc]?js(\?|$)/, '.css$1'); + } + return '[id].css'; + }); + D(output, 'hotUpdateChunkFilename', `[id].[fullhash].hot-update.${output.module ? 'mjs' : 'js'}`); + D(output, 'hotUpdateMainFilename', '[runtime].[fullhash].hot-update.json'); + F(output, 'hotUpdateGlobal', () => Template_1.default.toIdentifier(`webpackHotUpdate${Template_1.default.toIdentifier(output.uniqueName)}`)); + D(output, 'assetModuleFilename', '[hash][ext][query]'); + D(output, 'webassemblyModuleFilename', '[hash].module.wasm'); + F(output, 'path', () => path_1.default.join(process.cwd(), 'dist')); + D(output, 'publicPath', tp && (tp.document || tp.importScripts) ? 'auto' : ''); + D(output, 'hashFunction', futureDefaults ? 'xxhash64' : 'md4'); + D(output, 'hashDigest', 'hex'); + D(output, 'hashDigestLength', futureDefaults ? 16 : 20); + D(output, 'strictModuleErrorHandling', false); + if (output.library) { + F(output.library, 'type', () => (output.module ? 'module' : 'var')); + } + F(output, 'chunkFormat', () => { + if (tp) { + const helpMessage = isAffectedByBrowserslist + ? "Make sure that your 'browserslist' includes only platforms that support these features or select an appropriate 'target' to allow selecting a chunk format by default. Alternatively specify the 'output.chunkFormat' directly." + : "Select an appropriate 'target' to allow selecting one by default, or specify the 'output.chunkFormat' directly."; + if (output.module) { + if (tp.dynamicImport) return 'module'; + if (tp.document) return 'array-push'; + throw new Error('For the selected environment is no default ESM chunk format available:\n' + + 'ESM exports can be chosen when \'import()\' is available.\n' + + `JSONP Array push can be chosen when 'document' is available.\n${ + helpMessage}`); + } else { + if (tp.document) return 'array-push'; + if (tp.require) return 'commonjs'; + if (tp.nodeBuiltins) return 'commonjs'; + if (tp.importScripts) return 'array-push'; + throw new Error('For the selected environment is no default script chunk format available:\n' + + 'JSONP Array push can be chosen when \'document\' or \'importScripts\' is available.\n' + + `CommonJs exports can be chosen when 'require' or node builtins are available.\n${ + helpMessage}`); + } + } + throw new Error("Chunk format can't be selected by default when no target is specified"); + }); + D(output, 'asyncChunks', true); + F(output, 'chunkLoading', () => { + if (tp) { + switch (output.chunkFormat) { + case 'array-push': + if (tp.document) return 'jsonp'; + if (tp.importScripts) return 'import-scripts'; + break; + case 'commonjs': + if (tp.require) return 'require'; + if (tp.nodeBuiltins) return 'async-node'; + break; + case 'module': + if (tp.dynamicImport) return 'import'; + break; + } + if (tp.require === null || + tp.nodeBuiltins === null || + tp.document === null || + tp.importScripts === null) { + return 'universal'; + } + } + return false; + }); + F(output, 'workerChunkLoading', () => { + if (tp) { + switch (output.chunkFormat) { + case 'array-push': + if (tp.importScriptsInWorker) return 'import-scripts'; + break; + case 'commonjs': + if (tp.require) return 'require'; + if (tp.nodeBuiltins) return 'async-node'; + break; + case 'module': + if (tp.dynamicImportInWorker) return 'import'; + break; + } + if (tp.require === null || + tp.nodeBuiltins === null || + tp.importScriptsInWorker === null) { + return 'universal'; + } + } + return false; + }); + F(output, 'wasmLoading', () => { + if (tp) { + if (tp.fetchWasm) return 'fetch'; + if (tp.nodeBuiltins) return output.module ? 'async-node-module' : 'async-node'; + if (tp.nodeBuiltins === null || tp.fetchWasm === null) { + return 'universal'; + } + } + return false; + }); + F(output, 'workerWasmLoading', () => output.wasmLoading); + F(output, 'globalObject', () => { + if (tp) { + if (tp.global) return 'global'; + if (tp.globalThis) return 'globalThis'; + } + return 'self'; + }); + D(output, 'importFunctionName', 'import'); + F(output, 'clean', () => !!output.clean); + D(output, 'crossOriginLoading', false); + D(output, 'workerPublicPath', ''); + F(output, 'sourceMapFilename', () => { + return '[file].map'; + }); + const { trustedTypes } = output; + if (trustedTypes) { + F(trustedTypes, 'policyName', () => output.uniqueName.replace(/[^a-zA-Z0-9\-#=_/@.%]+/g, '_') || 'webpack'); + } + const forEachEntry = (fn) => { + for (const name of Object.keys(entry)) { + fn(entry[name]); + } + }; + A(output, 'enabledLibraryTypes', () => { + const enabledLibraryTypes = []; + if (output.library) { + enabledLibraryTypes.push(output.library.type); + } + forEachEntry(desc => { + if (desc.library) { + enabledLibraryTypes.push(desc.library.type); + } + }); + return enabledLibraryTypes; + }); + A(output, 'enabledChunkLoadingTypes', () => { + const enabledChunkLoadingTypes = new Set(); + if (output.chunkLoading) { + enabledChunkLoadingTypes.add(output.chunkLoading); + } + if (output.workerChunkLoading) { + enabledChunkLoadingTypes.add(output.workerChunkLoading); + } + forEachEntry(desc => { + if (desc.chunkLoading) { + enabledChunkLoadingTypes.add(desc.chunkLoading); + } + }); + return Array.from(enabledChunkLoadingTypes); + }); + A(output, 'enabledWasmLoadingTypes', () => { + const enabledWasmLoadingTypes = new Set(); + if (output.wasmLoading) { + enabledWasmLoadingTypes.add(output.wasmLoading); + } + if (output.workerWasmLoading) { + enabledWasmLoadingTypes.add(output.workerWasmLoading); + } + // forEachEntry(desc => { + // if (desc.wasmLoading) { + // enabledWasmLoadingTypes.add(desc.wasmLoading); + // } + // }); + return Array.from(enabledWasmLoadingTypes); + }); +}; +const applyExternalsPresetsDefaults = (externalsPresets, { targetProperties }) => { + D(externalsPresets, 'web', targetProperties && targetProperties.web); + D(externalsPresets, 'node', targetProperties && targetProperties.node); + D(externalsPresets, 'electron', targetProperties && targetProperties.electron); + D(externalsPresets, 'electronMain', targetProperties && + targetProperties.electron && + targetProperties.electronMain); + D(externalsPresets, 'electronPreload', targetProperties && + targetProperties.electron && + targetProperties.electronPreload); + D(externalsPresets, 'electronRenderer', targetProperties && + targetProperties.electron && + targetProperties.electronRenderer); +}; +const applyNodeDefaults = (node, { targetProperties }) => { + if (node === false) return; + F(node, 'global', () => { + if (targetProperties && targetProperties.global) return false; + return 'warn'; + }); + F(node, '__dirname', () => { + if (targetProperties && targetProperties.node) return 'eval-only'; + return 'warn-mock'; + }); + F(node, '__filename', () => { + if (targetProperties && targetProperties.node) return 'eval-only'; + return 'warn-mock'; + }); +}; +const applyOptimizationDefaults = (optimization, { production, development }) => { + D(optimization, 'removeAvailableModules', true); + D(optimization, 'removeEmptyChunks', true); + F(optimization, 'moduleIds', () => { + if (production) return 'deterministic'; + return 'named'; + }); + F(optimization, 'chunkIds', () => 'named'); + F(optimization, 'sideEffects', () => (production ? true : 'flag')); + D(optimization, 'providedExports', true); + D(optimization, 'usedExports', production); + D(optimization, 'innerGraph', production); + D(optimization, 'runtimeChunk', false); + D(optimization, 'realContentHash', production); + D(optimization, 'minimize', production); + A(optimization, 'minimizer', () => [ + // TODO: enable this when drop support for builtins options + // new SwcJsMinimizerPlugin(), + // new SwcCssMinimizerPlugin() + ]); + F(optimization, 'nodeEnv', () => { + if (production) return 'production'; + if (development) return 'development'; + return false; + }); + const { splitChunks } = optimization; + if (splitChunks) { + // A(splitChunks, "defaultSizeTypes", () => + // css ? ["javascript", "css", "unknown"] : ["javascript", "unknown"] + // ); + // D(splitChunks, "hidePathInfo", production); + D(splitChunks, 'chunks', 'async'); + // D(splitChunks, "usedExports", optimization.usedExports === true); + D(splitChunks, 'minChunks', 1); + F(splitChunks, 'minSize', () => (production ? 20000 : 10000)); + // F(splitChunks, "minRemainingSize", () => (development ? 0 : undefined)); + // F(splitChunks, "enforceSizeThreshold", () => (production ? 50000 : 30000)); + F(splitChunks, 'maxAsyncRequests', () => (production ? 30 : Infinity)); + F(splitChunks, 'maxInitialRequests', () => (production ? 30 : Infinity)); + // D(splitChunks, "automaticNameDelimiter", "-"); + const { cacheGroups } = splitChunks; + if (cacheGroups) { + F(cacheGroups, 'default', () => ({ + idHint: '', + reuseExistingChunk: true, + minChunks: 2, + priority: -20, + })); + F(cacheGroups, 'defaultVendors', () => ({ + idHint: 'vendors', + reuseExistingChunk: true, + test: /[\\/]node_modules[\\/]/i, + priority: -10, + })); + } + } +}; +const getResolveLoaderDefaults = () => { + const resolveOptions = { + conditionNames: ['loader', 'require', 'node'], + exportsFields: ['exports'], + mainFields: ['loader', 'main'], + extensions: ['.js'], + mainFiles: ['index'], + }; + return resolveOptions; +}; +const getResolveDefaults = ({ targetProperties, mode }) => { + const conditions = ['webpack']; + conditions.push(mode === 'development' ? 'development' : 'production'); + if (targetProperties) { + if (targetProperties.webworker) conditions.push('worker'); + if (targetProperties.node) conditions.push('node'); + if (targetProperties.web) conditions.push('browser'); + if (targetProperties.electron) conditions.push('electron'); + if (targetProperties.nwjs) conditions.push('nwjs'); + } + const jsExtensions = ['.js', '.json', '.wasm', '.tsx', '.ts', '.jsx']; + const tp = targetProperties; + const browserField = tp && tp.web && (!tp.node || (tp.electron && tp.electronRenderer)); + const cjsDeps = () => ({ + browserField, + mainFields: browserField ? ['browser', 'module', '...'] : ['module', '...'], + conditionNames: ['require', 'module', '...'], + extensions: [...jsExtensions], + }); + const esmDeps = () => ({ + browserField, + mainFields: browserField ? ['browser', 'module', '...'] : ['module', '...'], + conditionNames: ['import', 'module', '...'], + extensions: [...jsExtensions], + }); + const resolveOptions = { + modules: ['node_modules'], + conditionNames: conditions, + mainFiles: ['index'], + extensions: [], + browserField, + mainFields: ['main'].filter(Boolean), + exportsFields: ['exports'], + byDependency: { + wasm: esmDeps(), + esm: esmDeps(), + url: { + preferRelative: true, + }, + worker: { + ...esmDeps(), + preferRelative: true, + }, + commonjs: cjsDeps(), + // amd: cjsDeps(), + // for backward-compat: loadModule + // loader: cjsDeps(), + // for backward-compat: Custom Dependency and getResolve without dependencyType + unknown: cjsDeps(), + }, + }; + return resolveOptions; +}; +const D = (obj, prop, value) => { + if (obj[prop] === undefined) { + obj[prop] = value; + } +}; +const F = (obj, prop, factory) => { + if (obj[prop] === undefined) { + obj[prop] = factory(); + } +}; +const A = (obj, prop, factory) => { + const value = obj[prop]; + if (value === undefined) { + obj[prop] = factory(); + } else if (Array.isArray(value)) { + let newArray; + for (let i = 0; i < value.length; i++) { + const item = value[i]; + if (item === '...') { + if (newArray === undefined) { + newArray = value.slice(0, i); + // @ts-expect-error + obj[prop] = newArray; + } + const items = factory(); + if (items !== undefined) { + for (const item of items) { + newArray.push(item); + } + } + } else if (newArray !== undefined) { + newArray.push(item); + } + } + } +}; diff --git a/packages/bundles/override/rspack/zod.js b/packages/bundles/override/rspack/zod.js new file mode 100644 index 0000000000..b93d8ac404 --- /dev/null +++ b/packages/bundles/override/rspack/zod.js @@ -0,0 +1,705 @@ +'use strict'; +Object.defineProperty(exports, '__esModule', { value: true }); +exports.rspackOptions = void 0; +const zod_1 = require('zod'); +const util_1 = require('../util'); +// #region Name +const name = zod_1.z.string(); +// #endregion +// #region Dependencies +const dependencies = zod_1.z.array(name); +// #endregion +// #region Context +const context = zod_1.z.string(); +// #endregion +// #region Mode +const mode = zod_1.z.enum(['development', 'production', 'none']); +// #endregion +// #region Entry +const rawPublicPath = zod_1.z.string(); +const publicPath = zod_1.z.literal('auto').or(rawPublicPath); +const baseUri = zod_1.z.string(); +const chunkLoadingType = zod_1.z + .enum(['jsonp', 'import-scripts', 'require', 'async-node', 'import']) + .or(zod_1.z.string()); +const chunkLoading = zod_1.z.literal(false).or(chunkLoadingType); +const asyncChunks = zod_1.z.boolean(); +const wasmLoadingType = zod_1.z + .enum(['fetch-streaming', 'fetch', 'async-node']) + .or(zod_1.z.string()); +const wasmLoading = zod_1.z.literal(false).or(wasmLoadingType); +const libraryCustomUmdObject = zod_1.z.strictObject({ + amd: zod_1.z.string().optional(), + commonjs: zod_1.z.string().optional(), + root: zod_1.z.string().or(zod_1.z.array(zod_1.z.string())).optional(), +}); +const libraryName = zod_1.z + .string() + .or(zod_1.z.array(zod_1.z.string())) + .or(libraryCustomUmdObject); +const libraryCustomUmdCommentObject = zod_1.z.strictObject({ + amd: zod_1.z.string().optional(), + commonjs: zod_1.z.string().optional(), + commonjs2: zod_1.z.string().optional(), + root: zod_1.z.string().optional(), +}); +const amdContainer = zod_1.z.string(); +const auxiliaryComment = zod_1.z.string().or(libraryCustomUmdCommentObject); +const libraryExport = zod_1.z.string().or(zod_1.z.array(zod_1.z.string())); +const libraryType = zod_1.z + .enum([ + 'var', + 'module', + 'assign', + 'assign-properties', + 'this', + 'window', + 'self', + 'global', + 'commonjs', + 'commonjs2', + 'commonjs-module', + 'commonjs-static', + 'amd', + 'amd-require', + 'umd', + 'umd2', + 'jsonp', + 'system', +]) + .or(zod_1.z.string()); +const umdNamedDefine = zod_1.z.boolean(); +const libraryOptions = zod_1.z.strictObject({ + amdContainer: amdContainer.optional(), + auxiliaryComment: auxiliaryComment.optional(), + export: libraryExport.optional(), + name: libraryName.optional(), + type: libraryType, + umdNamedDefine: umdNamedDefine.optional(), +}); +const filenameTemplate = zod_1.z.string(); +const filename = filenameTemplate; +const entryFilename = filenameTemplate; +const entryRuntime = zod_1.z.literal(false).or(zod_1.z.string()); +const entryItem = zod_1.z.string().or(zod_1.z.array(zod_1.z.string())); +const entryDescription = zod_1.z.strictObject({ + import: entryItem, + runtime: entryRuntime.optional(), + publicPath: publicPath.optional(), + baseUri: baseUri.optional(), + chunkLoading: chunkLoading.optional(), + asyncChunks: asyncChunks.optional(), + wasmLoading: wasmLoading.optional(), + filename: entryFilename.optional(), + library: libraryOptions.optional(), +}); +const entryUnnamed = entryItem; +const entryObject = zod_1.z.record(entryItem.or(entryDescription)); +const entryStatic = entryObject.or(entryUnnamed); +const entry = entryStatic; +// #endregion +// #region Output +const path = zod_1.z.string(); +const assetModuleFilename = zod_1.z.string(); +const webassemblyModuleFilename = zod_1.z.string(); +const chunkFilename = filenameTemplate; +const crossOriginLoading = zod_1.z + .literal(false) + .or(zod_1.z.enum(['anonymous', 'use-credentials'])); +const cssFilename = filenameTemplate; +const cssChunkFilename = filenameTemplate; +const hotUpdateChunkFilename = filenameTemplate; +const hotUpdateMainFilename = filenameTemplate; +const hotUpdateGlobal = zod_1.z.string(); +const uniqueName = zod_1.z.string(); +const chunkLoadingGlobal = zod_1.z.string(); +const enabledLibraryTypes = zod_1.z.array(libraryType); +const clean = zod_1.z.boolean(); +const outputModule = zod_1.z.boolean(); +const strictModuleErrorHandling = zod_1.z.boolean(); +const globalObject = zod_1.z.string(); +const enabledWasmLoadingTypes = zod_1.z.array(wasmLoadingType); +const importFunctionName = zod_1.z.string(); +const iife = zod_1.z.boolean(); +const enabledChunkLoadingTypes = zod_1.z.array(chunkLoadingType); +const chunkFormat = zod_1.z.literal(false).or(zod_1.z.string()); +const workerPublicPath = zod_1.z.string(); +const trustedTypes = zod_1.z.strictObject({ + policyName: zod_1.z.string().optional(), +}); +const hashDigest = zod_1.z.string(); +const hashDigestLength = zod_1.z.number(); +const hashFunction = zod_1.z.string(); +const hashSalt = zod_1.z.string(); +const sourceMapFilename = zod_1.z.string(); +const output = zod_1.z.strictObject({ + path: path.optional(), + clean: clean.optional(), + publicPath: publicPath.optional(), + filename: filename.optional(), + chunkFilename: chunkFilename.optional(), + crossOriginLoading: crossOriginLoading.optional(), + cssFilename: cssFilename.optional(), + cssChunkFilename: cssChunkFilename.optional(), + hotUpdateMainFilename: hotUpdateMainFilename.optional(), + hotUpdateChunkFilename: hotUpdateChunkFilename.optional(), + hotUpdateGlobal: hotUpdateGlobal.optional(), + assetModuleFilename: assetModuleFilename.optional(), + uniqueName: uniqueName.optional(), + chunkLoadingGlobal: chunkLoadingGlobal.optional(), + enabledLibraryTypes: enabledLibraryTypes.optional(), + library: libraryName.or(libraryOptions).optional(), + libraryExport: libraryExport.optional(), + libraryTarget: libraryType.optional(), + umdNamedDefine: umdNamedDefine.optional(), + amdContainer: amdContainer.optional(), + auxiliaryComment: auxiliaryComment.optional(), + module: outputModule.optional(), + strictModuleErrorHandling: strictModuleErrorHandling.optional(), + globalObject: globalObject.optional(), + importFunctionName: importFunctionName.optional(), + iife: iife.optional(), + wasmLoading: wasmLoading.optional(), + enabledWasmLoadingTypes: enabledWasmLoadingTypes.optional(), + webassemblyModuleFilename: webassemblyModuleFilename.optional(), + chunkFormat: chunkFormat.optional(), + chunkLoading: chunkLoading.optional(), + enabledChunkLoadingTypes: enabledChunkLoadingTypes.optional(), + trustedTypes: zod_1.z.literal(true).or(zod_1.z.string()).or(trustedTypes).optional(), + sourceMapFilename: sourceMapFilename.optional(), + hashDigest: hashDigest.optional(), + hashDigestLength: hashDigestLength.optional(), + hashFunction: hashFunction.optional(), + hashSalt: hashSalt.optional(), + asyncChunks: asyncChunks.optional(), + workerChunkLoading: chunkLoading.optional(), + workerWasmLoading: wasmLoading.optional(), + workerPublicPath: workerPublicPath.optional(), +}); +// #endregion +// #region Resolve +const resolveAlias = zod_1.z.record(zod_1.z + .literal(false) + .or(zod_1.z.string()) + .or(zod_1.z.array(zod_1.z.string().or(zod_1.z.literal(false))))); +const resolveTsconfig = zod_1.z.strictObject({ + configFile: zod_1.z.string(), + references: zod_1.z.array(zod_1.z.string()).or(zod_1.z.literal('auto')).optional(), +}); +const baseResolveOptions = zod_1.z.strictObject({ + alias: resolveAlias.optional(), + /** + * This is `aliasField: ["browser"]` in webpack, because no one + * uses aliasField other than "browser". ---@bvanjoi + */ + browserField: zod_1.z.boolean().optional(), + conditionNames: zod_1.z.array(zod_1.z.string()).optional(), + extensions: zod_1.z.array(zod_1.z.string()).optional(), + fallback: resolveAlias.optional(), + mainFields: zod_1.z.array(zod_1.z.string()).optional(), + mainFiles: zod_1.z.array(zod_1.z.string()).optional(), + modules: zod_1.z.array(zod_1.z.string()).optional(), + preferRelative: zod_1.z.boolean().optional(), + tsConfigPath: zod_1.z.string().optional(), + tsConfig: resolveTsconfig.optional(), + fullySpecified: zod_1.z.boolean().optional(), + exportsFields: zod_1.z.array(zod_1.z.string()).optional(), + extensionAlias: zod_1.z.record(zod_1.z.string().or(zod_1.z.array(zod_1.z.string()))).optional(), +}); +const resolveOptions = baseResolveOptions.extend({ + byDependency: zod_1.z.lazy(() => zod_1.z.record(resolveOptions)).optional(), +}); +const resolve = resolveOptions; +// #endregion +// #region Module +const baseRuleSetCondition = zod_1.z + .instanceof(RegExp) + .or(zod_1.z.string()) + .or(zod_1.z.function().args(zod_1.z.string()).returns(zod_1.z.boolean())); +const ruleSetCondition = baseRuleSetCondition + .or(zod_1.z.lazy(() => ruleSetConditions)) + .or(zod_1.z.lazy(() => ruleSetLogicalConditions)); +const ruleSetConditions = zod_1.z.lazy(() => zod_1.z.array(ruleSetCondition)); +const ruleSetLogicalConditions = zod_1.z.strictObject({ + and: ruleSetConditions.optional(), + or: ruleSetConditions.optional(), + not: ruleSetConditions.optional(), +}); +const ruleSetLoader = zod_1.z.string(); +const ruleSetLoaderOptions = zod_1.z.string().or(zod_1.z.record(zod_1.z.any())); +const ruleSetLoaderWithOptions = zod_1.z.strictObject({ + ident: zod_1.z.string().optional(), + loader: ruleSetLoader, + options: ruleSetLoaderOptions.optional(), +}); +const ruleSetUseItem = ruleSetLoader.or(ruleSetLoaderWithOptions); +const ruleSetUse = ruleSetUseItem + .or(ruleSetUseItem.array()) + .or(zod_1.z.function().args(zod_1.z.custom()).returns(ruleSetUseItem.array())); +const baseRuleSetRule = zod_1.z.strictObject({ + test: ruleSetCondition.optional(), + exclude: ruleSetCondition.optional(), + include: ruleSetCondition.optional(), + issuer: ruleSetCondition.optional(), + dependency: ruleSetCondition.optional(), + resource: ruleSetCondition.optional(), + resourceFragment: ruleSetCondition.optional(), + resourceQuery: ruleSetCondition.optional(), + scheme: ruleSetCondition.optional(), + mimetype: ruleSetCondition.optional(), + descriptionData: zod_1.z.record(ruleSetCondition).optional(), + type: zod_1.z.string().optional(), + loader: ruleSetLoader.optional(), + options: ruleSetLoaderOptions.optional(), + use: ruleSetUse.optional(), + parser: zod_1.z.record(zod_1.z.any()).optional(), + generator: zod_1.z.record(zod_1.z.any()).optional(), + resolve: resolveOptions.optional(), + sideEffects: zod_1.z.boolean().optional(), + enforce: zod_1.z.literal('pre').or(zod_1.z.literal('post')).optional(), +}); +const ruleSetRule = baseRuleSetRule.extend({ + oneOf: zod_1.z.lazy(() => ruleSetRule.array()).optional(), + rules: zod_1.z.lazy(() => ruleSetRule.array()).optional(), +}); +const ruleSetRules = zod_1.z.array(zod_1.z.literal('...').or(ruleSetRule)); +const assetParserDataUrlOptions = zod_1.z.strictObject({ + maxSize: zod_1.z.number().optional(), +}); +const assetParserDataUrl = assetParserDataUrlOptions; +const assetParserOptions = zod_1.z.strictObject({ + dataUrlCondition: assetParserDataUrl.optional(), +}); +// TODO: "weak", "lazy-once" +const dynamicImportMode = zod_1.z.enum(['eager', 'lazy']); +const javascriptParserOptions = zod_1.z.strictObject({ + dynamicImportMode: dynamicImportMode.optional(), +}); +const parserOptionsByModuleTypeKnown = zod_1.z.strictObject({ + asset: assetParserOptions.optional(), + javascript: javascriptParserOptions.optional(), +}); +const parserOptionsByModuleTypeUnknown = zod_1.z.record(zod_1.z.record(zod_1.z.any())); +const parserOptionsByModuleType = parserOptionsByModuleTypeKnown.or(parserOptionsByModuleTypeUnknown); +const assetGeneratorDataUrlOptions = zod_1.z.strictObject({ + encoding: zod_1.z.literal(false).or(zod_1.z.literal('base64')).optional(), + mimetype: zod_1.z.string().optional(), +}); +const assetGeneratorDataUrl = assetGeneratorDataUrlOptions; +const assetInlineGeneratorOptions = zod_1.z.strictObject({ + dataUrl: assetGeneratorDataUrl.optional(), +}); +const assetResourceGeneratorOptions = zod_1.z.strictObject({ + filename: filenameTemplate.optional(), + publicPath: publicPath.optional(), +}); +const assetGeneratorOptions = assetInlineGeneratorOptions.merge(assetResourceGeneratorOptions); +const generatorOptionsByModuleTypeKnown = zod_1.z.strictObject({ + asset: assetGeneratorOptions.optional(), + 'asset/inline': assetInlineGeneratorOptions.optional(), + 'asset/resource': assetResourceGeneratorOptions.optional(), +}); +const generatorOptionsByModuleTypeUnknown = zod_1.z.record(zod_1.z.record(zod_1.z.any())); +const generatorOptionsByModuleType = generatorOptionsByModuleTypeKnown.or(generatorOptionsByModuleTypeUnknown); +const moduleOptions = zod_1.z.strictObject({ + defaultRules: ruleSetRules.optional(), + rules: ruleSetRules.optional(), + parser: parserOptionsByModuleType.optional(), + generator: generatorOptionsByModuleType.optional(), +}); +// #endregion +// #region Target +const allowTarget = zod_1.z + .enum([ + 'web', + 'webworker', + 'es3', + 'es5', + 'es2015', + 'es2016', + 'es2017', + 'es2018', + 'es2019', + 'es2020', + 'es2021', + 'es2022', + 'browserslist', +]) + .or(zod_1.z.literal('node')) + .or(zod_1.z.literal('async-node')) + .or(zod_1.z.custom(value => typeof value === 'string' && /^node\d+$/.test(value))) + .or(zod_1.z.custom(value => typeof value === 'string' && /^async-node\d+$/.test(value))) + .or(zod_1.z.custom(value => typeof value === 'string' && /^node\d+\.\d+$/.test(value))) + .or(zod_1.z.custom(value => typeof value === 'string' && /^async-node\d+\.\d+$/.test(value))) + .or(zod_1.z.literal('electron-main')) + .or(zod_1.z.custom(value => typeof value === 'string' && /^electron\d+-main$/.test(value))) + .or(zod_1.z.custom(value => typeof value === 'string' && /^electron\d+\.\d+-main$/.test(value))) + .or(zod_1.z.literal('electron-renderer')) + .or(zod_1.z.custom(value => typeof value === 'string' && /^electron\d+-renderer$/.test(value))) + .or(zod_1.z.custom(value => typeof value === 'string' && /^electron\d+\.\d+-renderer$/.test(value))) + .or(zod_1.z.literal('electron-preload')) + .or(zod_1.z.custom(value => typeof value === 'string' && /^electron\d+-preload$/.test(value))) + .or(zod_1.z.custom(value => typeof value === 'string' && /^electron\d+\.\d+-preload$/.test(value))); +const target = zod_1.z.literal(false).or(allowTarget).or(allowTarget.array()); +// #endregion +// #region ExternalsType +const externalsType = zod_1.z.enum([ + 'var', + 'module', + 'assign', + 'this', + 'window', + 'self', + 'global', + 'commonjs', + 'commonjs2', + 'commonjs-module', + 'commonjs-static', + 'amd', + 'amd-require', + 'umd', + 'umd2', + 'jsonp', + 'system', + 'promise', + 'import', + 'script', + 'node-commonjs', +]); +// #endregion +// #region Externals +const externalItemValue = zod_1.z + .string() + .or(zod_1.z.boolean()) + .or(zod_1.z.string().array().min(1)) + .or(zod_1.z.record(zod_1.z.string().or(zod_1.z.string().array()))); +const externalItemObjectUnknown = zod_1.z.record(externalItemValue); +const externalItemFunctionData = zod_1.z.strictObject({ + context: zod_1.z.string().optional(), + dependencyType: zod_1.z.string().optional(), + request: zod_1.z.string().optional(), +}); +const externalItem = zod_1.z + .string() + .or(zod_1.z.instanceof(RegExp)) + .or(externalItemObjectUnknown) + .or(zod_1.z + .function() + .args(externalItemFunctionData, zod_1.z + .function() + .args(zod_1.z.instanceof(Error).optional(), externalItemValue.optional(), externalsType.optional()) + .returns(zod_1.z.void()))) + .or(zod_1.z + .function() + .args(externalItemFunctionData) + .returns(zod_1.z.promise(externalItemValue))); +const externals = externalItem.array().or(externalItem); +// #endregion +// #region ExternalsPresets +const externalsPresets = zod_1.z.strictObject({ + node: zod_1.z.boolean().optional(), + web: zod_1.z.boolean().optional(), + webAsync: zod_1.z.boolean().optional(), + electron: zod_1.z.boolean().optional(), + electronMain: zod_1.z.boolean().optional(), + electronPreload: zod_1.z.boolean().optional(), + electronRenderer: zod_1.z.boolean().optional(), +}); +// #endregion +// #region InfrastructureLogging +const filterItemTypes = zod_1.z + .instanceof(RegExp) + .or(zod_1.z.string()) + .or(zod_1.z.function().args(zod_1.z.string()).returns(zod_1.z.boolean())); +const filterTypes = filterItemTypes.array().or(filterItemTypes); +const infrastructureLogging = zod_1.z.strictObject({ + appendOnly: zod_1.z.boolean().optional(), + colors: zod_1.z.boolean().optional(), + console: zod_1.z.custom().optional(), + debug: zod_1.z.boolean().or(filterTypes).optional(), + level: zod_1.z.enum(['none', 'error', 'warn', 'info', 'log', 'verbose']).optional(), + stream: zod_1.z.custom().optional(), +}); +// #endregion +// #region DevTool +const devTool = zod_1.z + .literal(false) + .or(zod_1.z.enum([ + 'cheap-source-map', + 'cheap-module-source-map', + 'source-map', + 'inline-cheap-source-map', + 'inline-cheap-module-source-map', + 'inline-source-map', + 'inline-nosources-cheap-module-source-map', + 'inline-nosources-source-map', + 'nosources-cheap-source-map', + 'nosources-cheap-module-source-map', + 'nosources-source-map', + 'hidden-nosources-cheap-source-map', + 'hidden-nosources-cheap-module-source-map', + 'hidden-nosources-source-map', + 'hidden-cheap-source-map', + 'hidden-cheap-module-source-map', + 'hidden-source-map', + 'eval-cheap-source-map', + 'eval-cheap-module-source-map', + 'eval-source-map', + 'eval-nosources-cheap-source-map', + 'eval-nosources-cheap-module-source-map', + 'eval-nosources-source-map', +])); +// #endregion +// #region Node +const nodeOptions = zod_1.z.strictObject({ + __dirname: zod_1.z + .boolean() + .or(zod_1.z.enum(['warn-mock', 'mock', 'eval-only'])) + .optional(), + __filename: zod_1.z + .boolean() + .or(zod_1.z.enum(['warn-mock', 'mock', 'eval-only'])) + .optional(), + global: zod_1.z.boolean().or(zod_1.z.literal('warn')).optional(), +}); +const node = zod_1.z.literal(false).or(nodeOptions); +// #endregion +// #region Snapshot +const snapshotOptions = zod_1.z.strictObject({ + module: zod_1.z + .strictObject({ + hash: zod_1.z.boolean().optional(), + timestamp: zod_1.z.boolean().optional(), + }) + .optional(), + resolve: zod_1.z + .strictObject({ + hash: zod_1.z.boolean().optional(), + timestamp: zod_1.z.boolean().optional(), + }) + .optional(), +}); +// #endregion +// #region Cache +const cacheOptions = zod_1.z.boolean(); +// #endregion +// #region Stats +const statsOptions = zod_1.z.strictObject({ + all: zod_1.z.boolean().optional(), + preset: zod_1.z + .enum(['normal', 'none', 'verbose', 'errors-only', 'errors-warnings']) + .optional(), + assets: zod_1.z.boolean().optional(), + chunks: zod_1.z.boolean().optional(), + modules: zod_1.z.boolean().optional(), + entrypoints: zod_1.z.boolean().optional(), + chunkGroups: zod_1.z.boolean().optional(), + warnings: zod_1.z.boolean().optional(), + warningsCount: zod_1.z.boolean().optional(), + errors: zod_1.z.boolean().optional(), + errorsCount: zod_1.z.boolean().optional(), + colors: zod_1.z.boolean().optional(), + hash: zod_1.z.boolean().optional(), + version: zod_1.z.boolean().optional(), + reasons: zod_1.z.boolean().optional(), + publicPath: zod_1.z.boolean().optional(), + outputPath: zod_1.z.boolean().optional(), + chunkModules: zod_1.z.boolean().optional(), + chunkRelations: zod_1.z.boolean().optional(), + ids: zod_1.z.boolean().optional(), + timings: zod_1.z.boolean().optional(), + builtAt: zod_1.z.boolean().optional(), + moduleAssets: zod_1.z.boolean().optional(), + modulesSpace: zod_1.z.number().optional(), + nestedModules: zod_1.z.boolean().optional(), + source: zod_1.z.boolean().optional(), + logging: zod_1.z + .enum(['none', 'error', 'warn', 'info', 'log', 'verbose']) + .or(zod_1.z.boolean()) + .optional(), + loggingDebug: zod_1.z.boolean().or(filterTypes).optional(), + loggingTrace: zod_1.z.boolean().optional(), + runtimeModules: zod_1.z.boolean().optional(), +}); +const statsValue = zod_1.z + .enum(['none', 'errors-only', 'errors-warnings', 'normal', 'verbose']) + .or(zod_1.z.boolean()) + .or(statsOptions); +const plugin = zod_1.z.union([ + zod_1.z.custom(), + zod_1.z.custom(), +]); +const plugins = plugin.array(); +// #endregion +// #region Optimization +const optimizationRuntimeChunk = zod_1.z + .enum(['single', 'multiple']) + .or(zod_1.z.boolean()) + .or(zod_1.z.strictObject({ + name: zod_1.z + .string() + .or(zod_1.z.function().returns(zod_1.z.string().or(zod_1.z.undefined()))) + .optional(), +})); +const optimizationSplitChunksName = zod_1.z.string().or(zod_1.z.literal(false)); +const optimizationSplitChunksChunks = zod_1.z + .enum(['initial', 'async', 'all']) + .or(zod_1.z.instanceof(RegExp)); +const optimizationSplitChunksSizes = zod_1.z.number(); +const sharedOptimizationSplitChunksCacheGroup = { + chunks: optimizationSplitChunksChunks.optional(), + minChunks: zod_1.z.number().optional(), + name: optimizationSplitChunksName.optional(), + minSize: optimizationSplitChunksSizes.optional(), + maxSize: optimizationSplitChunksSizes.optional(), + maxAsyncSize: optimizationSplitChunksSizes.optional(), + maxInitialSize: optimizationSplitChunksSizes.optional(), +}; +const optimizationSplitChunksCacheGroup = zod_1.z.strictObject({ + test: zod_1.z.string().or(zod_1.z.instanceof(RegExp)).optional(), + priority: zod_1.z.number().optional(), + enforce: zod_1.z.boolean().optional(), + reuseExistingChunk: zod_1.z.boolean().optional(), + type: zod_1.z.string().or(zod_1.z.instanceof(RegExp)).optional(), + idHint: zod_1.z.string().optional(), + ...sharedOptimizationSplitChunksCacheGroup, +}); +const optimizationSplitChunksOptions = zod_1.z.strictObject({ + cacheGroups: zod_1.z + .record(zod_1.z.literal(false).or(optimizationSplitChunksCacheGroup)) + .optional(), + maxAsyncRequests: zod_1.z.number().optional(), + maxInitialRequests: zod_1.z.number().optional(), + fallbackCacheGroup: zod_1.z + .strictObject({ + chunks: optimizationSplitChunksChunks.optional(), + minSize: zod_1.z.number().optional(), + maxSize: zod_1.z.number().optional(), + maxAsyncSize: zod_1.z.number().optional(), + maxInitialSize: zod_1.z.number().optional(), + }) + .optional(), + ...sharedOptimizationSplitChunksCacheGroup, +}); +const optimization = zod_1.z.strictObject({ + moduleIds: zod_1.z.enum(['named', 'deterministic']).optional(), + chunkIds: zod_1.z.enum(['named', 'deterministic']).optional(), + minimize: zod_1.z.boolean().optional(), + minimizer: zod_1.z.literal('...').or(plugin).array().optional(), + splitChunks: optimizationSplitChunksOptions.optional(), + runtimeChunk: optimizationRuntimeChunk.optional(), + removeAvailableModules: zod_1.z.boolean().optional(), + removeEmptyChunks: zod_1.z.boolean().optional(), + realContentHash: zod_1.z.boolean().optional(), + sideEffects: zod_1.z.enum(['flag']).or(zod_1.z.boolean()).optional(), + providedExports: zod_1.z.boolean().optional(), + innerGraph: zod_1.z.boolean().optional(), + usedExports: zod_1.z.enum(['global']).or(zod_1.z.boolean()).optional(), + nodeEnv: zod_1.z.union([zod_1.z.string(), zod_1.z.literal(false)]).optional(), +}); +// #endregion +// #region Experiments +const incrementalRebuildOptions = zod_1.z.strictObject({ + make: zod_1.z.boolean().optional(), + emitAsset: zod_1.z.boolean().optional(), +}); +const rspackFutureOptions = zod_1.z.strictObject({ + newResolver: zod_1.z.boolean().optional(), + newTreeshaking: zod_1.z.boolean().optional(), + disableTransformByDefault: zod_1.z.boolean().optional(), +}); +const experiments = zod_1.z.strictObject({ + lazyCompilation: zod_1.z.boolean().optional(), + incrementalRebuild: zod_1.z + .boolean() + .or(incrementalRebuildOptions) + .optional() + .refine(val => { + if (val !== undefined) { + (0, util_1.deprecatedWarn)(`'experiments.incrementalRebuild' has been deprecated, and will be drop support in 0.5.0. See the discussion ${(0, util_1.termlink)('here', 'https://github.com/web-infra-dev/rspack/issues/4708')}`); + } + return true; + }), + asyncWebAssembly: zod_1.z.boolean().optional(), + outputModule: zod_1.z.boolean().optional(), + topLevelAwait: zod_1.z.boolean().optional(), + newSplitChunks: zod_1.z + .boolean() + .optional() + .refine(val => { + if (val === false) { + (0, util_1.deprecatedWarn)(`'experiments.newSplitChunks = ${JSON.stringify(val)}' has been deprecated, please switch to 'experiments.newSplitChunks = true' to use webpack's behavior. + See the discussion ${(0, util_1.termlink)('here', 'https://github.com/web-infra-dev/rspack/discussions/4168')}`); + } + return true; + }), + css: zod_1.z.boolean().optional(), + futureDefaults: zod_1.z.boolean().optional(), + rspackFuture: rspackFutureOptions.optional(), +}); +// #endregion +// #region Watch +const watch = zod_1.z.boolean(); +// #endregion +// #region WatchOptions +const watchOptions = zod_1.z.strictObject({ + aggregateTimeout: zod_1.z.number().optional(), + followSymlinks: zod_1.z.boolean().optional(), + ignored: zod_1.z + .string() + .array() + .or(zod_1.z.instanceof(RegExp)) + .or(zod_1.z.string()) + .optional(), + poll: zod_1.z.number().or(zod_1.z.boolean()).optional(), + stdin: zod_1.z.boolean().optional(), +}); +const devServer = zod_1.z.custom(); +// #endregion +// #region IgnoreWarnings +const ignoreWarnings = zod_1.z + .instanceof(RegExp) + .or(zod_1.z + .function() + .args(zod_1.z.instanceof(Error), zod_1.z.custom()) + .returns(zod_1.z.boolean())) + .array(); +// #endregion +// #region Profile +const profile = zod_1.z.boolean(); +// #endregion +// #region Builtins (deprecated) +const builtins = zod_1.z.custom(); +const features = zod_1.z.custom(); +// #endregion +exports.rspackOptions = zod_1.z.strictObject({ + name: name.optional(), + dependencies: dependencies.optional(), + entry: entry.optional(), + output: output.optional(), + target: target.optional(), + mode: mode.optional(), + experiments: experiments.optional(), + externals: externals.optional(), + externalsType: externalsType.optional(), + externalsPresets: externalsPresets.optional(), + infrastructureLogging: infrastructureLogging.optional(), + cache: cacheOptions.optional(), + context: context.optional(), + devtool: devTool.optional(), + node: node.optional(), + ignoreWarnings: ignoreWarnings.optional(), + watchOptions: watchOptions.optional(), + watch: watch.optional(), + stats: statsValue.optional(), + snapshot: snapshotOptions.optional(), + optimization: optimization.optional(), + resolve: resolve.optional(), + resolveLoader: resolve.optional(), + plugins: plugins.optional(), + devServer: devServer.optional(), + builtins: builtins.optional(), + module: moduleOptions.optional(), + profile: profile.optional(), + features: features.optional(), +}); diff --git a/packages/bundles/package.json b/packages/bundles/package.json index a6c4a1b3f1..d8fd0b8853 100644 --- a/packages/bundles/package.json +++ b/packages/bundles/package.json @@ -33,7 +33,6 @@ "react-refresh": "0.14.0", "core-js-pure": "^3.8.1", "error-stack-parser": "^2.0.6", - "@rspack/dev-server": "0.3.11", "@ice/css-modules-hash": "0.0.6", "browserslist": "^4.21.3", "compare-versions": "6.0.0-rc.1", @@ -45,10 +44,13 @@ "webpack-sources": "3.2.3", "zod": "^3.21.4", "zod-validation-error": "1.2.0", - "@rspack/binding": "0.3.11" + "terminal-link": "^2.1.1", + "@ice/pack-binding": "0.0.2", + "@rspack/plugin-react-refresh": "0.4.0" }, "devDependencies": { - "@rspack/core": "0.3.11", + "@rspack/dev-server": "0.4.0", + "@rspack/core": "0.4.0", "@types/less": "^3.0.3", "@types/lodash": "^4.14.181", "@types/webpack-bundle-analyzer": "^4.4.1", @@ -86,7 +88,7 @@ "bonjour-service": "^1.0.13", "colorette": "^2.0.10", "compression": "^1.7.4", - "connect-history-api-fallback": "^1.6.0", + "connect-history-api-fallback": "2.0.0", "default-gateway": "^6.0.3", "express": "^4.17.3", "graceful-fs": "4.2.10", diff --git a/packages/bundles/scripts/tasks.ts b/packages/bundles/scripts/tasks.ts index 698cddeb13..12bc8e1abe 100644 --- a/packages/bundles/scripts/tasks.ts +++ b/packages/bundles/scripts/tasks.ts @@ -227,20 +227,57 @@ const tasks = [ patch: () => { const pkgPath = path.join(__dirname, '../node_modules/@rspack/core'); const targetPath = path.join(__dirname, '../compiled/@rspack/core'); - fs.removeSync(targetPath); // Copy the entire directory. - // Mark: when copy each file separately, the build process will be stuck. - fs.copySync(pkgPath, targetPath); - // Remove node_modules while bin files may be linked to node_modules. - fs.removeSync(path.join(pkgPath, 'node_modules')); // filter out js files and replace with compiled files. - const filePaths = globbySync(['**/*.js'], { cwd: targetPath, ignore: ['node_modules'] }); + const filePaths = globbySync(['**/*'], { cwd: pkgPath, ignore: ['node_modules'] }); + const filesAddOverwrite = ['dist/config/adapter.js', 'dist/config/defaults.js', 'dist/config/zod.js', 'dist/util/bindingVersionCheck.js']; filePaths.forEach((filePath) => { - const sourcePath = path.join(targetPath, filePath); - const fileContent = fs.readFileSync(sourcePath, 'utf8'); - fs.writeFileSync(sourcePath, replaceDeps(fileContent, ['tapable', 'schema-utils', 'graceful-fs'])); + const sourcePath = path.join(pkgPath, filePath); + const targetFilePath = path.join(targetPath, filePath); + fs.ensureDirSync(path.dirname(targetFilePath)); + if (path.extname(filePath) === '.js') { + const matched = filesAddOverwrite.some(filePath => { + const matched = sourcePath.split(path.sep).join('/').includes(filePath); + if (matched) { + fs.copyFileSync(path.join(__dirname, `../override/rspack/${path.basename(filePath)}`), targetFilePath); + } + return matched; + }); + if (!matched) { + const fileContent = fs.readFileSync(sourcePath, 'utf8'); + fs.writeFileSync( + targetFilePath, + replaceDeps(fileContent, ['tapable', 'schema-utils', 'graceful-fs']) + .replace(new RegExp('require\\(["\']@rspack/binding["\']\\)', 'g'), 'require("@ice/pack-binding")'), + ); + } + } else { + fs.copyFileSync(sourcePath, targetFilePath); + } + }); + }, + }, + { + pkgName: '@rspack/dev-server', + skipCompile: true, + patch: () => { + // Copy webpack-dev-server while all dependencies has been packed. + const pkgPath = path.join(__dirname, '../node_modules/@rspack/dev-server'); + const filePaths = globbySync(['**/*'], { cwd: pkgPath, ignore: ['node_modules', 'types', 'bin'] }); + filePaths.forEach((filePath) => { + fs.ensureDirSync(path.join(__dirname, `../compiled/@rspack/dev-server/${path.dirname(filePath)}`)); + const sourcePath = path.join(pkgPath, filePath); + const targetPath = path.join(__dirname, `../compiled/@rspack/dev-server/${filePath}`); + if (path.extname(filePath) === '.js') { + const fileContent = fs.readFileSync(sourcePath, 'utf8'); + fs.writeFileSync(targetPath, + replaceDeps(fileContent, webpackDevServerDeps.concat([...commonDeps, '@rspack/core', 'webpack-dev-server'])) + .replace(/webpack-dev-server\/client\/clients/g, '@ice/bundles/compiled/webpack-dev-server/client/clients'), + ); + } else { + fs.copyFileSync(sourcePath, targetPath); + } }); - // TODO: replace @rspack/binding. }, }, ]; diff --git a/packages/bundles/src/dev-server.ts b/packages/bundles/src/dev-server.ts index 794a2cc45a..2c3d8a34b5 100644 --- a/packages/bundles/src/dev-server.ts +++ b/packages/bundles/src/dev-server.ts @@ -1 +1 @@ -export * from '@rspack/dev-server'; +export * from '../compiled/@rspack/dev-server/dist/index.js'; diff --git a/packages/ice/package.json b/packages/ice/package.json index 446b27f1c4..46db65c3fd 100644 --- a/packages/ice/package.json +++ b/packages/ice/package.json @@ -98,8 +98,8 @@ "unplugin": "^1.5.0", "webpack": "^5.88.0", "webpack-dev-server": "4.15.0", - "@rspack/core": "0.3.11", - "@rspack/dev-server": "0.3.11" + "@rspack/core": "0.4.0", + "@rspack/dev-server": "0.4.0" }, "peerDependencies": { "react": ">=18.0.0", diff --git a/packages/ice/src/bundler/rspack/build.ts b/packages/ice/src/bundler/rspack/build.ts index 212dae65c4..6de7c92584 100644 --- a/packages/ice/src/bundler/rspack/build.ts +++ b/packages/ice/src/bundler/rspack/build.ts @@ -15,7 +15,11 @@ async function build(options: BuildOptions) { }); const { stats, isSuccessful, messages } = await new Promise((resolve, reject) => { let messages: { errors: string[]; warnings: string[] }; - compiler.run(async (_, stats: MultiStats) => { + compiler.run(async (err: any, stats: MultiStats) => { + if (err) { + reject(err); + return; + } const obj = stats.toJson({ all: false, timings: true, diff --git a/packages/ice/src/bundler/rspack/index.ts b/packages/ice/src/bundler/rspack/index.ts index e88c7e7565..aec155cb97 100644 --- a/packages/ice/src/bundler/rspack/index.ts +++ b/packages/ice/src/bundler/rspack/index.ts @@ -39,6 +39,7 @@ async function bundler( rspackConfigs, }; if (command === 'start') { + // @ts-expect-error dev-server has been pre-packed, so it will have different type. devServer = await start(buildOptions); } else if (command === 'build') { await build(buildOptions); diff --git a/packages/ice/src/webpack/ServerCompilerPlugin.ts b/packages/ice/src/webpack/ServerCompilerPlugin.ts index 42711e4118..a4b62f7ce9 100644 --- a/packages/ice/src/webpack/ServerCompilerPlugin.ts +++ b/packages/ice/src/webpack/ServerCompilerPlugin.ts @@ -40,7 +40,7 @@ export default class ServerCompilerPlugin { if (compilation) { // Option of compilationInfo need to be object, while it may changed during multi-time compilation. this.compilerOptions.compilationInfo.assetsManifest = - JSON.parse(compilation.assets['assets-manifest.json'].source().toString()); + JSON.parse(compilation.getAsset('assets-manifest.json').source.source().toString()); } // For first time, we create a new task. // The next time, we use incremental build so do not create task again. diff --git a/packages/rspack-config/package.json b/packages/rspack-config/package.json index 0333906b38..d3a9ee31df 100644 --- a/packages/rspack-config/package.json +++ b/packages/rspack-config/package.json @@ -15,11 +15,11 @@ "*.d.ts" ], "dependencies": { - "@ice/shared-config": "1.1.2", - "@ice/bundles": "0.1.17" + "@ice/bundles": "0.1.17", + "@ice/shared-config": "1.1.2" }, "devDependencies": { - "@rspack/core": "0.3.11" + "@rspack/core": "0.4.0" }, "scripts": { "watch": "tsc -w --sourceMap", diff --git a/packages/rspack-config/src/index.ts b/packages/rspack-config/src/index.ts index 33aa04990f..30cb64021c 100644 --- a/packages/rspack-config/src/index.ts +++ b/packages/rspack-config/src/index.ts @@ -1,9 +1,9 @@ import * as path from 'path'; import { createRequire } from 'module'; -import { compilationPlugin, compileExcludes, getDefineVars, getCompilerPlugins } from '@ice/shared-config'; +import { compilationPlugin, compileExcludes, getDefineVars, getCompilerPlugins, getJsxTransformOptions } from '@ice/shared-config'; import type { Config, ModifyWebpackConfig } from '@ice/shared-config/types'; import type { Configuration, rspack as Rspack } from '@rspack/core'; -import AssetManifest from './plugins/AssetManifest.js'; +import lodash from '@ice/bundles/compiled/lodash/index.js'; import getSplitChunks from './splitChunks.js'; import getAssetsRule from './assetsRule.js'; import getCssRules from './cssRules.js'; @@ -25,6 +25,7 @@ type GetConfig = ( const require = createRequire(import.meta.url); +const { merge } = lodash; const getConfig: GetConfig = async (options) => { const { rootDir, @@ -39,6 +40,7 @@ const getConfig: GetConfig = async (options) => { const { mode, + minify, publicPath = '/', cacheDir, outputDir = 'build', @@ -58,6 +60,7 @@ const getConfig: GetConfig = async (options) => { plugins = [], middlewares, configureWebpack = [], + minimizerOptions = {}, } = taskConfig || {}; const absoluteOutputDir = path.isAbsolute(outputDir) ? outputDir : path.join(rootDir, outputDir); const hashKey = hash === true ? 'hash:8' : (hash || ''); @@ -74,10 +77,33 @@ const getConfig: GetConfig = async (options) => { enableEnv: true, getRoutesFile, }); - const { DefinePlugin, ProvidePlugin } = await import('@ice/bundles/esm/rspack.js'); + + const { rspack: { DefinePlugin, ProvidePlugin, SwcJsMinimizerRspackPlugin } } = await import('@ice/bundles/esm/rspack.js'); const cssFilename = `css/${hashKey ? `[name]-[${hashKey}].css` : '[name].css'}`; // get compile plugins const compilerWebpackPlugins = getCompilerPlugins(rootDir, taskConfig || {}, 'rspack', { isServer: false }); + const jsMinimizerPluginOptions: any = merge({ + compress: { + ecma: 5, + unused: true, + dead_code: true, + // The following two options are known to break valid JavaScript code + // https://github.com/vercel/next.js/issues/7178#issuecomment-493048965 + comparisons: false, + inline: 2, + passes: 4, + }, + mangle: { + safari10: true, + }, + format: { + safari10: true, + comments: false, + // Fixes usage of Emoji and certain Regex + asciiOnly: true, + }, + module: true, + }, minimizerOptions); const config: Configuration = { entry: { main: [path.join(rootDir, runtimeTmpDir, 'entry.client.tsx')], @@ -97,15 +123,19 @@ const getConfig: GetConfig = async (options) => { context: rootDir, module: { rules: [ - // Compliation rules for js / ts. { + // TODO: use regexp to improve performance. test: compilation.transformInclude, - use: [{ - loader: require.resolve('@ice/shared-config/compilation-loader'), + use: { + loader: 'builtin:compilation-loader', options: { - transform: compilation.transform, + swcOptions: getJsxTransformOptions({ suffix: 'jsx', rootDir, mode, fastRefresh: false, polyfill, enableEnv: true }), + transformFeatures: { + removeExport: swcOptions.removeExportExprs, + keepExport: swcOptions.keepExports, + }, }, - }], + }, }, ...getAssetsRule(), ...getCssRules({ @@ -123,6 +153,7 @@ const getConfig: GetConfig = async (options) => { aggregateTimeout: 100, }, optimization: { + minimize: !!minify, splitChunks: typeof splitChunks == 'object' ? splitChunks : getSplitChunks(rootDir, splitChunks), @@ -132,22 +163,23 @@ const getConfig: GetConfig = async (options) => { ...plugins, // Unplugin should be compatible with rspack. ...compilerWebpackPlugins, - new AssetManifest({ - fileName: 'assets-manifest.json', - outputDir: path.join(rootDir, runtimeTmpDir), - }), new DefinePlugin(getDefineVars(define, runtimeDefineVars, getExpandedEnvs)), new ProvidePlugin({ process: [require.resolve('process/browser')], $ReactRefreshRuntime$: [require.resolve('./client/reactRefresh.cjs')], }), + !!minify && new SwcJsMinimizerRspackPlugin(jsMinimizerPluginOptions), ].filter(Boolean), builtins: { - devFriendlySplitChunks: true, css: { modules: { localIdentName }, }, }, + experiments: { + rspackFuture: { + disableTransformByDefault: true, + }, + }, stats: 'none', infrastructureLogging: { level: 'warn', @@ -172,6 +204,7 @@ const getConfig: GetConfig = async (options) => { ...devServer, setupMiddlewares: middlewares, }, + features: {}, }; // Compatible with API configureWebpack. const ctx = { diff --git a/packages/rspack-config/src/plugins/AssetManifest.ts b/packages/rspack-config/src/plugins/AssetManifest.ts deleted file mode 100644 index e51f67e67f..0000000000 --- a/packages/rspack-config/src/plugins/AssetManifest.ts +++ /dev/null @@ -1,75 +0,0 @@ -import { existsSync } from 'fs'; -import { resolve } from 'path'; -import type { Compiler, Compilation, RspackPluginInstance } from '@rspack/core'; - -export default class AssetManifest implements RspackPluginInstance { - private fileName: string; - private outputDir: string; - - constructor(options) { - this.fileName = options?.fileName || 'assets-manifest.json'; - this.outputDir = options?.outputDir || './'; - } - - apply(compiler: Compiler) { - compiler.hooks.thisCompilation.tap(this.constructor.name, (compilation) => { - compilation.hooks.processAssets.tapAsync( - { - name: this.constructor.name, - stage: compiler.webpack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_INLINE, - }, - (_: Compilation['assets'], callback) => { - const entries = {}; - const pages = {}; - // TODO: get assets info by compilation.assetsInfo (not supported yet). - const assets = {}; - const entryNames = Array.from(compilation.entrypoints.keys()); - entryNames.forEach((entryName: string) => { - const entryUnfilteredPointFiles = compilation.entrypoints.get(entryName)?.getFiles(); - const entryPointFiles = entryUnfilteredPointFiles?.filter((chunkFile) => { - const asset = compilation.getAsset(chunkFile); - if (!asset) { - return true; - } - const assetMetaInfo = asset.info; - return !( - assetMetaInfo.hotModuleReplacement || - assetMetaInfo.development - ); - }); - entries[entryName] = entryPointFiles; - }); - const stats = compilation.getStats().toJson({ - all: false, - chunks: true, - }); - stats.chunks.filter(({ entry, initial }) => !entry && !initial).forEach((chunk) => { - const chunkName = chunk.id; - - if (chunkName) { - pages[chunkName.replace(/^p_/, '')] = chunk.files.filter((file: string) => { - return file.endsWith('.js') || file.endsWith('.css'); - }); - } - }); - const manifest = { - publicPath: compilation.outputOptions?.publicPath, - entries, - pages, - assets, - }; - - const dataLoader = resolve(this.outputDir, './data-loader.ts'); - if (existsSync(dataLoader)) { - manifest['dataLoader'] = 'js/data-loader.js'; - } - - const output = JSON.stringify(manifest, null, 2); - // Emit asset manifest for server compile. - compilation.emitAsset(this.fileName, new compiler.webpack.sources.RawSource(output)); - callback(); - }, - ); - }); - } -} diff --git a/packages/shared-config/src/compileExcludes.ts b/packages/shared-config/src/compileExcludes.ts index 37aff4d0da..4916c70187 100644 --- a/packages/shared-config/src/compileExcludes.ts +++ b/packages/shared-config/src/compileExcludes.ts @@ -1,4 +1,4 @@ -const SKIP_COMPILE = [ +export const SKIP_COMPILE = [ // polyfill and helpers 'core-js', 'core-js-pure', '@swc/helpers', '@babel/runtime', 'tslib', // Deprecate version of @babel/runtime. diff --git a/packages/shared-config/src/index.ts b/packages/shared-config/src/index.ts index bd5e13d781..66c0ef1344 100644 --- a/packages/shared-config/src/index.ts +++ b/packages/shared-config/src/index.ts @@ -1,5 +1,5 @@ -import compilationPlugin, { isSupportedFeature } from './unPlugins/compilation.js'; -import compileExcludes from './compileExcludes.js'; +import compilationPlugin, { isSupportedFeature, getJsxTransformOptions } from './unPlugins/compilation.js'; +import compileExcludes, { SKIP_COMPILE as skipCompilePackages } from './compileExcludes.js'; import getCompilerPlugins from './getCompilerPlugins.js'; import getDefineVars from './getDefineVars.js'; import getPostcssOpts from './getPostcssOpts.js'; @@ -10,6 +10,8 @@ export { compilationPlugin, isSupportedFeature, compileExcludes, + skipCompilePackages, + getJsxTransformOptions, getCompilerPlugins, getDefineVars, getPostcssOpts, diff --git a/packages/shared-config/src/unPlugins/compilation.ts b/packages/shared-config/src/unPlugins/compilation.ts index 50496ad70f..f45b2f4f0a 100644 --- a/packages/shared-config/src/unPlugins/compilation.ts +++ b/packages/shared-config/src/unPlugins/compilation.ts @@ -71,14 +71,12 @@ const compilationPlugin = (options: Options): UnpluginOptions => { transformInclude(id) { // Resolved id is not formatted when used in webpack loader test. const formatedId = formatId(id); - return extensionRegex.test(formatedId) && !compileExcludes.some((regex) => regex.test(formatedId)); + const needCompile = extensionRegex.test(formatedId) && !compileExcludes.some((regex) => regex.test(formatedId)); + const skipCompile = /node_modules/.test(id) && !compileRegex.some((regex) => regex.test(id)); + return needCompile && !skipCompile; }, async transform(source: string, fileId: string) { const id = formatId(fileId); - if ((/node_modules/.test(id) && !compileRegex.some((regex) => regex.test(id)))) { - return; - } - const suffix = (['jsx', 'tsx'] as JSXSuffix[]).find(suffix => new RegExp(`\\.${suffix}?$`).test(id)); const programmaticOptions: SwcConfig = { @@ -184,13 +182,13 @@ const compilationPlugin = (options: Options): UnpluginOptions => { interface GetJsxTransformOptions { rootDir: string; mode: Options['mode']; - suffix: JSXSuffix; + suffix?: JSXSuffix; fastRefresh: boolean; polyfill: Config['polyfill']; enableEnv: boolean; } -function getJsxTransformOptions({ +export function getJsxTransformOptions({ suffix, fastRefresh, polyfill, @@ -250,6 +248,7 @@ function getJsxTransformOptions({ parser: { jsx: true, ...syntaxFeatures, + syntax: 'ecmascript', }, }, }, commonOptions); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f6b828e509..47b6da3b46 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1267,6 +1267,9 @@ importers: '@ice/css-modules-hash': specifier: 0.0.6 version: 0.0.6 + '@ice/pack-binding': + specifier: 0.0.2 + version: 0.0.2 '@ice/swc-plugin-keep-export': specifier: 0.2.0 version: 0.2.0 @@ -1276,12 +1279,9 @@ importers: '@ice/swc-plugin-remove-export': specifier: 0.2.0 version: 0.2.0 - '@rspack/binding': - specifier: 0.3.11 - version: 0.3.11 - '@rspack/dev-server': - specifier: 0.3.11 - version: 0.3.11(@rspack/core@0.3.11)(@swc/core@1.3.80)(esbuild@0.17.16)(react-refresh@0.14.0) + '@rspack/plugin-react-refresh': + specifier: 0.4.0 + version: 0.4.0(react-refresh@0.14.0)(webpack-dev-server@4.15.0)(webpack@5.88.2) '@swc/core': specifier: 1.3.80 version: 1.3.80 @@ -1345,6 +1345,9 @@ importers: sass: specifier: 1.50.0 version: 1.50.0 + terminal-link: + specifier: ^2.1.1 + version: 2.1.1 watchpack: specifier: ^2.4.0 version: 2.4.0 @@ -1362,8 +1365,11 @@ importers: specifier: 0.5.10 version: 0.5.10(react-refresh@0.14.0)(webpack-dev-server@4.15.0)(webpack@5.88.2) '@rspack/core': - specifier: 0.3.11 - version: 0.3.11 + specifier: 0.4.0 + version: 0.4.0 + '@rspack/dev-server': + specifier: 0.4.0 + version: 0.4.0(@rspack/core@0.4.0)(@swc/core@1.3.80)(esbuild@0.17.16)(react-refresh@0.14.0) '@types/less': specifier: ^3.0.3 version: 3.0.3 @@ -1389,8 +1395,8 @@ importers: specifier: ^1.7.4 version: 1.7.4 connect-history-api-fallback: - specifier: ^1.6.0 - version: 1.6.0 + specifier: 2.0.0 + version: 2.0.0 copy-webpack-plugin: specifier: 10.2.4 version: 10.2.4(webpack@5.88.2) @@ -1683,11 +1689,11 @@ importers: version: 21.1.1 devDependencies: '@rspack/core': - specifier: 0.3.11 - version: 0.3.11 + specifier: 0.4.0 + version: 0.4.0 '@rspack/dev-server': - specifier: 0.3.11 - version: 0.3.11(@rspack/core@0.3.11)(@types/express@4.17.17)(esbuild@0.17.16)(react-refresh@0.14.0) + specifier: 0.4.0 + version: 0.4.0(@rspack/core@0.4.0)(@types/express@4.17.17)(esbuild@0.17.16)(react-refresh@0.14.0) '@types/babel__generator': specifier: ^7.6.4 version: 7.6.4 @@ -2284,8 +2290,8 @@ importers: version: link:../shared-config devDependencies: '@rspack/core': - specifier: 0.3.11 - version: 0.3.11 + specifier: 0.4.0 + version: 0.4.0 packages/runtime: dependencies: @@ -6641,6 +6647,81 @@ packages: '@ice/css-modules-hash-win32-x64-msvc': 0.0.6 dev: false + /@ice/pack-binding-darwin-arm64@0.0.2: + resolution: {integrity: sha512-OvwDHEqcYr5coVgQGLQxb90MTC6/ySnmQkq03dikAMf8w3o5ooMzqSfRGLL8uAqBBhNNNipYPI97C7b9Pz+eaw==} + engines: {node: '>= 10'} + cpu: [arm64] + os: [darwin] + requiresBuild: true + dev: false + optional: true + + /@ice/pack-binding-darwin-universal@0.0.2: + resolution: {integrity: sha512-TG0e5NT6r2+yzL3eBU20RegLfWHDXjSyPjfQc0HM9sWgAHABQ0q+gE47rTv0ThWL8vC1uh4jlhPamwUCpjvLoQ==} + engines: {node: '>= 10'} + os: [darwin] + requiresBuild: true + dev: false + optional: true + + /@ice/pack-binding-darwin-x64@0.0.2: + resolution: {integrity: sha512-WcNGfHUClA4x0KjZf9ju0hG0/xFHnMUR1neoEyMw0UW1m6jZF76aWKBfQABocZkFV+veIyTZFXs/2GAmGZOJYw==} + engines: {node: '>= 10'} + cpu: [x64] + os: [darwin] + requiresBuild: true + dev: false + optional: true + + /@ice/pack-binding-linux-x64-gnu@0.0.2: + resolution: {integrity: sha512-FQM056bjtP3gyp1ilS7PdrNMhpfwJS1PJvktw0LsrulCrsg+7vkUSvYHY5Jb2IcUAWX0JvTOhvyUeFQ4sN4S6A==} + engines: {node: '>= 10'} + cpu: [x64] + os: [linux] + requiresBuild: true + dev: false + optional: true + + /@ice/pack-binding-linux-x64-musl@0.0.2: + resolution: {integrity: sha512-h2ELqYZbo/Ckpa0YS6U0z+/oFsJ7gVcta4Ib8IWjUdoXQpK4r37DxY7GdDe+VafGoYGwSJijdzbYQRYsobSVhQ==} + engines: {node: '>= 10'} + cpu: [x64] + os: [linux] + requiresBuild: true + dev: false + optional: true + + /@ice/pack-binding-win32-arm64-msvc@0.0.2: + resolution: {integrity: sha512-hgxGL5c2gReksGcPeLkdgtmTBKC8baxb7ZAXN3HQoYyT8TJmTjeG6tJvDAfoJU7k6VrGWD2IQvdjWGSsdHUQzw==} + engines: {node: '>= 10'} + cpu: [arm64] + os: [win32] + requiresBuild: true + dev: false + optional: true + + /@ice/pack-binding-win32-x64-msvc@0.0.2: + resolution: {integrity: sha512-TRacy9q8O2GLS1vA1Mh6ySPvpmzN459sTaOQ21WoGdbq+z6lrAgEKezbdB50hUoNZsw4DBDIPKwzZv2hhJGb6w==} + engines: {node: '>= 10'} + cpu: [x64] + os: [win32] + requiresBuild: true + dev: false + optional: true + + /@ice/pack-binding@0.0.2: + resolution: {integrity: sha512-UkWq7iZG0pH3u4yaU0lVRJjQT8CKfaRyPWSfiD6M8A8klRs3Ksd+yRWqsaIlQ6TxpQ9LvtAGKdAWBEYoJHqm/Q==} + engines: {node: '>= 10'} + optionalDependencies: + '@ice/pack-binding-darwin-arm64': 0.0.2 + '@ice/pack-binding-darwin-universal': 0.0.2 + '@ice/pack-binding-darwin-x64': 0.0.2 + '@ice/pack-binding-linux-x64-gnu': 0.0.2 + '@ice/pack-binding-linux-x64-musl': 0.0.2 + '@ice/pack-binding-win32-arm64-msvc': 0.0.2 + '@ice/pack-binding-win32-x64-msvc': 0.0.2 + dev: false + /@ice/pkg@1.5.5: resolution: {integrity: sha512-0BIfv6Uzs2wpHv7RmFwz+kWfoJLfx0yJrQyh3yqy+F6TZWxTwrqQmX+5yRmgqK5f7lGGhYfMMVNWjRSCw5MHPQ==} engines: {node: '>=16.14.0'} @@ -7541,6 +7622,7 @@ packages: source-map: 0.7.4 webpack: 5.76.0(@swc/core@1.3.80)(esbuild@0.17.16) webpack-dev-server: 4.13.1(webpack@5.76.0) + dev: true /@pmmmwh/react-refresh-webpack-plugin@0.5.10(react-refresh@0.14.0)(webpack-dev-server@4.15.0)(webpack@5.88.2): resolution: {integrity: sha512-j0Ya0hCFZPd4x40qLzbhGsh9TMtdb+CJQiso+WxLOPNasohq9cc5SNUcwsZaRH6++Xh91Xkm/xHCkuIiIu0LUA==} @@ -7580,7 +7662,6 @@ packages: source-map: 0.7.4 webpack: 5.88.2(@swc/core@1.3.80)(esbuild@0.17.16) webpack-dev-server: 4.15.0(webpack@5.88.2) - dev: true /@polka/url@1.0.0-next.21: resolution: {integrity: sha512-a5Sab1C4/icpTZVzZc5Ghpz88yQtGOyNqYXcZgOssB2uuAr+wF/MvN6bgtW32q7HHrvBki+BsZ0OuNv6EV3K9g==} @@ -7875,86 +7956,97 @@ packages: estree-walker: 2.0.2 picomatch: 2.3.1 - /@rspack/binding-darwin-arm64@0.3.11: - resolution: {integrity: sha512-rTDHDvhGEk/6B+42ptlvMn8EkYi3mR0A0+safWeO87Ca0j73Zs0lN0wNGkpQmWjX4xul8flBw1VcRfFvCAfKmg==} + /@rspack/binding-darwin-arm64@0.4.0: + resolution: {integrity: sha512-iQ6ERHXzY58zgHIZZAC7L7hrosO7BZXH3RpOTTibiZdTVex4Bq10CVmy6q6m88iQuqAQS2BHOXzAYLJtZlZRRw==} cpu: [arm64] os: [darwin] requiresBuild: true + dev: true optional: true - /@rspack/binding-darwin-x64@0.3.11: - resolution: {integrity: sha512-bKFvkVE5emmnvbjy7Te7gzo5yv6hWGzDp2j2uWWo6uK+fZ49UMcQW0JmpMs6TNkCEGXO6V1DKnCdDn0aQrQajA==} + /@rspack/binding-darwin-x64@0.4.0: + resolution: {integrity: sha512-LRCiMPCbAIwwo0euqao7+8peUXj+qPDSi0nSK2y6wjaXfUVi8FwpWQ+O+B3RH3rpyFBU63IqatC8razalt8JgQ==} cpu: [x64] os: [darwin] requiresBuild: true + dev: true optional: true - /@rspack/binding-linux-arm64-gnu@0.3.11: - resolution: {integrity: sha512-3Mo2YoCbAm1aDCuPMP/wZoYivHQ1V2U/LeD1Hn5DDSGxQhSFUSx+SADiVIycG9MgaUlYEfDT/14NCsv23DawNw==} + /@rspack/binding-linux-arm64-gnu@0.4.0: + resolution: {integrity: sha512-trfEUQ7awu6dLWUlIXmSJmwW48lSxEl7kW4FUas/UMNH3/B/wim8TPx6ZuDrCzVhYk5HP7ccjbQg7mnbJ+E48w==} cpu: [arm64] os: [linux] requiresBuild: true + dev: true optional: true - /@rspack/binding-linux-arm64-musl@0.3.11: - resolution: {integrity: sha512-lAZCBD6mZJwQ9BgTmreLHq2aPnu8rKxBIA+g+NVe48k+Z8YqwIj3lxSv6r6EDdH9Zq5TCgdfei99QK4tCwlc6g==} + /@rspack/binding-linux-arm64-musl@0.4.0: + resolution: {integrity: sha512-ubIcXmRopSJ6n+F/cRXDfGSgK847OX0CPeSSL4tiJ4dah5lz8iISZ9GLrNHJQ+SvphOH8F9lDpp8h2iwVt0Pbw==} cpu: [arm64] os: [linux] requiresBuild: true + dev: true optional: true - /@rspack/binding-linux-x64-gnu@0.3.11: - resolution: {integrity: sha512-9LuB64CaFt+G4a245HLdOvg8C4Ei1zIjeU0eghrd0svWQewQnOeoC+vXI0pSTGpNlcXiieKzJi502A/cwIJFIA==} + /@rspack/binding-linux-x64-gnu@0.4.0: + resolution: {integrity: sha512-Q3mqjgV2k68F8VuzZwaqhHggBhcSlD0N+vvtFP8BxXIX4Pdkmk2shwwVjniZmY+oKB16dbSmXxShdMlCE3CCng==} cpu: [x64] os: [linux] requiresBuild: true + dev: true optional: true - /@rspack/binding-linux-x64-musl@0.3.11: - resolution: {integrity: sha512-zaZVY3o02M6UMmCPozEFNJ9vurkMPdtdxaSutnVS5s8fVAioSVrojaKGy2A2mtnWkNlUmhkiUaafFrHsTjV9gw==} + /@rspack/binding-linux-x64-musl@0.4.0: + resolution: {integrity: sha512-5l6Q00yZDIeT8T1ruxEfF1Wj3m3SqnSHrPFiUqYydmgmNll1iCCRC2AmGVsmAACDQ7rg9z8BhhHtKukNBvmwTQ==} cpu: [x64] os: [linux] requiresBuild: true + dev: true optional: true - /@rspack/binding-win32-arm64-msvc@0.3.11: - resolution: {integrity: sha512-Hee6+g8q/o+sXs42lE5skzwGrjMoWbugu9Vjzoqi4cEnzVLaiJ3tVO7z5Ov8gdhvyb31r8yFJL7tJW8qkIcTjQ==} + /@rspack/binding-win32-arm64-msvc@0.4.0: + resolution: {integrity: sha512-k96/PSkVT/VEvqHygenzgr8Z7n4SuCSKONVFB5zazWDPaJwCqaqANQuvX0PbuazVy6PbiLE/YI0+4TDjL7dHCw==} cpu: [arm64] os: [win32] requiresBuild: true + dev: true optional: true - /@rspack/binding-win32-ia32-msvc@0.3.11: - resolution: {integrity: sha512-les3RZWROP/rvM43hKydxsBIJbKB4XmhJcB9+0ihJTOlu7saX+3twkW2dd/5NFlcbahdw0SHDq1Nz6DFWnC3Eg==} + /@rspack/binding-win32-ia32-msvc@0.4.0: + resolution: {integrity: sha512-DmC7MumePZuss1AigT4FaIbFPZFtZXdcWBhD7dF88CvsvQRVtOcMujtByWkkNJ6ZDp+IUHyXOtPQWr1iRjDOCQ==} cpu: [ia32] os: [win32] requiresBuild: true + dev: true optional: true - /@rspack/binding-win32-x64-msvc@0.3.11: - resolution: {integrity: sha512-+KK96D9/lSq/d28gf+Fuki4/AF7TKoiMP8CcfXoUoQaNyThb7Kr43je16NNfCIbAQHPCEbdeevIkn7+yuSyIdw==} + /@rspack/binding-win32-x64-msvc@0.4.0: + resolution: {integrity: sha512-F3pAxz1GakFkyq8S+iPTqVkvIFnHG9te36wLW+tIzY4oC0vNPsEVunBp6NrYHzTaOf3aBZ+bvsLZyfvg+pKxqA==} cpu: [x64] os: [win32] requiresBuild: true + dev: true optional: true - /@rspack/binding@0.3.11: - resolution: {integrity: sha512-0l46yjP7WCWkUngSKbyR2hYqH/AQ3ya0jT4rMPmQose9uKFZCqAd/otLDqKI4akRn6gDrESkBQXzfcvhyP9bhA==} + /@rspack/binding@0.4.0: + resolution: {integrity: sha512-SpjaySPGmyRnRHrQItl9W9NGE2WoHsUPnererZaLK+pfVgO92q9uoEoKl3EBNNI9uttG132SCz4cx1zXwN394w==} optionalDependencies: - '@rspack/binding-darwin-arm64': 0.3.11 - '@rspack/binding-darwin-x64': 0.3.11 - '@rspack/binding-linux-arm64-gnu': 0.3.11 - '@rspack/binding-linux-arm64-musl': 0.3.11 - '@rspack/binding-linux-x64-gnu': 0.3.11 - '@rspack/binding-linux-x64-musl': 0.3.11 - '@rspack/binding-win32-arm64-msvc': 0.3.11 - '@rspack/binding-win32-ia32-msvc': 0.3.11 - '@rspack/binding-win32-x64-msvc': 0.3.11 - - /@rspack/core@0.3.11: - resolution: {integrity: sha512-aEjCshlm1dXD5Wls2ksROEjpl5yVWVbd0BwkoRpDz27qr2bmAecnCwROjEWKZFoEZ10VHDrvSc8n/Q3mH3Erhg==} - dependencies: - '@rspack/binding': 0.3.11 + '@rspack/binding-darwin-arm64': 0.4.0 + '@rspack/binding-darwin-x64': 0.4.0 + '@rspack/binding-linux-arm64-gnu': 0.4.0 + '@rspack/binding-linux-arm64-musl': 0.4.0 + '@rspack/binding-linux-x64-gnu': 0.4.0 + '@rspack/binding-linux-x64-musl': 0.4.0 + '@rspack/binding-win32-arm64-msvc': 0.4.0 + '@rspack/binding-win32-ia32-msvc': 0.4.0 + '@rspack/binding-win32-x64-msvc': 0.4.0 + dev: true + + /@rspack/core@0.4.0: + resolution: {integrity: sha512-GY8lsCGRzj1mj5q1Ss5kjazpSisT/HJdXpIU730pG4Os6mE2sGYVUJ0ncYRv/DEBcL1c2dVr5vtMKTHlNYRlfg==} + engines: {node: '>=16.0.0'} + dependencies: + '@rspack/binding': 0.4.0 '@swc/helpers': 0.5.1 browserslist: 4.21.5 compare-versions: 6.0.0-rc.1 @@ -7964,21 +8056,21 @@ packages: json-parse-even-better-errors: 3.0.0 neo-async: 2.6.2 react-refresh: 0.14.0 - schema-utils: 4.0.0 tapable: 2.2.1 terminal-link: 2.1.1 watchpack: 2.4.0 webpack-sources: 3.2.3 zod: 3.21.4 zod-validation-error: 1.2.0(zod@3.21.4) + dev: true - /@rspack/dev-server@0.3.11(@rspack/core@0.3.11)(@swc/core@1.3.80)(esbuild@0.17.16)(react-refresh@0.14.0): - resolution: {integrity: sha512-ZJSMf/ZZt3+9oBUa25c2fABU5s0zFAzG8g8SUYXrxTX96PzAZwjr/s/piA1NgegzpFN14ydYvL+aEjg48cC2yA==} + /@rspack/dev-server@0.4.0(@rspack/core@0.4.0)(@swc/core@1.3.80)(esbuild@0.17.16)(react-refresh@0.14.0): + resolution: {integrity: sha512-qi70BKcGspjlNpufF+AOf5MHbEGnumMtVTtWzdw8I4xDWr2AguesrOEgACHMJx/EZks9vtbSqepf4anYglvsng==} peerDependencies: '@rspack/core': '*' dependencies: - '@rspack/core': 0.3.11 - '@rspack/plugin-react-refresh': 0.3.11(react-refresh@0.14.0)(webpack-dev-server@4.13.1)(webpack@5.76.0) + '@rspack/core': 0.4.0 + '@rspack/plugin-react-refresh': 0.4.0(react-refresh@0.14.0)(webpack-dev-server@4.13.1)(webpack@5.76.0) chokidar: 3.5.3 connect-history-api-fallback: 2.0.0 express: 4.18.1 @@ -8004,15 +8096,15 @@ packages: - webpack-cli - webpack-hot-middleware - webpack-plugin-serve - dev: false + dev: true - /@rspack/dev-server@0.3.11(@rspack/core@0.3.11)(@types/express@4.17.17)(esbuild@0.17.16)(react-refresh@0.14.0): - resolution: {integrity: sha512-ZJSMf/ZZt3+9oBUa25c2fABU5s0zFAzG8g8SUYXrxTX96PzAZwjr/s/piA1NgegzpFN14ydYvL+aEjg48cC2yA==} + /@rspack/dev-server@0.4.0(@rspack/core@0.4.0)(@types/express@4.17.17)(esbuild@0.17.16)(react-refresh@0.14.0): + resolution: {integrity: sha512-qi70BKcGspjlNpufF+AOf5MHbEGnumMtVTtWzdw8I4xDWr2AguesrOEgACHMJx/EZks9vtbSqepf4anYglvsng==} peerDependencies: '@rspack/core': '*' dependencies: - '@rspack/core': 0.3.11 - '@rspack/plugin-react-refresh': 0.3.11(react-refresh@0.14.0)(webpack-dev-server@4.13.1)(webpack@5.76.0) + '@rspack/core': 0.4.0 + '@rspack/plugin-react-refresh': 0.4.0(react-refresh@0.14.0)(webpack-dev-server@4.13.1)(webpack@5.76.0) chokidar: 3.5.3 connect-history-api-fallback: 2.0.0 express: 4.18.1 @@ -8040,8 +8132,8 @@ packages: - webpack-plugin-serve dev: true - /@rspack/plugin-react-refresh@0.3.11(react-refresh@0.14.0)(webpack-dev-server@4.13.1)(webpack@5.76.0): - resolution: {integrity: sha512-S5LjsV4HeZ5sCV4168QXCiuZL1dnwiLtpykB+1RAIQH+rBLDZebiflwgWHKD0B8oxYYiqGeVbQ5JvGWn4jyZVg==} + /@rspack/plugin-react-refresh@0.4.0(react-refresh@0.14.0)(webpack-dev-server@4.13.1)(webpack@5.76.0): + resolution: {integrity: sha512-yo2FXVj6P2HrBGIxBqqRJQzAdG6CrL0WFE+kQk/Uz+7Ct09nPvl7zRdHE1BUXHnSXIjrMJj4fRmd7hXsmtTHXQ==} peerDependencies: react-refresh: '>=0.10.0 <1.0.0' peerDependenciesMeta: @@ -8050,7 +8142,6 @@ packages: dependencies: '@pmmmwh/react-refresh-webpack-plugin': 0.5.10(react-refresh@0.14.0)(webpack-dev-server@4.13.1)(webpack@5.76.0) react-refresh: 0.14.0 - schema-utils: 4.0.0 transitivePeerDependencies: - '@types/webpack' - sockjs-client @@ -8059,6 +8150,27 @@ packages: - webpack-dev-server - webpack-hot-middleware - webpack-plugin-serve + dev: true + + /@rspack/plugin-react-refresh@0.4.0(react-refresh@0.14.0)(webpack-dev-server@4.15.0)(webpack@5.88.2): + resolution: {integrity: sha512-yo2FXVj6P2HrBGIxBqqRJQzAdG6CrL0WFE+kQk/Uz+7Ct09nPvl7zRdHE1BUXHnSXIjrMJj4fRmd7hXsmtTHXQ==} + peerDependencies: + react-refresh: '>=0.10.0 <1.0.0' + peerDependenciesMeta: + react-refresh: + optional: true + dependencies: + '@pmmmwh/react-refresh-webpack-plugin': 0.5.10(react-refresh@0.14.0)(webpack-dev-server@4.15.0)(webpack@5.88.2) + react-refresh: 0.14.0 + transitivePeerDependencies: + - '@types/webpack' + - sockjs-client + - type-fest + - webpack + - webpack-dev-server + - webpack-hot-middleware + - webpack-plugin-serve + dev: false /@sideway/address@4.1.4: resolution: {integrity: sha512-7vwq+rOHVWjyXxVlR76Agnvhy8I9rpzjosTESvmhNeXOXdZZB15Fl+TI9x1SiHZH5Jv2wTGduSxFDIaq0m3DUw==} @@ -8779,6 +8891,7 @@ packages: /@types/estree@0.0.51: resolution: {integrity: sha512-CuPgU6f3eT/XgKKPqKd/gLZV1Xmvf1a2R5POBOGQa6uv82xpls89HU5zKeVoyR8XzHd1RGNOlQlvUe3CFkjWNQ==} + dev: true /@types/estree@1.0.0: resolution: {integrity: sha512-WulqXMDUTYAXCjZnk6JtIHPigp55cVtDgDrO2gHRwhyJto21+1zbVCtOYB2L1F9w4qCQ0rOGWBnBe0FNTiEJIQ==} @@ -9652,6 +9765,7 @@ packages: dependencies: '@webassemblyjs/helper-numbers': 1.11.1 '@webassemblyjs/helper-wasm-bytecode': 1.11.1 + dev: true /@webassemblyjs/ast@1.11.5: resolution: {integrity: sha512-LHY/GSAZZRpsNQH+/oHqhRQ5FT7eoULcBqgfyTB5nQHogFnK3/7QoN7dLnwSE/JkUAF0SrRuclT7ODqMFtWxxQ==} @@ -9661,18 +9775,21 @@ packages: /@webassemblyjs/floating-point-hex-parser@1.11.1: resolution: {integrity: sha512-iGRfyc5Bq+NnNuX8b5hwBrRjzf0ocrJPI6GWFodBFzmFnyvrQ83SHKhmilCU/8Jv67i4GJZBMhEzltxzcNagtQ==} + dev: true /@webassemblyjs/floating-point-hex-parser@1.11.5: resolution: {integrity: sha512-1j1zTIC5EZOtCplMBG/IEwLtUojtwFVwdyVMbL/hwWqbzlQoJsWCOavrdnLkemwNoC/EOwtUFch3fuo+cbcXYQ==} /@webassemblyjs/helper-api-error@1.11.1: resolution: {integrity: sha512-RlhS8CBCXfRUR/cwo2ho9bkheSXG0+NwooXcc3PAILALf2QLdFyj7KGsKRbVc95hZnhnERon4kW/D3SZpp6Tcg==} + dev: true /@webassemblyjs/helper-api-error@1.11.5: resolution: {integrity: sha512-L65bDPmfpY0+yFrsgz8b6LhXmbbs38OnwDCf6NpnMUYqa+ENfE5Dq9E42ny0qz/PdR0LJyq/T5YijPnU8AXEpA==} /@webassemblyjs/helper-buffer@1.11.1: resolution: {integrity: sha512-gwikF65aDNeeXa8JxXa2BAk+REjSyhrNC9ZwdT0f8jc4dQQeDQ7G4m0f2QCLPJiMTTO6wfDmRmj/pW0PsUvIcA==} + dev: true /@webassemblyjs/helper-buffer@1.11.5: resolution: {integrity: sha512-fDKo1gstwFFSfacIeH5KfwzjykIE6ldh1iH9Y/8YkAZrhmu4TctqYjSh7t0K2VyDSXOZJ1MLhht/k9IvYGcIxg==} @@ -9683,6 +9800,7 @@ packages: '@webassemblyjs/floating-point-hex-parser': 1.11.1 '@webassemblyjs/helper-api-error': 1.11.1 '@xtuc/long': 4.2.2 + dev: true /@webassemblyjs/helper-numbers@1.11.5: resolution: {integrity: sha512-DhykHXM0ZABqfIGYNv93A5KKDw/+ywBFnuWybZZWcuzWHfbp21wUfRkbtz7dMGwGgT4iXjWuhRMA2Mzod6W4WA==} @@ -9693,6 +9811,7 @@ packages: /@webassemblyjs/helper-wasm-bytecode@1.11.1: resolution: {integrity: sha512-PvpoOGiJwXeTrSf/qfudJhwlvDQxFgelbMqtq52WWiXC6Xgg1IREdngmPN3bs4RoO83PnL/nFrxucXj1+BX62Q==} + dev: true /@webassemblyjs/helper-wasm-bytecode@1.11.5: resolution: {integrity: sha512-oC4Qa0bNcqnjAowFn7MPCETQgDYytpsfvz4ujZz63Zu/a/v71HeCAAmZsgZ3YVKec3zSPYytG3/PrRCqbtcAvA==} @@ -9704,6 +9823,7 @@ packages: '@webassemblyjs/helper-buffer': 1.11.1 '@webassemblyjs/helper-wasm-bytecode': 1.11.1 '@webassemblyjs/wasm-gen': 1.11.1 + dev: true /@webassemblyjs/helper-wasm-section@1.11.5: resolution: {integrity: sha512-uEoThA1LN2NA+K3B9wDo3yKlBfVtC6rh0i4/6hvbz071E8gTNZD/pT0MsBf7MeD6KbApMSkaAK0XeKyOZC7CIA==} @@ -9717,6 +9837,7 @@ packages: resolution: {integrity: sha512-hJ87QIPtAMKbFq6CGTkZYJivEwZDbQUgYd3qKSadTNOhVY7p+gfP6Sr0lLRVTaG1JjFj+r3YchoqRYxNH3M0GQ==} dependencies: '@xtuc/ieee754': 1.2.0 + dev: true /@webassemblyjs/ieee754@1.11.5: resolution: {integrity: sha512-37aGq6qVL8A8oPbPrSGMBcp38YZFXcHfiROflJn9jxSdSMMM5dS5P/9e2/TpaJuhE+wFrbukN2WI6Hw9MH5acg==} @@ -9727,6 +9848,7 @@ packages: resolution: {integrity: sha512-BJ2P0hNZ0u+Th1YZXJpzW6miwqQUGcIHT1G/sf72gLVD9DZ5AdYTqPNbHZh6K1M5VmKvFXwGSWZADz+qBWxeRw==} dependencies: '@xtuc/long': 4.2.2 + dev: true /@webassemblyjs/leb128@1.11.5: resolution: {integrity: sha512-ajqrRSXaTJoPW+xmkfYN6l8VIeNnR4vBOTQO9HzR7IygoCcKWkICbKFbVTNMjMgMREqXEr0+2M6zukzM47ZUfQ==} @@ -9735,6 +9857,7 @@ packages: /@webassemblyjs/utf8@1.11.1: resolution: {integrity: sha512-9kqcxAEdMhiwQkHpkNiorZzqpGrodQQ2IGrHHxCy+Ozng0ofyMA0lTqiLkVs1uzTRejX+/O0EOT7KxqVPuXosQ==} + dev: true /@webassemblyjs/utf8@1.11.5: resolution: {integrity: sha512-WiOhulHKTZU5UPlRl53gHR8OxdGsSOxqfpqWeA2FmcwBMaoEdz6b2x2si3IwC9/fSPLfe8pBMRTHVMk5nlwnFQ==} @@ -9750,6 +9873,7 @@ packages: '@webassemblyjs/wasm-opt': 1.11.1 '@webassemblyjs/wasm-parser': 1.11.1 '@webassemblyjs/wast-printer': 1.11.1 + dev: true /@webassemblyjs/wasm-edit@1.11.5: resolution: {integrity: sha512-C0p9D2fAu3Twwqvygvf42iGCQ4av8MFBLiTb+08SZ4cEdwzWx9QeAHDo1E2k+9s/0w1DM40oflJOpkZ8jW4HCQ==} @@ -9771,6 +9895,7 @@ packages: '@webassemblyjs/ieee754': 1.11.1 '@webassemblyjs/leb128': 1.11.1 '@webassemblyjs/utf8': 1.11.1 + dev: true /@webassemblyjs/wasm-gen@1.11.5: resolution: {integrity: sha512-14vteRlRjxLK9eSyYFvw1K8Vv+iPdZU0Aebk3j6oB8TQiQYuO6hj9s4d7qf6f2HJr2khzvNldAFG13CgdkAIfA==} @@ -9788,6 +9913,7 @@ packages: '@webassemblyjs/helper-buffer': 1.11.1 '@webassemblyjs/wasm-gen': 1.11.1 '@webassemblyjs/wasm-parser': 1.11.1 + dev: true /@webassemblyjs/wasm-opt@1.11.5: resolution: {integrity: sha512-tcKwlIXstBQgbKy1MlbDMlXaxpucn42eb17H29rawYLxm5+MsEmgPzeCP8B1Cl69hCice8LeKgZpRUAPtqYPgw==} @@ -9806,6 +9932,7 @@ packages: '@webassemblyjs/ieee754': 1.11.1 '@webassemblyjs/leb128': 1.11.1 '@webassemblyjs/utf8': 1.11.1 + dev: true /@webassemblyjs/wasm-parser@1.11.5: resolution: {integrity: sha512-SVXUIwsLQlc8srSD7jejsfTU83g7pIGr2YYNb9oHdtldSxaOhvA5xwvIiWIfcX8PlSakgqMXsLpLfbbJ4cBYew==} @@ -9822,6 +9949,7 @@ packages: dependencies: '@webassemblyjs/ast': 1.11.1 '@xtuc/long': 4.2.2 + dev: true /@webassemblyjs/wast-printer@1.11.5: resolution: {integrity: sha512-f7Pq3wvg3GSPUPzR0F6bmI89Hdb+u9WXrSKc4v+N0aV0q6r42WoF92Jp2jEorBEBRoRNXgjp53nBniDXcqZYPA==} @@ -10810,6 +10938,7 @@ packages: unpipe: 1.0.0 transitivePeerDependencies: - supports-color + dev: true /body-parser@1.20.1: resolution: {integrity: sha512-jWi7abTbYwajOytWCQc37VulmWiRae5RyTpaCyDcS5/lMdtwSz5lOpDE67srw/HYe35f1z3fDQw+3txg7gNtWw==} @@ -11560,11 +11689,6 @@ packages: write-file-atomic: 3.0.3 xdg-basedir: 4.0.0 - /connect-history-api-fallback@1.6.0: - resolution: {integrity: sha512-e54B99q/OUoH64zYYRf3HBP5z24G38h5D3qXu23JGRoigpX5Ss4r9ZnDk3g0Z8uQC2x2lPaJ+UlWBc1ZWBWdLg==} - engines: {node: '>=0.8'} - dev: true - /connect-history-api-fallback@2.0.0: resolution: {integrity: sha512-U73+6lQFmfiNPrYbXqr6kZ1i1wiRqXnp2nhMsINseWXO8lDau0LGEffJ8kQi4EjLZympVgRdvqjAgiZ1tgzDDA==} engines: {node: '>=0.8'} @@ -12852,6 +12976,7 @@ packages: /es-module-lexer@0.9.3: resolution: {integrity: sha512-1HQ2M2sPtxwnvOvT1ZClHyQDiggdNjURWpY2we6aMKCQiUVxTmVs2UYPLIrD84sS+kMdUwfBSylbJPwNnBrnHQ==} + dev: true /es-module-lexer@1.2.0: resolution: {integrity: sha512-2BMfqBDeVCcOlLaL1ZAfp+D868SczNpKArrTM3dhpd7dK/OVlogzY15qpUngt+LMTq5UC/csb9vVQAgupucSbA==} @@ -13820,6 +13945,7 @@ packages: vary: 1.1.2 transitivePeerDependencies: - supports-color + dev: true /express@4.18.2: resolution: {integrity: sha512-5/PsL6iGPdfQ/lKM1UuielYgv3BUoJfz1aUwU9vHZ+J7gyvwdQXFEBIEIaxeGf0GIcreATNyBExtalisDbuMqQ==} @@ -14868,7 +14994,7 @@ packages: he: 1.2.0 param-case: 3.0.4 relateurl: 0.2.7 - terser: 5.16.5 + terser: 5.14.2 /html-minifier@4.0.0: resolution: {integrity: sha512-aoGxanpFPLg7MkIl/DDFYtb0iWz7jMFGqFhvEDZga6/4QTjneiD8I/NXL1x5aaoCp7FSIT6h/OhykDdPsbtMig==} @@ -19322,6 +19448,7 @@ packages: engines: {node: '>=0.6'} dependencies: side-channel: 1.0.4 + dev: true /qs@6.11.0: resolution: {integrity: sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==} @@ -22377,6 +22504,7 @@ packages: serialize-javascript: 6.0.1 terser: 5.14.2 webpack: 5.76.0(@swc/core@1.3.80)(esbuild@0.17.16) + dev: true /terser-webpack-plugin@5.3.5(@swc/core@1.3.80)(esbuild@0.17.16)(webpack@5.88.2): resolution: {integrity: sha512-AOEDLDxD2zylUGf/wxHxklEkOe2/r+seuyOWujejFrIxHf11brA1/dWQNIgXa1c6/Wkxgu7zvv0JhOWfc2ELEA==} @@ -22449,7 +22577,7 @@ packages: jest-worker: 27.5.1 schema-utils: 3.3.0 serialize-javascript: 6.0.1 - terser: 5.16.5 + terser: 5.14.2 webpack: 5.88.2 /terser-webpack-plugin@5.3.7(@swc/core@1.3.80)(esbuild@0.17.16)(webpack@5.88.2): @@ -23827,6 +23955,7 @@ packages: range-parser: 1.2.1 schema-utils: 4.0.0 webpack: 5.76.0(@swc/core@1.3.80)(esbuild@0.17.16) + dev: true /webpack-dev-middleware@5.3.3(webpack@5.86.0): resolution: {integrity: sha512-hj5CYrY0bZLB+eTO+x/j67Pkrquiy7kWepMHmUMoPsmcUaeEnQJqFzHJOyxgWlq746/wUuA64p9ta34Kyb01pA==} @@ -23870,6 +23999,7 @@ packages: range-parser: 1.2.1 schema-utils: 4.0.0 webpack: 5.76.0(@swc/core@1.3.80)(esbuild@0.17.16) + dev: true /webpack-dev-server@4.13.1(webpack@5.76.0): resolution: {integrity: sha512-5tWg00bnWbYgkN+pd5yISQKDejRBYGEw15RaEEslH+zdbNDxxaZvEAO2WulaSaFKb5n3YG8JXsGaDsut1D0xdA==} @@ -23920,6 +24050,7 @@ packages: - debug - supports-color - utf-8-validate + dev: true /webpack-dev-server@4.15.0(debug@4.3.4)(webpack@5.88.2): resolution: {integrity: sha512-HmNB5QeSl1KpulTBQ8UT4FPrByYyaLxpJoQ0+s7EvUrMc16m0ZS1sgb1XGqzmgCPk0c9y+aaXxn11tbLzuM7NQ==} @@ -24138,6 +24269,7 @@ packages: - '@swc/core' - esbuild - uglify-js + dev: true /webpack@5.76.0(esbuild@0.17.16): resolution: {integrity: sha512-l5sOdYBDunyf72HW8dF23rFtWq/7Zgvt/9ftMof71E/yUb1YLOBmTgA2K4vQthB3kotMrSj609txVE0dnr2fjA==} @@ -24583,6 +24715,7 @@ packages: optional: true utf-8-validate: optional: true + dev: true /xdg-basedir@4.0.0: resolution: {integrity: sha512-PSNhEJDejZYV7h50BohL09Er9VaIefr2LMAf3OEmpCkjOi34eYyQYAXUTjEQtZJTKcF0E2UKTh+osDLsgNim9Q==}