@rspack/core 0.7.1-canary-72a523f-20240530161839 → 0.7.1-canary-06990bb-20240531053011

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.
@@ -90,6 +90,10 @@ export declare class Compilation {
90
90
  ExecuteModuleArgument,
91
91
  ExecuteModuleContext
92
92
  ]>;
93
+ additionalTreeRuntimeRequirements: liteTapable.SyncHook<[
94
+ Chunk,
95
+ Set<string>
96
+ ], void>;
93
97
  runtimeModule: liteTapable.SyncHook<[JsRuntimeModule, Chunk], void>;
94
98
  afterSeal: liteTapable.AsyncSeriesHook<[], void>;
95
99
  };
@@ -144,6 +144,10 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
144
144
  statsPrinter: new tapable.SyncHook(["statsPrinter", "options"]),
145
145
  buildModule: new liteTapable.SyncHook(["module"]),
146
146
  executeModule: new liteTapable.SyncHook(["options", "context"]),
147
+ additionalTreeRuntimeRequirements: new liteTapable.SyncHook([
148
+ "chunk",
149
+ "runtimeRequirements"
150
+ ]),
147
151
  runtimeModule: new liteTapable.SyncHook(["module", "chunk"]),
148
152
  afterSeal: new liteTapable.AsyncSeriesHook([])
149
153
  };
package/dist/Compiler.js CHANGED
@@ -591,6 +591,14 @@ _Compiler_instance = new WeakMap(), _Compiler_initial = new WeakMap(), _Compiler
591
591
  }
592
592
  });
593
593
  }),
594
+ registerCompilationAdditionalTreeRuntimeRequirements: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind
595
+ .CompilationAdditionalTreeRuntimeRequirements, () => __classPrivateFieldGet(this, _Compiler_compilation, "f").hooks.additionalTreeRuntimeRequirements, queried => ({ chunk, runtimeRequirements }) => {
596
+ const set = (0, RuntimeGlobals_1.__from_binding_runtime_globals)(runtimeRequirements);
597
+ queried.call(Chunk_1.Chunk.__from_binding(chunk, __classPrivateFieldGet(this, _Compiler_compilation, "f")), set);
598
+ return {
599
+ runtimeRequirements: (0, RuntimeGlobals_1.__to_binding_runtime_globals)(set)
600
+ };
601
+ }),
594
602
  registerCompilationRuntimeModuleTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.CompilationRuntimeModule, () => __classPrivateFieldGet(this, _Compiler_compilation, "f").hooks.runtimeModule, queried => ({ module, chunk }) => {
595
603
  const originSource = module.source?.source;
596
604
  queried.call(module, Chunk_1.Chunk.__from_binding(chunk, __classPrivateFieldGet(this, _Compiler_compilation, "f")));
@@ -7,6 +7,9 @@
7
7
  * Copyright (c) JS Foundation and other contributors
8
8
  * https://github.com/webpack/webpack/blob/main/LICENSE
9
9
  */
10
+ import { JsRuntimeGlobals } from "@rspack/binding";
11
+ export declare function __from_binding_runtime_globals(runtimeRequirements: JsRuntimeGlobals): Set<string>;
12
+ export declare function __to_binding_runtime_globals(runtimeRequirements: Set<string>): JsRuntimeGlobals;
10
13
  export declare const RuntimeGlobals: {
11
14
  /**
12
15
  * the internal require function
@@ -1,6 +1,4 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RuntimeGlobals = void 0;
4
2
  /**
5
3
  * The following code is modified based on
6
4
  * https://github.com/webpack/webpack/blob/v5.88.2/lib/RuntimeGlobals.js
@@ -10,6 +8,38 @@ exports.RuntimeGlobals = void 0;
10
8
  * Copyright (c) JS Foundation and other contributors
11
9
  * https://github.com/webpack/webpack/blob/main/LICENSE
12
10
  */
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.RuntimeGlobals = exports.__to_binding_runtime_globals = exports.__from_binding_runtime_globals = void 0;
13
+ const REVERSE_RUNTIME_GLOBALS = new Map();
14
+ function __from_binding_runtime_globals(runtimeRequirements) {
15
+ const res = new Set();
16
+ for (let flag of runtimeRequirements.value) {
17
+ if (flag in exports.RuntimeGlobals) {
18
+ res.add(exports.RuntimeGlobals[flag]);
19
+ }
20
+ else {
21
+ res.add(flag);
22
+ }
23
+ }
24
+ return res;
25
+ }
26
+ exports.__from_binding_runtime_globals = __from_binding_runtime_globals;
27
+ function __to_binding_runtime_globals(runtimeRequirements) {
28
+ const res = {
29
+ value: []
30
+ };
31
+ for (let flag of Array.from(runtimeRequirements)) {
32
+ const item = REVERSE_RUNTIME_GLOBALS.get(flag);
33
+ if (typeof item === "string") {
34
+ res.value.push(item);
35
+ }
36
+ else {
37
+ res.value.push(flag);
38
+ }
39
+ }
40
+ return res;
41
+ }
42
+ exports.__to_binding_runtime_globals = __to_binding_runtime_globals;
13
43
  exports.RuntimeGlobals = {
14
44
  /**
15
45
  * the internal require function
@@ -322,3 +352,6 @@ exports.RuntimeGlobals = {
322
352
  */
323
353
  asyncModule: "__webpack_require__.a"
324
354
  };
355
+ for (let entry of Object.entries(exports.RuntimeGlobals)) {
356
+ REVERSE_RUNTIME_GLOBALS.set(entry[1], entry[0]);
357
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspack/core",
3
- "version": "0.7.1-canary-72a523f-20240530161839",
3
+ "version": "0.7.1-canary-06990bb-20240531053011",
4
4
  "webpackVersion": "5.75.0",
5
5
  "license": "MIT",
6
6
  "description": "A Fast Rust-based Web Bundler",
@@ -72,15 +72,15 @@
72
72
  "watchpack": "^2.4.0",
73
73
  "zod": "^3.21.4",
74
74
  "zod-validation-error": "1.3.1",
75
- "@rspack/core": "0.7.1-canary-72a523f-20240530161839",
76
- "@rspack/plugin-minify": "^0.7.1-canary-72a523f-20240530161839"
75
+ "@rspack/core": "0.7.1-canary-06990bb-20240531053011",
76
+ "@rspack/plugin-minify": "^0.7.1-canary-06990bb-20240531053011"
77
77
  },
78
78
  "dependencies": {
79
79
  "@module-federation/runtime-tools": "0.1.6",
80
80
  "caniuse-lite": "^1.0.30001616",
81
81
  "tapable": "2.2.1",
82
82
  "webpack-sources": "3.2.3",
83
- "@rspack/binding": "0.7.1-canary-72a523f-20240530161839"
83
+ "@rspack/binding": "0.7.1-canary-06990bb-20240531053011"
84
84
  },
85
85
  "peerDependencies": {
86
86
  "@swc/helpers": ">=0.5.1"