@rspack-debug/core 1.4.0 → 1.4.3

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 (91) hide show
  1. package/README.md +1 -1
  2. package/compiled/tinypool/README.md +1 -1
  3. package/compiled/tinypool/dist/entry/worker.js +1 -0
  4. package/compiled/tinypool/dist/index.js +6 -2
  5. package/compiled/tinypool/package.json +1 -1
  6. package/dist/Chunk.d.ts +14 -34
  7. package/dist/ChunkGraph.d.ts +6 -21
  8. package/dist/Chunks.d.ts +0 -1
  9. package/dist/Compilation.d.ts +9 -8
  10. package/dist/Entrypoint.d.ts +2 -10
  11. package/dist/ErrorHelpers.d.ts +2 -0
  12. package/dist/RspackError.d.ts +1 -1
  13. package/dist/builtin-plugin/APIPlugin.d.ts +1 -2
  14. package/dist/builtin-plugin/ArrayPushCallbackChunkFormatPlugin.d.ts +1 -2
  15. package/dist/builtin-plugin/AssetModulesPlugin.d.ts +1 -2
  16. package/dist/builtin-plugin/AsyncWebAssemblyModulesPlugin.d.ts +1 -2
  17. package/dist/builtin-plugin/BannerPlugin.d.ts +3 -3
  18. package/dist/builtin-plugin/BundlerInfoRspackPlugin.d.ts +1 -2
  19. package/dist/builtin-plugin/ChunkPrefetchPreloadPlugin.d.ts +1 -2
  20. package/dist/builtin-plugin/CommonJsChunkFormatPlugin.d.ts +1 -2
  21. package/dist/builtin-plugin/ContextReplacementPlugin.d.ts +1 -2
  22. package/dist/builtin-plugin/CopyRspackPlugin.d.ts +2 -2
  23. package/dist/builtin-plugin/CssChunkingPlugin.d.ts +1 -1
  24. package/dist/builtin-plugin/CssModulesPlugin.d.ts +1 -2
  25. package/dist/builtin-plugin/DataUriPlugin.d.ts +1 -2
  26. package/dist/builtin-plugin/DefinePlugin.d.ts +1 -2
  27. package/dist/builtin-plugin/DllEntryPlugin.d.ts +1 -2
  28. package/dist/builtin-plugin/DllReferenceAgencyPlugin.d.ts +2 -2
  29. package/dist/builtin-plugin/ElectronTargetPlugin.d.ts +1 -2
  30. package/dist/builtin-plugin/EnableChunkLoadingPlugin.d.ts +1 -2
  31. package/dist/builtin-plugin/EnableWasmLoadingPlugin.d.ts +1 -2
  32. package/dist/builtin-plugin/EnsureChunkConditionsPlugin.d.ts +1 -2
  33. package/dist/builtin-plugin/EntryPlugin.d.ts +2 -2
  34. package/dist/builtin-plugin/EvalDevToolModulePlugin.d.ts +2 -2
  35. package/dist/builtin-plugin/EvalSourceMapDevToolPlugin.d.ts +2 -2
  36. package/dist/builtin-plugin/FetchCompileAsyncWasmPlugin.d.ts +1 -2
  37. package/dist/builtin-plugin/FileUriPlugin.d.ts +1 -2
  38. package/dist/builtin-plugin/FlagAllModulesAsUsedPlugin.d.ts +1 -2
  39. package/dist/builtin-plugin/FlagDependencyExportsPlugin.d.ts +1 -2
  40. package/dist/builtin-plugin/HttpExternalsRspackPlugin.d.ts +1 -2
  41. package/dist/builtin-plugin/IgnorePlugin.d.ts +2 -2
  42. package/dist/builtin-plugin/InferAsyncModulesPlugin.d.ts +1 -2
  43. package/dist/builtin-plugin/JsLoaderRspackPlugin.d.ts +1 -2
  44. package/dist/builtin-plugin/JsonModulesPlugin.d.ts +1 -2
  45. package/dist/builtin-plugin/LibManifestPlugin.d.ts +1 -2
  46. package/dist/builtin-plugin/LightningCssMinimizerRspackPlugin.d.ts +1 -2
  47. package/dist/builtin-plugin/LimitChunkCountPlugin.d.ts +1 -2
  48. package/dist/builtin-plugin/MergeDuplicateChunksPlugin.d.ts +1 -2
  49. package/dist/builtin-plugin/ModuleChunkFormatPlugin.d.ts +1 -2
  50. package/dist/builtin-plugin/ModuleInfoHeaderPlugin.d.ts +1 -2
  51. package/dist/builtin-plugin/NamedChunkIdsPlugin.d.ts +1 -2
  52. package/dist/builtin-plugin/NamedModuleIdsPlugin.d.ts +1 -2
  53. package/dist/builtin-plugin/NoEmitOnErrorsPlugin.d.ts +1 -2
  54. package/dist/builtin-plugin/NodeTargetPlugin.d.ts +1 -2
  55. package/dist/builtin-plugin/OccurrenceChunkIdsPlugin.d.ts +2 -2
  56. package/dist/builtin-plugin/ProgressPlugin.d.ts +2 -2
  57. package/dist/builtin-plugin/ProvidePlugin.d.ts +1 -2
  58. package/dist/builtin-plugin/RealContentHashPlugin.d.ts +1 -2
  59. package/dist/builtin-plugin/RemoveDuplicateModulesPlugin.d.ts +1 -2
  60. package/dist/builtin-plugin/RemoveEmptyChunksPlugin.d.ts +1 -2
  61. package/dist/builtin-plugin/RsdoctorPlugin.d.ts +2 -2
  62. package/dist/builtin-plugin/RslibPlugin.d.ts +2 -2
  63. package/dist/builtin-plugin/RstestPlugin.d.ts +2 -2
  64. package/dist/builtin-plugin/RuntimeChunkPlugin.d.ts +2 -2
  65. package/dist/builtin-plugin/RuntimePlugin.d.ts +2 -2
  66. package/dist/builtin-plugin/SideEffectsFlagPlugin.d.ts +1 -2
  67. package/dist/builtin-plugin/SizeLimitsPlugin.d.ts +1 -2
  68. package/dist/builtin-plugin/SourceMapDevToolPlugin.d.ts +2 -2
  69. package/dist/builtin-plugin/SubresourceIntegrityPlugin.d.ts +2 -2
  70. package/dist/builtin-plugin/SwcJsMinimizerPlugin.d.ts +1 -2
  71. package/dist/builtin-plugin/WarnCaseSensitiveModulesPlugin.d.ts +1 -2
  72. package/dist/builtin-plugin/base.d.ts +29 -5
  73. package/dist/builtin-plugin/html-plugin/plugin.d.ts +2 -2
  74. package/dist/builtin-plugin/index.d.ts +1 -1
  75. package/dist/builtin-plugin/lazy-compilation/lazyCompilation.d.ts +1 -2
  76. package/dist/config/normalization.d.ts +5 -3
  77. package/dist/config/types.d.ts +24 -5
  78. package/dist/config/zod.d.ts +7 -6
  79. package/dist/container/ModuleFederationRuntimePlugin.d.ts +1 -2
  80. package/dist/exports.d.ts +3 -1
  81. package/dist/index.js +242 -377
  82. package/dist/lib/WebpackError.d.ts +2 -4
  83. package/dist/loader-runner/ModuleError.d.ts +7 -0
  84. package/dist/loader-runner/ModuleWarning.d.ts +7 -0
  85. package/dist/stats/StatsFactory.d.ts +2 -2
  86. package/dist/stats/statsFactoryUtils.d.ts +2 -2
  87. package/dist/trace/index.d.ts +7 -1
  88. package/dist/util/index.d.ts +0 -2
  89. package/dist/worker.js +11 -7
  90. package/package.json +5 -3
  91. package/dist/ChunkGroup.d.ts +0 -33
@@ -7,17 +7,15 @@
7
7
  * Copyright (c) JS Foundation and other contributors
8
8
  * https://github.com/webpack/webpack/blob/main/LICENSE
9
9
  */
10
- import { inspect } from "node:util";
10
+ import type { DependencyLocation } from "@rspack/binding";
11
11
  import type { Chunk } from "../Chunk";
12
12
  import type { Module } from "../Module";
13
- type DependencyLocation = any;
14
13
  export declare class WebpackError extends Error {
15
14
  loc?: DependencyLocation;
16
15
  file?: string;
17
16
  chunk?: Chunk;
18
- module?: Module;
17
+ module?: null | Module;
19
18
  details?: string;
20
19
  hideStack?: boolean;
21
- [inspect.custom](): string;
22
20
  }
23
21
  export default WebpackError;
@@ -0,0 +1,7 @@
1
+ import WebpackError from "../lib/WebpackError";
2
+ export default class ModuleError extends WebpackError {
3
+ error?: Error;
4
+ constructor(err: Error, { from }?: {
5
+ from?: string;
6
+ });
7
+ }
@@ -0,0 +1,7 @@
1
+ import WebpackError from "../lib/WebpackError";
2
+ export default class ModuleWarning extends WebpackError {
3
+ error?: Error;
4
+ constructor(err: Error, { from }?: {
5
+ from?: string;
6
+ });
7
+ }
@@ -7,7 +7,7 @@
7
7
  * Copyright (c) JS Foundation and other contributors
8
8
  * https://github.com/webpack/webpack/blob/main/LICENSE
9
9
  */
10
- import type { JsStats, JsStatsCompilation, JsStatsError, JsStatsWarning } from "@rspack/binding";
10
+ import type { JsStats, JsStatsCompilation, JsStatsError } from "@rspack/binding";
11
11
  import { HookMap, SyncBailHook, SyncWaterfallHook } from "@rspack/lite-tapable";
12
12
  import type { Compilation } from "../Compilation";
13
13
  import { type GroupConfig } from "../util/smartGrouping";
@@ -16,7 +16,7 @@ export type KnownStatsFactoryContext = {
16
16
  makePathsRelative?: ((arg0: string) => string) | undefined;
17
17
  compilation?: Compilation | undefined;
18
18
  cachedGetErrors?: ((arg0: Compilation) => JsStatsError[]) | undefined;
19
- cachedGetWarnings?: ((arg0: Compilation) => JsStatsWarning[]) | undefined;
19
+ cachedGetWarnings?: ((arg0: Compilation) => JsStatsError[]) | undefined;
20
20
  getStatsCompilation: (compilation: Compilation) => JsStatsCompilation;
21
21
  getInner: (compilation: Compilation) => JsStats;
22
22
  };
@@ -285,7 +285,7 @@ export type SimpleExtractors = {
285
285
  chunk: ExtractorsByOption<binding.JsStatsChunk, KnownStatsChunk>;
286
286
  chunkOrigin: ExtractorsByOption<JsOriginRecord, StatsChunkOrigin>;
287
287
  error: ExtractorsByOption<binding.JsStatsError, StatsError>;
288
- warning: ExtractorsByOption<binding.JsStatsWarning, StatsError>;
288
+ warning: ExtractorsByOption<binding.JsStatsError, StatsError>;
289
289
  moduleTraceItem: ExtractorsByOption<binding.JsStatsModuleTrace, StatsModuleTraceItem>;
290
290
  moduleTraceDependency: ExtractorsByOption<binding.JsStatsModuleTraceDependency, StatsModuleTraceDependency>;
291
291
  };
@@ -321,5 +321,5 @@ export declare const errorsSpaceLimit: (errors: StatsError[], max: number) => {
321
321
  errors: StatsError[];
322
322
  filtered: number;
323
323
  };
324
- export declare const warningFromStatsWarning: (warning: binding.JsStatsWarning) => Error;
324
+ export declare const warningFromStatsWarning: (warning: binding.JsStatsError) => Error;
325
325
  export {};
@@ -13,17 +13,23 @@ export interface ChromeEvent {
13
13
  type MakeOptional<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
14
14
  type PartialChromeEvent = MakeOptional<ChromeEvent, "ts" | "ph">;
15
15
  export declare class JavaScriptTracer {
16
+ static state: "uninitialized" | "on" | "off";
16
17
  static startTime: bigint;
17
18
  static events: ChromeEvent[];
18
19
  static layer: string;
19
20
  static output: string;
20
21
  static session: import("node:inspector").Session;
21
22
  private static counter;
23
+ /**
24
+ * only first call take effects, subsequent calls will be ignored
25
+ * @param layer tracing layer
26
+ * @param output tracing output file path
27
+ */
22
28
  static initJavaScriptTrace(layer: string, output: string): Promise<void>;
23
29
  static uuid(): number;
24
30
  static initCpuProfiler(): void;
25
31
  /**
26
- *
32
+ * only first call take effects, subsequent calls will be ignored
27
33
  * @param isEnd true means we are at the end of tracing,and can append ']' to close the json
28
34
  * @returns
29
35
  */
@@ -1,10 +1,8 @@
1
- import type { JsRspackError } from "@rspack/binding";
2
1
  import type { LoaderObject } from "../loader-runner";
3
2
  export declare function isNil(value: unknown): value is null | undefined;
4
3
  export declare const toBuffer: (bufLike: string | Buffer | Uint8Array) => Buffer;
5
4
  export declare const toObject: (input: string | Buffer | object) => object;
6
5
  export declare function serializeObject(map: string | object | undefined | null): Buffer | undefined;
7
- export declare function concatErrorMsgAndStack(err: Error | JsRspackError | string): JsRspackError;
8
6
  export declare function indent(str: string, prefix: string): string;
9
7
  export declare function stringifyLoaderObject(o: LoaderObject): string;
10
8
  export declare function asArray<T>(item: T[]): T[];
package/dist/worker.js CHANGED
@@ -184,19 +184,23 @@ var __webpack_modules__ = {
184
184
  j: ()=>createHash
185
185
  });
186
186
  let external_node_crypto_namespaceObject = require("node:crypto");
187
- var _computedKey, external_node_crypto_default = __webpack_require__.n(external_node_crypto_namespaceObject);
188
- _computedKey = __webpack_require__("node:util").inspect.custom;
189
- let lib_WebpackError = class extends Error {
187
+ var external_node_crypto_default = __webpack_require__.n(external_node_crypto_namespaceObject), external_node_util_ = __webpack_require__("node:util");
188
+ class WebpackError_WebpackError extends Error {
190
189
  loc;
191
190
  file;
192
191
  chunk;
193
192
  module;
194
193
  details;
195
194
  hideStack;
196
- [_computedKey]() {
195
+ }
196
+ Object.defineProperty(WebpackError_WebpackError.prototype, external_node_util_.inspect.custom, {
197
+ value: function() {
197
198
  return this.stack + (this.details ? `\n${this.details}` : "");
198
- }
199
- }, CURRENT_METHOD_REGEXP = /at ([a-zA-Z0-9_.]*)/;
199
+ },
200
+ enumerable: !1,
201
+ configurable: !0
202
+ });
203
+ let WebpackError = WebpackError_WebpackError, CURRENT_METHOD_REGEXP = /at ([a-zA-Z0-9_.]*)/;
200
204
  function createMessage(method) {
201
205
  return `Abstract method${method ? ` ${method}` : ""}. Must be overridden.`;
202
206
  }
@@ -207,7 +211,7 @@ var __webpack_modules__ = {
207
211
  this.message = match?.[1] ? createMessage(match[1]) : createMessage();
208
212
  }
209
213
  }
210
- class AbstractMethodError extends lib_WebpackError {
214
+ class AbstractMethodError extends WebpackError {
211
215
  constructor(){
212
216
  super(new Message().message), this.name = "AbstractMethodError";
213
217
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspack-debug/core",
3
- "version": "1.4.0",
3
+ "version": "1.4.3",
4
4
  "webpackVersion": "5.75.0",
5
5
  "license": "MIT",
6
6
  "description": "The fast Rust-based web bundler with webpack-compatible API",
@@ -37,6 +37,7 @@
37
37
  "directory": "packages/rspack"
38
38
  },
39
39
  "devDependencies": {
40
+ "@ast-grep/napi": "^0.37.0",
40
41
  "@rslib/core": "0.10.0",
41
42
  "@swc/core": "1.12.0",
42
43
  "@swc/types": "0.1.22",
@@ -57,7 +58,7 @@
57
58
  "dependencies": {
58
59
  "@module-federation/runtime-tools": "0.15.0",
59
60
  "@rspack/lite-tapable": "1.0.1",
60
- "@rspack/binding": "npm:@rspack-debug/binding@1.4.0"
61
+ "@rspack/binding": "npm:@rspack-debug/binding@1.4.3"
61
62
  },
62
63
  "peerDependencies": {
63
64
  "@swc/helpers": ">=0.5.1"
@@ -68,9 +69,10 @@
68
69
  }
69
70
  },
70
71
  "scripts": {
71
- "build": "rslib build && npm run prepare-container-runtime",
72
+ "build": "rslib build && npm run prepare-container-runtime && npm run codmod",
72
73
  "dev": "rslib build --watch",
73
74
  "prepare-container-runtime": "node ./scripts/prepare-container-runtime.js",
75
+ "codmod": "node ./scripts/codmod/index.js",
74
76
  "doc-coverage": "tsx ./scripts/check-documentation-coverage.ts",
75
77
  "api-extractor": "api-extractor run --verbose",
76
78
  "api-extractor:ci": "api-extractor run --verbose || diff temp/core.api.md etc/core.api.md"
@@ -1,33 +0,0 @@
1
- import type { JsChunkGroup } from "@rspack/binding";
2
- import { Chunk } from "./Chunk";
3
- import type { Module } from "./Module";
4
- export declare class ChunkGroup {
5
- #private;
6
- readonly chunks: ReadonlyArray<Chunk>;
7
- readonly index?: number;
8
- readonly name?: string;
9
- readonly origins: ReadonlyArray<ChunkGroupOrigin>;
10
- readonly childrenIterable: Set<ChunkGroup>;
11
- static __from_binding(binding: JsChunkGroup): ChunkGroup;
12
- protected constructor(inner: JsChunkGroup);
13
- getFiles(): ReadonlyArray<string>;
14
- getParents(): ReadonlyArray<ChunkGroup>;
15
- isInitial(): boolean;
16
- getModulePreOrderIndex(module: Module): number | null;
17
- getModulePostOrderIndex(module: Module): number | null;
18
- }
19
- interface ChunkGroupOrigin {
20
- module?: Module;
21
- request?: string;
22
- loc?: {
23
- start: {
24
- line: number;
25
- column: number;
26
- };
27
- end?: {
28
- line: number;
29
- column: number;
30
- };
31
- } | string;
32
- }
33
- export {};