@rsdoctor/core 0.0.0-next-20240620044732
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/LICENSE +21 -0
- package/README.md +22 -0
- package/dist/build-utils/build/chunks/assetsModules.d.ts +4 -0
- package/dist/build-utils/build/chunks/assetsModules.d.ts.map +1 -0
- package/dist/build-utils/build/chunks/assetsModules.js +36 -0
- package/dist/build-utils/build/chunks/chunkTransform.d.ts +5 -0
- package/dist/build-utils/build/chunks/chunkTransform.d.ts.map +1 -0
- package/dist/build-utils/build/chunks/chunkTransform.js +31 -0
- package/dist/build-utils/build/chunks/generateTileGraph.d.ts +11 -0
- package/dist/build-utils/build/chunks/generateTileGraph.d.ts.map +1 -0
- package/dist/build-utils/build/chunks/generateTileGraph.js +71 -0
- package/dist/build-utils/build/chunks/index.d.ts +4 -0
- package/dist/build-utils/build/chunks/index.d.ts.map +1 -0
- package/dist/build-utils/build/chunks/index.js +26 -0
- package/dist/build-utils/build/index.d.ts +5 -0
- package/dist/build-utils/build/index.d.ts.map +1 -0
- package/dist/build-utils/build/index.js +47 -0
- package/dist/build-utils/build/module-graph/index.d.ts +4 -0
- package/dist/build-utils/build/module-graph/index.d.ts.map +1 -0
- package/dist/build-utils/build/module-graph/index.js +26 -0
- package/dist/build-utils/build/module-graph/parser.d.ts +3 -0
- package/dist/build-utils/build/module-graph/parser.d.ts.map +1 -0
- package/dist/build-utils/build/module-graph/parser.js +44 -0
- package/dist/build-utils/build/module-graph/transform.d.ts +5 -0
- package/dist/build-utils/build/module-graph/transform.d.ts.map +1 -0
- package/dist/build-utils/build/module-graph/transform.js +37 -0
- package/dist/build-utils/build/module-graph/treeShaking.d.ts +4 -0
- package/dist/build-utils/build/module-graph/treeShaking.d.ts.map +1 -0
- package/dist/build-utils/build/module-graph/treeShaking.js +132 -0
- package/dist/build-utils/build/module-graph/utils.d.ts +4 -0
- package/dist/build-utils/build/module-graph/utils.d.ts.map +1 -0
- package/dist/build-utils/build/module-graph/utils.js +113 -0
- package/dist/build-utils/build/module-graph/webpack/transform.d.ts +12 -0
- package/dist/build-utils/build/module-graph/webpack/transform.d.ts.map +1 -0
- package/dist/build-utils/build/module-graph/webpack/transform.js +195 -0
- package/dist/build-utils/build/utils/index.d.ts +4 -0
- package/dist/build-utils/build/utils/index.d.ts.map +1 -0
- package/dist/build-utils/build/utils/index.js +26 -0
- package/dist/build-utils/build/utils/loader.d.ts +19 -0
- package/dist/build-utils/build/utils/loader.d.ts.map +1 -0
- package/dist/build-utils/build/utils/loader.js +299 -0
- package/dist/build-utils/build/utils/parseBundle.d.ts +13 -0
- package/dist/build-utils/build/utils/parseBundle.d.ts.map +1 -0
- package/dist/build-utils/build/utils/parseBundle.js +367 -0
- package/dist/build-utils/build/utils/plugin.d.ts +6 -0
- package/dist/build-utils/build/utils/plugin.d.ts.map +1 -0
- package/dist/build-utils/build/utils/plugin.js +63 -0
- package/dist/build-utils/common/chunks/assetsContent.d.ts +5 -0
- package/dist/build-utils/common/chunks/assetsContent.d.ts.map +1 -0
- package/dist/build-utils/common/chunks/assetsContent.js +34 -0
- package/dist/build-utils/common/chunks/assetsModules.d.ts +24 -0
- package/dist/build-utils/common/chunks/assetsModules.d.ts.map +1 -0
- package/dist/build-utils/common/chunks/assetsModules.js +107 -0
- package/dist/build-utils/common/chunks/chunkTransform.d.ts +6 -0
- package/dist/build-utils/common/chunks/chunkTransform.d.ts.map +1 -0
- package/dist/build-utils/common/chunks/chunkTransform.js +73 -0
- package/dist/build-utils/common/chunks/index.d.ts +4 -0
- package/dist/build-utils/common/chunks/index.d.ts.map +1 -0
- package/dist/build-utils/common/chunks/index.js +26 -0
- package/dist/build-utils/common/index.d.ts +6 -0
- package/dist/build-utils/common/index.d.ts.map +1 -0
- package/dist/build-utils/common/index.js +50 -0
- package/dist/build-utils/common/module-graph/compatible.d.ts +10 -0
- package/dist/build-utils/common/module-graph/compatible.d.ts.map +1 -0
- package/dist/build-utils/common/module-graph/compatible.js +63 -0
- package/dist/build-utils/common/module-graph/index.d.ts +4 -0
- package/dist/build-utils/common/module-graph/index.d.ts.map +1 -0
- package/dist/build-utils/common/module-graph/index.js +26 -0
- package/dist/build-utils/common/module-graph/transform.d.ts +8 -0
- package/dist/build-utils/common/module-graph/transform.d.ts.map +1 -0
- package/dist/build-utils/common/module-graph/transform.js +200 -0
- package/dist/build-utils/common/module-graph/utils.d.ts +16 -0
- package/dist/build-utils/common/module-graph/utils.d.ts.map +1 -0
- package/dist/build-utils/common/module-graph/utils.js +62 -0
- package/dist/build-utils/common/trans-utils/index.d.ts +2 -0
- package/dist/build-utils/common/trans-utils/index.d.ts.map +1 -0
- package/dist/build-utils/common/trans-utils/index.js +22 -0
- package/dist/build-utils/common/trans-utils/transStats.d.ts +7 -0
- package/dist/build-utils/common/trans-utils/transStats.d.ts.map +1 -0
- package/dist/build-utils/common/trans-utils/transStats.js +35 -0
- package/dist/build-utils/common/webpack/compatible.d.ts +27 -0
- package/dist/build-utils/common/webpack/compatible.d.ts.map +1 -0
- package/dist/build-utils/common/webpack/compatible.js +181 -0
- package/dist/build-utils/index.d.ts +3 -0
- package/dist/build-utils/index.d.ts.map +1 -0
- package/dist/build-utils/index.js +41 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +43 -0
- package/dist/inner-plugins/constants.d.ts +7 -0
- package/dist/inner-plugins/constants.d.ts.map +1 -0
- package/dist/inner-plugins/constants.js +52 -0
- package/dist/inner-plugins/index.d.ts +3 -0
- package/dist/inner-plugins/index.d.ts.map +1 -0
- package/dist/inner-plugins/index.js +24 -0
- package/dist/inner-plugins/loaders/proxy.d.ts +5 -0
- package/dist/inner-plugins/loaders/proxy.d.ts.map +1 -0
- package/dist/inner-plugins/loaders/proxy.js +115 -0
- package/dist/inner-plugins/plugins/base.d.ts +14 -0
- package/dist/inner-plugins/plugins/base.d.ts.map +1 -0
- package/dist/inner-plugins/plugins/base.js +45 -0
- package/dist/inner-plugins/plugins/bundle.d.ts +15 -0
- package/dist/inner-plugins/plugins/bundle.d.ts.map +1 -0
- package/dist/inner-plugins/plugins/bundle.js +92 -0
- package/dist/inner-plugins/plugins/bundleTagPlugin.d.ts +7 -0
- package/dist/inner-plugins/plugins/bundleTagPlugin.d.ts.map +1 -0
- package/dist/inner-plugins/plugins/bundleTagPlugin.js +81 -0
- package/dist/inner-plugins/plugins/ensureModulesChunkGraph.d.ts +10 -0
- package/dist/inner-plugins/plugins/ensureModulesChunkGraph.d.ts.map +1 -0
- package/dist/inner-plugins/plugins/ensureModulesChunkGraph.js +126 -0
- package/dist/inner-plugins/plugins/errors.d.ts +12 -0
- package/dist/inner-plugins/plugins/errors.d.ts.map +1 -0
- package/dist/inner-plugins/plugins/errors.js +85 -0
- package/dist/inner-plugins/plugins/index.d.ts +11 -0
- package/dist/inner-plugins/plugins/index.d.ts.map +1 -0
- package/dist/inner-plugins/plugins/index.js +40 -0
- package/dist/inner-plugins/plugins/loader.d.ts +12 -0
- package/dist/inner-plugins/plugins/loader.d.ts.map +1 -0
- package/dist/inner-plugins/plugins/loader.js +161 -0
- package/dist/inner-plugins/plugins/plugins.d.ts +9 -0
- package/dist/inner-plugins/plugins/plugins.d.ts.map +1 -0
- package/dist/inner-plugins/plugins/plugins.js +60 -0
- package/dist/inner-plugins/plugins/progress.d.ts +9 -0
- package/dist/inner-plugins/plugins/progress.d.ts.map +1 -0
- package/dist/inner-plugins/plugins/progress.js +59 -0
- package/dist/inner-plugins/plugins/rules.d.ts +9 -0
- package/dist/inner-plugins/plugins/rules.d.ts.map +1 -0
- package/dist/inner-plugins/plugins/rules.js +85 -0
- package/dist/inner-plugins/plugins/summary.d.ts +15 -0
- package/dist/inner-plugins/plugins/summary.d.ts.map +1 -0
- package/dist/inner-plugins/plugins/summary.js +115 -0
- package/dist/inner-plugins/utils/circleDetect.d.ts +5 -0
- package/dist/inner-plugins/utils/circleDetect.d.ts.map +1 -0
- package/dist/inner-plugins/utils/circleDetect.js +42 -0
- package/dist/inner-plugins/utils/config.d.ts +8 -0
- package/dist/inner-plugins/utils/config.d.ts.map +1 -0
- package/dist/inner-plugins/utils/config.js +151 -0
- package/dist/inner-plugins/utils/index.d.ts +6 -0
- package/dist/inner-plugins/utils/index.d.ts.map +1 -0
- package/dist/inner-plugins/utils/index.js +30 -0
- package/dist/inner-plugins/utils/loader.d.ts +12 -0
- package/dist/inner-plugins/utils/loader.d.ts.map +1 -0
- package/dist/inner-plugins/utils/loader.js +201 -0
- package/dist/inner-plugins/utils/plugin.d.ts +6 -0
- package/dist/inner-plugins/utils/plugin.d.ts.map +1 -0
- package/dist/inner-plugins/utils/plugin.js +126 -0
- package/dist/inner-plugins/utils/sdk.d.ts +4 -0
- package/dist/inner-plugins/utils/sdk.d.ts.map +1 -0
- package/dist/inner-plugins/utils/sdk.js +43 -0
- package/dist/rules/index.d.ts +4 -0
- package/dist/rules/index.d.ts.map +1 -0
- package/dist/rules/index.js +33 -0
- package/dist/rules/linter.d.ts +10 -0
- package/dist/rules/linter.d.ts.map +1 -0
- package/dist/rules/linter.js +74 -0
- package/dist/rules/rule.d.ts +28 -0
- package/dist/rules/rule.d.ts.map +1 -0
- package/dist/rules/rule.js +143 -0
- package/dist/rules/rules/default-import-check/index.d.ts +5 -0
- package/dist/rules/rules/default-import-check/index.d.ts.map +1 -0
- package/dist/rules/rules/default-import-check/index.js +124 -0
- package/dist/rules/rules/default-import-check/types.d.ts +5 -0
- package/dist/rules/rules/default-import-check/types.d.ts.map +1 -0
- package/dist/rules/rules/default-import-check/types.js +16 -0
- package/dist/rules/rules/default-import-check/utils.d.ts +11 -0
- package/dist/rules/rules/default-import-check/utils.d.ts.map +1 -0
- package/dist/rules/rules/default-import-check/utils.js +93 -0
- package/dist/rules/rules/duplicate-package/index.d.ts +5 -0
- package/dist/rules/rules/duplicate-package/index.d.ts.map +1 -0
- package/dist/rules/rules/duplicate-package/index.js +71 -0
- package/dist/rules/rules/duplicate-package/types.d.ts +25 -0
- package/dist/rules/rules/duplicate-package/types.d.ts.map +1 -0
- package/dist/rules/rules/duplicate-package/types.js +51 -0
- package/dist/rules/rules/duplicate-package/utils.d.ts +4 -0
- package/dist/rules/rules/duplicate-package/utils.d.ts.map +1 -0
- package/dist/rules/rules/duplicate-package/utils.js +89 -0
- package/dist/rules/rules/ecma-version-check/index.d.ts +5 -0
- package/dist/rules/rules/ecma-version-check/index.d.ts.map +1 -0
- package/dist/rules/rules/ecma-version-check/index.js +82 -0
- package/dist/rules/rules/ecma-version-check/types.d.ts +8 -0
- package/dist/rules/rules/ecma-version-check/types.d.ts.map +1 -0
- package/dist/rules/rules/ecma-version-check/types.js +16 -0
- package/dist/rules/rules/ecma-version-check/utils.d.ts +3 -0
- package/dist/rules/rules/ecma-version-check/utils.d.ts.map +1 -0
- package/dist/rules/rules/ecma-version-check/utils.js +31 -0
- package/dist/rules/rules/index.d.ts +2 -0
- package/dist/rules/rules/index.d.ts.map +1 -0
- package/dist/rules/rules/index.js +37 -0
- package/dist/rules/rules/loader-performance-optimization/index.d.ts +5 -0
- package/dist/rules/rules/loader-performance-optimization/index.d.ts.map +1 -0
- package/dist/rules/rules/loader-performance-optimization/index.js +124 -0
- package/dist/rules/rules/loader-performance-optimization/types.d.ts +23 -0
- package/dist/rules/rules/loader-performance-optimization/types.d.ts.map +1 -0
- package/dist/rules/rules/loader-performance-optimization/types.js +16 -0
- package/dist/rules/rules/loader-performance-optimization/utils.d.ts +2 -0
- package/dist/rules/rules/loader-performance-optimization/utils.d.ts.map +1 -0
- package/dist/rules/rules/loader-performance-optimization/utils.js +38 -0
- package/dist/rules/utils.d.ts +4 -0
- package/dist/rules/utils.d.ts.map +1 -0
- package/dist/rules/utils.js +44 -0
- package/dist/types/chunks.d.ts +12 -0
- package/dist/types/chunks.d.ts.map +1 -0
- package/dist/types/chunks.js +16 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +30 -0
- package/dist/types/loader.d.ts +20 -0
- package/dist/types/loader.d.ts.map +1 -0
- package/dist/types/loader.js +16 -0
- package/dist/types/plugin.d.ts +96 -0
- package/dist/types/plugin.d.ts.map +1 -0
- package/dist/types/plugin.js +16 -0
- package/dist/types/rules.d.ts +8 -0
- package/dist/types/rules.d.ts.map +1 -0
- package/dist/types/rules.js +16 -0
- package/dist/types/webpack.d.ts +15 -0
- package/dist/types/webpack.d.ts.map +1 -0
- package/dist/types/webpack.js +16 -0
- package/package.json +112 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Plugin } from '@rsdoctor/types';
|
|
2
|
+
import { InternalBasePlugin } from './base';
|
|
3
|
+
export declare class InternalPluginsPlugin<T extends Plugin.BaseCompiler> extends InternalBasePlugin<T> {
|
|
4
|
+
readonly name = "plugins";
|
|
5
|
+
apply(compiler: T): void;
|
|
6
|
+
afterPlugins: (compiler: Plugin.BaseCompiler) => void;
|
|
7
|
+
compilation: (compilation: Plugin.BaseCompilation) => void;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=plugins.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugins.d.ts","sourceRoot":"","sources":["../../../src/inner-plugins/plugins/plugins.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAGnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AAE5C,qBAAa,qBAAqB,CAChC,CAAC,SAAS,MAAM,CAAC,YAAY,CAC7B,SAAQ,kBAAkB,CAAC,CAAC,CAAC;IAC7B,SAAgB,IAAI,aAAa;IAE1B,KAAK,CAAC,QAAQ,EAAE,CAAC;IAKjB,YAAY,aAAc,OAAO,YAAY,UAYlD;IAEK,WAAW,gBAAiB,OAAO,eAAe,KAAG,IAAI,CAO9D;CACH"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var plugins_exports = {};
|
|
20
|
+
__export(plugins_exports, {
|
|
21
|
+
InternalPluginsPlugin: () => InternalPluginsPlugin
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(plugins_exports);
|
|
24
|
+
var import_types = require("@rsdoctor/types");
|
|
25
|
+
var import_build = require("../../build-utils/build");
|
|
26
|
+
var import_utils = require("../utils");
|
|
27
|
+
var import_base = require("./base");
|
|
28
|
+
class InternalPluginsPlugin extends import_base.InternalBasePlugin {
|
|
29
|
+
constructor() {
|
|
30
|
+
super(...arguments);
|
|
31
|
+
this.name = "plugins";
|
|
32
|
+
this.afterPlugins = (compiler) => {
|
|
33
|
+
if (compiler.isChild())
|
|
34
|
+
return;
|
|
35
|
+
import_build.Utils.interceptCompilerHooks(
|
|
36
|
+
compiler,
|
|
37
|
+
(name, hook) => (0, import_utils.interceptPluginHook)(this.sdk, name, hook)
|
|
38
|
+
);
|
|
39
|
+
this.sdk.addClientRoutes([
|
|
40
|
+
import_types.Manifest.RsdoctorManifestClientRoutes.WebpackPlugins
|
|
41
|
+
]);
|
|
42
|
+
};
|
|
43
|
+
this.compilation = (compilation) => {
|
|
44
|
+
if (compilation.compiler.isChild())
|
|
45
|
+
return;
|
|
46
|
+
import_build.Utils.interceptCompilationHooks(
|
|
47
|
+
compilation,
|
|
48
|
+
(name, hook) => (0, import_utils.interceptPluginHook)(this.sdk, name, hook)
|
|
49
|
+
);
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
apply(compiler) {
|
|
53
|
+
compiler.hooks.afterPlugins.tap(this.tapPostOptions, this.afterPlugins);
|
|
54
|
+
compiler.hooks.compilation.tap(this.tapPostOptions, this.compilation);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
58
|
+
0 && (module.exports = {
|
|
59
|
+
InternalPluginsPlugin
|
|
60
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { SDK } from '@rsdoctor/types';
|
|
2
|
+
import type { Plugin } from '@rsdoctor/types';
|
|
3
|
+
import { InternalBasePlugin } from './base';
|
|
4
|
+
export declare class InternalProgressPlugin<T extends Plugin.BaseCompiler> extends InternalBasePlugin<T> {
|
|
5
|
+
readonly name = "progress";
|
|
6
|
+
protected currentProgress: SDK.ServerAPI.InferResponseType<SDK.ServerAPI.APIExtends.GetCompileProgess>;
|
|
7
|
+
apply(compiler: T): void;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=progress.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"progress.d.ts","sourceRoot":"","sources":["../../../src/inner-plugins/plugins/progress.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AACtC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AAE5C,qBAAa,sBAAsB,CACjC,CAAC,SAAS,MAAM,CAAC,YAAY,CAC7B,SAAQ,kBAAkB,CAAC,CAAC,CAAC;IAC7B,SAAgB,IAAI,cAAc;IAElC,SAAS,CAAC,eAAe,EAAE,GAAG,CAAC,SAAS,CAAC,iBAAiB,CAAC,GAAG,CAAC,SAAS,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAIlG;IAEG,KAAK,CAAC,QAAQ,EAAE,CAAC,GAAG,IAAI;CAqBhC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var progress_exports = {};
|
|
20
|
+
__export(progress_exports, {
|
|
21
|
+
InternalProgressPlugin: () => InternalProgressPlugin
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(progress_exports);
|
|
24
|
+
var import_types = require("@rsdoctor/types");
|
|
25
|
+
var import_base = require("./base");
|
|
26
|
+
class InternalProgressPlugin extends import_base.InternalBasePlugin {
|
|
27
|
+
constructor() {
|
|
28
|
+
super(...arguments);
|
|
29
|
+
this.name = "progress";
|
|
30
|
+
this.currentProgress = {
|
|
31
|
+
percentage: 100,
|
|
32
|
+
message: ""
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
apply(compiler) {
|
|
36
|
+
const { sdk, currentProgress } = this;
|
|
37
|
+
if (compiler.webpack && compiler.webpack.ProgressPlugin) {
|
|
38
|
+
const progress = new compiler.webpack.ProgressPlugin({
|
|
39
|
+
handler(percentage, msg) {
|
|
40
|
+
currentProgress.percentage = percentage;
|
|
41
|
+
currentProgress.message = msg || "";
|
|
42
|
+
const api = import_types.SDK.ServerAPI.APIExtends.GetCompileProgess;
|
|
43
|
+
sdk.server.sendAPIDataToClient(api, {
|
|
44
|
+
req: {
|
|
45
|
+
api,
|
|
46
|
+
body: void 0
|
|
47
|
+
},
|
|
48
|
+
res: currentProgress
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
progress.apply(compiler);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
57
|
+
0 && (module.exports = {
|
|
58
|
+
InternalProgressPlugin
|
|
59
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { InternalBasePlugin } from '../plugins';
|
|
2
|
+
import { Plugin } from '@rsdoctor/types';
|
|
3
|
+
export declare class InternalRulesPlugin extends InternalBasePlugin<Plugin.BaseCompiler> {
|
|
4
|
+
readonly name = "rules";
|
|
5
|
+
apply(compiler: Plugin.BaseCompiler): void;
|
|
6
|
+
done: (stats: Plugin.BaseStats) => Promise<void>;
|
|
7
|
+
protected lint(compilation: Plugin.BaseCompilation): Promise<void>;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=rules.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rules.d.ts","sourceRoot":"","sources":["../../../src/inner-plugins/plugins/rules.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAIhD,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAIzC,qBAAa,mBAAoB,SAAQ,kBAAkB,CAAC,MAAM,CAAC,YAAY,CAAC;IAC9E,SAAgB,IAAI,WAAW;IAExB,KAAK,CAAC,QAAQ,EAAE,MAAM,CAAC,YAAY;IAInC,IAAI,UAAiB,OAAO,SAAS,KAAG,QAAQ,IAAI,CAAC,CAE1D;cAEc,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC,eAAe;CAoDzD"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var rules_exports = {};
|
|
20
|
+
__export(rules_exports, {
|
|
21
|
+
InternalRulesPlugin: () => InternalRulesPlugin
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(rules_exports);
|
|
24
|
+
var import_plugins = require("../plugins");
|
|
25
|
+
var import_rules = require("../../rules");
|
|
26
|
+
var import_error = require("@rsdoctor/utils/error");
|
|
27
|
+
var import_lodash = require("lodash");
|
|
28
|
+
class InternalRulesPlugin extends import_plugins.InternalBasePlugin {
|
|
29
|
+
constructor() {
|
|
30
|
+
super(...arguments);
|
|
31
|
+
this.name = "rules";
|
|
32
|
+
this.done = async (stats) => {
|
|
33
|
+
await this.lint(stats.compilation);
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
apply(compiler) {
|
|
37
|
+
compiler.hooks.done.tapPromise(this.tapPreOptions, this.done);
|
|
38
|
+
}
|
|
39
|
+
async lint(compilation) {
|
|
40
|
+
const options = this.options ?? {};
|
|
41
|
+
const linter = new import_rules.Linter(options.linter);
|
|
42
|
+
const result = await linter.validate(this.sdk.getRuleContext({}));
|
|
43
|
+
const validateErrors = result.errors.map(
|
|
44
|
+
(err) => import_error.DevToolError.from(err, {
|
|
45
|
+
detail: err.detail,
|
|
46
|
+
controller: {
|
|
47
|
+
noColor: true
|
|
48
|
+
}
|
|
49
|
+
})
|
|
50
|
+
);
|
|
51
|
+
const errors = validateErrors.filter((item) => item.level === "Error");
|
|
52
|
+
const warnings = validateErrors.filter((item) => item.level === "Warn");
|
|
53
|
+
const toWebpackError = (err) => err.toError();
|
|
54
|
+
result.replace.forEach((item) => {
|
|
55
|
+
if ((0, import_lodash.isArray)(compilation.errors) && compilation.errors.includes(item)) {
|
|
56
|
+
(0, import_lodash.pull)(compilation.errors, item);
|
|
57
|
+
}
|
|
58
|
+
if ((0, import_lodash.isArray)(compilation.warnings) && compilation.warnings.includes(item)) {
|
|
59
|
+
(0, import_lodash.pull)(compilation.warnings, item);
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
if ((0, import_lodash.isArray)(compilation.errors)) {
|
|
63
|
+
errors.forEach((err) => {
|
|
64
|
+
compilation.warnings.push(toWebpackError(err));
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
if ((0, import_lodash.isArray)(compilation.warnings)) {
|
|
68
|
+
warnings.forEach((err) => {
|
|
69
|
+
compilation.warnings.push(toWebpackError(err));
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
this.sdk.reportError(validateErrors);
|
|
73
|
+
await linter.afterValidate({
|
|
74
|
+
data: this.sdk.getRuleContext({}),
|
|
75
|
+
validateResult: result,
|
|
76
|
+
hooks: {
|
|
77
|
+
afterSaveManifest: this.sdk.hooks.afterSaveManifest
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
83
|
+
0 && (module.exports = {
|
|
84
|
+
InternalRulesPlugin
|
|
85
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Plugin } from '@rsdoctor/types';
|
|
2
|
+
import { InternalBasePlugin } from './base';
|
|
3
|
+
export declare class InternalSummaryPlugin<T extends Plugin.BaseCompiler> extends InternalBasePlugin<T> {
|
|
4
|
+
readonly name = "summary";
|
|
5
|
+
private times;
|
|
6
|
+
private preTimes;
|
|
7
|
+
private postTimes;
|
|
8
|
+
apply(compiler: T): void;
|
|
9
|
+
private mark;
|
|
10
|
+
beforeCompile: () => Promise<void>;
|
|
11
|
+
afterCompile: (compilation: Plugin.BaseCompilation) => Promise<void>;
|
|
12
|
+
done: (compiler: T) => Promise<void>;
|
|
13
|
+
private report;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=summary.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"summary.d.ts","sourceRoot":"","sources":["../../../src/inner-plugins/plugins/summary.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AAE5C,qBAAa,qBAAqB,CAChC,CAAC,SAAS,MAAM,CAAC,YAAY,CAC7B,SAAQ,kBAAkB,CAAC,CAAC,CAAC;IAC7B,SAAgB,IAAI,aAAa;IAEjC,OAAO,CAAC,KAAK,CAAwD;IAErE,OAAO,CAAC,QAAQ,CAAwD;IAExE,OAAO,CAAC,SAAS,CAAwD;IAElE,KAAK,CAAC,QAAQ,EAAE,CAAC;IAiBxB,OAAO,CAAC,IAAI;IAeL,aAAa,QAAa,QAAQ,IAAI,CAAC,CAQ5C;IAEK,YAAY,gBACJ,OAAO,eAAe,KAClC,QAAQ,IAAI,CAAC,CAWd;IAEK,IAAI,aAAoB,CAAC,KAAG,QAAQ,IAAI,CAAC,CAuB9C;IAEF,OAAO,CAAC,MAAM;CAYf"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var summary_exports = {};
|
|
20
|
+
__export(summary_exports, {
|
|
21
|
+
InternalSummaryPlugin: () => InternalSummaryPlugin
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(summary_exports);
|
|
24
|
+
var import_common = require("@rsdoctor/utils/common");
|
|
25
|
+
var import_lodash = require("lodash");
|
|
26
|
+
var import_base = require("./base");
|
|
27
|
+
class InternalSummaryPlugin extends import_base.InternalBasePlugin {
|
|
28
|
+
constructor() {
|
|
29
|
+
super(...arguments);
|
|
30
|
+
this.name = "summary";
|
|
31
|
+
this.times = /* @__PURE__ */ new Map();
|
|
32
|
+
this.preTimes = /* @__PURE__ */ new Map();
|
|
33
|
+
this.postTimes = /* @__PURE__ */ new Map();
|
|
34
|
+
this.beforeCompile = async () => {
|
|
35
|
+
if (!this.times.has(import_common.Summary.SummaryCostsDataName.Bootstrap)) {
|
|
36
|
+
const costs = Math.floor(process.uptime() * 1e3);
|
|
37
|
+
const startAt = Date.now() - costs;
|
|
38
|
+
this.report(import_common.Summary.SummaryCostsDataName.Bootstrap, startAt);
|
|
39
|
+
this.mark(import_common.Summary.SummaryCostsDataName.Bootstrap, "post");
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
this.afterCompile = async (compilation) => {
|
|
43
|
+
if (!this.times.has(import_common.Summary.SummaryCostsDataName.Compile) && !compilation.compiler.isChild()) {
|
|
44
|
+
const start = this.postTimes.get(import_common.Summary.SummaryCostsDataName.Bootstrap);
|
|
45
|
+
this.report(import_common.Summary.SummaryCostsDataName.Compile, start);
|
|
46
|
+
this.mark(import_common.Summary.SummaryCostsDataName.Compile, "post");
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
this.done = async (compiler) => {
|
|
50
|
+
const start = this.postTimes.get(import_common.Summary.SummaryCostsDataName.Compile);
|
|
51
|
+
this.report(import_common.Summary.SummaryCostsDataName.Done, start);
|
|
52
|
+
if (compiler.options.optimization.minimize !== false) {
|
|
53
|
+
const pluginData = this.sdk.getStoreData().plugin;
|
|
54
|
+
const minifyHookData = [
|
|
55
|
+
...pluginData.optimizeChunkAssets || [],
|
|
56
|
+
// webpack4
|
|
57
|
+
...pluginData.processAssets || []
|
|
58
|
+
// webpack5
|
|
59
|
+
];
|
|
60
|
+
minifyHookData.length && this.sdk.reportSummaryData({
|
|
61
|
+
costs: [
|
|
62
|
+
{
|
|
63
|
+
name: import_common.Summary.SummaryCostsDataName.Minify,
|
|
64
|
+
startAt: (0, import_lodash.minBy)(minifyHookData, (e) => e.startAt).startAt,
|
|
65
|
+
costs: (0, import_lodash.sumBy)(minifyHookData, (e) => e.costs)
|
|
66
|
+
}
|
|
67
|
+
]
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
apply(compiler) {
|
|
73
|
+
compiler.hooks.beforeCompile.tapPromise(
|
|
74
|
+
this.tapPostOptions,
|
|
75
|
+
this.beforeCompile
|
|
76
|
+
);
|
|
77
|
+
compiler.hooks.afterCompile.tapPromise(
|
|
78
|
+
this.tapPreOptions,
|
|
79
|
+
this.afterCompile
|
|
80
|
+
);
|
|
81
|
+
compiler.hooks.done.tapPromise(
|
|
82
|
+
this.tapPostOptions,
|
|
83
|
+
this.done.bind(this, compiler)
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
mark(key, type) {
|
|
87
|
+
const now = Date.now();
|
|
88
|
+
switch (type) {
|
|
89
|
+
case "pre":
|
|
90
|
+
this.preTimes.set(key, now);
|
|
91
|
+
break;
|
|
92
|
+
case "post":
|
|
93
|
+
this.postTimes.set(key, now);
|
|
94
|
+
break;
|
|
95
|
+
default:
|
|
96
|
+
break;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
report(name, start) {
|
|
100
|
+
this.times.set(name, start);
|
|
101
|
+
this.sdk.reportSummaryData({
|
|
102
|
+
costs: [
|
|
103
|
+
{
|
|
104
|
+
name,
|
|
105
|
+
startAt: start,
|
|
106
|
+
costs: Date.now() - start
|
|
107
|
+
}
|
|
108
|
+
]
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
113
|
+
0 && (module.exports = {
|
|
114
|
+
InternalSummaryPlugin
|
|
115
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"circleDetect.d.ts","sourceRoot":"","sources":["../../../src/inner-plugins/utils/circleDetect.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe,QACrB,GAAG,UACA;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,OAAO,CAAA;CAAE,EAAE,OACnC,MAAM,EAAE,EAAE,SACR,MAAM,4BAoBd,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var circleDetect_exports = {};
|
|
20
|
+
__export(circleDetect_exports, {
|
|
21
|
+
checkCirclePath: () => checkCirclePath
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(circleDetect_exports);
|
|
24
|
+
const checkCirclePath = (obj, record, res, level, maxLevel = 3) => {
|
|
25
|
+
const idx = record.slice(0, record.length - 1).findIndex((v) => v.ref === obj);
|
|
26
|
+
if (idx !== -1) {
|
|
27
|
+
const key = record.map((v) => v.prop);
|
|
28
|
+
if (res.indexOf(key) < 0) {
|
|
29
|
+
res.push(key);
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
if (typeof obj === "object" && obj !== null && level < maxLevel) {
|
|
34
|
+
for (const [k, v] of Object.entries(obj)) {
|
|
35
|
+
checkCirclePath(v, [...record, { prop: k, ref: v }], res, level + 1);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
40
|
+
0 && (module.exports = {
|
|
41
|
+
checkCirclePath
|
|
42
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Linter, Plugin } from '@rsdoctor/types';
|
|
2
|
+
import type { RuleSetCondition as RspackRuleSetCondition } from '@rspack/core';
|
|
3
|
+
import { RuleSetCondition, RuleSetConditionAbsolute, RuleSetRule } from 'webpack';
|
|
4
|
+
import { RsdoctorWebpackPluginOptions, RsdoctorPluginOptionsNormalized } from '../../types';
|
|
5
|
+
export declare function normalizeUserConfig<Rules extends Linter.ExtendRuleData[]>(config?: RsdoctorWebpackPluginOptions<Rules>): RsdoctorPluginOptionsNormalized<Rules>;
|
|
6
|
+
export declare function makeRuleSetSerializable(item: RuleSetConditionAbsolute | RuleSetCondition | RspackRuleSetCondition | void): void;
|
|
7
|
+
export declare function makeRulesSerializable(rules: Plugin.RuleSetRule[] | RuleSetRule['oneOf']): void;
|
|
8
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/inner-plugins/utils/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,MAAM,EAAE,MAAM,EAAO,MAAM,iBAAiB,CAAC;AAE9D,OAAO,KAAK,EAAE,gBAAgB,IAAI,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAC/E,OAAO,EACL,gBAAgB,EAChB,wBAAwB,EACxB,WAAW,EACZ,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,4BAA4B,EAC5B,+BAA+B,EAChC,MAAM,SAAS,CAAC;AAMjB,wBAAgB,mBAAmB,CAAC,KAAK,SAAS,MAAM,CAAC,cAAc,EAAE,EACvE,MAAM,GAAE,4BAA4B,CAAC,KAAK,CAAM,GAC/C,+BAA+B,CAAC,KAAK,CAAC,CAiFxC;AAED,wBAAgB,uBAAuB,CACrC,IAAI,EACA,wBAAwB,GACxB,gBAAgB,GAChB,sBAAsB,GACtB,IAAI,QAcT;AAED,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,MAAM,CAAC,WAAW,EAAE,GAAG,WAAW,CAAC,OAAO,CAAC,QA+BnD"}
|
|
@@ -0,0 +1,151 @@
|
|
|
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 config_exports = {};
|
|
30
|
+
__export(config_exports, {
|
|
31
|
+
makeRuleSetSerializable: () => makeRuleSetSerializable,
|
|
32
|
+
makeRulesSerializable: () => makeRulesSerializable,
|
|
33
|
+
normalizeUserConfig: () => normalizeUserConfig
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(config_exports);
|
|
36
|
+
var import_types = require("@rsdoctor/types");
|
|
37
|
+
var import_assert = __toESM(require("assert"));
|
|
38
|
+
function defaultBoolean(v, dft) {
|
|
39
|
+
return typeof v === "boolean" ? v : dft;
|
|
40
|
+
}
|
|
41
|
+
function normalizeUserConfig(config = {}) {
|
|
42
|
+
const {
|
|
43
|
+
linter = {},
|
|
44
|
+
features = {},
|
|
45
|
+
loaderInterceptorOptions = {},
|
|
46
|
+
disableClientServer = false,
|
|
47
|
+
sdkInstance,
|
|
48
|
+
reportCodeType = { noModuleSource: false, noAssetsAndModuleSource: false },
|
|
49
|
+
disableTOSUpload = false,
|
|
50
|
+
innerClientPath = "",
|
|
51
|
+
supports = { parseBundle: true, banner: false },
|
|
52
|
+
port
|
|
53
|
+
} = config;
|
|
54
|
+
(0, import_assert.default)(linter && typeof linter === "object");
|
|
55
|
+
(0, import_assert.default)(features && typeof features === "object");
|
|
56
|
+
(0, import_assert.default)(
|
|
57
|
+
loaderInterceptorOptions && typeof loaderInterceptorOptions === "object"
|
|
58
|
+
);
|
|
59
|
+
(0, import_assert.default)(typeof disableClientServer === "boolean");
|
|
60
|
+
const _features = Array.isArray(
|
|
61
|
+
features
|
|
62
|
+
) ? {
|
|
63
|
+
loader: features.includes("loader"),
|
|
64
|
+
plugins: features.includes("plugins"),
|
|
65
|
+
resolver: features.includes("resolver"),
|
|
66
|
+
bundle: features.includes("bundle"),
|
|
67
|
+
treeShaking: features.includes("treeShaking"),
|
|
68
|
+
lite: features.includes("lite")
|
|
69
|
+
} : {
|
|
70
|
+
loader: defaultBoolean(features.loader, true),
|
|
71
|
+
plugins: defaultBoolean(features.plugins, true),
|
|
72
|
+
resolver: defaultBoolean(features.resolver, false),
|
|
73
|
+
bundle: defaultBoolean(features.bundle, true),
|
|
74
|
+
treeShaking: defaultBoolean(features.treeShaking, false),
|
|
75
|
+
lite: defaultBoolean(features.lite, false)
|
|
76
|
+
};
|
|
77
|
+
const _linter = {
|
|
78
|
+
rules: {},
|
|
79
|
+
extends: [],
|
|
80
|
+
level: "Error",
|
|
81
|
+
...linter
|
|
82
|
+
};
|
|
83
|
+
const res = {
|
|
84
|
+
linter: _linter,
|
|
85
|
+
features: _features,
|
|
86
|
+
loaderInterceptorOptions: {
|
|
87
|
+
skipLoaders: Array.isArray(loaderInterceptorOptions.skipLoaders) ? loaderInterceptorOptions.skipLoaders : []
|
|
88
|
+
},
|
|
89
|
+
disableClientServer,
|
|
90
|
+
sdkInstance,
|
|
91
|
+
/**
|
|
92
|
+
* Data storage is divided into three types:
|
|
93
|
+
* The first type: normal mode, all codes are saved.
|
|
94
|
+
* The second type: lite is the same as reportCodeType.noModuleSource, which lacks module source code.
|
|
95
|
+
* The third type: reportCodeType.noAssetsAndModuleSource means there is no module source code nor the packaged product code.
|
|
96
|
+
*
|
|
97
|
+
* */
|
|
98
|
+
reportCodeType: reportCodeType ? reportCodeType.noModuleSource ? import_types.SDK.ToDataType.Lite : reportCodeType.noAssetsAndModuleSource ? import_types.SDK.ToDataType.LiteAndNoAsset : import_types.SDK.ToDataType.Normal : _features.lite ? import_types.SDK.ToDataType.Lite : import_types.SDK.ToDataType.Normal,
|
|
99
|
+
disableTOSUpload,
|
|
100
|
+
innerClientPath,
|
|
101
|
+
supports,
|
|
102
|
+
port
|
|
103
|
+
};
|
|
104
|
+
return res;
|
|
105
|
+
}
|
|
106
|
+
function makeRuleSetSerializable(item) {
|
|
107
|
+
if (!item)
|
|
108
|
+
return;
|
|
109
|
+
if (item instanceof RegExp) {
|
|
110
|
+
item.toJSON = item.toString;
|
|
111
|
+
} else if (Array.isArray(item)) {
|
|
112
|
+
item.forEach((i) => makeRuleSetSerializable(i));
|
|
113
|
+
} else if (typeof item === "object") {
|
|
114
|
+
makeRuleSetSerializable(item.and);
|
|
115
|
+
makeRuleSetSerializable(item.or);
|
|
116
|
+
makeRuleSetSerializable(item.not);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
function makeRulesSerializable(rules) {
|
|
120
|
+
if (!Array.isArray(rules))
|
|
121
|
+
return;
|
|
122
|
+
if (!rules.length)
|
|
123
|
+
return;
|
|
124
|
+
rules.forEach((rule) => {
|
|
125
|
+
if (!rule)
|
|
126
|
+
return;
|
|
127
|
+
makeRuleSetSerializable(rule.test);
|
|
128
|
+
makeRuleSetSerializable(rule.resourceQuery);
|
|
129
|
+
makeRuleSetSerializable(rule.resource);
|
|
130
|
+
makeRuleSetSerializable(rule.resourceFragment);
|
|
131
|
+
makeRuleSetSerializable(rule.scheme);
|
|
132
|
+
makeRuleSetSerializable(rule.issuer);
|
|
133
|
+
if ("issuerLayer" in rule) {
|
|
134
|
+
makeRuleSetSerializable(rule.issuerLayer);
|
|
135
|
+
}
|
|
136
|
+
makeRuleSetSerializable(rule.include);
|
|
137
|
+
makeRuleSetSerializable(rule.exclude);
|
|
138
|
+
if (rule.oneOf) {
|
|
139
|
+
makeRulesSerializable(rule.oneOf);
|
|
140
|
+
}
|
|
141
|
+
if ("rules" in rule && rule.rules) {
|
|
142
|
+
makeRulesSerializable(rule.rules);
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
147
|
+
0 && (module.exports = {
|
|
148
|
+
makeRuleSetSerializable,
|
|
149
|
+
makeRulesSerializable,
|
|
150
|
+
normalizeUserConfig
|
|
151
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/inner-plugins/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
16
|
+
var utils_exports = {};
|
|
17
|
+
module.exports = __toCommonJS(utils_exports);
|
|
18
|
+
__reExport(utils_exports, require("./loader"), module.exports);
|
|
19
|
+
__reExport(utils_exports, require("./plugin"), module.exports);
|
|
20
|
+
__reExport(utils_exports, require("./sdk"), module.exports);
|
|
21
|
+
__reExport(utils_exports, require("./config"), module.exports);
|
|
22
|
+
__reExport(utils_exports, require("./circleDetect"), module.exports);
|
|
23
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
24
|
+
0 && (module.exports = {
|
|
25
|
+
...require("./loader"),
|
|
26
|
+
...require("./plugin"),
|
|
27
|
+
...require("./sdk"),
|
|
28
|
+
...require("./config"),
|
|
29
|
+
...require("./circleDetect")
|
|
30
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="lodash" />
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
import { SDK, Plugin } from '@rsdoctor/types';
|
|
4
|
+
import { ProxyLoaderInternalOptions, ProxyLoaderOptions } from '../../types';
|
|
5
|
+
import { Utils as BuildUtils, Types } from '../../build-utils/build';
|
|
6
|
+
export declare function getInternalLoaderOptions(loaderContext: Plugin.LoaderContext<ProxyLoaderOptions>): ProxyLoaderInternalOptions;
|
|
7
|
+
export declare function getLoaderOptionsWithoutInternalKeys(loaderContext: Plugin.LoaderContext<ProxyLoaderOptions>): import("lodash").Omit<ProxyLoaderOptions, "__l__">;
|
|
8
|
+
export declare function getOriginLoaderModule(loaderContext: Plugin.LoaderContext<ProxyLoaderOptions>): ReturnType<typeof BuildUtils.loadLoaderModule>;
|
|
9
|
+
export declare function shouldSkipLoader(loaderContext: Plugin.LoaderContext<ProxyLoaderOptions>): boolean;
|
|
10
|
+
export declare function interceptLoader<T extends Plugin.BuildRuleSetRule>(rules: T[], loaderPath: string, options: Omit<ProxyLoaderInternalOptions, 'loader' | 'hasOptions'>, cwd?: string, resolveLoader?: Plugin.Configuration['resolve']): T[];
|
|
11
|
+
export declare function reportLoader(ctx: Plugin.LoaderContext<ProxyLoaderOptions>, start: number, startHRTime: [number, number], isPitch: boolean, sync: boolean, code: string, err: Error | null | undefined, res: string | Buffer | null, sourceMap?: Types.SourceMapInput): Promise<SDK.LoaderData>;
|
|
12
|
+
//# sourceMappingURL=loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../../src/inner-plugins/utils/loader.ts"],"names":[],"mappings":";;AAYA,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAK9C,OAAO,EAAE,0BAA0B,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AACzE,OAAO,EAAE,KAAK,IAAI,UAAU,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAEjE,wBAAgB,wBAAwB,CACtC,aAAa,EAAE,MAAM,CAAC,aAAa,CAAC,kBAAkB,CAAC,GACtD,0BAA0B,CAI5B;AAED,wBAAgB,mCAAmC,CACjD,aAAa,EAAE,MAAM,CAAC,aAAa,CAAC,kBAAkB,CAAC,sDAiBxD;AAED,wBAAgB,qBAAqB,CACnC,aAAa,EAAE,MAAM,CAAC,aAAa,CAAC,kBAAkB,CAAC,GACtD,UAAU,CAAC,OAAO,UAAU,CAAC,gBAAgB,CAAC,CAGhD;AAED,wBAAgB,gBAAgB,CAC9B,aAAa,EAAE,MAAM,CAAC,aAAa,CAAC,kBAAkB,CAAC,WAgBxD;AAED,wBAAgB,eAAe,CAAC,CAAC,SAAS,MAAM,CAAC,gBAAgB,EAC/D,KAAK,EAAE,CAAC,EAAE,EACV,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,IAAI,CAAC,0BAA0B,EAAE,QAAQ,GAAG,YAAY,CAAC,EAClE,GAAG,SAAgB,EACnB,aAAa,CAAC,EAAE,MAAM,CAAC,aAAa,CAAC,SAAS,CAAC,GAC9C,CAAC,EAAE,CAkDL;AAED,wBAAsB,YAAY,CAChC,GAAG,EAAE,MAAM,CAAC,aAAa,CAAC,kBAAkB,CAAC,EAC7C,KAAK,EAAE,MAAM,EACb,WAAW,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAC7B,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,OAAO,EACb,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,KAAK,GAAG,IAAI,GAAG,SAAS,EAC7B,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,EAC3B,SAAS,CAAC,EAAE,KAAK,CAAC,cAAc,2BAoFjC"}
|