@rspack/core 0.7.4-canary-bdc2037-20240617004808 → 0.7.4

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/Chunk.d.ts CHANGED
@@ -26,5 +26,5 @@ export declare class Chunk {
26
26
  getAllAsyncChunks(): Iterable<Chunk>;
27
27
  getAllInitialChunks(): Iterable<Chunk>;
28
28
  getAllReferencedChunks(): Iterable<Chunk>;
29
- __internal_inner_ukey(): number;
29
+ __internal_innerUkey(): number;
30
30
  }
package/dist/Chunk.js CHANGED
@@ -69,7 +69,7 @@ class Chunk {
69
69
  getAllReferencedChunks() {
70
70
  return new Set((0, binding_1.__chunk_inner_get_all_referenced_chunks)(__classPrivateFieldGet(this, _Chunk_inner, "f").__inner_ukey, __classPrivateFieldGet(this, _Chunk_inner_compilation, "f")).map(c => Chunk.__from_binding(c, __classPrivateFieldGet(this, _Chunk_inner_compilation, "f"))));
71
71
  }
72
- __internal_inner_ukey() {
72
+ __internal_innerUkey() {
73
73
  return __classPrivateFieldGet(this, _Chunk_inner, "f").__inner_ukey;
74
74
  }
75
75
  }
@@ -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_innerUkey(), this.compilation.__internal_getInner()).map(m => Module_1.Module.__from_binding(m, this.compilation));
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_innerUkey(), this.compilation.__internal_getInner()).map(m => Module_1.Module.__from_binding(m, this.compilation)));
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_innerUkey(), this.compilation.__internal_getInner()).map(m => Module_1.Module.__from_binding(m, this.compilation)));
19
19
  }
20
20
  getChunkEntryDependentChunksIterable(chunk) {
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())));
21
+ return new Set((0, binding_1.__chunk_graph_inner_get_chunk_entry_dependent_chunks_iterable)(chunk.__internal_innerUkey(), 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_innerUkey(), sourceType, this.compilation.__internal_getInner()).map(m => Module_1.Module.__from_binding(m, this.compilation)));
25
25
  }
26
26
  }
27
27
  exports.ChunkGraph = ChunkGraph;
@@ -9,6 +9,6 @@ export declare class ChunkGroup {
9
9
  get chunks(): Chunk[];
10
10
  get index(): number | undefined;
11
11
  get name(): string | undefined;
12
- __internal_inner_ukey(): number;
13
- __internal_inner_compilation(): JsCompilation;
12
+ __internal_innerUkey(): number;
13
+ __internal_innerCompilation(): JsCompilation;
14
14
  }
@@ -10,7 +10,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
10
10
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
11
11
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
12
12
  };
13
- var _ChunkGroup_inner, _ChunkGroup_inner_compilation;
13
+ var _ChunkGroup_inner, _ChunkGroup_innerCompilation;
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.ChunkGroup = void 0;
16
16
  const binding_1 = require("@rspack/binding");
@@ -21,9 +21,9 @@ class ChunkGroup {
21
21
  }
22
22
  constructor(inner, compilation) {
23
23
  _ChunkGroup_inner.set(this, void 0);
24
- _ChunkGroup_inner_compilation.set(this, void 0);
24
+ _ChunkGroup_innerCompilation.set(this, void 0);
25
25
  __classPrivateFieldSet(this, _ChunkGroup_inner, inner, "f");
26
- __classPrivateFieldSet(this, _ChunkGroup_inner_compilation, compilation, "f");
26
+ __classPrivateFieldSet(this, _ChunkGroup_innerCompilation, compilation, "f");
27
27
  }
28
28
  getFiles() {
29
29
  const files = new Set();
@@ -36,12 +36,12 @@ class ChunkGroup {
36
36
  }
37
37
  getParents() {
38
38
  return __classPrivateFieldGet(this, _ChunkGroup_inner, "f").__inner_parents.map(parent => {
39
- const cg = (0, binding_1.__chunk_group_inner_get_chunk_group)(parent, __classPrivateFieldGet(this, _ChunkGroup_inner_compilation, "f"));
40
- return ChunkGroup.__from_binding(cg, __classPrivateFieldGet(this, _ChunkGroup_inner_compilation, "f"));
39
+ const cg = (0, binding_1.__chunk_group_inner_get_chunk_group)(parent, __classPrivateFieldGet(this, _ChunkGroup_innerCompilation, "f"));
40
+ return ChunkGroup.__from_binding(cg, __classPrivateFieldGet(this, _ChunkGroup_innerCompilation, "f"));
41
41
  });
42
42
  }
43
43
  get chunks() {
44
- return __classPrivateFieldGet(this, _ChunkGroup_inner, "f").chunks.map(c => Chunk_1.Chunk.__from_binding(c, __classPrivateFieldGet(this, _ChunkGroup_inner_compilation, "f")));
44
+ return __classPrivateFieldGet(this, _ChunkGroup_inner, "f").chunks.map(c => Chunk_1.Chunk.__from_binding(c, __classPrivateFieldGet(this, _ChunkGroup_innerCompilation, "f")));
45
45
  }
46
46
  get index() {
47
47
  return __classPrivateFieldGet(this, _ChunkGroup_inner, "f").index;
@@ -49,12 +49,12 @@ class ChunkGroup {
49
49
  get name() {
50
50
  return __classPrivateFieldGet(this, _ChunkGroup_inner, "f").name;
51
51
  }
52
- __internal_inner_ukey() {
52
+ __internal_innerUkey() {
53
53
  return __classPrivateFieldGet(this, _ChunkGroup_inner, "f").__inner_ukey;
54
54
  }
55
- __internal_inner_compilation() {
56
- return __classPrivateFieldGet(this, _ChunkGroup_inner_compilation, "f");
55
+ __internal_innerCompilation() {
56
+ return __classPrivateFieldGet(this, _ChunkGroup_innerCompilation, "f");
57
57
  }
58
58
  }
59
59
  exports.ChunkGroup = ChunkGroup;
60
- _ChunkGroup_inner = new WeakMap(), _ChunkGroup_inner_compilation = new WeakMap();
60
+ _ChunkGroup_inner = new WeakMap(), _ChunkGroup_innerCompilation = new WeakMap();
@@ -314,6 +314,11 @@ export declare class Compilation {
314
314
  * @internal
315
315
  */
316
316
  __internal__getChunks(): Chunk[];
317
+ /**
318
+ * Note: This is not a webpack public API, maybe removed in future.
319
+ *
320
+ * @internal
321
+ */
317
322
  __internal_getInner(): JsCompilation;
318
323
  seal(): void;
319
324
  unseal(): void;
@@ -693,6 +693,11 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
693
693
  .getChunks()
694
694
  .map(c => Chunk_1.Chunk.__from_binding(c, __classPrivateFieldGet(this, _Compilation_inner, "f")));
695
695
  }
696
+ /**
697
+ * Note: This is not a webpack public API, maybe removed in future.
698
+ *
699
+ * @internal
700
+ */
696
701
  __internal_getInner() {
697
702
  return __classPrivateFieldGet(this, _Compilation_inner, "f");
698
703
  }
package/dist/Compiler.js CHANGED
@@ -59,8 +59,8 @@ const config_1 = require("./config");
59
59
  const index_1 = require("./index");
60
60
  const liteTapable = __importStar(require("./lite-tapable"));
61
61
  const ResolverFactory = require("./ResolverFactory");
62
+ const FileSystem_1 = require("./FileSystem");
62
63
  const ConcurrentCompilationError_1 = __importDefault(require("./error/ConcurrentCompilationError"));
63
- const fileSystem_1 = require("./fileSystem");
64
64
  const Cache = require("./lib/Cache");
65
65
  const CacheFacade = require("./lib/CacheFacade");
66
66
  const Chunk_1 = require("./Chunk");
@@ -730,7 +730,7 @@ _Compiler_instance = new WeakMap(), _Compiler_initial = new WeakMap(), _Compiler
730
730
  return result;
731
731
  })
732
732
  }, "f");
733
- __classPrivateFieldSet(this, _Compiler_instance, new instanceBinding.Rspack(rawOptions, __classPrivateFieldGet(this, _Compiler_builtinPlugins, "f"), __classPrivateFieldGet(this, _Compiler_registers, "f"), fileSystem_1.ThreadsafeWritableNodeFS.__into_binding(this.outputFileSystem)), "f");
733
+ __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");
734
734
  callback(null, __classPrivateFieldGet(this, _Compiler_instance, "f"));
735
735
  }, _Compiler_updateNonSkippableRegisters = function _Compiler_updateNonSkippableRegisters() {
736
736
  const kinds = [];
@@ -28,33 +28,8 @@ const liteTapable = __importStar(require("./lite-tapable"));
28
28
  class ContextModuleFactory {
29
29
  constructor() {
30
30
  this.hooks = {
31
- // /** @type {AsyncSeriesBailHook<[ResolveData], Module | false | void>} */
32
- // resolve: new AsyncSeriesBailHook(["resolveData"]),
33
- // /** @type {HookMap<AsyncSeriesBailHook<[ResourceDataWithData, ResolveData], true | void>>} */
34
- // resolveForScheme: new HookMap(
35
- // () => new AsyncSeriesBailHook(["resourceData"])
36
- // ),
37
- // /** @type {HookMap<AsyncSeriesBailHook<[ResourceDataWithData, ResolveData], true | void>>} */
38
- // resolveInScheme: new HookMap(
39
- // () => new AsyncSeriesBailHook(["resourceData", "resolveData"])
40
- // ),
41
- // /** @type {AsyncSeriesBailHook<[ResolveData], Module>} */
42
- // factorize: new AsyncSeriesBailHook(["resolveData"]),
43
- // /** @type {AsyncSeriesBailHook<[ResolveData], false | void>} */
44
31
  beforeResolve: new liteTapable.AsyncSeriesWaterfallHook(["resolveData"]),
45
32
  afterResolve: new liteTapable.AsyncSeriesWaterfallHook(["resolveData"])
46
- // /** @type {AsyncSeriesBailHook<[ResolveData["createData"], ResolveData], Module | void>} */
47
- // createModule: new AsyncSeriesBailHook(["createData", "resolveData"]),
48
- // /** @type {SyncWaterfallHook<[Module, ResolveData["createData"], ResolveData], Module>} */
49
- // module: new SyncWaterfallHook(["module", "createData", "resolveData"]),
50
- // createParser: new HookMap(() => new SyncBailHook(["parserOptions"])),
51
- // parser: new HookMap(() => new SyncHook(["parser", "parserOptions"])),
52
- // createGenerator: new HookMap(
53
- // () => new SyncBailHook(["generatorOptions"])
54
- // ),
55
- // generator: new HookMap(
56
- // () => new SyncHook(["generator", "generatorOptions"])
57
- // )
58
33
  };
59
34
  }
60
35
  }
@@ -12,9 +12,9 @@ class Entrypoint extends ChunkGroup_1.ChunkGroup {
12
12
  super(inner, compilation);
13
13
  }
14
14
  getRuntimeChunk() {
15
- const c = (0, binding_1.__entrypoint_inner_get_runtime_chunk)(this.__internal_inner_ukey(), this.__internal_inner_compilation());
15
+ const c = (0, binding_1.__entrypoint_inner_get_runtime_chunk)(this.__internal_innerUkey(), this.__internal_innerCompilation());
16
16
  if (c)
17
- return Chunk_1.Chunk.__from_binding(c, this.__internal_inner_compilation());
17
+ return Chunk_1.Chunk.__from_binding(c, this.__internal_innerCompilation());
18
18
  return null;
19
19
  }
20
20
  }
@@ -8,6 +8,6 @@ declare class ThreadsafeWritableNodeFS implements ThreadsafeNodeFS {
8
8
  mkdirp: (name: string) => Promise<string | void> | string | void;
9
9
  removeDirAll: (name: string) => Promise<string | void> | string | void;
10
10
  constructor(fs?: OutputFileSystem);
11
- static __into_binding(fs?: OutputFileSystem): ThreadsafeWritableNodeFS;
11
+ static __to_binding(fs?: OutputFileSystem): ThreadsafeWritableNodeFS;
12
12
  }
13
13
  export { ThreadsafeWritableNodeFS };
@@ -27,7 +27,7 @@ class ThreadsafeWritableNodeFS {
27
27
  this.mkdirp = (0, memoize_1.memoizeFn)(() => util_1.default.promisify(fs_1.mkdirp.bind(null, fs)));
28
28
  this.removeDirAll = (0, memoize_1.memoizeFn)(() => util_1.default.promisify(fs_1.rmrf.bind(null, fs)));
29
29
  }
30
- static __into_binding(fs) {
30
+ static __to_binding(fs) {
31
31
  return new this(fs);
32
32
  }
33
33
  }
package/dist/Module.d.ts CHANGED
@@ -32,7 +32,6 @@ export type ContextModuleFactoryAfterResolveResult = false | {
32
32
  };
33
33
  export declare class Module {
34
34
  #private;
35
- _originalSource?: Source;
36
35
  context?: string;
37
36
  resource?: string;
38
37
  request?: string;
package/dist/Module.js CHANGED
@@ -10,7 +10,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
10
10
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
11
11
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
12
12
  };
13
- var _Module_inner, _CodeGenerationResult_inner, _CodeGenerationResults_inner;
13
+ var _Module_inner, _Module_originalSource, _CodeGenerationResult_inner, _CodeGenerationResults_inner;
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.CodeGenerationResults = exports.CodeGenerationResult = exports.Module = void 0;
16
16
  const source_1 = require("./util/source");
@@ -20,6 +20,7 @@ class Module {
20
20
  }
21
21
  constructor(module, compilation) {
22
22
  _Module_inner.set(this, void 0);
23
+ _Module_originalSource.set(this, void 0);
23
24
  __classPrivateFieldSet(this, _Module_inner, module, "f");
24
25
  this.context = module.context;
25
26
  this.resource = module.resource;
@@ -31,11 +32,11 @@ class Module {
31
32
  this.buildMeta = customModule?.buildMeta || {};
32
33
  }
33
34
  originalSource() {
34
- if (this._originalSource)
35
- return this._originalSource;
35
+ if (__classPrivateFieldGet(this, _Module_originalSource, "f"))
36
+ return __classPrivateFieldGet(this, _Module_originalSource, "f");
36
37
  if (__classPrivateFieldGet(this, _Module_inner, "f").originalSource) {
37
- this._originalSource = source_1.JsSource.__from_binding(__classPrivateFieldGet(this, _Module_inner, "f").originalSource);
38
- return this._originalSource;
38
+ __classPrivateFieldSet(this, _Module_originalSource, source_1.JsSource.__from_binding(__classPrivateFieldGet(this, _Module_inner, "f").originalSource), "f");
39
+ return __classPrivateFieldGet(this, _Module_originalSource, "f");
39
40
  }
40
41
  else {
41
42
  return null;
@@ -54,7 +55,7 @@ class Module {
54
55
  }
55
56
  }
56
57
  exports.Module = Module;
57
- _Module_inner = new WeakMap();
58
+ _Module_inner = new WeakMap(), _Module_originalSource = new WeakMap();
58
59
  class CodeGenerationResult {
59
60
  constructor(result) {
60
61
  _CodeGenerationResult_inner.set(this, void 0);
@@ -1,5 +1,8 @@
1
1
  declare class RuleSetCompiler {
2
2
  references: Map<string, any>;
3
+ /**
4
+ * builtin references that should be serializable and passed to Rust.
5
+ */
3
6
  builtinReferences: Map<string, any>;
4
7
  constructor();
5
8
  }
@@ -6,6 +6,6 @@ const base_1 = require("./base");
6
6
  exports.BundlerInfoRspackPlugin = (0, base_1.create)(binding_1.BuiltinPluginName.BundlerInfoRspackPlugin, (options) => {
7
7
  return {
8
8
  version: options.version || "unknown",
9
- force: options.force ?? false
9
+ force: options.force ?? true
10
10
  };
11
11
  });
@@ -0,0 +1,10 @@
1
+ import { BuiltinPluginName } from "@rspack/binding";
2
+ export declare const FetchCompileAsyncWasmPlugin: {
3
+ new (): {
4
+ name: BuiltinPluginName;
5
+ _options: void;
6
+ affectedHooks: "make" | "compile" | "emit" | "afterEmit" | "invalid" | "done" | "thisCompilation" | "afterDone" | "compilation" | "normalModuleFactory" | "contextModuleFactory" | "initialize" | "shouldEmit" | "infrastructureLog" | "beforeRun" | "run" | "assetEmitted" | "failed" | "shutdown" | "watchRun" | "watchClose" | "environment" | "afterEnvironment" | "afterPlugins" | "afterResolvers" | "beforeCompile" | "afterCompile" | "finishMake" | "entryOption" | undefined;
7
+ raw(): import("@rspack/binding").BuiltinPlugin;
8
+ apply(compiler: import("../Compiler").Compiler): void;
9
+ };
10
+ };
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FetchCompileAsyncWasmPlugin = void 0;
4
+ const binding_1 = require("@rspack/binding");
5
+ const base_1 = require("./base");
6
+ exports.FetchCompileAsyncWasmPlugin = (0, base_1.create)(binding_1.BuiltinPluginName.FetchCompileAsyncWasmPlugin, () => { }, "thisCompilation");
@@ -62,6 +62,7 @@ export * from "./SwcJsMinimizerPlugin";
62
62
  export * from "./WarnCaseSensitiveModulesPlugin";
63
63
  export * from "./WebWorkerTemplatePlugin";
64
64
  export * from "./WorkerPlugin";
65
+ export * from "./FetchCompileAsyncWasmPlugin";
65
66
  import { RawBuiltins } from "@rspack/binding";
66
67
  import { RspackOptionsNormalized } from "..";
67
68
  export interface Builtins {
@@ -80,6 +80,7 @@ __exportStar(require("./SwcJsMinimizerPlugin"), exports);
80
80
  __exportStar(require("./WarnCaseSensitiveModulesPlugin"), exports);
81
81
  __exportStar(require("./WebWorkerTemplatePlugin"), exports);
82
82
  __exportStar(require("./WorkerPlugin"), exports);
83
+ __exportStar(require("./FetchCompileAsyncWasmPlugin"), exports);
83
84
  function resolveTreeShaking(treeShaking, production) {
84
85
  return treeShaking !== undefined
85
86
  ? treeShaking.toString()
@@ -540,10 +540,7 @@ const applyOutputDefaults = (output, { context, outputModule, targetProperties:
540
540
  F(output, "clean", () => !!output.clean);
541
541
  D(output, "crossOriginLoading", false);
542
542
  D(output, "workerPublicPath", "");
543
- // IGNORE(output.sourceMapFilename): In webpack, sourceMapFilename is [file].map[query] by default
544
- F(output, "sourceMapFilename", () => {
545
- return "[file].map";
546
- });
543
+ D(output, "sourceMapFilename", "[file].map[query]");
547
544
  F(output, "scriptType", () => (output.module ? "module" : false));
548
545
  const { trustedTypes } = output;
549
546
  if (trustedTypes) {
package/dist/exports.d.ts CHANGED
@@ -58,6 +58,11 @@ export { EnvironmentPlugin } from "./lib/EnvironmentPlugin";
58
58
  export { LoaderOptionsPlugin } from "./lib/LoaderOptionsPlugin";
59
59
  export { LoaderTargetPlugin } from "./lib/LoaderTargetPlugin";
60
60
  export { NormalModuleReplacementPlugin } from "./lib/NormalModuleReplacementPlugin";
61
+ import { FetchCompileAsyncWasmPlugin } from "./builtin-plugin";
62
+ interface Web {
63
+ FetchCompileAsyncWasmPlugin: typeof FetchCompileAsyncWasmPlugin;
64
+ }
65
+ export declare const web: Web;
61
66
  import { NodeTargetPlugin } from "./builtin-plugin";
62
67
  import NodeEnvironmentPlugin from "./node/NodeEnvironmentPlugin";
63
68
  import NodeTemplatePlugin from "./node/NodeTemplatePlugin";
package/dist/exports.js CHANGED
@@ -26,8 +26,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
26
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.EvalDevToolModulePlugin = exports.EvalSourceMapDevToolPlugin = exports.SourceMapDevToolPlugin = exports.CopyRspackPlugin = exports.LightningCssMinimizerRspackPlugin = 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.LoaderTargetPlugin = exports.LoaderOptionsPlugin = exports.EnvironmentPlugin = exports.HotModuleReplacementPlugin = exports.ExternalsPlugin = exports.DynamicEntryPlugin = exports.EntryPlugin = exports.ProgressPlugin = exports.DefinePlugin = exports.ProvidePlugin = exports.IgnorePlugin = exports.BannerPlugin = exports.experimental_registerGlobalTrace = exports.experimental_cleanupGlobalTrace = exports.EntryOptionPlugin = exports.util = exports.config = exports.sources = exports.WebpackError = exports.Template = exports.ModuleFilenameHelpers = exports.Stats = exports.RuntimeGlobals = exports.NormalModule = exports.MultiStats = exports.WebpackOptionsApply = exports.RspackOptionsApply = exports.MultiCompiler = exports.Compiler = exports.Compilation = exports.version = exports.rspackVersion = void 0;
30
- exports.CssExtractRspackPlugin = void 0;
29
+ exports.EvalSourceMapDevToolPlugin = exports.SourceMapDevToolPlugin = exports.CopyRspackPlugin = exports.LightningCssMinimizerRspackPlugin = 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.web = exports.NormalModuleReplacementPlugin = exports.LoaderTargetPlugin = exports.LoaderOptionsPlugin = exports.EnvironmentPlugin = exports.HotModuleReplacementPlugin = exports.ExternalsPlugin = exports.DynamicEntryPlugin = exports.EntryPlugin = exports.ProgressPlugin = exports.DefinePlugin = exports.ProvidePlugin = exports.IgnorePlugin = exports.BannerPlugin = exports.experimental_registerGlobalTrace = exports.experimental_cleanupGlobalTrace = exports.EntryOptionPlugin = exports.util = exports.config = exports.sources = exports.WebpackError = exports.Template = exports.ModuleFilenameHelpers = exports.Stats = exports.RuntimeGlobals = exports.NormalModule = exports.MultiStats = exports.WebpackOptionsApply = exports.RspackOptionsApply = exports.MultiCompiler = exports.Compiler = exports.Compilation = exports.version = exports.rspackVersion = void 0;
30
+ exports.CssExtractRspackPlugin = exports.EvalDevToolModulePlugin = void 0;
31
31
  const { version: rspackVersion, webpackVersion } = require("../package.json");
32
32
  exports.rspackVersion = rspackVersion;
33
33
  exports.version = webpackVersion;
@@ -99,30 +99,34 @@ Object.defineProperty(exports, "LoaderTargetPlugin", { enumerable: true, get: fu
99
99
  var NormalModuleReplacementPlugin_1 = require("./lib/NormalModuleReplacementPlugin");
100
100
  Object.defineProperty(exports, "NormalModuleReplacementPlugin", { enumerable: true, get: function () { return NormalModuleReplacementPlugin_1.NormalModuleReplacementPlugin; } });
101
101
  const builtin_plugin_10 = require("./builtin-plugin");
102
+ exports.web = {
103
+ FetchCompileAsyncWasmPlugin: builtin_plugin_10.FetchCompileAsyncWasmPlugin
104
+ };
105
+ const builtin_plugin_11 = require("./builtin-plugin");
102
106
  const NodeEnvironmentPlugin_1 = __importDefault(require("./node/NodeEnvironmentPlugin"));
103
107
  const NodeTemplatePlugin_1 = __importDefault(require("./node/NodeTemplatePlugin"));
104
108
  exports.node = {
105
- NodeTargetPlugin: builtin_plugin_10.NodeTargetPlugin,
109
+ NodeTargetPlugin: builtin_plugin_11.NodeTargetPlugin,
106
110
  NodeTemplatePlugin: NodeTemplatePlugin_1.default,
107
111
  NodeEnvironmentPlugin: NodeEnvironmentPlugin_1.default
108
112
  };
109
- const builtin_plugin_11 = require("./builtin-plugin");
110
- exports.electron = { ElectronTargetPlugin: builtin_plugin_11.ElectronTargetPlugin };
111
113
  const builtin_plugin_12 = require("./builtin-plugin");
112
- exports.library = { EnableLibraryPlugin: builtin_plugin_12.EnableLibraryPlugin };
114
+ exports.electron = { ElectronTargetPlugin: builtin_plugin_12.ElectronTargetPlugin };
113
115
  const builtin_plugin_13 = require("./builtin-plugin");
114
- exports.wasm = { EnableWasmLoadingPlugin: builtin_plugin_13.EnableWasmLoadingPlugin };
116
+ exports.library = { EnableLibraryPlugin: builtin_plugin_13.EnableLibraryPlugin };
115
117
  const builtin_plugin_14 = require("./builtin-plugin");
116
- exports.javascript = { EnableChunkLoadingPlugin: builtin_plugin_14.EnableChunkLoadingPlugin };
118
+ exports.wasm = { EnableWasmLoadingPlugin: builtin_plugin_14.EnableWasmLoadingPlugin };
117
119
  const builtin_plugin_15 = require("./builtin-plugin");
118
- exports.webworker = { WebWorkerTemplatePlugin: builtin_plugin_15.WebWorkerTemplatePlugin };
120
+ exports.javascript = { EnableChunkLoadingPlugin: builtin_plugin_15.EnableChunkLoadingPlugin };
119
121
  const builtin_plugin_16 = require("./builtin-plugin");
122
+ exports.webworker = { WebWorkerTemplatePlugin: builtin_plugin_16.WebWorkerTemplatePlugin };
120
123
  const builtin_plugin_17 = require("./builtin-plugin");
121
124
  const builtin_plugin_18 = require("./builtin-plugin");
125
+ const builtin_plugin_19 = require("./builtin-plugin");
122
126
  exports.optimize = {
123
- LimitChunkCountPlugin: builtin_plugin_16.LimitChunkCountPlugin,
124
- RuntimeChunkPlugin: builtin_plugin_17.RuntimeChunkPlugin,
125
- SplitChunksPlugin: builtin_plugin_18.SplitChunksPlugin
127
+ LimitChunkCountPlugin: builtin_plugin_17.LimitChunkCountPlugin,
128
+ RuntimeChunkPlugin: builtin_plugin_18.RuntimeChunkPlugin,
129
+ SplitChunksPlugin: builtin_plugin_19.SplitChunksPlugin
126
130
  };
127
131
  const ModuleFederationPlugin_1 = require("./container/ModuleFederationPlugin");
128
132
  const ModuleFederationPluginV1_1 = require("./container/ModuleFederationPluginV1");
@@ -142,21 +146,21 @@ exports.sharing = {
142
146
  ConsumeSharedPlugin: ConsumeSharedPlugin_1.ConsumeSharedPlugin,
143
147
  SharePlugin: SharePlugin_1.SharePlugin
144
148
  };
145
- var builtin_plugin_19 = require("./builtin-plugin");
146
- Object.defineProperty(exports, "HtmlRspackPlugin", { enumerable: true, get: function () { return builtin_plugin_19.HtmlRspackPlugin; } });
147
149
  var builtin_plugin_20 = require("./builtin-plugin");
148
- Object.defineProperty(exports, "SwcJsMinimizerRspackPlugin", { enumerable: true, get: function () { return builtin_plugin_20.SwcJsMinimizerRspackPlugin; } });
150
+ Object.defineProperty(exports, "HtmlRspackPlugin", { enumerable: true, get: function () { return builtin_plugin_20.HtmlRspackPlugin; } });
149
151
  var builtin_plugin_21 = require("./builtin-plugin");
150
- Object.defineProperty(exports, "SwcCssMinimizerRspackPlugin", { enumerable: true, get: function () { return builtin_plugin_21.SwcCssMinimizerRspackPlugin; } });
152
+ Object.defineProperty(exports, "SwcJsMinimizerRspackPlugin", { enumerable: true, get: function () { return builtin_plugin_21.SwcJsMinimizerRspackPlugin; } });
151
153
  var builtin_plugin_22 = require("./builtin-plugin");
152
- Object.defineProperty(exports, "LightningCssMinimizerRspackPlugin", { enumerable: true, get: function () { return builtin_plugin_22.LightningCssMinimizerRspackPlugin; } });
154
+ Object.defineProperty(exports, "SwcCssMinimizerRspackPlugin", { enumerable: true, get: function () { return builtin_plugin_22.SwcCssMinimizerRspackPlugin; } });
153
155
  var builtin_plugin_23 = require("./builtin-plugin");
154
- Object.defineProperty(exports, "CopyRspackPlugin", { enumerable: true, get: function () { return builtin_plugin_23.CopyRspackPlugin; } });
156
+ Object.defineProperty(exports, "LightningCssMinimizerRspackPlugin", { enumerable: true, get: function () { return builtin_plugin_23.LightningCssMinimizerRspackPlugin; } });
155
157
  var builtin_plugin_24 = require("./builtin-plugin");
156
- Object.defineProperty(exports, "SourceMapDevToolPlugin", { enumerable: true, get: function () { return builtin_plugin_24.SourceMapDevToolPlugin; } });
158
+ Object.defineProperty(exports, "CopyRspackPlugin", { enumerable: true, get: function () { return builtin_plugin_24.CopyRspackPlugin; } });
157
159
  var builtin_plugin_25 = require("./builtin-plugin");
158
- Object.defineProperty(exports, "EvalSourceMapDevToolPlugin", { enumerable: true, get: function () { return builtin_plugin_25.EvalSourceMapDevToolPlugin; } });
160
+ Object.defineProperty(exports, "SourceMapDevToolPlugin", { enumerable: true, get: function () { return builtin_plugin_25.SourceMapDevToolPlugin; } });
159
161
  var builtin_plugin_26 = require("./builtin-plugin");
160
- Object.defineProperty(exports, "EvalDevToolModulePlugin", { enumerable: true, get: function () { return builtin_plugin_26.EvalDevToolModulePlugin; } });
162
+ Object.defineProperty(exports, "EvalSourceMapDevToolPlugin", { enumerable: true, get: function () { return builtin_plugin_26.EvalSourceMapDevToolPlugin; } });
161
163
  var builtin_plugin_27 = require("./builtin-plugin");
162
- Object.defineProperty(exports, "CssExtractRspackPlugin", { enumerable: true, get: function () { return builtin_plugin_27.CssExtractRspackPlugin; } });
164
+ Object.defineProperty(exports, "EvalDevToolModulePlugin", { enumerable: true, get: function () { return builtin_plugin_27.EvalDevToolModulePlugin; } });
165
+ var builtin_plugin_28 = require("./builtin-plugin");
166
+ Object.defineProperty(exports, "CssExtractRspackPlugin", { enumerable: true, get: function () { return builtin_plugin_28.CssExtractRspackPlugin; } });
@@ -30,7 +30,7 @@ export declare class LoaderObject {
30
30
  set data(data: any);
31
31
  shouldYield(): boolean;
32
32
  static __from_binding(loaderItem: JsLoaderItem, compiler: Compiler): LoaderObject;
33
- static __to_binding(loader: LoaderObject): JsLoaderItem["inner"];
33
+ static __to_binding(loader: LoaderObject): JsLoaderItem;
34
34
  }
35
35
  export declare function runLoaders(compiler: Compiler, context: JsLoaderContext): Promise<JsLoaderContext>;
36
36
  export declare function parsePathQueryFragment(str: string): {
@@ -22,7 +22,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
22
22
  var __importDefault = (this && this.__importDefault) || function (mod) {
23
23
  return (mod && mod.__esModule) ? mod : { "default": mod };
24
24
  };
25
- var _LoaderObject_cachedData, _LoaderObject_loaderItem;
25
+ var _LoaderObject_loaderItem;
26
26
  Object.defineProperty(exports, "__esModule", { value: true });
27
27
  exports.parsePathQueryFragment = exports.runLoaders = exports.LoaderObject = void 0;
28
28
  const node_querystring_1 = __importDefault(require("node:querystring"));
@@ -106,7 +106,6 @@ function createLoaderObject(loader, compiler) {
106
106
  }
107
107
  class LoaderObject {
108
108
  constructor(loaderItem, compiler) {
109
- _LoaderObject_cachedData.set(this, void 0);
110
109
  _LoaderObject_loaderItem.set(this, void 0);
111
110
  const { request, path, query, fragment, options, ident, normal, pitch, raw, type } = createLoaderObject(loaderItem, compiler);
112
111
  this.request = request;
@@ -120,47 +119,40 @@ class LoaderObject {
120
119
  this.raw = raw;
121
120
  this.type = type;
122
121
  __classPrivateFieldSet(this, _LoaderObject_loaderItem, loaderItem, "f");
123
- __classPrivateFieldSet(this, _LoaderObject_cachedData, null, "f");
124
122
  }
125
123
  get pitchExecuted() {
126
- return (0, binding_1.__loader_item_get_pitch_executed)(__classPrivateFieldGet(this, _LoaderObject_loaderItem, "f").inner);
124
+ return __classPrivateFieldGet(this, _LoaderObject_loaderItem, "f").pitchExecuted;
127
125
  }
128
126
  set pitchExecuted(value) {
129
127
  (0, assert_1.default)(value);
130
- (0, binding_1.__loader_item_set_pitch_executed)(__classPrivateFieldGet(this, _LoaderObject_loaderItem, "f").inner);
128
+ __classPrivateFieldGet(this, _LoaderObject_loaderItem, "f").pitchExecuted = true;
131
129
  }
132
130
  get normalExecuted() {
133
- return (0, binding_1.__loader_item_get_normal_executed)(__classPrivateFieldGet(this, _LoaderObject_loaderItem, "f").inner);
131
+ return __classPrivateFieldGet(this, _LoaderObject_loaderItem, "f").normalExecuted;
134
132
  }
135
133
  set normalExecuted(value) {
136
134
  (0, assert_1.default)(value);
137
- (0, binding_1.__loader_item_set_normal_executed)(__classPrivateFieldGet(this, _LoaderObject_loaderItem, "f").inner);
135
+ __classPrivateFieldGet(this, _LoaderObject_loaderItem, "f").normalExecuted = true;
138
136
  }
139
137
  // A data object shared between the pitch and the normal phase
140
138
  get data() {
141
- __classPrivateFieldSet(this, _LoaderObject_cachedData, __classPrivateFieldGet(this, _LoaderObject_cachedData, "f") ??
142
- (0, binding_1.__loader_item_get_loader_data)(__classPrivateFieldGet(this, _LoaderObject_loaderItem, "f").inner) ??
143
- {}, "f");
144
- return new Proxy(__classPrivateFieldGet(this, _LoaderObject_cachedData, "f"), {
139
+ return new Proxy((__classPrivateFieldGet(this, _LoaderObject_loaderItem, "f").data = __classPrivateFieldGet(this, _LoaderObject_loaderItem, "f").data ?? {}), {
145
140
  set: (_, property, value) => {
146
141
  if (typeof property === "string") {
147
- console.log(property, value);
148
- __classPrivateFieldGet(this, _LoaderObject_cachedData, "f")[property] = value;
149
- (0, binding_1.__loader_item_set_loader_data)(__classPrivateFieldGet(this, _LoaderObject_loaderItem, "f").inner, __classPrivateFieldGet(this, _LoaderObject_cachedData, "f"));
142
+ __classPrivateFieldGet(this, _LoaderObject_loaderItem, "f").data[property] = value;
150
143
  }
151
144
  return true;
152
145
  },
153
146
  get: (_, property) => {
154
147
  if (typeof property === "string") {
155
- return __classPrivateFieldGet(this, _LoaderObject_cachedData, "f")[property];
148
+ return __classPrivateFieldGet(this, _LoaderObject_loaderItem, "f").data[property];
156
149
  }
157
150
  }
158
151
  });
159
152
  }
160
153
  // A data object shared between the pitch and the normal phase
161
154
  set data(data) {
162
- __classPrivateFieldSet(this, _LoaderObject_cachedData, data, "f");
163
- (0, binding_1.__loader_item_set_loader_data)(__classPrivateFieldGet(this, _LoaderObject_loaderItem, "f").inner, data);
155
+ __classPrivateFieldGet(this, _LoaderObject_loaderItem, "f").data = data;
164
156
  }
165
157
  shouldYield() {
166
158
  return this.request.startsWith(adapterRuleUse_1.BUILTIN_LOADER_PREFIX);
@@ -169,11 +161,11 @@ class LoaderObject {
169
161
  return new this(loaderItem, compiler);
170
162
  }
171
163
  static __to_binding(loader) {
172
- return __classPrivateFieldGet(loader, _LoaderObject_loaderItem, "f").inner;
164
+ return __classPrivateFieldGet(loader, _LoaderObject_loaderItem, "f");
173
165
  }
174
166
  }
175
167
  exports.LoaderObject = LoaderObject;
176
- _LoaderObject_cachedData = new WeakMap(), _LoaderObject_loaderItem = new WeakMap();
168
+ _LoaderObject_loaderItem = new WeakMap();
177
169
  class JsSourceMap {
178
170
  static __from_binding(map) {
179
171
  return (0, util_2.isNil)(map) ? undefined : (0, util_2.toObject)(map);
@@ -476,24 +468,23 @@ async function runLoaders(compiler, context) {
476
468
  loaderContext.mode = compiler.options.mode;
477
469
  Object.assign(loaderContext, compiler.options.loader);
478
470
  const getResolveContext = () => {
479
- // FIXME: resolve's fileDependencies will includes lots of dir, '/', etc
480
471
  return {
481
472
  fileDependencies: {
482
- // @ts-expect-error
473
+ // @ts-expect-error: Mocking insert-only `Set<T>`
483
474
  add: d => {
484
- // loaderContext.addDependency(d)
475
+ loaderContext.addDependency(d);
485
476
  }
486
477
  },
487
478
  contextDependencies: {
488
- // @ts-expect-error
479
+ // @ts-expect-error: Mocking insert-only `Set<T>`
489
480
  add: d => {
490
- // loaderContext.addContextDependency(d)
481
+ loaderContext.addContextDependency(d);
491
482
  }
492
483
  },
493
484
  missingDependencies: {
494
- // @ts-expect-error
485
+ // @ts-expect-error: Mocking insert-only `Set<T>`
495
486
  add: d => {
496
- // loaderContext.addMissingDependency(d)
487
+ loaderContext.addMissingDependency(d);
497
488
  }
498
489
  }
499
490
  };
@@ -696,6 +687,8 @@ async function runLoaders(compiler, context) {
696
687
  default:
697
688
  throw new Error(`Unexpected loader runner state: ${loaderState}`);
698
689
  }
690
+ // update loader state
691
+ context.loaderItems = loaderContext.loaders.map(item => LoaderObject.__to_binding(item));
699
692
  return context;
700
693
  }
701
694
  exports.runLoaders = runLoaders;
@@ -572,9 +572,16 @@ const SIMPLE_EXTRACTORS = {
572
572
  const { type } = context;
573
573
  object.type = module.type;
574
574
  object.moduleType = module.moduleType;
575
+ // TODO: object.layer = module.layer;
575
576
  object.size = module.size;
576
577
  object.sizes = Object.fromEntries(module.sizes.map(({ sourceType, size }) => [sourceType, size]));
577
- Object.assign(object, factory.create(`${type}$visible`, module, context));
578
+ object.built = module.built;
579
+ object.codeGenerated = module.codeGenerated;
580
+ object.buildTimeExecuted = module.buildTimeExecuted;
581
+ object.cached = module.cached;
582
+ if (module.built || module.codeGenerated || options.cachedModules) {
583
+ Object.assign(object, factory.create(`${type}$visible`, module, context));
584
+ }
578
585
  }
579
586
  },
580
587
  module$visible: {
@@ -583,17 +590,15 @@ const SIMPLE_EXTRACTORS = {
583
590
  object.identifier = module.identifier;
584
591
  object.name = module.name;
585
592
  object.nameForCondition = module.nameForCondition;
586
- object.issuer = module.issuer;
587
- object.issuerName = module.issuerName;
588
- object.issuerPath = factory.create(`${type.slice(0, -8)}.issuerPath`, module.issuerPath, context);
589
- object.orphan = module.orphan;
590
593
  object.preOrderIndex = module.preOrderIndex;
591
594
  object.postOrderIndex = module.postOrderIndex;
592
595
  object.cacheable = module.cacheable;
593
- object.built = module.built;
594
- object.codeGenerated = module.codeGenerated;
595
- object.cached = module.cached;
596
596
  object.optional = module.optional;
597
+ object.orphan = module.orphan;
598
+ // TODO: object.dependent = module.dependent;
599
+ object.issuer = module.issuer;
600
+ object.issuerName = module.issuerName;
601
+ object.issuerPath = factory.create(`${type.slice(0, -8)}.issuerPath`, module.issuerPath, context);
597
602
  object.failed = module.failed;
598
603
  object.errors = module.errors;
599
604
  object.warnings = module.warnings;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspack/core",
3
- "version": "0.7.4-canary-bdc2037-20240617004808",
3
+ "version": "0.7.4",
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.4-canary-bdc2037-20240617004808",
78
- "@rspack/plugin-minify": "^0.7.4-canary-bdc2037-20240617004808"
77
+ "@rspack/core": "0.7.4",
78
+ "@rspack/plugin-minify": "^0.7.4"
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.4-canary-bdc2037-20240617004808"
85
+ "@rspack/binding": "0.7.4"
86
86
  },
87
87
  "peerDependencies": {
88
88
  "@swc/helpers": ">=0.5.1"