@rsdoctor/core 1.1.3 → 1.1.5

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.
@@ -1,5 +1,4 @@
1
1
  export * from './assetsModules';
2
2
  export * from './chunkTransform';
3
- export * from './generateTileGraph';
4
3
  export * from './rspack/transform';
5
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/build-utils/build/chunks/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/build-utils/build/chunks/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC"}
@@ -17,12 +17,10 @@ var chunks_exports = {};
17
17
  module.exports = __toCommonJS(chunks_exports);
18
18
  __reExport(chunks_exports, require("./assetsModules"), module.exports);
19
19
  __reExport(chunks_exports, require("./chunkTransform"), module.exports);
20
- __reExport(chunks_exports, require("./generateTileGraph"), module.exports);
21
20
  __reExport(chunks_exports, require("./rspack/transform"), module.exports);
22
21
  // Annotate the CommonJS export names for ESM import in node:
23
22
  0 && (module.exports = {
24
23
  ...require("./assetsModules"),
25
24
  ...require("./chunkTransform"),
26
- ...require("./generateTileGraph"),
27
25
  ...require("./rspack/transform")
28
26
  });
@@ -51,7 +51,7 @@ const parseBundle = (bundlePath, modulesData) => {
51
51
  const tagMatchResult = getStringBetween(
52
52
  content,
53
53
  0,
54
- /([a-z|A-Z|_]+\.[a-z]+)\(\SRSDOCTOR_START::(.*?);/,
54
+ /([a-z|A-Z|_]+\.[a-z]+)\(\SRSDOCTOR_START::(.*?)[;,]/,
55
55
  /([a-z|A-Z|_]+\.[a-z]+)\(\SRSDOCTOR_END::(.*?)\)/
56
56
  );
57
57
  content = tagMatchResult.result?.trim() || content;
@@ -1 +1 @@
1
- {"version":3,"file":"transform.d.ts","sourceRoot":"","sources":["../../../../src/build-utils/common/module-graph/transform.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAE9C,OAAO,EAAE,WAAW,EAAqB,MAAM,iBAAiB,CAAC;AAqCjE,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,MAAM,CAAC,WAAW,EAAE,EAC7B,gBAAgB,EAAE,MAAM,CAAC,WAAW,EAAE,QAKvC;AAaD;;GAEG;AACH,wBAAgB,qBAAqB,CACnC,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,MAAM,CAAC,gBAAgB,EAC5C,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,GAAG,CAAC,kBAAkB,eA0MnC"}
1
+ {"version":3,"file":"transform.d.ts","sourceRoot":"","sources":["../../../../src/build-utils/common/module-graph/transform.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAE9C,OAAO,EAAE,WAAW,EAAqB,MAAM,iBAAiB,CAAC;AAqCjE,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,MAAM,CAAC,WAAW,EAAE,EAC7B,gBAAgB,EAAE,MAAM,CAAC,WAAW,EAAE,QAKvC;AAaD;;GAEG;AACH,wBAAgB,qBAAqB,CACnC,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,MAAM,CAAC,gBAAgB,EAC5C,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,GAAG,CAAC,kBAAkB,eAsNnC"}
@@ -95,6 +95,11 @@ function getModuleGraphByStats({ modules, chunks }, root, chunkGraph) {
95
95
  data.id ? String(data.id) : void 0,
96
96
  data.layer
97
97
  );
98
+ if (data.optimizationBailout) {
99
+ data.optimizationBailout.forEach(
100
+ (reason) => concatenatedModule.addBailoutReason(reason)
101
+ );
102
+ }
98
103
  if (data.issuerPath) {
99
104
  concatenatedModule.addIssuerPath(data.issuerPath);
100
105
  }
@@ -134,6 +139,11 @@ function getModuleGraphByStats({ modules, chunks }, root, chunkGraph) {
134
139
  normal.layer
135
140
  );
136
141
  }
142
+ if (normal.optimizationBailout) {
143
+ normal.optimizationBailout.forEach(
144
+ (reason) => normalModule.addBailoutReason(reason)
145
+ );
146
+ }
137
147
  if (normal.issuerPath) {
138
148
  normalModule.addIssuerPath(normal.issuerPath);
139
149
  }
@@ -1 +1 @@
1
- {"version":3,"file":"bundleTagPlugin.d.ts","sourceRoot":"","sources":["../../../src/inner-plugins/plugins/bundleTagPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAEzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AAG5C,qBAAa,uBAAuB,CAClC,CAAC,SAAS,MAAM,CAAC,YAAY,CAC7B,SAAQ,kBAAkB,CAAC,CAAC,CAAC;IAC7B,SAAgB,IAAI,eAAe;IAE5B,KAAK,CAAC,QAAQ,EAAE,MAAM,CAAC,YAAY;CAoF3C"}
1
+ {"version":3,"file":"bundleTagPlugin.d.ts","sourceRoot":"","sources":["../../../src/inner-plugins/plugins/bundleTagPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAEzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AAG5C,qBAAa,uBAAuB,CAClC,CAAC,SAAS,MAAM,CAAC,YAAY,CAC7B,SAAQ,kBAAkB,CAAC,CAAC,CAAC;IAC7B,SAAgB,IAAI,eAAe;IAE5B,KAAK,CAAC,QAAQ,EAAE,MAAM,CAAC,YAAY;CAqF3C"}
@@ -77,6 +77,7 @@ class InternalBundleTagPlugin extends import_base.InternalBasePlugin {
77
77
  const { ConcatSource } = compiler.webpack.sources;
78
78
  compilation.updateAsset(
79
79
  file,
80
+ // @ts-ignore - webpack/rspack type compatibility issue
80
81
  (old) => {
81
82
  const concatSource = new ConcatSource();
82
83
  let header = "\n console.log('RSDOCTOR_START::');\n";
@@ -1 +1 @@
1
- {"version":3,"file":"ensureModulesChunkGraph.d.ts","sourceRoot":"","sources":["../../../src/inner-plugins/plugins/ensureModulesChunkGraph.ts"],"names":[],"mappings":"AACA,OAAO,EACL,sBAAsB,EAEvB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,MAAM,EAAE,MAAM,EAA4B,MAAM,iBAAiB,CAAC;AAY3E;;;;;GAKG;AACH,eAAO,MAAM,0BAA0B,aAC3B,MAAM,CAAC,YAAY,SACtB,sBAAsB,CAAC,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,cAAc,EAAE,CAAC,SA4H5E,CAAC"}
1
+ {"version":3,"file":"ensureModulesChunkGraph.d.ts","sourceRoot":"","sources":["../../../src/inner-plugins/plugins/ensureModulesChunkGraph.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EAEvB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,MAAM,EAAE,MAAM,EAAiB,MAAM,iBAAiB,CAAC;AAWhE;;;;;GAKG;AACH,eAAO,MAAM,0BAA0B,aAC3B,MAAM,CAAC,YAAY,SACtB,sBAAsB,CAAC,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,cAAc,EAAE,CAAC,SA+G5E,CAAC"}
@@ -1,9 +1,7 @@
1
1
  "use strict";
2
- var __create = Object.create;
3
2
  var __defProp = Object.defineProperty;
4
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
6
  var __export = (target, all) => {
9
7
  for (var name in all)
@@ -17,25 +15,15 @@ var __copyProps = (to, from, except, desc) => {
17
15
  }
18
16
  return to;
19
17
  };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
19
  var ensureModulesChunkGraph_exports = {};
30
20
  __export(ensureModulesChunkGraph_exports, {
31
21
  ensureModulesChunksGraphFn: () => ensureModulesChunksGraphFn
32
22
  });
33
23
  module.exports = __toCommonJS(ensureModulesChunkGraph_exports);
34
- var import_path = __toESM(require("path"));
35
24
  var import_types2 = require("@rsdoctor/types");
36
25
  var import_build = require("@rsdoctor/utils/build");
37
26
  var import_logger = require("@rsdoctor/utils/logger");
38
- var import_fs_extra = __toESM(require("fs-extra"));
39
27
  var import_build2 = require("../../build-utils/build");
40
28
  var import_common = require("../../build-utils/common");
41
29
  var import_constants = require("../constants");
@@ -119,20 +107,10 @@ const ensureModulesChunksGraphFn = (compiler, _this) => {
119
107
  _this.modulesGraph && await _this.sdk.reportModuleGraph(_this.modulesGraph);
120
108
  await _this.sdk.reportChunkGraph(_this.chunkGraph);
121
109
  if (_this.options.supports.generateTileGraph) {
122
- const reportFilePath = await import_build2.Chunks.generateTileGraph(
123
- getStatsJson(),
124
- {
125
- reportFilename: import_path.default.join(
126
- import_types2.Constants.RsdoctorOutputFolder,
127
- import_build2.Chunks.TileGraphReportName
128
- ),
129
- reportTitle: "bundle-analyzer",
130
- reportDir: _this.options.output.reportDir
131
- },
132
- compiler.outputPath
133
- );
134
- reportFilePath && await _this.sdk.reportTileHtml(
135
- import_fs_extra.default.readFileSync(reportFilePath, "utf-8")
110
+ import_logger.logger.warn(
111
+ import_logger.chalk.yellow(
112
+ "The option generateTileGraph is deprecated. Tile graph is now supported by default."
113
+ )
136
114
  );
137
115
  }
138
116
  }
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/inner-plugins/utils/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAE9D,OAAO,KAAK,EACV,gBAAgB,IAAI,sBAAsB,EAC1C,WAAW,IAAI,iBAAiB,EACjC,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,gBAAgB,IAAI,uBAAuB,EAC3C,wBAAwB,IAAI,+BAA+B,EAC3D,WAAW,IAAI,kBAAkB,EAClC,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,4BAA4B,EAC5B,+BAA+B,EAC/B,eAAe,EACf,2BAA2B,EAC3B,qCAAqC,EACtC,MAAM,SAAS,CAAC;AAOjB,wBAAgB,mBAAmB,CAAC,KAAK,SAAS,MAAM,CAAC,cAAc,EAAE,EACvE,MAAM,GAAE,4BAA4B,CAAC,KAAK,CAAM,GAC/C,+BAA+B,CAAC,KAAK,CAAC,CAyHxC;AAED,wBAAgB,uBAAuB,CACrC,IAAI,EACA,sBAAsB,GACtB,+BAA+B,GAC/B,uBAAuB,GACvB,IAAI,QAcT;AAED,wBAAgB,qBAAqB,CACnC,KAAK,EACD,MAAM,CAAC,WAAW,EAAE,GACpB,iBAAiB,CAAC,OAAO,CAAC,GAC1B,kBAAkB,CAAC,OAAO,CAAC,QA+BhC;AAED,eAAO,MAAM,mBAAmB,mBACd,eAAe,QACzB,MAAM,OAAO,GAAG,CAAC,KAAK,KAC3B,GAAG,CAAC,UA2BN,CAAC;AAEF,wBAAgB,0BAA0B,CACxC,KAAK,SAAS,MAAM,CAAC,cAAc,EAAE,EAErC,OAAO,EAAE,2BAA2B,CAAC,KAAK,CAAC,GAC1C,qCAAqC,CAAC,KAAK,CAAC,CAO9C"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/inner-plugins/utils/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAE9D,OAAO,KAAK,EACV,gBAAgB,IAAI,sBAAsB,EAC1C,WAAW,IAAI,iBAAiB,EACjC,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,gBAAgB,IAAI,uBAAuB,EAC3C,wBAAwB,IAAI,+BAA+B,EAC3D,WAAW,IAAI,kBAAkB,EAClC,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,4BAA4B,EAC5B,+BAA+B,EAC/B,eAAe,EACf,2BAA2B,EAC3B,qCAAqC,EACtC,MAAM,SAAS,CAAC;AA2DjB,wBAAgB,mBAAmB,CAAC,KAAK,SAAS,MAAM,CAAC,cAAc,EAAE,EACvE,MAAM,GAAE,4BAA4B,CAAC,KAAK,CAAM,GAC/C,+BAA+B,CAAC,KAAK,CAAC,CA2ExC;AAED,wBAAgB,uBAAuB,CACrC,IAAI,EACA,sBAAsB,GACtB,+BAA+B,GAC/B,uBAAuB,GACvB,IAAI,QAcT;AAED,wBAAgB,qBAAqB,CACnC,KAAK,EACD,MAAM,CAAC,WAAW,EAAE,GACpB,iBAAiB,CAAC,OAAO,CAAC,GAC1B,kBAAkB,CAAC,OAAO,CAAC,QA+BhC;AAED,eAAO,MAAM,mBAAmB,mBACd,eAAe,QACzB,MAAM,OAAO,GAAG,CAAC,KAAK,KAC3B,GAAG,CAAC,UAqBN,CAAC;AAEF,wBAAgB,0BAA0B,CACxC,KAAK,SAAS,MAAM,CAAC,cAAc,EAAE,EAErC,OAAO,EAAE,2BAA2B,CAAC,KAAK,CAAC,GAC1C,qCAAqC,CAAC,KAAK,CAAC,CAO9C"}
@@ -41,6 +41,52 @@ var import_logger = require("@rsdoctor/utils/logger");
41
41
  function defaultBoolean(v, dft) {
42
42
  return typeof v === "boolean" ? v : dft;
43
43
  }
44
+ function getDefaultOutput() {
45
+ return {
46
+ reportCodeType: {
47
+ noModuleSource: false,
48
+ noAssetsAndModuleSource: false,
49
+ noCode: false
50
+ },
51
+ reportDir: "",
52
+ compressData: true
53
+ };
54
+ }
55
+ function getDefaultSupports() {
56
+ return {
57
+ parseBundle: true,
58
+ banner: void 0,
59
+ gzip: false
60
+ };
61
+ }
62
+ function normalizeFeatures(features, mode) {
63
+ if (Array.isArray(features)) {
64
+ return {
65
+ loader: features.includes("loader"),
66
+ plugins: features.includes("plugins"),
67
+ resolver: features.includes("resolver"),
68
+ bundle: features.includes("bundle"),
69
+ treeShaking: features.includes("treeShaking"),
70
+ lite: features.includes("lite") || mode === import_types.SDK.IMode[import_types.SDK.IMode.lite]
71
+ };
72
+ }
73
+ return {
74
+ loader: defaultBoolean(features.loader, true),
75
+ plugins: defaultBoolean(features.plugins, true),
76
+ resolver: defaultBoolean(features.resolver, false),
77
+ bundle: defaultBoolean(features.bundle, true),
78
+ treeShaking: defaultBoolean(features.treeShaking, false),
79
+ lite: defaultBoolean(features.lite, false) || mode === import_types.SDK.IMode[import_types.SDK.IMode.lite]
80
+ };
81
+ }
82
+ function normalizeLinter(linter) {
83
+ return {
84
+ rules: {},
85
+ extends: [],
86
+ level: "Error",
87
+ ...linter
88
+ };
89
+ }
44
90
  function normalizeUserConfig(config = {}) {
45
91
  const {
46
92
  linter = {},
@@ -49,21 +95,8 @@ function normalizeUserConfig(config = {}) {
49
95
  disableClientServer = false,
50
96
  sdkInstance,
51
97
  innerClientPath = "",
52
- output = {
53
- reportCodeType: {
54
- noModuleSource: false,
55
- noAssetsAndModuleSource: false,
56
- noCode: false
57
- },
58
- reportDir: "",
59
- compressData: true
60
- },
61
- supports = {
62
- parseBundle: true,
63
- banner: void 0,
64
- generateTileGraph: true,
65
- gzip: false
66
- },
98
+ output = getDefaultOutput(),
99
+ supports = getDefaultSupports(),
67
100
  port,
68
101
  printLog = { serverUrls: true },
69
102
  mode = "normal",
@@ -73,35 +106,17 @@ function normalizeUserConfig(config = {}) {
73
106
  writeDataJson: false
74
107
  }
75
108
  } = config;
76
- (0, import_assert.default)(linter && typeof linter === "object");
77
- (0, import_assert.default)(features && typeof features === "object");
78
- (0, import_assert.default)(
79
- loaderInterceptorOptions && typeof loaderInterceptorOptions === "object"
80
- );
109
+ (0, import_assert.default)(typeof linter === "object");
110
+ (0, import_assert.default)(typeof features === "object" || Array.isArray(features));
111
+ (0, import_assert.default)(typeof loaderInterceptorOptions === "object");
81
112
  (0, import_assert.default)(typeof disableClientServer === "boolean");
82
- const _features = Array.isArray(
83
- features
84
- ) ? {
85
- loader: features.includes("loader"),
86
- plugins: features.includes("plugins"),
87
- resolver: features.includes("resolver"),
88
- bundle: features.includes("bundle"),
89
- treeShaking: features.includes("treeShaking"),
90
- lite: features.includes("lite") || mode === import_types.SDK.IMode[import_types.SDK.IMode.lite]
91
- } : {
92
- loader: defaultBoolean(features.loader, true),
93
- plugins: defaultBoolean(features.plugins, true),
94
- resolver: defaultBoolean(features.resolver, false),
95
- bundle: defaultBoolean(features.bundle, true),
96
- treeShaking: defaultBoolean(features.treeShaking, false),
97
- lite: defaultBoolean(features.lite, false) || mode === import_types.SDK.IMode[import_types.SDK.IMode.lite]
98
- };
99
- const _linter = {
100
- rules: {},
101
- extends: [],
102
- level: "Error",
103
- ...linter
104
- };
113
+ const _features = normalizeFeatures(features, mode);
114
+ const _linter = normalizeLinter(linter);
115
+ let _mode = mode;
116
+ if (_features.lite && _mode !== import_types.SDK.IMode[import_types.SDK.IMode.brief]) {
117
+ _mode = import_types.SDK.IMode[import_types.SDK.IMode.lite];
118
+ }
119
+ const reportCodeType = output.reportCodeType ? normalizeReportType(output.reportCodeType, _mode) : normalizeReportType(getDefaultOutput().reportCodeType, _mode);
105
120
  const res = {
106
121
  linter: _linter,
107
122
  features: _features,
@@ -111,21 +126,7 @@ function normalizeUserConfig(config = {}) {
111
126
  disableClientServer,
112
127
  sdkInstance,
113
128
  output: {
114
- /**
115
- * Data storage is divided into three types:
116
- * The first type: normal mode, all codes are saved.
117
- * The second type: lite is the same as reportCodeType.noModuleSource, which lacks module source code.
118
- * The third type: reportCodeType.noAssetsAndModuleSource means there is no module source code nor the packaged product code.
119
- *
120
- * */
121
- reportCodeType: output.reportCodeType ? normalizeReportType(output.reportCodeType, mode) : normalizeReportType(
122
- {
123
- noModuleSource: false,
124
- noAssetsAndModuleSource: false,
125
- noCode: false
126
- },
127
- mode
128
- ),
129
+ reportCodeType,
129
130
  reportDir: output.reportDir || "",
130
131
  compressData: output.compressData !== void 0 ? output.compressData : true
131
132
  },
@@ -136,7 +137,7 @@ function normalizeUserConfig(config = {}) {
136
137
  mode,
137
138
  brief
138
139
  };
139
- if (output.compressData === false && (output.reportCodeType && !output.reportCodeType?.noAssetsAndModuleSource || !output.reportCodeType)) {
140
+ if (res.output.compressData === false && (!output.reportCodeType || !output.reportCodeType.noAssetsAndModuleSource)) {
140
141
  import_logger.logger.info(
141
142
  import_logger.chalk.yellow(
142
143
  `[RSDOCTOR]: When you use compressData: false, it is recommended to set output.reportCodeType to { noAssetsAndModuleSource: true }.`
@@ -186,31 +187,22 @@ function makeRulesSerializable(rules) {
186
187
  });
187
188
  }
188
189
  const normalizeReportType = (reportCodeType, mode) => {
189
- let globalReportCodeType = import_types.SDK.ToDataType.Normal;
190
- switch (mode) {
191
- case import_types.SDK.IMode[import_types.SDK.IMode.brief]:
192
- globalReportCodeType = import_types.SDK.ToDataType.NoCode;
193
- break;
194
- case import_types.SDK.IMode[import_types.SDK.IMode.lite]:
195
- if (reportCodeType.noAssetsAndModuleSource) {
196
- globalReportCodeType = import_types.SDK.ToDataType.NoSourceAndAssets;
197
- } else {
198
- globalReportCodeType = import_types.SDK.ToDataType.NoSource;
199
- }
200
- break;
201
- default: {
202
- if (reportCodeType.noCode) {
203
- globalReportCodeType = import_types.SDK.ToDataType.NoCode;
204
- } else if (reportCodeType.noAssetsAndModuleSource) {
205
- globalReportCodeType = import_types.SDK.ToDataType.NoSourceAndAssets;
206
- } else if (reportCodeType.noModuleSource) {
207
- globalReportCodeType = import_types.SDK.ToDataType.NoSource;
208
- } else {
209
- globalReportCodeType = import_types.SDK.ToDataType.Normal;
210
- }
211
- }
190
+ if (mode === import_types.SDK.IMode[import_types.SDK.IMode.brief]) {
191
+ return import_types.SDK.ToDataType.NoCode;
192
+ }
193
+ if (mode === import_types.SDK.IMode[import_types.SDK.IMode.lite]) {
194
+ return reportCodeType.noAssetsAndModuleSource ? import_types.SDK.ToDataType.NoSourceAndAssets : import_types.SDK.ToDataType.NoSource;
195
+ }
196
+ if (reportCodeType.noCode) {
197
+ return import_types.SDK.ToDataType.NoCode;
198
+ }
199
+ if (reportCodeType.noAssetsAndModuleSource) {
200
+ return import_types.SDK.ToDataType.NoSourceAndAssets;
201
+ }
202
+ if (reportCodeType.noModuleSource) {
203
+ return import_types.SDK.ToDataType.NoSource;
212
204
  }
213
- return globalReportCodeType;
205
+ return import_types.SDK.ToDataType.Normal;
214
206
  };
215
207
  function normalizeRspackUserOptions(options) {
216
208
  const config = normalizeUserConfig(options);
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/rules/rules/duplicate-package/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAQ,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAAE,MAAM,EAAmB,MAAM,SAAS,CAAC;AAIlD,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAIpD,eAAO,MAAM,IAAI,8CAqDd,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/rules/rules/duplicate-package/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAQ,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAAE,MAAM,EAAmB,MAAM,SAAS,CAAC;AAIlD,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAIpD,eAAO,MAAM,IAAI,8CAwDd,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsdoctor/core",
3
- "version": "1.1.3",
3
+ "version": "1.1.5",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/web-infra-dev/rsdoctor",
@@ -63,29 +63,29 @@
63
63
  },
64
64
  "dependencies": {
65
65
  "@rsbuild/plugin-check-syntax": "1.3.0",
66
- "axios": "^1.9.0",
66
+ "axios": "^1.10.0",
67
67
  "browserslist-load-config": "^1.0.0",
68
68
  "enhanced-resolve": "5.12.0",
69
69
  "filesize": "^10.1.6",
70
70
  "fs-extra": "^11.1.1",
71
71
  "lodash": "^4.17.21",
72
72
  "path-browserify": "1.0.1",
73
- "semver": "^7.6.3",
73
+ "semver": "^7.7.2",
74
74
  "source-map": "^0.7.4",
75
75
  "webpack-bundle-analyzer": "^4.10.2",
76
- "@rsdoctor/graph": "1.1.3",
77
- "@rsdoctor/types": "1.1.3",
78
- "@rsdoctor/utils": "1.1.3",
79
- "@rsdoctor/sdk": "1.1.3"
76
+ "@rsdoctor/graph": "1.1.5",
77
+ "@rsdoctor/sdk": "1.1.5",
78
+ "@rsdoctor/utils": "1.1.5",
79
+ "@rsdoctor/types": "1.1.5"
80
80
  },
81
81
  "devDependencies": {
82
- "@rspack/core": "1.3.11",
82
+ "@rspack/core": "1.4.0-beta.1",
83
83
  "@types/fs-extra": "^11.0.4",
84
- "@types/lodash": "^4.17.17",
84
+ "@types/lodash": "^4.17.18",
85
85
  "@types/node": "^22.8.1",
86
86
  "@types/node-fetch": "^2.6.12",
87
87
  "@types/path-browserify": "1.0.3",
88
- "@types/semver": "^7.5.8",
88
+ "@types/semver": "^7.7.0",
89
89
  "@types/tapable": "2.2.7",
90
90
  "babel-loader": "10.0.0",
91
91
  "string-loader": "0.0.1",
@@ -1,12 +0,0 @@
1
- import { Plugin } from '@rsdoctor/types';
2
- export declare const TileGraphReportName = "rsdoctor-tile-graph.html";
3
- type IGenerateReportOpts = {
4
- reportFilename: string;
5
- reportTitle?: string;
6
- bundleDir?: string;
7
- openBrowser?: boolean;
8
- reportDir?: string;
9
- };
10
- export declare function generateTileGraph(bundleStats: Plugin.BaseStats, opts: IGenerateReportOpts, buildOutputPath: string): Promise<string | null>;
11
- export {};
12
- //# sourceMappingURL=generateTileGraph.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"generateTileGraph.d.ts","sourceRoot":"","sources":["../../../../src/build-utils/build/chunks/generateTileGraph.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAKzC,eAAO,MAAM,mBAAmB,6BAA6B,CAAC;AAE9D,KAAK,mBAAmB,GAAG;IACzB,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAiBF,wBAAsB,iBAAiB,CACrC,WAAW,EAAE,MAAM,CAAC,SAAS,EAC7B,IAAI,EAAE,mBAAmB,EACzB,eAAe,EAAE,MAAM,0BAuBxB"}
@@ -1,77 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var generateTileGraph_exports = {};
30
- __export(generateTileGraph_exports, {
31
- TileGraphReportName: () => TileGraphReportName,
32
- generateTileGraph: () => generateTileGraph
33
- });
34
- module.exports = __toCommonJS(generateTileGraph_exports);
35
- var import_path = __toESM(require("path"));
36
- var import_logger = require("@rsdoctor/utils/logger");
37
- var import_viewer = require("webpack-bundle-analyzer/lib/viewer");
38
- const TileGraphReportName = "rsdoctor-tile-graph.html";
39
- async function generateJSONReportUtil(bundleStats, opts) {
40
- await (0, import_viewer.generateReport)(bundleStats, {
41
- ...opts,
42
- logger: {
43
- warn: () => {
44
- },
45
- info: () => {
46
- },
47
- error: (e) => {
48
- import_logger.logger.info(`webpack-bundle-analyzer generateReport has error ${e}`);
49
- }
50
- }
51
- });
52
- }
53
- async function generateTileGraph(bundleStats, opts, buildOutputPath) {
54
- try {
55
- const { reportFilename, reportDir } = opts;
56
- await generateJSONReportUtil(bundleStats, {
57
- ...opts,
58
- openBrowser: false,
59
- bundleDir: reportDir || buildOutputPath
60
- });
61
- return import_path.default.join(
62
- reportDir ? import_path.default.resolve(
63
- buildOutputPath,
64
- import_path.default.relative(buildOutputPath, reportDir)
65
- ) : buildOutputPath,
66
- `${reportFilename}`
67
- );
68
- } catch (e) {
69
- (0, import_logger.debug)(() => `Generate webpack-bundle-analyzer tile graph has error:${e}`);
70
- return null;
71
- }
72
- }
73
- // Annotate the CommonJS export names for ESM import in node:
74
- 0 && (module.exports = {
75
- TileGraphReportName,
76
- generateTileGraph
77
- });