@rspack/core 0.5.9-canary-8778e17-20240328104834 → 0.5.9-canary-a856e2e-20240329110405
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/exports.d.ts
CHANGED
|
@@ -765,6 +765,7 @@ export { HotModuleReplacementPlugin } from "./builtin-plugin";
|
|
|
765
765
|
export { LoaderOptionsPlugin } from "./lib/LoaderOptionsPlugin";
|
|
766
766
|
export { LoaderTargetPlugin } from "./lib/LoaderTargetPlugin";
|
|
767
767
|
export { EnvironmentPlugin } from "./lib/EnvironmentPlugin";
|
|
768
|
+
export { NormalModuleReplacementPlugin } from "./lib/NormalModuleReplacementPlugin";
|
|
768
769
|
import NodeTemplatePlugin from "./node/NodeTemplatePlugin";
|
|
769
770
|
export declare const node: {
|
|
770
771
|
NodeTargetPlugin: {
|
package/dist/exports.js
CHANGED
|
@@ -3,7 +3,7 @@ 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.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.EnvironmentPlugin = exports.LoaderTargetPlugin = exports.LoaderOptionsPlugin = exports.HotModuleReplacementPlugin = exports.ExternalsPlugin = exports.EntryPlugin = exports.ProgressPlugin = exports.DefinePlugin = exports.ProvidePlugin = 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;
|
|
6
|
+
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.EntryPlugin = exports.ProgressPlugin = exports.DefinePlugin = exports.ProvidePlugin = 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;
|
|
7
7
|
const { version: rspackVersion, webpackVersion } = require("../package.json");
|
|
8
8
|
exports.rspackVersion = rspackVersion;
|
|
9
9
|
exports.version = webpackVersion;
|
|
@@ -67,6 +67,8 @@ var LoaderTargetPlugin_1 = require("./lib/LoaderTargetPlugin");
|
|
|
67
67
|
Object.defineProperty(exports, "LoaderTargetPlugin", { enumerable: true, get: function () { return LoaderTargetPlugin_1.LoaderTargetPlugin; } });
|
|
68
68
|
var EnvironmentPlugin_1 = require("./lib/EnvironmentPlugin");
|
|
69
69
|
Object.defineProperty(exports, "EnvironmentPlugin", { enumerable: true, get: function () { return EnvironmentPlugin_1.EnvironmentPlugin; } });
|
|
70
|
+
var NormalModuleReplacementPlugin_1 = require("./lib/NormalModuleReplacementPlugin");
|
|
71
|
+
Object.defineProperty(exports, "NormalModuleReplacementPlugin", { enumerable: true, get: function () { return NormalModuleReplacementPlugin_1.NormalModuleReplacementPlugin; } });
|
|
70
72
|
const NodeTemplatePlugin_1 = __importDefault(require("./node/NodeTemplatePlugin"));
|
|
71
73
|
const builtin_plugin_8 = require("./builtin-plugin");
|
|
72
74
|
exports.node = { NodeTargetPlugin: builtin_plugin_8.NodeTargetPlugin, NodeTemplatePlugin: NodeTemplatePlugin_1.default };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Based on [webpack/lib/NormalModuleReplacementPlugin.js]{@link https://github.com/webpack/webpack/blob/29cc4ead7eb6aafc3a5f6d0b10ce41d33d1ad874/lib/NormalModuleReplacementPlugin.js}
|
|
3
|
+
* Licensed with [MIT License]{@link http://www.opensource.org/licenses/mit-license.php}
|
|
4
|
+
* Original Author Tobias Koppers @sokra
|
|
5
|
+
*/
|
|
6
|
+
import { Compiler } from "../Compiler";
|
|
7
|
+
import { ResolveData } from "../Module";
|
|
8
|
+
type ModuleReplacer = (createData: ResolveData) => void;
|
|
9
|
+
export declare class NormalModuleReplacementPlugin {
|
|
10
|
+
readonly resourceRegExp: RegExp;
|
|
11
|
+
readonly newResource: string | ModuleReplacer;
|
|
12
|
+
/**
|
|
13
|
+
* @param {RegExp} resourceRegExp the resource matcher
|
|
14
|
+
* @param {string|ModuleReplacer} newResource the resource replacement
|
|
15
|
+
*/
|
|
16
|
+
constructor(resourceRegExp: RegExp, newResource: string | ModuleReplacer);
|
|
17
|
+
apply(compiler: Compiler): void;
|
|
18
|
+
}
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Based on [webpack/lib/NormalModuleReplacementPlugin.js]{@link https://github.com/webpack/webpack/blob/29cc4ead7eb6aafc3a5f6d0b10ce41d33d1ad874/lib/NormalModuleReplacementPlugin.js}
|
|
4
|
+
* Licensed with [MIT License]{@link http://www.opensource.org/licenses/mit-license.php}
|
|
5
|
+
* Original Author Tobias Koppers @sokra
|
|
6
|
+
*/
|
|
7
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
8
|
+
if (k2 === undefined) k2 = k;
|
|
9
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
10
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
11
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
12
|
+
}
|
|
13
|
+
Object.defineProperty(o, k2, desc);
|
|
14
|
+
}) : (function(o, m, k, k2) {
|
|
15
|
+
if (k2 === undefined) k2 = k;
|
|
16
|
+
o[k2] = m[k];
|
|
17
|
+
}));
|
|
18
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
19
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
20
|
+
}) : function(o, v) {
|
|
21
|
+
o["default"] = v;
|
|
22
|
+
});
|
|
23
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
24
|
+
if (mod && mod.__esModule) return mod;
|
|
25
|
+
var result = {};
|
|
26
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
27
|
+
__setModuleDefault(result, mod);
|
|
28
|
+
return result;
|
|
29
|
+
};
|
|
30
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
|
+
exports.NormalModuleReplacementPlugin = void 0;
|
|
32
|
+
const NodePath = __importStar(require("node:path"));
|
|
33
|
+
class NormalModuleReplacementPlugin {
|
|
34
|
+
/**
|
|
35
|
+
* @param {RegExp} resourceRegExp the resource matcher
|
|
36
|
+
* @param {string|ModuleReplacer} newResource the resource replacement
|
|
37
|
+
*/
|
|
38
|
+
constructor(resourceRegExp, newResource) {
|
|
39
|
+
this.resourceRegExp = resourceRegExp;
|
|
40
|
+
this.newResource = newResource;
|
|
41
|
+
}
|
|
42
|
+
apply(compiler) {
|
|
43
|
+
const { resourceRegExp, newResource } = this;
|
|
44
|
+
compiler.hooks.normalModuleFactory.tap("NormalModuleReplacementPlugin", nmf => {
|
|
45
|
+
nmf.hooks.beforeResolve.tap("NormalModuleReplacementPlugin", result => {
|
|
46
|
+
if (resourceRegExp.test(result.request)) {
|
|
47
|
+
if (typeof newResource === "function") {
|
|
48
|
+
newResource(result);
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
result.request = newResource;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
nmf.hooks.afterResolve.tap("NormalModuleReplacementPlugin", result => {
|
|
56
|
+
const createData = result.createData || {};
|
|
57
|
+
if (resourceRegExp.test(createData.resource || "")) {
|
|
58
|
+
if (typeof newResource === "function") {
|
|
59
|
+
newResource(result);
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
if (NodePath.posix.isAbsolute(newResource) ||
|
|
63
|
+
NodePath.win32.isAbsolute(newResource)) {
|
|
64
|
+
createData.resource = newResource;
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
createData.resource = NodePath.join(NodePath.dirname(createData.resource || ""), newResource);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
exports.NormalModuleReplacementPlugin = NormalModuleReplacementPlugin;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rspack/core",
|
|
3
|
-
"version": "0.5.9-canary-
|
|
3
|
+
"version": "0.5.9-canary-a856e2e-20240329110405",
|
|
4
4
|
"webpackVersion": "5.75.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "A Fast Rust-based Web Bundler",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"directory": "packages/rspack"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@swc/plugin-remove-console": "
|
|
32
|
+
"@swc/plugin-remove-console": "1.5.121",
|
|
33
33
|
"@types/watchpack": "^2.4.0",
|
|
34
34
|
"@types/webpack-sources": "3.2.3",
|
|
35
35
|
"@types/ws": "8.5.10",
|
|
@@ -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/core": "0.5.9-canary-a856e2e-20240329110405",
|
|
60
|
+
"@rspack/plugin-minify": "^0.5.9-canary-a856e2e-20240329110405"
|
|
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.9-canary-
|
|
75
|
+
"@rspack/binding": "0.5.9-canary-a856e2e-20240329110405"
|
|
76
76
|
},
|
|
77
77
|
"peerDependencies": {
|
|
78
78
|
"@swc/helpers": ">=0.5.1"
|