@rsdoctor/utils 1.3.1 → 1.3.3
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/file/index.d.ts +3 -3
- package/dist/build/index.d.ts +5 -5
- package/dist/build.cjs +27 -27
- package/dist/build.js +9 -12
- package/dist/common/graph/index.d.ts +5 -5
- package/dist/common/index.d.ts +19 -19
- package/dist/common.cjs +15 -15
- package/dist/common.js +18 -22
- package/dist/error/index.d.ts +2 -2
- package/dist/error/transform.d.ts +1 -1
- package/dist/error.cjs +4 -4
- package/dist/error.js +11 -12
- package/dist/logger.cjs +6 -6
- package/dist/logger.js +1 -1
- package/dist/rule-utils/document/document.d.ts +1 -1
- package/dist/rule-utils/document/index.d.ts +3 -3
- package/dist/rule-utils/document/server.d.ts +1 -1
- package/dist/rule-utils/index.d.ts +2 -2
- package/dist/rule-utils/parser/asserts.d.ts +1 -1
- package/dist/rule-utils/parser/index.d.ts +4 -4
- package/dist/rule-utils/parser/parser.d.ts +2 -2
- package/dist/rule-utils/parser/utils.d.ts +1 -1
- package/dist/ruleUtils.cjs +8 -6
- package/package.json +3 -3
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './sharding';
|
|
2
|
-
export * as fse from 'fs-extra
|
|
3
|
-
export * as cache from './cache';
|
|
1
|
+
export * from './sharding.js';
|
|
2
|
+
export * as fse from 'fs-extra';
|
|
3
|
+
export * as cache from './cache.js';
|
package/dist/build/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * as File from './file';
|
|
2
|
-
export * as Json from './json';
|
|
3
|
-
export * as Server from './server';
|
|
4
|
-
export * as EnvInfo from './envinfo';
|
|
5
|
-
export * as Process from './process';
|
|
1
|
+
export * as File from './file/index.js';
|
|
2
|
+
export * as Json from './json.js';
|
|
3
|
+
export * as Server from './server.js';
|
|
4
|
+
export * as EnvInfo from './envinfo.js';
|
|
5
|
+
export * as Process from './process.js';
|
package/dist/build.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
2
|
+
const __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
3
|
var __webpack_require__ = {};
|
|
4
4
|
__webpack_require__.n = (module)=>{
|
|
5
5
|
var getter = module && module.__esModule ? ()=>module.default : ()=>module;
|
|
@@ -37,7 +37,7 @@ var file_namespaceObject = {};
|
|
|
37
37
|
__webpack_require__.r(file_namespaceObject), __webpack_require__.d(file_namespaceObject, {
|
|
38
38
|
FileSharding: ()=>FileSharding,
|
|
39
39
|
cache: ()=>cache_namespaceObject,
|
|
40
|
-
fse: ()=>
|
|
40
|
+
fse: ()=>external_fs_extra_namespaceObject
|
|
41
41
|
});
|
|
42
42
|
var json_namespaceObject = {};
|
|
43
43
|
__webpack_require__.r(json_namespaceObject), __webpack_require__.d(json_namespaceObject, {
|
|
@@ -72,11 +72,11 @@ __webpack_require__.r(process_namespaceObject), __webpack_require__.d(process_na
|
|
|
72
72
|
getMemoryUsage: ()=>getMemoryUsage,
|
|
73
73
|
getMemoryUsageMessage: ()=>getMemoryUsageMessage
|
|
74
74
|
});
|
|
75
|
-
|
|
75
|
+
const external_fs_extra_namespaceObject = require("fs-extra");
|
|
76
76
|
var external_fs_extra_default = __webpack_require__.n(external_fs_extra_namespaceObject);
|
|
77
|
-
|
|
77
|
+
const external_fs_namespaceObject = require("fs");
|
|
78
78
|
var external_fs_default = __webpack_require__.n(external_fs_namespaceObject);
|
|
79
|
-
|
|
79
|
+
const external_path_namespaceObject = require("path");
|
|
80
80
|
var external_path_default = __webpack_require__.n(external_path_namespaceObject);
|
|
81
81
|
class FileSharding {
|
|
82
82
|
content;
|
|
@@ -103,9 +103,9 @@ class FileSharding {
|
|
|
103
103
|
}))), res;
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
|
-
|
|
106
|
+
const external_node_fs_namespaceObject = require("node:fs");
|
|
107
107
|
var external_node_fs_default = __webpack_require__.n(external_node_fs_namespaceObject);
|
|
108
|
-
|
|
108
|
+
const cache = new Map();
|
|
109
109
|
async function cache_readFile(path1) {
|
|
110
110
|
if (cache.has(path1)) return cache.get(path1);
|
|
111
111
|
let res = await external_node_fs_default().promises.readFile(path1, 'utf-8');
|
|
@@ -122,13 +122,13 @@ async function readJSON(path1) {
|
|
|
122
122
|
function readJSONSync(path1) {
|
|
123
123
|
return JSON.parse(readFileSync(path1));
|
|
124
124
|
}
|
|
125
|
-
|
|
125
|
+
const external_json_stream_stringify_namespaceObject = require("json-stream-stringify"), external_zlib_namespaceObject = require("zlib"), external_buffer_namespaceObject = require("buffer"), external_picocolors_namespaceObject = require("picocolors");
|
|
126
126
|
var external_picocolors_default = __webpack_require__.n(external_picocolors_namespaceObject);
|
|
127
|
-
|
|
127
|
+
const external_rslog_namespaceObject = require("rslog"), types_namespaceObject = require("@rsdoctor/types");
|
|
128
128
|
function debug(getMsg, prefix = '') {
|
|
129
129
|
process.env.DEBUG && (logger.level = 'verbose', logger.debug(`${prefix} ${getMsg()}`));
|
|
130
130
|
}
|
|
131
|
-
|
|
131
|
+
const rsdoctorLogger = (0, external_rslog_namespaceObject.createLogger)();
|
|
132
132
|
rsdoctorLogger.override({
|
|
133
133
|
log: (message)=>{
|
|
134
134
|
console.log(`${external_picocolors_default().green('[RSDOCTOR LOG]')} ${message}`);
|
|
@@ -155,9 +155,9 @@ rsdoctorLogger.override({
|
|
|
155
155
|
process.env.DEBUG && console.log(`${external_picocolors_default().blue('[RSDOCTOR DEBUG]')} ${message}`);
|
|
156
156
|
}
|
|
157
157
|
});
|
|
158
|
-
|
|
158
|
+
const _timers = new Map();
|
|
159
159
|
function time(label) {
|
|
160
|
-
process.env.DEBUG
|
|
160
|
+
process.env.DEBUG !== Constants.RsdoctorProcessEnvDebugKey || _timers.has(label) || _timers.set(label, Date.now());
|
|
161
161
|
}
|
|
162
162
|
function timeEnd(label) {
|
|
163
163
|
if (process.env.DEBUG !== Constants.RsdoctorProcessEnvDebugKey) return;
|
|
@@ -404,7 +404,7 @@ function getLoaderFileInputAndOutput(file, loader, loaderIndex, loaders) {
|
|
|
404
404
|
output: ''
|
|
405
405
|
};
|
|
406
406
|
}
|
|
407
|
-
|
|
407
|
+
const LoaderInternalPropertyName = '__l__', isVue = (compiler)=>('module' in compiler.options && compiler.options.module.rules || []).some((rule)=>!!(rule && 'object' == typeof rule && rule.test instanceof RegExp && rule.test?.test('.vue'))), getLoadrName = (loader)=>{
|
|
408
408
|
let regResults = loader.includes('node_modules') ? loader.split('node_modules') : null;
|
|
409
409
|
return regResults ? regResults[regResults.length - 1] : loader;
|
|
410
410
|
}, external_process_namespaceObject = require("process");
|
|
@@ -535,7 +535,7 @@ function getModuleDetails(moduleId, modules, dependencies) {
|
|
|
535
535
|
dependencies: getDependenciesByModule(module, dependencies)
|
|
536
536
|
};
|
|
537
537
|
}
|
|
538
|
-
|
|
538
|
+
const EXT = 'js|css|html', hashPattern = /[a-z|A-Z|0-9]{4,32}/, hashSeparatorPattern = /[-|.]/, fileExtensionPattern = /(?:\.[a-z|A-Z|0-9]{2,}){1,}/, filenamePattern = RegExp(`(.*)${hashSeparatorPattern.source}${hashPattern.source}(${fileExtensionPattern.source})$`);
|
|
539
539
|
function formatAssetName(assetName, fileConfig) {
|
|
540
540
|
let splitFilesList = fileConfig?.split('.'), outputFileTailName = '', unHashedFileName = assetName;
|
|
541
541
|
return splitFilesList?.length && splitFilesList.length >= 3 && splitFilesList[splitFilesList.length - 2]?.indexOf('[') < 0 && 'js|css|html'.indexOf(splitFilesList[splitFilesList.length - 1]) > -1 ? (outputFileTailName = splitFilesList[splitFilesList.length - 2], unHashedFileName = assetName.replace(/(.*)(\.[a-f0-9]{4,32})([^.]*.[^.]+){2,}/g, '$1'), `${unHashedFileName}.${outputFileTailName}.${assetName.substring(assetName.lastIndexOf('.') + 1)}`) : assetName.replace(filenamePattern, '$1$2');
|
|
@@ -732,7 +732,7 @@ function extname(filename) {
|
|
|
732
732
|
let matches = filename.split('?')[0].match(/\.([0-9a-z]+)(?:[\?#]|$)/i);
|
|
733
733
|
return matches ? `.${matches[1]}` : '';
|
|
734
734
|
}
|
|
735
|
-
|
|
735
|
+
const sep = ',';
|
|
736
736
|
function getBundleDiffPageQueryString(files) {
|
|
737
737
|
let qs = encodeURIComponent(files.join(','));
|
|
738
738
|
return qs && (qs = `?${Client.RsdoctorClientUrlQuery.BundleDiffFiles}=${qs}`), qs;
|
|
@@ -1065,7 +1065,7 @@ function compact(array) {
|
|
|
1065
1065
|
function isNil(value) {
|
|
1066
1066
|
return null == value;
|
|
1067
1067
|
}
|
|
1068
|
-
|
|
1068
|
+
const isPlainObject = (obj)=>null !== obj && 'object' == typeof obj && Object.getPrototypeOf(obj) === Object.prototype, isString = (v)=>'string' == typeof v || !!v && 'object' == typeof v && !Array.isArray(v) && '[object String]' === ({}).toString.call(v);
|
|
1069
1069
|
function pick(obj, keys) {
|
|
1070
1070
|
let result = {};
|
|
1071
1071
|
for(let i = 0; i < keys.length; i++){
|
|
@@ -1074,7 +1074,7 @@ function pick(obj, keys) {
|
|
|
1074
1074
|
}
|
|
1075
1075
|
return result;
|
|
1076
1076
|
}
|
|
1077
|
-
|
|
1077
|
+
const PACKAGE_PREFIX = /(?:node_modules|~)(?:\/\.pnpm)?/, PACKAGE_SLUG = /[a-zA-Z0-9]+(?:[-|_|.]+[a-zA-Z0-9]+)*/, VERSION = /@[\w|\-|_|.]+/, VERSION_NUMBER = '@([\\d.]+)', MODULE_PATH_PACKAGES = RegExp(`(?:${PACKAGE_PREFIX.source}/)(?:(?:@${PACKAGE_SLUG.source}[/|+])?(?:${PACKAGE_SLUG.source}\\+)*(?:${PACKAGE_SLUG.source})(?:${VERSION.source})?)(?:_(?:@${PACKAGE_SLUG.source}[/|+])?(?:${PACKAGE_SLUG.source})(?:@${PACKAGE_SLUG.source})?)*/`, 'g'), PACKAGE_PATH_NAME = /(?:(?:node_modules|~)(?:\/\.pnpm)?\/)(?:((?:@[a-zA-Z0-9]+(?:[-|_|.]+[a-zA-Z0-9]+)*[/|+])?(?:(?:[a-zA-Z0-9]+(?:[-|_|.]+[a-zA-Z0-9]+)*\+)*)(?:[a-zA-Z0-9]+(?:[-|_|.]+[a-zA-Z0-9]+)*))(?:@[\w|\-|_|.]+)?)(?:_((?:@[a-zA-Z0-9]+(?:[-|_|.]+[a-zA-Z0-9]+)*[/|+])?(?:[a-zA-Z0-9]+(?:[-|_|.]+[a-zA-Z0-9]+)*))(?:@[a-zA-Z0-9]+(?:[-|_|.]+[a-zA-Z0-9]+)*))*\//gm, uniqLast = (data)=>{
|
|
1078
1078
|
let res = [];
|
|
1079
1079
|
return data.forEach((item, index)=>{
|
|
1080
1080
|
data.slice(index + 1).includes(item) || res.push(item);
|
|
@@ -1122,7 +1122,7 @@ function getMcpConfigPath() {
|
|
|
1122
1122
|
let homeDir = os.homedir(), rsdoctorDir = path.join(homeDir, '.cache/rsdoctor');
|
|
1123
1123
|
return path.join(rsdoctorDir, 'mcp.json');
|
|
1124
1124
|
}
|
|
1125
|
-
|
|
1125
|
+
const external_stream_namespaceObject = require("stream"), maxFileSize = 419430400;
|
|
1126
1126
|
function stringify(json, replacer, space, cycle) {
|
|
1127
1127
|
let jsonList = [];
|
|
1128
1128
|
return json && 'object' == typeof json ? new Promise((resolve, reject)=>{
|
|
@@ -1141,7 +1141,7 @@ function stringify(json, replacer, space, cycle) {
|
|
|
1141
1141
|
}).on('error', (err)=>reject(err));
|
|
1142
1142
|
}) : Promise.resolve(JSON.stringify(json, replacer, space));
|
|
1143
1143
|
}
|
|
1144
|
-
|
|
1144
|
+
const readPackageJson = (file, readFile)=>{
|
|
1145
1145
|
let result, current = file;
|
|
1146
1146
|
for(; '/' !== current && !result;){
|
|
1147
1147
|
let parent = (0, external_path_namespaceObject.dirname)(current);
|
|
@@ -1154,11 +1154,11 @@ let readPackageJson = (file, readFile)=>{
|
|
|
1154
1154
|
} : readPackageJson((0, external_path_namespaceObject.dirname)(current), readFile);
|
|
1155
1155
|
}, index_js_namespaceObject = require("../compiled/connect/index.js");
|
|
1156
1156
|
var index_js_default = __webpack_require__.n(index_js_namespaceObject);
|
|
1157
|
-
|
|
1157
|
+
const external_http_namespaceObject = require("http");
|
|
1158
1158
|
var external_http_default = __webpack_require__.n(external_http_namespaceObject);
|
|
1159
|
-
|
|
1159
|
+
const external_get_port_namespaceObject = require("get-port");
|
|
1160
1160
|
var external_get_port_default = __webpack_require__.n(external_get_port_namespaceObject);
|
|
1161
|
-
|
|
1161
|
+
const external_child_process_namespaceObject = require("child_process"), RESTRICTED_PORTS = [
|
|
1162
1162
|
3659,
|
|
1163
1163
|
4045,
|
|
1164
1164
|
6000,
|
|
@@ -1174,13 +1174,13 @@ function getRandomPort(min, max) {
|
|
|
1174
1174
|
while (RESTRICTED_PORTS.includes(port));
|
|
1175
1175
|
return port;
|
|
1176
1176
|
}
|
|
1177
|
-
|
|
1177
|
+
const defaultPort = getRandomPort(3000, 8999);
|
|
1178
1178
|
async function getPort(expectPort) {
|
|
1179
1179
|
return external_get_port_default()({
|
|
1180
1180
|
port: expectPort
|
|
1181
1181
|
});
|
|
1182
1182
|
}
|
|
1183
|
-
|
|
1183
|
+
const createGetPortSyncFunctionString = (expectPort)=>`
|
|
1184
1184
|
(() => {
|
|
1185
1185
|
const net = require('net');
|
|
1186
1186
|
|
|
@@ -1239,9 +1239,9 @@ async function createServer(port) {
|
|
|
1239
1239
|
});
|
|
1240
1240
|
});
|
|
1241
1241
|
}
|
|
1242
|
-
|
|
1242
|
+
const external_envinfo_namespaceObject = require("envinfo");
|
|
1243
1243
|
var external_envinfo_default = __webpack_require__.n(external_envinfo_namespaceObject);
|
|
1244
|
-
|
|
1244
|
+
const helpers = external_envinfo_default().helpers, run = external_envinfo_default().run, getCPUInfo = ()=>helpers.getCPUInfo().then((res)=>res[1]), getOSInfo = ()=>helpers.getOSInfo().then((res)=>res[1]), getMemoryInfo = ()=>helpers.getMemoryInfo().then((res)=>res[1]), getNodeVersion = ()=>helpers.getNodeInfo().then((res)=>res[1]), getYarnVersion = ()=>helpers.getYarnInfo().then((res)=>res[1]), getNpmVersion = ()=>helpers.getnpmInfo().then((res)=>res[1]), getPnpmVersion = ()=>helpers.getpnpmInfo().then((res)=>res[1]);
|
|
1245
1245
|
function getNpmPackageVersion(pkg) {
|
|
1246
1246
|
let isArray = Array.isArray(pkg);
|
|
1247
1247
|
return run({
|
|
@@ -1286,7 +1286,7 @@ function getGitRepo() {
|
|
|
1286
1286
|
});
|
|
1287
1287
|
});
|
|
1288
1288
|
}
|
|
1289
|
-
|
|
1289
|
+
const filesize_index_js_namespaceObject = require("../compiled/filesize/index.js");
|
|
1290
1290
|
function getMemoryUsage() {
|
|
1291
1291
|
return (0, external_process_namespaceObject.memoryUsage)();
|
|
1292
1292
|
}
|
package/dist/build.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import fs_extra from "fs-extra";
|
|
2
1
|
import fs_0 from "fs";
|
|
3
2
|
import path_0, { dirname, join } from "path";
|
|
4
3
|
import node_fs from "node:fs";
|
|
@@ -17,7 +16,7 @@ import get_port from "get-port";
|
|
|
17
16
|
import { exec, execSync } from "child_process";
|
|
18
17
|
import envinfo_0 from "envinfo";
|
|
19
18
|
import { filesize } from "../compiled/filesize/index.js";
|
|
20
|
-
import * as
|
|
19
|
+
import * as __WEBPACK_EXTERNAL_MODULE_fs_extra_ce68a66b__ from "fs-extra";
|
|
21
20
|
var __webpack_require__ = {};
|
|
22
21
|
__webpack_require__.d = (exports, definition)=>{
|
|
23
22
|
for(var key in definition)__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key) && Object.defineProperty(exports, key, {
|
|
@@ -42,7 +41,7 @@ var file_namespaceObject = {};
|
|
|
42
41
|
__webpack_require__.r(file_namespaceObject), __webpack_require__.d(file_namespaceObject, {
|
|
43
42
|
FileSharding: ()=>FileSharding,
|
|
44
43
|
cache: ()=>cache_namespaceObject,
|
|
45
|
-
fse: ()=>
|
|
44
|
+
fse: ()=>__WEBPACK_EXTERNAL_MODULE_fs_extra_ce68a66b__
|
|
46
45
|
});
|
|
47
46
|
var json_namespaceObject = {};
|
|
48
47
|
__webpack_require__.r(json_namespaceObject), __webpack_require__.d(json_namespaceObject, {
|
|
@@ -94,7 +93,7 @@ class FileSharding {
|
|
|
94
93
|
}
|
|
95
94
|
async writeStringToFolder(folder, ext = '', index) {
|
|
96
95
|
let dist = path_0.resolve(folder);
|
|
97
|
-
await
|
|
96
|
+
await __WEBPACK_EXTERNAL_MODULE_fs_extra_ce68a66b__.default.ensureDir(dist);
|
|
98
97
|
let res = this.createVirtualShardingFiles(ext, index);
|
|
99
98
|
return await Promise.all(res.map((e)=>new Promise((resolve, reject)=>{
|
|
100
99
|
let stream = fs_0.createWriteStream(path_0.join(dist, e.filename), this.encoding);
|
|
@@ -149,22 +148,20 @@ createLogger().override({
|
|
|
149
148
|
}
|
|
150
149
|
}), RegExp(`(.*)${/[-|.]/.source}${/[a-z|A-Z|0-9]{4,32}/.source}(${/(?:\.[a-z|A-Z|0-9]{2,}){1,}/.source})$`);
|
|
151
150
|
let PACKAGE_SLUG = /[a-zA-Z0-9]+(?:[-|_|.]+[a-zA-Z0-9]+)*/, MODULE_PATH_PACKAGES = RegExp(`(?:${/(?:node_modules|~)(?:\/\.pnpm)?/.source}/)(?:(?:@${PACKAGE_SLUG.source}[/|+])?(?:${PACKAGE_SLUG.source}\\+)*(?:${PACKAGE_SLUG.source})(?:${/@[\w|\-|_|.]+/.source})?)(?:_(?:@${PACKAGE_SLUG.source}[/|+])?(?:${PACKAGE_SLUG.source})(?:@${PACKAGE_SLUG.source})?)*/`, 'g'), PACKAGE_PATH_NAME = /(?:(?:node_modules|~)(?:\/\.pnpm)?\/)(?:((?:@[a-zA-Z0-9]+(?:[-|_|.]+[a-zA-Z0-9]+)*[/|+])?(?:(?:[a-zA-Z0-9]+(?:[-|_|.]+[a-zA-Z0-9]+)*\+)*)(?:[a-zA-Z0-9]+(?:[-|_|.]+[a-zA-Z0-9]+)*))(?:@[\w|\-|_|.]+)?)(?:_((?:@[a-zA-Z0-9]+(?:[-|_|.]+[a-zA-Z0-9]+)*[/|+])?(?:[a-zA-Z0-9]+(?:[-|_|.]+[a-zA-Z0-9]+)*))(?:@[a-zA-Z0-9]+(?:[-|_|.]+[a-zA-Z0-9]+)*))*\//gm, getPackageMetaFromModulePath = (modulePath)=>{
|
|
152
|
-
|
|
151
|
+
var data;
|
|
152
|
+
let res, paths = modulePath.match(MODULE_PATH_PACKAGES);
|
|
153
153
|
if (!paths) return {
|
|
154
154
|
name: '',
|
|
155
155
|
version: ''
|
|
156
156
|
};
|
|
157
|
-
let names = ((
|
|
158
|
-
let res = [];
|
|
159
|
-
return data.forEach((item, index)=>{
|
|
160
|
-
data.slice(index + 1).includes(item) || res.push(item);
|
|
161
|
-
}), res;
|
|
162
|
-
})(paths.flatMap((packagePath)=>{
|
|
157
|
+
let names = (data = paths.flatMap((packagePath)=>{
|
|
163
158
|
let found = packagePath.matchAll(PACKAGE_PATH_NAME);
|
|
164
159
|
return found ? [
|
|
165
160
|
...found
|
|
166
161
|
].flat().filter((item)=>null != item || !item).slice(1).filter(Boolean).map((name)=>name.replace(/\+/g, '/')) : [];
|
|
167
|
-
}))
|
|
162
|
+
}), res = [], data.forEach((item, index)=>{
|
|
163
|
+
data.slice(index + 1).includes(item) || res.push(item);
|
|
164
|
+
}), res);
|
|
168
165
|
if (null == names || Array.isArray(names) && 0 === names.length || 'object' == typeof names && 0 === Object.keys(names).length) return {
|
|
169
166
|
name: '',
|
|
170
167
|
version: ''
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * from './assets';
|
|
2
|
-
export * from './chunk';
|
|
3
|
-
export * from './modules';
|
|
4
|
-
export * from './dependency';
|
|
5
|
-
export * from './entrypoints';
|
|
1
|
+
export * from './assets.js';
|
|
2
|
+
export * from './chunk.js';
|
|
3
|
+
export * from './modules.js';
|
|
4
|
+
export * from './dependency.js';
|
|
5
|
+
export * from './entrypoints.js';
|
package/dist/common/index.d.ts
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
export * as Summary from './summary';
|
|
2
|
-
export * as Crypto from './crypto';
|
|
3
|
-
export * as Manifest from './manifest';
|
|
4
|
-
export * as Loader from './loader';
|
|
5
|
-
export * as Time from './time';
|
|
6
|
-
export * as Algorithm from './algorithm';
|
|
7
|
-
export * as Resolver from './resolver';
|
|
8
|
-
export * as Graph from './graph';
|
|
9
|
-
export * as Bundle from './bundle';
|
|
10
|
-
export * as Url from './url';
|
|
11
|
-
export * as Plugin from './plugin';
|
|
12
|
-
export * as Data from './data';
|
|
13
|
-
export * as Alerts from './alerts';
|
|
14
|
-
export * as Rspack from './rspack';
|
|
15
|
-
export * as Package from './package';
|
|
16
|
-
export * as Lodash from './lodash';
|
|
17
|
-
export * as GlobalConfig from './global-config';
|
|
18
|
-
export * as File from './file';
|
|
19
|
-
export * from './decycle';
|
|
1
|
+
export * as Summary from './summary.js';
|
|
2
|
+
export * as Crypto from './crypto.js';
|
|
3
|
+
export * as Manifest from './manifest.js';
|
|
4
|
+
export * as Loader from './loader.js';
|
|
5
|
+
export * as Time from './time.js';
|
|
6
|
+
export * as Algorithm from './algorithm.js';
|
|
7
|
+
export * as Resolver from './resolver.js';
|
|
8
|
+
export * as Graph from './graph/index.js';
|
|
9
|
+
export * as Bundle from './bundle.js';
|
|
10
|
+
export * as Url from './url.js';
|
|
11
|
+
export * as Plugin from './plugin.js';
|
|
12
|
+
export * as Data from './data/index.js';
|
|
13
|
+
export * as Alerts from './alerts.js';
|
|
14
|
+
export * as Rspack from './rspack.js';
|
|
15
|
+
export * as Package from './package.js';
|
|
16
|
+
export * as Lodash from './lodash.js';
|
|
17
|
+
export * as GlobalConfig from './global-config.js';
|
|
18
|
+
export * as File from './file.js';
|
|
19
|
+
export * from './decycle.js';
|
package/dist/common.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
2
|
+
const __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
3
|
var __webpack_require__ = {};
|
|
4
4
|
__webpack_require__.n = (module)=>{
|
|
5
5
|
var getter = module && module.__esModule ? ()=>module.default : ()=>module;
|
|
@@ -195,7 +195,7 @@ __webpack_require__.r(global_config_namespaceObject), __webpack_require__.d(glob
|
|
|
195
195
|
var summary_SummaryCostsDataName = function(SummaryCostsDataName) {
|
|
196
196
|
return SummaryCostsDataName.Bootstrap = "bootstrap->beforeCompile", SummaryCostsDataName.Compile = "beforeCompile->afterCompile", SummaryCostsDataName.Done = "afterCompile->done", SummaryCostsDataName.Minify = "minify(processAssets)", SummaryCostsDataName;
|
|
197
197
|
}({});
|
|
198
|
-
|
|
198
|
+
const sep = '!';
|
|
199
199
|
function encode(str) {
|
|
200
200
|
let res = `${str.charCodeAt(0)}`;
|
|
201
201
|
for(let i = 1; i < str.length; i++)res += `!${str.charCodeAt(i)}`;
|
|
@@ -206,13 +206,13 @@ function decode(str) {
|
|
|
206
206
|
for(let i = 0; i < str.length; i++)'!' === str[i] ? (res += String.fromCharCode(+tmp), tmp = '') : tmp += str[i];
|
|
207
207
|
return tmp && (res += String.fromCharCode(+tmp)), res;
|
|
208
208
|
}
|
|
209
|
-
|
|
209
|
+
const external_zlib_namespaceObject = require("zlib"), external_buffer_namespaceObject = require("buffer"), external_picocolors_namespaceObject = require("picocolors");
|
|
210
210
|
var external_picocolors_default = __webpack_require__.n(external_picocolors_namespaceObject);
|
|
211
|
-
|
|
211
|
+
const external_rslog_namespaceObject = require("rslog"), types_namespaceObject = require("@rsdoctor/types");
|
|
212
212
|
function debug(getMsg, prefix = '') {
|
|
213
213
|
process.env.DEBUG && (logger.level = 'verbose', logger.debug(`${prefix} ${getMsg()}`));
|
|
214
214
|
}
|
|
215
|
-
|
|
215
|
+
const rsdoctorLogger = (0, external_rslog_namespaceObject.createLogger)();
|
|
216
216
|
rsdoctorLogger.override({
|
|
217
217
|
log: (message)=>{
|
|
218
218
|
console.log(`${external_picocolors_default().green('[RSDOCTOR LOG]')} ${message}`);
|
|
@@ -239,9 +239,9 @@ rsdoctorLogger.override({
|
|
|
239
239
|
process.env.DEBUG && console.log(`${external_picocolors_default().blue('[RSDOCTOR DEBUG]')} ${message}`);
|
|
240
240
|
}
|
|
241
241
|
});
|
|
242
|
-
|
|
242
|
+
const _timers = new Map();
|
|
243
243
|
function time(label) {
|
|
244
|
-
process.env.DEBUG
|
|
244
|
+
process.env.DEBUG !== Constants.RsdoctorProcessEnvDebugKey || _timers.has(label) || _timers.set(label, Date.now());
|
|
245
245
|
}
|
|
246
246
|
function timeEnd(label) {
|
|
247
247
|
if (process.env.DEBUG !== Constants.RsdoctorProcessEnvDebugKey) return;
|
|
@@ -270,7 +270,7 @@ function decompressText(input) {
|
|
|
270
270
|
function random(min, max) {
|
|
271
271
|
return Math.floor(Math.random() * (max - min + 1) + min);
|
|
272
272
|
}
|
|
273
|
-
|
|
273
|
+
const external_path_namespaceObject = require("path");
|
|
274
274
|
var external_path_default = __webpack_require__.n(external_path_namespaceObject);
|
|
275
275
|
function isUrl(uri) {
|
|
276
276
|
return /^https?:\/\//.test(uri);
|
|
@@ -490,7 +490,7 @@ function getLoaderFileInputAndOutput(file, loader, loaderIndex, loaders) {
|
|
|
490
490
|
output: ''
|
|
491
491
|
};
|
|
492
492
|
}
|
|
493
|
-
|
|
493
|
+
const LoaderInternalPropertyName = '__l__', isVue = (compiler)=>('module' in compiler.options && compiler.options.module.rules || []).some((rule)=>!!(rule && 'object' == typeof rule && rule.test instanceof RegExp && rule.test?.test('.vue'))), getLoadrName = (loader)=>{
|
|
494
494
|
let regResults = loader.includes('node_modules') ? loader.split('node_modules') : null;
|
|
495
495
|
return regResults ? regResults[regResults.length - 1] : loader;
|
|
496
496
|
}, external_process_namespaceObject = require("process");
|
|
@@ -662,7 +662,7 @@ function getModuleDetails(moduleId, modules, dependencies) {
|
|
|
662
662
|
dependencies: getDependenciesByModule(module, dependencies)
|
|
663
663
|
};
|
|
664
664
|
}
|
|
665
|
-
|
|
665
|
+
const EXT = 'js|css|html', hashPattern = /[a-z|A-Z|0-9]{4,32}/, hashSeparatorPattern = /[-|.]/, fileExtensionPattern = /(?:\.[a-z|A-Z|0-9]{2,}){1,}/, filenamePattern = RegExp(`(.*)${hashSeparatorPattern.source}${hashPattern.source}(${fileExtensionPattern.source})$`);
|
|
666
666
|
function formatAssetName(assetName, fileConfig) {
|
|
667
667
|
let splitFilesList = fileConfig?.split('.'), outputFileTailName = '', unHashedFileName = assetName;
|
|
668
668
|
return splitFilesList?.length && splitFilesList.length >= 3 && splitFilesList[splitFilesList.length - 2]?.indexOf('[') < 0 && 'js|css|html'.indexOf(splitFilesList[splitFilesList.length - 1]) > -1 ? (outputFileTailName = splitFilesList[splitFilesList.length - 2], unHashedFileName = assetName.replace(/(.*)(\.[a-f0-9]{4,32})([^.]*.[^.]+){2,}/g, '$1'), `${unHashedFileName}.${outputFileTailName}.${assetName.substring(assetName.lastIndexOf('.') + 1)}`) : assetName.replace(filenamePattern, '$1$2');
|
|
@@ -862,7 +862,7 @@ function extname(filename) {
|
|
|
862
862
|
function getEntryPoints(entrypoints) {
|
|
863
863
|
return entrypoints;
|
|
864
864
|
}
|
|
865
|
-
|
|
865
|
+
const bundle_sep = ',';
|
|
866
866
|
function getBundleDiffPageQueryString(files) {
|
|
867
867
|
let qs = encodeURIComponent(files.join(','));
|
|
868
868
|
return qs && (qs = `?${types_namespaceObject.Client.RsdoctorClientUrlQuery.BundleDiffFiles}=${qs}`), qs;
|
|
@@ -927,7 +927,7 @@ function getPackageRelationAlertDetails(modules, dependencies, root, packageDepe
|
|
|
927
927
|
} : null;
|
|
928
928
|
}).filter(Boolean);
|
|
929
929
|
}
|
|
930
|
-
|
|
930
|
+
const RspackLoaderInternalPropertyName = '__l__';
|
|
931
931
|
var rspack_RspackSummaryCostsDataName = function(RspackSummaryCostsDataName) {
|
|
932
932
|
return RspackSummaryCostsDataName.Bootstrap = "bootstrap->rspack:beforeCompile", RspackSummaryCostsDataName.Compile = "rspack:beforeCompile->afterCompile", RspackSummaryCostsDataName.Done = "rspack:afterCompile->done", RspackSummaryCostsDataName.Minify = "rspack:minify(rspack:optimizeChunkAssets)", RspackSummaryCostsDataName;
|
|
933
933
|
}({});
|
|
@@ -1245,7 +1245,7 @@ function compact(array) {
|
|
|
1245
1245
|
function isNil(value) {
|
|
1246
1246
|
return null == value;
|
|
1247
1247
|
}
|
|
1248
|
-
|
|
1248
|
+
const isPlainObject = (obj)=>null !== obj && 'object' == typeof obj && Object.getPrototypeOf(obj) === Object.prototype, isString = (v)=>'string' == typeof v || !!v && 'object' == typeof v && !Array.isArray(v) && '[object String]' === ({}).toString.call(v);
|
|
1249
1249
|
function pick(obj, keys) {
|
|
1250
1250
|
let result = {};
|
|
1251
1251
|
for(let i = 0; i < keys.length; i++){
|
|
@@ -1254,7 +1254,7 @@ function pick(obj, keys) {
|
|
|
1254
1254
|
}
|
|
1255
1255
|
return result;
|
|
1256
1256
|
}
|
|
1257
|
-
|
|
1257
|
+
const PACKAGE_PREFIX = /(?:node_modules|~)(?:\/\.pnpm)?/, PACKAGE_SLUG = /[a-zA-Z0-9]+(?:[-|_|.]+[a-zA-Z0-9]+)*/, VERSION = /@[\w|\-|_|.]+/, VERSION_NUMBER = '@([\\d.]+)', MODULE_PATH_PACKAGES = RegExp(`(?:${PACKAGE_PREFIX.source}/)(?:(?:@${PACKAGE_SLUG.source}[/|+])?(?:${PACKAGE_SLUG.source}\\+)*(?:${PACKAGE_SLUG.source})(?:${VERSION.source})?)(?:_(?:@${PACKAGE_SLUG.source}[/|+])?(?:${PACKAGE_SLUG.source})(?:@${PACKAGE_SLUG.source})?)*/`, 'g'), PACKAGE_PATH_NAME = /(?:(?:node_modules|~)(?:\/\.pnpm)?\/)(?:((?:@[a-zA-Z0-9]+(?:[-|_|.]+[a-zA-Z0-9]+)*[/|+])?(?:(?:[a-zA-Z0-9]+(?:[-|_|.]+[a-zA-Z0-9]+)*\+)*)(?:[a-zA-Z0-9]+(?:[-|_|.]+[a-zA-Z0-9]+)*))(?:@[\w|\-|_|.]+)?)(?:_((?:@[a-zA-Z0-9]+(?:[-|_|.]+[a-zA-Z0-9]+)*[/|+])?(?:[a-zA-Z0-9]+(?:[-|_|.]+[a-zA-Z0-9]+)*))(?:@[a-zA-Z0-9]+(?:[-|_|.]+[a-zA-Z0-9]+)*))*\//gm, uniqLast = (data)=>{
|
|
1258
1258
|
let res = [];
|
|
1259
1259
|
return data.forEach((item, index)=>{
|
|
1260
1260
|
data.slice(index + 1).includes(item) || res.push(item);
|
|
@@ -1282,7 +1282,7 @@ let PACKAGE_PREFIX = /(?:node_modules|~)(?:\/\.pnpm)?/, PACKAGE_SLUG = /[a-zA-Z0
|
|
|
1282
1282
|
};
|
|
1283
1283
|
}, external_fs_namespaceObject = require("fs");
|
|
1284
1284
|
var external_fs_default = __webpack_require__.n(external_fs_namespaceObject);
|
|
1285
|
-
|
|
1285
|
+
const external_os_namespaceObject = require("os");
|
|
1286
1286
|
var external_os_default = __webpack_require__.n(external_os_namespaceObject);
|
|
1287
1287
|
function writeMcpPort(port, builderName) {
|
|
1288
1288
|
let homeDir = external_os_default().homedir(), rsdoctorDir = external_path_default().join(homeDir, '.cache/rsdoctor'), mcpPortFilePath = external_path_default().join(rsdoctorDir, 'mcp.json');
|
package/dist/common.js
CHANGED
|
@@ -368,21 +368,19 @@ function getLoaderFolderStatistics(folder, loaders) {
|
|
|
368
368
|
});
|
|
369
369
|
}
|
|
370
370
|
function getDirectoriesLoaders(loaders, root) {
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
directories.add(`${root}/${twoLevelDir}`);
|
|
379
|
-
}
|
|
380
|
-
} else {
|
|
381
|
-
let pathParts = item.resource.path.split('/'), twoLevelDir = pathParts.slice(0, pathParts.length - 1).join('/');
|
|
382
|
-
directories.add(twoLevelDir);
|
|
371
|
+
let directories, rootPath = root || process.cwd();
|
|
372
|
+
return (directories = new Set(), loaders.forEach((item)=>{
|
|
373
|
+
if (item.resource.path.startsWith(rootPath)) {
|
|
374
|
+
let pathParts = item.resource.path.split(rootPath).slice(1).join('/').split('/');
|
|
375
|
+
if (pathParts.length >= 2) {
|
|
376
|
+
let twoLevelDir = pathParts.slice(0, 2).join('/');
|
|
377
|
+
directories.add(`${rootPath}/${twoLevelDir}`);
|
|
383
378
|
}
|
|
384
|
-
}
|
|
385
|
-
|
|
379
|
+
} else {
|
|
380
|
+
let pathParts = item.resource.path.split('/'), twoLevelDir = pathParts.slice(0, pathParts.length - 1).join('/');
|
|
381
|
+
directories.add(twoLevelDir);
|
|
382
|
+
}
|
|
383
|
+
}), Array.from(directories)).map((directory)=>{
|
|
386
384
|
let stats = getLoaderFolderStatistics(directory, loaders);
|
|
387
385
|
return {
|
|
388
386
|
directory,
|
|
@@ -1206,22 +1204,20 @@ function pick(obj, keys) {
|
|
|
1206
1204
|
return result;
|
|
1207
1205
|
}
|
|
1208
1206
|
let PACKAGE_SLUG = /[a-zA-Z0-9]+(?:[-|_|.]+[a-zA-Z0-9]+)*/, MODULE_PATH_PACKAGES = RegExp(`(?:${/(?:node_modules|~)(?:\/\.pnpm)?/.source}/)(?:(?:@${PACKAGE_SLUG.source}[/|+])?(?:${PACKAGE_SLUG.source}\\+)*(?:${PACKAGE_SLUG.source})(?:${/@[\w|\-|_|.]+/.source})?)(?:_(?:@${PACKAGE_SLUG.source}[/|+])?(?:${PACKAGE_SLUG.source})(?:@${PACKAGE_SLUG.source})?)*/`, 'g'), PACKAGE_PATH_NAME = /(?:(?:node_modules|~)(?:\/\.pnpm)?\/)(?:((?:@[a-zA-Z0-9]+(?:[-|_|.]+[a-zA-Z0-9]+)*[/|+])?(?:(?:[a-zA-Z0-9]+(?:[-|_|.]+[a-zA-Z0-9]+)*\+)*)(?:[a-zA-Z0-9]+(?:[-|_|.]+[a-zA-Z0-9]+)*))(?:@[\w|\-|_|.]+)?)(?:_((?:@[a-zA-Z0-9]+(?:[-|_|.]+[a-zA-Z0-9]+)*[/|+])?(?:[a-zA-Z0-9]+(?:[-|_|.]+[a-zA-Z0-9]+)*))(?:@[a-zA-Z0-9]+(?:[-|_|.]+[a-zA-Z0-9]+)*))*\//gm, getPackageMetaFromModulePath = (modulePath)=>{
|
|
1209
|
-
|
|
1207
|
+
var data;
|
|
1208
|
+
let res, paths = modulePath.match(MODULE_PATH_PACKAGES);
|
|
1210
1209
|
if (!paths) return {
|
|
1211
1210
|
name: '',
|
|
1212
1211
|
version: ''
|
|
1213
1212
|
};
|
|
1214
|
-
let names = ((
|
|
1215
|
-
let res = [];
|
|
1216
|
-
return data.forEach((item, index)=>{
|
|
1217
|
-
data.slice(index + 1).includes(item) || res.push(item);
|
|
1218
|
-
}), res;
|
|
1219
|
-
})(paths.flatMap((packagePath)=>{
|
|
1213
|
+
let names = (data = paths.flatMap((packagePath)=>{
|
|
1220
1214
|
let found = packagePath.matchAll(PACKAGE_PATH_NAME);
|
|
1221
1215
|
return found ? compact([
|
|
1222
1216
|
...found
|
|
1223
1217
|
].flat()).slice(1).filter(Boolean).map((name)=>name.replace(/\+/g, '/')) : [];
|
|
1224
|
-
}))
|
|
1218
|
+
}), res = [], data.forEach((item, index)=>{
|
|
1219
|
+
data.slice(index + 1).includes(item) || res.push(item);
|
|
1220
|
+
}), res);
|
|
1225
1221
|
if (isEmpty(names)) return {
|
|
1226
1222
|
name: '',
|
|
1227
1223
|
version: ''
|
package/dist/error/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './error';
|
|
2
|
-
export { printErrors } from './utils';
|
|
1
|
+
export * from './error.js';
|
|
2
|
+
export { printErrors } from './utils.js';
|
package/dist/error.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
2
|
+
const __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
3
|
var __webpack_require__ = {};
|
|
4
4
|
__webpack_require__.n = (module)=>{
|
|
5
5
|
var getter = module && module.__esModule ? ()=>module.default : ()=>module;
|
|
@@ -23,9 +23,9 @@ __webpack_require__.r(__webpack_exports__), __webpack_require__.d(__webpack_expo
|
|
|
23
23
|
DevToolError: ()=>DevToolError,
|
|
24
24
|
printErrors: ()=>printErrors
|
|
25
25
|
});
|
|
26
|
-
|
|
26
|
+
const code_frame_namespaceObject = require("@babel/code-frame"), types_namespaceObject = require("@rsdoctor/types"), external_picocolors_namespaceObject = require("picocolors"), external_deep_eql_namespaceObject = require("deep-eql");
|
|
27
27
|
var external_deep_eql_default = __webpack_require__.n(external_deep_eql_namespaceObject);
|
|
28
|
-
|
|
28
|
+
const external_strip_ansi_namespaceObject = require("strip-ansi");
|
|
29
29
|
var external_strip_ansi_default = __webpack_require__.n(external_strip_ansi_namespaceObject);
|
|
30
30
|
function isEsbuildError(err) {
|
|
31
31
|
return 'pluginName' in err && 'text' in err && 'location' in err;
|
|
@@ -180,7 +180,7 @@ function compact(array) {
|
|
|
180
180
|
function isNil(value) {
|
|
181
181
|
return null == value;
|
|
182
182
|
}
|
|
183
|
-
|
|
183
|
+
const isPlainObject = (obj)=>null !== obj && 'object' == typeof obj && Object.getPrototypeOf(obj) === Object.prototype, isString = (v)=>'string' == typeof v || !!v && 'object' == typeof v && !Array.isArray(v) && '[object String]' === ({}).toString.call(v);
|
|
184
184
|
function pick(obj, keys) {
|
|
185
185
|
let result = {};
|
|
186
186
|
for(let i = 0; i < keys.length; i++){
|
package/dist/error.js
CHANGED
|
@@ -31,14 +31,11 @@ function transformEsbuildError(err, opt) {
|
|
|
31
31
|
}
|
|
32
32
|
function transformBabelError(err, opt) {
|
|
33
33
|
if ('code' in err && 'reasonCode' in err) {
|
|
34
|
-
let errorCode = opt?.code ?? err.code ?? 'BABEL', title = err.reasonCode, errorParsed =
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
lineText: lines.find((line)=>line.startsWith('> '))?.replace(/> \d+ \| /, '') ?? ''
|
|
40
|
-
};
|
|
41
|
-
}(err.message), speedyError = new DevToolError(title, errorParsed.message, {
|
|
34
|
+
let lines, filePath, errorCode = opt?.code ?? err.code ?? 'BABEL', title = err.reasonCode, errorParsed = (filePath = (lines = strip_ansi(err.message).split('\n'))[0].replace(/^([^:]+):.*/, '$1'), {
|
|
35
|
+
message: lines[0].replace(/.*: (.*) \(\d+:\d+\)*/, '$1'),
|
|
36
|
+
filePath,
|
|
37
|
+
lineText: lines.find((line)=>line.startsWith('> '))?.replace(/> \d+ \| /, '') ?? ''
|
|
38
|
+
}), speedyError = new DevToolError(title, errorParsed.message, {
|
|
42
39
|
...opt,
|
|
43
40
|
code: errorCode,
|
|
44
41
|
stack: err.stack && clearStack(err.stack)
|
|
@@ -170,6 +167,7 @@ class DevToolError extends Error {
|
|
|
170
167
|
highlightCode: !controller.noColor
|
|
171
168
|
}));
|
|
172
169
|
} else if ('lineText' in codeFrameOpt) {
|
|
170
|
+
var rawLines, width;
|
|
173
171
|
let { length, lineText } = codeFrameOpt, lineCodeFrame = codeFrameColumns(lineText, {
|
|
174
172
|
start: {
|
|
175
173
|
line: 1,
|
|
@@ -182,10 +180,11 @@ class DevToolError extends Error {
|
|
|
182
180
|
}, {
|
|
183
181
|
highlightCode: !controller.noColor
|
|
184
182
|
});
|
|
185
|
-
start.line > 1
|
|
186
|
-
let lines
|
|
187
|
-
|
|
188
|
-
}
|
|
183
|
+
if (start.line > 1) {
|
|
184
|
+
let lines;
|
|
185
|
+
lineCodeFrame = lineCodeFrame.replace(' 1 |', ` ${start.line} |`), start.line >= 10 && (rawLines = lineCodeFrame, width = String(start.line).length - 1, (lines = rawLines.split('\n'))[1] = Array(width).fill(' ').join('') + lines[1], lineCodeFrame = lines.join('\n'));
|
|
186
|
+
}
|
|
187
|
+
msgs.push(lineCodeFrame);
|
|
189
188
|
}
|
|
190
189
|
} else msgs.push(`\n ${print.red(print.bold('File: '))}${print.bold(codeFrameOpt.filePath)}\n`);
|
|
191
190
|
return msgs;
|
package/dist/logger.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
2
|
+
const __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
3
|
var __webpack_require__ = {};
|
|
4
4
|
__webpack_require__.n = (module)=>{
|
|
5
5
|
var getter = module && module.__esModule ? ()=>module.default : ()=>module;
|
|
@@ -26,13 +26,13 @@ __webpack_require__.r(__webpack_exports__), __webpack_require__.d(__webpack_expo
|
|
|
26
26
|
timeEnd: ()=>timeEnd,
|
|
27
27
|
time: ()=>time
|
|
28
28
|
});
|
|
29
|
-
|
|
29
|
+
const external_picocolors_namespaceObject = require("picocolors");
|
|
30
30
|
var external_picocolors_default = __webpack_require__.n(external_picocolors_namespaceObject);
|
|
31
|
-
|
|
31
|
+
const external_rslog_namespaceObject = require("rslog"), types_namespaceObject = require("@rsdoctor/types");
|
|
32
32
|
function debug(getMsg, prefix = '') {
|
|
33
33
|
process.env.DEBUG && (external_rslog_namespaceObject.logger.level = 'verbose', external_rslog_namespaceObject.logger.debug(`${prefix} ${getMsg()}`));
|
|
34
34
|
}
|
|
35
|
-
|
|
35
|
+
const rsdoctorLogger = (0, external_rslog_namespaceObject.createLogger)();
|
|
36
36
|
rsdoctorLogger.override({
|
|
37
37
|
log: (message)=>{
|
|
38
38
|
console.log(`${external_picocolors_default().green('[RSDOCTOR LOG]')} ${message}`);
|
|
@@ -59,9 +59,9 @@ rsdoctorLogger.override({
|
|
|
59
59
|
process.env.DEBUG && console.log(`${external_picocolors_default().blue('[RSDOCTOR DEBUG]')} ${message}`);
|
|
60
60
|
}
|
|
61
61
|
});
|
|
62
|
-
|
|
62
|
+
const _timers = new Map();
|
|
63
63
|
function time(label) {
|
|
64
|
-
process.env.DEBUG
|
|
64
|
+
process.env.DEBUG !== types_namespaceObject.Constants.RsdoctorProcessEnvDebugKey || _timers.has(label) || _timers.set(label, Date.now());
|
|
65
65
|
}
|
|
66
66
|
function timeEnd(label) {
|
|
67
67
|
if (process.env.DEBUG !== types_namespaceObject.Constants.RsdoctorProcessEnvDebugKey) return;
|
package/dist/logger.js
CHANGED
|
@@ -33,7 +33,7 @@ rsdoctorLogger.override({
|
|
|
33
33
|
});
|
|
34
34
|
let _timers = new Map();
|
|
35
35
|
function time(label) {
|
|
36
|
-
process.env.DEBUG
|
|
36
|
+
process.env.DEBUG !== Constants.RsdoctorProcessEnvDebugKey || _timers.has(label) || _timers.set(label, Date.now());
|
|
37
37
|
}
|
|
38
38
|
function timeEnd(label) {
|
|
39
39
|
if (process.env.DEBUG !== Constants.RsdoctorProcessEnvDebugKey) return;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './document';
|
|
2
|
-
export * from './types';
|
|
3
|
-
export * from './server';
|
|
1
|
+
export * from './document.js';
|
|
2
|
+
export * from './types.js';
|
|
3
|
+
export * from './server.js';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './document';
|
|
2
|
-
export * from './parser';
|
|
1
|
+
export * from './document/index.js';
|
|
2
|
+
export * from './parser/index.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from './asserts';
|
|
2
|
-
export * from './parser';
|
|
3
|
-
export * from './utils';
|
|
4
|
-
export * from './types';
|
|
1
|
+
export * from './asserts.js';
|
|
2
|
+
export * from './parser.js';
|
|
3
|
+
export * from './utils.js';
|
|
4
|
+
export * from './types.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Parser as AcornParser, Options, Position } from 'acorn';
|
|
2
2
|
import * as walk from 'acorn-walk';
|
|
3
|
-
import * as utils from './utils';
|
|
4
|
-
import type { Node } from './types';
|
|
3
|
+
import * as utils from './utils.js';
|
|
4
|
+
import type { Node } from './types.js';
|
|
5
5
|
export type { Options as ParseOptions } from 'acorn';
|
|
6
6
|
export interface ParseError extends Error {
|
|
7
7
|
loc?: Position;
|
package/dist/ruleUtils.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
2
|
+
const __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
3
|
var __webpack_require__ = {};
|
|
4
4
|
__webpack_require__.d = (exports1, definition)=>{
|
|
5
5
|
for(var key in definition)__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key) && Object.defineProperty(exports1, key, {
|
|
@@ -45,7 +45,7 @@ __webpack_require__.r(utils_namespaceObject), __webpack_require__.d(utils_namesp
|
|
|
45
45
|
isES6: ()=>isES6,
|
|
46
46
|
isSameSemantics: ()=>isSameSemantics
|
|
47
47
|
});
|
|
48
|
-
|
|
48
|
+
const external_lines_and_columns_namespaceObject = require("lines-and-columns");
|
|
49
49
|
function isUndefined(value) {
|
|
50
50
|
return void 0 === value;
|
|
51
51
|
}
|
|
@@ -67,7 +67,7 @@ function compact(array) {
|
|
|
67
67
|
function isNil(value) {
|
|
68
68
|
return null == value;
|
|
69
69
|
}
|
|
70
|
-
|
|
70
|
+
const isPlainObject = (obj)=>null !== obj && 'object' == typeof obj && Object.getPrototypeOf(obj) === Object.prototype, isString = (v)=>'string' == typeof v || !!v && 'object' == typeof v && !Array.isArray(v) && '[object String]' === ({}).toString.call(v);
|
|
71
71
|
function pick(obj, keys) {
|
|
72
72
|
let result = {};
|
|
73
73
|
for(let i = 0; i < keys.length; i++){
|
|
@@ -111,7 +111,7 @@ class Document {
|
|
|
111
111
|
return startTxt + data.newText + endTxt;
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
|
-
|
|
114
|
+
const store = new Map();
|
|
115
115
|
function getDocument(content) {
|
|
116
116
|
if (store.has(content)) return store.get(content);
|
|
117
117
|
let doc = new Document(content);
|
|
@@ -126,7 +126,7 @@ function isSyntaxNode(node) {
|
|
|
126
126
|
function assertCreator(type) {
|
|
127
127
|
return (node)=>isSyntaxNode(node) && node.type === type;
|
|
128
128
|
}
|
|
129
|
-
|
|
129
|
+
const asserts = {
|
|
130
130
|
isProgram: assertCreator('Program'),
|
|
131
131
|
isEmptyStatement: assertCreator('EmptyStatement'),
|
|
132
132
|
isBlockStatement: assertCreator('BlockStatement'),
|
|
@@ -285,7 +285,9 @@ function isES6(code) {
|
|
|
285
285
|
function detectECMAVersion(code) {
|
|
286
286
|
return isES6(code) ? isES5(code) ? types_ECMAVersion.ES5 : types_ECMAVersion.ES6 : types_ECMAVersion.ES7P;
|
|
287
287
|
}
|
|
288
|
-
|
|
288
|
+
const acornParserInternal = external_acorn_namespaceObject.Parser.extend(external_acorn_import_attributes_namespaceObject.importAttributes);
|
|
289
|
+
let acornParserExport = external_acorn_namespaceObject.Parser.extend(external_acorn_import_attributes_namespaceObject.importAttributes);
|
|
290
|
+
const parser = {
|
|
289
291
|
walk: external_acorn_walk_namespaceObject,
|
|
290
292
|
parse: (input, options)=>acornParserExport.parse(input, options),
|
|
291
293
|
parseExpressionAt: (input, pos, options)=>acornParserExport.parseExpressionAt(input, pos, options),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsdoctor/utils",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.3",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/web-infra-dev/rsdoctor",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"acorn-import-attributes": "^1.9.5",
|
|
69
69
|
"acorn-walk": "8.3.4",
|
|
70
70
|
"deep-eql": "4.1.4",
|
|
71
|
-
"envinfo": "7.
|
|
71
|
+
"envinfo": "7.18.0",
|
|
72
72
|
"fs-extra": "^11.1.1",
|
|
73
73
|
"get-port": "5.1.1",
|
|
74
74
|
"json-stream-stringify": "3.0.1",
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"picocolors": "^1.1.1",
|
|
77
77
|
"rslog": "^1.2.11",
|
|
78
78
|
"strip-ansi": "^6.0.1",
|
|
79
|
-
"@rsdoctor/types": "1.3.
|
|
79
|
+
"@rsdoctor/types": "1.3.3"
|
|
80
80
|
},
|
|
81
81
|
"devDependencies": {
|
|
82
82
|
"@types/babel__code-frame": "7.0.6",
|