@rspack/core 0.5.6 → 0.5.7-canary-3320ea8-20240312032922
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/ChunkGroup.d.ts +3 -1
- package/dist/ChunkGroup.js +6 -0
- package/dist/Compilation.d.ts +4 -5
- package/dist/Compilation.js +37 -52
- package/dist/Compiler.js +55 -53
- package/dist/Entrypoint.d.ts +8 -0
- package/dist/Entrypoint.js +21 -0
- package/dist/config/adapter.js +10 -3
- package/dist/config/adapterRuleUse.d.ts +1 -1
- package/dist/config/normalization.d.ts +2 -1
- package/dist/config/normalization.js +1 -0
- package/dist/config/zod.d.ts +21 -0
- package/dist/config/zod.js +9 -2
- package/dist/exports.d.ts +4 -0
- package/dist/lite-tapable/index.d.ts +34 -24
- package/dist/lite-tapable/index.js +173 -75
- package/dist/loader-runner/index.js +7 -5
- package/dist/stats/DefaultStatsFactoryPlugin.js +3 -0
- package/dist/stats/statsFactoryUtils.d.ts +2 -1
- package/dist/util/fake.d.ts +0 -35
- package/dist/util/fake.js +1 -95
- package/package.json +7 -6
package/dist/ChunkGroup.d.ts
CHANGED
|
@@ -2,9 +2,11 @@ import { type JsChunkGroup, type JsCompilation } from "@rspack/binding";
|
|
|
2
2
|
export declare class ChunkGroup {
|
|
3
3
|
#private;
|
|
4
4
|
static __from_binding(chunk: JsChunkGroup, compilation: JsCompilation): ChunkGroup;
|
|
5
|
-
|
|
5
|
+
protected constructor(inner: JsChunkGroup, compilation: JsCompilation);
|
|
6
6
|
getFiles(): string[];
|
|
7
7
|
getParents(): ChunkGroup[];
|
|
8
8
|
get index(): number | undefined;
|
|
9
9
|
get name(): string | undefined;
|
|
10
|
+
__internal_inner_ukey(): number;
|
|
11
|
+
__internal_inner_compilation(): JsCompilation;
|
|
10
12
|
}
|
package/dist/ChunkGroup.js
CHANGED
|
@@ -45,6 +45,12 @@ class ChunkGroup {
|
|
|
45
45
|
get name() {
|
|
46
46
|
return __classPrivateFieldGet(this, _ChunkGroup_inner, "f").name;
|
|
47
47
|
}
|
|
48
|
+
__internal_inner_ukey() {
|
|
49
|
+
return __classPrivateFieldGet(this, _ChunkGroup_inner, "f").__inner_ukey;
|
|
50
|
+
}
|
|
51
|
+
__internal_inner_compilation() {
|
|
52
|
+
return __classPrivateFieldGet(this, _ChunkGroup_inner_compilation, "f");
|
|
53
|
+
}
|
|
48
54
|
}
|
|
49
55
|
exports.ChunkGroup = ChunkGroup;
|
|
50
56
|
_ChunkGroup_inner = new WeakMap(), _ChunkGroup_inner_compilation = new WeakMap();
|
package/dist/Compilation.d.ts
CHANGED
|
@@ -12,21 +12,21 @@ import * as tapable from "tapable";
|
|
|
12
12
|
import { Source } from "webpack-sources";
|
|
13
13
|
import type { ExternalObject, JsAssetInfo, JsChunk, JsCompatSource, JsCompilation, JsModule, JsRuntimeModule, JsStatsChunk, JsStatsError, PathData } from "@rspack/binding";
|
|
14
14
|
import { RspackOptionsNormalized, StatsOptions, OutputNormalized, StatsValue, RspackPluginInstance } from "./config";
|
|
15
|
+
import * as liteTapable from "./lite-tapable";
|
|
15
16
|
import { ContextModuleFactory } from "./ContextModuleFactory";
|
|
16
17
|
import ResolverFactory from "./ResolverFactory";
|
|
17
|
-
import { ChunkGroup } from "./ChunkGroup";
|
|
18
18
|
import { Compiler } from "./Compiler";
|
|
19
19
|
import { Logger } from "./logging/Logger";
|
|
20
20
|
import { NormalModuleFactory } from "./NormalModuleFactory";
|
|
21
21
|
import { Stats } from "./Stats";
|
|
22
22
|
import { StatsFactory } from "./stats/StatsFactory";
|
|
23
23
|
import { StatsPrinter } from "./stats/StatsPrinter";
|
|
24
|
-
import { createFakeProcessAssetsHook } from "./util/fake";
|
|
25
24
|
import { NormalizedJsModule } from "./util/normalization";
|
|
26
25
|
import MergeCaller from "./util/MergeCaller";
|
|
27
26
|
import { Chunk } from "./Chunk";
|
|
28
27
|
import { CodeGenerationResult } from "./Module";
|
|
29
28
|
import { ChunkGraph } from "./ChunkGraph";
|
|
29
|
+
import { Entrypoint } from "./Entrypoint";
|
|
30
30
|
export type AssetInfo = Partial<JsAssetInfo> & Record<string, any>;
|
|
31
31
|
export type Assets = Record<string, Source>;
|
|
32
32
|
export interface Asset {
|
|
@@ -62,7 +62,7 @@ type CreateStatsOptionsContext = KnownCreateStatsOptionsContext & Record<string,
|
|
|
62
62
|
export declare class Compilation {
|
|
63
63
|
#private;
|
|
64
64
|
hooks: {
|
|
65
|
-
processAssets:
|
|
65
|
+
processAssets: liteTapable.AsyncSeriesHook<Assets>;
|
|
66
66
|
afterProcessAssets: tapable.SyncHook<Assets>;
|
|
67
67
|
childCompiler: tapable.SyncHook<[Compiler, string, number]>;
|
|
68
68
|
log: tapable.SyncBailHook<[string, LogEntry], true>;
|
|
@@ -125,7 +125,7 @@ export declare class Compilation {
|
|
|
125
125
|
/**
|
|
126
126
|
* Get a map of all entrypoints.
|
|
127
127
|
*/
|
|
128
|
-
get entrypoints(): ReadonlyMap<string,
|
|
128
|
+
get entrypoints(): ReadonlyMap<string, Entrypoint>;
|
|
129
129
|
getCache(name: string): import("./lib/CacheFacade");
|
|
130
130
|
createStatsOptions(optionsOrPreset: StatsValue | undefined, context?: CreateStatsOptionsContext): StatsOptions;
|
|
131
131
|
createStatsFactory(options: StatsOptions): StatsFactory;
|
|
@@ -328,6 +328,5 @@ export declare class Compilation {
|
|
|
328
328
|
static PROCESS_ASSETS_STAGE_OPTIMIZE_TRANSFER: number;
|
|
329
329
|
static PROCESS_ASSETS_STAGE_ANALYSE: number;
|
|
330
330
|
static PROCESS_ASSETS_STAGE_REPORT: number;
|
|
331
|
-
__internal_getProcessAssetsHookByStage(stage: number): tapable.AsyncSeriesHook<Assets, tapable.UnsetAdditionalOptions>;
|
|
332
331
|
}
|
|
333
332
|
export {};
|
package/dist/Compilation.js
CHANGED
|
@@ -49,7 +49,7 @@ exports.Compilation = void 0;
|
|
|
49
49
|
* https://github.com/webpack/webpack/blob/main/LICENSE
|
|
50
50
|
*/
|
|
51
51
|
const tapable = __importStar(require("tapable"));
|
|
52
|
-
const
|
|
52
|
+
const liteTapable = __importStar(require("./lite-tapable"));
|
|
53
53
|
const ErrorHelpers_1 = __importDefault(require("./ErrorHelpers"));
|
|
54
54
|
const Logger_1 = require("./logging/Logger");
|
|
55
55
|
const NormalModule_1 = require("./NormalModule");
|
|
@@ -64,6 +64,7 @@ const MergeCaller_1 = __importDefault(require("./util/MergeCaller"));
|
|
|
64
64
|
const memoize_1 = require("./util/memoize");
|
|
65
65
|
const Chunk_1 = require("./Chunk");
|
|
66
66
|
const ChunkGraph_1 = require("./ChunkGraph");
|
|
67
|
+
const Entrypoint_1 = require("./Entrypoint");
|
|
67
68
|
class Compilation {
|
|
68
69
|
constructor(compiler, inner) {
|
|
69
70
|
_Compilation_inner.set(this, void 0);
|
|
@@ -95,13 +96,42 @@ class Compilation {
|
|
|
95
96
|
this.name = undefined;
|
|
96
97
|
this.startTime = undefined;
|
|
97
98
|
this.endTime = undefined;
|
|
98
|
-
const
|
|
99
|
+
const processAssetsHook = new liteTapable.AsyncSeriesHook([
|
|
100
|
+
"assets"
|
|
101
|
+
]);
|
|
102
|
+
const createProcessAssetsHook = (name, stage, getArgs, code) => {
|
|
103
|
+
const errorMessage = (reason) => `Can't automatically convert plugin using Compilation.hooks.${name} to Compilation.hooks.processAssets because ${reason}.
|
|
104
|
+
BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a single Compilation.hooks.processAssets hook.`;
|
|
105
|
+
const getOptions = (options) => {
|
|
106
|
+
if (typeof options === "string")
|
|
107
|
+
options = { name: options };
|
|
108
|
+
if (options.stage) {
|
|
109
|
+
throw new Error(errorMessage("it's using the 'stage' option"));
|
|
110
|
+
}
|
|
111
|
+
return { ...options, stage: stage };
|
|
112
|
+
};
|
|
113
|
+
return Object.freeze({
|
|
114
|
+
name,
|
|
115
|
+
intercept() {
|
|
116
|
+
throw new Error(errorMessage("it's using 'intercept'"));
|
|
117
|
+
},
|
|
118
|
+
tap: (options, fn) => {
|
|
119
|
+
processAssetsHook.tap(getOptions(options), () => fn(...getArgs()));
|
|
120
|
+
},
|
|
121
|
+
tapAsync: (options, fn) => {
|
|
122
|
+
processAssetsHook.tapAsync(getOptions(options), (assets, callback) => fn(...getArgs(), callback));
|
|
123
|
+
},
|
|
124
|
+
tapPromise: (options, fn) => {
|
|
125
|
+
processAssetsHook.tapPromise(getOptions(options), () => fn(...getArgs()));
|
|
126
|
+
},
|
|
127
|
+
_fakeHook: true
|
|
128
|
+
});
|
|
129
|
+
};
|
|
99
130
|
this.hooks = {
|
|
100
|
-
processAssets:
|
|
131
|
+
processAssets: processAssetsHook,
|
|
101
132
|
afterProcessAssets: new tapable.SyncHook(["assets"]),
|
|
102
|
-
// TODO: webpack 6 deprecate, keep it just for compatibility
|
|
103
133
|
/** @deprecated */
|
|
104
|
-
additionalAssets:
|
|
134
|
+
additionalAssets: createProcessAssetsHook("additionalAssets", Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL, () => []),
|
|
105
135
|
childCompiler: new tapable.SyncHook([
|
|
106
136
|
"childCompiler",
|
|
107
137
|
"compilerName",
|
|
@@ -196,7 +226,7 @@ class Compilation {
|
|
|
196
226
|
get entrypoints() {
|
|
197
227
|
return new Map(Object.entries(__classPrivateFieldGet(this, _Compilation_inner, "f").entrypoints).map(([n, e]) => [
|
|
198
228
|
n,
|
|
199
|
-
|
|
229
|
+
Entrypoint_1.Entrypoint.__from_binding(e, __classPrivateFieldGet(this, _Compilation_inner, "f"))
|
|
200
230
|
]));
|
|
201
231
|
}
|
|
202
232
|
getCache(name) {
|
|
@@ -218,6 +248,7 @@ class Compilation {
|
|
|
218
248
|
options.runtimeModules = optionOrLocalFallback(options.runtimeModules, !context.forToString);
|
|
219
249
|
options.reasons = optionOrLocalFallback(options.reasons, !context.forToString);
|
|
220
250
|
options.usedExports = optionOrLocalFallback(options.usedExports, !context.forToString);
|
|
251
|
+
options.optimizationBailout = optionOrLocalFallback(options.optimizationBailout, !context.forToString);
|
|
221
252
|
options.providedExports = optionOrLocalFallback(options.providedExports, !context.forToString);
|
|
222
253
|
options.entrypoints = optionOrLocalFallback(options.entrypoints, true);
|
|
223
254
|
options.chunkGroups = optionOrLocalFallback(options.chunkGroups, !context.forToString);
|
|
@@ -674,52 +705,6 @@ class Compilation {
|
|
|
674
705
|
}
|
|
675
706
|
seal() { }
|
|
676
707
|
unseal() { }
|
|
677
|
-
__internal_getProcessAssetsHookByStage(stage) {
|
|
678
|
-
if (stage > Compilation.PROCESS_ASSETS_STAGE_REPORT) {
|
|
679
|
-
this.pushDiagnostic("warning", "not supported process_assets_stage", `custom stage for process_assets is not supported yet, so ${stage} is fallback to Compilation.PROCESS_ASSETS_STAGE_REPORT(${Compilation.PROCESS_ASSETS_STAGE_REPORT}) `);
|
|
680
|
-
stage = Compilation.PROCESS_ASSETS_STAGE_REPORT;
|
|
681
|
-
}
|
|
682
|
-
if (stage < Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL) {
|
|
683
|
-
this.pushDiagnostic("warning", "not supported process_assets_stage", `custom stage for process_assets is not supported yet, so ${stage} is fallback to Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL(${Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL}) `);
|
|
684
|
-
stage = Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL;
|
|
685
|
-
}
|
|
686
|
-
switch (stage) {
|
|
687
|
-
case Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL:
|
|
688
|
-
return this.hooks.processAssets.stageAdditional;
|
|
689
|
-
case Compilation.PROCESS_ASSETS_STAGE_PRE_PROCESS:
|
|
690
|
-
return this.hooks.processAssets.stagePreProcess;
|
|
691
|
-
case Compilation.PROCESS_ASSETS_STAGE_DERIVED:
|
|
692
|
-
return this.hooks.processAssets.stageDerived;
|
|
693
|
-
case Compilation.PROCESS_ASSETS_STAGE_ADDITIONS:
|
|
694
|
-
return this.hooks.processAssets.stageAdditions;
|
|
695
|
-
case Compilation.PROCESS_ASSETS_STAGE_NONE:
|
|
696
|
-
return this.hooks.processAssets.stageNone;
|
|
697
|
-
case Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE:
|
|
698
|
-
return this.hooks.processAssets.stageOptimize;
|
|
699
|
-
case Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_COUNT:
|
|
700
|
-
return this.hooks.processAssets.stageOptimizeCount;
|
|
701
|
-
case Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_COMPATIBILITY:
|
|
702
|
-
return this.hooks.processAssets.stageOptimizeCompatibility;
|
|
703
|
-
case Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE:
|
|
704
|
-
return this.hooks.processAssets.stageOptimizeSize;
|
|
705
|
-
case Compilation.PROCESS_ASSETS_STAGE_DEV_TOOLING:
|
|
706
|
-
return this.hooks.processAssets.stageDevTooling;
|
|
707
|
-
case Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_INLINE:
|
|
708
|
-
return this.hooks.processAssets.stageOptimizeInline;
|
|
709
|
-
case Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE:
|
|
710
|
-
return this.hooks.processAssets.stageSummarize;
|
|
711
|
-
case Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_HASH:
|
|
712
|
-
return this.hooks.processAssets.stageOptimizeHash;
|
|
713
|
-
case Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_TRANSFER:
|
|
714
|
-
return this.hooks.processAssets.stageOptimizeTransfer;
|
|
715
|
-
case Compilation.PROCESS_ASSETS_STAGE_ANALYSE:
|
|
716
|
-
return this.hooks.processAssets.stageAnalyse;
|
|
717
|
-
case Compilation.PROCESS_ASSETS_STAGE_REPORT:
|
|
718
|
-
return this.hooks.processAssets.stageReport;
|
|
719
|
-
default:
|
|
720
|
-
throw new Error("processAssets hook uses custom stage number is not supported.");
|
|
721
|
-
}
|
|
722
|
-
}
|
|
723
708
|
}
|
|
724
709
|
_Compilation_inner = new WeakMap();
|
|
725
710
|
Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL = -2000;
|
package/dist/Compiler.js
CHANGED
|
@@ -36,7 +36,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
36
36
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
37
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
38
|
};
|
|
39
|
-
var _Compiler_instances, _Compiler_instance, _Compiler_disabledHooks, _Compiler_moduleExecutionResultsMap, _Compiler_getInstance, _Compiler_updateDisabledHooks, _Compiler_beforeCompile, _Compiler_afterCompile, _Compiler_finishMake, _Compiler_buildModule,
|
|
39
|
+
var _Compiler_instances, _Compiler_instance, _Compiler_disabledHooks, _Compiler_moduleExecutionResultsMap, _Compiler_getInstance, _Compiler_updateDisabledHooks, _Compiler_beforeCompile, _Compiler_afterCompile, _Compiler_finishMake, _Compiler_buildModule, _Compiler_afterProcessAssets, _Compiler_beforeResolve, _Compiler_afterResolve, _Compiler_contextModuleFactoryBeforeResolve, _Compiler_contextModuleFactoryAfterResolve, _Compiler_normalModuleFactoryCreateModule, _Compiler_normalModuleFactoryResolveForScheme, _Compiler_optimizeChunkModules, _Compiler_optimizeTree, _Compiler_optimizeModules, _Compiler_afterOptimizeModules, _Compiler_chunkAsset, _Compiler_finishModules, _Compiler_shouldEmit, _Compiler_emit, _Compiler_assetEmitted, _Compiler_afterEmit, _Compiler_succeedModule, _Compiler_stillValidModule, _Compiler_runtimeModule, _Compiler_executeModule, _Compiler_decorateUpdateDisabledHooks, _Compiler_registerCompilerCompilationTaps, _Compiler_registerCompilerMakeTaps, _Compiler_registerCompilationProcessAssetsTaps, _Compiler_newCompilation;
|
|
40
40
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
41
|
exports.Compiler = void 0;
|
|
42
42
|
const index_1 = require("./index");
|
|
@@ -523,22 +523,6 @@ _Compiler_instance = new WeakMap(), _Compiler_disabledHooks = new WeakMap(), _Co
|
|
|
523
523
|
emit: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_emit).bind(this),
|
|
524
524
|
assetEmitted: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_assetEmitted).bind(this),
|
|
525
525
|
afterEmit: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_afterEmit).bind(this),
|
|
526
|
-
processAssetsStageAdditional: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_processAssets).bind(this, Compilation_1.Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL),
|
|
527
|
-
processAssetsStagePreProcess: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_processAssets).bind(this, Compilation_1.Compilation.PROCESS_ASSETS_STAGE_PRE_PROCESS),
|
|
528
|
-
processAssetsStageDerived: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_processAssets).bind(this, Compilation_1.Compilation.PROCESS_ASSETS_STAGE_DERIVED),
|
|
529
|
-
processAssetsStageAdditions: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_processAssets).bind(this, Compilation_1.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS),
|
|
530
|
-
processAssetsStageNone: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_processAssets).bind(this, Compilation_1.Compilation.PROCESS_ASSETS_STAGE_NONE),
|
|
531
|
-
processAssetsStageOptimize: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_processAssets).bind(this, Compilation_1.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE),
|
|
532
|
-
processAssetsStageOptimizeCount: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_processAssets).bind(this, Compilation_1.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_COUNT),
|
|
533
|
-
processAssetsStageOptimizeCompatibility: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_processAssets).bind(this, Compilation_1.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_COMPATIBILITY),
|
|
534
|
-
processAssetsStageOptimizeSize: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_processAssets).bind(this, Compilation_1.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE),
|
|
535
|
-
processAssetsStageDevTooling: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_processAssets).bind(this, Compilation_1.Compilation.PROCESS_ASSETS_STAGE_DEV_TOOLING),
|
|
536
|
-
processAssetsStageOptimizeInline: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_processAssets).bind(this, Compilation_1.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_INLINE),
|
|
537
|
-
processAssetsStageSummarize: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_processAssets).bind(this, Compilation_1.Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE),
|
|
538
|
-
processAssetsStageOptimizeHash: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_processAssets).bind(this, Compilation_1.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_HASH),
|
|
539
|
-
processAssetsStageOptimizeTransfer: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_processAssets).bind(this, Compilation_1.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_TRANSFER),
|
|
540
|
-
processAssetsStageAnalyse: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_processAssets).bind(this, Compilation_1.Compilation.PROCESS_ASSETS_STAGE_ANALYSE),
|
|
541
|
-
processAssetsStageReport: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_processAssets).bind(this, Compilation_1.Compilation.PROCESS_ASSETS_STAGE_REPORT),
|
|
542
526
|
afterProcessAssets: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_afterProcessAssets).bind(this),
|
|
543
527
|
// `Compilation` should be created with hook `thisCompilation`, and here is the reason:
|
|
544
528
|
// We know that the hook `thisCompilation` will not be called from a child compiler(it doesn't matter whether the child compiler is created on the Rust or the Node side).
|
|
@@ -564,7 +548,8 @@ _Compiler_instance = new WeakMap(), _Compiler_disabledHooks = new WeakMap(), _Co
|
|
|
564
548
|
runtimeModule: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_runtimeModule).bind(this)
|
|
565
549
|
}, {
|
|
566
550
|
registerCompilerCompilationTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_registerCompilerCompilationTaps).bind(this),
|
|
567
|
-
registerCompilerMakeTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_registerCompilerMakeTaps).bind(this)
|
|
551
|
+
registerCompilerMakeTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_registerCompilerMakeTaps).bind(this),
|
|
552
|
+
registerCompilationProcessAssetsTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_registerCompilationProcessAssetsTaps).bind(this)
|
|
568
553
|
}, (0, fileSystem_1.createThreadsafeNodeFSFromRaw)(this.outputFileSystem), loader_runner_1.runLoaders.bind(undefined, this)), "f");
|
|
569
554
|
callback(null, __classPrivateFieldGet(this, _Compiler_instance, "f"));
|
|
570
555
|
}, _Compiler_updateDisabledHooks = function _Compiler_updateDisabledHooks(callback) {
|
|
@@ -578,22 +563,6 @@ _Compiler_instance = new WeakMap(), _Compiler_disabledHooks = new WeakMap(), _Co
|
|
|
578
563
|
emit: this.hooks.emit,
|
|
579
564
|
assetEmitted: this.hooks.assetEmitted,
|
|
580
565
|
afterEmit: this.hooks.afterEmit,
|
|
581
|
-
processAssetsStageAdditional: this.compilation.__internal_getProcessAssetsHookByStage(Compilation_1.Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL),
|
|
582
|
-
processAssetsStagePreProcess: this.compilation.__internal_getProcessAssetsHookByStage(Compilation_1.Compilation.PROCESS_ASSETS_STAGE_PRE_PROCESS),
|
|
583
|
-
processAssetsStageDerived: this.compilation.__internal_getProcessAssetsHookByStage(Compilation_1.Compilation.PROCESS_ASSETS_STAGE_DERIVED),
|
|
584
|
-
processAssetsStageAdditions: this.compilation.__internal_getProcessAssetsHookByStage(Compilation_1.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS),
|
|
585
|
-
processAssetsStageNone: this.compilation.__internal_getProcessAssetsHookByStage(Compilation_1.Compilation.PROCESS_ASSETS_STAGE_NONE),
|
|
586
|
-
processAssetsStageOptimize: this.compilation.__internal_getProcessAssetsHookByStage(Compilation_1.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE),
|
|
587
|
-
processAssetsStageOptimizeCount: this.compilation.__internal_getProcessAssetsHookByStage(Compilation_1.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_COUNT),
|
|
588
|
-
processAssetsStageOptimizeCompatibility: this.compilation.__internal_getProcessAssetsHookByStage(Compilation_1.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_COMPATIBILITY),
|
|
589
|
-
processAssetsStageOptimizeSize: this.compilation.__internal_getProcessAssetsHookByStage(Compilation_1.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE),
|
|
590
|
-
processAssetsStageDevTooling: this.compilation.__internal_getProcessAssetsHookByStage(Compilation_1.Compilation.PROCESS_ASSETS_STAGE_DEV_TOOLING),
|
|
591
|
-
processAssetsStageOptimizeInline: this.compilation.__internal_getProcessAssetsHookByStage(Compilation_1.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_INLINE),
|
|
592
|
-
processAssetsStageSummarize: this.compilation.__internal_getProcessAssetsHookByStage(Compilation_1.Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE),
|
|
593
|
-
processAssetsStageOptimizeHash: this.compilation.__internal_getProcessAssetsHookByStage(Compilation_1.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_HASH),
|
|
594
|
-
processAssetsStageOptimizeTransfer: this.compilation.__internal_getProcessAssetsHookByStage(Compilation_1.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_TRANSFER),
|
|
595
|
-
processAssetsStageAnalyse: this.compilation.__internal_getProcessAssetsHookByStage(Compilation_1.Compilation.PROCESS_ASSETS_STAGE_ANALYSE),
|
|
596
|
-
processAssetsStageReport: this.compilation.__internal_getProcessAssetsHookByStage(Compilation_1.Compilation.PROCESS_ASSETS_STAGE_REPORT),
|
|
597
566
|
afterProcessAssets: this.compilation.hooks.afterProcessAssets,
|
|
598
567
|
optimizeTree: this.compilation.hooks.optimizeTree,
|
|
599
568
|
finishModules: this.compilation.hooks.finishModules,
|
|
@@ -650,11 +619,6 @@ _Compiler_instance = new WeakMap(), _Compiler_disabledHooks = new WeakMap(), _Co
|
|
|
650
619
|
const normalized = (0, normalization_1.normalizeJsModule)(module);
|
|
651
620
|
this.compilation.hooks.buildModule.call(normalized);
|
|
652
621
|
__classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_updateDisabledHooks).call(this);
|
|
653
|
-
}, _Compiler_processAssets = async function _Compiler_processAssets(stage) {
|
|
654
|
-
await this.compilation
|
|
655
|
-
.__internal_getProcessAssetsHookByStage(stage)
|
|
656
|
-
.promise(this.compilation.assets);
|
|
657
|
-
__classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_updateDisabledHooks).call(this);
|
|
658
622
|
}, _Compiler_afterProcessAssets = async function _Compiler_afterProcessAssets() {
|
|
659
623
|
await this.compilation.hooks.afterProcessAssets.promise(this.compilation.assets);
|
|
660
624
|
__classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_updateDisabledHooks).call(this);
|
|
@@ -810,41 +774,79 @@ _Compiler_instance = new WeakMap(), _Compiler_disabledHooks = new WeakMap(), _Co
|
|
|
810
774
|
}
|
|
811
775
|
const executeResult = __webpack_require__(entry);
|
|
812
776
|
__classPrivateFieldGet(this, _Compiler_moduleExecutionResultsMap, "f").set(id, executeResult);
|
|
777
|
+
}, _Compiler_decorateUpdateDisabledHooks = function _Compiler_decorateUpdateDisabledHooks(jsTaps) {
|
|
778
|
+
if (jsTaps.length > 0) {
|
|
779
|
+
const last = jsTaps[jsTaps.length - 1];
|
|
780
|
+
const old = last.function;
|
|
781
|
+
last.function = async () => {
|
|
782
|
+
await old();
|
|
783
|
+
__classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_updateDisabledHooks).call(this);
|
|
784
|
+
};
|
|
785
|
+
}
|
|
813
786
|
}, _Compiler_registerCompilerCompilationTaps = function _Compiler_registerCompilerCompilationTaps(stages) {
|
|
814
787
|
if (!this.hooks.compilation.isUsed())
|
|
815
788
|
return [];
|
|
816
|
-
const breakpoints = [
|
|
789
|
+
const breakpoints = [liteTapable.minStage, ...stages, liteTapable.maxStage];
|
|
817
790
|
const jsTaps = [];
|
|
818
791
|
for (let i = 0; i < breakpoints.length - 1; i++) {
|
|
819
|
-
const
|
|
792
|
+
const from = breakpoints[i];
|
|
793
|
+
const to = breakpoints[i + 1];
|
|
794
|
+
const stageRange = [from, to];
|
|
795
|
+
const queried = this.hooks.compilation.queryStageRange(stageRange);
|
|
796
|
+
if (!queried.isUsed())
|
|
797
|
+
continue;
|
|
820
798
|
jsTaps.push({
|
|
821
|
-
function: (
|
|
822
|
-
|
|
799
|
+
function: () => {
|
|
800
|
+
queried.call(this.compilation, {
|
|
823
801
|
normalModuleFactory: this.compilation.normalModuleFactory
|
|
824
802
|
});
|
|
825
|
-
if (i + 1 >= breakpoints.length - 1)
|
|
826
|
-
__classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_updateDisabledHooks).call(this);
|
|
827
803
|
},
|
|
828
|
-
stage:
|
|
804
|
+
stage: liteTapable.safeStage(from + 1)
|
|
829
805
|
});
|
|
830
806
|
}
|
|
807
|
+
__classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_decorateUpdateDisabledHooks).call(this, jsTaps);
|
|
831
808
|
return jsTaps;
|
|
832
809
|
}, _Compiler_registerCompilerMakeTaps = function _Compiler_registerCompilerMakeTaps(stages) {
|
|
833
810
|
if (!this.hooks.make.isUsed())
|
|
834
811
|
return [];
|
|
835
|
-
const breakpoints = [
|
|
812
|
+
const breakpoints = [liteTapable.minStage, ...stages, liteTapable.maxStage];
|
|
813
|
+
const jsTaps = [];
|
|
814
|
+
for (let i = 0; i < breakpoints.length - 1; i++) {
|
|
815
|
+
const from = breakpoints[i];
|
|
816
|
+
const to = breakpoints[i + 1];
|
|
817
|
+
const stageRange = [from, to];
|
|
818
|
+
const queried = this.hooks.make.queryStageRange(stageRange);
|
|
819
|
+
if (!queried.isUsed())
|
|
820
|
+
continue;
|
|
821
|
+
jsTaps.push({
|
|
822
|
+
function: async () => {
|
|
823
|
+
await queried.promise(this.compilation);
|
|
824
|
+
},
|
|
825
|
+
stage: liteTapable.safeStage(from + 1)
|
|
826
|
+
});
|
|
827
|
+
}
|
|
828
|
+
__classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_decorateUpdateDisabledHooks).call(this, jsTaps);
|
|
829
|
+
return jsTaps;
|
|
830
|
+
}, _Compiler_registerCompilationProcessAssetsTaps = function _Compiler_registerCompilationProcessAssetsTaps(stages) {
|
|
831
|
+
if (!this.compilation.hooks.processAssets.isUsed())
|
|
832
|
+
return [];
|
|
833
|
+
const breakpoints = [liteTapable.minStage, ...stages, liteTapable.maxStage];
|
|
836
834
|
const jsTaps = [];
|
|
837
835
|
for (let i = 0; i < breakpoints.length - 1; i++) {
|
|
838
|
-
const
|
|
836
|
+
const from = breakpoints[i];
|
|
837
|
+
const to = breakpoints[i + 1];
|
|
838
|
+
const stageRange = [from, to];
|
|
839
|
+
const queried = this.compilation.hooks.processAssets.queryStageRange(stageRange);
|
|
840
|
+
if (!queried.isUsed())
|
|
841
|
+
continue;
|
|
839
842
|
jsTaps.push({
|
|
840
|
-
function: async (
|
|
841
|
-
await
|
|
842
|
-
if (i + 1 >= breakpoints.length - 1)
|
|
843
|
-
__classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_updateDisabledHooks).call(this);
|
|
843
|
+
function: async () => {
|
|
844
|
+
await queried.promise(this.compilation.assets);
|
|
844
845
|
},
|
|
845
|
-
stage:
|
|
846
|
+
stage: liteTapable.safeStage(from + 1)
|
|
846
847
|
});
|
|
847
848
|
}
|
|
849
|
+
__classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_decorateUpdateDisabledHooks).call(this, jsTaps);
|
|
848
850
|
return jsTaps;
|
|
849
851
|
}, _Compiler_newCompilation = function _Compiler_newCompilation(native) {
|
|
850
852
|
const compilation = new Compilation_1.Compilation(this, native);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type JsChunkGroup, type JsCompilation } from "@rspack/binding";
|
|
2
|
+
import { ChunkGroup } from "./ChunkGroup";
|
|
3
|
+
import { Chunk } from "./Chunk";
|
|
4
|
+
export declare class Entrypoint extends ChunkGroup {
|
|
5
|
+
static __from_binding(chunk: JsChunkGroup, compilation: JsCompilation): Entrypoint;
|
|
6
|
+
protected constructor(inner: JsChunkGroup, compilation: JsCompilation);
|
|
7
|
+
getRuntimeChunk(): Chunk | null;
|
|
8
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Entrypoint = void 0;
|
|
4
|
+
const binding_1 = require("@rspack/binding");
|
|
5
|
+
const ChunkGroup_1 = require("./ChunkGroup");
|
|
6
|
+
const Chunk_1 = require("./Chunk");
|
|
7
|
+
class Entrypoint extends ChunkGroup_1.ChunkGroup {
|
|
8
|
+
static __from_binding(chunk, compilation) {
|
|
9
|
+
return new Entrypoint(chunk, compilation);
|
|
10
|
+
}
|
|
11
|
+
constructor(inner, compilation) {
|
|
12
|
+
super(inner, compilation);
|
|
13
|
+
}
|
|
14
|
+
getRuntimeChunk() {
|
|
15
|
+
const c = (0, binding_1.__entrypoint_inner_get_runtime_chunk)(this.__internal_inner_ukey(), this.__internal_inner_compilation());
|
|
16
|
+
if (c)
|
|
17
|
+
return Chunk_1.Chunk.__from_binding(c, this.__internal_inner_compilation());
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.Entrypoint = Entrypoint;
|
package/dist/config/adapter.js
CHANGED
|
@@ -64,7 +64,7 @@ function getRawTarget(target) {
|
|
|
64
64
|
}
|
|
65
65
|
return target;
|
|
66
66
|
}
|
|
67
|
-
function
|
|
67
|
+
function getRawExtensionAlias(alias = {}) {
|
|
68
68
|
const entries = Object.entries(alias).map(([key, value]) => {
|
|
69
69
|
if (Array.isArray(value)) {
|
|
70
70
|
return [key, value];
|
|
@@ -75,6 +75,12 @@ function getRawAlias(alias = {}) {
|
|
|
75
75
|
});
|
|
76
76
|
return Object.fromEntries(entries);
|
|
77
77
|
}
|
|
78
|
+
function getRawAlias(alias = {}) {
|
|
79
|
+
return Object.entries(alias).map(([key, value]) => ({
|
|
80
|
+
path: key,
|
|
81
|
+
redirect: Array.isArray(value) ? value : [value]
|
|
82
|
+
}));
|
|
83
|
+
}
|
|
78
84
|
function getRawResolveByDependency(byDependency) {
|
|
79
85
|
if (byDependency === undefined)
|
|
80
86
|
return byDependency;
|
|
@@ -88,7 +94,7 @@ function getRawResolve(resolve) {
|
|
|
88
94
|
...resolve,
|
|
89
95
|
alias: getRawAlias(resolve.alias),
|
|
90
96
|
fallback: getRawAlias(resolve.fallback),
|
|
91
|
-
extensionAlias:
|
|
97
|
+
extensionAlias: getRawExtensionAlias(resolve.extensionAlias),
|
|
92
98
|
tsconfig: tsconfigConfigFile
|
|
93
99
|
? {
|
|
94
100
|
configFile: tsconfigConfigFile,
|
|
@@ -209,7 +215,8 @@ function getRawModule(module, options) {
|
|
|
209
215
|
return {
|
|
210
216
|
rules,
|
|
211
217
|
parser: getRawParserOptionsByModuleType(module.parser),
|
|
212
|
-
generator: getRawGeneratorOptionsByModuleType(module.generator)
|
|
218
|
+
generator: getRawGeneratorOptionsByModuleType(module.generator),
|
|
219
|
+
noParse: module.noParse
|
|
213
220
|
};
|
|
214
221
|
}
|
|
215
222
|
function tryMatch(payload, condition) {
|
|
@@ -49,7 +49,7 @@ export interface LoaderContext<OptionsType = {}> {
|
|
|
49
49
|
cacheable(cacheable?: boolean): void;
|
|
50
50
|
sourceMap: boolean;
|
|
51
51
|
rootContext: string;
|
|
52
|
-
context: string;
|
|
52
|
+
context: string | null;
|
|
53
53
|
loaderIndex: number;
|
|
54
54
|
remainingRequest: string;
|
|
55
55
|
currentRequest: string;
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* https://github.com/webpack/webpack/blob/main/LICENSE
|
|
9
9
|
*/
|
|
10
10
|
import { Compilation } from "..";
|
|
11
|
-
import type { Context, Dependencies, Node, DevTool, Externals, ExternalsPresets, ExternalsType, InfrastructureLogging, LibraryOptions, Mode, Name, Resolve, RspackOptions, Target, SnapshotOptions, CacheOptions, StatsValue, Optimization, Plugins, Watch, WatchOptions, DevServer, Profile, Bail, Builtins, EntryRuntime, ChunkLoading, PublicPath, EntryFilename, Path, Clean, Filename, ChunkFilename, CrossOriginLoading, CssFilename, CssChunkFilename, HotUpdateMainFilename, HotUpdateChunkFilename, AssetModuleFilename, UniqueName, ChunkLoadingGlobal, EnabledLibraryTypes, OutputModule, StrictModuleErrorHandling, GlobalObject, ImportFunctionName, Iife, WasmLoading, EnabledWasmLoadingTypes, WebassemblyModuleFilename, TrustedTypes, SourceMapFilename, HashDigest, HashDigestLength, HashFunction, HashSalt, WorkerPublicPath, RuleSetRules, ParserOptionsByModuleType, GeneratorOptionsByModuleType, RspackFutureOptions, HotUpdateGlobal, ScriptType, DevtoolNamespace, DevtoolModuleFilenameTemplate, DevtoolFallbackModuleFilenameTemplate } from "./zod";
|
|
11
|
+
import type { Context, Dependencies, Node, DevTool, Externals, ExternalsPresets, ExternalsType, InfrastructureLogging, LibraryOptions, Mode, Name, Resolve, RspackOptions, Target, SnapshotOptions, CacheOptions, StatsValue, Optimization, Plugins, Watch, WatchOptions, DevServer, Profile, Bail, Builtins, EntryRuntime, ChunkLoading, PublicPath, EntryFilename, Path, Clean, Filename, ChunkFilename, CrossOriginLoading, CssFilename, CssChunkFilename, HotUpdateMainFilename, HotUpdateChunkFilename, AssetModuleFilename, UniqueName, ChunkLoadingGlobal, EnabledLibraryTypes, OutputModule, StrictModuleErrorHandling, GlobalObject, ImportFunctionName, Iife, WasmLoading, EnabledWasmLoadingTypes, WebassemblyModuleFilename, TrustedTypes, SourceMapFilename, HashDigest, HashDigestLength, HashFunction, HashSalt, WorkerPublicPath, RuleSetRules, ParserOptionsByModuleType, GeneratorOptionsByModuleType, RspackFutureOptions, HotUpdateGlobal, ScriptType, NoParseOption, DevtoolNamespace, DevtoolModuleFilenameTemplate, DevtoolFallbackModuleFilenameTemplate } from "./zod";
|
|
12
12
|
export declare const getNormalizedRspackOptions: (config: RspackOptions) => RspackOptionsNormalized;
|
|
13
13
|
export type EntryNormalized = EntryStaticNormalized;
|
|
14
14
|
export interface EntryStaticNormalized {
|
|
@@ -72,6 +72,7 @@ export interface ModuleOptionsNormalized {
|
|
|
72
72
|
rules: RuleSetRules;
|
|
73
73
|
parser: ParserOptionsByModuleType;
|
|
74
74
|
generator: GeneratorOptionsByModuleType;
|
|
75
|
+
noParse?: NoParseOption;
|
|
75
76
|
}
|
|
76
77
|
export interface ExperimentsNormalized {
|
|
77
78
|
lazyCompilation?: boolean;
|
|
@@ -125,6 +125,7 @@ const getNormalizedRspackOptions = (config) => {
|
|
|
125
125
|
...resolve
|
|
126
126
|
})),
|
|
127
127
|
module: nestedConfig(config.module, module => ({
|
|
128
|
+
noParse: module.noParse,
|
|
128
129
|
parser: keyedNestedConfig(module.parser, cloneObject, {}),
|
|
129
130
|
generator: keyedNestedConfig(module.generator, cloneObject, {}),
|
|
130
131
|
defaultRules: optionalNestedArray(module.defaultRules, r => [...r]),
|