@rsdoctor/core 2.0.0-alpha.2 → 2.0.0-beta.1
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/26.js +220 -157
- package/dist/630.js +28 -17
- package/dist/630.js.LICENSE.txt +1 -1
- package/dist/build-utils/build/json.d.ts +1 -1
- package/dist/build-utils/build/loader/probeLoaderPlugin.d.ts +1 -0
- package/dist/build-utils/build/server.d.ts +1 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +405 -164
- package/dist/inner-plugins/plugins/bundle.d.ts +1 -1
- package/dist/inner-plugins/plugins/errors.d.ts +1 -0
- package/dist/inner-plugins/plugins/loader.d.ts +2 -0
- package/dist/inner-plugins/plugins/plugins.d.ts +1 -1
- package/dist/inner-plugins/plugins/summary.d.ts +3 -2
- package/dist/inner-plugins/utils/config.d.ts +3 -1
- package/dist/inner-plugins/utils/normalize-config.d.ts +3 -8
- package/dist/inner-plugins/utils/ruleWarnings.d.ts +2 -0
- package/dist/inner-plugins/utils/sdk.d.ts +2 -1
- package/dist/proxy-loader.js +7 -3
- package/dist/rspack-plugin/index.d.ts +0 -1
- package/dist/rspack-plugin/plugin.d.ts +47 -17
- package/dist/rspack-plugin/session.d.ts +19 -0
- package/dist/rspack-plugin/writeStore.d.ts +2 -0
- package/dist/rule-utils/parser/utils.d.ts +3 -6
- package/dist/rules/rules/ecma-version-check/index.d.ts +1 -1
- package/dist/sdk/multiple/controller.d.ts +13 -2
- package/dist/sdk/multiple/primary.d.ts +14 -6
- package/dist/sdk/sdk/core.d.ts +3 -2
- package/dist/sdk/sdk/types.d.ts +1 -1
- package/dist/sdk/utils/index.d.ts +1 -0
- package/dist/sdk/utils/manifestSharding.d.ts +16 -0
- package/dist/types/loader.d.ts +5 -0
- package/dist/types/plugin.d.ts +0 -8
- package/package.json +27 -28
- package/dist/rspack-plugin/multiple.d.ts +0 -8
package/dist/630.js
CHANGED
|
@@ -26,22 +26,22 @@ __webpack_require__.r(utils_namespaceObject), __webpack_require__.d(utils_namesp
|
|
|
26
26
|
getIdentifierInPattern: ()=>getIdentifierInPattern,
|
|
27
27
|
isES5: ()=>isES5,
|
|
28
28
|
isES6: ()=>isES6,
|
|
29
|
-
|
|
29
|
+
isSameSyntax: ()=>function isSameSyntax(node1, node2) {
|
|
30
30
|
if (node1.type !== node2.type) return !1;
|
|
31
31
|
switch(node1.type){
|
|
32
32
|
case 'CallExpression':
|
|
33
|
-
return node1.arguments.length === node2.arguments.length && !!node1.optional == !!node2.optional &&
|
|
33
|
+
return node1.arguments.length === node2.arguments.length && !!node1.optional == !!node2.optional && isSameSyntax(node1.callee, node2.callee) && node1.arguments.every((node, i)=>isSameSyntax(node, node2.arguments[i]));
|
|
34
34
|
case 'MemberExpression':
|
|
35
|
-
return node1.computed === node2.computed && !!node1.optional == !!node2.optional &&
|
|
35
|
+
return node1.computed === node2.computed && !!node1.optional == !!node2.optional && isSameSyntax(node1.object, node2.object) && isSameSyntax(node1.property, node2.property);
|
|
36
36
|
case 'Identifier':
|
|
37
37
|
return node1.name === node2.name;
|
|
38
38
|
case 'Literal':
|
|
39
39
|
if (asserts.isSimpleLiteral(node1) && asserts.isSimpleLiteral(node2)) return node1.value === node2.value;
|
|
40
40
|
return node1.raw === node2.raw;
|
|
41
41
|
case 'ObjectExpression':
|
|
42
|
-
return node1.properties.length === node2.properties.length && node1.properties.every((prop, i)=>
|
|
42
|
+
return node1.properties.length === node2.properties.length && node1.properties.every((prop, i)=>isSameSyntax(prop, node2.properties[i]));
|
|
43
43
|
case 'Property':
|
|
44
|
-
return node1.computed === node2.computed && node1.kind === node2.kind && node1.method === node2.method &&
|
|
44
|
+
return node1.computed === node2.computed && node1.kind === node2.kind && node1.method === node2.method && isSameSyntax(node1.key, node2.key) && isSameSyntax(node1.value, node2.value);
|
|
45
45
|
default:
|
|
46
46
|
throw Error(`Unknown node type: ${node1.type}`);
|
|
47
47
|
}
|
|
@@ -398,21 +398,21 @@ var esm_JsonStreamStringify = function(_Readable) {
|
|
|
398
398
|
writable: !1
|
|
399
399
|
}), JsonStreamStringify;
|
|
400
400
|
}(Readable);
|
|
401
|
-
function stringify(json, replacer, space, cycle) {
|
|
401
|
+
function stringify(json, replacer, space, cycle, chunkSize = 419430400) {
|
|
402
402
|
let jsonList = [];
|
|
403
403
|
return json && 'object' == typeof json ? new Promise((resolve, reject)=>{
|
|
404
404
|
let stream = new esm_JsonStreamStringify(json, replacer, space, cycle), currentLength = 0, currentContent = '', batchProcessor = new Transform({
|
|
405
405
|
readableObjectMode: !0,
|
|
406
406
|
transform (chunk, _encoding, callback) {
|
|
407
407
|
chunk.toString().split('\\n').forEach((line)=>{
|
|
408
|
-
currentLength + line.length >
|
|
408
|
+
currentLength + line.length > chunkSize && (jsonList.push(currentContent), currentContent = '', currentLength = 0), line.length && (currentContent += line, currentLength += line.length);
|
|
409
409
|
}), callback();
|
|
410
410
|
}
|
|
411
411
|
});
|
|
412
412
|
stream.pipe(batchProcessor).on('data', (line)=>{
|
|
413
|
-
currentLength + line.length >
|
|
413
|
+
currentLength + line.length > chunkSize && (jsonList.push(currentContent), currentContent = '', currentLength = 0), line.length && (currentContent += line, currentLength += line.length);
|
|
414
414
|
}).on('end', ()=>{
|
|
415
|
-
|
|
415
|
+
currentContent.length > 0 && jsonList.push(currentContent), resolve(jsonList);
|
|
416
416
|
}).on('error', (err)=>reject(err));
|
|
417
417
|
}) : Promise.resolve(JSON.stringify(json, replacer, space));
|
|
418
418
|
}
|
|
@@ -601,7 +601,7 @@ function filesize(arg, { bits = !1, pad = !1, base = -1, round = 2, locale = "",
|
|
|
601
601
|
if (output === EXPONENT) return e;
|
|
602
602
|
e3 = e, symbolTable = STRINGS_symbol[actualStandard][bits ? "bits" : "bytes"], u = isDecimal && 1 === e3 ? bits ? "kbit" : "kB" : symbolTable[e3], result[1] = u;
|
|
603
603
|
var symbol, num1, e1, precision1, val1, e2, e3, e4, u1, e5 = e;
|
|
604
|
-
if (neg && (result[0] = -result[0]), symbols[result[1]] && (result[1] = symbols[result[1]]), numericValue = "string" == typeof result[0] ? parseFloat(result[0]) : result[0], result[0] = function(value, locale, localeOptions, separator, pad, round, roundingFunc) {
|
|
604
|
+
if (neg && (result[0] = "string" == typeof result[0] ? `-${result[0]}` : -result[0]), symbols[result[1]] && (result[1] = symbols[result[1]]), numericValue = "string" == typeof result[0] ? parseFloat(result[0]) : result[0], result[0] = function(value, locale, localeOptions, separator, pad, round, roundingFunc) {
|
|
605
605
|
let result = value, localePad = pad && round > 0 ? {
|
|
606
606
|
minimumFractionDigits: round,
|
|
607
607
|
maximumFractionDigits: round
|
|
@@ -1225,18 +1225,29 @@ function getModuleLocation(node) {
|
|
|
1225
1225
|
};
|
|
1226
1226
|
}
|
|
1227
1227
|
function setSDK(t) {
|
|
1228
|
-
|
|
1228
|
+
registerSDK(t, !0);
|
|
1229
1229
|
}
|
|
1230
|
-
function
|
|
1230
|
+
function registerSDK(t, asDefault = !1) {
|
|
1231
|
+
globalThis.__rsdoctor_sdks__ || (globalThis.__rsdoctor_sdks__ = []);
|
|
1232
|
+
let sameNameIndex = globalThis.__rsdoctor_sdks__.findIndex((sdk)=>sdk.name === t.name);
|
|
1233
|
+
sameNameIndex >= 0 ? globalThis.__rsdoctor_sdks__[sameNameIndex] = t : globalThis.__rsdoctor_sdks__.includes(t) || globalThis.__rsdoctor_sdks__.push(t), asDefault && (globalThis.__rsdoctor_sdk__ = t);
|
|
1234
|
+
}
|
|
1235
|
+
function findMatchingSDK(sdks, compilerId) {
|
|
1236
|
+
let exactMatch = sdks.find((item)=>item.name === compilerId || 'compilerPath' in item && item.compilerPath === compilerId);
|
|
1237
|
+
if (exactMatch) return exactMatch;
|
|
1238
|
+
let compilerName = compilerId.split('|', 1)[0];
|
|
1239
|
+
if (compilerName && compilerName !== compilerId) return sdks.find((item)=>item.name === compilerName);
|
|
1240
|
+
}
|
|
1241
|
+
function getSDK(compilerId) {
|
|
1231
1242
|
let sdks = globalThis.__rsdoctor_sdks__ || [], sdk = globalThis.__rsdoctor_sdk__;
|
|
1232
|
-
if (
|
|
1243
|
+
if (compilerId && (sdk = findMatchingSDK(sdks, compilerId) || sdk), sdk && compilerId && 'parent' in sdk) {
|
|
1233
1244
|
let parent = sdk.parent;
|
|
1234
|
-
return parent
|
|
1245
|
+
return parent && findMatchingSDK(parent.slaves, compilerId) || sdk;
|
|
1235
1246
|
}
|
|
1236
1247
|
return sdk;
|
|
1237
1248
|
}
|
|
1238
1249
|
export default function(...args) {
|
|
1239
|
-
let time = Date.now(), code = args[0], _options = this.getOptions(), sdk = getSDK(_options.builderName), loaderData = {
|
|
1250
|
+
let time = Date.now(), code = args[0], _options = this.getOptions(), compilation = this._compilation, sdk = getSDK(compilation?.compiler?.compilerPath || _options.builderName), targetLoaderIndex = 'start' === _options.type ? this.loaderIndex - 1 : this.loaderIndex + 1, loaderData = {
|
|
1240
1251
|
resource: {
|
|
1241
1252
|
path: this._module?.layer ? `${this.resourcePath}[${this._module.layer}]` : this.resourcePath,
|
|
1242
1253
|
query: parseQuery(this.resourceQuery),
|
|
@@ -1249,7 +1260,7 @@ export default function(...args) {
|
|
|
1249
1260
|
loaders: [
|
|
1250
1261
|
{
|
|
1251
1262
|
loader: _options.loader,
|
|
1252
|
-
loaderIndex:
|
|
1263
|
+
loaderIndex: targetLoaderIndex,
|
|
1253
1264
|
path: _options.loader,
|
|
1254
1265
|
input: 'start' === _options.type ? code : null,
|
|
1255
1266
|
result: 'end' === _options.type ? code : null,
|
|
@@ -1266,4 +1277,4 @@ export default function(...args) {
|
|
|
1266
1277
|
};
|
|
1267
1278
|
sdk?.reportLoaderStartOrEnd(loaderData), this.callback(null, ...args);
|
|
1268
1279
|
};
|
|
1269
|
-
export { addProbeLoader2Rules, color, createLoaderContextTrap, extractLoaderName, filesize, getDocument, getLoaderNameMatch, getSDK, interceptCompilationHooks, interceptCompilerHooks, isESMLoader, loadLoaderModule, logger_time, mapEachRules, parseBundle, parseQuery, parser, rsdoctorLogger as logger, setSDK, stringify, timeEnd };
|
|
1280
|
+
export { addProbeLoader2Rules, color, createLoaderContextTrap, extractLoaderName, filesize, getDocument, getLoaderNameMatch, getSDK, interceptCompilationHooks, interceptCompilerHooks, isESMLoader, loadLoaderModule, logger_time, mapEachRules, parseBundle, parseQuery, parser, registerSDK, rsdoctorLogger as logger, setSDK, stringify, timeEnd };
|
package/dist/630.js.LICENSE.txt
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { SDK } from '@rsdoctor/shared/types';
|
|
2
|
-
export declare function stringify<T, P = T extends undefined ? undefined : string>(json: T, replacer?: (this: any, key: string, value: any) => any, space?: string | number, cycle?: boolean): Promise<P>;
|
|
2
|
+
export declare function stringify<T, P = T extends undefined ? undefined : string>(json: T, replacer?: (this: any, key: string, value: any) => any, space?: string | number, cycle?: boolean, chunkSize?: number): Promise<P>;
|
|
3
3
|
export declare const readPackageJson: (file: string, readFile?: SDK.GetPackageFile) => SDK.PackageBasicData | undefined;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import connect from 'connect';
|
|
2
1
|
import http from 'http';
|
|
3
2
|
import { Thirdparty } from '@rsdoctor/shared/types';
|
|
4
3
|
export declare const defaultHost = "127.0.0.1";
|
|
@@ -6,7 +5,7 @@ export declare const defaultPort: number;
|
|
|
6
5
|
export declare function getPort(expectPort: number, host?: string): Promise<number>;
|
|
7
6
|
export declare const createGetPortSyncFunctionString: (expectPort: number, host?: string) => string;
|
|
8
7
|
export declare function getPortSync(expectPort: number, host?: string): number | never;
|
|
9
|
-
export declare function createApp(): connect.Server;
|
|
8
|
+
export declare function createApp(): Thirdparty.connect.Server;
|
|
10
9
|
export declare function createServer(port: number, host?: string): Promise<{
|
|
11
10
|
app: Thirdparty.connect.Server;
|
|
12
11
|
server: http.Server;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { logger } from './logger.js';
|
|
2
|
-
export {
|
|
2
|
+
export { RsdoctorRspackPlugin } from './rspack-plugin/index.js';
|
|
3
3
|
export { Linter, LinterType, Rule as LinterRule, defineRule, rules, } from './rules/index.js';
|
|
4
4
|
export { RsdoctorSDK, resolveClientDiffHtmlPath } from './sdk/index.js';
|
|
5
|
-
export type {
|
|
5
|
+
export type { RsdoctorRspackPluginOptions } from './types/index.js';
|