vite-plus 0.3.3 → 1.0.0-rc.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/LICENSE +35 -146
- package/README.md +3 -3
- package/binding/index.cjs +57 -54
- package/binding/index.d.cts +9 -0
- package/dist/{agent-Cu6-tXIP.js → agent-Dinpyd-k.js} +6 -5
- package/dist/bin.js +48 -18
- package/dist/config/bin.js +2 -2
- package/dist/constants-CiKwrA0v.js +356 -0
- package/dist/create/bin.js +18 -12
- package/dist/{define-config-DPNEJxPz.d.ts → define-config-B9usMnEa.d.ts} +51 -10
- package/dist/{define-config-D0mevyb3.cjs → define-config-CBccpane.cjs} +173 -44
- package/dist/{define-config-IgzmnvvV.js → define-config-jhuYJ7Tb.js} +158 -42
- package/dist/define-config.cjs +1 -1
- package/dist/define-config.d.ts +1 -1
- package/dist/define-config.js +1 -1
- package/dist/documentation-DqcZSthV.js +11 -0
- package/dist/{editor-4sjlHmUh.js → editor-DMBczTdj.js} +205 -152
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/{json-cULBl7Pi.js → json-JP24qHUF.js} +14 -6
- package/dist/lint-plugins.cjs +1 -1
- package/dist/migration/bin.js +3122 -15
- package/dist/{oxlint-plugin-config-BVqEe9KY.js → oxlint-plugin-config-BgsDA6ua.js} +1 -1
- package/dist/oxlint-plugin.js +9 -7
- package/dist/pack-bin.js +1 -1
- package/dist/{package-CHH8jWan.js → package-B85H2Nw0.js} +6 -2
- package/dist/{vitest-ecosystem-BiRqcaRI.js → package-overrides-Dpn4scvN.js} +1 -7
- package/dist/{prompts-k14KgthC.js → prompts-CQobX7uP.js} +2 -2
- package/dist/{resolve-vite-config-BqvS2P98.js → resolve-vite-config-BUFUmi8h.js} +2 -2
- package/dist/{resolve-vite-config-CTOTuqTi.js → resolve-vite-config-I8fmpR7I.js} +1 -1
- package/dist/staged/bin.js +1205 -3317
- package/dist/sync-versions/bin.js +3 -2
- package/dist/sync-versions/bin.mjs +17 -2
- package/dist/test/browser/context.js +1 -1
- package/dist/test/browser/providers/playwright/context.js +1 -1
- package/dist/test/browser/providers/preview/context.js +1 -1
- package/dist/test/browser-playwright/context.js +1 -1
- package/dist/test/browser-preview/context.js +1 -1
- package/dist/test/context.d.ts +2 -942
- package/dist/test/context.js +1 -1
- package/dist/test/internal/traces.js +1 -0
- package/dist/test/locators.d.ts +2 -294
- package/dist/test/matchers.d.ts +2 -29
- package/dist/test/mocker.d.ts +2 -0
- package/dist/test/mocker.js +1 -0
- package/dist/test/{browser-webdriverio/context.js → plugins/browser-context.d.ts} +1 -0
- package/dist/test/plugins/browser-context.js +1 -1
- package/dist/test/plugins/browser-locators.d.ts +2 -0
- package/dist/test/plugins/browser-playwright.d.ts +2 -0
- package/dist/test/plugins/browser-preview.d.ts +2 -0
- package/dist/test/plugins/browser.d.ts +2 -0
- package/dist/test/plugins/mocker-automock.d.ts +2 -0
- package/dist/test/plugins/mocker-browser.d.ts +2 -0
- package/dist/test/plugins/mocker-node.d.ts +2 -0
- package/dist/test/plugins/mocker-redirect.d.ts +2 -0
- package/dist/test/plugins/mocker-register.d.ts +2 -0
- package/dist/test/plugins/mocker-transforms.d.ts +2 -0
- package/dist/test/plugins/mocker.d.ts +2 -0
- package/dist/test/plugins/pretty-format.d.ts +2 -0
- package/dist/test/plugins/snapshot-environment.d.ts +2 -0
- package/dist/test/plugins/snapshot-manager.d.ts +2 -0
- package/dist/test/plugins/snapshot.d.ts +2 -0
- package/dist/test/plugins/spy.d.ts +2 -0
- package/dist/test/plugins/utils-constants.d.ts +2 -0
- package/dist/test/plugins/utils-diff.d.ts +2 -0
- package/dist/test/plugins/utils-display.d.ts +2 -0
- package/dist/test/plugins/utils-error.d.ts +2 -0
- package/dist/test/plugins/utils-helpers.d.ts +2 -0
- package/dist/test/plugins/utils-offset.d.ts +2 -0
- package/dist/test/plugins/utils-resolver.d.ts +2 -0
- package/dist/test/plugins/utils-serialize.d.ts +2 -0
- package/dist/test/plugins/utils-source-map-node.d.ts +2 -0
- package/dist/test/plugins/utils-source-map.d.ts +2 -0
- package/dist/test/plugins/utils-timers.d.ts +2 -0
- package/dist/test/plugins/utils.d.ts +2 -0
- package/dist/toolchain.js +8 -8
- package/dist/toolchain.json +8 -8
- package/dist/{tsconfig-C3h9CVTA.js → tsconfig-Buo0RSzz.js} +8 -4
- package/dist/{tsconfig-euB-GmIE.js → tsconfig-C1VeTG9k.js} +1 -1
- package/dist/version.js +5 -3
- package/dist/versions.js +4 -4
- package/dist/vitest-ecosystem-BU0AqZq-.js +23 -0
- package/dist/vitest-v5-entry-points-DthU1e_O.js +25 -0
- package/docs/config/fmt.md +2 -2
- package/docs/config/lint.md +2 -2
- package/docs/config/run.md +1 -1
- package/docs/guide/check.md +2 -0
- package/docs/guide/commit-hooks.md +8 -1
- package/docs/guide/env.md +18 -13
- package/docs/guide/fmt.md +4 -2
- package/docs/guide/index.md +1 -1
- package/docs/guide/install.md +1 -1
- package/docs/guide/lint.md +3 -1
- package/docs/guide/local-cli.md +3 -3
- package/docs/guide/migrate-rules.md +16 -12
- package/docs/guide/migrate.md +86 -20
- package/docs/guide/monorepo.md +5 -1
- package/docs/guide/test.md +2 -0
- package/docs/guide/troubleshooting.md +3 -3
- package/docs/guide/vitest-v5.md +221 -0
- package/package.json +64 -87
- package/bin/oxfmt +0 -33
- package/bin/oxlint +0 -38
- package/dist/cli-truncate-Bg3RDXpi.js +0 -865
- package/dist/constants-C2dTOTe-.js +0 -80
- package/dist/is-fullwidth-code-point-BUNlIICg.js +0 -8
- package/dist/log-update-CoW8Z4Dl.js +0 -491
- package/dist/strip-ansi-C3wrWz9t.js +0 -853
- package/dist/test/browser/providers/webdriverio/context.d.ts +0 -1
- package/dist/test/browser/providers/webdriverio/context.js +0 -1
- package/dist/test/browser/providers/webdriverio.d.ts +0 -77
- package/dist/test/browser/providers/webdriverio.js +0 -1
- package/dist/test/browser-webdriverio/context.d.ts +0 -1
- package/dist/test/browser-webdriverio.d.ts +0 -77
- package/dist/test/browser-webdriverio.js +0 -1
- package/dist/test/coverage.d.ts +0 -2
- package/dist/test/coverage.js +0 -1
- package/dist/test/environments.d.ts +0 -2
- package/dist/test/environments.js +0 -1
- package/dist/test/plugins/browser-webdriverio.js +0 -1
- package/dist/test/plugins/expect.js +0 -1
- package/dist/test/plugins/runner-types.js +0 -1
- package/dist/test/plugins/runner-utils.js +0 -1
- package/dist/test/plugins/runner.js +0 -1
- package/dist/test/reporters.d.ts +0 -2
- package/dist/test/reporters.js +0 -1
- package/dist/test/runners.d.ts +0 -2
- package/dist/test/runners.js +0 -1
- package/dist/test/snapshot.d.ts +0 -2
- package/dist/test/snapshot.js +0 -1
- package/dist/test/suite.d.ts +0 -2
- package/dist/test/suite.js +0 -1
- package/dist/tsgolint-path-CbDReEOx.js +0 -34
- package/dist/tsgolint-path.d.ts +0 -7
- package/dist/tsgolint-path.js +0 -2
- package/dist/wrap-ansi-DNjkuBEp.js +0 -157
- package/dist/wrap-ansi-DUi52C6W.js +0 -2
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { createRequire } from "node:module";
|
|
2
|
-
//#region package.json
|
|
3
|
-
var version = "0.3.3";
|
|
4
|
-
//#endregion
|
|
5
|
-
//#region src/utils/constants.ts
|
|
6
|
-
const VITE_PLUS_NAME = "vite-plus";
|
|
7
|
-
const VITE_PLUS_VERSION = process.env.VP_VERSION || version;
|
|
8
|
-
const VITE_CONFIG_FILES = [
|
|
9
|
-
"vite.config.js",
|
|
10
|
-
"vite.config.mjs",
|
|
11
|
-
"vite.config.ts",
|
|
12
|
-
"vite.config.cjs",
|
|
13
|
-
"vite.config.mts",
|
|
14
|
-
"vite.config.cts"
|
|
15
|
-
];
|
|
16
|
-
const VITEST_VERSION = "4.1.11";
|
|
17
|
-
const SETUP_VP_VERSION = "v1.20.0";
|
|
18
|
-
const TSDOWN_MIGRATION_SKILL_URL = "https://github.com/rolldown/tsdown/blob/main/skills/tsdown-migrate/SKILL.md";
|
|
19
|
-
const VITE_PLUS_OVERRIDE_PACKAGES = process.env.VP_OVERRIDE_PACKAGES ? JSON.parse(process.env.VP_OVERRIDE_PACKAGES) : {
|
|
20
|
-
vite: `npm:@voidzero-dev/vite-plus-core@${VITE_PLUS_VERSION}`,
|
|
21
|
-
vitest: VITEST_VERSION
|
|
22
|
-
};
|
|
23
|
-
/**
|
|
24
|
-
* Package-name patterns the migrator exempts from a package manager's
|
|
25
|
-
* "minimum release age" gate (pnpm `minimumReleaseAgeExclude` / Yarn
|
|
26
|
-
* `npmPreapprovedPackages`).
|
|
27
|
-
*
|
|
28
|
-
* Vite+ pins `vitest` to an exact, sometimes freshly published version, and the
|
|
29
|
-
* in-tree `@vitest/*` siblings install transitively at that same version, so an
|
|
30
|
-
* age gate would otherwise quarantine the Vite+-managed family and break
|
|
31
|
-
* `vp install`. The `@vitest/*` glob also covers the optional `@vitest/browser-*`
|
|
32
|
-
* peers the migrator pins for browser projects. This does NOT pin or manage any
|
|
33
|
-
* package — it only lets the chosen versions through the user's gate, including
|
|
34
|
-
* the `@vitest/coverage-*` version the coverage guard asks the user to align to
|
|
35
|
-
* the bundled vitest.
|
|
36
|
-
*/
|
|
37
|
-
const VITEST_AGE_GATE_EXEMPT_PACKAGES = ["vitest", "@vitest/*"];
|
|
38
|
-
/**
|
|
39
|
-
* When VP_FORCE_MIGRATE is set, force full dependency rewriting
|
|
40
|
-
* even for projects already using vite-plus. Used by ecosystem CI to
|
|
41
|
-
* override dependencies with locally built tgz packages.
|
|
42
|
-
*/
|
|
43
|
-
function isForceOverrideMode() {
|
|
44
|
-
return process.env.VP_FORCE_MIGRATE === "1";
|
|
45
|
-
}
|
|
46
|
-
const require = createRequire(import.meta.url);
|
|
47
|
-
function resolve(path) {
|
|
48
|
-
return require.resolve(path, { paths: [process.cwd(), import.meta.dirname] });
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Like {@link resolve}, but prefers the copy shipped with the CLI
|
|
52
|
-
* (`import.meta.dirname`) over the project's (`process.cwd()`).
|
|
53
|
-
*
|
|
54
|
-
* Use this for runtime modules that MUST match what `vite-plus/test*`
|
|
55
|
-
* imports resolve to — chiefly the Vitest runner binary. The `vite-plus/test`
|
|
56
|
-
* shims `export * from 'vitest'`, which Node resolves to vite-plus's own
|
|
57
|
-
* bundled (pinned) Vitest. If `vp test` instead spawned a project-local
|
|
58
|
-
* Vitest (a different physical copy/version), the runner and the imported
|
|
59
|
-
* `vi`/`expect`/runner internals would come from two distinct Vitest
|
|
60
|
-
* modules — a classic source of Vitest internal-state and mock-hoisting
|
|
61
|
-
* mismatches. `process.cwd()` stays as a fallback for layouts where the
|
|
62
|
-
* bundled copy is somehow unreachable, so this is never worse than {@link resolve}.
|
|
63
|
-
*/
|
|
64
|
-
function resolveBundled(path) {
|
|
65
|
-
return require.resolve(path, { paths: [import.meta.dirname, process.cwd()] });
|
|
66
|
-
}
|
|
67
|
-
const BASEURL_TSCONFIG_WARNING = "Skipped typeAware/typeCheck: a tsconfig file contains baseUrl which is not yet supported by the oxlint type checker.\n Run `vp dlx @andrewbranch/ts5to6 --fixBaseUrl <tsconfig path>` to remove baseUrl from your tsconfig.";
|
|
68
|
-
const BASEURL_TSCONFIG_FIX_PACKAGE = "@andrewbranch/ts5to6";
|
|
69
|
-
const BASEURL_TSCONFIG_FIX_FLAG = "--fixBaseUrl";
|
|
70
|
-
function createBaseUrlTsconfigFixArgs(target = ".") {
|
|
71
|
-
return [BASEURL_TSCONFIG_FIX_FLAG, target];
|
|
72
|
-
}
|
|
73
|
-
const DEFAULT_ENVS = {
|
|
74
|
-
JS_RUNTIME_VERSION: process.versions.node,
|
|
75
|
-
JS_RUNTIME_NAME: process.release.name,
|
|
76
|
-
NODE_PACKAGE_MANAGER: "vite-plus"
|
|
77
|
-
};
|
|
78
|
-
const CONFIG_METADATA_ENV = "VP_RESOLVING_CONFIG_METADATA";
|
|
79
|
-
//#endregion
|
|
80
|
-
export { version as _, SETUP_VP_VERSION as a, VITEST_VERSION as c, VITE_PLUS_OVERRIDE_PACKAGES as d, VITE_PLUS_VERSION as f, resolveBundled as g, resolve as h, DEFAULT_ENVS as i, VITE_CONFIG_FILES as l, isForceOverrideMode as m, BASEURL_TSCONFIG_WARNING as n, TSDOWN_MIGRATION_SKILL_URL as o, createBaseUrlTsconfigFixArgs as p, CONFIG_METADATA_ENV as r, VITEST_AGE_GATE_EXEMPT_PACKAGES as s, BASEURL_TSCONFIG_FIX_PACKAGE as t, VITE_PLUS_NAME as u };
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { i as isWide, r as isFullWidth } from "./strip-ansi-C3wrWz9t.js";
|
|
2
|
-
//#region ../../node_modules/.pnpm/is-fullwidth-code-point@5.1.0/node_modules/is-fullwidth-code-point/index.js
|
|
3
|
-
function isFullwidthCodePoint(codePoint) {
|
|
4
|
-
if (!Number.isInteger(codePoint)) return false;
|
|
5
|
-
return isFullWidth(codePoint) || isWide(codePoint);
|
|
6
|
-
}
|
|
7
|
-
//#endregion
|
|
8
|
-
export { isFullwidthCodePoint as t };
|
|
@@ -1,491 +0,0 @@
|
|
|
1
|
-
import { a as ansiStyles, t as stripAnsi } from "./strip-ansi-C3wrWz9t.js";
|
|
2
|
-
import { t as isFullwidthCodePoint } from "./is-fullwidth-code-point-BUNlIICg.js";
|
|
3
|
-
import { t as wrapAnsi } from "./wrap-ansi-DNjkuBEp.js";
|
|
4
|
-
import os from "node:os";
|
|
5
|
-
import process$1 from "node:process";
|
|
6
|
-
//#region ../../node_modules/.pnpm/environment@1.1.0/node_modules/environment/index.js
|
|
7
|
-
const isBrowser = globalThis.window?.document !== void 0;
|
|
8
|
-
globalThis.process?.versions?.node;
|
|
9
|
-
globalThis.process?.versions?.bun;
|
|
10
|
-
globalThis.Deno?.version?.deno;
|
|
11
|
-
globalThis.process?.versions?.electron;
|
|
12
|
-
globalThis.navigator?.userAgent?.includes("jsdom");
|
|
13
|
-
typeof WorkerGlobalScope !== "undefined" && globalThis instanceof WorkerGlobalScope;
|
|
14
|
-
typeof DedicatedWorkerGlobalScope !== "undefined" && globalThis instanceof DedicatedWorkerGlobalScope;
|
|
15
|
-
typeof SharedWorkerGlobalScope !== "undefined" && globalThis instanceof SharedWorkerGlobalScope;
|
|
16
|
-
typeof ServiceWorkerGlobalScope !== "undefined" && globalThis instanceof ServiceWorkerGlobalScope;
|
|
17
|
-
const platform = globalThis.navigator?.userAgentData?.platform;
|
|
18
|
-
platform === "macOS" || globalThis.navigator?.platform === "MacIntel" || globalThis.navigator?.userAgent?.includes(" Mac ") === true || globalThis.process?.platform;
|
|
19
|
-
platform === "Windows" || globalThis.navigator?.platform === "Win32" || globalThis.process?.platform;
|
|
20
|
-
platform === "Linux" || globalThis.navigator?.platform?.startsWith("Linux") === true || globalThis.navigator?.userAgent?.includes(" Linux ") === true || globalThis.process?.platform;
|
|
21
|
-
platform === "iOS" || globalThis.navigator?.platform === "MacIntel" && globalThis.navigator?.maxTouchPoints > 1 || /iPad|iPhone|iPod/.test(globalThis.navigator?.platform);
|
|
22
|
-
platform === "Android" || globalThis.navigator?.platform === "Android" || globalThis.navigator?.userAgent?.includes(" Android ") === true || globalThis.process?.platform;
|
|
23
|
-
//#endregion
|
|
24
|
-
//#region ../../node_modules/.pnpm/ansi-escapes@7.2.0/node_modules/ansi-escapes/base.js
|
|
25
|
-
const ESC = "\x1B[";
|
|
26
|
-
!isBrowser && process$1.env.TERM_PROGRAM;
|
|
27
|
-
const isWindows = !isBrowser && process$1.platform === "win32";
|
|
28
|
-
!isBrowser && (process$1.env.TERM?.startsWith("screen") || process$1.env.TERM?.startsWith("tmux") || process$1.env.TMUX);
|
|
29
|
-
isBrowser || process$1.cwd;
|
|
30
|
-
const cursorUp = (count = 1) => ESC + count + "A";
|
|
31
|
-
const eraseLines = (count) => {
|
|
32
|
-
let clear = "";
|
|
33
|
-
for (let i = 0; i < count; i++) clear += eraseLine + (i < count - 1 ? cursorUp() : "");
|
|
34
|
-
if (count) clear += "\x1B[G";
|
|
35
|
-
return clear;
|
|
36
|
-
};
|
|
37
|
-
const eraseLine = "\x1B[2K";
|
|
38
|
-
const isOldWindows = () => {
|
|
39
|
-
if (isBrowser || !isWindows) return false;
|
|
40
|
-
const parts = os.release().split(".");
|
|
41
|
-
const major = Number(parts[0]);
|
|
42
|
-
const build = Number(parts[2] ?? 0);
|
|
43
|
-
if (major < 10) return true;
|
|
44
|
-
if (major === 10 && build < 10586) return true;
|
|
45
|
-
return false;
|
|
46
|
-
};
|
|
47
|
-
isOldWindows();
|
|
48
|
-
//#endregion
|
|
49
|
-
//#region ../../node_modules/.pnpm/mimic-function@5.0.1/node_modules/mimic-function/index.js
|
|
50
|
-
const copyProperty = (to, from, property, ignoreNonConfigurable) => {
|
|
51
|
-
if (property === "length" || property === "prototype") return;
|
|
52
|
-
if (property === "arguments" || property === "caller") return;
|
|
53
|
-
const toDescriptor = Object.getOwnPropertyDescriptor(to, property);
|
|
54
|
-
const fromDescriptor = Object.getOwnPropertyDescriptor(from, property);
|
|
55
|
-
if (!canCopyProperty(toDescriptor, fromDescriptor) && ignoreNonConfigurable) return;
|
|
56
|
-
Object.defineProperty(to, property, fromDescriptor);
|
|
57
|
-
};
|
|
58
|
-
const canCopyProperty = function(toDescriptor, fromDescriptor) {
|
|
59
|
-
return toDescriptor === void 0 || toDescriptor.configurable || toDescriptor.writable === fromDescriptor.writable && toDescriptor.enumerable === fromDescriptor.enumerable && toDescriptor.configurable === fromDescriptor.configurable && (toDescriptor.writable || toDescriptor.value === fromDescriptor.value);
|
|
60
|
-
};
|
|
61
|
-
const changePrototype = (to, from) => {
|
|
62
|
-
const fromPrototype = Object.getPrototypeOf(from);
|
|
63
|
-
if (fromPrototype === Object.getPrototypeOf(to)) return;
|
|
64
|
-
Object.setPrototypeOf(to, fromPrototype);
|
|
65
|
-
};
|
|
66
|
-
const wrappedToString = (withName, fromBody) => `/* Wrapped ${withName}*/\n${fromBody}`;
|
|
67
|
-
const toStringDescriptor = Object.getOwnPropertyDescriptor(Function.prototype, "toString");
|
|
68
|
-
const toStringName = Object.getOwnPropertyDescriptor(Function.prototype.toString, "name");
|
|
69
|
-
const changeToString = (to, from, name) => {
|
|
70
|
-
const withName = name === "" ? "" : `with ${name.trim()}() `;
|
|
71
|
-
const newToString = wrappedToString.bind(null, withName, from.toString());
|
|
72
|
-
Object.defineProperty(newToString, "name", toStringName);
|
|
73
|
-
const { writable, enumerable, configurable } = toStringDescriptor;
|
|
74
|
-
Object.defineProperty(to, "toString", {
|
|
75
|
-
value: newToString,
|
|
76
|
-
writable,
|
|
77
|
-
enumerable,
|
|
78
|
-
configurable
|
|
79
|
-
});
|
|
80
|
-
};
|
|
81
|
-
function mimicFunction(to, from, { ignoreNonConfigurable = false } = {}) {
|
|
82
|
-
const { name } = to;
|
|
83
|
-
for (const property of Reflect.ownKeys(from)) copyProperty(to, from, property, ignoreNonConfigurable);
|
|
84
|
-
changePrototype(to, from);
|
|
85
|
-
changeToString(to, from, name);
|
|
86
|
-
return to;
|
|
87
|
-
}
|
|
88
|
-
//#endregion
|
|
89
|
-
//#region ../../node_modules/.pnpm/onetime@7.0.0/node_modules/onetime/index.js
|
|
90
|
-
const calledFunctions = /* @__PURE__ */ new WeakMap();
|
|
91
|
-
const onetime = (function_, options = {}) => {
|
|
92
|
-
if (typeof function_ !== "function") throw new TypeError("Expected a function");
|
|
93
|
-
let returnValue;
|
|
94
|
-
let callCount = 0;
|
|
95
|
-
const functionName = function_.displayName || function_.name || "<anonymous>";
|
|
96
|
-
const onetime = function(...arguments_) {
|
|
97
|
-
calledFunctions.set(onetime, ++callCount);
|
|
98
|
-
if (callCount === 1) {
|
|
99
|
-
returnValue = function_.apply(this, arguments_);
|
|
100
|
-
function_ = void 0;
|
|
101
|
-
} else if (options.throw === true) throw new Error(`Function \`${functionName}\` can only be called once`);
|
|
102
|
-
return returnValue;
|
|
103
|
-
};
|
|
104
|
-
mimicFunction(onetime, function_);
|
|
105
|
-
calledFunctions.set(onetime, callCount);
|
|
106
|
-
return onetime;
|
|
107
|
-
};
|
|
108
|
-
onetime.callCount = (function_) => {
|
|
109
|
-
if (!calledFunctions.has(function_)) throw new Error(`The given function \`${function_.name}\` is not wrapped by the \`onetime\` package`);
|
|
110
|
-
return calledFunctions.get(function_);
|
|
111
|
-
};
|
|
112
|
-
//#endregion
|
|
113
|
-
//#region ../../node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/signals.js
|
|
114
|
-
/**
|
|
115
|
-
* This is not the set of all possible signals.
|
|
116
|
-
*
|
|
117
|
-
* It IS, however, the set of all signals that trigger
|
|
118
|
-
* an exit on either Linux or BSD systems. Linux is a
|
|
119
|
-
* superset of the signal names supported on BSD, and
|
|
120
|
-
* the unknown signals just fail to register, so we can
|
|
121
|
-
* catch that easily enough.
|
|
122
|
-
*
|
|
123
|
-
* Windows signals are a different set, since there are
|
|
124
|
-
* signals that terminate Windows processes, but don't
|
|
125
|
-
* terminate (or don't even exist) on Posix systems.
|
|
126
|
-
*
|
|
127
|
-
* Don't bother with SIGKILL. It's uncatchable, which
|
|
128
|
-
* means that we can't fire any callbacks anyway.
|
|
129
|
-
*
|
|
130
|
-
* If a user does happen to register a handler on a non-
|
|
131
|
-
* fatal signal like SIGWINCH or something, and then
|
|
132
|
-
* exit, it'll end up firing `process.emit('exit')`, so
|
|
133
|
-
* the handler will be fired anyway.
|
|
134
|
-
*
|
|
135
|
-
* SIGBUS, SIGFPE, SIGSEGV and SIGILL, when not raised
|
|
136
|
-
* artificially, inherently leave the process in a
|
|
137
|
-
* state from which it is not safe to try and enter JS
|
|
138
|
-
* listeners.
|
|
139
|
-
*/
|
|
140
|
-
const signals = [];
|
|
141
|
-
signals.push("SIGHUP", "SIGINT", "SIGTERM");
|
|
142
|
-
if (process.platform !== "win32") signals.push("SIGALRM", "SIGABRT", "SIGVTALRM", "SIGXCPU", "SIGXFSZ", "SIGUSR2", "SIGTRAP", "SIGSYS", "SIGQUIT", "SIGIOT");
|
|
143
|
-
if (process.platform === "linux") signals.push("SIGIO", "SIGPOLL", "SIGPWR", "SIGSTKFLT");
|
|
144
|
-
//#endregion
|
|
145
|
-
//#region ../../node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/index.js
|
|
146
|
-
const processOk = (process) => !!process && typeof process === "object" && typeof process.removeListener === "function" && typeof process.emit === "function" && typeof process.reallyExit === "function" && typeof process.listeners === "function" && typeof process.kill === "function" && typeof process.pid === "number" && typeof process.on === "function";
|
|
147
|
-
const kExitEmitter = Symbol.for("signal-exit emitter");
|
|
148
|
-
const global = globalThis;
|
|
149
|
-
const ObjectDefineProperty = Object.defineProperty.bind(Object);
|
|
150
|
-
var Emitter = class {
|
|
151
|
-
emitted = {
|
|
152
|
-
afterExit: false,
|
|
153
|
-
exit: false
|
|
154
|
-
};
|
|
155
|
-
listeners = {
|
|
156
|
-
afterExit: [],
|
|
157
|
-
exit: []
|
|
158
|
-
};
|
|
159
|
-
count = 0;
|
|
160
|
-
id = Math.random();
|
|
161
|
-
constructor() {
|
|
162
|
-
if (global[kExitEmitter]) return global[kExitEmitter];
|
|
163
|
-
ObjectDefineProperty(global, kExitEmitter, {
|
|
164
|
-
value: this,
|
|
165
|
-
writable: false,
|
|
166
|
-
enumerable: false,
|
|
167
|
-
configurable: false
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
on(ev, fn) {
|
|
171
|
-
this.listeners[ev].push(fn);
|
|
172
|
-
}
|
|
173
|
-
removeListener(ev, fn) {
|
|
174
|
-
const list = this.listeners[ev];
|
|
175
|
-
const i = list.indexOf(fn);
|
|
176
|
-
/* c8 ignore start */
|
|
177
|
-
if (i === -1) return;
|
|
178
|
-
/* c8 ignore stop */
|
|
179
|
-
if (i === 0 && list.length === 1) list.length = 0;
|
|
180
|
-
else list.splice(i, 1);
|
|
181
|
-
}
|
|
182
|
-
emit(ev, code, signal) {
|
|
183
|
-
if (this.emitted[ev]) return false;
|
|
184
|
-
this.emitted[ev] = true;
|
|
185
|
-
let ret = false;
|
|
186
|
-
for (const fn of this.listeners[ev]) ret = fn(code, signal) === true || ret;
|
|
187
|
-
if (ev === "exit") ret = this.emit("afterExit", code, signal) || ret;
|
|
188
|
-
return ret;
|
|
189
|
-
}
|
|
190
|
-
};
|
|
191
|
-
var SignalExitBase = class {};
|
|
192
|
-
const signalExitWrap = (handler) => {
|
|
193
|
-
return {
|
|
194
|
-
onExit(cb, opts) {
|
|
195
|
-
return handler.onExit(cb, opts);
|
|
196
|
-
},
|
|
197
|
-
load() {
|
|
198
|
-
return handler.load();
|
|
199
|
-
},
|
|
200
|
-
unload() {
|
|
201
|
-
return handler.unload();
|
|
202
|
-
}
|
|
203
|
-
};
|
|
204
|
-
};
|
|
205
|
-
var SignalExitFallback = class extends SignalExitBase {
|
|
206
|
-
onExit() {
|
|
207
|
-
return () => {};
|
|
208
|
-
}
|
|
209
|
-
load() {}
|
|
210
|
-
unload() {}
|
|
211
|
-
};
|
|
212
|
-
var SignalExit = class extends SignalExitBase {
|
|
213
|
-
/* c8 ignore start */
|
|
214
|
-
#hupSig = process$2.platform === "win32" ? "SIGINT" : "SIGHUP";
|
|
215
|
-
/* c8 ignore stop */
|
|
216
|
-
#emitter = new Emitter();
|
|
217
|
-
#process;
|
|
218
|
-
#originalProcessEmit;
|
|
219
|
-
#originalProcessReallyExit;
|
|
220
|
-
#sigListeners = {};
|
|
221
|
-
#loaded = false;
|
|
222
|
-
constructor(process) {
|
|
223
|
-
super();
|
|
224
|
-
this.#process = process;
|
|
225
|
-
this.#sigListeners = {};
|
|
226
|
-
for (const sig of signals) this.#sigListeners[sig] = () => {
|
|
227
|
-
const listeners = this.#process.listeners(sig);
|
|
228
|
-
let { count } = this.#emitter;
|
|
229
|
-
/* c8 ignore start */
|
|
230
|
-
const p = process;
|
|
231
|
-
if (typeof p.__signal_exit_emitter__ === "object" && typeof p.__signal_exit_emitter__.count === "number") count += p.__signal_exit_emitter__.count;
|
|
232
|
-
/* c8 ignore stop */
|
|
233
|
-
if (listeners.length === count) {
|
|
234
|
-
this.unload();
|
|
235
|
-
const ret = this.#emitter.emit("exit", null, sig);
|
|
236
|
-
/* c8 ignore start */
|
|
237
|
-
const s = sig === "SIGHUP" ? this.#hupSig : sig;
|
|
238
|
-
if (!ret) process.kill(process.pid, s);
|
|
239
|
-
}
|
|
240
|
-
};
|
|
241
|
-
this.#originalProcessReallyExit = process.reallyExit;
|
|
242
|
-
this.#originalProcessEmit = process.emit;
|
|
243
|
-
}
|
|
244
|
-
onExit(cb, opts) {
|
|
245
|
-
/* c8 ignore start */
|
|
246
|
-
if (!processOk(this.#process)) return () => {};
|
|
247
|
-
/* c8 ignore stop */
|
|
248
|
-
if (this.#loaded === false) this.load();
|
|
249
|
-
const ev = opts?.alwaysLast ? "afterExit" : "exit";
|
|
250
|
-
this.#emitter.on(ev, cb);
|
|
251
|
-
return () => {
|
|
252
|
-
this.#emitter.removeListener(ev, cb);
|
|
253
|
-
if (this.#emitter.listeners["exit"].length === 0 && this.#emitter.listeners["afterExit"].length === 0) this.unload();
|
|
254
|
-
};
|
|
255
|
-
}
|
|
256
|
-
load() {
|
|
257
|
-
if (this.#loaded) return;
|
|
258
|
-
this.#loaded = true;
|
|
259
|
-
this.#emitter.count += 1;
|
|
260
|
-
for (const sig of signals) try {
|
|
261
|
-
const fn = this.#sigListeners[sig];
|
|
262
|
-
if (fn) this.#process.on(sig, fn);
|
|
263
|
-
} catch (_) {}
|
|
264
|
-
this.#process.emit = (ev, ...a) => {
|
|
265
|
-
return this.#processEmit(ev, ...a);
|
|
266
|
-
};
|
|
267
|
-
this.#process.reallyExit = (code) => {
|
|
268
|
-
return this.#processReallyExit(code);
|
|
269
|
-
};
|
|
270
|
-
}
|
|
271
|
-
unload() {
|
|
272
|
-
if (!this.#loaded) return;
|
|
273
|
-
this.#loaded = false;
|
|
274
|
-
signals.forEach((sig) => {
|
|
275
|
-
const listener = this.#sigListeners[sig];
|
|
276
|
-
/* c8 ignore start */
|
|
277
|
-
if (!listener) throw new Error("Listener not defined for signal: " + sig);
|
|
278
|
-
/* c8 ignore stop */
|
|
279
|
-
try {
|
|
280
|
-
this.#process.removeListener(sig, listener);
|
|
281
|
-
} catch (_) {}
|
|
282
|
-
/* c8 ignore stop */
|
|
283
|
-
});
|
|
284
|
-
this.#process.emit = this.#originalProcessEmit;
|
|
285
|
-
this.#process.reallyExit = this.#originalProcessReallyExit;
|
|
286
|
-
this.#emitter.count -= 1;
|
|
287
|
-
}
|
|
288
|
-
#processReallyExit(code) {
|
|
289
|
-
/* c8 ignore start */
|
|
290
|
-
if (!processOk(this.#process)) return 0;
|
|
291
|
-
this.#process.exitCode = code || 0;
|
|
292
|
-
/* c8 ignore stop */
|
|
293
|
-
this.#emitter.emit("exit", this.#process.exitCode, null);
|
|
294
|
-
return this.#originalProcessReallyExit.call(this.#process, this.#process.exitCode);
|
|
295
|
-
}
|
|
296
|
-
#processEmit(ev, ...args) {
|
|
297
|
-
const og = this.#originalProcessEmit;
|
|
298
|
-
if (ev === "exit" && processOk(this.#process)) {
|
|
299
|
-
if (typeof args[0] === "number") this.#process.exitCode = args[0];
|
|
300
|
-
/* c8 ignore start */
|
|
301
|
-
const ret = og.call(this.#process, ev, ...args);
|
|
302
|
-
/* c8 ignore start */
|
|
303
|
-
this.#emitter.emit("exit", this.#process.exitCode, null);
|
|
304
|
-
/* c8 ignore stop */
|
|
305
|
-
return ret;
|
|
306
|
-
} else return og.call(this.#process, ev, ...args);
|
|
307
|
-
}
|
|
308
|
-
};
|
|
309
|
-
const process$2 = globalThis.process;
|
|
310
|
-
const { onExit, load, unload } = signalExitWrap(processOk(process$2) ? new SignalExit(process$2) : new SignalExitFallback());
|
|
311
|
-
//#endregion
|
|
312
|
-
//#region ../../node_modules/.pnpm/restore-cursor@5.1.0/node_modules/restore-cursor/index.js
|
|
313
|
-
const terminal = process$1.stderr.isTTY ? process$1.stderr : process$1.stdout.isTTY ? process$1.stdout : void 0;
|
|
314
|
-
const restoreCursor = terminal ? onetime(() => {
|
|
315
|
-
onExit(() => {
|
|
316
|
-
terminal.write("\x1B[?25h");
|
|
317
|
-
}, { alwaysLast: true });
|
|
318
|
-
}) : () => {};
|
|
319
|
-
//#endregion
|
|
320
|
-
//#region ../../node_modules/.pnpm/cli-cursor@5.0.0/node_modules/cli-cursor/index.js
|
|
321
|
-
let isHidden = false;
|
|
322
|
-
const cliCursor = {};
|
|
323
|
-
cliCursor.show = (writableStream = process$1.stderr) => {
|
|
324
|
-
if (!writableStream.isTTY) return;
|
|
325
|
-
isHidden = false;
|
|
326
|
-
writableStream.write("\x1B[?25h");
|
|
327
|
-
};
|
|
328
|
-
cliCursor.hide = (writableStream = process$1.stderr) => {
|
|
329
|
-
if (!writableStream.isTTY) return;
|
|
330
|
-
restoreCursor();
|
|
331
|
-
isHidden = true;
|
|
332
|
-
writableStream.write("\x1B[?25l");
|
|
333
|
-
};
|
|
334
|
-
cliCursor.toggle = (force, writableStream) => {
|
|
335
|
-
if (force !== void 0) isHidden = force;
|
|
336
|
-
if (isHidden) cliCursor.show(writableStream);
|
|
337
|
-
else cliCursor.hide(writableStream);
|
|
338
|
-
};
|
|
339
|
-
//#endregion
|
|
340
|
-
//#region ../../node_modules/.pnpm/slice-ansi@7.1.2/node_modules/slice-ansi/index.js
|
|
341
|
-
const ESCAPES = /* @__PURE__ */ new Set([27, 155]);
|
|
342
|
-
const CODE_POINT_0 = "0".codePointAt(0);
|
|
343
|
-
const CODE_POINT_9 = "9".codePointAt(0);
|
|
344
|
-
const MAX_ANSI_SEQUENCE_LENGTH = 19;
|
|
345
|
-
const endCodesSet = /* @__PURE__ */ new Set();
|
|
346
|
-
const endCodesMap = /* @__PURE__ */ new Map();
|
|
347
|
-
for (const [start, end] of ansiStyles.codes) {
|
|
348
|
-
endCodesSet.add(ansiStyles.color.ansi(end));
|
|
349
|
-
endCodesMap.set(ansiStyles.color.ansi(start), ansiStyles.color.ansi(end));
|
|
350
|
-
}
|
|
351
|
-
function getEndCode(code) {
|
|
352
|
-
if (endCodesSet.has(code)) return code;
|
|
353
|
-
if (endCodesMap.has(code)) return endCodesMap.get(code);
|
|
354
|
-
code = code.slice(2);
|
|
355
|
-
if (code.includes(";")) code = code[0] + "0";
|
|
356
|
-
const returnValue = ansiStyles.codes.get(Number.parseInt(code, 10));
|
|
357
|
-
if (returnValue) return ansiStyles.color.ansi(returnValue);
|
|
358
|
-
return ansiStyles.reset.open;
|
|
359
|
-
}
|
|
360
|
-
function findNumberIndex(string) {
|
|
361
|
-
for (let index = 0; index < string.length; index++) {
|
|
362
|
-
const codePoint = string.codePointAt(index);
|
|
363
|
-
if (codePoint >= CODE_POINT_0 && codePoint <= CODE_POINT_9) return index;
|
|
364
|
-
}
|
|
365
|
-
return -1;
|
|
366
|
-
}
|
|
367
|
-
function parseAnsiCode(string, offset) {
|
|
368
|
-
string = string.slice(offset, offset + MAX_ANSI_SEQUENCE_LENGTH);
|
|
369
|
-
const startIndex = findNumberIndex(string);
|
|
370
|
-
if (startIndex !== -1) {
|
|
371
|
-
let endIndex = string.indexOf("m", startIndex);
|
|
372
|
-
if (endIndex === -1) endIndex = string.length;
|
|
373
|
-
return string.slice(0, endIndex + 1);
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
function tokenize(string, endCharacter = Number.POSITIVE_INFINITY) {
|
|
377
|
-
const returnValue = [];
|
|
378
|
-
let index = 0;
|
|
379
|
-
let visibleCount = 0;
|
|
380
|
-
while (index < string.length) {
|
|
381
|
-
const codePoint = string.codePointAt(index);
|
|
382
|
-
if (ESCAPES.has(codePoint)) {
|
|
383
|
-
const code = parseAnsiCode(string, index);
|
|
384
|
-
if (code) {
|
|
385
|
-
returnValue.push({
|
|
386
|
-
type: "ansi",
|
|
387
|
-
code,
|
|
388
|
-
endCode: getEndCode(code)
|
|
389
|
-
});
|
|
390
|
-
index += code.length;
|
|
391
|
-
continue;
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
const isFullWidth = isFullwidthCodePoint(codePoint);
|
|
395
|
-
const character = String.fromCodePoint(codePoint);
|
|
396
|
-
returnValue.push({
|
|
397
|
-
type: "character",
|
|
398
|
-
value: character,
|
|
399
|
-
isFullWidth
|
|
400
|
-
});
|
|
401
|
-
index += character.length;
|
|
402
|
-
visibleCount += isFullWidth ? 2 : character.length;
|
|
403
|
-
if (visibleCount >= endCharacter) break;
|
|
404
|
-
}
|
|
405
|
-
return returnValue;
|
|
406
|
-
}
|
|
407
|
-
function reduceAnsiCodes(codes) {
|
|
408
|
-
let returnValue = [];
|
|
409
|
-
for (const code of codes) if (code.code === ansiStyles.reset.open) returnValue = [];
|
|
410
|
-
else if (endCodesSet.has(code.code)) returnValue = returnValue.filter((returnValueCode) => returnValueCode.endCode !== code.code);
|
|
411
|
-
else {
|
|
412
|
-
returnValue = returnValue.filter((returnValueCode) => returnValueCode.endCode !== code.endCode);
|
|
413
|
-
returnValue.push(code);
|
|
414
|
-
}
|
|
415
|
-
return returnValue;
|
|
416
|
-
}
|
|
417
|
-
function undoAnsiCodes(codes) {
|
|
418
|
-
return reduceAnsiCodes(codes).map(({ endCode }) => endCode).reverse().join("");
|
|
419
|
-
}
|
|
420
|
-
function sliceAnsi(string, start, end) {
|
|
421
|
-
const tokens = tokenize(string, end);
|
|
422
|
-
let activeCodes = [];
|
|
423
|
-
let position = 0;
|
|
424
|
-
let returnValue = "";
|
|
425
|
-
let include = false;
|
|
426
|
-
for (const token of tokens) {
|
|
427
|
-
if (end !== void 0 && position >= end) break;
|
|
428
|
-
if (token.type === "ansi") {
|
|
429
|
-
activeCodes.push(token);
|
|
430
|
-
if (include) returnValue += token.code;
|
|
431
|
-
} else {
|
|
432
|
-
if (!include && position >= start) {
|
|
433
|
-
include = true;
|
|
434
|
-
activeCodes = reduceAnsiCodes(activeCodes);
|
|
435
|
-
returnValue = activeCodes.map(({ code }) => code).join("");
|
|
436
|
-
}
|
|
437
|
-
if (include) returnValue += token.value;
|
|
438
|
-
position += token.isFullWidth ? 2 : token.value.length;
|
|
439
|
-
}
|
|
440
|
-
}
|
|
441
|
-
returnValue += undoAnsiCodes(activeCodes);
|
|
442
|
-
return returnValue;
|
|
443
|
-
}
|
|
444
|
-
//#endregion
|
|
445
|
-
//#region ../../node_modules/.pnpm/log-update@6.1.0/node_modules/log-update/index.js
|
|
446
|
-
const defaultTerminalHeight = 24;
|
|
447
|
-
const getWidth = ({ columns = 80 }) => columns;
|
|
448
|
-
const fitToTerminalHeight = (stream, text) => {
|
|
449
|
-
const terminalHeight = stream.rows ?? defaultTerminalHeight;
|
|
450
|
-
const lines = text.split("\n");
|
|
451
|
-
const toRemove = Math.max(0, lines.length - terminalHeight);
|
|
452
|
-
return toRemove ? sliceAnsi(text, stripAnsi(lines.slice(0, toRemove).join("\n")).length + 1) : text;
|
|
453
|
-
};
|
|
454
|
-
function createLogUpdate(stream, { showCursor = false } = {}) {
|
|
455
|
-
let previousLineCount = 0;
|
|
456
|
-
let previousWidth = getWidth(stream);
|
|
457
|
-
let previousOutput = "";
|
|
458
|
-
const reset = () => {
|
|
459
|
-
previousOutput = "";
|
|
460
|
-
previousWidth = getWidth(stream);
|
|
461
|
-
previousLineCount = 0;
|
|
462
|
-
};
|
|
463
|
-
const render = (...arguments_) => {
|
|
464
|
-
if (!showCursor) cliCursor.hide();
|
|
465
|
-
let output = fitToTerminalHeight(stream, arguments_.join(" ") + "\n");
|
|
466
|
-
const width = getWidth(stream);
|
|
467
|
-
if (output === previousOutput && previousWidth === width) return;
|
|
468
|
-
previousOutput = output;
|
|
469
|
-
previousWidth = width;
|
|
470
|
-
output = wrapAnsi(output, width, {
|
|
471
|
-
trim: false,
|
|
472
|
-
hard: true,
|
|
473
|
-
wordWrap: false
|
|
474
|
-
});
|
|
475
|
-
stream.write(eraseLines(previousLineCount) + output);
|
|
476
|
-
previousLineCount = output.split("\n").length;
|
|
477
|
-
};
|
|
478
|
-
render.clear = () => {
|
|
479
|
-
stream.write(eraseLines(previousLineCount));
|
|
480
|
-
reset();
|
|
481
|
-
};
|
|
482
|
-
render.done = () => {
|
|
483
|
-
reset();
|
|
484
|
-
if (!showCursor) cliCursor.show();
|
|
485
|
-
};
|
|
486
|
-
return render;
|
|
487
|
-
}
|
|
488
|
-
createLogUpdate(process$1.stdout);
|
|
489
|
-
createLogUpdate(process$1.stderr);
|
|
490
|
-
//#endregion
|
|
491
|
-
export { createLogUpdate };
|