@rsdoctor/core 1.1.3 → 1.1.4

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.
@@ -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":"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,QAc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BAAkB,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,53 @@ 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
+ generateTileGraph: true,
60
+ gzip: false
61
+ };
62
+ }
63
+ function normalizeFeatures(features, mode) {
64
+ if (Array.isArray(features)) {
65
+ return {
66
+ loader: features.includes("loader"),
67
+ plugins: features.includes("plugins"),
68
+ resolver: features.includes("resolver"),
69
+ bundle: features.includes("bundle"),
70
+ treeShaking: features.includes("treeShaking"),
71
+ lite: features.includes("lite") || mode === import_types.SDK.IMode[import_types.SDK.IMode.lite]
72
+ };
73
+ }
74
+ return {
75
+ loader: defaultBoolean(features.loader, true),
76
+ plugins: defaultBoolean(features.plugins, true),
77
+ resolver: defaultBoolean(features.resolver, false),
78
+ bundle: defaultBoolean(features.bundle, true),
79
+ treeShaking: defaultBoolean(features.treeShaking, false),
80
+ lite: defaultBoolean(features.lite, false) || mode === import_types.SDK.IMode[import_types.SDK.IMode.lite]
81
+ };
82
+ }
83
+ function normalizeLinter(linter) {
84
+ return {
85
+ rules: {},
86
+ extends: [],
87
+ level: "Error",
88
+ ...linter
89
+ };
90
+ }
44
91
  function normalizeUserConfig(config = {}) {
45
92
  const {
46
93
  linter = {},
@@ -49,21 +96,8 @@ function normalizeUserConfig(config = {}) {
49
96
  disableClientServer = false,
50
97
  sdkInstance,
51
98
  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
- },
99
+ output = getDefaultOutput(),
100
+ supports = getDefaultSupports(),
67
101
  port,
68
102
  printLog = { serverUrls: true },
69
103
  mode = "normal",
@@ -73,35 +107,17 @@ function normalizeUserConfig(config = {}) {
73
107
  writeDataJson: false
74
108
  }
75
109
  } = 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
- );
110
+ (0, import_assert.default)(typeof linter === "object");
111
+ (0, import_assert.default)(typeof features === "object" || Array.isArray(features));
112
+ (0, import_assert.default)(typeof loaderInterceptorOptions === "object");
81
113
  (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
- };
114
+ const _features = normalizeFeatures(features, mode);
115
+ const _linter = normalizeLinter(linter);
116
+ let _mode = mode;
117
+ if (_features.lite && _mode !== import_types.SDK.IMode[import_types.SDK.IMode.brief]) {
118
+ _mode = import_types.SDK.IMode[import_types.SDK.IMode.lite];
119
+ }
120
+ const reportCodeType = output.reportCodeType ? normalizeReportType(output.reportCodeType, _mode) : normalizeReportType(getDefaultOutput().reportCodeType, _mode);
105
121
  const res = {
106
122
  linter: _linter,
107
123
  features: _features,
@@ -111,21 +127,7 @@ function normalizeUserConfig(config = {}) {
111
127
  disableClientServer,
112
128
  sdkInstance,
113
129
  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
- ),
130
+ reportCodeType,
129
131
  reportDir: output.reportDir || "",
130
132
  compressData: output.compressData !== void 0 ? output.compressData : true
131
133
  },
@@ -136,7 +138,7 @@ function normalizeUserConfig(config = {}) {
136
138
  mode,
137
139
  brief
138
140
  };
139
- if (output.compressData === false && (output.reportCodeType && !output.reportCodeType?.noAssetsAndModuleSource || !output.reportCodeType)) {
141
+ if (res.output.compressData === false && (!output.reportCodeType || !output.reportCodeType.noAssetsAndModuleSource)) {
140
142
  import_logger.logger.info(
141
143
  import_logger.chalk.yellow(
142
144
  `[RSDOCTOR]: When you use compressData: false, it is recommended to set output.reportCodeType to { noAssetsAndModuleSource: true }.`
@@ -186,31 +188,22 @@ function makeRulesSerializable(rules) {
186
188
  });
187
189
  }
188
190
  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
- }
191
+ if (mode === import_types.SDK.IMode[import_types.SDK.IMode.brief]) {
192
+ return import_types.SDK.ToDataType.NoCode;
193
+ }
194
+ if (mode === import_types.SDK.IMode[import_types.SDK.IMode.lite]) {
195
+ return reportCodeType.noAssetsAndModuleSource ? import_types.SDK.ToDataType.NoSourceAndAssets : import_types.SDK.ToDataType.NoSource;
196
+ }
197
+ if (reportCodeType.noCode) {
198
+ return import_types.SDK.ToDataType.NoCode;
199
+ }
200
+ if (reportCodeType.noAssetsAndModuleSource) {
201
+ return import_types.SDK.ToDataType.NoSourceAndAssets;
202
+ }
203
+ if (reportCodeType.noModuleSource) {
204
+ return import_types.SDK.ToDataType.NoSource;
212
205
  }
213
- return globalReportCodeType;
206
+ return import_types.SDK.ToDataType.Normal;
214
207
  };
215
208
  function normalizeRspackUserOptions(options) {
216
209
  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.4",
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.4",
77
+ "@rsdoctor/sdk": "1.1.4",
78
+ "@rsdoctor/types": "1.1.4",
79
+ "@rsdoctor/utils": "1.1.4"
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
84
  "@types/lodash": "^4.17.17",
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",