wxt 0.18.15 → 0.19.0
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/bin/wxt.mjs +1 -1
- package/dist/browser/chrome.d.ts +17 -0
- package/dist/browser/chrome.mjs +7 -0
- package/dist/browser/index.d.ts +18 -0
- package/dist/browser/index.mjs +2 -0
- package/dist/builtin-modules/index.d.ts +2 -0
- package/dist/builtin-modules/index.mjs +2 -0
- package/dist/builtin-modules/unimport.d.ts +8 -0
- package/dist/builtin-modules/unimport.mjs +99 -0
- package/dist/cli/cli-utils.d.ts +25 -0
- package/dist/cli/cli-utils.mjs +58 -0
- package/dist/cli/commands.d.ts +2 -0
- package/dist/cli/commands.mjs +104 -0
- package/dist/cli/index.d.ts +1 -0
- package/dist/cli/index.mjs +11 -0
- package/dist/client/app-config.d.ts +2 -0
- package/dist/client/app-config.mjs +4 -0
- package/dist/client/content-scripts/content-script-context.d.ts +114 -0
- package/dist/client/content-scripts/content-script-context.mjs +169 -0
- package/dist/client/content-scripts/custom-events.d.ts +10 -0
- package/dist/client/content-scripts/custom-events.mjs +13 -0
- package/dist/client/content-scripts/index.d.ts +2 -0
- package/dist/client/content-scripts/index.mjs +2 -0
- package/dist/client/content-scripts/location-watcher.d.ts +12 -0
- package/dist/client/content-scripts/location-watcher.mjs +22 -0
- package/dist/client/content-scripts/ui/index.d.ts +23 -0
- package/dist/client/content-scripts/ui/index.mjs +188 -0
- package/dist/{client.d.ts → client/content-scripts/ui/types.d.ts} +17 -45
- package/dist/client/content-scripts/ui/types.mjs +0 -0
- package/dist/client/index.d.ts +7 -0
- package/dist/client/index.mjs +2 -0
- package/dist/core/build.d.ts +15 -0
- package/dist/core/build.mjs +6 -0
- package/dist/core/builders/vite/index.d.ts +3 -0
- package/dist/core/builders/vite/index.mjs +285 -0
- package/dist/core/builders/vite/plugins/bundleAnalysis.d.ts +7 -0
- package/dist/core/builders/vite/plugins/bundleAnalysis.mjs +15 -0
- package/dist/core/builders/vite/plugins/cssEntrypoints.d.ts +13 -0
- package/dist/core/builders/vite/plugins/cssEntrypoints.mjs +22 -0
- package/dist/core/builders/vite/plugins/defineImportMeta.d.ts +14 -0
- package/dist/core/builders/vite/plugins/defineImportMeta.mjs +13 -0
- package/dist/core/builders/vite/plugins/devHtmlPrerender.d.ts +7 -0
- package/dist/core/builders/vite/plugins/devHtmlPrerender.mjs +140 -0
- package/dist/core/builders/vite/plugins/devServerGlobals.d.ts +6 -0
- package/dist/core/builders/vite/plugins/devServerGlobals.mjs +15 -0
- package/dist/core/builders/vite/plugins/download.d.ts +10 -0
- package/dist/core/builders/vite/plugins/download.mjs +14 -0
- package/dist/core/builders/vite/plugins/entrypointGroupGlobals.d.ts +6 -0
- package/dist/core/builders/vite/plugins/entrypointGroupGlobals.mjs +16 -0
- package/dist/core/builders/vite/plugins/extensionApiMock.d.ts +11 -0
- package/dist/core/builders/vite/plugins/extensionApiMock.mjs +26 -0
- package/dist/core/builders/vite/plugins/globals.d.ts +3 -0
- package/dist/core/builders/vite/plugins/globals.mjs +15 -0
- package/dist/core/builders/vite/plugins/index.d.ts +17 -0
- package/dist/core/builders/vite/plugins/index.mjs +17 -0
- package/dist/core/builders/vite/plugins/multipageMove.d.ts +20 -0
- package/dist/core/builders/vite/plugins/multipageMove.mjs +59 -0
- package/dist/core/builders/vite/plugins/noopBackground.d.ts +6 -0
- package/dist/core/builders/vite/plugins/noopBackground.mjs +17 -0
- package/dist/core/builders/vite/plugins/removeEntrypointMainFunction.d.ts +6 -0
- package/dist/core/builders/vite/plugins/removeEntrypointMainFunction.mjs +12 -0
- package/dist/core/builders/vite/plugins/resolveAppConfig.d.ts +6 -0
- package/dist/core/builders/vite/plugins/resolveAppConfig.mjs +26 -0
- package/dist/core/builders/vite/plugins/resolveExtensionApi.d.ts +10 -0
- package/dist/core/builders/vite/plugins/resolveExtensionApi.mjs +15 -0
- package/dist/core/builders/vite/plugins/resolveVirtualModules.d.ts +6 -0
- package/dist/core/builders/vite/plugins/resolveVirtualModules.mjs +30 -0
- package/dist/core/builders/vite/plugins/tsconfigPaths.d.ts +3 -0
- package/dist/core/builders/vite/plugins/tsconfigPaths.mjs +12 -0
- package/dist/core/builders/vite/plugins/wxtPluginLoader.d.ts +6 -0
- package/dist/core/builders/vite/plugins/wxtPluginLoader.mjs +56 -0
- package/dist/core/clean.d.ts +21 -0
- package/dist/core/clean.mjs +38 -0
- package/dist/core/create-server.d.ts +11 -0
- package/dist/core/create-server.mjs +206 -0
- package/dist/core/define-config.d.ts +2 -0
- package/dist/core/define-config.mjs +3 -0
- package/dist/core/define-runner-config.d.ts +2 -0
- package/dist/core/define-runner-config.mjs +3 -0
- package/dist/core/index.d.ts +8 -0
- package/dist/core/index.mjs +8 -0
- package/dist/core/initialize.d.ts +5 -0
- package/dist/core/initialize.mjs +128 -0
- package/dist/core/package-managers/bun.d.ts +2 -0
- package/dist/core/package-managers/bun.mjs +19 -0
- package/dist/core/package-managers/index.d.ts +2 -0
- package/dist/core/package-managers/index.mjs +65 -0
- package/dist/core/package-managers/npm.d.ts +17 -0
- package/dist/core/package-managers/npm.mjs +58 -0
- package/dist/core/package-managers/pnpm.d.ts +2 -0
- package/dist/core/package-managers/pnpm.mjs +21 -0
- package/dist/core/package-managers/types.d.ts +2 -0
- package/dist/core/package-managers/types.mjs +0 -0
- package/dist/core/package-managers/yarn.d.ts +2 -0
- package/dist/core/package-managers/yarn.mjs +31 -0
- package/dist/core/prepare.d.ts +2 -0
- package/dist/core/prepare.mjs +8 -0
- package/dist/core/runners/index.d.ts +2 -0
- package/dist/core/runners/index.mjs +12 -0
- package/dist/core/runners/manual.d.ts +5 -0
- package/dist/core/runners/manual.mjs +16 -0
- package/dist/core/runners/safari.d.ts +5 -0
- package/dist/core/runners/safari.mjs +16 -0
- package/dist/core/runners/web-ext.d.ts +5 -0
- package/dist/core/runners/web-ext.mjs +78 -0
- package/dist/core/runners/wsl.d.ts +5 -0
- package/dist/core/runners/wsl.mjs +16 -0
- package/dist/core/utils/arrays.d.ts +13 -0
- package/dist/{chunk-BERPNPEZ.js → core/utils/arrays.mjs} +6 -10
- package/dist/core/utils/building/build-entrypoints.d.ts +3 -0
- package/dist/core/utils/building/build-entrypoints.mjs +47 -0
- package/dist/core/utils/building/detect-dev-changes.d.ts +57 -0
- package/dist/core/utils/building/detect-dev-changes.mjs +93 -0
- package/dist/core/utils/building/find-entrypoints.d.ts +5 -0
- package/dist/core/utils/building/find-entrypoints.mjs +385 -0
- package/dist/core/utils/building/generate-wxt-dir.d.ts +5 -0
- package/dist/core/utils/building/generate-wxt-dir.mjs +192 -0
- package/dist/core/utils/building/group-entrypoints.d.ts +8 -0
- package/dist/core/utils/building/group-entrypoints.mjs +37 -0
- package/dist/core/utils/building/import-entrypoint.d.ts +16 -0
- package/dist/core/utils/building/import-entrypoint.mjs +97 -0
- package/dist/core/utils/building/index.d.ts +9 -0
- package/dist/core/utils/building/index.mjs +9 -0
- package/dist/core/utils/building/internal-build.d.ts +12 -0
- package/dist/core/utils/building/internal-build.mjs +112 -0
- package/dist/core/utils/building/rebuild.d.ts +23 -0
- package/dist/core/utils/building/rebuild.mjs +39 -0
- package/dist/core/utils/building/resolve-config.d.ts +11 -0
- package/dist/core/utils/building/resolve-config.mjs +364 -0
- package/dist/core/utils/cache.d.ts +8 -0
- package/dist/core/utils/cache.mjs +21 -0
- package/dist/core/utils/cli.d.ts +3 -0
- package/dist/core/utils/cli.mjs +26 -0
- package/dist/core/utils/constants.d.ts +5 -0
- package/dist/core/utils/constants.mjs +1 -0
- package/dist/core/utils/content-scripts.d.ts +11 -0
- package/dist/core/utils/content-scripts.mjs +60 -0
- package/dist/core/utils/content-security-policy.d.ts +14 -0
- package/dist/core/utils/content-security-policy.mjs +39 -0
- package/dist/core/utils/entrypoints.d.ts +25 -0
- package/dist/core/utils/entrypoints.mjs +31 -0
- package/dist/core/utils/eslint.d.ts +1 -0
- package/dist/core/utils/eslint.mjs +11 -0
- package/dist/core/utils/fs.d.ts +13 -0
- package/dist/core/utils/fs.mjs +15 -0
- package/dist/core/utils/globals.d.ts +11 -0
- package/dist/core/utils/globals.mjs +53 -0
- package/dist/core/utils/i18n.d.ts +11 -0
- package/dist/core/utils/i18n.mjs +35 -0
- package/dist/core/utils/log/index.d.ts +4 -0
- package/dist/core/utils/log/index.mjs +4 -0
- package/dist/core/utils/log/printBuildSummary.d.ts +2 -0
- package/dist/core/utils/log/printBuildSummary.mjs +32 -0
- package/dist/core/utils/log/printFileList.d.ts +1 -0
- package/dist/core/utils/log/printFileList.mjs +42 -0
- package/dist/core/utils/log/printHeader.d.ts +1 -0
- package/dist/core/utils/log/printHeader.mjs +7 -0
- package/dist/core/utils/log/printTable.d.ts +1 -0
- package/dist/core/utils/log/printTable.mjs +22 -0
- package/dist/core/utils/manifest.d.ts +44 -0
- package/dist/core/utils/manifest.mjs +512 -0
- package/dist/core/utils/network.d.ts +7 -0
- package/dist/core/utils/network.mjs +38 -0
- package/dist/core/utils/package.d.ts +6 -0
- package/dist/core/utils/package.mjs +14 -0
- package/dist/core/utils/paths.d.ts +11 -0
- package/dist/core/utils/paths.mjs +10 -0
- package/dist/core/utils/strings.d.ts +14 -0
- package/dist/core/utils/strings.mjs +18 -0
- package/dist/core/utils/testing/fake-objects.d.ts +4556 -0
- package/dist/core/utils/testing/fake-objects.mjs +322 -0
- package/dist/core/utils/time.d.ts +9 -0
- package/dist/core/utils/time.mjs +17 -0
- package/dist/core/utils/transform.d.ts +9 -0
- package/dist/core/utils/transform.mjs +17 -0
- package/dist/core/utils/types.d.ts +10 -0
- package/dist/core/utils/types.mjs +0 -0
- package/dist/core/utils/validation.d.ts +15 -0
- package/dist/core/utils/validation.mjs +55 -0
- package/dist/core/utils/virtual-modules.d.ts +22 -0
- package/dist/core/utils/virtual-modules.mjs +14 -0
- package/dist/core/utils/wsl.d.ts +4 -0
- package/dist/core/utils/wsl.mjs +4 -0
- package/dist/core/wxt.d.ts +19 -0
- package/dist/core/wxt.mjs +41 -0
- package/dist/core/zip.d.ts +7 -0
- package/dist/core/zip.mjs +137 -0
- package/dist/index.d.ts +4 -79
- package/dist/index.mjs +3 -0
- package/dist/modules.d.ts +10 -20
- package/dist/{chunk-6XSIWUWF.js → modules.mjs} +7 -16
- package/dist/sandbox/define-app-config.d.ts +19 -0
- package/dist/sandbox/define-app-config.mjs +3 -0
- package/dist/sandbox/define-background.d.ts +3 -0
- package/dist/sandbox/define-background.mjs +4 -0
- package/dist/sandbox/define-content-script.d.ts +2 -0
- package/dist/sandbox/define-content-script.mjs +3 -0
- package/dist/sandbox/define-unlisted-script.d.ts +3 -0
- package/dist/sandbox/define-unlisted-script.mjs +4 -0
- package/dist/sandbox/define-wxt-plugin.d.ts +2 -0
- package/dist/sandbox/define-wxt-plugin.mjs +3 -0
- package/dist/sandbox/dev-server-websocket.d.ts +21 -0
- package/dist/sandbox/dev-server-websocket.mjs +37 -0
- package/dist/sandbox/index.d.ts +11 -0
- package/dist/sandbox/index.mjs +6 -0
- package/dist/sandbox/utils/logger.d.ts +9 -0
- package/dist/sandbox/utils/logger.mjs +15 -0
- package/dist/storage.d.ts +39 -16
- package/dist/{storage.js → storage.mjs} +30 -41
- package/dist/testing/fake-browser.d.ts +1 -0
- package/dist/testing/fake-browser.mjs +1 -0
- package/dist/testing/index.d.ts +5 -0
- package/dist/testing/index.mjs +2 -0
- package/dist/{testing.d.ts → testing/wxt-vitest-plugin.d.ts} +3 -15
- package/dist/testing/wxt-vitest-plugin.mjs +26 -0
- package/dist/{index-nWRfwAJi.d.cts → types.d.ts} +150 -264
- package/dist/types.mjs +0 -0
- package/dist/version.d.ts +1 -0
- package/dist/version.mjs +1 -0
- package/dist/virtual/{background-entrypoint.js → background-entrypoint.mjs} +31 -40
- package/dist/virtual/{content-script-isolated-world-entrypoint.js → content-script-isolated-world-entrypoint.mjs} +9 -13
- package/dist/virtual/{content-script-main-world-entrypoint.js → content-script-main-world-entrypoint.mjs} +9 -14
- package/dist/virtual/mock-browser.mjs +6 -0
- package/dist/virtual/{reload-html.js → reload-html.mjs} +8 -9
- package/dist/virtual/{unlisted-script-entrypoint.js → unlisted-script-entrypoint.mjs} +8 -12
- package/package.json +47 -57
- package/dist/browser.d.ts +0 -18
- package/dist/browser.js +0 -6
- package/dist/chunk-BM6QYGAW.js +0 -1063
- package/dist/chunk-FNTE2L27.js +0 -7
- package/dist/chunk-FP7RYLVL.js +0 -3617
- package/dist/chunk-KPD5J7PZ.js +0 -1065
- package/dist/chunk-QGM4M3NI.js +0 -37
- package/dist/chunk-SGKCDMVR.js +0 -38
- package/dist/cli.d.ts +0 -2
- package/dist/cli.js +0 -4438
- package/dist/client.js +0 -424
- package/dist/define-app-config-bg54F_lV.d.ts +0 -294
- package/dist/execa-4UBDUBJZ.js +0 -7244
- package/dist/execa-QLUM2B3W.js +0 -7245
- package/dist/index-nWRfwAJi.d.ts +0 -1401
- package/dist/index.cjs +0 -14473
- package/dist/index.d.cts +0 -81
- package/dist/index.js +0 -696
- package/dist/modules.cjs +0 -96
- package/dist/modules.d.cts +0 -119
- package/dist/modules.js +0 -17
- package/dist/prompt-25QIVJDC.js +0 -755
- package/dist/prompt-7BMKNSWS.js +0 -754
- package/dist/sandbox.d.ts +0 -16
- package/dist/sandbox.js +0 -36
- package/dist/storage.cjs +0 -439
- package/dist/storage.d.cts +0 -200
- package/dist/testing.cjs +0 -2815
- package/dist/testing.d.cts +0 -30
- package/dist/testing.js +0 -40
- package/dist/virtual/mock-browser.js +0 -6
package/dist/testing.cjs
DELETED
|
@@ -1,2815 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __esm = (fn, res) => function __init() {
|
|
9
|
-
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
10
|
-
};
|
|
11
|
-
var __export = (target, all) => {
|
|
12
|
-
for (var name in all)
|
|
13
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
14
|
-
};
|
|
15
|
-
var __copyProps = (to, from, except, desc) => {
|
|
16
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
17
|
-
for (let key of __getOwnPropNames(from))
|
|
18
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
19
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
20
|
-
}
|
|
21
|
-
return to;
|
|
22
|
-
};
|
|
23
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
24
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
25
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
26
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
27
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
28
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
29
|
-
mod
|
|
30
|
-
));
|
|
31
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
32
|
-
|
|
33
|
-
// ../../node_modules/.pnpm/consola@3.2.3/node_modules/consola/dist/core.mjs
|
|
34
|
-
function isObject(value) {
|
|
35
|
-
return value !== null && typeof value === "object";
|
|
36
|
-
}
|
|
37
|
-
function _defu(baseObject, defaults, namespace = ".", merger) {
|
|
38
|
-
if (!isObject(defaults)) {
|
|
39
|
-
return _defu(baseObject, {}, namespace, merger);
|
|
40
|
-
}
|
|
41
|
-
const object = Object.assign({}, defaults);
|
|
42
|
-
for (const key in baseObject) {
|
|
43
|
-
if (key === "__proto__" || key === "constructor") {
|
|
44
|
-
continue;
|
|
45
|
-
}
|
|
46
|
-
const value = baseObject[key];
|
|
47
|
-
if (value === null || value === void 0) {
|
|
48
|
-
continue;
|
|
49
|
-
}
|
|
50
|
-
if (merger && merger(object, key, value, namespace)) {
|
|
51
|
-
continue;
|
|
52
|
-
}
|
|
53
|
-
if (Array.isArray(value) && Array.isArray(object[key])) {
|
|
54
|
-
object[key] = [...value, ...object[key]];
|
|
55
|
-
} else if (isObject(value) && isObject(object[key])) {
|
|
56
|
-
object[key] = _defu(
|
|
57
|
-
value,
|
|
58
|
-
object[key],
|
|
59
|
-
(namespace ? `${namespace}.` : "") + key.toString(),
|
|
60
|
-
merger
|
|
61
|
-
);
|
|
62
|
-
} else {
|
|
63
|
-
object[key] = value;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
return object;
|
|
67
|
-
}
|
|
68
|
-
function createDefu(merger) {
|
|
69
|
-
return (...arguments_) => (
|
|
70
|
-
// eslint-disable-next-line unicorn/no-array-reduce
|
|
71
|
-
arguments_.reduce((p2, c2) => _defu(p2, c2, "", merger), {})
|
|
72
|
-
);
|
|
73
|
-
}
|
|
74
|
-
function isPlainObject(obj) {
|
|
75
|
-
return Object.prototype.toString.call(obj) === "[object Object]";
|
|
76
|
-
}
|
|
77
|
-
function isLogObj(arg) {
|
|
78
|
-
if (!isPlainObject(arg)) {
|
|
79
|
-
return false;
|
|
80
|
-
}
|
|
81
|
-
if (!arg.message && !arg.args) {
|
|
82
|
-
return false;
|
|
83
|
-
}
|
|
84
|
-
if (arg.stack) {
|
|
85
|
-
return false;
|
|
86
|
-
}
|
|
87
|
-
return true;
|
|
88
|
-
}
|
|
89
|
-
function _normalizeLogLevel(input, types = {}, defaultLevel = 3) {
|
|
90
|
-
if (input === void 0) {
|
|
91
|
-
return defaultLevel;
|
|
92
|
-
}
|
|
93
|
-
if (typeof input === "number") {
|
|
94
|
-
return input;
|
|
95
|
-
}
|
|
96
|
-
if (types[input] && types[input].level !== void 0) {
|
|
97
|
-
return types[input].level;
|
|
98
|
-
}
|
|
99
|
-
return defaultLevel;
|
|
100
|
-
}
|
|
101
|
-
function createConsola(options = {}) {
|
|
102
|
-
return new Consola(options);
|
|
103
|
-
}
|
|
104
|
-
var LogLevels, LogTypes, defu, paused, queue, Consola;
|
|
105
|
-
var init_core = __esm({
|
|
106
|
-
"../../node_modules/.pnpm/consola@3.2.3/node_modules/consola/dist/core.mjs"() {
|
|
107
|
-
"use strict";
|
|
108
|
-
LogLevels = {
|
|
109
|
-
silent: Number.NEGATIVE_INFINITY,
|
|
110
|
-
fatal: 0,
|
|
111
|
-
error: 0,
|
|
112
|
-
warn: 1,
|
|
113
|
-
log: 2,
|
|
114
|
-
info: 3,
|
|
115
|
-
success: 3,
|
|
116
|
-
fail: 3,
|
|
117
|
-
ready: 3,
|
|
118
|
-
start: 3,
|
|
119
|
-
box: 3,
|
|
120
|
-
debug: 4,
|
|
121
|
-
trace: 5,
|
|
122
|
-
verbose: Number.POSITIVE_INFINITY
|
|
123
|
-
};
|
|
124
|
-
LogTypes = {
|
|
125
|
-
// Silent
|
|
126
|
-
silent: {
|
|
127
|
-
level: -1
|
|
128
|
-
},
|
|
129
|
-
// Level 0
|
|
130
|
-
fatal: {
|
|
131
|
-
level: LogLevels.fatal
|
|
132
|
-
},
|
|
133
|
-
error: {
|
|
134
|
-
level: LogLevels.error
|
|
135
|
-
},
|
|
136
|
-
// Level 1
|
|
137
|
-
warn: {
|
|
138
|
-
level: LogLevels.warn
|
|
139
|
-
},
|
|
140
|
-
// Level 2
|
|
141
|
-
log: {
|
|
142
|
-
level: LogLevels.log
|
|
143
|
-
},
|
|
144
|
-
// Level 3
|
|
145
|
-
info: {
|
|
146
|
-
level: LogLevels.info
|
|
147
|
-
},
|
|
148
|
-
success: {
|
|
149
|
-
level: LogLevels.success
|
|
150
|
-
},
|
|
151
|
-
fail: {
|
|
152
|
-
level: LogLevels.fail
|
|
153
|
-
},
|
|
154
|
-
ready: {
|
|
155
|
-
level: LogLevels.info
|
|
156
|
-
},
|
|
157
|
-
start: {
|
|
158
|
-
level: LogLevels.info
|
|
159
|
-
},
|
|
160
|
-
box: {
|
|
161
|
-
level: LogLevels.info
|
|
162
|
-
},
|
|
163
|
-
// Level 4
|
|
164
|
-
debug: {
|
|
165
|
-
level: LogLevels.debug
|
|
166
|
-
},
|
|
167
|
-
// Level 5
|
|
168
|
-
trace: {
|
|
169
|
-
level: LogLevels.trace
|
|
170
|
-
},
|
|
171
|
-
// Verbose
|
|
172
|
-
verbose: {
|
|
173
|
-
level: LogLevels.verbose
|
|
174
|
-
}
|
|
175
|
-
};
|
|
176
|
-
defu = createDefu();
|
|
177
|
-
paused = false;
|
|
178
|
-
queue = [];
|
|
179
|
-
Consola = class _Consola {
|
|
180
|
-
constructor(options = {}) {
|
|
181
|
-
const types = options.types || LogTypes;
|
|
182
|
-
this.options = defu(
|
|
183
|
-
{
|
|
184
|
-
...options,
|
|
185
|
-
defaults: { ...options.defaults },
|
|
186
|
-
level: _normalizeLogLevel(options.level, types),
|
|
187
|
-
reporters: [...options.reporters || []]
|
|
188
|
-
},
|
|
189
|
-
{
|
|
190
|
-
types: LogTypes,
|
|
191
|
-
throttle: 1e3,
|
|
192
|
-
throttleMin: 5,
|
|
193
|
-
formatOptions: {
|
|
194
|
-
date: true,
|
|
195
|
-
colors: false,
|
|
196
|
-
compact: true
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
);
|
|
200
|
-
for (const type in types) {
|
|
201
|
-
const defaults = {
|
|
202
|
-
type,
|
|
203
|
-
...this.options.defaults,
|
|
204
|
-
...types[type]
|
|
205
|
-
};
|
|
206
|
-
this[type] = this._wrapLogFn(defaults);
|
|
207
|
-
this[type].raw = this._wrapLogFn(
|
|
208
|
-
defaults,
|
|
209
|
-
true
|
|
210
|
-
);
|
|
211
|
-
}
|
|
212
|
-
if (this.options.mockFn) {
|
|
213
|
-
this.mockTypes();
|
|
214
|
-
}
|
|
215
|
-
this._lastLog = {};
|
|
216
|
-
}
|
|
217
|
-
get level() {
|
|
218
|
-
return this.options.level;
|
|
219
|
-
}
|
|
220
|
-
set level(level) {
|
|
221
|
-
this.options.level = _normalizeLogLevel(
|
|
222
|
-
level,
|
|
223
|
-
this.options.types,
|
|
224
|
-
this.options.level
|
|
225
|
-
);
|
|
226
|
-
}
|
|
227
|
-
prompt(message, opts) {
|
|
228
|
-
if (!this.options.prompt) {
|
|
229
|
-
throw new Error("prompt is not supported!");
|
|
230
|
-
}
|
|
231
|
-
return this.options.prompt(message, opts);
|
|
232
|
-
}
|
|
233
|
-
create(options) {
|
|
234
|
-
const instance = new _Consola({
|
|
235
|
-
...this.options,
|
|
236
|
-
...options
|
|
237
|
-
});
|
|
238
|
-
if (this._mockFn) {
|
|
239
|
-
instance.mockTypes(this._mockFn);
|
|
240
|
-
}
|
|
241
|
-
return instance;
|
|
242
|
-
}
|
|
243
|
-
withDefaults(defaults) {
|
|
244
|
-
return this.create({
|
|
245
|
-
...this.options,
|
|
246
|
-
defaults: {
|
|
247
|
-
...this.options.defaults,
|
|
248
|
-
...defaults
|
|
249
|
-
}
|
|
250
|
-
});
|
|
251
|
-
}
|
|
252
|
-
withTag(tag) {
|
|
253
|
-
return this.withDefaults({
|
|
254
|
-
tag: this.options.defaults.tag ? this.options.defaults.tag + ":" + tag : tag
|
|
255
|
-
});
|
|
256
|
-
}
|
|
257
|
-
addReporter(reporter) {
|
|
258
|
-
this.options.reporters.push(reporter);
|
|
259
|
-
return this;
|
|
260
|
-
}
|
|
261
|
-
removeReporter(reporter) {
|
|
262
|
-
if (reporter) {
|
|
263
|
-
const i = this.options.reporters.indexOf(reporter);
|
|
264
|
-
if (i >= 0) {
|
|
265
|
-
return this.options.reporters.splice(i, 1);
|
|
266
|
-
}
|
|
267
|
-
} else {
|
|
268
|
-
this.options.reporters.splice(0);
|
|
269
|
-
}
|
|
270
|
-
return this;
|
|
271
|
-
}
|
|
272
|
-
setReporters(reporters) {
|
|
273
|
-
this.options.reporters = Array.isArray(reporters) ? reporters : [reporters];
|
|
274
|
-
return this;
|
|
275
|
-
}
|
|
276
|
-
wrapAll() {
|
|
277
|
-
this.wrapConsole();
|
|
278
|
-
this.wrapStd();
|
|
279
|
-
}
|
|
280
|
-
restoreAll() {
|
|
281
|
-
this.restoreConsole();
|
|
282
|
-
this.restoreStd();
|
|
283
|
-
}
|
|
284
|
-
wrapConsole() {
|
|
285
|
-
for (const type in this.options.types) {
|
|
286
|
-
if (!console["__" + type]) {
|
|
287
|
-
console["__" + type] = console[type];
|
|
288
|
-
}
|
|
289
|
-
console[type] = this[type].raw;
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
restoreConsole() {
|
|
293
|
-
for (const type in this.options.types) {
|
|
294
|
-
if (console["__" + type]) {
|
|
295
|
-
console[type] = console["__" + type];
|
|
296
|
-
delete console["__" + type];
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
wrapStd() {
|
|
301
|
-
this._wrapStream(this.options.stdout, "log");
|
|
302
|
-
this._wrapStream(this.options.stderr, "log");
|
|
303
|
-
}
|
|
304
|
-
_wrapStream(stream, type) {
|
|
305
|
-
if (!stream) {
|
|
306
|
-
return;
|
|
307
|
-
}
|
|
308
|
-
if (!stream.__write) {
|
|
309
|
-
stream.__write = stream.write;
|
|
310
|
-
}
|
|
311
|
-
stream.write = (data) => {
|
|
312
|
-
this[type].raw(String(data).trim());
|
|
313
|
-
};
|
|
314
|
-
}
|
|
315
|
-
restoreStd() {
|
|
316
|
-
this._restoreStream(this.options.stdout);
|
|
317
|
-
this._restoreStream(this.options.stderr);
|
|
318
|
-
}
|
|
319
|
-
_restoreStream(stream) {
|
|
320
|
-
if (!stream) {
|
|
321
|
-
return;
|
|
322
|
-
}
|
|
323
|
-
if (stream.__write) {
|
|
324
|
-
stream.write = stream.__write;
|
|
325
|
-
delete stream.__write;
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
|
-
pauseLogs() {
|
|
329
|
-
paused = true;
|
|
330
|
-
}
|
|
331
|
-
resumeLogs() {
|
|
332
|
-
paused = false;
|
|
333
|
-
const _queue = queue.splice(0);
|
|
334
|
-
for (const item of _queue) {
|
|
335
|
-
item[0]._logFn(item[1], item[2]);
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
mockTypes(mockFn) {
|
|
339
|
-
const _mockFn = mockFn || this.options.mockFn;
|
|
340
|
-
this._mockFn = _mockFn;
|
|
341
|
-
if (typeof _mockFn !== "function") {
|
|
342
|
-
return;
|
|
343
|
-
}
|
|
344
|
-
for (const type in this.options.types) {
|
|
345
|
-
this[type] = _mockFn(type, this.options.types[type]) || this[type];
|
|
346
|
-
this[type].raw = this[type];
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
_wrapLogFn(defaults, isRaw) {
|
|
350
|
-
return (...args) => {
|
|
351
|
-
if (paused) {
|
|
352
|
-
queue.push([this, defaults, args, isRaw]);
|
|
353
|
-
return;
|
|
354
|
-
}
|
|
355
|
-
return this._logFn(defaults, args, isRaw);
|
|
356
|
-
};
|
|
357
|
-
}
|
|
358
|
-
_logFn(defaults, args, isRaw) {
|
|
359
|
-
if ((defaults.level || 0) > this.level) {
|
|
360
|
-
return false;
|
|
361
|
-
}
|
|
362
|
-
const logObj = {
|
|
363
|
-
date: /* @__PURE__ */ new Date(),
|
|
364
|
-
args: [],
|
|
365
|
-
...defaults,
|
|
366
|
-
level: _normalizeLogLevel(defaults.level, this.options.types)
|
|
367
|
-
};
|
|
368
|
-
if (!isRaw && args.length === 1 && isLogObj(args[0])) {
|
|
369
|
-
Object.assign(logObj, args[0]);
|
|
370
|
-
} else {
|
|
371
|
-
logObj.args = [...args];
|
|
372
|
-
}
|
|
373
|
-
if (logObj.message) {
|
|
374
|
-
logObj.args.unshift(logObj.message);
|
|
375
|
-
delete logObj.message;
|
|
376
|
-
}
|
|
377
|
-
if (logObj.additional) {
|
|
378
|
-
if (!Array.isArray(logObj.additional)) {
|
|
379
|
-
logObj.additional = logObj.additional.split("\n");
|
|
380
|
-
}
|
|
381
|
-
logObj.args.push("\n" + logObj.additional.join("\n"));
|
|
382
|
-
delete logObj.additional;
|
|
383
|
-
}
|
|
384
|
-
logObj.type = typeof logObj.type === "string" ? logObj.type.toLowerCase() : "log";
|
|
385
|
-
logObj.tag = typeof logObj.tag === "string" ? logObj.tag : "";
|
|
386
|
-
const resolveLog = (newLog = false) => {
|
|
387
|
-
const repeated = (this._lastLog.count || 0) - this.options.throttleMin;
|
|
388
|
-
if (this._lastLog.object && repeated > 0) {
|
|
389
|
-
const args2 = [...this._lastLog.object.args];
|
|
390
|
-
if (repeated > 1) {
|
|
391
|
-
args2.push(`(repeated ${repeated} times)`);
|
|
392
|
-
}
|
|
393
|
-
this._log({ ...this._lastLog.object, args: args2 });
|
|
394
|
-
this._lastLog.count = 1;
|
|
395
|
-
}
|
|
396
|
-
if (newLog) {
|
|
397
|
-
this._lastLog.object = logObj;
|
|
398
|
-
this._log(logObj);
|
|
399
|
-
}
|
|
400
|
-
};
|
|
401
|
-
clearTimeout(this._lastLog.timeout);
|
|
402
|
-
const diffTime = this._lastLog.time && logObj.date ? logObj.date.getTime() - this._lastLog.time.getTime() : 0;
|
|
403
|
-
this._lastLog.time = logObj.date;
|
|
404
|
-
if (diffTime < this.options.throttle) {
|
|
405
|
-
try {
|
|
406
|
-
const serializedLog = JSON.stringify([
|
|
407
|
-
logObj.type,
|
|
408
|
-
logObj.tag,
|
|
409
|
-
logObj.args
|
|
410
|
-
]);
|
|
411
|
-
const isSameLog = this._lastLog.serialized === serializedLog;
|
|
412
|
-
this._lastLog.serialized = serializedLog;
|
|
413
|
-
if (isSameLog) {
|
|
414
|
-
this._lastLog.count = (this._lastLog.count || 0) + 1;
|
|
415
|
-
if (this._lastLog.count > this.options.throttleMin) {
|
|
416
|
-
this._lastLog.timeout = setTimeout(
|
|
417
|
-
resolveLog,
|
|
418
|
-
this.options.throttle
|
|
419
|
-
);
|
|
420
|
-
return;
|
|
421
|
-
}
|
|
422
|
-
}
|
|
423
|
-
} catch {
|
|
424
|
-
}
|
|
425
|
-
}
|
|
426
|
-
resolveLog(true);
|
|
427
|
-
}
|
|
428
|
-
_log(logObj) {
|
|
429
|
-
for (const reporter of this.options.reporters) {
|
|
430
|
-
reporter.log(logObj, {
|
|
431
|
-
options: this.options
|
|
432
|
-
});
|
|
433
|
-
}
|
|
434
|
-
}
|
|
435
|
-
};
|
|
436
|
-
Consola.prototype.add = Consola.prototype.addReporter;
|
|
437
|
-
Consola.prototype.remove = Consola.prototype.removeReporter;
|
|
438
|
-
Consola.prototype.clear = Consola.prototype.removeReporter;
|
|
439
|
-
Consola.prototype.withScope = Consola.prototype.withTag;
|
|
440
|
-
Consola.prototype.mock = Consola.prototype.mockTypes;
|
|
441
|
-
Consola.prototype.pause = Consola.prototype.pauseLogs;
|
|
442
|
-
Consola.prototype.resume = Consola.prototype.resumeLogs;
|
|
443
|
-
}
|
|
444
|
-
});
|
|
445
|
-
|
|
446
|
-
// ../../node_modules/.pnpm/consola@3.2.3/node_modules/consola/dist/shared/consola.06ad8a64.mjs
|
|
447
|
-
function parseStack(stack) {
|
|
448
|
-
const cwd = process.cwd() + import_node_path14.sep;
|
|
449
|
-
const lines = stack.split("\n").splice(1).map((l2) => l2.trim().replace("file://", "").replace(cwd, ""));
|
|
450
|
-
return lines;
|
|
451
|
-
}
|
|
452
|
-
function writeStream(data, stream) {
|
|
453
|
-
const write = stream.__write || stream.write;
|
|
454
|
-
return write.call(stream, data);
|
|
455
|
-
}
|
|
456
|
-
var import_node_util, import_node_path14, bracket, BasicReporter;
|
|
457
|
-
var init_consola_06ad8a64 = __esm({
|
|
458
|
-
"../../node_modules/.pnpm/consola@3.2.3/node_modules/consola/dist/shared/consola.06ad8a64.mjs"() {
|
|
459
|
-
"use strict";
|
|
460
|
-
import_node_util = require("util");
|
|
461
|
-
import_node_path14 = require("path");
|
|
462
|
-
bracket = (x) => x ? `[${x}]` : "";
|
|
463
|
-
BasicReporter = class {
|
|
464
|
-
formatStack(stack, opts) {
|
|
465
|
-
return " " + parseStack(stack).join("\n ");
|
|
466
|
-
}
|
|
467
|
-
formatArgs(args, opts) {
|
|
468
|
-
const _args = args.map((arg) => {
|
|
469
|
-
if (arg && typeof arg.stack === "string") {
|
|
470
|
-
return arg.message + "\n" + this.formatStack(arg.stack, opts);
|
|
471
|
-
}
|
|
472
|
-
return arg;
|
|
473
|
-
});
|
|
474
|
-
return (0, import_node_util.formatWithOptions)(opts, ..._args);
|
|
475
|
-
}
|
|
476
|
-
formatDate(date, opts) {
|
|
477
|
-
return opts.date ? date.toLocaleTimeString() : "";
|
|
478
|
-
}
|
|
479
|
-
filterAndJoin(arr) {
|
|
480
|
-
return arr.filter(Boolean).join(" ");
|
|
481
|
-
}
|
|
482
|
-
formatLogObj(logObj, opts) {
|
|
483
|
-
const message = this.formatArgs(logObj.args, opts);
|
|
484
|
-
if (logObj.type === "box") {
|
|
485
|
-
return "\n" + [
|
|
486
|
-
bracket(logObj.tag),
|
|
487
|
-
logObj.title && logObj.title,
|
|
488
|
-
...message.split("\n")
|
|
489
|
-
].filter(Boolean).map((l2) => " > " + l2).join("\n") + "\n";
|
|
490
|
-
}
|
|
491
|
-
return this.filterAndJoin([
|
|
492
|
-
bracket(logObj.type),
|
|
493
|
-
bracket(logObj.tag),
|
|
494
|
-
message
|
|
495
|
-
]);
|
|
496
|
-
}
|
|
497
|
-
log(logObj, ctx) {
|
|
498
|
-
const line = this.formatLogObj(logObj, {
|
|
499
|
-
columns: ctx.options.stdout.columns || 0,
|
|
500
|
-
...ctx.options.formatOptions
|
|
501
|
-
});
|
|
502
|
-
return writeStream(
|
|
503
|
-
line + "\n",
|
|
504
|
-
logObj.level < 2 ? ctx.options.stderr || process.stderr : ctx.options.stdout || process.stdout
|
|
505
|
-
);
|
|
506
|
-
}
|
|
507
|
-
};
|
|
508
|
-
}
|
|
509
|
-
});
|
|
510
|
-
|
|
511
|
-
// ../../node_modules/.pnpm/consola@3.2.3/node_modules/consola/dist/utils.mjs
|
|
512
|
-
function replaceClose(index, string, close, replace, head = string.slice(0, Math.max(0, index)) + replace, tail = string.slice(Math.max(0, index + close.length)), next = tail.indexOf(close)) {
|
|
513
|
-
return head + (next < 0 ? tail : replaceClose(next, tail, close, replace));
|
|
514
|
-
}
|
|
515
|
-
function clearBleed(index, string, open, close, replace) {
|
|
516
|
-
return index < 0 ? open + string + close : open + replaceClose(index, string, close, replace) + close;
|
|
517
|
-
}
|
|
518
|
-
function filterEmpty(open, close, replace = open, at = open.length + 1) {
|
|
519
|
-
return (string) => string || !(string === "" || string === void 0) ? clearBleed(
|
|
520
|
-
("" + string).indexOf(close, at),
|
|
521
|
-
string,
|
|
522
|
-
open,
|
|
523
|
-
close,
|
|
524
|
-
replace
|
|
525
|
-
) : "";
|
|
526
|
-
}
|
|
527
|
-
function init(open, close, replace) {
|
|
528
|
-
return filterEmpty(`\x1B[${open}m`, `\x1B[${close}m`, replace);
|
|
529
|
-
}
|
|
530
|
-
function createColors(useColor = isColorSupported) {
|
|
531
|
-
return useColor ? colorDefs : Object.fromEntries(Object.keys(colorDefs).map((key) => [key, String]));
|
|
532
|
-
}
|
|
533
|
-
function getColor(color, fallback = "reset") {
|
|
534
|
-
return colors[color] || colors[fallback];
|
|
535
|
-
}
|
|
536
|
-
function stripAnsi(text2) {
|
|
537
|
-
return text2.replace(new RegExp(ansiRegex, "g"), "");
|
|
538
|
-
}
|
|
539
|
-
function box(text2, _opts = {}) {
|
|
540
|
-
const opts = {
|
|
541
|
-
..._opts,
|
|
542
|
-
style: {
|
|
543
|
-
...defaultStyle,
|
|
544
|
-
..._opts.style
|
|
545
|
-
}
|
|
546
|
-
};
|
|
547
|
-
const textLines = text2.split("\n");
|
|
548
|
-
const boxLines = [];
|
|
549
|
-
const _color = getColor(opts.style.borderColor);
|
|
550
|
-
const borderStyle = {
|
|
551
|
-
...typeof opts.style.borderStyle === "string" ? boxStylePresets[opts.style.borderStyle] || boxStylePresets.solid : opts.style.borderStyle
|
|
552
|
-
};
|
|
553
|
-
if (_color) {
|
|
554
|
-
for (const key in borderStyle) {
|
|
555
|
-
borderStyle[key] = _color(
|
|
556
|
-
borderStyle[key]
|
|
557
|
-
);
|
|
558
|
-
}
|
|
559
|
-
}
|
|
560
|
-
const paddingOffset = opts.style.padding % 2 === 0 ? opts.style.padding : opts.style.padding + 1;
|
|
561
|
-
const height = textLines.length + paddingOffset;
|
|
562
|
-
const width = Math.max(...textLines.map((line) => line.length)) + paddingOffset;
|
|
563
|
-
const widthOffset = width + paddingOffset;
|
|
564
|
-
const leftSpace = opts.style.marginLeft > 0 ? " ".repeat(opts.style.marginLeft) : "";
|
|
565
|
-
if (opts.style.marginTop > 0) {
|
|
566
|
-
boxLines.push("".repeat(opts.style.marginTop));
|
|
567
|
-
}
|
|
568
|
-
if (opts.title) {
|
|
569
|
-
const left = borderStyle.h.repeat(
|
|
570
|
-
Math.floor((width - stripAnsi(opts.title).length) / 2)
|
|
571
|
-
);
|
|
572
|
-
const right = borderStyle.h.repeat(
|
|
573
|
-
width - stripAnsi(opts.title).length - stripAnsi(left).length + paddingOffset
|
|
574
|
-
);
|
|
575
|
-
boxLines.push(
|
|
576
|
-
`${leftSpace}${borderStyle.tl}${left}${opts.title}${right}${borderStyle.tr}`
|
|
577
|
-
);
|
|
578
|
-
} else {
|
|
579
|
-
boxLines.push(
|
|
580
|
-
`${leftSpace}${borderStyle.tl}${borderStyle.h.repeat(widthOffset)}${borderStyle.tr}`
|
|
581
|
-
);
|
|
582
|
-
}
|
|
583
|
-
const valignOffset = opts.style.valign === "center" ? Math.floor((height - textLines.length) / 2) : opts.style.valign === "top" ? height - textLines.length - paddingOffset : height - textLines.length;
|
|
584
|
-
for (let i = 0; i < height; i++) {
|
|
585
|
-
if (i < valignOffset || i >= valignOffset + textLines.length) {
|
|
586
|
-
boxLines.push(
|
|
587
|
-
`${leftSpace}${borderStyle.v}${" ".repeat(widthOffset)}${borderStyle.v}`
|
|
588
|
-
);
|
|
589
|
-
} else {
|
|
590
|
-
const line = textLines[i - valignOffset];
|
|
591
|
-
const left = " ".repeat(paddingOffset);
|
|
592
|
-
const right = " ".repeat(width - stripAnsi(line).length);
|
|
593
|
-
boxLines.push(
|
|
594
|
-
`${leftSpace}${borderStyle.v}${left}${line}${right}${borderStyle.v}`
|
|
595
|
-
);
|
|
596
|
-
}
|
|
597
|
-
}
|
|
598
|
-
boxLines.push(
|
|
599
|
-
`${leftSpace}${borderStyle.bl}${borderStyle.h.repeat(widthOffset)}${borderStyle.br}`
|
|
600
|
-
);
|
|
601
|
-
if (opts.style.marginBottom > 0) {
|
|
602
|
-
boxLines.push("".repeat(opts.style.marginBottom));
|
|
603
|
-
}
|
|
604
|
-
return boxLines.join("\n");
|
|
605
|
-
}
|
|
606
|
-
var tty, env, argv, platform, isDisabled, isForced, isWindows, isDumbTerminal, isCompatibleTerminal, isCI, isColorSupported, colorDefs, colors, ansiRegex, boxStylePresets, defaultStyle;
|
|
607
|
-
var init_utils = __esm({
|
|
608
|
-
"../../node_modules/.pnpm/consola@3.2.3/node_modules/consola/dist/utils.mjs"() {
|
|
609
|
-
"use strict";
|
|
610
|
-
tty = __toESM(require("tty"), 1);
|
|
611
|
-
({
|
|
612
|
-
env = {},
|
|
613
|
-
argv = [],
|
|
614
|
-
platform = ""
|
|
615
|
-
} = typeof process === "undefined" ? {} : process);
|
|
616
|
-
isDisabled = "NO_COLOR" in env || argv.includes("--no-color");
|
|
617
|
-
isForced = "FORCE_COLOR" in env || argv.includes("--color");
|
|
618
|
-
isWindows = platform === "win32";
|
|
619
|
-
isDumbTerminal = env.TERM === "dumb";
|
|
620
|
-
isCompatibleTerminal = tty && tty.isatty && tty.isatty(1) && env.TERM && !isDumbTerminal;
|
|
621
|
-
isCI = "CI" in env && ("GITHUB_ACTIONS" in env || "GITLAB_CI" in env || "CIRCLECI" in env);
|
|
622
|
-
isColorSupported = !isDisabled && (isForced || isWindows && !isDumbTerminal || isCompatibleTerminal || isCI);
|
|
623
|
-
colorDefs = {
|
|
624
|
-
reset: init(0, 0),
|
|
625
|
-
bold: init(1, 22, "\x1B[22m\x1B[1m"),
|
|
626
|
-
dim: init(2, 22, "\x1B[22m\x1B[2m"),
|
|
627
|
-
italic: init(3, 23),
|
|
628
|
-
underline: init(4, 24),
|
|
629
|
-
inverse: init(7, 27),
|
|
630
|
-
hidden: init(8, 28),
|
|
631
|
-
strikethrough: init(9, 29),
|
|
632
|
-
black: init(30, 39),
|
|
633
|
-
red: init(31, 39),
|
|
634
|
-
green: init(32, 39),
|
|
635
|
-
yellow: init(33, 39),
|
|
636
|
-
blue: init(34, 39),
|
|
637
|
-
magenta: init(35, 39),
|
|
638
|
-
cyan: init(36, 39),
|
|
639
|
-
white: init(37, 39),
|
|
640
|
-
gray: init(90, 39),
|
|
641
|
-
bgBlack: init(40, 49),
|
|
642
|
-
bgRed: init(41, 49),
|
|
643
|
-
bgGreen: init(42, 49),
|
|
644
|
-
bgYellow: init(43, 49),
|
|
645
|
-
bgBlue: init(44, 49),
|
|
646
|
-
bgMagenta: init(45, 49),
|
|
647
|
-
bgCyan: init(46, 49),
|
|
648
|
-
bgWhite: init(47, 49),
|
|
649
|
-
blackBright: init(90, 39),
|
|
650
|
-
redBright: init(91, 39),
|
|
651
|
-
greenBright: init(92, 39),
|
|
652
|
-
yellowBright: init(93, 39),
|
|
653
|
-
blueBright: init(94, 39),
|
|
654
|
-
magentaBright: init(95, 39),
|
|
655
|
-
cyanBright: init(96, 39),
|
|
656
|
-
whiteBright: init(97, 39),
|
|
657
|
-
bgBlackBright: init(100, 49),
|
|
658
|
-
bgRedBright: init(101, 49),
|
|
659
|
-
bgGreenBright: init(102, 49),
|
|
660
|
-
bgYellowBright: init(103, 49),
|
|
661
|
-
bgBlueBright: init(104, 49),
|
|
662
|
-
bgMagentaBright: init(105, 49),
|
|
663
|
-
bgCyanBright: init(106, 49),
|
|
664
|
-
bgWhiteBright: init(107, 49)
|
|
665
|
-
};
|
|
666
|
-
colors = createColors();
|
|
667
|
-
ansiRegex = [
|
|
668
|
-
"[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)",
|
|
669
|
-
"(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"
|
|
670
|
-
].join("|");
|
|
671
|
-
boxStylePresets = {
|
|
672
|
-
solid: {
|
|
673
|
-
tl: "\u250C",
|
|
674
|
-
tr: "\u2510",
|
|
675
|
-
bl: "\u2514",
|
|
676
|
-
br: "\u2518",
|
|
677
|
-
h: "\u2500",
|
|
678
|
-
v: "\u2502"
|
|
679
|
-
},
|
|
680
|
-
double: {
|
|
681
|
-
tl: "\u2554",
|
|
682
|
-
tr: "\u2557",
|
|
683
|
-
bl: "\u255A",
|
|
684
|
-
br: "\u255D",
|
|
685
|
-
h: "\u2550",
|
|
686
|
-
v: "\u2551"
|
|
687
|
-
},
|
|
688
|
-
doubleSingle: {
|
|
689
|
-
tl: "\u2553",
|
|
690
|
-
tr: "\u2556",
|
|
691
|
-
bl: "\u2559",
|
|
692
|
-
br: "\u255C",
|
|
693
|
-
h: "\u2500",
|
|
694
|
-
v: "\u2551"
|
|
695
|
-
},
|
|
696
|
-
doubleSingleRounded: {
|
|
697
|
-
tl: "\u256D",
|
|
698
|
-
tr: "\u256E",
|
|
699
|
-
bl: "\u2570",
|
|
700
|
-
br: "\u256F",
|
|
701
|
-
h: "\u2500",
|
|
702
|
-
v: "\u2551"
|
|
703
|
-
},
|
|
704
|
-
singleThick: {
|
|
705
|
-
tl: "\u250F",
|
|
706
|
-
tr: "\u2513",
|
|
707
|
-
bl: "\u2517",
|
|
708
|
-
br: "\u251B",
|
|
709
|
-
h: "\u2501",
|
|
710
|
-
v: "\u2503"
|
|
711
|
-
},
|
|
712
|
-
singleDouble: {
|
|
713
|
-
tl: "\u2552",
|
|
714
|
-
tr: "\u2555",
|
|
715
|
-
bl: "\u2558",
|
|
716
|
-
br: "\u255B",
|
|
717
|
-
h: "\u2550",
|
|
718
|
-
v: "\u2502"
|
|
719
|
-
},
|
|
720
|
-
singleDoubleRounded: {
|
|
721
|
-
tl: "\u256D",
|
|
722
|
-
tr: "\u256E",
|
|
723
|
-
bl: "\u2570",
|
|
724
|
-
br: "\u256F",
|
|
725
|
-
h: "\u2550",
|
|
726
|
-
v: "\u2502"
|
|
727
|
-
},
|
|
728
|
-
rounded: {
|
|
729
|
-
tl: "\u256D",
|
|
730
|
-
tr: "\u256E",
|
|
731
|
-
bl: "\u2570",
|
|
732
|
-
br: "\u256F",
|
|
733
|
-
h: "\u2500",
|
|
734
|
-
v: "\u2502"
|
|
735
|
-
}
|
|
736
|
-
};
|
|
737
|
-
defaultStyle = {
|
|
738
|
-
borderColor: "white",
|
|
739
|
-
borderStyle: "rounded",
|
|
740
|
-
valign: "center",
|
|
741
|
-
padding: 2,
|
|
742
|
-
marginLeft: 1,
|
|
743
|
-
marginTop: 1,
|
|
744
|
-
marginBottom: 1
|
|
745
|
-
};
|
|
746
|
-
}
|
|
747
|
-
});
|
|
748
|
-
|
|
749
|
-
// ../../node_modules/.pnpm/consola@3.2.3/node_modules/consola/dist/chunks/prompt.mjs
|
|
750
|
-
var prompt_exports = {};
|
|
751
|
-
__export(prompt_exports, {
|
|
752
|
-
prompt: () => prompt
|
|
753
|
-
});
|
|
754
|
-
function z({ onlyFirst: t = false } = {}) {
|
|
755
|
-
const u = ["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)", "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");
|
|
756
|
-
return new RegExp(u, t ? void 0 : "g");
|
|
757
|
-
}
|
|
758
|
-
function $(t) {
|
|
759
|
-
if (typeof t != "string") throw new TypeError(`Expected a \`string\`, got \`${typeof t}\``);
|
|
760
|
-
return t.replace(z(), "");
|
|
761
|
-
}
|
|
762
|
-
function c(t, u = {}) {
|
|
763
|
-
if (typeof t != "string" || t.length === 0 || (u = { ambiguousIsNarrow: true, ...u }, t = $(t), t.length === 0)) return 0;
|
|
764
|
-
t = t.replace(Y(), " ");
|
|
765
|
-
const F = u.ambiguousIsNarrow ? 1 : 2;
|
|
766
|
-
let e = 0;
|
|
767
|
-
for (const s3 of t) {
|
|
768
|
-
const C = s3.codePointAt(0);
|
|
769
|
-
if (C <= 31 || C >= 127 && C <= 159 || C >= 768 && C <= 879) continue;
|
|
770
|
-
switch (K.eastAsianWidth(s3)) {
|
|
771
|
-
case "F":
|
|
772
|
-
case "W":
|
|
773
|
-
e += 2;
|
|
774
|
-
break;
|
|
775
|
-
case "A":
|
|
776
|
-
e += F;
|
|
777
|
-
break;
|
|
778
|
-
default:
|
|
779
|
-
e += 1;
|
|
780
|
-
}
|
|
781
|
-
}
|
|
782
|
-
return e;
|
|
783
|
-
}
|
|
784
|
-
function U() {
|
|
785
|
-
const t = /* @__PURE__ */ new Map();
|
|
786
|
-
for (const [u, F] of Object.entries(r)) {
|
|
787
|
-
for (const [e, s3] of Object.entries(F)) r[e] = { open: `\x1B[${s3[0]}m`, close: `\x1B[${s3[1]}m` }, F[e] = r[e], t.set(s3[0], s3[1]);
|
|
788
|
-
Object.defineProperty(r, u, { value: F, enumerable: false });
|
|
789
|
-
}
|
|
790
|
-
return Object.defineProperty(r, "codes", { value: t, enumerable: false }), r.color.close = "\x1B[39m", r.bgColor.close = "\x1B[49m", r.color.ansi = L(), r.color.ansi256 = M(), r.color.ansi16m = T(), r.bgColor.ansi = L(v), r.bgColor.ansi256 = M(v), r.bgColor.ansi16m = T(v), Object.defineProperties(r, { rgbToAnsi256: { value: (u, F, e) => u === F && F === e ? u < 8 ? 16 : u > 248 ? 231 : Math.round((u - 8) / 247 * 24) + 232 : 16 + 36 * Math.round(u / 255 * 5) + 6 * Math.round(F / 255 * 5) + Math.round(e / 255 * 5), enumerable: false }, hexToRgb: { value: (u) => {
|
|
791
|
-
const F = /[a-f\d]{6}|[a-f\d]{3}/i.exec(u.toString(16));
|
|
792
|
-
if (!F) return [0, 0, 0];
|
|
793
|
-
let [e] = F;
|
|
794
|
-
e.length === 3 && (e = [...e].map((C) => C + C).join(""));
|
|
795
|
-
const s3 = Number.parseInt(e, 16);
|
|
796
|
-
return [s3 >> 16 & 255, s3 >> 8 & 255, s3 & 255];
|
|
797
|
-
}, enumerable: false }, hexToAnsi256: { value: (u) => r.rgbToAnsi256(...r.hexToRgb(u)), enumerable: false }, ansi256ToAnsi: { value: (u) => {
|
|
798
|
-
if (u < 8) return 30 + u;
|
|
799
|
-
if (u < 16) return 90 + (u - 8);
|
|
800
|
-
let F, e, s3;
|
|
801
|
-
if (u >= 232) F = ((u - 232) * 10 + 8) / 255, e = F, s3 = F;
|
|
802
|
-
else {
|
|
803
|
-
u -= 16;
|
|
804
|
-
const i = u % 36;
|
|
805
|
-
F = Math.floor(u / 36) / 5, e = Math.floor(i / 6) / 5, s3 = i % 6 / 5;
|
|
806
|
-
}
|
|
807
|
-
const C = Math.max(F, e, s3) * 2;
|
|
808
|
-
if (C === 0) return 30;
|
|
809
|
-
let D = 30 + (Math.round(s3) << 2 | Math.round(e) << 1 | Math.round(F));
|
|
810
|
-
return C === 2 && (D += 60), D;
|
|
811
|
-
}, enumerable: false }, rgbToAnsi: { value: (u, F, e) => r.ansi256ToAnsi(r.rgbToAnsi256(u, F, e)), enumerable: false }, hexToAnsi: { value: (u) => r.ansi256ToAnsi(r.hexToAnsi256(u)), enumerable: false } }), r;
|
|
812
|
-
}
|
|
813
|
-
function P(t, u, F) {
|
|
814
|
-
return String(t).normalize().replace(/\r\n/g, `
|
|
815
|
-
`).split(`
|
|
816
|
-
`).map((e) => uD(e, u, F)).join(`
|
|
817
|
-
`);
|
|
818
|
-
}
|
|
819
|
-
function FD(t, u) {
|
|
820
|
-
if (t === u) return;
|
|
821
|
-
const F = t.split(`
|
|
822
|
-
`), e = u.split(`
|
|
823
|
-
`), s3 = [];
|
|
824
|
-
for (let C = 0; C < Math.max(F.length, e.length); C++) F[C] !== e[C] && s3.push(C);
|
|
825
|
-
return s3;
|
|
826
|
-
}
|
|
827
|
-
function g(t, u) {
|
|
828
|
-
t.isTTY && t.setRawMode(u);
|
|
829
|
-
}
|
|
830
|
-
async function prompt(message, opts = {}) {
|
|
831
|
-
if (!opts.type || opts.type === "text") {
|
|
832
|
-
return await text({
|
|
833
|
-
message,
|
|
834
|
-
defaultValue: opts.default,
|
|
835
|
-
placeholder: opts.placeholder,
|
|
836
|
-
initialValue: opts.initial
|
|
837
|
-
});
|
|
838
|
-
}
|
|
839
|
-
if (opts.type === "confirm") {
|
|
840
|
-
return await confirm({
|
|
841
|
-
message,
|
|
842
|
-
initialValue: opts.initial
|
|
843
|
-
});
|
|
844
|
-
}
|
|
845
|
-
if (opts.type === "select") {
|
|
846
|
-
return await select({
|
|
847
|
-
message,
|
|
848
|
-
options: opts.options.map(
|
|
849
|
-
(o) => typeof o === "string" ? { value: o, label: o } : o
|
|
850
|
-
)
|
|
851
|
-
});
|
|
852
|
-
}
|
|
853
|
-
if (opts.type === "multiselect") {
|
|
854
|
-
return await multiselect({
|
|
855
|
-
message,
|
|
856
|
-
options: opts.options.map(
|
|
857
|
-
(o) => typeof o === "string" ? { value: o, label: o } : o
|
|
858
|
-
),
|
|
859
|
-
required: opts.required
|
|
860
|
-
});
|
|
861
|
-
}
|
|
862
|
-
throw new Error(`Unknown prompt type: ${opts.type}`);
|
|
863
|
-
}
|
|
864
|
-
var import_node_process, import_node_readline, import_node_tty, import_tty, import_node_util2, import_node_path15, ESC, CSI, beep, cursor, scroll, erase, src, picocolors, tty2, isColorSupported2, formatter, replaceClose2, createColors2, picocolorsExports, l, m, G, K, Y, v, L, M, T, r, Z, H, q, p, J, b, W, Q, I, w, N, j, X, _, DD, uD, R, V, tD, h, sD, iD, ED, oD, unicode, s, S_STEP_ACTIVE, S_STEP_CANCEL, S_STEP_ERROR, S_STEP_SUBMIT, S_BAR, S_BAR_END, S_RADIO_ACTIVE, S_RADIO_INACTIVE, S_CHECKBOX_ACTIVE, S_CHECKBOX_SELECTED, S_CHECKBOX_INACTIVE, symbol, text, confirm, select, multiselect;
|
|
865
|
-
var init_prompt = __esm({
|
|
866
|
-
"../../node_modules/.pnpm/consola@3.2.3/node_modules/consola/dist/chunks/prompt.mjs"() {
|
|
867
|
-
"use strict";
|
|
868
|
-
import_node_process = require("process");
|
|
869
|
-
import_node_readline = __toESM(require("readline"), 1);
|
|
870
|
-
import_node_tty = require("tty");
|
|
871
|
-
init_consola_36c0034f();
|
|
872
|
-
import_tty = __toESM(require("tty"), 1);
|
|
873
|
-
init_utils();
|
|
874
|
-
init_core();
|
|
875
|
-
init_consola_06ad8a64();
|
|
876
|
-
import_node_util2 = require("util");
|
|
877
|
-
import_node_path15 = require("path");
|
|
878
|
-
ESC = "\x1B";
|
|
879
|
-
CSI = `${ESC}[`;
|
|
880
|
-
beep = "\x07";
|
|
881
|
-
cursor = {
|
|
882
|
-
to(x, y) {
|
|
883
|
-
if (!y) return `${CSI}${x + 1}G`;
|
|
884
|
-
return `${CSI}${y + 1};${x + 1}H`;
|
|
885
|
-
},
|
|
886
|
-
move(x, y) {
|
|
887
|
-
let ret = "";
|
|
888
|
-
if (x < 0) ret += `${CSI}${-x}D`;
|
|
889
|
-
else if (x > 0) ret += `${CSI}${x}C`;
|
|
890
|
-
if (y < 0) ret += `${CSI}${-y}A`;
|
|
891
|
-
else if (y > 0) ret += `${CSI}${y}B`;
|
|
892
|
-
return ret;
|
|
893
|
-
},
|
|
894
|
-
up: (count = 1) => `${CSI}${count}A`,
|
|
895
|
-
down: (count = 1) => `${CSI}${count}B`,
|
|
896
|
-
forward: (count = 1) => `${CSI}${count}C`,
|
|
897
|
-
backward: (count = 1) => `${CSI}${count}D`,
|
|
898
|
-
nextLine: (count = 1) => `${CSI}E`.repeat(count),
|
|
899
|
-
prevLine: (count = 1) => `${CSI}F`.repeat(count),
|
|
900
|
-
left: `${CSI}G`,
|
|
901
|
-
hide: `${CSI}?25l`,
|
|
902
|
-
show: `${CSI}?25h`,
|
|
903
|
-
save: `${ESC}7`,
|
|
904
|
-
restore: `${ESC}8`
|
|
905
|
-
};
|
|
906
|
-
scroll = {
|
|
907
|
-
up: (count = 1) => `${CSI}S`.repeat(count),
|
|
908
|
-
down: (count = 1) => `${CSI}T`.repeat(count)
|
|
909
|
-
};
|
|
910
|
-
erase = {
|
|
911
|
-
screen: `${CSI}2J`,
|
|
912
|
-
up: (count = 1) => `${CSI}1J`.repeat(count),
|
|
913
|
-
down: (count = 1) => `${CSI}J`.repeat(count),
|
|
914
|
-
line: `${CSI}2K`,
|
|
915
|
-
lineEnd: `${CSI}K`,
|
|
916
|
-
lineStart: `${CSI}1K`,
|
|
917
|
-
lines(count) {
|
|
918
|
-
let clear = "";
|
|
919
|
-
for (let i = 0; i < count; i++)
|
|
920
|
-
clear += this.line + (i < count - 1 ? cursor.up() : "");
|
|
921
|
-
if (count)
|
|
922
|
-
clear += cursor.left;
|
|
923
|
-
return clear;
|
|
924
|
-
}
|
|
925
|
-
};
|
|
926
|
-
src = { cursor, scroll, erase, beep };
|
|
927
|
-
picocolors = { exports: {} };
|
|
928
|
-
tty2 = import_tty.default;
|
|
929
|
-
isColorSupported2 = !("NO_COLOR" in process.env || process.argv.includes("--no-color")) && ("FORCE_COLOR" in process.env || process.argv.includes("--color") || process.platform === "win32" || tty2.isatty(1) && process.env.TERM !== "dumb" || "CI" in process.env);
|
|
930
|
-
formatter = (open, close, replace = open) => (input) => {
|
|
931
|
-
let string = "" + input;
|
|
932
|
-
let index = string.indexOf(close, open.length);
|
|
933
|
-
return ~index ? open + replaceClose2(string, close, replace, index) + close : open + string + close;
|
|
934
|
-
};
|
|
935
|
-
replaceClose2 = (string, close, replace, index) => {
|
|
936
|
-
let start = string.substring(0, index) + replace;
|
|
937
|
-
let end = string.substring(index + close.length);
|
|
938
|
-
let nextIndex = end.indexOf(close);
|
|
939
|
-
return ~nextIndex ? start + replaceClose2(end, close, replace, nextIndex) : start + end;
|
|
940
|
-
};
|
|
941
|
-
createColors2 = (enabled = isColorSupported2) => ({
|
|
942
|
-
isColorSupported: enabled,
|
|
943
|
-
reset: enabled ? (s3) => `\x1B[0m${s3}\x1B[0m` : String,
|
|
944
|
-
bold: enabled ? formatter("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m") : String,
|
|
945
|
-
dim: enabled ? formatter("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m") : String,
|
|
946
|
-
italic: enabled ? formatter("\x1B[3m", "\x1B[23m") : String,
|
|
947
|
-
underline: enabled ? formatter("\x1B[4m", "\x1B[24m") : String,
|
|
948
|
-
inverse: enabled ? formatter("\x1B[7m", "\x1B[27m") : String,
|
|
949
|
-
hidden: enabled ? formatter("\x1B[8m", "\x1B[28m") : String,
|
|
950
|
-
strikethrough: enabled ? formatter("\x1B[9m", "\x1B[29m") : String,
|
|
951
|
-
black: enabled ? formatter("\x1B[30m", "\x1B[39m") : String,
|
|
952
|
-
red: enabled ? formatter("\x1B[31m", "\x1B[39m") : String,
|
|
953
|
-
green: enabled ? formatter("\x1B[32m", "\x1B[39m") : String,
|
|
954
|
-
yellow: enabled ? formatter("\x1B[33m", "\x1B[39m") : String,
|
|
955
|
-
blue: enabled ? formatter("\x1B[34m", "\x1B[39m") : String,
|
|
956
|
-
magenta: enabled ? formatter("\x1B[35m", "\x1B[39m") : String,
|
|
957
|
-
cyan: enabled ? formatter("\x1B[36m", "\x1B[39m") : String,
|
|
958
|
-
white: enabled ? formatter("\x1B[37m", "\x1B[39m") : String,
|
|
959
|
-
gray: enabled ? formatter("\x1B[90m", "\x1B[39m") : String,
|
|
960
|
-
bgBlack: enabled ? formatter("\x1B[40m", "\x1B[49m") : String,
|
|
961
|
-
bgRed: enabled ? formatter("\x1B[41m", "\x1B[49m") : String,
|
|
962
|
-
bgGreen: enabled ? formatter("\x1B[42m", "\x1B[49m") : String,
|
|
963
|
-
bgYellow: enabled ? formatter("\x1B[43m", "\x1B[49m") : String,
|
|
964
|
-
bgBlue: enabled ? formatter("\x1B[44m", "\x1B[49m") : String,
|
|
965
|
-
bgMagenta: enabled ? formatter("\x1B[45m", "\x1B[49m") : String,
|
|
966
|
-
bgCyan: enabled ? formatter("\x1B[46m", "\x1B[49m") : String,
|
|
967
|
-
bgWhite: enabled ? formatter("\x1B[47m", "\x1B[49m") : String
|
|
968
|
-
});
|
|
969
|
-
picocolors.exports = createColors2();
|
|
970
|
-
picocolors.exports.createColors = createColors2;
|
|
971
|
-
picocolorsExports = picocolors.exports;
|
|
972
|
-
l = /* @__PURE__ */ getDefaultExportFromCjs(picocolorsExports);
|
|
973
|
-
m = {};
|
|
974
|
-
G = { get exports() {
|
|
975
|
-
return m;
|
|
976
|
-
}, set exports(t) {
|
|
977
|
-
m = t;
|
|
978
|
-
} };
|
|
979
|
-
(function(t) {
|
|
980
|
-
var u = {};
|
|
981
|
-
t.exports = u, u.eastAsianWidth = function(e) {
|
|
982
|
-
var s3 = e.charCodeAt(0), C = e.length == 2 ? e.charCodeAt(1) : 0, D = s3;
|
|
983
|
-
return 55296 <= s3 && s3 <= 56319 && 56320 <= C && C <= 57343 && (s3 &= 1023, C &= 1023, D = s3 << 10 | C, D += 65536), D == 12288 || 65281 <= D && D <= 65376 || 65504 <= D && D <= 65510 ? "F" : D == 8361 || 65377 <= D && D <= 65470 || 65474 <= D && D <= 65479 || 65482 <= D && D <= 65487 || 65490 <= D && D <= 65495 || 65498 <= D && D <= 65500 || 65512 <= D && D <= 65518 ? "H" : 4352 <= D && D <= 4447 || 4515 <= D && D <= 4519 || 4602 <= D && D <= 4607 || 9001 <= D && D <= 9002 || 11904 <= D && D <= 11929 || 11931 <= D && D <= 12019 || 12032 <= D && D <= 12245 || 12272 <= D && D <= 12283 || 12289 <= D && D <= 12350 || 12353 <= D && D <= 12438 || 12441 <= D && D <= 12543 || 12549 <= D && D <= 12589 || 12593 <= D && D <= 12686 || 12688 <= D && D <= 12730 || 12736 <= D && D <= 12771 || 12784 <= D && D <= 12830 || 12832 <= D && D <= 12871 || 12880 <= D && D <= 13054 || 13056 <= D && D <= 19903 || 19968 <= D && D <= 42124 || 42128 <= D && D <= 42182 || 43360 <= D && D <= 43388 || 44032 <= D && D <= 55203 || 55216 <= D && D <= 55238 || 55243 <= D && D <= 55291 || 63744 <= D && D <= 64255 || 65040 <= D && D <= 65049 || 65072 <= D && D <= 65106 || 65108 <= D && D <= 65126 || 65128 <= D && D <= 65131 || 110592 <= D && D <= 110593 || 127488 <= D && D <= 127490 || 127504 <= D && D <= 127546 || 127552 <= D && D <= 127560 || 127568 <= D && D <= 127569 || 131072 <= D && D <= 194367 || 177984 <= D && D <= 196605 || 196608 <= D && D <= 262141 ? "W" : 32 <= D && D <= 126 || 162 <= D && D <= 163 || 165 <= D && D <= 166 || D == 172 || D == 175 || 10214 <= D && D <= 10221 || 10629 <= D && D <= 10630 ? "Na" : D == 161 || D == 164 || 167 <= D && D <= 168 || D == 170 || 173 <= D && D <= 174 || 176 <= D && D <= 180 || 182 <= D && D <= 186 || 188 <= D && D <= 191 || D == 198 || D == 208 || 215 <= D && D <= 216 || 222 <= D && D <= 225 || D == 230 || 232 <= D && D <= 234 || 236 <= D && D <= 237 || D == 240 || 242 <= D && D <= 243 || 247 <= D && D <= 250 || D == 252 || D == 254 || D == 257 || D == 273 || D == 275 || D == 283 || 294 <= D && D <= 295 || D == 299 || 305 <= D && D <= 307 || D == 312 || 319 <= D && D <= 322 || D == 324 || 328 <= D && D <= 331 || D == 333 || 338 <= D && D <= 339 || 358 <= D && D <= 359 || D == 363 || D == 462 || D == 464 || D == 466 || D == 468 || D == 470 || D == 472 || D == 474 || D == 476 || D == 593 || D == 609 || D == 708 || D == 711 || 713 <= D && D <= 715 || D == 717 || D == 720 || 728 <= D && D <= 731 || D == 733 || D == 735 || 768 <= D && D <= 879 || 913 <= D && D <= 929 || 931 <= D && D <= 937 || 945 <= D && D <= 961 || 963 <= D && D <= 969 || D == 1025 || 1040 <= D && D <= 1103 || D == 1105 || D == 8208 || 8211 <= D && D <= 8214 || 8216 <= D && D <= 8217 || 8220 <= D && D <= 8221 || 8224 <= D && D <= 8226 || 8228 <= D && D <= 8231 || D == 8240 || 8242 <= D && D <= 8243 || D == 8245 || D == 8251 || D == 8254 || D == 8308 || D == 8319 || 8321 <= D && D <= 8324 || D == 8364 || D == 8451 || D == 8453 || D == 8457 || D == 8467 || D == 8470 || 8481 <= D && D <= 8482 || D == 8486 || D == 8491 || 8531 <= D && D <= 8532 || 8539 <= D && D <= 8542 || 8544 <= D && D <= 8555 || 8560 <= D && D <= 8569 || D == 8585 || 8592 <= D && D <= 8601 || 8632 <= D && D <= 8633 || D == 8658 || D == 8660 || D == 8679 || D == 8704 || 8706 <= D && D <= 8707 || 8711 <= D && D <= 8712 || D == 8715 || D == 8719 || D == 8721 || D == 8725 || D == 8730 || 8733 <= D && D <= 8736 || D == 8739 || D == 8741 || 8743 <= D && D <= 8748 || D == 8750 || 8756 <= D && D <= 8759 || 8764 <= D && D <= 8765 || D == 8776 || D == 8780 || D == 8786 || 8800 <= D && D <= 8801 || 8804 <= D && D <= 8807 || 8810 <= D && D <= 8811 || 8814 <= D && D <= 8815 || 8834 <= D && D <= 8835 || 8838 <= D && D <= 8839 || D == 8853 || D == 8857 || D == 8869 || D == 8895 || D == 8978 || 9312 <= D && D <= 9449 || 9451 <= D && D <= 9547 || 9552 <= D && D <= 9587 || 9600 <= D && D <= 9615 || 9618 <= D && D <= 9621 || 9632 <= D && D <= 9633 || 9635 <= D && D <= 9641 || 9650 <= D && D <= 9651 || 9654 <= D && D <= 9655 || 9660 <= D && D <= 9661 || 9664 <= D && D <= 9665 || 9670 <= D && D <= 9672 || D == 9675 || 9678 <= D && D <= 9681 || 9698 <= D && D <= 9701 || D == 9711 || 9733 <= D && D <= 9734 || D == 9737 || 9742 <= D && D <= 9743 || 9748 <= D && D <= 9749 || D == 9756 || D == 9758 || D == 9792 || D == 9794 || 9824 <= D && D <= 9825 || 9827 <= D && D <= 9829 || 9831 <= D && D <= 9834 || 9836 <= D && D <= 9837 || D == 9839 || 9886 <= D && D <= 9887 || 9918 <= D && D <= 9919 || 9924 <= D && D <= 9933 || 9935 <= D && D <= 9953 || D == 9955 || 9960 <= D && D <= 9983 || D == 10045 || D == 10071 || 10102 <= D && D <= 10111 || 11093 <= D && D <= 11097 || 12872 <= D && D <= 12879 || 57344 <= D && D <= 63743 || 65024 <= D && D <= 65039 || D == 65533 || 127232 <= D && D <= 127242 || 127248 <= D && D <= 127277 || 127280 <= D && D <= 127337 || 127344 <= D && D <= 127386 || 917760 <= D && D <= 917999 || 983040 <= D && D <= 1048573 || 1048576 <= D && D <= 1114109 ? "A" : "N";
|
|
984
|
-
}, u.characterLength = function(e) {
|
|
985
|
-
var s3 = this.eastAsianWidth(e);
|
|
986
|
-
return s3 == "F" || s3 == "W" || s3 == "A" ? 2 : 1;
|
|
987
|
-
};
|
|
988
|
-
function F(e) {
|
|
989
|
-
return e.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g) || [];
|
|
990
|
-
}
|
|
991
|
-
u.length = function(e) {
|
|
992
|
-
for (var s3 = F(e), C = 0, D = 0; D < s3.length; D++) C = C + this.characterLength(s3[D]);
|
|
993
|
-
return C;
|
|
994
|
-
}, u.slice = function(e, s3, C) {
|
|
995
|
-
textLen = u.length(e), s3 = s3 || 0, C = C || 1, s3 < 0 && (s3 = textLen + s3), C < 0 && (C = textLen + C);
|
|
996
|
-
for (var D = "", i = 0, o = F(e), E = 0; E < o.length; E++) {
|
|
997
|
-
var a = o[E], n = u.length(a);
|
|
998
|
-
if (i >= s3 - (n == 2 ? 1 : 0)) if (i + n <= C) D += a;
|
|
999
|
-
else break;
|
|
1000
|
-
i += n;
|
|
1001
|
-
}
|
|
1002
|
-
return D;
|
|
1003
|
-
};
|
|
1004
|
-
})(G);
|
|
1005
|
-
K = m;
|
|
1006
|
-
Y = function() {
|
|
1007
|
-
return /\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83E\uDDD1(?:\u200D(?:\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\uD83D[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3])\uFE0F|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDE35\u200D\uD83D\uDCAB|\uD83D\uDE2E\u200D\uD83D\uDCA8|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83E\uDDD1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC69(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC08\u200D\u2B1B|\u2764\uFE0F\u200D(?:\uD83D\uDD25|\uD83E\uDE79)|\uD83D\uDC41\uFE0F|\uD83C\uDFF3\uFE0F|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|[#\*0-9]\uFE0F\u20E3|\u2764\uFE0F|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|\uD83C\uDFF4|(?:[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270C\u270D]|\uD83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g;
|
|
1008
|
-
};
|
|
1009
|
-
v = 10;
|
|
1010
|
-
L = (t = 0) => (u) => `\x1B[${u + t}m`;
|
|
1011
|
-
M = (t = 0) => (u) => `\x1B[${38 + t};5;${u}m`;
|
|
1012
|
-
T = (t = 0) => (u, F, e) => `\x1B[${38 + t};2;${u};${F};${e}m`;
|
|
1013
|
-
r = { modifier: { reset: [0, 0], bold: [1, 22], dim: [2, 22], italic: [3, 23], underline: [4, 24], overline: [53, 55], inverse: [7, 27], hidden: [8, 28], strikethrough: [9, 29] }, color: { black: [30, 39], red: [31, 39], green: [32, 39], yellow: [33, 39], blue: [34, 39], magenta: [35, 39], cyan: [36, 39], white: [37, 39], blackBright: [90, 39], gray: [90, 39], grey: [90, 39], redBright: [91, 39], greenBright: [92, 39], yellowBright: [93, 39], blueBright: [94, 39], magentaBright: [95, 39], cyanBright: [96, 39], whiteBright: [97, 39] }, bgColor: { bgBlack: [40, 49], bgRed: [41, 49], bgGreen: [42, 49], bgYellow: [43, 49], bgBlue: [44, 49], bgMagenta: [45, 49], bgCyan: [46, 49], bgWhite: [47, 49], bgBlackBright: [100, 49], bgGray: [100, 49], bgGrey: [100, 49], bgRedBright: [101, 49], bgGreenBright: [102, 49], bgYellowBright: [103, 49], bgBlueBright: [104, 49], bgMagentaBright: [105, 49], bgCyanBright: [106, 49], bgWhiteBright: [107, 49] } };
|
|
1014
|
-
Object.keys(r.modifier);
|
|
1015
|
-
Z = Object.keys(r.color);
|
|
1016
|
-
H = Object.keys(r.bgColor);
|
|
1017
|
-
[...Z, ...H];
|
|
1018
|
-
q = U();
|
|
1019
|
-
p = /* @__PURE__ */ new Set(["\x1B", "\x9B"]);
|
|
1020
|
-
J = 39;
|
|
1021
|
-
b = "\x07";
|
|
1022
|
-
W = "[";
|
|
1023
|
-
Q = "]";
|
|
1024
|
-
I = "m";
|
|
1025
|
-
w = `${Q}8;;`;
|
|
1026
|
-
N = (t) => `${p.values().next().value}${W}${t}${I}`;
|
|
1027
|
-
j = (t) => `${p.values().next().value}${w}${t}${b}`;
|
|
1028
|
-
X = (t) => t.split(" ").map((u) => c(u));
|
|
1029
|
-
_ = (t, u, F) => {
|
|
1030
|
-
const e = [...u];
|
|
1031
|
-
let s3 = false, C = false, D = c($(t[t.length - 1]));
|
|
1032
|
-
for (const [i, o] of e.entries()) {
|
|
1033
|
-
const E = c(o);
|
|
1034
|
-
if (D + E <= F ? t[t.length - 1] += o : (t.push(o), D = 0), p.has(o) && (s3 = true, C = e.slice(i + 1).join("").startsWith(w)), s3) {
|
|
1035
|
-
C ? o === b && (s3 = false, C = false) : o === I && (s3 = false);
|
|
1036
|
-
continue;
|
|
1037
|
-
}
|
|
1038
|
-
D += E, D === F && i < e.length - 1 && (t.push(""), D = 0);
|
|
1039
|
-
}
|
|
1040
|
-
!D && t[t.length - 1].length > 0 && t.length > 1 && (t[t.length - 2] += t.pop());
|
|
1041
|
-
};
|
|
1042
|
-
DD = (t) => {
|
|
1043
|
-
const u = t.split(" ");
|
|
1044
|
-
let F = u.length;
|
|
1045
|
-
for (; F > 0 && !(c(u[F - 1]) > 0); ) F--;
|
|
1046
|
-
return F === u.length ? t : u.slice(0, F).join(" ") + u.slice(F).join("");
|
|
1047
|
-
};
|
|
1048
|
-
uD = (t, u, F = {}) => {
|
|
1049
|
-
if (F.trim !== false && t.trim() === "") return "";
|
|
1050
|
-
let e = "", s3, C;
|
|
1051
|
-
const D = X(t);
|
|
1052
|
-
let i = [""];
|
|
1053
|
-
for (const [E, a] of t.split(" ").entries()) {
|
|
1054
|
-
F.trim !== false && (i[i.length - 1] = i[i.length - 1].trimStart());
|
|
1055
|
-
let n = c(i[i.length - 1]);
|
|
1056
|
-
if (E !== 0 && (n >= u && (F.wordWrap === false || F.trim === false) && (i.push(""), n = 0), (n > 0 || F.trim === false) && (i[i.length - 1] += " ", n++)), F.hard && D[E] > u) {
|
|
1057
|
-
const B = u - n, A = 1 + Math.floor((D[E] - B - 1) / u);
|
|
1058
|
-
Math.floor((D[E] - 1) / u) < A && i.push(""), _(i, a, u);
|
|
1059
|
-
continue;
|
|
1060
|
-
}
|
|
1061
|
-
if (n + D[E] > u && n > 0 && D[E] > 0) {
|
|
1062
|
-
if (F.wordWrap === false && n < u) {
|
|
1063
|
-
_(i, a, u);
|
|
1064
|
-
continue;
|
|
1065
|
-
}
|
|
1066
|
-
i.push("");
|
|
1067
|
-
}
|
|
1068
|
-
if (n + D[E] > u && F.wordWrap === false) {
|
|
1069
|
-
_(i, a, u);
|
|
1070
|
-
continue;
|
|
1071
|
-
}
|
|
1072
|
-
i[i.length - 1] += a;
|
|
1073
|
-
}
|
|
1074
|
-
F.trim !== false && (i = i.map((E) => DD(E)));
|
|
1075
|
-
const o = [...i.join(`
|
|
1076
|
-
`)];
|
|
1077
|
-
for (const [E, a] of o.entries()) {
|
|
1078
|
-
if (e += a, p.has(a)) {
|
|
1079
|
-
const { groups: B } = new RegExp(`(?:\\${W}(?<code>\\d+)m|\\${w}(?<uri>.*)${b})`).exec(o.slice(E).join("")) || { groups: {} };
|
|
1080
|
-
if (B.code !== void 0) {
|
|
1081
|
-
const A = Number.parseFloat(B.code);
|
|
1082
|
-
s3 = A === J ? void 0 : A;
|
|
1083
|
-
} else B.uri !== void 0 && (C = B.uri.length === 0 ? void 0 : B.uri);
|
|
1084
|
-
}
|
|
1085
|
-
const n = q.codes.get(Number(s3));
|
|
1086
|
-
o[E + 1] === `
|
|
1087
|
-
` ? (C && (e += j("")), s3 && n && (e += N(n))) : a === `
|
|
1088
|
-
` && (s3 && n && (e += N(s3)), C && (e += j(C)));
|
|
1089
|
-
}
|
|
1090
|
-
return e;
|
|
1091
|
-
};
|
|
1092
|
-
R = Symbol("clack:cancel");
|
|
1093
|
-
V = /* @__PURE__ */ new Map([["k", "up"], ["j", "down"], ["h", "left"], ["l", "right"]]);
|
|
1094
|
-
tD = /* @__PURE__ */ new Set(["up", "down", "left", "right", "space", "enter"]);
|
|
1095
|
-
h = class {
|
|
1096
|
-
constructor({ render: u, input: F = import_node_process.stdin, output: e = import_node_process.stdout, ...s3 }, C = true) {
|
|
1097
|
-
this._track = false, this._cursor = 0, this.state = "initial", this.error = "", this.subscribers = /* @__PURE__ */ new Map(), this._prevFrame = "", this.opts = s3, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = u.bind(this), this._track = C, this.input = F, this.output = e;
|
|
1098
|
-
}
|
|
1099
|
-
prompt() {
|
|
1100
|
-
const u = new import_node_tty.WriteStream(0);
|
|
1101
|
-
return u._write = (F, e, s3) => {
|
|
1102
|
-
this._track && (this.value = this.rl.line.replace(/\t/g, ""), this._cursor = this.rl.cursor, this.emit("value", this.value)), s3();
|
|
1103
|
-
}, this.input.pipe(u), this.rl = import_node_readline.default.createInterface({ input: this.input, output: u, tabSize: 2, prompt: "", escapeCodeTimeout: 50 }), import_node_readline.default.emitKeypressEvents(this.input, this.rl), this.rl.prompt(), this.opts.initialValue !== void 0 && this._track && this.rl.write(this.opts.initialValue), this.input.on("keypress", this.onKeypress), g(this.input, true), this.output.on("resize", this.render), this.render(), new Promise((F, e) => {
|
|
1104
|
-
this.once("submit", () => {
|
|
1105
|
-
this.output.write(src.cursor.show), this.output.off("resize", this.render), g(this.input, false), F(this.value);
|
|
1106
|
-
}), this.once("cancel", () => {
|
|
1107
|
-
this.output.write(src.cursor.show), this.output.off("resize", this.render), g(this.input, false), F(R);
|
|
1108
|
-
});
|
|
1109
|
-
});
|
|
1110
|
-
}
|
|
1111
|
-
on(u, F) {
|
|
1112
|
-
const e = this.subscribers.get(u) ?? [];
|
|
1113
|
-
e.push({ cb: F }), this.subscribers.set(u, e);
|
|
1114
|
-
}
|
|
1115
|
-
once(u, F) {
|
|
1116
|
-
const e = this.subscribers.get(u) ?? [];
|
|
1117
|
-
e.push({ cb: F, once: true }), this.subscribers.set(u, e);
|
|
1118
|
-
}
|
|
1119
|
-
emit(u, ...F) {
|
|
1120
|
-
const e = this.subscribers.get(u) ?? [], s3 = [];
|
|
1121
|
-
for (const C of e) C.cb(...F), C.once && s3.push(() => e.splice(e.indexOf(C), 1));
|
|
1122
|
-
for (const C of s3) C();
|
|
1123
|
-
}
|
|
1124
|
-
unsubscribe() {
|
|
1125
|
-
this.subscribers.clear();
|
|
1126
|
-
}
|
|
1127
|
-
onKeypress(u, F) {
|
|
1128
|
-
if (this.state === "error" && (this.state = "active"), F?.name && !this._track && V.has(F.name) && this.emit("cursor", V.get(F.name)), F?.name && tD.has(F.name) && this.emit("cursor", F.name), u && (u.toLowerCase() === "y" || u.toLowerCase() === "n") && this.emit("confirm", u.toLowerCase() === "y"), u && this.emit("key", u.toLowerCase()), F?.name === "return") {
|
|
1129
|
-
if (this.opts.validate) {
|
|
1130
|
-
const e = this.opts.validate(this.value);
|
|
1131
|
-
e && (this.error = e, this.state = "error", this.rl.write(this.value));
|
|
1132
|
-
}
|
|
1133
|
-
this.state !== "error" && (this.state = "submit");
|
|
1134
|
-
}
|
|
1135
|
-
u === "" && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
|
|
1136
|
-
}
|
|
1137
|
-
close() {
|
|
1138
|
-
this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
|
|
1139
|
-
`), g(this.input, false), this.rl.close(), this.emit(`${this.state}`, this.value), this.unsubscribe();
|
|
1140
|
-
}
|
|
1141
|
-
restoreCursor() {
|
|
1142
|
-
const u = P(this._prevFrame, process.stdout.columns, { hard: true }).split(`
|
|
1143
|
-
`).length - 1;
|
|
1144
|
-
this.output.write(src.cursor.move(-999, u * -1));
|
|
1145
|
-
}
|
|
1146
|
-
render() {
|
|
1147
|
-
const u = P(this._render(this) ?? "", process.stdout.columns, { hard: true });
|
|
1148
|
-
if (u !== this._prevFrame) {
|
|
1149
|
-
if (this.state === "initial") this.output.write(src.cursor.hide);
|
|
1150
|
-
else {
|
|
1151
|
-
const F = FD(this._prevFrame, u);
|
|
1152
|
-
if (this.restoreCursor(), F && F?.length === 1) {
|
|
1153
|
-
const e = F[0];
|
|
1154
|
-
this.output.write(src.cursor.move(0, e)), this.output.write(src.erase.lines(1));
|
|
1155
|
-
const s3 = u.split(`
|
|
1156
|
-
`);
|
|
1157
|
-
this.output.write(s3[e]), this._prevFrame = u, this.output.write(src.cursor.move(0, s3.length - e - 1));
|
|
1158
|
-
return;
|
|
1159
|
-
} else if (F && F?.length > 1) {
|
|
1160
|
-
const e = F[0];
|
|
1161
|
-
this.output.write(src.cursor.move(0, e)), this.output.write(src.erase.down());
|
|
1162
|
-
const C = u.split(`
|
|
1163
|
-
`).slice(e);
|
|
1164
|
-
this.output.write(C.join(`
|
|
1165
|
-
`)), this._prevFrame = u;
|
|
1166
|
-
return;
|
|
1167
|
-
}
|
|
1168
|
-
this.output.write(src.erase.down());
|
|
1169
|
-
}
|
|
1170
|
-
this.output.write(u), this.state === "initial" && (this.state = "active"), this._prevFrame = u;
|
|
1171
|
-
}
|
|
1172
|
-
}
|
|
1173
|
-
};
|
|
1174
|
-
sD = class extends h {
|
|
1175
|
-
get cursor() {
|
|
1176
|
-
return this.value ? 0 : 1;
|
|
1177
|
-
}
|
|
1178
|
-
get _value() {
|
|
1179
|
-
return this.cursor === 0;
|
|
1180
|
-
}
|
|
1181
|
-
constructor(u) {
|
|
1182
|
-
super(u, false), this.value = !!u.initialValue, this.on("value", () => {
|
|
1183
|
-
this.value = this._value;
|
|
1184
|
-
}), this.on("confirm", (F) => {
|
|
1185
|
-
this.output.write(src.cursor.move(0, -1)), this.value = F, this.state = "submit", this.close();
|
|
1186
|
-
}), this.on("cursor", () => {
|
|
1187
|
-
this.value = !this.value;
|
|
1188
|
-
});
|
|
1189
|
-
}
|
|
1190
|
-
};
|
|
1191
|
-
iD = class extends h {
|
|
1192
|
-
constructor(u) {
|
|
1193
|
-
super(u, false), this.cursor = 0, this.options = u.options, this.value = [...u.initialValues ?? []], this.cursor = Math.max(this.options.findIndex(({ value: F }) => F === u.cursorAt), 0), this.on("key", (F) => {
|
|
1194
|
-
F === "a" && this.toggleAll();
|
|
1195
|
-
}), this.on("cursor", (F) => {
|
|
1196
|
-
switch (F) {
|
|
1197
|
-
case "left":
|
|
1198
|
-
case "up":
|
|
1199
|
-
this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
|
|
1200
|
-
break;
|
|
1201
|
-
case "down":
|
|
1202
|
-
case "right":
|
|
1203
|
-
this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
|
|
1204
|
-
break;
|
|
1205
|
-
case "space":
|
|
1206
|
-
this.toggleValue();
|
|
1207
|
-
break;
|
|
1208
|
-
}
|
|
1209
|
-
});
|
|
1210
|
-
}
|
|
1211
|
-
get _value() {
|
|
1212
|
-
return this.options[this.cursor].value;
|
|
1213
|
-
}
|
|
1214
|
-
toggleAll() {
|
|
1215
|
-
const u = this.value.length === this.options.length;
|
|
1216
|
-
this.value = u ? [] : this.options.map((F) => F.value);
|
|
1217
|
-
}
|
|
1218
|
-
toggleValue() {
|
|
1219
|
-
const u = this.value.includes(this._value);
|
|
1220
|
-
this.value = u ? this.value.filter((F) => F !== this._value) : [...this.value, this._value];
|
|
1221
|
-
}
|
|
1222
|
-
};
|
|
1223
|
-
ED = class extends h {
|
|
1224
|
-
constructor(u) {
|
|
1225
|
-
super(u, false), this.cursor = 0, this.options = u.options, this.cursor = this.options.findIndex(({ value: F }) => F === u.initialValue), this.cursor === -1 && (this.cursor = 0), this.changeValue(), this.on("cursor", (F) => {
|
|
1226
|
-
switch (F) {
|
|
1227
|
-
case "left":
|
|
1228
|
-
case "up":
|
|
1229
|
-
this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
|
|
1230
|
-
break;
|
|
1231
|
-
case "down":
|
|
1232
|
-
case "right":
|
|
1233
|
-
this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
|
|
1234
|
-
break;
|
|
1235
|
-
}
|
|
1236
|
-
this.changeValue();
|
|
1237
|
-
});
|
|
1238
|
-
}
|
|
1239
|
-
get _value() {
|
|
1240
|
-
return this.options[this.cursor];
|
|
1241
|
-
}
|
|
1242
|
-
changeValue() {
|
|
1243
|
-
this.value = this._value.value;
|
|
1244
|
-
}
|
|
1245
|
-
};
|
|
1246
|
-
oD = class extends h {
|
|
1247
|
-
constructor(u) {
|
|
1248
|
-
super(u), this.valueWithCursor = "", this.on("finalize", () => {
|
|
1249
|
-
this.value || (this.value = u.defaultValue), this.valueWithCursor = this.value;
|
|
1250
|
-
}), this.on("value", () => {
|
|
1251
|
-
if (this.cursor >= this.value.length) this.valueWithCursor = `${this.value}${l.inverse(l.hidden("_"))}`;
|
|
1252
|
-
else {
|
|
1253
|
-
const F = this.value.slice(0, this.cursor), e = this.value.slice(this.cursor);
|
|
1254
|
-
this.valueWithCursor = `${F}${l.inverse(e[0])}${e.slice(1)}`;
|
|
1255
|
-
}
|
|
1256
|
-
});
|
|
1257
|
-
}
|
|
1258
|
-
get cursor() {
|
|
1259
|
-
return this._cursor;
|
|
1260
|
-
}
|
|
1261
|
-
};
|
|
1262
|
-
unicode = isUnicodeSupported();
|
|
1263
|
-
s = (c2, fallback) => unicode ? c2 : fallback;
|
|
1264
|
-
S_STEP_ACTIVE = s("\u276F", ">");
|
|
1265
|
-
S_STEP_CANCEL = s("\u25A0", "x");
|
|
1266
|
-
S_STEP_ERROR = s("\u25B2", "x");
|
|
1267
|
-
S_STEP_SUBMIT = s("\u2714", "\u221A");
|
|
1268
|
-
S_BAR = "";
|
|
1269
|
-
S_BAR_END = "";
|
|
1270
|
-
S_RADIO_ACTIVE = s("\u25CF", ">");
|
|
1271
|
-
S_RADIO_INACTIVE = s("\u25CB", " ");
|
|
1272
|
-
S_CHECKBOX_ACTIVE = s("\u25FB", "[\u2022]");
|
|
1273
|
-
S_CHECKBOX_SELECTED = s("\u25FC", "[+]");
|
|
1274
|
-
S_CHECKBOX_INACTIVE = s("\u25FB", "[ ]");
|
|
1275
|
-
symbol = (state) => {
|
|
1276
|
-
switch (state) {
|
|
1277
|
-
case "initial":
|
|
1278
|
-
case "active": {
|
|
1279
|
-
return colors.cyan(S_STEP_ACTIVE);
|
|
1280
|
-
}
|
|
1281
|
-
case "cancel": {
|
|
1282
|
-
return colors.red(S_STEP_CANCEL);
|
|
1283
|
-
}
|
|
1284
|
-
case "error": {
|
|
1285
|
-
return colors.yellow(S_STEP_ERROR);
|
|
1286
|
-
}
|
|
1287
|
-
case "submit": {
|
|
1288
|
-
return colors.green(S_STEP_SUBMIT);
|
|
1289
|
-
}
|
|
1290
|
-
}
|
|
1291
|
-
};
|
|
1292
|
-
text = (opts) => {
|
|
1293
|
-
return new oD({
|
|
1294
|
-
validate: opts.validate,
|
|
1295
|
-
placeholder: opts.placeholder,
|
|
1296
|
-
defaultValue: opts.defaultValue,
|
|
1297
|
-
initialValue: opts.initialValue,
|
|
1298
|
-
render() {
|
|
1299
|
-
const title = `${colors.gray(S_BAR)}
|
|
1300
|
-
${symbol(this.state)} ${opts.message}
|
|
1301
|
-
`;
|
|
1302
|
-
const placeholder = opts.placeholder ? colors.inverse(opts.placeholder[0]) + colors.dim(opts.placeholder.slice(1)) : colors.inverse(colors.hidden("_"));
|
|
1303
|
-
const value = this.value ? this.valueWithCursor : placeholder;
|
|
1304
|
-
switch (this.state) {
|
|
1305
|
-
case "error": {
|
|
1306
|
-
return `${title.trim()}
|
|
1307
|
-
${colors.yellow(
|
|
1308
|
-
S_BAR
|
|
1309
|
-
)} ${value}
|
|
1310
|
-
${colors.yellow(S_BAR_END)} ${colors.yellow(
|
|
1311
|
-
this.error
|
|
1312
|
-
)}
|
|
1313
|
-
`;
|
|
1314
|
-
}
|
|
1315
|
-
case "submit": {
|
|
1316
|
-
return `${title}${colors.gray(S_BAR)} ${colors.dim(
|
|
1317
|
-
this.value || opts.placeholder
|
|
1318
|
-
)}`;
|
|
1319
|
-
}
|
|
1320
|
-
case "cancel": {
|
|
1321
|
-
return `${title}${colors.gray(S_BAR)} ${colors.strikethrough(
|
|
1322
|
-
colors.dim(this.value ?? "")
|
|
1323
|
-
)}${this.value?.trim() ? "\n" + colors.gray(S_BAR) : ""}`;
|
|
1324
|
-
}
|
|
1325
|
-
default: {
|
|
1326
|
-
return `${title}${colors.cyan(S_BAR)} ${value}
|
|
1327
|
-
${colors.cyan(
|
|
1328
|
-
S_BAR_END
|
|
1329
|
-
)}
|
|
1330
|
-
`;
|
|
1331
|
-
}
|
|
1332
|
-
}
|
|
1333
|
-
}
|
|
1334
|
-
}).prompt();
|
|
1335
|
-
};
|
|
1336
|
-
confirm = (opts) => {
|
|
1337
|
-
const active = opts.active ?? "Yes";
|
|
1338
|
-
const inactive = opts.inactive ?? "No";
|
|
1339
|
-
return new sD({
|
|
1340
|
-
active,
|
|
1341
|
-
inactive,
|
|
1342
|
-
initialValue: opts.initialValue ?? true,
|
|
1343
|
-
render() {
|
|
1344
|
-
const title = `${colors.gray(S_BAR)}
|
|
1345
|
-
${symbol(this.state)} ${opts.message}
|
|
1346
|
-
`;
|
|
1347
|
-
const value = this.value ? active : inactive;
|
|
1348
|
-
switch (this.state) {
|
|
1349
|
-
case "submit": {
|
|
1350
|
-
return `${title}${colors.gray(S_BAR)} ${colors.dim(value)}`;
|
|
1351
|
-
}
|
|
1352
|
-
case "cancel": {
|
|
1353
|
-
return `${title}${colors.gray(S_BAR)} ${colors.strikethrough(
|
|
1354
|
-
colors.dim(value)
|
|
1355
|
-
)}
|
|
1356
|
-
${colors.gray(S_BAR)}`;
|
|
1357
|
-
}
|
|
1358
|
-
default: {
|
|
1359
|
-
return `${title}${colors.cyan(S_BAR)} ${this.value ? `${colors.green(S_RADIO_ACTIVE)} ${active}` : `${colors.dim(S_RADIO_INACTIVE)} ${colors.dim(active)}`} ${colors.dim("/")} ${this.value ? `${colors.dim(S_RADIO_INACTIVE)} ${colors.dim(inactive)}` : `${colors.green(S_RADIO_ACTIVE)} ${inactive}`}
|
|
1360
|
-
${colors.cyan(S_BAR_END)}
|
|
1361
|
-
`;
|
|
1362
|
-
}
|
|
1363
|
-
}
|
|
1364
|
-
}
|
|
1365
|
-
}).prompt();
|
|
1366
|
-
};
|
|
1367
|
-
select = (opts) => {
|
|
1368
|
-
const opt = (option, state) => {
|
|
1369
|
-
const label = option.label ?? String(option.value);
|
|
1370
|
-
switch (state) {
|
|
1371
|
-
case "active": {
|
|
1372
|
-
return `${colors.green(S_RADIO_ACTIVE)} ${label} ${option.hint ? colors.dim(`(${option.hint})`) : ""}`;
|
|
1373
|
-
}
|
|
1374
|
-
case "selected": {
|
|
1375
|
-
return `${colors.dim(label)}`;
|
|
1376
|
-
}
|
|
1377
|
-
case "cancelled": {
|
|
1378
|
-
return `${colors.strikethrough(colors.dim(label))}`;
|
|
1379
|
-
}
|
|
1380
|
-
}
|
|
1381
|
-
return `${colors.dim(S_RADIO_INACTIVE)} ${colors.dim(label)}`;
|
|
1382
|
-
};
|
|
1383
|
-
return new ED({
|
|
1384
|
-
options: opts.options,
|
|
1385
|
-
initialValue: opts.initialValue,
|
|
1386
|
-
render() {
|
|
1387
|
-
const title = `${colors.gray(S_BAR)}
|
|
1388
|
-
${symbol(this.state)} ${opts.message}
|
|
1389
|
-
`;
|
|
1390
|
-
switch (this.state) {
|
|
1391
|
-
case "submit": {
|
|
1392
|
-
return `${title}${colors.gray(S_BAR)} ${opt(
|
|
1393
|
-
this.options[this.cursor],
|
|
1394
|
-
"selected"
|
|
1395
|
-
)}`;
|
|
1396
|
-
}
|
|
1397
|
-
case "cancel": {
|
|
1398
|
-
return `${title}${colors.gray(S_BAR)} ${opt(
|
|
1399
|
-
this.options[this.cursor],
|
|
1400
|
-
"cancelled"
|
|
1401
|
-
)}
|
|
1402
|
-
${colors.gray(S_BAR)}`;
|
|
1403
|
-
}
|
|
1404
|
-
default: {
|
|
1405
|
-
return `${title}${colors.cyan(S_BAR)} ${this.options.map(
|
|
1406
|
-
(option, i) => opt(option, i === this.cursor ? "active" : "inactive")
|
|
1407
|
-
).join(`
|
|
1408
|
-
${colors.cyan(S_BAR)} `)}
|
|
1409
|
-
${colors.cyan(S_BAR_END)}
|
|
1410
|
-
`;
|
|
1411
|
-
}
|
|
1412
|
-
}
|
|
1413
|
-
}
|
|
1414
|
-
}).prompt();
|
|
1415
|
-
};
|
|
1416
|
-
multiselect = (opts) => {
|
|
1417
|
-
const opt = (option, state) => {
|
|
1418
|
-
const label = option.label ?? String(option.value);
|
|
1419
|
-
switch (state) {
|
|
1420
|
-
case "active": {
|
|
1421
|
-
return `${colors.cyan(S_CHECKBOX_ACTIVE)} ${label} ${option.hint ? colors.dim(`(${option.hint})`) : ""}`;
|
|
1422
|
-
}
|
|
1423
|
-
case "selected": {
|
|
1424
|
-
return `${colors.green(S_CHECKBOX_SELECTED)} ${colors.dim(label)}`;
|
|
1425
|
-
}
|
|
1426
|
-
case "cancelled": {
|
|
1427
|
-
return `${colors.strikethrough(colors.dim(label))}`;
|
|
1428
|
-
}
|
|
1429
|
-
case "active-selected": {
|
|
1430
|
-
return `${colors.green(S_CHECKBOX_SELECTED)} ${label} ${option.hint ? colors.dim(`(${option.hint})`) : ""}`;
|
|
1431
|
-
}
|
|
1432
|
-
case "submitted": {
|
|
1433
|
-
return `${colors.dim(label)}`;
|
|
1434
|
-
}
|
|
1435
|
-
}
|
|
1436
|
-
return `${colors.dim(S_CHECKBOX_INACTIVE)} ${colors.dim(label)}`;
|
|
1437
|
-
};
|
|
1438
|
-
return new iD({
|
|
1439
|
-
options: opts.options,
|
|
1440
|
-
initialValues: opts.initialValues,
|
|
1441
|
-
required: opts.required ?? true,
|
|
1442
|
-
cursorAt: opts.cursorAt,
|
|
1443
|
-
validate(selected) {
|
|
1444
|
-
if (this.required && selected.length === 0) {
|
|
1445
|
-
return `Please select at least one option.
|
|
1446
|
-
${colors.reset(
|
|
1447
|
-
colors.dim(
|
|
1448
|
-
`Press ${colors.gray(
|
|
1449
|
-
colors.bgWhite(colors.inverse(" space "))
|
|
1450
|
-
)} to select, ${colors.gray(
|
|
1451
|
-
colors.bgWhite(colors.inverse(" enter "))
|
|
1452
|
-
)} to submit`
|
|
1453
|
-
)
|
|
1454
|
-
)}`;
|
|
1455
|
-
}
|
|
1456
|
-
},
|
|
1457
|
-
render() {
|
|
1458
|
-
const title = `${colors.gray(S_BAR)}
|
|
1459
|
-
${symbol(this.state)} ${opts.message}
|
|
1460
|
-
`;
|
|
1461
|
-
switch (this.state) {
|
|
1462
|
-
case "submit": {
|
|
1463
|
-
return `${title}${colors.gray(S_BAR)} ${this.options.filter(({ value }) => this.value.includes(value)).map((option) => opt(option, "submitted")).join(colors.dim(", ")) || colors.dim("none")}`;
|
|
1464
|
-
}
|
|
1465
|
-
case "cancel": {
|
|
1466
|
-
const label = this.options.filter(({ value }) => this.value.includes(value)).map((option) => opt(option, "cancelled")).join(colors.dim(", "));
|
|
1467
|
-
return `${title}${colors.gray(S_BAR)} ${label.trim() ? `${label}
|
|
1468
|
-
${colors.gray(S_BAR)}` : ""}`;
|
|
1469
|
-
}
|
|
1470
|
-
case "error": {
|
|
1471
|
-
const footer = this.error.split("\n").map(
|
|
1472
|
-
(ln, i) => i === 0 ? `${colors.yellow(S_BAR_END)} ${colors.yellow(ln)}` : ` ${ln}`
|
|
1473
|
-
).join("\n");
|
|
1474
|
-
return title + colors.yellow(S_BAR) + " " + this.options.map((option, i) => {
|
|
1475
|
-
const selected = this.value.includes(option.value);
|
|
1476
|
-
const active = i === this.cursor;
|
|
1477
|
-
if (active && selected) {
|
|
1478
|
-
return opt(option, "active-selected");
|
|
1479
|
-
}
|
|
1480
|
-
if (selected) {
|
|
1481
|
-
return opt(option, "selected");
|
|
1482
|
-
}
|
|
1483
|
-
return opt(option, active ? "active" : "inactive");
|
|
1484
|
-
}).join(`
|
|
1485
|
-
${colors.yellow(S_BAR)} `) + "\n" + footer + "\n";
|
|
1486
|
-
}
|
|
1487
|
-
default: {
|
|
1488
|
-
return `${title}${colors.cyan(S_BAR)} ${this.options.map((option, i) => {
|
|
1489
|
-
const selected = this.value.includes(option.value);
|
|
1490
|
-
const active = i === this.cursor;
|
|
1491
|
-
if (active && selected) {
|
|
1492
|
-
return opt(option, "active-selected");
|
|
1493
|
-
}
|
|
1494
|
-
if (selected) {
|
|
1495
|
-
return opt(option, "selected");
|
|
1496
|
-
}
|
|
1497
|
-
return opt(option, active ? "active" : "inactive");
|
|
1498
|
-
}).join(`
|
|
1499
|
-
${colors.cyan(S_BAR)} `)}
|
|
1500
|
-
${colors.cyan(S_BAR_END)}
|
|
1501
|
-
`;
|
|
1502
|
-
}
|
|
1503
|
-
}
|
|
1504
|
-
}
|
|
1505
|
-
}).prompt();
|
|
1506
|
-
};
|
|
1507
|
-
}
|
|
1508
|
-
});
|
|
1509
|
-
|
|
1510
|
-
// ../../node_modules/.pnpm/consola@3.2.3/node_modules/consola/dist/shared/consola.36c0034f.mjs
|
|
1511
|
-
function detectProvider(env2) {
|
|
1512
|
-
for (const provider of providers) {
|
|
1513
|
-
const envName = provider[1] || provider[0];
|
|
1514
|
-
if (env2[envName]) {
|
|
1515
|
-
return {
|
|
1516
|
-
name: provider[0].toLowerCase(),
|
|
1517
|
-
...provider[2]
|
|
1518
|
-
};
|
|
1519
|
-
}
|
|
1520
|
-
}
|
|
1521
|
-
if (env2.SHELL && env2.SHELL === "/bin/jsh") {
|
|
1522
|
-
return {
|
|
1523
|
-
name: "stackblitz",
|
|
1524
|
-
ci: false
|
|
1525
|
-
};
|
|
1526
|
-
}
|
|
1527
|
-
return {
|
|
1528
|
-
name: "",
|
|
1529
|
-
ci: false
|
|
1530
|
-
};
|
|
1531
|
-
}
|
|
1532
|
-
function toBoolean(val) {
|
|
1533
|
-
return val ? val !== "false" : false;
|
|
1534
|
-
}
|
|
1535
|
-
function ansiRegex2({ onlyFirst = false } = {}) {
|
|
1536
|
-
const pattern = [
|
|
1537
|
-
"[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)",
|
|
1538
|
-
"(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"
|
|
1539
|
-
].join("|");
|
|
1540
|
-
return new RegExp(pattern, onlyFirst ? void 0 : "g");
|
|
1541
|
-
}
|
|
1542
|
-
function stripAnsi2(string) {
|
|
1543
|
-
if (typeof string !== "string") {
|
|
1544
|
-
throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
|
|
1545
|
-
}
|
|
1546
|
-
return string.replace(regex, "");
|
|
1547
|
-
}
|
|
1548
|
-
function getDefaultExportFromCjs(x) {
|
|
1549
|
-
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
1550
|
-
}
|
|
1551
|
-
function stringWidth$1(string, options) {
|
|
1552
|
-
if (typeof string !== "string" || string.length === 0) {
|
|
1553
|
-
return 0;
|
|
1554
|
-
}
|
|
1555
|
-
options = {
|
|
1556
|
-
ambiguousIsNarrow: true,
|
|
1557
|
-
countAnsiEscapeCodes: false,
|
|
1558
|
-
...options
|
|
1559
|
-
};
|
|
1560
|
-
if (!options.countAnsiEscapeCodes) {
|
|
1561
|
-
string = stripAnsi2(string);
|
|
1562
|
-
}
|
|
1563
|
-
if (string.length === 0) {
|
|
1564
|
-
return 0;
|
|
1565
|
-
}
|
|
1566
|
-
const ambiguousCharacterWidth = options.ambiguousIsNarrow ? 1 : 2;
|
|
1567
|
-
let width = 0;
|
|
1568
|
-
for (const { segment: character } of new Intl.Segmenter().segment(string)) {
|
|
1569
|
-
const codePoint = character.codePointAt(0);
|
|
1570
|
-
if (codePoint <= 31 || codePoint >= 127 && codePoint <= 159) {
|
|
1571
|
-
continue;
|
|
1572
|
-
}
|
|
1573
|
-
if (codePoint >= 768 && codePoint <= 879) {
|
|
1574
|
-
continue;
|
|
1575
|
-
}
|
|
1576
|
-
if (emojiRegex().test(character)) {
|
|
1577
|
-
width += 2;
|
|
1578
|
-
continue;
|
|
1579
|
-
}
|
|
1580
|
-
const code = eastAsianWidth.eastAsianWidth(character);
|
|
1581
|
-
switch (code) {
|
|
1582
|
-
case "F":
|
|
1583
|
-
case "W": {
|
|
1584
|
-
width += 2;
|
|
1585
|
-
break;
|
|
1586
|
-
}
|
|
1587
|
-
case "A": {
|
|
1588
|
-
width += ambiguousCharacterWidth;
|
|
1589
|
-
break;
|
|
1590
|
-
}
|
|
1591
|
-
default: {
|
|
1592
|
-
width += 1;
|
|
1593
|
-
}
|
|
1594
|
-
}
|
|
1595
|
-
}
|
|
1596
|
-
return width;
|
|
1597
|
-
}
|
|
1598
|
-
function isUnicodeSupported() {
|
|
1599
|
-
if (import_node_process2.default.platform !== "win32") {
|
|
1600
|
-
return import_node_process2.default.env.TERM !== "linux";
|
|
1601
|
-
}
|
|
1602
|
-
return Boolean(import_node_process2.default.env.CI) || Boolean(import_node_process2.default.env.WT_SESSION) || Boolean(import_node_process2.default.env.TERMINUS_SUBLIME) || import_node_process2.default.env.ConEmuTask === "{cmd::Cmder}" || import_node_process2.default.env.TERM_PROGRAM === "Terminus-Sublime" || import_node_process2.default.env.TERM_PROGRAM === "vscode" || import_node_process2.default.env.TERM === "xterm-256color" || import_node_process2.default.env.TERM === "alacritty" || import_node_process2.default.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
1603
|
-
}
|
|
1604
|
-
function stringWidth(str) {
|
|
1605
|
-
if (!Intl.Segmenter) {
|
|
1606
|
-
return stripAnsi(str).length;
|
|
1607
|
-
}
|
|
1608
|
-
return stringWidth$1(str);
|
|
1609
|
-
}
|
|
1610
|
-
function characterFormat(str) {
|
|
1611
|
-
return str.replace(/`([^`]+)`/gm, (_2, m2) => colors.cyan(m2)).replace(/\s+_([^_]+)_\s+/gm, (_2, m2) => ` ${colors.underline(m2)} `);
|
|
1612
|
-
}
|
|
1613
|
-
function getColor2(color = "white") {
|
|
1614
|
-
return colors[color] || colors.white;
|
|
1615
|
-
}
|
|
1616
|
-
function getBgColor(color = "bgWhite") {
|
|
1617
|
-
return colors[`bg${color[0].toUpperCase()}${color.slice(1)}`] || colors.bgWhite;
|
|
1618
|
-
}
|
|
1619
|
-
function createConsola2(options = {}) {
|
|
1620
|
-
let level = _getDefaultLogLevel();
|
|
1621
|
-
if (process.env.CONSOLA_LEVEL) {
|
|
1622
|
-
level = Number.parseInt(process.env.CONSOLA_LEVEL) ?? level;
|
|
1623
|
-
}
|
|
1624
|
-
const consola2 = createConsola({
|
|
1625
|
-
level,
|
|
1626
|
-
defaults: { level },
|
|
1627
|
-
stdout: process.stdout,
|
|
1628
|
-
stderr: process.stderr,
|
|
1629
|
-
prompt: (...args) => Promise.resolve().then(() => (init_prompt(), prompt_exports)).then((m2) => m2.prompt(...args)),
|
|
1630
|
-
reporters: options.reporters || [
|
|
1631
|
-
options.fancy ?? !(isCI2 || isTest) ? new FancyReporter() : new BasicReporter()
|
|
1632
|
-
],
|
|
1633
|
-
...options
|
|
1634
|
-
});
|
|
1635
|
-
return consola2;
|
|
1636
|
-
}
|
|
1637
|
-
function _getDefaultLogLevel() {
|
|
1638
|
-
if (isDebug) {
|
|
1639
|
-
return LogLevels.debug;
|
|
1640
|
-
}
|
|
1641
|
-
if (isTest) {
|
|
1642
|
-
return LogLevels.warn;
|
|
1643
|
-
}
|
|
1644
|
-
return LogLevels.info;
|
|
1645
|
-
}
|
|
1646
|
-
var import_node_process2, providers, processShim, envShim, providerInfo, nodeENV, isCI2, hasTTY, isDebug, isTest, regex, eastasianwidth, eastasianwidthExports, eastAsianWidth, emojiRegex, TYPE_COLOR_MAP, LEVEL_COLOR_MAP, unicode2, s2, TYPE_ICONS, FancyReporter, consola;
|
|
1647
|
-
var init_consola_36c0034f = __esm({
|
|
1648
|
-
"../../node_modules/.pnpm/consola@3.2.3/node_modules/consola/dist/shared/consola.36c0034f.mjs"() {
|
|
1649
|
-
"use strict";
|
|
1650
|
-
init_core();
|
|
1651
|
-
init_consola_06ad8a64();
|
|
1652
|
-
import_node_process2 = __toESM(require("process"), 1);
|
|
1653
|
-
init_utils();
|
|
1654
|
-
providers = [
|
|
1655
|
-
["APPVEYOR"],
|
|
1656
|
-
["AZURE_PIPELINES", "SYSTEM_TEAMFOUNDATIONCOLLECTIONURI"],
|
|
1657
|
-
["AZURE_STATIC", "INPUT_AZURE_STATIC_WEB_APPS_API_TOKEN"],
|
|
1658
|
-
["APPCIRCLE", "AC_APPCIRCLE"],
|
|
1659
|
-
["BAMBOO", "bamboo_planKey"],
|
|
1660
|
-
["BITBUCKET", "BITBUCKET_COMMIT"],
|
|
1661
|
-
["BITRISE", "BITRISE_IO"],
|
|
1662
|
-
["BUDDY", "BUDDY_WORKSPACE_ID"],
|
|
1663
|
-
["BUILDKITE"],
|
|
1664
|
-
["CIRCLE", "CIRCLECI"],
|
|
1665
|
-
["CIRRUS", "CIRRUS_CI"],
|
|
1666
|
-
["CLOUDFLARE_PAGES", "CF_PAGES", { ci: true }],
|
|
1667
|
-
["CODEBUILD", "CODEBUILD_BUILD_ARN"],
|
|
1668
|
-
["CODEFRESH", "CF_BUILD_ID"],
|
|
1669
|
-
["DRONE"],
|
|
1670
|
-
["DRONE", "DRONE_BUILD_EVENT"],
|
|
1671
|
-
["DSARI"],
|
|
1672
|
-
["GITHUB_ACTIONS"],
|
|
1673
|
-
["GITLAB", "GITLAB_CI"],
|
|
1674
|
-
["GITLAB", "CI_MERGE_REQUEST_ID"],
|
|
1675
|
-
["GOCD", "GO_PIPELINE_LABEL"],
|
|
1676
|
-
["LAYERCI"],
|
|
1677
|
-
["HUDSON", "HUDSON_URL"],
|
|
1678
|
-
["JENKINS", "JENKINS_URL"],
|
|
1679
|
-
["MAGNUM"],
|
|
1680
|
-
["NETLIFY"],
|
|
1681
|
-
["NETLIFY", "NETLIFY_LOCAL", { ci: false }],
|
|
1682
|
-
["NEVERCODE"],
|
|
1683
|
-
["RENDER"],
|
|
1684
|
-
["SAIL", "SAILCI"],
|
|
1685
|
-
["SEMAPHORE"],
|
|
1686
|
-
["SCREWDRIVER"],
|
|
1687
|
-
["SHIPPABLE"],
|
|
1688
|
-
["SOLANO", "TDDIUM"],
|
|
1689
|
-
["STRIDER"],
|
|
1690
|
-
["TEAMCITY", "TEAMCITY_VERSION"],
|
|
1691
|
-
["TRAVIS"],
|
|
1692
|
-
["VERCEL", "NOW_BUILDER"],
|
|
1693
|
-
["APPCENTER", "APPCENTER_BUILD_ID"],
|
|
1694
|
-
["CODESANDBOX", "CODESANDBOX_SSE", { ci: false }],
|
|
1695
|
-
["STACKBLITZ"],
|
|
1696
|
-
["STORMKIT"],
|
|
1697
|
-
["CLEAVR"]
|
|
1698
|
-
];
|
|
1699
|
-
processShim = typeof process !== "undefined" ? process : {};
|
|
1700
|
-
envShim = processShim.env || {};
|
|
1701
|
-
providerInfo = detectProvider(envShim);
|
|
1702
|
-
nodeENV = typeof process !== "undefined" && process.env && process.env.NODE_ENV || "";
|
|
1703
|
-
processShim.platform;
|
|
1704
|
-
providerInfo.name;
|
|
1705
|
-
isCI2 = toBoolean(envShim.CI) || providerInfo.ci !== false;
|
|
1706
|
-
hasTTY = toBoolean(processShim.stdout && processShim.stdout.isTTY);
|
|
1707
|
-
isDebug = toBoolean(envShim.DEBUG);
|
|
1708
|
-
isTest = nodeENV === "test" || toBoolean(envShim.TEST);
|
|
1709
|
-
toBoolean(envShim.MINIMAL) || isCI2 || isTest || !hasTTY;
|
|
1710
|
-
regex = ansiRegex2();
|
|
1711
|
-
eastasianwidth = { exports: {} };
|
|
1712
|
-
(function(module2) {
|
|
1713
|
-
var eaw = {};
|
|
1714
|
-
{
|
|
1715
|
-
module2.exports = eaw;
|
|
1716
|
-
}
|
|
1717
|
-
eaw.eastAsianWidth = function(character) {
|
|
1718
|
-
var x = character.charCodeAt(0);
|
|
1719
|
-
var y = character.length == 2 ? character.charCodeAt(1) : 0;
|
|
1720
|
-
var codePoint = x;
|
|
1721
|
-
if (55296 <= x && x <= 56319 && (56320 <= y && y <= 57343)) {
|
|
1722
|
-
x &= 1023;
|
|
1723
|
-
y &= 1023;
|
|
1724
|
-
codePoint = x << 10 | y;
|
|
1725
|
-
codePoint += 65536;
|
|
1726
|
-
}
|
|
1727
|
-
if (12288 == codePoint || 65281 <= codePoint && codePoint <= 65376 || 65504 <= codePoint && codePoint <= 65510) {
|
|
1728
|
-
return "F";
|
|
1729
|
-
}
|
|
1730
|
-
if (8361 == codePoint || 65377 <= codePoint && codePoint <= 65470 || 65474 <= codePoint && codePoint <= 65479 || 65482 <= codePoint && codePoint <= 65487 || 65490 <= codePoint && codePoint <= 65495 || 65498 <= codePoint && codePoint <= 65500 || 65512 <= codePoint && codePoint <= 65518) {
|
|
1731
|
-
return "H";
|
|
1732
|
-
}
|
|
1733
|
-
if (4352 <= codePoint && codePoint <= 4447 || 4515 <= codePoint && codePoint <= 4519 || 4602 <= codePoint && codePoint <= 4607 || 9001 <= codePoint && codePoint <= 9002 || 11904 <= codePoint && codePoint <= 11929 || 11931 <= codePoint && codePoint <= 12019 || 12032 <= codePoint && codePoint <= 12245 || 12272 <= codePoint && codePoint <= 12283 || 12289 <= codePoint && codePoint <= 12350 || 12353 <= codePoint && codePoint <= 12438 || 12441 <= codePoint && codePoint <= 12543 || 12549 <= codePoint && codePoint <= 12589 || 12593 <= codePoint && codePoint <= 12686 || 12688 <= codePoint && codePoint <= 12730 || 12736 <= codePoint && codePoint <= 12771 || 12784 <= codePoint && codePoint <= 12830 || 12832 <= codePoint && codePoint <= 12871 || 12880 <= codePoint && codePoint <= 13054 || 13056 <= codePoint && codePoint <= 19903 || 19968 <= codePoint && codePoint <= 42124 || 42128 <= codePoint && codePoint <= 42182 || 43360 <= codePoint && codePoint <= 43388 || 44032 <= codePoint && codePoint <= 55203 || 55216 <= codePoint && codePoint <= 55238 || 55243 <= codePoint && codePoint <= 55291 || 63744 <= codePoint && codePoint <= 64255 || 65040 <= codePoint && codePoint <= 65049 || 65072 <= codePoint && codePoint <= 65106 || 65108 <= codePoint && codePoint <= 65126 || 65128 <= codePoint && codePoint <= 65131 || 110592 <= codePoint && codePoint <= 110593 || 127488 <= codePoint && codePoint <= 127490 || 127504 <= codePoint && codePoint <= 127546 || 127552 <= codePoint && codePoint <= 127560 || 127568 <= codePoint && codePoint <= 127569 || 131072 <= codePoint && codePoint <= 194367 || 177984 <= codePoint && codePoint <= 196605 || 196608 <= codePoint && codePoint <= 262141) {
|
|
1734
|
-
return "W";
|
|
1735
|
-
}
|
|
1736
|
-
if (32 <= codePoint && codePoint <= 126 || 162 <= codePoint && codePoint <= 163 || 165 <= codePoint && codePoint <= 166 || 172 == codePoint || 175 == codePoint || 10214 <= codePoint && codePoint <= 10221 || 10629 <= codePoint && codePoint <= 10630) {
|
|
1737
|
-
return "Na";
|
|
1738
|
-
}
|
|
1739
|
-
if (161 == codePoint || 164 == codePoint || 167 <= codePoint && codePoint <= 168 || 170 == codePoint || 173 <= codePoint && codePoint <= 174 || 176 <= codePoint && codePoint <= 180 || 182 <= codePoint && codePoint <= 186 || 188 <= codePoint && codePoint <= 191 || 198 == codePoint || 208 == codePoint || 215 <= codePoint && codePoint <= 216 || 222 <= codePoint && codePoint <= 225 || 230 == codePoint || 232 <= codePoint && codePoint <= 234 || 236 <= codePoint && codePoint <= 237 || 240 == codePoint || 242 <= codePoint && codePoint <= 243 || 247 <= codePoint && codePoint <= 250 || 252 == codePoint || 254 == codePoint || 257 == codePoint || 273 == codePoint || 275 == codePoint || 283 == codePoint || 294 <= codePoint && codePoint <= 295 || 299 == codePoint || 305 <= codePoint && codePoint <= 307 || 312 == codePoint || 319 <= codePoint && codePoint <= 322 || 324 == codePoint || 328 <= codePoint && codePoint <= 331 || 333 == codePoint || 338 <= codePoint && codePoint <= 339 || 358 <= codePoint && codePoint <= 359 || 363 == codePoint || 462 == codePoint || 464 == codePoint || 466 == codePoint || 468 == codePoint || 470 == codePoint || 472 == codePoint || 474 == codePoint || 476 == codePoint || 593 == codePoint || 609 == codePoint || 708 == codePoint || 711 == codePoint || 713 <= codePoint && codePoint <= 715 || 717 == codePoint || 720 == codePoint || 728 <= codePoint && codePoint <= 731 || 733 == codePoint || 735 == codePoint || 768 <= codePoint && codePoint <= 879 || 913 <= codePoint && codePoint <= 929 || 931 <= codePoint && codePoint <= 937 || 945 <= codePoint && codePoint <= 961 || 963 <= codePoint && codePoint <= 969 || 1025 == codePoint || 1040 <= codePoint && codePoint <= 1103 || 1105 == codePoint || 8208 == codePoint || 8211 <= codePoint && codePoint <= 8214 || 8216 <= codePoint && codePoint <= 8217 || 8220 <= codePoint && codePoint <= 8221 || 8224 <= codePoint && codePoint <= 8226 || 8228 <= codePoint && codePoint <= 8231 || 8240 == codePoint || 8242 <= codePoint && codePoint <= 8243 || 8245 == codePoint || 8251 == codePoint || 8254 == codePoint || 8308 == codePoint || 8319 == codePoint || 8321 <= codePoint && codePoint <= 8324 || 8364 == codePoint || 8451 == codePoint || 8453 == codePoint || 8457 == codePoint || 8467 == codePoint || 8470 == codePoint || 8481 <= codePoint && codePoint <= 8482 || 8486 == codePoint || 8491 == codePoint || 8531 <= codePoint && codePoint <= 8532 || 8539 <= codePoint && codePoint <= 8542 || 8544 <= codePoint && codePoint <= 8555 || 8560 <= codePoint && codePoint <= 8569 || 8585 == codePoint || 8592 <= codePoint && codePoint <= 8601 || 8632 <= codePoint && codePoint <= 8633 || 8658 == codePoint || 8660 == codePoint || 8679 == codePoint || 8704 == codePoint || 8706 <= codePoint && codePoint <= 8707 || 8711 <= codePoint && codePoint <= 8712 || 8715 == codePoint || 8719 == codePoint || 8721 == codePoint || 8725 == codePoint || 8730 == codePoint || 8733 <= codePoint && codePoint <= 8736 || 8739 == codePoint || 8741 == codePoint || 8743 <= codePoint && codePoint <= 8748 || 8750 == codePoint || 8756 <= codePoint && codePoint <= 8759 || 8764 <= codePoint && codePoint <= 8765 || 8776 == codePoint || 8780 == codePoint || 8786 == codePoint || 8800 <= codePoint && codePoint <= 8801 || 8804 <= codePoint && codePoint <= 8807 || 8810 <= codePoint && codePoint <= 8811 || 8814 <= codePoint && codePoint <= 8815 || 8834 <= codePoint && codePoint <= 8835 || 8838 <= codePoint && codePoint <= 8839 || 8853 == codePoint || 8857 == codePoint || 8869 == codePoint || 8895 == codePoint || 8978 == codePoint || 9312 <= codePoint && codePoint <= 9449 || 9451 <= codePoint && codePoint <= 9547 || 9552 <= codePoint && codePoint <= 9587 || 9600 <= codePoint && codePoint <= 9615 || 9618 <= codePoint && codePoint <= 9621 || 9632 <= codePoint && codePoint <= 9633 || 9635 <= codePoint && codePoint <= 9641 || 9650 <= codePoint && codePoint <= 9651 || 9654 <= codePoint && codePoint <= 9655 || 9660 <= codePoint && codePoint <= 9661 || 9664 <= codePoint && codePoint <= 9665 || 9670 <= codePoint && codePoint <= 9672 || 9675 == codePoint || 9678 <= codePoint && codePoint <= 9681 || 9698 <= codePoint && codePoint <= 9701 || 9711 == codePoint || 9733 <= codePoint && codePoint <= 9734 || 9737 == codePoint || 9742 <= codePoint && codePoint <= 9743 || 9748 <= codePoint && codePoint <= 9749 || 9756 == codePoint || 9758 == codePoint || 9792 == codePoint || 9794 == codePoint || 9824 <= codePoint && codePoint <= 9825 || 9827 <= codePoint && codePoint <= 9829 || 9831 <= codePoint && codePoint <= 9834 || 9836 <= codePoint && codePoint <= 9837 || 9839 == codePoint || 9886 <= codePoint && codePoint <= 9887 || 9918 <= codePoint && codePoint <= 9919 || 9924 <= codePoint && codePoint <= 9933 || 9935 <= codePoint && codePoint <= 9953 || 9955 == codePoint || 9960 <= codePoint && codePoint <= 9983 || 10045 == codePoint || 10071 == codePoint || 10102 <= codePoint && codePoint <= 10111 || 11093 <= codePoint && codePoint <= 11097 || 12872 <= codePoint && codePoint <= 12879 || 57344 <= codePoint && codePoint <= 63743 || 65024 <= codePoint && codePoint <= 65039 || 65533 == codePoint || 127232 <= codePoint && codePoint <= 127242 || 127248 <= codePoint && codePoint <= 127277 || 127280 <= codePoint && codePoint <= 127337 || 127344 <= codePoint && codePoint <= 127386 || 917760 <= codePoint && codePoint <= 917999 || 983040 <= codePoint && codePoint <= 1048573 || 1048576 <= codePoint && codePoint <= 1114109) {
|
|
1740
|
-
return "A";
|
|
1741
|
-
}
|
|
1742
|
-
return "N";
|
|
1743
|
-
};
|
|
1744
|
-
eaw.characterLength = function(character) {
|
|
1745
|
-
var code = this.eastAsianWidth(character);
|
|
1746
|
-
if (code == "F" || code == "W" || code == "A") {
|
|
1747
|
-
return 2;
|
|
1748
|
-
} else {
|
|
1749
|
-
return 1;
|
|
1750
|
-
}
|
|
1751
|
-
};
|
|
1752
|
-
function stringToArray(string) {
|
|
1753
|
-
return string.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g) || [];
|
|
1754
|
-
}
|
|
1755
|
-
eaw.length = function(string) {
|
|
1756
|
-
var characters = stringToArray(string);
|
|
1757
|
-
var len = 0;
|
|
1758
|
-
for (var i = 0; i < characters.length; i++) {
|
|
1759
|
-
len = len + this.characterLength(characters[i]);
|
|
1760
|
-
}
|
|
1761
|
-
return len;
|
|
1762
|
-
};
|
|
1763
|
-
eaw.slice = function(text2, start, end) {
|
|
1764
|
-
textLen = eaw.length(text2);
|
|
1765
|
-
start = start ? start : 0;
|
|
1766
|
-
end = end ? end : 1;
|
|
1767
|
-
if (start < 0) {
|
|
1768
|
-
start = textLen + start;
|
|
1769
|
-
}
|
|
1770
|
-
if (end < 0) {
|
|
1771
|
-
end = textLen + end;
|
|
1772
|
-
}
|
|
1773
|
-
var result = "";
|
|
1774
|
-
var eawLen = 0;
|
|
1775
|
-
var chars = stringToArray(text2);
|
|
1776
|
-
for (var i = 0; i < chars.length; i++) {
|
|
1777
|
-
var char = chars[i];
|
|
1778
|
-
var charLen = eaw.length(char);
|
|
1779
|
-
if (eawLen >= start - (charLen == 2 ? 1 : 0)) {
|
|
1780
|
-
if (eawLen + charLen <= end) {
|
|
1781
|
-
result += char;
|
|
1782
|
-
} else {
|
|
1783
|
-
break;
|
|
1784
|
-
}
|
|
1785
|
-
}
|
|
1786
|
-
eawLen += charLen;
|
|
1787
|
-
}
|
|
1788
|
-
return result;
|
|
1789
|
-
};
|
|
1790
|
-
})(eastasianwidth);
|
|
1791
|
-
eastasianwidthExports = eastasianwidth.exports;
|
|
1792
|
-
eastAsianWidth = /* @__PURE__ */ getDefaultExportFromCjs(eastasianwidthExports);
|
|
1793
|
-
emojiRegex = () => {
|
|
1794
|
-
return /[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26F9(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC3\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC08\uDC26](?:\u200D\u2B1B)?|[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE])))?))?|\uDC6F(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDD75(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE88\uDE90-\uDEBD\uDEBF-\uDEC2\uDECE-\uDEDB\uDEE0-\uDEE8]|\uDD3C(?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF])?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g;
|
|
1795
|
-
};
|
|
1796
|
-
TYPE_COLOR_MAP = {
|
|
1797
|
-
info: "cyan",
|
|
1798
|
-
fail: "red",
|
|
1799
|
-
success: "green",
|
|
1800
|
-
ready: "green",
|
|
1801
|
-
start: "magenta"
|
|
1802
|
-
};
|
|
1803
|
-
LEVEL_COLOR_MAP = {
|
|
1804
|
-
0: "red",
|
|
1805
|
-
1: "yellow"
|
|
1806
|
-
};
|
|
1807
|
-
unicode2 = isUnicodeSupported();
|
|
1808
|
-
s2 = (c2, fallback) => unicode2 ? c2 : fallback;
|
|
1809
|
-
TYPE_ICONS = {
|
|
1810
|
-
error: s2("\u2716", "\xD7"),
|
|
1811
|
-
fatal: s2("\u2716", "\xD7"),
|
|
1812
|
-
ready: s2("\u2714", "\u221A"),
|
|
1813
|
-
warn: s2("\u26A0", "\u203C"),
|
|
1814
|
-
info: s2("\u2139", "i"),
|
|
1815
|
-
success: s2("\u2714", "\u221A"),
|
|
1816
|
-
debug: s2("\u2699", "D"),
|
|
1817
|
-
trace: s2("\u2192", "\u2192"),
|
|
1818
|
-
fail: s2("\u2716", "\xD7"),
|
|
1819
|
-
start: s2("\u25D0", "o"),
|
|
1820
|
-
log: ""
|
|
1821
|
-
};
|
|
1822
|
-
FancyReporter = class extends BasicReporter {
|
|
1823
|
-
formatStack(stack) {
|
|
1824
|
-
return "\n" + parseStack(stack).map(
|
|
1825
|
-
(line) => " " + line.replace(/^at +/, (m2) => colors.gray(m2)).replace(/\((.+)\)/, (_2, m2) => `(${colors.cyan(m2)})`)
|
|
1826
|
-
).join("\n");
|
|
1827
|
-
}
|
|
1828
|
-
formatType(logObj, isBadge, opts) {
|
|
1829
|
-
const typeColor = TYPE_COLOR_MAP[logObj.type] || LEVEL_COLOR_MAP[logObj.level] || "gray";
|
|
1830
|
-
if (isBadge) {
|
|
1831
|
-
return getBgColor(typeColor)(
|
|
1832
|
-
colors.black(` ${logObj.type.toUpperCase()} `)
|
|
1833
|
-
);
|
|
1834
|
-
}
|
|
1835
|
-
const _type = typeof TYPE_ICONS[logObj.type] === "string" ? TYPE_ICONS[logObj.type] : logObj.icon || logObj.type;
|
|
1836
|
-
return _type ? getColor2(typeColor)(_type) : "";
|
|
1837
|
-
}
|
|
1838
|
-
formatLogObj(logObj, opts) {
|
|
1839
|
-
const [message, ...additional] = this.formatArgs(logObj.args, opts).split(
|
|
1840
|
-
"\n"
|
|
1841
|
-
);
|
|
1842
|
-
if (logObj.type === "box") {
|
|
1843
|
-
return box(
|
|
1844
|
-
characterFormat(
|
|
1845
|
-
message + (additional.length > 0 ? "\n" + additional.join("\n") : "")
|
|
1846
|
-
),
|
|
1847
|
-
{
|
|
1848
|
-
title: logObj.title ? characterFormat(logObj.title) : void 0,
|
|
1849
|
-
style: logObj.style
|
|
1850
|
-
}
|
|
1851
|
-
);
|
|
1852
|
-
}
|
|
1853
|
-
const date = this.formatDate(logObj.date, opts);
|
|
1854
|
-
const coloredDate = date && colors.gray(date);
|
|
1855
|
-
const isBadge = logObj.badge ?? logObj.level < 2;
|
|
1856
|
-
const type = this.formatType(logObj, isBadge, opts);
|
|
1857
|
-
const tag = logObj.tag ? colors.gray(logObj.tag) : "";
|
|
1858
|
-
let line;
|
|
1859
|
-
const left = this.filterAndJoin([type, characterFormat(message)]);
|
|
1860
|
-
const right = this.filterAndJoin(opts.columns ? [tag, coloredDate] : [tag]);
|
|
1861
|
-
const space = (opts.columns || 0) - stringWidth(left) - stringWidth(right) - 2;
|
|
1862
|
-
line = space > 0 && (opts.columns || 0) >= 80 ? left + " ".repeat(space) + right : (right ? `${colors.gray(`[${right}]`)} ` : "") + left;
|
|
1863
|
-
line += characterFormat(
|
|
1864
|
-
additional.length > 0 ? "\n" + additional.join("\n") : ""
|
|
1865
|
-
);
|
|
1866
|
-
if (logObj.type === "trace") {
|
|
1867
|
-
const _err = new Error("Trace: " + logObj.message);
|
|
1868
|
-
line += this.formatStack(_err.stack || "");
|
|
1869
|
-
}
|
|
1870
|
-
return isBadge ? "\n" + line + "\n" : line;
|
|
1871
|
-
}
|
|
1872
|
-
};
|
|
1873
|
-
consola = createConsola2();
|
|
1874
|
-
}
|
|
1875
|
-
});
|
|
1876
|
-
|
|
1877
|
-
// src/testing/index.ts
|
|
1878
|
-
var testing_exports = {};
|
|
1879
|
-
__export(testing_exports, {
|
|
1880
|
-
WxtVitest: () => WxtVitest,
|
|
1881
|
-
fakeBrowser: () => import_fake_browser.fakeBrowser
|
|
1882
|
-
});
|
|
1883
|
-
module.exports = __toCommonJS(testing_exports);
|
|
1884
|
-
|
|
1885
|
-
// src/testing/fake-browser.ts
|
|
1886
|
-
var import_fake_browser = require("@webext-core/fake-browser");
|
|
1887
|
-
|
|
1888
|
-
// src/core/utils/entrypoints.ts
|
|
1889
|
-
var import_node_path2 = __toESM(require("path"), 1);
|
|
1890
|
-
|
|
1891
|
-
// src/core/utils/paths.ts
|
|
1892
|
-
var import_node_path = __toESM(require("path"), 1);
|
|
1893
|
-
var import_normalize_path = __toESM(require("normalize-path"), 1);
|
|
1894
|
-
function normalizePath(path8) {
|
|
1895
|
-
return (0, import_normalize_path.default)(path8);
|
|
1896
|
-
}
|
|
1897
|
-
var CSS_EXTENSIONS = ["css", "scss", "sass", "less", "styl", "stylus"];
|
|
1898
|
-
var CSS_EXTENSIONS_PATTERN = `+(${CSS_EXTENSIONS.join("|")})`;
|
|
1899
|
-
|
|
1900
|
-
// src/core/builders/vite/plugins/devHtmlPrerender.ts
|
|
1901
|
-
var import_linkedom = require("linkedom");
|
|
1902
|
-
var import_node_path3 = require("path");
|
|
1903
|
-
var import_ohash = require("ohash");
|
|
1904
|
-
|
|
1905
|
-
// src/core/utils/network.ts
|
|
1906
|
-
var import_node_dns = __toESM(require("dns"), 1);
|
|
1907
|
-
|
|
1908
|
-
// src/core/utils/time.ts
|
|
1909
|
-
function withTimeout(promise, duration) {
|
|
1910
|
-
return new Promise((res, rej) => {
|
|
1911
|
-
const timeout = setTimeout(() => {
|
|
1912
|
-
rej(`Promise timed out after ${duration}ms`);
|
|
1913
|
-
}, duration);
|
|
1914
|
-
promise.then(res).catch(rej).finally(() => clearTimeout(timeout));
|
|
1915
|
-
});
|
|
1916
|
-
}
|
|
1917
|
-
|
|
1918
|
-
// src/core/utils/network.ts
|
|
1919
|
-
function isOffline() {
|
|
1920
|
-
const isOffline2 = new Promise((res) => {
|
|
1921
|
-
import_node_dns.default.resolve("google.com", (err) => {
|
|
1922
|
-
if (err == null) {
|
|
1923
|
-
res(false);
|
|
1924
|
-
} else {
|
|
1925
|
-
res(true);
|
|
1926
|
-
}
|
|
1927
|
-
});
|
|
1928
|
-
});
|
|
1929
|
-
return withTimeout(isOffline2, 1e3).catch(() => true);
|
|
1930
|
-
}
|
|
1931
|
-
async function isOnline() {
|
|
1932
|
-
const offline = await isOffline();
|
|
1933
|
-
return !offline;
|
|
1934
|
-
}
|
|
1935
|
-
async function fetchCached(url, config) {
|
|
1936
|
-
let content = "";
|
|
1937
|
-
if (await isOnline()) {
|
|
1938
|
-
const res = await fetch(url);
|
|
1939
|
-
if (res.status < 300) {
|
|
1940
|
-
content = await res.text();
|
|
1941
|
-
await config.fsCache.set(url, content);
|
|
1942
|
-
} else {
|
|
1943
|
-
config.logger.debug(
|
|
1944
|
-
`Failed to download "${url}", falling back to cache...`
|
|
1945
|
-
);
|
|
1946
|
-
}
|
|
1947
|
-
}
|
|
1948
|
-
if (!content) content = await config.fsCache.get(url) ?? "";
|
|
1949
|
-
if (!content)
|
|
1950
|
-
throw Error(
|
|
1951
|
-
`Offline and "${url}" has not been cached. Try again when online.`
|
|
1952
|
-
);
|
|
1953
|
-
return content;
|
|
1954
|
-
}
|
|
1955
|
-
|
|
1956
|
-
// src/core/builders/vite/plugins/download.ts
|
|
1957
|
-
function download(config) {
|
|
1958
|
-
return {
|
|
1959
|
-
name: "wxt:download",
|
|
1960
|
-
resolveId(id) {
|
|
1961
|
-
if (id.startsWith("url:")) return "\0" + id;
|
|
1962
|
-
},
|
|
1963
|
-
async load(id) {
|
|
1964
|
-
if (!id.startsWith("\0url:")) return;
|
|
1965
|
-
const url = id.replace("\0url:", "");
|
|
1966
|
-
return await fetchCached(url, config);
|
|
1967
|
-
}
|
|
1968
|
-
};
|
|
1969
|
-
}
|
|
1970
|
-
|
|
1971
|
-
// src/core/builders/vite/plugins/multipageMove.ts
|
|
1972
|
-
var import_node_path4 = require("path");
|
|
1973
|
-
var import_fs_extra = __toESM(require("fs-extra"), 1);
|
|
1974
|
-
|
|
1975
|
-
// src/core/utils/virtual-modules.ts
|
|
1976
|
-
var virtualEntrypointTypes = [
|
|
1977
|
-
"content-script-main-world",
|
|
1978
|
-
"content-script-isolated-world",
|
|
1979
|
-
"background",
|
|
1980
|
-
"unlisted-script"
|
|
1981
|
-
];
|
|
1982
|
-
var virtualEntrypointModuleNames = virtualEntrypointTypes.map(
|
|
1983
|
-
(name) => `${name}-entrypoint`
|
|
1984
|
-
);
|
|
1985
|
-
var virtualModuleNames = [
|
|
1986
|
-
...virtualEntrypointModuleNames,
|
|
1987
|
-
"mock-browser",
|
|
1988
|
-
"reload-html"
|
|
1989
|
-
];
|
|
1990
|
-
|
|
1991
|
-
// src/core/builders/vite/plugins/resolveVirtualModules.ts
|
|
1992
|
-
var import_fs_extra2 = __toESM(require("fs-extra"), 1);
|
|
1993
|
-
|
|
1994
|
-
// src/core/builders/vite/plugins/tsconfigPaths.ts
|
|
1995
|
-
function tsconfigPaths(config) {
|
|
1996
|
-
return {
|
|
1997
|
-
name: "wxt:aliases",
|
|
1998
|
-
async config() {
|
|
1999
|
-
return {
|
|
2000
|
-
resolve: {
|
|
2001
|
-
alias: config.alias
|
|
2002
|
-
}
|
|
2003
|
-
};
|
|
2004
|
-
}
|
|
2005
|
-
};
|
|
2006
|
-
}
|
|
2007
|
-
|
|
2008
|
-
// src/core/utils/constants.ts
|
|
2009
|
-
var VIRTUAL_NOOP_BACKGROUND_MODULE_ID = "virtual:user-background";
|
|
2010
|
-
|
|
2011
|
-
// src/core/builders/vite/plugins/bundleAnalysis.ts
|
|
2012
|
-
var import_rollup_plugin_visualizer = require("@aklinker1/rollup-plugin-visualizer");
|
|
2013
|
-
var import_node_path5 = __toESM(require("path"), 1);
|
|
2014
|
-
|
|
2015
|
-
// src/core/utils/globals.ts
|
|
2016
|
-
function getGlobals(config) {
|
|
2017
|
-
return [
|
|
2018
|
-
{
|
|
2019
|
-
name: "MANIFEST_VERSION",
|
|
2020
|
-
value: config.manifestVersion,
|
|
2021
|
-
type: `2 | 3`
|
|
2022
|
-
},
|
|
2023
|
-
{
|
|
2024
|
-
name: "BROWSER",
|
|
2025
|
-
value: config.browser,
|
|
2026
|
-
type: `string`
|
|
2027
|
-
},
|
|
2028
|
-
{
|
|
2029
|
-
name: "CHROME",
|
|
2030
|
-
value: config.browser === "chrome",
|
|
2031
|
-
type: `boolean`
|
|
2032
|
-
},
|
|
2033
|
-
{
|
|
2034
|
-
name: "FIREFOX",
|
|
2035
|
-
value: config.browser === "firefox",
|
|
2036
|
-
type: `boolean`
|
|
2037
|
-
},
|
|
2038
|
-
{
|
|
2039
|
-
name: "SAFARI",
|
|
2040
|
-
value: config.browser === "safari",
|
|
2041
|
-
type: `boolean`
|
|
2042
|
-
},
|
|
2043
|
-
{
|
|
2044
|
-
name: "EDGE",
|
|
2045
|
-
value: config.browser === "edge",
|
|
2046
|
-
type: `boolean`
|
|
2047
|
-
},
|
|
2048
|
-
{
|
|
2049
|
-
name: "OPERA",
|
|
2050
|
-
value: config.browser === "opera",
|
|
2051
|
-
type: `boolean`
|
|
2052
|
-
},
|
|
2053
|
-
{
|
|
2054
|
-
name: "COMMAND",
|
|
2055
|
-
value: config.command,
|
|
2056
|
-
type: `"build" | "serve"`
|
|
2057
|
-
}
|
|
2058
|
-
];
|
|
2059
|
-
}
|
|
2060
|
-
|
|
2061
|
-
// src/core/builders/vite/plugins/globals.ts
|
|
2062
|
-
function globals(config) {
|
|
2063
|
-
return {
|
|
2064
|
-
name: "wxt:globals",
|
|
2065
|
-
config() {
|
|
2066
|
-
const define = {};
|
|
2067
|
-
for (const global of getGlobals(config)) {
|
|
2068
|
-
define[`import.meta.env.${global.name}`] = JSON.stringify(global.value);
|
|
2069
|
-
}
|
|
2070
|
-
return {
|
|
2071
|
-
define
|
|
2072
|
-
};
|
|
2073
|
-
}
|
|
2074
|
-
};
|
|
2075
|
-
}
|
|
2076
|
-
|
|
2077
|
-
// src/core/builders/vite/plugins/webextensionPolyfillMock.ts
|
|
2078
|
-
var import_node_path6 = __toESM(require("path"), 1);
|
|
2079
|
-
function webextensionPolyfillMock(config) {
|
|
2080
|
-
return {
|
|
2081
|
-
name: "wxt:testing-inline-deps",
|
|
2082
|
-
config() {
|
|
2083
|
-
return {
|
|
2084
|
-
resolve: {
|
|
2085
|
-
alias: {
|
|
2086
|
-
// Alias to use a mocked version of the polyfill
|
|
2087
|
-
"webextension-polyfill": import_node_path6.default.resolve(
|
|
2088
|
-
config.wxtModuleDir,
|
|
2089
|
-
"dist/virtual/mock-browser"
|
|
2090
|
-
)
|
|
2091
|
-
}
|
|
2092
|
-
},
|
|
2093
|
-
ssr: {
|
|
2094
|
-
// Inline all WXT modules
|
|
2095
|
-
noExternal: ["wxt"]
|
|
2096
|
-
}
|
|
2097
|
-
};
|
|
2098
|
-
}
|
|
2099
|
-
};
|
|
2100
|
-
}
|
|
2101
|
-
|
|
2102
|
-
// src/core/utils/transform.ts
|
|
2103
|
-
var import_magicast = require("magicast");
|
|
2104
|
-
|
|
2105
|
-
// src/core/builders/vite/plugins/removeEntrypointMainFunction.ts
|
|
2106
|
-
var import_node_path7 = require("path");
|
|
2107
|
-
|
|
2108
|
-
// src/core/builders/vite/plugins/wxtPluginLoader.ts
|
|
2109
|
-
var import_linkedom2 = require("linkedom");
|
|
2110
|
-
|
|
2111
|
-
// src/core/builders/vite/plugins/resolveAppConfig.ts
|
|
2112
|
-
var import_fs_extra3 = require("fs-extra");
|
|
2113
|
-
var import_node_path8 = require("path");
|
|
2114
|
-
function resolveAppConfig(config) {
|
|
2115
|
-
const virtualModuleId = "virtual:app-config";
|
|
2116
|
-
const resolvedVirtualModuleId = "\0" + virtualModuleId;
|
|
2117
|
-
const appConfigFile = (0, import_node_path8.resolve)(config.srcDir, "app.config.ts");
|
|
2118
|
-
return {
|
|
2119
|
-
name: "wxt:resolve-app-config",
|
|
2120
|
-
config() {
|
|
2121
|
-
return {
|
|
2122
|
-
optimizeDeps: {
|
|
2123
|
-
// Prevent ESBuild from attempting to resolve the virtual module
|
|
2124
|
-
// while optimizing WXT.
|
|
2125
|
-
exclude: [virtualModuleId]
|
|
2126
|
-
}
|
|
2127
|
-
};
|
|
2128
|
-
},
|
|
2129
|
-
async resolveId(id) {
|
|
2130
|
-
if (id !== virtualModuleId) return;
|
|
2131
|
-
return await (0, import_fs_extra3.exists)(appConfigFile) ? appConfigFile : resolvedVirtualModuleId;
|
|
2132
|
-
},
|
|
2133
|
-
load(id) {
|
|
2134
|
-
if (id === resolvedVirtualModuleId) return `export default {}`;
|
|
2135
|
-
}
|
|
2136
|
-
};
|
|
2137
|
-
}
|
|
2138
|
-
|
|
2139
|
-
// src/core/utils/fs.ts
|
|
2140
|
-
var import_fs_extra5 = __toESM(require("fs-extra"), 1);
|
|
2141
|
-
var import_fast_glob2 = __toESM(require("fast-glob"), 1);
|
|
2142
|
-
|
|
2143
|
-
// src/core/wxt.ts
|
|
2144
|
-
var import_hookable = require("hookable");
|
|
2145
|
-
|
|
2146
|
-
// src/core/package-managers/index.ts
|
|
2147
|
-
var import_nypm = require("nypm");
|
|
2148
|
-
|
|
2149
|
-
// src/core/package-managers/npm.ts
|
|
2150
|
-
var import_node_path9 = __toESM(require("path"), 1);
|
|
2151
|
-
var import_fs_extra4 = require("fs-extra");
|
|
2152
|
-
|
|
2153
|
-
// src/core/builders/vite/index.ts
|
|
2154
|
-
var import_server = require("vite-node/server");
|
|
2155
|
-
var import_client = require("vite-node/client");
|
|
2156
|
-
var import_source_map = require("vite-node/source-map");
|
|
2157
|
-
|
|
2158
|
-
// src/modules.ts
|
|
2159
|
-
var vite = __toESM(require("vite"), 1);
|
|
2160
|
-
var import_fast_glob = __toESM(require("fast-glob"), 1);
|
|
2161
|
-
var import_node_path10 = require("path");
|
|
2162
|
-
function defineWxtModule(module2) {
|
|
2163
|
-
if (typeof module2 === "function") return { setup: module2 };
|
|
2164
|
-
return module2;
|
|
2165
|
-
}
|
|
2166
|
-
function addViteConfig(wxt2, viteConfig) {
|
|
2167
|
-
wxt2.hooks.hook("ready", (wxt3) => {
|
|
2168
|
-
const userVite = wxt3.config.vite;
|
|
2169
|
-
wxt3.config.vite = async (env2) => {
|
|
2170
|
-
const fromUser = await userVite(env2);
|
|
2171
|
-
const fromModule = viteConfig(env2) ?? {};
|
|
2172
|
-
return vite.mergeConfig(fromModule, fromUser);
|
|
2173
|
-
};
|
|
2174
|
-
});
|
|
2175
|
-
}
|
|
2176
|
-
|
|
2177
|
-
// src/builtin-modules/unimport.ts
|
|
2178
|
-
var import_unimport = require("unimport");
|
|
2179
|
-
var import_node_path11 = require("path");
|
|
2180
|
-
var unimport_default = defineWxtModule({
|
|
2181
|
-
name: "wxt:built-in:unimport",
|
|
2182
|
-
setup(wxt2) {
|
|
2183
|
-
const options = wxt2.config.imports;
|
|
2184
|
-
if (options === false) return;
|
|
2185
|
-
let unimport;
|
|
2186
|
-
wxt2.hooks.hook("ready", () => {
|
|
2187
|
-
const addModuleImports = (module2) => {
|
|
2188
|
-
if (!module2.imports) return;
|
|
2189
|
-
options.imports ??= [];
|
|
2190
|
-
options.imports.push(...module2.imports);
|
|
2191
|
-
};
|
|
2192
|
-
wxt2.config.builtinModules.forEach(addModuleImports);
|
|
2193
|
-
wxt2.config.userModules.forEach(addModuleImports);
|
|
2194
|
-
});
|
|
2195
|
-
wxt2.hooks.afterEach((event) => {
|
|
2196
|
-
if (event.name === "ready") {
|
|
2197
|
-
unimport = (0, import_unimport.createUnimport)(options);
|
|
2198
|
-
}
|
|
2199
|
-
});
|
|
2200
|
-
wxt2.hooks.hook("prepare:types", async (_2, entries) => {
|
|
2201
|
-
await unimport.init();
|
|
2202
|
-
entries.push(await getImportsDeclarationEntry(unimport));
|
|
2203
|
-
if (options.eslintrc.enabled === false) return;
|
|
2204
|
-
entries.push(
|
|
2205
|
-
await getEslintConfigEntry(unimport, options.eslintrc.enabled, options)
|
|
2206
|
-
);
|
|
2207
|
-
});
|
|
2208
|
-
addViteConfig(wxt2, () => ({
|
|
2209
|
-
plugins: [vitePlugin(unimport)]
|
|
2210
|
-
}));
|
|
2211
|
-
}
|
|
2212
|
-
});
|
|
2213
|
-
function vitePlugin(unimport) {
|
|
2214
|
-
const ENABLED_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
2215
|
-
".js",
|
|
2216
|
-
".jsx",
|
|
2217
|
-
".ts",
|
|
2218
|
-
".tsx",
|
|
2219
|
-
".vue",
|
|
2220
|
-
".svelte"
|
|
2221
|
-
]);
|
|
2222
|
-
return {
|
|
2223
|
-
name: "wxt:unimport",
|
|
2224
|
-
async transform(code, id) {
|
|
2225
|
-
if (id.includes("node_modules")) return;
|
|
2226
|
-
if (!ENABLED_EXTENSIONS.has((0, import_node_path11.extname)(id))) return;
|
|
2227
|
-
const injected = await unimport.injectImports(code, id);
|
|
2228
|
-
return {
|
|
2229
|
-
code: injected.code,
|
|
2230
|
-
map: injected.s.generateMap({ hires: "boundary", source: id })
|
|
2231
|
-
};
|
|
2232
|
-
}
|
|
2233
|
-
};
|
|
2234
|
-
}
|
|
2235
|
-
async function getImportsDeclarationEntry(unimport) {
|
|
2236
|
-
await unimport.init();
|
|
2237
|
-
return {
|
|
2238
|
-
path: "types/imports.d.ts",
|
|
2239
|
-
text: [
|
|
2240
|
-
"// Generated by wxt",
|
|
2241
|
-
await unimport.generateTypeDeclarations(),
|
|
2242
|
-
""
|
|
2243
|
-
].join("\n"),
|
|
2244
|
-
tsReference: true
|
|
2245
|
-
};
|
|
2246
|
-
}
|
|
2247
|
-
async function getEslintConfigEntry(unimport, version2, options) {
|
|
2248
|
-
const globals2 = (await unimport.getImports()).map((i) => i.as ?? i.name).filter(Boolean).sort().reduce((globals3, name) => {
|
|
2249
|
-
globals3[name] = options.eslintrc.globalsPropValue;
|
|
2250
|
-
return globals3;
|
|
2251
|
-
}, {});
|
|
2252
|
-
if (version2 <= 8) return getEslint8ConfigEntry(options, globals2);
|
|
2253
|
-
else return getEslint9ConfigEntry(options, globals2);
|
|
2254
|
-
}
|
|
2255
|
-
function getEslint8ConfigEntry(options, globals2) {
|
|
2256
|
-
return {
|
|
2257
|
-
path: options.eslintrc.filePath,
|
|
2258
|
-
text: JSON.stringify({ globals: globals2 }, null, 2) + "\n"
|
|
2259
|
-
};
|
|
2260
|
-
}
|
|
2261
|
-
function getEslint9ConfigEntry(options, globals2) {
|
|
2262
|
-
return {
|
|
2263
|
-
path: options.eslintrc.filePath,
|
|
2264
|
-
text: `const globals = ${JSON.stringify(globals2, null, 2)}
|
|
2265
|
-
|
|
2266
|
-
export default {
|
|
2267
|
-
name: "wxt/auto-imports",
|
|
2268
|
-
languageOptions: {
|
|
2269
|
-
globals,
|
|
2270
|
-
sourceType: "module",
|
|
2271
|
-
},
|
|
2272
|
-
};
|
|
2273
|
-
`
|
|
2274
|
-
};
|
|
2275
|
-
}
|
|
2276
|
-
|
|
2277
|
-
// src/builtin-modules/index.ts
|
|
2278
|
-
var builtinModules = [unimport_default];
|
|
2279
|
-
|
|
2280
|
-
// src/core/utils/fs.ts
|
|
2281
|
-
async function writeFileIfDifferent(file, newContents) {
|
|
2282
|
-
const existingContents = await import_fs_extra5.default.readFile(file, "utf-8").catch(() => void 0);
|
|
2283
|
-
if (existingContents !== newContents) {
|
|
2284
|
-
await import_fs_extra5.default.writeFile(file, newContents);
|
|
2285
|
-
}
|
|
2286
|
-
}
|
|
2287
|
-
|
|
2288
|
-
// src/core/utils/building/build-entrypoints.ts
|
|
2289
|
-
var import_fs_extra6 = __toESM(require("fs-extra"), 1);
|
|
2290
|
-
var import_picocolors = __toESM(require("picocolors"), 1);
|
|
2291
|
-
|
|
2292
|
-
// src/core/utils/building/find-entrypoints.ts
|
|
2293
|
-
var import_fs_extra7 = __toESM(require("fs-extra"), 1);
|
|
2294
|
-
var import_minimatch = require("minimatch");
|
|
2295
|
-
var import_linkedom3 = require("linkedom");
|
|
2296
|
-
var import_json5 = __toESM(require("json5"), 1);
|
|
2297
|
-
var import_fast_glob3 = __toESM(require("fast-glob"), 1);
|
|
2298
|
-
var import_picocolors2 = __toESM(require("picocolors"), 1);
|
|
2299
|
-
var PATH_GLOB_TO_TYPE_MAP = {
|
|
2300
|
-
"sandbox.html": "sandbox",
|
|
2301
|
-
"sandbox/index.html": "sandbox",
|
|
2302
|
-
"*.sandbox.html": "sandbox",
|
|
2303
|
-
"*.sandbox/index.html": "sandbox",
|
|
2304
|
-
"bookmarks.html": "bookmarks",
|
|
2305
|
-
"bookmarks/index.html": "bookmarks",
|
|
2306
|
-
"history.html": "history",
|
|
2307
|
-
"history/index.html": "history",
|
|
2308
|
-
"newtab.html": "newtab",
|
|
2309
|
-
"newtab/index.html": "newtab",
|
|
2310
|
-
"sidepanel.html": "sidepanel",
|
|
2311
|
-
"sidepanel/index.html": "sidepanel",
|
|
2312
|
-
"*.sidepanel.html": "sidepanel",
|
|
2313
|
-
"*.sidepanel/index.html": "sidepanel",
|
|
2314
|
-
"devtools.html": "devtools",
|
|
2315
|
-
"devtools/index.html": "devtools",
|
|
2316
|
-
"background.[jt]s": "background",
|
|
2317
|
-
"background/index.[jt]s": "background",
|
|
2318
|
-
[VIRTUAL_NOOP_BACKGROUND_MODULE_ID]: "background",
|
|
2319
|
-
"content.[jt]s?(x)": "content-script",
|
|
2320
|
-
"content/index.[jt]s?(x)": "content-script",
|
|
2321
|
-
"*.content.[jt]s?(x)": "content-script",
|
|
2322
|
-
"*.content/index.[jt]s?(x)": "content-script",
|
|
2323
|
-
[`content.${CSS_EXTENSIONS_PATTERN}`]: "content-script-style",
|
|
2324
|
-
[`*.content.${CSS_EXTENSIONS_PATTERN}`]: "content-script-style",
|
|
2325
|
-
[`content/index.${CSS_EXTENSIONS_PATTERN}`]: "content-script-style",
|
|
2326
|
-
[`*.content/index.${CSS_EXTENSIONS_PATTERN}`]: "content-script-style",
|
|
2327
|
-
"popup.html": "popup",
|
|
2328
|
-
"popup/index.html": "popup",
|
|
2329
|
-
"options.html": "options",
|
|
2330
|
-
"options/index.html": "options",
|
|
2331
|
-
"*.html": "unlisted-page",
|
|
2332
|
-
"*/index.html": "unlisted-page",
|
|
2333
|
-
"*.[jt]s?(x)": "unlisted-script",
|
|
2334
|
-
"*/index.[jt]s?(x)": "unlisted-script",
|
|
2335
|
-
[`*.${CSS_EXTENSIONS_PATTERN}`]: "unlisted-style",
|
|
2336
|
-
[`*/index.${CSS_EXTENSIONS_PATTERN}`]: "unlisted-style"
|
|
2337
|
-
};
|
|
2338
|
-
|
|
2339
|
-
// src/core/utils/building/generate-wxt-dir.ts
|
|
2340
|
-
var import_fs_extra8 = __toESM(require("fs-extra"), 1);
|
|
2341
|
-
var import_node_path12 = require("path");
|
|
2342
|
-
var import_node_path13 = __toESM(require("path"), 1);
|
|
2343
|
-
|
|
2344
|
-
// src/core/utils/building/resolve-config.ts
|
|
2345
|
-
var import_c12 = require("c12");
|
|
2346
|
-
var import_node_path17 = __toESM(require("path"), 1);
|
|
2347
|
-
|
|
2348
|
-
// src/core/utils/cache.ts
|
|
2349
|
-
var import_fs_extra9 = __toESM(require("fs-extra"), 1);
|
|
2350
|
-
var import_path = require("path");
|
|
2351
|
-
function createFsCache(wxtDir) {
|
|
2352
|
-
const getPath = (key) => (0, import_path.resolve)(wxtDir, "cache", encodeURIComponent(key));
|
|
2353
|
-
return {
|
|
2354
|
-
async set(key, value) {
|
|
2355
|
-
const path8 = getPath(key);
|
|
2356
|
-
await (0, import_fs_extra9.ensureDir)((0, import_path.dirname)(path8));
|
|
2357
|
-
await writeFileIfDifferent(path8, value);
|
|
2358
|
-
},
|
|
2359
|
-
async get(key) {
|
|
2360
|
-
const path8 = getPath(key);
|
|
2361
|
-
try {
|
|
2362
|
-
return await import_fs_extra9.default.readFile(path8, "utf-8");
|
|
2363
|
-
} catch {
|
|
2364
|
-
return void 0;
|
|
2365
|
-
}
|
|
2366
|
-
}
|
|
2367
|
-
};
|
|
2368
|
-
}
|
|
2369
|
-
|
|
2370
|
-
// ../../node_modules/.pnpm/consola@3.2.3/node_modules/consola/dist/index.mjs
|
|
2371
|
-
init_consola_36c0034f();
|
|
2372
|
-
init_core();
|
|
2373
|
-
init_consola_06ad8a64();
|
|
2374
|
-
var import_node_process3 = require("process");
|
|
2375
|
-
init_utils();
|
|
2376
|
-
var import_node_tty2 = require("tty");
|
|
2377
|
-
var import_node_util3 = require("util");
|
|
2378
|
-
var import_node_path16 = require("path");
|
|
2379
|
-
|
|
2380
|
-
// src/core/utils/building/resolve-config.ts
|
|
2381
|
-
var import_defu = __toESM(require("defu"), 1);
|
|
2382
|
-
var import_fs_extra10 = __toESM(require("fs-extra"), 1);
|
|
2383
|
-
var import_fast_glob4 = __toESM(require("fast-glob"), 1);
|
|
2384
|
-
|
|
2385
|
-
// src/core/utils/eslint.ts
|
|
2386
|
-
var import_meta = {};
|
|
2387
|
-
async function getEslintVersion() {
|
|
2388
|
-
try {
|
|
2389
|
-
const require2 = (await import("module")).default.createRequire(
|
|
2390
|
-
import_meta.url
|
|
2391
|
-
);
|
|
2392
|
-
const { ESLint } = require2("eslint");
|
|
2393
|
-
return ESLint.version?.split(".") ?? [];
|
|
2394
|
-
} catch (error) {
|
|
2395
|
-
return [];
|
|
2396
|
-
}
|
|
2397
|
-
}
|
|
2398
|
-
|
|
2399
|
-
// src/core/utils/building/resolve-config.ts
|
|
2400
|
-
var import_meta2 = {};
|
|
2401
|
-
async function resolveConfig(inlineConfig, command) {
|
|
2402
|
-
let userConfig = {};
|
|
2403
|
-
let userConfigMetadata;
|
|
2404
|
-
if (inlineConfig.configFile !== false) {
|
|
2405
|
-
const { config: loadedConfig, ...metadata } = await (0, import_c12.loadConfig)({
|
|
2406
|
-
configFile: inlineConfig.configFile,
|
|
2407
|
-
name: "wxt",
|
|
2408
|
-
cwd: inlineConfig.root ?? process.cwd(),
|
|
2409
|
-
rcFile: false,
|
|
2410
|
-
jitiOptions: {
|
|
2411
|
-
esmResolve: true
|
|
2412
|
-
}
|
|
2413
|
-
});
|
|
2414
|
-
userConfig = loadedConfig ?? {};
|
|
2415
|
-
userConfigMetadata = metadata;
|
|
2416
|
-
}
|
|
2417
|
-
const mergedConfig = await mergeInlineConfig(inlineConfig, userConfig);
|
|
2418
|
-
const debug = mergedConfig.debug ?? false;
|
|
2419
|
-
const logger = mergedConfig.logger ?? consola;
|
|
2420
|
-
if (debug) logger.level = LogLevels.debug;
|
|
2421
|
-
const browser = mergedConfig.browser ?? "chrome";
|
|
2422
|
-
const manifestVersion = mergedConfig.manifestVersion ?? (browser === "firefox" || browser === "safari" ? 2 : 3);
|
|
2423
|
-
const mode = mergedConfig.mode ?? COMMAND_MODES[command];
|
|
2424
|
-
const env2 = { browser, command, manifestVersion, mode };
|
|
2425
|
-
const root = import_node_path17.default.resolve(
|
|
2426
|
-
inlineConfig.root ?? userConfig.root ?? process.cwd()
|
|
2427
|
-
);
|
|
2428
|
-
const wxtDir = import_node_path17.default.resolve(root, ".wxt");
|
|
2429
|
-
const wxtModuleDir = await resolveWxtModuleDir();
|
|
2430
|
-
const srcDir = import_node_path17.default.resolve(root, mergedConfig.srcDir ?? root);
|
|
2431
|
-
const entrypointsDir = import_node_path17.default.resolve(
|
|
2432
|
-
srcDir,
|
|
2433
|
-
mergedConfig.entrypointsDir ?? "entrypoints"
|
|
2434
|
-
);
|
|
2435
|
-
const modulesDir = import_node_path17.default.resolve(srcDir, mergedConfig.modulesDir ?? "modules");
|
|
2436
|
-
if (await isDirMissing(entrypointsDir)) {
|
|
2437
|
-
logMissingDir(logger, "Entrypoints", entrypointsDir);
|
|
2438
|
-
}
|
|
2439
|
-
const filterEntrypoints = !!mergedConfig.filterEntrypoints?.length ? new Set(mergedConfig.filterEntrypoints) : void 0;
|
|
2440
|
-
const publicDir = import_node_path17.default.resolve(srcDir, mergedConfig.publicDir ?? "public");
|
|
2441
|
-
if (await isDirMissing(publicDir)) {
|
|
2442
|
-
logMissingDir(logger, "Public", publicDir);
|
|
2443
|
-
}
|
|
2444
|
-
const typesDir = import_node_path17.default.resolve(wxtDir, "types");
|
|
2445
|
-
const outBaseDir = import_node_path17.default.resolve(root, mergedConfig.outDir ?? ".output");
|
|
2446
|
-
const outDir = import_node_path17.default.resolve(outBaseDir, `${browser}-mv${manifestVersion}`);
|
|
2447
|
-
const reloadCommand = mergedConfig.dev?.reloadCommand ?? "Alt+R";
|
|
2448
|
-
const runnerConfig = await (0, import_c12.loadConfig)({
|
|
2449
|
-
name: "web-ext",
|
|
2450
|
-
cwd: root,
|
|
2451
|
-
globalRc: true,
|
|
2452
|
-
rcFile: ".webextrc",
|
|
2453
|
-
overrides: inlineConfig.runner,
|
|
2454
|
-
defaults: userConfig.runner
|
|
2455
|
-
});
|
|
2456
|
-
const alias = Object.fromEntries(
|
|
2457
|
-
Object.entries({
|
|
2458
|
-
...mergedConfig.alias,
|
|
2459
|
-
"@": srcDir,
|
|
2460
|
-
"~": srcDir,
|
|
2461
|
-
"@@": root,
|
|
2462
|
-
"~~": root
|
|
2463
|
-
}).map(([key, value]) => [key, import_node_path17.default.resolve(root, value)])
|
|
2464
|
-
);
|
|
2465
|
-
let devServerConfig;
|
|
2466
|
-
if (command === "serve") {
|
|
2467
|
-
let port = mergedConfig.dev?.server?.port;
|
|
2468
|
-
if (port == null || !isFinite(port)) {
|
|
2469
|
-
const { default: getPort, portNumbers } = await import("get-port");
|
|
2470
|
-
port = await getPort({ port: portNumbers(3e3, 3010) });
|
|
2471
|
-
}
|
|
2472
|
-
devServerConfig = {
|
|
2473
|
-
port,
|
|
2474
|
-
hostname: mergedConfig.dev?.server?.hostname ?? "localhost"
|
|
2475
|
-
};
|
|
2476
|
-
}
|
|
2477
|
-
const userModules = await resolveWxtUserModules(
|
|
2478
|
-
modulesDir,
|
|
2479
|
-
mergedConfig.modules
|
|
2480
|
-
);
|
|
2481
|
-
const moduleOptions = userModules.reduce(
|
|
2482
|
-
(map, module2) => {
|
|
2483
|
-
if (module2.configKey) {
|
|
2484
|
-
map[module2.configKey] = // @ts-expect-error
|
|
2485
|
-
mergedConfig[module2.configKey];
|
|
2486
|
-
}
|
|
2487
|
-
return map;
|
|
2488
|
-
},
|
|
2489
|
-
{}
|
|
2490
|
-
);
|
|
2491
|
-
return {
|
|
2492
|
-
browser,
|
|
2493
|
-
command,
|
|
2494
|
-
debug,
|
|
2495
|
-
entrypointsDir,
|
|
2496
|
-
modulesDir,
|
|
2497
|
-
filterEntrypoints,
|
|
2498
|
-
env: env2,
|
|
2499
|
-
fsCache: createFsCache(wxtDir),
|
|
2500
|
-
imports: await getUnimportOptions(wxtDir, srcDir, logger, mergedConfig),
|
|
2501
|
-
logger,
|
|
2502
|
-
manifest: await resolveManifestConfig(env2, mergedConfig.manifest),
|
|
2503
|
-
manifestVersion,
|
|
2504
|
-
mode,
|
|
2505
|
-
outBaseDir,
|
|
2506
|
-
outDir,
|
|
2507
|
-
publicDir,
|
|
2508
|
-
wxtModuleDir,
|
|
2509
|
-
root,
|
|
2510
|
-
runnerConfig,
|
|
2511
|
-
srcDir,
|
|
2512
|
-
typesDir,
|
|
2513
|
-
wxtDir,
|
|
2514
|
-
zip: resolveZipConfig(root, outBaseDir, mergedConfig),
|
|
2515
|
-
transformManifest: mergedConfig.transformManifest,
|
|
2516
|
-
analysis: resolveAnalysisConfig(root, mergedConfig),
|
|
2517
|
-
userConfigMetadata: userConfigMetadata ?? {},
|
|
2518
|
-
alias,
|
|
2519
|
-
experimental: (0, import_defu.default)(mergedConfig.experimental, {
|
|
2520
|
-
includeBrowserPolyfill: true,
|
|
2521
|
-
entrypointImporter: "jiti"
|
|
2522
|
-
}),
|
|
2523
|
-
dev: {
|
|
2524
|
-
server: devServerConfig,
|
|
2525
|
-
reloadCommand
|
|
2526
|
-
},
|
|
2527
|
-
hooks: mergedConfig.hooks ?? {},
|
|
2528
|
-
vite: mergedConfig.vite ?? (() => ({})),
|
|
2529
|
-
builtinModules,
|
|
2530
|
-
userModules,
|
|
2531
|
-
plugins: [],
|
|
2532
|
-
...moduleOptions
|
|
2533
|
-
};
|
|
2534
|
-
}
|
|
2535
|
-
async function resolveManifestConfig(env2, manifest) {
|
|
2536
|
-
return await (typeof manifest === "function" ? manifest(env2) : manifest ?? {});
|
|
2537
|
-
}
|
|
2538
|
-
async function mergeInlineConfig(inlineConfig, userConfig) {
|
|
2539
|
-
const imports = inlineConfig.imports === false || userConfig.imports === false ? false : userConfig.imports == null && inlineConfig.imports == null ? void 0 : (0, import_defu.default)(inlineConfig.imports ?? {}, userConfig.imports ?? {});
|
|
2540
|
-
const manifest = async (env2) => {
|
|
2541
|
-
const user = await resolveManifestConfig(env2, userConfig.manifest);
|
|
2542
|
-
const inline = await resolveManifestConfig(env2, inlineConfig.manifest);
|
|
2543
|
-
return (0, import_defu.default)(inline, user);
|
|
2544
|
-
};
|
|
2545
|
-
const transformManifest = (manifest2) => {
|
|
2546
|
-
userConfig.transformManifest?.(manifest2);
|
|
2547
|
-
inlineConfig.transformManifest?.(manifest2);
|
|
2548
|
-
};
|
|
2549
|
-
const merged = (0, import_defu.default)(inlineConfig, userConfig);
|
|
2550
|
-
const builderConfig = await mergeBuilderConfig(
|
|
2551
|
-
merged.logger ?? consola,
|
|
2552
|
-
inlineConfig,
|
|
2553
|
-
userConfig
|
|
2554
|
-
);
|
|
2555
|
-
return {
|
|
2556
|
-
...merged,
|
|
2557
|
-
// Custom merge values
|
|
2558
|
-
transformManifest,
|
|
2559
|
-
imports,
|
|
2560
|
-
manifest,
|
|
2561
|
-
...builderConfig
|
|
2562
|
-
};
|
|
2563
|
-
}
|
|
2564
|
-
function resolveZipConfig(root, outBaseDir, mergedConfig) {
|
|
2565
|
-
const downloadedPackagesDir = import_node_path17.default.resolve(root, ".wxt/local_modules");
|
|
2566
|
-
return {
|
|
2567
|
-
name: void 0,
|
|
2568
|
-
sourcesTemplate: "{{name}}-{{version}}-sources.zip",
|
|
2569
|
-
artifactTemplate: "{{name}}-{{version}}-{{browser}}.zip",
|
|
2570
|
-
sourcesRoot: root,
|
|
2571
|
-
includeSources: [],
|
|
2572
|
-
compressionLevel: 9,
|
|
2573
|
-
...mergedConfig.zip,
|
|
2574
|
-
excludeSources: [
|
|
2575
|
-
"**/node_modules",
|
|
2576
|
-
// WXT files
|
|
2577
|
-
"**/web-ext.config.ts",
|
|
2578
|
-
// Hidden files
|
|
2579
|
-
"**/.*",
|
|
2580
|
-
// Tests
|
|
2581
|
-
"**/__tests__/**",
|
|
2582
|
-
"**/*.+(test|spec).?(c|m)+(j|t)s?(x)",
|
|
2583
|
-
// Output directory
|
|
2584
|
-
`${import_node_path17.default.relative(root, outBaseDir)}/**`,
|
|
2585
|
-
// From user
|
|
2586
|
-
...mergedConfig.zip?.excludeSources ?? []
|
|
2587
|
-
],
|
|
2588
|
-
downloadPackages: mergedConfig.zip?.downloadPackages ?? [],
|
|
2589
|
-
downloadedPackagesDir
|
|
2590
|
-
};
|
|
2591
|
-
}
|
|
2592
|
-
function resolveAnalysisConfig(root, mergedConfig) {
|
|
2593
|
-
const analysisOutputFile = import_node_path17.default.resolve(
|
|
2594
|
-
root,
|
|
2595
|
-
mergedConfig.analysis?.outputFile ?? "stats.html"
|
|
2596
|
-
);
|
|
2597
|
-
const analysisOutputDir = import_node_path17.default.dirname(analysisOutputFile);
|
|
2598
|
-
const analysisOutputName = import_node_path17.default.parse(analysisOutputFile).name;
|
|
2599
|
-
return {
|
|
2600
|
-
enabled: mergedConfig.analysis?.enabled ?? false,
|
|
2601
|
-
open: mergedConfig.analysis?.open ?? false,
|
|
2602
|
-
template: mergedConfig.analysis?.template ?? "treemap",
|
|
2603
|
-
outputFile: analysisOutputFile,
|
|
2604
|
-
outputDir: analysisOutputDir,
|
|
2605
|
-
outputName: analysisOutputName,
|
|
2606
|
-
keepArtifacts: mergedConfig.analysis?.keepArtifacts ?? false
|
|
2607
|
-
};
|
|
2608
|
-
}
|
|
2609
|
-
async function getUnimportOptions(wxtDir, srcDir, logger, config) {
|
|
2610
|
-
if (config.imports === false) return false;
|
|
2611
|
-
const defaultOptions = {
|
|
2612
|
-
debugLog: logger.debug,
|
|
2613
|
-
imports: [
|
|
2614
|
-
{ name: "defineConfig", from: "wxt" },
|
|
2615
|
-
{ name: "fakeBrowser", from: "wxt/testing" }
|
|
2616
|
-
],
|
|
2617
|
-
presets: [
|
|
2618
|
-
{ package: "wxt/client" },
|
|
2619
|
-
{ package: "wxt/browser" },
|
|
2620
|
-
{ package: "wxt/sandbox" },
|
|
2621
|
-
{ package: "wxt/storage" }
|
|
2622
|
-
],
|
|
2623
|
-
warn: logger.warn,
|
|
2624
|
-
dirs: ["components", "composables", "hooks", "utils"],
|
|
2625
|
-
dirsScanOptions: {
|
|
2626
|
-
cwd: srcDir
|
|
2627
|
-
},
|
|
2628
|
-
eslintrc: await getUnimportEslintOptions(wxtDir, config.imports?.eslintrc)
|
|
2629
|
-
};
|
|
2630
|
-
return (0, import_defu.default)(
|
|
2631
|
-
config.imports ?? {},
|
|
2632
|
-
defaultOptions
|
|
2633
|
-
);
|
|
2634
|
-
}
|
|
2635
|
-
async function getUnimportEslintOptions(wxtDir, options) {
|
|
2636
|
-
const rawEslintEnabled = options?.enabled ?? "auto";
|
|
2637
|
-
let eslintEnabled;
|
|
2638
|
-
switch (rawEslintEnabled) {
|
|
2639
|
-
case "auto":
|
|
2640
|
-
const version2 = await getEslintVersion();
|
|
2641
|
-
let major = parseInt(version2[0]);
|
|
2642
|
-
if (major <= 8) eslintEnabled = 8;
|
|
2643
|
-
else if (major >= 9) eslintEnabled = 9;
|
|
2644
|
-
else eslintEnabled = 8;
|
|
2645
|
-
break;
|
|
2646
|
-
case true:
|
|
2647
|
-
eslintEnabled = 8;
|
|
2648
|
-
break;
|
|
2649
|
-
default:
|
|
2650
|
-
eslintEnabled = rawEslintEnabled;
|
|
2651
|
-
}
|
|
2652
|
-
return {
|
|
2653
|
-
enabled: eslintEnabled,
|
|
2654
|
-
filePath: import_node_path17.default.resolve(
|
|
2655
|
-
wxtDir,
|
|
2656
|
-
eslintEnabled === 9 ? "eslint-auto-imports.mjs" : "eslintrc-auto-import.json"
|
|
2657
|
-
),
|
|
2658
|
-
globalsPropValue: true
|
|
2659
|
-
};
|
|
2660
|
-
}
|
|
2661
|
-
async function resolveWxtModuleDir() {
|
|
2662
|
-
const requireResolve = require?.resolve ?? (await import("module")).default.createRequire(import_meta2.url).resolve;
|
|
2663
|
-
return import_node_path17.default.resolve(requireResolve("wxt"), "../..");
|
|
2664
|
-
}
|
|
2665
|
-
async function isDirMissing(dir) {
|
|
2666
|
-
return !await import_fs_extra10.default.exists(dir);
|
|
2667
|
-
}
|
|
2668
|
-
function logMissingDir(logger, name, expected) {
|
|
2669
|
-
logger.warn(
|
|
2670
|
-
`${name} directory not found: ./${normalizePath(
|
|
2671
|
-
import_node_path17.default.relative(process.cwd(), expected)
|
|
2672
|
-
)}`
|
|
2673
|
-
);
|
|
2674
|
-
}
|
|
2675
|
-
var COMMAND_MODES = {
|
|
2676
|
-
build: "production",
|
|
2677
|
-
serve: "development"
|
|
2678
|
-
};
|
|
2679
|
-
async function mergeBuilderConfig(logger, inlineConfig, userConfig) {
|
|
2680
|
-
const vite2 = await import("vite").catch((err) => {
|
|
2681
|
-
logger.debug("Failed to import vite:", err);
|
|
2682
|
-
});
|
|
2683
|
-
if (vite2) {
|
|
2684
|
-
return {
|
|
2685
|
-
vite: async (env2) => {
|
|
2686
|
-
const resolvedInlineConfig = await inlineConfig.vite?.(env2) ?? {};
|
|
2687
|
-
const resolvedUserConfig = await userConfig.vite?.(env2) ?? {};
|
|
2688
|
-
return vite2.mergeConfig(resolvedUserConfig, resolvedInlineConfig);
|
|
2689
|
-
}
|
|
2690
|
-
};
|
|
2691
|
-
}
|
|
2692
|
-
throw Error("Builder not found. Make sure vite is installed.");
|
|
2693
|
-
}
|
|
2694
|
-
async function resolveWxtUserModules(modulesDir, modules = []) {
|
|
2695
|
-
const npmModules = await Promise.all(
|
|
2696
|
-
modules.map(async (moduleId) => {
|
|
2697
|
-
const mod = await import(
|
|
2698
|
-
/* @vite-ignore */
|
|
2699
|
-
moduleId
|
|
2700
|
-
);
|
|
2701
|
-
if (mod.default == null) {
|
|
2702
|
-
throw Error("Module missing default export: " + moduleId);
|
|
2703
|
-
}
|
|
2704
|
-
return {
|
|
2705
|
-
...mod.default,
|
|
2706
|
-
type: "node_module",
|
|
2707
|
-
id: moduleId
|
|
2708
|
-
};
|
|
2709
|
-
})
|
|
2710
|
-
);
|
|
2711
|
-
const localModulePaths = await (0, import_fast_glob4.default)(["*.[tj]s", "*/index.[tj]s"], {
|
|
2712
|
-
cwd: modulesDir,
|
|
2713
|
-
onlyFiles: true
|
|
2714
|
-
}).catch(() => []);
|
|
2715
|
-
const localModules = await Promise.all(
|
|
2716
|
-
localModulePaths.map(async (file) => {
|
|
2717
|
-
const absolutePath = normalizePath(import_node_path17.default.resolve(modulesDir, file));
|
|
2718
|
-
const { config } = await (0, import_c12.loadConfig)({
|
|
2719
|
-
configFile: absolutePath,
|
|
2720
|
-
globalRc: false,
|
|
2721
|
-
rcFile: false,
|
|
2722
|
-
packageJson: false,
|
|
2723
|
-
envName: false,
|
|
2724
|
-
dotenv: false
|
|
2725
|
-
});
|
|
2726
|
-
if (config == null)
|
|
2727
|
-
throw Error(
|
|
2728
|
-
`No config found for ${file}. Did you forget to add a default export?`
|
|
2729
|
-
);
|
|
2730
|
-
config.name ??= file;
|
|
2731
|
-
return {
|
|
2732
|
-
...config,
|
|
2733
|
-
type: "local",
|
|
2734
|
-
id: absolutePath
|
|
2735
|
-
};
|
|
2736
|
-
})
|
|
2737
|
-
);
|
|
2738
|
-
return [...npmModules, ...localModules];
|
|
2739
|
-
}
|
|
2740
|
-
|
|
2741
|
-
// src/core/utils/building/import-entrypoint.ts
|
|
2742
|
-
var import_jiti = __toESM(require("jiti"), 1);
|
|
2743
|
-
var import_unimport3 = require("unimport");
|
|
2744
|
-
var import_fs_extra11 = __toESM(require("fs-extra"), 1);
|
|
2745
|
-
var import_node_path18 = require("path");
|
|
2746
|
-
var import_esbuild = require("esbuild");
|
|
2747
|
-
var import_node_url = require("url");
|
|
2748
|
-
|
|
2749
|
-
// src/core/utils/building/internal-build.ts
|
|
2750
|
-
var import_picocolors5 = __toESM(require("picocolors"), 1);
|
|
2751
|
-
var import_fs_extra15 = __toESM(require("fs-extra"), 1);
|
|
2752
|
-
|
|
2753
|
-
// src/core/utils/log/printFileList.ts
|
|
2754
|
-
var import_node_path19 = __toESM(require("path"), 1);
|
|
2755
|
-
var import_picocolors3 = __toESM(require("picocolors"), 1);
|
|
2756
|
-
var import_fs_extra12 = __toESM(require("fs-extra"), 1);
|
|
2757
|
-
var import_filesize = require("filesize");
|
|
2758
|
-
var DEFAULT_COLOR = import_picocolors3.default.blue;
|
|
2759
|
-
var CHUNK_COLORS = {
|
|
2760
|
-
".js.map": import_picocolors3.default.gray,
|
|
2761
|
-
".cjs.map": import_picocolors3.default.gray,
|
|
2762
|
-
".mjs.map": import_picocolors3.default.gray,
|
|
2763
|
-
".html": import_picocolors3.default.green,
|
|
2764
|
-
".css": import_picocolors3.default.magenta,
|
|
2765
|
-
".js": import_picocolors3.default.cyan,
|
|
2766
|
-
".cjs": import_picocolors3.default.cyan,
|
|
2767
|
-
".mjs": import_picocolors3.default.cyan,
|
|
2768
|
-
".zip": import_picocolors3.default.yellow
|
|
2769
|
-
};
|
|
2770
|
-
|
|
2771
|
-
// src/core/utils/log/printHeader.ts
|
|
2772
|
-
var import_picocolors4 = __toESM(require("picocolors"), 1);
|
|
2773
|
-
|
|
2774
|
-
// src/core/utils/building/internal-build.ts
|
|
2775
|
-
var import_fast_glob5 = __toESM(require("fast-glob"), 1);
|
|
2776
|
-
|
|
2777
|
-
// src/core/utils/manifest.ts
|
|
2778
|
-
var import_fs_extra14 = __toESM(require("fs-extra"), 1);
|
|
2779
|
-
|
|
2780
|
-
// src/core/utils/package.ts
|
|
2781
|
-
var import_node_path20 = require("path");
|
|
2782
|
-
var import_fs_extra13 = __toESM(require("fs-extra"), 1);
|
|
2783
|
-
|
|
2784
|
-
// src/core/utils/manifest.ts
|
|
2785
|
-
var import_defu2 = __toESM(require("defu"), 1);
|
|
2786
|
-
|
|
2787
|
-
// src/core/utils/building/internal-build.ts
|
|
2788
|
-
var import_node_path21 = require("path");
|
|
2789
|
-
var import_rollup_plugin_visualizer2 = require("@aklinker1/rollup-plugin-visualizer");
|
|
2790
|
-
var import_ci_info = require("ci-info");
|
|
2791
|
-
|
|
2792
|
-
// src/testing/wxt-vitest-plugin.ts
|
|
2793
|
-
var import_unimport5 = require("unimport");
|
|
2794
|
-
function WxtVitest(inlineConfig) {
|
|
2795
|
-
return resolveConfig(inlineConfig ?? {}, "serve").then(async (config) => {
|
|
2796
|
-
const plugins = [
|
|
2797
|
-
webextensionPolyfillMock(config),
|
|
2798
|
-
globals(config),
|
|
2799
|
-
download(config),
|
|
2800
|
-
tsconfigPaths(config),
|
|
2801
|
-
resolveAppConfig(config)
|
|
2802
|
-
];
|
|
2803
|
-
if (config.imports !== false) {
|
|
2804
|
-
const unimport = (0, import_unimport5.createUnimport)(config.imports);
|
|
2805
|
-
await unimport.init();
|
|
2806
|
-
plugins.push(vitePlugin(unimport));
|
|
2807
|
-
}
|
|
2808
|
-
return plugins;
|
|
2809
|
-
});
|
|
2810
|
-
}
|
|
2811
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
2812
|
-
0 && (module.exports = {
|
|
2813
|
-
WxtVitest,
|
|
2814
|
-
fakeBrowser
|
|
2815
|
-
});
|