@rsdoctor/core 1.3.7 → 1.3.9

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 (56) hide show
  1. package/dist/build-utils/build/chunks/index.d.ts +3 -3
  2. package/dist/build-utils/build/index.cjs +2 -2
  3. package/dist/build-utils/build/index.d.ts +5 -5
  4. package/dist/build-utils/build/loader/index.d.ts +2 -2
  5. package/dist/build-utils/build/module-graph/index.d.ts +4 -4
  6. package/dist/build-utils/build/module-graph/rspack/transform.cjs +1 -1
  7. package/dist/build-utils/build/module-graph/transform.d.ts +1 -1
  8. package/dist/build-utils/build/module-graph/utils.cjs +2 -2
  9. package/dist/build-utils/build/module-graph/webpack/transform.cjs +1 -1
  10. package/dist/build-utils/build/module-graph/webpack/transform.js +1 -1
  11. package/dist/build-utils/build/utils/index.d.ts +3 -3
  12. package/dist/build-utils/build/utils/loader.cjs +5 -5
  13. package/dist/build-utils/build/utils/plugin.cjs +2 -2
  14. package/dist/build-utils/index.d.ts +1 -1
  15. package/dist/index.cjs +4 -4
  16. package/dist/index.d.ts +3 -3
  17. package/dist/inner-plugins/index.d.ts +2 -2
  18. package/dist/inner-plugins/loaders/proxy.d.ts +1 -1
  19. package/dist/inner-plugins/plugins/base.d.ts +1 -1
  20. package/dist/inner-plugins/plugins/bundle.cjs +2 -7
  21. package/dist/inner-plugins/plugins/bundle.d.ts +1 -1
  22. package/dist/inner-plugins/plugins/bundle.js +2 -7
  23. package/dist/inner-plugins/plugins/bundleTagPlugin.d.ts +1 -1
  24. package/dist/inner-plugins/plugins/ensureModulesChunkGraph.cjs +3 -3
  25. package/dist/inner-plugins/plugins/ensureModulesChunkGraph.d.ts +1 -1
  26. package/dist/inner-plugins/plugins/ensureModulesChunkGraph.js +1 -1
  27. package/dist/inner-plugins/plugins/errors.d.ts +1 -1
  28. package/dist/inner-plugins/plugins/index.d.ts +10 -10
  29. package/dist/inner-plugins/plugins/loader.d.ts +1 -1
  30. package/dist/inner-plugins/plugins/plugins.d.ts +1 -1
  31. package/dist/inner-plugins/plugins/progress.d.ts +1 -1
  32. package/dist/inner-plugins/plugins/rspack.d.ts +1 -1
  33. package/dist/inner-plugins/plugins/rules.d.ts +1 -1
  34. package/dist/inner-plugins/plugins/sourcemapTool.cjs +22 -3
  35. package/dist/inner-plugins/plugins/sourcemapTool.d.ts +1 -1
  36. package/dist/inner-plugins/plugins/sourcemapTool.js +20 -1
  37. package/dist/inner-plugins/plugins/summary.d.ts +1 -1
  38. package/dist/inner-plugins/utils/config.cjs +2 -1
  39. package/dist/inner-plugins/utils/config.d.ts +1 -1
  40. package/dist/inner-plugins/utils/config.js +2 -1
  41. package/dist/inner-plugins/utils/index.d.ts +9 -9
  42. package/dist/inner-plugins/utils/loader.cjs +3 -3
  43. package/dist/inner-plugins/utils/loader.d.ts +2 -2
  44. package/dist/inner-plugins/utils/plugin.cjs +2 -2
  45. package/dist/inner-plugins/utils/plugin.d.ts +1 -1
  46. package/dist/rules/index.d.ts +3 -3
  47. package/dist/rules/rule.d.ts +1 -1
  48. package/dist/rules/rules/cross-chunks-package/index.d.ts +2 -2
  49. package/dist/rules/rules/default-import-check/index.d.ts +2 -2
  50. package/dist/rules/rules/default-import-check/utils.cjs +4 -4
  51. package/dist/rules/rules/duplicate-package/index.d.ts +2 -2
  52. package/dist/rules/rules/ecma-version-check/index.d.ts +2 -2
  53. package/dist/rules/rules/index.d.ts +1 -1
  54. package/dist/rules/rules/loader-performance-optimization/index.d.ts +2 -2
  55. package/dist/types/index.d.ts +4 -4
  56. package/package.json +6 -6
@@ -1,3 +1,3 @@
1
- export * from './assetsModules';
2
- export * from './chunkTransform';
3
- export * from './rspack/transform';
1
+ export * from './assetsModules.js';
2
+ export * from './chunkTransform.js';
3
+ export * from './rspack/transform.js';
@@ -25,10 +25,10 @@ var __webpack_exports__ = {};
25
25
  __webpack_require__.r(__webpack_exports__);
26
26
  __webpack_require__.d(__webpack_exports__, {
27
27
  Chunks: ()=>index_cjs_namespaceObject,
28
+ Types: ()=>external_types_index_cjs_namespaceObject,
28
29
  Utils: ()=>external_utils_index_cjs_namespaceObject,
29
- ModuleGraph: ()=>external_module_graph_index_cjs_namespaceObject,
30
30
  Loader: ()=>external_loader_index_cjs_namespaceObject,
31
- Types: ()=>external_types_index_cjs_namespaceObject
31
+ ModuleGraph: ()=>external_module_graph_index_cjs_namespaceObject
32
32
  });
33
33
  const index_cjs_namespaceObject = require("./chunks/index.cjs");
34
34
  const external_utils_index_cjs_namespaceObject = require("./utils/index.cjs");
@@ -1,5 +1,5 @@
1
- export * as Chunks from './chunks';
2
- export * as Utils from './utils';
3
- export * as Loader from './loader';
4
- export * as Types from '../../types';
5
- export * as ModuleGraph from './module-graph';
1
+ export * as Chunks from './chunks/index.js';
2
+ export * as Utils from './utils/index.js';
3
+ export * as Loader from './loader/index.js';
4
+ export * as Types from '../../types/index.js';
5
+ export * as ModuleGraph from './module-graph/index.js';
@@ -1,2 +1,2 @@
1
- export * from './probeLoaderPlugin';
2
- export * from './probeLoader';
1
+ export * from './probeLoaderPlugin.js';
2
+ export * from './probeLoader.js';
@@ -1,4 +1,4 @@
1
- export * from './webpack/transform';
2
- export * from './transform';
3
- export * from './treeShaking';
4
- export * from './rspack/transform';
1
+ export * from './webpack/transform.js';
2
+ export * from './transform.js';
3
+ export * from './treeShaking.js';
4
+ export * from './rspack/transform.js';
@@ -24,8 +24,8 @@ var __webpack_require__ = {};
24
24
  var __webpack_exports__ = {};
25
25
  __webpack_require__.r(__webpack_exports__);
26
26
  __webpack_require__.d(__webpack_exports__, {
27
- patchNativeModuleGraph: ()=>patchNativeModuleGraph,
28
27
  patchNativeModuleIds: ()=>patchNativeModuleIds,
28
+ patchNativeModuleGraph: ()=>patchNativeModuleGraph,
29
29
  patchNativeModuleSources: ()=>patchNativeModuleSources
30
30
  });
31
31
  const graph_namespaceObject = require("@rsdoctor/graph");
@@ -1,4 +1,4 @@
1
1
  import { Plugin } from '@rsdoctor/types';
2
- import { TransformContext } from '.';
2
+ import { TransformContext } from './index.js';
3
3
  import { SDK } from '@rsdoctor/types';
4
4
  export declare function getModuleGraphByStats(compilation: Plugin.BaseCompilation, stats: Plugin.StatsCompilation, root: string, chunkGraph: SDK.ChunkGraphInstance, features?: Plugin.RsdoctorWebpackPluginFeatures, context?: TransformContext): Promise<SDK.ModuleGraphInstance>;
@@ -24,8 +24,8 @@ var __webpack_require__ = {};
24
24
  var __webpack_exports__ = {};
25
25
  __webpack_require__.r(__webpack_exports__);
26
26
  __webpack_require__.d(__webpack_exports__, {
27
- getDeclarationIdentifier: ()=>getDeclarationIdentifier,
28
- getExportIdentifierStatement: ()=>getExportIdentifierStatement
27
+ getExportIdentifierStatement: ()=>getExportIdentifierStatement,
28
+ getDeclarationIdentifier: ()=>getDeclarationIdentifier
29
29
  });
30
30
  const compat_namespaceObject = require("es-toolkit/compat");
31
31
  const ruleUtils_namespaceObject = require("@rsdoctor/utils/ruleUtils");
@@ -70,7 +70,7 @@ function appendDependency(webpackDep, module, webpackGraph, graph) {
70
70
  const resolveRequest = graph_namespaceObject.Webpack.getWebpackModulePath(resolvedWebpackModule);
71
71
  const request = rawRequest ?? resolveRequest;
72
72
  if (!module.getDependencyByRequest(request)) {
73
- const depModule = graph.getModuleByFile(resolveRequest);
73
+ const depModule = graph.getModuleByFile(resolveRequest)[0];
74
74
  if (depModule) {
75
75
  const dep = module.addDependency(request, depModule, graph_namespaceObject.ModuleGraphTrans.getImportKind(webpackDep));
76
76
  if (dep) graph.addDependency(dep);
@@ -33,7 +33,7 @@ function appendDependency(webpackDep, module, webpackGraph, graph) {
33
33
  const resolveRequest = Webpack.getWebpackModulePath(resolvedWebpackModule);
34
34
  const request = rawRequest ?? resolveRequest;
35
35
  if (!module.getDependencyByRequest(request)) {
36
- const depModule = graph.getModuleByFile(resolveRequest);
36
+ const depModule = graph.getModuleByFile(resolveRequest)[0];
37
37
  if (depModule) {
38
38
  const dep = module.addDependency(request, depModule, ModuleGraphTrans.getImportKind(webpackDep));
39
39
  if (dep) graph.addDependency(dep);
@@ -1,3 +1,3 @@
1
- export * from './loader';
2
- export * from './plugin';
3
- export * from './parseBundle';
1
+ export * from './loader.js';
2
+ export * from './plugin.js';
3
+ export * from './parseBundle.js';
@@ -52,14 +52,14 @@ var __webpack_exports__ = {};
52
52
  __webpack_require__.r(__webpack_exports__);
53
53
  __webpack_require__.d(__webpack_exports__, {
54
54
  extractLoaderName: ()=>extractLoaderName,
55
+ mapEachRules: ()=>mapEachRules,
55
56
  addProbeLoader2Rules: ()=>addProbeLoader2Rules,
57
+ createLoaderContextTrap: ()=>createLoaderContextTrap,
56
58
  isESMLoader: ()=>isESMLoader,
57
- getLoaderNameMatch: ()=>getLoaderNameMatch,
58
59
  parseQuery: ()=>parseQuery,
59
- createLoaderContextTrap: ()=>createLoaderContextTrap,
60
- loadLoaderModule: ()=>loadLoaderModule,
61
- mapEachRules: ()=>mapEachRules,
62
- parsePathQueryFragment: ()=>parsePathQueryFragment
60
+ getLoaderNameMatch: ()=>getLoaderNameMatch,
61
+ parsePathQueryFragment: ()=>parsePathQueryFragment,
62
+ loadLoaderModule: ()=>loadLoaderModule
63
63
  });
64
64
  const external_node_path_namespaceObject = require("node:path");
65
65
  var external_node_path_default = /*#__PURE__*/ __webpack_require__.n(external_node_path_namespaceObject);
@@ -24,9 +24,9 @@ var __webpack_require__ = {};
24
24
  var __webpack_exports__ = {};
25
25
  __webpack_require__.r(__webpack_exports__);
26
26
  __webpack_require__.d(__webpack_exports__, {
27
- interceptCompilationHooks: ()=>interceptCompilationHooks,
28
27
  interceptCompilerHooks: ()=>interceptCompilerHooks,
29
- shouldInterceptPluginHook: ()=>shouldInterceptPluginHook
28
+ shouldInterceptPluginHook: ()=>shouldInterceptPluginHook,
29
+ interceptCompilationHooks: ()=>interceptCompilationHooks
30
30
  });
31
31
  const graph_namespaceObject = require("@rsdoctor/graph");
32
32
  function shouldInterceptPluginHook(hook) {
@@ -1 +1 @@
1
- export * as Build from './build';
1
+ export * as Build from './build/index.js';
package/dist/index.cjs CHANGED
@@ -59,8 +59,8 @@ var __webpack_exports__ = {};
59
59
  var _build_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./build-utils");
60
60
  var __WEBPACK_REEXPORT_OBJECT__ = {};
61
61
  for(var __WEBPACK_IMPORT_KEY__ in _build_utils__WEBPACK_IMPORTED_MODULE_0__)if ([
62
- "InnerPlugins",
63
- "default"
62
+ "default",
63
+ "InnerPlugins"
64
64
  ].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
65
65
  return _build_utils__WEBPACK_IMPORTED_MODULE_0__[key];
66
66
  }).bind(0, __WEBPACK_IMPORT_KEY__);
@@ -69,8 +69,8 @@ var __webpack_exports__ = {};
69
69
  var _types__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("./types");
70
70
  var __WEBPACK_REEXPORT_OBJECT__ = {};
71
71
  for(var __WEBPACK_IMPORT_KEY__ in _types__WEBPACK_IMPORTED_MODULE_2__)if ([
72
- "InnerPlugins",
73
- "default"
72
+ "default",
73
+ "InnerPlugins"
74
74
  ].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
75
75
  return _types__WEBPACK_IMPORTED_MODULE_2__[key];
76
76
  }).bind(0, __WEBPACK_IMPORT_KEY__);
package/dist/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- export * from './build-utils';
2
- export * as InnerPlugins from './inner-plugins';
3
- export * from './types';
1
+ export * from './build-utils/index.js';
2
+ export * as InnerPlugins from './inner-plugins/index.js';
3
+ export * from './types/index.js';
@@ -1,2 +1,2 @@
1
- export * from './plugins';
2
- export * from './utils';
1
+ export * from './plugins/index.js';
2
+ export * from './utils/index.js';
@@ -1,6 +1,6 @@
1
1
  import type { Plugin as PluginType } from '@rsdoctor/types';
2
2
  import { Plugin } from '@rsdoctor/types';
3
- import type { ProxyLoaderOptions } from '../../types';
3
+ import type { ProxyLoaderOptions } from '../../types/index.js';
4
4
  declare const loaderModule: Plugin.LoaderDefinition<ProxyLoaderOptions, {}>;
5
5
  export declare const pitch: (this: PluginType.LoaderContext<ProxyLoaderOptions>) => string | void | Buffer<ArrayBufferLike> | Promise<string | Buffer<ArrayBufferLike>>;
6
6
  export declare const raw = true;
@@ -1,5 +1,5 @@
1
1
  import type { Linter, Plugin, SDK } from '@rsdoctor/types';
2
- import type { InternalPlugin, RsdoctorPluginInstance } from '../../types';
2
+ import type { InternalPlugin, RsdoctorPluginInstance } from '../../types/index.js';
3
3
  export declare abstract class InternalBasePlugin<T extends Plugin.BaseCompiler> implements InternalPlugin<T, Linter.ExtendRuleData[]> {
4
4
  readonly scheduler: RsdoctorPluginInstance<T, Linter.ExtendRuleData[]>;
5
5
  abstract name: string;
@@ -35,12 +35,7 @@ class InternalBundlePlugin extends external_base_cjs_namespaceObject.InternalBas
35
35
  (0, logger_namespaceObject.time)('InternalBundlePlugin.apply');
36
36
  try {
37
37
  this.scheduler.ensureModulesChunksGraphApplied(compiler);
38
- compiler.hooks.compilation.tap({
39
- name: 'ChangeDevtoolModuleFilename',
40
- stage: -100
41
- }, ()=>{
42
- this.changeDevtoolModuleFilename(compiler);
43
- });
38
+ this.changeDevtoolModuleFilename(compiler);
44
39
  compiler.hooks.compilation.tap(this.tapPostOptions, this.thisCompilation);
45
40
  compiler.hooks.done.tapPromise(this.tapPreOptions, this.done.bind(this));
46
41
  } finally{
@@ -54,7 +49,7 @@ class InternalBundlePlugin extends external_base_cjs_namespaceObject.InternalBas
54
49
  if (!compiler.options.output) compiler.options.output = {};
55
50
  compiler.options.output.devtoolModuleFilenameTemplate = '[absolute-resource-path]';
56
51
  logger_namespaceObject.logger.warn("output.devtoolModuleFilenameTemplate has been changed to [absolute-resource-path], this is for bundle analysis.");
57
- if (devtool.includes('source-map')) compiler.options.output.devtoolFallbackModuleFilenameTemplate = '[absolute-resource-path]';
52
+ if (devtool.includes('source-map')) compiler.options.output.devtoolFallbackModuleFilenameTemplate = ()=>'[absolute-resource-path]';
58
53
  }
59
54
  }
60
55
  ensureAssetContent(name) {
@@ -1,5 +1,5 @@
1
1
  import { Plugin } from '@rsdoctor/types';
2
- import { InternalBasePlugin } from './base';
2
+ import { InternalBasePlugin } from './base.js';
3
3
  export declare class InternalBundlePlugin<T extends Plugin.BaseCompiler> extends InternalBasePlugin<T> {
4
4
  readonly name = "bundle";
5
5
  map: Map<string, {
@@ -9,12 +9,7 @@ class InternalBundlePlugin extends InternalBasePlugin {
9
9
  time('InternalBundlePlugin.apply');
10
10
  try {
11
11
  this.scheduler.ensureModulesChunksGraphApplied(compiler);
12
- compiler.hooks.compilation.tap({
13
- name: 'ChangeDevtoolModuleFilename',
14
- stage: -100
15
- }, ()=>{
16
- this.changeDevtoolModuleFilename(compiler);
17
- });
12
+ this.changeDevtoolModuleFilename(compiler);
18
13
  compiler.hooks.compilation.tap(this.tapPostOptions, this.thisCompilation);
19
14
  compiler.hooks.done.tapPromise(this.tapPreOptions, this.done.bind(this));
20
15
  } finally{
@@ -28,7 +23,7 @@ class InternalBundlePlugin extends InternalBasePlugin {
28
23
  if (!compiler.options.output) compiler.options.output = {};
29
24
  compiler.options.output.devtoolModuleFilenameTemplate = '[absolute-resource-path]';
30
25
  logger.warn("output.devtoolModuleFilenameTemplate has been changed to [absolute-resource-path], this is for bundle analysis.");
31
- if (devtool.includes('source-map')) compiler.options.output.devtoolFallbackModuleFilenameTemplate = '[absolute-resource-path]';
26
+ if (devtool.includes('source-map')) compiler.options.output.devtoolFallbackModuleFilenameTemplate = ()=>'[absolute-resource-path]';
32
27
  }
33
28
  }
34
29
  ensureAssetContent(name) {
@@ -1,5 +1,5 @@
1
1
  import { Plugin } from '@rsdoctor/types';
2
- import { InternalBasePlugin } from './base';
2
+ import { InternalBasePlugin } from './base.js';
3
3
  export declare class InternalBundleTagPlugin<T extends Plugin.BaseCompiler> extends InternalBasePlugin<T> {
4
4
  readonly name = "bundleTag";
5
5
  apply(compiler: Plugin.BaseCompiler): void;
@@ -24,9 +24,9 @@ var __webpack_require__ = {};
24
24
  var __webpack_exports__ = {};
25
25
  __webpack_require__.r(__webpack_exports__);
26
26
  __webpack_require__.d(__webpack_exports__, {
27
+ ensureModulesChunksGraphFn: ()=>ensureModulesChunksGraphFn,
27
28
  calculateNamespaceAndRegex: ()=>calculateNamespaceAndRegex,
28
- ensureDevtools: ()=>ensureDevtools,
29
- ensureModulesChunksGraphFn: ()=>ensureModulesChunksGraphFn
29
+ ensureDevtools: ()=>ensureDevtools
30
30
  });
31
31
  const types_namespaceObject = require("@rsdoctor/types");
32
32
  const build_namespaceObject = require("@rsdoctor/utils/build");
@@ -69,7 +69,7 @@ async function doneHandler(_stats, _this, context, compiler) {
69
69
  let cached = null;
70
70
  return ()=>{
71
71
  if (cached) return cached;
72
- cached = stats.toJson({
72
+ cached = 'lynx' === compiler.options.name ? stats.toJson() : stats.toJson({
73
73
  all: false,
74
74
  chunks: true,
75
75
  modules: true,
@@ -1,4 +1,4 @@
1
- import { RsdoctorPluginInstance } from '../../types';
1
+ import { RsdoctorPluginInstance } from '../../types/index.js';
2
2
  import { Linter, Plugin } from '@rsdoctor/types';
3
3
  /**
4
4
  * Represents a mapping item from a source map.
@@ -41,7 +41,7 @@ async function doneHandler(_stats, _this, context, compiler) {
41
41
  let cached = null;
42
42
  return ()=>{
43
43
  if (cached) return cached;
44
- cached = stats.toJson({
44
+ cached = 'lynx' === compiler.options.name ? stats.toJson() : stats.toJson({
45
45
  all: false,
46
46
  chunks: true,
47
47
  modules: true,
@@ -1,5 +1,5 @@
1
1
  import { Rule, Err, Plugin } from '@rsdoctor/types';
2
- import { InternalBasePlugin } from './base';
2
+ import { InternalBasePlugin } from './base.js';
3
3
  import { DevToolError } from '@rsdoctor/utils/error';
4
4
  export declare class InternalErrorReporterPlugin<T extends Plugin.BaseCompiler> extends InternalBasePlugin<T> {
5
5
  readonly name = "error-reporter";
@@ -1,10 +1,10 @@
1
- export * from './loader';
2
- export * from './plugins';
3
- export * from './errors';
4
- export * from './progress';
5
- export * from './summary';
6
- export * from './base';
7
- export * from './bundle';
8
- export * from './ensureModulesChunkGraph';
9
- export * from './rules';
10
- export * from './bundleTagPlugin';
1
+ export * from './loader.js';
2
+ export * from './plugins.js';
3
+ export * from './errors.js';
4
+ export * from './progress.js';
5
+ export * from './summary.js';
6
+ export * from './base.js';
7
+ export * from './bundle.js';
8
+ export * from './ensureModulesChunkGraph.js';
9
+ export * from './rules.js';
10
+ export * from './bundleTagPlugin.js';
@@ -1,5 +1,5 @@
1
1
  import { Plugin } from '@rsdoctor/types';
2
- import { InternalBasePlugin } from './base';
2
+ import { InternalBasePlugin } from './base.js';
3
3
  export declare class InternalLoaderPlugin<T extends Plugin.BaseCompiler> extends InternalBasePlugin<T> {
4
4
  readonly name = "loader";
5
5
  readonly internalLoaderPath: string;
@@ -1,5 +1,5 @@
1
1
  import { Plugin } from '@rsdoctor/types';
2
- import { InternalBasePlugin } from './base';
2
+ import { InternalBasePlugin } from './base.js';
3
3
  export declare class InternalPluginsPlugin<T extends Plugin.BaseCompiler> extends InternalBasePlugin<T> {
4
4
  readonly name = "plugins";
5
5
  apply(compiler: Plugin.BaseCompiler): void;
@@ -1,6 +1,6 @@
1
1
  import { SDK } from '@rsdoctor/types';
2
2
  import type { Plugin } from '@rsdoctor/types';
3
- import { InternalBasePlugin } from './base';
3
+ import { InternalBasePlugin } from './base.js';
4
4
  export declare class InternalProgressPlugin<T extends Plugin.BaseCompilerType<'webpack'>> extends InternalBasePlugin<T> {
5
5
  readonly name = "progress";
6
6
  protected currentProgress: SDK.ServerAPI.InferResponseType<SDK.ServerAPI.APIExtends.GetCompileProgress>;
@@ -1,4 +1,4 @@
1
1
  import { Linter, Plugin } from '@rsdoctor/types';
2
2
  import type { experiments } from '@rspack/core';
3
- import { RsdoctorPluginInstance } from '../../types';
3
+ import { RsdoctorPluginInstance } from '../../types/index.js';
4
4
  export declare function applyRspackNativePlugin(compiler: Plugin.BaseCompiler, plugin: RsdoctorPluginInstance<Plugin.BaseCompiler, Linter.ExtendRuleData[]>, RsdoctorRspackPlugin: typeof experiments.RsdoctorPlugin): void;
@@ -1,4 +1,4 @@
1
- import { InternalBasePlugin } from './base';
1
+ import { InternalBasePlugin } from './base.js';
2
2
  import { Plugin } from '@rsdoctor/types';
3
3
  export declare class InternalRulesPlugin extends InternalBasePlugin<Plugin.BaseCompiler> {
4
4
  readonly name = "rules";
@@ -25,10 +25,10 @@ var __webpack_exports__ = {};
25
25
  __webpack_require__.r(__webpack_exports__);
26
26
  __webpack_require__.d(__webpack_exports__, {
27
27
  UNASSIGNED: ()=>UNASSIGNED,
28
- collectSourceMaps: ()=>collectSourceMaps,
29
28
  bindContextCache: ()=>bindContextCache,
30
29
  handleAfterEmitAssets: ()=>handleAfterEmitAssets,
31
- handleEmitAssets: ()=>handleEmitAssets
30
+ handleEmitAssets: ()=>handleEmitAssets,
31
+ collectSourceMaps: ()=>collectSourceMaps
32
32
  });
33
33
  const common_namespaceObject = require("@rsdoctor/utils/common");
34
34
  const logger_namespaceObject = require("@rsdoctor/utils/logger");
@@ -57,6 +57,7 @@ async function collectSourceMaps(map, assetLinesCodeList, _compilation, _this, s
57
57
  const consumer = await new external_source_map_namespaceObject.SourceMapConsumer(map);
58
58
  const getRealSourcePath = bindContextCache(_this.sdk.root || process.cwd(), namespace, _this._realSourcePathCache);
59
59
  const lineMappings = new Map();
60
+ consumer._absoluteSources = consumer._sources;
60
61
  consumer.eachMapping((m)=>{
61
62
  if (!lineMappings.has(m.generatedLine)) lineMappings.set(m.generatedLine, []);
62
63
  lineMappings.get(m.generatedLine).push(m);
@@ -69,7 +70,25 @@ async function collectSourceMaps(map, assetLinesCodeList, _compilation, _this, s
69
70
  for(let i = 0; i < mappings.length; i++){
70
71
  const m = mappings[i];
71
72
  if (!m.source) continue;
72
- let realSource = m.source.split('!').pop();
73
+ let realSource = m.source;
74
+ if (realSource.includes('!')) {
75
+ const parts = realSource.split('!');
76
+ for(let j = parts.length - 1; j >= 0; j--){
77
+ const part = parts[j];
78
+ if (!part) continue;
79
+ const cleanPart = part.split('??')[0];
80
+ if (!cleanPart.startsWith('builtin:')) {
81
+ if (cleanPart.startsWith('/') || cleanPart.includes('\\')) {
82
+ realSource = cleanPart;
83
+ break;
84
+ }
85
+ }
86
+ }
87
+ if (realSource === m.source) {
88
+ const lastPart = parts[parts.length - 1];
89
+ realSource = lastPart ? lastPart.split('??')[0] : lastPart;
90
+ }
91
+ } else if (realSource.includes('??')) realSource = realSource.split('??')[0];
73
92
  if ((realSource?.startsWith('webpack://') || realSource?.startsWith('file://')) && sourceMapFilenameRegex) realSource = getRealSourcePath(realSource, sourceMapFilenameRegex);
74
93
  if (!realSource) continue;
75
94
  if (skipSources && skipSources.has(realSource)) continue;
@@ -1,4 +1,4 @@
1
- import { RsdoctorPluginInstance } from '../../types';
1
+ import { RsdoctorPluginInstance } from '../../types/index.js';
2
2
  import { Linter, Plugin } from '@rsdoctor/types';
3
3
  export declare const UNASSIGNED = "[unassigned]";
4
4
  /**
@@ -27,6 +27,7 @@ async function collectSourceMaps(map, assetLinesCodeList, _compilation, _this, s
27
27
  const consumer = await new SourceMapConsumer(map);
28
28
  const getRealSourcePath = bindContextCache(_this.sdk.root || process.cwd(), namespace, _this._realSourcePathCache);
29
29
  const lineMappings = new Map();
30
+ consumer._absoluteSources = consumer._sources;
30
31
  consumer.eachMapping((m)=>{
31
32
  if (!lineMappings.has(m.generatedLine)) lineMappings.set(m.generatedLine, []);
32
33
  lineMappings.get(m.generatedLine).push(m);
@@ -39,7 +40,25 @@ async function collectSourceMaps(map, assetLinesCodeList, _compilation, _this, s
39
40
  for(let i = 0; i < mappings.length; i++){
40
41
  const m = mappings[i];
41
42
  if (!m.source) continue;
42
- let realSource = m.source.split('!').pop();
43
+ let realSource = m.source;
44
+ if (realSource.includes('!')) {
45
+ const parts = realSource.split('!');
46
+ for(let j = parts.length - 1; j >= 0; j--){
47
+ const part = parts[j];
48
+ if (!part) continue;
49
+ const cleanPart = part.split('??')[0];
50
+ if (!cleanPart.startsWith('builtin:')) {
51
+ if (cleanPart.startsWith('/') || cleanPart.includes('\\')) {
52
+ realSource = cleanPart;
53
+ break;
54
+ }
55
+ }
56
+ }
57
+ if (realSource === m.source) {
58
+ const lastPart = parts[parts.length - 1];
59
+ realSource = lastPart ? lastPart.split('??')[0] : lastPart;
60
+ }
61
+ } else if (realSource.includes('??')) realSource = realSource.split('??')[0];
43
62
  if ((realSource?.startsWith('webpack://') || realSource?.startsWith('file://')) && sourceMapFilenameRegex) realSource = getRealSourcePath(realSource, sourceMapFilenameRegex);
44
63
  if (!realSource) continue;
45
64
  if (skipSources && skipSources.has(realSource)) continue;
@@ -1,5 +1,5 @@
1
1
  import type { Plugin } from '@rsdoctor/types';
2
- import { InternalBasePlugin } from './base';
2
+ import { InternalBasePlugin } from './base.js';
3
3
  export declare class InternalSummaryPlugin<T extends Plugin.BaseCompiler> extends InternalBasePlugin<T> {
4
4
  readonly name = "summary";
5
5
  private times;
@@ -99,9 +99,10 @@ function isValidMode(mode) {
99
99
  ].includes(mode);
100
100
  }
101
101
  function normalizeUserConfig(config = {}) {
102
- const { linter = {}, features = {}, loaderInterceptorOptions = {}, disableClientServer = false, sdkInstance, innerClientPath = '', output = getDefaultOutput(), supports = getDefaultSupports(), port, printLog = {
102
+ const { linter = {}, features = {}, loaderInterceptorOptions = {}, disableClientServer: userDisableClientServer = false, sdkInstance, innerClientPath = '', output = getDefaultOutput(), supports = getDefaultSupports(), port, printLog = {
103
103
  serverUrls: true
104
104
  }, mode, brief } = config;
105
+ const disableClientServer = 'true' === process.env.RSTEST ? false : process.env.CI ? true : userDisableClientServer;
105
106
  external_assert_default()('object' == typeof linter);
106
107
  external_assert_default()('object' == typeof features || Array.isArray(features));
107
108
  external_assert_default()('object' == typeof loaderInterceptorOptions);
@@ -1,4 +1,4 @@
1
- import { RsdoctorRspackPluginOptions, RsdoctorRspackPluginOptionsNormalized } from '../../types';
1
+ import { RsdoctorRspackPluginOptions, RsdoctorRspackPluginOptionsNormalized } from '../../types/index.js';
2
2
  import { Linter, Plugin, SDK } from '@rsdoctor/types';
3
3
  export declare function normalizeUserConfig<Rules extends Linter.ExtendRuleData[]>(config?: Plugin.RsdoctorWebpackPluginOptions<Rules>): Plugin.RsdoctorPluginOptionsNormalized<Rules>;
4
4
  export declare const normalizeReportType: (reportCodeType: Plugin.IReportCodeType | Plugin.NewReportCodeType, mode: keyof typeof SDK.IMode) => SDK.ToDataType;
@@ -61,9 +61,10 @@ function isValidMode(mode) {
61
61
  ].includes(mode);
62
62
  }
63
63
  function normalizeUserConfig(config = {}) {
64
- const { linter = {}, features = {}, loaderInterceptorOptions = {}, disableClientServer = false, sdkInstance, innerClientPath = '', output = getDefaultOutput(), supports = getDefaultSupports(), port, printLog = {
64
+ const { linter = {}, features = {}, loaderInterceptorOptions = {}, disableClientServer: userDisableClientServer = false, sdkInstance, innerClientPath = '', output = getDefaultOutput(), supports = getDefaultSupports(), port, printLog = {
65
65
  serverUrls: true
66
66
  }, mode, brief } = config;
67
+ const disableClientServer = 'true' === process.env.RSTEST ? false : process.env.CI ? true : userDisableClientServer;
67
68
  assert('object' == typeof linter);
68
69
  assert('object' == typeof features || Array.isArray(features));
69
70
  assert('object' == typeof loaderInterceptorOptions);
@@ -1,9 +1,9 @@
1
- export * from './loader';
2
- export * from './plugin';
3
- export * from './sdk';
4
- export * from './config';
5
- export * from './circleDetect';
6
- export * from './plugin-common';
7
- export * from './normalize-config';
8
- export * from './plugin-common';
9
- export * from './normalize-config';
1
+ export * from './loader.js';
2
+ export * from './plugin.js';
3
+ export * from './sdk.js';
4
+ export * from './config.js';
5
+ export * from './circleDetect.js';
6
+ export * from './plugin-common.js';
7
+ export * from './normalize-config.js';
8
+ export * from './plugin-common.js';
9
+ export * from './normalize-config.js';
@@ -34,11 +34,11 @@ var __webpack_exports__ = {};
34
34
  __webpack_require__.r(__webpack_exports__);
35
35
  __webpack_require__.d(__webpack_exports__, {
36
36
  interceptLoader: ()=>interceptLoader,
37
- reportLoader: ()=>reportLoader,
37
+ getLoaderOptionsWithoutInternalKeys: ()=>getLoaderOptionsWithoutInternalKeys,
38
38
  shouldSkipLoader: ()=>shouldSkipLoader,
39
- getOriginLoaderModule: ()=>getOriginLoaderModule,
39
+ reportLoader: ()=>reportLoader,
40
40
  getInternalLoaderOptions: ()=>getInternalLoaderOptions,
41
- getLoaderOptionsWithoutInternalKeys: ()=>getLoaderOptionsWithoutInternalKeys
41
+ getOriginLoaderModule: ()=>getOriginLoaderModule
42
42
  });
43
43
  const index_js_namespaceObject = require("../../../compiled/axios/index.js");
44
44
  var index_js_default = /*#__PURE__*/ __webpack_require__.n(index_js_namespaceObject);
@@ -1,7 +1,7 @@
1
1
  import { Loader } from '@rsdoctor/utils/common';
2
2
  import { SDK, Plugin } from '@rsdoctor/types';
3
- import { ProxyLoaderInternalOptions, ProxyLoaderOptions } from '../../types';
4
- import { Utils as BuildUtils } from '../../build-utils/build';
3
+ import { ProxyLoaderInternalOptions, ProxyLoaderOptions } from '../../types/index.js';
4
+ import { Utils as BuildUtils } from '../../build-utils/build/index.js';
5
5
  export declare function getInternalLoaderOptions(loaderContext: Plugin.LoaderContext<ProxyLoaderOptions>): ProxyLoaderInternalOptions;
6
6
  export declare function getLoaderOptionsWithoutInternalKeys(loaderContext: Plugin.LoaderContext<ProxyLoaderOptions>): Omit<ProxyLoaderOptions, typeof Loader.LoaderInternalPropertyName>;
7
7
  export declare function getOriginLoaderModule(loaderContext: Plugin.LoaderContext<ProxyLoaderOptions>): ReturnType<typeof BuildUtils.loadLoaderModule>;
@@ -24,8 +24,8 @@ var __webpack_require__ = {};
24
24
  var __webpack_exports__ = {};
25
25
  __webpack_require__.r(__webpack_exports__);
26
26
  __webpack_require__.d(__webpack_exports__, {
27
- reportPluginData: ()=>reportPluginData,
28
- interceptPluginHook: ()=>interceptPluginHook
27
+ interceptPluginHook: ()=>interceptPluginHook,
28
+ reportPluginData: ()=>reportPluginData
29
29
  });
30
30
  const error_namespaceObject = require("@rsdoctor/utils/error");
31
31
  function reportPluginData(sdk, hook, tapName, start, type, _res, err) {
@@ -1,4 +1,4 @@
1
1
  import type { SDK } from '@rsdoctor/types';
2
- import { IHook } from '../../build-utils/build/utils';
2
+ import { IHook } from '../../build-utils/build/utils/index.js';
3
3
  export declare function reportPluginData(sdk: SDK.RsdoctorBuilderSDKInstance, hook: string, tapName: string, start: number, type: SDK.PluginHookData['type'], _res: unknown, err?: Error): void;
4
4
  export declare function interceptPluginHook(sdk: SDK.RsdoctorBuilderSDKInstance, name: string, hook: IHook): void;
@@ -1,3 +1,3 @@
1
- export * from './linter';
2
- export * from './rule';
3
- export { rules } from './rules';
1
+ export * from './linter.js';
2
+ export * from './rule.js';
3
+ export { rules } from './rules/index.js';
@@ -1,5 +1,5 @@
1
1
  import { Linter, SDK, Rule as RuleTypes } from '@rsdoctor/types';
2
- import { LinterType } from './linter';
2
+ import { LinterType } from './linter.js';
3
3
  type DefaultRuleConfig = Linter.DefaultRuleConfig;
4
4
  export declare class Rule<Config = DefaultRuleConfig> implements Linter.RuleMeta<Config> {
5
5
  static from<C>(data: Linter.ExtendRuleData<C>): Rule<C>;
@@ -1,4 +1,4 @@
1
1
  import { Linter } from '@rsdoctor/types';
2
- import { Config } from './types';
3
- export type { Config } from './types';
2
+ import { Config } from './types.js';
3
+ export type { Config } from './types.js';
4
4
  export declare const rule: Linter.RuleData<Config, "cross-chunks-package">;
@@ -1,4 +1,4 @@
1
1
  import { Linter } from '@rsdoctor/types';
2
- import type { Config } from './types';
3
- export type { Config } from './types';
2
+ import type { Config } from './types.js';
3
+ export type { Config } from './types.js';
4
4
  export declare const rule: Linter.RuleData<Config, "default-import-check">;
@@ -24,11 +24,11 @@ var __webpack_require__ = {};
24
24
  var __webpack_exports__ = {};
25
25
  __webpack_require__.r(__webpack_exports__);
26
26
  __webpack_require__.d(__webpack_exports__, {
27
- importDeclarationToString: ()=>importDeclarationToString,
28
- getSourceRangeFromTransformedOffset: ()=>getSourceRangeFromTransformedOffset,
29
27
  hasSameLeftInAssignStatement: ()=>hasSameLeftInAssignStatement,
30
- getFixData: ()=>getFixData,
31
- getDefaultImportByRequest: ()=>getDefaultImportByRequest
28
+ getSourceRangeFromTransformedOffset: ()=>getSourceRangeFromTransformedOffset,
29
+ getDefaultImportByRequest: ()=>getDefaultImportByRequest,
30
+ importDeclarationToString: ()=>importDeclarationToString,
31
+ getFixData: ()=>getFixData
32
32
  });
33
33
  const ruleUtils_namespaceObject = require("@rsdoctor/utils/ruleUtils");
34
34
  const common_namespaceObject = require("@rsdoctor/utils/common");
@@ -1,4 +1,4 @@
1
1
  import { Linter } from '@rsdoctor/types';
2
- import { Config } from './types';
3
- export type { Config, CheckVersion } from './types';
2
+ import { Config } from './types.js';
3
+ export type { Config, CheckVersion } from './types.js';
4
4
  export declare const rule: Linter.RuleData<Config, "duplicate-package">;
@@ -1,4 +1,4 @@
1
- import { Config } from './types';
1
+ import { Config } from './types.js';
2
2
  import { Linter } from '@rsdoctor/types';
3
- export type { Config } from './types';
3
+ export type { Config } from './types.js';
4
4
  export declare const rule: Linter.RuleData<Config, "ecma-version-check">;
@@ -1 +1 @@
1
- export declare const rules: (import("@rsdoctor/types/dist/linter").RuleData<import("./duplicate-package").Config, "duplicate-package"> | import("@rsdoctor/types/dist/linter").RuleData<import("./default-import-check").Config, "default-import-check"> | import("@rsdoctor/types/dist/linter").RuleData<import("./loader-performance-optimization").Config, "loader-performance-optimization"> | import("@rsdoctor/types/dist/linter").RuleData<import("./ecma-version-check").Config, "ecma-version-check"> | import("@rsdoctor/types/dist/linter").RuleData<import("./cross-chunks-package").Config, "cross-chunks-package">)[];
1
+ export declare const rules: (import("@rsdoctor/types/dist/linter").RuleData<import("./duplicate-package/index.js").Config, "duplicate-package"> | import("@rsdoctor/types/dist/linter").RuleData<import("./default-import-check/index.js").Config, "default-import-check"> | import("@rsdoctor/types/dist/linter").RuleData<import("./loader-performance-optimization/index.js").Config, "loader-performance-optimization"> | import("@rsdoctor/types/dist/linter").RuleData<import("./ecma-version-check/index.js").Config, "ecma-version-check"> | import("@rsdoctor/types/dist/linter").RuleData<import("./cross-chunks-package/index.js").Config, "cross-chunks-package">)[];
@@ -1,4 +1,4 @@
1
1
  import { Linter } from '@rsdoctor/types';
2
- import { Config } from './types';
3
- export type { Config } from './types';
2
+ import { Config } from './types.js';
3
+ export type { Config } from './types.js';
4
4
  export declare const rule: Linter.RuleData<Config, "loader-performance-optimization">;
@@ -1,4 +1,4 @@
1
- export * from './chunks';
2
- export * from './rules';
3
- export * from './loader';
4
- export * from './plugin';
1
+ export * from './chunks.js';
2
+ export * from './rules.js';
3
+ export * from './loader.js';
4
+ export * from './plugin.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsdoctor/core",
3
- "version": "1.3.7",
3
+ "version": "1.3.9",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/web-infra-dev/rsdoctor",
@@ -69,14 +69,14 @@
69
69
  "fs-extra": "^11.1.1",
70
70
  "semver": "^7.7.3",
71
71
  "source-map": "^0.7.6",
72
- "@rsdoctor/graph": "1.3.7",
73
- "@rsdoctor/sdk": "1.3.7",
74
- "@rsdoctor/types": "1.3.7",
75
- "@rsdoctor/utils": "1.3.7"
72
+ "@rsdoctor/graph": "1.3.9",
73
+ "@rsdoctor/sdk": "1.3.9",
74
+ "@rsdoctor/types": "1.3.9",
75
+ "@rsdoctor/utils": "1.3.9"
76
76
  },
77
77
  "devDependencies": {
78
78
  "axios": "^1.12.2",
79
- "@rspack/core": "1.5.8",
79
+ "@rspack/core": "1.6.1",
80
80
  "@types/fs-extra": "^11.0.4",
81
81
  "@types/node": "^22.8.1",
82
82
  "@types/node-fetch": "^2.6.13",