@rspack/core 0.7.5 → 0.7.6-canary-1a0d77d-20240627143904
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
|
@@ -77,6 +77,7 @@ const Logger_1 = require("./logging/Logger");
|
|
|
77
77
|
const util_1 = require("./util");
|
|
78
78
|
const assertNotNil_1 = require("./util/assertNotNil");
|
|
79
79
|
const bindingVersionCheck_1 = require("./util/bindingVersionCheck");
|
|
80
|
+
const createHash_1 = require("./util/createHash");
|
|
80
81
|
const identifier_1 = require("./util/identifier");
|
|
81
82
|
class Compiler {
|
|
82
83
|
constructor(context, options) {
|
|
@@ -728,6 +729,13 @@ _Compiler_instance = new WeakMap(), _Compiler_initial = new WeakMap(), _Compiler
|
|
|
728
729
|
})
|
|
729
730
|
: false;
|
|
730
731
|
return result;
|
|
732
|
+
}),
|
|
733
|
+
registerJavascriptModulesChunkHashTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.JavascriptModulesChunkHash, () => builtin_plugin_1.JavascriptModulesPlugin.getCompilationHooks(__classPrivateFieldGet(this, _Compiler_compilation, "f"))
|
|
734
|
+
.chunkHash, queried => (chunk) => {
|
|
735
|
+
const hash = (0, createHash_1.createHash)(this.options.output.hashFunction);
|
|
736
|
+
queried.call(Chunk_1.Chunk.__from_binding(chunk, __classPrivateFieldGet(this, _Compiler_compilation, "f")), hash);
|
|
737
|
+
const digestResult = hash.digest(this.options.output.hashDigest);
|
|
738
|
+
return Buffer.from(digestResult);
|
|
731
739
|
})
|
|
732
740
|
}, "f");
|
|
733
741
|
__classPrivateFieldSet(this, _Compiler_instance, new instanceBinding.Rspack(rawOptions, __classPrivateFieldGet(this, _Compiler_builtinPlugins, "f"), __classPrivateFieldGet(this, _Compiler_registers, "f"), FileSystem_1.ThreadsafeWritableNodeFS.__to_binding(this.outputFileSystem)), "f");
|
|
@@ -1,10 +1,16 @@
|
|
|
1
|
-
import { BuiltinPluginName } from "@rspack/binding";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
};
|
|
1
|
+
import { BuiltinPlugin, BuiltinPluginName } from "@rspack/binding";
|
|
2
|
+
import { Compilation } from "../Compilation";
|
|
3
|
+
import * as liteTapable from "../lite-tapable";
|
|
4
|
+
import { RspackBuiltinPlugin } from "./base";
|
|
5
|
+
import Hash = require("../util/hash");
|
|
6
|
+
import { Chunk } from "../Chunk";
|
|
7
|
+
export type CompilationHooks = {
|
|
8
|
+
chunkHash: liteTapable.SyncHook<[Chunk, Hash]>;
|
|
10
9
|
};
|
|
10
|
+
export declare class JavascriptModulesPlugin extends RspackBuiltinPlugin {
|
|
11
|
+
name: BuiltinPluginName;
|
|
12
|
+
affectedHooks: "compilation";
|
|
13
|
+
constructor();
|
|
14
|
+
raw(): BuiltinPlugin;
|
|
15
|
+
static getCompilationHooks(compilation: Compilation): CompilationHooks;
|
|
16
|
+
}
|
|
@@ -1,6 +1,55 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
26
|
exports.JavascriptModulesPlugin = void 0;
|
|
4
27
|
const binding_1 = require("@rspack/binding");
|
|
28
|
+
const Compilation_1 = require("../Compilation");
|
|
29
|
+
const liteTapable = __importStar(require("../lite-tapable"));
|
|
5
30
|
const base_1 = require("./base");
|
|
6
|
-
|
|
31
|
+
const compilationHooksMap = new WeakMap();
|
|
32
|
+
class JavascriptModulesPlugin extends base_1.RspackBuiltinPlugin {
|
|
33
|
+
constructor() {
|
|
34
|
+
super();
|
|
35
|
+
this.name = binding_1.BuiltinPluginName.JavascriptModulesPlugin;
|
|
36
|
+
this.affectedHooks = "compilation";
|
|
37
|
+
}
|
|
38
|
+
raw() {
|
|
39
|
+
return (0, base_1.createBuiltinPlugin)(this.name, undefined);
|
|
40
|
+
}
|
|
41
|
+
static getCompilationHooks(compilation) {
|
|
42
|
+
if (!(compilation instanceof Compilation_1.Compilation)) {
|
|
43
|
+
throw new TypeError("The 'compilation' argument must be an instance of Compilation");
|
|
44
|
+
}
|
|
45
|
+
let hooks = compilationHooksMap.get(compilation);
|
|
46
|
+
if (hooks === undefined) {
|
|
47
|
+
hooks = {
|
|
48
|
+
chunkHash: new liteTapable.SyncHook(["chunk", "hash"])
|
|
49
|
+
};
|
|
50
|
+
compilationHooksMap.set(compilation, hooks);
|
|
51
|
+
}
|
|
52
|
+
return hooks;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
exports.JavascriptModulesPlugin = JavascriptModulesPlugin;
|
package/dist/exports.d.ts
CHANGED
|
@@ -87,9 +87,10 @@ interface Wasm {
|
|
|
87
87
|
EnableWasmLoadingPlugin: typeof EnableWasmLoadingPlugin;
|
|
88
88
|
}
|
|
89
89
|
export declare const wasm: Wasm;
|
|
90
|
-
import { EnableChunkLoadingPlugin } from "./builtin-plugin";
|
|
90
|
+
import { EnableChunkLoadingPlugin, JavascriptModulesPlugin } from "./builtin-plugin";
|
|
91
91
|
interface JavaScript {
|
|
92
92
|
EnableChunkLoadingPlugin: typeof EnableChunkLoadingPlugin;
|
|
93
|
+
JavascriptModulesPlugin: typeof JavascriptModulesPlugin;
|
|
93
94
|
}
|
|
94
95
|
export declare const javascript: JavaScript;
|
|
95
96
|
import { WebWorkerTemplatePlugin } from "./builtin-plugin";
|
package/dist/exports.js
CHANGED
|
@@ -117,7 +117,10 @@ exports.library = { EnableLibraryPlugin: builtin_plugin_13.EnableLibraryPlugin }
|
|
|
117
117
|
const builtin_plugin_14 = require("./builtin-plugin");
|
|
118
118
|
exports.wasm = { EnableWasmLoadingPlugin: builtin_plugin_14.EnableWasmLoadingPlugin };
|
|
119
119
|
const builtin_plugin_15 = require("./builtin-plugin");
|
|
120
|
-
exports.javascript = {
|
|
120
|
+
exports.javascript = {
|
|
121
|
+
EnableChunkLoadingPlugin: builtin_plugin_15.EnableChunkLoadingPlugin,
|
|
122
|
+
JavascriptModulesPlugin: builtin_plugin_15.JavascriptModulesPlugin
|
|
123
|
+
};
|
|
121
124
|
const builtin_plugin_16 = require("./builtin-plugin");
|
|
122
125
|
exports.webworker = { WebWorkerTemplatePlugin: builtin_plugin_16.WebWorkerTemplatePlugin };
|
|
123
126
|
const builtin_plugin_17 = require("./builtin-plugin");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rspack/core",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.6-canary-1a0d77d-20240627143904",
|
|
4
4
|
"webpackVersion": "5.75.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "The fast Rust-based web bundler with webpack-compatible API",
|
|
@@ -74,15 +74,15 @@
|
|
|
74
74
|
"watchpack": "^2.4.0",
|
|
75
75
|
"zod": "^3.21.4",
|
|
76
76
|
"zod-validation-error": "1.3.1",
|
|
77
|
-
"@rspack/core": "0.7.
|
|
78
|
-
"@rspack/plugin-minify": "^0.7.
|
|
77
|
+
"@rspack/core": "0.7.6-canary-1a0d77d-20240627143904",
|
|
78
|
+
"@rspack/plugin-minify": "^0.7.6-canary-1a0d77d-20240627143904"
|
|
79
79
|
},
|
|
80
80
|
"dependencies": {
|
|
81
81
|
"@module-federation/runtime-tools": "0.1.6",
|
|
82
82
|
"caniuse-lite": "^1.0.30001616",
|
|
83
83
|
"tapable": "2.2.1",
|
|
84
84
|
"webpack-sources": "3.2.3",
|
|
85
|
-
"@rspack/binding": "0.7.
|
|
85
|
+
"@rspack/binding": "0.7.6-canary-1a0d77d-20240627143904"
|
|
86
86
|
},
|
|
87
87
|
"peerDependencies": {
|
|
88
88
|
"@swc/helpers": ">=0.5.1"
|