vitest 1.0.0-beta.3 → 1.0.0-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +17 -0
- package/dist/browser.d.ts +1 -2
- package/dist/browser.js +3 -3
- package/dist/child.js +5 -4
- package/dist/{chunk-api-setup.37a43981.js → chunk-api-setup.6d19ab38.js} +6 -2
- package/dist/{chunk-install-pkg.6349b322.js → chunk-install-pkg.e1d6323e.js} +4 -4
- package/dist/{chunk-integrations-globals.9df12d91.js → chunk-integrations-globals.2b099e04.js} +6 -6
- package/dist/cli.js +8 -5
- package/dist/config.cjs +1 -0
- package/dist/config.d.ts +1 -2
- package/dist/config.js +1 -0
- package/dist/coverage.d.ts +1 -2
- package/dist/entry-vm.js +8 -8
- package/dist/entry.js +8 -8
- package/dist/environments.d.ts +1 -2
- package/dist/execute.d.ts +2 -3
- package/dist/execute.js +1 -2
- package/dist/index.d.ts +233 -60
- package/dist/index.js +7 -7
- package/dist/node.d.ts +8 -4
- package/dist/node.js +4 -4
- package/dist/{reporters-1678fe04.d.ts → reporters-50c2bd49.d.ts} +39 -6
- package/dist/reporters.d.ts +1 -2
- package/dist/reporters.js +3 -3
- package/dist/runners.d.ts +1 -2
- package/dist/runners.js +5 -6
- package/dist/{suite-0579b50d.d.ts → suite-ad69b7cd.d.ts} +1 -1
- package/dist/suite.d.ts +2 -3
- package/dist/suite.js +3 -3
- package/dist/{vendor-benchmark.44931cfa.js → vendor-benchmark.b6befc50.js} +1 -1
- package/dist/{vendor-execute.e6e4e89b.js → vendor-execute.157302d6.js} +2 -3
- package/dist/vendor-global.c3664e75.js +14 -0
- package/dist/{vendor-index.29282562.js → vendor-index.2b92937b.js} +1 -1
- package/dist/{vendor-index.3d079eea.js → vendor-index.57925a34.js} +2 -2
- package/dist/{vendor-index.68ecee35.js → vendor-index.72df742e.js} +11 -4
- package/dist/{vendor-node.327f8f1f.js → vendor-node.65461b16.js} +762 -98
- package/dist/{vendor-reporters.b9600369.js → vendor-reporters.d24d80a4.js} +2 -2
- package/dist/{vendor-rpc.cbd8e972.js → vendor-rpc.171f65fb.js} +1 -1
- package/dist/{vendor-run-once.3e5ef7d7.js → vendor-run-once.fb836747.js} +1 -1
- package/dist/{vendor-vi.d30b47ae.js → vendor-vi.3baa7c4a.js} +32 -35
- package/dist/vm.js +6 -5
- package/dist/worker.js +6 -5
- package/package.json +8 -8
- package/dist/vendor-global.97e4527c.js +0 -9
|
@@ -17,11 +17,12 @@ import { slash as slash$2, normalizeRequestId, cleanUrl } from 'vite-node/utils'
|
|
|
17
17
|
import { ViteNodeRunner } from 'vite-node/client';
|
|
18
18
|
import { SnapshotManager } from '@vitest/snapshot/manager';
|
|
19
19
|
import { ViteNodeServer } from 'vite-node/server';
|
|
20
|
-
import { r as removeUndefinedValues, a as isWindows } from './vendor-index.
|
|
20
|
+
import { r as removeUndefinedValues, a as isWindows$1 } from './vendor-index.2b92937b.js';
|
|
21
21
|
import { g as getCoverageProvider, C as CoverageProviderMap } from './vendor-coverage.78040316.js';
|
|
22
22
|
import { r as rootDir } from './vendor-paths.84fc7a99.js';
|
|
23
23
|
import v8 from 'node:v8';
|
|
24
24
|
import * as nodeos from 'node:os';
|
|
25
|
+
import nodeos__default from 'node:os';
|
|
25
26
|
import EventEmitter from 'node:events';
|
|
26
27
|
import Tinypool$1, { Tinypool } from 'tinypool';
|
|
27
28
|
import { c as createBirpc } from './vendor-index.1ca68bd5.js';
|
|
@@ -33,12 +34,12 @@ import { performance } from 'node:perf_hooks';
|
|
|
33
34
|
import { e as execa, a as signalExit } from './vendor-index.8efe7746.js';
|
|
34
35
|
import { TraceMap, generatedPositionFor, parseErrorStacktrace } from '@vitest/utils/source-map';
|
|
35
36
|
import { isPackageExists, resolveModule } from 'local-pkg';
|
|
36
|
-
import { isCI } from 'std-env';
|
|
37
|
+
import { isCI, provider as provider$1 } from 'std-env';
|
|
37
38
|
import ue from 'module';
|
|
38
39
|
import { parse as parse$4 } from 'acorn';
|
|
39
40
|
import { ancestor, simple, findNodeAround } from 'acorn-walk';
|
|
40
41
|
import { generateHash, calculateSuiteHash, someTasksAreOnly, interpretTaskModes, getTasks, hasFailed } from '@vitest/runner/utils';
|
|
41
|
-
import { R as ReportersMap, B as BenchmarkReportsMap, s as
|
|
42
|
+
import { R as ReportersMap, B as BenchmarkReportsMap, s as stripAnsi, a as ansiStyles, d as divider, F as F_POINTER, c as cliTruncate } from './vendor-reporters.d24d80a4.js';
|
|
42
43
|
import crypto, { createHash } from 'node:crypto';
|
|
43
44
|
import MagicString from 'magic-string';
|
|
44
45
|
import { stripLiteral } from 'strip-literal';
|
|
@@ -61,7 +62,7 @@ function _mergeNamespaces(n, m) {
|
|
|
61
62
|
return Object.freeze(n);
|
|
62
63
|
}
|
|
63
64
|
|
|
64
|
-
var version$1 = "1.0.0-beta.
|
|
65
|
+
var version$1 = "1.0.0-beta.4";
|
|
65
66
|
|
|
66
67
|
const __dirname$1 = url.fileURLToPath(new URL(".", import.meta.url));
|
|
67
68
|
async function ensurePackageInstalled(dependency, root) {
|
|
@@ -80,7 +81,7 @@ async function ensurePackageInstalled(dependency, root) {
|
|
|
80
81
|
message: c.reset(`Do you want to install ${c.green(dependency)}?`)
|
|
81
82
|
});
|
|
82
83
|
if (install) {
|
|
83
|
-
await (await import('./chunk-install-pkg.
|
|
84
|
+
await (await import('./chunk-install-pkg.e1d6323e.js')).installPackage(dependency, { dev: true });
|
|
84
85
|
process.stderr.write(c.yellow(`
|
|
85
86
|
Package ${dependency} installed, re-run the command to start.
|
|
86
87
|
`));
|
|
@@ -7196,7 +7197,7 @@ function stringifyRegex(input) {
|
|
|
7196
7197
|
return `$$vitest:${input.toString()}`;
|
|
7197
7198
|
}
|
|
7198
7199
|
function createChildProcessPool(ctx, { execArgv, env, forksPath }) {
|
|
7199
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
7200
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
7200
7201
|
const numCpus = typeof nodeos.availableParallelism === "function" ? nodeos.availableParallelism() : nodeos.cpus().length;
|
|
7201
7202
|
const threadsCount = ctx.config.watch ? Math.max(Math.floor(numCpus / 2), 1) : Math.max(numCpus - 1, 1);
|
|
7202
7203
|
const maxThreads = ((_b = (_a = ctx.config.poolOptions) == null ? void 0 : _a.forks) == null ? void 0 : _b.maxForks) ?? threadsCount;
|
|
@@ -7207,14 +7208,17 @@ function createChildProcessPool(ctx, { execArgv, env, forksPath }) {
|
|
|
7207
7208
|
maxThreads,
|
|
7208
7209
|
minThreads,
|
|
7209
7210
|
env,
|
|
7210
|
-
execArgv
|
|
7211
|
+
execArgv: [
|
|
7212
|
+
...((_f = (_e = ctx.config.poolOptions) == null ? void 0 : _e.forks) == null ? void 0 : _f.execArgv) ?? [],
|
|
7213
|
+
...execArgv
|
|
7214
|
+
],
|
|
7211
7215
|
terminateTimeout: ctx.config.teardownTimeout
|
|
7212
7216
|
};
|
|
7213
|
-
if (((
|
|
7217
|
+
if (((_h = (_g = ctx.config.poolOptions) == null ? void 0 : _g.forks) == null ? void 0 : _h.isolate) ?? true) {
|
|
7214
7218
|
options.isolateWorkers = true;
|
|
7215
7219
|
options.concurrentTasksPerWorker = 1;
|
|
7216
7220
|
}
|
|
7217
|
-
if ((
|
|
7221
|
+
if ((_j = (_i = ctx.config.poolOptions) == null ? void 0 : _i.forks) == null ? void 0 : _j.singleFork) {
|
|
7218
7222
|
options.concurrentTasksPerWorker = 1;
|
|
7219
7223
|
options.maxThreads = 1;
|
|
7220
7224
|
options.minThreads = 1;
|
|
@@ -7232,7 +7236,8 @@ function createChildProcessPool(ctx, { execArgv, env, forksPath }) {
|
|
|
7232
7236
|
invalidates,
|
|
7233
7237
|
environment,
|
|
7234
7238
|
workerId,
|
|
7235
|
-
projectName: project.getName()
|
|
7239
|
+
projectName: project.getName(),
|
|
7240
|
+
providedContext: project.getProvidedContext()
|
|
7236
7241
|
};
|
|
7237
7242
|
try {
|
|
7238
7243
|
await pool.run(data, { name, channel });
|
|
@@ -7348,7 +7353,7 @@ function createWorkerChannel$1(project) {
|
|
|
7348
7353
|
return { workerPort, port };
|
|
7349
7354
|
}
|
|
7350
7355
|
function createThreadsPool(ctx, { execArgv, env, workerPath }) {
|
|
7351
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
7356
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
7352
7357
|
const numCpus = typeof nodeos.availableParallelism === "function" ? nodeos.availableParallelism() : nodeos.cpus().length;
|
|
7353
7358
|
const threadsCount = ctx.config.watch ? Math.max(Math.floor(numCpus / 2), 1) : Math.max(numCpus - 1, 1);
|
|
7354
7359
|
const maxThreads = ((_b = (_a = ctx.config.poolOptions) == null ? void 0 : _a.threads) == null ? void 0 : _b.maxThreads) ?? threadsCount;
|
|
@@ -7361,14 +7366,17 @@ function createThreadsPool(ctx, { execArgv, env, workerPath }) {
|
|
|
7361
7366
|
maxThreads,
|
|
7362
7367
|
minThreads,
|
|
7363
7368
|
env,
|
|
7364
|
-
execArgv
|
|
7369
|
+
execArgv: [
|
|
7370
|
+
...((_h = (_g = ctx.config.poolOptions) == null ? void 0 : _g.threads) == null ? void 0 : _h.execArgv) ?? [],
|
|
7371
|
+
...execArgv
|
|
7372
|
+
],
|
|
7365
7373
|
terminateTimeout: ctx.config.teardownTimeout
|
|
7366
7374
|
};
|
|
7367
|
-
if (((
|
|
7375
|
+
if (((_j = (_i = ctx.config.poolOptions) == null ? void 0 : _i.threads) == null ? void 0 : _j.isolate) ?? true) {
|
|
7368
7376
|
options.isolateWorkers = true;
|
|
7369
7377
|
options.concurrentTasksPerWorker = 1;
|
|
7370
7378
|
}
|
|
7371
|
-
if ((
|
|
7379
|
+
if ((_l = (_k = ctx.config.poolOptions) == null ? void 0 : _k.threads) == null ? void 0 : _l.singleThread) {
|
|
7372
7380
|
options.concurrentTasksPerWorker = 1;
|
|
7373
7381
|
options.maxThreads = 1;
|
|
7374
7382
|
options.minThreads = 1;
|
|
@@ -7387,7 +7395,8 @@ function createThreadsPool(ctx, { execArgv, env, workerPath }) {
|
|
|
7387
7395
|
invalidates,
|
|
7388
7396
|
environment,
|
|
7389
7397
|
workerId,
|
|
7390
|
-
projectName: project.getName()
|
|
7398
|
+
projectName: project.getName(),
|
|
7399
|
+
providedContext: project.getProvidedContext()
|
|
7391
7400
|
};
|
|
7392
7401
|
try {
|
|
7393
7402
|
await pool.run(data, { transferList: [workerPort], name });
|
|
@@ -7636,7 +7645,7 @@ function createWorkerChannel(project) {
|
|
|
7636
7645
|
return { workerPort, port };
|
|
7637
7646
|
}
|
|
7638
7647
|
function createVmThreadsPool(ctx, { execArgv, env, vmPath }) {
|
|
7639
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
7648
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
7640
7649
|
const numCpus = typeof nodeos.availableParallelism === "function" ? nodeos.availableParallelism() : nodeos.cpus().length;
|
|
7641
7650
|
const threadsCount = ctx.config.watch ? Math.max(Math.floor(numCpus / 2), 1) : Math.max(numCpus - 1, 1);
|
|
7642
7651
|
const maxThreads = ((_b = (_a = ctx.config.poolOptions) == null ? void 0 : _a.vmThreads) == null ? void 0 : _b.maxThreads) ?? threadsCount;
|
|
@@ -7654,12 +7663,13 @@ function createVmThreadsPool(ctx, { execArgv, env, vmPath }) {
|
|
|
7654
7663
|
"--experimental-vm-modules",
|
|
7655
7664
|
"--require",
|
|
7656
7665
|
suppressWarningsPath,
|
|
7666
|
+
...((_h = (_g = ctx.config.poolOptions) == null ? void 0 : _g.vmThreads) == null ? void 0 : _h.execArgv) ?? [],
|
|
7657
7667
|
...execArgv
|
|
7658
7668
|
],
|
|
7659
7669
|
terminateTimeout: ctx.config.teardownTimeout,
|
|
7660
7670
|
maxMemoryLimitBeforeRecycle: getMemoryLimit(ctx.config) || void 0
|
|
7661
7671
|
};
|
|
7662
|
-
if ((
|
|
7672
|
+
if ((_j = (_i = ctx.config.poolOptions) == null ? void 0 : _i.vmThreads) == null ? void 0 : _j.singleThread) {
|
|
7663
7673
|
options.concurrentTasksPerWorker = 1;
|
|
7664
7674
|
options.maxThreads = 1;
|
|
7665
7675
|
options.minThreads = 1;
|
|
@@ -7678,7 +7688,8 @@ function createVmThreadsPool(ctx, { execArgv, env, vmPath }) {
|
|
|
7678
7688
|
invalidates,
|
|
7679
7689
|
environment,
|
|
7680
7690
|
workerId,
|
|
7681
|
-
projectName: project.getName()
|
|
7691
|
+
projectName: project.getName(),
|
|
7692
|
+
providedContext: project.getProvidedContext()
|
|
7682
7693
|
};
|
|
7683
7694
|
try {
|
|
7684
7695
|
await pool.run(data, { transferList: [workerPort], name });
|
|
@@ -7795,7 +7806,7 @@ async function getTsconfig(root, config) {
|
|
|
7795
7806
|
tmpTsConfig.compilerOptions.emitDeclarationOnly = false;
|
|
7796
7807
|
tmpTsConfig.compilerOptions.incremental = true;
|
|
7797
7808
|
tmpTsConfig.compilerOptions.tsBuildInfoFile = join(
|
|
7798
|
-
__dirname,
|
|
7809
|
+
process.versions.pnp ? join(nodeos__default.tmpdir(), "vitest") : __dirname,
|
|
7799
7810
|
"tsconfig.tmp.tsbuildinfo"
|
|
7800
7811
|
);
|
|
7801
7812
|
const tsconfigFinalContent = JSON.stringify(tmpTsConfig, null, 2);
|
|
@@ -8361,7 +8372,7 @@ function createPool(ctx) {
|
|
|
8361
8372
|
var _a;
|
|
8362
8373
|
const conditions = ((_a = ctx.server.config.resolve.conditions) == null ? void 0 : _a.flatMap((c) => ["--conditions", c])) || [];
|
|
8363
8374
|
const execArgv = process.execArgv.filter(
|
|
8364
|
-
(execArg) => execArg.startsWith("--cpu-prof") || execArg.startsWith("--heap-prof")
|
|
8375
|
+
(execArg) => execArg.startsWith("--cpu-prof") || execArg.startsWith("--heap-prof") || execArg.startsWith("--diagnostic-dir")
|
|
8365
8376
|
);
|
|
8366
8377
|
const options = {
|
|
8367
8378
|
...ctx.projectFiles,
|
|
@@ -8372,7 +8383,7 @@ function createPool(ctx) {
|
|
|
8372
8383
|
env: {
|
|
8373
8384
|
TEST: "true",
|
|
8374
8385
|
VITEST: "true",
|
|
8375
|
-
NODE_ENV:
|
|
8386
|
+
NODE_ENV: process.env.NODE_ENV || "test",
|
|
8376
8387
|
VITEST_MODE: ctx.config.watch ? "WATCH" : "RUN",
|
|
8377
8388
|
...process.env,
|
|
8378
8389
|
...ctx.config.env
|
|
@@ -8621,6 +8632,7 @@ const benchmarkConfigDefaults = {
|
|
|
8621
8632
|
const defaultCoverageExcludes = [
|
|
8622
8633
|
"coverage/**",
|
|
8623
8634
|
"dist/**",
|
|
8635
|
+
"**/[.]**",
|
|
8624
8636
|
"packages/*/test?(s)/**",
|
|
8625
8637
|
"**/*.d.ts",
|
|
8626
8638
|
"**/virtual:*",
|
|
@@ -9023,6 +9035,7 @@ function resolveConfig(mode, options, viteConfig) {
|
|
|
9023
9035
|
resolved.snapshotFormat.plugins = [];
|
|
9024
9036
|
const UPDATE_SNAPSHOT = resolved.update || process.env.UPDATE_SNAPSHOT;
|
|
9025
9037
|
resolved.snapshotOptions = {
|
|
9038
|
+
expand: resolved.expandSnapshotDiff ?? false,
|
|
9026
9039
|
snapshotFormat: resolved.snapshotFormat || {},
|
|
9027
9040
|
updateSnapshot: isCI && !UPDATE_SNAPSHOT ? "none" : UPDATE_SNAPSHOT ? "all" : "new",
|
|
9028
9041
|
resolveSnapshotPath: options.resolveSnapshotPath,
|
|
@@ -9101,6 +9114,11 @@ function resolveConfig(mode, options, viteConfig) {
|
|
|
9101
9114
|
resolveModule(file, { paths: [resolved.root] }) ?? resolve(resolved.root, file)
|
|
9102
9115
|
)
|
|
9103
9116
|
);
|
|
9117
|
+
resolved.globalSetup = toArray(resolved.globalSetup || []).map(
|
|
9118
|
+
(file) => normalize(
|
|
9119
|
+
resolveModule(file, { paths: [resolved.root] }) ?? resolve(resolved.root, file)
|
|
9120
|
+
)
|
|
9121
|
+
);
|
|
9104
9122
|
resolved.coverage.exclude.push(...resolved.setupFiles.map((file) => `${resolved.coverage.allowExternal ? "**/" : ""}${relative(resolved.root, file)}`));
|
|
9105
9123
|
resolved.forceRerunTriggers = [
|
|
9106
9124
|
...resolved.forceRerunTriggers,
|
|
@@ -9155,8 +9173,10 @@ function resolveConfig(mode, options, viteConfig) {
|
|
|
9155
9173
|
resolved.browser ?? (resolved.browser = {});
|
|
9156
9174
|
(_E = resolved.browser).enabled ?? (_E.enabled = false);
|
|
9157
9175
|
(_F = resolved.browser).headless ?? (_F.headless = isCI);
|
|
9158
|
-
(_G = resolved.browser).slowHijackESM ?? (_G.slowHijackESM =
|
|
9176
|
+
(_G = resolved.browser).slowHijackESM ?? (_G.slowHijackESM = false);
|
|
9159
9177
|
(_H = resolved.browser).isolate ?? (_H.isolate = true);
|
|
9178
|
+
if (resolved.browser.enabled && provider$1 === "stackblitz")
|
|
9179
|
+
resolved.browser.provider = "none";
|
|
9160
9180
|
resolved.browser.api = resolveApiServerConfig(resolved.browser) || {
|
|
9161
9181
|
port: defaultBrowserPort
|
|
9162
9182
|
};
|
|
@@ -9172,7 +9192,15 @@ const ESC$1 = '\u001B[';
|
|
|
9172
9192
|
const OSC = '\u001B]';
|
|
9173
9193
|
const BEL = '\u0007';
|
|
9174
9194
|
const SEP = ';';
|
|
9175
|
-
|
|
9195
|
+
|
|
9196
|
+
/* global window */
|
|
9197
|
+
const isBrowser = typeof window !== 'undefined' && typeof window.document !== 'undefined';
|
|
9198
|
+
|
|
9199
|
+
const isTerminalApp = !isBrowser && process$1.env.TERM_PROGRAM === 'Apple_Terminal';
|
|
9200
|
+
const isWindows = !isBrowser && process$1.platform === 'win32';
|
|
9201
|
+
const cwdFunction = isBrowser ? () => {
|
|
9202
|
+
throw new Error('`process.cwd()` only works in Node.js, not the browser.');
|
|
9203
|
+
} : process$1.cwd;
|
|
9176
9204
|
|
|
9177
9205
|
const ansiEscapes = {};
|
|
9178
9206
|
|
|
@@ -9185,7 +9213,7 @@ ansiEscapes.cursorTo = (x, y) => {
|
|
|
9185
9213
|
return ESC$1 + (x + 1) + 'G';
|
|
9186
9214
|
}
|
|
9187
9215
|
|
|
9188
|
-
return ESC$1 + (y + 1) +
|
|
9216
|
+
return ESC$1 + (y + 1) + SEP + (x + 1) + 'H';
|
|
9189
9217
|
};
|
|
9190
9218
|
|
|
9191
9219
|
ansiEscapes.cursorMove = (x, y) => {
|
|
@@ -9249,32 +9277,33 @@ ansiEscapes.scrollDown = ESC$1 + 'T';
|
|
|
9249
9277
|
|
|
9250
9278
|
ansiEscapes.clearScreen = '\u001Bc';
|
|
9251
9279
|
|
|
9252
|
-
ansiEscapes.clearTerminal =
|
|
9253
|
-
`${ansiEscapes.eraseScreen}${ESC$1}0f`
|
|
9280
|
+
ansiEscapes.clearTerminal = isWindows
|
|
9281
|
+
? `${ansiEscapes.eraseScreen}${ESC$1}0f`
|
|
9254
9282
|
// 1. Erases the screen (Only done in case `2` is not supported)
|
|
9255
9283
|
// 2. Erases the whole screen including scrollback buffer
|
|
9256
9284
|
// 3. Moves cursor to the top-left position
|
|
9257
9285
|
// More info: https://www.real-world-systems.com/docs/ANSIcode.html
|
|
9258
|
-
`${ansiEscapes.eraseScreen}${ESC$1}3J${ESC$1}H`;
|
|
9286
|
+
: `${ansiEscapes.eraseScreen}${ESC$1}3J${ESC$1}H`;
|
|
9287
|
+
|
|
9288
|
+
ansiEscapes.enterAlternativeScreen = ESC$1 + '?1049h';
|
|
9289
|
+
ansiEscapes.exitAlternativeScreen = ESC$1 + '?1049l';
|
|
9259
9290
|
|
|
9260
9291
|
ansiEscapes.beep = BEL;
|
|
9261
9292
|
|
|
9262
|
-
ansiEscapes.link = (text, url) =>
|
|
9263
|
-
|
|
9264
|
-
|
|
9265
|
-
|
|
9266
|
-
|
|
9267
|
-
|
|
9268
|
-
|
|
9269
|
-
|
|
9270
|
-
|
|
9271
|
-
|
|
9272
|
-
|
|
9273
|
-
|
|
9274
|
-
|
|
9275
|
-
|
|
9276
|
-
].join('');
|
|
9277
|
-
};
|
|
9293
|
+
ansiEscapes.link = (text, url) => [
|
|
9294
|
+
OSC,
|
|
9295
|
+
'8',
|
|
9296
|
+
SEP,
|
|
9297
|
+
SEP,
|
|
9298
|
+
url,
|
|
9299
|
+
BEL,
|
|
9300
|
+
text,
|
|
9301
|
+
OSC,
|
|
9302
|
+
'8',
|
|
9303
|
+
SEP,
|
|
9304
|
+
SEP,
|
|
9305
|
+
BEL,
|
|
9306
|
+
].join('');
|
|
9278
9307
|
|
|
9279
9308
|
ansiEscapes.image = (buffer, options = {}) => {
|
|
9280
9309
|
let returnValue = `${OSC}1337;File=inline=1`;
|
|
@@ -9295,9 +9324,9 @@ ansiEscapes.image = (buffer, options = {}) => {
|
|
|
9295
9324
|
};
|
|
9296
9325
|
|
|
9297
9326
|
ansiEscapes.iTerm = {
|
|
9298
|
-
setCwd: (cwd =
|
|
9327
|
+
setCwd: (cwd = cwdFunction()) => `${OSC}50;CurrentDir=${cwd}${BEL}`,
|
|
9299
9328
|
|
|
9300
|
-
annotation
|
|
9329
|
+
annotation(message, options = {}) {
|
|
9301
9330
|
let returnValue = `${OSC}1337;`;
|
|
9302
9331
|
|
|
9303
9332
|
const hasX = typeof options.x !== 'undefined';
|
|
@@ -9311,16 +9340,17 @@ ansiEscapes.iTerm = {
|
|
|
9311
9340
|
returnValue += options.isHidden ? 'AddHiddenAnnotation=' : 'AddAnnotation=';
|
|
9312
9341
|
|
|
9313
9342
|
if (options.length > 0) {
|
|
9314
|
-
returnValue +=
|
|
9315
|
-
|
|
9316
|
-
|
|
9317
|
-
|
|
9343
|
+
returnValue += (
|
|
9344
|
+
hasX
|
|
9345
|
+
? [message, options.length, options.x, options.y]
|
|
9346
|
+
: [options.length, message]
|
|
9347
|
+
).join('|');
|
|
9318
9348
|
} else {
|
|
9319
9349
|
returnValue += message;
|
|
9320
9350
|
}
|
|
9321
9351
|
|
|
9322
9352
|
return returnValue + BEL;
|
|
9323
|
-
}
|
|
9353
|
+
},
|
|
9324
9354
|
};
|
|
9325
9355
|
|
|
9326
9356
|
var onetime$2 = {exports: {}};
|
|
@@ -9429,7 +9459,439 @@ cliCursor.toggle = (force, writableStream) => {
|
|
|
9429
9459
|
}
|
|
9430
9460
|
};
|
|
9431
9461
|
|
|
9432
|
-
|
|
9462
|
+
// Generated code.
|
|
9463
|
+
|
|
9464
|
+
function isAmbiguous(x) {
|
|
9465
|
+
return x === 0xA1
|
|
9466
|
+
|| x === 0xA4
|
|
9467
|
+
|| x === 0xA7
|
|
9468
|
+
|| x === 0xA8
|
|
9469
|
+
|| x === 0xAA
|
|
9470
|
+
|| x === 0xAD
|
|
9471
|
+
|| x === 0xAE
|
|
9472
|
+
|| x >= 0xB0 && x <= 0xB4
|
|
9473
|
+
|| x >= 0xB6 && x <= 0xBA
|
|
9474
|
+
|| x >= 0xBC && x <= 0xBF
|
|
9475
|
+
|| x === 0xC6
|
|
9476
|
+
|| x === 0xD0
|
|
9477
|
+
|| x === 0xD7
|
|
9478
|
+
|| x === 0xD8
|
|
9479
|
+
|| x >= 0xDE && x <= 0xE1
|
|
9480
|
+
|| x === 0xE6
|
|
9481
|
+
|| x >= 0xE8 && x <= 0xEA
|
|
9482
|
+
|| x === 0xEC
|
|
9483
|
+
|| x === 0xED
|
|
9484
|
+
|| x === 0xF0
|
|
9485
|
+
|| x === 0xF2
|
|
9486
|
+
|| x === 0xF3
|
|
9487
|
+
|| x >= 0xF7 && x <= 0xFA
|
|
9488
|
+
|| x === 0xFC
|
|
9489
|
+
|| x === 0xFE
|
|
9490
|
+
|| x === 0x101
|
|
9491
|
+
|| x === 0x111
|
|
9492
|
+
|| x === 0x113
|
|
9493
|
+
|| x === 0x11B
|
|
9494
|
+
|| x === 0x126
|
|
9495
|
+
|| x === 0x127
|
|
9496
|
+
|| x === 0x12B
|
|
9497
|
+
|| x >= 0x131 && x <= 0x133
|
|
9498
|
+
|| x === 0x138
|
|
9499
|
+
|| x >= 0x13F && x <= 0x142
|
|
9500
|
+
|| x === 0x144
|
|
9501
|
+
|| x >= 0x148 && x <= 0x14B
|
|
9502
|
+
|| x === 0x14D
|
|
9503
|
+
|| x === 0x152
|
|
9504
|
+
|| x === 0x153
|
|
9505
|
+
|| x === 0x166
|
|
9506
|
+
|| x === 0x167
|
|
9507
|
+
|| x === 0x16B
|
|
9508
|
+
|| x === 0x1CE
|
|
9509
|
+
|| x === 0x1D0
|
|
9510
|
+
|| x === 0x1D2
|
|
9511
|
+
|| x === 0x1D4
|
|
9512
|
+
|| x === 0x1D6
|
|
9513
|
+
|| x === 0x1D8
|
|
9514
|
+
|| x === 0x1DA
|
|
9515
|
+
|| x === 0x1DC
|
|
9516
|
+
|| x === 0x251
|
|
9517
|
+
|| x === 0x261
|
|
9518
|
+
|| x === 0x2C4
|
|
9519
|
+
|| x === 0x2C7
|
|
9520
|
+
|| x >= 0x2C9 && x <= 0x2CB
|
|
9521
|
+
|| x === 0x2CD
|
|
9522
|
+
|| x === 0x2D0
|
|
9523
|
+
|| x >= 0x2D8 && x <= 0x2DB
|
|
9524
|
+
|| x === 0x2DD
|
|
9525
|
+
|| x === 0x2DF
|
|
9526
|
+
|| x >= 0x300 && x <= 0x36F
|
|
9527
|
+
|| x >= 0x391 && x <= 0x3A1
|
|
9528
|
+
|| x >= 0x3A3 && x <= 0x3A9
|
|
9529
|
+
|| x >= 0x3B1 && x <= 0x3C1
|
|
9530
|
+
|| x >= 0x3C3 && x <= 0x3C9
|
|
9531
|
+
|| x === 0x401
|
|
9532
|
+
|| x >= 0x410 && x <= 0x44F
|
|
9533
|
+
|| x === 0x451
|
|
9534
|
+
|| x === 0x2010
|
|
9535
|
+
|| x >= 0x2013 && x <= 0x2016
|
|
9536
|
+
|| x === 0x2018
|
|
9537
|
+
|| x === 0x2019
|
|
9538
|
+
|| x === 0x201C
|
|
9539
|
+
|| x === 0x201D
|
|
9540
|
+
|| x >= 0x2020 && x <= 0x2022
|
|
9541
|
+
|| x >= 0x2024 && x <= 0x2027
|
|
9542
|
+
|| x === 0x2030
|
|
9543
|
+
|| x === 0x2032
|
|
9544
|
+
|| x === 0x2033
|
|
9545
|
+
|| x === 0x2035
|
|
9546
|
+
|| x === 0x203B
|
|
9547
|
+
|| x === 0x203E
|
|
9548
|
+
|| x === 0x2074
|
|
9549
|
+
|| x === 0x207F
|
|
9550
|
+
|| x >= 0x2081 && x <= 0x2084
|
|
9551
|
+
|| x === 0x20AC
|
|
9552
|
+
|| x === 0x2103
|
|
9553
|
+
|| x === 0x2105
|
|
9554
|
+
|| x === 0x2109
|
|
9555
|
+
|| x === 0x2113
|
|
9556
|
+
|| x === 0x2116
|
|
9557
|
+
|| x === 0x2121
|
|
9558
|
+
|| x === 0x2122
|
|
9559
|
+
|| x === 0x2126
|
|
9560
|
+
|| x === 0x212B
|
|
9561
|
+
|| x === 0x2153
|
|
9562
|
+
|| x === 0x2154
|
|
9563
|
+
|| x >= 0x215B && x <= 0x215E
|
|
9564
|
+
|| x >= 0x2160 && x <= 0x216B
|
|
9565
|
+
|| x >= 0x2170 && x <= 0x2179
|
|
9566
|
+
|| x === 0x2189
|
|
9567
|
+
|| x >= 0x2190 && x <= 0x2199
|
|
9568
|
+
|| x === 0x21B8
|
|
9569
|
+
|| x === 0x21B9
|
|
9570
|
+
|| x === 0x21D2
|
|
9571
|
+
|| x === 0x21D4
|
|
9572
|
+
|| x === 0x21E7
|
|
9573
|
+
|| x === 0x2200
|
|
9574
|
+
|| x === 0x2202
|
|
9575
|
+
|| x === 0x2203
|
|
9576
|
+
|| x === 0x2207
|
|
9577
|
+
|| x === 0x2208
|
|
9578
|
+
|| x === 0x220B
|
|
9579
|
+
|| x === 0x220F
|
|
9580
|
+
|| x === 0x2211
|
|
9581
|
+
|| x === 0x2215
|
|
9582
|
+
|| x === 0x221A
|
|
9583
|
+
|| x >= 0x221D && x <= 0x2220
|
|
9584
|
+
|| x === 0x2223
|
|
9585
|
+
|| x === 0x2225
|
|
9586
|
+
|| x >= 0x2227 && x <= 0x222C
|
|
9587
|
+
|| x === 0x222E
|
|
9588
|
+
|| x >= 0x2234 && x <= 0x2237
|
|
9589
|
+
|| x === 0x223C
|
|
9590
|
+
|| x === 0x223D
|
|
9591
|
+
|| x === 0x2248
|
|
9592
|
+
|| x === 0x224C
|
|
9593
|
+
|| x === 0x2252
|
|
9594
|
+
|| x === 0x2260
|
|
9595
|
+
|| x === 0x2261
|
|
9596
|
+
|| x >= 0x2264 && x <= 0x2267
|
|
9597
|
+
|| x === 0x226A
|
|
9598
|
+
|| x === 0x226B
|
|
9599
|
+
|| x === 0x226E
|
|
9600
|
+
|| x === 0x226F
|
|
9601
|
+
|| x === 0x2282
|
|
9602
|
+
|| x === 0x2283
|
|
9603
|
+
|| x === 0x2286
|
|
9604
|
+
|| x === 0x2287
|
|
9605
|
+
|| x === 0x2295
|
|
9606
|
+
|| x === 0x2299
|
|
9607
|
+
|| x === 0x22A5
|
|
9608
|
+
|| x === 0x22BF
|
|
9609
|
+
|| x === 0x2312
|
|
9610
|
+
|| x >= 0x2460 && x <= 0x24E9
|
|
9611
|
+
|| x >= 0x24EB && x <= 0x254B
|
|
9612
|
+
|| x >= 0x2550 && x <= 0x2573
|
|
9613
|
+
|| x >= 0x2580 && x <= 0x258F
|
|
9614
|
+
|| x >= 0x2592 && x <= 0x2595
|
|
9615
|
+
|| x === 0x25A0
|
|
9616
|
+
|| x === 0x25A1
|
|
9617
|
+
|| x >= 0x25A3 && x <= 0x25A9
|
|
9618
|
+
|| x === 0x25B2
|
|
9619
|
+
|| x === 0x25B3
|
|
9620
|
+
|| x === 0x25B6
|
|
9621
|
+
|| x === 0x25B7
|
|
9622
|
+
|| x === 0x25BC
|
|
9623
|
+
|| x === 0x25BD
|
|
9624
|
+
|| x === 0x25C0
|
|
9625
|
+
|| x === 0x25C1
|
|
9626
|
+
|| x >= 0x25C6 && x <= 0x25C8
|
|
9627
|
+
|| x === 0x25CB
|
|
9628
|
+
|| x >= 0x25CE && x <= 0x25D1
|
|
9629
|
+
|| x >= 0x25E2 && x <= 0x25E5
|
|
9630
|
+
|| x === 0x25EF
|
|
9631
|
+
|| x === 0x2605
|
|
9632
|
+
|| x === 0x2606
|
|
9633
|
+
|| x === 0x2609
|
|
9634
|
+
|| x === 0x260E
|
|
9635
|
+
|| x === 0x260F
|
|
9636
|
+
|| x === 0x261C
|
|
9637
|
+
|| x === 0x261E
|
|
9638
|
+
|| x === 0x2640
|
|
9639
|
+
|| x === 0x2642
|
|
9640
|
+
|| x === 0x2660
|
|
9641
|
+
|| x === 0x2661
|
|
9642
|
+
|| x >= 0x2663 && x <= 0x2665
|
|
9643
|
+
|| x >= 0x2667 && x <= 0x266A
|
|
9644
|
+
|| x === 0x266C
|
|
9645
|
+
|| x === 0x266D
|
|
9646
|
+
|| x === 0x266F
|
|
9647
|
+
|| x === 0x269E
|
|
9648
|
+
|| x === 0x269F
|
|
9649
|
+
|| x === 0x26BF
|
|
9650
|
+
|| x >= 0x26C6 && x <= 0x26CD
|
|
9651
|
+
|| x >= 0x26CF && x <= 0x26D3
|
|
9652
|
+
|| x >= 0x26D5 && x <= 0x26E1
|
|
9653
|
+
|| x === 0x26E3
|
|
9654
|
+
|| x === 0x26E8
|
|
9655
|
+
|| x === 0x26E9
|
|
9656
|
+
|| x >= 0x26EB && x <= 0x26F1
|
|
9657
|
+
|| x === 0x26F4
|
|
9658
|
+
|| x >= 0x26F6 && x <= 0x26F9
|
|
9659
|
+
|| x === 0x26FB
|
|
9660
|
+
|| x === 0x26FC
|
|
9661
|
+
|| x === 0x26FE
|
|
9662
|
+
|| x === 0x26FF
|
|
9663
|
+
|| x === 0x273D
|
|
9664
|
+
|| x >= 0x2776 && x <= 0x277F
|
|
9665
|
+
|| x >= 0x2B56 && x <= 0x2B59
|
|
9666
|
+
|| x >= 0x3248 && x <= 0x324F
|
|
9667
|
+
|| x >= 0xE000 && x <= 0xF8FF
|
|
9668
|
+
|| x >= 0xFE00 && x <= 0xFE0F
|
|
9669
|
+
|| x === 0xFFFD
|
|
9670
|
+
|| x >= 0x1F100 && x <= 0x1F10A
|
|
9671
|
+
|| x >= 0x1F110 && x <= 0x1F12D
|
|
9672
|
+
|| x >= 0x1F130 && x <= 0x1F169
|
|
9673
|
+
|| x >= 0x1F170 && x <= 0x1F18D
|
|
9674
|
+
|| x === 0x1F18F
|
|
9675
|
+
|| x === 0x1F190
|
|
9676
|
+
|| x >= 0x1F19B && x <= 0x1F1AC
|
|
9677
|
+
|| x >= 0xE0100 && x <= 0xE01EF
|
|
9678
|
+
|| x >= 0xF0000 && x <= 0xFFFFD
|
|
9679
|
+
|| x >= 0x100000 && x <= 0x10FFFD;
|
|
9680
|
+
}
|
|
9681
|
+
|
|
9682
|
+
function isFullWidth(x) {
|
|
9683
|
+
return x === 0x3000
|
|
9684
|
+
|| x >= 0xFF01 && x <= 0xFF60
|
|
9685
|
+
|| x >= 0xFFE0 && x <= 0xFFE6;
|
|
9686
|
+
}
|
|
9687
|
+
|
|
9688
|
+
function isWide(x) {
|
|
9689
|
+
return x >= 0x1100 && x <= 0x115F
|
|
9690
|
+
|| x === 0x231A
|
|
9691
|
+
|| x === 0x231B
|
|
9692
|
+
|| x === 0x2329
|
|
9693
|
+
|| x === 0x232A
|
|
9694
|
+
|| x >= 0x23E9 && x <= 0x23EC
|
|
9695
|
+
|| x === 0x23F0
|
|
9696
|
+
|| x === 0x23F3
|
|
9697
|
+
|| x === 0x25FD
|
|
9698
|
+
|| x === 0x25FE
|
|
9699
|
+
|| x === 0x2614
|
|
9700
|
+
|| x === 0x2615
|
|
9701
|
+
|| x >= 0x2648 && x <= 0x2653
|
|
9702
|
+
|| x === 0x267F
|
|
9703
|
+
|| x === 0x2693
|
|
9704
|
+
|| x === 0x26A1
|
|
9705
|
+
|| x === 0x26AA
|
|
9706
|
+
|| x === 0x26AB
|
|
9707
|
+
|| x === 0x26BD
|
|
9708
|
+
|| x === 0x26BE
|
|
9709
|
+
|| x === 0x26C4
|
|
9710
|
+
|| x === 0x26C5
|
|
9711
|
+
|| x === 0x26CE
|
|
9712
|
+
|| x === 0x26D4
|
|
9713
|
+
|| x === 0x26EA
|
|
9714
|
+
|| x === 0x26F2
|
|
9715
|
+
|| x === 0x26F3
|
|
9716
|
+
|| x === 0x26F5
|
|
9717
|
+
|| x === 0x26FA
|
|
9718
|
+
|| x === 0x26FD
|
|
9719
|
+
|| x === 0x2705
|
|
9720
|
+
|| x === 0x270A
|
|
9721
|
+
|| x === 0x270B
|
|
9722
|
+
|| x === 0x2728
|
|
9723
|
+
|| x === 0x274C
|
|
9724
|
+
|| x === 0x274E
|
|
9725
|
+
|| x >= 0x2753 && x <= 0x2755
|
|
9726
|
+
|| x === 0x2757
|
|
9727
|
+
|| x >= 0x2795 && x <= 0x2797
|
|
9728
|
+
|| x === 0x27B0
|
|
9729
|
+
|| x === 0x27BF
|
|
9730
|
+
|| x === 0x2B1B
|
|
9731
|
+
|| x === 0x2B1C
|
|
9732
|
+
|| x === 0x2B50
|
|
9733
|
+
|| x === 0x2B55
|
|
9734
|
+
|| x >= 0x2E80 && x <= 0x2E99
|
|
9735
|
+
|| x >= 0x2E9B && x <= 0x2EF3
|
|
9736
|
+
|| x >= 0x2F00 && x <= 0x2FD5
|
|
9737
|
+
|| x >= 0x2FF0 && x <= 0x2FFF
|
|
9738
|
+
|| x >= 0x3001 && x <= 0x303E
|
|
9739
|
+
|| x >= 0x3041 && x <= 0x3096
|
|
9740
|
+
|| x >= 0x3099 && x <= 0x30FF
|
|
9741
|
+
|| x >= 0x3105 && x <= 0x312F
|
|
9742
|
+
|| x >= 0x3131 && x <= 0x318E
|
|
9743
|
+
|| x >= 0x3190 && x <= 0x31E3
|
|
9744
|
+
|| x >= 0x31EF && x <= 0x321E
|
|
9745
|
+
|| x >= 0x3220 && x <= 0x3247
|
|
9746
|
+
|| x >= 0x3250 && x <= 0x4DBF
|
|
9747
|
+
|| x >= 0x4E00 && x <= 0xA48C
|
|
9748
|
+
|| x >= 0xA490 && x <= 0xA4C6
|
|
9749
|
+
|| x >= 0xA960 && x <= 0xA97C
|
|
9750
|
+
|| x >= 0xAC00 && x <= 0xD7A3
|
|
9751
|
+
|| x >= 0xF900 && x <= 0xFAFF
|
|
9752
|
+
|| x >= 0xFE10 && x <= 0xFE19
|
|
9753
|
+
|| x >= 0xFE30 && x <= 0xFE52
|
|
9754
|
+
|| x >= 0xFE54 && x <= 0xFE66
|
|
9755
|
+
|| x >= 0xFE68 && x <= 0xFE6B
|
|
9756
|
+
|| x >= 0x16FE0 && x <= 0x16FE4
|
|
9757
|
+
|| x === 0x16FF0
|
|
9758
|
+
|| x === 0x16FF1
|
|
9759
|
+
|| x >= 0x17000 && x <= 0x187F7
|
|
9760
|
+
|| x >= 0x18800 && x <= 0x18CD5
|
|
9761
|
+
|| x >= 0x18D00 && x <= 0x18D08
|
|
9762
|
+
|| x >= 0x1AFF0 && x <= 0x1AFF3
|
|
9763
|
+
|| x >= 0x1AFF5 && x <= 0x1AFFB
|
|
9764
|
+
|| x === 0x1AFFD
|
|
9765
|
+
|| x === 0x1AFFE
|
|
9766
|
+
|| x >= 0x1B000 && x <= 0x1B122
|
|
9767
|
+
|| x === 0x1B132
|
|
9768
|
+
|| x >= 0x1B150 && x <= 0x1B152
|
|
9769
|
+
|| x === 0x1B155
|
|
9770
|
+
|| x >= 0x1B164 && x <= 0x1B167
|
|
9771
|
+
|| x >= 0x1B170 && x <= 0x1B2FB
|
|
9772
|
+
|| x === 0x1F004
|
|
9773
|
+
|| x === 0x1F0CF
|
|
9774
|
+
|| x === 0x1F18E
|
|
9775
|
+
|| x >= 0x1F191 && x <= 0x1F19A
|
|
9776
|
+
|| x >= 0x1F200 && x <= 0x1F202
|
|
9777
|
+
|| x >= 0x1F210 && x <= 0x1F23B
|
|
9778
|
+
|| x >= 0x1F240 && x <= 0x1F248
|
|
9779
|
+
|| x === 0x1F250
|
|
9780
|
+
|| x === 0x1F251
|
|
9781
|
+
|| x >= 0x1F260 && x <= 0x1F265
|
|
9782
|
+
|| x >= 0x1F300 && x <= 0x1F320
|
|
9783
|
+
|| x >= 0x1F32D && x <= 0x1F335
|
|
9784
|
+
|| x >= 0x1F337 && x <= 0x1F37C
|
|
9785
|
+
|| x >= 0x1F37E && x <= 0x1F393
|
|
9786
|
+
|| x >= 0x1F3A0 && x <= 0x1F3CA
|
|
9787
|
+
|| x >= 0x1F3CF && x <= 0x1F3D3
|
|
9788
|
+
|| x >= 0x1F3E0 && x <= 0x1F3F0
|
|
9789
|
+
|| x === 0x1F3F4
|
|
9790
|
+
|| x >= 0x1F3F8 && x <= 0x1F43E
|
|
9791
|
+
|| x === 0x1F440
|
|
9792
|
+
|| x >= 0x1F442 && x <= 0x1F4FC
|
|
9793
|
+
|| x >= 0x1F4FF && x <= 0x1F53D
|
|
9794
|
+
|| x >= 0x1F54B && x <= 0x1F54E
|
|
9795
|
+
|| x >= 0x1F550 && x <= 0x1F567
|
|
9796
|
+
|| x === 0x1F57A
|
|
9797
|
+
|| x === 0x1F595
|
|
9798
|
+
|| x === 0x1F596
|
|
9799
|
+
|| x === 0x1F5A4
|
|
9800
|
+
|| x >= 0x1F5FB && x <= 0x1F64F
|
|
9801
|
+
|| x >= 0x1F680 && x <= 0x1F6C5
|
|
9802
|
+
|| x === 0x1F6CC
|
|
9803
|
+
|| x >= 0x1F6D0 && x <= 0x1F6D2
|
|
9804
|
+
|| x >= 0x1F6D5 && x <= 0x1F6D7
|
|
9805
|
+
|| x >= 0x1F6DC && x <= 0x1F6DF
|
|
9806
|
+
|| x === 0x1F6EB
|
|
9807
|
+
|| x === 0x1F6EC
|
|
9808
|
+
|| x >= 0x1F6F4 && x <= 0x1F6FC
|
|
9809
|
+
|| x >= 0x1F7E0 && x <= 0x1F7EB
|
|
9810
|
+
|| x === 0x1F7F0
|
|
9811
|
+
|| x >= 0x1F90C && x <= 0x1F93A
|
|
9812
|
+
|| x >= 0x1F93C && x <= 0x1F945
|
|
9813
|
+
|| x >= 0x1F947 && x <= 0x1F9FF
|
|
9814
|
+
|| x >= 0x1FA70 && x <= 0x1FA7C
|
|
9815
|
+
|| x >= 0x1FA80 && x <= 0x1FA88
|
|
9816
|
+
|| x >= 0x1FA90 && x <= 0x1FABD
|
|
9817
|
+
|| x >= 0x1FABF && x <= 0x1FAC5
|
|
9818
|
+
|| x >= 0x1FACE && x <= 0x1FADB
|
|
9819
|
+
|| x >= 0x1FAE0 && x <= 0x1FAE8
|
|
9820
|
+
|| x >= 0x1FAF0 && x <= 0x1FAF8
|
|
9821
|
+
|| x >= 0x20000 && x <= 0x2FFFD
|
|
9822
|
+
|| x >= 0x30000 && x <= 0x3FFFD;
|
|
9823
|
+
}
|
|
9824
|
+
|
|
9825
|
+
function validate(codePoint) {
|
|
9826
|
+
if (!Number.isSafeInteger(codePoint)) {
|
|
9827
|
+
throw new TypeError(`Expected a code point, got \`${typeof codePoint}\`.`);
|
|
9828
|
+
}
|
|
9829
|
+
}
|
|
9830
|
+
|
|
9831
|
+
function eastAsianWidth(codePoint, {ambiguousAsWide = false} = {}) {
|
|
9832
|
+
validate(codePoint);
|
|
9833
|
+
|
|
9834
|
+
if (
|
|
9835
|
+
isFullWidth(codePoint)
|
|
9836
|
+
|| isWide(codePoint)
|
|
9837
|
+
|| (ambiguousAsWide && isAmbiguous(codePoint))
|
|
9838
|
+
) {
|
|
9839
|
+
return 2;
|
|
9840
|
+
}
|
|
9841
|
+
|
|
9842
|
+
return 1;
|
|
9843
|
+
}
|
|
9844
|
+
|
|
9845
|
+
var emojiRegex = () => {
|
|
9846
|
+
// https://mths.be/emoji
|
|
9847
|
+
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\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]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\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])?|[\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-\uDF43\uDF45-\uDF4A\uDF4C-\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]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\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(?:[\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\uDEB5](?:\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-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\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\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\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\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\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\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\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\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\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\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\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\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\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\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\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\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\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\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\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\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\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\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\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\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\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?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\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])?|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\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\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\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\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\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\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\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\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\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\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\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\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\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;
|
|
9848
|
+
};
|
|
9849
|
+
|
|
9850
|
+
function stringWidth(string, options = {}) {
|
|
9851
|
+
if (typeof string !== 'string' || string.length === 0) {
|
|
9852
|
+
return 0;
|
|
9853
|
+
}
|
|
9854
|
+
|
|
9855
|
+
const {
|
|
9856
|
+
ambiguousIsNarrow = true,
|
|
9857
|
+
countAnsiEscapeCodes = false,
|
|
9858
|
+
} = options;
|
|
9859
|
+
|
|
9860
|
+
if (!countAnsiEscapeCodes) {
|
|
9861
|
+
string = stripAnsi(string);
|
|
9862
|
+
}
|
|
9863
|
+
|
|
9864
|
+
if (string.length === 0) {
|
|
9865
|
+
return 0;
|
|
9866
|
+
}
|
|
9867
|
+
|
|
9868
|
+
let width = 0;
|
|
9869
|
+
|
|
9870
|
+
for (const {segment: character} of new Intl.Segmenter().segment(string)) {
|
|
9871
|
+
const codePoint = character.codePointAt(0);
|
|
9872
|
+
|
|
9873
|
+
// Ignore control characters
|
|
9874
|
+
if (codePoint <= 0x1F || (codePoint >= 0x7F && codePoint <= 0x9F)) {
|
|
9875
|
+
continue;
|
|
9876
|
+
}
|
|
9877
|
+
|
|
9878
|
+
// Ignore combining characters
|
|
9879
|
+
if (codePoint >= 0x3_00 && codePoint <= 0x3_6F) {
|
|
9880
|
+
continue;
|
|
9881
|
+
}
|
|
9882
|
+
|
|
9883
|
+
if (emojiRegex().test(character)) {
|
|
9884
|
+
width += 2;
|
|
9885
|
+
continue;
|
|
9886
|
+
}
|
|
9887
|
+
|
|
9888
|
+
width += eastAsianWidth(codePoint, {ambiguousAsWide: !ambiguousIsNarrow});
|
|
9889
|
+
}
|
|
9890
|
+
|
|
9891
|
+
return width;
|
|
9892
|
+
}
|
|
9893
|
+
|
|
9894
|
+
const ESCAPES$1 = new Set([
|
|
9433
9895
|
'\u001B',
|
|
9434
9896
|
'\u009B',
|
|
9435
9897
|
]);
|
|
@@ -9441,8 +9903,8 @@ const ANSI_OSC = ']';
|
|
|
9441
9903
|
const ANSI_SGR_TERMINATOR = 'm';
|
|
9442
9904
|
const ANSI_ESCAPE_LINK = `${ANSI_OSC}8;;`;
|
|
9443
9905
|
|
|
9444
|
-
const wrapAnsiCode = code => `${ESCAPES.values().next().value}${ANSI_CSI}${code}${ANSI_SGR_TERMINATOR}`;
|
|
9445
|
-
const wrapAnsiHyperlink =
|
|
9906
|
+
const wrapAnsiCode = code => `${ESCAPES$1.values().next().value}${ANSI_CSI}${code}${ANSI_SGR_TERMINATOR}`;
|
|
9907
|
+
const wrapAnsiHyperlink = url => `${ESCAPES$1.values().next().value}${ANSI_ESCAPE_LINK}${url}${ANSI_ESCAPE_BELL}`;
|
|
9446
9908
|
|
|
9447
9909
|
// Calculate the length of words split on ' ', ignoring
|
|
9448
9910
|
// the extra characters added by ansi escape codes
|
|
@@ -9455,7 +9917,7 @@ const wrapWord = (rows, word, columns) => {
|
|
|
9455
9917
|
|
|
9456
9918
|
let isInsideEscape = false;
|
|
9457
9919
|
let isInsideLinkEscape = false;
|
|
9458
|
-
let visible = stringWidth(stripAnsi(rows
|
|
9920
|
+
let visible = stringWidth(stripAnsi(rows.at(-1)));
|
|
9459
9921
|
|
|
9460
9922
|
for (const [index, character] of characters.entries()) {
|
|
9461
9923
|
const characterLength = stringWidth(character);
|
|
@@ -9467,9 +9929,11 @@ const wrapWord = (rows, word, columns) => {
|
|
|
9467
9929
|
visible = 0;
|
|
9468
9930
|
}
|
|
9469
9931
|
|
|
9470
|
-
if (ESCAPES.has(character)) {
|
|
9932
|
+
if (ESCAPES$1.has(character)) {
|
|
9471
9933
|
isInsideEscape = true;
|
|
9472
|
-
|
|
9934
|
+
|
|
9935
|
+
const ansiEscapeLinkCandidate = characters.slice(index + 1, index + 1 + ANSI_ESCAPE_LINK.length).join('');
|
|
9936
|
+
isInsideLinkEscape = ansiEscapeLinkCandidate === ANSI_ESCAPE_LINK;
|
|
9473
9937
|
}
|
|
9474
9938
|
|
|
9475
9939
|
if (isInsideEscape) {
|
|
@@ -9495,7 +9959,7 @@ const wrapWord = (rows, word, columns) => {
|
|
|
9495
9959
|
|
|
9496
9960
|
// It's possible that the last row we copy over is only
|
|
9497
9961
|
// ansi escape characters, handle this edge-case
|
|
9498
|
-
if (!visible && rows
|
|
9962
|
+
if (!visible && rows.at(-1).length > 0 && rows.length > 1) {
|
|
9499
9963
|
rows[rows.length - 2] += rows.pop();
|
|
9500
9964
|
}
|
|
9501
9965
|
};
|
|
@@ -9520,11 +9984,11 @@ const stringVisibleTrimSpacesRight = string => {
|
|
|
9520
9984
|
return words.slice(0, last).join(' ') + words.slice(last).join('');
|
|
9521
9985
|
};
|
|
9522
9986
|
|
|
9523
|
-
// The wrap-ansi module can be invoked in either 'hard' or 'soft' wrap mode
|
|
9987
|
+
// The wrap-ansi module can be invoked in either 'hard' or 'soft' wrap mode.
|
|
9524
9988
|
//
|
|
9525
|
-
// 'hard' will never allow a string to take up more than columns characters
|
|
9989
|
+
// 'hard' will never allow a string to take up more than columns characters.
|
|
9526
9990
|
//
|
|
9527
|
-
// 'soft' allows long words to expand past the column length
|
|
9991
|
+
// 'soft' allows long words to expand past the column length.
|
|
9528
9992
|
const exec = (string, columns, options = {}) => {
|
|
9529
9993
|
if (options.trim !== false && string.trim() === '') {
|
|
9530
9994
|
return '';
|
|
@@ -9539,10 +10003,10 @@ const exec = (string, columns, options = {}) => {
|
|
|
9539
10003
|
|
|
9540
10004
|
for (const [index, word] of string.split(' ').entries()) {
|
|
9541
10005
|
if (options.trim !== false) {
|
|
9542
|
-
rows[rows.length - 1] = rows
|
|
10006
|
+
rows[rows.length - 1] = rows.at(-1).trimStart();
|
|
9543
10007
|
}
|
|
9544
10008
|
|
|
9545
|
-
let rowLength = stringWidth(rows
|
|
10009
|
+
let rowLength = stringWidth(rows.at(-1));
|
|
9546
10010
|
|
|
9547
10011
|
if (index !== 0) {
|
|
9548
10012
|
if (rowLength >= columns && (options.wordWrap === false || options.trim === false)) {
|
|
@@ -9591,13 +10055,17 @@ const exec = (string, columns, options = {}) => {
|
|
|
9591
10055
|
rows = rows.map(row => stringVisibleTrimSpacesRight(row));
|
|
9592
10056
|
}
|
|
9593
10057
|
|
|
9594
|
-
const
|
|
10058
|
+
const preString = rows.join('\n');
|
|
10059
|
+
const pre = [...preString];
|
|
10060
|
+
|
|
10061
|
+
// We need to keep a separate index as `String#slice()` works on Unicode code units, while `pre` is an array of codepoints.
|
|
10062
|
+
let preStringIndex = 0;
|
|
9595
10063
|
|
|
9596
10064
|
for (const [index, character] of pre.entries()) {
|
|
9597
10065
|
returnValue += character;
|
|
9598
10066
|
|
|
9599
|
-
if (ESCAPES.has(character)) {
|
|
9600
|
-
const {groups} = new RegExp(`(?:\\${ANSI_CSI}(?<code>\\d+)m|\\${ANSI_ESCAPE_LINK}(?<uri>.*)${ANSI_ESCAPE_BELL})`).exec(
|
|
10067
|
+
if (ESCAPES$1.has(character)) {
|
|
10068
|
+
const {groups} = new RegExp(`(?:\\${ANSI_CSI}(?<code>\\d+)m|\\${ANSI_ESCAPE_LINK}(?<uri>.*)${ANSI_ESCAPE_BELL})`).exec(preString.slice(preStringIndex)) || {groups: {}};
|
|
9601
10069
|
if (groups.code !== undefined) {
|
|
9602
10070
|
const code = Number.parseFloat(groups.code);
|
|
9603
10071
|
escapeCode = code === END_CODE ? undefined : code;
|
|
@@ -9625,6 +10093,8 @@ const exec = (string, columns, options = {}) => {
|
|
|
9625
10093
|
returnValue += wrapAnsiHyperlink(escapeUrl);
|
|
9626
10094
|
}
|
|
9627
10095
|
}
|
|
10096
|
+
|
|
10097
|
+
preStringIndex += character.length;
|
|
9628
10098
|
}
|
|
9629
10099
|
|
|
9630
10100
|
return returnValue;
|
|
@@ -9634,12 +10104,185 @@ const exec = (string, columns, options = {}) => {
|
|
|
9634
10104
|
function wrapAnsi(string, columns, options) {
|
|
9635
10105
|
return String(string)
|
|
9636
10106
|
.normalize()
|
|
9637
|
-
.
|
|
10107
|
+
.replaceAll('\r\n', '\n')
|
|
9638
10108
|
.split('\n')
|
|
9639
10109
|
.map(line => exec(line, columns, options))
|
|
9640
10110
|
.join('\n');
|
|
9641
10111
|
}
|
|
9642
10112
|
|
|
10113
|
+
function isFullwidthCodePoint(codePoint) {
|
|
10114
|
+
if (!Number.isInteger(codePoint)) {
|
|
10115
|
+
return false;
|
|
10116
|
+
}
|
|
10117
|
+
|
|
10118
|
+
return eastAsianWidth(codePoint) === 2;
|
|
10119
|
+
}
|
|
10120
|
+
|
|
10121
|
+
// \x1b and \x9b
|
|
10122
|
+
const ESCAPES = new Set([27, 155]);
|
|
10123
|
+
|
|
10124
|
+
const CODE_POINT_0 = '0'.codePointAt(0);
|
|
10125
|
+
const CODE_POINT_9 = '9'.codePointAt(0);
|
|
10126
|
+
|
|
10127
|
+
const endCodesSet = new Set();
|
|
10128
|
+
const endCodesMap = new Map();
|
|
10129
|
+
for (const [start, end] of ansiStyles.codes) {
|
|
10130
|
+
endCodesSet.add(ansiStyles.color.ansi(end));
|
|
10131
|
+
endCodesMap.set(ansiStyles.color.ansi(start), ansiStyles.color.ansi(end));
|
|
10132
|
+
}
|
|
10133
|
+
|
|
10134
|
+
function getEndCode(code) {
|
|
10135
|
+
if (endCodesSet.has(code)) {
|
|
10136
|
+
return code;
|
|
10137
|
+
}
|
|
10138
|
+
|
|
10139
|
+
if (endCodesMap.has(code)) {
|
|
10140
|
+
return endCodesMap.get(code);
|
|
10141
|
+
}
|
|
10142
|
+
|
|
10143
|
+
code = code.slice(2);
|
|
10144
|
+
if (code.includes(';')) {
|
|
10145
|
+
code = code[0] + '0';
|
|
10146
|
+
}
|
|
10147
|
+
|
|
10148
|
+
const returnValue = ansiStyles.codes.get(Number.parseInt(code, 10));
|
|
10149
|
+
if (returnValue) {
|
|
10150
|
+
return ansiStyles.color.ansi(returnValue);
|
|
10151
|
+
}
|
|
10152
|
+
|
|
10153
|
+
return ansiStyles.reset.open;
|
|
10154
|
+
}
|
|
10155
|
+
|
|
10156
|
+
function findNumberIndex(string) {
|
|
10157
|
+
for (let index = 0; index < string.length; index++) {
|
|
10158
|
+
const codePoint = string.codePointAt(index);
|
|
10159
|
+
if (codePoint >= CODE_POINT_0 && codePoint <= CODE_POINT_9) {
|
|
10160
|
+
return index;
|
|
10161
|
+
}
|
|
10162
|
+
}
|
|
10163
|
+
|
|
10164
|
+
return -1;
|
|
10165
|
+
}
|
|
10166
|
+
|
|
10167
|
+
function parseAnsiCode(string, offset) {
|
|
10168
|
+
string = string.slice(offset, offset + 19);
|
|
10169
|
+
const startIndex = findNumberIndex(string);
|
|
10170
|
+
if (startIndex !== -1) {
|
|
10171
|
+
let endIndex = string.indexOf('m', startIndex);
|
|
10172
|
+
if (endIndex === -1) {
|
|
10173
|
+
endIndex = string.length;
|
|
10174
|
+
}
|
|
10175
|
+
|
|
10176
|
+
return string.slice(0, endIndex + 1);
|
|
10177
|
+
}
|
|
10178
|
+
}
|
|
10179
|
+
|
|
10180
|
+
function tokenize(string, endCharacter = Number.POSITIVE_INFINITY) {
|
|
10181
|
+
const returnValue = [];
|
|
10182
|
+
|
|
10183
|
+
let index = 0;
|
|
10184
|
+
let visibleCount = 0;
|
|
10185
|
+
while (index < string.length) {
|
|
10186
|
+
const codePoint = string.codePointAt(index);
|
|
10187
|
+
|
|
10188
|
+
if (ESCAPES.has(codePoint)) {
|
|
10189
|
+
const code = parseAnsiCode(string, index);
|
|
10190
|
+
if (code) {
|
|
10191
|
+
returnValue.push({
|
|
10192
|
+
type: 'ansi',
|
|
10193
|
+
code,
|
|
10194
|
+
endCode: getEndCode(code),
|
|
10195
|
+
});
|
|
10196
|
+
index += code.length;
|
|
10197
|
+
continue;
|
|
10198
|
+
}
|
|
10199
|
+
}
|
|
10200
|
+
|
|
10201
|
+
const isFullWidth = isFullwidthCodePoint(codePoint);
|
|
10202
|
+
const character = String.fromCodePoint(codePoint);
|
|
10203
|
+
|
|
10204
|
+
returnValue.push({
|
|
10205
|
+
type: 'character',
|
|
10206
|
+
value: character,
|
|
10207
|
+
isFullWidth,
|
|
10208
|
+
});
|
|
10209
|
+
|
|
10210
|
+
index += character.length;
|
|
10211
|
+
visibleCount += isFullWidth ? 2 : character.length;
|
|
10212
|
+
|
|
10213
|
+
if (visibleCount >= endCharacter) {
|
|
10214
|
+
break;
|
|
10215
|
+
}
|
|
10216
|
+
}
|
|
10217
|
+
|
|
10218
|
+
return returnValue;
|
|
10219
|
+
}
|
|
10220
|
+
|
|
10221
|
+
function reduceAnsiCodes(codes) {
|
|
10222
|
+
let returnValue = [];
|
|
10223
|
+
|
|
10224
|
+
for (const code of codes) {
|
|
10225
|
+
if (code.code === ansiStyles.reset.open) {
|
|
10226
|
+
// Reset code, disable all codes
|
|
10227
|
+
returnValue = [];
|
|
10228
|
+
} else if (endCodesSet.has(code.code)) {
|
|
10229
|
+
// This is an end code, disable all matching start codes
|
|
10230
|
+
returnValue = returnValue.filter(returnValueCode => returnValueCode.endCode !== code.code);
|
|
10231
|
+
} else {
|
|
10232
|
+
// This is a start code. Disable all styles this "overrides", then enable it
|
|
10233
|
+
returnValue = returnValue.filter(returnValueCode => returnValueCode.endCode !== code.endCode);
|
|
10234
|
+
returnValue.push(code);
|
|
10235
|
+
}
|
|
10236
|
+
}
|
|
10237
|
+
|
|
10238
|
+
return returnValue;
|
|
10239
|
+
}
|
|
10240
|
+
|
|
10241
|
+
function undoAnsiCodes(codes) {
|
|
10242
|
+
const reduced = reduceAnsiCodes(codes);
|
|
10243
|
+
const endCodes = reduced.map(({endCode}) => endCode);
|
|
10244
|
+
return endCodes.reverse().join('');
|
|
10245
|
+
}
|
|
10246
|
+
|
|
10247
|
+
function sliceAnsi(string, start, end) {
|
|
10248
|
+
const tokens = tokenize(string, end);
|
|
10249
|
+
let activeCodes = [];
|
|
10250
|
+
let position = 0;
|
|
10251
|
+
let returnValue = '';
|
|
10252
|
+
let include = false;
|
|
10253
|
+
|
|
10254
|
+
for (const token of tokens) {
|
|
10255
|
+
if (end !== undefined && position >= end) {
|
|
10256
|
+
break;
|
|
10257
|
+
}
|
|
10258
|
+
|
|
10259
|
+
if (token.type === 'ansi') {
|
|
10260
|
+
activeCodes.push(token);
|
|
10261
|
+
if (include) {
|
|
10262
|
+
returnValue += token.code;
|
|
10263
|
+
}
|
|
10264
|
+
} else {
|
|
10265
|
+
// Character
|
|
10266
|
+
if (!include && position >= start) {
|
|
10267
|
+
include = true;
|
|
10268
|
+
// Simplify active codes
|
|
10269
|
+
activeCodes = reduceAnsiCodes(activeCodes);
|
|
10270
|
+
returnValue = activeCodes.map(({code}) => code).join('');
|
|
10271
|
+
}
|
|
10272
|
+
|
|
10273
|
+
if (include) {
|
|
10274
|
+
returnValue += token.value;
|
|
10275
|
+
}
|
|
10276
|
+
|
|
10277
|
+
position += token.isFullWidth ? 2 : token.value.length;
|
|
10278
|
+
}
|
|
10279
|
+
}
|
|
10280
|
+
|
|
10281
|
+
// Disable active codes at the end
|
|
10282
|
+
returnValue += undoAnsiCodes(activeCodes);
|
|
10283
|
+
return returnValue;
|
|
10284
|
+
}
|
|
10285
|
+
|
|
9643
10286
|
const defaultTerminalHeight = 24;
|
|
9644
10287
|
|
|
9645
10288
|
const getWidth = stream => {
|
|
@@ -9653,7 +10296,7 @@ const getWidth = stream => {
|
|
|
9653
10296
|
};
|
|
9654
10297
|
|
|
9655
10298
|
const fitToTerminalHeight = (stream, text) => {
|
|
9656
|
-
const terminalHeight = stream.rows
|
|
10299
|
+
const terminalHeight = stream.rows ?? defaultTerminalHeight;
|
|
9657
10300
|
const lines = text.split('\n');
|
|
9658
10301
|
|
|
9659
10302
|
const toRemove = lines.length - terminalHeight;
|
|
@@ -9719,7 +10362,7 @@ createLogUpdate(process$1.stdout);
|
|
|
9719
10362
|
|
|
9720
10363
|
createLogUpdate(process$1.stderr);
|
|
9721
10364
|
|
|
9722
|
-
var version = "1.0.0-beta.
|
|
10365
|
+
var version = "1.0.0-beta.4";
|
|
9723
10366
|
|
|
9724
10367
|
async function printError(error, project, options) {
|
|
9725
10368
|
const { showCodeFrame = true, fullStack = false, type } = options;
|
|
@@ -10371,12 +11014,13 @@ async function createBrowserServer(project, configFile) {
|
|
|
10371
11014
|
});
|
|
10372
11015
|
await server.listen();
|
|
10373
11016
|
await server.watcher.close();
|
|
10374
|
-
(await import('./chunk-api-setup.
|
|
11017
|
+
(await import('./chunk-api-setup.6d19ab38.js')).setup(project, server);
|
|
10375
11018
|
return server;
|
|
10376
11019
|
}
|
|
10377
11020
|
|
|
11021
|
+
const builtinProviders = ["webdriverio", "playwright", "none"];
|
|
10378
11022
|
async function getBrowserProvider(options, loader) {
|
|
10379
|
-
if (options.provider == null ||
|
|
11023
|
+
if (options.provider == null || builtinProviders.includes(options.provider)) {
|
|
10380
11024
|
await ensurePackageInstalled("@vitest/browser", loader.root);
|
|
10381
11025
|
const providers = await loader.executeId("@vitest/browser/providers");
|
|
10382
11026
|
const provider = options.provider || "webdriverio";
|
|
@@ -10713,8 +11357,8 @@ async function initializeProject(workspacePath, ctx, options) {
|
|
|
10713
11357
|
root,
|
|
10714
11358
|
logLevel: "error",
|
|
10715
11359
|
configFile,
|
|
10716
|
-
// this will make "mode"
|
|
10717
|
-
mode: options.mode || ctx.config.mode
|
|
11360
|
+
// this will make "mode": "test" | "benchmark" inside defineConfig
|
|
11361
|
+
mode: options.mode || ctx.config.mode,
|
|
10718
11362
|
plugins: [
|
|
10719
11363
|
...options.plugins || [],
|
|
10720
11364
|
WorkspaceVitestPlugin(project, { ...options, root, workspacePath })
|
|
@@ -10738,23 +11382,40 @@ class WorkspaceProject {
|
|
|
10738
11382
|
closingPromise;
|
|
10739
11383
|
browserProvider;
|
|
10740
11384
|
testFilesList = [];
|
|
10741
|
-
|
|
10742
|
-
|
|
11385
|
+
_globalSetups;
|
|
11386
|
+
_provided = {};
|
|
10743
11387
|
getName() {
|
|
10744
11388
|
return this.config.name || "";
|
|
10745
11389
|
}
|
|
10746
11390
|
isCore() {
|
|
10747
11391
|
return this.ctx.getCoreWorkspaceProject() === this;
|
|
10748
11392
|
}
|
|
11393
|
+
provide = (key, value) => {
|
|
11394
|
+
try {
|
|
11395
|
+
structuredClone(value);
|
|
11396
|
+
} catch (err) {
|
|
11397
|
+
throw new Error(`Cannot provide "${key}" because it's not serializable.`, {
|
|
11398
|
+
cause: err
|
|
11399
|
+
});
|
|
11400
|
+
}
|
|
11401
|
+
this._provided[key] = value;
|
|
11402
|
+
};
|
|
11403
|
+
getProvidedContext() {
|
|
11404
|
+
if (this.isCore())
|
|
11405
|
+
return this._provided;
|
|
11406
|
+
return {
|
|
11407
|
+
...this.ctx.getCoreWorkspaceProject().getProvidedContext(),
|
|
11408
|
+
...this._provided
|
|
11409
|
+
};
|
|
11410
|
+
}
|
|
10749
11411
|
async initializeGlobalSetup() {
|
|
10750
11412
|
var _a;
|
|
10751
|
-
if (this.
|
|
11413
|
+
if (this._globalSetups)
|
|
10752
11414
|
return;
|
|
10753
|
-
this._globalSetupInit = true;
|
|
10754
11415
|
this._globalSetups = await loadGlobalSetupFiles(this.runner, this.config.globalSetup);
|
|
10755
11416
|
try {
|
|
10756
11417
|
for (const globalSetupFile of this._globalSetups) {
|
|
10757
|
-
const teardown = await ((_a = globalSetupFile.setup) == null ? void 0 : _a.call(globalSetupFile));
|
|
11418
|
+
const teardown = await ((_a = globalSetupFile.setup) == null ? void 0 : _a.call(globalSetupFile, { provide: this.provide, config: this.config }));
|
|
10758
11419
|
if (teardown == null || !!globalSetupFile.teardown)
|
|
10759
11420
|
continue;
|
|
10760
11421
|
if (typeof teardown !== "function")
|
|
@@ -10770,7 +11431,7 @@ ${c.red(divider(c.bold(c.inverse(" Error during global setup "))))}`);
|
|
|
10770
11431
|
}
|
|
10771
11432
|
async teardownGlobalSetup() {
|
|
10772
11433
|
var _a;
|
|
10773
|
-
if (!this.
|
|
11434
|
+
if (!this._globalSetups)
|
|
10774
11435
|
return;
|
|
10775
11436
|
for (const globalSetupFile of [...this._globalSetups].reverse()) {
|
|
10776
11437
|
try {
|
|
@@ -10967,7 +11628,7 @@ ${c.red(divider(c.bold(c.inverse(" Error during global setup "))))}`);
|
|
|
10967
11628
|
this.server.close(),
|
|
10968
11629
|
(_a = this.typechecker) == null ? void 0 : _a.stop(),
|
|
10969
11630
|
(_b = this.browser) == null ? void 0 : _b.close(),
|
|
10970
|
-
this.
|
|
11631
|
+
() => this._provided = {}
|
|
10971
11632
|
].filter(Boolean));
|
|
10972
11633
|
}
|
|
10973
11634
|
return this.closingPromise;
|
|
@@ -10983,7 +11644,7 @@ ${c.red(divider(c.bold(c.inverse(" Error during global setup "))))}`);
|
|
|
10983
11644
|
const supportedBrowsers = this.browserProvider.getSupportedBrowsers();
|
|
10984
11645
|
if (!browser)
|
|
10985
11646
|
throw new Error(`[${this.getName()}] Browser name is required. Please, set \`test.browser.name\` option manually.`);
|
|
10986
|
-
if (!supportedBrowsers.includes(browser))
|
|
11647
|
+
if (supportedBrowsers.length && !supportedBrowsers.includes(browser))
|
|
10987
11648
|
throw new Error(`[${this.getName()}] Browser "${browser}" is not supported by the browser provider "${this.browserProvider.name}". Supported browsers: ${supportedBrowsers.join(", ")}.`);
|
|
10988
11649
|
const providerOptions = this.config.browser.providerOptions;
|
|
10989
11650
|
await this.browserProvider.initialize(this, { browser, options: providerOptions });
|
|
@@ -11305,9 +11966,8 @@ class Vitest {
|
|
|
11305
11966
|
const coreProject = this.getCoreWorkspaceProject();
|
|
11306
11967
|
if (!projects.has(coreProject))
|
|
11307
11968
|
projects.add(coreProject);
|
|
11308
|
-
await
|
|
11309
|
-
|
|
11310
|
-
);
|
|
11969
|
+
for await (const project of projects)
|
|
11970
|
+
await project.initializeGlobalSetup();
|
|
11311
11971
|
}
|
|
11312
11972
|
async runFiles(paths) {
|
|
11313
11973
|
const filepaths = paths.map(([, file]) => file);
|
|
@@ -11538,17 +12198,21 @@ class Vitest {
|
|
|
11538
12198
|
}
|
|
11539
12199
|
async close() {
|
|
11540
12200
|
if (!this.closingPromise) {
|
|
11541
|
-
|
|
11542
|
-
|
|
11543
|
-
|
|
11544
|
-
|
|
11545
|
-
|
|
11546
|
-
|
|
11547
|
-
|
|
11548
|
-
|
|
11549
|
-
|
|
12201
|
+
this.closingPromise = (async () => {
|
|
12202
|
+
for await (const project of [...this.projects].reverse())
|
|
12203
|
+
await project.teardownGlobalSetup();
|
|
12204
|
+
const closePromises = this.projects.map((w) => w.close().then(() => w.server = void 0));
|
|
12205
|
+
if (!this.projects.includes(this.coreWorkspaceProject))
|
|
12206
|
+
closePromises.push(this.coreWorkspaceProject.close().then(() => this.server = void 0));
|
|
12207
|
+
if (this.pool)
|
|
12208
|
+
closePromises.push(this.pool.close().then(() => this.pool = void 0));
|
|
12209
|
+
closePromises.push(...this._onClose.map((fn) => fn()));
|
|
12210
|
+
return Promise.allSettled(closePromises).then((results) => {
|
|
12211
|
+
results.filter((r) => r.status === "rejected").forEach((err) => {
|
|
12212
|
+
this.logger.error("error during close", err.reason);
|
|
12213
|
+
});
|
|
11550
12214
|
});
|
|
11551
|
-
});
|
|
12215
|
+
})();
|
|
11552
12216
|
}
|
|
11553
12217
|
return this.closingPromise;
|
|
11554
12218
|
}
|
|
@@ -11736,7 +12400,7 @@ async function VitestPlugin(options = {}, ctx = new Vitest("test")) {
|
|
|
11736
12400
|
try {
|
|
11737
12401
|
await ctx.setServer(options, server, userConfig);
|
|
11738
12402
|
if (options.api && options.watch)
|
|
11739
|
-
(await import('./chunk-api-setup.
|
|
12403
|
+
(await import('./chunk-api-setup.6d19ab38.js')).setup(ctx);
|
|
11740
12404
|
} catch (err) {
|
|
11741
12405
|
await ctx.logger.printError(err, { fullStack: true });
|
|
11742
12406
|
process.exit(1);
|
|
@@ -11765,8 +12429,8 @@ async function createVitest(mode, options, viteOverrides = {}) {
|
|
|
11765
12429
|
const config = {
|
|
11766
12430
|
logLevel: "error",
|
|
11767
12431
|
configFile: configPath,
|
|
11768
|
-
// this will make "mode"
|
|
11769
|
-
mode: options.mode ||
|
|
12432
|
+
// this will make "mode": "test" | "benchmark" inside defineConfig
|
|
12433
|
+
mode: options.mode || mode,
|
|
11770
12434
|
plugins: await VitestPlugin(options, ctx)
|
|
11771
12435
|
};
|
|
11772
12436
|
const server = await createViteServer(mergeConfig(config, mergeConfig(viteOverrides, { root: options.root })));
|
|
@@ -18080,7 +18744,7 @@ function registerConsoleShortcuts(ctx) {
|
|
|
18080
18744
|
}
|
|
18081
18745
|
return ctx.exit(true);
|
|
18082
18746
|
}
|
|
18083
|
-
if (!isWindows && key && key.ctrl && key.name === "z") {
|
|
18747
|
+
if (!isWindows$1 && key && key.ctrl && key.name === "z") {
|
|
18084
18748
|
process.kill(process.ppid, "SIGTSTP");
|
|
18085
18749
|
process.kill(process.pid, "SIGTSTP");
|
|
18086
18750
|
return;
|
|
@@ -18161,7 +18825,7 @@ async function startVitest(mode, cliFilters = [], options = {}, viteOverrides) {
|
|
|
18161
18825
|
var _a, _b;
|
|
18162
18826
|
process.env.TEST = "true";
|
|
18163
18827
|
process.env.VITEST = "true";
|
|
18164
|
-
(_a = process.env).NODE_ENV ?? (_a.NODE_ENV =
|
|
18828
|
+
(_a = process.env).NODE_ENV ?? (_a.NODE_ENV = "test");
|
|
18165
18829
|
if (options.run)
|
|
18166
18830
|
options.watch = false;
|
|
18167
18831
|
const root = resolve(options.root || process.cwd());
|