@rspack/core 0.6.5-canary-dc02c55-20240516004313 → 0.6.5-canary-b7b5c75-20240821125908
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/Chunk.d.ts +1 -1
- package/dist/Chunk.js +1 -1
- package/dist/ChunkGroup.d.ts +1 -1
- package/dist/ChunkGroup.js +3 -3
- package/dist/Compilation.d.ts +65 -46
- package/dist/Compilation.js +222 -128
- package/dist/Compiler.d.ts +44 -75
- package/dist/Compiler.js +260 -301
- package/dist/Entrypoint.d.ts +1 -1
- package/dist/Entrypoint.js +1 -1
- package/dist/ExecuteModulePlugin.js +1 -1
- package/dist/Module.js +2 -2
- package/dist/MultiCompiler.d.ts +25 -10
- package/dist/MultiCompiler.js +3 -3
- package/dist/MultiStats.d.ts +1 -1
- package/dist/NormalModuleFactory.d.ts +1 -1
- package/dist/Stats.d.ts +2 -2
- package/dist/Watching.d.ts +9 -0
- package/dist/Watching.js +2 -12
- package/dist/builtin-loader/swc/index.d.ts +6 -6
- package/dist/builtin-loader/swc/index.js +3 -3
- package/dist/builtin-loader/swc/types.d.ts +2 -2
- package/dist/builtin-plugin/APIPlugin.d.ts +1 -1
- package/dist/builtin-plugin/ArrayPushCallbackChunkFormatPlugin.d.ts +1 -1
- package/dist/builtin-plugin/AssetModulesPlugin.d.ts +1 -1
- package/dist/builtin-plugin/AsyncWebAssemblyModulesPlugin.d.ts +1 -1
- package/dist/builtin-plugin/BannerPlugin.d.ts +2 -2
- package/dist/builtin-plugin/BannerPlugin.js +1 -1
- package/dist/builtin-plugin/BundlerInfoRspackPlugin.d.ts +1 -1
- package/dist/builtin-plugin/ChunkPrefetchPreloadPlugin.d.ts +1 -1
- package/dist/builtin-plugin/CommonJsChunkFormatPlugin.d.ts +1 -1
- package/dist/builtin-plugin/CopyRspackPlugin.d.ts +1 -1
- package/dist/builtin-plugin/CssModulesPlugin.d.ts +1 -1
- package/dist/builtin-plugin/DataUriPlugin.d.ts +1 -1
- package/dist/builtin-plugin/DefinePlugin.d.ts +1 -1
- package/dist/builtin-plugin/DeterministicChunkIdsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/DeterministicModuleIdsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/DynamicEntryPlugin.d.ts +1 -1
- package/dist/builtin-plugin/DynamicEntryPlugin.js +1 -1
- package/dist/builtin-plugin/ElectronTargetPlugin.d.ts +1 -1
- package/dist/builtin-plugin/EnableChunkLoadingPlugin.d.ts +1 -1
- package/dist/builtin-plugin/EnableLibraryPlugin.d.ts +1 -1
- package/dist/builtin-plugin/EnableWasmLoadingPlugin.d.ts +1 -1
- package/dist/builtin-plugin/EnsureChunkConditionsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/EntryPlugin.d.ts +1 -1
- package/dist/builtin-plugin/EntryPlugin.js +1 -1
- package/dist/builtin-plugin/EvalDevToolModulePlugin.d.ts +1 -1
- package/dist/builtin-plugin/EvalSourceMapDevToolPlugin.d.ts +1 -1
- package/dist/builtin-plugin/ExternalsPlugin.d.ts +3 -3
- package/dist/builtin-plugin/FileUriPlugin.d.ts +1 -1
- package/dist/builtin-plugin/FlagDependencyExportsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/FlagDependencyUsagePlugin.d.ts +1 -1
- package/dist/builtin-plugin/HtmlRspackPlugin.d.ts +2 -2
- package/dist/builtin-plugin/HtmlRspackPlugin.js +2 -2
- package/dist/builtin-plugin/HttpExternalsRspackPlugin.d.ts +1 -1
- package/dist/builtin-plugin/IgnorePlugin.d.ts +1 -1
- package/dist/builtin-plugin/InferAsyncModulesPlugin.d.ts +1 -1
- package/dist/builtin-plugin/JavascriptModulesPlugin.d.ts +1 -1
- package/dist/builtin-plugin/JsLoaderRspackPlugin.d.ts +1 -1
- package/dist/builtin-plugin/JsLoaderRspackPlugin.js +1 -1
- package/dist/builtin-plugin/JsonModulesPlugin.d.ts +1 -1
- package/dist/builtin-plugin/LimitChunkCountPlugin.d.ts +1 -1
- package/dist/builtin-plugin/MangleExportsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/MergeDuplicateChunksPlugin.d.ts +1 -1
- package/dist/builtin-plugin/ModuleChunkFormatPlugin.d.ts +1 -1
- package/dist/builtin-plugin/ModuleConcatenationPlugin.d.ts +1 -1
- package/dist/builtin-plugin/NamedChunkIdsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/NamedModuleIdsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/NodeTargetPlugin.d.ts +1 -1
- package/dist/builtin-plugin/ProgressPlugin.d.ts +1 -1
- package/dist/builtin-plugin/ProvidePlugin.d.ts +1 -1
- package/dist/builtin-plugin/RealContentHashPlugin.d.ts +1 -1
- package/dist/builtin-plugin/RemoveEmptyChunksPlugin.d.ts +1 -1
- package/dist/builtin-plugin/RuntimeChunkPlugin.d.ts +1 -1
- package/dist/builtin-plugin/RuntimePlugin.d.ts +1 -1
- package/dist/builtin-plugin/SideEffectsFlagPlugin.d.ts +1 -1
- package/dist/builtin-plugin/SizeLimitsPlugin.d.ts +1 -1
- package/dist/builtin-plugin/SourceMapDevToolPlugin.d.ts +1 -1
- package/dist/builtin-plugin/SplitChunksPlugin.d.ts +2 -2
- package/dist/builtin-plugin/SplitChunksPlugin.js +4 -4
- package/dist/builtin-plugin/SwcCssMinimizerPlugin.d.ts +1 -1
- package/dist/builtin-plugin/SwcJsMinimizerPlugin.d.ts +1 -1
- package/dist/builtin-plugin/WarnCaseSensitiveModulesPlugin.d.ts +1 -1
- package/dist/builtin-plugin/WebWorkerTemplatePlugin.d.ts +1 -1
- package/dist/builtin-plugin/WorkerPlugin.d.ts +2 -2
- package/dist/builtin-plugin/base.d.ts +1 -1
- package/dist/builtin-plugin/css-extract/index.d.ts +4 -5
- package/dist/builtin-plugin/css-extract/loader.d.ts +1 -1
- package/dist/builtin-plugin/css-extract/loader.js +2 -2
- package/dist/builtin-plugin/index.d.ts +43 -43
- package/dist/builtin-plugin/index.js +43 -43
- package/dist/config/adapter.d.ts +2 -2
- package/dist/config/adapter.js +5 -6
- package/dist/config/adapterRuleUse.d.ts +1 -2
- package/dist/config/adapterRuleUse.js +2 -2
- package/dist/config/defaults.js +4 -6
- package/dist/config/index.d.ts +2 -2
- package/dist/config/index.js +2 -2
- package/dist/config/normalization.d.ts +2 -1
- package/dist/config/zod.d.ts +184 -258
- package/dist/config/zod.js +28 -8
- package/dist/container/ContainerPlugin.d.ts +1 -1
- package/dist/container/ContainerReferencePlugin.d.ts +1 -1
- package/dist/container/ContainerReferencePlugin.js +1 -1
- package/dist/container/ModuleFederationPlugin.js +1 -1
- package/dist/container/ModuleFederationPluginV1.d.ts +1 -1
- package/dist/container/ModuleFederationPluginV1.js +1 -1
- package/dist/container/ModuleFederationRuntimePlugin.d.ts +1 -1
- package/dist/exports.d.ts +30 -32
- package/dist/exports.js +17 -15
- package/dist/fileSystem.d.ts +8 -12
- package/dist/fileSystem.js +48 -25
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/loader-runner/index.js +13 -13
- package/dist/logging/Logger.d.ts +1 -1
- package/dist/logging/createConsoleLogger.js +14 -0
- package/dist/node/NodeEnvironmentPlugin.d.ts +1 -1
- package/dist/node/NodeEnvironmentPlugin.js +1 -1
- package/dist/node/nodeConsole.js +4 -0
- package/dist/rspack.d.ts +13 -4
- package/dist/rspack.js +8 -8
- package/dist/rspackOptionsApply.d.ts +10 -1
- package/dist/rspackOptionsApply.js +5 -14
- package/dist/sharing/ConsumeSharedPlugin.d.ts +1 -1
- package/dist/sharing/ConsumeSharedPlugin.js +1 -1
- package/dist/stats/DefaultStatsFactoryPlugin.js +2 -2
- package/dist/stats/StatsFactory.d.ts +2 -2
- package/dist/stats/StatsFactory.js +9 -0
- package/dist/stats/StatsPrinter.d.ts +1 -1
- package/dist/stats/statsFactoryUtils.d.ts +1 -1
- package/dist/util/comparators.d.ts +1 -1
- package/dist/util/createSource.d.ts +5 -0
- package/dist/util/createSource.js +65 -0
- package/dist/util/fs.d.ts +0 -64
- package/dist/util/fs.js +0 -122
- package/dist/util/index.d.ts +1 -2
- package/dist/util/index.js +11 -16
- package/package.json +5 -5
- package/dist/util/source.d.ts +0 -18
- package/dist/util/source.js +0 -66
package/dist/config/zod.js
CHANGED
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.rspackOptions = exports.externalsType = void 0;
|
|
4
4
|
const zod_1 = require("../../compiled/zod");
|
|
5
|
-
const
|
|
5
|
+
const util_1 = require("../util");
|
|
6
6
|
const Module_1 = require("../Module");
|
|
7
|
+
const Chunk_1 = require("../Chunk");
|
|
7
8
|
//#region Name
|
|
8
9
|
const name = zod_1.z.string();
|
|
9
10
|
//#endregion
|
|
@@ -219,6 +220,19 @@ const resolveTsconfig = zod_1.z.strictObject({
|
|
|
219
220
|
});
|
|
220
221
|
const baseResolveOptions = zod_1.z.strictObject({
|
|
221
222
|
alias: resolveAlias.optional(),
|
|
223
|
+
/**
|
|
224
|
+
* This is `aliasField: ["browser"]` in webpack, because no one
|
|
225
|
+
* uses aliasField other than "browser". ---@bvanjoi
|
|
226
|
+
*/
|
|
227
|
+
browserField: zod_1.z
|
|
228
|
+
.boolean()
|
|
229
|
+
.optional()
|
|
230
|
+
.refine(val => {
|
|
231
|
+
if (val !== undefined) {
|
|
232
|
+
(0, util_1.deprecatedWarn)(`'resolve.browserField' has been deprecated, and will be removed in 0.6.0. Please use 'resolve.aliasField' instead.`);
|
|
233
|
+
}
|
|
234
|
+
return true;
|
|
235
|
+
}),
|
|
222
236
|
conditionNames: zod_1.z.array(zod_1.z.string()).optional(),
|
|
223
237
|
extensions: zod_1.z.array(zod_1.z.string()).optional(),
|
|
224
238
|
fallback: resolveAlias.optional(),
|
|
@@ -371,23 +385,19 @@ const cssGeneratorExportsConvention = zod_1.z.enum([
|
|
|
371
385
|
]);
|
|
372
386
|
const cssGeneratorExportsOnly = zod_1.z.boolean();
|
|
373
387
|
const cssGeneratorLocalIdentName = zod_1.z.string();
|
|
374
|
-
const cssGeneratorEsModule = zod_1.z.boolean();
|
|
375
388
|
const cssGeneratorOptions = zod_1.z.strictObject({
|
|
376
389
|
exportsConvention: cssGeneratorExportsConvention.optional(),
|
|
377
|
-
exportsOnly: cssGeneratorExportsOnly.optional()
|
|
378
|
-
esModule: cssGeneratorEsModule.optional()
|
|
390
|
+
exportsOnly: cssGeneratorExportsOnly.optional()
|
|
379
391
|
});
|
|
380
392
|
const cssAutoGeneratorOptions = zod_1.z.strictObject({
|
|
381
393
|
exportsConvention: cssGeneratorExportsConvention.optional(),
|
|
382
394
|
exportsOnly: cssGeneratorExportsOnly.optional(),
|
|
383
|
-
localIdentName: cssGeneratorLocalIdentName.optional()
|
|
384
|
-
esModule: cssGeneratorEsModule.optional()
|
|
395
|
+
localIdentName: cssGeneratorLocalIdentName.optional()
|
|
385
396
|
});
|
|
386
397
|
const cssModuleGeneratorOptions = zod_1.z.strictObject({
|
|
387
398
|
exportsConvention: cssGeneratorExportsConvention.optional(),
|
|
388
399
|
exportsOnly: cssGeneratorExportsOnly.optional(),
|
|
389
|
-
localIdentName: cssGeneratorLocalIdentName.optional()
|
|
390
|
-
esModule: cssGeneratorEsModule.optional()
|
|
400
|
+
localIdentName: cssGeneratorLocalIdentName.optional()
|
|
391
401
|
});
|
|
392
402
|
const generatorOptionsByModuleTypeKnown = zod_1.z.strictObject({
|
|
393
403
|
asset: assetGeneratorOptions.optional(),
|
|
@@ -754,6 +764,16 @@ const experiments = zod_1.z.strictObject({
|
|
|
754
764
|
asyncWebAssembly: zod_1.z.boolean().optional(),
|
|
755
765
|
outputModule: zod_1.z.boolean().optional(),
|
|
756
766
|
topLevelAwait: zod_1.z.boolean().optional(),
|
|
767
|
+
newSplitChunks: zod_1.z
|
|
768
|
+
.boolean()
|
|
769
|
+
.optional()
|
|
770
|
+
.refine(val => {
|
|
771
|
+
if (val === false) {
|
|
772
|
+
(0, util_1.deprecatedWarn)(`'experiments.newSplitChunks = ${JSON.stringify(val)}' has been deprecated, please switch to 'experiments.newSplitChunks = true' to use webpack's behavior.
|
|
773
|
+
See the discussion here (https://github.com/web-infra-dev/rspack/discussions/4168)`);
|
|
774
|
+
}
|
|
775
|
+
return true;
|
|
776
|
+
}),
|
|
757
777
|
css: zod_1.z.boolean().optional(),
|
|
758
778
|
futureDefaults: zod_1.z.boolean().optional(),
|
|
759
779
|
rspackFuture: rspackFutureOptions.optional()
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BuiltinPlugin, BuiltinPluginName } from "@rspack/binding";
|
|
2
2
|
import { RspackBuiltinPlugin } from "../builtin-plugin/base";
|
|
3
|
-
import { Compiler } from "../Compiler";
|
|
4
3
|
import { EntryRuntime, FilenameTemplate, LibraryOptions } from "../config";
|
|
4
|
+
import { Compiler } from "../Compiler";
|
|
5
5
|
export type ContainerPluginOptions = {
|
|
6
6
|
exposes: Exposes;
|
|
7
7
|
filename?: FilenameTemplate;
|
|
@@ -21,7 +21,7 @@ export type RemotesConfig = {
|
|
|
21
21
|
export declare class ContainerReferencePlugin extends RspackBuiltinPlugin {
|
|
22
22
|
name: BuiltinPluginName;
|
|
23
23
|
_options: {
|
|
24
|
-
remoteType: "promise" | "
|
|
24
|
+
remoteType: "promise" | "jsonp" | "import" | "amd" | "commonjs" | "commonjs2" | "var" | "module" | "assign" | "this" | "window" | "self" | "global" | "commonjs-module" | "commonjs-static" | "amd-require" | "umd" | "umd2" | "system" | "script" | "node-commonjs";
|
|
25
25
|
remotes: [string, {
|
|
26
26
|
external: string[];
|
|
27
27
|
shareScope: string;
|
|
@@ -4,8 +4,8 @@ exports.ContainerReferencePlugin = void 0;
|
|
|
4
4
|
const binding_1 = require("@rspack/binding");
|
|
5
5
|
const base_1 = require("../builtin-plugin/base");
|
|
6
6
|
const ExternalsPlugin_1 = require("../builtin-plugin/ExternalsPlugin");
|
|
7
|
-
const ShareRuntimePlugin_1 = require("../sharing/ShareRuntimePlugin");
|
|
8
7
|
const options_1 = require("./options");
|
|
8
|
+
const ShareRuntimePlugin_1 = require("../sharing/ShareRuntimePlugin");
|
|
9
9
|
class ContainerReferencePlugin extends base_1.RspackBuiltinPlugin {
|
|
10
10
|
constructor(options) {
|
|
11
11
|
var _a;
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ModuleFederationPlugin = void 0;
|
|
4
4
|
const config_1 = require("../config");
|
|
5
|
+
const options_1 = require("./options");
|
|
5
6
|
const validate_1 = require("../util/validate");
|
|
6
7
|
const ModuleFederationRuntimePlugin_1 = require("./ModuleFederationRuntimePlugin");
|
|
7
|
-
const options_1 = require("./options");
|
|
8
8
|
class ModuleFederationPlugin {
|
|
9
9
|
constructor(_options) {
|
|
10
10
|
this._options = _options;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Compiler } from "../Compiler";
|
|
2
|
-
import { EntryRuntime, ExternalsType
|
|
2
|
+
import { LibraryOptions, EntryRuntime, ExternalsType } from "../config";
|
|
3
3
|
import { Shared } from "../sharing/SharePlugin";
|
|
4
4
|
import { Exposes } from "./ContainerPlugin";
|
|
5
5
|
import { Remotes } from "./ContainerReferencePlugin";
|
|
@@ -3,10 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ModuleFederationPluginV1 = void 0;
|
|
4
4
|
const config_1 = require("../config");
|
|
5
5
|
const SharePlugin_1 = require("../sharing/SharePlugin");
|
|
6
|
-
const ShareRuntimePlugin_1 = require("../sharing/ShareRuntimePlugin");
|
|
7
6
|
const validate_1 = require("../util/validate");
|
|
8
7
|
const ContainerPlugin_1 = require("./ContainerPlugin");
|
|
9
8
|
const ContainerReferencePlugin_1 = require("./ContainerReferencePlugin");
|
|
9
|
+
const ShareRuntimePlugin_1 = require("../sharing/ShareRuntimePlugin");
|
|
10
10
|
class ModuleFederationPluginV1 {
|
|
11
11
|
constructor(_options) {
|
|
12
12
|
this._options = _options;
|
|
@@ -3,7 +3,7 @@ export declare const ModuleFederationRuntimePlugin: {
|
|
|
3
3
|
new (): {
|
|
4
4
|
name: BuiltinPluginName;
|
|
5
5
|
_options: void;
|
|
6
|
-
affectedHooks: "done" | "make" | "compile" | "emit" | "afterEmit" | "invalid" | "thisCompilation" | "afterDone" | "
|
|
6
|
+
affectedHooks: "done" | "compilation" | "make" | "compile" | "emit" | "afterEmit" | "invalid" | "thisCompilation" | "afterDone" | "normalModuleFactory" | "contextModuleFactory" | "initialize" | "shouldEmit" | "infrastructureLog" | "beforeRun" | "run" | "assetEmitted" | "failed" | "shutdown" | "watchRun" | "watchClose" | "environment" | "afterEnvironment" | "afterPlugins" | "afterResolvers" | "beforeCompile" | "afterCompile" | "finishMake" | "entryOption" | undefined;
|
|
7
7
|
raw(): import("@rspack/binding").BuiltinPlugin;
|
|
8
8
|
apply(compiler: import("../Compiler").Compiler): void;
|
|
9
9
|
};
|
package/dist/exports.d.ts
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
declare const rspackVersion: any, webpackVersion: any;
|
|
2
|
-
export {
|
|
3
|
-
export type { Asset, AssetInfo, Assets, CompilationParams, LogEntry } from "./Compilation";
|
|
4
|
-
export { Compilation } from "./Compilation";
|
|
2
|
+
export { webpackVersion as version, rspackVersion };
|
|
5
3
|
export { Compiler } from "./Compiler";
|
|
6
|
-
export
|
|
4
|
+
export { Compilation } from "./Compilation";
|
|
5
|
+
export type { Asset, AssetInfo, Assets, LogEntry, CompilationParams } from "./Compilation";
|
|
7
6
|
export { MultiCompiler } from "./MultiCompiler";
|
|
7
|
+
export type { MultiCompilerOptions, MultiRspackOptions } from "./MultiCompiler";
|
|
8
8
|
import { RspackOptionsApply } from "./rspackOptionsApply";
|
|
9
9
|
export { RspackOptionsApply, RspackOptionsApply as WebpackOptionsApply };
|
|
10
|
+
export { RuntimeGlobals } from "./RuntimeGlobals";
|
|
11
|
+
export { Stats } from "./Stats";
|
|
12
|
+
export type { StatsCompilation, StatsAsset, StatsChunk, StatsError, StatsModule, StatsWarnings } from "./Stats";
|
|
13
|
+
export { MultiStats } from "./MultiStats";
|
|
10
14
|
export type { Chunk } from "./Chunk";
|
|
11
15
|
export type { ChunkGroup } from "./ChunkGroup";
|
|
16
|
+
export type { NormalModuleFactory } from "./NormalModuleFactory";
|
|
12
17
|
export type { Module } from "./Module";
|
|
13
|
-
export { MultiStats } from "./MultiStats";
|
|
14
18
|
export { NormalModule } from "./NormalModule";
|
|
15
|
-
export type { NormalModuleFactory } from "./NormalModuleFactory";
|
|
16
|
-
export { RuntimeGlobals } from "./RuntimeGlobals";
|
|
17
|
-
export type { StatsAsset, StatsChunk, StatsCompilation, StatsError, StatsModule, StatsWarnings } from "./Stats";
|
|
18
|
-
export { Stats } from "./Stats";
|
|
19
19
|
import * as ModuleFilenameHelpers from "./lib/ModuleFilenameHelpers";
|
|
20
20
|
export { ModuleFilenameHelpers };
|
|
21
21
|
import Template = require("./Template");
|
|
@@ -24,7 +24,7 @@ export declare const WebpackError: ErrorConstructor;
|
|
|
24
24
|
export type { Watching } from "./Watching";
|
|
25
25
|
declare const sources: any;
|
|
26
26
|
export { sources };
|
|
27
|
-
import {
|
|
27
|
+
import { getNormalizedRspackOptions, applyRspackOptionsDefaults } from "./config";
|
|
28
28
|
type Config = {
|
|
29
29
|
getNormalizedRspackOptions: typeof getNormalizedRspackOptions;
|
|
30
30
|
applyRspackOptionsDefaults: typeof applyRspackOptionsDefaults;
|
|
@@ -37,30 +37,29 @@ export declare const util: {
|
|
|
37
37
|
createHash: (algorithm: any) => any;
|
|
38
38
|
cleverMerge: <T, O>(first: T, second: O) => T | O | (T & O);
|
|
39
39
|
};
|
|
40
|
+
export { registerGlobalTrace as experimental_registerGlobalTrace, cleanupGlobalTrace as experimental_cleanupGlobalTrace } from "@rspack/binding";
|
|
40
41
|
export { default as EntryOptionPlugin } from "./lib/EntryOptionPlugin";
|
|
41
|
-
export { type OutputFileSystem } from "./util/fs";
|
|
42
|
-
export { cleanupGlobalTrace as experimental_cleanupGlobalTrace, registerGlobalTrace as experimental_registerGlobalTrace } from "@rspack/binding";
|
|
43
|
-
export type { BannerPluginArgument } from "./builtin-plugin";
|
|
44
|
-
export type { ProvidePluginOptions } from "./builtin-plugin";
|
|
45
|
-
export type { DefinePluginOptions } from "./builtin-plugin";
|
|
46
|
-
export type { ProgressPluginArgument } from "./builtin-plugin";
|
|
47
|
-
export type { EntryOptions } from "./builtin-plugin";
|
|
48
42
|
export { BannerPlugin } from "./builtin-plugin";
|
|
43
|
+
export type { BannerPluginArgument } from "./builtin-plugin";
|
|
49
44
|
export { IgnorePlugin, type IgnorePluginOptions } from "./builtin-plugin";
|
|
50
45
|
export { ProvidePlugin } from "./builtin-plugin";
|
|
46
|
+
export type { ProvidePluginOptions } from "./builtin-plugin";
|
|
51
47
|
export { DefinePlugin } from "./builtin-plugin";
|
|
48
|
+
export type { DefinePluginOptions } from "./builtin-plugin";
|
|
52
49
|
export { ProgressPlugin } from "./builtin-plugin";
|
|
50
|
+
export type { ProgressPluginArgument } from "./builtin-plugin";
|
|
53
51
|
export { EntryPlugin } from "./builtin-plugin";
|
|
52
|
+
export type { EntryOptions } from "./builtin-plugin";
|
|
54
53
|
export { DynamicEntryPlugin } from "./builtin-plugin";
|
|
55
54
|
export { ExternalsPlugin } from "./builtin-plugin";
|
|
56
55
|
export { HotModuleReplacementPlugin } from "./builtin-plugin";
|
|
57
|
-
export { EnvironmentPlugin } from "./lib/EnvironmentPlugin";
|
|
58
56
|
export { LoaderOptionsPlugin } from "./lib/LoaderOptionsPlugin";
|
|
59
57
|
export { LoaderTargetPlugin } from "./lib/LoaderTargetPlugin";
|
|
58
|
+
export { EnvironmentPlugin } from "./lib/EnvironmentPlugin";
|
|
60
59
|
export { NormalModuleReplacementPlugin } from "./lib/NormalModuleReplacementPlugin";
|
|
60
|
+
import NodeTemplatePlugin from "./node/NodeTemplatePlugin";
|
|
61
61
|
import { NodeTargetPlugin } from "./builtin-plugin";
|
|
62
62
|
import NodeEnvironmentPlugin from "./node/NodeEnvironmentPlugin";
|
|
63
|
-
import NodeTemplatePlugin from "./node/NodeTemplatePlugin";
|
|
64
63
|
interface Node {
|
|
65
64
|
NodeTargetPlugin: typeof NodeTargetPlugin;
|
|
66
65
|
NodeTemplatePlugin: typeof NodeTemplatePlugin;
|
|
@@ -107,37 +106,36 @@ import { ModuleFederationPluginV1 } from "./container/ModuleFederationPluginV1";
|
|
|
107
106
|
export type { ModuleFederationPluginV1Options } from "./container/ModuleFederationPluginV1";
|
|
108
107
|
import { ContainerPlugin } from "./container/ContainerPlugin";
|
|
109
108
|
import { ContainerReferencePlugin } from "./container/ContainerReferencePlugin";
|
|
110
|
-
export type { ContainerPluginOptions, Exposes,
|
|
111
|
-
export type { ContainerReferencePluginOptions, Remotes,
|
|
109
|
+
export type { ContainerPluginOptions, Exposes, ExposesItem, ExposesItems, ExposesObject, ExposesConfig } from "./container/ContainerPlugin";
|
|
110
|
+
export type { ContainerReferencePluginOptions, Remotes, RemotesItem, RemotesItems, RemotesObject, RemotesConfig } from "./container/ContainerReferencePlugin";
|
|
112
111
|
export declare const container: {
|
|
113
112
|
ContainerPlugin: typeof ContainerPlugin;
|
|
114
113
|
ContainerReferencePlugin: typeof ContainerReferencePlugin;
|
|
115
114
|
ModuleFederationPlugin: typeof ModuleFederationPlugin;
|
|
116
115
|
ModuleFederationPluginV1: typeof ModuleFederationPluginV1;
|
|
117
116
|
};
|
|
118
|
-
import { ConsumeSharedPlugin } from "./sharing/ConsumeSharedPlugin";
|
|
119
117
|
import { ProvideSharedPlugin } from "./sharing/ProvideSharedPlugin";
|
|
118
|
+
import { ConsumeSharedPlugin } from "./sharing/ConsumeSharedPlugin";
|
|
120
119
|
import { SharePlugin } from "./sharing/SharePlugin";
|
|
121
|
-
export type {
|
|
122
|
-
export type {
|
|
123
|
-
export type { Shared, SharedConfig, SharedItem, SharedObject
|
|
120
|
+
export type { ProvideSharedPluginOptions, Provides, ProvidesConfig, ProvidesItem, ProvidesObject } from "./sharing/ProvideSharedPlugin";
|
|
121
|
+
export type { ConsumeSharedPluginOptions, Consumes, ConsumesConfig, ConsumesItem, ConsumesObject } from "./sharing/ConsumeSharedPlugin";
|
|
122
|
+
export type { SharePluginOptions, Shared, SharedConfig, SharedItem, SharedObject } from "./sharing/SharePlugin";
|
|
124
123
|
export declare const sharing: {
|
|
125
124
|
ProvideSharedPlugin: typeof ProvideSharedPlugin;
|
|
126
125
|
ConsumeSharedPlugin: typeof ConsumeSharedPlugin;
|
|
127
126
|
SharePlugin: typeof SharePlugin;
|
|
128
127
|
};
|
|
129
|
-
export type { HtmlRspackPluginOptions } from "./builtin-plugin";
|
|
130
|
-
export type { SwcJsMinimizerRspackPluginOptions } from "./builtin-plugin";
|
|
131
|
-
export type { CopyRspackPluginOptions } from "./builtin-plugin";
|
|
132
|
-
export type { SourceMapDevToolPluginOptions } from "./builtin-plugin";
|
|
133
|
-
export type { EvalDevToolModulePluginOptions } from "./builtin-plugin";
|
|
134
|
-
export type { CssExtractRspackLoaderOptions, CssExtractRspackPluginOptions } from "./builtin-plugin";
|
|
135
128
|
export { HtmlRspackPlugin } from "./builtin-plugin";
|
|
129
|
+
export type { HtmlRspackPluginOptions } from "./builtin-plugin";
|
|
136
130
|
export { SwcJsMinimizerRspackPlugin } from "./builtin-plugin";
|
|
131
|
+
export type { SwcJsMinimizerRspackPluginOptions } from "./builtin-plugin";
|
|
137
132
|
export { SwcCssMinimizerRspackPlugin } from "./builtin-plugin";
|
|
138
133
|
export { CopyRspackPlugin } from "./builtin-plugin";
|
|
134
|
+
export type { CopyRspackPluginOptions } from "./builtin-plugin";
|
|
139
135
|
export { SourceMapDevToolPlugin } from "./builtin-plugin";
|
|
140
136
|
export { EvalSourceMapDevToolPlugin } from "./builtin-plugin";
|
|
137
|
+
export type { SourceMapDevToolPluginOptions } from "./builtin-plugin";
|
|
141
138
|
export { EvalDevToolModulePlugin } from "./builtin-plugin";
|
|
139
|
+
export type { EvalDevToolModulePluginOptions } from "./builtin-plugin";
|
|
142
140
|
export { CssExtractRspackPlugin } from "./builtin-plugin";
|
|
143
|
-
export type {
|
|
141
|
+
export type { SwcLoaderOptions, SwcLoaderEnvConfig, SwcLoaderJscConfig, SwcLoaderModuleConfig, SwcLoaderParserConfig, SwcLoaderEsParserConfig, SwcLoaderTsParserConfig, SwcLoaderTransformConfig } from "./builtin-loader/swc/index";
|
package/dist/exports.js
CHANGED
|
@@ -26,27 +26,27 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.CssExtractRspackPlugin = exports.EvalDevToolModulePlugin = exports.EvalSourceMapDevToolPlugin = exports.SourceMapDevToolPlugin = exports.CopyRspackPlugin = exports.SwcCssMinimizerRspackPlugin = exports.SwcJsMinimizerRspackPlugin = exports.HtmlRspackPlugin = exports.sharing = exports.container = exports.optimize = exports.webworker = exports.javascript = exports.wasm = exports.library = exports.electron = exports.node = exports.NormalModuleReplacementPlugin = exports.
|
|
29
|
+
exports.CssExtractRspackPlugin = exports.EvalDevToolModulePlugin = exports.EvalSourceMapDevToolPlugin = exports.SourceMapDevToolPlugin = exports.CopyRspackPlugin = exports.SwcCssMinimizerRspackPlugin = exports.SwcJsMinimizerRspackPlugin = exports.HtmlRspackPlugin = exports.sharing = exports.container = exports.optimize = exports.webworker = exports.javascript = exports.wasm = exports.library = exports.electron = exports.node = exports.NormalModuleReplacementPlugin = exports.EnvironmentPlugin = exports.LoaderTargetPlugin = exports.LoaderOptionsPlugin = exports.HotModuleReplacementPlugin = exports.ExternalsPlugin = exports.DynamicEntryPlugin = exports.EntryPlugin = exports.ProgressPlugin = exports.DefinePlugin = exports.ProvidePlugin = exports.IgnorePlugin = exports.BannerPlugin = exports.EntryOptionPlugin = exports.experimental_cleanupGlobalTrace = exports.experimental_registerGlobalTrace = exports.util = exports.config = exports.sources = exports.WebpackError = exports.Template = exports.ModuleFilenameHelpers = exports.NormalModule = exports.MultiStats = exports.Stats = exports.RuntimeGlobals = exports.WebpackOptionsApply = exports.RspackOptionsApply = exports.MultiCompiler = exports.Compilation = exports.Compiler = exports.rspackVersion = exports.version = void 0;
|
|
30
30
|
const { version: rspackVersion, webpackVersion } = require("../package.json");
|
|
31
31
|
exports.rspackVersion = rspackVersion;
|
|
32
32
|
exports.version = webpackVersion;
|
|
33
|
-
var Compilation_1 = require("./Compilation");
|
|
34
|
-
Object.defineProperty(exports, "Compilation", { enumerable: true, get: function () { return Compilation_1.Compilation; } });
|
|
35
33
|
var Compiler_1 = require("./Compiler");
|
|
36
34
|
Object.defineProperty(exports, "Compiler", { enumerable: true, get: function () { return Compiler_1.Compiler; } });
|
|
35
|
+
var Compilation_1 = require("./Compilation");
|
|
36
|
+
Object.defineProperty(exports, "Compilation", { enumerable: true, get: function () { return Compilation_1.Compilation; } });
|
|
37
37
|
var MultiCompiler_1 = require("./MultiCompiler");
|
|
38
38
|
Object.defineProperty(exports, "MultiCompiler", { enumerable: true, get: function () { return MultiCompiler_1.MultiCompiler; } });
|
|
39
39
|
const rspackOptionsApply_1 = require("./rspackOptionsApply");
|
|
40
40
|
Object.defineProperty(exports, "RspackOptionsApply", { enumerable: true, get: function () { return rspackOptionsApply_1.RspackOptionsApply; } });
|
|
41
41
|
Object.defineProperty(exports, "WebpackOptionsApply", { enumerable: true, get: function () { return rspackOptionsApply_1.RspackOptionsApply; } });
|
|
42
|
-
var MultiStats_1 = require("./MultiStats");
|
|
43
|
-
Object.defineProperty(exports, "MultiStats", { enumerable: true, get: function () { return MultiStats_1.MultiStats; } });
|
|
44
|
-
var NormalModule_1 = require("./NormalModule");
|
|
45
|
-
Object.defineProperty(exports, "NormalModule", { enumerable: true, get: function () { return NormalModule_1.NormalModule; } });
|
|
46
42
|
var RuntimeGlobals_1 = require("./RuntimeGlobals");
|
|
47
43
|
Object.defineProperty(exports, "RuntimeGlobals", { enumerable: true, get: function () { return RuntimeGlobals_1.RuntimeGlobals; } });
|
|
48
44
|
var Stats_1 = require("./Stats");
|
|
49
45
|
Object.defineProperty(exports, "Stats", { enumerable: true, get: function () { return Stats_1.Stats; } });
|
|
46
|
+
var MultiStats_1 = require("./MultiStats");
|
|
47
|
+
Object.defineProperty(exports, "MultiStats", { enumerable: true, get: function () { return MultiStats_1.MultiStats; } });
|
|
48
|
+
var NormalModule_1 = require("./NormalModule");
|
|
49
|
+
Object.defineProperty(exports, "NormalModule", { enumerable: true, get: function () { return NormalModule_1.NormalModule; } });
|
|
50
50
|
// API extractor not working with some re-exports, see: https://github.com/microsoft/fluentui/issues/20694
|
|
51
51
|
const ModuleFilenameHelpers = __importStar(require("./lib/ModuleFilenameHelpers"));
|
|
52
52
|
exports.ModuleFilenameHelpers = ModuleFilenameHelpers;
|
|
@@ -63,14 +63,15 @@ exports.config = {
|
|
|
63
63
|
getNormalizedWebpackOptions: config_1.getNormalizedRspackOptions,
|
|
64
64
|
applyWebpackOptionsDefaults: config_1.applyRspackOptionsDefaults
|
|
65
65
|
};
|
|
66
|
-
const cleverMerge_1 = require("./util/cleverMerge");
|
|
67
66
|
const createHash_1 = require("./util/createHash");
|
|
67
|
+
const cleverMerge_1 = require("./util/cleverMerge");
|
|
68
68
|
exports.util = { createHash: createHash_1.createHash, cleverMerge: cleverMerge_1.cachedCleverMerge };
|
|
69
|
-
var EntryOptionPlugin_1 = require("./lib/EntryOptionPlugin");
|
|
70
|
-
Object.defineProperty(exports, "EntryOptionPlugin", { enumerable: true, get: function () { return __importDefault(EntryOptionPlugin_1).default; } });
|
|
71
69
|
var binding_1 = require("@rspack/binding");
|
|
72
|
-
Object.defineProperty(exports, "experimental_cleanupGlobalTrace", { enumerable: true, get: function () { return binding_1.cleanupGlobalTrace; } });
|
|
73
70
|
Object.defineProperty(exports, "experimental_registerGlobalTrace", { enumerable: true, get: function () { return binding_1.registerGlobalTrace; } });
|
|
71
|
+
Object.defineProperty(exports, "experimental_cleanupGlobalTrace", { enumerable: true, get: function () { return binding_1.cleanupGlobalTrace; } });
|
|
72
|
+
var EntryOptionPlugin_1 = require("./lib/EntryOptionPlugin");
|
|
73
|
+
Object.defineProperty(exports, "EntryOptionPlugin", { enumerable: true, get: function () { return __importDefault(EntryOptionPlugin_1).default; } });
|
|
74
|
+
///// Internal Plugins /////
|
|
74
75
|
var builtin_plugin_1 = require("./builtin-plugin");
|
|
75
76
|
Object.defineProperty(exports, "BannerPlugin", { enumerable: true, get: function () { return builtin_plugin_1.BannerPlugin; } });
|
|
76
77
|
var builtin_plugin_2 = require("./builtin-plugin");
|
|
@@ -89,17 +90,17 @@ var builtin_plugin_8 = require("./builtin-plugin");
|
|
|
89
90
|
Object.defineProperty(exports, "ExternalsPlugin", { enumerable: true, get: function () { return builtin_plugin_8.ExternalsPlugin; } });
|
|
90
91
|
var builtin_plugin_9 = require("./builtin-plugin");
|
|
91
92
|
Object.defineProperty(exports, "HotModuleReplacementPlugin", { enumerable: true, get: function () { return builtin_plugin_9.HotModuleReplacementPlugin; } });
|
|
92
|
-
var EnvironmentPlugin_1 = require("./lib/EnvironmentPlugin");
|
|
93
|
-
Object.defineProperty(exports, "EnvironmentPlugin", { enumerable: true, get: function () { return EnvironmentPlugin_1.EnvironmentPlugin; } });
|
|
94
93
|
var LoaderOptionsPlugin_1 = require("./lib/LoaderOptionsPlugin");
|
|
95
94
|
Object.defineProperty(exports, "LoaderOptionsPlugin", { enumerable: true, get: function () { return LoaderOptionsPlugin_1.LoaderOptionsPlugin; } });
|
|
96
95
|
var LoaderTargetPlugin_1 = require("./lib/LoaderTargetPlugin");
|
|
97
96
|
Object.defineProperty(exports, "LoaderTargetPlugin", { enumerable: true, get: function () { return LoaderTargetPlugin_1.LoaderTargetPlugin; } });
|
|
97
|
+
var EnvironmentPlugin_1 = require("./lib/EnvironmentPlugin");
|
|
98
|
+
Object.defineProperty(exports, "EnvironmentPlugin", { enumerable: true, get: function () { return EnvironmentPlugin_1.EnvironmentPlugin; } });
|
|
98
99
|
var NormalModuleReplacementPlugin_1 = require("./lib/NormalModuleReplacementPlugin");
|
|
99
100
|
Object.defineProperty(exports, "NormalModuleReplacementPlugin", { enumerable: true, get: function () { return NormalModuleReplacementPlugin_1.NormalModuleReplacementPlugin; } });
|
|
101
|
+
const NodeTemplatePlugin_1 = __importDefault(require("./node/NodeTemplatePlugin"));
|
|
100
102
|
const builtin_plugin_10 = require("./builtin-plugin");
|
|
101
103
|
const NodeEnvironmentPlugin_1 = __importDefault(require("./node/NodeEnvironmentPlugin"));
|
|
102
|
-
const NodeTemplatePlugin_1 = __importDefault(require("./node/NodeTemplatePlugin"));
|
|
103
104
|
exports.node = {
|
|
104
105
|
NodeTargetPlugin: builtin_plugin_10.NodeTargetPlugin,
|
|
105
106
|
NodeTemplatePlugin: NodeTemplatePlugin_1.default,
|
|
@@ -133,14 +134,15 @@ exports.container = {
|
|
|
133
134
|
ModuleFederationPlugin: ModuleFederationPlugin_1.ModuleFederationPlugin,
|
|
134
135
|
ModuleFederationPluginV1: ModuleFederationPluginV1_1.ModuleFederationPluginV1
|
|
135
136
|
};
|
|
136
|
-
const ConsumeSharedPlugin_1 = require("./sharing/ConsumeSharedPlugin");
|
|
137
137
|
const ProvideSharedPlugin_1 = require("./sharing/ProvideSharedPlugin");
|
|
138
|
+
const ConsumeSharedPlugin_1 = require("./sharing/ConsumeSharedPlugin");
|
|
138
139
|
const SharePlugin_1 = require("./sharing/SharePlugin");
|
|
139
140
|
exports.sharing = {
|
|
140
141
|
ProvideSharedPlugin: ProvideSharedPlugin_1.ProvideSharedPlugin,
|
|
141
142
|
ConsumeSharedPlugin: ConsumeSharedPlugin_1.ConsumeSharedPlugin,
|
|
142
143
|
SharePlugin: SharePlugin_1.SharePlugin
|
|
143
144
|
};
|
|
145
|
+
///// Rspack Postfixed Internal Plugins /////
|
|
144
146
|
var builtin_plugin_19 = require("./builtin-plugin");
|
|
145
147
|
Object.defineProperty(exports, "HtmlRspackPlugin", { enumerable: true, get: function () { return builtin_plugin_19.HtmlRspackPlugin; } });
|
|
146
148
|
var builtin_plugin_20 = require("./builtin-plugin");
|
package/dist/fileSystem.d.ts
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
mkdir: (name: string) => Promise<void> | void;
|
|
8
|
-
mkdirp: (name: string) => Promise<string | void> | string | void;
|
|
9
|
-
removeDirAll: (name: string) => Promise<string | void> | string | void;
|
|
10
|
-
constructor(fs?: OutputFileSystem);
|
|
11
|
-
static __into_binding(fs?: OutputFileSystem): ThreadsafeWritableNodeFS;
|
|
1
|
+
export interface ThreadsafeWritableNodeFS {
|
|
2
|
+
writeFile: (...args: any[]) => any;
|
|
3
|
+
removeFile: (...args: any[]) => any;
|
|
4
|
+
mkdir: (...args: any[]) => any;
|
|
5
|
+
mkdirp: (...args: any[]) => any;
|
|
6
|
+
removeDirAll: (...args: any[]) => any;
|
|
12
7
|
}
|
|
13
|
-
|
|
8
|
+
declare function createThreadsafeNodeFSFromRaw(fs: typeof import("fs")): ThreadsafeWritableNodeFS;
|
|
9
|
+
export { createThreadsafeNodeFSFromRaw };
|
package/dist/fileSystem.js
CHANGED
|
@@ -3,32 +3,55 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.createThreadsafeNodeFSFromRaw = void 0;
|
|
7
7
|
const util_1 = __importDefault(require("util"));
|
|
8
|
-
const
|
|
8
|
+
const path_1 = require("path");
|
|
9
9
|
const memoize_1 = require("./util/memoize");
|
|
10
|
-
|
|
11
|
-
writeFile()
|
|
12
|
-
removeFile()
|
|
13
|
-
mkdir()
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
10
|
+
function createThreadsafeNodeFSFromRaw(fs) {
|
|
11
|
+
let writeFile = (0, memoize_1.memoizeFn)(() => util_1.default.promisify(fs.writeFile.bind(fs)));
|
|
12
|
+
let removeFile = (0, memoize_1.memoizeFn)(() => util_1.default.promisify(fs.unlink.bind(fs)));
|
|
13
|
+
let mkdir = (0, memoize_1.memoizeFn)(() => util_1.default.promisify(fs.mkdir.bind(fs)));
|
|
14
|
+
return {
|
|
15
|
+
writeFile,
|
|
16
|
+
removeFile,
|
|
17
|
+
mkdir,
|
|
18
|
+
mkdirp: dir => {
|
|
19
|
+
return mkdir(dir, {
|
|
20
|
+
recursive: true
|
|
21
|
+
});
|
|
22
|
+
},
|
|
23
|
+
removeDirAll: dir => {
|
|
24
|
+
// memfs don't support rmSync
|
|
25
|
+
return rmrfBuild(fs)(dir);
|
|
23
26
|
}
|
|
24
|
-
|
|
25
|
-
this.removeFile = (0, memoize_1.memoizeFn)(() => util_1.default.promisify(fs.unlink.bind(fs)));
|
|
26
|
-
this.mkdir = (0, memoize_1.memoizeFn)(() => util_1.default.promisify(fs.mkdir.bind(fs)));
|
|
27
|
-
this.mkdirp = (0, memoize_1.memoizeFn)(() => util_1.default.promisify(fs_1.mkdirp.bind(null, fs)));
|
|
28
|
-
this.removeDirAll = (0, memoize_1.memoizeFn)(() => util_1.default.promisify(fs_1.rmrf.bind(null, fs)));
|
|
29
|
-
}
|
|
30
|
-
static __into_binding(fs) {
|
|
31
|
-
return new this(fs);
|
|
32
|
-
}
|
|
27
|
+
};
|
|
33
28
|
}
|
|
34
|
-
exports.
|
|
29
|
+
exports.createThreadsafeNodeFSFromRaw = createThreadsafeNodeFSFromRaw;
|
|
30
|
+
const rmrfBuild = (fs) => {
|
|
31
|
+
async function exists(path) {
|
|
32
|
+
try {
|
|
33
|
+
await util_1.default.promisify(fs.access.bind(fs))(path);
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
36
|
+
catch (_a) {
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
const rmrf = async (dir) => {
|
|
41
|
+
if (await exists(dir)) {
|
|
42
|
+
const files = await util_1.default.promisify(fs.readdir.bind(fs))(dir);
|
|
43
|
+
await Promise.all(files
|
|
44
|
+
.map(f => (0, path_1.join)(dir, f))
|
|
45
|
+
.map(async (filePath) => {
|
|
46
|
+
if ((await util_1.default.promisify(fs.lstat.bind(fs))(filePath)).isDirectory()) {
|
|
47
|
+
await rmrf(filePath);
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
await util_1.default.promisify(fs.unlink.bind(fs))(filePath);
|
|
51
|
+
}
|
|
52
|
+
}));
|
|
53
|
+
await util_1.default.promisify(fs.rmdir.bind(fs))(dir);
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
return rmrf;
|
|
57
|
+
};
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -27,8 +27,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
29
|
exports.rspack = void 0;
|
|
30
|
-
const rspackExports = __importStar(require("./exports"));
|
|
31
30
|
const rspack_1 = require("./rspack");
|
|
31
|
+
const rspackExports = __importStar(require("./exports"));
|
|
32
32
|
const fn = Object.assign(rspack_1.rspack, rspackExports);
|
|
33
33
|
fn.rspack = fn;
|
|
34
34
|
fn.webpack = fn;
|
|
@@ -11,12 +11,12 @@
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.runLoaders = exports.parsePathQueryFragment = void 0;
|
|
13
13
|
const webpack_sources_1 = require("webpack-sources");
|
|
14
|
-
const adapterRuleUse_1 = require("../config/adapterRuleUse");
|
|
15
14
|
const NormalModule_1 = require("../NormalModule");
|
|
15
|
+
const adapterRuleUse_1 = require("../config/adapterRuleUse");
|
|
16
16
|
const util_1 = require("../util");
|
|
17
|
-
const createHash_1 = require("../util/createHash");
|
|
18
17
|
const identifier_1 = require("../util/identifier");
|
|
19
18
|
const memoize_1 = require("../util/memoize");
|
|
19
|
+
const createHash_1 = require("../util/createHash");
|
|
20
20
|
const loadLoader = require("./loadLoader");
|
|
21
21
|
const querystring = require("node:querystring");
|
|
22
22
|
const PATH_QUERY_FRAGMENT_REGEXP = /^((?:\0.|[^?#\0])*)(\?(?:\0.|[^#\0])*)?(#.*)?$/;
|
|
@@ -151,7 +151,7 @@ async function runLoaders(compiler, rawContext) {
|
|
|
151
151
|
"When using a function for Rule.use in config you need to " +
|
|
152
152
|
"provide an 'ident' property for referenced loader options.");
|
|
153
153
|
}
|
|
154
|
-
obj.options = compiler.
|
|
154
|
+
obj.options = compiler.ruleSet.references.get(ident);
|
|
155
155
|
if (obj.options === undefined) {
|
|
156
156
|
throw new Error(`Invalid ident("${ident}") is provided by referenced loader`);
|
|
157
157
|
}
|
|
@@ -201,7 +201,7 @@ async function runLoaders(compiler, rawContext) {
|
|
|
201
201
|
if (!callback) {
|
|
202
202
|
return new Promise((resolve, reject) => {
|
|
203
203
|
compiler
|
|
204
|
-
.
|
|
204
|
+
.compilation.__internal_getInner()
|
|
205
205
|
.importModule(request, options.publicPath, options.baseUri, rawContext._moduleIdentifier, loaderContext.context, (err, res) => {
|
|
206
206
|
if (err)
|
|
207
207
|
reject(err);
|
|
@@ -225,7 +225,7 @@ async function runLoaders(compiler, rawContext) {
|
|
|
225
225
|
});
|
|
226
226
|
}
|
|
227
227
|
return compiler
|
|
228
|
-
.
|
|
228
|
+
.compilation.__internal_getInner()
|
|
229
229
|
.importModule(request, options.publicPath, options.baseUri, rawContext._moduleIdentifier, loaderContext.context, (err, res) => {
|
|
230
230
|
if (err) {
|
|
231
231
|
callback(err, undefined);
|
|
@@ -386,22 +386,22 @@ async function runLoaders(compiler, rawContext) {
|
|
|
386
386
|
};
|
|
387
387
|
};
|
|
388
388
|
loaderContext.getLogger = function getLogger(name) {
|
|
389
|
-
return compiler.
|
|
389
|
+
return compiler.compilation.getLogger([name, resource].filter(Boolean).join("|"));
|
|
390
390
|
};
|
|
391
391
|
loaderContext.rootContext = compiler.context;
|
|
392
392
|
loaderContext.emitError = function emitError(error) {
|
|
393
393
|
const title = "Module Error";
|
|
394
394
|
const message = error instanceof Error ? (0, util_1.concatErrorMsgAndStack)(error) : error;
|
|
395
|
-
compiler.
|
|
395
|
+
compiler.compilation.pushDiagnostic("error", title, `${message}\n(from: ${(0, util_1.stringifyLoaderObject)(loaderContext.loaders[loaderContext.loaderIndex])})`);
|
|
396
396
|
};
|
|
397
397
|
loaderContext.emitWarning = function emitWarning(warning) {
|
|
398
398
|
const title = "Module Warning";
|
|
399
399
|
const message = warning instanceof Error ? (0, util_1.concatErrorMsgAndStack)(warning) : warning;
|
|
400
|
-
compiler.
|
|
400
|
+
compiler.compilation.pushDiagnostic("warning", title, `${message}\n(from: ${(0, util_1.stringifyLoaderObject)(loaderContext.loaders[loaderContext.loaderIndex])})`);
|
|
401
401
|
};
|
|
402
402
|
loaderContext.__internal__pushNativeDiagnostics =
|
|
403
403
|
function __internal__pushNativeDiagnostics(diagnostics) {
|
|
404
|
-
compiler.
|
|
404
|
+
compiler.compilation.__internal__pushNativeDiagnostics(diagnostics);
|
|
405
405
|
};
|
|
406
406
|
loaderContext.emitFile = function emitFile(name, content, sourceMap, assetInfo) {
|
|
407
407
|
let source;
|
|
@@ -425,7 +425,7 @@ async function runLoaders(compiler, rawContext) {
|
|
|
425
425
|
}
|
|
426
426
|
assetFilenames.push(name),
|
|
427
427
|
// @ts-expect-error
|
|
428
|
-
compiler.
|
|
428
|
+
compiler.compilation.emitAsset(name, source, assetInfo);
|
|
429
429
|
};
|
|
430
430
|
loaderContext.fs = compiler.inputFileSystem;
|
|
431
431
|
const getAbsolutify = (0, memoize_1.memoize)(() => identifier_1.absolutify.bindCache(compiler.root));
|
|
@@ -444,7 +444,7 @@ async function runLoaders(compiler, rawContext) {
|
|
|
444
444
|
: getContextify()(context, request);
|
|
445
445
|
},
|
|
446
446
|
createHash: type => {
|
|
447
|
-
return (0, createHash_1.createHash)(type || compiler.
|
|
447
|
+
return (0, createHash_1.createHash)(type || compiler.compilation.outputOptions.hashFunction);
|
|
448
448
|
}
|
|
449
449
|
};
|
|
450
450
|
loaderContext.addBuildDependency = function addBuildDependency(file) {
|
|
@@ -477,7 +477,7 @@ async function runLoaders(compiler, rawContext) {
|
|
|
477
477
|
return missingDependencies.slice();
|
|
478
478
|
};
|
|
479
479
|
loaderContext._compiler = compiler;
|
|
480
|
-
loaderContext._compilation = compiler.
|
|
480
|
+
loaderContext._compilation = compiler.compilation;
|
|
481
481
|
loaderContext.getOptions = function () {
|
|
482
482
|
const loader = getCurrentLoader(loaderContext);
|
|
483
483
|
let options = loader === null || loader === void 0 ? void 0 : loader.options;
|
|
@@ -500,7 +500,7 @@ async function runLoaders(compiler, rawContext) {
|
|
|
500
500
|
}
|
|
501
501
|
return options;
|
|
502
502
|
};
|
|
503
|
-
let compilation = compiler.
|
|
503
|
+
let compilation = compiler.compilation;
|
|
504
504
|
let step = 0;
|
|
505
505
|
while (compilation) {
|
|
506
506
|
NormalModule_1.NormalModule.getCompilationHooks(compilation).loader.call(loaderContext);
|
package/dist/logging/Logger.d.ts
CHANGED
|
@@ -30,7 +30,7 @@ export type LogTypeEnum = (typeof LogType)[keyof typeof LogType];
|
|
|
30
30
|
declare const LOG_SYMBOL: unique symbol;
|
|
31
31
|
declare const TIMERS_SYMBOL: unique symbol;
|
|
32
32
|
declare const TIMERS_AGGREGATES_SYMBOL: unique symbol;
|
|
33
|
-
export type LogFunction = (type: LogTypeEnum, args
|
|
33
|
+
export type LogFunction = (type: LogTypeEnum, args?: any[]) => void;
|
|
34
34
|
export type GetChildLogger = (name: string | (() => string)) => Logger;
|
|
35
35
|
export declare class Logger {
|
|
36
36
|
getChildLogger: GetChildLogger;
|