@rspack/core 0.5.9-canary-245b951-20240409104441 → 0.5.9-canary-01da61e-20240411100442

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.
Files changed (48) hide show
  1. package/dist/Compilation.d.ts +5 -2
  2. package/dist/Compilation.js +8 -7
  3. package/dist/Compiler.d.ts +8 -3
  4. package/dist/Compiler.js +39 -31
  5. package/dist/ExecuteModulePlugin.js +2 -2
  6. package/dist/Module.d.ts +0 -1
  7. package/dist/Module.js +0 -1
  8. package/dist/Stats.js +2 -2
  9. package/dist/builtin-plugin/EntryPlugin.d.ts +0 -1
  10. package/dist/builtin-plugin/EntryPlugin.js +2 -3
  11. package/dist/builtin-plugin/ExternalsPlugin.d.ts +2 -2
  12. package/dist/builtin-plugin/HtmlRspackPlugin.d.ts +3 -3
  13. package/dist/builtin-plugin/{APIPlugin.d.ts → RSCClientEntryPlugin.d.ts} +1 -1
  14. package/dist/builtin-plugin/RSCClientEntryPlugin.js +6 -0
  15. package/dist/builtin-plugin/{CssModulesPlugin.d.ts → RSCClientReferenceManifestRspackPlugin.d.ts} +1 -1
  16. package/dist/builtin-plugin/RSCClientReferenceManifestRspackPlugin.js +6 -0
  17. package/dist/builtin-plugin/SplitChunksPlugin.js +1 -2
  18. package/dist/builtin-plugin/index.d.ts +8 -4
  19. package/dist/builtin-plugin/index.js +17 -3
  20. package/dist/config/adapter.js +7 -59
  21. package/dist/config/adapterRuleUse.d.ts +2 -2
  22. package/dist/config/defaults.js +34 -64
  23. package/dist/config/normalization.d.ts +0 -1
  24. package/dist/config/normalization.js +1 -9
  25. package/dist/config/zod.d.ts +91 -763
  26. package/dist/config/zod.js +3 -45
  27. package/dist/container/ContainerReferencePlugin.d.ts +1 -1
  28. package/dist/exports.d.ts +26 -77
  29. package/dist/exports.js +4 -2
  30. package/dist/lib/EntryOptionPlugin.js +1 -1
  31. package/dist/rspackOptionsApply.d.ts +1 -0
  32. package/dist/rspackOptionsApply.js +20 -8
  33. package/dist/util/comparators.d.ts +1 -1
  34. package/package.json +4 -4
  35. package/dist/builtin-plugin/APIPlugin.js +0 -6
  36. package/dist/builtin-plugin/CssModulesPlugin.js +0 -6
  37. package/dist/builtin-plugin/css-extract/hmr/hotModuleReplacement.d.ts +0 -3
  38. package/dist/builtin-plugin/css-extract/hmr/hotModuleReplacement.js +0 -222
  39. package/dist/builtin-plugin/css-extract/hmr/normalize-url.d.ts +0 -2
  40. package/dist/builtin-plugin/css-extract/hmr/normalize-url.js +0 -38
  41. package/dist/builtin-plugin/css-extract/index.d.ts +0 -22
  42. package/dist/builtin-plugin/css-extract/index.js +0 -109
  43. package/dist/builtin-plugin/css-extract/loader-options.json +0 -32
  44. package/dist/builtin-plugin/css-extract/loader.d.ts +0 -15
  45. package/dist/builtin-plugin/css-extract/loader.js +0 -180
  46. package/dist/builtin-plugin/css-extract/plugin-options.json +0 -79
  47. package/dist/builtin-plugin/css-extract/utils.d.ts +0 -5
  48. package/dist/builtin-plugin/css-extract/utils.js +0 -51
@@ -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;
@@ -136,8 +135,12 @@ export declare class Compilation {
136
135
  * Source: [updateAsset](https://github.com/webpack/webpack/blob/9fcaa243573005d6fdece9a3f8d89a0e8b399613/lib/Compilation.js#L4320)
137
136
  *
138
137
  * FIXME: *AssetInfo* may be undefined in update fn for webpack impl, but still not implemented in rspack
138
+ *
139
+ * @param {string} file file name
140
+ * @param {Source | function(Source): Source} newSourceOrFunction new asset source or function converting old to new
141
+ * @param {AssetInfo | function(AssetInfo): AssetInfo} assetInfoUpdateOrFunction new asset info or function converting old to new
139
142
  */
140
- updateAsset(filename: string, newSourceOrFunction: Source | ((source: Source) => Source), assetInfoUpdateOrFunction?: AssetInfo | ((assetInfo: AssetInfo) => AssetInfo)): void;
143
+ updateAsset(filename: string, newSourceOrFunction: Source | ((source: Source) => Source), assetInfoUpdateOrFunction: AssetInfo | ((assetInfo: AssetInfo) => AssetInfo)): void;
141
144
  /**
142
145
  * Emit an not existing asset. Trying to emit an asset that already exists will throw an error.
143
146
  *
@@ -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;
@@ -294,6 +293,10 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
294
293
  * Source: [updateAsset](https://github.com/webpack/webpack/blob/9fcaa243573005d6fdece9a3f8d89a0e8b399613/lib/Compilation.js#L4320)
295
294
  *
296
295
  * FIXME: *AssetInfo* may be undefined in update fn for webpack impl, but still not implemented in rspack
296
+ *
297
+ * @param {string} file file name
298
+ * @param {Source | function(Source): Source} newSourceOrFunction new asset source or function converting old to new
299
+ * @param {AssetInfo | function(AssetInfo): AssetInfo} assetInfoUpdateOrFunction new asset info or function converting old to new
297
300
  */
298
301
  updateAsset(filename, newSourceOrFunction, assetInfoUpdateOrFunction) {
299
302
  let compatNewSourceOrFunction;
@@ -305,11 +308,9 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
305
308
  else {
306
309
  compatNewSourceOrFunction = (0, createSource_1.createRawFromSource)(newSourceOrFunction);
307
310
  }
308
- __classPrivateFieldGet(this, _Compilation_inner, "f").updateAsset(filename, compatNewSourceOrFunction, assetInfoUpdateOrFunction === undefined
309
- ? assetInfoUpdateOrFunction
310
- : typeof assetInfoUpdateOrFunction === "function"
311
- ? jsAssetInfo => (0, util_1.toJsAssetInfo)(assetInfoUpdateOrFunction(jsAssetInfo))
312
- : (0, util_1.toJsAssetInfo)(assetInfoUpdateOrFunction));
311
+ __classPrivateFieldGet(this, _Compilation_inner, "f").updateAsset(filename, compatNewSourceOrFunction, typeof assetInfoUpdateOrFunction === "function"
312
+ ? jsAssetInfo => (0, util_1.toJsAssetInfo)(assetInfoUpdateOrFunction(jsAssetInfo))
313
+ : (0, util_1.toJsAssetInfo)(assetInfoUpdateOrFunction));
313
314
  }
314
315
  /**
315
316
  * Emit an not existing asset. Trying to emit an asset that already exists will throw an error.
@@ -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
  /**
@@ -69,6 +69,7 @@ const NormalModuleFactory_1 = require("./NormalModuleFactory");
69
69
  const bindingVersionCheck_1 = require("./util/bindingVersionCheck");
70
70
  const Watching_1 = require("./Watching");
71
71
  const builtin_plugin_1 = require("./builtin-plugin");
72
+ const rspackOptionsApply_1 = require("./rspackOptionsApply");
72
73
  const defaults_1 = require("./config/defaults");
73
74
  const assertNotNil_1 = require("./util/assertNotNil");
74
75
  const RuntimeGlobals_1 = require("./RuntimeGlobals");
@@ -83,7 +84,7 @@ class Compiler {
83
84
  _Compiler_instance.set(this, void 0);
84
85
  this.webpack = index_1.rspack;
85
86
  // TODO: remove this after remove rebuild on the rust side.
86
- _Compiler_initial.set(this, true);
87
+ this.first = true;
87
88
  _Compiler_disabledHooks.set(this, void 0);
88
89
  _Compiler_nonSkippableRegisters.set(this, void 0);
89
90
  _Compiler_registers.set(this, void 0);
@@ -385,10 +386,36 @@ class Compiler {
385
386
  }
386
387
  }
387
388
  /**
388
- * * Note: This is not a webpack public API, maybe removed in future.
389
- * @internal
389
+ * Safety: This method is only valid to call if the previous rebuild task is finished, or there will be data races.
390
390
  */
391
- __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) {
392
419
  __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_getInstance).call(this, (error, instance) => {
393
420
  if (error) {
394
421
  return callback === null || callback === void 0 ? void 0 : callback(error);
@@ -410,7 +437,7 @@ class Compiler {
410
437
  }
411
438
  this.hooks.compile.call(params);
412
439
  __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_resetThisCompilation).call(this);
413
- __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_build).call(this, err => {
440
+ this.build(err => {
414
441
  if (err) {
415
442
  return callback(err);
416
443
  }
@@ -443,7 +470,7 @@ class Compiler {
443
470
  }
444
471
  close(callback) {
445
472
  if (this.watching) {
446
- // When there is still an active watching, close this #initial
473
+ // When there is still an active watching, close this first
447
474
  this.watching.close(() => {
448
475
  this.close(callback);
449
476
  });
@@ -470,7 +497,7 @@ class Compiler {
470
497
  }
471
498
  }
472
499
  exports.Compiler = Compiler;
473
- _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) {
474
501
  const error = (0, bindingVersionCheck_1.checkVersion)();
475
502
  if (error) {
476
503
  return callback(error);
@@ -479,6 +506,10 @@ _Compiler_instance = new WeakMap(), _Compiler_initial = new WeakMap(), _Compiler
479
506
  return callback(null, __classPrivateFieldGet(this, _Compiler_instance, "f"));
480
507
  }
481
508
  const options = this.options;
509
+ // TODO: remove this in v0.6
510
+ if (!options.experiments.rspackFuture.disableApplyEntryLazily) {
511
+ (0, rspackOptionsApply_1.applyEntryOptions)(this, options);
512
+ }
482
513
  // TODO: remove this when drop support for builtins options
483
514
  options.builtins = (0, builtin_plugin_1.deprecated_resolveBuiltins)(options.builtins, options);
484
515
  const rawOptions = (0, config_1.getRawOptions)(options, this);
@@ -568,7 +599,6 @@ _Compiler_instance = new WeakMap(), _Compiler_initial = new WeakMap(), _Compiler
568
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)),
569
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)),
570
601
  registerCompilationAfterProcessAssetsTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.CompilationAfterProcessAssets, () => this.compilation.hooks.afterProcessAssets, queried => () => queried.call(this.compilation.assets)),
571
- registerCompilationAfterSealTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.CompilationAfterSeal, () => this.compilation.hooks.afterSeal, queried => async () => await queried.promise()),
572
602
  registerNormalModuleFactoryBeforeResolveTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.NormalModuleFactoryBeforeResolve, () => this.compilationParams.normalModuleFactory.hooks.beforeResolve, queried => async (resolveData) => {
573
603
  const normalizedResolveData = {
574
604
  request: resolveData.request,
@@ -721,28 +751,6 @@ _Compiler_instance = new WeakMap(), _Compiler_initial = new WeakMap(), _Compiler
721
751
  getTaps.registerKind = registerKind;
722
752
  getTaps.getHookMap = getHookMap;
723
753
  return getTaps;
724
- }, _Compiler_build = function _Compiler_build(callback) {
725
- __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_getInstance).call(this, (error, instance) => {
726
- if (error) {
727
- return callback === null || callback === void 0 ? void 0 : callback(error);
728
- }
729
- if (!__classPrivateFieldGet(this, _Compiler_initial, "f")) {
730
- instance.rebuild(Array.from(this.modifiedFiles || []), Array.from(this.removedFiles || []), error => {
731
- if (error) {
732
- return callback === null || callback === void 0 ? void 0 : callback(error);
733
- }
734
- callback === null || callback === void 0 ? void 0 : callback(null);
735
- });
736
- return;
737
- }
738
- __classPrivateFieldSet(this, _Compiler_initial, false, "f");
739
- instance.build(error => {
740
- if (error) {
741
- return callback === null || callback === void 0 ? void 0 : callback(error);
742
- }
743
- callback === null || callback === void 0 ? void 0 : callback(null);
744
- });
745
- });
746
754
  }, _Compiler_createCompilation = function _Compiler_createCompilation(native) {
747
755
  const compilation = new Compilation_1.Compilation(this, native);
748
756
  compilation.name = this.name;
@@ -13,10 +13,10 @@ class ExecuteModulePlugin {
13
13
  const moduleObject = options.moduleObject;
14
14
  const source = options.codeGenerationResult.get("javascript");
15
15
  try {
16
- const fn = node_vm_1.default.runInThisContext(`(function(module, __webpack_module__, __webpack_exports__, exports, ${_1.RuntimeGlobals.require}) {\n${source}\n})`, {
16
+ const fn = node_vm_1.default.runInThisContext(`(function(module, __webpack_exports__, ${_1.RuntimeGlobals.require}) {\n${source}\n})`, {
17
17
  filename: moduleObject.id
18
18
  });
19
- fn.call(moduleObject.exports, moduleObject, moduleObject, moduleObject.exports, moduleObject.exports, context.__webpack_require__);
19
+ fn.call(moduleObject.exports, moduleObject, moduleObject.exports, context.__webpack_require__);
20
20
  }
21
21
  catch (e) {
22
22
  let err = e instanceof Error ? e : new Error(e);
package/dist/Module.d.ts CHANGED
@@ -21,7 +21,6 @@ export type ResolveData = {
21
21
  export declare class Module {
22
22
  #private;
23
23
  _originalSource?: Source;
24
- rawRequest?: string;
25
24
  static __from_binding(module: JsModule): Module;
26
25
  constructor(module: JsModule);
27
26
  get context(): string | undefined;
package/dist/Module.js CHANGED
@@ -21,7 +21,6 @@ class Module {
21
21
  constructor(module) {
22
22
  _Module_inner.set(this, void 0);
23
23
  __classPrivateFieldSet(this, _Module_inner, module, "f");
24
- this.rawRequest = module.rawRequest;
25
24
  }
26
25
  get context() {
27
26
  return __classPrivateFieldGet(this, _Module_inner, "f").context;
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): {
@@ -12,7 +12,7 @@ exports.EntryPlugin = (0, base_1.create)(binding_1.BuiltinPluginName.EntryPlugin
12
12
  entry,
13
13
  options: getRawEntryOptions(entryOptions)
14
14
  };
15
- }, "make");
15
+ });
16
16
  function getRawEntryOptions(entry) {
17
17
  const runtime = entry.runtime;
18
18
  const chunkLoading = entry.chunkLoading;
@@ -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" | "global" | "import" | "amd" | "commonjs2" | "var" | "assign" | "this" | "window" | "self" | "commonjs-module" | "commonjs-static" | "amd-require" | "umd" | "umd2" | "jsonp" | "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" | "global" | "import" | "amd" | "commonjs2" | "var" | "assign" | "this" | "window" | "self" | "commonjs-module" | "commonjs-static" | "amd-require" | "umd" | "umd2" | "jsonp" | "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;
@@ -1,5 +1,5 @@
1
1
  import { BuiltinPluginName } from "@rspack/binding";
2
- export declare const APIPlugin: {
2
+ export declare const RSCClientEntryPlugin: {
3
3
  new (): {
4
4
  name: BuiltinPluginName;
5
5
  _options: void;
@@ -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");
@@ -1,5 +1,5 @@
1
1
  import { BuiltinPluginName } from "@rspack/binding";
2
- export declare const CssModulesPlugin: {
2
+ export declare const RSCClientReferenceManifestRspackPlugin: {
3
3
  new (): {
4
4
  name: BuiltinPluginName;
5
5
  _options: void;
@@ -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");
@@ -65,11 +65,10 @@ function toRawSplitChunksOptions(sc, compiler) {
65
65
  return chunks;
66
66
  }
67
67
  }
68
- const { name, chunks, defaultSizeTypes, cacheGroups = {}, fallbackCacheGroup, ...passThrough } = sc;
68
+ const { name, chunks, cacheGroups = {}, fallbackCacheGroup, ...passThrough } = sc;
69
69
  return {
70
70
  name: getName(name),
71
71
  chunks: getChunks(chunks),
72
- defaultSizeTypes: defaultSizeTypes || ["javascript", "unknown"],
73
72
  cacheGroups: Object.entries(cacheGroups)
74
73
  .filter(([_key, group]) => group !== false)
75
74
  .map(([key, group]) => {
@@ -46,17 +46,21 @@ export * from "./FlagDependencyUsagePlugin";
46
46
  export * from "./MangleExportsPlugin";
47
47
  export * from "./BundlerInfoRspackPlugin";
48
48
  export * from "./ModuleConcatenationPlugin";
49
- export * from "./CssModulesPlugin";
50
- export * from "./APIPlugin";
51
49
  export * from "./HtmlRspackPlugin";
52
50
  export * from "./CopyRspackPlugin";
53
51
  export * from "./SwcJsMinimizerPlugin";
54
52
  export * from "./SwcCssMinimizerPlugin";
53
+ export * from "./RSCClientEntryPlugin";
54
+ export * from "./RSCClientReferenceManifestRspackPlugin";
55
55
  export * from "./JsLoaderRspackPlugin";
56
- export * from "./css-extract";
57
- import { RawBuiltins } from "@rspack/binding";
56
+ import { RawBuiltins, RawCssModulesConfig } from "@rspack/binding";
58
57
  import { RspackOptionsNormalized } from "..";
58
+ type BuiltinsCssConfig = {
59
+ modules?: Partial<RawCssModulesConfig>;
60
+ namedExports?: boolean;
61
+ };
59
62
  export interface Builtins {
63
+ css?: BuiltinsCssConfig;
60
64
  treeShaking?: boolean | "module";
61
65
  }
62
66
  export declare function deprecated_resolveBuiltins(builtins: Builtins, options: RspackOptionsNormalized): RawBuiltins;
@@ -64,14 +64,13 @@ __exportStar(require("./FlagDependencyUsagePlugin"), exports);
64
64
  __exportStar(require("./MangleExportsPlugin"), exports);
65
65
  __exportStar(require("./BundlerInfoRspackPlugin"), exports);
66
66
  __exportStar(require("./ModuleConcatenationPlugin"), exports);
67
- __exportStar(require("./CssModulesPlugin"), exports);
68
- __exportStar(require("./APIPlugin"), exports);
69
67
  __exportStar(require("./HtmlRspackPlugin"), exports);
70
68
  __exportStar(require("./CopyRspackPlugin"), exports);
71
69
  __exportStar(require("./SwcJsMinimizerPlugin"), exports);
72
70
  __exportStar(require("./SwcCssMinimizerPlugin"), exports);
71
+ __exportStar(require("./RSCClientEntryPlugin"), exports);
72
+ __exportStar(require("./RSCClientReferenceManifestRspackPlugin"), exports);
73
73
  __exportStar(require("./JsLoaderRspackPlugin"), exports);
74
- __exportStar(require("./css-extract"), exports);
75
74
  function resolveTreeShaking(treeShaking, production) {
76
75
  return treeShaking !== undefined
77
76
  ? treeShaking.toString()
@@ -80,8 +79,23 @@ function resolveTreeShaking(treeShaking, production) {
80
79
  : "false";
81
80
  }
82
81
  function deprecated_resolveBuiltins(builtins, options) {
82
+ var _a, _b;
83
83
  const production = options.mode === "production" || !options.mode;
84
84
  return {
85
+ // TODO: discuss with webpack, this should move to css generator options
86
+ css: options.experiments.css
87
+ ? {
88
+ modules: {
89
+ localsConvention: "asIs",
90
+ localIdentName: production
91
+ ? "[hash]"
92
+ : "[path][name][ext]__[local]",
93
+ exportsOnly: false,
94
+ ...(_a = builtins.css) === null || _a === void 0 ? void 0 : _a.modules
95
+ },
96
+ namedExports: (_b = builtins.css) === null || _b === void 0 ? void 0 : _b.namedExports
97
+ }
98
+ : undefined,
85
99
  treeShaking: resolveTreeShaking(builtins.treeShaking, production)
86
100
  };
87
101
  }
@@ -336,8 +336,7 @@ const getRawModuleRule = (rule, path, options) => {
336
336
  if (rule.resourceQuery && !tryMatch(query, rule.resourceQuery)) {
337
337
  return false;
338
338
  }
339
- if (rule.resourceFragment &&
340
- !tryMatch(fragment, rule.resourceFragment)) {
339
+ if (rule.resourceFragment && !tryMatch(fragment, rule.resourceFragment)) {
341
340
  return false;
342
341
  }
343
342
  return true;
@@ -409,26 +408,9 @@ function getRawParserOptions(parser, type) {
409
408
  javascript: getRawJavascriptParserOptions(parser)
410
409
  };
411
410
  }
412
- else if (type === "css") {
413
- return {
414
- type: "css",
415
- css: getRawCssParserOptions(parser)
416
- };
417
- }
418
- else if (type === "css/auto") {
419
- return {
420
- type: "css/auto",
421
- cssAuto: getRawCssParserOptions(parser)
422
- };
423
- }
424
- else if (type === "css/module") {
425
- return {
426
- type: "css/module",
427
- cssModule: getRawCssParserOptions(parser)
428
- };
429
- }
430
- // FIXME: shouldn't depend on module type, for example: `rules: [{ test: /\.css/, generator: {..} }]` will error
431
- throw new Error(`unreachable: unknow module type: ${type}`);
411
+ return {
412
+ type: "unknown"
413
+ };
432
414
  }
433
415
  function getRawJavascriptParserOptions(parser) {
434
416
  var _a, _b, _c, _d, _e;
@@ -461,11 +443,6 @@ function getRawAssetParserDataUrl(dataUrlCondition) {
461
443
  }
462
444
  throw new Error(`unreachable: AssetParserDataUrl type should be one of "options", but got ${dataUrlCondition}`);
463
445
  }
464
- function getRawCssParserOptions(parser) {
465
- return {
466
- namedExports: parser.namedExports
467
- };
468
- }
469
446
  function getRawGeneratorOptions(generator, type) {
470
447
  if (type === "asset") {
471
448
  return {
@@ -489,25 +466,9 @@ function getRawGeneratorOptions(generator, type) {
489
466
  : undefined
490
467
  };
491
468
  }
492
- if (type === "css") {
493
- return {
494
- type: "css",
495
- css: getRawCssGeneratorOptions(generator)
496
- };
497
- }
498
- if (type === "css/auto") {
499
- return {
500
- type: "css/auto",
501
- cssAuto: getRawCssAutoOrModuleGeneratorOptions(generator)
502
- };
503
- }
504
- if (type === "css/module") {
505
- return {
506
- type: "css/module",
507
- cssModule: getRawCssAutoOrModuleGeneratorOptions(generator)
508
- };
509
- }
510
- throw new Error(`unreachable: unknow module type: ${type}`);
469
+ return {
470
+ type: "unknown"
471
+ };
511
472
  }
512
473
  function getRawAssetGeneratorOptions(options) {
513
474
  return {
@@ -541,19 +502,6 @@ function getRawAssetGeneratorDataUrl(dataUrl) {
541
502
  }
542
503
  throw new Error(`unreachable: AssetGeneratorDataUrl type should be one of "options", "function", but got ${dataUrl}`);
543
504
  }
544
- function getRawCssGeneratorOptions(options) {
545
- return {
546
- exportsConvention: options.exportsConvention,
547
- exportsOnly: options.exportsOnly
548
- };
549
- }
550
- function getRawCssAutoOrModuleGeneratorOptions(options) {
551
- return {
552
- localIdentName: options.localIdentName,
553
- exportsConvention: options.exportsConvention,
554
- exportsOnly: options.exportsOnly
555
- };
556
- }
557
505
  function getRawOptimization(optimization) {
558
506
  (0, assert_1.default)(!(0, util_1.isNil)(optimization.removeAvailableModules) &&
559
507
  !(0, util_1.isNil)(optimization.sideEffects) &&
@@ -96,8 +96,8 @@ export interface LoaderContext<OptionsType = {}> {
96
96
  getMissingDependencies(): string[];
97
97
  addBuildDependency(file: string): void;
98
98
  importModule(request: string, options: {
99
- publicPath?: string;
100
- baseUri?: string;
99
+ publicPath: string;
100
+ baseUri: string;
101
101
  }, callback: (err?: Error, res?: any) => void): void;
102
102
  fs: any;
103
103
  utils: {