@rspack/core 0.5.9-canary-b914bc8-20240402075258 → 0.5.9-canary-4297cec-20240402080759

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,7 +90,6 @@ export declare class Compilation {
90
90
  ExecuteModuleContext
91
91
  ]>;
92
92
  runtimeModule: liteTapable.SyncHook<[JsRuntimeModule, Chunk], void>;
93
- afterSeal: liteTapable.AsyncSeriesHook<[], void>;
94
93
  };
95
94
  options: RspackOptionsNormalized;
96
95
  outputOptions: OutputNormalized;
@@ -154,8 +154,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
154
154
  statsPrinter: new tapable.SyncHook(["statsPrinter", "options"]),
155
155
  buildModule: new liteTapable.SyncHook(["module"]),
156
156
  executeModule: new liteTapable.SyncHook(["options", "context"]),
157
- runtimeModule: new liteTapable.SyncHook(["module", "chunk"]),
158
- afterSeal: new liteTapable.AsyncSeriesHook([])
157
+ runtimeModule: new liteTapable.SyncHook(["module", "chunk"])
159
158
  };
160
159
  this.compiler = compiler;
161
160
  this.resolverFactory = compiler.resolverFactory;
@@ -42,6 +42,7 @@ declare class Compiler {
42
42
  };
43
43
  compilation?: Compilation;
44
44
  compilationParams?: CompilationParams;
45
+ first: boolean;
45
46
  builtinPlugins: binding.BuiltinPlugin[];
46
47
  root: Compiler;
47
48
  running: boolean;
@@ -109,10 +110,14 @@ declare class Compiler {
109
110
  getInfrastructureLogger(name: string | Function): Logger;
110
111
  run(callback: Callback<Error, Stats>): void;
111
112
  /**
112
- * * Note: This is not a webpack public API, maybe removed in future.
113
- * @internal
113
+ * Safety: This method is only valid to call if the previous rebuild task is finished, or there will be data races.
114
114
  */
115
- __internal__rebuild(modifiedFiles?: ReadonlySet<string>, removedFiles?: ReadonlySet<string>, callback?: (error: Error | null) => void): void;
115
+ build(callback?: (error: Error | null) => void): void;
116
+ /**
117
+ * Safety: This method is only valid to call if the previous rebuild task is finished, or there will be data races.
118
+ * @deprecated This is a low-level incremental rebuild API, which shouldn't be used intentionally. Use `compiler.build` instead.
119
+ */
120
+ rebuild(modifiedFiles?: ReadonlySet<string>, removedFiles?: ReadonlySet<string>, callback?: (error: Error | null) => void): void;
116
121
  compile(callback: Callback<Error, Compilation>): void;
117
122
  watch(watchOptions: WatchOptions, handler: Callback<Error, Stats>): Watching;
118
123
  purgeInputFileSystem(): void;
package/dist/Compiler.js CHANGED
@@ -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 _Compiler_instances, _Compiler_instance, _Compiler_initial, _Compiler_disabledHooks, _Compiler_nonSkippableRegisters, _Compiler_registers, _Compiler_moduleExecutionResultsMap, _Compiler_getInstance, _Compiler_updateNonSkippableRegisters, _Compiler_decorateJsTaps, _Compiler_createHookRegisterTaps, _Compiler_createHookMapRegisterTaps, _Compiler_build, _Compiler_createCompilation, _Compiler_resetThisCompilation, _Compiler_newCompilationParams;
39
+ var _Compiler_instances, _Compiler_instance, _Compiler_disabledHooks, _Compiler_nonSkippableRegisters, _Compiler_registers, _Compiler_moduleExecutionResultsMap, _Compiler_getInstance, _Compiler_updateNonSkippableRegisters, _Compiler_decorateJsTaps, _Compiler_createHookRegisterTaps, _Compiler_createHookMapRegisterTaps, _Compiler_createCompilation, _Compiler_resetThisCompilation, _Compiler_newCompilationParams;
40
40
  Object.defineProperty(exports, "__esModule", { value: true });
41
41
  exports.Compiler = void 0;
42
42
  /**
@@ -84,7 +84,7 @@ class Compiler {
84
84
  _Compiler_instance.set(this, void 0);
85
85
  this.webpack = index_1.rspack;
86
86
  // TODO: remove this after remove rebuild on the rust side.
87
- _Compiler_initial.set(this, true);
87
+ this.first = true;
88
88
  _Compiler_disabledHooks.set(this, void 0);
89
89
  _Compiler_nonSkippableRegisters.set(this, void 0);
90
90
  _Compiler_registers.set(this, void 0);
@@ -386,10 +386,36 @@ class Compiler {
386
386
  }
387
387
  }
388
388
  /**
389
- * * Note: This is not a webpack public API, maybe removed in future.
390
- * @internal
389
+ * Safety: This method is only valid to call if the previous rebuild task is finished, or there will be data races.
391
390
  */
392
- __internal__rebuild(modifiedFiles, removedFiles, callback) {
391
+ build(callback) {
392
+ __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_getInstance).call(this, (error, instance) => {
393
+ if (error) {
394
+ return callback === null || callback === void 0 ? void 0 : callback(error);
395
+ }
396
+ if (!this.first) {
397
+ instance.rebuild(Array.from(this.modifiedFiles || []), Array.from(this.removedFiles || []), error => {
398
+ if (error) {
399
+ return callback === null || callback === void 0 ? void 0 : callback(error);
400
+ }
401
+ callback === null || callback === void 0 ? void 0 : callback(null);
402
+ });
403
+ return;
404
+ }
405
+ this.first = false;
406
+ instance.build(error => {
407
+ if (error) {
408
+ return callback === null || callback === void 0 ? void 0 : callback(error);
409
+ }
410
+ callback === null || callback === void 0 ? void 0 : callback(null);
411
+ });
412
+ });
413
+ }
414
+ /**
415
+ * Safety: This method is only valid to call if the previous rebuild task is finished, or there will be data races.
416
+ * @deprecated This is a low-level incremental rebuild API, which shouldn't be used intentionally. Use `compiler.build` instead.
417
+ */
418
+ rebuild(modifiedFiles, removedFiles, callback) {
393
419
  __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_getInstance).call(this, (error, instance) => {
394
420
  if (error) {
395
421
  return callback === null || callback === void 0 ? void 0 : callback(error);
@@ -411,7 +437,7 @@ class Compiler {
411
437
  }
412
438
  this.hooks.compile.call(params);
413
439
  __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_resetThisCompilation).call(this);
414
- __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_build).call(this, err => {
440
+ this.build(err => {
415
441
  if (err) {
416
442
  return callback(err);
417
443
  }
@@ -444,7 +470,7 @@ class Compiler {
444
470
  }
445
471
  close(callback) {
446
472
  if (this.watching) {
447
- // When there is still an active watching, close this #initial
473
+ // When there is still an active watching, close this first
448
474
  this.watching.close(() => {
449
475
  this.close(callback);
450
476
  });
@@ -471,7 +497,7 @@ class Compiler {
471
497
  }
472
498
  }
473
499
  exports.Compiler = Compiler;
474
- _Compiler_instance = new WeakMap(), _Compiler_initial = new WeakMap(), _Compiler_disabledHooks = new WeakMap(), _Compiler_nonSkippableRegisters = new WeakMap(), _Compiler_registers = new WeakMap(), _Compiler_moduleExecutionResultsMap = new WeakMap(), _Compiler_instances = new WeakSet(), _Compiler_getInstance = function _Compiler_getInstance(callback) {
500
+ _Compiler_instance = new WeakMap(), _Compiler_disabledHooks = new WeakMap(), _Compiler_nonSkippableRegisters = new WeakMap(), _Compiler_registers = new WeakMap(), _Compiler_moduleExecutionResultsMap = new WeakMap(), _Compiler_instances = new WeakSet(), _Compiler_getInstance = function _Compiler_getInstance(callback) {
475
501
  const error = (0, bindingVersionCheck_1.checkVersion)();
476
502
  if (error) {
477
503
  return callback(error);
@@ -573,7 +599,6 @@ _Compiler_instance = new WeakMap(), _Compiler_initial = new WeakMap(), _Compiler
573
599
  registerCompilationChunkAssetTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.CompilationChunkAsset, () => this.compilation.hooks.chunkAsset, queried => ({ chunk, filename }) => queried.call(Chunk_1.Chunk.__from_binding(chunk, this.compilation), filename)),
574
600
  registerCompilationProcessAssetsTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.CompilationProcessAssets, () => this.compilation.hooks.processAssets, queried => async () => await queried.promise(this.compilation.assets)),
575
601
  registerCompilationAfterProcessAssetsTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.CompilationAfterProcessAssets, () => this.compilation.hooks.afterProcessAssets, queried => () => queried.call(this.compilation.assets)),
576
- registerCompilationAfterSealTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.CompilationAfterSeal, () => this.compilation.hooks.afterSeal, queried => async () => await queried.promise()),
577
602
  registerNormalModuleFactoryBeforeResolveTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.NormalModuleFactoryBeforeResolve, () => this.compilationParams.normalModuleFactory.hooks.beforeResolve, queried => async (resolveData) => {
578
603
  const normalizedResolveData = {
579
604
  request: resolveData.request,
@@ -726,28 +751,6 @@ _Compiler_instance = new WeakMap(), _Compiler_initial = new WeakMap(), _Compiler
726
751
  getTaps.registerKind = registerKind;
727
752
  getTaps.getHookMap = getHookMap;
728
753
  return getTaps;
729
- }, _Compiler_build = function _Compiler_build(callback) {
730
- __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_getInstance).call(this, (error, instance) => {
731
- if (error) {
732
- return callback === null || callback === void 0 ? void 0 : callback(error);
733
- }
734
- if (!__classPrivateFieldGet(this, _Compiler_initial, "f")) {
735
- instance.rebuild(Array.from(this.modifiedFiles || []), Array.from(this.removedFiles || []), error => {
736
- if (error) {
737
- return callback === null || callback === void 0 ? void 0 : callback(error);
738
- }
739
- callback === null || callback === void 0 ? void 0 : callback(null);
740
- });
741
- return;
742
- }
743
- __classPrivateFieldSet(this, _Compiler_initial, false, "f");
744
- instance.build(error => {
745
- if (error) {
746
- return callback === null || callback === void 0 ? void 0 : callback(error);
747
- }
748
- callback === null || callback === void 0 ? void 0 : callback(null);
749
- });
750
- });
751
754
  }, _Compiler_createCompilation = function _Compiler_createCompilation(native) {
752
755
  const compilation = new Compilation_1.Compilation(this, native);
753
756
  compilation.name = this.name;
package/dist/Stats.js CHANGED
@@ -103,8 +103,8 @@ function normalizeStatsPreset(options) {
103
103
  }
104
104
  exports.normalizeStatsPreset = normalizeStatsPreset;
105
105
  function presetToOptions(name) {
106
- const preset = (typeof name === "string" && name.toLowerCase()) || name;
107
- switch (preset) {
106
+ const pn = (typeof name === "string" && name.toLowerCase()) || name;
107
+ switch (pn) {
108
108
  case "none":
109
109
  return {
110
110
  all: false
@@ -9,7 +9,6 @@ export type EntryOptions = {
9
9
  baseUri?: string;
10
10
  filename?: FilenameTemplate;
11
11
  library?: LibraryOptions;
12
- dependOn?: string[];
13
12
  };
14
13
  export declare const EntryPlugin: {
15
14
  new (context: string, entry: string, options?: string | EntryOptions | undefined): {
@@ -26,7 +26,6 @@ function getRawEntryOptions(entry) {
26
26
  : undefined,
27
27
  asyncChunks: entry.asyncChunks,
28
28
  filename: entry.filename,
29
- library: entry.library && (0, config_1.getRawLibrary)(entry.library),
30
- dependOn: entry.dependOn
29
+ library: entry.library && (0, config_1.getRawLibrary)(entry.library)
31
30
  };
32
31
  }
@@ -4,7 +4,7 @@ export declare const ExternalsPlugin: {
4
4
  context?: string | undefined;
5
5
  dependencyType?: string | undefined;
6
6
  request?: string | undefined;
7
- }, args_1: (args_0: Error | undefined, args_1: string | boolean | string[] | Record<string, string | string[]> | undefined, args_2: "module" | "promise" | "script" | "commonjs" | "jsonp" | "import" | "amd" | "commonjs2" | "var" | "assign" | "this" | "window" | "self" | "global" | "commonjs-module" | "commonjs-static" | "amd-require" | "umd" | "umd2" | "system" | "node-commonjs" | undefined, ...args_3: unknown[]) => void, ...args_2: unknown[]) => unknown) | ((args_0: {
7
+ }, args_1: (args_0: Error | undefined, args_1: string | boolean | string[] | Record<string, string | string[]> | undefined, args_2: "promise" | "module" | "jsonp" | "import" | "amd" | "commonjs" | "commonjs2" | "var" | "assign" | "this" | "window" | "self" | "global" | "commonjs-module" | "commonjs-static" | "amd-require" | "umd" | "umd2" | "system" | "script" | "node-commonjs" | undefined, ...args_3: unknown[]) => void, ...args_2: unknown[]) => unknown) | ((args_0: {
8
8
  context?: string | undefined;
9
9
  dependencyType?: string | undefined;
10
10
  request?: string | undefined;
@@ -12,7 +12,7 @@ export declare const ExternalsPlugin: {
12
12
  context?: string | undefined;
13
13
  dependencyType?: string | undefined;
14
14
  request?: string | undefined;
15
- }, args_1: (args_0: Error | undefined, args_1: string | boolean | string[] | Record<string, string | string[]> | undefined, args_2: "module" | "promise" | "script" | "commonjs" | "jsonp" | "import" | "amd" | "commonjs2" | "var" | "assign" | "this" | "window" | "self" | "global" | "commonjs-module" | "commonjs-static" | "amd-require" | "umd" | "umd2" | "system" | "node-commonjs" | undefined, ...args_3: unknown[]) => void, ...args_2: unknown[]) => unknown) | ((args_0: {
15
+ }, args_1: (args_0: Error | undefined, args_1: string | boolean | string[] | Record<string, string | string[]> | undefined, args_2: "promise" | "module" | "jsonp" | "import" | "amd" | "commonjs" | "commonjs2" | "var" | "assign" | "this" | "window" | "self" | "global" | "commonjs-module" | "commonjs-static" | "amd-require" | "umd" | "umd2" | "system" | "script" | "node-commonjs" | undefined, ...args_3: unknown[]) => void, ...args_2: unknown[]) => unknown) | ((args_0: {
16
16
  context?: string | undefined;
17
17
  dependencyType?: string | undefined;
18
18
  request?: string | undefined;
@@ -22,7 +22,7 @@ declare const htmlRspackPluginOptions: z.ZodObject<{
22
22
  templateParameters?: Record<string, string> | undefined;
23
23
  inject?: boolean | "head" | "body" | undefined;
24
24
  publicPath?: string | undefined;
25
- scriptLoading?: "blocking" | "defer" | "module" | undefined;
25
+ scriptLoading?: "module" | "blocking" | "defer" | undefined;
26
26
  chunks?: string[] | undefined;
27
27
  excludedChunks?: string[] | undefined;
28
28
  sri?: "sha256" | "sha384" | "sha512" | undefined;
@@ -37,7 +37,7 @@ declare const htmlRspackPluginOptions: z.ZodObject<{
37
37
  templateParameters?: Record<string, string> | undefined;
38
38
  inject?: boolean | "head" | "body" | undefined;
39
39
  publicPath?: string | undefined;
40
- scriptLoading?: "blocking" | "defer" | "module" | undefined;
40
+ scriptLoading?: "module" | "blocking" | "defer" | undefined;
41
41
  chunks?: string[] | undefined;
42
42
  excludedChunks?: string[] | undefined;
43
43
  sri?: "sha256" | "sha384" | "sha512" | undefined;
@@ -55,7 +55,7 @@ export declare const HtmlRspackPlugin: {
55
55
  templateParameters?: Record<string, string> | undefined;
56
56
  inject?: boolean | "head" | "body" | undefined;
57
57
  publicPath?: string | undefined;
58
- scriptLoading?: "blocking" | "defer" | "module" | undefined;
58
+ scriptLoading?: "module" | "blocking" | "defer" | undefined;
59
59
  chunks?: string[] | undefined;
60
60
  excludedChunks?: string[] | undefined;
61
61
  sri?: "sha256" | "sha384" | "sha512" | undefined;
@@ -0,0 +1,10 @@
1
+ import { BuiltinPluginName } from "@rspack/binding";
2
+ export declare const RSCClientEntryPlugin: {
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.RSCClientEntryPlugin = void 0;
4
+ const binding_1 = require("@rspack/binding");
5
+ const base_1 = require("./base");
6
+ exports.RSCClientEntryPlugin = (0, base_1.create)(binding_1.BuiltinPluginName.RSCClientEntryRspackPlugin, () => { }, "compilation");
@@ -0,0 +1,10 @@
1
+ import { BuiltinPluginName } from "@rspack/binding";
2
+ export declare const RSCClientReferenceManifestRspackPlugin: {
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.RSCClientReferenceManifestRspackPlugin = void 0;
4
+ const binding_1 = require("@rspack/binding");
5
+ const base_1 = require("./base");
6
+ exports.RSCClientReferenceManifestRspackPlugin = (0, base_1.create)(binding_1.BuiltinPluginName.RSCClientReferenceManifestRspackPlugin, () => { }, "compilation");
@@ -50,6 +50,8 @@ export * from "./HtmlRspackPlugin";
50
50
  export * from "./CopyRspackPlugin";
51
51
  export * from "./SwcJsMinimizerPlugin";
52
52
  export * from "./SwcCssMinimizerPlugin";
53
+ export * from "./RSCClientEntryPlugin";
54
+ export * from "./RSCClientReferenceManifestRspackPlugin";
53
55
  export * from "./JsLoaderRspackPlugin";
54
56
  import { RawBuiltins, RawCssModulesConfig } from "@rspack/binding";
55
57
  import { RspackOptionsNormalized } from "..";
@@ -68,6 +68,8 @@ __exportStar(require("./HtmlRspackPlugin"), exports);
68
68
  __exportStar(require("./CopyRspackPlugin"), exports);
69
69
  __exportStar(require("./SwcJsMinimizerPlugin"), exports);
70
70
  __exportStar(require("./SwcCssMinimizerPlugin"), exports);
71
+ __exportStar(require("./RSCClientEntryPlugin"), exports);
72
+ __exportStar(require("./RSCClientReferenceManifestRspackPlugin"), exports);
71
73
  __exportStar(require("./JsLoaderRspackPlugin"), exports);
72
74
  function resolveTreeShaking(treeShaking, production) {
73
75
  return treeShaking !== undefined
@@ -23,7 +23,6 @@ export interface EntryDescriptionNormalized {
23
23
  baseUri?: string;
24
24
  filename?: EntryFilename;
25
25
  library?: LibraryOptions;
26
- dependOn?: string[];
27
26
  }
28
27
  export interface OutputNormalized {
29
28
  path?: Path;
@@ -233,12 +233,7 @@ const getNormalizedEntryStatic = (entry) => {
233
233
  chunkLoading: value.chunkLoading,
234
234
  asyncChunks: value.asyncChunks,
235
235
  filename: value.filename,
236
- library: value.library,
237
- dependOn: Array.isArray(value.dependOn)
238
- ? value.dependOn
239
- : value.dependOn
240
- ? [value.dependOn]
241
- : undefined
236
+ library: value.library
242
237
  };
243
238
  }
244
239
  }