@rspack/core 0.7.1-canary-1b93a35-20240605065754 → 0.7.1-canary-a7d673e-20240606094751

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.
@@ -9,19 +9,19 @@ class ChunkGraph {
9
9
  this.compilation = compilation;
10
10
  }
11
11
  getChunkModules(chunk) {
12
- return (0, binding_1.__chunk_graph_inner_get_chunk_modules)(chunk.__internal_inner_ukey(), this.compilation.__internal_getInner()).map(m => Module_1.Module.__from_binding(m, this.compilation));
12
+ return (0, binding_1.__chunk_graph_inner_get_chunk_modules)(chunk.__internal_inner_ukey(), this.compilation.__internal_getInner()).map(m => Module_1.Module.__from_binding(m));
13
13
  }
14
14
  getChunkModulesIterable(chunk) {
15
- return new Set((0, binding_1.__chunk_graph_inner_get_chunk_modules)(chunk.__internal_inner_ukey(), this.compilation.__internal_getInner()).map(m => Module_1.Module.__from_binding(m, this.compilation)));
15
+ return new Set((0, binding_1.__chunk_graph_inner_get_chunk_modules)(chunk.__internal_inner_ukey(), this.compilation.__internal_getInner()).map(m => Module_1.Module.__from_binding(m)));
16
16
  }
17
17
  getChunkEntryModulesIterable(chunk) {
18
- return new Set((0, binding_1.__chunk_graph_inner_get_chunk_entry_modules)(chunk.__internal_inner_ukey(), this.compilation.__internal_getInner()).map(m => Module_1.Module.__from_binding(m, this.compilation)));
18
+ return new Set((0, binding_1.__chunk_graph_inner_get_chunk_entry_modules)(chunk.__internal_inner_ukey(), this.compilation.__internal_getInner()).map(m => Module_1.Module.__from_binding(m)));
19
19
  }
20
20
  getChunkEntryDependentChunksIterable(chunk) {
21
21
  return new Set((0, binding_1.__chunk_graph_inner_get_chunk_entry_dependent_chunks_iterable)(chunk.__internal_inner_ukey(), this.compilation.__internal_getInner()).map(c => Chunk_1.Chunk.__from_binding(c, this.compilation.__internal_getInner())));
22
22
  }
23
23
  getChunkModulesIterableBySourceType(chunk, sourceType) {
24
- return new Set((0, binding_1.__chunk_graph_inner_get_chunk_modules_iterable_by_source_type)(chunk.__internal_inner_ukey(), sourceType, this.compilation.__internal_getInner()).map(m => Module_1.Module.__from_binding(m, this.compilation)));
24
+ return new Set((0, binding_1.__chunk_graph_inner_get_chunk_modules_iterable_by_source_type)(chunk.__internal_inner_ukey(), sourceType, this.compilation.__internal_getInner()).map(m => Module_1.Module.__from_binding(m)));
25
25
  }
26
26
  }
27
27
  exports.ChunkGraph = ChunkGraph;
@@ -136,15 +136,6 @@ export declare class Compilation {
136
136
  * Note: This is a proxy for webpack internal API, only method `get` is supported now.
137
137
  */
138
138
  get namedChunks(): Map<string, Readonly<Chunk>>;
139
- /**
140
- * Note: This is not a webpack public API, maybe removed in future.
141
- *
142
- * @internal
143
- */
144
- __internal__getCustomModule(moduleIdentifier: string): {
145
- buildInfo: Record<string, unknown>;
146
- buildMeta: Record<string, unknown>;
147
- };
148
139
  getCache(name: string): import("./lib/CacheFacade");
149
140
  createStatsOptions(optionsOrPreset: StatsValue | undefined, context?: CreateStatsOptionsContext): StatsOptions;
150
141
  createStatsFactory(options: StatsOptions): StatsFactory;
@@ -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 _Compilation_instances, _Compilation_inner, _Compilation_cachedAssets, _Compilation_customModules, _Compilation_createCachedAssets;
39
+ var _Compilation_instances, _Compilation_inner, _Compilation_cachedAssets, _Compilation_createCachedAssets;
40
40
  Object.defineProperty(exports, "__esModule", { value: true });
41
41
  exports.Compilation = void 0;
42
42
  const tapable = __importStar(require("tapable"));
@@ -67,33 +67,25 @@ class Compilation {
67
67
  return null;
68
68
  }
69
69
  };
70
- /**
71
- * Records the dynamically added fields for Module on the JavaScript side, using the Module identifier for association.
72
- * These fields are generally used within a plugin, so they do not need to be passed back to the Rust side.
73
- */
74
- _Compilation_customModules.set(this, void 0);
75
70
  this.fileDependencies = (0, fake_1.createFakeCompilationDependencies)(() => __classPrivateFieldGet(this, _Compilation_inner, "f").getFileDependencies(), d => __classPrivateFieldGet(this, _Compilation_inner, "f").addFileDependencies(d));
76
71
  this.contextDependencies = (0, fake_1.createFakeCompilationDependencies)(() => __classPrivateFieldGet(this, _Compilation_inner, "f").getContextDependencies(), d => __classPrivateFieldGet(this, _Compilation_inner, "f").addContextDependencies(d));
77
72
  this.missingDependencies = (0, fake_1.createFakeCompilationDependencies)(() => __classPrivateFieldGet(this, _Compilation_inner, "f").getMissingDependencies(), d => __classPrivateFieldGet(this, _Compilation_inner, "f").addMissingDependencies(d));
78
73
  this.buildDependencies = (0, fake_1.createFakeCompilationDependencies)(() => __classPrivateFieldGet(this, _Compilation_inner, "f").getBuildDependencies(), d => __classPrivateFieldGet(this, _Compilation_inner, "f").addBuildDependencies(d));
79
- this._rebuildModuleCaller = (function (compilation) {
80
- return new MergeCaller_1.default((args) => {
81
- __classPrivateFieldGet(compilation, _Compilation_inner, "f").rebuildModule(args.map(item => item[0]), function (err, modules) {
82
- for (const [id, callback] of args) {
83
- const m = modules.find(item => item.moduleIdentifier === id);
84
- if (m) {
85
- callback(err, Module_1.Module.__from_binding(m, compilation));
86
- }
87
- else {
88
- callback(err || new Error("module no found"), null);
89
- }
74
+ this._rebuildModuleCaller = new MergeCaller_1.default((args) => {
75
+ __classPrivateFieldGet(this, _Compilation_inner, "f").rebuildModule(args.map(item => item[0]), function (err, modules) {
76
+ for (const [id, callback] of args) {
77
+ const m = modules.find(item => item.moduleIdentifier === id);
78
+ if (m) {
79
+ callback(err, Module_1.Module.__from_binding(m));
90
80
  }
91
- });
92
- }, 10);
93
- })(this);
81
+ else {
82
+ callback(err || new Error("module no found"), null);
83
+ }
84
+ }
85
+ });
86
+ }, 10);
94
87
  __classPrivateFieldSet(this, _Compilation_inner, inner, "f");
95
88
  __classPrivateFieldSet(this, _Compilation_cachedAssets, __classPrivateFieldGet(this, _Compilation_instances, "m", _Compilation_createCachedAssets).call(this), "f");
96
- __classPrivateFieldSet(this, _Compilation_customModules, {}, "f");
97
89
  const processAssetsHook = new liteTapable.AsyncSeriesHook([
98
90
  "assets"
99
91
  ]);
@@ -195,7 +187,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
195
187
  }
196
188
  get modules() {
197
189
  return (0, memoize_1.memoizeValue)(() => {
198
- return this.__internal__getModules().map(item => Module_1.Module.__from_binding(item, this));
190
+ return this.__internal__getModules().map(item => Module_1.Module.__from_binding(item));
199
191
  });
200
192
  }
201
193
  // FIXME: Webpack returns a `Set`
@@ -219,21 +211,6 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
219
211
  }
220
212
  };
221
213
  }
222
- /**
223
- * Note: This is not a webpack public API, maybe removed in future.
224
- *
225
- * @internal
226
- */
227
- __internal__getCustomModule(moduleIdentifier) {
228
- let module = __classPrivateFieldGet(this, _Compilation_customModules, "f")[moduleIdentifier];
229
- if (!module) {
230
- module = __classPrivateFieldGet(this, _Compilation_customModules, "f")[moduleIdentifier] = {
231
- buildInfo: {},
232
- buildMeta: {}
233
- };
234
- }
235
- return module;
236
- }
237
214
  getCache(name) {
238
215
  return this.compiler.getCache(name);
239
216
  }
@@ -706,7 +683,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
706
683
  seal() { }
707
684
  unseal() { }
708
685
  }
709
- _Compilation_inner = new WeakMap(), _Compilation_cachedAssets = new WeakMap(), _Compilation_customModules = new WeakMap(), _Compilation_instances = new WeakSet(), _Compilation_createCachedAssets = function _Compilation_createCachedAssets() {
686
+ _Compilation_inner = new WeakMap(), _Compilation_cachedAssets = new WeakMap(), _Compilation_instances = new WeakSet(), _Compilation_createCachedAssets = function _Compilation_createCachedAssets() {
710
687
  return new Proxy({}, {
711
688
  get: (_, property) => {
712
689
  if (typeof property === "string") {
package/dist/Compiler.js CHANGED
@@ -608,9 +608,9 @@ _Compiler_instance = new WeakMap(), _Compiler_initial = new WeakMap(), _Compiler
608
608
  }
609
609
  return;
610
610
  }),
611
- registerCompilationBuildModuleTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.CompilationBuildModule, () => __classPrivateFieldGet(this, _Compiler_compilation, "f").hooks.buildModule, queired => (m) => queired.call(Module_1.Module.__from_binding(m, __classPrivateFieldGet(this, _Compiler_compilation, "f")))),
612
- registerCompilationStillValidModuleTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.CompilationStillValidModule, () => __classPrivateFieldGet(this, _Compiler_compilation, "f").hooks.stillValidModule, queired => (m) => queired.call(Module_1.Module.__from_binding(m, __classPrivateFieldGet(this, _Compiler_compilation, "f")))),
613
- registerCompilationSucceedModuleTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.CompilationSucceedModule, () => __classPrivateFieldGet(this, _Compiler_compilation, "f").hooks.succeedModule, queired => (m) => queired.call(Module_1.Module.__from_binding(m, __classPrivateFieldGet(this, _Compiler_compilation, "f")))),
611
+ registerCompilationBuildModuleTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.CompilationBuildModule, () => __classPrivateFieldGet(this, _Compiler_compilation, "f").hooks.buildModule, queired => (m) => queired.call(Module_1.Module.__from_binding(m))),
612
+ registerCompilationStillValidModuleTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.CompilationStillValidModule, () => __classPrivateFieldGet(this, _Compiler_compilation, "f").hooks.stillValidModule, queired => (m) => queired.call(Module_1.Module.__from_binding(m))),
613
+ registerCompilationSucceedModuleTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.CompilationSucceedModule, () => __classPrivateFieldGet(this, _Compiler_compilation, "f").hooks.succeedModule, queired => (m) => queired.call(Module_1.Module.__from_binding(m))),
614
614
  registerCompilationExecuteModuleTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.CompilationExecuteModule, () => __classPrivateFieldGet(this, _Compiler_compilation, "f").hooks.executeModule, queried => ({ entry, id, codegenResults, runtimeModules }) => {
615
615
  const __webpack_require__ = (id) => {
616
616
  const cached = moduleCache[id];
package/dist/Module.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  import { JsCodegenerationResult, JsCodegenerationResults, JsCreateData, JsModule } from "@rspack/binding";
2
2
  import { Source } from "webpack-sources";
3
- import { Compilation } from "./Compilation";
4
3
  export type ResourceData = {
5
4
  resource: string;
6
5
  path: string;
@@ -33,26 +32,12 @@ export type ContextModuleFactoryAfterResolveResult = false | {
33
32
  export declare class Module {
34
33
  #private;
35
34
  _originalSource?: Source;
36
- context?: string;
37
- resource?: string;
38
- request?: string;
39
- userRequest?: string;
40
35
  rawRequest?: string;
41
- /**
42
- * Records the dynamically added fields for Module on the JavaScript side.
43
- * These fields are generally used within a plugin, so they do not need to be passed back to the Rust side.
44
- * @see {@link Compilation#customModules}
45
- */
46
- buildInfo: Record<string, any>;
47
- /**
48
- * Records the dynamically added fields for Module on the JavaScript side.
49
- * These fields are generally used within a plugin, so they do not need to be passed back to the Rust side.
50
- * @see {@link Compilation#customModules}
51
- */
52
- buildMeta: Record<string, any>;
53
- static __from_binding(module: JsModule, compilation?: Compilation): Module;
54
- constructor(module: JsModule, compilation?: Compilation);
55
- originalSource(): Source | null;
36
+ static __from_binding(module: JsModule): Module;
37
+ constructor(module: JsModule);
38
+ get context(): string | undefined;
39
+ get resource(): string | undefined;
40
+ get originalSource(): Source | null;
56
41
  identifier(): string;
57
42
  nameForCondition(): string | null;
58
43
  }
package/dist/Module.js CHANGED
@@ -15,22 +15,21 @@ Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.CodeGenerationResults = exports.CodeGenerationResult = exports.Module = void 0;
16
16
  const source_1 = require("./util/source");
17
17
  class Module {
18
- static __from_binding(module, compilation) {
19
- return new Module(module, compilation);
18
+ static __from_binding(module) {
19
+ return new Module(module);
20
20
  }
21
- constructor(module, compilation) {
21
+ constructor(module) {
22
22
  _Module_inner.set(this, void 0);
23
23
  __classPrivateFieldSet(this, _Module_inner, module, "f");
24
- this.context = module.context;
25
- this.resource = module.resource;
26
- this.request = module.request;
27
- this.userRequest = module.userRequest;
28
24
  this.rawRequest = module.rawRequest;
29
- const customModule = compilation?.__internal__getCustomModule(module.moduleIdentifier);
30
- this.buildInfo = customModule?.buildInfo || {};
31
- this.buildMeta = customModule?.buildMeta || {};
32
25
  }
33
- originalSource() {
26
+ get context() {
27
+ return __classPrivateFieldGet(this, _Module_inner, "f").context;
28
+ }
29
+ get resource() {
30
+ return __classPrivateFieldGet(this, _Module_inner, "f").resource;
31
+ }
32
+ get originalSource() {
34
33
  if (this._originalSource)
35
34
  return this._originalSource;
36
35
  if (__classPrivateFieldGet(this, _Module_inner, "f").originalSource) {
@@ -34,7 +34,7 @@ function toRawSplitChunksOptions(sc, compiler) {
34
34
  return name(undefined);
35
35
  }
36
36
  else {
37
- return name(Module_1.Module.__from_binding(ctx.module, compiler._lastCompilation));
37
+ return name(Module_1.Module.__from_binding(ctx.module));
38
38
  }
39
39
  };
40
40
  }
@@ -49,7 +49,7 @@ function toRawSplitChunksOptions(sc, compiler) {
49
49
  return test(undefined);
50
50
  }
51
51
  else {
52
- return test(Module_1.Module.__from_binding(ctx.module, compiler._lastCompilation));
52
+ return test(Module_1.Module.__from_binding(ctx.module));
53
53
  }
54
54
  };
55
55
  }
@@ -5,7 +5,6 @@ import { Compiler } from "../Compiler";
5
5
  import { Logger } from "../logging/Logger";
6
6
  import Hash = require("../util/hash");
7
7
  import { Compilation } from "../Compilation";
8
- import { Module } from "../Module";
9
8
  import { Mode, Resolve, RuleSetUseItem, Target } from "./zod";
10
9
  export interface ComposeJsUseOptions {
11
10
  devtool: RawOptions["devtool"];
@@ -112,7 +111,6 @@ export interface LoaderContext<OptionsType = {}> {
112
111
  data: unknown;
113
112
  _compiler: Compiler;
114
113
  _compilation: Compilation;
115
- _module: Module;
116
114
  /**
117
115
  * Internal field for interoperability.
118
116
  * Do not use this in anywhere else.
@@ -18,7 +18,6 @@ const createHash_1 = require("../util/createHash");
18
18
  const identifier_1 = require("../util/identifier");
19
19
  const memoize_1 = require("../util/memoize");
20
20
  const loadLoader = require("./loadLoader");
21
- const Module_1 = require("../Module");
22
21
  const querystring = require("node:querystring");
23
22
  const PATH_QUERY_FRAGMENT_REGEXP = /^((?:\u200b.|[^?#\u200b])*)(\?(?:\u200b.|[^#\u200b])*)?(#.*)?$/;
24
23
  function parsePathQueryFragment(str) {
@@ -203,7 +202,7 @@ async function runLoaders(compiler, rawContext) {
203
202
  return new Promise((resolve, reject) => {
204
203
  compiler
205
204
  ._lastCompilation.__internal_getInner()
206
- .importModule(request, options.publicPath, options.baseUri, rawContext._module.moduleIdentifier, loaderContext.context, (err, res) => {
205
+ .importModule(request, options.publicPath, options.baseUri, rawContext._moduleIdentifier, loaderContext.context, (err, res) => {
207
206
  if (err)
208
207
  reject(err);
209
208
  else {
@@ -219,9 +218,6 @@ async function runLoaders(compiler, rawContext) {
219
218
  for (const dep of res.fileDependencies) {
220
219
  this.addDependency(dep);
221
220
  }
222
- if (res.cacheable === false) {
223
- this.cacheable(false);
224
- }
225
221
  assetFilenames.push(...res.assets);
226
222
  resolve(compiler.__internal__getModuleExecutionResult(res.id));
227
223
  }
@@ -230,7 +226,7 @@ async function runLoaders(compiler, rawContext) {
230
226
  }
231
227
  return compiler
232
228
  ._lastCompilation.__internal_getInner()
233
- .importModule(request, options.publicPath, options.baseUri, rawContext._module.moduleIdentifier, loaderContext.context, (err, res) => {
229
+ .importModule(request, options.publicPath, options.baseUri, rawContext._moduleIdentifier, loaderContext.context, (err, res) => {
234
230
  if (err) {
235
231
  callback(err, undefined);
236
232
  }
@@ -247,9 +243,6 @@ async function runLoaders(compiler, rawContext) {
247
243
  for (const dep of res.fileDependencies) {
248
244
  this.addDependency(dep);
249
245
  }
250
- if (res.cacheable === false) {
251
- this.cacheable(false);
252
- }
253
246
  assetFilenames.push(...res.assets);
254
247
  callback(undefined, compiler.__internal__getModuleExecutionResult(res.id));
255
248
  }
@@ -486,7 +479,6 @@ async function runLoaders(compiler, rawContext) {
486
479
  };
487
480
  loaderContext._compiler = compiler;
488
481
  loaderContext._compilation = compiler._lastCompilation;
489
- loaderContext._module = Module_1.Module.__from_binding(rawContext._module, compiler._lastCompilation);
490
482
  loaderContext.getOptions = function () {
491
483
  const loader = getCurrentLoader(loaderContext);
492
484
  let options = loader?.options;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspack/core",
3
- "version": "0.7.1-canary-1b93a35-20240605065754",
3
+ "version": "0.7.1-canary-a7d673e-20240606094751",
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-1b93a35-20240605065754",
76
- "@rspack/plugin-minify": "^0.7.1-canary-1b93a35-20240605065754"
75
+ "@rspack/plugin-minify": "^0.7.1-canary-a7d673e-20240606094751",
76
+ "@rspack/core": "0.7.1-canary-a7d673e-20240606094751"
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-1b93a35-20240605065754"
83
+ "@rspack/binding": "0.7.1-canary-a7d673e-20240606094751"
84
84
  },
85
85
  "peerDependencies": {
86
86
  "@swc/helpers": ">=0.5.1"