@rspack/core 1.0.13 → 1.1.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 (99) hide show
  1. package/compiled/@swc/types/index.d.ts +1962 -0
  2. package/compiled/@swc/types/index.js +19 -0
  3. package/compiled/@swc/types/license +201 -0
  4. package/compiled/@swc/types/package.json +1 -0
  5. package/dist/Compilation.d.ts +6 -17
  6. package/dist/Compiler.d.ts +0 -1
  7. package/dist/FileSystem.d.ts +7 -3
  8. package/dist/Module.d.ts +5 -3
  9. package/dist/NormalModule.d.ts +2 -7
  10. package/dist/RuntimeGlobals.d.ts +1 -1
  11. package/dist/builtin-loader/swc/types.d.ts +9 -435
  12. package/dist/builtin-plugin/APIPlugin.d.ts +2 -2
  13. package/dist/builtin-plugin/ArrayPushCallbackChunkFormatPlugin.d.ts +2 -2
  14. package/dist/builtin-plugin/AssetModulesPlugin.d.ts +2 -2
  15. package/dist/builtin-plugin/AsyncWebAssemblyModulesPlugin.d.ts +2 -2
  16. package/dist/builtin-plugin/BannerPlugin.d.ts +2 -2
  17. package/dist/builtin-plugin/BundlerInfoRspackPlugin.d.ts +2 -2
  18. package/dist/builtin-plugin/ChunkPrefetchPreloadPlugin.d.ts +2 -2
  19. package/dist/builtin-plugin/CommonJsChunkFormatPlugin.d.ts +2 -2
  20. package/dist/builtin-plugin/ContextReplacementPlugin.d.ts +2 -2
  21. package/dist/builtin-plugin/CopyRspackPlugin.d.ts +2 -2
  22. package/dist/builtin-plugin/CssModulesPlugin.d.ts +2 -2
  23. package/dist/builtin-plugin/DataUriPlugin.d.ts +2 -2
  24. package/dist/builtin-plugin/DefinePlugin.d.ts +2 -2
  25. package/dist/builtin-plugin/DeterministicChunkIdsPlugin.d.ts +2 -2
  26. package/dist/builtin-plugin/DeterministicModuleIdsPlugin.d.ts +2 -2
  27. package/dist/builtin-plugin/ElectronTargetPlugin.d.ts +2 -2
  28. package/dist/builtin-plugin/EnableChunkLoadingPlugin.d.ts +2 -2
  29. package/dist/builtin-plugin/EnableWasmLoadingPlugin.d.ts +2 -2
  30. package/dist/builtin-plugin/EnsureChunkConditionsPlugin.d.ts +2 -2
  31. package/dist/builtin-plugin/EntryPlugin.d.ts +2 -2
  32. package/dist/builtin-plugin/EvalDevToolModulePlugin.d.ts +2 -2
  33. package/dist/builtin-plugin/EvalSourceMapDevToolPlugin.d.ts +2 -2
  34. package/dist/builtin-plugin/ExternalsPlugin.d.ts +2 -2
  35. package/dist/builtin-plugin/FetchCompileAsyncWasmPlugin.d.ts +2 -2
  36. package/dist/builtin-plugin/FileUriPlugin.d.ts +2 -2
  37. package/dist/builtin-plugin/FlagDependencyExportsPlugin.d.ts +2 -2
  38. package/dist/builtin-plugin/FlagDependencyUsagePlugin.d.ts +2 -2
  39. package/dist/builtin-plugin/HtmlRspackPlugin.d.ts +16 -10
  40. package/dist/builtin-plugin/HttpExternalsRspackPlugin.d.ts +2 -2
  41. package/dist/builtin-plugin/IgnorePlugin.d.ts +2 -2
  42. package/dist/builtin-plugin/InferAsyncModulesPlugin.d.ts +2 -2
  43. package/dist/builtin-plugin/JsonModulesPlugin.d.ts +2 -2
  44. package/dist/builtin-plugin/{LightningCssMiminizerRspackPlugin.d.ts → LightningCssMinimizerRspackPlugin.d.ts} +2 -2
  45. package/dist/builtin-plugin/LimitChunkCountPlugin.d.ts +2 -2
  46. package/dist/builtin-plugin/MangleExportsPlugin.d.ts +2 -2
  47. package/dist/builtin-plugin/MergeDuplicateChunksPlugin.d.ts +2 -2
  48. package/dist/builtin-plugin/ModuleChunkFormatPlugin.d.ts +2 -2
  49. package/dist/builtin-plugin/ModuleConcatenationPlugin.d.ts +2 -2
  50. package/dist/builtin-plugin/NamedChunkIdsPlugin.d.ts +2 -2
  51. package/dist/builtin-plugin/NamedModuleIdsPlugin.d.ts +2 -2
  52. package/dist/builtin-plugin/NaturalChunkIdsPlugin.d.ts +2 -2
  53. package/dist/builtin-plugin/NaturalModuleIdsPlugin.d.ts +2 -2
  54. package/dist/builtin-plugin/NoEmitOnErrorsPlugin.d.ts +2 -2
  55. package/dist/builtin-plugin/NodeTargetPlugin.d.ts +2 -2
  56. package/dist/builtin-plugin/ProgressPlugin.d.ts +2 -2
  57. package/dist/builtin-plugin/ProvidePlugin.d.ts +2 -2
  58. package/dist/builtin-plugin/RealContentHashPlugin.d.ts +2 -2
  59. package/dist/builtin-plugin/RemoveDuplicateModulesPlugin.d.ts +10 -0
  60. package/dist/builtin-plugin/RemoveEmptyChunksPlugin.d.ts +2 -2
  61. package/dist/builtin-plugin/RuntimeChunkPlugin.d.ts +2 -2
  62. package/dist/builtin-plugin/RuntimePlugin.d.ts +2 -2
  63. package/dist/builtin-plugin/SideEffectsFlagPlugin.d.ts +2 -2
  64. package/dist/builtin-plugin/SizeLimitsPlugin.d.ts +10 -10
  65. package/dist/builtin-plugin/SourceMapDevToolPlugin.d.ts +2 -2
  66. package/dist/builtin-plugin/SplitChunksPlugin.d.ts +1 -1
  67. package/dist/builtin-plugin/SwcJsMinimizerPlugin.d.ts +2 -2
  68. package/dist/builtin-plugin/WarnCaseSensitiveModulesPlugin.d.ts +2 -2
  69. package/dist/builtin-plugin/WebWorkerTemplatePlugin.d.ts +2 -2
  70. package/dist/builtin-plugin/css-extract/loader.d.ts +1 -1
  71. package/dist/builtin-plugin/index.d.ts +4 -2
  72. package/dist/builtin-plugin/lazy-compilation/backend.d.ts +1 -5
  73. package/dist/builtin-plugin/lazy-compilation/lazyCompilation.d.ts +2 -2
  74. package/dist/config/adapter.d.ts +1 -1
  75. package/dist/config/adapterRuleUse.d.ts +1 -2
  76. package/dist/config/index.d.ts +1 -0
  77. package/dist/config/normalization.d.ts +2 -1
  78. package/dist/config/types.d.ts +889 -3
  79. package/dist/config/zod.d.ts +1010 -2231
  80. package/dist/container/ModuleFederationRuntimePlugin.d.ts +2 -2
  81. package/dist/exports.d.ts +4 -2
  82. package/dist/index.d.ts +1 -0
  83. package/dist/index.js +443 -4852
  84. package/dist/lib/HookWebpackError.d.ts +1 -1
  85. package/dist/lib/WebpackError.d.ts +0 -1
  86. package/dist/node/nodeConsole.d.ts +0 -1
  87. package/dist/stats/statsFactoryUtils.d.ts +1 -2
  88. package/dist/util/ArrayQueue.d.ts +1 -9
  89. package/dist/util/asyncLib.d.ts +54 -0
  90. package/dist/util/fs.d.ts +0 -3
  91. package/dist/util/hash/BatchedHash.d.ts +0 -1
  92. package/dist/util/hash/index.d.ts +0 -1
  93. package/dist/util/hash/wasm-hash.d.ts +0 -1
  94. package/dist/util/identifier.d.ts +8 -8
  95. package/dist/util/index.d.ts +0 -1
  96. package/dist/util/memoize.d.ts +1 -1
  97. package/dist/util/webpack.d.ts +1 -1
  98. package/package.json +6 -6
  99. package/dist/builtin-loader/swc/react.d.ts +0 -15
@@ -31,7 +31,7 @@ export declare const makeWebpackError: (error: Error, hook: string) => WebpackEr
31
31
  * @param hook name of hook
32
32
  * @returns generic callback
33
33
  */
34
- export declare const makeWebpackErrorCallback: <T>(callback: (error?: WebpackError | null, result?: T | undefined) => void, hook: string) => Callback<Error, T>;
34
+ export declare const makeWebpackErrorCallback: <T>(callback: (error?: WebpackError | null, result?: T) => void, hook: string) => Callback<Error, T>;
35
35
  /**
36
36
  * @param fn function which will be wrapping in try catch
37
37
  * @param hook name of hook
@@ -7,7 +7,6 @@
7
7
  * Copyright (c) JS Foundation and other contributors
8
8
  * https://github.com/webpack/webpack/blob/main/LICENSE
9
9
  */
10
- /// <reference types="node" />
11
10
  import { inspect } from "node:util";
12
11
  import type { Chunk } from "../Chunk";
13
12
  import type { Module } from "../Module";
@@ -7,7 +7,6 @@
7
7
  * Copyright (c) JS Foundation and other contributors
8
8
  * https://github.com/webpack/webpack/blob/main/LICENSE
9
9
  */
10
- /// <reference types="node" />
11
10
  import type { LoggerConsole } from "../logging/createConsoleLogger";
12
11
  export default function ({ colors, appendOnly, stream }: {
13
12
  colors?: boolean;
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import type * as binding from "@rspack/binding";
3
2
  import type { JsOriginRecord } from "@rspack/binding";
4
3
  import type { Compilation } from "../Compilation";
@@ -273,7 +272,7 @@ export declare const spaceLimited: (itemsAndGroups: ItemChildren, max: number, f
273
272
  filteredChildren: any;
274
273
  };
275
274
  export declare const countWithChildren: (compilation: Compilation, getItems: (compilation: Compilation, key: string) => any[]) => number;
276
- export declare const sortByField: (field: string) => (a1: Object, a2: Object) => number;
275
+ export declare const sortByField: (field: string) => ((a1: Object, a2: Object) => number);
277
276
  export declare const assetGroup: (children: StatsAsset[]) => {
278
277
  size: number;
279
278
  };
@@ -40,14 +40,6 @@ declare class ArrayQueue<T> {
40
40
  * @returns {void}
41
41
  */
42
42
  delete(item: T): void;
43
- [Symbol.iterator](): {
44
- next: () => {
45
- done: boolean;
46
- value: T;
47
- } | {
48
- done: boolean;
49
- value: undefined;
50
- };
51
- };
43
+ [Symbol.iterator](): Generator<T, void, unknown>;
52
44
  }
53
45
  export default ArrayQueue;
@@ -0,0 +1,54 @@
1
+ /**
2
+ * The following code is modified based on
3
+ * https://github.com/suguru03/neo-async/blob/master/lib/async.js
4
+ *
5
+ * MIT Licensed
6
+ * Author Suguru Motegi
7
+ * Copyright (c) 2014-2018 Suguru Motegi
8
+ * https://github.com/suguru03/neo-async/blob/master/LICENSE
9
+ */
10
+ export interface Dictionary<T> {
11
+ [key: string]: T;
12
+ }
13
+ export type IterableCollection<T> = T[] | IterableIterator<T> | Dictionary<T>;
14
+ export type ErrorCallback<E = Error> = (err?: E | null) => void;
15
+ export type AsyncIterator<T, E = Error> = (item: T, callback: ErrorCallback<E>) => void;
16
+ /**
17
+ * @example
18
+ *
19
+ * // array
20
+ * var order = [];
21
+ * var array = [1, 3, 2];
22
+ * var iterator = function(num, done) {
23
+ * setTimeout(function() {
24
+ * order.push(num);
25
+ * done();
26
+ * }, num * 10);
27
+ * };
28
+ * asyncLib.each(array, iterator, function(err, res) {
29
+ * console.log(res); // undefined
30
+ * console.log(order); // [1, 2, 3]
31
+ * });
32
+ *
33
+ * @example
34
+ *
35
+ * // break
36
+ * var order = [];
37
+ * var array = [1, 3, 2];
38
+ * var iterator = function(num, done) {
39
+ * setTimeout(function() {
40
+ * order.push(num);
41
+ * done(null, num !== 2);
42
+ * }, num * 10);
43
+ * };
44
+ * asyncLib.each(array, iterator, function(err, res) {
45
+ * console.log(res); // undefined
46
+ * console.log(order); // [1, 2]
47
+ * });
48
+ *
49
+ */
50
+ declare function each<T, E = Error>(collection: IterableCollection<T>, iterator: AsyncIterator<T, E>, originalCallback: ErrorCallback<E>): void;
51
+ declare const _default: {
52
+ each: typeof each;
53
+ };
54
+ export default _default;
package/dist/util/fs.d.ts CHANGED
@@ -7,9 +7,6 @@
7
7
  * Copyright (c) JS Foundation and other contributors
8
8
  * https://github.com/webpack/webpack/blob/main/LICENSE
9
9
  */
10
- /// <reference types="node" />
11
- /// <reference types="node" />
12
- /// <reference types="node" />
13
10
  import type { Abortable } from "node:events";
14
11
  import type { WatchOptions } from "../config";
15
12
  export interface Watcher {
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  /**
3
2
  * The following code is modified based on
4
3
  * https://github.com/webpack/webpack/blob/4b4ca3b/lib/util/hash/BatchedHash.js
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  export default class Hash {
3
2
  /**
4
3
  * Update hash {@link https://nodejs.org/api/crypto.html#crypto_hash_update_data_inputencoding}
@@ -7,7 +7,6 @@
7
7
  * Copyright (c) JS Foundation and other contributors
8
8
  * https://github.com/webpack/webpack/blob/main/LICENSE
9
9
  */
10
- /// <reference types="node" />
11
10
  export declare const MAX_SHORT_STRING: number;
12
11
  type Exports = WebAssembly.Instance["exports"] & {
13
12
  init: () => void;
@@ -11,13 +11,13 @@ export declare const makePathsRelative: {
11
11
  * @param {Object=} associatedObjectForCache an object to which the cache will be attached
12
12
  * @returns {function(string, string): string} cached function
13
13
  */
14
- bindCache(associatedObjectForCache: object | undefined): (arg0: string, arg1: string) => string;
14
+ bindCache(associatedObjectForCache: object | undefined): ((arg0: string, arg1: string) => string);
15
15
  /**
16
16
  * @param {string} context context used to create relative path
17
17
  * @param {Object=} associatedObjectForCache an object to which the cache will be attached
18
18
  * @returns {function(string): string} cached function
19
19
  */
20
- bindContextCache(context: string, associatedObjectForCache: object | undefined): (arg0: string) => string;
20
+ bindContextCache(context: string, associatedObjectForCache: object | undefined): ((arg0: string) => string);
21
21
  };
22
22
  export declare const makePathsAbsolute: {
23
23
  (context: string, identifier: string, associatedObjectForCache: object | undefined): string;
@@ -25,13 +25,13 @@ export declare const makePathsAbsolute: {
25
25
  * @param {Object=} associatedObjectForCache an object to which the cache will be attached
26
26
  * @returns {function(string, string): string} cached function
27
27
  */
28
- bindCache(associatedObjectForCache: object | undefined): (arg0: string, arg1: string) => string;
28
+ bindCache(associatedObjectForCache: object | undefined): ((arg0: string, arg1: string) => string);
29
29
  /**
30
30
  * @param {string} context context used to create relative path
31
31
  * @param {Object=} associatedObjectForCache an object to which the cache will be attached
32
32
  * @returns {function(string): string} cached function
33
33
  */
34
- bindContextCache(context: string, associatedObjectForCache: object | undefined): (arg0: string) => string;
34
+ bindContextCache(context: string, associatedObjectForCache: object | undefined): ((arg0: string) => string);
35
35
  };
36
36
  export declare const contextify: {
37
37
  (context: string, identifier: string, associatedObjectForCache: object | undefined): string;
@@ -39,13 +39,13 @@ export declare const contextify: {
39
39
  * @param {Object=} associatedObjectForCache an object to which the cache will be attached
40
40
  * @returns {function(string, string): string} cached function
41
41
  */
42
- bindCache(associatedObjectForCache: object | undefined): (arg0: string, arg1: string) => string;
42
+ bindCache(associatedObjectForCache: object | undefined): ((arg0: string, arg1: string) => string);
43
43
  /**
44
44
  * @param {string} context context used to create relative path
45
45
  * @param {Object=} associatedObjectForCache an object to which the cache will be attached
46
46
  * @returns {function(string): string} cached function
47
47
  */
48
- bindContextCache(context: string, associatedObjectForCache: object | undefined): (arg0: string) => string;
48
+ bindContextCache(context: string, associatedObjectForCache: object | undefined): ((arg0: string) => string);
49
49
  };
50
50
  export declare const absolutify: {
51
51
  (context: string, identifier: string, associatedObjectForCache: object | undefined): string;
@@ -53,13 +53,13 @@ export declare const absolutify: {
53
53
  * @param {Object=} associatedObjectForCache an object to which the cache will be attached
54
54
  * @returns {function(string, string): string} cached function
55
55
  */
56
- bindCache(associatedObjectForCache: object | undefined): (arg0: string, arg1: string) => string;
56
+ bindCache(associatedObjectForCache: object | undefined): ((arg0: string, arg1: string) => string);
57
57
  /**
58
58
  * @param {string} context context used to create relative path
59
59
  * @param {Object=} associatedObjectForCache an object to which the cache will be attached
60
60
  * @returns {function(string): string} cached function
61
61
  */
62
- bindContextCache(context: string, associatedObjectForCache: object | undefined): (arg0: string) => string;
62
+ bindContextCache(context: string, associatedObjectForCache: object | undefined): ((arg0: string) => string);
63
63
  };
64
64
  export declare const parseResource: {
65
65
  (str: string, associatedObjectForCache?: object): ParsedResource;
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import type { JsRspackError, JsStatsError } from "@rspack/binding";
3
2
  import type { LoaderObject } from "../loader-runner";
4
3
  export declare function mapValues(record: Record<string, string>, fn: (key: string) => string): {
@@ -1,3 +1,3 @@
1
- export declare const memoize: <T>(fn: () => T) => () => T;
1
+ export declare const memoize: <T>(fn: () => T) => (() => T);
2
2
  export declare const memoizeFn: <const T extends readonly unknown[], const P>(fn: () => (...args: T) => P) => (...args: T) => P;
3
3
  export declare function memoizeValue<T>(fn: () => T): T;
@@ -1,4 +1,4 @@
1
1
  declare const _default: {
2
- readonly createHash: (algorithm: (string & {}) | "debug" | "xxhash64" | "md4" | "native-md4" | (new () => import("./hash").default)) => import("./hash").default;
2
+ readonly createHash: (algorithm: "debug" | "xxhash64" | "md4" | "native-md4" | (string & {}) | (new () => import("./hash").default)) => import("./hash").default;
3
3
  };
4
4
  export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspack/core",
3
- "version": "1.0.13",
3
+ "version": "1.1.0-beta.0",
4
4
  "webpackVersion": "5.75.0",
5
5
  "license": "MIT",
6
6
  "description": "The fast Rust-based web bundler with webpack-compatible API",
@@ -12,6 +12,7 @@
12
12
  },
13
13
  "exports": {
14
14
  ".": {
15
+ "types": "./dist/index.d.ts",
15
16
  "default": "./dist/index.js"
16
17
  },
17
18
  "./hot/*": "./hot/*.js",
@@ -37,8 +38,8 @@
37
38
  },
38
39
  "devDependencies": {
39
40
  "@swc/core": "1.4.0",
41
+ "@swc/types": "0.1.12",
40
42
  "@types/graceful-fs": "4.1.9",
41
- "@types/neo-async": "^2.6.6",
42
43
  "@types/watchpack": "^2.4.0",
43
44
  "@types/webpack-sources": "3.2.3",
44
45
  "browserslist": "^4.21.3",
@@ -46,11 +47,10 @@
46
47
  "enhanced-resolve": "5.12.0",
47
48
  "graceful-fs": "4.2.10",
48
49
  "json-parse-even-better-errors": "^3.0.0",
49
- "neo-async": "2.6.2",
50
50
  "prebundle": "^1.1.0",
51
51
  "tsc-alias": "^1.8.8",
52
52
  "tsup": "^8.3.0",
53
- "typescript": "5.0.2",
53
+ "typescript": "^5.6.3",
54
54
  "watchpack": "^2.4.0",
55
55
  "webpack-dev-server": "5.0.4",
56
56
  "webpack-sources": "3.2.3",
@@ -61,7 +61,7 @@
61
61
  "@module-federation/runtime-tools": "0.5.1",
62
62
  "@rspack/lite-tapable": "1.0.1",
63
63
  "caniuse-lite": "^1.0.30001616",
64
- "@rspack/binding": "1.0.13"
64
+ "@rspack/binding": "1.1.0-beta.0"
65
65
  },
66
66
  "peerDependencies": {
67
67
  "@swc/helpers": ">=0.5.1"
@@ -80,6 +80,6 @@
80
80
  "prepare-container-runtime": "node ./scripts/prepare-container-runtime.js",
81
81
  "doc-coverage": "node scripts/check-documentation-coverage.mjs",
82
82
  "api-extractor": "api-extractor run --verbose",
83
- "api-extractor:ci": "api-extractor run --verbose || diff temp/api.md etc/api.md"
83
+ "api-extractor:ci": "api-extractor run --verbose || diff temp/core.api.md etc/core.api.md"
84
84
  }
85
85
  }
@@ -1,15 +0,0 @@
1
- type RawReactOptions = {
2
- runtime?: "automatic" | "classic";
3
- importSource?: string;
4
- pragma?: string;
5
- pragmaFrag?: string;
6
- throwIfNamespace?: boolean;
7
- development?: boolean;
8
- useBuiltins?: boolean;
9
- useSpread?: boolean;
10
- refresh?: boolean;
11
- };
12
- declare function resolveReact(react: ReactOptions): RawReactOptions;
13
- type ReactOptions = RawReactOptions | undefined;
14
- export { resolveReact };
15
- export type { ReactOptions };