@shell-shock/core 0.17.21 → 0.17.23
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 +16 -7
- package/dist/api.cjs +4 -5
- package/dist/api.d.cts +1 -1
- package/dist/api.d.mts +1 -1
- package/dist/api.mjs +2 -2
- package/dist/command-B6KYexlV.d.mts +308 -0
- package/dist/command-B6KYexlV.d.mts.map +1 -0
- package/dist/command-CtfR7hKM.d.cts +308 -0
- package/dist/command-CtfR7hKM.d.cts.map +1 -0
- package/dist/components/command-validation-logic.cjs +153 -216
- package/dist/components/command-validation-logic.d.cts +2 -1
- package/dist/components/command-validation-logic.d.cts.map +1 -1
- package/dist/components/command-validation-logic.d.mts +2 -1
- package/dist/components/command-validation-logic.mjs +153 -214
- package/dist/components/docs.cjs +6 -364
- package/dist/components/docs.d.cts +2 -3
- package/dist/components/docs.d.cts.map +1 -1
- package/dist/components/docs.d.mts +2 -3
- package/dist/components/docs.mjs +2 -356
- package/dist/components/exec-builtin.cjs +63 -100
- package/dist/components/exec-builtin.d.cts +1 -2
- package/dist/components/exec-builtin.d.cts.map +1 -1
- package/dist/components/exec-builtin.d.mts +1 -2
- package/dist/components/exec-builtin.mjs +7 -41
- package/dist/components/helpers.cjs +2 -52
- package/dist/components/helpers.d.cts +2 -1
- package/dist/components/helpers.d.cts.map +1 -1
- package/dist/components/helpers.d.mts +2 -1
- package/dist/components/helpers.mjs +2 -50
- package/dist/components/index.cjs +7 -23
- package/dist/components/index.mjs +9 -9
- package/dist/components/options-parser-logic.cjs +198 -420
- package/dist/components/options-parser-logic.d.cts +2 -5
- package/dist/components/options-parser-logic.d.cts.map +1 -1
- package/dist/components/options-parser-logic.d.mts +2 -5
- package/dist/components/options-parser-logic.mjs +192 -407
- package/dist/components/state-builtin.cjs +106 -164
- package/dist/components/state-builtin.d.cts +1 -2
- package/dist/components/state-builtin.d.cts.map +1 -1
- package/dist/components/state-builtin.d.mts +1 -2
- package/dist/components/state-builtin.mjs +12 -68
- package/dist/components/usage.cjs +4 -48
- package/dist/components/usage.d.cts +1 -2
- package/dist/components/usage.d.cts.map +1 -1
- package/dist/components/usage.d.mts +1 -2
- package/dist/components/usage.mjs +4 -46
- package/dist/components/utils-builtin.cjs +77 -144
- package/dist/components/utils-builtin.d.cts +1 -2
- package/dist/components/utils-builtin.d.cts.map +1 -1
- package/dist/components/utils-builtin.d.mts +1 -2
- package/dist/components/utils-builtin.mjs +9 -74
- package/dist/config-BIF9mEz0.d.cts +157 -0
- package/dist/config-BIF9mEz0.d.cts.map +1 -0
- package/dist/config-CnNYdfsL.d.mts +157 -0
- package/dist/config-CnNYdfsL.d.mts.map +1 -0
- package/dist/config.cjs +24 -58
- package/dist/config.d.cts +1 -2
- package/dist/config.d.cts.map +1 -1
- package/dist/config.d.mts +1 -2
- package/dist/config.mjs +23 -55
- package/dist/{plugin-utils/context-helpers.mjs → context-helpers-D3EJxwbq.mjs} +5 -83
- package/dist/context-helpers-D3EJxwbq.mjs.map +1 -0
- package/dist/{plugin-utils/context-helpers.cjs → context-helpers-_wUuFRB8.cjs} +63 -92
- package/dist/contexts/command.cjs +3 -9
- package/dist/contexts/command.d.cts +1 -2
- package/dist/contexts/command.d.cts.map +1 -1
- package/dist/contexts/command.d.mts +1 -2
- package/dist/contexts/command.mjs +2 -7
- package/dist/contexts/index.cjs +19 -1
- package/dist/contexts/index.d.cts +2 -1
- package/dist/contexts/index.d.mts +2 -1
- package/dist/contexts/index.mjs +2 -1
- package/dist/contexts/options.cjs +7 -30
- package/dist/contexts/options.d.cts +1 -2
- package/dist/contexts/options.d.cts.map +1 -1
- package/dist/contexts/options.d.mts +1 -2
- package/dist/contexts/options.mjs +7 -27
- package/dist/contexts/power-plant.cjs +19 -0
- package/dist/contexts/power-plant.d.cts +2 -0
- package/dist/contexts/power-plant.d.mts +2 -0
- package/dist/contexts/power-plant.mjs +5 -0
- package/dist/docs-C6ZvsVMu.cjs +278 -0
- package/dist/docs-CGQ2HtEY.mjs +249 -0
- package/dist/docs-CGQ2HtEY.mjs.map +1 -0
- package/dist/engine.cjs +5 -39
- package/dist/engine.d.cts +1 -2
- package/dist/engine.d.cts.map +1 -1
- package/dist/engine.d.mts +1 -2
- package/dist/engine.mjs +4 -37
- package/dist/generator.cjs +68 -0
- package/dist/generator.d.cts +15 -0
- package/dist/generator.d.cts.map +1 -0
- package/dist/generator.d.mts +15 -0
- package/dist/generator.d.mts.map +1 -0
- package/dist/generator.mjs +66 -0
- package/dist/generator.mjs.map +1 -0
- package/dist/{helpers/get-framework.cjs → get-framework-CxZc2krd.cjs} +7 -8
- package/dist/{helpers/get-framework.mjs → get-framework-Dlqz2hVZ.mjs} +3 -8
- package/dist/get-framework-Dlqz2hVZ.mjs.map +1 -0
- package/dist/helpers/power-plant.cjs +102 -0
- package/dist/helpers/power-plant.d.cts +61 -0
- package/dist/helpers/power-plant.d.cts.map +1 -0
- package/dist/helpers/power-plant.d.mts +61 -0
- package/dist/helpers/power-plant.d.mts.map +1 -0
- package/dist/helpers/power-plant.mjs +99 -0
- package/dist/helpers/power-plant.mjs.map +1 -0
- package/dist/index-D4klH_pj.d.mts +2 -0
- package/dist/index-DYOBadKY.d.cts +2 -0
- package/dist/index.cjs +1 -37
- package/dist/index.d.cts +4 -6
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +4 -6
- package/dist/index.mjs +0 -35
- package/dist/package-B7Vu265G.mjs +6 -0
- package/dist/package-B7Vu265G.mjs.map +1 -0
- package/dist/{package.cjs → package-BLC4qc8t.cjs} +2 -4
- package/dist/plugin-B-hM2twc.mjs +1458 -0
- package/dist/plugin-B-hM2twc.mjs.map +1 -0
- package/dist/plugin-Bhfq0DMC.cjs +1490 -0
- package/dist/plugin-utils/index.cjs +359 -26
- package/dist/plugin-utils/index.d.cts +273 -9
- package/dist/plugin-utils/index.d.cts.map +1 -0
- package/dist/plugin-utils/index.d.mts +273 -9
- package/dist/plugin-utils/index.d.mts.map +1 -0
- package/dist/plugin-utils/index.mjs +346 -10
- package/dist/plugin-utils/index.mjs.map +1 -0
- package/dist/plugin.cjs +3 -496
- package/dist/plugin.d.cts +1 -3
- package/dist/plugin.d.cts.map +1 -1
- package/dist/plugin.d.mts +1 -3
- package/dist/plugin.mjs +2 -491
- package/dist/power-plant-LgxcvlMN.d.cts +4 -0
- package/dist/power-plant-LgxcvlMN.d.mts +4 -0
- package/dist/reflect-CSiffeL9.cjs +27 -0
- package/dist/reflect-DXKSFgvS.mjs +23 -0
- package/dist/reflect-DXKSFgvS.mjs.map +1 -0
- package/dist/schemas/env.cjs +91 -0
- package/dist/schemas/env.d.cts +145 -0
- package/dist/schemas/env.d.cts.map +1 -0
- package/dist/schemas/env.d.mts +145 -0
- package/dist/{types → schemas}/env.d.mts.map +1 -1
- package/dist/schemas/env.mjs +91 -0
- package/dist/schemas/index.cjs +4 -0
- package/dist/schemas/index.d.cts +2 -0
- package/dist/schemas/index.d.mts +2 -0
- package/dist/schemas/index.mjs +3 -0
- package/dist/types/command.cjs +0 -402
- package/dist/types/command.d.cts +2 -309
- package/dist/types/command.d.mts +2 -309
- package/dist/types/command.mjs +1 -368
- package/dist/types/config.cjs +0 -175
- package/dist/types/config.d.cts +2 -126
- package/dist/types/config.d.mts +2 -126
- package/dist/types/config.mjs +1 -164
- package/dist/types/context.cjs +0 -45
- package/dist/types/context.d.cts +2 -31
- package/dist/types/context.d.mts +2 -31
- package/dist/types/context.mjs +1 -41
- package/dist/types/index.cjs +3 -53
- package/dist/types/index.d.cts +4 -5
- package/dist/types/index.d.mts +4 -5
- package/dist/types/index.mjs +4 -5
- package/package.json +106 -42
- package/dist/_virtual/_rolldown/runtime.cjs +0 -29
- package/dist/api.cjs.map +0 -1
- package/dist/components/command-validation-logic.cjs.map +0 -1
- package/dist/components/docs.cjs.map +0 -1
- package/dist/components/docs.mjs.map +0 -1
- package/dist/components/exec-builtin.cjs.map +0 -1
- package/dist/components/helpers.cjs.map +0 -1
- package/dist/components/options-parser-logic.cjs.map +0 -1
- package/dist/components/state-builtin.cjs.map +0 -1
- package/dist/components/usage.cjs.map +0 -1
- package/dist/components/utils-builtin.cjs.map +0 -1
- package/dist/config.cjs.map +0 -1
- package/dist/contexts/command.cjs.map +0 -1
- package/dist/contexts/options.cjs.map +0 -1
- package/dist/engine.cjs.map +0 -1
- package/dist/helpers/automd.cjs +0 -193
- package/dist/helpers/automd.cjs.map +0 -1
- package/dist/helpers/automd.mjs +0 -190
- package/dist/helpers/automd.mjs.map +0 -1
- package/dist/helpers/docs-helpers.cjs +0 -24
- package/dist/helpers/docs-helpers.cjs.map +0 -1
- package/dist/helpers/docs-helpers.mjs +0 -24
- package/dist/helpers/docs-helpers.mjs.map +0 -1
- package/dist/helpers/get-framework.cjs.map +0 -1
- package/dist/helpers/get-framework.mjs.map +0 -1
- package/dist/helpers/paths.cjs +0 -137
- package/dist/helpers/paths.cjs.map +0 -1
- package/dist/helpers/paths.mjs +0 -134
- package/dist/helpers/paths.mjs.map +0 -1
- package/dist/helpers/persistence.cjs +0 -114
- package/dist/helpers/persistence.cjs.map +0 -1
- package/dist/helpers/persistence.mjs +0 -113
- package/dist/helpers/persistence.mjs.map +0 -1
- package/dist/helpers/update-package-json.cjs +0 -65
- package/dist/helpers/update-package-json.cjs.map +0 -1
- package/dist/helpers/update-package-json.mjs +0 -64
- package/dist/helpers/update-package-json.mjs.map +0 -1
- package/dist/helpers/utilities.cjs +0 -95
- package/dist/helpers/utilities.cjs.map +0 -1
- package/dist/helpers/utilities.mjs +0 -94
- package/dist/helpers/utilities.mjs.map +0 -1
- package/dist/helpers/validations.cjs +0 -71
- package/dist/helpers/validations.cjs.map +0 -1
- package/dist/helpers/validations.mjs +0 -70
- package/dist/helpers/validations.mjs.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/package.cjs.map +0 -1
- package/dist/package.mjs +0 -6
- package/dist/package.mjs.map +0 -1
- package/dist/plugin-utils/compute-bin.cjs +0 -49
- package/dist/plugin-utils/compute-bin.cjs.map +0 -1
- package/dist/plugin-utils/compute-bin.d.cts +0 -13
- package/dist/plugin-utils/compute-bin.d.cts.map +0 -1
- package/dist/plugin-utils/compute-bin.d.mts +0 -13
- package/dist/plugin-utils/compute-bin.d.mts.map +0 -1
- package/dist/plugin-utils/compute-bin.mjs +0 -49
- package/dist/plugin-utils/compute-bin.mjs.map +0 -1
- package/dist/plugin-utils/context-helpers.cjs.map +0 -1
- package/dist/plugin-utils/context-helpers.d.cts +0 -106
- package/dist/plugin-utils/context-helpers.d.cts.map +0 -1
- package/dist/plugin-utils/context-helpers.d.mts +0 -106
- package/dist/plugin-utils/context-helpers.d.mts.map +0 -1
- package/dist/plugin-utils/context-helpers.mjs.map +0 -1
- package/dist/plugin-utils/deepkit.cjs +0 -70
- package/dist/plugin-utils/deepkit.cjs.map +0 -1
- package/dist/plugin-utils/deepkit.d.cts +0 -23
- package/dist/plugin-utils/deepkit.d.cts.map +0 -1
- package/dist/plugin-utils/deepkit.d.mts +0 -23
- package/dist/plugin-utils/deepkit.d.mts.map +0 -1
- package/dist/plugin-utils/deepkit.mjs +0 -69
- package/dist/plugin-utils/deepkit.mjs.map +0 -1
- package/dist/plugin-utils/description-helpers.cjs +0 -112
- package/dist/plugin-utils/description-helpers.cjs.map +0 -1
- package/dist/plugin-utils/description-helpers.d.cts +0 -44
- package/dist/plugin-utils/description-helpers.d.cts.map +0 -1
- package/dist/plugin-utils/description-helpers.d.mts +0 -44
- package/dist/plugin-utils/description-helpers.d.mts.map +0 -1
- package/dist/plugin-utils/description-helpers.mjs +0 -108
- package/dist/plugin-utils/description-helpers.mjs.map +0 -1
- package/dist/plugin-utils/get-command-tree.cjs +0 -118
- package/dist/plugin-utils/get-command-tree.cjs.map +0 -1
- package/dist/plugin-utils/get-command-tree.d.cts +0 -36
- package/dist/plugin-utils/get-command-tree.d.cts.map +0 -1
- package/dist/plugin-utils/get-command-tree.d.mts +0 -36
- package/dist/plugin-utils/get-command-tree.d.mts.map +0 -1
- package/dist/plugin-utils/get-command-tree.mjs +0 -115
- package/dist/plugin-utils/get-command-tree.mjs.map +0 -1
- package/dist/plugin-utils/reflect.cjs +0 -54
- package/dist/plugin-utils/reflect.cjs.map +0 -1
- package/dist/plugin-utils/reflect.d.cts +0 -14
- package/dist/plugin-utils/reflect.d.cts.map +0 -1
- package/dist/plugin-utils/reflect.d.mts +0 -14
- package/dist/plugin-utils/reflect.d.mts.map +0 -1
- package/dist/plugin-utils/reflect.mjs +0 -53
- package/dist/plugin-utils/reflect.mjs.map +0 -1
- package/dist/plugin-utils/traverse-command-tree.cjs +0 -65
- package/dist/plugin-utils/traverse-command-tree.cjs.map +0 -1
- package/dist/plugin-utils/traverse-command-tree.d.cts +0 -22
- package/dist/plugin-utils/traverse-command-tree.d.cts.map +0 -1
- package/dist/plugin-utils/traverse-command-tree.d.mts +0 -22
- package/dist/plugin-utils/traverse-command-tree.d.mts.map +0 -1
- package/dist/plugin-utils/traverse-command-tree.mjs +0 -63
- package/dist/plugin-utils/traverse-command-tree.mjs.map +0 -1
- package/dist/plugin-utils/type-checks.cjs +0 -222
- package/dist/plugin-utils/type-checks.cjs.map +0 -1
- package/dist/plugin-utils/type-checks.d.cts +0 -41
- package/dist/plugin-utils/type-checks.d.cts.map +0 -1
- package/dist/plugin-utils/type-checks.d.mts +0 -41
- package/dist/plugin-utils/type-checks.d.mts.map +0 -1
- package/dist/plugin-utils/type-checks.mjs +0 -218
- package/dist/plugin-utils/type-checks.mjs.map +0 -1
- package/dist/plugin.cjs.map +0 -1
- package/dist/plugin.mjs.map +0 -1
- package/dist/resolver/deepkit.cjs +0 -110
- package/dist/resolver/deepkit.cjs.map +0 -1
- package/dist/resolver/deepkit.mjs +0 -109
- package/dist/resolver/deepkit.mjs.map +0 -1
- package/dist/resolver/helpers.cjs +0 -184
- package/dist/resolver/helpers.cjs.map +0 -1
- package/dist/resolver/helpers.mjs +0 -180
- package/dist/resolver/helpers.mjs.map +0 -1
- package/dist/resolver/resolve.cjs +0 -473
- package/dist/resolver/resolve.cjs.map +0 -1
- package/dist/resolver/resolve.mjs +0 -473
- package/dist/resolver/resolve.mjs.map +0 -1
- package/dist/types/command.cjs.map +0 -1
- package/dist/types/command.d.cts.map +0 -1
- package/dist/types/command.d.mts.map +0 -1
- package/dist/types/command.mjs.map +0 -1
- package/dist/types/config.cjs.map +0 -1
- package/dist/types/config.d.cts.map +0 -1
- package/dist/types/config.d.mts.map +0 -1
- package/dist/types/config.mjs.map +0 -1
- package/dist/types/context.cjs.map +0 -1
- package/dist/types/context.d.cts.map +0 -1
- package/dist/types/context.d.mts.map +0 -1
- package/dist/types/context.mjs.map +0 -1
- package/dist/types/env.cjs +0 -53
- package/dist/types/env.cjs.map +0 -1
- package/dist/types/env.d.cts +0 -71
- package/dist/types/env.d.cts.map +0 -1
- package/dist/types/env.d.mts +0 -71
- package/dist/types/env.mjs +0 -51
- /package/dist/{types → schemas}/env.mjs.map +0 -0
package/dist/plugin.mjs
CHANGED
|
@@ -1,492 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { CommandDocsFile } from "./components/docs.mjs";
|
|
3
|
-
import { ExecBuiltin } from "./components/exec-builtin.mjs";
|
|
4
|
-
import { traverseCommands } from "./plugin-utils/traverse-command-tree.mjs";
|
|
5
|
-
import { getCommandTree } from "./plugin-utils/get-command-tree.mjs";
|
|
6
|
-
import { StateBuiltin } from "./components/state-builtin.mjs";
|
|
7
|
-
import { UtilsBuiltin } from "./components/utils-builtin.mjs";
|
|
8
|
-
import { args, commands, options, usage } from "./helpers/automd.mjs";
|
|
9
|
-
import { getFramework } from "./helpers/get-framework.mjs";
|
|
10
|
-
import { findCommandsRoot, resolveCommandId, resolveCommandName, resolveCommandPath } from "./helpers/paths.mjs";
|
|
11
|
-
import { readCommandsPersistence, writeCommandsPersistence } from "./helpers/persistence.mjs";
|
|
12
|
-
import { formatBinaryPath, updatePackageJsonBinary } from "./helpers/update-package-json.mjs";
|
|
13
|
-
import { formatCommandTree, getGlobalOptions } from "./helpers/utilities.mjs";
|
|
14
|
-
import { validateCommand } from "./helpers/validations.mjs";
|
|
15
|
-
import { resolve } from "./resolver/resolve.mjs";
|
|
16
|
-
import { createComponent } from "@alloy-js/core/jsx-runtime";
|
|
17
|
-
import { For, Show } from "@alloy-js/core";
|
|
18
|
-
import { render } from "@powerlines/plugin-alloy/render";
|
|
19
|
-
import automd from "@powerlines/plugin-automd";
|
|
20
|
-
import { extractEnv, writeEnv } from "@powerlines/plugin-env/helpers/schema";
|
|
21
|
-
import nodejs from "@powerlines/plugin-nodejs";
|
|
22
|
-
import tsdown from "@powerlines/plugin-tsdown";
|
|
23
|
-
import { addProperty, getCacheFilePath, getProperties, isJsonSchemaObject } from "@powerlines/schema";
|
|
24
|
-
import { toArray } from "@stryke/convert/to-array";
|
|
25
|
-
import { chmodX } from "@stryke/fs/chmod-x";
|
|
26
|
-
import { appendPath } from "@stryke/path/append";
|
|
27
|
-
import { findFilePath } from "@stryke/path/find";
|
|
28
|
-
import { isParentPath } from "@stryke/path/is-parent-path";
|
|
29
|
-
import { joinPaths } from "@stryke/path/join-paths";
|
|
30
|
-
import { replacePath } from "@stryke/path/replace";
|
|
31
|
-
import { resolveParentPath } from "@stryke/path/resolve-parent-path";
|
|
32
|
-
import { camelCase } from "@stryke/string-format/camel-case";
|
|
33
|
-
import { constantCase } from "@stryke/string-format/constant-case";
|
|
34
|
-
import { kebabCase } from "@stryke/string-format/kebab-case";
|
|
35
|
-
import { isObject } from "@stryke/type-checks/is-object";
|
|
36
|
-
import { isSetObject } from "@stryke/type-checks/is-set-object";
|
|
37
|
-
import { isSetString } from "@stryke/type-checks/is-set-string";
|
|
38
|
-
import { defu } from "defu";
|
|
39
|
-
import { isFileReference } from "powerlines";
|
|
40
|
-
import { resolveInputs } from "powerlines/utils";
|
|
1
|
+
import { t as plugin } from "./plugin-B-hM2twc.mjs";
|
|
41
2
|
|
|
42
|
-
|
|
43
|
-
function __assignType(fn, args) {
|
|
44
|
-
fn.__type = args;
|
|
45
|
-
return fn;
|
|
46
|
-
}
|
|
47
|
-
const MAX_DEPTH = 50;
|
|
48
|
-
/**
|
|
49
|
-
* The core Powerlines plugin to build Shell Shock projects.
|
|
50
|
-
*/
|
|
51
|
-
const plugin = __assignType((options$1 = {}) => {
|
|
52
|
-
return [
|
|
53
|
-
(tsdown.Ω = [["Context", "\"w!"]], tsdown()),
|
|
54
|
-
(automd.Ω = [["Context", "\"w!"]], automd()),
|
|
55
|
-
{
|
|
56
|
-
name: "shell-shock/core:config",
|
|
57
|
-
config: __assignType(async function config() {
|
|
58
|
-
this.debug("Resolving the Shell Shock configuration.");
|
|
59
|
-
return defu(options$1, {
|
|
60
|
-
name: getAppName(this),
|
|
61
|
-
title: getAppTitle(this),
|
|
62
|
-
description: getAppDescription(this),
|
|
63
|
-
platform: "node",
|
|
64
|
-
projectType: "application",
|
|
65
|
-
framework: getFramework(),
|
|
66
|
-
isCaseSensitive: false,
|
|
67
|
-
output: {
|
|
68
|
-
format: "esm",
|
|
69
|
-
dts: false
|
|
70
|
-
},
|
|
71
|
-
input: !this.config.input || Array.isArray(this.config.input) && this.config.input.length === 0 || isObject(this.config.input) && Object.keys(this.config.input).length === 0 ? ["src/**/command.ts", "src/**/command.tsx"] : void 0,
|
|
72
|
-
resolve: {
|
|
73
|
-
external: ["@powerlines/deepkit"],
|
|
74
|
-
skipNodeModulesBundle: true
|
|
75
|
-
},
|
|
76
|
-
tsdown: {
|
|
77
|
-
dts: false,
|
|
78
|
-
nodeProtocol: true,
|
|
79
|
-
unbundle: false
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
}, ["config", "P\"/!"]),
|
|
83
|
-
configResolved: {
|
|
84
|
-
order: "pre",
|
|
85
|
-
async handler() {
|
|
86
|
-
this.debug("Shell Shock configuration has been resolved.");
|
|
87
|
-
await updatePackageJsonBinary(this);
|
|
88
|
-
this.config.appSpecificEnvPrefix = isSetString(this.config.autoAssignEnv) ? this.config.autoAssignEnv : constantCase(getAppName(this));
|
|
89
|
-
if (!this.config.env.prefix || !Array.isArray(this.config.env.prefix)) this.config.env.prefix = toArray(this.config.env.prefix);
|
|
90
|
-
if (!this.config.env.prefix.includes(this.config.appSpecificEnvPrefix)) this.config.env.prefix.push(this.config.appSpecificEnvPrefix);
|
|
91
|
-
this.config.bin = (isSetString(this.packageJson.bin) ? { [kebabCase(this.config.name)]: this.packageJson.bin } : this.packageJson.bin) ?? { [kebabCase(this.config.name)]: formatBinaryPath(this.config.output.format) };
|
|
92
|
-
if (isSetString(this.config.docs)) {
|
|
93
|
-
const docsWithoutCommandPath = this.config.docs.replace(/\/?\{(?:command|cmd)\}.*$/, "");
|
|
94
|
-
this.config.docs = {
|
|
95
|
-
commands: this.config.docs,
|
|
96
|
-
app: this.config.docs.endsWith("/") ? docsWithoutCommandPath.endsWith("/") ? docsWithoutCommandPath : `${docsWithoutCommandPath}/` : docsWithoutCommandPath
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
this.inputs ??= [];
|
|
100
|
-
this.globalOptions = Object.values(getGlobalOptions(this, {
|
|
101
|
-
id: null,
|
|
102
|
-
name: this.config.name,
|
|
103
|
-
path: null,
|
|
104
|
-
segments: [],
|
|
105
|
-
title: this.config.title,
|
|
106
|
-
description: this.config.description,
|
|
107
|
-
alias: [],
|
|
108
|
-
virtual: false
|
|
109
|
-
})).map(__assignType((option) => ({
|
|
110
|
-
...option,
|
|
111
|
-
name: camelCase(option.name),
|
|
112
|
-
alias: option.alias ?? [],
|
|
113
|
-
required: option.required ?? true
|
|
114
|
-
}), [
|
|
115
|
-
"option",
|
|
116
|
-
"",
|
|
117
|
-
"P\"2!\"/\""
|
|
118
|
-
]));
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
},
|
|
122
|
-
...(nodejs.Ω = [["Context", "\"w!"]], nodejs(defu(options$1 ?? {}, { env: {
|
|
123
|
-
config: "@shell-shock/core/types/env#ShellShockEnv",
|
|
124
|
-
validate: false
|
|
125
|
-
} }))),
|
|
126
|
-
{
|
|
127
|
-
name: "shell-shock/core:inputs",
|
|
128
|
-
async configResolved() {
|
|
129
|
-
const toInputLocation = __assignType((value) => {
|
|
130
|
-
if (isSetString(value)) return value;
|
|
131
|
-
if (isSetObject(value) && isFileReference(value)) return String(value.file);
|
|
132
|
-
return null;
|
|
133
|
-
}, [
|
|
134
|
-
"value",
|
|
135
|
-
"",
|
|
136
|
-
"P#2!P&,J/\""
|
|
137
|
-
]);
|
|
138
|
-
const configuredInputs = [];
|
|
139
|
-
if (Array.isArray(this.config.input)) configuredInputs.push(...this.config.input.map(toInputLocation).filter(__assignType((value) => isSetString(value), [
|
|
140
|
-
"value",
|
|
141
|
-
"",
|
|
142
|
-
"P\"2!!/\""
|
|
143
|
-
])));
|
|
144
|
-
else if (isSetString(this.config.input)) configuredInputs.push(this.config.input);
|
|
145
|
-
else if (isSetObject(this.config.input) && isFileReference(this.config.input)) configuredInputs.push(String(this.config.input.file));
|
|
146
|
-
else if (isSetObject(this.config.input)) configuredInputs.push(...Object.values(this.config.input).map(toInputLocation).filter(__assignType((value) => isSetString(value), [
|
|
147
|
-
"value",
|
|
148
|
-
"",
|
|
149
|
-
"P\"2!!/\""
|
|
150
|
-
])));
|
|
151
|
-
this.debug(configuredInputs.length <= 1 ? `Checking for command modules in the following location: ${configuredInputs[0] ?? "(none configured)"}.` : `Checking for command modules in the following locations:\n${configuredInputs.map(__assignType((input) => ` - ${input}`, [
|
|
152
|
-
"input",
|
|
153
|
-
"",
|
|
154
|
-
"P\"2!\"/\""
|
|
155
|
-
])).join("\n")}`);
|
|
156
|
-
this.commandsPath = await findCommandsRoot(this);
|
|
157
|
-
this.debug(`Resolved commands root path: ${this.commandsPath}`);
|
|
158
|
-
const inputs = await resolveInputs(this, this.config.input);
|
|
159
|
-
this.debug(`Found ${inputs.length} entry points specified in the configuration options.`);
|
|
160
|
-
this.inputs = inputs.reduce(__assignType((ret, entry) => {
|
|
161
|
-
if (entry.file !== this.commandsPath && !isParentPath(entry.file, this.commandsPath)) throw new Error(`Command entry point "${entry.file}" is not located within the commands root "${this.commandsPath}". Please ensure that all command entry points are located within the current project.`);
|
|
162
|
-
const id = resolveCommandId(this, entry.file);
|
|
163
|
-
if (!ret.some(__assignType((existing) => existing.id === id, [
|
|
164
|
-
"existing",
|
|
165
|
-
"",
|
|
166
|
-
"P\"2!\"/\""
|
|
167
|
-
]))) {
|
|
168
|
-
const name = resolveCommandName(entry.file);
|
|
169
|
-
let segments = resolveCommandPath(this, entry.file).split("/").filter(Boolean);
|
|
170
|
-
segments = segments.map(__assignType((segment, index) => {
|
|
171
|
-
const found = segments.findIndex(__assignType((existing) => existing === segment, [
|
|
172
|
-
"existing",
|
|
173
|
-
"",
|
|
174
|
-
"P\"2!\"/\""
|
|
175
|
-
]));
|
|
176
|
-
if (found !== -1 && found !== index) segment += `_${segments.filter(__assignType((segment) => isDynamicPathSegment(segment) && getDynamicPathSegmentName(segment).replace(/_\d+$/, "") === segment, [
|
|
177
|
-
"segment",
|
|
178
|
-
"",
|
|
179
|
-
"P\"2!\"/\""
|
|
180
|
-
])).length}`;
|
|
181
|
-
return segment;
|
|
182
|
-
}, [
|
|
183
|
-
"segment",
|
|
184
|
-
"index",
|
|
185
|
-
"",
|
|
186
|
-
"P\"2!\"2\"\"/#"
|
|
187
|
-
]));
|
|
188
|
-
ret.push({
|
|
189
|
-
id,
|
|
190
|
-
path: segments.join("/"),
|
|
191
|
-
segments,
|
|
192
|
-
name,
|
|
193
|
-
alias: [],
|
|
194
|
-
tags: [],
|
|
195
|
-
virtual: false,
|
|
196
|
-
entry: {
|
|
197
|
-
...entry,
|
|
198
|
-
input: {
|
|
199
|
-
file: entry.file,
|
|
200
|
-
export: entry.export
|
|
201
|
-
},
|
|
202
|
-
output: name
|
|
203
|
-
}
|
|
204
|
-
});
|
|
205
|
-
}
|
|
206
|
-
return ret;
|
|
207
|
-
}, [
|
|
208
|
-
"ret",
|
|
209
|
-
"entry",
|
|
210
|
-
"",
|
|
211
|
-
"P\"2!\"2\"\"/#"
|
|
212
|
-
]), this.inputs);
|
|
213
|
-
this.debug(`Shell Shock will process ${this.inputs.length} command entry files: \n${this.inputs.map(__assignType((command) => ` - ${command.id}: ${replacePath(command.entry.file, this.commandsPath)}`, [
|
|
214
|
-
"command",
|
|
215
|
-
"",
|
|
216
|
-
"P\"2!\"/\""
|
|
217
|
-
])).join("\n")}`);
|
|
218
|
-
},
|
|
219
|
-
prepare: __assignType(async function prepare() {
|
|
220
|
-
this.debug("Rendering base built-in modules for the Shell Shock application.");
|
|
221
|
-
return render(this, [
|
|
222
|
-
createComponent(StateBuiltin, {}),
|
|
223
|
-
createComponent(UtilsBuiltin, {}),
|
|
224
|
-
createComponent(ExecBuiltin, {})
|
|
225
|
-
]);
|
|
226
|
-
}, ["prepare", "P\"/!"])
|
|
227
|
-
},
|
|
228
|
-
{
|
|
229
|
-
name: "shell-shock/core:virtual-inputs",
|
|
230
|
-
configResolved: {
|
|
231
|
-
order: "post",
|
|
232
|
-
async handler() {
|
|
233
|
-
if (this.inputs.length === 0) this.warn("No commands were found in the project. Please ensure at least one command exists.");
|
|
234
|
-
else {
|
|
235
|
-
this.debug("Finding and adding virtual command inputs for each command previously found.");
|
|
236
|
-
this.inputs = this.inputs.reduce(__assignType((ret, command) => {
|
|
237
|
-
let depth = 0;
|
|
238
|
-
let parentPath = resolveParentPath(findFilePath(command.entry.file));
|
|
239
|
-
if (isParentPath(parentPath, this.commandsPath)) while (parentPath !== this.commandsPath) {
|
|
240
|
-
if (depth++ > MAX_DEPTH) throw new Error(`Unable to process virtual commands for ${command.name} \n\nPlease ensure ${command.entry.file} is a valid command entry file and does not have an invalid path.`);
|
|
241
|
-
if (!ret.some(__assignType((existing) => findFilePath(existing.entry.file) === parentPath, [
|
|
242
|
-
"existing",
|
|
243
|
-
"",
|
|
244
|
-
"P\"2!\"/\""
|
|
245
|
-
]))) {
|
|
246
|
-
const file = joinPaths(parentPath, "command.ts");
|
|
247
|
-
const id = resolveCommandId(this, file);
|
|
248
|
-
if (!ret.some(__assignType((existing) => existing.id === id, [
|
|
249
|
-
"existing",
|
|
250
|
-
"",
|
|
251
|
-
"P\"2!\"/\""
|
|
252
|
-
]))) {
|
|
253
|
-
const name = resolveCommandName(file);
|
|
254
|
-
let segments = resolveCommandPath(this, file).split("/").filter(Boolean);
|
|
255
|
-
segments = segments.map(__assignType((segment, index) => {
|
|
256
|
-
const found = segments.findIndex(__assignType((existing) => existing === segment, [
|
|
257
|
-
"existing",
|
|
258
|
-
"",
|
|
259
|
-
"P\"2!\"/\""
|
|
260
|
-
]));
|
|
261
|
-
if (found !== -1 && found !== index) segment += `_${segments.filter(__assignType((segment) => isDynamicPathSegment(segment) && getDynamicPathSegmentName(segment).replace(/_\d+$/, "") === segment, [
|
|
262
|
-
"segment",
|
|
263
|
-
"",
|
|
264
|
-
"P\"2!\"/\""
|
|
265
|
-
])).length}`;
|
|
266
|
-
return segment;
|
|
267
|
-
}, [
|
|
268
|
-
"segment",
|
|
269
|
-
"index",
|
|
270
|
-
"",
|
|
271
|
-
"P\"2!\"2\"\"/#"
|
|
272
|
-
]));
|
|
273
|
-
ret.push({
|
|
274
|
-
id,
|
|
275
|
-
path: segments.join("/"),
|
|
276
|
-
segments,
|
|
277
|
-
name,
|
|
278
|
-
alias: [],
|
|
279
|
-
tags: [],
|
|
280
|
-
virtual: true,
|
|
281
|
-
entry: { file }
|
|
282
|
-
});
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
parentPath = resolveParentPath(parentPath);
|
|
286
|
-
}
|
|
287
|
-
return ret;
|
|
288
|
-
}, [
|
|
289
|
-
"ret",
|
|
290
|
-
"command",
|
|
291
|
-
"",
|
|
292
|
-
"P\"2!\"2\"\"/#"
|
|
293
|
-
]), this.inputs).sort(__assignType((a, b) => a.segments.length - b.segments.length, [
|
|
294
|
-
"a",
|
|
295
|
-
"b",
|
|
296
|
-
"",
|
|
297
|
-
"P\"2!\"2\"\"/#"
|
|
298
|
-
]));
|
|
299
|
-
this.debug(`Final command input list: \n${this.inputs.map(__assignType((command) => ` - ${command.id}${command.virtual ? " (virtual)" : ""}`, [
|
|
300
|
-
"command",
|
|
301
|
-
"",
|
|
302
|
-
"P\"2!\"/\""
|
|
303
|
-
])).join("\n")}`);
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
},
|
|
308
|
-
{
|
|
309
|
-
name: "shell-shock/core:update-env",
|
|
310
|
-
configResolved: {
|
|
311
|
-
order: "post",
|
|
312
|
-
async handler() {
|
|
313
|
-
this.debug("Adding global options to the CLI application's environment variables.");
|
|
314
|
-
if (!this.env.config) {
|
|
315
|
-
this.debug("Environment variable schema not found in plugin context. Extracting environment variable schema from type definitions provided in plugin options.");
|
|
316
|
-
await extractEnv(this);
|
|
317
|
-
if (!this.env.config) throw new Error("Failed to extract environment variable schema from type definitions provided in plugin options. Please ensure the `env.types` option is correctly specified and points to a valid TypeScript type definition file.");
|
|
318
|
-
}
|
|
319
|
-
if (!isJsonSchemaObject(this.env.config.schema)) throw new Error("Invalid environment variable schema extracted.");
|
|
320
|
-
const env = getProperties(this.env.config);
|
|
321
|
-
this.globalOptions.filter(__assignType((option) => isSetString(option.env) && !env[option.env], [
|
|
322
|
-
"option",
|
|
323
|
-
"",
|
|
324
|
-
"P\"2!\"/\""
|
|
325
|
-
])).forEach(__assignType((option) => {
|
|
326
|
-
addProperty(this.env.config, option.env, {
|
|
327
|
-
...option,
|
|
328
|
-
name: option.env,
|
|
329
|
-
alias: option.alias.filter(__assignType((alias) => alias.length > 1, [
|
|
330
|
-
"alias",
|
|
331
|
-
"",
|
|
332
|
-
"P\"2!\"/\""
|
|
333
|
-
])).map(__assignType((alias) => constantCase(alias), [
|
|
334
|
-
"alias",
|
|
335
|
-
"",
|
|
336
|
-
"P\"2!\"/\""
|
|
337
|
-
]))
|
|
338
|
-
});
|
|
339
|
-
}, [
|
|
340
|
-
"option",
|
|
341
|
-
"",
|
|
342
|
-
"P\"2!\"/\""
|
|
343
|
-
]));
|
|
344
|
-
await writeEnv(this);
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
},
|
|
348
|
-
{
|
|
349
|
-
name: "shell-shock/core:resolve-commands",
|
|
350
|
-
prepare: {
|
|
351
|
-
order: "post",
|
|
352
|
-
async handler() {
|
|
353
|
-
this.debug("Initializing the CLI application's command tree.");
|
|
354
|
-
this.commands = {};
|
|
355
|
-
if (this.config.command !== "prepare" && this.config.skipCache !== true && this.persistedMeta?.checksum === this.meta.checksum && this.fs.existsSync(getCacheFilePath(this, this.env.config))) {
|
|
356
|
-
this.debug(`Skipping command resolution as the meta checksum has not changed.`);
|
|
357
|
-
await extractEnv(this);
|
|
358
|
-
await readCommandsPersistence(this);
|
|
359
|
-
} else {
|
|
360
|
-
for (const input of this.inputs.filter(__assignType((input) => input.segments.filter(__assignType((segment) => !isDynamicPathSegment(segment) && !isPathSegmentGroup(segment), [
|
|
361
|
-
"segment",
|
|
362
|
-
"",
|
|
363
|
-
"P\"2!\"/\""
|
|
364
|
-
])).length === 1, [
|
|
365
|
-
"input",
|
|
366
|
-
"",
|
|
367
|
-
"P\"2!\"/\""
|
|
368
|
-
]))) this.commands[input.name] = await resolve({
|
|
369
|
-
context: this,
|
|
370
|
-
command: input
|
|
371
|
-
});
|
|
372
|
-
this.debug("Post-processing commands to ensure proper reflection.");
|
|
373
|
-
await traverseCommands(this, __assignType((command) => {
|
|
374
|
-
command.options = Object.fromEntries(Object.entries(command.options).map(__assignType(([name, option]) => [camelCase(name), {
|
|
375
|
-
...option,
|
|
376
|
-
name: camelCase(name),
|
|
377
|
-
alias: option.alias ?? [],
|
|
378
|
-
required: option.required ?? true
|
|
379
|
-
}], [
|
|
380
|
-
"param0",
|
|
381
|
-
"",
|
|
382
|
-
"P\"2!\"/\""
|
|
383
|
-
])));
|
|
384
|
-
}, [
|
|
385
|
-
"command",
|
|
386
|
-
"",
|
|
387
|
-
"P\"2!\"/\""
|
|
388
|
-
]));
|
|
389
|
-
await writeCommandsPersistence(this);
|
|
390
|
-
}
|
|
391
|
-
this.debug("Validating the CLI applications command tree.");
|
|
392
|
-
let isValid = true;
|
|
393
|
-
await traverseCommands(this, __assignType((command) => {
|
|
394
|
-
const failures = validateCommand(command);
|
|
395
|
-
if (failures.length > 0) {
|
|
396
|
-
this.error(`Found ${failures.length} issue${failures.length > 1 ? "s" : ""} with the ${command.title} command: \n${failures.map(__assignType((failure) => ` - ${failure.code}: ${failure.details}`, [
|
|
397
|
-
"failure",
|
|
398
|
-
"",
|
|
399
|
-
"P\"2!\"/\""
|
|
400
|
-
])).join("\n")}\n`);
|
|
401
|
-
isValid = false;
|
|
402
|
-
}
|
|
403
|
-
}, [
|
|
404
|
-
"command",
|
|
405
|
-
"",
|
|
406
|
-
"P\"2!\"/\""
|
|
407
|
-
]));
|
|
408
|
-
if (!isValid) throw new Error(`One or more commands in the command tree are invalid. Please review the errors above and correct them before proceeding.`);
|
|
409
|
-
this.info(`\nCreating an application with the following command tree: \n${formatCommandTree(this)}\n`);
|
|
410
|
-
}
|
|
411
|
-
}
|
|
412
|
-
},
|
|
413
|
-
{
|
|
414
|
-
name: "shell-shock/core:chmod+x",
|
|
415
|
-
configResolved() {
|
|
416
|
-
this.config.tsdown.hooks ??= {};
|
|
417
|
-
this.config.tsdown.hooks["build:done"] = __assignType(async (_) => {
|
|
418
|
-
await Promise.all(Object.values(this.config.bin).map(__assignType(async (bin) => {
|
|
419
|
-
const path = appendPath(bin, joinPaths(this.config.cwd, this.config.root));
|
|
420
|
-
if (this.fs.existsSync(path)) {
|
|
421
|
-
this.debug(`Adding hashbang to binary executable output file: ${path}`);
|
|
422
|
-
const content = await this.fs.read(path);
|
|
423
|
-
if (content && !content.startsWith("#!")) await this.fs.write(path, `#!/usr/bin/env ${this.config.mode === "development" ? "-S NODE_OPTIONS=--enable-source-maps" : ""} node\n\n${content}`);
|
|
424
|
-
this.debug(`Adding executable permissions (chmod+x) to binary executable output file: ${path}`);
|
|
425
|
-
await chmodX(path);
|
|
426
|
-
} else this.warn(`Expected binary output file not found at path: ${path}. Skipping adding hashbang and executable permissions (chmod+x).`);
|
|
427
|
-
}, [
|
|
428
|
-
"bin",
|
|
429
|
-
"",
|
|
430
|
-
"P\"2!\"/\""
|
|
431
|
-
])));
|
|
432
|
-
}, [
|
|
433
|
-
"chunks",
|
|
434
|
-
"_",
|
|
435
|
-
"",
|
|
436
|
-
"PP!P!F4!MK2\"\"/#"
|
|
437
|
-
]);
|
|
438
|
-
}
|
|
439
|
-
},
|
|
440
|
-
{
|
|
441
|
-
name: "shell-shock/core:docs",
|
|
442
|
-
configResolved: __assignType(function configResolved() {
|
|
443
|
-
this.config.automd ??= {};
|
|
444
|
-
this.config.automd.generators = {
|
|
445
|
-
...this.config.automd.generators ?? {},
|
|
446
|
-
commands: commands(this),
|
|
447
|
-
usage: usage(this),
|
|
448
|
-
options: options(this),
|
|
449
|
-
args: args(this)
|
|
450
|
-
};
|
|
451
|
-
}, ["configResolved", "P\"/!"]),
|
|
452
|
-
async docs() {
|
|
453
|
-
this.debug("Rendering CLI command reference documentation and writing to the output directory.");
|
|
454
|
-
const commands = this.inputs.map(__assignType((input) => getCommandTree(this, input.segments), [
|
|
455
|
-
"input",
|
|
456
|
-
"",
|
|
457
|
-
"P\"2!\"/\""
|
|
458
|
-
])).filter(Boolean);
|
|
459
|
-
return render(this, createComponent(For, {
|
|
460
|
-
get each() {
|
|
461
|
-
return Object.values(commands);
|
|
462
|
-
},
|
|
463
|
-
doubleHardline: true,
|
|
464
|
-
get children() {
|
|
465
|
-
return __assignType((child) => createComponent(Show, {
|
|
466
|
-
get when() {
|
|
467
|
-
return !child.virtual;
|
|
468
|
-
},
|
|
469
|
-
get children() {
|
|
470
|
-
return createComponent(CommandDocsFile, { command: child });
|
|
471
|
-
}
|
|
472
|
-
}), [
|
|
473
|
-
"child",
|
|
474
|
-
"",
|
|
475
|
-
"P\"2!\"/\""
|
|
476
|
-
]);
|
|
477
|
-
}
|
|
478
|
-
}));
|
|
479
|
-
}
|
|
480
|
-
}
|
|
481
|
-
];
|
|
482
|
-
}, [
|
|
483
|
-
"Options",
|
|
484
|
-
"options",
|
|
485
|
-
() => ({}),
|
|
486
|
-
"",
|
|
487
|
-
"P\"w!2\">#!F/$"
|
|
488
|
-
]);
|
|
489
|
-
|
|
490
|
-
//#endregion
|
|
491
|
-
export { plugin as default, plugin };
|
|
492
|
-
//# sourceMappingURL=plugin.mjs.map
|
|
3
|
+
export { plugin as default, plugin };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { usePowerlines, usePowerlinesSafe } from "@powerlines/plugin-alloy/core/contexts/context";
|
|
2
|
+
import { BuiltinFile, BuiltinFileProps } from "@powerlines/plugin-alloy/typescript/components/builtin-file";
|
|
3
|
+
import { EntryFile, EntryFileProps } from "@powerlines/plugin-alloy/typescript/components/entry-file";
|
|
4
|
+
export { usePowerlines as a, EntryFileProps as i, BuiltinFileProps as n, usePowerlinesSafe as o, EntryFile as r, BuiltinFile as t };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { usePowerlines, usePowerlinesSafe } from "@powerlines/plugin-alloy/core/contexts/context";
|
|
2
|
+
import { BuiltinFile, BuiltinFileProps } from "@powerlines/plugin-alloy/typescript/components/builtin-file";
|
|
3
|
+
import { EntryFile, EntryFileProps } from "@powerlines/plugin-alloy/typescript/components/entry-file";
|
|
4
|
+
export { usePowerlines as a, EntryFileProps as i, BuiltinFileProps as n, usePowerlinesSafe as o, EntryFile as r, BuiltinFile as t };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
//#region src/plugin-utils/reflect.ts
|
|
2
|
+
/**
|
|
3
|
+
* Sort command options alphabetically by name, placing boolean options with negatives appropriately.
|
|
4
|
+
*
|
|
5
|
+
* @param options - The array of command options to sort.
|
|
6
|
+
* @param skipNegatives - Whether to skip negative options when sorting (default: true).
|
|
7
|
+
* @returns A new array of sorted command options.
|
|
8
|
+
*/
|
|
9
|
+
function sortOptions(options, skipNegatives = true) {
|
|
10
|
+
if (!options || options.length === 0) return [];
|
|
11
|
+
return options.filter((arg) => arg.type !== "boolean" || arg.variadic || !skipNegatives || !arg.isNegativeOf).sort((a, b) => a.name.localeCompare(b.name)).reduce((ret, arg) => {
|
|
12
|
+
ret.push(arg);
|
|
13
|
+
if (arg.type === "boolean") {
|
|
14
|
+
const negativeArg = options.find((a) => a.type === "boolean" && !a.variadic && a.isNegativeOf === arg.name);
|
|
15
|
+
if (negativeArg) ret.push(negativeArg);
|
|
16
|
+
}
|
|
17
|
+
return ret;
|
|
18
|
+
}, []);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
//#endregion
|
|
22
|
+
Object.defineProperty(exports, 'sortOptions', {
|
|
23
|
+
enumerable: true,
|
|
24
|
+
get: function () {
|
|
25
|
+
return sortOptions;
|
|
26
|
+
}
|
|
27
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
//#region src/plugin-utils/reflect.ts
|
|
2
|
+
/**
|
|
3
|
+
* Sort command options alphabetically by name, placing boolean options with negatives appropriately.
|
|
4
|
+
*
|
|
5
|
+
* @param options - The array of command options to sort.
|
|
6
|
+
* @param skipNegatives - Whether to skip negative options when sorting (default: true).
|
|
7
|
+
* @returns A new array of sorted command options.
|
|
8
|
+
*/
|
|
9
|
+
function sortOptions(options, skipNegatives = true) {
|
|
10
|
+
if (!options || options.length === 0) return [];
|
|
11
|
+
return options.filter((arg) => arg.type !== "boolean" || arg.variadic || !skipNegatives || !arg.isNegativeOf).sort((a, b) => a.name.localeCompare(b.name)).reduce((ret, arg) => {
|
|
12
|
+
ret.push(arg);
|
|
13
|
+
if (arg.type === "boolean") {
|
|
14
|
+
const negativeArg = options.find((a) => a.type === "boolean" && !a.variadic && a.isNegativeOf === arg.name);
|
|
15
|
+
if (negativeArg) ret.push(negativeArg);
|
|
16
|
+
}
|
|
17
|
+
return ret;
|
|
18
|
+
}, []);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
//#endregion
|
|
22
|
+
export { sortOptions as t };
|
|
23
|
+
//# sourceMappingURL=reflect-DXKSFgvS.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reflect-DXKSFgvS.mjs","names":[],"sources":[],"mappings":""}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
let zod = require("zod");
|
|
3
|
+
let _powerlines_plugin_env_schemas_env = require("@powerlines/plugin-env/schemas/env");
|
|
4
|
+
|
|
5
|
+
//#region src/schemas/env.ts
|
|
6
|
+
/**
|
|
7
|
+
* Zod schema for the Shell Shock environment configuration.
|
|
8
|
+
*
|
|
9
|
+
* @remarks
|
|
10
|
+
* Extends the base Powerlines {@link envSchema} with CLI-specific runtime
|
|
11
|
+
* environment variables used for executable resolution and npm script detection.
|
|
12
|
+
*/
|
|
13
|
+
const envSchema = _powerlines_plugin_env_schemas_env.envSchema.extend({
|
|
14
|
+
/**
|
|
15
|
+
* The system PATHEXT variable, used to determine which file extensions are considered executable on Windows.
|
|
16
|
+
*
|
|
17
|
+
* @remarks
|
|
18
|
+
* If not provided, it will default to '.EXE;.CMD;.BAT;.COM' on Windows, and will be ignored on other platforms. This variable is used to locate executable files when running commands, and is only relevant on Windows platforms. On non-Windows platforms, the system's executable file resolution will be used, and this variable will have no effect.
|
|
19
|
+
*/
|
|
20
|
+
PATHEXT: zod.z.string().optional().meta({
|
|
21
|
+
description: "The system PATHEXT variable, used to determine which file extensions are considered executable on Windows. If not provided, it will default to '.EXE;.CMD;.BAT;.COM' on Windows, and will be ignored on other platforms.",
|
|
22
|
+
runtime: true,
|
|
23
|
+
hidden: true,
|
|
24
|
+
category: "node"
|
|
25
|
+
}),
|
|
26
|
+
/**
|
|
27
|
+
* The system PATH variable, used to locate executable files.
|
|
28
|
+
*/
|
|
29
|
+
PATH: zod.z.string().optional().meta({
|
|
30
|
+
description: "The system PATH variable, used to locate executable files.",
|
|
31
|
+
runtime: true,
|
|
32
|
+
hidden: true,
|
|
33
|
+
category: "node"
|
|
34
|
+
}),
|
|
35
|
+
/**
|
|
36
|
+
* The npm user agent string, which can be used to detect if the environment is running within an npm script.
|
|
37
|
+
*
|
|
38
|
+
* @remarks
|
|
39
|
+
* This variable is set by npm when running scripts defined in package.json. It can be used to conditionally adjust behavior when running within an npm script context, such as modifying logging output or adjusting command execution. If this variable is not set, it can be assumed that the environment is not running within an npm script.
|
|
40
|
+
*/
|
|
41
|
+
npm_config_user_agent: zod.z.string().optional().meta({
|
|
42
|
+
description: "The npm user agent string, which can be used to detect if the environment is running within an npm script. This variable is set by npm when running scripts defined in package.json.",
|
|
43
|
+
runtime: true,
|
|
44
|
+
hidden: true,
|
|
45
|
+
category: "node"
|
|
46
|
+
}),
|
|
47
|
+
/**
|
|
48
|
+
* The npm_config_fund environment variable, which can be used to control npm's funding behavior.
|
|
49
|
+
*
|
|
50
|
+
* @remarks
|
|
51
|
+
* This variable is set by npm when running scripts defined in package.json, and can be used to control npm's funding behavior. If set to 'false', it will disable npm's funding messages. If not set, npm will use its default funding behavior. This variable is only relevant when running within an npm script context, and has no effect on command execution or behavior outside of that context.
|
|
52
|
+
*/
|
|
53
|
+
npm_config_fund: zod.z.string().optional().meta({
|
|
54
|
+
description: "The npm_config_fund environment variable, which can be used to control npm's funding behavior. If set to 'false', it will disable npm's funding messages.",
|
|
55
|
+
runtime: true,
|
|
56
|
+
hidden: true,
|
|
57
|
+
category: "node"
|
|
58
|
+
}),
|
|
59
|
+
/**
|
|
60
|
+
* The npm execution path, which can be used to determine the location of the npm executable.
|
|
61
|
+
*
|
|
62
|
+
* @remarks
|
|
63
|
+
* This variable is set by npm when running scripts defined in package.json. It provides the absolute path to the npm executable being used to run the script. This can be useful for resolving the location of npm or for debugging purposes. If this variable is not set, it may indicate that the environment is not running within an npm script context, or that npm is not available in the PATH.
|
|
64
|
+
*/
|
|
65
|
+
npm_execpath: zod.z.string().optional().meta({
|
|
66
|
+
description: "The npm execution path, which can be used to determine the location of the npm executable. This variable is set by npm when running scripts defined in package.json.",
|
|
67
|
+
runtime: true,
|
|
68
|
+
hidden: true,
|
|
69
|
+
category: "node"
|
|
70
|
+
}),
|
|
71
|
+
/**
|
|
72
|
+
* The COMSPEC environment variable, which specifies the command-line interpreter to use on Windows.
|
|
73
|
+
*
|
|
74
|
+
* @remarks
|
|
75
|
+
* This variable is used on Windows platforms to determine which command-line interpreter to use when executing commands. It typically points to cmd.exe, but can be customized by the user. If this variable is not set on Windows, it will default to 'cmd.exe'. On non-Windows platforms, this variable is ignored and has no effect on command execution.
|
|
76
|
+
*/
|
|
77
|
+
COMSPEC: zod.z.string().optional().meta({
|
|
78
|
+
description: "The COMSPEC environment variable, which specifies the command-line interpreter to use on Windows. It typically points to cmd.exe, but can be customized by the user.",
|
|
79
|
+
runtime: true,
|
|
80
|
+
hidden: true,
|
|
81
|
+
category: "node"
|
|
82
|
+
})
|
|
83
|
+
});
|
|
84
|
+
/**
|
|
85
|
+
* Inferred Shell Shock environment configuration type from {@link ShellShockEnv}.
|
|
86
|
+
*/
|
|
87
|
+
/**
|
|
88
|
+
* Input type for {@link ShellShockEnv} before defaults applied.
|
|
89
|
+
*/
|
|
90
|
+
//#endregion
|
|
91
|
+
exports.envSchema = envSchema;
|