@rspack/core 0.5.8-canary-8598a50-20240326124040 → 0.5.9-canary-8fd75cb-20240326041944
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, _Compiler_contextModuleFactoryBeforeResolve, _Compiler_contextModuleFactoryAfterResolve, _Compiler_normalModuleFactoryCreateModule, _Compiler_normalModuleFactoryResolveForScheme, _Compiler_optimizeChunkModules, _Compiler_optimizeTree, _Compiler_decorateUpdateDisabledHooks, _Compiler_createRegisterTaps, _Compiler_createCompilation, _Compiler_resetThisCompilation, _Compiler_newCompilationParams;
|
|
39
|
+
var _Compiler_instances, _Compiler_instance, _Compiler_disabledHooks, _Compiler_moduleExecutionResultsMap, _Compiler_getInstance, _Compiler_updateDisabledHooks, _Compiler_afterProcessAssets, _Compiler_afterResolve, _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,6 +58,7 @@ 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");
|
|
61
62
|
const builtin_plugin_1 = require("./builtin-plugin");
|
|
62
63
|
const rspackOptionsApply_1 = require("./rspackOptionsApply");
|
|
63
64
|
const defaults_1 = require("./config/defaults");
|
|
@@ -503,6 +504,7 @@ _Compiler_instance = new WeakMap(), _Compiler_disabledHooks = new WeakMap(), _Co
|
|
|
503
504
|
__classPrivateFieldSet(this, _Compiler_instance, new instanceBinding.Rspack(rawOptions, this.builtinPlugins, {
|
|
504
505
|
normalModuleFactoryCreateModule: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_normalModuleFactoryCreateModule).bind(this),
|
|
505
506
|
normalModuleFactoryResolveForScheme: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_normalModuleFactoryResolveForScheme).bind(this),
|
|
507
|
+
afterResolve: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_afterResolve).bind(this),
|
|
506
508
|
contextModuleFactoryBeforeResolve: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_contextModuleFactoryBeforeResolve).bind(this),
|
|
507
509
|
contextModuleFactoryAfterResolve: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_contextModuleFactoryAfterResolve).bind(this)
|
|
508
510
|
}, {
|
|
@@ -602,30 +604,18 @@ _Compiler_instance = new WeakMap(), _Compiler_disabledHooks = new WeakMap(), _Co
|
|
|
602
604
|
resolveData.request = normalizedResolveData.request;
|
|
603
605
|
resolveData.context = normalizedResolveData.context;
|
|
604
606
|
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];
|
|
618
607
|
})
|
|
619
608
|
}, (0, fileSystem_1.createThreadsafeNodeFSFromRaw)(this.outputFileSystem)), "f");
|
|
620
609
|
callback(null, __classPrivateFieldGet(this, _Compiler_instance, "f"));
|
|
621
610
|
}, _Compiler_updateDisabledHooks = function _Compiler_updateDisabledHooks(callback) {
|
|
622
|
-
var _a, _b, _c, _d;
|
|
611
|
+
var _a, _b, _c, _d, _e;
|
|
623
612
|
const disabledHooks = [];
|
|
624
613
|
const hookMap = {
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
614
|
+
afterResolve: (_a = this.compilationParams) === null || _a === void 0 ? void 0 : _a.normalModuleFactory.hooks.afterResolve,
|
|
615
|
+
contextModuleFactoryBeforeResolve: (_b = this.compilationParams) === null || _b === void 0 ? void 0 : _b.contextModuleFactory.hooks.beforeResolve,
|
|
616
|
+
contextModuleFactoryAfterResolve: (_c = this.compilationParams) === null || _c === void 0 ? void 0 : _c.contextModuleFactory.hooks.afterResolve,
|
|
617
|
+
normalModuleFactoryCreateModule: (_d = this.compilationParams) === null || _d === void 0 ? void 0 : _d.normalModuleFactory.hooks.createModule,
|
|
618
|
+
normalModuleFactoryResolveForScheme: (_e = this.compilationParams) === null || _e === void 0 ? void 0 : _e.normalModuleFactory.hooks.resolveForScheme
|
|
629
619
|
};
|
|
630
620
|
for (const [name, hook] of Object.entries(hookMap)) {
|
|
631
621
|
if (typeof hook !== "undefined" &&
|
|
@@ -650,6 +640,17 @@ _Compiler_instance = new WeakMap(), _Compiler_disabledHooks = new WeakMap(), _Co
|
|
|
650
640
|
}, _Compiler_afterProcessAssets = async function _Compiler_afterProcessAssets() {
|
|
651
641
|
await this.compilation.hooks.afterProcessAssets.promise(this.compilation.assets);
|
|
652
642
|
__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];
|
|
653
654
|
}, _Compiler_contextModuleFactoryBeforeResolve = async function _Compiler_contextModuleFactoryBeforeResolve(resourceData) {
|
|
654
655
|
let res = await this.compilationParams.contextModuleFactory.hooks.beforeResolve.promise(resourceData);
|
|
655
656
|
__classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_updateDisabledHooks).call(this);
|
package/dist/Module.d.ts
CHANGED
|
@@ -1,24 +1,5 @@
|
|
|
1
|
-
import { JsCodegenerationResult, JsCodegenerationResults,
|
|
1
|
+
import { JsCodegenerationResult, JsCodegenerationResults, 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
|
-
};
|
|
22
3
|
export declare class Module {
|
|
23
4
|
#private;
|
|
24
5
|
_originalSource?: Source;
|
|
@@ -1,7 +1,22 @@
|
|
|
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
|
-
|
|
4
|
+
type ResourceData = {
|
|
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
|
+
};
|
|
5
20
|
type CreateModuleData = binding.CreateModuleData & {
|
|
6
21
|
settings: {};
|
|
7
22
|
matchResource: string;
|
|
@@ -10,7 +25,7 @@ export declare class NormalModuleFactory {
|
|
|
10
25
|
hooks: {
|
|
11
26
|
resolveForScheme: HookMap<AsyncSeriesBailHook<[ResourceDataWithData], true | void>>;
|
|
12
27
|
beforeResolve: liteTapable.AsyncSeriesBailHook<[ResolveData], false | void>;
|
|
13
|
-
afterResolve:
|
|
28
|
+
afterResolve: AsyncSeriesBailHook<[ResolveData], boolean | void>;
|
|
14
29
|
createModule: AsyncSeriesBailHook<[CreateModuleData, {}], void>;
|
|
15
30
|
};
|
|
16
31
|
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 tapable_1.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,7 +336,8 @@ const getRawModuleRule = (rule, path, options) => {
|
|
|
336
336
|
if (rule.resourceQuery && !tryMatch(query, rule.resourceQuery)) {
|
|
337
337
|
return false;
|
|
338
338
|
}
|
|
339
|
-
if (rule.resourceFragment &&
|
|
339
|
+
if (rule.resourceFragment &&
|
|
340
|
+
!tryMatch(fragment, rule.resourceFragment)) {
|
|
340
341
|
return false;
|
|
341
342
|
}
|
|
342
343
|
return true;
|
|
@@ -66,15 +66,10 @@ 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);
|
|
70
69
|
shared[name].scope.push(scope);
|
|
71
70
|
}
|
|
72
71
|
else {
|
|
73
|
-
shared[name] = {
|
|
74
|
-
version: [version],
|
|
75
|
-
get: factory,
|
|
76
|
-
scope: [scope]
|
|
77
|
-
};
|
|
72
|
+
shared[name] = { version, get: factory, scope: [scope] };
|
|
78
73
|
}
|
|
79
74
|
}
|
|
80
75
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rspack/core",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.9-canary-8fd75cb-20240326041944",
|
|
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/
|
|
60
|
-
"@rspack/
|
|
59
|
+
"@rspack/plugin-minify": "^0.5.9-canary-8fd75cb-20240326041944",
|
|
60
|
+
"@rspack/core": "0.5.9-canary-8fd75cb-20240326041944"
|
|
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.
|
|
75
|
+
"@rspack/binding": "0.5.9-canary-8fd75cb-20240326041944"
|
|
76
76
|
},
|
|
77
77
|
"peerDependencies": {
|
|
78
78
|
"@swc/helpers": ">=0.5.1"
|