@rsdoctor/core 1.3.4 → 1.3.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.
- package/dist/build-utils/build/loader/probeLoader.cjs +3 -4
- package/dist/build-utils/build/loader/probeLoader.js +3 -4
- package/dist/build-utils/build/module-graph/treeShaking.cjs +1 -2
- package/dist/build-utils/build/module-graph/treeShaking.js +1 -2
- package/dist/build-utils/build/module-graph/utils.cjs +5 -7
- package/dist/build-utils/build/module-graph/utils.js +5 -7
- package/dist/build-utils/build/module-graph/webpack/transform.cjs +7 -9
- package/dist/build-utils/build/module-graph/webpack/transform.js +7 -9
- package/dist/build-utils/build/utils/loader.cjs +10 -11
- package/dist/build-utils/build/utils/loader.js +10 -11
- package/dist/build-utils/build/utils/parseBundle.cjs +10 -15
- package/dist/build-utils/build/utils/parseBundle.js +10 -15
- package/dist/build-utils/build/utils/plugin.cjs +2 -2
- package/dist/build-utils/build/utils/plugin.js +2 -2
- package/dist/inner-plugins/plugins/bundle.cjs +1 -4
- package/dist/inner-plugins/plugins/bundle.js +1 -4
- package/dist/inner-plugins/plugins/bundleTagPlugin.cjs +6 -15
- package/dist/inner-plugins/plugins/bundleTagPlugin.js +6 -15
- package/dist/inner-plugins/plugins/ensureModulesChunkGraph.cjs +3 -6
- package/dist/inner-plugins/plugins/ensureModulesChunkGraph.js +3 -6
- package/dist/inner-plugins/plugins/loader.cjs +1 -1
- package/dist/inner-plugins/plugins/loader.js +1 -1
- package/dist/inner-plugins/plugins/sourcemapTool.cjs +10 -17
- package/dist/inner-plugins/plugins/sourcemapTool.js +10 -17
- package/dist/inner-plugins/utils/config.cjs +1 -2
- package/dist/inner-plugins/utils/config.js +1 -2
- package/dist/inner-plugins/utils/loader.cjs +6 -8
- package/dist/inner-plugins/utils/loader.js +6 -8
- package/dist/inner-plugins/utils/normalize-config.cjs +7 -8
- package/dist/inner-plugins/utils/normalize-config.js +7 -8
- package/dist/inner-plugins/utils/plugin-common.cjs +4 -5
- package/dist/inner-plugins/utils/plugin-common.js +4 -5
- package/dist/inner-plugins/utils/plugin.cjs +2 -3
- package/dist/inner-plugins/utils/plugin.js +2 -3
- package/dist/rules/rules/default-import-check/index.cjs +1 -1
- package/dist/rules/rules/default-import-check/index.js +1 -1
- package/dist/rules/rules/default-import-check/utils.cjs +1 -2
- package/dist/rules/rules/default-import-check/utils.js +1 -2
- package/dist/rules/rules/ecma-version-check/index.cjs +3 -4
- package/dist/rules/rules/ecma-version-check/index.js +3 -4
- package/dist/rules/rules/ecma-version-check/utils.cjs +1 -1
- package/dist/rules/rules/ecma-version-check/utils.js +1 -1
- package/dist/rules/rules/loader-performance-optimization/index.cjs +1 -1
- package/dist/rules/rules/loader-performance-optimization/index.js +1 -1
- package/package.json +7 -7
|
@@ -53,7 +53,7 @@ function reportPluginData(sdk, hook, tapName, start, type, _res, err) {
|
|
|
53
53
|
});
|
|
54
54
|
}
|
|
55
55
|
function interceptPluginHook(sdk, name, hook) {
|
|
56
|
-
if (!
|
|
56
|
+
if (!hook?.intercept) return;
|
|
57
57
|
hook.intercept({
|
|
58
58
|
register (tap) {
|
|
59
59
|
const o = tap.fn;
|
|
@@ -80,9 +80,8 @@ function interceptPluginHook(sdk, name, hook) {
|
|
|
80
80
|
}
|
|
81
81
|
};
|
|
82
82
|
else if ('promise' === tap.type) tap.fn = function() {
|
|
83
|
-
var _arguments__compiler, _arguments_, _arguments;
|
|
84
83
|
const start = Date.now();
|
|
85
|
-
const isChild =
|
|
84
|
+
const isChild = arguments?.[0]?.compiler?.isChild();
|
|
86
85
|
return o.apply(this, arguments).then((res)=>{
|
|
87
86
|
if (isChild) return res;
|
|
88
87
|
reportPluginData(sdk, name, tap.name, start, tap.type, res);
|
|
@@ -26,7 +26,7 @@ function reportPluginData(sdk, hook, tapName, start, type, _res, err) {
|
|
|
26
26
|
});
|
|
27
27
|
}
|
|
28
28
|
function interceptPluginHook(sdk, name, hook) {
|
|
29
|
-
if (!
|
|
29
|
+
if (!hook?.intercept) return;
|
|
30
30
|
hook.intercept({
|
|
31
31
|
register (tap) {
|
|
32
32
|
const o = tap.fn;
|
|
@@ -53,9 +53,8 @@ function interceptPluginHook(sdk, name, hook) {
|
|
|
53
53
|
}
|
|
54
54
|
};
|
|
55
55
|
else if ('promise' === tap.type) tap.fn = function() {
|
|
56
|
-
var _arguments__compiler, _arguments_, _arguments;
|
|
57
56
|
const start = Date.now();
|
|
58
|
-
const isChild =
|
|
57
|
+
const isChild = arguments?.[0]?.compiler?.isChild();
|
|
59
58
|
return o.apply(this, arguments).then((res)=>{
|
|
60
59
|
if (isChild) return res;
|
|
61
60
|
reportPluginData(sdk, name, tap.name, start, tap.type, res);
|
|
@@ -59,7 +59,7 @@ const rule = (0, external_rule_cjs_namespaceObject.defineRule)(()=>{
|
|
|
59
59
|
dependency,
|
|
60
60
|
node
|
|
61
61
|
} : {};
|
|
62
|
-
}).filter((dep)=>
|
|
62
|
+
}).filter((dep)=>dep?.dependency);
|
|
63
63
|
for (const { dependency, node } of dependencyWithNode){
|
|
64
64
|
if (!dependency) continue;
|
|
65
65
|
const document = (0, external_utils_cjs_namespaceObject.getSourceRangeFromTransformedOffset)(dependency.module, node);
|
|
@@ -33,7 +33,7 @@ const rule = defineRule(()=>{
|
|
|
33
33
|
dependency,
|
|
34
34
|
node
|
|
35
35
|
} : {};
|
|
36
|
-
}).filter((dep)=>
|
|
36
|
+
}).filter((dep)=>dep?.dependency);
|
|
37
37
|
for (const { dependency, node } of dependencyWithNode){
|
|
38
38
|
if (!dependency) continue;
|
|
39
39
|
const document = getSourceRangeFromTransformedOffset(dependency.module, node);
|
|
@@ -56,7 +56,6 @@ function getFixData(module, node, originalRange) {
|
|
|
56
56
|
};
|
|
57
57
|
}
|
|
58
58
|
function getSourceRangeFromTransformedOffset(module, node) {
|
|
59
|
-
var _sourceRange_end, _sourceRange_end1;
|
|
60
59
|
const source = module.getSource();
|
|
61
60
|
const sourceMap = module.getSourceMap();
|
|
62
61
|
const transformedStart = node.loc.start;
|
|
@@ -73,7 +72,7 @@ function getSourceRangeFromTransformedOffset(module, node) {
|
|
|
73
72
|
};
|
|
74
73
|
if (!sourceMap) return transformedReport;
|
|
75
74
|
const sourceRange = module.getSourceRange(node.loc);
|
|
76
|
-
if (common_namespaceObject.Lodash.isUndefined(
|
|
75
|
+
if (common_namespaceObject.Lodash.isUndefined(sourceRange?.start.line) || common_namespaceObject.Lodash.isUndefined(sourceRange?.start.column) || common_namespaceObject.Lodash.isUndefined(sourceRange?.end?.line) || common_namespaceObject.Lodash.isUndefined(sourceRange?.end?.column)) return transformedReport;
|
|
77
76
|
return {
|
|
78
77
|
path: module.path,
|
|
79
78
|
isTransformed: false,
|
|
@@ -26,7 +26,6 @@ function getFixData(module, node, originalRange) {
|
|
|
26
26
|
};
|
|
27
27
|
}
|
|
28
28
|
function getSourceRangeFromTransformedOffset(module, node) {
|
|
29
|
-
var _sourceRange_end, _sourceRange_end1;
|
|
30
29
|
const source = module.getSource();
|
|
31
30
|
const sourceMap = module.getSourceMap();
|
|
32
31
|
const transformedStart = node.loc.start;
|
|
@@ -43,7 +42,7 @@ function getSourceRangeFromTransformedOffset(module, node) {
|
|
|
43
42
|
};
|
|
44
43
|
if (!sourceMap) return transformedReport;
|
|
45
44
|
const sourceRange = module.getSourceRange(node.loc);
|
|
46
|
-
if (Lodash.isUndefined(
|
|
45
|
+
if (Lodash.isUndefined(sourceRange?.start.line) || Lodash.isUndefined(sourceRange?.start.column) || Lodash.isUndefined(sourceRange?.end?.line) || Lodash.isUndefined(sourceRange?.end?.column)) return transformedReport;
|
|
47
46
|
return {
|
|
48
47
|
path: module.path,
|
|
49
48
|
isTransformed: false,
|
|
@@ -55,7 +55,6 @@ const rule = (0, external_rule_cjs_namespaceObject.defineRule)(()=>({
|
|
|
55
55
|
},
|
|
56
56
|
async check ({ chunkGraph, report, ruleConfig, root, configs }) {
|
|
57
57
|
for (const asset of chunkGraph.getAssets()){
|
|
58
|
-
var _configs_, _buildConfig_output;
|
|
59
58
|
if ('.js' !== external_path_default().extname(asset.path)) continue;
|
|
60
59
|
const browserslistConfig = (0, external_browserslist_load_config_namespaceObject.loadConfig)({
|
|
61
60
|
path: root,
|
|
@@ -64,8 +63,8 @@ const rule = (0, external_rule_cjs_namespaceObject.defineRule)(()=>({
|
|
|
64
63
|
const { exclude, excludeOutput, targets, ecmaVersion } = ruleConfig;
|
|
65
64
|
const finalTargets = targets || browserslistConfig || [];
|
|
66
65
|
if (!finalTargets.length && !ecmaVersion) return;
|
|
67
|
-
const buildConfig =
|
|
68
|
-
const context =
|
|
66
|
+
const buildConfig = configs[0]?.config;
|
|
67
|
+
const context = buildConfig?.context || root;
|
|
69
68
|
const checkSyntax = new plugin_check_syntax_namespaceObject.CheckSyntax({
|
|
70
69
|
exclude,
|
|
71
70
|
excludeOutput,
|
|
@@ -73,7 +72,7 @@ const rule = (0, external_rule_cjs_namespaceObject.defineRule)(()=>({
|
|
|
73
72
|
rootPath: context,
|
|
74
73
|
targets: finalTargets
|
|
75
74
|
});
|
|
76
|
-
const outputDir =
|
|
75
|
+
const outputDir = buildConfig?.output?.path || external_path_default().resolve(root, 'dist');
|
|
77
76
|
const assetPath = external_path_default().resolve(outputDir, asset.path);
|
|
78
77
|
await checkSyntax.check(assetPath, asset.content);
|
|
79
78
|
checkSyntax.errors.forEach((err)=>{
|
|
@@ -19,7 +19,6 @@ const rule = defineRule(()=>({
|
|
|
19
19
|
},
|
|
20
20
|
async check ({ chunkGraph, report, ruleConfig, root, configs }) {
|
|
21
21
|
for (const asset of chunkGraph.getAssets()){
|
|
22
|
-
var _configs_, _buildConfig_output;
|
|
23
22
|
if ('.js' !== path.extname(asset.path)) continue;
|
|
24
23
|
const browserslistConfig = loadConfig({
|
|
25
24
|
path: root,
|
|
@@ -28,8 +27,8 @@ const rule = defineRule(()=>({
|
|
|
28
27
|
const { exclude, excludeOutput, targets, ecmaVersion } = ruleConfig;
|
|
29
28
|
const finalTargets = targets || browserslistConfig || [];
|
|
30
29
|
if (!finalTargets.length && !ecmaVersion) return;
|
|
31
|
-
const buildConfig =
|
|
32
|
-
const context =
|
|
30
|
+
const buildConfig = configs[0]?.config;
|
|
31
|
+
const context = buildConfig?.context || root;
|
|
33
32
|
const checkSyntax = new CheckSyntax({
|
|
34
33
|
exclude,
|
|
35
34
|
excludeOutput,
|
|
@@ -37,7 +36,7 @@ const rule = defineRule(()=>({
|
|
|
37
36
|
rootPath: context,
|
|
38
37
|
targets: finalTargets
|
|
39
38
|
});
|
|
40
|
-
const outputDir =
|
|
39
|
+
const outputDir = buildConfig?.output?.path || path.resolve(root, 'dist');
|
|
41
40
|
const assetPath = path.resolve(outputDir, asset.path);
|
|
42
41
|
await checkSyntax.check(assetPath, asset.content);
|
|
43
42
|
checkSyntax.errors.forEach((err)=>{
|
|
@@ -28,7 +28,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
28
28
|
});
|
|
29
29
|
function getVersionNumber(ECMAString) {
|
|
30
30
|
const version = ECMAString.match(/\d/);
|
|
31
|
-
return
|
|
31
|
+
return version?.length ? Number(version[0]) : void 0;
|
|
32
32
|
}
|
|
33
33
|
exports.getVersionNumber = __webpack_exports__.getVersionNumber;
|
|
34
34
|
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
@@ -2,6 +2,6 @@ import 'module';
|
|
|
2
2
|
/*#__PURE__*/ import.meta.url;
|
|
3
3
|
function getVersionNumber(ECMAString) {
|
|
4
4
|
const version = ECMAString.match(/\d/);
|
|
5
|
-
return
|
|
5
|
+
return version?.length ? Number(version[0]) : void 0;
|
|
6
6
|
}
|
|
7
7
|
export { getVersionNumber };
|
|
@@ -54,7 +54,7 @@ const rule = (0, external_rule_cjs_namespaceObject.defineRule)(()=>({
|
|
|
54
54
|
},
|
|
55
55
|
check ({ loader, configs, root, ruleConfig, report }) {
|
|
56
56
|
const { extensions, ignore = [], threshold = 5000 } = ruleConfig;
|
|
57
|
-
if (!extensions ||
|
|
57
|
+
if (!extensions || extensions?.length === 0) return;
|
|
58
58
|
if (0 === loader.length) return;
|
|
59
59
|
const { config } = configs.find((e)=>'webpack' === e.name) || {
|
|
60
60
|
config: void 0
|
|
@@ -28,7 +28,7 @@ const rule = defineRule(()=>({
|
|
|
28
28
|
},
|
|
29
29
|
check ({ loader, configs, root, ruleConfig, report }) {
|
|
30
30
|
const { extensions, ignore = [], threshold = 5000 } = ruleConfig;
|
|
31
|
-
if (!extensions ||
|
|
31
|
+
if (!extensions || extensions?.length === 0) return;
|
|
32
32
|
if (0 === loader.length) return;
|
|
33
33
|
const { config } = configs.find((e)=>'webpack' === e.name) || {
|
|
34
34
|
config: void 0
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsdoctor/core",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.5",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/web-infra-dev/rsdoctor",
|
|
@@ -62,16 +62,17 @@
|
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
64
|
"browserslist-load-config": "^1.0.1",
|
|
65
|
-
"@rsbuild/plugin-check-syntax": "1.
|
|
65
|
+
"@rsbuild/plugin-check-syntax": "1.5.0",
|
|
66
66
|
"enhanced-resolve": "5.12.0",
|
|
67
|
+
"es-toolkit": "^1.41.0",
|
|
67
68
|
"filesize": "^10.1.6",
|
|
68
69
|
"fs-extra": "^11.1.1",
|
|
69
70
|
"semver": "^7.7.3",
|
|
70
71
|
"source-map": "^0.7.6",
|
|
71
|
-
"@rsdoctor/
|
|
72
|
-
"@rsdoctor/
|
|
73
|
-
"@rsdoctor/types": "1.3.
|
|
74
|
-
"@rsdoctor/utils": "1.3.
|
|
72
|
+
"@rsdoctor/sdk": "1.3.5",
|
|
73
|
+
"@rsdoctor/graph": "1.3.5",
|
|
74
|
+
"@rsdoctor/types": "1.3.5",
|
|
75
|
+
"@rsdoctor/utils": "1.3.5"
|
|
75
76
|
},
|
|
76
77
|
"devDependencies": {
|
|
77
78
|
"axios": "^1.12.2",
|
|
@@ -82,7 +83,6 @@
|
|
|
82
83
|
"@types/semver": "^7.7.1",
|
|
83
84
|
"@types/tapable": "2.2.7",
|
|
84
85
|
"babel-loader": "10.0.0",
|
|
85
|
-
"es-toolkit": "^1.40.0",
|
|
86
86
|
"prebundle": "1.4.2",
|
|
87
87
|
"string-loader": "0.0.1",
|
|
88
88
|
"ts-loader": "^9.5.4",
|