@rspack/core 1.0.0-alpha.2 → 1.0.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ChunkGraph.d.ts +1 -1
- package/dist/Compilation.d.ts +9 -9
- package/dist/Compilation.js +25 -21
- package/dist/Compiler.d.ts +6 -6
- package/dist/Compiler.js +5 -6
- package/dist/ContextModuleFactory.d.ts +1 -1
- package/dist/FileSystem.d.ts +2 -2
- package/dist/Module.d.ts +4 -3
- package/dist/Module.js +1 -0
- package/dist/MultiCompiler.d.ts +3 -3
- package/dist/MultiStats.d.ts +2 -2
- package/dist/MultiWatching.d.ts +2 -2
- package/dist/NormalModule.d.ts +1 -1
- package/dist/NormalModuleFactory.d.ts +1 -1
- package/dist/Resolver.d.ts +19 -0
- package/dist/Resolver.js +39 -0
- package/dist/ResolverFactory.d.ts +9 -47
- package/dist/ResolverFactory.js +49 -120
- package/dist/RspackError.d.ts +1 -1
- package/dist/RuntimeGlobals.d.ts +1 -1
- package/dist/Stats.d.ts +2 -2
- package/dist/Watching.d.ts +3 -3
- package/dist/builtin-loader/swc/index.d.ts +0 -2
- package/dist/builtin-loader/swc/index.js +1 -3
- package/dist/builtin-loader/swc/pluginImport.d.ts +17 -1
- package/dist/builtin-loader/swc/react.d.ts +11 -1
- package/dist/builtin-plugin/APIPlugin.d.ts +3 -3
- package/dist/builtin-plugin/ArrayPushCallbackChunkFormatPlugin.d.ts +3 -3
- package/dist/builtin-plugin/AssetModulesPlugin.d.ts +3 -3
- package/dist/builtin-plugin/AsyncWebAssemblyModulesPlugin.d.ts +3 -3
- package/dist/builtin-plugin/BannerPlugin.d.ts +25 -4
- package/dist/builtin-plugin/BundlerInfoRspackPlugin.d.ts +4 -4
- package/dist/builtin-plugin/ChunkPrefetchPreloadPlugin.d.ts +3 -3
- package/dist/builtin-plugin/CommonJsChunkFormatPlugin.d.ts +3 -3
- package/dist/builtin-plugin/CopyRspackPlugin.d.ts +4 -4
- package/dist/builtin-plugin/CssModulesPlugin.d.ts +3 -3
- package/dist/builtin-plugin/DataUriPlugin.d.ts +3 -3
- package/dist/builtin-plugin/DefinePlugin.d.ts +10 -4
- package/dist/builtin-plugin/DefinePlugin.js +42 -8
- package/dist/builtin-plugin/DeterministicChunkIdsPlugin.d.ts +3 -3
- package/dist/builtin-plugin/DeterministicModuleIdsPlugin.d.ts +3 -3
- package/dist/builtin-plugin/DynamicEntryPlugin.d.ts +5 -5
- package/dist/builtin-plugin/ElectronTargetPlugin.d.ts +3 -3
- package/dist/builtin-plugin/EnableChunkLoadingPlugin.d.ts +3 -3
- package/dist/builtin-plugin/EnableLibraryPlugin.d.ts +2 -2
- package/dist/builtin-plugin/EnableWasmLoadingPlugin.d.ts +3 -3
- package/dist/builtin-plugin/EnsureChunkConditionsPlugin.d.ts +3 -3
- package/dist/builtin-plugin/EntryPlugin.d.ts +5 -5
- package/dist/builtin-plugin/EvalDevToolModulePlugin.d.ts +4 -4
- package/dist/builtin-plugin/EvalSourceMapDevToolPlugin.d.ts +5 -5
- package/dist/builtin-plugin/ExternalsPlugin.d.ts +22 -6
- package/dist/builtin-plugin/FetchCompileAsyncWasmPlugin.d.ts +3 -3
- package/dist/builtin-plugin/FileUriPlugin.d.ts +3 -3
- package/dist/builtin-plugin/FlagDependencyExportsPlugin.d.ts +3 -3
- package/dist/builtin-plugin/FlagDependencyUsagePlugin.d.ts +3 -3
- package/dist/builtin-plugin/HotModuleReplacementPlugin.d.ts +2 -2
- package/dist/builtin-plugin/HtmlRspackPlugin.d.ts +19 -4
- package/dist/builtin-plugin/HttpExternalsRspackPlugin.d.ts +4 -4
- package/dist/builtin-plugin/IgnorePlugin.d.ts +4 -4
- package/dist/builtin-plugin/InferAsyncModulesPlugin.d.ts +3 -3
- package/dist/builtin-plugin/JavascriptModulesPlugin.d.ts +2 -2
- package/dist/builtin-plugin/JsLoaderRspackPlugin.d.ts +4 -4
- package/dist/builtin-plugin/JsonModulesPlugin.d.ts +3 -3
- package/dist/builtin-plugin/LightningCssMiminizerRspackPlugin.d.ts +4 -4
- package/dist/builtin-plugin/LimitChunkCountPlugin.d.ts +4 -4
- package/dist/builtin-plugin/MangleExportsPlugin.d.ts +3 -3
- package/dist/builtin-plugin/MergeDuplicateChunksPlugin.d.ts +3 -3
- package/dist/builtin-plugin/ModuleChunkFormatPlugin.d.ts +3 -3
- package/dist/builtin-plugin/ModuleConcatenationPlugin.d.ts +3 -3
- package/dist/builtin-plugin/NamedChunkIdsPlugin.d.ts +3 -3
- package/dist/builtin-plugin/NamedModuleIdsPlugin.d.ts +3 -3
- package/dist/builtin-plugin/NaturalChunkIdsPlugin.d.ts +3 -3
- package/dist/builtin-plugin/NaturalModuleIdsPlugin.d.ts +3 -3
- package/dist/builtin-plugin/NodeTargetPlugin.d.ts +3 -3
- package/dist/builtin-plugin/ProgressPlugin.d.ts +4 -4
- package/dist/builtin-plugin/ProvidePlugin.d.ts +3 -3
- package/dist/builtin-plugin/RealContentHashPlugin.d.ts +3 -3
- package/dist/builtin-plugin/RemoveEmptyChunksPlugin.d.ts +3 -3
- package/dist/builtin-plugin/RuntimeChunkPlugin.d.ts +4 -4
- package/dist/builtin-plugin/RuntimePlugin.d.ts +3 -3
- package/dist/builtin-plugin/SideEffectsFlagPlugin.d.ts +3 -3
- package/dist/builtin-plugin/SizeLimitsPlugin.d.ts +9 -4
- package/dist/builtin-plugin/SourceMapDevToolPlugin.d.ts +4 -4
- package/dist/builtin-plugin/SplitChunksPlugin.d.ts +3 -3
- package/dist/builtin-plugin/SwcCssMinimizerPlugin.d.ts +3 -3
- package/dist/builtin-plugin/SwcJsMinimizerPlugin.d.ts +4 -4
- package/dist/builtin-plugin/WarnCaseSensitiveModulesPlugin.d.ts +3 -3
- package/dist/builtin-plugin/WebWorkerTemplatePlugin.d.ts +3 -3
- package/dist/builtin-plugin/WorkerPlugin.d.ts +3 -3
- package/dist/builtin-plugin/base.d.ts +6 -6
- package/dist/builtin-plugin/base.js +3 -3
- package/dist/builtin-plugin/css-extract/index.d.ts +1 -1
- package/dist/builtin-plugin/css-extract/loader.js +13 -3
- package/dist/builtin-plugin/css-extract/utils.d.ts +1 -1
- package/dist/builtin-plugin/index.d.ts +1 -7
- package/dist/builtin-plugin/index.js +3 -17
- package/dist/builtin-plugin/lazy-compilation/lazyCompilation.d.ts +11 -17
- package/dist/builtin-plugin/lazy-compilation/plugin.d.ts +2 -2
- package/dist/config/adapter.d.ts +5 -4
- package/dist/config/adapter.js +3 -2
- package/dist/config/adapterRuleUse.d.ts +7 -7
- package/dist/config/defaults.d.ts +1 -1
- package/dist/config/zod.d.ts +382 -382
- package/dist/config/zod.js +2 -3
- package/dist/container/ContainerPlugin.d.ts +3 -3
- package/dist/container/ContainerReferencePlugin.d.ts +4 -4
- package/dist/container/ModuleFederationPlugin.d.ts +2 -2
- package/dist/container/ModuleFederationPluginV1.d.ts +5 -5
- package/dist/container/ModuleFederationRuntimePlugin.d.ts +3 -3
- package/dist/container/default.runtime.js +1 -1
- package/dist/lib/EntryOptionPlugin.d.ts +2 -2
- package/dist/lib/NormalModuleReplacementPlugin.d.ts +2 -2
- package/dist/loader-runner/index.d.ts +2 -2
- package/dist/loader-runner/index.js +33 -46
- package/dist/loader-runner/loadLoader.js +1 -1
- package/dist/node/NodeTemplatePlugin.d.ts +1 -1
- package/dist/node/NodeWatchFileSystem.d.ts +1 -1
- package/dist/rspack.d.ts +3 -3
- package/dist/rspackOptionsApply.d.ts +1 -1
- package/dist/rspackOptionsApply.js +1 -19
- package/dist/sharing/ConsumeSharedPlugin.d.ts +2 -2
- package/dist/sharing/ProvideSharedPlugin.d.ts +2 -2
- package/dist/sharing/SharePlugin.d.ts +1 -1
- package/dist/sharing/ShareRuntimePlugin.d.ts +2 -2
- package/dist/stats/StatsFactory.d.ts +2 -2
- package/dist/stats/statsFactoryUtils.d.ts +1 -1
- package/dist/util/SplitChunkSize.d.ts +1 -1
- package/dist/util/bindingVersionCheck.js +1 -1
- package/dist/util/comparators.d.ts +1 -1
- package/dist/util/fs.d.ts +1 -1
- package/dist/util/index.d.ts +1 -1
- package/dist/util/index.js +4 -2
- package/dist/util/validate.d.ts +1 -1
- package/package.json +5 -35
package/dist/config/zod.js
CHANGED
|
@@ -259,7 +259,6 @@ const baseResolveOptions = zod_1.z.strictObject({
|
|
|
259
259
|
const resolveOptions = baseResolveOptions.extend({
|
|
260
260
|
byDependency: zod_1.z.lazy(() => zod_1.z.record(resolveOptions)).optional()
|
|
261
261
|
});
|
|
262
|
-
const resolve = resolveOptions;
|
|
263
262
|
//#endregion
|
|
264
263
|
//#region Module
|
|
265
264
|
const baseRuleSetCondition = zod_1.z
|
|
@@ -915,8 +914,8 @@ exports.rspackOptions = zod_1.z.strictObject({
|
|
|
915
914
|
stats: statsValue.optional(),
|
|
916
915
|
snapshot: snapshotOptions.optional(),
|
|
917
916
|
optimization: optimization.optional(),
|
|
918
|
-
resolve:
|
|
919
|
-
resolveLoader:
|
|
917
|
+
resolve: resolveOptions.optional(),
|
|
918
|
+
resolveLoader: resolveOptions.optional(),
|
|
920
919
|
plugins: plugins.optional(),
|
|
921
920
|
devServer: devServer.optional(),
|
|
922
921
|
module: moduleOptions.optional(),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { BuiltinPlugin, BuiltinPluginName } from "@rspack/binding";
|
|
2
|
-
import { Compiler } from "../Compiler";
|
|
1
|
+
import { type BuiltinPlugin, BuiltinPluginName } from "@rspack/binding";
|
|
2
|
+
import type { Compiler } from "../Compiler";
|
|
3
3
|
import { RspackBuiltinPlugin } from "../builtin-plugin/base";
|
|
4
|
-
import { EntryRuntime, FilenameTemplate, LibraryOptions } from "../config";
|
|
4
|
+
import { type EntryRuntime, type FilenameTemplate, type LibraryOptions } from "../config";
|
|
5
5
|
export type ContainerPluginOptions = {
|
|
6
6
|
exposes: Exposes;
|
|
7
7
|
filename?: FilenameTemplate;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { BuiltinPlugin, BuiltinPluginName } from "@rspack/binding";
|
|
2
|
-
import { Compiler } from "../Compiler";
|
|
1
|
+
import { type BuiltinPlugin, BuiltinPluginName } from "@rspack/binding";
|
|
2
|
+
import type { Compiler } from "../Compiler";
|
|
3
3
|
import { RspackBuiltinPlugin } from "../builtin-plugin/base";
|
|
4
|
-
import { ExternalsType } from "../config";
|
|
4
|
+
import type { ExternalsType } from "../config";
|
|
5
5
|
export type ContainerReferencePluginOptions = {
|
|
6
6
|
remoteType: ExternalsType;
|
|
7
7
|
remotes: Remotes;
|
|
@@ -21,7 +21,7 @@ export type RemotesConfig = {
|
|
|
21
21
|
export declare class ContainerReferencePlugin extends RspackBuiltinPlugin {
|
|
22
22
|
name: BuiltinPluginName;
|
|
23
23
|
_options: {
|
|
24
|
-
remoteType: "
|
|
24
|
+
remoteType: "promise" | "module" | "commonjs" | "umd" | "amd" | "jsonp" | "import" | "commonjs2" | "var" | "assign" | "this" | "window" | "self" | "global" | "commonjs-module" | "commonjs-static" | "amd-require" | "umd2" | "system" | "script" | "node-commonjs";
|
|
25
25
|
remotes: [string, {
|
|
26
26
|
external: string[];
|
|
27
27
|
shareScope: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Compiler } from "../Compiler";
|
|
2
|
-
import {
|
|
1
|
+
import type { Compiler } from "../Compiler";
|
|
2
|
+
import type { ModuleFederationPluginV1Options } from "./ModuleFederationPluginV1";
|
|
3
3
|
export interface ModuleFederationPluginOptions extends Omit<ModuleFederationPluginV1Options, "enhanced"> {
|
|
4
4
|
runtimePlugins?: RuntimePlugins;
|
|
5
5
|
implementation?: string;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Compiler } from "../Compiler";
|
|
2
|
-
import { EntryRuntime, ExternalsType, LibraryOptions } from "../config";
|
|
3
|
-
import { Shared } from "../sharing/SharePlugin";
|
|
4
|
-
import { Exposes } from "./ContainerPlugin";
|
|
5
|
-
import { Remotes } from "./ContainerReferencePlugin";
|
|
1
|
+
import type { Compiler } from "../Compiler";
|
|
2
|
+
import { type EntryRuntime, type ExternalsType, type LibraryOptions } from "../config";
|
|
3
|
+
import { type Shared } from "../sharing/SharePlugin";
|
|
4
|
+
import { type Exposes } from "./ContainerPlugin";
|
|
5
|
+
import { type Remotes } from "./ContainerReferencePlugin";
|
|
6
6
|
export interface ModuleFederationPluginV1Options {
|
|
7
7
|
exposes?: Exposes;
|
|
8
8
|
filename?: string;
|
|
@@ -2,9 +2,9 @@ import { BuiltinPluginName } from "@rspack/binding";
|
|
|
2
2
|
export declare const ModuleFederationRuntimePlugin: {
|
|
3
3
|
new (): {
|
|
4
4
|
name: BuiltinPluginName;
|
|
5
|
-
|
|
6
|
-
affectedHooks: "
|
|
7
|
-
raw(): import("@rspack/binding").BuiltinPlugin;
|
|
5
|
+
_args: [];
|
|
6
|
+
affectedHooks: "done" | "compilation" | "failed" | "environment" | "emit" | "make" | "compile" | "afterEmit" | "invalid" | "thisCompilation" | "afterDone" | "normalModuleFactory" | "contextModuleFactory" | "initialize" | "shouldEmit" | "infrastructureLog" | "beforeRun" | "run" | "assetEmitted" | "shutdown" | "watchRun" | "watchClose" | "afterEnvironment" | "afterPlugins" | "afterResolvers" | "beforeCompile" | "afterCompile" | "finishMake" | "entryOption" | undefined;
|
|
7
|
+
raw(compiler: import("../Compiler").Compiler): import("@rspack/binding").BuiltinPlugin;
|
|
8
8
|
apply(compiler: import("../Compiler").Compiler): void;
|
|
9
9
|
};
|
|
10
10
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var __module_federation_bundler_runtime__,__module_federation_runtime_plugins__,__module_federation_remote_infos__,__module_federation_container_name__;module.exports=function(){if((__webpack_require__.initializeSharingData||__webpack_require__.initializeExposesData)&&__webpack_require__.federation){const override=(obj,key,value)=>{if(!obj)return;if(obj[key])obj[key]=value};const merge=(obj,key,fn)=>{const value=fn();if(Array.isArray(value)){obj[key]
|
|
1
|
+
var __module_federation_bundler_runtime__,__module_federation_runtime_plugins__,__module_federation_remote_infos__,__module_federation_container_name__;module.exports=function(){if((__webpack_require__.initializeSharingData||__webpack_require__.initializeExposesData)&&__webpack_require__.federation){var __webpack_require___remotesLoadingData,__webpack_require___remotesLoadingData1,__webpack_require___initializeSharingData,__webpack_require___consumesLoadingData,__webpack_require___consumesLoadingData1,__webpack_require___initializeExposesData,__webpack_require___consumesLoadingData2;const override=(obj,key,value)=>{if(!obj)return;if(obj[key])obj[key]=value};const merge=(obj,key,fn)=>{const value=fn();if(Array.isArray(value)){var _obj,_key;var _;(_=(_obj=obj)[_key=key])!==null&&_!==void 0?_:_obj[_key]=[];obj[key].push(...value)}else if(typeof value==="object"&&value!==null){var _obj1,_key1;var _1;(_1=(_obj1=obj)[_key1=key])!==null&&_1!==void 0?_1:_obj1[_key1]={};Object.assign(obj[key],value)}};const early=(obj,key,initial)=>{var _obj,_key;var _;(_=(_obj=obj)[_key=key])!==null&&_!==void 0?_:_obj[_key]=initial()};var __webpack_require___remotesLoadingData_chunkMapping;const remotesLoadingChunkMapping=(__webpack_require___remotesLoadingData_chunkMapping=(__webpack_require___remotesLoadingData=__webpack_require__.remotesLoadingData)===null||__webpack_require___remotesLoadingData===void 0?void 0:__webpack_require___remotesLoadingData.chunkMapping)!==null&&__webpack_require___remotesLoadingData_chunkMapping!==void 0?__webpack_require___remotesLoadingData_chunkMapping:{};var __webpack_require___remotesLoadingData_moduleIdToRemoteDataMapping;const remotesLoadingModuleIdToRemoteDataMapping=(__webpack_require___remotesLoadingData_moduleIdToRemoteDataMapping=(__webpack_require___remotesLoadingData1=__webpack_require__.remotesLoadingData)===null||__webpack_require___remotesLoadingData1===void 0?void 0:__webpack_require___remotesLoadingData1.moduleIdToRemoteDataMapping)!==null&&__webpack_require___remotesLoadingData_moduleIdToRemoteDataMapping!==void 0?__webpack_require___remotesLoadingData_moduleIdToRemoteDataMapping:{};var __webpack_require___initializeSharingData_scopeToSharingDataMapping;const initializeSharingScopeToInitDataMapping=(__webpack_require___initializeSharingData_scopeToSharingDataMapping=(__webpack_require___initializeSharingData=__webpack_require__.initializeSharingData)===null||__webpack_require___initializeSharingData===void 0?void 0:__webpack_require___initializeSharingData.scopeToSharingDataMapping)!==null&&__webpack_require___initializeSharingData_scopeToSharingDataMapping!==void 0?__webpack_require___initializeSharingData_scopeToSharingDataMapping:{};var __webpack_require___consumesLoadingData_chunkMapping;const consumesLoadingChunkMapping=(__webpack_require___consumesLoadingData_chunkMapping=(__webpack_require___consumesLoadingData=__webpack_require__.consumesLoadingData)===null||__webpack_require___consumesLoadingData===void 0?void 0:__webpack_require___consumesLoadingData.chunkMapping)!==null&&__webpack_require___consumesLoadingData_chunkMapping!==void 0?__webpack_require___consumesLoadingData_chunkMapping:{};var __webpack_require___consumesLoadingData_moduleIdToConsumeDataMapping;const consumesLoadingModuleToConsumeDataMapping=(__webpack_require___consumesLoadingData_moduleIdToConsumeDataMapping=(__webpack_require___consumesLoadingData1=__webpack_require__.consumesLoadingData)===null||__webpack_require___consumesLoadingData1===void 0?void 0:__webpack_require___consumesLoadingData1.moduleIdToConsumeDataMapping)!==null&&__webpack_require___consumesLoadingData_moduleIdToConsumeDataMapping!==void 0?__webpack_require___consumesLoadingData_moduleIdToConsumeDataMapping:{};const consumesLoadinginstalledModules={};const initializeSharingInitPromises=[];const initializeSharingInitTokens=[];const containerShareScope=(__webpack_require___initializeExposesData=__webpack_require__.initializeExposesData)===null||__webpack_require___initializeExposesData===void 0?void 0:__webpack_require___initializeExposesData.shareScope;for(const key in __module_federation_bundler_runtime__){__webpack_require__.federation[key]=__module_federation_bundler_runtime__[key]}early(__webpack_require__.federation,"consumesLoadingModuleToHandlerMapping",()=>{const consumesLoadingModuleToHandlerMapping={};for(let[moduleId,data]of Object.entries(consumesLoadingModuleToConsumeDataMapping)){consumesLoadingModuleToHandlerMapping[moduleId]={getter:data.fallback,shareInfo:{shareConfig:{fixedDependencies:false,requiredVersion:data.requiredVersion,strictVersion:data.strictVersion,singleton:data.singleton,eager:data.eager},scope:[data.shareScope]},shareKey:data.shareKey}}return consumesLoadingModuleToHandlerMapping});early(__webpack_require__.federation,"initOptions",()=>({}));early(__webpack_require__.federation.initOptions,"name",()=>__module_federation_container_name__);early(__webpack_require__.federation.initOptions,"shared",()=>{const shared={};for(let[scope,stages]of Object.entries(initializeSharingScopeToInitDataMapping)){for(let stage of stages){if(typeof stage==="object"&&stage!==null){const{name,version,factory,eager}=stage;const options={version,scope:[scope],get:factory};if(shared[name]){shared[name].push(options)}else{shared[name]=[options]}}}}return shared});merge(__webpack_require__.federation.initOptions,"remotes",()=>Object.values(__module_federation_remote_infos__).flat().filter(remote=>remote.externalType==="script"));merge(__webpack_require__.federation.initOptions,"plugins",()=>__module_federation_runtime_plugins__);early(__webpack_require__.federation,"bundlerRuntimeOptions",()=>({}));early(__webpack_require__.federation.bundlerRuntimeOptions,"remotes",()=>({}));early(__webpack_require__.federation.bundlerRuntimeOptions.remotes,"chunkMapping",()=>remotesLoadingChunkMapping);early(__webpack_require__.federation.bundlerRuntimeOptions.remotes,"idToExternalAndNameMapping",()=>{const remotesLoadingIdToExternalAndNameMappingMapping={};for(let[moduleId,data]of Object.entries(remotesLoadingModuleIdToRemoteDataMapping)){remotesLoadingIdToExternalAndNameMappingMapping[moduleId]=[data.shareScope,data.name,data.externalModuleId,data.remoteName]}return remotesLoadingIdToExternalAndNameMappingMapping});early(__webpack_require__.federation.bundlerRuntimeOptions.remotes,"webpackRequire",()=>__webpack_require__);merge(__webpack_require__.federation.bundlerRuntimeOptions.remotes,"idToRemoteMap",()=>{const idToRemoteMap={};for(let[id,remoteData]of Object.entries(remotesLoadingModuleIdToRemoteDataMapping)){const info=__module_federation_remote_infos__[remoteData.remoteName];if(info)idToRemoteMap[id]=info}return idToRemoteMap});override(__webpack_require__,"S",__webpack_require__.federation.bundlerRuntime.S);if(__webpack_require__.federation.attachShareScopeMap){__webpack_require__.federation.attachShareScopeMap(__webpack_require__)}override(__webpack_require__.f,"remotes",(chunkId,promises)=>__webpack_require__.federation.bundlerRuntime.remotes({chunkId,promises,chunkMapping:remotesLoadingChunkMapping,idToExternalAndNameMapping:__webpack_require__.federation.bundlerRuntimeOptions.remotes.idToExternalAndNameMapping,idToRemoteMap:__webpack_require__.federation.bundlerRuntimeOptions.remotes.idToRemoteMap,webpackRequire:__webpack_require__}));override(__webpack_require__.f,"consumes",(chunkId,promises)=>__webpack_require__.federation.bundlerRuntime.consumes({chunkId,promises,chunkMapping:consumesLoadingChunkMapping,moduleToHandlerMapping:__webpack_require__.federation.consumesLoadingModuleToHandlerMapping,installedModules:consumesLoadinginstalledModules,webpackRequire:__webpack_require__}));override(__webpack_require__,"I",(name,initScope)=>__webpack_require__.federation.bundlerRuntime.I({shareScopeName:name,initScope,initPromises:initializeSharingInitPromises,initTokens:initializeSharingInitTokens,webpackRequire:__webpack_require__}));override(__webpack_require__,"initContainer",(shareScope,initScope,remoteEntryInitOptions)=>__webpack_require__.federation.bundlerRuntime.initContainerEntry({shareScope,initScope,remoteEntryInitOptions,shareScopeKey:containerShareScope,webpackRequire:__webpack_require__}));override(__webpack_require__,"getContainer",(module1,getScope)=>{var moduleMap=__webpack_require__.initializeExposesData.moduleMap;__webpack_require__.R=getScope;getScope=Object.prototype.hasOwnProperty.call(moduleMap,module1)?moduleMap[module1]():Promise.resolve().then(()=>{throw new Error('Module "'+module1+'" does not exist in container.')});__webpack_require__.R=undefined;return getScope});__webpack_require__.federation.instance=__webpack_require__.federation.runtime.init(__webpack_require__.federation.initOptions);if((__webpack_require___consumesLoadingData2=__webpack_require__.consumesLoadingData)===null||__webpack_require___consumesLoadingData2===void 0?void 0:__webpack_require___consumesLoadingData2.initialConsumes){__webpack_require__.federation.bundlerRuntime.installInitialConsumes({webpackRequire:__webpack_require__,installedModules:consumesLoadinginstalledModules,initialConsumes:__webpack_require__.consumesLoadingData.initialConsumes,moduleToHandlerMapping:__webpack_require__.federation.consumesLoadingModuleToHandlerMapping})}}};
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
* Copyright (c) JS Foundation and other contributors
|
|
8
8
|
* https://github.com/webpack/webpack/blob/main/LICENSE
|
|
9
9
|
*/
|
|
10
|
-
import { Compiler, EntryDescriptionNormalized, EntryNormalized } from "..";
|
|
11
|
-
import { EntryOptions } from "../builtin-plugin";
|
|
10
|
+
import type { Compiler, EntryDescriptionNormalized, EntryNormalized } from "..";
|
|
11
|
+
import { type EntryOptions } from "../builtin-plugin";
|
|
12
12
|
export default class EntryOptionPlugin {
|
|
13
13
|
apply(compiler: Compiler): void;
|
|
14
14
|
static applyEntryOption(compiler: Compiler, context: string, entry: EntryNormalized): void;
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* Licensed with [MIT License]{@link http://www.opensource.org/licenses/mit-license.php}
|
|
4
4
|
* Original Author Tobias Koppers @sokra
|
|
5
5
|
*/
|
|
6
|
-
import { Compiler } from "../Compiler";
|
|
7
|
-
import { ResolveData } from "../Module";
|
|
6
|
+
import type { Compiler } from "../Compiler";
|
|
7
|
+
import type { ResolveData } from "../Module";
|
|
8
8
|
type ModuleReplacer = (createData: ResolveData) => void;
|
|
9
9
|
export declare class NormalModuleReplacementPlugin {
|
|
10
10
|
readonly resourceRegExp: RegExp;
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
* Copyright (c) JS Foundation and other contributors
|
|
8
8
|
* https://github.com/webpack/loader-runner/blob/main/LICENSE
|
|
9
9
|
*/
|
|
10
|
-
import { JsLoaderContext, JsLoaderItem } from "@rspack/binding";
|
|
11
|
-
import { Compiler } from "../Compiler";
|
|
10
|
+
import { type JsLoaderContext, type JsLoaderItem } from "@rspack/binding";
|
|
11
|
+
import type { Compiler } from "../Compiler";
|
|
12
12
|
export declare class LoaderObject {
|
|
13
13
|
#private;
|
|
14
14
|
request: string;
|
|
@@ -55,12 +55,10 @@ function createLoaderObject(loader, compiler) {
|
|
|
55
55
|
};
|
|
56
56
|
Object.defineProperty(obj, "request", {
|
|
57
57
|
enumerable: true,
|
|
58
|
-
get:
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
},
|
|
63
|
-
set: function (value) {
|
|
58
|
+
get: () => obj.path.replace(/#/g, "\u200b#") +
|
|
59
|
+
obj.query.replace(/#/g, "\u200b#") +
|
|
60
|
+
obj.fragment,
|
|
61
|
+
set: value => {
|
|
64
62
|
var splittedRequest = (0, identifier_1.parseResourceWithoutFragment)(value.request);
|
|
65
63
|
obj.path = splittedRequest.path;
|
|
66
64
|
obj.query = splittedRequest.query;
|
|
@@ -191,7 +189,7 @@ const runSyncOrAsync = (0, util_1.promisify)(function runSyncOrAsync(fn, context
|
|
|
191
189
|
isSync = false;
|
|
192
190
|
return innerCallback;
|
|
193
191
|
};
|
|
194
|
-
const innerCallback = (context.callback =
|
|
192
|
+
const innerCallback = (context.callback = (err, ...args) => {
|
|
195
193
|
if (isDone) {
|
|
196
194
|
if (reportedError)
|
|
197
195
|
return; // ignore
|
|
@@ -222,7 +220,7 @@ const runSyncOrAsync = (0, util_1.promisify)(function runSyncOrAsync(fn, context
|
|
|
222
220
|
if (result &&
|
|
223
221
|
typeof result === "object" &&
|
|
224
222
|
typeof result.then === "function") {
|
|
225
|
-
result.then(
|
|
223
|
+
result.then((r) => {
|
|
226
224
|
callback(null, [r]);
|
|
227
225
|
}, callback);
|
|
228
226
|
return;
|
|
@@ -232,6 +230,11 @@ const runSyncOrAsync = (0, util_1.promisify)(function runSyncOrAsync(fn, context
|
|
|
232
230
|
}
|
|
233
231
|
}
|
|
234
232
|
catch (e) {
|
|
233
|
+
// use string for napi getter
|
|
234
|
+
let err = e;
|
|
235
|
+
if ("hideStack" in err && err.hideStack) {
|
|
236
|
+
err.hideStack = "true";
|
|
237
|
+
}
|
|
235
238
|
if (isError)
|
|
236
239
|
throw e;
|
|
237
240
|
if (isDone) {
|
|
@@ -388,14 +391,14 @@ async function runLoaders(compiler, context) {
|
|
|
388
391
|
};
|
|
389
392
|
Object.defineProperty(loaderContext, "resource", {
|
|
390
393
|
enumerable: true,
|
|
391
|
-
get:
|
|
394
|
+
get: () => {
|
|
392
395
|
if (loaderContext.resourcePath === undefined)
|
|
393
396
|
return undefined;
|
|
394
397
|
return (loaderContext.resourcePath.replace(/#/g, "\u200b#") +
|
|
395
398
|
loaderContext.resourceQuery.replace(/#/g, "\u200b#") +
|
|
396
399
|
loaderContext.resourceFragment);
|
|
397
400
|
},
|
|
398
|
-
set:
|
|
401
|
+
set: value => {
|
|
399
402
|
const splittedResource = value && parsePathQueryFragment(value);
|
|
400
403
|
loaderContext.resourcePath = splittedResource
|
|
401
404
|
? splittedResource.path
|
|
@@ -410,56 +413,42 @@ async function runLoaders(compiler, context) {
|
|
|
410
413
|
});
|
|
411
414
|
Object.defineProperty(loaderContext, "request", {
|
|
412
415
|
enumerable: true,
|
|
413
|
-
get:
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
})
|
|
418
|
-
.concat(loaderContext.resource || "")
|
|
419
|
-
.join("!");
|
|
420
|
-
}
|
|
416
|
+
get: () => loaderContext.loaders
|
|
417
|
+
.map(o => o.request)
|
|
418
|
+
.concat(loaderContext.resource || "")
|
|
419
|
+
.join("!")
|
|
421
420
|
});
|
|
422
421
|
Object.defineProperty(loaderContext, "remainingRequest", {
|
|
423
422
|
enumerable: true,
|
|
424
|
-
get:
|
|
423
|
+
get: () => {
|
|
425
424
|
if (loaderContext.loaderIndex >= loaderContext.loaders.length - 1 &&
|
|
426
425
|
!loaderContext.resource)
|
|
427
426
|
return "";
|
|
428
427
|
return loaderContext.loaders
|
|
429
428
|
.slice(loaderContext.loaderIndex + 1)
|
|
430
|
-
.map(
|
|
431
|
-
return o.request;
|
|
432
|
-
})
|
|
429
|
+
.map(o => o.request)
|
|
433
430
|
.concat(loaderContext.resource || "")
|
|
434
431
|
.join("!");
|
|
435
432
|
}
|
|
436
433
|
});
|
|
437
434
|
Object.defineProperty(loaderContext, "currentRequest", {
|
|
438
435
|
enumerable: true,
|
|
439
|
-
get:
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
})
|
|
445
|
-
.concat(loaderContext.resource || "")
|
|
446
|
-
.join("!");
|
|
447
|
-
}
|
|
436
|
+
get: () => loaderContext.loaders
|
|
437
|
+
.slice(loaderContext.loaderIndex)
|
|
438
|
+
.map(o => o.request)
|
|
439
|
+
.concat(loaderContext.resource || "")
|
|
440
|
+
.join("!")
|
|
448
441
|
});
|
|
449
442
|
Object.defineProperty(loaderContext, "previousRequest", {
|
|
450
443
|
enumerable: true,
|
|
451
|
-
get:
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
return o.request;
|
|
456
|
-
})
|
|
457
|
-
.join("!");
|
|
458
|
-
}
|
|
444
|
+
get: () => loaderContext.loaders
|
|
445
|
+
.slice(0, loaderContext.loaderIndex)
|
|
446
|
+
.map(o => o.request)
|
|
447
|
+
.join("!")
|
|
459
448
|
});
|
|
460
449
|
Object.defineProperty(loaderContext, "query", {
|
|
461
450
|
enumerable: true,
|
|
462
|
-
get:
|
|
451
|
+
get: () => {
|
|
463
452
|
const entry = loaderContext.loaders[loaderContext.loaderIndex];
|
|
464
453
|
return entry.options && typeof entry.options === "object"
|
|
465
454
|
? entry.options
|
|
@@ -494,7 +483,7 @@ async function runLoaders(compiler, context) {
|
|
|
494
483
|
}
|
|
495
484
|
};
|
|
496
485
|
};
|
|
497
|
-
const resolver = compiler.resolverFactory.get("normal");
|
|
486
|
+
const resolver = compiler._lastCompilation.resolverFactory.get("normal");
|
|
498
487
|
loaderContext.resolve = function resolve(context, request, callback) {
|
|
499
488
|
resolver.resolve({}, context, request, getResolveContext(), callback);
|
|
500
489
|
};
|
|
@@ -528,7 +517,7 @@ async function runLoaders(compiler, context) {
|
|
|
528
517
|
let hasStack = !!error.stack;
|
|
529
518
|
error.name = "ModuleError";
|
|
530
519
|
error.message = `${error.message} (from: ${(0, util_2.stringifyLoaderObject)(loaderContext.loaders[loaderContext.loaderIndex])})`;
|
|
531
|
-
hasStack && Error.captureStackTrace(error);
|
|
520
|
+
!hasStack && Error.captureStackTrace(error);
|
|
532
521
|
error = (0, util_2.concatErrorMsgAndStack)(error);
|
|
533
522
|
error.moduleIdentifier = this._module.identifier();
|
|
534
523
|
compiler._lastCompilation.__internal__pushDiagnostic({
|
|
@@ -598,7 +587,7 @@ async function runLoaders(compiler, context) {
|
|
|
598
587
|
loaderContext._compiler = compiler;
|
|
599
588
|
loaderContext._compilation = compiler._lastCompilation;
|
|
600
589
|
loaderContext._module = Module_1.Module.__from_binding(context._module, compiler._lastCompilation);
|
|
601
|
-
loaderContext.getOptions =
|
|
590
|
+
loaderContext.getOptions = () => {
|
|
602
591
|
const loader = getCurrentLoader(loaderContext);
|
|
603
592
|
let options = loader?.options;
|
|
604
593
|
if (typeof options === "string") {
|
|
@@ -669,9 +658,7 @@ async function runLoaders(compiler, context) {
|
|
|
669
658
|
loaderContext.previousRequest,
|
|
670
659
|
currentLoaderObject.data
|
|
671
660
|
])) || [];
|
|
672
|
-
const hasArg = args.some(
|
|
673
|
-
return value !== undefined;
|
|
674
|
-
});
|
|
661
|
+
const hasArg = args.some(value => value !== undefined);
|
|
675
662
|
if (hasArg) {
|
|
676
663
|
const [content, sourceMap, additionalData] = args;
|
|
677
664
|
context.content = (0, util_2.isNil)(content) ? null : (0, util_2.toBuffer)(content);
|
|
@@ -20,7 +20,7 @@ module.exports = function loadLoader(loader, callback) {
|
|
|
20
20
|
var loaderUrl = url.pathToFileURL(loader.path);
|
|
21
21
|
/** @type {Promise<any>} */
|
|
22
22
|
var modulePromise = eval("import(" + JSON.stringify(loaderUrl.toString()) + ")");
|
|
23
|
-
modulePromise.then(
|
|
23
|
+
modulePromise.then(module => {
|
|
24
24
|
handleResult(loader, module, callback);
|
|
25
25
|
}, callback);
|
|
26
26
|
return;
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* Copyright (c) JS Foundation and other contributors
|
|
8
8
|
* https://github.com/webpack/webpack/blob/main/LICENSE
|
|
9
9
|
*/
|
|
10
|
-
import { Compiler } from "../Compiler";
|
|
10
|
+
import type { Compiler } from "../Compiler";
|
|
11
11
|
export type NodeTemplatePluginOptions = {
|
|
12
12
|
asyncChunkLoading?: boolean;
|
|
13
13
|
};
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* https://github.com/webpack/webpack/blob/main/LICENSE
|
|
9
9
|
*/
|
|
10
10
|
import Watchpack from "../../compiled/watchpack";
|
|
11
|
-
import { FileSystemInfoEntry, WatchFileSystem, Watcher } from "../util/fs";
|
|
11
|
+
import type { FileSystemInfoEntry, WatchFileSystem, Watcher } from "../util/fs";
|
|
12
12
|
export default class NodeWatchFileSystem implements WatchFileSystem {
|
|
13
13
|
inputFileSystem: any;
|
|
14
14
|
watcherOptions: Watchpack.WatchOptions;
|
package/dist/rspack.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Callback } from "@rspack/lite-tapable";
|
|
1
|
+
import type { Callback } from "@rspack/lite-tapable";
|
|
2
2
|
import { Compiler } from "./Compiler";
|
|
3
|
-
import { MultiCompiler, MultiRspackOptions } from "./MultiCompiler";
|
|
3
|
+
import { MultiCompiler, type MultiRspackOptions } from "./MultiCompiler";
|
|
4
4
|
import MultiStats from "./MultiStats";
|
|
5
5
|
import { Stats } from "./Stats";
|
|
6
|
-
import { RspackOptions } from "./config";
|
|
6
|
+
import { type RspackOptions } from "./config";
|
|
7
7
|
declare function createMultiCompiler(options: MultiRspackOptions): MultiCompiler;
|
|
8
8
|
declare function createCompiler(userOptions: RspackOptions): Compiler;
|
|
9
9
|
declare function rspack(options: MultiRspackOptions): MultiCompiler;
|
|
@@ -23,7 +23,6 @@ const DefaultStatsFactoryPlugin_1 = require("./stats/DefaultStatsFactoryPlugin")
|
|
|
23
23
|
const DefaultStatsPresetPlugin_1 = require("./stats/DefaultStatsPresetPlugin");
|
|
24
24
|
const DefaultStatsPrinterPlugin_1 = require("./stats/DefaultStatsPrinterPlugin");
|
|
25
25
|
const assertNotNil_1 = require("./util/assertNotNil");
|
|
26
|
-
const cleverMerge_1 = require("./util/cleverMerge");
|
|
27
26
|
class RspackOptionsApply {
|
|
28
27
|
constructor() { }
|
|
29
28
|
process(options, compiler) {
|
|
@@ -171,9 +170,7 @@ class RspackOptionsApply {
|
|
|
171
170
|
// this is only for test
|
|
172
171
|
// @ts-expect-error cacheable is hide
|
|
173
172
|
lazyOptions.cacheable ?? true, lazyOptions.entries ?? true, lazyOptions.imports ?? true, typeof lazyOptions.test === "function"
|
|
174
|
-
?
|
|
175
|
-
return lazyOptions.test.call(lazyOptions, new Module_1.Module(jsModule));
|
|
176
|
-
}
|
|
173
|
+
? jsModule => lazyOptions.test.call(lazyOptions, new Module_1.Module(jsModule))
|
|
177
174
|
: lazyOptions.test
|
|
178
175
|
? {
|
|
179
176
|
source: lazyOptions.test.source,
|
|
@@ -267,21 +264,6 @@ class RspackOptionsApply {
|
|
|
267
264
|
if (!compiler.inputFileSystem) {
|
|
268
265
|
throw new Error("No input filesystem provided");
|
|
269
266
|
}
|
|
270
|
-
compiler.resolverFactory.hooks.resolveOptions
|
|
271
|
-
.for("normal")
|
|
272
|
-
.tap("RspackOptionsApply", resolveOptions => {
|
|
273
|
-
resolveOptions = (0, cleverMerge_1.cleverMerge)(options.resolve, resolveOptions);
|
|
274
|
-
resolveOptions.fileSystem = compiler.inputFileSystem;
|
|
275
|
-
return resolveOptions;
|
|
276
|
-
});
|
|
277
|
-
compiler.resolverFactory.hooks.resolveOptions
|
|
278
|
-
.for("context")
|
|
279
|
-
.tap("RspackOptionsApply", resolveOptions => {
|
|
280
|
-
resolveOptions = (0, cleverMerge_1.cleverMerge)(options.resolve, resolveOptions);
|
|
281
|
-
resolveOptions.fileSystem = compiler.inputFileSystem;
|
|
282
|
-
resolveOptions.resolveToContext = true;
|
|
283
|
-
return resolveOptions;
|
|
284
|
-
});
|
|
285
267
|
compiler.hooks.afterResolvers.call(compiler);
|
|
286
268
|
}
|
|
287
269
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BuiltinPlugin, BuiltinPluginName } from "@rspack/binding";
|
|
2
|
-
import { Compiler } from "../Compiler";
|
|
1
|
+
import { type BuiltinPlugin, BuiltinPluginName } from "@rspack/binding";
|
|
2
|
+
import type { Compiler } from "../Compiler";
|
|
3
3
|
import { RspackBuiltinPlugin } from "../builtin-plugin/base";
|
|
4
4
|
export type ConsumeSharedPluginOptions = {
|
|
5
5
|
consumes: Consumes;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BuiltinPlugin, BuiltinPluginName } from "@rspack/binding";
|
|
2
|
-
import { Compiler } from "../Compiler";
|
|
1
|
+
import { type BuiltinPlugin, BuiltinPluginName } from "@rspack/binding";
|
|
2
|
+
import type { Compiler } from "../Compiler";
|
|
3
3
|
import { RspackBuiltinPlugin } from "../builtin-plugin/base";
|
|
4
4
|
export type ProvideSharedPluginOptions = {
|
|
5
5
|
provides: Provides;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BuiltinPlugin, BuiltinPluginName } from "@rspack/binding";
|
|
2
|
-
import { Compiler } from "../Compiler";
|
|
1
|
+
import { type BuiltinPlugin, BuiltinPluginName } from "@rspack/binding";
|
|
2
|
+
import type { Compiler } from "../Compiler";
|
|
3
3
|
import { RspackBuiltinPlugin } from "../builtin-plugin/base";
|
|
4
4
|
export declare class ShareRuntimePlugin extends RspackBuiltinPlugin {
|
|
5
5
|
private enhanced;
|
|
@@ -7,10 +7,10 @@
|
|
|
7
7
|
* Copyright (c) JS Foundation and other contributors
|
|
8
8
|
* https://github.com/webpack/webpack/blob/main/LICENSE
|
|
9
9
|
*/
|
|
10
|
-
import { JsStats, JsStatsError, JsStatsWarning } from "@rspack/binding";
|
|
10
|
+
import type { JsStats, JsStatsError, JsStatsWarning } from "@rspack/binding";
|
|
11
11
|
import { HookMap, SyncBailHook, SyncWaterfallHook } from "@rspack/lite-tapable";
|
|
12
12
|
import type { Compilation } from "../Compilation";
|
|
13
|
-
import { GroupConfig } from "../util/smartGrouping";
|
|
13
|
+
import { type GroupConfig } from "../util/smartGrouping";
|
|
14
14
|
export type KnownStatsFactoryContext = {
|
|
15
15
|
type: string;
|
|
16
16
|
makePathsRelative?: ((arg0: string) => string) | undefined;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as binding from "@rspack/binding";
|
|
1
|
+
import type * as binding from "@rspack/binding";
|
|
2
2
|
import type { Compilation, NormalizedStatsOptions } from "../Compilation";
|
|
3
3
|
import { type Comparator } from "../util/comparators";
|
|
4
4
|
import type { StatsFactory, StatsFactoryContext } from "./StatsFactory";
|
|
@@ -57,7 +57,7 @@ function isMusl() {
|
|
|
57
57
|
}
|
|
58
58
|
const BINDING_VERSION = require("@rspack/binding/package.json").version;
|
|
59
59
|
const CORE_VERSION = require("../../package.json").version;
|
|
60
|
-
const getAddonPlatformArchAbi =
|
|
60
|
+
const getAddonPlatformArchAbi = () => {
|
|
61
61
|
const { platform, arch } = process;
|
|
62
62
|
let binding = "";
|
|
63
63
|
binding += platform;
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* https://github.com/webpack/webpack/blob/main/LICENSE
|
|
9
9
|
*/
|
|
10
10
|
import type { JsStatsChunk as Chunk } from "@rspack/binding";
|
|
11
|
-
import { ChunkGroup } from "../ChunkGroup";
|
|
11
|
+
import type { ChunkGroup } from "../ChunkGroup";
|
|
12
12
|
export type Comparator = <T>(arg0: T, arg1: T) => -1 | 0 | 1;
|
|
13
13
|
type Selector<A, B> = (input: A) => B;
|
|
14
14
|
export declare const concatComparators: (c1: Comparator, c2: Comparator, ...cRest: Comparator[]) => Comparator;
|
package/dist/util/fs.d.ts
CHANGED
package/dist/util/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import type { JsRspackError, JsStatsError } from "@rspack/binding";
|
|
3
|
-
import { LoaderObject } from "../loader-runner";
|
|
3
|
+
import type { LoaderObject } from "../loader-runner";
|
|
4
4
|
export declare function mapValues(record: Record<string, string>, fn: (key: string) => string): {
|
|
5
5
|
[k: string]: string;
|
|
6
6
|
};
|
package/dist/util/index.js
CHANGED
|
@@ -63,10 +63,12 @@ function concatErrorMsgAndStack(err) {
|
|
|
63
63
|
if (typeof err === "string") {
|
|
64
64
|
return new Error(err);
|
|
65
65
|
}
|
|
66
|
-
|
|
66
|
+
const hideStack = "hideStack" in err && err.hideStack;
|
|
67
|
+
if (!hideStack && "stack" in err) {
|
|
67
68
|
err.message = err.stack || err.message;
|
|
68
|
-
return err;
|
|
69
69
|
}
|
|
70
|
+
// maybe `null`, use `undefined` to compatible with `Option<String>`
|
|
71
|
+
err.stack = err.stack || undefined;
|
|
70
72
|
return err;
|
|
71
73
|
}
|
|
72
74
|
exports.concatErrorMsgAndStack = concatErrorMsgAndStack;
|
package/dist/util/validate.d.ts
CHANGED