@rsdoctor/rspack-plugin 1.2.2 → 1.2.4-beta.0
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/constants.d.ts +0 -1
- package/dist/index.cjs +173 -0
- package/dist/index.d.ts +0 -1
- package/dist/index.js +136 -59
- package/dist/multiple.d.ts +3 -4
- package/dist/plugin.d.ts +3 -4
- package/dist/types/index.d.ts +3 -4
- package/package.json +19 -12
- package/dist/constants.d.ts.map +0 -1
- package/dist/constants.js +0 -84
- package/dist/index.d.ts.map +0 -1
- package/dist/multiple.d.ts.map +0 -1
- package/dist/multiple.js +0 -80
- package/dist/plugin.d.ts.map +0 -1
- package/dist/plugin.js +0 -203
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js +0 -18
package/dist/constants.d.ts
CHANGED
|
@@ -5,4 +5,3 @@ export declare const pluginTapPreOptions: Tap;
|
|
|
5
5
|
export declare const internalPluginTapPreOptions: (namespace: string) => Tap;
|
|
6
6
|
export declare const internalPluginTapPostOptions: (namespace: string) => Tap;
|
|
7
7
|
export declare const pkg: any;
|
|
8
|
-
//# sourceMappingURL=constants.d.ts.map
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
let __rslib_import_meta_url__ = 'undefined' == typeof document ? new (require('url'.replace('', ''))).URL('file:' + __filename).href : document.currentScript && document.currentScript.src || new URL('main.js', document.baseURI).href;
|
|
3
|
+
var __webpack_modules__ = {
|
|
4
|
+
"./package.json": function(module) {
|
|
5
|
+
module.exports = JSON.parse('{"name":"@rsdoctor/rspack-plugin","version":"1.2.4-beta.0","repository":{"type":"git","url":"https://github.com/web-infra-dev/rsdoctor","directory":"packages/rspack-plugin"},"license":"MIT","main":"dist/index.cjs","types":"dist/index.d.ts","files":["dist"],"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.cjs"}},"type":"module","scripts":{"dev":"npm run start","start":"rslib build -w","build":"rslib build","test":"rstest run"},"dependencies":{"@rsdoctor/core":"workspace:*","@rsdoctor/graph":"workspace:*","@rsdoctor/sdk":"workspace:*","@rsdoctor/types":"workspace:*","@rsdoctor/utils":"workspace:*","lodash-es":"^4.17.21"},"devDependencies":{"@rspack/core":"1.5.1","@types/lodash-es":"^4.17.12","@types/node":"^22.8.1","@types/tapable":"2.2.7","tslib":"2.8.1","typescript":"^5.9.2"},"peerDependencies":{"@rspack/core":"*"},"peerDependenciesMeta":{"@rspack/core":{"optional":true}},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"}}');
|
|
6
|
+
}
|
|
7
|
+
}, __webpack_module_cache__ = {};
|
|
8
|
+
function __webpack_require__(moduleId) {
|
|
9
|
+
var cachedModule = __webpack_module_cache__[moduleId];
|
|
10
|
+
if (void 0 !== cachedModule) return cachedModule.exports;
|
|
11
|
+
var module = __webpack_module_cache__[moduleId] = {
|
|
12
|
+
exports: {}
|
|
13
|
+
};
|
|
14
|
+
return __webpack_modules__[moduleId](module, module.exports, __webpack_require__), module.exports;
|
|
15
|
+
}
|
|
16
|
+
__webpack_require__.n = (module)=>{
|
|
17
|
+
var getter = module && module.__esModule ? ()=>module.default : ()=>module;
|
|
18
|
+
return __webpack_require__.d(getter, {
|
|
19
|
+
a: getter
|
|
20
|
+
}), getter;
|
|
21
|
+
}, __webpack_require__.d = (exports1, definition)=>{
|
|
22
|
+
for(var key in definition)__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key) && Object.defineProperty(exports1, key, {
|
|
23
|
+
enumerable: !0,
|
|
24
|
+
get: definition[key]
|
|
25
|
+
});
|
|
26
|
+
}, __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop), __webpack_require__.r = (exports1)=>{
|
|
27
|
+
'undefined' != typeof Symbol && Symbol.toStringTag && Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
28
|
+
value: 'Module'
|
|
29
|
+
}), Object.defineProperty(exports1, '__esModule', {
|
|
30
|
+
value: !0
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
var __webpack_exports__ = {};
|
|
34
|
+
for(var __webpack_i__ in (()=>{
|
|
35
|
+
let globalController;
|
|
36
|
+
__webpack_require__.r(__webpack_exports__), __webpack_require__.d(__webpack_exports__, {
|
|
37
|
+
RsdoctorRspackPlugin: ()=>RsdoctorRspackPlugin,
|
|
38
|
+
RsdoctorRspackMultiplePlugin: ()=>RsdoctorRspackMultiplePlugin
|
|
39
|
+
});
|
|
40
|
+
let build_utils_namespaceObject = require("@rsdoctor/core/build-utils"), plugins_namespaceObject = require("@rsdoctor/core/plugins"), sdk_namespaceObject = require("@rsdoctor/sdk"), types_namespaceObject = require("@rsdoctor/types"), external_path_namespaceObject = require("path");
|
|
41
|
+
var external_path_default = __webpack_require__.n(external_path_namespaceObject);
|
|
42
|
+
let pluginTapName = 'RsdoctorRspackPlugin', pluginTapPostOptions = {
|
|
43
|
+
name: pluginTapName,
|
|
44
|
+
stage: 999
|
|
45
|
+
};
|
|
46
|
+
__webpack_require__("./package.json");
|
|
47
|
+
let graph_namespaceObject = require("@rsdoctor/graph"), common_namespaceObject = require("@rsdoctor/utils/common"), logger_namespaceObject = require("@rsdoctor/utils/logger");
|
|
48
|
+
class RsdoctorRspackPlugin {
|
|
49
|
+
name = pluginTapName;
|
|
50
|
+
sdk;
|
|
51
|
+
isRsdoctorPlugin;
|
|
52
|
+
_bootstrapTask;
|
|
53
|
+
browserIsOpened = !1;
|
|
54
|
+
modulesGraph;
|
|
55
|
+
options;
|
|
56
|
+
outsideInstance;
|
|
57
|
+
constructor(options){
|
|
58
|
+
this.options = (0, plugins_namespaceObject.normalizeRspackUserOptions)(Object.assign(options || {}, {
|
|
59
|
+
supports: {
|
|
60
|
+
...options?.supports
|
|
61
|
+
}
|
|
62
|
+
}));
|
|
63
|
+
let { port, output, innerClientPath, printLog, sdkInstance } = this.options;
|
|
64
|
+
this.sdk = this.options.sdkInstance ?? new sdk_namespaceObject.RsdoctorSDK({
|
|
65
|
+
port,
|
|
66
|
+
name: pluginTapName,
|
|
67
|
+
root: process.cwd(),
|
|
68
|
+
type: output.reportCodeType,
|
|
69
|
+
config: {
|
|
70
|
+
innerClientPath,
|
|
71
|
+
printLog,
|
|
72
|
+
mode: output.mode ? output.mode : void 0,
|
|
73
|
+
brief: output.mode === types_namespaceObject.SDK.IMode[types_namespaceObject.SDK.IMode.brief] && output.options || void 0
|
|
74
|
+
}
|
|
75
|
+
}), this.outsideInstance = !!sdkInstance, this.modulesGraph = new graph_namespaceObject.ModuleGraph(), this.isRsdoctorPlugin = !0;
|
|
76
|
+
}
|
|
77
|
+
apply(compiler) {
|
|
78
|
+
(0, logger_namespaceObject.time)('RsdoctorRspackPlugin.apply');
|
|
79
|
+
try {
|
|
80
|
+
this._bootstrapTask || (this._bootstrapTask = this.sdk.bootstrap()), compiler.options.name && this.sdk.setName(compiler.options.name), (0, plugins_namespaceObject.setSDK)(this.sdk), compiler.hooks.afterPlugins.tap(pluginTapPostOptions, this.afterPlugins.bind(this, compiler)), compiler.hooks.done.tapPromise({
|
|
81
|
+
...pluginTapPostOptions,
|
|
82
|
+
stage: pluginTapPostOptions.stage + 100
|
|
83
|
+
}, this.done.bind(this, compiler)), new plugins_namespaceObject.InternalSummaryPlugin(this).apply(compiler), this.options.features.loader && (new build_utils_namespaceObject.Loader.ProbeLoaderPlugin().apply(compiler), this.sdk.addClientRoutes([
|
|
84
|
+
types_namespaceObject.Manifest.RsdoctorManifestClientRoutes.WebpackLoaders
|
|
85
|
+
]), common_namespaceObject.Loader.isVue(compiler) || new plugins_namespaceObject.InternalLoaderPlugin(this).apply(compiler)), this.options.features.plugins && new plugins_namespaceObject.InternalPluginsPlugin(this).apply(compiler), this.options.features.bundle && (new plugins_namespaceObject.InternalBundlePlugin(this).apply(compiler), new plugins_namespaceObject.InternalBundleTagPlugin(this).apply(compiler)), this.options.features.resolver && logger_namespaceObject.logger.info(logger_namespaceObject.chalk.yellow('Rspack currently does not support Resolver capabilities.')), new plugins_namespaceObject.InternalRulesPlugin(this).apply(compiler), new plugins_namespaceObject.InternalErrorReporterPlugin(this).apply(compiler);
|
|
86
|
+
let RsdoctorRspackNativePlugin = compiler.webpack.experiments?.RsdoctorPlugin;
|
|
87
|
+
if (RsdoctorRspackNativePlugin) {
|
|
88
|
+
logger_namespaceObject.logger.debug('[RspackNativePlugin] Enabled');
|
|
89
|
+
let enableNativePlugin = this.options.experiments?.enableNativePlugin;
|
|
90
|
+
new RsdoctorRspackNativePlugin({
|
|
91
|
+
moduleGraphFeatures: 'boolean' == typeof enableNativePlugin ? enableNativePlugin : enableNativePlugin?.moduleGraph || !1,
|
|
92
|
+
chunkGraphFeatures: 'boolean' == typeof enableNativePlugin ? enableNativePlugin : enableNativePlugin?.chunkGraph || !1,
|
|
93
|
+
sourceMapFeatures: {
|
|
94
|
+
cheap: !1,
|
|
95
|
+
module: !1
|
|
96
|
+
}
|
|
97
|
+
}).apply(compiler);
|
|
98
|
+
}
|
|
99
|
+
} finally{
|
|
100
|
+
(0, logger_namespaceObject.timeEnd)('RsdoctorRspackPlugin.apply');
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
ensureModulesChunksGraphApplied(compiler) {
|
|
104
|
+
(0, plugins_namespaceObject.ensureModulesChunksGraphFn)(compiler, this);
|
|
105
|
+
}
|
|
106
|
+
afterPlugins = (compiler)=>{
|
|
107
|
+
(0, logger_namespaceObject.time)('RsdoctorRspackPlugin.afterPlugins');
|
|
108
|
+
try {
|
|
109
|
+
this.getRspackConfig(compiler);
|
|
110
|
+
} finally{
|
|
111
|
+
(0, logger_namespaceObject.timeEnd)('RsdoctorRspackPlugin.afterPlugins');
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
done = async (compiler)=>{
|
|
115
|
+
(0, logger_namespaceObject.time)('RsdoctorRspackPlugin.done');
|
|
116
|
+
try {
|
|
117
|
+
await this.sdk.bootstrap(), this.sdk.addClientRoutes([
|
|
118
|
+
types_namespaceObject.Manifest.RsdoctorManifestClientRoutes.Overall
|
|
119
|
+
]), this.outsideInstance && 'parent' in this.sdk && this.sdk.parent.master.setOutputDir(external_path_default().resolve(this.options.output.reportDir || compiler.outputPath, `./${types_namespaceObject.Constants.RsdoctorOutputFolder}`)), this.sdk.setOutputDir(external_path_default().resolve(this.options.output.reportDir || compiler.outputPath, `./${types_namespaceObject.Constants.RsdoctorOutputFolder}`)), await this.sdk.writeStore(), this.options.disableClientServer || (this.options.output.mode === types_namespaceObject.SDK.IMode[types_namespaceObject.SDK.IMode.brief] ? (0, plugins_namespaceObject.handleBriefModeReport)(this.sdk, this.options, this.options.disableClientServer) : await this.sdk.server.openClientPage('homepage')), this.options.disableClientServer && await this.sdk.dispose();
|
|
120
|
+
} finally{
|
|
121
|
+
(0, logger_namespaceObject.timeEnd)('RsdoctorRspackPlugin.done');
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
getRspackConfig(compiler) {
|
|
125
|
+
(0, logger_namespaceObject.time)('RsdoctorRspackPlugin.getRspackConfig');
|
|
126
|
+
try {
|
|
127
|
+
if (compiler.isChild()) return;
|
|
128
|
+
let configuration = (0, plugins_namespaceObject.processCompilerConfig)(compiler.options), rspackVersion = compiler.webpack?.rspackVersion, webpackVersion = compiler.webpack?.version;
|
|
129
|
+
this.sdk.reportConfiguration({
|
|
130
|
+
name: rspackVersion ? 'rspack' : 'webpack',
|
|
131
|
+
version: rspackVersion || webpackVersion || 'unknown',
|
|
132
|
+
config: configuration,
|
|
133
|
+
root: (0, sdk_namespaceObject.findRoot)() || ''
|
|
134
|
+
});
|
|
135
|
+
} finally{
|
|
136
|
+
(0, logger_namespaceObject.timeEnd)('RsdoctorRspackPlugin.getRspackConfig');
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
class RsdoctorRspackMultiplePlugin extends RsdoctorRspackPlugin {
|
|
141
|
+
controller;
|
|
142
|
+
constructor(options = {}){
|
|
143
|
+
let controller = (()=>{
|
|
144
|
+
if (globalController) return globalController;
|
|
145
|
+
let controller = new sdk_namespaceObject.RsdoctorSDKController();
|
|
146
|
+
return globalController = controller, controller;
|
|
147
|
+
})(), normallizedOptions = (0, plugins_namespaceObject.normalizeUserConfig)(options);
|
|
148
|
+
super({
|
|
149
|
+
...options,
|
|
150
|
+
sdkInstance: controller.createSlave({
|
|
151
|
+
name: options.name || 'Builder',
|
|
152
|
+
stage: options.stage,
|
|
153
|
+
extraConfig: {
|
|
154
|
+
innerClientPath: normallizedOptions.innerClientPath,
|
|
155
|
+
printLog: normallizedOptions.printLog,
|
|
156
|
+
mode: normallizedOptions.output.mode ? normallizedOptions.output.mode : void 0,
|
|
157
|
+
brief: normallizedOptions.output.mode === types_namespaceObject.SDK.IMode[types_namespaceObject.SDK.IMode.brief] && normallizedOptions.output.options || void 0
|
|
158
|
+
},
|
|
159
|
+
type: normallizedOptions.output.reportCodeType
|
|
160
|
+
})
|
|
161
|
+
}), this.controller = controller;
|
|
162
|
+
}
|
|
163
|
+
apply(compiler) {
|
|
164
|
+
'dependencies' in compiler.options && (this.sdk.dependencies = compiler.options.dependencies), super.apply(compiler);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
})(), exports.RsdoctorRspackMultiplePlugin = __webpack_exports__.RsdoctorRspackMultiplePlugin, exports.RsdoctorRspackPlugin = __webpack_exports__.RsdoctorRspackPlugin, __webpack_exports__)-1 === [
|
|
168
|
+
"RsdoctorRspackMultiplePlugin",
|
|
169
|
+
"RsdoctorRspackPlugin"
|
|
170
|
+
].indexOf(__webpack_i__) && (exports[__webpack_i__] = __webpack_exports__[__webpack_i__]);
|
|
171
|
+
Object.defineProperty(exports, '__esModule', {
|
|
172
|
+
value: !0
|
|
173
|
+
});
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,69 +1,146 @@
|
|
|
1
|
-
|
|
1
|
+
let globalController;
|
|
2
|
+
import { Loader } from "@rsdoctor/core/build-utils";
|
|
3
|
+
import { InternalBundlePlugin, InternalBundleTagPlugin, InternalErrorReporterPlugin, InternalLoaderPlugin, InternalPluginsPlugin, InternalRulesPlugin, InternalSummaryPlugin, ensureModulesChunksGraphFn, handleBriefModeReport, normalizeRspackUserOptions, normalizeUserConfig, processCompilerConfig, setSDK } from "@rsdoctor/core/plugins";
|
|
4
|
+
import { RsdoctorSDK, RsdoctorSDKController, findRoot } from "@rsdoctor/sdk";
|
|
5
|
+
import { Constants, Manifest, SDK } from "@rsdoctor/types";
|
|
6
|
+
import path from "path";
|
|
7
|
+
import { ModuleGraph } from "@rsdoctor/graph";
|
|
8
|
+
import { Loader as common_Loader } from "@rsdoctor/utils/common";
|
|
9
|
+
import { chalk, logger, time, timeEnd } from "@rsdoctor/utils/logger";
|
|
2
10
|
var __webpack_modules__ = {
|
|
3
|
-
"./
|
|
4
|
-
module.exports =
|
|
5
|
-
},
|
|
6
|
-
"./plugin": function(module) {
|
|
7
|
-
module.exports = require("./plugin.js");
|
|
11
|
+
"./package.json": function(module) {
|
|
12
|
+
module.exports = JSON.parse('{"name":"@rsdoctor/rspack-plugin","version":"1.2.4-beta.0","repository":{"type":"git","url":"https://github.com/web-infra-dev/rsdoctor","directory":"packages/rspack-plugin"},"license":"MIT","main":"dist/index.cjs","types":"dist/index.d.ts","files":["dist"],"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.cjs"}},"type":"module","scripts":{"dev":"npm run start","start":"rslib build -w","build":"rslib build","test":"rstest run"},"dependencies":{"@rsdoctor/core":"workspace:*","@rsdoctor/graph":"workspace:*","@rsdoctor/sdk":"workspace:*","@rsdoctor/types":"workspace:*","@rsdoctor/utils":"workspace:*","lodash-es":"^4.17.21"},"devDependencies":{"@rspack/core":"1.5.1","@types/lodash-es":"^4.17.12","@types/node":"^22.8.1","@types/tapable":"2.2.7","tslib":"2.8.1","typescript":"^5.9.2"},"peerDependencies":{"@rspack/core":"*"},"peerDependenciesMeta":{"@rspack/core":{"optional":true}},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"}}');
|
|
8
13
|
}
|
|
14
|
+
}, __webpack_module_cache__ = {};
|
|
15
|
+
let pluginTapName = 'RsdoctorRspackPlugin', pluginTapPostOptions = {
|
|
16
|
+
name: pluginTapName,
|
|
17
|
+
stage: 999
|
|
9
18
|
};
|
|
10
|
-
|
|
11
|
-
function __webpack_require__(moduleId) {
|
|
19
|
+
!function __webpack_require__(moduleId) {
|
|
12
20
|
var cachedModule = __webpack_module_cache__[moduleId];
|
|
13
21
|
if (void 0 !== cachedModule) return cachedModule.exports;
|
|
14
22
|
var module = __webpack_module_cache__[moduleId] = {
|
|
15
23
|
exports: {}
|
|
16
24
|
};
|
|
17
|
-
__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
((
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
25
|
+
return __webpack_modules__[moduleId](module, module.exports, __webpack_require__), module.exports;
|
|
26
|
+
}("./package.json");
|
|
27
|
+
class RsdoctorRspackPlugin {
|
|
28
|
+
name = pluginTapName;
|
|
29
|
+
sdk;
|
|
30
|
+
isRsdoctorPlugin;
|
|
31
|
+
_bootstrapTask;
|
|
32
|
+
browserIsOpened = !1;
|
|
33
|
+
modulesGraph;
|
|
34
|
+
options;
|
|
35
|
+
outsideInstance;
|
|
36
|
+
constructor(options){
|
|
37
|
+
this.options = normalizeRspackUserOptions(Object.assign(options || {}, {
|
|
38
|
+
supports: {
|
|
39
|
+
...options?.supports
|
|
40
|
+
}
|
|
41
|
+
}));
|
|
42
|
+
let { port, output, innerClientPath, printLog, sdkInstance } = this.options;
|
|
43
|
+
this.sdk = this.options.sdkInstance ?? new RsdoctorSDK({
|
|
44
|
+
port,
|
|
45
|
+
name: pluginTapName,
|
|
46
|
+
root: process.cwd(),
|
|
47
|
+
type: output.reportCodeType,
|
|
48
|
+
config: {
|
|
49
|
+
innerClientPath,
|
|
50
|
+
printLog,
|
|
51
|
+
mode: output.mode ? output.mode : void 0,
|
|
52
|
+
brief: output.mode === SDK.IMode[SDK.IMode.brief] && output.options || void 0
|
|
53
|
+
}
|
|
54
|
+
}), this.outsideInstance = !!sdkInstance, this.modulesGraph = new ModuleGraph(), this.isRsdoctorPlugin = !0;
|
|
55
|
+
}
|
|
56
|
+
apply(compiler) {
|
|
57
|
+
time('RsdoctorRspackPlugin.apply');
|
|
58
|
+
try {
|
|
59
|
+
this._bootstrapTask || (this._bootstrapTask = this.sdk.bootstrap()), compiler.options.name && this.sdk.setName(compiler.options.name), setSDK(this.sdk), compiler.hooks.afterPlugins.tap(pluginTapPostOptions, this.afterPlugins.bind(this, compiler)), compiler.hooks.done.tapPromise({
|
|
60
|
+
...pluginTapPostOptions,
|
|
61
|
+
stage: pluginTapPostOptions.stage + 100
|
|
62
|
+
}, this.done.bind(this, compiler)), new InternalSummaryPlugin(this).apply(compiler), this.options.features.loader && (new Loader.ProbeLoaderPlugin().apply(compiler), this.sdk.addClientRoutes([
|
|
63
|
+
Manifest.RsdoctorManifestClientRoutes.WebpackLoaders
|
|
64
|
+
]), common_Loader.isVue(compiler) || new InternalLoaderPlugin(this).apply(compiler)), this.options.features.plugins && new InternalPluginsPlugin(this).apply(compiler), this.options.features.bundle && (new InternalBundlePlugin(this).apply(compiler), new InternalBundleTagPlugin(this).apply(compiler)), this.options.features.resolver && logger.info(chalk.yellow('Rspack currently does not support Resolver capabilities.')), new InternalRulesPlugin(this).apply(compiler), new InternalErrorReporterPlugin(this).apply(compiler);
|
|
65
|
+
let RsdoctorRspackNativePlugin = compiler.webpack.experiments?.RsdoctorPlugin;
|
|
66
|
+
if (RsdoctorRspackNativePlugin) {
|
|
67
|
+
logger.debug('[RspackNativePlugin] Enabled');
|
|
68
|
+
let enableNativePlugin = this.options.experiments?.enableNativePlugin;
|
|
69
|
+
new RsdoctorRspackNativePlugin({
|
|
70
|
+
moduleGraphFeatures: 'boolean' == typeof enableNativePlugin ? enableNativePlugin : enableNativePlugin?.moduleGraph || !1,
|
|
71
|
+
chunkGraphFeatures: 'boolean' == typeof enableNativePlugin ? enableNativePlugin : enableNativePlugin?.chunkGraph || !1,
|
|
72
|
+
sourceMapFeatures: {
|
|
73
|
+
cheap: !1,
|
|
74
|
+
module: !1
|
|
75
|
+
}
|
|
76
|
+
}).apply(compiler);
|
|
77
|
+
}
|
|
78
|
+
} finally{
|
|
79
|
+
timeEnd('RsdoctorRspackPlugin.apply');
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
ensureModulesChunksGraphApplied(compiler) {
|
|
83
|
+
ensureModulesChunksGraphFn(compiler, this);
|
|
84
|
+
}
|
|
85
|
+
afterPlugins = (compiler)=>{
|
|
86
|
+
time('RsdoctorRspackPlugin.afterPlugins');
|
|
87
|
+
try {
|
|
88
|
+
this.getRspackConfig(compiler);
|
|
89
|
+
} finally{
|
|
90
|
+
timeEnd('RsdoctorRspackPlugin.afterPlugins');
|
|
91
|
+
}
|
|
35
92
|
};
|
|
36
|
-
|
|
37
|
-
(
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
Object.defineProperty(exports1, '__esModule', {
|
|
46
|
-
value: true
|
|
47
|
-
});
|
|
93
|
+
done = async (compiler)=>{
|
|
94
|
+
time('RsdoctorRspackPlugin.done');
|
|
95
|
+
try {
|
|
96
|
+
await this.sdk.bootstrap(), this.sdk.addClientRoutes([
|
|
97
|
+
Manifest.RsdoctorManifestClientRoutes.Overall
|
|
98
|
+
]), this.outsideInstance && 'parent' in this.sdk && this.sdk.parent.master.setOutputDir(path.resolve(this.options.output.reportDir || compiler.outputPath, `./${Constants.RsdoctorOutputFolder}`)), this.sdk.setOutputDir(path.resolve(this.options.output.reportDir || compiler.outputPath, `./${Constants.RsdoctorOutputFolder}`)), await this.sdk.writeStore(), this.options.disableClientServer || (this.options.output.mode === SDK.IMode[SDK.IMode.brief] ? handleBriefModeReport(this.sdk, this.options, this.options.disableClientServer) : await this.sdk.server.openClientPage('homepage')), this.options.disableClientServer && await this.sdk.dispose();
|
|
99
|
+
} finally{
|
|
100
|
+
timeEnd('RsdoctorRspackPlugin.done');
|
|
101
|
+
}
|
|
48
102
|
};
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
103
|
+
getRspackConfig(compiler) {
|
|
104
|
+
time('RsdoctorRspackPlugin.getRspackConfig');
|
|
105
|
+
try {
|
|
106
|
+
if (compiler.isChild()) return;
|
|
107
|
+
let configuration = processCompilerConfig(compiler.options), rspackVersion = compiler.webpack?.rspackVersion, webpackVersion = compiler.webpack?.version;
|
|
108
|
+
this.sdk.reportConfiguration({
|
|
109
|
+
name: rspackVersion ? 'rspack' : 'webpack',
|
|
110
|
+
version: rspackVersion || webpackVersion || 'unknown',
|
|
111
|
+
config: configuration,
|
|
112
|
+
root: findRoot() || ''
|
|
113
|
+
});
|
|
114
|
+
} finally{
|
|
115
|
+
timeEnd('RsdoctorRspackPlugin.getRspackConfig');
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
class RsdoctorRspackMultiplePlugin extends RsdoctorRspackPlugin {
|
|
120
|
+
controller;
|
|
121
|
+
constructor(options = {}){
|
|
122
|
+
let controller = (()=>{
|
|
123
|
+
if (globalController) return globalController;
|
|
124
|
+
let controller = new RsdoctorSDKController();
|
|
125
|
+
return globalController = controller, controller;
|
|
126
|
+
})(), normallizedOptions = normalizeUserConfig(options);
|
|
127
|
+
super({
|
|
128
|
+
...options,
|
|
129
|
+
sdkInstance: controller.createSlave({
|
|
130
|
+
name: options.name || 'Builder',
|
|
131
|
+
stage: options.stage,
|
|
132
|
+
extraConfig: {
|
|
133
|
+
innerClientPath: normallizedOptions.innerClientPath,
|
|
134
|
+
printLog: normallizedOptions.printLog,
|
|
135
|
+
mode: normallizedOptions.output.mode ? normallizedOptions.output.mode : void 0,
|
|
136
|
+
brief: normallizedOptions.output.mode === SDK.IMode[SDK.IMode.brief] && normallizedOptions.output.options || void 0
|
|
137
|
+
},
|
|
138
|
+
type: normallizedOptions.output.reportCodeType
|
|
139
|
+
})
|
|
140
|
+
}), this.controller = controller;
|
|
141
|
+
}
|
|
142
|
+
apply(compiler) {
|
|
143
|
+
'dependencies' in compiler.options && (this.sdk.dependencies = compiler.options.dependencies), super.apply(compiler);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
export { RsdoctorRspackMultiplePlugin, RsdoctorRspackPlugin };
|
package/dist/multiple.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type
|
|
3
|
-
import { RsdoctorRspackPlugin } from './plugin';
|
|
1
|
+
import type { RsdoctorMultiplePluginOptions } from '@rsdoctor/core/types';
|
|
2
|
+
import { type Linter } from '@rsdoctor/types';
|
|
4
3
|
import type { Compiler } from '@rspack/core';
|
|
4
|
+
import { RsdoctorRspackPlugin } from './plugin';
|
|
5
5
|
export declare class RsdoctorRspackMultiplePlugin<Rules extends Linter.ExtendRuleData[]> extends RsdoctorRspackPlugin<Rules> {
|
|
6
6
|
private controller;
|
|
7
7
|
constructor(options?: RsdoctorMultiplePluginOptions<Rules>);
|
|
8
8
|
apply(compiler: Compiler): void;
|
|
9
9
|
}
|
|
10
|
-
//# sourceMappingURL=multiple.d.ts.map
|
package/dist/plugin.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import type { RsdoctorRspackPluginInstance, RsdoctorRspackPluginOptions, RsdoctorRspackPluginOptionsNormalized } from '@rsdoctor/core/types';
|
|
2
|
+
import { RsdoctorPrimarySDK } from '@rsdoctor/sdk';
|
|
3
3
|
import { Linter, Plugin, SDK } from '@rsdoctor/types';
|
|
4
4
|
export declare class RsdoctorRspackPlugin<Rules extends Linter.ExtendRuleData[]> implements RsdoctorRspackPluginInstance<Rules> {
|
|
5
5
|
readonly name = "RsdoctorRspackPlugin";
|
|
6
|
-
readonly sdk:
|
|
6
|
+
readonly sdk: SDK.RsdoctorBuilderSDKInstance | RsdoctorPrimarySDK;
|
|
7
7
|
readonly isRsdoctorPlugin: boolean;
|
|
8
8
|
_bootstrapTask: Promise<unknown>;
|
|
9
9
|
protected browserIsOpened: boolean;
|
|
@@ -23,4 +23,3 @@ export declare class RsdoctorRspackPlugin<Rules extends Linter.ExtendRuleData[]>
|
|
|
23
23
|
done: (compiler: Plugin.BaseCompilerType<"rspack">) => Promise<void>;
|
|
24
24
|
getRspackConfig(compiler: Plugin.BaseCompilerType<'rspack'>): void;
|
|
25
25
|
}
|
|
26
|
-
//# sourceMappingURL=plugin.d.ts.map
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import type { Plugin } from '@rsdoctor/types';
|
|
1
2
|
import type { RspackPluginInstance } from '@rspack/core';
|
|
2
|
-
import type { RsdoctorWebpackPluginOptions } from '@rsdoctor/core/types';
|
|
3
3
|
export interface RsdoctorRspackPluginOptions {
|
|
4
4
|
/**
|
|
5
5
|
* turn on it if you don't need to see profile in browser.
|
|
@@ -9,15 +9,14 @@ export interface RsdoctorRspackPluginOptions {
|
|
|
9
9
|
/**
|
|
10
10
|
* the switch for the Rsdoctor features.
|
|
11
11
|
*/
|
|
12
|
-
features?: RsdoctorWebpackPluginOptions<[]>['features'];
|
|
12
|
+
features?: Plugin.RsdoctorWebpackPluginOptions<[]>['features'];
|
|
13
13
|
/**
|
|
14
14
|
* configuration of the interceptor for webpack loaders.
|
|
15
15
|
* @description worked when the `features.loader === true`.
|
|
16
16
|
*/
|
|
17
|
-
loaderInterceptorOptions?: RsdoctorWebpackPluginOptions<[
|
|
17
|
+
loaderInterceptorOptions?: Plugin.RsdoctorWebpackPluginOptions<[
|
|
18
18
|
]>['loaderInterceptorOptions'];
|
|
19
19
|
}
|
|
20
20
|
export interface RsdoctorRspackPluginInstance extends RspackPluginInstance {
|
|
21
21
|
readonly name: string;
|
|
22
22
|
}
|
|
23
|
-
//# sourceMappingURL=index.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,33 +1,40 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsdoctor/rspack-plugin",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.4-beta.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/web-infra-dev/rsdoctor",
|
|
7
7
|
"directory": "packages/rspack-plugin"
|
|
8
8
|
},
|
|
9
9
|
"license": "MIT",
|
|
10
|
-
"main": "dist/index.
|
|
10
|
+
"main": "dist/index.cjs",
|
|
11
11
|
"types": "dist/index.d.ts",
|
|
12
12
|
"files": [
|
|
13
13
|
"dist"
|
|
14
14
|
],
|
|
15
|
+
"exports": {
|
|
16
|
+
".": {
|
|
17
|
+
"types": "./dist/index.d.ts",
|
|
18
|
+
"import": "./dist/index.js",
|
|
19
|
+
"default": "./dist/index.cjs"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"type": "module",
|
|
15
23
|
"dependencies": {
|
|
16
|
-
"lodash": "^4.17.21",
|
|
17
|
-
"@rsdoctor/core": "1.2.
|
|
18
|
-
"@rsdoctor/sdk": "1.2.
|
|
19
|
-
"@rsdoctor/types": "1.2.
|
|
20
|
-
"@rsdoctor/utils": "1.2.
|
|
21
|
-
"@rsdoctor/graph": "1.2.
|
|
24
|
+
"lodash-es": "^4.17.21",
|
|
25
|
+
"@rsdoctor/core": "1.2.4-beta.0",
|
|
26
|
+
"@rsdoctor/sdk": "1.2.4-beta.0",
|
|
27
|
+
"@rsdoctor/types": "1.2.4-beta.0",
|
|
28
|
+
"@rsdoctor/utils": "1.2.4-beta.0",
|
|
29
|
+
"@rsdoctor/graph": "1.2.4-beta.0"
|
|
22
30
|
},
|
|
23
31
|
"devDependencies": {
|
|
24
|
-
"@
|
|
25
|
-
"@
|
|
26
|
-
"@types/lodash": "^4.17.20",
|
|
32
|
+
"@rspack/core": "1.5.1",
|
|
33
|
+
"@types/lodash-es": "^4.17.12",
|
|
27
34
|
"@types/node": "^22.8.1",
|
|
28
35
|
"@types/tapable": "2.2.7",
|
|
29
36
|
"tslib": "2.8.1",
|
|
30
|
-
"typescript": "^5.
|
|
37
|
+
"typescript": "^5.9.2"
|
|
31
38
|
},
|
|
32
39
|
"peerDependencies": {
|
|
33
40
|
"@rspack/core": "*"
|
package/dist/constants.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,SAAS,CAAC;AAEnC,eAAO,MAAM,aAAa,yBAAyB,CAAC;AAEpD,eAAO,MAAM,oBAAoB,EAAE,GAGlC,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,GAGjC,CAAC;AAEF,eAAO,MAAM,2BAA2B,cAAe,MAAM,KAAG,GAG9D,CAAC;AAEH,eAAO,MAAM,4BAA4B,cAAe,MAAM,KAAG,GAG/D,CAAC;AAEH,eAAO,MAAM,GAAG,KAA6B,CAAC"}
|
package/dist/constants.js
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __webpack_modules__ = {
|
|
3
|
-
"../package.json": function(module) {
|
|
4
|
-
module.exports = require("../package.json");
|
|
5
|
-
}
|
|
6
|
-
};
|
|
7
|
-
var __webpack_module_cache__ = {};
|
|
8
|
-
function __webpack_require__(moduleId) {
|
|
9
|
-
var cachedModule = __webpack_module_cache__[moduleId];
|
|
10
|
-
if (void 0 !== cachedModule) return cachedModule.exports;
|
|
11
|
-
var module = __webpack_module_cache__[moduleId] = {
|
|
12
|
-
exports: {}
|
|
13
|
-
};
|
|
14
|
-
__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
15
|
-
return module.exports;
|
|
16
|
-
}
|
|
17
|
-
(()=>{
|
|
18
|
-
__webpack_require__.d = (exports1, definition)=>{
|
|
19
|
-
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
20
|
-
enumerable: true,
|
|
21
|
-
get: definition[key]
|
|
22
|
-
});
|
|
23
|
-
};
|
|
24
|
-
})();
|
|
25
|
-
(()=>{
|
|
26
|
-
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
27
|
-
})();
|
|
28
|
-
(()=>{
|
|
29
|
-
__webpack_require__.r = (exports1)=>{
|
|
30
|
-
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
31
|
-
value: 'Module'
|
|
32
|
-
});
|
|
33
|
-
Object.defineProperty(exports1, '__esModule', {
|
|
34
|
-
value: true
|
|
35
|
-
});
|
|
36
|
-
};
|
|
37
|
-
})();
|
|
38
|
-
var __webpack_exports__ = {};
|
|
39
|
-
(()=>{
|
|
40
|
-
__webpack_require__.r(__webpack_exports__);
|
|
41
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
42
|
-
internalPluginTapPostOptions: ()=>internalPluginTapPostOptions,
|
|
43
|
-
internalPluginTapPreOptions: ()=>internalPluginTapPreOptions,
|
|
44
|
-
pkg: ()=>pkg,
|
|
45
|
-
pluginTapName: ()=>pluginTapName,
|
|
46
|
-
pluginTapPostOptions: ()=>pluginTapPostOptions,
|
|
47
|
-
pluginTapPreOptions: ()=>pluginTapPreOptions
|
|
48
|
-
});
|
|
49
|
-
const pluginTapName = 'RsdoctorRspackPlugin';
|
|
50
|
-
const pluginTapPostOptions = {
|
|
51
|
-
name: pluginTapName,
|
|
52
|
-
stage: 999
|
|
53
|
-
};
|
|
54
|
-
const pluginTapPreOptions = {
|
|
55
|
-
name: pluginTapName,
|
|
56
|
-
stage: -999
|
|
57
|
-
};
|
|
58
|
-
const internalPluginTapPreOptions = (namespace)=>({
|
|
59
|
-
name: `${pluginTapName}:${namespace}`,
|
|
60
|
-
stage: -998
|
|
61
|
-
});
|
|
62
|
-
const internalPluginTapPostOptions = (namespace)=>({
|
|
63
|
-
name: `${pluginTapName}:${namespace}`,
|
|
64
|
-
stage: 1000
|
|
65
|
-
});
|
|
66
|
-
const pkg = __webpack_require__("../package.json");
|
|
67
|
-
})();
|
|
68
|
-
exports.internalPluginTapPostOptions = __webpack_exports__.internalPluginTapPostOptions;
|
|
69
|
-
exports.internalPluginTapPreOptions = __webpack_exports__.internalPluginTapPreOptions;
|
|
70
|
-
exports.pkg = __webpack_exports__.pkg;
|
|
71
|
-
exports.pluginTapName = __webpack_exports__.pluginTapName;
|
|
72
|
-
exports.pluginTapPostOptions = __webpack_exports__.pluginTapPostOptions;
|
|
73
|
-
exports.pluginTapPreOptions = __webpack_exports__.pluginTapPreOptions;
|
|
74
|
-
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
75
|
-
"internalPluginTapPostOptions",
|
|
76
|
-
"internalPluginTapPreOptions",
|
|
77
|
-
"pkg",
|
|
78
|
-
"pluginTapName",
|
|
79
|
-
"pluginTapPostOptions",
|
|
80
|
-
"pluginTapPreOptions"
|
|
81
|
-
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
82
|
-
Object.defineProperty(exports, '__esModule', {
|
|
83
|
-
value: true
|
|
84
|
-
});
|
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC"}
|
package/dist/multiple.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"multiple.d.ts","sourceRoot":"","sources":["../src/multiple.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,gBAAgB,CAAC;AAEpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAEhD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAI7C,qBAAa,4BAA4B,CACvC,KAAK,SAAS,MAAM,CAAC,cAAc,EAAE,CACrC,SAAQ,oBAAoB,CAAC,KAAK,CAAC;IAEnC,OAAO,CAAC,UAAU,CAAwB;gBAE9B,OAAO,GAAE,6BAA6B,CAAC,KAAK,CAAM;IA+B9D,KAAK,CAAC,QAAQ,EAAE,QAAQ;CAQzB"}
|
package/dist/multiple.js
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __webpack_require__ = {};
|
|
3
|
-
(()=>{
|
|
4
|
-
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
-
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: definition[key]
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
})();
|
|
11
|
-
(()=>{
|
|
12
|
-
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
-
})();
|
|
14
|
-
(()=>{
|
|
15
|
-
__webpack_require__.r = (exports1)=>{
|
|
16
|
-
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
-
value: 'Module'
|
|
18
|
-
});
|
|
19
|
-
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
-
value: true
|
|
21
|
-
});
|
|
22
|
-
};
|
|
23
|
-
})();
|
|
24
|
-
var __webpack_exports__ = {};
|
|
25
|
-
__webpack_require__.r(__webpack_exports__);
|
|
26
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
-
RsdoctorRspackMultiplePlugin: ()=>RsdoctorRspackMultiplePlugin
|
|
28
|
-
});
|
|
29
|
-
const sdk_namespaceObject = require("@rsdoctor/sdk");
|
|
30
|
-
const external_plugin_js_namespaceObject = require("./plugin.js");
|
|
31
|
-
const plugins_namespaceObject = require("@rsdoctor/core/plugins");
|
|
32
|
-
function _define_property(obj, key, value) {
|
|
33
|
-
if (key in obj) Object.defineProperty(obj, key, {
|
|
34
|
-
value: value,
|
|
35
|
-
enumerable: true,
|
|
36
|
-
configurable: true,
|
|
37
|
-
writable: true
|
|
38
|
-
});
|
|
39
|
-
else obj[key] = value;
|
|
40
|
-
return obj;
|
|
41
|
-
}
|
|
42
|
-
let globalController;
|
|
43
|
-
class RsdoctorRspackMultiplePlugin extends external_plugin_js_namespaceObject.RsdoctorRspackPlugin {
|
|
44
|
-
apply(compiler) {
|
|
45
|
-
if ('dependencies' in compiler.options) this.sdk.dependencies = compiler.options.dependencies;
|
|
46
|
-
super.apply(compiler);
|
|
47
|
-
}
|
|
48
|
-
constructor(options = {}){
|
|
49
|
-
const controller = (()=>{
|
|
50
|
-
if (globalController) return globalController;
|
|
51
|
-
const controller = new sdk_namespaceObject.RsdoctorSDKController();
|
|
52
|
-
globalController = controller;
|
|
53
|
-
return controller;
|
|
54
|
-
})();
|
|
55
|
-
const normallizedOptions = (0, plugins_namespaceObject.normalizeUserConfig)(options);
|
|
56
|
-
const instance = controller.createSlave({
|
|
57
|
-
name: options.name || 'Builder',
|
|
58
|
-
stage: options.stage,
|
|
59
|
-
extraConfig: {
|
|
60
|
-
innerClientPath: normallizedOptions.innerClientPath,
|
|
61
|
-
printLog: normallizedOptions.printLog,
|
|
62
|
-
mode: normallizedOptions.mode ? normallizedOptions.mode : void 0,
|
|
63
|
-
brief: normallizedOptions.brief
|
|
64
|
-
},
|
|
65
|
-
type: normallizedOptions.output.reportCodeType
|
|
66
|
-
});
|
|
67
|
-
super({
|
|
68
|
-
...options,
|
|
69
|
-
sdkInstance: instance
|
|
70
|
-
}), _define_property(this, "controller", void 0);
|
|
71
|
-
this.controller = controller;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
exports.RsdoctorRspackMultiplePlugin = __webpack_exports__.RsdoctorRspackMultiplePlugin;
|
|
75
|
-
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
76
|
-
"RsdoctorRspackMultiplePlugin"
|
|
77
|
-
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
78
|
-
Object.defineProperty(exports, '__esModule', {
|
|
79
|
-
value: true
|
|
80
|
-
});
|
package/dist/plugin.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,kBAAkB,EAClB,WAAW,EACZ,MAAM,eAAe,CAAC;AAcvB,OAAO,KAAK,EACV,4BAA4B,EAC5B,2BAA2B,EAC3B,qCAAqC,EACtC,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAEL,MAAM,EAGN,MAAM,EACN,GAAG,EACJ,MAAM,iBAAiB,CAAC;AASzB,qBAAa,oBAAoB,CAAC,KAAK,SAAS,MAAM,CAAC,cAAc,EAAE,CACrE,YAAW,4BAA4B,CAAC,KAAK,CAAC;IAE9C,SAAgB,IAAI,0BAAiB;IAErC,SAAgB,GAAG,EAAE,WAAW,GAAG,kBAAkB,CAAC;IAEtD,SAAgB,gBAAgB,EAAE,OAAO,CAAC;IAEnC,cAAc,EAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAEzC,SAAS,CAAC,eAAe,UAAS;IAE3B,YAAY,EAAE,GAAG,CAAC,mBAAmB,CAAC;IAEtC,OAAO,EAAE,qCAAqC,CAAC,KAAK,CAAC,CAAC;IAEtD,eAAe,EAAE,OAAO,CAAC;gBAEpB,OAAO,CAAC,EAAE,2BAA2B,CAAC,KAAK,CAAC;IAiCxD,KAAK,CAAC,QAAQ,EAAE,OAAO,GAAG,OAAO;IAuGjC;;;;;OAKG;IACI,+BAA+B,CACpC,QAAQ,EAAE,MAAM,CAAC,gBAAgB,CAAC,QAAQ,CAAC;IAKtC,YAAY,aAAc,MAAM,CAAC,gBAAgB,CAAC,QAAQ,CAAC,KAAG,IAAI,CAOvE;IAEK,IAAI,aACC,MAAM,CAAC,gBAAgB,CAAC,QAAQ,CAAC,KAC1C,OAAO,CAAC,IAAI,CAAC,CAgDd;IAEK,eAAe,CAAC,QAAQ,EAAE,MAAM,CAAC,gBAAgB,CAAC,QAAQ,CAAC;CAoCnE"}
|
package/dist/plugin.js
DELETED
|
@@ -1,203 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __webpack_require__ = {};
|
|
3
|
-
(()=>{
|
|
4
|
-
__webpack_require__.n = (module)=>{
|
|
5
|
-
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
6
|
-
__webpack_require__.d(getter, {
|
|
7
|
-
a: getter
|
|
8
|
-
});
|
|
9
|
-
return getter;
|
|
10
|
-
};
|
|
11
|
-
})();
|
|
12
|
-
(()=>{
|
|
13
|
-
__webpack_require__.d = (exports1, definition)=>{
|
|
14
|
-
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
15
|
-
enumerable: true,
|
|
16
|
-
get: definition[key]
|
|
17
|
-
});
|
|
18
|
-
};
|
|
19
|
-
})();
|
|
20
|
-
(()=>{
|
|
21
|
-
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
22
|
-
})();
|
|
23
|
-
(()=>{
|
|
24
|
-
__webpack_require__.r = (exports1)=>{
|
|
25
|
-
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
26
|
-
value: 'Module'
|
|
27
|
-
});
|
|
28
|
-
Object.defineProperty(exports1, '__esModule', {
|
|
29
|
-
value: true
|
|
30
|
-
});
|
|
31
|
-
};
|
|
32
|
-
})();
|
|
33
|
-
var __webpack_exports__ = {};
|
|
34
|
-
__webpack_require__.r(__webpack_exports__);
|
|
35
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
36
|
-
RsdoctorRspackPlugin: ()=>RsdoctorRspackPlugin
|
|
37
|
-
});
|
|
38
|
-
const sdk_namespaceObject = require("@rsdoctor/sdk");
|
|
39
|
-
const plugins_namespaceObject = require("@rsdoctor/core/plugins");
|
|
40
|
-
const build_utils_namespaceObject = require("@rsdoctor/core/build-utils");
|
|
41
|
-
const types_namespaceObject = require("@rsdoctor/types");
|
|
42
|
-
const external_path_namespaceObject = require("path");
|
|
43
|
-
var external_path_default = /*#__PURE__*/ __webpack_require__.n(external_path_namespaceObject);
|
|
44
|
-
const external_constants_js_namespaceObject = require("./constants.js");
|
|
45
|
-
const external_lodash_namespaceObject = require("lodash");
|
|
46
|
-
const common_namespaceObject = require("@rsdoctor/utils/common");
|
|
47
|
-
const logger_namespaceObject = require("@rsdoctor/utils/logger");
|
|
48
|
-
const graph_namespaceObject = require("@rsdoctor/graph");
|
|
49
|
-
function _define_property(obj, key, value) {
|
|
50
|
-
if (key in obj) Object.defineProperty(obj, key, {
|
|
51
|
-
value: value,
|
|
52
|
-
enumerable: true,
|
|
53
|
-
configurable: true,
|
|
54
|
-
writable: true
|
|
55
|
-
});
|
|
56
|
-
else obj[key] = value;
|
|
57
|
-
return obj;
|
|
58
|
-
}
|
|
59
|
-
class RsdoctorRspackPlugin {
|
|
60
|
-
apply(compiler) {
|
|
61
|
-
(0, logger_namespaceObject.time)('RsdoctorRspackPlugin.apply');
|
|
62
|
-
try {
|
|
63
|
-
var _compiler_webpack_experiments;
|
|
64
|
-
if (!this._bootstrapTask) this._bootstrapTask = this.sdk.bootstrap();
|
|
65
|
-
if (compiler.options.name) this.sdk.setName(compiler.options.name);
|
|
66
|
-
(0, plugins_namespaceObject.setSDK)(this.sdk);
|
|
67
|
-
compiler.hooks.afterPlugins.tap(external_constants_js_namespaceObject.pluginTapPostOptions, this.afterPlugins.bind(this, compiler));
|
|
68
|
-
compiler.hooks.done.tapPromise({
|
|
69
|
-
...external_constants_js_namespaceObject.pluginTapPostOptions,
|
|
70
|
-
stage: external_constants_js_namespaceObject.pluginTapPostOptions.stage + 100
|
|
71
|
-
}, this.done.bind(this, compiler));
|
|
72
|
-
new plugins_namespaceObject.InternalSummaryPlugin(this).apply(compiler);
|
|
73
|
-
if (this.options.features.loader) {
|
|
74
|
-
new build_utils_namespaceObject.Loader.ProbeLoaderPlugin().apply(compiler);
|
|
75
|
-
this.sdk.addClientRoutes([
|
|
76
|
-
types_namespaceObject.Manifest.RsdoctorManifestClientRoutes.WebpackLoaders
|
|
77
|
-
]);
|
|
78
|
-
if (!common_namespaceObject.Loader.isVue(compiler)) new plugins_namespaceObject.InternalLoaderPlugin(this).apply(compiler);
|
|
79
|
-
}
|
|
80
|
-
if (this.options.features.plugins) new plugins_namespaceObject.InternalPluginsPlugin(this).apply(compiler);
|
|
81
|
-
if (this.options.features.bundle) {
|
|
82
|
-
new plugins_namespaceObject.InternalBundlePlugin(this).apply(compiler);
|
|
83
|
-
new plugins_namespaceObject.InternalBundleTagPlugin(this).apply(compiler);
|
|
84
|
-
}
|
|
85
|
-
if (this.options.features.resolver) logger_namespaceObject.logger.info(logger_namespaceObject.chalk.yellow('Rspack currently does not support Resolver capabilities.'));
|
|
86
|
-
new plugins_namespaceObject.InternalRulesPlugin(this).apply(compiler);
|
|
87
|
-
new plugins_namespaceObject.InternalErrorReporterPlugin(this).apply(compiler);
|
|
88
|
-
const RsdoctorRspackNativePlugin = null == (_compiler_webpack_experiments = compiler.webpack.experiments) ? void 0 : _compiler_webpack_experiments.RsdoctorPlugin;
|
|
89
|
-
if (RsdoctorRspackNativePlugin) {
|
|
90
|
-
var _this_options_experiments;
|
|
91
|
-
logger_namespaceObject.logger.debug('[RspackNativePlugin] Enabled');
|
|
92
|
-
const enableNativePlugin = null == (_this_options_experiments = this.options.experiments) ? void 0 : _this_options_experiments.enableNativePlugin;
|
|
93
|
-
new RsdoctorRspackNativePlugin({
|
|
94
|
-
moduleGraphFeatures: 'boolean' == typeof enableNativePlugin ? enableNativePlugin : (null == enableNativePlugin ? void 0 : enableNativePlugin.moduleGraph) || false,
|
|
95
|
-
chunkGraphFeatures: 'boolean' == typeof enableNativePlugin ? enableNativePlugin : (null == enableNativePlugin ? void 0 : enableNativePlugin.chunkGraph) || false,
|
|
96
|
-
sourceMapFeatures: {
|
|
97
|
-
cheap: false,
|
|
98
|
-
module: false
|
|
99
|
-
}
|
|
100
|
-
}).apply(compiler);
|
|
101
|
-
}
|
|
102
|
-
} finally{
|
|
103
|
-
(0, logger_namespaceObject.timeEnd)('RsdoctorRspackPlugin.apply');
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
ensureModulesChunksGraphApplied(compiler) {
|
|
107
|
-
(0, plugins_namespaceObject.ensureModulesChunksGraphFn)(compiler, this);
|
|
108
|
-
}
|
|
109
|
-
getRspackConfig(compiler) {
|
|
110
|
-
(0, logger_namespaceObject.time)('RsdoctorRspackPlugin.getRspackConfig');
|
|
111
|
-
try {
|
|
112
|
-
var _compiler_webpack, _compiler_webpack1;
|
|
113
|
-
if (compiler.isChild()) return;
|
|
114
|
-
const { plugins, infrastructureLogging, ...rest } = compiler.options;
|
|
115
|
-
const _rest = (0, external_lodash_namespaceObject.cloneDeep)(rest);
|
|
116
|
-
(0, plugins_namespaceObject.makeRulesSerializable)(_rest.module.defaultRules);
|
|
117
|
-
(0, plugins_namespaceObject.makeRulesSerializable)(_rest.module.rules);
|
|
118
|
-
const configuration = {
|
|
119
|
-
..._rest,
|
|
120
|
-
plugins: plugins.map((e)=>null == e ? void 0 : e.constructor.name)
|
|
121
|
-
};
|
|
122
|
-
const rspackVersion = null == (_compiler_webpack = compiler.webpack) ? void 0 : _compiler_webpack.rspackVersion;
|
|
123
|
-
const webpackVersion = null == (_compiler_webpack1 = compiler.webpack) ? void 0 : _compiler_webpack1.version;
|
|
124
|
-
this.sdk.reportConfiguration({
|
|
125
|
-
name: rspackVersion ? 'rspack' : 'webpack',
|
|
126
|
-
version: rspackVersion || webpackVersion || 'unknown',
|
|
127
|
-
config: configuration,
|
|
128
|
-
root: (0, sdk_namespaceObject.findRoot)() || ''
|
|
129
|
-
});
|
|
130
|
-
this.sdk.setOutputDir(external_path_default().resolve(this.options.output.reportDir || compiler.outputPath, `./${types_namespaceObject.Constants.RsdoctorOutputFolder}`));
|
|
131
|
-
} finally{
|
|
132
|
-
(0, logger_namespaceObject.timeEnd)('RsdoctorRspackPlugin.getRspackConfig');
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
constructor(options){
|
|
136
|
-
var _options_supports, _options_supports1;
|
|
137
|
-
_define_property(this, "name", external_constants_js_namespaceObject.pluginTapName);
|
|
138
|
-
_define_property(this, "sdk", void 0);
|
|
139
|
-
_define_property(this, "isRsdoctorPlugin", void 0);
|
|
140
|
-
_define_property(this, "_bootstrapTask", void 0);
|
|
141
|
-
_define_property(this, "browserIsOpened", false);
|
|
142
|
-
_define_property(this, "modulesGraph", void 0);
|
|
143
|
-
_define_property(this, "options", void 0);
|
|
144
|
-
_define_property(this, "outsideInstance", void 0);
|
|
145
|
-
_define_property(this, "afterPlugins", (compiler)=>{
|
|
146
|
-
(0, logger_namespaceObject.time)('RsdoctorRspackPlugin.afterPlugins');
|
|
147
|
-
try {
|
|
148
|
-
this.getRspackConfig(compiler);
|
|
149
|
-
} finally{
|
|
150
|
-
(0, logger_namespaceObject.timeEnd)('RsdoctorRspackPlugin.afterPlugins');
|
|
151
|
-
}
|
|
152
|
-
});
|
|
153
|
-
_define_property(this, "done", async (compiler)=>{
|
|
154
|
-
(0, logger_namespaceObject.time)('RsdoctorRspackPlugin.done');
|
|
155
|
-
try {
|
|
156
|
-
await this.sdk.bootstrap();
|
|
157
|
-
this.sdk.addClientRoutes([
|
|
158
|
-
types_namespaceObject.Manifest.RsdoctorManifestClientRoutes.Overall
|
|
159
|
-
]);
|
|
160
|
-
if (this.outsideInstance && 'parent' in this.sdk) this.sdk.parent.master.setOutputDir(external_path_default().resolve(this.options.output.reportDir || compiler.outputPath, `./${types_namespaceObject.Constants.RsdoctorOutputFolder}`));
|
|
161
|
-
this.sdk.setOutputDir(external_path_default().resolve(this.options.output.reportDir || compiler.outputPath, `./${types_namespaceObject.Constants.RsdoctorOutputFolder}`));
|
|
162
|
-
await this.sdk.writeStore();
|
|
163
|
-
if (!this.options.disableClientServer) if (this.options.mode === types_namespaceObject.SDK.IMode[types_namespaceObject.SDK.IMode.brief]) {
|
|
164
|
-
const outputFilePath = external_path_default().resolve(this.sdk.outputDir, this.options.brief.reportHtmlName || 'rsdoctor-report.html');
|
|
165
|
-
console.log(`${logger_namespaceObject.chalk.green('[RSDOCTOR] generated brief report')}: ${outputFilePath}`);
|
|
166
|
-
(0, sdk_namespaceObject.openBrowser)(`file:///${outputFilePath}`);
|
|
167
|
-
} else await this.sdk.server.openClientPage('homepage');
|
|
168
|
-
if (this.options.disableClientServer) await this.sdk.dispose();
|
|
169
|
-
} finally{
|
|
170
|
-
(0, logger_namespaceObject.timeEnd)('RsdoctorRspackPlugin.done');
|
|
171
|
-
}
|
|
172
|
-
});
|
|
173
|
-
this.options = (0, plugins_namespaceObject.normalizeRspackUserOptions)(Object.assign(options || {}, {
|
|
174
|
-
supports: {
|
|
175
|
-
...null == options ? void 0 : options.supports,
|
|
176
|
-
generateTileGraph: (null == options ? void 0 : null == (_options_supports = options.supports) ? void 0 : _options_supports.generateTileGraph) ? null == options ? void 0 : null == (_options_supports1 = options.supports) ? void 0 : _options_supports1.generateTileGraph : false
|
|
177
|
-
}
|
|
178
|
-
}));
|
|
179
|
-
this.sdk = this.options.sdkInstance ?? new sdk_namespaceObject.RsdoctorSDK({
|
|
180
|
-
port: this.options.port,
|
|
181
|
-
name: external_constants_js_namespaceObject.pluginTapName,
|
|
182
|
-
root: process.cwd(),
|
|
183
|
-
type: this.options.output.reportCodeType,
|
|
184
|
-
config: {
|
|
185
|
-
innerClientPath: this.options.innerClientPath,
|
|
186
|
-
printLog: this.options.printLog,
|
|
187
|
-
mode: this.options.mode ? this.options.mode : void 0,
|
|
188
|
-
brief: this.options.brief,
|
|
189
|
-
compressData: this.options.output.compressData
|
|
190
|
-
}
|
|
191
|
-
});
|
|
192
|
-
this.outsideInstance = Boolean(this.options.sdkInstance);
|
|
193
|
-
this.modulesGraph = new graph_namespaceObject.ModuleGraph();
|
|
194
|
-
this.isRsdoctorPlugin = true;
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
exports.RsdoctorRspackPlugin = __webpack_exports__.RsdoctorRspackPlugin;
|
|
198
|
-
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
199
|
-
"RsdoctorRspackPlugin"
|
|
200
|
-
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
201
|
-
Object.defineProperty(exports, '__esModule', {
|
|
202
|
-
value: true
|
|
203
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAC;AAEzE,MAAM,WAAW,2BAA2B;IAC1C;;;OAGG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B;;OAEG;IACH,QAAQ,CAAC,EAAE,4BAA4B,CAAC,EAAE,CAAC,CAAC,UAAU,CAAC,CAAC;IACxD;;;OAGG;IACH,wBAAwB,CAAC,EAAE,4BAA4B,CACrD;KAAE,CACH,CAAC,0BAA0B,CAAC,CAAC;CAC/B;AAED,MAAM,WAAW,4BACf,SAAQ,oBAAoB;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB"}
|
package/dist/types/index.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __webpack_require__ = {};
|
|
3
|
-
(()=>{
|
|
4
|
-
__webpack_require__.r = (exports1)=>{
|
|
5
|
-
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
6
|
-
value: 'Module'
|
|
7
|
-
});
|
|
8
|
-
Object.defineProperty(exports1, '__esModule', {
|
|
9
|
-
value: true
|
|
10
|
-
});
|
|
11
|
-
};
|
|
12
|
-
})();
|
|
13
|
-
var __webpack_exports__ = {};
|
|
14
|
-
__webpack_require__.r(__webpack_exports__);
|
|
15
|
-
for(var __webpack_i__ in __webpack_exports__)exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
16
|
-
Object.defineProperty(exports, '__esModule', {
|
|
17
|
-
value: true
|
|
18
|
-
});
|