@rsdoctor/core 0.4.2 → 0.4.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/build-utils/build/utils/loader.d.ts +3 -1
- package/dist/build-utils/build/utils/loader.d.ts.map +1 -1
- package/dist/build-utils/build/utils/loader.js +11 -11
- package/dist/inner-plugins/plugins/bundleTagPlugin.d.ts.map +1 -1
- package/dist/inner-plugins/plugins/bundleTagPlugin.js +4 -5
- package/dist/inner-plugins/utils/config.d.ts.map +1 -1
- package/dist/inner-plugins/utils/config.js +5 -1
- package/dist/inner-plugins/utils/loader.d.ts.map +1 -1
- package/dist/inner-plugins/utils/loader.js +3 -4
- package/package.json +7 -11
|
@@ -10,11 +10,13 @@ export declare function loadLoaderModule(loaderPath: string, cwd?: string): {
|
|
|
10
10
|
pitch: Plugin.PitchLoaderDefinitionFunction;
|
|
11
11
|
raw: boolean | void;
|
|
12
12
|
};
|
|
13
|
-
export declare function getLoaderOptions<T>(loaderContext: Plugin.LoaderContext<T>): T;
|
|
14
13
|
export declare function extractLoaderName(loaderPath: string, cwd?: string): string;
|
|
15
14
|
export declare function mapEachRules<T extends Plugin.BuildRuleSetRule>(rules: T[], callback: (rule: T) => T): T[];
|
|
16
15
|
export declare function isESMLoader(r: Plugin.BuildRuleSetRule): boolean;
|
|
17
16
|
export declare function getLoaderNameMatch(r: Plugin.BuildRuleSetRule, loaderName: string, strict?: boolean): boolean;
|
|
18
17
|
export declare function addProbeLoader2Rules<T extends Plugin.BuildRuleSetRule>(rules: T[], appendRules: (rule: T, index: number) => T, fn: (r: Plugin.BuildRuleSetRule) => boolean): T[];
|
|
19
18
|
export declare function createLoaderContextTrap(this: Plugin.LoaderContext<Common.PlainObject>, final: (err: Error | null | undefined, res: string | Buffer | null, sourceMap?: WebpackSourceMapInput) => void): Plugin.LoaderContext<Common.PlainObject<any>>;
|
|
19
|
+
export declare function parseQuery(query: string): {
|
|
20
|
+
[k: string]: string;
|
|
21
|
+
};
|
|
20
22
|
//# sourceMappingURL=loader.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../../../src/build-utils/build/utils/loader.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../../../src/build-utils/build/utils/loader.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAQ,cAAc,IAAI,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAQ/E,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,GAAG;IACnD,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;CAClB,CAOA;AAED,wBAAgB,gBAAgB,CAC9B,UAAU,EAAE,MAAM,EAClB,GAAG,SAAgB,GAClB;IACD,OAAO,EAAE,MAAM,CAAC,gBAAgB,CAAC,MAAM,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;IACzD,KAAK,EAAE,MAAM,CAAC,6BAA6B,CAAC;IAC5C,GAAG,EAAE,OAAO,GAAG,IAAI,CAAC;CACrB,CAiBA;AAED,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,SAAK,GAAG,MAAM,CAqBtE;AAED,wBAAgB,YAAY,CAAC,CAAC,SAAS,MAAM,CAAC,gBAAgB,EAC5D,KAAK,EAAE,CAAC,EAAE,EACV,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GACvB,CAAC,EAAE,CAgFL;AAED,wBAAgB,WAAW,CAAC,CAAC,EAAE,MAAM,CAAC,gBAAgB,WA2BrD;AAED,wBAAgB,kBAAkB,CAChC,CAAC,EAAE,MAAM,CAAC,gBAAgB,EAC1B,UAAU,EAAE,MAAM,EAClB,MAAM,UAAO,WAiBd;AAGD,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,MAAM,CAAC,gBAAgB,EACpE,KAAK,EAAE,CAAC,EAAE,EACV,WAAW,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,KAAK,CAAC,EAC1C,EAAE,EAAE,CAAC,CAAC,EAAE,MAAM,CAAC,gBAAgB,KAAK,OAAO,GAC1C,CAAC,EAAE,CAsDL;AAED,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,WAAW,CAAC,EAC9C,KAAK,EAAE,CACL,GAAG,EAAE,KAAK,GAAG,IAAI,GAAG,SAAS,EAC7B,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,EAC3B,SAAS,CAAC,EAAE,qBAAqB,KAC9B,IAAI,iDAsFV;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM;;EAMvC"}
|
|
@@ -32,14 +32,13 @@ __export(loader_exports, {
|
|
|
32
32
|
createLoaderContextTrap: () => createLoaderContextTrap,
|
|
33
33
|
extractLoaderName: () => extractLoaderName,
|
|
34
34
|
getLoaderNameMatch: () => getLoaderNameMatch,
|
|
35
|
-
getLoaderOptions: () => getLoaderOptions,
|
|
36
35
|
isESMLoader: () => isESMLoader,
|
|
37
36
|
loadLoaderModule: () => loadLoaderModule,
|
|
38
37
|
mapEachRules: () => mapEachRules,
|
|
39
|
-
parsePathQueryFragment: () => parsePathQueryFragment
|
|
38
|
+
parsePathQueryFragment: () => parsePathQueryFragment,
|
|
39
|
+
parseQuery: () => parseQuery
|
|
40
40
|
});
|
|
41
41
|
module.exports = __toCommonJS(loader_exports);
|
|
42
|
-
var import_loader_utils = require("loader-utils");
|
|
43
42
|
var import_path = __toESM(require("path"));
|
|
44
43
|
var import_fs_extra = __toESM(require("fs-extra"));
|
|
45
44
|
var import_lodash = require("lodash");
|
|
@@ -66,12 +65,6 @@ function loadLoaderModule(loaderPath, cwd = process.cwd()) {
|
|
|
66
65
|
raw: mod.default?.raw || mod.raw || false
|
|
67
66
|
};
|
|
68
67
|
}
|
|
69
|
-
function getLoaderOptions(loaderContext) {
|
|
70
|
-
if (typeof loaderContext.getOptions === "function") {
|
|
71
|
-
return loaderContext.getOptions();
|
|
72
|
-
}
|
|
73
|
-
return (0, import_loader_utils.getOptions)(loaderContext);
|
|
74
|
-
}
|
|
75
68
|
function extractLoaderName(loaderPath, cwd = "") {
|
|
76
69
|
let res = loaderPath.replace(cwd, "");
|
|
77
70
|
if (!import_path.default.isAbsolute(res))
|
|
@@ -297,15 +290,22 @@ function createLoaderContextTrap(final) {
|
|
|
297
290
|
});
|
|
298
291
|
return trap;
|
|
299
292
|
}
|
|
293
|
+
function parseQuery(query) {
|
|
294
|
+
if (query.startsWith("?")) {
|
|
295
|
+
query = query.slice(1);
|
|
296
|
+
}
|
|
297
|
+
const searchParams = new URLSearchParams(query);
|
|
298
|
+
return Object.fromEntries(searchParams.entries());
|
|
299
|
+
}
|
|
300
300
|
// Annotate the CommonJS export names for ESM import in node:
|
|
301
301
|
0 && (module.exports = {
|
|
302
302
|
addProbeLoader2Rules,
|
|
303
303
|
createLoaderContextTrap,
|
|
304
304
|
extractLoaderName,
|
|
305
305
|
getLoaderNameMatch,
|
|
306
|
-
getLoaderOptions,
|
|
307
306
|
isESMLoader,
|
|
308
307
|
loadLoaderModule,
|
|
309
308
|
mapEachRules,
|
|
310
|
-
parsePathQueryFragment
|
|
309
|
+
parsePathQueryFragment,
|
|
310
|
+
parseQuery
|
|
311
311
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bundleTagPlugin.d.ts","sourceRoot":"","sources":["../../../src/inner-plugins/plugins/bundleTagPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"bundleTagPlugin.d.ts","sourceRoot":"","sources":["../../../src/inner-plugins/plugins/bundleTagPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAEzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AAG5C,qBAAa,uBAAuB,CAClC,CAAC,SAAS,MAAM,CAAC,YAAY,CAC7B,SAAQ,kBAAkB,CAAC,CAAC,CAAC;IAC7B,SAAgB,IAAI,eAAe;IAE5B,KAAK,CAAC,QAAQ,EAAE,MAAM,CAAC,YAAY;CAuD3C"}
|
|
@@ -22,7 +22,6 @@ __export(bundleTagPlugin_exports, {
|
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(bundleTagPlugin_exports);
|
|
24
24
|
var import_path = require("path");
|
|
25
|
-
var import_webpack_sources = require("webpack-sources");
|
|
26
25
|
var import_base = require("./base");
|
|
27
26
|
var import_logger = require("@rsdoctor/utils/logger");
|
|
28
27
|
class InternalBundleTagPlugin extends import_base.InternalBasePlugin {
|
|
@@ -31,7 +30,7 @@ class InternalBundleTagPlugin extends import_base.InternalBasePlugin {
|
|
|
31
30
|
this.name = "bundleTag";
|
|
32
31
|
}
|
|
33
32
|
apply(compiler) {
|
|
34
|
-
const supportBannerPlugin =
|
|
33
|
+
const supportBannerPlugin = this.options.supports?.banner;
|
|
35
34
|
compiler.hooks.compilation.tap(
|
|
36
35
|
"RsdoctorTagBannerPlugin",
|
|
37
36
|
(compilation) => {
|
|
@@ -41,7 +40,7 @@ class InternalBundleTagPlugin extends import_base.InternalBasePlugin {
|
|
|
41
40
|
stage: -2e3
|
|
42
41
|
},
|
|
43
42
|
async () => {
|
|
44
|
-
if (!compilation.options.plugins.map((p) => p && p.constructor.name).includes("BannerPlugin")
|
|
43
|
+
if (!compilation.options.plugins.map((p) => p && p.constructor.name).includes("BannerPlugin") || supportBannerPlugin === false) {
|
|
45
44
|
return;
|
|
46
45
|
}
|
|
47
46
|
import_logger.logger.info(
|
|
@@ -55,11 +54,11 @@ class InternalBundleTagPlugin extends import_base.InternalBasePlugin {
|
|
|
55
54
|
if (!file || (0, import_path.extname)(file) !== ".js") {
|
|
56
55
|
continue;
|
|
57
56
|
}
|
|
57
|
+
const { ConcatSource } = compiler.webpack.sources;
|
|
58
58
|
compilation.updateAsset(
|
|
59
59
|
file,
|
|
60
|
-
// @ts-ignore
|
|
61
60
|
(old) => {
|
|
62
|
-
const concatSource = new
|
|
61
|
+
const concatSource = new ConcatSource();
|
|
63
62
|
let header = "\n console.log('RSDOCTOR_START::');\n";
|
|
64
63
|
let footer = "\n console.log('RSDOCTOR_END::');\n";
|
|
65
64
|
concatSource.add(header);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/inner-plugins/utils/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAE9D,OAAO,KAAK,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,EAC/B,eAAe,EAChB,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,
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/inner-plugins/utils/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAE9D,OAAO,KAAK,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,EAC/B,eAAe,EAChB,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,CAiGxC;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;AAED,eAAO,MAAM,mBAAmB,mBACd,eAAe,QACzB,MAAM,OAAO,GAAG,CAAC,KAAK,KAC3B,GAAG,CAAC,UAuBN,CAAC"}
|
|
@@ -55,7 +55,11 @@ function normalizeUserConfig(config = {}) {
|
|
|
55
55
|
},
|
|
56
56
|
disableTOSUpload = false,
|
|
57
57
|
innerClientPath = "",
|
|
58
|
-
supports = {
|
|
58
|
+
supports = {
|
|
59
|
+
parseBundle: true,
|
|
60
|
+
banner: void 0,
|
|
61
|
+
generateTileGraph: true
|
|
62
|
+
},
|
|
59
63
|
port,
|
|
60
64
|
printLog = { serverUrls: true },
|
|
61
65
|
mode = "normal",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../../src/inner-plugins/utils/loader.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../../src/inner-plugins/utils/loader.ts"],"names":[],"mappings":"AAWA,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;AAGjE,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,CAsDL;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"}
|
|
@@ -39,7 +39,6 @@ module.exports = __toCommonJS(loader_exports);
|
|
|
39
39
|
var import_axios = __toESM(require("axios"));
|
|
40
40
|
var import_enhanced_resolve = require("enhanced-resolve");
|
|
41
41
|
var import_fs = __toESM(require("fs"));
|
|
42
|
-
var import_loader_utils = require("loader-utils");
|
|
43
42
|
var import_lodash = require("lodash");
|
|
44
43
|
var import_path = __toESM(require("path"));
|
|
45
44
|
var import_logger = require("@rsdoctor/utils/logger");
|
|
@@ -52,11 +51,11 @@ var import_circleDetect = require("./circleDetect");
|
|
|
52
51
|
var import_build = require("../../build-utils/build");
|
|
53
52
|
var import_utils = require("../../build-utils/build/utils");
|
|
54
53
|
function getInternalLoaderOptions(loaderContext) {
|
|
55
|
-
const options =
|
|
54
|
+
const options = loaderContext.getOptions();
|
|
56
55
|
return options[import_common.Loader.LoaderInternalPropertyName];
|
|
57
56
|
}
|
|
58
57
|
function getLoaderOptionsWithoutInternalKeys(loaderContext) {
|
|
59
|
-
const options =
|
|
58
|
+
const options = loaderContext.getOptions();
|
|
60
59
|
const circlePaths = [];
|
|
61
60
|
const loaderOptions = (0, import_lodash.omit)(options, [import_common.Loader.LoaderInternalPropertyName]);
|
|
62
61
|
(0, import_circleDetect.checkCirclePath)(loaderOptions, [], circlePaths, 0);
|
|
@@ -133,7 +132,7 @@ async function reportLoader(ctx, start, startHRTime, isPitch, sync, code, err, r
|
|
|
133
132
|
{
|
|
134
133
|
resource: {
|
|
135
134
|
path: ctx.resourcePath,
|
|
136
|
-
query: (0,
|
|
135
|
+
query: (0, import_utils.parseQuery)(ctx.resourceQuery || "?"),
|
|
137
136
|
queryRaw: ctx.resourceQuery,
|
|
138
137
|
ext: import_path.default.extname(ctx.resourcePath).slice(1)
|
|
139
138
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsdoctor/core",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.4",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/web-infra-dev/rsdoctor",
|
|
@@ -64,35 +64,31 @@
|
|
|
64
64
|
"dependencies": {
|
|
65
65
|
"axios": "^1.7.2",
|
|
66
66
|
"enhanced-resolve": "5.12.0",
|
|
67
|
-
"filesize": "^10.1.
|
|
67
|
+
"filesize": "^10.1.6",
|
|
68
68
|
"fs-extra": "^11.1.1",
|
|
69
|
-
"loader-utils": "^2.0.4",
|
|
70
69
|
"lodash": "^4.17.21",
|
|
71
70
|
"path-browserify": "1.0.1",
|
|
72
71
|
"semver": "^7.6.3",
|
|
73
72
|
"source-map": "^0.7.4",
|
|
74
73
|
"webpack-bundle-analyzer": "^4.10.2",
|
|
75
|
-
"
|
|
76
|
-
"@rsdoctor/
|
|
77
|
-
"@rsdoctor/
|
|
78
|
-
"@rsdoctor/
|
|
79
|
-
"@rsdoctor/utils": "0.4.2"
|
|
74
|
+
"@rsdoctor/graph": "0.4.4",
|
|
75
|
+
"@rsdoctor/sdk": "0.4.4",
|
|
76
|
+
"@rsdoctor/types": "0.4.4",
|
|
77
|
+
"@rsdoctor/utils": "0.4.4"
|
|
80
78
|
},
|
|
81
79
|
"devDependencies": {
|
|
82
80
|
"@rspack/core": "0.7.5",
|
|
83
81
|
"@types/fs-extra": "^11.0.4",
|
|
84
|
-
"@types/loader-utils": "^2.0.6",
|
|
85
82
|
"@types/lodash": "^4.17.7",
|
|
86
83
|
"@types/node": "^16",
|
|
87
84
|
"@types/node-fetch": "^2.6.11",
|
|
88
85
|
"@types/path-browserify": "1.0.3",
|
|
89
86
|
"@types/semver": "^7.5.8",
|
|
90
87
|
"@types/tapable": "2.2.7",
|
|
91
|
-
"@types/webpack-sources": "^3.2.3",
|
|
92
88
|
"babel-loader": "9.1.3",
|
|
93
89
|
"string-loader": "0.0.1",
|
|
94
90
|
"ts-loader": "^9.5.1",
|
|
95
|
-
"tslib": "2.
|
|
91
|
+
"tslib": "2.7.0",
|
|
96
92
|
"typescript": "^5.2.2",
|
|
97
93
|
"webpack": "^5.90.0",
|
|
98
94
|
"@scripts/test-helper": "0.1.1"
|