@fedify/init 2.5.0-dev.2516 → 2.5.0-dev.2541
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/README.md +17 -7
- package/dist/_virtual/_rolldown/runtime.js +26 -0
- package/dist/action/configs.js +23 -11
- package/dist/ask/kv.js +10 -10
- package/dist/ask/mq.js +10 -10
- package/dist/ask/pm.js +8 -5
- package/dist/command.d.ts +21 -1
- package/dist/json/kv.js +1 -0
- package/dist/json/kv.json +1 -0
- package/dist/json/mq.js +1 -0
- package/dist/json/mq.json +1 -0
- package/dist/lib.js +2 -2
- package/dist/node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/index.js +29 -0
- package/dist/node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/enoent.js +42 -0
- package/dist/node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/parse.js +67 -0
- package/dist/node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/escape.js +23 -0
- package/dist/node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/readShebang.js +22 -0
- package/dist/node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js +36 -0
- package/dist/node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js +47 -0
- package/dist/node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/mode.js +33 -0
- package/dist/node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js +33 -0
- package/dist/node_modules/.pnpm/path-key@3.1.1/node_modules/path-key/index.js +14 -0
- package/dist/node_modules/.pnpm/shebang-command@2.0.0/node_modules/shebang-command/index.js +17 -0
- package/dist/node_modules/.pnpm/shebang-regex@3.0.0/node_modules/shebang-regex/index.js +8 -0
- package/dist/node_modules/.pnpm/which@2.0.2/node_modules/which/which.js +77 -0
- package/dist/{deno.js → packages/init/deno.js} +1 -1
- package/dist/scripts/tooling_main.js +17 -0
- package/dist/test/action.d.ts +6 -0
- package/dist/test/action.js +15 -5
- package/dist/test/cancel.js +14 -0
- package/dist/test/create.js +10 -5
- package/dist/test/lookup.js +17 -7
- package/dist/test/mod.d.ts +6 -1
- package/dist/test/mod.js +13 -6
- package/dist/test/node.js +6 -0
- package/dist/test/port.js +34 -13
- package/dist/test/run.js +15 -9
- package/dist/test/server.js +136 -108
- package/dist/types.d.ts +4 -0
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -28,8 +28,10 @@ The initializer supports the following project configurations:
|
|
|
28
28
|
- **Web frameworks**: Bare-bones, [Astro], [Elysia], [Express], [Hono],
|
|
29
29
|
[Next.js], [Nitro], [Nuxt], [SolidStart], [SvelteKit]
|
|
30
30
|
- **Package managers**: Deno, pnpm, Bun, Yarn, npm
|
|
31
|
-
- **Key-value stores**: In-Memory, Redis, PostgreSQL, Deno KV (
|
|
32
|
-
|
|
31
|
+
- **Key-value stores**: In-Memory, Redis, PostgreSQL, Deno KV (deprecated;
|
|
32
|
+
Deno only)
|
|
33
|
+
- **Message queues**: In-Process, Redis, PostgreSQL, AMQP, Deno KV
|
|
34
|
+
(deprecated; Deno only)
|
|
33
35
|
|
|
34
36
|
[Astro]: https://astro.build/
|
|
35
37
|
[Elysia]: https://elysiajs.com/
|
|
@@ -70,13 +72,16 @@ import { initCommand, runInit } from "@fedify/init";
|
|
|
70
72
|
Test
|
|
71
73
|
----
|
|
72
74
|
|
|
73
|
-
The `test
|
|
75
|
+
The `test:init` task is useful for contributors working on `@fedify/init`,
|
|
74
76
|
especially when adding support for a new framework/library or modifying the
|
|
75
77
|
scaffolding logic. It tests the project initialization by running
|
|
76
|
-
`fedify init` across all combinations of supported options
|
|
78
|
+
`fedify init` across all combinations of supported options in temporary
|
|
77
79
|
directories, verifying that the generated projects are valid.
|
|
78
80
|
|
|
79
|
-
|
|
81
|
+
The harness runs on Node.js 22.18 or later, using
|
|
82
|
+
`--experimental-transform-types` for the initializer source. The default
|
|
83
|
+
matrix includes Deno projects and requires Deno as well. To run it, use the
|
|
84
|
+
mise task from the repository root:
|
|
80
85
|
|
|
81
86
|
~~~~ sh
|
|
82
87
|
mise run test:init
|
|
@@ -85,8 +90,13 @@ mise run test:init
|
|
|
85
90
|
You can also filter specific options to test a subset of combinations:
|
|
86
91
|
|
|
87
92
|
~~~~ sh
|
|
88
|
-
mise run test:init -w hono -p
|
|
93
|
+
mise run test:init -- -w hono -p npm -k in-memory -m in-process
|
|
94
|
+
mise run test:init -- -w hono -p deno
|
|
89
95
|
~~~~
|
|
90
96
|
|
|
97
|
+
The first command tests only Node.js targets and needs no Deno executable or
|
|
98
|
+
cache. The second tests the Hono targets that use Deno.
|
|
99
|
+
|
|
91
100
|
Use `--no-dry-run` to test with actual file creation and dependency
|
|
92
|
-
installation, or `--no-hyd-run` to
|
|
101
|
+
installation, or `--no-hyd-run` to preview generation without scaffolding apps
|
|
102
|
+
or installing dependencies. The harness writes log files for both modes.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
//#region \0rolldown/runtime.js
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
12
|
+
key = keys[i];
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
14
|
+
get: ((k) => from[k]).bind(null, key),
|
|
15
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
21
|
+
value: mod,
|
|
22
|
+
enumerable: true
|
|
23
|
+
}) : target, mod));
|
|
24
|
+
var __require = /* #__PURE__ */ (() => createRequire(import.meta.url))();
|
|
25
|
+
//#endregion
|
|
26
|
+
export { __commonJSMin, __require, __toESM };
|
package/dist/action/configs.js
CHANGED
|
@@ -24,17 +24,29 @@ const logger = getLogger([
|
|
|
24
24
|
* @param param0 - Destructured initialization data containing KV, MQ, initializer, and directory
|
|
25
25
|
* @returns Configuration object with path and Deno-specific settings
|
|
26
26
|
*/
|
|
27
|
-
const loadDenoConfig = (data) =>
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
27
|
+
const loadDenoConfig = (data) => {
|
|
28
|
+
const lintExcludes = getDenoKvLintExcludes(data);
|
|
29
|
+
return {
|
|
30
|
+
path: "deno.json",
|
|
31
|
+
data: {
|
|
32
|
+
...pick(["compilerOptions", "tasks"], data.initializer),
|
|
33
|
+
...getUnstable(data),
|
|
34
|
+
nodeModulesDir: "auto",
|
|
35
|
+
imports: joinDepsReg("deno")(getDependencies(data)),
|
|
36
|
+
lint: {
|
|
37
|
+
plugins: ["jsr:@fedify/lint"],
|
|
38
|
+
...lintExcludes.length > 0 ? { rules: { exclude: lintExcludes } } : {}
|
|
39
|
+
},
|
|
40
|
+
...data.testMode && !data.dryRun ? { links: getLinks(data) } : {}
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Deno Lint reports every plugin rule as an error, so `denokv` selections
|
|
46
|
+
* would fail `deno lint` without opting out of the deprecation rules. The
|
|
47
|
+
* interactive prompt already labels the option as deprecated.
|
|
48
|
+
*/
|
|
49
|
+
const getDenoKvLintExcludes = ({ kvStore, messageQueue }) => [...kvStore === "denokv" ? ["fedify-lint/deno-kv-store-deprecated"] : [], ...messageQueue === "denokv" ? ["fedify-lint/deno-kv-message-queue-deprecated"] : []];
|
|
38
50
|
const getUnstable = ({ kv: { denoUnstable: kv = [] }, mq: { denoUnstable: mq = [] } }) => {
|
|
39
51
|
const unstable = pipe(needsUnstableTemporal() ? ["temporal"] : [], concat(kv), concat(mq), uniq, toArray);
|
|
40
52
|
return isEmpty(unstable) ? {} : { unstable };
|
package/dist/ask/kv.js
CHANGED
|
@@ -22,17 +22,17 @@ const askKvStore = async (data) => ({
|
|
|
22
22
|
});
|
|
23
23
|
const unmatchedWhileTesting = ({ kvStore: kv, packageManager: pm }) => /* @__PURE__ */ new Error(`Key-value store '${kv}' is not compatible with package manager '${pm}'`);
|
|
24
24
|
const noticeUnmatched = ({ kvStore: kv, packageManager: pm }) => printErrorMessage`Error: Key-value store '${kv}' is not compatible with package manager '${pm}'`;
|
|
25
|
-
const choiceKvStore = (pm) => (kv) =>
|
|
26
|
-
|
|
25
|
+
const choiceKvStore = (pm) => (kv) => {
|
|
26
|
+
const supported = isKvSupportsPm({
|
|
27
27
|
kvStore: kv,
|
|
28
28
|
packageManager: pm
|
|
29
|
-
})
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
}
|
|
29
|
+
});
|
|
30
|
+
return {
|
|
31
|
+
name: kvStores[kv].deprecated ? `${kv} (deprecated)` : kv,
|
|
32
|
+
value: kv,
|
|
33
|
+
disabled: supported ? false : `(not supported with ${pm})`
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
36
|
const isKvSupportsPm = ({ kvStore, packageManager }) => kvStores[kvStore].packageManagers.includes(packageManager);
|
|
37
37
|
//#endregion
|
|
38
|
-
export { fillKvStore as default };
|
|
38
|
+
export { choiceKvStore, fillKvStore as default };
|
package/dist/ask/mq.js
CHANGED
|
@@ -24,17 +24,17 @@ const unmatchedWhileTesting = ({ messageQueue: mq, packageManager: pm }) => /* @
|
|
|
24
24
|
const noticeUnmatched = ({ messageQueue: mq, packageManager: pm }) => {
|
|
25
25
|
printErrorMessage`Error: Message queue '${mq}' is not compatible with package manager '${pm}'`;
|
|
26
26
|
};
|
|
27
|
-
const choiceMessageQueue = (packageManager) => (messageQueue) =>
|
|
28
|
-
|
|
27
|
+
const choiceMessageQueue = (packageManager) => (messageQueue) => {
|
|
28
|
+
const supported = isMqSupportsPm({
|
|
29
29
|
messageQueue,
|
|
30
30
|
packageManager
|
|
31
|
-
})
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
messageQueue,
|
|
35
|
-
packageManager
|
|
36
|
-
}
|
|
37
|
-
}
|
|
31
|
+
});
|
|
32
|
+
return {
|
|
33
|
+
name: messageQueues[messageQueue].deprecated ? `${messageQueue} (deprecated)` : messageQueue,
|
|
34
|
+
value: messageQueue,
|
|
35
|
+
disabled: supported ? false : `(not supported with ${packageManager})`
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
38
|
const isMqSupportsPm = ({ messageQueue, packageManager }) => messageQueues[messageQueue].packageManagers.includes(packageManager);
|
|
39
39
|
//#endregion
|
|
40
|
-
export { fillMessageQueue as default };
|
|
40
|
+
export { choiceMessageQueue, fillMessageQueue as default };
|
package/dist/ask/pm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PACKAGE_MANAGER } from "../const.js";
|
|
2
2
|
import { printErrorMessage } from "../utils.js";
|
|
3
|
-
import { checkAllRuntimes, getInstallUrl, isPackageManagerAvailable, isTest, runtimes } from "../lib.js";
|
|
3
|
+
import { checkAllRuntimes, checkRuntimeVersion, getInstallUrl, isPackageManagerAvailable, isTest, resolveRequiredVersion, runtimes } from "../lib.js";
|
|
4
4
|
import { pmToRt } from "../webframeworks/utils.js";
|
|
5
5
|
import webFrameworks from "../webframeworks/mod.js";
|
|
6
6
|
import process from "node:process";
|
|
@@ -18,7 +18,11 @@ import { print } from "@optique/run";
|
|
|
18
18
|
* @returns A promise resolving to options with a guaranteed packageManager
|
|
19
19
|
*/
|
|
20
20
|
const fillPackageManager = async ({ packageManager, ...options }) => {
|
|
21
|
-
const
|
|
21
|
+
const runtime = packageManager == null ? void 0 : pmToRt(packageManager);
|
|
22
|
+
const choices = isTest(options) && packageManager != null && runtime != null ? [await choicePackageManager(options.webFramework, packageManager, await checkRuntimeVersion({
|
|
23
|
+
...runtimes[runtime],
|
|
24
|
+
minVersion: resolveRequiredVersion(runtime, webFrameworks[options.webFramework].minRuntimeVersions?.[runtime])
|
|
25
|
+
}))] : await calculateChoices(options.webFramework);
|
|
22
26
|
if (packageManager != null) {
|
|
23
27
|
const choice = choices.find(({ value }) => value === packageManager);
|
|
24
28
|
if (choice.disabled == null) return {
|
|
@@ -35,7 +39,7 @@ const fillPackageManager = async ({ packageManager, ...options }) => {
|
|
|
35
39
|
};
|
|
36
40
|
const calculateChoices = async (wf) => {
|
|
37
41
|
const runtimeChecks = await checkAllRuntimes(webFrameworks[wf].minRuntimeVersions);
|
|
38
|
-
const choices = await Promise.all(PACKAGE_MANAGER.map(choicePackageManager(wf, runtimeChecks)));
|
|
42
|
+
const choices = await Promise.all(PACKAGE_MANAGER.map((pm) => choicePackageManager(wf, pm, runtimeChecks[pmToRt(pm)])));
|
|
39
43
|
if (choices.every((choice) => choice.disabled)) {
|
|
40
44
|
printErrorMessage`No package manager with a supported runtime is available for ${webFrameworks[wf].label}.`;
|
|
41
45
|
process.exit(1);
|
|
@@ -46,8 +50,7 @@ const askPackageManager = (choices) => select({
|
|
|
46
50
|
message: "Choose the package manager to use",
|
|
47
51
|
choices
|
|
48
52
|
});
|
|
49
|
-
const choicePackageManager = (wf,
|
|
50
|
-
const check = runtimeChecks[pmToRt(value)];
|
|
53
|
+
const choicePackageManager = async (wf, value, check) => {
|
|
51
54
|
const label = runtimes[pmToRt(value)].label;
|
|
52
55
|
const disabled = !isWfSupportsPm(wf, value) ? `not supported with ${webFrameworks[wf].label}` : check.status === "unsupported" ? `requires ${label} ${check.required} or later (detected: ${check.detected})` : check.status === "missing" ? `requires ${label} which is not installed` : check.status === "malformed" ? `could not detect ${label} version` : pmToRt(value) === "node" && !await isPackageManagerAvailable(value) ? `is not installed; install it from ${getInstallUrl(value)}` : "";
|
|
53
56
|
return disabled === "" ? {
|
package/dist/command.d.ts
CHANGED
|
@@ -43,5 +43,25 @@ declare const initCommand: _$_optique_core0.FluentParser<"sync", {
|
|
|
43
43
|
}, ["matched", string] | ["parsing", Record<string | symbol, unknown>] | undefined>;
|
|
44
44
|
/** The inferred value type produced by parsing the `fedify init` command. */
|
|
45
45
|
type InitCommand = InferValue<typeof initCommand>;
|
|
46
|
+
/**
|
|
47
|
+
* The `test-init` CLI command parser.
|
|
48
|
+
*/
|
|
49
|
+
declare const testInitCommand: _$_optique_core0.FluentParser<"sync", ({
|
|
50
|
+
readonly webFramework: readonly ("next" | "bare-bones" | "hono" | "nitro" | "elysia" | "astro" | "express" | "nuxt" | "solidstart" | "sveltekit" | undefined)[];
|
|
51
|
+
readonly packageManager: readonly ("deno" | "pnpm" | "bun" | "yarn" | "npm" | undefined)[];
|
|
52
|
+
readonly kvStore: readonly ("postgres" | "mysql" | "in-memory" | "redis" | "denokv" | undefined)[];
|
|
53
|
+
readonly messageQueue: readonly ("postgres" | "mysql" | "redis" | "denokv" | "in-process" | "amqp" | undefined)[];
|
|
54
|
+
} & {
|
|
55
|
+
readonly noHydRun: boolean;
|
|
56
|
+
}) | ({
|
|
57
|
+
readonly webFramework: readonly ("next" | "bare-bones" | "hono" | "nitro" | "elysia" | "astro" | "express" | "nuxt" | "solidstart" | "sveltekit" | undefined)[];
|
|
58
|
+
readonly packageManager: readonly ("deno" | "pnpm" | "bun" | "yarn" | "npm" | undefined)[];
|
|
59
|
+
readonly kvStore: readonly ("postgres" | "mysql" | "in-memory" | "redis" | "denokv" | undefined)[];
|
|
60
|
+
readonly messageQueue: readonly ("postgres" | "mysql" | "redis" | "denokv" | "in-process" | "amqp" | undefined)[];
|
|
61
|
+
} & {
|
|
62
|
+
readonly noDryRun: boolean;
|
|
63
|
+
}), ["matched", string] | ["parsing", Record<string | symbol, unknown>] | undefined>;
|
|
64
|
+
/** The inferred value type produced by parsing the `test-init` command. */
|
|
65
|
+
type TestInitCommand = InferValue<typeof testInitCommand>;
|
|
46
66
|
//#endregion
|
|
47
|
-
export { InitCommand, initCommand, initOptions };
|
|
67
|
+
export { InitCommand, TestInitCommand, initCommand, initOptions, testInitCommand };
|
package/dist/json/kv.js
CHANGED
package/dist/json/kv.json
CHANGED
package/dist/json/mq.js
CHANGED
package/dist/json/mq.json
CHANGED
package/dist/lib.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { version } from "./deno.js";
|
|
1
|
+
import { version } from "./packages/init/deno.js";
|
|
2
2
|
import kv_default from "./json/kv.js";
|
|
3
3
|
import mq_default from "./json/mq.js";
|
|
4
4
|
import rt_default from "./json/rt.js";
|
|
@@ -367,4 +367,4 @@ const isDirectory = async (path) => {
|
|
|
367
367
|
/** Returns `true` if the current run is in test mode. */
|
|
368
368
|
const isTest = ({ testMode }) => testMode;
|
|
369
369
|
//#endregion
|
|
370
|
-
export { PACKAGE_VERSION, checkAllRuntimes, createFile, getBuildCommand, getDevCommand, getInstallUrl, isDirectoryEmpty, isPackageManagerAvailable, isTest, kvStores, logger, messageQueues, packageManagers, readTemplate, resolveRequiredVersion, runtimes, throwUnlessNotExists, verifyRuntimeVersion };
|
|
370
|
+
export { PACKAGE_VERSION, checkAllRuntimes, checkRuntimeVersion, createFile, getBuildCommand, getDevCommand, getInstallUrl, isDirectoryEmpty, isPackageManagerAvailable, isTest, kvStores, logger, messageQueues, packageManagers, readTemplate, resolveRequiredVersion, runtimes, throwUnlessNotExists, verifyRuntimeVersion };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { __commonJSMin, __require } from "../../../../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { require_parse } from "./lib/parse.js";
|
|
3
|
+
import { require_enoent } from "./lib/enoent.js";
|
|
4
|
+
//#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/index.js
|
|
5
|
+
var require_cross_spawn = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
6
|
+
const cp = __require("child_process");
|
|
7
|
+
const parse = require_parse();
|
|
8
|
+
const enoent = require_enoent();
|
|
9
|
+
function spawn(command, args, options) {
|
|
10
|
+
const parsed = parse(command, args, options);
|
|
11
|
+
const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
|
|
12
|
+
enoent.hookChildProcess(spawned, parsed);
|
|
13
|
+
return spawned;
|
|
14
|
+
}
|
|
15
|
+
function spawnSync(command, args, options) {
|
|
16
|
+
const parsed = parse(command, args, options);
|
|
17
|
+
const result = cp.spawnSync(parsed.command, parsed.args, parsed.options);
|
|
18
|
+
result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
|
|
19
|
+
return result;
|
|
20
|
+
}
|
|
21
|
+
module.exports = spawn;
|
|
22
|
+
module.exports.spawn = spawn;
|
|
23
|
+
module.exports.sync = spawnSync;
|
|
24
|
+
module.exports._parse = parse;
|
|
25
|
+
module.exports._enoent = enoent;
|
|
26
|
+
}));
|
|
27
|
+
//#endregion
|
|
28
|
+
export default require_cross_spawn();
|
|
29
|
+
export { require_cross_spawn };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { __commonJSMin } from "../../../../../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
//#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/enoent.js
|
|
3
|
+
var require_enoent = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
4
|
+
const isWin = process.platform === "win32";
|
|
5
|
+
function notFoundError(original, syscall) {
|
|
6
|
+
return Object.assign(/* @__PURE__ */ new Error(`${syscall} ${original.command} ENOENT`), {
|
|
7
|
+
code: "ENOENT",
|
|
8
|
+
errno: "ENOENT",
|
|
9
|
+
syscall: `${syscall} ${original.command}`,
|
|
10
|
+
path: original.command,
|
|
11
|
+
spawnargs: original.args
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
function hookChildProcess(cp, parsed) {
|
|
15
|
+
if (!isWin) return;
|
|
16
|
+
const originalEmit = cp.emit;
|
|
17
|
+
cp.emit = function(name, arg1) {
|
|
18
|
+
if (name === "exit") {
|
|
19
|
+
const err = verifyENOENT(arg1, parsed);
|
|
20
|
+
if (err) return originalEmit.call(cp, "error", err);
|
|
21
|
+
}
|
|
22
|
+
return originalEmit.apply(cp, arguments);
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function verifyENOENT(status, parsed) {
|
|
26
|
+
if (isWin && status === 1 && !parsed.file) return notFoundError(parsed.original, "spawn");
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
function verifyENOENTSync(status, parsed) {
|
|
30
|
+
if (isWin && status === 1 && !parsed.file) return notFoundError(parsed.original, "spawnSync");
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
module.exports = {
|
|
34
|
+
hookChildProcess,
|
|
35
|
+
verifyENOENT,
|
|
36
|
+
verifyENOENTSync,
|
|
37
|
+
notFoundError
|
|
38
|
+
};
|
|
39
|
+
}));
|
|
40
|
+
//#endregion
|
|
41
|
+
export default require_enoent();
|
|
42
|
+
export { require_enoent };
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { __commonJSMin, __require } from "../../../../../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { require_resolveCommand } from "./util/resolveCommand.js";
|
|
3
|
+
import { require_escape } from "./util/escape.js";
|
|
4
|
+
import { require_readShebang } from "./util/readShebang.js";
|
|
5
|
+
//#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/parse.js
|
|
6
|
+
var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
7
|
+
const path = __require("path");
|
|
8
|
+
const resolveCommand = require_resolveCommand();
|
|
9
|
+
const escape = require_escape();
|
|
10
|
+
const readShebang = require_readShebang();
|
|
11
|
+
const isWin = process.platform === "win32";
|
|
12
|
+
const isExecutableRegExp = /\.(?:com|exe)$/i;
|
|
13
|
+
const isCmdShimRegExp = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
|
|
14
|
+
function detectShebang(parsed) {
|
|
15
|
+
parsed.file = resolveCommand(parsed);
|
|
16
|
+
const shebang = parsed.file && readShebang(parsed.file);
|
|
17
|
+
if (shebang) {
|
|
18
|
+
parsed.args.unshift(parsed.file);
|
|
19
|
+
parsed.command = shebang;
|
|
20
|
+
return resolveCommand(parsed);
|
|
21
|
+
}
|
|
22
|
+
return parsed.file;
|
|
23
|
+
}
|
|
24
|
+
function parseNonShell(parsed) {
|
|
25
|
+
if (!isWin) return parsed;
|
|
26
|
+
const commandFile = detectShebang(parsed);
|
|
27
|
+
const needsShell = !isExecutableRegExp.test(commandFile);
|
|
28
|
+
if (parsed.options.forceShell || needsShell) {
|
|
29
|
+
const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
|
|
30
|
+
parsed.command = path.normalize(parsed.command);
|
|
31
|
+
parsed.command = escape.command(parsed.command);
|
|
32
|
+
parsed.args = parsed.args.map((arg) => escape.argument(arg, needsDoubleEscapeMetaChars));
|
|
33
|
+
parsed.args = [
|
|
34
|
+
"/d",
|
|
35
|
+
"/s",
|
|
36
|
+
"/c",
|
|
37
|
+
`"${[parsed.command].concat(parsed.args).join(" ")}"`
|
|
38
|
+
];
|
|
39
|
+
parsed.command = process.env.comspec || "cmd.exe";
|
|
40
|
+
parsed.options.windowsVerbatimArguments = true;
|
|
41
|
+
}
|
|
42
|
+
return parsed;
|
|
43
|
+
}
|
|
44
|
+
function parse(command, args, options) {
|
|
45
|
+
if (args && !Array.isArray(args)) {
|
|
46
|
+
options = args;
|
|
47
|
+
args = null;
|
|
48
|
+
}
|
|
49
|
+
args = args ? args.slice(0) : [];
|
|
50
|
+
options = Object.assign({}, options);
|
|
51
|
+
const parsed = {
|
|
52
|
+
command,
|
|
53
|
+
args,
|
|
54
|
+
options,
|
|
55
|
+
file: void 0,
|
|
56
|
+
original: {
|
|
57
|
+
command,
|
|
58
|
+
args
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
return options.shell ? parsed : parseNonShell(parsed);
|
|
62
|
+
}
|
|
63
|
+
module.exports = parse;
|
|
64
|
+
}));
|
|
65
|
+
//#endregion
|
|
66
|
+
export default require_parse();
|
|
67
|
+
export { require_parse };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { __commonJSMin } from "../../../../../../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
//#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/escape.js
|
|
3
|
+
var require_escape = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
4
|
+
const metaCharsRegExp = /([()\][%!^"`<>&|;, *?])/g;
|
|
5
|
+
function escapeCommand(arg) {
|
|
6
|
+
arg = arg.replace(metaCharsRegExp, "^$1");
|
|
7
|
+
return arg;
|
|
8
|
+
}
|
|
9
|
+
function escapeArgument(arg, doubleEscapeMetaChars) {
|
|
10
|
+
arg = `${arg}`;
|
|
11
|
+
arg = arg.replace(/(?=(\\+?)?)\1"/g, "$1$1\\\"");
|
|
12
|
+
arg = arg.replace(/(?=(\\+?)?)\1$/, "$1$1");
|
|
13
|
+
arg = `"${arg}"`;
|
|
14
|
+
arg = arg.replace(metaCharsRegExp, "^$1");
|
|
15
|
+
if (doubleEscapeMetaChars) arg = arg.replace(metaCharsRegExp, "^$1");
|
|
16
|
+
return arg;
|
|
17
|
+
}
|
|
18
|
+
module.exports.command = escapeCommand;
|
|
19
|
+
module.exports.argument = escapeArgument;
|
|
20
|
+
}));
|
|
21
|
+
//#endregion
|
|
22
|
+
export default require_escape();
|
|
23
|
+
export { require_escape };
|
package/dist/node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/readShebang.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { __commonJSMin, __require } from "../../../../../../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { require_shebang_command } from "../../../../../shebang-command@2.0.0/node_modules/shebang-command/index.js";
|
|
3
|
+
//#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/readShebang.js
|
|
4
|
+
var require_readShebang = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
5
|
+
const fs = __require("fs");
|
|
6
|
+
const shebangCommand = require_shebang_command();
|
|
7
|
+
function readShebang(command) {
|
|
8
|
+
const size = 150;
|
|
9
|
+
const buffer = Buffer.alloc(size);
|
|
10
|
+
let fd;
|
|
11
|
+
try {
|
|
12
|
+
fd = fs.openSync(command, "r");
|
|
13
|
+
fs.readSync(fd, buffer, 0, size, 0);
|
|
14
|
+
fs.closeSync(fd);
|
|
15
|
+
} catch (e) {}
|
|
16
|
+
return shebangCommand(buffer.toString());
|
|
17
|
+
}
|
|
18
|
+
module.exports = readShebang;
|
|
19
|
+
}));
|
|
20
|
+
//#endregion
|
|
21
|
+
export default require_readShebang();
|
|
22
|
+
export { require_readShebang };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { __commonJSMin, __require } from "../../../../../../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { require_which } from "../../../../../which@2.0.2/node_modules/which/which.js";
|
|
3
|
+
import { require_path_key } from "../../../../../path-key@3.1.1/node_modules/path-key/index.js";
|
|
4
|
+
//#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js
|
|
5
|
+
var require_resolveCommand = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
6
|
+
const path = __require("path");
|
|
7
|
+
const which = require_which();
|
|
8
|
+
const getPathKey = require_path_key();
|
|
9
|
+
function resolveCommandAttempt(parsed, withoutPathExt) {
|
|
10
|
+
const env = parsed.options.env || process.env;
|
|
11
|
+
const cwd = process.cwd();
|
|
12
|
+
const hasCustomCwd = parsed.options.cwd != null;
|
|
13
|
+
const shouldSwitchCwd = hasCustomCwd && process.chdir !== void 0 && !process.chdir.disabled;
|
|
14
|
+
if (shouldSwitchCwd) try {
|
|
15
|
+
process.chdir(parsed.options.cwd);
|
|
16
|
+
} catch (err) {}
|
|
17
|
+
let resolved;
|
|
18
|
+
try {
|
|
19
|
+
resolved = which.sync(parsed.command, {
|
|
20
|
+
path: env[getPathKey({ env })],
|
|
21
|
+
pathExt: withoutPathExt ? path.delimiter : void 0
|
|
22
|
+
});
|
|
23
|
+
} catch (e) {} finally {
|
|
24
|
+
if (shouldSwitchCwd) process.chdir(cwd);
|
|
25
|
+
}
|
|
26
|
+
if (resolved) resolved = path.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
|
|
27
|
+
return resolved;
|
|
28
|
+
}
|
|
29
|
+
function resolveCommand(parsed) {
|
|
30
|
+
return resolveCommandAttempt(parsed) || resolveCommandAttempt(parsed, true);
|
|
31
|
+
}
|
|
32
|
+
module.exports = resolveCommand;
|
|
33
|
+
}));
|
|
34
|
+
//#endregion
|
|
35
|
+
export default require_resolveCommand();
|
|
36
|
+
export { require_resolveCommand };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { __commonJSMin, __require } from "../../../../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { require_windows } from "./windows.js";
|
|
3
|
+
import { require_mode } from "./mode.js";
|
|
4
|
+
//#region ../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js
|
|
5
|
+
var require_isexe = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
6
|
+
__require("fs");
|
|
7
|
+
var core;
|
|
8
|
+
if (process.platform === "win32" || global.TESTING_WINDOWS) core = require_windows();
|
|
9
|
+
else core = require_mode();
|
|
10
|
+
module.exports = isexe;
|
|
11
|
+
isexe.sync = sync;
|
|
12
|
+
function isexe(path, options, cb) {
|
|
13
|
+
if (typeof options === "function") {
|
|
14
|
+
cb = options;
|
|
15
|
+
options = {};
|
|
16
|
+
}
|
|
17
|
+
if (!cb) {
|
|
18
|
+
if (typeof Promise !== "function") throw new TypeError("callback not provided");
|
|
19
|
+
return new Promise(function(resolve, reject) {
|
|
20
|
+
isexe(path, options || {}, function(er, is) {
|
|
21
|
+
if (er) reject(er);
|
|
22
|
+
else resolve(is);
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
core(path, options || {}, function(er, is) {
|
|
27
|
+
if (er) {
|
|
28
|
+
if (er.code === "EACCES" || options && options.ignoreErrors) {
|
|
29
|
+
er = null;
|
|
30
|
+
is = false;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
cb(er, is);
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
function sync(path, options) {
|
|
37
|
+
try {
|
|
38
|
+
return core.sync(path, options || {});
|
|
39
|
+
} catch (er) {
|
|
40
|
+
if (options && options.ignoreErrors || er.code === "EACCES") return false;
|
|
41
|
+
else throw er;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}));
|
|
45
|
+
//#endregion
|
|
46
|
+
export default require_isexe();
|
|
47
|
+
export { require_isexe };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { __commonJSMin, __require } from "../../../../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
//#region ../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/mode.js
|
|
3
|
+
var require_mode = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
4
|
+
module.exports = isexe;
|
|
5
|
+
isexe.sync = sync;
|
|
6
|
+
var fs = __require("fs");
|
|
7
|
+
function isexe(path, options, cb) {
|
|
8
|
+
fs.stat(path, function(er, stat) {
|
|
9
|
+
cb(er, er ? false : checkStat(stat, options));
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
function sync(path, options) {
|
|
13
|
+
return checkStat(fs.statSync(path), options);
|
|
14
|
+
}
|
|
15
|
+
function checkStat(stat, options) {
|
|
16
|
+
return stat.isFile() && checkMode(stat, options);
|
|
17
|
+
}
|
|
18
|
+
function checkMode(stat, options) {
|
|
19
|
+
var mod = stat.mode;
|
|
20
|
+
var uid = stat.uid;
|
|
21
|
+
var gid = stat.gid;
|
|
22
|
+
var myUid = options.uid !== void 0 ? options.uid : process.getuid && process.getuid();
|
|
23
|
+
var myGid = options.gid !== void 0 ? options.gid : process.getgid && process.getgid();
|
|
24
|
+
var u = parseInt("100", 8);
|
|
25
|
+
var g = parseInt("010", 8);
|
|
26
|
+
var o = parseInt("001", 8);
|
|
27
|
+
var ug = u | g;
|
|
28
|
+
return mod & o || mod & g && gid === myGid || mod & u && uid === myUid || mod & ug && myUid === 0;
|
|
29
|
+
}
|
|
30
|
+
}));
|
|
31
|
+
//#endregion
|
|
32
|
+
export default require_mode();
|
|
33
|
+
export { require_mode };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { __commonJSMin, __require } from "../../../../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
//#region ../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js
|
|
3
|
+
var require_windows = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
4
|
+
module.exports = isexe;
|
|
5
|
+
isexe.sync = sync;
|
|
6
|
+
var fs = __require("fs");
|
|
7
|
+
function checkPathExt(path, options) {
|
|
8
|
+
var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
|
|
9
|
+
if (!pathext) return true;
|
|
10
|
+
pathext = pathext.split(";");
|
|
11
|
+
if (pathext.indexOf("") !== -1) return true;
|
|
12
|
+
for (var i = 0; i < pathext.length; i++) {
|
|
13
|
+
var p = pathext[i].toLowerCase();
|
|
14
|
+
if (p && path.substr(-p.length).toLowerCase() === p) return true;
|
|
15
|
+
}
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
function checkStat(stat, path, options) {
|
|
19
|
+
if (!stat.isSymbolicLink() && !stat.isFile()) return false;
|
|
20
|
+
return checkPathExt(path, options);
|
|
21
|
+
}
|
|
22
|
+
function isexe(path, options, cb) {
|
|
23
|
+
fs.stat(path, function(er, stat) {
|
|
24
|
+
cb(er, er ? false : checkStat(stat, path, options));
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
function sync(path, options) {
|
|
28
|
+
return checkStat(fs.statSync(path), path, options);
|
|
29
|
+
}
|
|
30
|
+
}));
|
|
31
|
+
//#endregion
|
|
32
|
+
export default require_windows();
|
|
33
|
+
export { require_windows };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { __commonJSMin } from "../../../../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
//#region ../../node_modules/.pnpm/path-key@3.1.1/node_modules/path-key/index.js
|
|
3
|
+
var require_path_key = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
4
|
+
const pathKey = (options = {}) => {
|
|
5
|
+
const environment = options.env || process.env;
|
|
6
|
+
if ((options.platform || process.platform) !== "win32") return "PATH";
|
|
7
|
+
return Object.keys(environment).reverse().find((key) => key.toUpperCase() === "PATH") || "Path";
|
|
8
|
+
};
|
|
9
|
+
module.exports = pathKey;
|
|
10
|
+
module.exports.default = pathKey;
|
|
11
|
+
}));
|
|
12
|
+
//#endregion
|
|
13
|
+
export default require_path_key();
|
|
14
|
+
export { require_path_key };
|