@qwik.dev/devtools 0.2.1 → 0.2.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/plugin/index.d.ts +4 -1
- package/dist/plugin/index.js +2078 -595
- package/dist/ui/_virtual/browser.qwik.mjs +8 -0
- package/dist/ui/_virtual/browser.qwik2.mjs +4 -0
- package/dist/ui/components/DevtoolsButton/DevtoolsButton.qwik.mjs +1 -1
- package/dist/ui/components/DevtoolsPanel/DevtoolsPanel.qwik.mjs +1 -1
- package/dist/ui/components/Tab/Tab.qwik.mjs +1 -1
- package/dist/ui/components/TabContent/TabContent.qwik.mjs +1 -1
- package/dist/ui/components/ThemeToggle/QwikThemeToggle.qwik.mjs +1 -1
- package/dist/ui/components/Tree/Tree.qwik.mjs +1 -1
- package/dist/ui/devtools.qwik.mjs +73 -72
- package/dist/ui/features/Assets/Assets.qwik.mjs +3 -3
- package/dist/ui/features/CodeBreack/CodeBreack.qwik.mjs +4 -4
- package/dist/ui/features/CodeBreack/HtmlParser.qwik.mjs +13 -20
- package/dist/ui/features/CodeBreack/StateParser.qwik.mjs +13 -20
- package/dist/ui/features/Overview/Overview.qwik.mjs +17 -17
- package/dist/ui/features/Packages/Packages.qwik.mjs +4 -4
- package/dist/ui/features/Packages/components/DependencyCard/DependencyCard.qwik.mjs +9 -9
- package/dist/ui/features/Packages/components/PackageIcon/PackageIcon.qwik.mjs +1 -1
- package/dist/ui/features/Performance/Performance.qwik.mjs +307 -0
- package/dist/ui/features/Performance/computePerfViewModel.qwik.mjs +101 -0
- package/dist/ui/features/Performance/transformPerformanceData.qwik.mjs +34 -0
- package/dist/ui/features/RenderTree/RenderTree.qwik.mjs +38 -45
- package/dist/ui/features/RenderTree/TreeBuilder.qwik.mjs +181 -0
- package/dist/ui/features/RenderTree/data.qwik.mjs +30 -16
- package/dist/ui/features/RenderTree/formatTreeData.qwik.mjs +205 -230
- package/dist/ui/features/RenderTree/types.qwik.mjs +50 -0
- package/dist/ui/features/Routes/Routes.qwik.mjs +3 -3
- package/dist/ui/features/inspect/Inspect.qwik.mjs +1 -1
- package/dist/ui/global.css.qwik.mjs +1 -1
- package/dist/ui/lib-types/kit/src/globals.d.ts +56 -5
- package/dist/ui/lib-types/kit/src/index.d.ts +1 -0
- package/dist/ui/lib-types/kit/src/types.d.ts +9 -0
- package/dist/ui/lib-types/ui/src/features/Performance/Performance.d.ts +1 -0
- package/dist/ui/lib-types/ui/src/features/Performance/computePerfViewModel.d.ts +33 -0
- package/dist/ui/lib-types/ui/src/features/Performance/computePerfViewModel.test.d.ts +1 -0
- package/dist/ui/lib-types/ui/src/features/Performance/transformPerformanceData.d.ts +22 -0
- package/dist/ui/lib-types/ui/src/features/Performance/transformPerformanceData.test.d.ts +1 -0
- package/dist/ui/lib-types/ui/src/features/RenderTree/TreeBuilder.d.ts +60 -0
- package/dist/ui/lib-types/ui/src/features/RenderTree/data.d.ts +34 -8
- package/dist/ui/lib-types/ui/src/features/RenderTree/formatTreeData.d.ts +79 -148
- package/dist/ui/lib-types/ui/src/features/RenderTree/index.d.ts +6 -0
- package/dist/ui/lib-types/ui/src/features/RenderTree/types.d.ts +116 -0
- package/dist/ui/lib-types/ui/src/types/state.d.ts +1 -1
- package/dist/ui/lib-types/ui/src/utils/shiki.d.ts +2 -0
- package/dist/ui/node_modules/.pnpm/@qwikest_icons@0.0.13_@builder.io_qwik@1.11.0_vite@7.1.3_@types_node@20.14.11_jiti@2.6._02d306fcbd9f637dd624291702bff9c0/node_modules/@qwikest/icons/lib/hi.qwik.qwik.mjs +19 -0
- package/dist/ui/node_modules/.pnpm/debug@4.4.3_supports-color@5.5.0/node_modules/debug/src/browser.qwik.mjs +177 -0
- package/dist/ui/node_modules/.pnpm/debug@4.4.3_supports-color@5.5.0/node_modules/debug/src/common.qwik.mjs +182 -0
- package/dist/ui/node_modules/.pnpm/ms@2.1.3/node_modules/ms/index.qwik.mjs +120 -0
- package/dist/ui/packages/kit/src/constants.qwik.mjs +0 -2
- package/dist/ui/packages/kit/src/context.qwik.mjs +5 -4
- package/dist/ui/utils/shiki.qwik.mjs +23 -0
- package/package.json +3 -3
- package/dist/ui/features/RenderTree/transfromqseq.qwik.mjs +0 -91
- package/dist/ui/lib-types/ui/src/features/RenderTree/transfromqseq.d.ts +0 -7
package/dist/plugin/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { createRequire } from "module";
|
|
2
|
+
import VueInspector from "vite-plugin-inspect";
|
|
2
3
|
import fsp, { lstat, readFile, readdir, stat } from "node:fs/promises";
|
|
3
4
|
import path from "path";
|
|
4
5
|
import { join, relative, resolve } from "node:path/posix";
|
|
@@ -7,7 +8,6 @@ import { homedir } from "node:os";
|
|
|
7
8
|
import { createHash } from "node:crypto";
|
|
8
9
|
import { execSync } from "child_process";
|
|
9
10
|
import { parseSync } from "oxc-parser";
|
|
10
|
-
import VueInspector from "vite-plugin-inspect";
|
|
11
11
|
|
|
12
12
|
//#region rolldown:runtime
|
|
13
13
|
var __create = Object.create;
|
|
@@ -95,9 +95,9 @@ var require_fs$3 = __commonJS({ "../../node_modules/.pnpm/fast-glob@3.3.2/node_m
|
|
|
95
95
|
var require_path = __commonJS({ "../../node_modules/.pnpm/fast-glob@3.3.2/node_modules/fast-glob/out/utils/path.js"(exports) {
|
|
96
96
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
97
97
|
exports.convertPosixPathToPattern = exports.convertWindowsPathToPattern = exports.convertPathToPattern = exports.escapePosixPath = exports.escapeWindowsPath = exports.escape = exports.removeLeadingDotSegment = exports.makeAbsolute = exports.unixify = void 0;
|
|
98
|
-
const os$
|
|
98
|
+
const os$2 = __require("os");
|
|
99
99
|
const path$11 = __require("path");
|
|
100
|
-
const IS_WINDOWS_PLATFORM = os$
|
|
100
|
+
const IS_WINDOWS_PLATFORM = os$2.platform() === "win32";
|
|
101
101
|
const LEADING_DOT_SEGMENT_CHARACTERS_COUNT = 2;
|
|
102
102
|
/**
|
|
103
103
|
* All non-escaped special characters.
|
|
@@ -629,7 +629,7 @@ var require_to_regex_range = __commonJS({ "../../node_modules/.pnpm/to-regex-ran
|
|
|
629
629
|
//#endregion
|
|
630
630
|
//#region ../../node_modules/.pnpm/fill-range@7.1.1/node_modules/fill-range/index.js
|
|
631
631
|
var require_fill_range = __commonJS({ "../../node_modules/.pnpm/fill-range@7.1.1/node_modules/fill-range/index.js"(exports, module) {
|
|
632
|
-
const util$
|
|
632
|
+
const util$2 = __require("util");
|
|
633
633
|
const toRegexRange = require_to_regex_range();
|
|
634
634
|
const isObject$1 = (val) => val !== null && typeof val === "object" && !Array.isArray(val);
|
|
635
635
|
const transform = (toNumber) => {
|
|
@@ -702,7 +702,7 @@ var require_fill_range = __commonJS({ "../../node_modules/.pnpm/fill-range@7.1.1
|
|
|
702
702
|
return toRegexRange(start, end, options);
|
|
703
703
|
};
|
|
704
704
|
const rangeError = (...args) => {
|
|
705
|
-
return new RangeError("Invalid range arguments: " + util$
|
|
705
|
+
return new RangeError("Invalid range arguments: " + util$2.inspect(...args));
|
|
706
706
|
};
|
|
707
707
|
const invalidRange = (start, end, options) => {
|
|
708
708
|
if (options.strictRanges === true) throw rangeError([start, end]);
|
|
@@ -969,7 +969,7 @@ var require_parse$1 = __commonJS({ "../../node_modules/.pnpm/braces@3.0.3/node_m
|
|
|
969
969
|
/**
|
|
970
970
|
* parse
|
|
971
971
|
*/
|
|
972
|
-
const parse$
|
|
972
|
+
const parse$5 = (input, options = {}) => {
|
|
973
973
|
if (typeof input !== "string") throw new TypeError("Expected a string");
|
|
974
974
|
const opts = options || {};
|
|
975
975
|
const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH$1, opts.maxLength) : MAX_LENGTH$1;
|
|
@@ -1245,7 +1245,7 @@ var require_parse$1 = __commonJS({ "../../node_modules/.pnpm/braces@3.0.3/node_m
|
|
|
1245
1245
|
push({ type: "eos" });
|
|
1246
1246
|
return ast;
|
|
1247
1247
|
};
|
|
1248
|
-
module.exports = parse$
|
|
1248
|
+
module.exports = parse$5;
|
|
1249
1249
|
} });
|
|
1250
1250
|
|
|
1251
1251
|
//#endregion
|
|
@@ -1254,7 +1254,7 @@ var require_braces = __commonJS({ "../../node_modules/.pnpm/braces@3.0.3/node_mo
|
|
|
1254
1254
|
const stringify$1 = require_stringify();
|
|
1255
1255
|
const compile = require_compile();
|
|
1256
1256
|
const expand$1 = require_expand();
|
|
1257
|
-
const parse$
|
|
1257
|
+
const parse$4 = require_parse$1();
|
|
1258
1258
|
/**
|
|
1259
1259
|
* Expand the given pattern or create a regex-compatible string.
|
|
1260
1260
|
*
|
|
@@ -1292,7 +1292,7 @@ var require_braces = __commonJS({ "../../node_modules/.pnpm/braces@3.0.3/node_mo
|
|
|
1292
1292
|
* @return {Object} Returns an AST
|
|
1293
1293
|
* @api public
|
|
1294
1294
|
*/
|
|
1295
|
-
braces$1.parse = (input, options = {}) => parse$
|
|
1295
|
+
braces$1.parse = (input, options = {}) => parse$4(input, options);
|
|
1296
1296
|
/**
|
|
1297
1297
|
* Creates a braces string from an AST, or an AST node.
|
|
1298
1298
|
*
|
|
@@ -1918,7 +1918,7 @@ var require_parse = __commonJS({ "../../node_modules/.pnpm/picomatch@2.3.1/node_
|
|
|
1918
1918
|
* @param {Object} options
|
|
1919
1919
|
* @return {Object}
|
|
1920
1920
|
*/
|
|
1921
|
-
const parse$
|
|
1921
|
+
const parse$3 = (input, options) => {
|
|
1922
1922
|
if (typeof input !== "string") throw new TypeError("Expected a string");
|
|
1923
1923
|
input = REPLACEMENTS[input] || input;
|
|
1924
1924
|
const opts = { ...options };
|
|
@@ -2065,7 +2065,7 @@ var require_parse = __commonJS({ "../../node_modules/.pnpm/picomatch@2.3.1/node_
|
|
|
2065
2065
|
if (token.inner && token.inner.length > 1 && token.inner.includes("/")) extglobStar = globstar(opts);
|
|
2066
2066
|
if (extglobStar !== star$2 || eos() || /^\)+$/.test(remaining())) output = token.close = `)$))${extglobStar}`;
|
|
2067
2067
|
if (token.inner.includes("*") && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) {
|
|
2068
|
-
const expression = parse$
|
|
2068
|
+
const expression = parse$3(rest, {
|
|
2069
2069
|
...options,
|
|
2070
2070
|
fastpaths: false
|
|
2071
2071
|
}).output;
|
|
@@ -2086,10 +2086,10 @@ var require_parse = __commonJS({ "../../node_modules/.pnpm/picomatch@2.3.1/node_
|
|
|
2086
2086
|
*/
|
|
2087
2087
|
if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) {
|
|
2088
2088
|
let backslashes = false;
|
|
2089
|
-
let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars$1, first, rest, index) => {
|
|
2089
|
+
let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m$1, esc, chars$1, first, rest, index) => {
|
|
2090
2090
|
if (first === "\\") {
|
|
2091
2091
|
backslashes = true;
|
|
2092
|
-
return m;
|
|
2092
|
+
return m$1;
|
|
2093
2093
|
}
|
|
2094
2094
|
if (first === "?") {
|
|
2095
2095
|
if (esc) return esc + first + (rest ? QMARK$1.repeat(rest.length) : "");
|
|
@@ -2101,11 +2101,11 @@ var require_parse = __commonJS({ "../../node_modules/.pnpm/picomatch@2.3.1/node_
|
|
|
2101
2101
|
if (esc) return esc + first + (rest ? star$2 : "");
|
|
2102
2102
|
return star$2;
|
|
2103
2103
|
}
|
|
2104
|
-
return esc ? m : `\\${m}`;
|
|
2104
|
+
return esc ? m$1 : `\\${m$1}`;
|
|
2105
2105
|
});
|
|
2106
2106
|
if (backslashes === true) if (opts.unescape === true) output = output.replace(/\\/g, "");
|
|
2107
|
-
else output = output.replace(/\\+/g, (m) => {
|
|
2108
|
-
return m.length % 2 === 0 ? "\\\\" : m ? "\\" : "";
|
|
2107
|
+
else output = output.replace(/\\+/g, (m$1) => {
|
|
2108
|
+
return m$1.length % 2 === 0 ? "\\\\" : m$1 ? "\\" : "";
|
|
2109
2109
|
});
|
|
2110
2110
|
if (output === input && opts.contains === true) {
|
|
2111
2111
|
state.output = input;
|
|
@@ -2323,7 +2323,7 @@ var require_parse = __commonJS({ "../../node_modules/.pnpm/picomatch@2.3.1/node_
|
|
|
2323
2323
|
brace.value = brace.output = "\\{";
|
|
2324
2324
|
value = output = "\\}";
|
|
2325
2325
|
state.output = out;
|
|
2326
|
-
for (const t of toks) state.output += t.output || t.value;
|
|
2326
|
+
for (const t$1 of toks) state.output += t$1.output || t$1.value;
|
|
2327
2327
|
}
|
|
2328
2328
|
push({
|
|
2329
2329
|
type: "brace",
|
|
@@ -2703,7 +2703,7 @@ var require_parse = __commonJS({ "../../node_modules/.pnpm/picomatch@2.3.1/node_
|
|
|
2703
2703
|
* This can significantly speed up processing and has very little downside
|
|
2704
2704
|
* impact when none of the fast paths match.
|
|
2705
2705
|
*/
|
|
2706
|
-
parse$
|
|
2706
|
+
parse$3.fastpaths = (input, options) => {
|
|
2707
2707
|
const opts = { ...options };
|
|
2708
2708
|
const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
|
|
2709
2709
|
const len = input.length;
|
|
@@ -2748,7 +2748,7 @@ var require_parse = __commonJS({ "../../node_modules/.pnpm/picomatch@2.3.1/node_
|
|
|
2748
2748
|
if (source && opts.strictSlashes !== true) source += `${SLASH_LITERAL$1}?`;
|
|
2749
2749
|
return source;
|
|
2750
2750
|
};
|
|
2751
|
-
module.exports = parse$
|
|
2751
|
+
module.exports = parse$3;
|
|
2752
2752
|
} });
|
|
2753
2753
|
|
|
2754
2754
|
//#endregion
|
|
@@ -2756,7 +2756,7 @@ var require_parse = __commonJS({ "../../node_modules/.pnpm/picomatch@2.3.1/node_
|
|
|
2756
2756
|
var require_picomatch$1 = __commonJS({ "../../node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/picomatch.js"(exports, module) {
|
|
2757
2757
|
const path$8 = __require("path");
|
|
2758
2758
|
const scan = require_scan();
|
|
2759
|
-
const parse$
|
|
2759
|
+
const parse$2 = require_parse();
|
|
2760
2760
|
const utils$11 = require_utils$2();
|
|
2761
2761
|
const constants = require_constants$1();
|
|
2762
2762
|
const isObject = (val) => val && typeof val === "object" && !Array.isArray(val);
|
|
@@ -2928,7 +2928,7 @@ var require_picomatch$1 = __commonJS({ "../../node_modules/.pnpm/picomatch@2.3.1
|
|
|
2928
2928
|
*/
|
|
2929
2929
|
picomatch$1.parse = (pattern$1, options) => {
|
|
2930
2930
|
if (Array.isArray(pattern$1)) return pattern$1.map((p$1) => picomatch$1.parse(p$1, options));
|
|
2931
|
-
return parse$
|
|
2931
|
+
return parse$2(pattern$1, {
|
|
2932
2932
|
...options,
|
|
2933
2933
|
fastpaths: false
|
|
2934
2934
|
});
|
|
@@ -3006,8 +3006,8 @@ var require_picomatch$1 = __commonJS({ "../../node_modules/.pnpm/picomatch@2.3.1
|
|
|
3006
3006
|
negated: false,
|
|
3007
3007
|
fastpaths: true
|
|
3008
3008
|
};
|
|
3009
|
-
if (options.fastpaths !== false && (input[0] === "." || input[0] === "*")) parsed.output = parse$
|
|
3010
|
-
if (!parsed.output) parsed = parse$
|
|
3009
|
+
if (options.fastpaths !== false && (input[0] === "." || input[0] === "*")) parsed.output = parse$2.fastpaths(input, options);
|
|
3010
|
+
if (!parsed.output) parsed = parse$2(input, options);
|
|
3011
3011
|
return picomatch$1.compileRe(parsed, options, returnOutput, returnState);
|
|
3012
3012
|
};
|
|
3013
3013
|
/**
|
|
@@ -3055,7 +3055,7 @@ var require_picomatch = __commonJS({ "../../node_modules/.pnpm/picomatch@2.3.1/n
|
|
|
3055
3055
|
//#endregion
|
|
3056
3056
|
//#region ../../node_modules/.pnpm/micromatch@4.0.8/node_modules/micromatch/index.js
|
|
3057
3057
|
var require_micromatch = __commonJS({ "../../node_modules/.pnpm/micromatch@4.0.8/node_modules/micromatch/index.js"(exports, module) {
|
|
3058
|
-
const util = __require("util");
|
|
3058
|
+
const util$1 = __require("util");
|
|
3059
3059
|
const braces = require_braces();
|
|
3060
3060
|
const picomatch = require_picomatch();
|
|
3061
3061
|
const utils$10 = require_utils$2();
|
|
@@ -3213,7 +3213,7 @@ var require_micromatch = __commonJS({ "../../node_modules/.pnpm/micromatch@4.0.8
|
|
|
3213
3213
|
* @api public
|
|
3214
3214
|
*/
|
|
3215
3215
|
micromatch$1.contains = (str, pattern$1, options) => {
|
|
3216
|
-
if (typeof str !== "string") throw new TypeError(`Expected a string: "${util.inspect(str)}"`);
|
|
3216
|
+
if (typeof str !== "string") throw new TypeError(`Expected a string: "${util$1.inspect(str)}"`);
|
|
3217
3217
|
if (Array.isArray(pattern$1)) return pattern$1.some((p$1) => micromatch$1.contains(str, p$1, options));
|
|
3218
3218
|
if (typeof pattern$1 === "string") {
|
|
3219
3219
|
if (isEmptyString(str) || isEmptyString(pattern$1)) return false;
|
|
@@ -3334,7 +3334,7 @@ var require_micromatch = __commonJS({ "../../node_modules/.pnpm/micromatch@4.0.8
|
|
|
3334
3334
|
* @api public
|
|
3335
3335
|
*/
|
|
3336
3336
|
micromatch$1.all = (str, patterns, options) => {
|
|
3337
|
-
if (typeof str !== "string") throw new TypeError(`Expected a string: "${util.inspect(str)}"`);
|
|
3337
|
+
if (typeof str !== "string") throw new TypeError(`Expected a string: "${util$1.inspect(str)}"`);
|
|
3338
3338
|
return [].concat(patterns).every((p$1) => picomatch(p$1, options)(str));
|
|
3339
3339
|
};
|
|
3340
3340
|
/**
|
|
@@ -4109,7 +4109,7 @@ var require_utils = __commonJS({ "../../node_modules/.pnpm/@nodelib+fs.scandir@2
|
|
|
4109
4109
|
|
|
4110
4110
|
//#endregion
|
|
4111
4111
|
//#region ../../node_modules/.pnpm/@nodelib+fs.scandir@2.1.5/node_modules/@nodelib/fs.scandir/out/providers/common.js
|
|
4112
|
-
var require_common$
|
|
4112
|
+
var require_common$2 = __commonJS({ "../../node_modules/.pnpm/@nodelib+fs.scandir@2.1.5/node_modules/@nodelib/fs.scandir/out/providers/common.js"(exports) {
|
|
4113
4113
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4114
4114
|
exports.joinPathSegments = void 0;
|
|
4115
4115
|
function joinPathSegments$1(a, b, separator) {
|
|
@@ -4131,7 +4131,7 @@ var require_async$4 = __commonJS({ "../../node_modules/.pnpm/@nodelib+fs.scandir
|
|
|
4131
4131
|
const rpl = require_run_parallel();
|
|
4132
4132
|
const constants_1$1 = require_constants();
|
|
4133
4133
|
const utils$8 = require_utils();
|
|
4134
|
-
const common$4 = require_common$
|
|
4134
|
+
const common$4 = require_common$2();
|
|
4135
4135
|
function read$1(directory, settings, callback) {
|
|
4136
4136
|
if (!settings.stats && constants_1$1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) {
|
|
4137
4137
|
readdirWithFileTypes$1(directory, settings, callback);
|
|
@@ -4236,7 +4236,7 @@ var require_sync$4 = __commonJS({ "../../node_modules/.pnpm/@nodelib+fs.scandir@
|
|
|
4236
4236
|
const fsStat$4 = require_out$3();
|
|
4237
4237
|
const constants_1 = require_constants();
|
|
4238
4238
|
const utils$7 = require_utils();
|
|
4239
|
-
const common$3 = require_common$
|
|
4239
|
+
const common$3 = require_common$2();
|
|
4240
4240
|
function read(directory, settings) {
|
|
4241
4241
|
if (!settings.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) return readdirWithFileTypes(directory, settings);
|
|
4242
4242
|
return readdir$1(directory, settings);
|
|
@@ -4619,7 +4619,7 @@ var require_queue = __commonJS({ "../../node_modules/.pnpm/fastq@1.17.1/node_mod
|
|
|
4619
4619
|
|
|
4620
4620
|
//#endregion
|
|
4621
4621
|
//#region ../../node_modules/.pnpm/@nodelib+fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/readers/common.js
|
|
4622
|
-
var require_common = __commonJS({ "../../node_modules/.pnpm/@nodelib+fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/readers/common.js"(exports) {
|
|
4622
|
+
var require_common$1 = __commonJS({ "../../node_modules/.pnpm/@nodelib+fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/readers/common.js"(exports) {
|
|
4623
4623
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4624
4624
|
exports.joinPathSegments = exports.replacePathSegmentSeparator = exports.isAppliedFilter = exports.isFatalError = void 0;
|
|
4625
4625
|
function isFatalError(settings, error) {
|
|
@@ -4650,7 +4650,7 @@ var require_common = __commonJS({ "../../node_modules/.pnpm/@nodelib+fs.walk@1.2
|
|
|
4650
4650
|
//#region ../../node_modules/.pnpm/@nodelib+fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/readers/reader.js
|
|
4651
4651
|
var require_reader$1 = __commonJS({ "../../node_modules/.pnpm/@nodelib+fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/readers/reader.js"(exports) {
|
|
4652
4652
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4653
|
-
const common$2 = require_common();
|
|
4653
|
+
const common$2 = require_common$1();
|
|
4654
4654
|
var Reader$1 = class {
|
|
4655
4655
|
constructor(_root, _settings) {
|
|
4656
4656
|
this._root = _root;
|
|
@@ -4668,7 +4668,7 @@ var require_async$3 = __commonJS({ "../../node_modules/.pnpm/@nodelib+fs.walk@1.
|
|
|
4668
4668
|
const events_1 = __require("events");
|
|
4669
4669
|
const fsScandir$2 = require_out$2();
|
|
4670
4670
|
const fastq = require_queue();
|
|
4671
|
-
const common$1 = require_common();
|
|
4671
|
+
const common$1 = require_common$1();
|
|
4672
4672
|
const reader_1$4 = require_reader$1();
|
|
4673
4673
|
var AsyncReader = class extends reader_1$4.default {
|
|
4674
4674
|
constructor(_root, _settings) {
|
|
@@ -4822,7 +4822,7 @@ var require_stream$2 = __commonJS({ "../../node_modules/.pnpm/@nodelib+fs.walk@1
|
|
|
4822
4822
|
var require_sync$3 = __commonJS({ "../../node_modules/.pnpm/@nodelib+fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/readers/sync.js"(exports) {
|
|
4823
4823
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4824
4824
|
const fsScandir$1 = require_out$2();
|
|
4825
|
-
const common = require_common();
|
|
4825
|
+
const common = require_common$1();
|
|
4826
4826
|
const reader_1$3 = require_reader$1();
|
|
4827
4827
|
var SyncReader = class extends reader_1$3.default {
|
|
4828
4828
|
constructor() {
|
|
@@ -5486,12 +5486,12 @@ var require_settings = __commonJS({ "../../node_modules/.pnpm/fast-glob@3.3.2/no
|
|
|
5486
5486
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5487
5487
|
exports.DEFAULT_FILE_SYSTEM_ADAPTER = void 0;
|
|
5488
5488
|
const fs = __require("fs");
|
|
5489
|
-
const os = __require("os");
|
|
5489
|
+
const os$1 = __require("os");
|
|
5490
5490
|
/**
|
|
5491
5491
|
* The `os.cpus` method can return zero. We expect the number of cores to be greater than zero.
|
|
5492
5492
|
* https://github.com/nodejs/node/blob/7faeddf23a98c53896f8b574a6e66589e8fb1eb8/lib/os.js#L106-L107
|
|
5493
5493
|
*/
|
|
5494
|
-
const CPU_COUNT = Math.max(os.cpus().length, 1);
|
|
5494
|
+
const CPU_COUNT = Math.max(os$1.cpus().length, 1);
|
|
5495
5495
|
exports.DEFAULT_FILE_SYSTEM_ADAPTER = {
|
|
5496
5496
|
lstat: fs.lstat,
|
|
5497
5497
|
lstatSync: fs.lstatSync,
|
|
@@ -5714,8 +5714,8 @@ var require_balanced_match = __commonJS({ "../../node_modules/.pnpm/balanced-mat
|
|
|
5714
5714
|
};
|
|
5715
5715
|
}
|
|
5716
5716
|
function maybeMatch(reg, str) {
|
|
5717
|
-
var m = str.match(reg);
|
|
5718
|
-
return m ? m[0] : null;
|
|
5717
|
+
var m$1 = str.match(reg);
|
|
5718
|
+
return m$1 ? m$1[0] : null;
|
|
5719
5719
|
}
|
|
5720
5720
|
balanced$1.range = range;
|
|
5721
5721
|
function range(a, b, str) {
|
|
@@ -5770,11 +5770,11 @@ var require_brace_expansion = __commonJS({ "../../node_modules/.pnpm/brace-expan
|
|
|
5770
5770
|
function parseCommaParts(str) {
|
|
5771
5771
|
if (!str) return [""];
|
|
5772
5772
|
var parts = [];
|
|
5773
|
-
var m = balanced("{", "}", str);
|
|
5774
|
-
if (!m) return str.split(",");
|
|
5775
|
-
var pre = m.pre;
|
|
5776
|
-
var body = m.body;
|
|
5777
|
-
var post = m.post;
|
|
5773
|
+
var m$1 = balanced("{", "}", str);
|
|
5774
|
+
if (!m$1) return str.split(",");
|
|
5775
|
+
var pre = m$1.pre;
|
|
5776
|
+
var body = m$1.body;
|
|
5777
|
+
var post = m$1.post;
|
|
5778
5778
|
var p$1 = pre.split(",");
|
|
5779
5779
|
p$1[p$1.length - 1] += "{" + body + "}";
|
|
5780
5780
|
var postParts = parseCommaParts(post);
|
|
@@ -5796,60 +5796,60 @@ var require_brace_expansion = __commonJS({ "../../node_modules/.pnpm/brace-expan
|
|
|
5796
5796
|
function isPadded(el) {
|
|
5797
5797
|
return /^-?0\d/.test(el);
|
|
5798
5798
|
}
|
|
5799
|
-
function lte(i, y) {
|
|
5800
|
-
return i <= y;
|
|
5799
|
+
function lte(i, y$1) {
|
|
5800
|
+
return i <= y$1;
|
|
5801
5801
|
}
|
|
5802
|
-
function gte(i, y) {
|
|
5803
|
-
return i >= y;
|
|
5802
|
+
function gte(i, y$1) {
|
|
5803
|
+
return i >= y$1;
|
|
5804
5804
|
}
|
|
5805
5805
|
function expand(str, isTop) {
|
|
5806
5806
|
var expansions = [];
|
|
5807
|
-
var m = balanced("{", "}", str);
|
|
5808
|
-
if (!m) return [str];
|
|
5809
|
-
var pre = m.pre;
|
|
5810
|
-
var post = m.post.length ? expand(m.post, false) : [""];
|
|
5811
|
-
if (/\$$/.test(m.pre)) for (var k$1 = 0; k$1 < post.length; k$1++) {
|
|
5812
|
-
var expansion = pre + "{" + m.body + "}" + post[k$1];
|
|
5807
|
+
var m$1 = balanced("{", "}", str);
|
|
5808
|
+
if (!m$1) return [str];
|
|
5809
|
+
var pre = m$1.pre;
|
|
5810
|
+
var post = m$1.post.length ? expand(m$1.post, false) : [""];
|
|
5811
|
+
if (/\$$/.test(m$1.pre)) for (var k$1 = 0; k$1 < post.length; k$1++) {
|
|
5812
|
+
var expansion = pre + "{" + m$1.body + "}" + post[k$1];
|
|
5813
5813
|
expansions.push(expansion);
|
|
5814
5814
|
}
|
|
5815
5815
|
else {
|
|
5816
|
-
var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
|
|
5817
|
-
var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
|
|
5816
|
+
var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m$1.body);
|
|
5817
|
+
var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m$1.body);
|
|
5818
5818
|
var isSequence = isNumericSequence || isAlphaSequence;
|
|
5819
|
-
var isOptions = m.body.indexOf(",") >= 0;
|
|
5819
|
+
var isOptions = m$1.body.indexOf(",") >= 0;
|
|
5820
5820
|
if (!isSequence && !isOptions) {
|
|
5821
|
-
if (m.post.match(/,.*\}/)) {
|
|
5822
|
-
str = m.pre + "{" + m.body + escClose + m.post;
|
|
5821
|
+
if (m$1.post.match(/,.*\}/)) {
|
|
5822
|
+
str = m$1.pre + "{" + m$1.body + escClose + m$1.post;
|
|
5823
5823
|
return expand(str);
|
|
5824
5824
|
}
|
|
5825
5825
|
return [str];
|
|
5826
5826
|
}
|
|
5827
5827
|
var n;
|
|
5828
|
-
if (isSequence) n = m.body.split(/\.\./);
|
|
5828
|
+
if (isSequence) n = m$1.body.split(/\.\./);
|
|
5829
5829
|
else {
|
|
5830
|
-
n = parseCommaParts(m.body);
|
|
5830
|
+
n = parseCommaParts(m$1.body);
|
|
5831
5831
|
if (n.length === 1) {
|
|
5832
5832
|
n = expand(n[0], false).map(embrace);
|
|
5833
5833
|
if (n.length === 1) return post.map(function(p$1) {
|
|
5834
|
-
return m.pre + n[0] + p$1;
|
|
5834
|
+
return m$1.pre + n[0] + p$1;
|
|
5835
5835
|
});
|
|
5836
5836
|
}
|
|
5837
5837
|
}
|
|
5838
5838
|
var N;
|
|
5839
5839
|
if (isSequence) {
|
|
5840
5840
|
var x$1 = numeric(n[0]);
|
|
5841
|
-
var y = numeric(n[1]);
|
|
5841
|
+
var y$1 = numeric(n[1]);
|
|
5842
5842
|
var width = Math.max(n[0].length, n[1].length);
|
|
5843
5843
|
var incr = n.length == 3 ? Math.abs(numeric(n[2])) : 1;
|
|
5844
5844
|
var test = lte;
|
|
5845
|
-
var reverse = y < x$1;
|
|
5845
|
+
var reverse = y$1 < x$1;
|
|
5846
5846
|
if (reverse) {
|
|
5847
5847
|
incr *= -1;
|
|
5848
5848
|
test = gte;
|
|
5849
5849
|
}
|
|
5850
5850
|
var pad$1 = n.some(isPadded);
|
|
5851
5851
|
N = [];
|
|
5852
|
-
for (var i = x$1; test(i, y); i += incr) {
|
|
5852
|
+
for (var i = x$1; test(i, y$1); i += incr) {
|
|
5853
5853
|
var c;
|
|
5854
5854
|
if (isAlphaSequence) {
|
|
5855
5855
|
c = String.fromCharCode(i);
|
|
@@ -5911,8 +5911,8 @@ const posixClasses = {
|
|
|
5911
5911
|
"[:word:]": ["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}", true],
|
|
5912
5912
|
"[:xdigit:]": ["A-Fa-f0-9", false]
|
|
5913
5913
|
};
|
|
5914
|
-
const braceEscape = (s) => s.replace(/[[\]\\-]/g, "\\$&");
|
|
5915
|
-
const regexpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
|
5914
|
+
const braceEscape = (s$1) => s$1.replace(/[[\]\\-]/g, "\\$&");
|
|
5915
|
+
const regexpEscape = (s$1) => s$1.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
|
5916
5916
|
const rangesToString = (ranges) => ranges.join("");
|
|
5917
5917
|
const parseClass = (glob, position) => {
|
|
5918
5918
|
const pos = position;
|
|
@@ -6031,8 +6031,8 @@ const parseClass = (glob, position) => {
|
|
|
6031
6031
|
* Slashes (and backslashes in `windowsPathsNoEscape` mode) cannot be escaped
|
|
6032
6032
|
* or unescaped.
|
|
6033
6033
|
*/
|
|
6034
|
-
const unescape = (s, { windowsPathsNoEscape = false } = {}) => {
|
|
6035
|
-
return windowsPathsNoEscape ? s.replace(/\[([^\/\\])\]/g, "$1") : s.replace(/((?!\\).|^)\[([^\/\\])\]/g, "$1$2").replace(/\\([^\/])/g, "$1");
|
|
6034
|
+
const unescape = (s$1, { windowsPathsNoEscape = false } = {}) => {
|
|
6035
|
+
return windowsPathsNoEscape ? s$1.replace(/\[([^\/\\])\]/g, "$1") : s$1.replace(/((?!\\).|^)\[([^\/\\])\]/g, "$1$2").replace(/\\([^\/])/g, "$1");
|
|
6036
6036
|
};
|
|
6037
6037
|
|
|
6038
6038
|
//#endregion
|
|
@@ -6050,7 +6050,7 @@ const startNoDot = "(?!\\.)";
|
|
|
6050
6050
|
const addPatternStart = new Set(["[", "."]);
|
|
6051
6051
|
const justDots = new Set(["..", "."]);
|
|
6052
6052
|
const reSpecials = new Set("().*{}+?[]^$\\!");
|
|
6053
|
-
const regExpEscape$1 = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
|
6053
|
+
const regExpEscape$1 = (s$1) => s$1.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
|
6054
6054
|
const qmark$1 = "[^/]";
|
|
6055
6055
|
const star$1 = qmark$1 + "*?";
|
|
6056
6056
|
const starNoEmpty = qmark$1 + "+?";
|
|
@@ -6315,12 +6315,12 @@ var AST = class AST {
|
|
|
6315
6315
|
const start = this.type === "!" ? "(?:(?!(?:" : "(?:";
|
|
6316
6316
|
let body = this.#partsToRegExp(dot);
|
|
6317
6317
|
if (this.isStart() && this.isEnd() && !body && this.type !== "!") {
|
|
6318
|
-
const s = this.toString();
|
|
6319
|
-
this.#parts = [s];
|
|
6318
|
+
const s$1 = this.toString();
|
|
6319
|
+
this.#parts = [s$1];
|
|
6320
6320
|
this.type = null;
|
|
6321
6321
|
this.#hasMagic = void 0;
|
|
6322
6322
|
return [
|
|
6323
|
-
s,
|
|
6323
|
+
s$1,
|
|
6324
6324
|
unescape(this.toString()),
|
|
6325
6325
|
false,
|
|
6326
6326
|
false
|
|
@@ -6411,8 +6411,8 @@ var AST = class AST {
|
|
|
6411
6411
|
* that exact character. In this mode, `\` is _not_ escaped, because it is
|
|
6412
6412
|
* not interpreted as a magic character, but instead as a path separator.
|
|
6413
6413
|
*/
|
|
6414
|
-
const escape = (s, { windowsPathsNoEscape = false } = {}) => {
|
|
6415
|
-
return windowsPathsNoEscape ? s.replace(/[?*()[\]]/g, "[$&]") : s.replace(/[?*()[\]\\]/g, "\\$&");
|
|
6414
|
+
const escape = (s$1, { windowsPathsNoEscape = false } = {}) => {
|
|
6415
|
+
return windowsPathsNoEscape ? s$1.replace(/[?*()[\]]/g, "[$&]") : s$1.replace(/[?*()[\]\\]/g, "\\$&");
|
|
6416
6416
|
};
|
|
6417
6417
|
|
|
6418
6418
|
//#endregion
|
|
@@ -6491,8 +6491,8 @@ const ext = (a, b = {}) => Object.assign({}, a, b);
|
|
|
6491
6491
|
const defaults = (def) => {
|
|
6492
6492
|
if (!def || typeof def !== "object" || !Object.keys(def).length) return minimatch;
|
|
6493
6493
|
const orig = minimatch;
|
|
6494
|
-
const m = (p$1, pattern$1, options = {}) => orig(p$1, pattern$1, ext(def, options));
|
|
6495
|
-
return Object.assign(m, {
|
|
6494
|
+
const m$1 = (p$1, pattern$1, options = {}) => orig(p$1, pattern$1, ext(def, options));
|
|
6495
|
+
return Object.assign(m$1, {
|
|
6496
6496
|
Minimatch: class Minimatch$1 extends orig.Minimatch {
|
|
6497
6497
|
constructor(pattern$1, options = {}) {
|
|
6498
6498
|
super(pattern$1, ext(def, options));
|
|
@@ -6511,8 +6511,8 @@ const defaults = (def) => {
|
|
|
6511
6511
|
return orig.AST.fromGlob(pattern$1, ext(def, options));
|
|
6512
6512
|
}
|
|
6513
6513
|
},
|
|
6514
|
-
unescape: (s, options = {}) => orig.unescape(s, ext(def, options)),
|
|
6515
|
-
escape: (s, options = {}) => orig.escape(s, ext(def, options)),
|
|
6514
|
+
unescape: (s$1, options = {}) => orig.unescape(s$1, ext(def, options)),
|
|
6515
|
+
escape: (s$1, options = {}) => orig.escape(s$1, ext(def, options)),
|
|
6516
6516
|
filter: (pattern$1, options = {}) => orig.filter(pattern$1, ext(def, options)),
|
|
6517
6517
|
defaults: (options) => orig.defaults(ext(def, options)),
|
|
6518
6518
|
makeRe: (pattern$1, options = {}) => orig.makeRe(pattern$1, ext(def, options)),
|
|
@@ -6539,7 +6539,7 @@ const match = (list, pattern$1, options = {}) => {
|
|
|
6539
6539
|
};
|
|
6540
6540
|
minimatch.match = match;
|
|
6541
6541
|
const globMagic = /[?*]|[+@!]\(.*?\)|\[|\]/;
|
|
6542
|
-
const regExpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
|
6542
|
+
const regExpEscape = (s$1) => s$1.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
|
6543
6543
|
var Minimatch = class {
|
|
6544
6544
|
options;
|
|
6545
6545
|
set;
|
|
@@ -6602,20 +6602,20 @@ var Minimatch = class {
|
|
|
6602
6602
|
this.globSet = [...new Set(this.braceExpand())];
|
|
6603
6603
|
if (options.debug) this.debug = (...args) => console.error(...args);
|
|
6604
6604
|
this.debug(this.pattern, this.globSet);
|
|
6605
|
-
const rawGlobParts = this.globSet.map((s) => this.slashSplit(s));
|
|
6605
|
+
const rawGlobParts = this.globSet.map((s$1) => this.slashSplit(s$1));
|
|
6606
6606
|
this.globParts = this.preprocess(rawGlobParts);
|
|
6607
6607
|
this.debug(this.pattern, this.globParts);
|
|
6608
|
-
let set = this.globParts.map((s, _, __) => {
|
|
6608
|
+
let set = this.globParts.map((s$1, _, __) => {
|
|
6609
6609
|
if (this.isWindows && this.windowsNoMagicRoot) {
|
|
6610
|
-
const isUNC = s[0] === "" && s[1] === "" && (s[2] === "?" || !globMagic.test(s[2])) && !globMagic.test(s[3]);
|
|
6611
|
-
const isDrive = /^[a-z]:/i.test(s[0]);
|
|
6612
|
-
if (isUNC) return [...s.slice(0, 4), ...s.slice(4).map((ss) => this.parse(ss))];
|
|
6613
|
-
else if (isDrive) return [s[0], ...s.slice(1).map((ss) => this.parse(ss))];
|
|
6610
|
+
const isUNC = s$1[0] === "" && s$1[1] === "" && (s$1[2] === "?" || !globMagic.test(s$1[2])) && !globMagic.test(s$1[3]);
|
|
6611
|
+
const isDrive = /^[a-z]:/i.test(s$1[0]);
|
|
6612
|
+
if (isUNC) return [...s$1.slice(0, 4), ...s$1.slice(4).map((ss) => this.parse(ss))];
|
|
6613
|
+
else if (isDrive) return [s$1[0], ...s$1.slice(1).map((ss) => this.parse(ss))];
|
|
6614
6614
|
}
|
|
6615
|
-
return s.map((ss) => this.parse(ss));
|
|
6615
|
+
return s$1.map((ss) => this.parse(ss));
|
|
6616
6616
|
});
|
|
6617
6617
|
this.debug(this.pattern, set);
|
|
6618
|
-
this.set = set.filter((s) => s.indexOf(false) === -1);
|
|
6618
|
+
this.set = set.filter((s$1) => s$1.indexOf(false) === -1);
|
|
6619
6619
|
if (this.isWindows) for (let i = 0; i < this.set.length; i++) {
|
|
6620
6620
|
const p$1 = this.set[i];
|
|
6621
6621
|
if (p$1[0] === "" && p$1[1] === "" && this.globParts[i][2] === "?" && typeof p$1[3] === "string" && /^[a-z]:$/i.test(p$1[3])) p$1[2] = "?";
|
|
@@ -6893,13 +6893,13 @@ var Minimatch = class {
|
|
|
6893
6893
|
const options = this.options;
|
|
6894
6894
|
if (pattern$1 === "**") return GLOBSTAR;
|
|
6895
6895
|
if (pattern$1 === "") return "";
|
|
6896
|
-
let m;
|
|
6896
|
+
let m$1;
|
|
6897
6897
|
let fastTest = null;
|
|
6898
|
-
if (m = pattern$1.match(starRE)) fastTest = options.dot ? starTestDot : starTest;
|
|
6899
|
-
else if (m = pattern$1.match(starDotExtRE)) fastTest = (options.nocase ? options.dot ? starDotExtTestNocaseDot : starDotExtTestNocase : options.dot ? starDotExtTestDot : starDotExtTest)(m[1]);
|
|
6900
|
-
else if (m = pattern$1.match(qmarksRE)) fastTest = (options.nocase ? options.dot ? qmarksTestNocaseDot : qmarksTestNocase : options.dot ? qmarksTestDot : qmarksTest)(m);
|
|
6901
|
-
else if (m = pattern$1.match(starDotStarRE)) fastTest = options.dot ? starDotStarTestDot : starDotStarTest;
|
|
6902
|
-
else if (m = pattern$1.match(dotStarRE)) fastTest = dotStarTest;
|
|
6898
|
+
if (m$1 = pattern$1.match(starRE)) fastTest = options.dot ? starTestDot : starTest;
|
|
6899
|
+
else if (m$1 = pattern$1.match(starDotExtRE)) fastTest = (options.nocase ? options.dot ? starDotExtTestNocaseDot : starDotExtTestNocase : options.dot ? starDotExtTestDot : starDotExtTest)(m$1[1]);
|
|
6900
|
+
else if (m$1 = pattern$1.match(qmarksRE)) fastTest = (options.nocase ? options.dot ? qmarksTestNocaseDot : qmarksTestNocase : options.dot ? qmarksTestDot : qmarksTest)(m$1);
|
|
6901
|
+
else if (m$1 = pattern$1.match(starDotStarRE)) fastTest = options.dot ? starDotStarTestDot : starDotStarTest;
|
|
6902
|
+
else if (m$1 = pattern$1.match(dotStarRE)) fastTest = dotStarTest;
|
|
6903
6903
|
const re$1 = AST.fromGlob(pattern$1, this.options).toMMPattern();
|
|
6904
6904
|
if (fastTest && typeof re$1 === "object") Reflect.defineProperty(re$1, "test", { value: fastTest });
|
|
6905
6905
|
return re$1;
|
|
@@ -7039,65 +7039,65 @@ var re = ((n) => (n.DIRECTORY = "directory", n.FILE = "file", n))(re || {}), ne
|
|
|
7039
7039
|
symbols: ie,
|
|
7040
7040
|
skipErrors: !0
|
|
7041
7041
|
};
|
|
7042
|
-
function w(r, t) {
|
|
7043
|
-
return resolve$1(t.homeShortcut ? r.replace(/^~($|\/|\\)/, homedir() + "$1") : r);
|
|
7042
|
+
function w$1(r, t$1) {
|
|
7043
|
+
return resolve$1(t$1.homeShortcut ? r.replace(/^~($|\/|\\)/, homedir() + "$1") : r);
|
|
7044
7044
|
}
|
|
7045
7045
|
function S(r) {
|
|
7046
|
-
return (Array.isArray(r) ? r : [r]).map((t) => t instanceof RegExp ? t : makeRe(t, { dot: !0 })).filter((t) => t instanceof RegExp);
|
|
7046
|
+
return (Array.isArray(r) ? r : [r]).map((t$1) => t$1 instanceof RegExp ? t$1 : makeRe(t$1, { dot: !0 })).filter((t$1) => t$1 instanceof RegExp);
|
|
7047
7047
|
}
|
|
7048
7048
|
function V(r) {
|
|
7049
|
-
let t = {};
|
|
7049
|
+
let t$1 = {};
|
|
7050
7050
|
if (r) {
|
|
7051
|
-
for (let n in p) t[n] = r[n] !== void 0 ? r[n] : p[n];
|
|
7052
|
-
t.depth < 0 && (t.depth = 0);
|
|
7053
|
-
} else t = p;
|
|
7054
|
-
return t;
|
|
7051
|
+
for (let n in p) t$1[n] = r[n] !== void 0 ? r[n] : p[n];
|
|
7052
|
+
t$1.depth < 0 && (t$1.depth = 0);
|
|
7053
|
+
} else t$1 = p;
|
|
7054
|
+
return t$1;
|
|
7055
7055
|
}
|
|
7056
7056
|
function C(r) {
|
|
7057
|
-
let t = [
|
|
7057
|
+
let t$1 = [
|
|
7058
7058
|
"B",
|
|
7059
7059
|
"KB",
|
|
7060
7060
|
"MB",
|
|
7061
7061
|
"GB",
|
|
7062
7062
|
"TB"
|
|
7063
7063
|
], n;
|
|
7064
|
-
for (n = 0; n < t.length && r > 1e3; n++) r /= 1e3;
|
|
7065
|
-
return Math.round(r * 100) / 100 + " " + t[n];
|
|
7064
|
+
for (n = 0; n < t$1.length && r > 1e3; n++) r /= 1e3;
|
|
7065
|
+
return Math.round(r * 100) / 100 + " " + t$1[n];
|
|
7066
7066
|
}
|
|
7067
|
-
function x(r, t) {
|
|
7068
|
-
return r.localeCompare(t);
|
|
7067
|
+
function x(r, t$1) {
|
|
7068
|
+
return r.localeCompare(t$1);
|
|
7069
7069
|
}
|
|
7070
|
-
function A(r, t) {
|
|
7071
|
-
return r.toLowerCase().localeCompare(t.toLowerCase());
|
|
7070
|
+
function A(r, t$1) {
|
|
7071
|
+
return r.toLowerCase().localeCompare(t$1.toLowerCase());
|
|
7072
7072
|
}
|
|
7073
|
-
function k(r, t) {
|
|
7074
|
-
if (!t) return r;
|
|
7075
|
-
if (t === !0) return r.sort(x);
|
|
7076
|
-
if (typeof t == "string") switch (t) {
|
|
7073
|
+
function k(r, t$1) {
|
|
7074
|
+
if (!t$1) return r;
|
|
7075
|
+
if (t$1 === !0) return r.sort(x);
|
|
7076
|
+
if (typeof t$1 == "string") switch (t$1) {
|
|
7077
7077
|
case "alpha": return r.sort(x);
|
|
7078
7078
|
case "antialpha": return r.sort(x).reverse();
|
|
7079
7079
|
case "alpha-insensitive": return r.sort(A);
|
|
7080
7080
|
case "antialpha-insensitive": return r.sort(A).reverse();
|
|
7081
7081
|
default: return r;
|
|
7082
7082
|
}
|
|
7083
|
-
else if (typeof t == "function") return r.sort(t);
|
|
7083
|
+
else if (typeof t$1 == "function") return r.sort(t$1);
|
|
7084
7084
|
}
|
|
7085
|
-
function z(r, t) {
|
|
7086
|
-
return x(r.name, t.name);
|
|
7085
|
+
function z(r, t$1) {
|
|
7086
|
+
return x(r.name, t$1.name);
|
|
7087
7087
|
}
|
|
7088
|
-
function Y(r, t) {
|
|
7089
|
-
return A(r.name, t.name);
|
|
7088
|
+
function Y(r, t$1) {
|
|
7089
|
+
return A(r.name, t$1.name);
|
|
7090
7090
|
}
|
|
7091
|
-
function le(r, t) {
|
|
7092
|
-
return r.type === "directory" && t.type === "file" ? -1 : r.type === "file" && t.type === "directory" ? 1 : 0;
|
|
7091
|
+
function le(r, t$1) {
|
|
7092
|
+
return r.type === "directory" && t$1.type === "file" ? -1 : r.type === "file" && t$1.type === "directory" ? 1 : 0;
|
|
7093
7093
|
}
|
|
7094
|
-
function ae(r, t) {
|
|
7095
|
-
return r.type === "file" && t.type === "directory" ? -1 : r.type === "directory" && t.type === "file" ? 1 : 0;
|
|
7094
|
+
function ae(r, t$1) {
|
|
7095
|
+
return r.type === "file" && t$1.type === "directory" ? -1 : r.type === "directory" && t$1.type === "file" ? 1 : 0;
|
|
7096
7096
|
}
|
|
7097
|
-
function $(r, t) {
|
|
7098
|
-
if (!t) return r;
|
|
7099
|
-
if (t === !0) return r.sort(z);
|
|
7100
|
-
if (typeof t == "string") switch (t) {
|
|
7097
|
+
function $(r, t$1) {
|
|
7098
|
+
if (!t$1) return r;
|
|
7099
|
+
if (t$1 === !0) return r.sort(z);
|
|
7100
|
+
if (typeof t$1 == "string") switch (t$1) {
|
|
7101
7101
|
case "alpha": return r.sort(z);
|
|
7102
7102
|
case "antialpha": return r.sort(z).reverse();
|
|
7103
7103
|
case "alpha-insensitive": return r.sort(Y);
|
|
@@ -7106,95 +7106,95 @@ function $(r, t) {
|
|
|
7106
7106
|
case "files-first": return r.sort(ae);
|
|
7107
7107
|
default: return r;
|
|
7108
7108
|
}
|
|
7109
|
-
else if (typeof t == "function") return r.sort(t);
|
|
7109
|
+
else if (typeof t$1 == "function") return r.sort(t$1);
|
|
7110
7110
|
}
|
|
7111
|
-
async function G(r, t, n, e, l, o) {
|
|
7111
|
+
async function G(r, t$1, n, e, l, o) {
|
|
7112
7112
|
if (e.depth !== void 0 && n > e.depth) return null;
|
|
7113
|
-
let a = r === t ? "." : relative$1(r, t);
|
|
7114
|
-
if (e.exclude && r !== t && S(e.exclude).some((b) => b.test(`/${a}`))) return null;
|
|
7115
|
-
let s = basename(t), h;
|
|
7113
|
+
let a = r === t$1 ? "." : relative$1(r, t$1);
|
|
7114
|
+
if (e.exclude && r !== t$1 && S(e.exclude).some((b) => b.test(`/${a}`))) return null;
|
|
7115
|
+
let s$1 = basename(t$1), h$1;
|
|
7116
7116
|
try {
|
|
7117
|
-
h = await stat(t);
|
|
7117
|
+
h$1 = await stat(t$1);
|
|
7118
7118
|
} catch (c) {
|
|
7119
7119
|
if (e.skipErrors) return null;
|
|
7120
7120
|
throw c;
|
|
7121
7121
|
}
|
|
7122
7122
|
let i;
|
|
7123
7123
|
try {
|
|
7124
|
-
i = await lstat(t);
|
|
7124
|
+
i = await lstat(t$1);
|
|
7125
7125
|
} catch (c) {
|
|
7126
7126
|
if (e.skipErrors) return null;
|
|
7127
7127
|
throw c;
|
|
7128
7128
|
}
|
|
7129
|
-
let m = i.isSymbolicLink(), g = h.isFile() ? "file" : "directory";
|
|
7130
|
-
if (!e.showHidden && s.charAt(0) === "." || !e.symbolicLinks && m) return null;
|
|
7129
|
+
let m$1 = i.isSymbolicLink(), g = h$1.isFile() ? "file" : "directory";
|
|
7130
|
+
if (!e.showHidden && s$1.charAt(0) === "." || !e.symbolicLinks && m$1) return null;
|
|
7131
7131
|
let E;
|
|
7132
7132
|
if (e.hash) {
|
|
7133
7133
|
let c = e.hashAlgorithm;
|
|
7134
|
-
E = createHash(c), E.update(s);
|
|
7134
|
+
E = createHash(c), E.update(s$1);
|
|
7135
7135
|
}
|
|
7136
7136
|
let u = {
|
|
7137
|
-
name: s,
|
|
7138
|
-
path: e.normalize ? t.replace(/\\/g, "/") : t,
|
|
7137
|
+
name: s$1,
|
|
7138
|
+
path: e.normalize ? t$1.replace(/\\/g, "/") : t$1,
|
|
7139
7139
|
relativePath: e.normalize ? a.replace(/\\/g, "/") : a,
|
|
7140
7140
|
type: g,
|
|
7141
|
-
isSymbolicLink: m,
|
|
7142
|
-
stat: e.followLinks ? h : i
|
|
7141
|
+
isSymbolicLink: m$1,
|
|
7142
|
+
stat: e.followLinks ? h$1 : i
|
|
7143
7143
|
};
|
|
7144
7144
|
switch (e.stat || delete u.stat, g) {
|
|
7145
7145
|
case "directory":
|
|
7146
7146
|
let c = [], b;
|
|
7147
|
-
if (e.followLinks || !m) {
|
|
7147
|
+
if (e.followLinks || !m$1) {
|
|
7148
7148
|
try {
|
|
7149
|
-
b = await readdir(t), b = k(b, e.sorted);
|
|
7150
|
-
} catch (d) {
|
|
7149
|
+
b = await readdir(t$1), b = k(b, e.sorted);
|
|
7150
|
+
} catch (d$1) {
|
|
7151
7151
|
if (e.skipErrors) return null;
|
|
7152
|
-
throw d;
|
|
7152
|
+
throw d$1;
|
|
7153
7153
|
}
|
|
7154
|
-
if (e.emptyDirectory && (u.isEmpty = !b.length), c = await Promise.all(b.map(async (d) => await G(r, resolve$1(t, d), n + 1, e, l, o))), c = c.filter((d) => d !== null), e.excludeEmptyDirectories && !c.length) return null;
|
|
7154
|
+
if (e.emptyDirectory && (u.isEmpty = !b.length), c = await Promise.all(b.map(async (d$1) => await G(r, resolve$1(t$1, d$1), n + 1, e, l, o))), c = c.filter((d$1) => d$1 !== null), e.excludeEmptyDirectories && !c.length) return null;
|
|
7155
7155
|
}
|
|
7156
|
-
if (e.matches && r !== t) {
|
|
7157
|
-
let d = S(e.matches);
|
|
7158
|
-
if (!c.length && d.some((f) => !f.test(`/${a}`))) return null;
|
|
7156
|
+
if (e.matches && r !== t$1) {
|
|
7157
|
+
let d$1 = S(e.matches);
|
|
7158
|
+
if (!c.length && d$1.some((f) => !f.test(`/${a}`))) return null;
|
|
7159
7159
|
}
|
|
7160
7160
|
if (e.sizeInBytes || e.size) {
|
|
7161
|
-
let d = c.reduce((f, y) => f + y.sizeInBytes, 0);
|
|
7162
|
-
u.sizeInBytes = d, u.size = e.size ? C(d) : void 0, e.sizeInBytes || c.forEach((f) => f.sizeInBytes = void 0);
|
|
7161
|
+
let d$1 = c.reduce((f, y$1) => f + y$1.sizeInBytes, 0);
|
|
7162
|
+
u.sizeInBytes = d$1, u.size = e.size ? C(d$1) : void 0, e.sizeInBytes || c.forEach((f) => f.sizeInBytes = void 0);
|
|
7163
7163
|
}
|
|
7164
7164
|
if (e.hash) {
|
|
7165
7165
|
c.forEach((f) => {
|
|
7166
7166
|
E.update(f.hash);
|
|
7167
7167
|
});
|
|
7168
|
-
let d = e.hashEncoding;
|
|
7169
|
-
u.hash = E.digest(d);
|
|
7168
|
+
let d$1 = e.hashEncoding;
|
|
7169
|
+
u.hash = E.digest(d$1);
|
|
7170
7170
|
}
|
|
7171
|
-
e.descendants && (u.descendants = c.reduce((d, f) => d + (f.type === "directory" && e.descendantsIgnoreDirectories ? 0 : 1) + (f.descendants ?? 0), 0)), c.length && (u.children = e.postSorted ? $(c, e.postSorted) : c);
|
|
7171
|
+
e.descendants && (u.descendants = c.reduce((d$1, f) => d$1 + (f.type === "directory" && e.descendantsIgnoreDirectories ? 0 : 1) + (f.descendants ?? 0), 0)), c.length && (u.children = e.postSorted ? $(c, e.postSorted) : c);
|
|
7172
7172
|
break;
|
|
7173
7173
|
case "file":
|
|
7174
|
-
if (u.extension = extname(t).replace(".", ""), e.extensions && e.extensions.indexOf(u.extension) === -1 || e.matches && r !== t && S(e.matches).some((f) => !f.test(`/${a}`))) return null;
|
|
7174
|
+
if (u.extension = extname(t$1).replace(".", ""), e.extensions && e.extensions.indexOf(u.extension) === -1 || e.matches && r !== t$1 && S(e.matches).some((f) => !f.test(`/${a}`))) return null;
|
|
7175
7175
|
if (e.sizeInBytes || e.size) {
|
|
7176
|
-
let d = e.followLinks ? h.size : i.size;
|
|
7177
|
-
u.sizeInBytes = d, u.size = e.size ? C(d) : void 0;
|
|
7176
|
+
let d$1 = e.followLinks ? h$1.size : i.size;
|
|
7177
|
+
u.sizeInBytes = d$1, u.size = e.size ? C(d$1) : void 0;
|
|
7178
7178
|
}
|
|
7179
7179
|
if (e.hash) {
|
|
7180
|
-
let d;
|
|
7180
|
+
let d$1;
|
|
7181
7181
|
try {
|
|
7182
|
-
d = await readFile(t);
|
|
7183
|
-
} catch (y) {
|
|
7182
|
+
d$1 = await readFile(t$1);
|
|
7183
|
+
} catch (y$1) {
|
|
7184
7184
|
if (e.skipErrors) return null;
|
|
7185
|
-
throw y;
|
|
7185
|
+
throw y$1;
|
|
7186
7186
|
}
|
|
7187
|
-
E.update(d);
|
|
7187
|
+
E.update(d$1);
|
|
7188
7188
|
let f = e.hashEncoding;
|
|
7189
7189
|
u.hash = E.digest(f);
|
|
7190
7190
|
}
|
|
7191
7191
|
break;
|
|
7192
7192
|
default: return null;
|
|
7193
7193
|
}
|
|
7194
|
-
return l && g === "file" ? await l(u, e.followLinks ? h : i) : o && g === "directory" && await o(u, e.followLinks ? h : i), u;
|
|
7194
|
+
return l && g === "file" ? await l(u, e.followLinks ? h$1 : i) : o && g === "directory" && await o(u, e.followLinks ? h$1 : i), u;
|
|
7195
7195
|
}
|
|
7196
|
-
async function Ie(r, t, n, e) {
|
|
7197
|
-
let l = V(t), o = w(r, l), a = await G(o, o, 0, l, n, e);
|
|
7196
|
+
async function Ie(r, t$1, n, e) {
|
|
7197
|
+
let l = V(t$1), o = w$1(r, l), a = await G(o, o, 0, l, n, e);
|
|
7198
7198
|
return a && (a.sizeInBytes = l.sizeInBytes ? a.sizeInBytes : void 0), a;
|
|
7199
7199
|
}
|
|
7200
7200
|
|
|
@@ -7208,181 +7208,1029 @@ function getRouteFunctions({ config }) {
|
|
|
7208
7208
|
} };
|
|
7209
7209
|
}
|
|
7210
7210
|
|
|
7211
|
+
//#endregion
|
|
7212
|
+
//#region ../../node_modules/.pnpm/ms@2.1.3/node_modules/ms/index.js
|
|
7213
|
+
var require_ms = __commonJS({ "../../node_modules/.pnpm/ms@2.1.3/node_modules/ms/index.js"(exports, module) {
|
|
7214
|
+
/**
|
|
7215
|
+
* Helpers.
|
|
7216
|
+
*/
|
|
7217
|
+
var s = 1e3;
|
|
7218
|
+
var m = s * 60;
|
|
7219
|
+
var h = m * 60;
|
|
7220
|
+
var d = h * 24;
|
|
7221
|
+
var w = d * 7;
|
|
7222
|
+
var y = d * 365.25;
|
|
7223
|
+
/**
|
|
7224
|
+
* Parse or format the given `val`.
|
|
7225
|
+
*
|
|
7226
|
+
* Options:
|
|
7227
|
+
*
|
|
7228
|
+
* - `long` verbose formatting [false]
|
|
7229
|
+
*
|
|
7230
|
+
* @param {String|Number} val
|
|
7231
|
+
* @param {Object} [options]
|
|
7232
|
+
* @throws {Error} throw an error if val is not a non-empty string or a number
|
|
7233
|
+
* @return {String|Number}
|
|
7234
|
+
* @api public
|
|
7235
|
+
*/
|
|
7236
|
+
module.exports = function(val, options) {
|
|
7237
|
+
options = options || {};
|
|
7238
|
+
var type = typeof val;
|
|
7239
|
+
if (type === "string" && val.length > 0) return parse$1(val);
|
|
7240
|
+
else if (type === "number" && isFinite(val)) return options.long ? fmtLong(val) : fmtShort(val);
|
|
7241
|
+
throw new Error("val is not a non-empty string or a valid number. val=" + JSON.stringify(val));
|
|
7242
|
+
};
|
|
7243
|
+
/**
|
|
7244
|
+
* Parse the given `str` and return milliseconds.
|
|
7245
|
+
*
|
|
7246
|
+
* @param {String} str
|
|
7247
|
+
* @return {Number}
|
|
7248
|
+
* @api private
|
|
7249
|
+
*/
|
|
7250
|
+
function parse$1(str) {
|
|
7251
|
+
str = String(str);
|
|
7252
|
+
if (str.length > 100) return;
|
|
7253
|
+
var match$1 = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(str);
|
|
7254
|
+
if (!match$1) return;
|
|
7255
|
+
var n = parseFloat(match$1[1]);
|
|
7256
|
+
var type = (match$1[2] || "ms").toLowerCase();
|
|
7257
|
+
switch (type) {
|
|
7258
|
+
case "years":
|
|
7259
|
+
case "year":
|
|
7260
|
+
case "yrs":
|
|
7261
|
+
case "yr":
|
|
7262
|
+
case "y": return n * y;
|
|
7263
|
+
case "weeks":
|
|
7264
|
+
case "week":
|
|
7265
|
+
case "w": return n * w;
|
|
7266
|
+
case "days":
|
|
7267
|
+
case "day":
|
|
7268
|
+
case "d": return n * d;
|
|
7269
|
+
case "hours":
|
|
7270
|
+
case "hour":
|
|
7271
|
+
case "hrs":
|
|
7272
|
+
case "hr":
|
|
7273
|
+
case "h": return n * h;
|
|
7274
|
+
case "minutes":
|
|
7275
|
+
case "minute":
|
|
7276
|
+
case "mins":
|
|
7277
|
+
case "min":
|
|
7278
|
+
case "m": return n * m;
|
|
7279
|
+
case "seconds":
|
|
7280
|
+
case "second":
|
|
7281
|
+
case "secs":
|
|
7282
|
+
case "sec":
|
|
7283
|
+
case "s": return n * s;
|
|
7284
|
+
case "milliseconds":
|
|
7285
|
+
case "millisecond":
|
|
7286
|
+
case "msecs":
|
|
7287
|
+
case "msec":
|
|
7288
|
+
case "ms": return n;
|
|
7289
|
+
default: return void 0;
|
|
7290
|
+
}
|
|
7291
|
+
}
|
|
7292
|
+
/**
|
|
7293
|
+
* Short format for `ms`.
|
|
7294
|
+
*
|
|
7295
|
+
* @param {Number} ms
|
|
7296
|
+
* @return {String}
|
|
7297
|
+
* @api private
|
|
7298
|
+
*/
|
|
7299
|
+
function fmtShort(ms) {
|
|
7300
|
+
var msAbs = Math.abs(ms);
|
|
7301
|
+
if (msAbs >= d) return Math.round(ms / d) + "d";
|
|
7302
|
+
if (msAbs >= h) return Math.round(ms / h) + "h";
|
|
7303
|
+
if (msAbs >= m) return Math.round(ms / m) + "m";
|
|
7304
|
+
if (msAbs >= s) return Math.round(ms / s) + "s";
|
|
7305
|
+
return ms + "ms";
|
|
7306
|
+
}
|
|
7307
|
+
/**
|
|
7308
|
+
* Long format for `ms`.
|
|
7309
|
+
*
|
|
7310
|
+
* @param {Number} ms
|
|
7311
|
+
* @return {String}
|
|
7312
|
+
* @api private
|
|
7313
|
+
*/
|
|
7314
|
+
function fmtLong(ms) {
|
|
7315
|
+
var msAbs = Math.abs(ms);
|
|
7316
|
+
if (msAbs >= d) return plural(ms, msAbs, d, "day");
|
|
7317
|
+
if (msAbs >= h) return plural(ms, msAbs, h, "hour");
|
|
7318
|
+
if (msAbs >= m) return plural(ms, msAbs, m, "minute");
|
|
7319
|
+
if (msAbs >= s) return plural(ms, msAbs, s, "second");
|
|
7320
|
+
return ms + " ms";
|
|
7321
|
+
}
|
|
7322
|
+
/**
|
|
7323
|
+
* Pluralization helper.
|
|
7324
|
+
*/
|
|
7325
|
+
function plural(ms, msAbs, n, name) {
|
|
7326
|
+
var isPlural = msAbs >= n * 1.5;
|
|
7327
|
+
return Math.round(ms / n) + " " + name + (isPlural ? "s" : "");
|
|
7328
|
+
}
|
|
7329
|
+
} });
|
|
7330
|
+
|
|
7331
|
+
//#endregion
|
|
7332
|
+
//#region ../../node_modules/.pnpm/debug@4.4.3_supports-color@5.5.0/node_modules/debug/src/common.js
|
|
7333
|
+
var require_common = __commonJS({ "../../node_modules/.pnpm/debug@4.4.3_supports-color@5.5.0/node_modules/debug/src/common.js"(exports, module) {
|
|
7334
|
+
/**
|
|
7335
|
+
* This is the common logic for both the Node.js and web browser
|
|
7336
|
+
* implementations of `debug()`.
|
|
7337
|
+
*/
|
|
7338
|
+
function setup(env$1) {
|
|
7339
|
+
createDebug.debug = createDebug;
|
|
7340
|
+
createDebug.default = createDebug;
|
|
7341
|
+
createDebug.coerce = coerce;
|
|
7342
|
+
createDebug.disable = disable;
|
|
7343
|
+
createDebug.enable = enable;
|
|
7344
|
+
createDebug.enabled = enabled;
|
|
7345
|
+
createDebug.humanize = require_ms();
|
|
7346
|
+
createDebug.destroy = destroy;
|
|
7347
|
+
Object.keys(env$1).forEach((key) => {
|
|
7348
|
+
createDebug[key] = env$1[key];
|
|
7349
|
+
});
|
|
7350
|
+
/**
|
|
7351
|
+
* The currently active debug mode names, and names to skip.
|
|
7352
|
+
*/
|
|
7353
|
+
createDebug.names = [];
|
|
7354
|
+
createDebug.skips = [];
|
|
7355
|
+
/**
|
|
7356
|
+
* Map of special "%n" handling functions, for the debug "format" argument.
|
|
7357
|
+
*
|
|
7358
|
+
* Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
|
|
7359
|
+
*/
|
|
7360
|
+
createDebug.formatters = {};
|
|
7361
|
+
/**
|
|
7362
|
+
* Selects a color for a debug namespace
|
|
7363
|
+
* @param {String} namespace The namespace string for the debug instance to be colored
|
|
7364
|
+
* @return {Number|String} An ANSI color code for the given namespace
|
|
7365
|
+
* @api private
|
|
7366
|
+
*/
|
|
7367
|
+
function selectColor(namespace) {
|
|
7368
|
+
let hash = 0;
|
|
7369
|
+
for (let i = 0; i < namespace.length; i++) {
|
|
7370
|
+
hash = (hash << 5) - hash + namespace.charCodeAt(i);
|
|
7371
|
+
hash |= 0;
|
|
7372
|
+
}
|
|
7373
|
+
return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
|
|
7374
|
+
}
|
|
7375
|
+
createDebug.selectColor = selectColor;
|
|
7376
|
+
/**
|
|
7377
|
+
* Create a debugger with the given `namespace`.
|
|
7378
|
+
*
|
|
7379
|
+
* @param {String} namespace
|
|
7380
|
+
* @return {Function}
|
|
7381
|
+
* @api public
|
|
7382
|
+
*/
|
|
7383
|
+
function createDebug(namespace) {
|
|
7384
|
+
let prevTime;
|
|
7385
|
+
let enableOverride = null;
|
|
7386
|
+
let namespacesCache;
|
|
7387
|
+
let enabledCache;
|
|
7388
|
+
function debug(...args) {
|
|
7389
|
+
if (!debug.enabled) return;
|
|
7390
|
+
const self = debug;
|
|
7391
|
+
const curr = Number(new Date());
|
|
7392
|
+
const ms = curr - (prevTime || curr);
|
|
7393
|
+
self.diff = ms;
|
|
7394
|
+
self.prev = prevTime;
|
|
7395
|
+
self.curr = curr;
|
|
7396
|
+
prevTime = curr;
|
|
7397
|
+
args[0] = createDebug.coerce(args[0]);
|
|
7398
|
+
if (typeof args[0] !== "string") args.unshift("%O");
|
|
7399
|
+
let index = 0;
|
|
7400
|
+
args[0] = args[0].replace(/%([a-zA-Z%])/g, (match$1, format) => {
|
|
7401
|
+
if (match$1 === "%%") return "%";
|
|
7402
|
+
index++;
|
|
7403
|
+
const formatter = createDebug.formatters[format];
|
|
7404
|
+
if (typeof formatter === "function") {
|
|
7405
|
+
const val = args[index];
|
|
7406
|
+
match$1 = formatter.call(self, val);
|
|
7407
|
+
args.splice(index, 1);
|
|
7408
|
+
index--;
|
|
7409
|
+
}
|
|
7410
|
+
return match$1;
|
|
7411
|
+
});
|
|
7412
|
+
createDebug.formatArgs.call(self, args);
|
|
7413
|
+
const logFn = self.log || createDebug.log;
|
|
7414
|
+
logFn.apply(self, args);
|
|
7415
|
+
}
|
|
7416
|
+
debug.namespace = namespace;
|
|
7417
|
+
debug.useColors = createDebug.useColors();
|
|
7418
|
+
debug.color = createDebug.selectColor(namespace);
|
|
7419
|
+
debug.extend = extend;
|
|
7420
|
+
debug.destroy = createDebug.destroy;
|
|
7421
|
+
Object.defineProperty(debug, "enabled", {
|
|
7422
|
+
enumerable: true,
|
|
7423
|
+
configurable: false,
|
|
7424
|
+
get: () => {
|
|
7425
|
+
if (enableOverride !== null) return enableOverride;
|
|
7426
|
+
if (namespacesCache !== createDebug.namespaces) {
|
|
7427
|
+
namespacesCache = createDebug.namespaces;
|
|
7428
|
+
enabledCache = createDebug.enabled(namespace);
|
|
7429
|
+
}
|
|
7430
|
+
return enabledCache;
|
|
7431
|
+
},
|
|
7432
|
+
set: (v) => {
|
|
7433
|
+
enableOverride = v;
|
|
7434
|
+
}
|
|
7435
|
+
});
|
|
7436
|
+
if (typeof createDebug.init === "function") createDebug.init(debug);
|
|
7437
|
+
return debug;
|
|
7438
|
+
}
|
|
7439
|
+
function extend(namespace, delimiter) {
|
|
7440
|
+
const newDebug = createDebug(this.namespace + (typeof delimiter === "undefined" ? ":" : delimiter) + namespace);
|
|
7441
|
+
newDebug.log = this.log;
|
|
7442
|
+
return newDebug;
|
|
7443
|
+
}
|
|
7444
|
+
/**
|
|
7445
|
+
* Enables a debug mode by namespaces. This can include modes
|
|
7446
|
+
* separated by a colon and wildcards.
|
|
7447
|
+
*
|
|
7448
|
+
* @param {String} namespaces
|
|
7449
|
+
* @api public
|
|
7450
|
+
*/
|
|
7451
|
+
function enable(namespaces) {
|
|
7452
|
+
createDebug.save(namespaces);
|
|
7453
|
+
createDebug.namespaces = namespaces;
|
|
7454
|
+
createDebug.names = [];
|
|
7455
|
+
createDebug.skips = [];
|
|
7456
|
+
const split = (typeof namespaces === "string" ? namespaces : "").trim().replace(/\s+/g, ",").split(",").filter(Boolean);
|
|
7457
|
+
for (const ns of split) if (ns[0] === "-") createDebug.skips.push(ns.slice(1));
|
|
7458
|
+
else createDebug.names.push(ns);
|
|
7459
|
+
}
|
|
7460
|
+
/**
|
|
7461
|
+
* Checks if the given string matches a namespace template, honoring
|
|
7462
|
+
* asterisks as wildcards.
|
|
7463
|
+
*
|
|
7464
|
+
* @param {String} search
|
|
7465
|
+
* @param {String} template
|
|
7466
|
+
* @return {Boolean}
|
|
7467
|
+
*/
|
|
7468
|
+
function matchesTemplate(search, template) {
|
|
7469
|
+
let searchIndex = 0;
|
|
7470
|
+
let templateIndex = 0;
|
|
7471
|
+
let starIndex = -1;
|
|
7472
|
+
let matchIndex = 0;
|
|
7473
|
+
while (searchIndex < search.length) if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === "*")) if (template[templateIndex] === "*") {
|
|
7474
|
+
starIndex = templateIndex;
|
|
7475
|
+
matchIndex = searchIndex;
|
|
7476
|
+
templateIndex++;
|
|
7477
|
+
} else {
|
|
7478
|
+
searchIndex++;
|
|
7479
|
+
templateIndex++;
|
|
7480
|
+
}
|
|
7481
|
+
else if (starIndex !== -1) {
|
|
7482
|
+
templateIndex = starIndex + 1;
|
|
7483
|
+
matchIndex++;
|
|
7484
|
+
searchIndex = matchIndex;
|
|
7485
|
+
} else return false;
|
|
7486
|
+
while (templateIndex < template.length && template[templateIndex] === "*") templateIndex++;
|
|
7487
|
+
return templateIndex === template.length;
|
|
7488
|
+
}
|
|
7489
|
+
/**
|
|
7490
|
+
* Disable debug output.
|
|
7491
|
+
*
|
|
7492
|
+
* @return {String} namespaces
|
|
7493
|
+
* @api public
|
|
7494
|
+
*/
|
|
7495
|
+
function disable() {
|
|
7496
|
+
const namespaces = [...createDebug.names, ...createDebug.skips.map((namespace) => "-" + namespace)].join(",");
|
|
7497
|
+
createDebug.enable("");
|
|
7498
|
+
return namespaces;
|
|
7499
|
+
}
|
|
7500
|
+
/**
|
|
7501
|
+
* Returns true if the given mode name is enabled, false otherwise.
|
|
7502
|
+
*
|
|
7503
|
+
* @param {String} name
|
|
7504
|
+
* @return {Boolean}
|
|
7505
|
+
* @api public
|
|
7506
|
+
*/
|
|
7507
|
+
function enabled(name) {
|
|
7508
|
+
for (const skip of createDebug.skips) if (matchesTemplate(name, skip)) return false;
|
|
7509
|
+
for (const ns of createDebug.names) if (matchesTemplate(name, ns)) return true;
|
|
7510
|
+
return false;
|
|
7511
|
+
}
|
|
7512
|
+
/**
|
|
7513
|
+
* Coerce `val`.
|
|
7514
|
+
*
|
|
7515
|
+
* @param {Mixed} val
|
|
7516
|
+
* @return {Mixed}
|
|
7517
|
+
* @api private
|
|
7518
|
+
*/
|
|
7519
|
+
function coerce(val) {
|
|
7520
|
+
if (val instanceof Error) return val.stack || val.message;
|
|
7521
|
+
return val;
|
|
7522
|
+
}
|
|
7523
|
+
/**
|
|
7524
|
+
* XXX DO NOT USE. This is a temporary stub function.
|
|
7525
|
+
* XXX It WILL be removed in the next major release.
|
|
7526
|
+
*/
|
|
7527
|
+
function destroy() {
|
|
7528
|
+
console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
|
|
7529
|
+
}
|
|
7530
|
+
createDebug.enable(createDebug.load());
|
|
7531
|
+
return createDebug;
|
|
7532
|
+
}
|
|
7533
|
+
module.exports = setup;
|
|
7534
|
+
} });
|
|
7535
|
+
|
|
7536
|
+
//#endregion
|
|
7537
|
+
//#region ../../node_modules/.pnpm/debug@4.4.3_supports-color@5.5.0/node_modules/debug/src/browser.js
|
|
7538
|
+
var require_browser = __commonJS({ "../../node_modules/.pnpm/debug@4.4.3_supports-color@5.5.0/node_modules/debug/src/browser.js"(exports, module) {
|
|
7539
|
+
/**
|
|
7540
|
+
* This is the web browser implementation of `debug()`.
|
|
7541
|
+
*/
|
|
7542
|
+
exports.formatArgs = formatArgs$1;
|
|
7543
|
+
exports.save = save$1;
|
|
7544
|
+
exports.load = load$1;
|
|
7545
|
+
exports.useColors = useColors$1;
|
|
7546
|
+
exports.storage = localstorage();
|
|
7547
|
+
exports.destroy = (() => {
|
|
7548
|
+
let warned = false;
|
|
7549
|
+
return () => {
|
|
7550
|
+
if (!warned) {
|
|
7551
|
+
warned = true;
|
|
7552
|
+
console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
|
|
7553
|
+
}
|
|
7554
|
+
};
|
|
7555
|
+
})();
|
|
7556
|
+
/**
|
|
7557
|
+
* Colors.
|
|
7558
|
+
*/
|
|
7559
|
+
exports.colors = [
|
|
7560
|
+
"#0000CC",
|
|
7561
|
+
"#0000FF",
|
|
7562
|
+
"#0033CC",
|
|
7563
|
+
"#0033FF",
|
|
7564
|
+
"#0066CC",
|
|
7565
|
+
"#0066FF",
|
|
7566
|
+
"#0099CC",
|
|
7567
|
+
"#0099FF",
|
|
7568
|
+
"#00CC00",
|
|
7569
|
+
"#00CC33",
|
|
7570
|
+
"#00CC66",
|
|
7571
|
+
"#00CC99",
|
|
7572
|
+
"#00CCCC",
|
|
7573
|
+
"#00CCFF",
|
|
7574
|
+
"#3300CC",
|
|
7575
|
+
"#3300FF",
|
|
7576
|
+
"#3333CC",
|
|
7577
|
+
"#3333FF",
|
|
7578
|
+
"#3366CC",
|
|
7579
|
+
"#3366FF",
|
|
7580
|
+
"#3399CC",
|
|
7581
|
+
"#3399FF",
|
|
7582
|
+
"#33CC00",
|
|
7583
|
+
"#33CC33",
|
|
7584
|
+
"#33CC66",
|
|
7585
|
+
"#33CC99",
|
|
7586
|
+
"#33CCCC",
|
|
7587
|
+
"#33CCFF",
|
|
7588
|
+
"#6600CC",
|
|
7589
|
+
"#6600FF",
|
|
7590
|
+
"#6633CC",
|
|
7591
|
+
"#6633FF",
|
|
7592
|
+
"#66CC00",
|
|
7593
|
+
"#66CC33",
|
|
7594
|
+
"#9900CC",
|
|
7595
|
+
"#9900FF",
|
|
7596
|
+
"#9933CC",
|
|
7597
|
+
"#9933FF",
|
|
7598
|
+
"#99CC00",
|
|
7599
|
+
"#99CC33",
|
|
7600
|
+
"#CC0000",
|
|
7601
|
+
"#CC0033",
|
|
7602
|
+
"#CC0066",
|
|
7603
|
+
"#CC0099",
|
|
7604
|
+
"#CC00CC",
|
|
7605
|
+
"#CC00FF",
|
|
7606
|
+
"#CC3300",
|
|
7607
|
+
"#CC3333",
|
|
7608
|
+
"#CC3366",
|
|
7609
|
+
"#CC3399",
|
|
7610
|
+
"#CC33CC",
|
|
7611
|
+
"#CC33FF",
|
|
7612
|
+
"#CC6600",
|
|
7613
|
+
"#CC6633",
|
|
7614
|
+
"#CC9900",
|
|
7615
|
+
"#CC9933",
|
|
7616
|
+
"#CCCC00",
|
|
7617
|
+
"#CCCC33",
|
|
7618
|
+
"#FF0000",
|
|
7619
|
+
"#FF0033",
|
|
7620
|
+
"#FF0066",
|
|
7621
|
+
"#FF0099",
|
|
7622
|
+
"#FF00CC",
|
|
7623
|
+
"#FF00FF",
|
|
7624
|
+
"#FF3300",
|
|
7625
|
+
"#FF3333",
|
|
7626
|
+
"#FF3366",
|
|
7627
|
+
"#FF3399",
|
|
7628
|
+
"#FF33CC",
|
|
7629
|
+
"#FF33FF",
|
|
7630
|
+
"#FF6600",
|
|
7631
|
+
"#FF6633",
|
|
7632
|
+
"#FF9900",
|
|
7633
|
+
"#FF9933",
|
|
7634
|
+
"#FFCC00",
|
|
7635
|
+
"#FFCC33"
|
|
7636
|
+
];
|
|
7637
|
+
/**
|
|
7638
|
+
* Currently only WebKit-based Web Inspectors, Firefox >= v31,
|
|
7639
|
+
* and the Firebug extension (any Firefox version) are known
|
|
7640
|
+
* to support "%c" CSS customizations.
|
|
7641
|
+
*
|
|
7642
|
+
* TODO: add a `localStorage` variable to explicitly enable/disable colors
|
|
7643
|
+
*/
|
|
7644
|
+
function useColors$1() {
|
|
7645
|
+
if (typeof window !== "undefined" && window.process && (window.process.type === "renderer" || window.process.__nwjs)) return true;
|
|
7646
|
+
if (typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) return false;
|
|
7647
|
+
let m$1;
|
|
7648
|
+
return typeof document !== "undefined" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || typeof window !== "undefined" && window.console && (window.console.firebug || window.console.exception && window.console.table) || typeof navigator !== "undefined" && navigator.userAgent && (m$1 = navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)) && parseInt(m$1[1], 10) >= 31 || typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
|
|
7649
|
+
}
|
|
7650
|
+
/**
|
|
7651
|
+
* Colorize log arguments if enabled.
|
|
7652
|
+
*
|
|
7653
|
+
* @api public
|
|
7654
|
+
*/
|
|
7655
|
+
function formatArgs$1(args) {
|
|
7656
|
+
args[0] = (this.useColors ? "%c" : "") + this.namespace + (this.useColors ? " %c" : " ") + args[0] + (this.useColors ? "%c " : " ") + "+" + module.exports.humanize(this.diff);
|
|
7657
|
+
if (!this.useColors) return;
|
|
7658
|
+
const c = "color: " + this.color;
|
|
7659
|
+
args.splice(1, 0, c, "color: inherit");
|
|
7660
|
+
let index = 0;
|
|
7661
|
+
let lastC = 0;
|
|
7662
|
+
args[0].replace(/%[a-zA-Z%]/g, (match$1) => {
|
|
7663
|
+
if (match$1 === "%%") return;
|
|
7664
|
+
index++;
|
|
7665
|
+
if (match$1 === "%c") lastC = index;
|
|
7666
|
+
});
|
|
7667
|
+
args.splice(lastC, 0, c);
|
|
7668
|
+
}
|
|
7669
|
+
/**
|
|
7670
|
+
* Invokes `console.debug()` when available.
|
|
7671
|
+
* No-op when `console.debug` is not a "function".
|
|
7672
|
+
* If `console.debug` is not available, falls back
|
|
7673
|
+
* to `console.log`.
|
|
7674
|
+
*
|
|
7675
|
+
* @api public
|
|
7676
|
+
*/
|
|
7677
|
+
exports.log = console.debug || console.log || (() => {});
|
|
7678
|
+
/**
|
|
7679
|
+
* Save `namespaces`.
|
|
7680
|
+
*
|
|
7681
|
+
* @param {String} namespaces
|
|
7682
|
+
* @api private
|
|
7683
|
+
*/
|
|
7684
|
+
function save$1(namespaces) {
|
|
7685
|
+
try {
|
|
7686
|
+
if (namespaces) exports.storage.setItem("debug", namespaces);
|
|
7687
|
+
else exports.storage.removeItem("debug");
|
|
7688
|
+
} catch (error) {}
|
|
7689
|
+
}
|
|
7690
|
+
/**
|
|
7691
|
+
* Load `namespaces`.
|
|
7692
|
+
*
|
|
7693
|
+
* @return {String} returns the previously persisted debug modes
|
|
7694
|
+
* @api private
|
|
7695
|
+
*/
|
|
7696
|
+
function load$1() {
|
|
7697
|
+
let r;
|
|
7698
|
+
try {
|
|
7699
|
+
r = exports.storage.getItem("debug") || exports.storage.getItem("DEBUG");
|
|
7700
|
+
} catch (error) {}
|
|
7701
|
+
if (!r && typeof process !== "undefined" && "env" in process) r = process.env.DEBUG;
|
|
7702
|
+
return r;
|
|
7703
|
+
}
|
|
7704
|
+
/**
|
|
7705
|
+
* Localstorage attempts to return the localstorage.
|
|
7706
|
+
*
|
|
7707
|
+
* This is necessary because safari throws
|
|
7708
|
+
* when a user disables cookies/localstorage
|
|
7709
|
+
* and you attempt to access it.
|
|
7710
|
+
*
|
|
7711
|
+
* @return {LocalStorage}
|
|
7712
|
+
* @api private
|
|
7713
|
+
*/
|
|
7714
|
+
function localstorage() {
|
|
7715
|
+
try {
|
|
7716
|
+
return localStorage;
|
|
7717
|
+
} catch (error) {}
|
|
7718
|
+
}
|
|
7719
|
+
module.exports = require_common()(exports);
|
|
7720
|
+
const { formatters: formatters$1 } = module.exports;
|
|
7721
|
+
/**
|
|
7722
|
+
* Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
|
|
7723
|
+
*/
|
|
7724
|
+
formatters$1.j = function(v) {
|
|
7725
|
+
try {
|
|
7726
|
+
return JSON.stringify(v);
|
|
7727
|
+
} catch (error) {
|
|
7728
|
+
return "[UnexpectedJSONParseError]: " + error.message;
|
|
7729
|
+
}
|
|
7730
|
+
};
|
|
7731
|
+
} });
|
|
7732
|
+
|
|
7733
|
+
//#endregion
|
|
7734
|
+
//#region ../../node_modules/.pnpm/has-flag@3.0.0/node_modules/has-flag/index.js
|
|
7735
|
+
var require_has_flag = __commonJS({ "../../node_modules/.pnpm/has-flag@3.0.0/node_modules/has-flag/index.js"(exports, module) {
|
|
7736
|
+
module.exports = (flag, argv) => {
|
|
7737
|
+
argv = argv || process.argv;
|
|
7738
|
+
const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
|
|
7739
|
+
const pos = argv.indexOf(prefix + flag);
|
|
7740
|
+
const terminatorPos = argv.indexOf("--");
|
|
7741
|
+
return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos);
|
|
7742
|
+
};
|
|
7743
|
+
} });
|
|
7744
|
+
|
|
7745
|
+
//#endregion
|
|
7746
|
+
//#region ../../node_modules/.pnpm/supports-color@5.5.0/node_modules/supports-color/index.js
|
|
7747
|
+
var require_supports_color = __commonJS({ "../../node_modules/.pnpm/supports-color@5.5.0/node_modules/supports-color/index.js"(exports, module) {
|
|
7748
|
+
const os = __require("os");
|
|
7749
|
+
const hasFlag = require_has_flag();
|
|
7750
|
+
const env = process.env;
|
|
7751
|
+
let forceColor;
|
|
7752
|
+
if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false")) forceColor = false;
|
|
7753
|
+
else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) forceColor = true;
|
|
7754
|
+
if ("FORCE_COLOR" in env) forceColor = env.FORCE_COLOR.length === 0 || parseInt(env.FORCE_COLOR, 10) !== 0;
|
|
7755
|
+
function translateLevel(level) {
|
|
7756
|
+
if (level === 0) return false;
|
|
7757
|
+
return {
|
|
7758
|
+
level,
|
|
7759
|
+
hasBasic: true,
|
|
7760
|
+
has256: level >= 2,
|
|
7761
|
+
has16m: level >= 3
|
|
7762
|
+
};
|
|
7763
|
+
}
|
|
7764
|
+
function supportsColor(stream$1) {
|
|
7765
|
+
if (forceColor === false) return 0;
|
|
7766
|
+
if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) return 3;
|
|
7767
|
+
if (hasFlag("color=256")) return 2;
|
|
7768
|
+
if (stream$1 && !stream$1.isTTY && forceColor !== true) return 0;
|
|
7769
|
+
const min = forceColor ? 1 : 0;
|
|
7770
|
+
if (process.platform === "win32") {
|
|
7771
|
+
const osRelease = os.release().split(".");
|
|
7772
|
+
if (Number(process.versions.node.split(".")[0]) >= 8 && Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
7773
|
+
return 1;
|
|
7774
|
+
}
|
|
7775
|
+
if ("CI" in env) {
|
|
7776
|
+
if ([
|
|
7777
|
+
"TRAVIS",
|
|
7778
|
+
"CIRCLECI",
|
|
7779
|
+
"APPVEYOR",
|
|
7780
|
+
"GITLAB_CI"
|
|
7781
|
+
].some((sign) => sign in env) || env.CI_NAME === "codeship") return 1;
|
|
7782
|
+
return min;
|
|
7783
|
+
}
|
|
7784
|
+
if ("TEAMCITY_VERSION" in env) return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
|
|
7785
|
+
if (env.COLORTERM === "truecolor") return 3;
|
|
7786
|
+
if ("TERM_PROGRAM" in env) {
|
|
7787
|
+
const version = parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
|
|
7788
|
+
switch (env.TERM_PROGRAM) {
|
|
7789
|
+
case "iTerm.app": return version >= 3 ? 3 : 2;
|
|
7790
|
+
case "Apple_Terminal": return 2;
|
|
7791
|
+
}
|
|
7792
|
+
}
|
|
7793
|
+
if (/-256(color)?$/i.test(env.TERM)) return 2;
|
|
7794
|
+
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) return 1;
|
|
7795
|
+
if ("COLORTERM" in env) return 1;
|
|
7796
|
+
if (env.TERM === "dumb") return min;
|
|
7797
|
+
return min;
|
|
7798
|
+
}
|
|
7799
|
+
function getSupportLevel(stream$1) {
|
|
7800
|
+
const level = supportsColor(stream$1);
|
|
7801
|
+
return translateLevel(level);
|
|
7802
|
+
}
|
|
7803
|
+
module.exports = {
|
|
7804
|
+
supportsColor: getSupportLevel,
|
|
7805
|
+
stdout: getSupportLevel(process.stdout),
|
|
7806
|
+
stderr: getSupportLevel(process.stderr)
|
|
7807
|
+
};
|
|
7808
|
+
} });
|
|
7809
|
+
|
|
7810
|
+
//#endregion
|
|
7811
|
+
//#region ../../node_modules/.pnpm/debug@4.4.3_supports-color@5.5.0/node_modules/debug/src/node.js
|
|
7812
|
+
var require_node = __commonJS({ "../../node_modules/.pnpm/debug@4.4.3_supports-color@5.5.0/node_modules/debug/src/node.js"(exports, module) {
|
|
7813
|
+
/**
|
|
7814
|
+
* Module dependencies.
|
|
7815
|
+
*/
|
|
7816
|
+
const tty = __require("tty");
|
|
7817
|
+
const util = __require("util");
|
|
7818
|
+
/**
|
|
7819
|
+
* This is the Node.js implementation of `debug()`.
|
|
7820
|
+
*/
|
|
7821
|
+
exports.init = init;
|
|
7822
|
+
exports.log = log$5;
|
|
7823
|
+
exports.formatArgs = formatArgs;
|
|
7824
|
+
exports.save = save;
|
|
7825
|
+
exports.load = load;
|
|
7826
|
+
exports.useColors = useColors;
|
|
7827
|
+
exports.destroy = util.deprecate(() => {}, "Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
|
|
7828
|
+
/**
|
|
7829
|
+
* Colors.
|
|
7830
|
+
*/
|
|
7831
|
+
exports.colors = [
|
|
7832
|
+
6,
|
|
7833
|
+
2,
|
|
7834
|
+
3,
|
|
7835
|
+
4,
|
|
7836
|
+
5,
|
|
7837
|
+
1
|
|
7838
|
+
];
|
|
7839
|
+
try {
|
|
7840
|
+
const supportsColor$1 = require_supports_color();
|
|
7841
|
+
if (supportsColor$1 && (supportsColor$1.stderr || supportsColor$1).level >= 2) exports.colors = [
|
|
7842
|
+
20,
|
|
7843
|
+
21,
|
|
7844
|
+
26,
|
|
7845
|
+
27,
|
|
7846
|
+
32,
|
|
7847
|
+
33,
|
|
7848
|
+
38,
|
|
7849
|
+
39,
|
|
7850
|
+
40,
|
|
7851
|
+
41,
|
|
7852
|
+
42,
|
|
7853
|
+
43,
|
|
7854
|
+
44,
|
|
7855
|
+
45,
|
|
7856
|
+
56,
|
|
7857
|
+
57,
|
|
7858
|
+
62,
|
|
7859
|
+
63,
|
|
7860
|
+
68,
|
|
7861
|
+
69,
|
|
7862
|
+
74,
|
|
7863
|
+
75,
|
|
7864
|
+
76,
|
|
7865
|
+
77,
|
|
7866
|
+
78,
|
|
7867
|
+
79,
|
|
7868
|
+
80,
|
|
7869
|
+
81,
|
|
7870
|
+
92,
|
|
7871
|
+
93,
|
|
7872
|
+
98,
|
|
7873
|
+
99,
|
|
7874
|
+
112,
|
|
7875
|
+
113,
|
|
7876
|
+
128,
|
|
7877
|
+
129,
|
|
7878
|
+
134,
|
|
7879
|
+
135,
|
|
7880
|
+
148,
|
|
7881
|
+
149,
|
|
7882
|
+
160,
|
|
7883
|
+
161,
|
|
7884
|
+
162,
|
|
7885
|
+
163,
|
|
7886
|
+
164,
|
|
7887
|
+
165,
|
|
7888
|
+
166,
|
|
7889
|
+
167,
|
|
7890
|
+
168,
|
|
7891
|
+
169,
|
|
7892
|
+
170,
|
|
7893
|
+
171,
|
|
7894
|
+
172,
|
|
7895
|
+
173,
|
|
7896
|
+
178,
|
|
7897
|
+
179,
|
|
7898
|
+
184,
|
|
7899
|
+
185,
|
|
7900
|
+
196,
|
|
7901
|
+
197,
|
|
7902
|
+
198,
|
|
7903
|
+
199,
|
|
7904
|
+
200,
|
|
7905
|
+
201,
|
|
7906
|
+
202,
|
|
7907
|
+
203,
|
|
7908
|
+
204,
|
|
7909
|
+
205,
|
|
7910
|
+
206,
|
|
7911
|
+
207,
|
|
7912
|
+
208,
|
|
7913
|
+
209,
|
|
7914
|
+
214,
|
|
7915
|
+
215,
|
|
7916
|
+
220,
|
|
7917
|
+
221
|
|
7918
|
+
];
|
|
7919
|
+
} catch (error) {}
|
|
7920
|
+
/**
|
|
7921
|
+
* Build up the default `inspectOpts` object from the environment variables.
|
|
7922
|
+
*
|
|
7923
|
+
* $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js
|
|
7924
|
+
*/
|
|
7925
|
+
exports.inspectOpts = Object.keys(process.env).filter((key) => {
|
|
7926
|
+
return /^debug_/i.test(key);
|
|
7927
|
+
}).reduce((obj, key) => {
|
|
7928
|
+
const prop = key.substring(6).toLowerCase().replace(/_([a-z])/g, (_, k$1) => {
|
|
7929
|
+
return k$1.toUpperCase();
|
|
7930
|
+
});
|
|
7931
|
+
let val = process.env[key];
|
|
7932
|
+
if (/^(yes|on|true|enabled)$/i.test(val)) val = true;
|
|
7933
|
+
else if (/^(no|off|false|disabled)$/i.test(val)) val = false;
|
|
7934
|
+
else if (val === "null") val = null;
|
|
7935
|
+
else val = Number(val);
|
|
7936
|
+
obj[prop] = val;
|
|
7937
|
+
return obj;
|
|
7938
|
+
}, {});
|
|
7939
|
+
/**
|
|
7940
|
+
* Is stdout a TTY? Colored output is enabled when `true`.
|
|
7941
|
+
*/
|
|
7942
|
+
function useColors() {
|
|
7943
|
+
return "colors" in exports.inspectOpts ? Boolean(exports.inspectOpts.colors) : tty.isatty(process.stderr.fd);
|
|
7944
|
+
}
|
|
7945
|
+
/**
|
|
7946
|
+
* Adds ANSI color escape codes if enabled.
|
|
7947
|
+
*
|
|
7948
|
+
* @api public
|
|
7949
|
+
*/
|
|
7950
|
+
function formatArgs(args) {
|
|
7951
|
+
const { namespace: name, useColors: useColors$2 } = this;
|
|
7952
|
+
if (useColors$2) {
|
|
7953
|
+
const c = this.color;
|
|
7954
|
+
const colorCode = "\x1B[3" + (c < 8 ? c : "8;5;" + c);
|
|
7955
|
+
const prefix = ` ${colorCode};1m${name} \u001B[0m`;
|
|
7956
|
+
args[0] = prefix + args[0].split("\n").join("\n" + prefix);
|
|
7957
|
+
args.push(colorCode + "m+" + module.exports.humanize(this.diff) + "\x1B[0m");
|
|
7958
|
+
} else args[0] = getDate() + name + " " + args[0];
|
|
7959
|
+
}
|
|
7960
|
+
function getDate() {
|
|
7961
|
+
if (exports.inspectOpts.hideDate) return "";
|
|
7962
|
+
return new Date().toISOString() + " ";
|
|
7963
|
+
}
|
|
7964
|
+
/**
|
|
7965
|
+
* Invokes `util.formatWithOptions()` with the specified arguments and writes to stderr.
|
|
7966
|
+
*/
|
|
7967
|
+
function log$5(...args) {
|
|
7968
|
+
return process.stderr.write(util.formatWithOptions(exports.inspectOpts, ...args) + "\n");
|
|
7969
|
+
}
|
|
7970
|
+
/**
|
|
7971
|
+
* Save `namespaces`.
|
|
7972
|
+
*
|
|
7973
|
+
* @param {String} namespaces
|
|
7974
|
+
* @api private
|
|
7975
|
+
*/
|
|
7976
|
+
function save(namespaces) {
|
|
7977
|
+
if (namespaces) process.env.DEBUG = namespaces;
|
|
7978
|
+
else delete process.env.DEBUG;
|
|
7979
|
+
}
|
|
7980
|
+
/**
|
|
7981
|
+
* Load `namespaces`.
|
|
7982
|
+
*
|
|
7983
|
+
* @return {String} returns the previously persisted debug modes
|
|
7984
|
+
* @api private
|
|
7985
|
+
*/
|
|
7986
|
+
function load() {
|
|
7987
|
+
return process.env.DEBUG;
|
|
7988
|
+
}
|
|
7989
|
+
/**
|
|
7990
|
+
* Init logic for `debug` instances.
|
|
7991
|
+
*
|
|
7992
|
+
* Create a new `inspectOpts` object in case `useColors` is set
|
|
7993
|
+
* differently for a particular `debug` instance.
|
|
7994
|
+
*/
|
|
7995
|
+
function init(debug) {
|
|
7996
|
+
debug.inspectOpts = {};
|
|
7997
|
+
const keys = Object.keys(exports.inspectOpts);
|
|
7998
|
+
for (let i = 0; i < keys.length; i++) debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
|
|
7999
|
+
}
|
|
8000
|
+
module.exports = require_common()(exports);
|
|
8001
|
+
const { formatters } = module.exports;
|
|
8002
|
+
/**
|
|
8003
|
+
* Map %o to `util.inspect()`, all on a single line.
|
|
8004
|
+
*/
|
|
8005
|
+
formatters.o = function(v) {
|
|
8006
|
+
this.inspectOpts.colors = this.useColors;
|
|
8007
|
+
return util.inspect(v, this.inspectOpts).split("\n").map((str) => str.trim()).join(" ");
|
|
8008
|
+
};
|
|
8009
|
+
/**
|
|
8010
|
+
* Map %O to `util.inspect()`, allowing multiple lines if needed.
|
|
8011
|
+
*/
|
|
8012
|
+
formatters.O = function(v) {
|
|
8013
|
+
this.inspectOpts.colors = this.useColors;
|
|
8014
|
+
return util.inspect(v, this.inspectOpts);
|
|
8015
|
+
};
|
|
8016
|
+
} });
|
|
8017
|
+
|
|
8018
|
+
//#endregion
|
|
8019
|
+
//#region ../../node_modules/.pnpm/debug@4.4.3_supports-color@5.5.0/node_modules/debug/src/index.js
|
|
8020
|
+
var require_src = __commonJS({ "../../node_modules/.pnpm/debug@4.4.3_supports-color@5.5.0/node_modules/debug/src/index.js"(exports, module) {
|
|
8021
|
+
/**
|
|
8022
|
+
* Detect Electron renderer / nwjs process, which is node, but we should
|
|
8023
|
+
* treat as a browser.
|
|
8024
|
+
*/
|
|
8025
|
+
if (typeof process === "undefined" || process.type === "renderer" || process.browser === true || process.__nwjs) module.exports = require_browser();
|
|
8026
|
+
else module.exports = require_node();
|
|
8027
|
+
} });
|
|
8028
|
+
var import_src = __toESM(require_src(), 1);
|
|
8029
|
+
|
|
7211
8030
|
//#endregion
|
|
7212
8031
|
//#region src/npm/index.ts
|
|
7213
|
-
const
|
|
7214
|
-
const CACHE_TTL = 1e3 * 60 * 30;
|
|
8032
|
+
const log$4 = (0, import_src.debug)("qwik:devtools:npm");
|
|
7215
8033
|
let preloadedDependencies = null;
|
|
7216
8034
|
let isPreloading = false;
|
|
7217
8035
|
let preloadPromise = null;
|
|
7218
|
-
|
|
7219
|
-
|
|
7220
|
-
|
|
7221
|
-
|
|
7222
|
-
|
|
7223
|
-
|
|
7224
|
-
|
|
7225
|
-
|
|
7226
|
-
|
|
7227
|
-
|
|
7228
|
-
|
|
8036
|
+
let dependenciesStatus = {
|
|
8037
|
+
phase: "idle",
|
|
8038
|
+
loaded: 0,
|
|
8039
|
+
total: 0,
|
|
8040
|
+
startedAt: null,
|
|
8041
|
+
finishedAt: null
|
|
8042
|
+
};
|
|
8043
|
+
async function fileExists(filePath) {
|
|
8044
|
+
try {
|
|
8045
|
+
await fsp.access(filePath);
|
|
8046
|
+
return true;
|
|
8047
|
+
} catch {
|
|
8048
|
+
return false;
|
|
8049
|
+
}
|
|
7229
8050
|
}
|
|
7230
|
-
async function
|
|
8051
|
+
async function readJsonFile(filePath) {
|
|
7231
8052
|
try {
|
|
7232
|
-
|
|
7233
|
-
|
|
7234
|
-
const candidate = path.join(currentDir, fileName);
|
|
7235
|
-
const exists = await fsp.access(candidate).then(() => true).catch(() => false);
|
|
7236
|
-
if (exists) return candidate;
|
|
7237
|
-
const parent = path.dirname(currentDir);
|
|
7238
|
-
if (parent === currentDir) break;
|
|
7239
|
-
currentDir = parent;
|
|
7240
|
-
}
|
|
7241
|
-
return null;
|
|
8053
|
+
const content = await fsp.readFile(filePath, "utf-8");
|
|
8054
|
+
return JSON.parse(content);
|
|
7242
8055
|
} catch {
|
|
7243
8056
|
return null;
|
|
7244
8057
|
}
|
|
7245
8058
|
}
|
|
8059
|
+
async function findNearestFileUp(startDir, fileName) {
|
|
8060
|
+
let currentDir = path.resolve(startDir);
|
|
8061
|
+
for (let i = 0; i < 100; i++) {
|
|
8062
|
+
const candidate = path.join(currentDir, fileName);
|
|
8063
|
+
if (await fileExists(candidate)) return candidate;
|
|
8064
|
+
const parent = path.dirname(currentDir);
|
|
8065
|
+
if (parent === currentDir) break;
|
|
8066
|
+
currentDir = parent;
|
|
8067
|
+
}
|
|
8068
|
+
return null;
|
|
8069
|
+
}
|
|
7246
8070
|
function getProjectStartDirFromConfig(config) {
|
|
7247
8071
|
if (config?.root) return config.root;
|
|
7248
8072
|
if (config?.configFile) return path.dirname(config.configFile);
|
|
7249
8073
|
return process.cwd();
|
|
7250
8074
|
}
|
|
7251
|
-
|
|
7252
|
-
|
|
7253
|
-
|
|
7254
|
-
|
|
7255
|
-
|
|
7256
|
-
|
|
7257
|
-
|
|
7258
|
-
return "pnpm";
|
|
7259
|
-
}
|
|
8075
|
+
function nodeModulesPackageJsonPath(projectRoot, name) {
|
|
8076
|
+
return path.join(projectRoot, "node_modules", ...name.split("/"), "package.json");
|
|
8077
|
+
}
|
|
8078
|
+
function normalizeRepositoryUrl(repository) {
|
|
8079
|
+
const url = typeof repository === "string" ? repository : repository?.url;
|
|
8080
|
+
if (!url || typeof url !== "string") return void 0;
|
|
8081
|
+
return url.replace(/^git\+/, "").replace(/^ssh:\/\/git@/, "https://").replace(/\.git$/, "");
|
|
7260
8082
|
}
|
|
7261
|
-
|
|
7262
|
-
if (
|
|
7263
|
-
|
|
7264
|
-
return
|
|
8083
|
+
function guessIconUrl(name, repositoryUrl) {
|
|
8084
|
+
if (name.startsWith("@")) {
|
|
8085
|
+
const scope = name.split("/")[0].substring(1);
|
|
8086
|
+
return `https://avatars.githubusercontent.com/${scope}?size=64`;
|
|
7265
8087
|
}
|
|
7266
|
-
if (
|
|
7267
|
-
|
|
7268
|
-
return
|
|
8088
|
+
if (repositoryUrl?.includes("github.com")) {
|
|
8089
|
+
const match$1 = repositoryUrl.match(/github\.com\/([^\/]+)/);
|
|
8090
|
+
if (match$1) return `https://avatars.githubusercontent.com/${match$1[1]}?size=64`;
|
|
7269
8091
|
}
|
|
8092
|
+
return null;
|
|
8093
|
+
}
|
|
8094
|
+
function deferToEventLoop() {
|
|
8095
|
+
return new Promise((resolve$2) => setImmediate(resolve$2));
|
|
8096
|
+
}
|
|
8097
|
+
async function mapLimit(items, concurrency, fn) {
|
|
8098
|
+
if (items.length === 0) return [];
|
|
8099
|
+
const results = new Array(items.length);
|
|
8100
|
+
let cursor = 0;
|
|
8101
|
+
const workers = Array.from({ length: Math.min(concurrency, items.length) }, async () => {
|
|
8102
|
+
while (true) {
|
|
8103
|
+
const i = cursor++;
|
|
8104
|
+
if (i >= items.length) return;
|
|
8105
|
+
results[i] = await fn(items[i], i);
|
|
8106
|
+
}
|
|
8107
|
+
});
|
|
8108
|
+
await Promise.all(workers);
|
|
8109
|
+
return results;
|
|
8110
|
+
}
|
|
8111
|
+
async function detectPackageManager(projectRoot) {
|
|
8112
|
+
if (await fileExists(path.join(projectRoot, "pnpm-lock.yaml"))) return "pnpm";
|
|
8113
|
+
if (await fileExists(path.join(projectRoot, "yarn.lock"))) return "yarn";
|
|
8114
|
+
if (await fileExists(path.join(projectRoot, "package-lock.json"))) return "npm";
|
|
8115
|
+
return "pnpm";
|
|
8116
|
+
}
|
|
8117
|
+
async function phase1LocalIndex(projectRoot, deps) {
|
|
8118
|
+
const localConcurrency = 16;
|
|
8119
|
+
return mapLimit(deps, localConcurrency, async ([name, requestedVersion]) => {
|
|
8120
|
+
const pkgJsonPath = nodeModulesPackageJsonPath(projectRoot, name);
|
|
8121
|
+
const installedPkg = await readJsonFile(pkgJsonPath);
|
|
8122
|
+
const version = installedPkg?.version || requestedVersion;
|
|
8123
|
+
const repository = normalizeRepositoryUrl(installedPkg?.repository);
|
|
8124
|
+
const iconUrl = guessIconUrl(name, repository);
|
|
8125
|
+
const info = {
|
|
8126
|
+
name,
|
|
8127
|
+
version,
|
|
8128
|
+
description: installedPkg?.description || "No description available",
|
|
8129
|
+
author: installedPkg?.author,
|
|
8130
|
+
homepage: installedPkg?.homepage,
|
|
8131
|
+
repository,
|
|
8132
|
+
npmUrl: `https://www.npmjs.com/package/${name}`,
|
|
8133
|
+
iconUrl
|
|
8134
|
+
};
|
|
8135
|
+
dependenciesStatus.loaded++;
|
|
8136
|
+
if (dependenciesStatus.loaded % 50 === 0) await deferToEventLoop();
|
|
8137
|
+
return info;
|
|
8138
|
+
});
|
|
8139
|
+
}
|
|
8140
|
+
async function phase2BackgroundEnrich(deps) {
|
|
8141
|
+
const targets = deps.filter((p$1) => !p$1.repository || !p$1.iconUrl || p$1.description === "No description available");
|
|
8142
|
+
const enrichConcurrency = 6;
|
|
8143
|
+
await mapLimit(targets, enrichConcurrency, async (p$1) => {
|
|
8144
|
+
const repo = normalizeRepositoryUrl(p$1.repository);
|
|
8145
|
+
if (repo && repo !== p$1.repository) p$1.repository = repo;
|
|
8146
|
+
if (!p$1.iconUrl) p$1.iconUrl = guessIconUrl(p$1.name, p$1.repository);
|
|
8147
|
+
if (!p$1.repository || p$1.description === "No description available") try {
|
|
8148
|
+
const controller = new AbortController();
|
|
8149
|
+
const timeoutId = setTimeout(() => controller.abort(), 1500);
|
|
8150
|
+
const res = await fetch(`https://registry.npmjs.org/${encodeURIComponent(p$1.name)}/${encodeURIComponent(p$1.version)}`, {
|
|
8151
|
+
headers: { Accept: "application/json" },
|
|
8152
|
+
signal: controller.signal
|
|
8153
|
+
});
|
|
8154
|
+
clearTimeout(timeoutId);
|
|
8155
|
+
if (res.ok) {
|
|
8156
|
+
const data = await res.json();
|
|
8157
|
+
if (!p$1.repository) p$1.repository = normalizeRepositoryUrl(data?.repository);
|
|
8158
|
+
if (p$1.description === "No description available" && data?.description) p$1.description = data.description;
|
|
8159
|
+
if (!p$1.iconUrl) p$1.iconUrl = guessIconUrl(p$1.name, p$1.repository);
|
|
8160
|
+
}
|
|
8161
|
+
} catch {}
|
|
8162
|
+
await deferToEventLoop();
|
|
8163
|
+
return p$1;
|
|
8164
|
+
});
|
|
8165
|
+
}
|
|
8166
|
+
async function preloadDependencies(config) {
|
|
8167
|
+
if (preloadedDependencies) return preloadedDependencies;
|
|
8168
|
+
if (isPreloading && preloadPromise) return preloadPromise;
|
|
7270
8169
|
isPreloading = true;
|
|
7271
|
-
|
|
8170
|
+
dependenciesStatus = {
|
|
8171
|
+
phase: "phase1",
|
|
8172
|
+
loaded: 0,
|
|
8173
|
+
total: 0,
|
|
8174
|
+
startedAt: Date.now(),
|
|
8175
|
+
finishedAt: null
|
|
8176
|
+
};
|
|
7272
8177
|
preloadPromise = (async () => {
|
|
7273
8178
|
const startDir = getProjectStartDirFromConfig(config);
|
|
7274
|
-
const
|
|
7275
|
-
if (!
|
|
8179
|
+
const packageJsonPath = await findNearestFileUp(startDir, "package.json");
|
|
8180
|
+
if (!packageJsonPath) {
|
|
7276
8181
|
preloadedDependencies = [];
|
|
8182
|
+
dependenciesStatus.phase = "done";
|
|
8183
|
+
dependenciesStatus.finishedAt = Date.now();
|
|
7277
8184
|
isPreloading = false;
|
|
7278
|
-
console.log("[Qwik DevTools] No package.json found");
|
|
7279
8185
|
return [];
|
|
7280
8186
|
}
|
|
8187
|
+
const projectRoot = path.dirname(packageJsonPath);
|
|
8188
|
+
const pkg = await readJsonFile(packageJsonPath);
|
|
8189
|
+
const allDeps = {
|
|
8190
|
+
...pkg?.dependencies || {},
|
|
8191
|
+
...pkg?.devDependencies || {},
|
|
8192
|
+
...pkg?.peerDependencies || {}
|
|
8193
|
+
};
|
|
8194
|
+
const entries = Object.entries(allDeps);
|
|
8195
|
+
dependenciesStatus.total = entries.length;
|
|
7281
8196
|
try {
|
|
7282
|
-
const
|
|
7283
|
-
|
|
7284
|
-
|
|
7285
|
-
|
|
7286
|
-
|
|
7287
|
-
|
|
7288
|
-
|
|
7289
|
-
|
|
7290
|
-
|
|
7291
|
-
|
|
7292
|
-
|
|
7293
|
-
|
|
7294
|
-
|
|
7295
|
-
|
|
7296
|
-
|
|
7297
|
-
|
|
7298
|
-
|
|
7299
|
-
|
|
7300
|
-
if (uncachedDependencies.length === 0) {
|
|
7301
|
-
preloadedDependencies = cachedPackages;
|
|
7302
|
-
isPreloading = false;
|
|
7303
|
-
return cachedPackages;
|
|
7304
|
-
}
|
|
7305
|
-
const batchSize = 100;
|
|
7306
|
-
const batches = [];
|
|
7307
|
-
for (let i = 0; i < uncachedDependencies.length; i += batchSize) batches.push(uncachedDependencies.slice(i, i + batchSize));
|
|
7308
|
-
const fetchedPackages = [];
|
|
7309
|
-
console.log(`[Qwik DevTools] Fetching ${uncachedDependencies.length} packages in parallel...`);
|
|
7310
|
-
const allBatchPromises = batches.map(async (batch) => {
|
|
7311
|
-
const batchPromises = batch.map(async ([name, version]) => {
|
|
7312
|
-
try {
|
|
7313
|
-
const controller = new AbortController();
|
|
7314
|
-
const timeoutId = setTimeout(() => controller.abort(), 5e3);
|
|
7315
|
-
const response = await fetch(`https://registry.npmjs.org/${name}`, {
|
|
7316
|
-
headers: { "Accept": "application/json" },
|
|
7317
|
-
signal: controller.signal
|
|
7318
|
-
});
|
|
7319
|
-
clearTimeout(timeoutId);
|
|
7320
|
-
if (!response.ok) throw new Error(`HTTP ${response.status}`);
|
|
7321
|
-
const packageData = await response.json();
|
|
7322
|
-
const latestVersion = packageData["dist-tags"]?.latest || version;
|
|
7323
|
-
const versionData = packageData.versions?.[latestVersion] || packageData.versions?.[version];
|
|
7324
|
-
let repositoryUrl = versionData?.repository?.url || packageData.repository?.url;
|
|
7325
|
-
if (repositoryUrl) repositoryUrl = repositoryUrl.replace(/^git\+/, "").replace(/^ssh:\/\/git@/, "https://").replace(/\.git$/, "");
|
|
7326
|
-
let iconUrl = null;
|
|
7327
|
-
if (packageData.logo) iconUrl = packageData.logo;
|
|
7328
|
-
else if (name.startsWith("@")) {
|
|
7329
|
-
const scope = name.split("/")[0].substring(1);
|
|
7330
|
-
iconUrl = `https://avatars.githubusercontent.com/${scope}?size=64`;
|
|
7331
|
-
} else if (repositoryUrl?.includes("github.com")) {
|
|
7332
|
-
const repoMatch = repositoryUrl.match(/github\.com\/([^\/]+)/);
|
|
7333
|
-
if (repoMatch) iconUrl = `https://avatars.githubusercontent.com/${repoMatch[1]}?size=64`;
|
|
7334
|
-
}
|
|
7335
|
-
const packageInfo = {
|
|
7336
|
-
name,
|
|
7337
|
-
version,
|
|
7338
|
-
description: versionData?.description || packageData.description || "No description available",
|
|
7339
|
-
author: versionData?.author || packageData.author,
|
|
7340
|
-
homepage: versionData?.homepage || packageData.homepage,
|
|
7341
|
-
repository: repositoryUrl,
|
|
7342
|
-
npmUrl: `https://www.npmjs.com/package/${name}`,
|
|
7343
|
-
iconUrl
|
|
7344
|
-
};
|
|
7345
|
-
setCachedPackage(name, packageInfo);
|
|
7346
|
-
return packageInfo;
|
|
7347
|
-
} catch (error) {
|
|
7348
|
-
const basicInfo = {
|
|
7349
|
-
name,
|
|
7350
|
-
version,
|
|
7351
|
-
description: "No description available",
|
|
7352
|
-
npmUrl: `https://www.npmjs.com/package/${name}`,
|
|
7353
|
-
iconUrl: null
|
|
7354
|
-
};
|
|
7355
|
-
setCachedPackage(name, basicInfo);
|
|
7356
|
-
return basicInfo;
|
|
7357
|
-
}
|
|
7358
|
-
});
|
|
7359
|
-
const batchResults = await Promise.allSettled(batchPromises);
|
|
7360
|
-
return batchResults.filter((result) => result.status === "fulfilled").map((result) => result.value);
|
|
7361
|
-
});
|
|
7362
|
-
const allBatchResults = await Promise.all(allBatchPromises);
|
|
7363
|
-
for (const batchResult of allBatchResults) fetchedPackages.push(...batchResult);
|
|
7364
|
-
const allPackages = [...cachedPackages, ...fetchedPackages];
|
|
7365
|
-
preloadedDependencies = allPackages;
|
|
7366
|
-
isPreloading = false;
|
|
7367
|
-
console.log(`[Qwik DevTools] ✓ Successfully preloaded ${allPackages.length} dependencies`);
|
|
7368
|
-
return allPackages;
|
|
7369
|
-
} catch (error) {
|
|
7370
|
-
console.error("[Qwik DevTools] ✗ Failed to preload dependencies:", error);
|
|
8197
|
+
const list = await phase1LocalIndex(projectRoot, entries);
|
|
8198
|
+
preloadedDependencies = list;
|
|
8199
|
+
dependenciesStatus.phase = "phase2";
|
|
8200
|
+
(async () => {
|
|
8201
|
+
try {
|
|
8202
|
+
await phase2BackgroundEnrich(list);
|
|
8203
|
+
dependenciesStatus.phase = "done";
|
|
8204
|
+
} catch (e) {
|
|
8205
|
+
dependenciesStatus.phase = "error";
|
|
8206
|
+
dependenciesStatus.error = e instanceof Error ? e.message : String(e);
|
|
8207
|
+
} finally {
|
|
8208
|
+
dependenciesStatus.finishedAt = Date.now();
|
|
8209
|
+
isPreloading = false;
|
|
8210
|
+
}
|
|
8211
|
+
})();
|
|
8212
|
+
log$4(`[Qwik DevTools] ✓ Phase1 preloaded ${list.length} dependencies (local-first)`);
|
|
8213
|
+
return list;
|
|
8214
|
+
} catch (e) {
|
|
7371
8215
|
preloadedDependencies = [];
|
|
8216
|
+
dependenciesStatus.phase = "error";
|
|
8217
|
+
dependenciesStatus.error = e instanceof Error ? e.message : String(e);
|
|
8218
|
+
dependenciesStatus.finishedAt = Date.now();
|
|
7372
8219
|
isPreloading = false;
|
|
8220
|
+
log$4("[Qwik DevTools] ✗ Failed to preload dependencies (local-first):", e);
|
|
7373
8221
|
return [];
|
|
7374
8222
|
}
|
|
7375
8223
|
})();
|
|
7376
8224
|
return preloadPromise;
|
|
7377
|
-
}
|
|
8225
|
+
}
|
|
7378
8226
|
async function startPreloading({ config }) {
|
|
7379
8227
|
const startTime = Date.now();
|
|
7380
|
-
|
|
8228
|
+
log$4("[Qwik DevTools] 🚀 Initiating dependency preload (background)...");
|
|
7381
8229
|
preloadDependencies(config).then(() => {
|
|
7382
8230
|
const duration = ((Date.now() - startTime) / 1e3).toFixed(2);
|
|
7383
|
-
|
|
8231
|
+
log$4(`[Qwik DevTools] ⚡ Preload completed in ${duration}s`);
|
|
7384
8232
|
}).catch((err) => {
|
|
7385
|
-
|
|
8233
|
+
log$4("[Qwik DevTools] ✗ Preload failed:", err);
|
|
7386
8234
|
});
|
|
7387
8235
|
return Promise.resolve();
|
|
7388
8236
|
}
|
|
@@ -7393,8 +8241,7 @@ function getNpmFunctions({ config }) {
|
|
|
7393
8241
|
const pathToPackageJson = await findNearestFileUp(startDir, "package.json");
|
|
7394
8242
|
if (!pathToPackageJson) return [];
|
|
7395
8243
|
try {
|
|
7396
|
-
const
|
|
7397
|
-
const pkg = JSON.parse(pkgJson);
|
|
8244
|
+
const pkg = await readJsonFile(pathToPackageJson);
|
|
7398
8245
|
return Object.entries(pkg.devDependencies).filter(([key]) => /@qwik/i.test(key));
|
|
7399
8246
|
} catch (error) {
|
|
7400
8247
|
return [];
|
|
@@ -7402,15 +8249,29 @@ function getNpmFunctions({ config }) {
|
|
|
7402
8249
|
},
|
|
7403
8250
|
async getAllDependencies() {
|
|
7404
8251
|
if (preloadedDependencies) {
|
|
7405
|
-
|
|
8252
|
+
log$4("[Qwik DevTools] Returning preloaded dependencies");
|
|
7406
8253
|
return preloadedDependencies;
|
|
7407
8254
|
}
|
|
7408
|
-
if (isPreloading
|
|
7409
|
-
|
|
7410
|
-
|
|
7411
|
-
|
|
7412
|
-
|
|
7413
|
-
|
|
8255
|
+
if (isPreloading) return [];
|
|
8256
|
+
log$4("[Qwik DevTools] Warning: Preload not started, starting now...");
|
|
8257
|
+
preloadDependencies(config);
|
|
8258
|
+
return [];
|
|
8259
|
+
},
|
|
8260
|
+
async getDependenciesStatus() {
|
|
8261
|
+
return dependenciesStatus;
|
|
8262
|
+
},
|
|
8263
|
+
async refreshDependencies() {
|
|
8264
|
+
preloadedDependencies = null;
|
|
8265
|
+
isPreloading = false;
|
|
8266
|
+
preloadPromise = null;
|
|
8267
|
+
dependenciesStatus = {
|
|
8268
|
+
phase: "idle",
|
|
8269
|
+
loaded: 0,
|
|
8270
|
+
total: 0,
|
|
8271
|
+
startedAt: null,
|
|
8272
|
+
finishedAt: null
|
|
8273
|
+
};
|
|
8274
|
+
preloadDependencies(config);
|
|
7414
8275
|
},
|
|
7415
8276
|
async installPackage(packageName, isDev = true) {
|
|
7416
8277
|
try {
|
|
@@ -7712,14 +8573,14 @@ function compositeTransformation(isApplicable, annotation, transform$1, untransf
|
|
|
7712
8573
|
untransform
|
|
7713
8574
|
};
|
|
7714
8575
|
}
|
|
7715
|
-
const symbolRule = compositeTransformation((s, superJson) => {
|
|
7716
|
-
if (isSymbol(s)) {
|
|
7717
|
-
const isRegistered = !!superJson.symbolRegistry.getIdentifier(s);
|
|
8576
|
+
const symbolRule = compositeTransformation((s$1, superJson) => {
|
|
8577
|
+
if (isSymbol(s$1)) {
|
|
8578
|
+
const isRegistered = !!superJson.symbolRegistry.getIdentifier(s$1);
|
|
7718
8579
|
return isRegistered;
|
|
7719
8580
|
}
|
|
7720
8581
|
return false;
|
|
7721
|
-
}, (s, superJson) => {
|
|
7722
|
-
const identifier = superJson.symbolRegistry.getIdentifier(s);
|
|
8582
|
+
}, (s$1, superJson) => {
|
|
8583
|
+
const identifier = superJson.symbolRegistry.getIdentifier(s$1);
|
|
7723
8584
|
return ["symbol", identifier];
|
|
7724
8585
|
}, (v) => v.description, (_, a, superJson) => {
|
|
7725
8586
|
const value = superJson.symbolRegistry.getValue(a[1]);
|
|
@@ -8029,8 +8890,8 @@ function isPlainObject(payload) {
|
|
|
8029
8890
|
function isNull(payload) {
|
|
8030
8891
|
return getType(payload) === "Null";
|
|
8031
8892
|
}
|
|
8032
|
-
function isOneOf(a, b, c, d, e) {
|
|
8033
|
-
return (value) => a(value) || b(value) || !!c && c(value) || !!d && d(value) || !!e && e(value);
|
|
8893
|
+
function isOneOf(a, b, c, d$1, e) {
|
|
8894
|
+
return (value) => a(value) || b(value) || !!c && c(value) || !!d$1 && d$1(value) || !!e && e(value);
|
|
8034
8895
|
}
|
|
8035
8896
|
function isUndefined(payload) {
|
|
8036
8897
|
return getType(payload) === "Undefined";
|
|
@@ -8071,7 +8932,7 @@ var SuperJSON = class {
|
|
|
8071
8932
|
*/
|
|
8072
8933
|
constructor({ dedupe = false } = {}) {
|
|
8073
8934
|
this.classRegistry = new ClassRegistry();
|
|
8074
|
-
this.symbolRegistry = new Registry((s) => s.description ?? "");
|
|
8935
|
+
this.symbolRegistry = new Registry((s$1) => s$1.description ?? "");
|
|
8075
8936
|
this.customTransformerRegistry = new CustomTransformerRegistry();
|
|
8076
8937
|
this.allowedErrorProps = [];
|
|
8077
8938
|
this.dedupe = dedupe;
|
|
@@ -8300,14 +9161,15 @@ const SERVER_RPC = "__qwik_server_rpc__";
|
|
|
8300
9161
|
|
|
8301
9162
|
//#endregion
|
|
8302
9163
|
//#region ../kit/src/context.ts
|
|
9164
|
+
const t = target;
|
|
8303
9165
|
function getViteServerContext() {
|
|
8304
|
-
return
|
|
9166
|
+
return t[SERVER_CTX];
|
|
8305
9167
|
}
|
|
8306
9168
|
function setViteServerContext(ctx) {
|
|
8307
|
-
|
|
9169
|
+
t[SERVER_CTX] = ctx;
|
|
8308
9170
|
}
|
|
8309
9171
|
function setViteServerRpc(rpc) {
|
|
8310
|
-
|
|
9172
|
+
t[SERVER_RPC] = rpc;
|
|
8311
9173
|
}
|
|
8312
9174
|
|
|
8313
9175
|
//#endregion
|
|
@@ -8327,34 +9189,60 @@ function createServerRpc(functions) {
|
|
|
8327
9189
|
//#endregion
|
|
8328
9190
|
//#region src/parse/helpers.ts
|
|
8329
9191
|
const ALL_HOOK_NAMES = new Set([...USE_HOOK_LIST]);
|
|
9192
|
+
/**
|
|
9193
|
+
* Type guard to check if a value is an AST node with a type property
|
|
9194
|
+
*/
|
|
8330
9195
|
function isAstNodeLike(value) {
|
|
8331
9196
|
return Boolean(value) && typeof value === "object" && "type" in value;
|
|
8332
9197
|
}
|
|
8333
|
-
|
|
8334
|
-
|
|
8335
|
-
|
|
9198
|
+
/**
|
|
9199
|
+
* Extracts the name from an Identifier node
|
|
9200
|
+
*/
|
|
8336
9201
|
function getVariableIdentifierName(id) {
|
|
8337
9202
|
if (!isAstNodeLike(id)) return null;
|
|
8338
9203
|
return id.type === "Identifier" ? id.name : null;
|
|
8339
9204
|
}
|
|
8340
|
-
|
|
8341
|
-
|
|
9205
|
+
/**
|
|
9206
|
+
* Normalizes a hook name by removing the trailing $ suffix
|
|
9207
|
+
* @example normalizeHookName('useSignal$') => 'useSignal'
|
|
9208
|
+
*/
|
|
9209
|
+
function normalizeHookName(raw) {
|
|
9210
|
+
return raw.endsWith("$") ? raw.slice(0, -1) : raw;
|
|
8342
9211
|
}
|
|
9212
|
+
/**
|
|
9213
|
+
* Normalizes a hook name by removing the trailing 'Qrl' suffix
|
|
9214
|
+
* @example normalizeQrlHookName('useTaskQrl') => 'useTask'
|
|
9215
|
+
*/
|
|
8343
9216
|
function normalizeQrlHookName(hookName) {
|
|
8344
9217
|
return hookName.endsWith("Qrl") ? hookName.slice(0, -3) : hookName;
|
|
8345
9218
|
}
|
|
9219
|
+
/**
|
|
9220
|
+
* Checks if a hook name is in the known hooks list
|
|
9221
|
+
*/
|
|
9222
|
+
function isKnownHook(name) {
|
|
9223
|
+
return ALL_HOOK_NAMES.has(name);
|
|
9224
|
+
}
|
|
9225
|
+
/**
|
|
9226
|
+
* Checks if a hook name follows the custom hook naming convention (use[A-Z_])
|
|
9227
|
+
* and is not a built-in Qwik hook
|
|
9228
|
+
*/
|
|
9229
|
+
function isCustomHook(hookName) {
|
|
9230
|
+
const isBuiltIn = USE_HOOK_LIST.some((item) => item.startsWith(hookName));
|
|
9231
|
+
return !isBuiltIn && /^use[A-Z_]/.test(hookName);
|
|
9232
|
+
}
|
|
9233
|
+
/**
|
|
9234
|
+
* Finds the start position of the line containing the given index
|
|
9235
|
+
*/
|
|
8346
9236
|
function findLineStart(code, index) {
|
|
8347
|
-
let lineStart = index;
|
|
8348
9237
|
for (let i = index - 1; i >= 0; i--) {
|
|
8349
9238
|
const ch = code[i];
|
|
8350
|
-
if (ch === "\n" || ch === "\r")
|
|
8351
|
-
lineStart = i + 1;
|
|
8352
|
-
break;
|
|
8353
|
-
}
|
|
8354
|
-
if (i === 0) lineStart = 0;
|
|
9239
|
+
if (ch === "\n" || ch === "\r") return i + 1;
|
|
8355
9240
|
}
|
|
8356
|
-
return
|
|
9241
|
+
return 0;
|
|
8357
9242
|
}
|
|
9243
|
+
/**
|
|
9244
|
+
* Reads the indentation (spaces/tabs) starting from a given position
|
|
9245
|
+
*/
|
|
8358
9246
|
function readIndent(code, indexFrom) {
|
|
8359
9247
|
let indent = "";
|
|
8360
9248
|
let i = indexFrom;
|
|
@@ -8367,34 +9255,58 @@ function readIndent(code, indexFrom) {
|
|
|
8367
9255
|
}
|
|
8368
9256
|
return indent;
|
|
8369
9257
|
}
|
|
9258
|
+
/**
|
|
9259
|
+
* Removes trailing semicolon and whitespace from a code segment
|
|
9260
|
+
*/
|
|
9261
|
+
function trimStatementSemicolon(segment) {
|
|
9262
|
+
return segment.trim().replace(/;?\s*$/, "");
|
|
9263
|
+
}
|
|
9264
|
+
/**
|
|
9265
|
+
* Builds the collecthook() call code with proper indentation
|
|
9266
|
+
*/
|
|
8370
9267
|
function buildCollecthookPayload(indent, variableName, hookType, category, hookExpression) {
|
|
8371
|
-
const
|
|
9268
|
+
const dataValue = hookExpression === "undefined" ? "undefined" : hookExpression;
|
|
8372
9269
|
return `${indent}collecthook({
|
|
8373
9270
|
${indent} variableName: '${variableName}',
|
|
8374
9271
|
${indent} hookType: '${hookType}',
|
|
8375
9272
|
${indent} category: '${category}',
|
|
8376
|
-
${indent} data: ${
|
|
9273
|
+
${indent} data: ${dataValue}
|
|
8377
9274
|
${indent}});\n`;
|
|
8378
9275
|
}
|
|
9276
|
+
/**
|
|
9277
|
+
* Checks if a collecthook call already exists after the given position (by variable ID)
|
|
9278
|
+
*/
|
|
8379
9279
|
function hasCollecthookAfterByVariableId(code, fromIndex, variableId, maxLookahead = 600) {
|
|
8380
9280
|
const lookahead = code.slice(fromIndex, fromIndex + maxLookahead);
|
|
8381
|
-
const
|
|
8382
|
-
return
|
|
9281
|
+
const pattern$1 = new RegExp(`collecthook\\s*\\(\\s*\\{[\\s\\S]{0,300}?data:\\s*${variableId}\\b`);
|
|
9282
|
+
return pattern$1.test(lookahead);
|
|
8383
9283
|
}
|
|
9284
|
+
/**
|
|
9285
|
+
* Checks if a collecthook call already exists after the given position (by variable name)
|
|
9286
|
+
*/
|
|
8384
9287
|
function hasCollecthookAfterByVariableName(code, fromIndex, variableName, maxLookahead = 600) {
|
|
8385
9288
|
const lookahead = code.slice(fromIndex, fromIndex + maxLookahead);
|
|
8386
|
-
const
|
|
8387
|
-
return
|
|
8388
|
-
}
|
|
8389
|
-
function trimStatementSemicolon(segment) {
|
|
8390
|
-
return segment.trim().replace(/;?\s*$/, "");
|
|
8391
|
-
}
|
|
8392
|
-
function isCustomHook(hookName) {
|
|
8393
|
-
return !USE_HOOK_LIST.some((item) => item.startsWith(hookName)) && /^use[A-Z_]/.test(hookName);
|
|
9289
|
+
const pattern$1 = new RegExp(`collecthook\\s*\\(\\s*\\{[\\s\\S]{0,200}?variableName:\\s*'${variableName}'`);
|
|
9290
|
+
return pattern$1.test(lookahead);
|
|
8394
9291
|
}
|
|
8395
9292
|
|
|
8396
9293
|
//#endregion
|
|
8397
9294
|
//#region src/parse/traverse.ts
|
|
9295
|
+
/**
|
|
9296
|
+
* Parses TypeScript/JSX code into an AST using oxc-parser
|
|
9297
|
+
*/
|
|
9298
|
+
function parseProgram(code) {
|
|
9299
|
+
const parsed = parseSync("file.tsx", code, {
|
|
9300
|
+
lang: "tsx",
|
|
9301
|
+
sourceType: "module",
|
|
9302
|
+
astType: "ts",
|
|
9303
|
+
range: true
|
|
9304
|
+
});
|
|
9305
|
+
return parsed.program;
|
|
9306
|
+
}
|
|
9307
|
+
/**
|
|
9308
|
+
* Calls the appropriate visitor function for enter/exit events
|
|
9309
|
+
*/
|
|
8398
9310
|
function callVisitor(visitor, type, hook, path$12) {
|
|
8399
9311
|
if (!visitor) return;
|
|
8400
9312
|
const specific = visitor[type];
|
|
@@ -8410,18 +9322,12 @@ function callVisitor(visitor, type, hook, path$12) {
|
|
|
8410
9322
|
if (fn) fn(path$12);
|
|
8411
9323
|
}
|
|
8412
9324
|
}
|
|
8413
|
-
|
|
8414
|
-
|
|
8415
|
-
|
|
8416
|
-
sourceType: "module",
|
|
8417
|
-
astType: "ts",
|
|
8418
|
-
range: true
|
|
8419
|
-
});
|
|
8420
|
-
return parsed.program;
|
|
8421
|
-
}
|
|
9325
|
+
/**
|
|
9326
|
+
* Traverses an AST program with a visitor pattern
|
|
9327
|
+
*/
|
|
8422
9328
|
function traverseProgram(program, visitor, state) {
|
|
8423
9329
|
let shouldStopAll = false;
|
|
8424
|
-
function
|
|
9330
|
+
function traverse$1(node, parent, key, index) {
|
|
8425
9331
|
if (shouldStopAll) return;
|
|
8426
9332
|
if (!isAstNodeLike(node)) return;
|
|
8427
9333
|
let shouldSkipChildren = false;
|
|
@@ -8443,215 +9349,316 @@ function traverseProgram(program, visitor, state) {
|
|
|
8443
9349
|
const record = node;
|
|
8444
9350
|
for (const k$1 of Object.keys(record)) {
|
|
8445
9351
|
const value = record[k$1];
|
|
8446
|
-
if (Array.isArray(value)) for (let i = 0; i < value.length; i++)
|
|
8447
|
-
else
|
|
9352
|
+
if (Array.isArray(value)) for (let i = 0; i < value.length; i++) traverse$1(value[i], node, k$1, i);
|
|
9353
|
+
else traverse$1(value, node, k$1, null);
|
|
8448
9354
|
}
|
|
8449
9355
|
}
|
|
8450
9356
|
callVisitor(visitor, "exit", "exit", path$12);
|
|
8451
9357
|
}
|
|
8452
|
-
|
|
9358
|
+
traverse$1(program, null, null, null);
|
|
8453
9359
|
}
|
|
9360
|
+
/**
|
|
9361
|
+
* Finds all component$ function bodies in the AST and returns their positions
|
|
9362
|
+
*/
|
|
8454
9363
|
function findAllComponentBodyRangesFromProgram(program) {
|
|
8455
9364
|
const ranges = [];
|
|
8456
9365
|
traverseProgram(program, { enter: (path$12) => {
|
|
8457
9366
|
const node = path$12.node;
|
|
8458
|
-
if (!node) return;
|
|
8459
|
-
|
|
8460
|
-
|
|
8461
|
-
|
|
8462
|
-
|
|
8463
|
-
|
|
8464
|
-
|
|
8465
|
-
|
|
8466
|
-
|
|
8467
|
-
|
|
8468
|
-
|
|
8469
|
-
|
|
8470
|
-
|
|
8471
|
-
|
|
8472
|
-
|
|
8473
|
-
|
|
8474
|
-
|
|
8475
|
-
ranges.push({
|
|
8476
|
-
insertPos: start + 1,
|
|
8477
|
-
bodyStart: start,
|
|
8478
|
-
bodyEnd: end,
|
|
8479
|
-
exportName
|
|
8480
|
-
});
|
|
8481
|
-
}
|
|
8482
|
-
}
|
|
8483
|
-
}
|
|
8484
|
-
}
|
|
9367
|
+
if (!node || node.type !== "CallExpression") return;
|
|
9368
|
+
const callee = node.callee;
|
|
9369
|
+
if (!callee || callee.type !== "Identifier" || callee.name !== "component$") return;
|
|
9370
|
+
const firstArg = node.arguments?.[0];
|
|
9371
|
+
const isFunction = firstArg?.type === "ArrowFunctionExpression" || firstArg?.type === "FunctionExpression";
|
|
9372
|
+
if (!isFunction) return;
|
|
9373
|
+
const body = firstArg.body;
|
|
9374
|
+
if (body?.type !== "BlockStatement" || !Array.isArray(body.range)) return;
|
|
9375
|
+
const start = body.range[0];
|
|
9376
|
+
const end = body.range[1];
|
|
9377
|
+
const exportName = detectExportName(path$12.parent);
|
|
9378
|
+
ranges.push({
|
|
9379
|
+
insertPos: start + 1,
|
|
9380
|
+
bodyStart: start,
|
|
9381
|
+
bodyEnd: end,
|
|
9382
|
+
exportName
|
|
9383
|
+
});
|
|
8485
9384
|
} });
|
|
9385
|
+
return deduplicateAndSort(ranges);
|
|
9386
|
+
}
|
|
9387
|
+
/**
|
|
9388
|
+
* Detects the export name from the parent node context
|
|
9389
|
+
*/
|
|
9390
|
+
function detectExportName(parent) {
|
|
9391
|
+
if (!parent) return void 0;
|
|
9392
|
+
if (parent.type === "ExportDefaultDeclaration") return "";
|
|
9393
|
+
if (parent.type === "VariableDeclarator") {
|
|
9394
|
+
const id = parent.id;
|
|
9395
|
+
if (id?.type === "Identifier" && typeof id.name === "string") return id.name;
|
|
9396
|
+
}
|
|
9397
|
+
return void 0;
|
|
9398
|
+
}
|
|
9399
|
+
/**
|
|
9400
|
+
* Removes duplicate ranges and sorts by insertPos ascending
|
|
9401
|
+
*/
|
|
9402
|
+
function deduplicateAndSort(ranges) {
|
|
8486
9403
|
const seen = new Set();
|
|
8487
9404
|
const unique = ranges.filter((r) => {
|
|
8488
9405
|
if (seen.has(r.insertPos)) return false;
|
|
8489
9406
|
seen.add(r.insertPos);
|
|
8490
9407
|
return true;
|
|
8491
9408
|
});
|
|
8492
|
-
unique.sort((a, b) => a.insertPos - b.insertPos);
|
|
8493
|
-
return unique;
|
|
9409
|
+
return unique.sort((a, b) => a.insertPos - b.insertPos);
|
|
8494
9410
|
}
|
|
8495
9411
|
|
|
8496
9412
|
//#endregion
|
|
8497
|
-
//#region src/parse/
|
|
8498
|
-
|
|
8499
|
-
|
|
8500
|
-
|
|
9413
|
+
//#region src/parse/initInjector.ts
|
|
9414
|
+
/**
|
|
9415
|
+
* Injects collecthook initialization and render stats at the beginning of each component body
|
|
9416
|
+
*/
|
|
9417
|
+
function injectInitHooks(code, bodies, options) {
|
|
9418
|
+
const tasks = [];
|
|
9419
|
+
for (const body of bodies) {
|
|
9420
|
+
const task = createInitTask(code, body, options);
|
|
9421
|
+
if (task) tasks.push(task);
|
|
9422
|
+
}
|
|
9423
|
+
return applyTasks$1(code, tasks);
|
|
9424
|
+
}
|
|
9425
|
+
/**
|
|
9426
|
+
* Creates an initialization task for a single component body
|
|
9427
|
+
*/
|
|
9428
|
+
function createInitTask(code, body, options) {
|
|
9429
|
+
const { insertPos, exportName } = body;
|
|
9430
|
+
if (hasExistingCollecthook(code, insertPos)) return null;
|
|
9431
|
+
const { insertIndex, prefixNewline } = calculateInsertPosition(code, insertPos);
|
|
9432
|
+
const indent = readIndent(code, insertIndex);
|
|
9433
|
+
const componentArg = buildComponentArg(options?.path, exportName);
|
|
9434
|
+
const initLine = `${prefixNewline}${indent}const collecthook = ${INNER_USE_HOOK}(${componentArg})\n`;
|
|
9435
|
+
return {
|
|
9436
|
+
start: insertIndex,
|
|
9437
|
+
end: insertIndex,
|
|
9438
|
+
text: initLine
|
|
9439
|
+
};
|
|
9440
|
+
}
|
|
9441
|
+
function hasExistingCollecthook(code, insertPos) {
|
|
9442
|
+
const lookahead = code.slice(insertPos, insertPos + 200);
|
|
9443
|
+
return /const\s+collecthook\s*=\s*useCollectHooks\s*\(/.test(lookahead);
|
|
9444
|
+
}
|
|
9445
|
+
function calculateInsertPosition(code, insertPos) {
|
|
9446
|
+
if (code[insertPos] === "\r" && code[insertPos + 1] === "\n") return {
|
|
9447
|
+
insertIndex: insertPos + 2,
|
|
9448
|
+
prefixNewline: ""
|
|
9449
|
+
};
|
|
9450
|
+
if (code[insertPos] === "\n") return {
|
|
9451
|
+
insertIndex: insertPos + 1,
|
|
9452
|
+
prefixNewline: ""
|
|
9453
|
+
};
|
|
9454
|
+
return {
|
|
9455
|
+
insertIndex: insertPos,
|
|
9456
|
+
prefixNewline: "\n"
|
|
9457
|
+
};
|
|
9458
|
+
}
|
|
9459
|
+
/**
|
|
9460
|
+
* Builds the component argument string for collecthook initialization
|
|
9461
|
+
*/
|
|
9462
|
+
function buildComponentArg(path$12, exportName) {
|
|
9463
|
+
const rawArg = String(path$12 ?? "");
|
|
9464
|
+
const baseArg = rawArg.split("?")[0].split("#")[0];
|
|
9465
|
+
const suffix = buildComponentSuffix(baseArg, exportName);
|
|
9466
|
+
return JSON.stringify(`${baseArg}${suffix}`);
|
|
9467
|
+
}
|
|
9468
|
+
function buildComponentSuffix(baseArg, exportName) {
|
|
9469
|
+
if (exportName && typeof exportName === "string") return `_${exportName}`;
|
|
9470
|
+
if (baseArg.endsWith("index.tsx")) {
|
|
9471
|
+
const parts = baseArg.split("/");
|
|
9472
|
+
const parent = parts.length >= 2 ? parts[parts.length - 2] : "index";
|
|
9473
|
+
return `_${parent.replace(/-/g, "_")}`;
|
|
9474
|
+
}
|
|
9475
|
+
const file = baseArg.split("/").pop() || "";
|
|
9476
|
+
const name = file.replace(/\.[^.]+$/, "");
|
|
9477
|
+
return name ? `_${name.replace(/-/g, "_")}` : "";
|
|
9478
|
+
}
|
|
9479
|
+
function applyTasks$1(code, tasks) {
|
|
9480
|
+
tasks.sort((a, b) => b.start - a.start);
|
|
8501
9481
|
let result = code;
|
|
8502
|
-
|
|
8503
|
-
|
|
8504
|
-
|
|
8505
|
-
|
|
8506
|
-
|
|
8507
|
-
|
|
8508
|
-
|
|
8509
|
-
|
|
8510
|
-
|
|
8511
|
-
|
|
8512
|
-
|
|
8513
|
-
|
|
8514
|
-
|
|
8515
|
-
|
|
8516
|
-
|
|
8517
|
-
|
|
8518
|
-
|
|
8519
|
-
const
|
|
8520
|
-
|
|
8521
|
-
const baseArg = rawArg.split("?")[0].split("#")[0];
|
|
8522
|
-
let suffix = "";
|
|
8523
|
-
if (exportName && typeof exportName === "string") suffix = `_${exportName}`;
|
|
8524
|
-
else if (baseArg.endsWith("index.tsx")) {
|
|
8525
|
-
const parts = baseArg.split("/");
|
|
8526
|
-
const parent = parts.length >= 2 ? parts[parts.length - 2] : "index";
|
|
8527
|
-
const safeParent = parent.replace(/-/g, "_");
|
|
8528
|
-
suffix = `_${safeParent}`;
|
|
8529
|
-
} else {
|
|
8530
|
-
const file = baseArg.split("/").pop() || "";
|
|
8531
|
-
const name = file.replace(/\.[^.]+$/, "");
|
|
8532
|
-
const safeName = name.replace(/-/g, "_");
|
|
8533
|
-
suffix = name ? `_${safeName}` : "";
|
|
8534
|
-
}
|
|
8535
|
-
const arg = JSON.stringify(`${baseArg}${suffix}`);
|
|
8536
|
-
const initLine = `${prefixNewline}${indent}const collecthook = ${INNER_USE_HOOK}(${arg})\n`;
|
|
8537
|
-
tasks.push({
|
|
8538
|
-
start: insertIndex,
|
|
8539
|
-
end: insertIndex,
|
|
8540
|
-
text: initLine
|
|
8541
|
-
});
|
|
9482
|
+
for (const task of tasks) result = result.slice(0, task.start) + task.text + result.slice(task.end);
|
|
9483
|
+
return result;
|
|
9484
|
+
}
|
|
9485
|
+
|
|
9486
|
+
//#endregion
|
|
9487
|
+
//#region src/parse/hookTracker.ts
|
|
9488
|
+
/**
|
|
9489
|
+
* Injects collecthook calls after each hook usage
|
|
9490
|
+
*/
|
|
9491
|
+
function injectHookTrackers(code) {
|
|
9492
|
+
const program = parseProgram(code);
|
|
9493
|
+
const tasks = [];
|
|
9494
|
+
let customHookIndex = 0;
|
|
9495
|
+
traverseProgram(program, { enter: (path$12) => {
|
|
9496
|
+
const node = path$12.node;
|
|
9497
|
+
if (!node) return;
|
|
9498
|
+
if (node.type === "VariableDeclarator") {
|
|
9499
|
+
const task = processVariableDeclarator(code, node, path$12);
|
|
9500
|
+
if (task) tasks.push(task);
|
|
8542
9501
|
}
|
|
8543
|
-
|
|
8544
|
-
|
|
8545
|
-
|
|
8546
|
-
|
|
8547
|
-
|
|
8548
|
-
const tasks = [];
|
|
8549
|
-
traverseProgram(programForInjections, { enter: (path$12) => {
|
|
8550
|
-
const node = path$12.node;
|
|
8551
|
-
if (!node) return;
|
|
8552
|
-
if (node.type === "VariableDeclarator") {
|
|
8553
|
-
const init = node.init;
|
|
8554
|
-
if (!isAstNodeLike(init) || init.type !== "CallExpression") return;
|
|
8555
|
-
const callee = init.callee;
|
|
8556
|
-
if (!isAstNodeLike(callee) || callee.type !== "Identifier") return;
|
|
8557
|
-
const hookName = normalizeHookName(callee.name);
|
|
8558
|
-
const isQrlName = normalizeQrlHookName(hookName);
|
|
8559
|
-
const variableId = getVariableIdentifierName(node.id);
|
|
8560
|
-
if (!variableId) return;
|
|
8561
|
-
if (hookName === INNER_USE_HOOK) return;
|
|
8562
|
-
if (isCustomHook(isQrlName)) {
|
|
8563
|
-
const parent$1 = path$12.parent;
|
|
8564
|
-
const parentRange$1 = parent$1 && Array.isArray(parent$1.range) ? parent$1.range : void 0;
|
|
8565
|
-
if (!parentRange$1) return;
|
|
8566
|
-
const declStart$1 = parentRange$1[0];
|
|
8567
|
-
const declEnd$1 = parentRange$1[1];
|
|
8568
|
-
const lineStart$1 = findLineStart(result, declStart$1);
|
|
8569
|
-
const indent$1 = readIndent(result, lineStart$1);
|
|
8570
|
-
const payload$1 = buildCollecthookPayload(indent$1, variableId, "customhook", "VariableDeclarator", variableId);
|
|
8571
|
-
if (hasCollecthookAfterByVariableId(result, declEnd$1, variableId)) return;
|
|
8572
|
-
tasks.push({
|
|
8573
|
-
kind: "insert",
|
|
8574
|
-
pos: declEnd$1,
|
|
8575
|
-
text: "\n" + payload$1
|
|
8576
|
-
});
|
|
8577
|
-
return;
|
|
8578
|
-
}
|
|
8579
|
-
if (!isKnownHook(isQrlName)) return;
|
|
8580
|
-
const parent = path$12.parent;
|
|
8581
|
-
const parentRange = parent && Array.isArray(parent.range) ? parent.range : void 0;
|
|
8582
|
-
if (!parentRange) return;
|
|
8583
|
-
const declStart = parentRange[0];
|
|
8584
|
-
const declEnd = parentRange[1];
|
|
8585
|
-
const lineStart = findLineStart(result, declStart);
|
|
8586
|
-
const indent = readIndent(result, lineStart);
|
|
8587
|
-
const payload = buildCollecthookPayload(indent, variableId, isQrlName, "VariableDeclarator", variableId);
|
|
8588
|
-
if (hasCollecthookAfterByVariableId(result, declEnd, variableId)) return;
|
|
8589
|
-
tasks.push({
|
|
8590
|
-
kind: "insert",
|
|
8591
|
-
pos: declEnd,
|
|
8592
|
-
text: "\n" + payload
|
|
8593
|
-
});
|
|
8594
|
-
return;
|
|
8595
|
-
}
|
|
8596
|
-
if (node.type === "ExpressionStatement") {
|
|
8597
|
-
const expr = node.expression;
|
|
8598
|
-
if (!isAstNodeLike(expr) || expr.type !== "CallExpression") return;
|
|
8599
|
-
const callee = expr.callee;
|
|
8600
|
-
if (!isAstNodeLike(callee) || callee.type !== "Identifier") return;
|
|
8601
|
-
const hookName = normalizeHookName(callee.name);
|
|
8602
|
-
const isQrlName = normalizeQrlHookName(hookName);
|
|
8603
|
-
const isListed = isKnownHook(isQrlName);
|
|
8604
|
-
if (hookName === INNER_USE_HOOK) return;
|
|
8605
|
-
const stmtRange = Array.isArray(node.range) ? node.range : void 0;
|
|
8606
|
-
if (!stmtRange) return;
|
|
8607
|
-
const stmtStart = stmtRange[0];
|
|
8608
|
-
const stmtEnd = stmtRange[1];
|
|
8609
|
-
const lineStart = findLineStart(result, stmtStart);
|
|
8610
|
-
const indent = readIndent(result, lineStart);
|
|
8611
|
-
if (isListed) {
|
|
8612
|
-
const payload = buildCollecthookPayload(indent, isQrlName, isQrlName, "expressionStatement", "undefined");
|
|
8613
|
-
if (hasCollecthookAfterByVariableName(result, stmtEnd, isQrlName)) return;
|
|
8614
|
-
tasks.push({
|
|
8615
|
-
kind: "insert",
|
|
8616
|
-
pos: stmtEnd,
|
|
8617
|
-
text: "\n" + payload
|
|
8618
|
-
});
|
|
8619
|
-
} else if (isCustomHook(isQrlName)) {
|
|
8620
|
-
const stmtRange$1 = Array.isArray(node.range) ? node.range : void 0;
|
|
8621
|
-
if (!stmtRange$1) return;
|
|
8622
|
-
const stmtStart$1 = stmtRange$1[0];
|
|
8623
|
-
const stmtEnd$1 = stmtRange$1[1];
|
|
8624
|
-
const callSource = result.slice(stmtStart$1, stmtEnd$1);
|
|
8625
|
-
const lineStart2 = findLineStart(result, stmtStart$1);
|
|
8626
|
-
const indent2 = readIndent(result, lineStart2);
|
|
8627
|
-
const variableName = `_customhook_${index}`;
|
|
8628
|
-
const declLine = `${indent2}let ${variableName} = ${trimStatementSemicolon(callSource)};\n`;
|
|
8629
|
-
const payload = buildCollecthookPayload(indent2, variableName, "customhook", "VariableDeclarator", variableName);
|
|
8630
|
-
index++;
|
|
8631
|
-
tasks.push({
|
|
8632
|
-
kind: "replace",
|
|
8633
|
-
start: stmtStart$1,
|
|
8634
|
-
end: stmtEnd$1,
|
|
8635
|
-
text: declLine + payload
|
|
8636
|
-
});
|
|
8637
|
-
}
|
|
9502
|
+
if (node.type === "ExpressionStatement") {
|
|
9503
|
+
const result = processExpressionStatement(code, node, customHookIndex);
|
|
9504
|
+
if (result) {
|
|
9505
|
+
tasks.push(result.task);
|
|
9506
|
+
customHookIndex = result.newIndex;
|
|
8638
9507
|
}
|
|
8639
|
-
} });
|
|
8640
|
-
if (tasks.length > 0) {
|
|
8641
|
-
tasks.sort((a, b) => {
|
|
8642
|
-
const apos = a.kind === "insert" ? a.pos : a.start;
|
|
8643
|
-
const bpos = b.kind === "insert" ? b.pos : b.start;
|
|
8644
|
-
return bpos - apos;
|
|
8645
|
-
});
|
|
8646
|
-
for (const t of tasks) if (t.kind === "insert") result = result.slice(0, t.pos) + t.text + result.slice(t.pos);
|
|
8647
|
-
else result = result.slice(0, t.start) + t.text + result.slice(t.end);
|
|
8648
9508
|
}
|
|
9509
|
+
} });
|
|
9510
|
+
return applyTasks(code, tasks);
|
|
9511
|
+
}
|
|
9512
|
+
/**
|
|
9513
|
+
* Processes: const x = useSignal(), const data = useCustomHook()
|
|
9514
|
+
*/
|
|
9515
|
+
function processVariableDeclarator(code, node, path$12) {
|
|
9516
|
+
const hookInfo = extractHookInfo(node);
|
|
9517
|
+
if (!hookInfo) return null;
|
|
9518
|
+
const { hookName, normalizedName, variableId } = hookInfo;
|
|
9519
|
+
if (hookName === INNER_USE_HOOK) return null;
|
|
9520
|
+
const range$1 = getParentRange(path$12.parent);
|
|
9521
|
+
if (!range$1) return null;
|
|
9522
|
+
const { declEnd, indent } = getPositionInfo(code, range$1);
|
|
9523
|
+
if (isCustomHook(normalizedName)) {
|
|
9524
|
+
if (hasCollecthookAfterByVariableId(code, declEnd, variableId)) return null;
|
|
9525
|
+
const payload$1 = buildCollecthookPayload(indent, variableId, "customhook", "VariableDeclarator", variableId);
|
|
9526
|
+
return {
|
|
9527
|
+
kind: "insert",
|
|
9528
|
+
pos: declEnd,
|
|
9529
|
+
text: "\n" + payload$1
|
|
9530
|
+
};
|
|
8649
9531
|
}
|
|
9532
|
+
if (!isKnownHook(normalizedName)) return null;
|
|
9533
|
+
if (hasCollecthookAfterByVariableId(code, declEnd, variableId)) return null;
|
|
9534
|
+
const payload = buildCollecthookPayload(indent, variableId, normalizedName, "VariableDeclarator", variableId);
|
|
9535
|
+
return {
|
|
9536
|
+
kind: "insert",
|
|
9537
|
+
pos: declEnd,
|
|
9538
|
+
text: "\n" + payload
|
|
9539
|
+
};
|
|
9540
|
+
}
|
|
9541
|
+
/**
|
|
9542
|
+
* Processes: useTask$(() => {}), useCustomHook()
|
|
9543
|
+
*/
|
|
9544
|
+
function processExpressionStatement(code, node, currentIndex) {
|
|
9545
|
+
const hookInfo = extractExpressionHookInfo(node);
|
|
9546
|
+
if (!hookInfo) return null;
|
|
9547
|
+
const { hookName, normalizedName } = hookInfo;
|
|
9548
|
+
if (hookName === INNER_USE_HOOK) return null;
|
|
9549
|
+
const stmtRange = node.range;
|
|
9550
|
+
if (!stmtRange) return null;
|
|
9551
|
+
const [stmtStart, stmtEnd] = stmtRange;
|
|
9552
|
+
const lineStart = findLineStart(code, stmtStart);
|
|
9553
|
+
const indent = readIndent(code, lineStart);
|
|
9554
|
+
if (isKnownHook(normalizedName)) {
|
|
9555
|
+
if (hasCollecthookAfterByVariableName(code, stmtEnd, normalizedName)) return null;
|
|
9556
|
+
const payload = buildCollecthookPayload(indent, normalizedName, normalizedName, "expressionStatement", "undefined");
|
|
9557
|
+
return {
|
|
9558
|
+
task: {
|
|
9559
|
+
kind: "insert",
|
|
9560
|
+
pos: stmtEnd,
|
|
9561
|
+
text: "\n" + payload
|
|
9562
|
+
},
|
|
9563
|
+
newIndex: currentIndex
|
|
9564
|
+
};
|
|
9565
|
+
}
|
|
9566
|
+
if (isCustomHook(normalizedName)) return convertToVariableDeclaration(code, stmtStart, stmtEnd, indent, currentIndex);
|
|
9567
|
+
return null;
|
|
9568
|
+
}
|
|
9569
|
+
/**
|
|
9570
|
+
* Converts a custom hook expression to a variable declaration with tracking
|
|
9571
|
+
*/
|
|
9572
|
+
function convertToVariableDeclaration(code, stmtStart, stmtEnd, indent, currentIndex) {
|
|
9573
|
+
const callSource = code.slice(stmtStart, stmtEnd);
|
|
9574
|
+
const variableName = `_customhook_${currentIndex}`;
|
|
9575
|
+
const declLine = `${indent}let ${variableName} = ${trimStatementSemicolon(callSource)};\n`;
|
|
9576
|
+
const payload = buildCollecthookPayload(indent, variableName, "customhook", "VariableDeclarator", variableName);
|
|
9577
|
+
return {
|
|
9578
|
+
task: {
|
|
9579
|
+
kind: "replace",
|
|
9580
|
+
start: stmtStart,
|
|
9581
|
+
end: stmtEnd,
|
|
9582
|
+
text: declLine + payload
|
|
9583
|
+
},
|
|
9584
|
+
newIndex: currentIndex + 1
|
|
9585
|
+
};
|
|
9586
|
+
}
|
|
9587
|
+
function extractHookInfo(node) {
|
|
9588
|
+
const init$1 = node.init;
|
|
9589
|
+
if (!isAstNodeLike(init$1) || init$1.type !== "CallExpression") return null;
|
|
9590
|
+
const callee = init$1.callee;
|
|
9591
|
+
if (!isAstNodeLike(callee) || callee.type !== "Identifier") return null;
|
|
9592
|
+
const hookName = normalizeHookName(callee.name);
|
|
9593
|
+
const normalizedName = normalizeQrlHookName(hookName);
|
|
9594
|
+
const variableId = getVariableIdentifierName(node.id);
|
|
9595
|
+
if (!variableId) return null;
|
|
9596
|
+
return {
|
|
9597
|
+
hookName,
|
|
9598
|
+
normalizedName,
|
|
9599
|
+
variableId
|
|
9600
|
+
};
|
|
9601
|
+
}
|
|
9602
|
+
function extractExpressionHookInfo(node) {
|
|
9603
|
+
const expr = node.expression;
|
|
9604
|
+
if (!isAstNodeLike(expr) || expr.type !== "CallExpression") return null;
|
|
9605
|
+
const callee = expr.callee;
|
|
9606
|
+
if (!isAstNodeLike(callee) || callee.type !== "Identifier") return null;
|
|
9607
|
+
const hookName = normalizeHookName(callee.name);
|
|
9608
|
+
const normalizedName = normalizeQrlHookName(hookName);
|
|
9609
|
+
return {
|
|
9610
|
+
hookName,
|
|
9611
|
+
normalizedName
|
|
9612
|
+
};
|
|
9613
|
+
}
|
|
9614
|
+
function getParentRange(parent) {
|
|
9615
|
+
const range$1 = parent?.range;
|
|
9616
|
+
if (!range$1) return null;
|
|
9617
|
+
return [range$1[0], range$1[1]];
|
|
9618
|
+
}
|
|
9619
|
+
function getPositionInfo(code, range$1) {
|
|
9620
|
+
const [declStart, declEnd] = range$1;
|
|
9621
|
+
const lineStart = findLineStart(code, declStart);
|
|
9622
|
+
const indent = readIndent(code, lineStart);
|
|
9623
|
+
return {
|
|
9624
|
+
declStart,
|
|
9625
|
+
declEnd,
|
|
9626
|
+
indent
|
|
9627
|
+
};
|
|
9628
|
+
}
|
|
9629
|
+
function applyTasks(code, tasks) {
|
|
9630
|
+
if (tasks.length === 0) return code;
|
|
9631
|
+
tasks.sort((a, b) => {
|
|
9632
|
+
const aPos = a.kind === "insert" ? a.pos : a.start;
|
|
9633
|
+
const bPos = b.kind === "insert" ? b.pos : b.start;
|
|
9634
|
+
return bPos - aPos;
|
|
9635
|
+
});
|
|
9636
|
+
let result = code;
|
|
9637
|
+
for (const task of tasks) if (task.kind === "insert") result = result.slice(0, task.pos) + task.text + result.slice(task.pos);
|
|
9638
|
+
else result = result.slice(0, task.start) + task.text + result.slice(task.end);
|
|
9639
|
+
return result;
|
|
9640
|
+
}
|
|
9641
|
+
|
|
9642
|
+
//#endregion
|
|
9643
|
+
//#region src/parse/parse.ts
|
|
9644
|
+
/**
|
|
9645
|
+
* Parses and transforms Qwik component code by injecting devtools hooks
|
|
9646
|
+
*
|
|
9647
|
+
* Phase 1: Inject initialization hooks (collecthook setup + render stats)
|
|
9648
|
+
* Phase 2: Inject collecthook calls for individual hooks
|
|
9649
|
+
*/
|
|
9650
|
+
function parseQwikCode(code, options) {
|
|
9651
|
+
const program = parseProgram(code);
|
|
9652
|
+
const componentBodies = findAllComponentBodyRangesFromProgram(program);
|
|
9653
|
+
if (componentBodies.length === 0) return code;
|
|
9654
|
+
let result = injectInitHooks(code, componentBodies, options);
|
|
9655
|
+
result = injectHookTrackers(result);
|
|
8650
9656
|
return result;
|
|
8651
9657
|
}
|
|
8652
9658
|
|
|
8653
9659
|
//#endregion
|
|
8654
9660
|
//#region src/inspect/index.ts
|
|
9661
|
+
const log$3 = (0, import_src.debug)("qwik:devtools:inspect");
|
|
8655
9662
|
const codeStringCache = new Map();
|
|
8656
9663
|
function parseCodeWithCache(code) {
|
|
8657
9664
|
const hit = codeStringCache.get(code);
|
|
@@ -8681,7 +9688,7 @@ function getModulesContent(ctx) {
|
|
|
8681
9688
|
modules: modules$1
|
|
8682
9689
|
};
|
|
8683
9690
|
} catch (error) {
|
|
8684
|
-
|
|
9691
|
+
log$3(`Failed to transform request for ${pathId}:`, error);
|
|
8685
9692
|
return {
|
|
8686
9693
|
pathId,
|
|
8687
9694
|
modules: null,
|
|
@@ -8727,7 +9734,7 @@ function getModulesContent(ctx) {
|
|
|
8727
9734
|
} catch {}
|
|
8728
9735
|
return [];
|
|
8729
9736
|
} catch (error) {
|
|
8730
|
-
|
|
9737
|
+
log$3(`Failed to parse qwik code for ${pathId}:`, error);
|
|
8731
9738
|
return [];
|
|
8732
9739
|
}
|
|
8733
9740
|
}
|
|
@@ -8747,30 +9754,6 @@ function getServerFunctions(ctx) {
|
|
|
8747
9754
|
};
|
|
8748
9755
|
}
|
|
8749
9756
|
|
|
8750
|
-
//#endregion
|
|
8751
|
-
//#region src/utils/useCollectHooks.ts
|
|
8752
|
-
const useCollectHooks = `import { $, useSignal, useVisibleTask$ } from "@qwik.dev/core"
|
|
8753
|
-
export const useCollectHooks = (src) => {
|
|
8754
|
-
const hooksList = useSignal(new Set())
|
|
8755
|
-
useVisibleTask$(({ track }) => {
|
|
8756
|
-
const newdata = track(() => hooksList.value);
|
|
8757
|
-
if(!window.QWIK_DEVTOOLS_GLOBAL_STATE) {
|
|
8758
|
-
window.QWIK_DEVTOOLS_GLOBAL_STATE = {}
|
|
8759
|
-
window.QWIK_DEVTOOLS_GLOBAL_STATE[src] = [...newdata]
|
|
8760
|
-
}else {
|
|
8761
|
-
window.QWIK_DEVTOOLS_GLOBAL_STATE[src] = [...newdata]
|
|
8762
|
-
}
|
|
8763
|
-
}, { strategy: 'document-ready'})
|
|
8764
|
-
return $((args) => {
|
|
8765
|
-
if(hooksList.value.has(args)) {
|
|
8766
|
-
return
|
|
8767
|
-
}
|
|
8768
|
-
hooksList.value.add(args)
|
|
8769
|
-
})
|
|
8770
|
-
}
|
|
8771
|
-
`;
|
|
8772
|
-
var useCollectHooks_default = useCollectHooks;
|
|
8773
|
-
|
|
8774
9757
|
//#endregion
|
|
8775
9758
|
//#region src/utils/updateConf.ts
|
|
8776
9759
|
function updateConf(conf) {
|
|
@@ -8796,59 +9779,309 @@ function updateConf(conf) {
|
|
|
8796
9779
|
var updateConf_default = updateConf;
|
|
8797
9780
|
|
|
8798
9781
|
//#endregion
|
|
8799
|
-
//#region src/
|
|
8800
|
-
|
|
8801
|
-
|
|
9782
|
+
//#region src/virtualmodules/useCollectHooks.ts
|
|
9783
|
+
/**
|
|
9784
|
+
* Virtual module source for devtools tracking.
|
|
9785
|
+
* Collects hooks and tracks render statistics.
|
|
9786
|
+
*/
|
|
9787
|
+
const useCollectHooks = `import { $, useSignal, useVisibleTask$ } from "@qwik.dev/core"
|
|
9788
|
+
|
|
9789
|
+
function initComponentState() {
|
|
9790
|
+
return {
|
|
9791
|
+
hooks: [],
|
|
9792
|
+
stats: {}
|
|
9793
|
+
}
|
|
9794
|
+
}
|
|
9795
|
+
|
|
9796
|
+
function getOrCreateState(src) {
|
|
9797
|
+
if (!window.QWIK_DEVTOOLS_GLOBAL_STATE) {
|
|
9798
|
+
window.QWIK_DEVTOOLS_GLOBAL_STATE = {}
|
|
9799
|
+
}
|
|
9800
|
+
if (!window.QWIK_DEVTOOLS_GLOBAL_STATE[src]) {
|
|
9801
|
+
window.QWIK_DEVTOOLS_GLOBAL_STATE[src] = initComponentState()
|
|
9802
|
+
}
|
|
9803
|
+
return window.QWIK_DEVTOOLS_GLOBAL_STATE[src]
|
|
9804
|
+
}
|
|
9805
|
+
|
|
9806
|
+
/**
|
|
9807
|
+
* Hook to collect component hooks
|
|
9808
|
+
*/
|
|
9809
|
+
export const useCollectHooks = (src) => {
|
|
9810
|
+
const hooksList = useSignal(new Set())
|
|
9811
|
+
useVisibleTask$(({ track }) => {
|
|
9812
|
+
const newHooks = track(() => hooksList.value)
|
|
9813
|
+
const state = getOrCreateState(src)
|
|
9814
|
+
state.hooks = [...newHooks]
|
|
9815
|
+
}, { strategy: 'document-ready' })
|
|
9816
|
+
|
|
9817
|
+
return $((args) => {
|
|
9818
|
+
if (hooksList.value.has(args)) {
|
|
9819
|
+
return
|
|
9820
|
+
}
|
|
9821
|
+
hooksList.value.add(args)
|
|
9822
|
+
})
|
|
9823
|
+
}
|
|
9824
|
+
`;
|
|
9825
|
+
var useCollectHooks_default = useCollectHooks;
|
|
9826
|
+
|
|
9827
|
+
//#endregion
|
|
9828
|
+
//#region src/virtualmodules/perfRuntime.ts
|
|
9829
|
+
/**
|
|
9830
|
+
* Shared runtime snippet used by perf instrumentation code.
|
|
9831
|
+
*
|
|
9832
|
+
* This file exports a **string** (not executable TS) that gets concatenated into:
|
|
9833
|
+
* - the virtual module `virtual:qwik-component-proxy`
|
|
9834
|
+
* - injected wrappers for Qwik-generated `_component_` render-function modules
|
|
9835
|
+
*
|
|
9836
|
+
* It is intentionally framework-agnostic and relies only on `window`/`process`.
|
|
9837
|
+
*/
|
|
9838
|
+
const perfRuntime = `
|
|
9839
|
+
// [qwik-perf-runtime] shared helpers (injected)
|
|
9840
|
+
const __qwik_perf_is_server__ = () => typeof window === 'undefined';
|
|
9841
|
+
|
|
9842
|
+
const __qwik_perf_init_csr__ = () => {
|
|
9843
|
+
if (typeof window === 'undefined') return;
|
|
9844
|
+
window.__QWIK_PERF__ = window.__QWIK_PERF__ || { ssr: [], csr: [] };
|
|
9845
|
+
// Map: viteId -> index in perf.csr (used for upsert)
|
|
9846
|
+
window.__QWIK_PERF__._csrByViteId = window.__QWIK_PERF__._csrByViteId || {};
|
|
9847
|
+
// Map: component -> index in perf.ssr (used for componentQrl upsert on CSR)
|
|
9848
|
+
window.__QWIK_PERF__._ssrByComponent = window.__QWIK_PERF__._ssrByComponent || {};
|
|
9849
|
+
};
|
|
9850
|
+
|
|
9851
|
+
const __qwik_perf_get_ssr_store__ = () =>
|
|
9852
|
+
typeof process !== 'undefined' && process ? process : globalThis;
|
|
9853
|
+
|
|
9854
|
+
const __qwik_perf_next_id__ = (perf) => {
|
|
9855
|
+
perf._id = (perf._id || 0) + 1;
|
|
9856
|
+
return perf._id;
|
|
9857
|
+
};
|
|
9858
|
+
|
|
9859
|
+
const __qwik_perf_next_ssr_id__ = (store) => {
|
|
9860
|
+
store.__QWIK_SSR_PERF_ID__ = (store.__QWIK_SSR_PERF_ID__ || 0) + 1;
|
|
9861
|
+
return store.__QWIK_SSR_PERF_ID__;
|
|
9862
|
+
};
|
|
9863
|
+
|
|
9864
|
+
const __qwik_perf_ssr_push__ = (store, entry) => {
|
|
9865
|
+
const id = __qwik_perf_next_ssr_id__(store);
|
|
9866
|
+
store.__QWIK_SSR_PERF__.push({ id, ...entry });
|
|
9867
|
+
return store.__QWIK_SSR_PERF__.length - 1;
|
|
9868
|
+
};
|
|
9869
|
+
|
|
9870
|
+
const __qwik_perf_commit_ssr__ = (store, entry) => {
|
|
9871
|
+
store.__QWIK_SSR_PERF__ = store.__QWIK_SSR_PERF__ || [];
|
|
9872
|
+
|
|
9873
|
+
// Upsert by key (viteId preferred, otherwise component). Keep only the latest entry per key,
|
|
9874
|
+
// but also attach an ever-increasing ssrCount so we can see how many times it rendered.
|
|
9875
|
+
store.__QWIK_SSR_PERF_INDEX__ = store.__QWIK_SSR_PERF_INDEX__ || {};
|
|
9876
|
+
store.__QWIK_SSR_PERF_COUNT__ = store.__QWIK_SSR_PERF_COUNT__ || {};
|
|
9877
|
+
|
|
9878
|
+
const key = (entry && (entry.viteId || entry.component)) || 'unknown';
|
|
9879
|
+
const nextCount = (store.__QWIK_SSR_PERF_COUNT__[key] || 0) + 1;
|
|
9880
|
+
store.__QWIK_SSR_PERF_COUNT__[key] = nextCount;
|
|
9881
|
+
|
|
9882
|
+
const next = { ...entry, ssrCount: nextCount };
|
|
9883
|
+
const existingIdx = store.__QWIK_SSR_PERF_INDEX__[key];
|
|
9884
|
+
|
|
9885
|
+
if (typeof existingIdx === 'number') {
|
|
9886
|
+
const prev = store.__QWIK_SSR_PERF__[existingIdx];
|
|
9887
|
+
store.__QWIK_SSR_PERF__[existingIdx] = { id: prev?.id, ...next };
|
|
9888
|
+
} else {
|
|
9889
|
+
store.__QWIK_SSR_PERF_INDEX__[key] = __qwik_perf_ssr_push__(store, next);
|
|
9890
|
+
}
|
|
9891
|
+
};
|
|
9892
|
+
|
|
9893
|
+
const __qwik_perf_commit_csr__ = (entry) => {
|
|
9894
|
+
__qwik_perf_init_csr__();
|
|
9895
|
+
const perf = window.__QWIK_PERF__;
|
|
9896
|
+
const next = { id: __qwik_perf_next_id__(perf), ...entry };
|
|
9897
|
+
|
|
9898
|
+
// If viteId exists we treat it as an "upsert" record (render-function modules).
|
|
9899
|
+
if (entry && entry.viteId) {
|
|
9900
|
+
const idx = perf._csrByViteId[entry.viteId];
|
|
9901
|
+
if (typeof idx === 'number') perf.csr[idx] = next;
|
|
9902
|
+
else {
|
|
9903
|
+
perf._csrByViteId[entry.viteId] = perf.csr.length;
|
|
9904
|
+
perf.csr.push(next);
|
|
9905
|
+
}
|
|
9906
|
+
return;
|
|
9907
|
+
}
|
|
9908
|
+
|
|
9909
|
+
perf.csr.push(next);
|
|
9910
|
+
};
|
|
9911
|
+
|
|
9912
|
+
// Force componentQrl entries to be treated as SSR records.
|
|
9913
|
+
// - On SSR: store into process/globalThis __QWIK_SSR_PERF__ (same as other SSR entries)
|
|
9914
|
+
// - On CSR: store into window.__QWIK_PERF__.ssr (so csr only contains render-function modules)
|
|
9915
|
+
const __qwik_perf_commit_componentqrl__ = (entry) => {
|
|
9916
|
+
const next = { ...entry, phase: 'ssr'};
|
|
9917
|
+
if (__qwik_perf_is_server__()) {
|
|
9918
|
+
const store = __qwik_perf_get_ssr_store__();
|
|
9919
|
+
__qwik_perf_commit_ssr__(store, next);
|
|
9920
|
+
return;
|
|
9921
|
+
}
|
|
9922
|
+
|
|
9923
|
+
__qwik_perf_init_csr__();
|
|
9924
|
+
const perf = window.__QWIK_PERF__;
|
|
9925
|
+
perf.ssr = perf.ssr || [];
|
|
9926
|
+
// Build index lazily from any SSR-injected snapshot
|
|
9927
|
+
if (!perf._ssrIndexBuilt) {
|
|
9928
|
+
for (let i = 0; i < perf.ssr.length; i++) {
|
|
9929
|
+
const e = perf.ssr[i];
|
|
9930
|
+
if (e && e.component && typeof perf._ssrByComponent[e.component] !== 'number') {
|
|
9931
|
+
perf._ssrByComponent[e.component] = i;
|
|
9932
|
+
}
|
|
9933
|
+
}
|
|
9934
|
+
perf._ssrIndexBuilt = true;
|
|
9935
|
+
}
|
|
9936
|
+
|
|
9937
|
+
const key = next && next.component;
|
|
9938
|
+
const idx = key ? perf._ssrByComponent[key] : undefined;
|
|
9939
|
+
if (typeof idx === 'number') {
|
|
9940
|
+
const prev = perf.ssr[idx];
|
|
9941
|
+
const prevCount = prev && typeof prev.ssrCount === 'number' ? prev.ssrCount : 0;
|
|
9942
|
+
const ssrCount = prevCount + 1;
|
|
9943
|
+
perf.ssr[idx] = { id: prev && prev.id, ...next, ssrCount };
|
|
9944
|
+
} else {
|
|
9945
|
+
const id = __qwik_perf_next_id__(perf);
|
|
9946
|
+
if (key) perf._ssrByComponent[key] = perf.ssr.length;
|
|
9947
|
+
perf.ssr.push({ id, ...next, ssrCount: 1 });
|
|
9948
|
+
}
|
|
9949
|
+
};
|
|
9950
|
+
|
|
9951
|
+
const __qwik_perf_commit__ = (entry) => {
|
|
9952
|
+
if (__qwik_perf_is_server__()) {
|
|
9953
|
+
const store = __qwik_perf_get_ssr_store__();
|
|
9954
|
+
__qwik_perf_commit_ssr__(store, entry);
|
|
9955
|
+
} else {
|
|
9956
|
+
__qwik_perf_commit_csr__(entry);
|
|
9957
|
+
}
|
|
9958
|
+
};
|
|
9959
|
+
`;
|
|
9960
|
+
var perfRuntime_default = perfRuntime;
|
|
9961
|
+
|
|
9962
|
+
//#endregion
|
|
9963
|
+
//#region src/virtualmodules/qwikComponentProxy.ts
|
|
9964
|
+
const qwikComponentProxy$1 = `${perfRuntime_default}
|
|
9965
|
+
import { componentQrl as originalComponentQrl } from '@qwik.dev/core';
|
|
9966
|
+
|
|
9967
|
+
function componentQrl(qrl, options) {
|
|
9968
|
+
const phase = __qwik_perf_is_server__() ? 'ssr' : 'csr';
|
|
9969
|
+
const start = performance.now();
|
|
9970
|
+
let viteId = null;
|
|
9971
|
+
const component = qrl?.getSymbol?.() || qrl?.$symbol$ || 'unknown';
|
|
9972
|
+
if(qrl.dev){
|
|
9973
|
+
viteId = qrl.dev.file.replace(/[^/]*$/, qrl.dev.displayName);
|
|
9974
|
+
}
|
|
9975
|
+
const result = originalComponentQrl(qrl, options);
|
|
9976
|
+
const duration = performance.now() - start;
|
|
9977
|
+
__qwik_perf_commit_componentqrl__({
|
|
9978
|
+
component,
|
|
9979
|
+
phase,
|
|
9980
|
+
duration,
|
|
9981
|
+
start,
|
|
9982
|
+
viteId,
|
|
9983
|
+
end: start + duration,
|
|
9984
|
+
});
|
|
9985
|
+
return result;
|
|
9986
|
+
}
|
|
9987
|
+
|
|
9988
|
+
export { componentQrl };
|
|
9989
|
+
`;
|
|
9990
|
+
var qwikComponentProxy_default = qwikComponentProxy$1;
|
|
9991
|
+
|
|
9992
|
+
//#endregion
|
|
9993
|
+
//#region src/virtualmodules/virtualModules.ts
|
|
9994
|
+
const log$2 = (0, import_src.debug)("qwik:devtools:plugin");
|
|
9995
|
+
const VIRTUAL_MODULES = [{
|
|
9996
|
+
key: VIRTUAL_QWIK_DEVTOOLS_KEY,
|
|
9997
|
+
source: useCollectHooks_default,
|
|
9998
|
+
hookName: INNER_USE_HOOK
|
|
9999
|
+
}, {
|
|
10000
|
+
key: "virtual:qwik-component-proxy",
|
|
10001
|
+
source: qwikComponentProxy_default,
|
|
10002
|
+
hookName: ""
|
|
10003
|
+
}];
|
|
10004
|
+
function normalizeId(id) {
|
|
10005
|
+
return id.split("?")[0].split("#")[0];
|
|
10006
|
+
}
|
|
10007
|
+
function getIdVariations(key) {
|
|
10008
|
+
return [
|
|
10009
|
+
key,
|
|
10010
|
+
`/${key}`,
|
|
10011
|
+
`\u0000${key}`,
|
|
10012
|
+
`/@id/${key}`
|
|
10013
|
+
];
|
|
10014
|
+
}
|
|
10015
|
+
function isVirtualId(id, key) {
|
|
10016
|
+
return getIdVariations(key).includes(normalizeId(id));
|
|
10017
|
+
}
|
|
10018
|
+
function findVirtualModule(id) {
|
|
10019
|
+
return VIRTUAL_MODULES.find((module$1) => isVirtualId(id, module$1.key));
|
|
10020
|
+
}
|
|
10021
|
+
function injectImportIfMissing(code, key, hookName) {
|
|
10022
|
+
if (!code.includes(key)) return `import { ${hookName} } from '${key}';\n${code}`;
|
|
10023
|
+
log$2("importing virtual qwik devtools", key, code);
|
|
10024
|
+
return code;
|
|
10025
|
+
}
|
|
10026
|
+
function transformComponentFile(code, id) {
|
|
10027
|
+
code = injectImportIfMissing(code, VIRTUAL_QWIK_DEVTOOLS_KEY, INNER_USE_HOOK);
|
|
10028
|
+
return parseQwikCode(code, { path: id });
|
|
10029
|
+
}
|
|
10030
|
+
function transformRootFile(code) {
|
|
10031
|
+
const mode = process.env.MODE;
|
|
10032
|
+
const importPath = mode === "dev" ? "@devtools/ui" : "@qwik.dev/devtools/ui";
|
|
10033
|
+
if (!code.includes(importPath)) code = `import { QwikDevtools } from '${importPath}';\n${code}`;
|
|
10034
|
+
const bodyMatch = code.match(/<body[^>]*>([\s\S]*?)<\/body>/);
|
|
10035
|
+
if (bodyMatch) {
|
|
10036
|
+
const bodyContent = bodyMatch[1];
|
|
10037
|
+
const newBodyContent = `${bodyContent}\n <QwikDevtools />`;
|
|
10038
|
+
code = code.replace(bodyContent, newBodyContent);
|
|
10039
|
+
}
|
|
10040
|
+
return code;
|
|
10041
|
+
}
|
|
10042
|
+
|
|
10043
|
+
//#endregion
|
|
10044
|
+
//#region src/plugin/devtools.ts
|
|
10045
|
+
const log$1 = (0, import_src.debug)("qwik:devtools:plugin");
|
|
10046
|
+
/**
|
|
10047
|
+
* Core Qwik DevTools plugin
|
|
10048
|
+
*/
|
|
10049
|
+
function devtoolsPlugin() {
|
|
10050
|
+
let resolvedConfig;
|
|
8802
10051
|
const qwikData = new Map();
|
|
8803
10052
|
let preloadStarted = false;
|
|
8804
|
-
|
|
10053
|
+
return {
|
|
8805
10054
|
name: "vite-plugin-qwik-devtools",
|
|
8806
10055
|
apply: "serve",
|
|
8807
10056
|
resolveId(id) {
|
|
8808
|
-
const
|
|
8809
|
-
if (
|
|
10057
|
+
const virtualModule = findVirtualModule(id);
|
|
10058
|
+
if (virtualModule) return `/${virtualModule.key}`;
|
|
8810
10059
|
},
|
|
8811
10060
|
load(id) {
|
|
8812
|
-
|
|
8813
|
-
|
|
10061
|
+
const virtualModule = findVirtualModule(id);
|
|
10062
|
+
if (virtualModule) return {
|
|
10063
|
+
code: virtualModule.source,
|
|
8814
10064
|
map: { mappings: "" }
|
|
8815
10065
|
};
|
|
8816
10066
|
},
|
|
8817
10067
|
configResolved(viteConfig) {
|
|
8818
|
-
|
|
8819
|
-
updateConf_default(
|
|
10068
|
+
resolvedConfig = viteConfig;
|
|
10069
|
+
updateConf_default(resolvedConfig);
|
|
8820
10070
|
if (!preloadStarted) {
|
|
8821
10071
|
preloadStarted = true;
|
|
8822
|
-
startPreloading({ config:
|
|
8823
|
-
|
|
10072
|
+
startPreloading({ config: resolvedConfig }).catch((err) => {
|
|
10073
|
+
log$1("[Qwik DevTools] Failed to start preloading:", err);
|
|
8824
10074
|
});
|
|
8825
10075
|
}
|
|
8826
10076
|
},
|
|
8827
10077
|
transform: {
|
|
8828
10078
|
order: "pre",
|
|
8829
10079
|
handler(code, id) {
|
|
8830
|
-
|
|
8831
|
-
if (id.endsWith(".tsx")
|
|
8832
|
-
|
|
8833
|
-
|
|
8834
|
-
|
|
8835
|
-
} else console.log("importing virtual qwik devtools", VIRTUAL_QWIK_DEVTOOLS_KEY, code);
|
|
8836
|
-
code = parseQwikCode(code, { path: id });
|
|
8837
|
-
}
|
|
8838
|
-
if (id.endsWith("root.tsx")) {
|
|
8839
|
-
const importPath = mode === "dev" ? "@devtools/ui" : "@qwik.dev/devtools/ui";
|
|
8840
|
-
if (!code.includes(importPath)) code = `import { QwikDevtools } from '${importPath}';\n${code}`;
|
|
8841
|
-
const match$1 = code.match(/<body[^>]*>([\s\S]*?)<\/body>/);
|
|
8842
|
-
if (match$1) {
|
|
8843
|
-
const bodyContent = match$1[1];
|
|
8844
|
-
const newBodyContent = `${bodyContent}\n <QwikDevtools />`;
|
|
8845
|
-
code = code.replace(bodyContent, newBodyContent);
|
|
8846
|
-
}
|
|
8847
|
-
return {
|
|
8848
|
-
code,
|
|
8849
|
-
map: null
|
|
8850
|
-
};
|
|
8851
|
-
}
|
|
10080
|
+
if (id.endsWith(".tsx") && code.includes("component$")) code = transformComponentFile(code, id);
|
|
10081
|
+
if (id.endsWith("root.tsx")) return {
|
|
10082
|
+
code: transformRootFile(code),
|
|
10083
|
+
map: null
|
|
10084
|
+
};
|
|
8852
10085
|
return {
|
|
8853
10086
|
code,
|
|
8854
10087
|
map: { mappings: "" }
|
|
@@ -8859,13 +10092,263 @@ function qwikDevtools() {
|
|
|
8859
10092
|
setViteServerContext(server);
|
|
8860
10093
|
const rpcFunctions = getServerFunctions({
|
|
8861
10094
|
server,
|
|
8862
|
-
config:
|
|
10095
|
+
config: resolvedConfig,
|
|
8863
10096
|
qwikData
|
|
8864
10097
|
});
|
|
8865
10098
|
createServerRpc(rpcFunctions);
|
|
8866
10099
|
}
|
|
8867
10100
|
};
|
|
8868
|
-
|
|
10101
|
+
}
|
|
10102
|
+
|
|
10103
|
+
//#endregion
|
|
10104
|
+
//#region src/virtualmodules/perfLazyWrapperPreamble.ts
|
|
10105
|
+
/**
|
|
10106
|
+
* Preamble injected into Qwik-generated lazy render function modules (`_component_...`).
|
|
10107
|
+
*
|
|
10108
|
+
* It defines `__qwik_wrap__` that wraps each exported render function and records perf entries.
|
|
10109
|
+
*/
|
|
10110
|
+
const perfLazyWrapperPreamble = `${perfRuntime_default}
|
|
10111
|
+
|
|
10112
|
+
// [qwik-component-proxy] Render function wrapper
|
|
10113
|
+
const __qwik_wrap__ = (fn, name, viteId) => {
|
|
10114
|
+
if (typeof fn !== 'function') return fn;
|
|
10115
|
+
let renderCount = 0;
|
|
10116
|
+
|
|
10117
|
+
function wrapped(...args) {
|
|
10118
|
+
renderCount += 1;
|
|
10119
|
+
const phase = __qwik_perf_is_server__() ? 'ssr' : 'csr';
|
|
10120
|
+
const start = performance.now();
|
|
10121
|
+
|
|
10122
|
+
const result = fn.apply(this, args);
|
|
10123
|
+
const duration = performance.now() - start;
|
|
10124
|
+
__qwik_perf_commit__({
|
|
10125
|
+
component: name,
|
|
10126
|
+
phase,
|
|
10127
|
+
duration,
|
|
10128
|
+
start,
|
|
10129
|
+
end: start + duration,
|
|
10130
|
+
viteId,
|
|
10131
|
+
renderCount,
|
|
10132
|
+
});
|
|
10133
|
+
return result;
|
|
10134
|
+
}
|
|
10135
|
+
|
|
10136
|
+
// Preserve Qwik-compiler metadata attached to the original function.
|
|
10137
|
+
// (No try/catch per request; avoid touching special function props.)
|
|
10138
|
+
const skip = {
|
|
10139
|
+
length: true,
|
|
10140
|
+
name: true,
|
|
10141
|
+
arguments: true,
|
|
10142
|
+
caller: true,
|
|
10143
|
+
prototype: true,
|
|
10144
|
+
};
|
|
10145
|
+
|
|
10146
|
+
const descriptors = Object.getOwnPropertyDescriptors(fn);
|
|
10147
|
+
for (const key of Object.keys(descriptors)) {
|
|
10148
|
+
if (skip[key]) continue;
|
|
10149
|
+
Object.defineProperty(wrapped, key, descriptors[key]);
|
|
10150
|
+
}
|
|
10151
|
+
|
|
10152
|
+
for (const sym of Object.getOwnPropertySymbols(fn)) {
|
|
10153
|
+
const desc = Object.getOwnPropertyDescriptor(fn, sym);
|
|
10154
|
+
if (desc) Object.defineProperty(wrapped, sym, desc);
|
|
10155
|
+
}
|
|
10156
|
+
|
|
10157
|
+
return wrapped;
|
|
10158
|
+
};
|
|
10159
|
+
`;
|
|
10160
|
+
var perfLazyWrapperPreamble_default = perfLazyWrapperPreamble;
|
|
10161
|
+
|
|
10162
|
+
//#endregion
|
|
10163
|
+
//#region src/plugin/statistics.ts
|
|
10164
|
+
/**
|
|
10165
|
+
* Statistics plugin: collect Qwik render performance.
|
|
10166
|
+
*
|
|
10167
|
+
* Responsibilities (kept similar to `plugin/devtools.ts` structure):
|
|
10168
|
+
* - Transform: rewrite `componentQrl` imports to a virtual module
|
|
10169
|
+
* - Transform: wrap Qwik-generated lazy render modules (`_component_`) to record perf entries
|
|
10170
|
+
* - Dev SSR: inject SSR perf snapshot into final HTML
|
|
10171
|
+
*
|
|
10172
|
+
* The virtual module source for `componentQrl` is registered in:
|
|
10173
|
+
* - `packages/plugin/src/virtualmodules/qwikComponentProxy.ts`
|
|
10174
|
+
* and is served by the core devtools plugin (`plugin/devtools.ts`) via `virtualmodules/virtualModules.ts`.
|
|
10175
|
+
*
|
|
10176
|
+
* Data sinks:
|
|
10177
|
+
* - **CSR**: `window.__QWIK_PERF__ = { ssr: [], csr: [] }`
|
|
10178
|
+
* - **SSR**: stored on `process` (preferred) or `globalThis` as `__QWIK_SSR_PERF__`
|
|
10179
|
+
*/
|
|
10180
|
+
const PERF_VIRTUAL_ID = "virtual:qwik-component-proxy";
|
|
10181
|
+
const log = (0, import_src.debug)("qwik:devtools:perf");
|
|
10182
|
+
function getStoreForSSR() {
|
|
10183
|
+
return typeof process !== "undefined" && process ? process : globalThis;
|
|
10184
|
+
}
|
|
10185
|
+
function isFromNodeModules(cleanId) {
|
|
10186
|
+
return cleanId.includes("/node_modules/") || cleanId.includes("\\node_modules\\");
|
|
10187
|
+
}
|
|
10188
|
+
function isUiLibBuildOutput(cleanId) {
|
|
10189
|
+
return cleanId.includes("/packages/ui/lib/") || cleanId.includes("\\packages\\ui\\lib\\");
|
|
10190
|
+
}
|
|
10191
|
+
function shouldTransformSource(id) {
|
|
10192
|
+
const cleanId = normalizeId(id);
|
|
10193
|
+
return !isFromNodeModules(cleanId) && !isUiLibBuildOutput(cleanId);
|
|
10194
|
+
}
|
|
10195
|
+
function isPerfVirtualModuleId(id) {
|
|
10196
|
+
return isVirtualId(id, PERF_VIRTUAL_ID);
|
|
10197
|
+
}
|
|
10198
|
+
function rewriteComponentQrlImport(code, id) {
|
|
10199
|
+
if (!code.includes("@qwik.dev/core") || !code.includes("componentQrl")) return {
|
|
10200
|
+
code,
|
|
10201
|
+
changed: false
|
|
10202
|
+
};
|
|
10203
|
+
const importRe = /import\s*\{([^}]*)\}\s*from\s*['"]@qwik\.dev\/core['"]/g;
|
|
10204
|
+
let changed = false;
|
|
10205
|
+
const next = code.replace(importRe, (match$1, imports) => {
|
|
10206
|
+
const importList = String(imports).split(",").map((s$1) => s$1.trim()).filter(Boolean);
|
|
10207
|
+
const hasComponentQrl = importList.some((imp) => imp === "componentQrl" || imp.startsWith("componentQrl "));
|
|
10208
|
+
if (!hasComponentQrl) return match$1;
|
|
10209
|
+
changed = true;
|
|
10210
|
+
log("rewrite componentQrl import %O", {
|
|
10211
|
+
id,
|
|
10212
|
+
isVirtual: normalizeId(id).startsWith("\0")
|
|
10213
|
+
});
|
|
10214
|
+
const filteredImports = importList.filter((imp) => imp !== "componentQrl" && !imp.startsWith("componentQrl "));
|
|
10215
|
+
if (filteredImports.length === 0) return `import { componentQrl } from '${PERF_VIRTUAL_ID}'`;
|
|
10216
|
+
return `import { ${filteredImports.join(", ")} } from '@qwik.dev/core';\nimport { componentQrl } from '${PERF_VIRTUAL_ID}'`;
|
|
10217
|
+
});
|
|
10218
|
+
return {
|
|
10219
|
+
code: next,
|
|
10220
|
+
changed
|
|
10221
|
+
};
|
|
10222
|
+
}
|
|
10223
|
+
function findQwikLazyComponentExports(code) {
|
|
10224
|
+
const exportRe = /export\s+const\s+(\w+_component_\w+)\s*=/g;
|
|
10225
|
+
const exports$1 = [];
|
|
10226
|
+
let match$1;
|
|
10227
|
+
while ((match$1 = exportRe.exec(code)) !== null) exports$1.push(match$1[1]);
|
|
10228
|
+
return exports$1;
|
|
10229
|
+
}
|
|
10230
|
+
function replaceExportWithOriginal(code, exportName) {
|
|
10231
|
+
return code.replace(new RegExp(`export\\s+const\\s+${exportName}\\s*=`), `const __original_${exportName}__ =`);
|
|
10232
|
+
}
|
|
10233
|
+
function appendWrappedExport(code, exportName, id) {
|
|
10234
|
+
return code + `
|
|
10235
|
+
export const ${exportName} = __qwik_wrap__(__original_${exportName}__, '${exportName}', '${id}');
|
|
10236
|
+
`;
|
|
10237
|
+
}
|
|
10238
|
+
function wrapQwikLazyComponentExports(params) {
|
|
10239
|
+
const { exports: exports$1, id } = params;
|
|
10240
|
+
if (exports$1.length === 0) return {
|
|
10241
|
+
code: params.code,
|
|
10242
|
+
changed: false
|
|
10243
|
+
};
|
|
10244
|
+
log("wrap _component_ exports %O", {
|
|
10245
|
+
id,
|
|
10246
|
+
count: exports$1.length
|
|
10247
|
+
});
|
|
10248
|
+
let modifiedCode = perfLazyWrapperPreamble_default + params.code;
|
|
10249
|
+
for (const exportName of exports$1) {
|
|
10250
|
+
modifiedCode = replaceExportWithOriginal(modifiedCode, exportName);
|
|
10251
|
+
modifiedCode = appendWrappedExport(modifiedCode, exportName, id);
|
|
10252
|
+
}
|
|
10253
|
+
return {
|
|
10254
|
+
code: modifiedCode,
|
|
10255
|
+
changed: true
|
|
10256
|
+
};
|
|
10257
|
+
}
|
|
10258
|
+
function createSsrPerfInjectionScript(entries) {
|
|
10259
|
+
return `
|
|
10260
|
+
<script>
|
|
10261
|
+
window.__QWIK_PERF__ = window.__QWIK_PERF__ || { ssr: [], csr: [] };
|
|
10262
|
+
window.__QWIK_PERF__.ssr = ${JSON.stringify(entries)};
|
|
10263
|
+
window.dispatchEvent(new CustomEvent('qwik:ssr-perf', { detail: ${JSON.stringify(entries)} }));
|
|
10264
|
+
</script>`;
|
|
10265
|
+
}
|
|
10266
|
+
function attachSsrPerfInjectorMiddleware(server) {
|
|
10267
|
+
server.middlewares.use((req, res, next) => {
|
|
10268
|
+
const accept = req.headers.accept || "";
|
|
10269
|
+
if (!accept.includes("text/html")) return next();
|
|
10270
|
+
const store = getStoreForSSR();
|
|
10271
|
+
const originalWrite = res.write.bind(res);
|
|
10272
|
+
const originalEnd = res.end.bind(res);
|
|
10273
|
+
let body = "";
|
|
10274
|
+
res.write = function(chunk, encodingOrCallback, callback) {
|
|
10275
|
+
if (chunk) body += typeof chunk === "string" ? chunk : Buffer.from(chunk).toString();
|
|
10276
|
+
if (typeof encodingOrCallback === "function") encodingOrCallback();
|
|
10277
|
+
if (typeof callback === "function") callback();
|
|
10278
|
+
return true;
|
|
10279
|
+
};
|
|
10280
|
+
res.end = function(chunk, encodingOrCallback, callback) {
|
|
10281
|
+
if (chunk) body += typeof chunk === "string" ? chunk : Buffer.from(chunk).toString();
|
|
10282
|
+
if (body.includes("</head>")) {
|
|
10283
|
+
const rawArr = store.__QWIK_SSR_PERF__;
|
|
10284
|
+
const entries = Array.isArray(rawArr) ? rawArr : [];
|
|
10285
|
+
log("inject ssr perf %O", {
|
|
10286
|
+
url: req.url,
|
|
10287
|
+
total: entries.length
|
|
10288
|
+
});
|
|
10289
|
+
const script = createSsrPerfInjectionScript(entries);
|
|
10290
|
+
body = body.replace(/<head(\s[^>]*)?>/i, (m$1) => `${m$1}${script}`);
|
|
10291
|
+
}
|
|
10292
|
+
try {
|
|
10293
|
+
res.setHeader("Content-Length", Buffer.byteLength(body));
|
|
10294
|
+
} catch {}
|
|
10295
|
+
originalWrite(body);
|
|
10296
|
+
if (typeof encodingOrCallback === "function") encodingOrCallback();
|
|
10297
|
+
if (typeof callback === "function") callback();
|
|
10298
|
+
return originalEnd();
|
|
10299
|
+
};
|
|
10300
|
+
next();
|
|
10301
|
+
});
|
|
10302
|
+
}
|
|
10303
|
+
function statisticsPlugin() {
|
|
10304
|
+
return {
|
|
10305
|
+
name: "vite:qwik-component-proxy-transform",
|
|
10306
|
+
enforce: "post",
|
|
10307
|
+
transform(code, id) {
|
|
10308
|
+
if (isPerfVirtualModuleId(id)) return null;
|
|
10309
|
+
if (!shouldTransformSource(id)) return null;
|
|
10310
|
+
let modifiedCode = code;
|
|
10311
|
+
let hasChanges = false;
|
|
10312
|
+
const rewritten = rewriteComponentQrlImport(modifiedCode, id);
|
|
10313
|
+
modifiedCode = rewritten.code;
|
|
10314
|
+
hasChanges = hasChanges || rewritten.changed;
|
|
10315
|
+
const cleanId = normalizeId(id);
|
|
10316
|
+
if (cleanId.includes("_component_")) {
|
|
10317
|
+
const exports$1 = findQwikLazyComponentExports(code);
|
|
10318
|
+
const wrapped = wrapQwikLazyComponentExports({
|
|
10319
|
+
code: modifiedCode,
|
|
10320
|
+
id,
|
|
10321
|
+
exports: exports$1
|
|
10322
|
+
});
|
|
10323
|
+
modifiedCode = wrapped.code;
|
|
10324
|
+
hasChanges = hasChanges || wrapped.changed;
|
|
10325
|
+
}
|
|
10326
|
+
if (!hasChanges) return null;
|
|
10327
|
+
return {
|
|
10328
|
+
code: modifiedCode,
|
|
10329
|
+
map: null
|
|
10330
|
+
};
|
|
10331
|
+
},
|
|
10332
|
+
configureServer(server) {
|
|
10333
|
+
attachSsrPerfInjectorMiddleware(server);
|
|
10334
|
+
}
|
|
10335
|
+
};
|
|
10336
|
+
}
|
|
10337
|
+
function qwikComponentProxy() {
|
|
10338
|
+
return [statisticsPlugin()];
|
|
10339
|
+
}
|
|
10340
|
+
|
|
10341
|
+
//#endregion
|
|
10342
|
+
//#region src/plugin/index.ts
|
|
10343
|
+
/**
|
|
10344
|
+
* Main entry: combines all devtools plugins
|
|
10345
|
+
*/
|
|
10346
|
+
function qwikDevtools() {
|
|
10347
|
+
return [
|
|
10348
|
+
devtoolsPlugin(),
|
|
10349
|
+
VueInspector(),
|
|
10350
|
+
...qwikComponentProxy()
|
|
10351
|
+
];
|
|
8869
10352
|
}
|
|
8870
10353
|
|
|
8871
10354
|
//#endregion
|