@rsdoctor/rspack-plugin 1.5.3-alpha.0 → 1.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/constants.d.ts +53 -1
- package/dist/index.cjs +135 -138
- package/dist/index.js +7 -15
- package/package.json +8 -8
package/dist/constants.d.ts
CHANGED
|
@@ -4,4 +4,56 @@ export declare const pluginTapPostOptions: Tap;
|
|
|
4
4
|
export declare const pluginTapPreOptions: Tap;
|
|
5
5
|
export declare const internalPluginTapPreOptions: (namespace: string) => Tap;
|
|
6
6
|
export declare const internalPluginTapPostOptions: (namespace: string) => Tap;
|
|
7
|
-
export declare const pkg:
|
|
7
|
+
export declare const pkg: {
|
|
8
|
+
name: string;
|
|
9
|
+
version: string;
|
|
10
|
+
repository: {
|
|
11
|
+
type: string;
|
|
12
|
+
url: string;
|
|
13
|
+
directory: string;
|
|
14
|
+
};
|
|
15
|
+
license: string;
|
|
16
|
+
main: string;
|
|
17
|
+
types: string;
|
|
18
|
+
files: string[];
|
|
19
|
+
exports: {
|
|
20
|
+
".": {
|
|
21
|
+
types: string;
|
|
22
|
+
import: string;
|
|
23
|
+
default: string;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
type: string;
|
|
27
|
+
scripts: {
|
|
28
|
+
dev: string;
|
|
29
|
+
start: string;
|
|
30
|
+
build: string;
|
|
31
|
+
test: string;
|
|
32
|
+
};
|
|
33
|
+
dependencies: {
|
|
34
|
+
"@rsdoctor/core": string;
|
|
35
|
+
"@rsdoctor/graph": string;
|
|
36
|
+
"@rsdoctor/sdk": string;
|
|
37
|
+
"@rsdoctor/types": string;
|
|
38
|
+
"@rsdoctor/utils": string;
|
|
39
|
+
};
|
|
40
|
+
devDependencies: {
|
|
41
|
+
"@rspack/core": string;
|
|
42
|
+
"@types/node": string;
|
|
43
|
+
"@types/tapable": string;
|
|
44
|
+
tslib: string;
|
|
45
|
+
typescript: string;
|
|
46
|
+
};
|
|
47
|
+
peerDependencies: {
|
|
48
|
+
"@rspack/core": string;
|
|
49
|
+
};
|
|
50
|
+
peerDependenciesMeta: {
|
|
51
|
+
"@rspack/core": {
|
|
52
|
+
optional: boolean;
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
publishConfig: {
|
|
56
|
+
access: string;
|
|
57
|
+
registry: string;
|
|
58
|
+
};
|
|
59
|
+
};
|
package/dist/index.cjs
CHANGED
|
@@ -1,18 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
let globalController;
|
|
2
3
|
const __rslib_import_meta_url__ = "u" < typeof document ? new (require('url'.replace('', ''))).URL('file:' + __filename).href : document.currentScript && document.currentScript.src || new URL('main.js', document.baseURI).href;
|
|
3
|
-
var
|
|
4
|
-
"./package.json" (module) {
|
|
5
|
-
module.exports = JSON.parse('{"name":"@rsdoctor/rspack-plugin","version":"1.5.3-alpha.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:*"},"devDependencies":{"@rspack/core":"1.7.4","@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
|
-
}
|
|
4
|
+
var __webpack_require__ = {};
|
|
16
5
|
__webpack_require__.n = (module)=>{
|
|
17
6
|
var getter = module && module.__esModule ? ()=>module.default : ()=>module;
|
|
18
7
|
return __webpack_require__.d(getter, {
|
|
@@ -31,139 +20,147 @@ __webpack_require__.n = (module)=>{
|
|
|
31
20
|
});
|
|
32
21
|
};
|
|
33
22
|
var __webpack_exports__ = {};
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
name
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
name: pluginTapName,
|
|
65
|
-
root: process.cwd(),
|
|
66
|
-
type: output.reportCodeType,
|
|
67
|
-
config: {
|
|
68
|
-
innerClientPath,
|
|
69
|
-
printLog,
|
|
70
|
-
mode: output.mode ? output.mode : void 0,
|
|
71
|
-
brief: output.mode === types_namespaceObject.SDK.IMode[types_namespaceObject.SDK.IMode.brief] && output.options || void 0
|
|
72
|
-
}
|
|
73
|
-
}), this.outsideInstance = !!sdkInstance, this.modulesGraph = new graph_namespaceObject.ModuleGraph(), this.isRsdoctorPlugin = !0;
|
|
74
|
-
}
|
|
75
|
-
apply(compiler) {
|
|
76
|
-
(0, logger_namespaceObject.time)('RsdoctorRspackPlugin.apply');
|
|
77
|
-
try {
|
|
78
|
-
hasGreeted || compiler.isChild() || (hasGreeted = !0, logger_namespaceObject.logger.greet(`
|
|
79
|
-
\nRsdoctor v${pkg.version}\n`)), 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({
|
|
80
|
-
...pluginTapPostOptions,
|
|
81
|
-
stage: pluginTapPostOptions.stage + 100
|
|
82
|
-
}, 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([
|
|
83
|
-
types_namespaceObject.Manifest.RsdoctorManifestClientRoutes.WebpackLoaders
|
|
84
|
-
]), 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 && new plugins_namespaceObject.InternalResolverPlugin(this).apply(compiler), new plugins_namespaceObject.InternalRulesPlugin(this).apply(compiler), new plugins_namespaceObject.InternalErrorReporterPlugin(this).apply(compiler);
|
|
85
|
-
let RsdoctorRspackNativePlugin = compiler.webpack.experiments?.RsdoctorPlugin;
|
|
86
|
-
if (RsdoctorRspackNativePlugin) {
|
|
87
|
-
logger_namespaceObject.logger.debug('[RspackNativePlugin] Enabled');
|
|
88
|
-
let enableNativePlugin = this.options.experiments?.enableNativePlugin;
|
|
89
|
-
new RsdoctorRspackNativePlugin({
|
|
90
|
-
moduleGraphFeatures: enableNativePlugin?.moduleGraph ?? !0,
|
|
91
|
-
chunkGraphFeatures: enableNativePlugin?.chunkGraph ?? !0,
|
|
92
|
-
sourceMapFeatures: {
|
|
93
|
-
cheap: !1,
|
|
94
|
-
module: !1
|
|
95
|
-
}
|
|
96
|
-
}).apply(compiler);
|
|
97
|
-
}
|
|
98
|
-
} finally{
|
|
99
|
-
(0, logger_namespaceObject.timeEnd)('RsdoctorRspackPlugin.apply');
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
ensureModulesChunksGraphApplied(compiler) {
|
|
103
|
-
(0, plugins_namespaceObject.ensureModulesChunksGraphFn)(compiler, this);
|
|
104
|
-
}
|
|
105
|
-
afterPlugins = (compiler)=>{
|
|
106
|
-
(0, logger_namespaceObject.time)('RsdoctorRspackPlugin.afterPlugins');
|
|
107
|
-
try {
|
|
108
|
-
this.getRspackConfig(compiler);
|
|
109
|
-
} finally{
|
|
110
|
-
(0, logger_namespaceObject.timeEnd)('RsdoctorRspackPlugin.afterPlugins');
|
|
23
|
+
__webpack_require__.r(__webpack_exports__), __webpack_require__.d(__webpack_exports__, {
|
|
24
|
+
RsdoctorRspackMultiplePlugin: ()=>RsdoctorRspackMultiplePlugin,
|
|
25
|
+
RsdoctorRspackPlugin: ()=>RsdoctorRspackPlugin
|
|
26
|
+
});
|
|
27
|
+
const 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");
|
|
28
|
+
var external_path_default = __webpack_require__.n(external_path_namespaceObject), package_namespaceObject = JSON.parse('{"name":"@rsdoctor/rspack-plugin","version":"1.5.4","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:*"},"devDependencies":{"@rspack/core":"2.0.0-canary-20260116","@types/node":"^22.8.1","@types/tapable":"2.3.0","tslib":"2.8.1","typescript":"^5.9.2"},"peerDependencies":{"@rspack/core":"*"},"peerDependenciesMeta":{"@rspack/core":{"optional":true}},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"}}');
|
|
29
|
+
const pluginTapName = 'RsdoctorRspackPlugin', pluginTapPostOptions = {
|
|
30
|
+
name: pluginTapName,
|
|
31
|
+
stage: 999
|
|
32
|
+
}, pluginTapPreOptions = null, internalPluginTapPreOptions = (namespace)=>({
|
|
33
|
+
name: `${pluginTapName}:${namespace}`,
|
|
34
|
+
stage: -998
|
|
35
|
+
}), internalPluginTapPostOptions = (namespace)=>({
|
|
36
|
+
name: `${pluginTapName}:${namespace}`,
|
|
37
|
+
stage: 1000
|
|
38
|
+
}), pkg = package_namespaceObject, graph_namespaceObject = require("@rsdoctor/graph"), common_namespaceObject = require("@rsdoctor/utils/common"), logger_namespaceObject = require("@rsdoctor/utils/logger");
|
|
39
|
+
let hasGreeted = !1;
|
|
40
|
+
class RsdoctorRspackPlugin {
|
|
41
|
+
name = pluginTapName;
|
|
42
|
+
sdk;
|
|
43
|
+
isRsdoctorPlugin;
|
|
44
|
+
_bootstrapTask;
|
|
45
|
+
browserIsOpened = !1;
|
|
46
|
+
modulesGraph;
|
|
47
|
+
options;
|
|
48
|
+
outsideInstance;
|
|
49
|
+
constructor(options){
|
|
50
|
+
this.options = (0, plugins_namespaceObject.normalizeRspackUserOptions)(Object.assign(options || {}, {
|
|
51
|
+
supports: {
|
|
52
|
+
...options?.supports
|
|
111
53
|
}
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
54
|
+
}));
|
|
55
|
+
const { port, output, innerClientPath, printLog, sdkInstance } = this.options;
|
|
56
|
+
this.sdk = this.options.sdkInstance ?? new sdk_namespaceObject.RsdoctorSDK({
|
|
57
|
+
port,
|
|
58
|
+
name: pluginTapName,
|
|
59
|
+
root: process.cwd(),
|
|
60
|
+
type: output.reportCodeType,
|
|
61
|
+
config: {
|
|
62
|
+
innerClientPath,
|
|
63
|
+
printLog,
|
|
64
|
+
mode: output.mode ? output.mode : void 0,
|
|
65
|
+
brief: output.mode === types_namespaceObject.SDK.IMode[types_namespaceObject.SDK.IMode.brief] && output.options || void 0,
|
|
66
|
+
features: {
|
|
67
|
+
treeShaking: this.options.features.treeShaking
|
|
68
|
+
}
|
|
121
69
|
}
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
70
|
+
}), this.outsideInstance = !!sdkInstance, this.modulesGraph = new graph_namespaceObject.ModuleGraph(), this.isRsdoctorPlugin = !0;
|
|
71
|
+
}
|
|
72
|
+
apply(compiler) {
|
|
73
|
+
(0, logger_namespaceObject.time)('RsdoctorRspackPlugin.apply');
|
|
74
|
+
try {
|
|
75
|
+
hasGreeted || compiler.isChild() || (hasGreeted = !0, logger_namespaceObject.logger.greet(`
|
|
76
|
+
\nRsdoctor v${package_namespaceObject.version}\n`)), 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({
|
|
77
|
+
...pluginTapPostOptions,
|
|
78
|
+
stage: pluginTapPostOptions.stage + 100
|
|
79
|
+
}, 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([
|
|
80
|
+
types_namespaceObject.Manifest.RsdoctorManifestClientRoutes.WebpackLoaders
|
|
81
|
+
]), 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 && new plugins_namespaceObject.InternalResolverPlugin(this).apply(compiler), new plugins_namespaceObject.InternalRulesPlugin(this).apply(compiler), new plugins_namespaceObject.InternalErrorReporterPlugin(this).apply(compiler);
|
|
82
|
+
let RsdoctorRspackNativePlugin = compiler.webpack.experiments?.RsdoctorPlugin;
|
|
83
|
+
if (RsdoctorRspackNativePlugin) {
|
|
84
|
+
logger_namespaceObject.logger.debug('[RspackNativePlugin] Enabled');
|
|
85
|
+
let enableNativePlugin = this.options.experiments?.enableNativePlugin;
|
|
86
|
+
new RsdoctorRspackNativePlugin({
|
|
87
|
+
moduleGraphFeatures: enableNativePlugin?.moduleGraph ?? !0,
|
|
88
|
+
chunkGraphFeatures: enableNativePlugin?.chunkGraph ?? !0,
|
|
89
|
+
sourceMapFeatures: {
|
|
90
|
+
cheap: !1,
|
|
91
|
+
module: !1
|
|
92
|
+
}
|
|
93
|
+
}).apply(compiler);
|
|
136
94
|
}
|
|
95
|
+
} finally{
|
|
96
|
+
(0, logger_namespaceObject.timeEnd)('RsdoctorRspackPlugin.apply');
|
|
137
97
|
}
|
|
138
98
|
}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
...options,
|
|
159
|
-
sdkInstance: instance
|
|
160
|
-
}), this.controller = controller;
|
|
99
|
+
ensureModulesChunksGraphApplied(compiler) {
|
|
100
|
+
(0, plugins_namespaceObject.ensureModulesChunksGraphFn)(compiler, this);
|
|
101
|
+
}
|
|
102
|
+
afterPlugins = (compiler)=>{
|
|
103
|
+
(0, logger_namespaceObject.time)('RsdoctorRspackPlugin.afterPlugins');
|
|
104
|
+
try {
|
|
105
|
+
this.getRspackConfig(compiler);
|
|
106
|
+
} finally{
|
|
107
|
+
(0, logger_namespaceObject.timeEnd)('RsdoctorRspackPlugin.afterPlugins');
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
done = async (compiler)=>{
|
|
111
|
+
(0, logger_namespaceObject.time)('RsdoctorRspackPlugin.done');
|
|
112
|
+
try {
|
|
113
|
+
logger_namespaceObject.logger.debug('[RsdoctorRspackPlugin] bootstrap(start) in done()'), await this.sdk.bootstrap(), logger_namespaceObject.logger.debug('[RsdoctorRspackPlugin] bootstrap(end) in done()'), this.sdk.addClientRoutes([
|
|
114
|
+
types_namespaceObject.Manifest.RsdoctorManifestClientRoutes.Overall
|
|
115
|
+
]), this.outsideInstance && 'parent' in this.sdk && this.sdk.parent.master.setOutputDir(external_path_default().resolve(this.options.output.reportDir || compiler.outputPath, this.options.output.mode === types_namespaceObject.SDK.IMode[types_namespaceObject.SDK.IMode.brief] ? '' : `./${types_namespaceObject.Constants.RsdoctorOutputFolder}`)), this.sdk.setOutputDir(external_path_default().resolve(this.options.output.reportDir || compiler.outputPath, this.options.output.mode === types_namespaceObject.SDK.IMode[types_namespaceObject.SDK.IMode.brief] ? '' : `./${types_namespaceObject.Constants.RsdoctorOutputFolder}`)), await this.sdk.writeStore(), this.options.disableClientServer || (this.options.output.mode === types_namespaceObject.SDK.IMode[types_namespaceObject.SDK.IMode.brief] ? await (0, plugins_namespaceObject.handleBriefModeReport)(this.sdk, this.options, this.options.disableClientServer) : await this.sdk.server.openClientPage('homepage')), (this.options.disableClientServer || this.options.output.mode === types_namespaceObject.SDK.IMode[types_namespaceObject.SDK.IMode.brief] && Array.isArray(this.options.output.options?.type) && 1 === this.options.output.options.type.length && 'json' === this.options.output.options.type[0]) && await this.sdk.dispose();
|
|
116
|
+
} finally{
|
|
117
|
+
(0, logger_namespaceObject.timeEnd)('RsdoctorRspackPlugin.done');
|
|
161
118
|
}
|
|
162
|
-
|
|
163
|
-
|
|
119
|
+
};
|
|
120
|
+
getRspackConfig(compiler) {
|
|
121
|
+
(0, logger_namespaceObject.time)('RsdoctorRspackPlugin.getRspackConfig');
|
|
122
|
+
try {
|
|
123
|
+
if (compiler.isChild()) return;
|
|
124
|
+
let configuration = (0, plugins_namespaceObject.processCompilerConfig)(compiler.options), rspackVersion = compiler.webpack?.rspackVersion, webpackVersion = compiler.webpack?.version;
|
|
125
|
+
this.sdk.reportConfiguration({
|
|
126
|
+
name: rspackVersion ? 'rspack' : 'webpack',
|
|
127
|
+
version: rspackVersion || webpackVersion || 'unknown',
|
|
128
|
+
config: configuration,
|
|
129
|
+
root: (0, sdk_namespaceObject.findRoot)() || ''
|
|
130
|
+
});
|
|
131
|
+
} finally{
|
|
132
|
+
(0, logger_namespaceObject.timeEnd)('RsdoctorRspackPlugin.getRspackConfig');
|
|
164
133
|
}
|
|
165
134
|
}
|
|
166
|
-
}
|
|
135
|
+
}
|
|
136
|
+
class RsdoctorRspackMultiplePlugin extends RsdoctorRspackPlugin {
|
|
137
|
+
controller;
|
|
138
|
+
constructor(options = {}){
|
|
139
|
+
const controller = (()=>{
|
|
140
|
+
if (globalController) return globalController;
|
|
141
|
+
let controller = new sdk_namespaceObject.RsdoctorSDKController();
|
|
142
|
+
return globalController = controller, controller;
|
|
143
|
+
})(), normallizedOptions = (0, plugins_namespaceObject.normalizeUserConfig)(options), instance = controller.createSlave({
|
|
144
|
+
name: options.name || 'Builder',
|
|
145
|
+
stage: options.stage,
|
|
146
|
+
extraConfig: {
|
|
147
|
+
innerClientPath: normallizedOptions.innerClientPath,
|
|
148
|
+
printLog: normallizedOptions.printLog,
|
|
149
|
+
mode: normallizedOptions.output.mode ? normallizedOptions.output.mode : void 0,
|
|
150
|
+
brief: normallizedOptions.output.mode === types_namespaceObject.SDK.IMode[types_namespaceObject.SDK.IMode.brief] && normallizedOptions.output.options || void 0
|
|
151
|
+
},
|
|
152
|
+
type: normallizedOptions.output.reportCodeType
|
|
153
|
+
});
|
|
154
|
+
super({
|
|
155
|
+
...options,
|
|
156
|
+
sdkInstance: instance
|
|
157
|
+
}), this.controller = controller;
|
|
158
|
+
}
|
|
159
|
+
apply(compiler) {
|
|
160
|
+
'dependencies' in compiler.options && (this.sdk.dependencies = compiler.options.dependencies), super.apply(compiler);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
for(var __rspack_i in exports.RsdoctorRspackMultiplePlugin = __webpack_exports__.RsdoctorRspackMultiplePlugin, exports.RsdoctorRspackPlugin = __webpack_exports__.RsdoctorRspackPlugin, __webpack_exports__)-1 === [
|
|
167
164
|
"RsdoctorRspackMultiplePlugin",
|
|
168
165
|
"RsdoctorRspackPlugin"
|
|
169
166
|
].indexOf(__rspack_i) && (exports[__rspack_i] = __webpack_exports__[__rspack_i]);
|
package/dist/index.js
CHANGED
|
@@ -7,22 +7,11 @@ import path from "path";
|
|
|
7
7
|
import { ModuleGraph } from "@rsdoctor/graph";
|
|
8
8
|
import { Loader as common_Loader } from "@rsdoctor/utils/common";
|
|
9
9
|
import { logger, time, timeEnd } from "@rsdoctor/utils/logger";
|
|
10
|
-
var
|
|
11
|
-
"./package.json" (module) {
|
|
12
|
-
module.exports = JSON.parse('{"name":"@rsdoctor/rspack-plugin","version":"1.5.3-alpha.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:*"},"devDependencies":{"@rspack/core":"1.7.4","@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/"}}');
|
|
13
|
-
}
|
|
14
|
-
}, __webpack_module_cache__ = {};
|
|
10
|
+
var package_namespaceObject = JSON.parse('{"name":"@rsdoctor/rspack-plugin","version":"1.5.4","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:*"},"devDependencies":{"@rspack/core":"2.0.0-canary-20260116","@types/node":"^22.8.1","@types/tapable":"2.3.0","tslib":"2.8.1","typescript":"^5.9.2"},"peerDependencies":{"@rspack/core":"*"},"peerDependenciesMeta":{"@rspack/core":{"optional":true}},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"}}');
|
|
15
11
|
let pluginTapName = 'RsdoctorRspackPlugin', pluginTapPostOptions = {
|
|
16
12
|
name: pluginTapName,
|
|
17
13
|
stage: 999
|
|
18
|
-
},
|
|
19
|
-
var cachedModule = __webpack_module_cache__[moduleId];
|
|
20
|
-
if (void 0 !== cachedModule) return cachedModule.exports;
|
|
21
|
-
var module = __webpack_module_cache__[moduleId] = {
|
|
22
|
-
exports: {}
|
|
23
|
-
};
|
|
24
|
-
return __webpack_modules__[moduleId](module, module.exports, __webpack_require__), module.exports;
|
|
25
|
-
}("./package.json"), hasGreeted = !1;
|
|
14
|
+
}, hasGreeted = !1;
|
|
26
15
|
class RsdoctorRspackPlugin {
|
|
27
16
|
name = pluginTapName;
|
|
28
17
|
sdk;
|
|
@@ -48,7 +37,10 @@ class RsdoctorRspackPlugin {
|
|
|
48
37
|
innerClientPath,
|
|
49
38
|
printLog,
|
|
50
39
|
mode: output.mode ? output.mode : void 0,
|
|
51
|
-
brief: output.mode === SDK.IMode[SDK.IMode.brief] && output.options || void 0
|
|
40
|
+
brief: output.mode === SDK.IMode[SDK.IMode.brief] && output.options || void 0,
|
|
41
|
+
features: {
|
|
42
|
+
treeShaking: this.options.features.treeShaking
|
|
43
|
+
}
|
|
52
44
|
}
|
|
53
45
|
}), this.outsideInstance = !!sdkInstance, this.modulesGraph = new ModuleGraph(), this.isRsdoctorPlugin = !0;
|
|
54
46
|
}
|
|
@@ -56,7 +48,7 @@ class RsdoctorRspackPlugin {
|
|
|
56
48
|
time('RsdoctorRspackPlugin.apply');
|
|
57
49
|
try {
|
|
58
50
|
hasGreeted || compiler.isChild() || (hasGreeted = !0, logger.greet(`
|
|
59
|
-
\nRsdoctor v${
|
|
51
|
+
\nRsdoctor v${package_namespaceObject.version}\n`)), 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
52
|
...pluginTapPostOptions,
|
|
61
53
|
stage: pluginTapPostOptions.stage + 100
|
|
62
54
|
}, this.done.bind(this, compiler)), new InternalSummaryPlugin(this).apply(compiler), this.options.features.loader && (new Loader.ProbeLoaderPlugin().apply(compiler), this.sdk.addClientRoutes([
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsdoctor/rspack-plugin",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.4",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/web-infra-dev/rsdoctor",
|
|
@@ -21,16 +21,16 @@
|
|
|
21
21
|
},
|
|
22
22
|
"type": "module",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@rsdoctor/
|
|
25
|
-
"@rsdoctor/
|
|
26
|
-
"@rsdoctor/
|
|
27
|
-
"@rsdoctor/
|
|
28
|
-
"@rsdoctor/
|
|
24
|
+
"@rsdoctor/types": "1.5.4",
|
|
25
|
+
"@rsdoctor/core": "1.5.4",
|
|
26
|
+
"@rsdoctor/sdk": "1.5.4",
|
|
27
|
+
"@rsdoctor/utils": "1.5.4",
|
|
28
|
+
"@rsdoctor/graph": "1.5.4"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@rspack/core": "
|
|
31
|
+
"@rspack/core": "2.0.0-canary-20260116",
|
|
32
32
|
"@types/node": "^22.8.1",
|
|
33
|
-
"@types/tapable": "2.
|
|
33
|
+
"@types/tapable": "2.3.0",
|
|
34
34
|
"tslib": "2.8.1",
|
|
35
35
|
"typescript": "^5.9.2"
|
|
36
36
|
},
|