@rspack/core 0.5.8-canary-cff2c4f-20240325162043 → 0.5.8-canary-8598a50-20240326124040
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
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_afterProcessAssets,
|
|
39
|
+
var _Compiler_instances, _Compiler_instance, _Compiler_disabledHooks, _Compiler_moduleExecutionResultsMap, _Compiler_getInstance, _Compiler_updateDisabledHooks, _Compiler_afterProcessAssets, _Compiler_contextModuleFactoryBeforeResolve, _Compiler_contextModuleFactoryAfterResolve, _Compiler_normalModuleFactoryCreateModule, _Compiler_normalModuleFactoryResolveForScheme, _Compiler_optimizeChunkModules, _Compiler_optimizeTree, _Compiler_decorateUpdateDisabledHooks, _Compiler_createRegisterTaps, _Compiler_createCompilation, _Compiler_resetThisCompilation, _Compiler_newCompilationParams;
|
|
40
40
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
41
|
exports.Compiler = void 0;
|
|
42
42
|
const index_1 = require("./index");
|
|
@@ -58,7 +58,6 @@ const Logger_1 = require("./logging/Logger");
|
|
|
58
58
|
const NormalModuleFactory_1 = require("./NormalModuleFactory");
|
|
59
59
|
const bindingVersionCheck_1 = require("./util/bindingVersionCheck");
|
|
60
60
|
const Watching_1 = require("./Watching");
|
|
61
|
-
const NormalModule_1 = require("./NormalModule");
|
|
62
61
|
const builtin_plugin_1 = require("./builtin-plugin");
|
|
63
62
|
const rspackOptionsApply_1 = require("./rspackOptionsApply");
|
|
64
63
|
const defaults_1 = require("./config/defaults");
|
|
@@ -504,7 +503,6 @@ _Compiler_instance = new WeakMap(), _Compiler_disabledHooks = new WeakMap(), _Co
|
|
|
504
503
|
__classPrivateFieldSet(this, _Compiler_instance, new instanceBinding.Rspack(rawOptions, this.builtinPlugins, {
|
|
505
504
|
normalModuleFactoryCreateModule: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_normalModuleFactoryCreateModule).bind(this),
|
|
506
505
|
normalModuleFactoryResolveForScheme: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_normalModuleFactoryResolveForScheme).bind(this),
|
|
507
|
-
afterResolve: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_afterResolve).bind(this),
|
|
508
506
|
contextModuleFactoryBeforeResolve: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_contextModuleFactoryBeforeResolve).bind(this),
|
|
509
507
|
contextModuleFactoryAfterResolve: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_contextModuleFactoryAfterResolve).bind(this)
|
|
510
508
|
}, {
|
|
@@ -604,18 +602,30 @@ _Compiler_instance = new WeakMap(), _Compiler_disabledHooks = new WeakMap(), _Co
|
|
|
604
602
|
resolveData.request = normalizedResolveData.request;
|
|
605
603
|
resolveData.context = normalizedResolveData.context;
|
|
606
604
|
return [ret, resolveData];
|
|
605
|
+
}),
|
|
606
|
+
registerNormalModuleFactoryAfterResolveTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createRegisterTaps).call(this, () => this.compilationParams.normalModuleFactory.hooks.afterResolve, queried => async (arg) => {
|
|
607
|
+
const data = {
|
|
608
|
+
request: arg.request,
|
|
609
|
+
context: arg.context,
|
|
610
|
+
fileDependencies: arg.fileDependencies,
|
|
611
|
+
missingDependencies: arg.missingDependencies,
|
|
612
|
+
contextDependencies: arg.contextDependencies,
|
|
613
|
+
factoryMeta: arg.factoryMeta,
|
|
614
|
+
createData: arg.createData
|
|
615
|
+
};
|
|
616
|
+
const ret = await queried.promise(data);
|
|
617
|
+
return [ret, data.createData];
|
|
607
618
|
})
|
|
608
619
|
}, (0, fileSystem_1.createThreadsafeNodeFSFromRaw)(this.outputFileSystem)), "f");
|
|
609
620
|
callback(null, __classPrivateFieldGet(this, _Compiler_instance, "f"));
|
|
610
621
|
}, _Compiler_updateDisabledHooks = function _Compiler_updateDisabledHooks(callback) {
|
|
611
|
-
var _a, _b, _c, _d
|
|
622
|
+
var _a, _b, _c, _d;
|
|
612
623
|
const disabledHooks = [];
|
|
613
624
|
const hookMap = {
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
normalModuleFactoryResolveForScheme: (_e = this.compilationParams) === null || _e === void 0 ? void 0 : _e.normalModuleFactory.hooks.resolveForScheme
|
|
625
|
+
contextModuleFactoryBeforeResolve: (_a = this.compilationParams) === null || _a === void 0 ? void 0 : _a.contextModuleFactory.hooks.beforeResolve,
|
|
626
|
+
contextModuleFactoryAfterResolve: (_b = this.compilationParams) === null || _b === void 0 ? void 0 : _b.contextModuleFactory.hooks.afterResolve,
|
|
627
|
+
normalModuleFactoryCreateModule: (_c = this.compilationParams) === null || _c === void 0 ? void 0 : _c.normalModuleFactory.hooks.createModule,
|
|
628
|
+
normalModuleFactoryResolveForScheme: (_d = this.compilationParams) === null || _d === void 0 ? void 0 : _d.normalModuleFactory.hooks.resolveForScheme
|
|
619
629
|
};
|
|
620
630
|
for (const [name, hook] of Object.entries(hookMap)) {
|
|
621
631
|
if (typeof hook !== "undefined" &&
|
|
@@ -640,17 +650,6 @@ _Compiler_instance = new WeakMap(), _Compiler_disabledHooks = new WeakMap(), _Co
|
|
|
640
650
|
}, _Compiler_afterProcessAssets = async function _Compiler_afterProcessAssets() {
|
|
641
651
|
await this.compilation.hooks.afterProcessAssets.promise(this.compilation.assets);
|
|
642
652
|
__classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_updateDisabledHooks).call(this);
|
|
643
|
-
}, _Compiler_afterResolve = async function _Compiler_afterResolve(resolveData) {
|
|
644
|
-
let res = await this.compilationParams.normalModuleFactory.hooks.afterResolve.promise(resolveData);
|
|
645
|
-
NormalModule_1.NormalModule.getCompilationHooks(this.compilation).loader.tap("sideEffectFreePropPlugin", (loaderContext) => {
|
|
646
|
-
loaderContext._module = {
|
|
647
|
-
factoryMeta: {
|
|
648
|
-
sideEffectFree: !!resolveData.factoryMeta.sideEffectFree
|
|
649
|
-
}
|
|
650
|
-
};
|
|
651
|
-
});
|
|
652
|
-
__classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_updateDisabledHooks).call(this);
|
|
653
|
-
return [res, resolveData.createData];
|
|
654
653
|
}, _Compiler_contextModuleFactoryBeforeResolve = async function _Compiler_contextModuleFactoryBeforeResolve(resourceData) {
|
|
655
654
|
let res = await this.compilationParams.contextModuleFactory.hooks.beforeResolve.promise(resourceData);
|
|
656
655
|
__classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_updateDisabledHooks).call(this);
|
package/dist/Module.d.ts
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
|
-
import { JsCodegenerationResult, JsCodegenerationResults, JsModule } from "@rspack/binding";
|
|
1
|
+
import { JsCodegenerationResult, JsCodegenerationResults, JsCreateData, JsFactoryMeta, JsModule } from "@rspack/binding";
|
|
2
2
|
import { Source } from "webpack-sources";
|
|
3
|
+
export type ResourceData = {
|
|
4
|
+
resource: string;
|
|
5
|
+
path: string;
|
|
6
|
+
query?: string;
|
|
7
|
+
fragment?: string;
|
|
8
|
+
};
|
|
9
|
+
export type ResourceDataWithData = ResourceData & {
|
|
10
|
+
data?: Record<string, any>;
|
|
11
|
+
};
|
|
12
|
+
export type CreateData = Partial<JsCreateData>;
|
|
13
|
+
export type ResolveData = {
|
|
14
|
+
context: string;
|
|
15
|
+
request: string;
|
|
16
|
+
fileDependencies: string[];
|
|
17
|
+
missingDependencies: string[];
|
|
18
|
+
contextDependencies: string[];
|
|
19
|
+
factoryMeta?: JsFactoryMeta;
|
|
20
|
+
createData?: CreateData;
|
|
21
|
+
};
|
|
3
22
|
export declare class Module {
|
|
4
23
|
#private;
|
|
5
24
|
_originalSource?: Source;
|
|
@@ -1,22 +1,7 @@
|
|
|
1
1
|
import { AsyncSeriesBailHook, HookMap } from "tapable";
|
|
2
2
|
import * as liteTapable from "./lite-tapable";
|
|
3
3
|
import type * as binding from "@rspack/binding";
|
|
4
|
-
|
|
5
|
-
resource: string;
|
|
6
|
-
path: string;
|
|
7
|
-
query?: string;
|
|
8
|
-
fragment?: string;
|
|
9
|
-
};
|
|
10
|
-
type ResourceDataWithData = ResourceData & {
|
|
11
|
-
data?: Record<string, any>;
|
|
12
|
-
};
|
|
13
|
-
type ResolveData = {
|
|
14
|
-
context?: string;
|
|
15
|
-
request: string;
|
|
16
|
-
fileDependencies: string[];
|
|
17
|
-
missingDependencies: string[];
|
|
18
|
-
contextDependencies: string[];
|
|
19
|
-
};
|
|
4
|
+
import { ResolveData, ResourceDataWithData } from "./Module";
|
|
20
5
|
type CreateModuleData = binding.CreateModuleData & {
|
|
21
6
|
settings: {};
|
|
22
7
|
matchResource: string;
|
|
@@ -25,7 +10,7 @@ export declare class NormalModuleFactory {
|
|
|
25
10
|
hooks: {
|
|
26
11
|
resolveForScheme: HookMap<AsyncSeriesBailHook<[ResourceDataWithData], true | void>>;
|
|
27
12
|
beforeResolve: liteTapable.AsyncSeriesBailHook<[ResolveData], false | void>;
|
|
28
|
-
afterResolve: AsyncSeriesBailHook<[ResolveData],
|
|
13
|
+
afterResolve: liteTapable.AsyncSeriesBailHook<[ResolveData], false | void>;
|
|
29
14
|
createModule: AsyncSeriesBailHook<[CreateModuleData, {}], void>;
|
|
30
15
|
};
|
|
31
16
|
constructor();
|
|
@@ -42,7 +42,7 @@ class NormalModuleFactory {
|
|
|
42
42
|
// /** @type {AsyncSeriesBailHook<[ResolveData], false | void>} */
|
|
43
43
|
beforeResolve: new liteTapable.AsyncSeriesBailHook(["resolveData"]),
|
|
44
44
|
// /** @type {AsyncSeriesBailHook<[ResolveData], false | void>} */
|
|
45
|
-
afterResolve: new
|
|
45
|
+
afterResolve: new liteTapable.AsyncSeriesBailHook(["resolveData"]),
|
|
46
46
|
// /** @type {AsyncSeriesBailHook<[ResolveData["createData"], ResolveData], Module | void>} */
|
|
47
47
|
createModule: new tapable_1.AsyncSeriesBailHook(["createData", "resolveData"])
|
|
48
48
|
// /** @type {SyncWaterfallHook<[Module, ResolveData["createData"], ResolveData], Module>} */
|
package/dist/config/adapter.js
CHANGED
|
@@ -336,8 +336,7 @@ const getRawModuleRule = (rule, path, options) => {
|
|
|
336
336
|
if (rule.resourceQuery && !tryMatch(query, rule.resourceQuery)) {
|
|
337
337
|
return false;
|
|
338
338
|
}
|
|
339
|
-
if (rule.resourceFragment &&
|
|
340
|
-
!tryMatch(fragment, rule.resourceFragment)) {
|
|
339
|
+
if (rule.resourceFragment && !tryMatch(fragment, rule.resourceFragment)) {
|
|
341
340
|
return false;
|
|
342
341
|
}
|
|
343
342
|
return true;
|
|
@@ -66,10 +66,15 @@ module.exports = function () {
|
|
|
66
66
|
if (typeof stage === "object" && stage !== null) {
|
|
67
67
|
const { name, version, factory, eager } = stage;
|
|
68
68
|
if (shared[name]) {
|
|
69
|
+
shared[name].version.push(version);
|
|
69
70
|
shared[name].scope.push(scope);
|
|
70
71
|
}
|
|
71
72
|
else {
|
|
72
|
-
shared[name] = {
|
|
73
|
+
shared[name] = {
|
|
74
|
+
version: [version],
|
|
75
|
+
get: factory,
|
|
76
|
+
scope: [scope]
|
|
77
|
+
};
|
|
73
78
|
}
|
|
74
79
|
}
|
|
75
80
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rspack/core",
|
|
3
|
-
"version": "0.5.8-canary-
|
|
3
|
+
"version": "0.5.8-canary-8598a50-20240326124040",
|
|
4
4
|
"webpackVersion": "5.75.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "A Fast Rust-based Web Bundler",
|
|
@@ -56,8 +56,8 @@
|
|
|
56
56
|
"styled-components": "^6.0.8",
|
|
57
57
|
"terser": "5.27.2",
|
|
58
58
|
"wast-loader": "^1.11.4",
|
|
59
|
-
"@rspack/core": "0.5.8-canary-
|
|
60
|
-
"@rspack/plugin-minify": "^0.5.8-canary-
|
|
59
|
+
"@rspack/core": "0.5.8-canary-8598a50-20240326124040",
|
|
60
|
+
"@rspack/plugin-minify": "^0.5.8-canary-8598a50-20240326124040"
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
63
|
"@module-federation/runtime-tools": "0.0.8",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"webpack-sources": "3.2.3",
|
|
73
73
|
"zod": "^3.21.4",
|
|
74
74
|
"zod-validation-error": "1.3.1",
|
|
75
|
-
"@rspack/binding": "0.5.8-canary-
|
|
75
|
+
"@rspack/binding": "0.5.8-canary-8598a50-20240326124040"
|
|
76
76
|
},
|
|
77
77
|
"peerDependencies": {
|
|
78
78
|
"@swc/helpers": ">=0.5.1"
|