@rspack/core 1.0.0-alpha.5 → 1.0.0-beta.0

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 (89) hide show
  1. package/compiled/zod/index.d.ts +138 -52
  2. package/compiled/zod/index.js +300 -103
  3. package/compiled/zod/package.json +1 -1
  4. package/compiled/zod-validation-error/index.js +6 -6
  5. package/dist/Compilation.d.ts +21 -3
  6. package/dist/Compilation.js +64 -49
  7. package/dist/Compiler.js +28 -28
  8. package/dist/ErrorHelpers.js +2 -4
  9. package/dist/Module.js +2 -6
  10. package/dist/ModuleTypeConstants.d.ts +45 -69
  11. package/dist/ModuleTypeConstants.js +24 -77
  12. package/dist/Stats.js +4 -6
  13. package/dist/Template.d.ts +31 -147
  14. package/dist/Template.js +40 -236
  15. package/dist/builtin-loader/lightningcss/index.d.ts +89 -0
  16. package/dist/builtin-loader/lightningcss/index.js +175 -0
  17. package/dist/builtin-plugin/BannerPlugin.d.ts +24 -48
  18. package/dist/builtin-plugin/DefinePlugin.js +9 -13
  19. package/dist/builtin-plugin/EntryPlugin.d.ts +2 -2
  20. package/dist/builtin-plugin/ExternalsPlugin.d.ts +24 -0
  21. package/dist/builtin-plugin/HtmlRspackPlugin.d.ts +8 -8
  22. package/dist/builtin-plugin/JavascriptModulesPlugin.d.ts +2 -2
  23. package/dist/builtin-plugin/LightningCssMiminizerRspackPlugin.d.ts +10 -3
  24. package/dist/builtin-plugin/LightningCssMiminizerRspackPlugin.js +4 -1
  25. package/dist/builtin-plugin/SplitChunksPlugin.js +5 -15
  26. package/dist/builtin-plugin/SwcJsMinimizerPlugin.js +15 -23
  27. package/dist/builtin-plugin/base.js +1 -3
  28. package/dist/builtin-plugin/css-extract/hmr/hotModuleReplacement.d.ts +3 -3
  29. package/dist/builtin-plugin/css-extract/hmr/hotModuleReplacement.js +17 -66
  30. package/dist/builtin-plugin/css-extract/hmr/normalizeUrl.d.ts +2 -0
  31. package/dist/builtin-plugin/css-extract/hmr/{normalize-url.js → normalizeUrl.js} +15 -24
  32. package/dist/builtin-plugin/css-extract/loader.js +5 -5
  33. package/dist/config/adapter.d.ts +1 -1
  34. package/dist/config/adapter.js +24 -23
  35. package/dist/config/adapterRuleUse.d.ts +5 -5
  36. package/dist/config/adapterRuleUse.js +23 -1
  37. package/dist/config/browserslistTargetHandler.d.ts +17 -15
  38. package/dist/config/browserslistTargetHandler.js +27 -33
  39. package/dist/config/defaults.js +20 -21
  40. package/dist/config/normalization.d.ts +2 -0
  41. package/dist/config/normalization.js +5 -5
  42. package/dist/config/target.d.ts +48 -109
  43. package/dist/config/target.js +50 -86
  44. package/dist/config/zod.d.ts +2391 -2205
  45. package/dist/config/zod.js +28 -18
  46. package/dist/container/ContainerPlugin.d.ts +7 -7
  47. package/dist/container/options.js +1 -1
  48. package/dist/exports.d.ts +4 -4
  49. package/dist/exports.js +2 -2
  50. package/dist/lib/CacheFacade.js +1 -0
  51. package/dist/lib/ModuleFilenameHelpers.js +1 -3
  52. package/dist/lib/cache/mergeEtags.js +5 -11
  53. package/dist/lib/formatLocation.js +3 -5
  54. package/dist/loader-runner/LoaderLoadingError.d.ts +11 -1
  55. package/dist/loader-runner/LoaderLoadingError.js +3 -5
  56. package/dist/loader-runner/index.js +7 -9
  57. package/dist/loader-runner/loadLoader.d.ts +11 -2
  58. package/dist/loader-runner/loadLoader.js +17 -19
  59. package/dist/logging/createConsoleLogger.js +2 -6
  60. package/dist/logging/truncateArgs.js +5 -9
  61. package/dist/node/nodeConsole.js +1 -3
  62. package/dist/stats/DefaultStatsFactoryPlugin.js +17 -7
  63. package/dist/stats/DefaultStatsPresetPlugin.js +4 -4
  64. package/dist/stats/DefaultStatsPrinterPlugin.js +11 -16
  65. package/dist/stats/StatsFactory.js +13 -17
  66. package/dist/stats/StatsPrinter.js +7 -9
  67. package/dist/util/AssetInfo.js +11 -7
  68. package/dist/util/SplitChunkSize.js +1 -1
  69. package/dist/util/cleverMerge.d.ts +33 -57
  70. package/dist/util/cleverMerge.js +89 -145
  71. package/dist/util/comparators.js +3 -5
  72. package/dist/util/createHash.d.ts +4 -3
  73. package/dist/util/createHash.js +31 -45
  74. package/dist/util/fs.js +9 -13
  75. package/dist/util/hash/BatchedHash.d.ts +24 -9
  76. package/dist/util/hash/BatchedHash.js +16 -13
  77. package/dist/util/hash/index.d.ts +9 -9
  78. package/dist/util/hash/index.js +14 -11
  79. package/dist/util/hash/md4.d.ts +29 -2
  80. package/dist/util/hash/md4.js +7 -3
  81. package/dist/util/hash/wasm-hash.d.ts +52 -5
  82. package/dist/util/hash/wasm-hash.js +19 -22
  83. package/dist/util/hash/xxhash64.d.ts +29 -2
  84. package/dist/util/hash/xxhash64.js +7 -3
  85. package/dist/util/identifier.js +9 -15
  86. package/dist/util/index.js +1 -1
  87. package/dist/util/memoize.js +7 -9
  88. package/package.json +9 -8
  89. package/dist/builtin-plugin/css-extract/hmr/normalize-url.d.ts +0 -2
@@ -98,16 +98,14 @@ class StatsFactory {
98
98
  if (this._inCreate) {
99
99
  return this._create(type, data, baseContext);
100
100
  }
101
- else {
102
- try {
103
- this._inCreate = true;
104
- return this._create(type, data, baseContext);
105
- }
106
- finally {
107
- for (const key of Object.keys(this._caches))
108
- this._caches[key].clear();
109
- this._inCreate = false;
110
- }
101
+ try {
102
+ this._inCreate = true;
103
+ return this._create(type, data, baseContext);
104
+ }
105
+ finally {
106
+ for (const key of Object.keys(this._caches))
107
+ this._caches[key].clear();
108
+ this._inCreate = false;
111
109
  }
112
110
  }
113
111
  _create(type, data, baseContext) {
@@ -168,13 +166,11 @@ class StatsFactory {
168
166
  // run result on merged items
169
167
  return this._forEachLevelWaterfall(this.hooks.result, this._caches.result, type, result, (h, r) => h.call(r, context));
170
168
  }
171
- else {
172
- const object = {};
173
- // run extract on value
174
- this._forEachLevel(this.hooks.extract, this._caches.extract, type, h => h.call(object, data, context));
175
- // run result on extracted object
176
- return this._forEachLevelWaterfall(this.hooks.result, this._caches.result, type, object, (h, r) => h.call(r, context));
177
- }
169
+ const object = {};
170
+ // run extract on value
171
+ this._forEachLevel(this.hooks.extract, this._caches.extract, type, h => h.call(object, data, context));
172
+ // run result on extracted object
173
+ return this._forEachLevelWaterfall(this.hooks.result, this._caches.result, type, object, (h, r) => h.call(r, context));
178
174
  }
179
175
  }
180
176
  exports.StatsFactory = StatsFactory;
@@ -80,15 +80,13 @@ class StatsPrinter {
80
80
  if (this._inPrint) {
81
81
  return this._print(type, object, baseContext);
82
82
  }
83
- else {
84
- try {
85
- this._inPrint = true;
86
- return this._print(type, object, baseContext);
87
- }
88
- finally {
89
- this._levelHookCache.clear();
90
- this._inPrint = false;
91
- }
83
+ try {
84
+ this._inPrint = true;
85
+ return this._print(type, object, baseContext);
86
+ }
87
+ finally {
88
+ this._levelHookCache.clear();
89
+ this._inPrint = false;
92
90
  }
93
91
  }
94
92
  _print(type, object, baseContext) {
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.JsAssetInfo = void 0;
4
4
  class JsAssetInfo {
5
5
  static __from_binding(jsAssetInfo) {
6
- const { immutable, minimized, development, hotModuleReplacement, related, chunkHash, contentHash, javascriptModule, sourceFilename, extras } = jsAssetInfo;
6
+ const { immutable, minimized, development, hotModuleReplacement, related, chunkhash, fullhash, contenthash, javascriptModule, sourceFilename, extras } = jsAssetInfo;
7
7
  return {
8
8
  ...extras,
9
9
  immutable,
@@ -11,14 +11,15 @@ class JsAssetInfo {
11
11
  development,
12
12
  hotModuleReplacement,
13
13
  related,
14
- chunkHash,
15
- contentHash,
14
+ fullhash,
15
+ chunkhash,
16
+ contenthash,
16
17
  javascriptModule,
17
18
  sourceFilename
18
19
  };
19
20
  }
20
21
  static __to_binding(assetInfo = {}) {
21
- let { immutable = false, minimized = false, development = false, hotModuleReplacement = false, related = {}, chunkHash = [], contentHash = [], javascriptModule, sourceFilename, ...extras } = assetInfo;
22
+ let { immutable = false, minimized = false, development = false, hotModuleReplacement = false, related = {}, fullhash = [], chunkhash = [], contenthash = [], javascriptModule, sourceFilename, ...extras } = assetInfo;
22
23
  extras = extras ?? {};
23
24
  return {
24
25
  immutable,
@@ -26,9 +27,12 @@ class JsAssetInfo {
26
27
  development,
27
28
  hotModuleReplacement,
28
29
  related,
29
- chunkHash,
30
- contentHash,
31
- extras
30
+ fullhash,
31
+ chunkhash,
32
+ contenthash,
33
+ extras,
34
+ javascriptModule,
35
+ sourceFilename
32
36
  };
33
37
  }
34
38
  }
@@ -6,7 +6,7 @@ class JsSplitChunkSizes {
6
6
  if (typeof sizes === "number") {
7
7
  return sizes;
8
8
  }
9
- else if (sizes && typeof sizes === "object") {
9
+ if (sizes && typeof sizes === "object") {
10
10
  const chunkSizes = {
11
11
  sizes: sizes
12
12
  };
@@ -1,42 +1,16 @@
1
- export type ObjectParsedPropertyEntry = {
2
- /**
3
- * base value
4
- */
5
- base: any | undefined;
6
- /**
7
- * the name of the selector property
8
- */
9
- byProperty: string | undefined;
10
- /**
11
- * value depending on selector property, merged with base
12
- */
13
- byValues: Map<string, any>;
14
- };
15
- export type ParsedObject = {
16
- /**
17
- * static properties (key is property name)
18
- */
19
- static: Map<string, ObjectParsedPropertyEntry>;
20
- /**
21
- * dynamic part
22
- */
23
- dynamic: {
24
- byProperty: string;
25
- fn: Function;
26
- } | undefined;
27
- };
28
1
  /**
29
- * @template T
30
- * @param {Partial<T>} obj object
31
- * @param {string} property property
32
- * @param {string|number|boolean} value assignment value
33
- * @returns {T} new object
2
+ * The following code is modified based on
3
+ * https://github.com/webpack/webpack/blob/4b4ca3b/lib/util/cleverMerge.js
4
+ *
5
+ * MIT Licensed
6
+ * Author Tobias Koppers @sokra
7
+ * Copyright (c) JS Foundation and other contributors
8
+ * https://github.com/webpack/webpack/blob/main/LICENSE
34
9
  */
35
- export function cachedSetProperty<T>(obj: Partial<T>, property: string, value: string | number | boolean): T;
10
+ type Obj = Record<PropertyKey, any>;
11
+ export declare const DELETE: unique symbol;
36
12
  /**
37
13
  * Merges two given objects and caches the result to avoid computation if same objects passed as arguments again.
38
- * @template T
39
- * @template O
40
14
  * @example
41
15
  * // performs cleverMerge(first, second), stores the result in WeakMap and returns result
42
16
  * cachedCleverMerge({a: 1}, {a: 2})
@@ -44,35 +18,37 @@ export function cachedSetProperty<T>(obj: Partial<T>, property: string, value: s
44
18
  * // when same arguments passed, gets the result from WeakMap and returns it.
45
19
  * cachedCleverMerge({a: 1}, {a: 2})
46
20
  * {a: 2}
47
- * @param {T} first first object
48
- * @param {O} second second object
49
- * @returns {T & O | T | O} merged object of first and second object
21
+ * @param first first object
22
+ * @param second second object
23
+ * @returns merged object of first and second object
50
24
  */
51
- export function cachedCleverMerge<T, O>(first: T, second: O): T | O | (T & O);
25
+ export declare const cachedCleverMerge: <First, Second>(first: First, second: Second) => First | Second | (First & Second);
26
+ /**
27
+ * @param obj object
28
+ * @param property property
29
+ * @param value assignment value
30
+ * @returns new object
31
+ */
32
+ export declare const cachedSetProperty: (obj: Obj, property: string, value: string | number | boolean) => Obj;
52
33
  /**
53
34
  * Merges two objects. Objects are deeply clever merged.
54
35
  * Arrays might reference the old value with "...".
55
36
  * Non-object values take preference over object values.
56
- * @template T
57
- * @template O
58
- * @param {T} first first object
59
- * @param {O} second second object
60
- * @returns {T & O | T | O} merged object of first and second object
37
+ * @param first first object
38
+ * @param second second object
39
+ * @returns merged object of first and second object
61
40
  */
62
- export function cleverMerge<T, O>(first: T, second: O): T | O | (T & O);
41
+ export declare const cleverMerge: <First, Second>(first: First, second: Second) => First | Second | (First & Second);
63
42
  /**
64
- * @template T
65
- * @template {string} P
66
- * @param {T} obj the object
67
- * @param {P} byProperty the by description
68
- * @param {...any} values values
69
- * @returns {Omit<T, P>|undefined} object with merged byProperty
43
+ * @param obj the object
44
+ * @returns the object without operations like "..." or DELETE
70
45
  */
71
- export function resolveByProperty<T, P extends string>(obj: T, byProperty: P, ...values: any[]): Omit<T, P> | undefined;
46
+ export declare const removeOperations: <O extends Obj>(obj: O) => O;
72
47
  /**
73
- * @template T
74
- * @param {T} obj the object
75
- * @returns {T} the object without operations like "..." or DELETE
48
+ * @param obj the object
49
+ * @param byProperty the by description
50
+ * @param values values
51
+ * @returns object with merged byProperty
76
52
  */
77
- export function removeOperations<T>(obj: T): T;
78
- export const DELETE: unique symbol;
53
+ export declare const resolveByProperty: <O extends Obj | null, P extends PropertyKey>(obj: O, byProperty: P, ...values: any[]) => Omit<O, P> | undefined;
54
+ export {};