@rspack/core 0.6.5-canary-73c31ab-20240510004618 → 0.6.5-canary-d1f53fd-20240511004704
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/Compiler.js +26 -20
- package/dist/ContextModuleFactory.d.ts +7 -3
- package/dist/ContextModuleFactory.js +2 -2
- package/dist/Module.d.ts +11 -0
- package/dist/exports.d.ts +2 -0
- package/dist/exports.js +6 -1
- package/dist/lite-tapable/index.d.ts +6 -0
- package/dist/lite-tapable/index.js +107 -1
- package/package.json +4 -4
package/dist/Compiler.js
CHANGED
|
@@ -609,27 +609,33 @@ _Compiler_instance = new WeakMap(), _Compiler_initial = new WeakMap(), _Compiler
|
|
|
609
609
|
};
|
|
610
610
|
await queried.promise(data, {});
|
|
611
611
|
}),
|
|
612
|
-
registerContextModuleFactoryBeforeResolveTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.ContextModuleFactoryBeforeResolve, () => this.compilationParams.contextModuleFactory.hooks.beforeResolve, queried => async (
|
|
613
|
-
|
|
614
|
-
request: arg.request,
|
|
615
|
-
context: arg.context,
|
|
616
|
-
fileDependencies: [],
|
|
617
|
-
missingDependencies: [],
|
|
618
|
-
contextDependencies: []
|
|
619
|
-
};
|
|
620
|
-
const ret = await queried.promise(data);
|
|
621
|
-
return [ret, data];
|
|
612
|
+
registerContextModuleFactoryBeforeResolveTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.ContextModuleFactoryBeforeResolve, () => this.compilationParams.contextModuleFactory.hooks.beforeResolve, queried => async (bindingData) => {
|
|
613
|
+
return queried.promise(bindingData);
|
|
622
614
|
}),
|
|
623
|
-
registerContextModuleFactoryAfterResolveTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.ContextModuleFactoryAfterResolve, () => this.compilationParams.contextModuleFactory.hooks.afterResolve, queried => async (
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
615
|
+
registerContextModuleFactoryAfterResolveTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.ContextModuleFactoryAfterResolve, () => this.compilationParams.contextModuleFactory.hooks.afterResolve, queried => async (bindingData) => {
|
|
616
|
+
var _a;
|
|
617
|
+
const data = bindingData
|
|
618
|
+
? ({
|
|
619
|
+
resource: bindingData.resource,
|
|
620
|
+
regExp: bindingData.regExp
|
|
621
|
+
? new RegExp(bindingData.regExp)
|
|
622
|
+
: undefined,
|
|
623
|
+
request: bindingData.request,
|
|
624
|
+
context: bindingData.context,
|
|
625
|
+
// TODO: Dependencies are not fully supported yet; this is a placeholder to prevent errors in moment-locales-webpack-plugin.
|
|
626
|
+
dependencies: []
|
|
627
|
+
})
|
|
628
|
+
: false;
|
|
629
|
+
const ret = await queried.promise(data);
|
|
630
|
+
const result = ret
|
|
631
|
+
? ({
|
|
632
|
+
resource: ret.resource,
|
|
633
|
+
context: ret.context,
|
|
634
|
+
request: ret.request,
|
|
635
|
+
regExp: (_a = ret.regExp) === null || _a === void 0 ? void 0 : _a.toString()
|
|
636
|
+
})
|
|
637
|
+
: false;
|
|
638
|
+
return result;
|
|
633
639
|
})
|
|
634
640
|
}, "f");
|
|
635
641
|
__classPrivateFieldSet(this, _Compiler_instance, new instanceBinding.Rspack(rawOptions, this.builtinPlugins, __classPrivateFieldGet(this, _Compiler_registers, "f"), (0, fileSystem_1.createThreadsafeNodeFSFromRaw)(this.outputFileSystem)), "f");
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import * as liteTapable from "./lite-tapable";
|
|
2
|
-
import {
|
|
2
|
+
import { ContextModuleFactoryAfterResolveResult, ContextModuleFactoryBeforeResolveResult } from "./Module";
|
|
3
3
|
export declare class ContextModuleFactory {
|
|
4
4
|
hooks: {
|
|
5
|
-
beforeResolve: liteTapable.
|
|
6
|
-
|
|
5
|
+
beforeResolve: liteTapable.AsyncSeriesWaterfallHook<[
|
|
6
|
+
ContextModuleFactoryBeforeResolveResult
|
|
7
|
+
], ContextModuleFactoryBeforeResolveResult | void>;
|
|
8
|
+
afterResolve: liteTapable.AsyncSeriesWaterfallHook<[
|
|
9
|
+
ContextModuleFactoryAfterResolveResult
|
|
10
|
+
], ContextModuleFactoryAfterResolveResult | void>;
|
|
7
11
|
};
|
|
8
12
|
constructor();
|
|
9
13
|
}
|
|
@@ -41,8 +41,8 @@ class ContextModuleFactory {
|
|
|
41
41
|
// /** @type {AsyncSeriesBailHook<[ResolveData], Module>} */
|
|
42
42
|
// factorize: new AsyncSeriesBailHook(["resolveData"]),
|
|
43
43
|
// /** @type {AsyncSeriesBailHook<[ResolveData], false | void>} */
|
|
44
|
-
beforeResolve: new liteTapable.
|
|
45
|
-
afterResolve: new liteTapable.
|
|
44
|
+
beforeResolve: new liteTapable.AsyncSeriesWaterfallHook(["resolveData"]),
|
|
45
|
+
afterResolve: new liteTapable.AsyncSeriesWaterfallHook(["resolveData"])
|
|
46
46
|
// /** @type {AsyncSeriesBailHook<[ResolveData["createData"], ResolveData], Module | void>} */
|
|
47
47
|
// createModule: new AsyncSeriesBailHook(["createData", "resolveData"]),
|
|
48
48
|
// /** @type {SyncWaterfallHook<[Module, ResolveData["createData"], ResolveData], Module>} */
|
package/dist/Module.d.ts
CHANGED
|
@@ -18,6 +18,17 @@ export type ResolveData = {
|
|
|
18
18
|
contextDependencies: string[];
|
|
19
19
|
createData?: CreateData;
|
|
20
20
|
};
|
|
21
|
+
export type ContextModuleFactoryBeforeResolveResult = false | {
|
|
22
|
+
context: string;
|
|
23
|
+
request?: string;
|
|
24
|
+
};
|
|
25
|
+
export type ContextModuleFactoryAfterResolveResult = false | {
|
|
26
|
+
resource: string;
|
|
27
|
+
context: string;
|
|
28
|
+
request: string;
|
|
29
|
+
regExp?: RegExp;
|
|
30
|
+
dependencies: Array<any>;
|
|
31
|
+
};
|
|
21
32
|
export declare class Module {
|
|
22
33
|
#private;
|
|
23
34
|
_originalSource?: Source;
|
package/dist/exports.d.ts
CHANGED
|
@@ -59,9 +59,11 @@ export { EnvironmentPlugin } from "./lib/EnvironmentPlugin";
|
|
|
59
59
|
export { NormalModuleReplacementPlugin } from "./lib/NormalModuleReplacementPlugin";
|
|
60
60
|
import NodeTemplatePlugin from "./node/NodeTemplatePlugin";
|
|
61
61
|
import { NodeTargetPlugin } from "./builtin-plugin";
|
|
62
|
+
import NodeEnvironmentPlugin from "./node/NodeEnvironmentPlugin";
|
|
62
63
|
interface Node {
|
|
63
64
|
NodeTargetPlugin: typeof NodeTargetPlugin;
|
|
64
65
|
NodeTemplatePlugin: typeof NodeTemplatePlugin;
|
|
66
|
+
NodeEnvironmentPlugin: typeof NodeEnvironmentPlugin;
|
|
65
67
|
}
|
|
66
68
|
export declare const node: Node;
|
|
67
69
|
import { ElectronTargetPlugin } from "./builtin-plugin";
|
package/dist/exports.js
CHANGED
|
@@ -100,7 +100,12 @@ var NormalModuleReplacementPlugin_1 = require("./lib/NormalModuleReplacementPlug
|
|
|
100
100
|
Object.defineProperty(exports, "NormalModuleReplacementPlugin", { enumerable: true, get: function () { return NormalModuleReplacementPlugin_1.NormalModuleReplacementPlugin; } });
|
|
101
101
|
const NodeTemplatePlugin_1 = __importDefault(require("./node/NodeTemplatePlugin"));
|
|
102
102
|
const builtin_plugin_10 = require("./builtin-plugin");
|
|
103
|
-
|
|
103
|
+
const NodeEnvironmentPlugin_1 = __importDefault(require("./node/NodeEnvironmentPlugin"));
|
|
104
|
+
exports.node = {
|
|
105
|
+
NodeTargetPlugin: builtin_plugin_10.NodeTargetPlugin,
|
|
106
|
+
NodeTemplatePlugin: NodeTemplatePlugin_1.default,
|
|
107
|
+
NodeEnvironmentPlugin: NodeEnvironmentPlugin_1.default
|
|
108
|
+
};
|
|
104
109
|
const builtin_plugin_11 = require("./builtin-plugin");
|
|
105
110
|
exports.electron = { ElectronTargetPlugin: builtin_plugin_11.ElectronTargetPlugin };
|
|
106
111
|
const builtin_plugin_12 = require("./builtin-plugin");
|
|
@@ -112,6 +112,12 @@ export declare class AsyncSeriesBailHook<T, R, AdditionalOptions = UnsetAddition
|
|
|
112
112
|
tapAsync(options: Options<AdditionalOptions>, fn: FnWithCallback<T, void>): void;
|
|
113
113
|
tapPromise(options: Options<AdditionalOptions>, fn: Fn<T, void>): void;
|
|
114
114
|
}
|
|
115
|
+
export declare class AsyncSeriesWaterfallHook<T, R, AdditionalOptions = UnsetAdditionalOptions> extends Hook<T, R, AdditionalOptions> {
|
|
116
|
+
constructor(args?: ArgumentNames<AsArray<T>>, name?: string);
|
|
117
|
+
callAsyncStageRange(queried: QueriedHook<T, R, AdditionalOptions>, ...args: Append<AsArray<T>, Callback<Error, R>>): void;
|
|
118
|
+
tapAsync(options: Options<AdditionalOptions>, fn: FnWithCallback<T, void>): void;
|
|
119
|
+
tapPromise(options: Options<AdditionalOptions>, fn: Fn<T, void>): void;
|
|
120
|
+
}
|
|
115
121
|
export type HookMapKey = any;
|
|
116
122
|
export type HookFactory<H> = (key: HookMapKey, hook?: H) => H;
|
|
117
123
|
export interface HookMapInterceptor<H> {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.QueriedHookMap = exports.HookMap = exports.AsyncSeriesBailHook = exports.AsyncSeriesHook = exports.AsyncParallelHook = exports.SyncBailHook = exports.SyncHook = exports.QueriedHook = exports.safeStage = exports.maxStage = exports.minStage = exports.Hook = void 0;
|
|
3
|
+
exports.QueriedHookMap = exports.HookMap = exports.AsyncSeriesWaterfallHook = exports.AsyncSeriesBailHook = exports.AsyncSeriesHook = exports.AsyncParallelHook = exports.SyncBailHook = exports.SyncHook = exports.QueriedHook = exports.safeStage = exports.maxStage = exports.minStage = exports.Hook = void 0;
|
|
4
4
|
class Hook {
|
|
5
5
|
constructor(args, name) {
|
|
6
6
|
this.args = args;
|
|
@@ -578,6 +578,112 @@ class AsyncSeriesBailHook extends Hook {
|
|
|
578
578
|
}
|
|
579
579
|
}
|
|
580
580
|
exports.AsyncSeriesBailHook = AsyncSeriesBailHook;
|
|
581
|
+
class AsyncSeriesWaterfallHook extends Hook {
|
|
582
|
+
constructor(args, name) {
|
|
583
|
+
if (!(args === null || args === void 0 ? void 0 : args.length))
|
|
584
|
+
throw new Error("Waterfall hooks must have at least one argument");
|
|
585
|
+
super(args, name);
|
|
586
|
+
}
|
|
587
|
+
callAsyncStageRange(queried, ...args) {
|
|
588
|
+
const { stageRange: [from, to], tapsInRange } = queried;
|
|
589
|
+
let data = args[0];
|
|
590
|
+
const cb = args[1];
|
|
591
|
+
if (from === exports.minStage) {
|
|
592
|
+
this._runCallInterceptors(data);
|
|
593
|
+
}
|
|
594
|
+
const done = () => {
|
|
595
|
+
this._runDoneInterceptors();
|
|
596
|
+
cb(null, data);
|
|
597
|
+
};
|
|
598
|
+
const error = (e) => {
|
|
599
|
+
this._runErrorInterceptors(e);
|
|
600
|
+
cb(e);
|
|
601
|
+
};
|
|
602
|
+
if (tapsInRange.length === 0)
|
|
603
|
+
return done();
|
|
604
|
+
let index = 0;
|
|
605
|
+
const next = () => {
|
|
606
|
+
const tap = tapsInRange[index];
|
|
607
|
+
this._runTapInterceptors(tap);
|
|
608
|
+
if (tap.type === "promise") {
|
|
609
|
+
const promise = tap.fn(data);
|
|
610
|
+
if (!promise || !promise.then) {
|
|
611
|
+
throw new Error("Tap function (tapPromise) did not return promise (returned " +
|
|
612
|
+
promise +
|
|
613
|
+
")");
|
|
614
|
+
}
|
|
615
|
+
promise.then((r) => {
|
|
616
|
+
index += 1;
|
|
617
|
+
if (r !== undefined) {
|
|
618
|
+
data = r;
|
|
619
|
+
}
|
|
620
|
+
if (index === tapsInRange.length) {
|
|
621
|
+
done();
|
|
622
|
+
}
|
|
623
|
+
else {
|
|
624
|
+
next();
|
|
625
|
+
}
|
|
626
|
+
}, (e) => {
|
|
627
|
+
index = tapsInRange.length;
|
|
628
|
+
error(e);
|
|
629
|
+
});
|
|
630
|
+
}
|
|
631
|
+
else if (tap.type === "async") {
|
|
632
|
+
tap.fn(data, (e, r) => {
|
|
633
|
+
if (e) {
|
|
634
|
+
index = tapsInRange.length;
|
|
635
|
+
error(e);
|
|
636
|
+
}
|
|
637
|
+
else {
|
|
638
|
+
index += 1;
|
|
639
|
+
if (r !== undefined) {
|
|
640
|
+
data = r;
|
|
641
|
+
}
|
|
642
|
+
if (index === tapsInRange.length) {
|
|
643
|
+
done();
|
|
644
|
+
}
|
|
645
|
+
else {
|
|
646
|
+
next();
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
});
|
|
650
|
+
}
|
|
651
|
+
else {
|
|
652
|
+
let hasError = false;
|
|
653
|
+
try {
|
|
654
|
+
const r = tap.fn(data);
|
|
655
|
+
if (r !== undefined) {
|
|
656
|
+
data = r;
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
catch (e) {
|
|
660
|
+
hasError = true;
|
|
661
|
+
index = tapsInRange.length;
|
|
662
|
+
error(e);
|
|
663
|
+
}
|
|
664
|
+
if (!hasError) {
|
|
665
|
+
index += 1;
|
|
666
|
+
if (index === tapsInRange.length) {
|
|
667
|
+
done();
|
|
668
|
+
}
|
|
669
|
+
else {
|
|
670
|
+
next();
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
if (index === tapsInRange.length)
|
|
675
|
+
return;
|
|
676
|
+
};
|
|
677
|
+
next();
|
|
678
|
+
}
|
|
679
|
+
tapAsync(options, fn) {
|
|
680
|
+
this._tap("async", options, fn);
|
|
681
|
+
}
|
|
682
|
+
tapPromise(options, fn) {
|
|
683
|
+
this._tap("promise", options, fn);
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
exports.AsyncSeriesWaterfallHook = AsyncSeriesWaterfallHook;
|
|
581
687
|
const defaultFactory = (key, hook) => hook;
|
|
582
688
|
class HookMap {
|
|
583
689
|
constructor(factory, name) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rspack/core",
|
|
3
|
-
"version": "0.6.5-canary-
|
|
3
|
+
"version": "0.6.5-canary-d1f53fd-20240511004704",
|
|
4
4
|
"webpackVersion": "5.75.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "A Fast Rust-based Web Bundler",
|
|
@@ -71,8 +71,8 @@
|
|
|
71
71
|
"watchpack": "^2.4.0",
|
|
72
72
|
"zod": "^3.21.4",
|
|
73
73
|
"zod-validation-error": "1.3.1",
|
|
74
|
-
"@rspack/core": "0.6.5-canary-
|
|
75
|
-
"@rspack/plugin-minify": "^0.6.5-canary-
|
|
74
|
+
"@rspack/core": "0.6.5-canary-d1f53fd-20240511004704",
|
|
75
|
+
"@rspack/plugin-minify": "^0.6.5-canary-d1f53fd-20240511004704"
|
|
76
76
|
},
|
|
77
77
|
"dependencies": {
|
|
78
78
|
"@module-federation/runtime-tools": "0.1.6",
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
"enhanced-resolve": "5.12.0",
|
|
81
81
|
"tapable": "2.2.1",
|
|
82
82
|
"webpack-sources": "3.2.3",
|
|
83
|
-
"@rspack/binding": "0.6.5-canary-
|
|
83
|
+
"@rspack/binding": "0.6.5-canary-d1f53fd-20240511004704"
|
|
84
84
|
},
|
|
85
85
|
"peerDependencies": {
|
|
86
86
|
"@swc/helpers": ">=0.5.1"
|