@sorrell/cli-utilities 1.0.50 → 1.0.52
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/Distribution/Bin/Bin.d.ts +9 -0
- package/Distribution/Bin/Bin.d.ts.map +1 -0
- package/Distribution/Bin/Bin.js +12 -0
- package/Distribution/Bin/Bin.js.map +1 -0
- package/Distribution/Bin/Version.d.ts +8 -0
- package/Distribution/Bin/Version.d.ts.map +1 -0
- package/Distribution/Bin/Version.js +8 -0
- package/Distribution/Bin/Version.js.map +1 -0
- package/Distribution/Bin/WriteVersionCommand.d.ts +16 -0
- package/Distribution/Bin/WriteVersionCommand.d.ts.map +1 -0
- package/Distribution/Bin/WriteVersionCommand.js +51 -0
- package/Distribution/Bin/WriteVersionCommand.js.map +1 -0
- package/Distribution/Command/Command.Barrel.d.ts +9 -0
- package/Distribution/Command/Command.Barrel.d.ts.map +1 -0
- package/Distribution/Command/Command.Barrel.js +9 -0
- package/Distribution/Command/Command.Barrel.js.map +1 -0
- package/Distribution/Command/Command.Types.d.ts +12 -1
- package/Distribution/Command/Command.Types.d.ts.map +1 -1
- package/Distribution/Command/Command.Types.js +1 -0
- package/Distribution/Command/Command.Types.js.map +1 -1
- package/Distribution/Command/Command.d.ts +14 -5
- package/Distribution/Command/Command.d.ts.map +1 -1
- package/Distribution/Command/Command.js +19 -8
- package/Distribution/Command/Command.js.map +1 -1
- package/Distribution/Command/index.d.ts +1 -1
- package/Distribution/Command/index.d.ts.map +1 -1
- package/Distribution/Command/index.js +1 -1
- package/Distribution/Command/index.js.map +1 -1
- package/Distribution/PackageConfig/index.d.ts +1 -1
- package/Distribution/PackageConfig/index.d.ts.map +1 -1
- package/Distribution/PackageConfig/index.js +1 -1
- package/Distribution/PackageConfig/index.js.map +1 -1
- package/package.json +4 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Bin.d.ts","sourceRoot":"","sources":["../../Source/Bin/Bin.ts"],"names":[],"mappings":";AAEA;;;;;GAKG"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* @file Bin.ts
|
|
4
|
+
* @author Gage Sorrell <gage@sorrell.sh>
|
|
5
|
+
* @copyright (c) 2026 Gage Sorrell
|
|
6
|
+
* @license MIT
|
|
7
|
+
*/
|
|
8
|
+
import { RunCli } from "../Command/Command.js";
|
|
9
|
+
import { Version } from "./Version.js";
|
|
10
|
+
import { WriteVersionCommand } from "./WriteVersionCommand.js";
|
|
11
|
+
RunCli("@sorrell/cli-utilities", Version, [WriteVersionCommand]);
|
|
12
|
+
//# sourceMappingURL=Bin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Bin.js","sourceRoot":"","sources":["../../Source/Bin/Bin.ts"],"names":[],"mappings":";AAEA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE/D,MAAM,CAAC,wBAAwB,EAAE,OAAO,EAAE,CAAE,mBAAmB,CAAE,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Version.d.ts","sourceRoot":"","sources":["../../Source/Bin/Version.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,EAAE,MAAe,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Version.js","sourceRoot":"","sources":["../../Source/Bin/Version.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAW,MAAM,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file WriteVersionCommand.ts
|
|
3
|
+
* @author Gage Sorrell <gage@sorrell.sh>
|
|
4
|
+
* @copyright (c) 2026 Gage Sorrell
|
|
5
|
+
* @license MIT
|
|
6
|
+
*/
|
|
7
|
+
import { Command } from "@effect/cli";
|
|
8
|
+
import { Path as EffectPath, FileSystem } from "@effect/platform";
|
|
9
|
+
import type { PackageJsonParseError, RootDirectoryNotFoundError } from "@sorrell/utilities/npm";
|
|
10
|
+
import type { PlatformError } from "@effect/platform/Error";
|
|
11
|
+
type WriteVersionCommand = Command.Command<"write-version", EffectPath.Path | FileSystem.FileSystem, PackageJsonParseError | RootDirectoryNotFoundError | PlatformError, {
|
|
12
|
+
readonly Out: string;
|
|
13
|
+
}>;
|
|
14
|
+
export declare const WriteVersionCommand: WriteVersionCommand;
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=WriteVersionCommand.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WriteVersionCommand.d.ts","sourceRoot":"","sources":["../../Source/Bin/WriteVersionCommand.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAQ,OAAO,EAAE,MAAM,aAAa,CAAC;AAE5C,OAAO,EAAE,IAAI,IAAI,UAAU,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,KAAK,EAAE,qBAAqB,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AAKhG,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAkF5D,KAAK,mBAAmB,GACpB,OAAO,CAAC,OAAO,CACX,eAAe,EACb,UAAU,CAAC,IAAI,GACf,UAAU,CAAC,UAAU,EACrB,qBAAqB,GACrB,0BAA0B,GAC1B,aAAa,EACf;IAAE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;CAAE,CAC5B,CAAC;AAEN,eAIA,MAAM,mBAAmB,EAAE,mBAC8C,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file WriteVersionCommand.ts
|
|
3
|
+
* @author Gage Sorrell <gage@sorrell.sh>
|
|
4
|
+
* @copyright (c) 2026 Gage Sorrell
|
|
5
|
+
* @license MIT
|
|
6
|
+
*/
|
|
7
|
+
import { Args, Command } from "@effect/cli";
|
|
8
|
+
import { Console, Effect, pipe } from "effect";
|
|
9
|
+
import { Path as EffectPath, FileSystem } from "@effect/platform";
|
|
10
|
+
import Chalk from "chalk";
|
|
11
|
+
import { Code } from "../Format/Format.js";
|
|
12
|
+
import { GetPackageJson } from "@sorrell/utilities/npm/effect";
|
|
13
|
+
const DefaultModuleName = "Version.ts";
|
|
14
|
+
const WriteVersionConfig = {
|
|
15
|
+
Out: pipe(Args.file({ exists: "either", name: "out" }), Args.withDefault(`./${DefaultModuleName}`), Args.withDescription(`The path to where the exported version ${Code("string")} will be written.`))
|
|
16
|
+
};
|
|
17
|
+
/* eslint-disable-next-line jsdoc/require-jsdoc */
|
|
18
|
+
function HandleWriteVersion({ Out }) {
|
|
19
|
+
return Effect.gen(function* () {
|
|
20
|
+
const Fs = yield* FileSystem.FileSystem;
|
|
21
|
+
const Path = yield* EffectPath.Path;
|
|
22
|
+
const HasTsExtension = [".ts", ".mts", ".cts"].some((Extension) => Out.endsWith(Extension));
|
|
23
|
+
const NormalizedOutPath = yield* Effect.gen(function* () {
|
|
24
|
+
const OutAbsolute = Path.resolve(process.cwd(), Out);
|
|
25
|
+
return HasTsExtension
|
|
26
|
+
? OutAbsolute
|
|
27
|
+
: Path.resolve(OutAbsolute, DefaultModuleName);
|
|
28
|
+
});
|
|
29
|
+
const DirectoryExists = yield* Fs.exists(Path.dirname(NormalizedOutPath));
|
|
30
|
+
if (!DirectoryExists) {
|
|
31
|
+
yield* Fs.makeDirectory(Path.dirname(NormalizedOutPath), { recursive: true });
|
|
32
|
+
}
|
|
33
|
+
const PackageJson = yield* GetPackageJson();
|
|
34
|
+
if (!("version" in PackageJson) || PackageJson.version === undefined) {
|
|
35
|
+
return yield* Effect.dieMessage(`Your ${Code("package.json")} does not have a ${Code("\"version\"")} property.`);
|
|
36
|
+
}
|
|
37
|
+
const PackageVersion = PackageJson.version;
|
|
38
|
+
const ModuleContents = `/* eslint-disable */
|
|
39
|
+
|
|
40
|
+
export const Version: string = "v${PackageVersion}";
|
|
41
|
+
`;
|
|
42
|
+
yield* Fs.writeFileString(NormalizedOutPath, ModuleContents);
|
|
43
|
+
Console.log(`${Chalk.green("✔")} Successfully wrote version v${PackageVersion} ` +
|
|
44
|
+
`to ${Path.basename(NormalizedOutPath)}.`);
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
export /**
|
|
48
|
+
* Write a module at a given path that exports a `const Version: string` that
|
|
49
|
+
* is the `"version"` property of the package's `package.json`.
|
|
50
|
+
*/ const WriteVersionCommand = Command.make("write-version", WriteVersionConfig, HandleWriteVersion);
|
|
51
|
+
//# sourceMappingURL=WriteVersionCommand.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WriteVersionCommand.js","sourceRoot":"","sources":["../../Source/Bin/WriteVersionCommand.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Command.Barrel.d.ts","sourceRoot":"","sources":["../../Source/Command/Command.Barrel.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Command.Barrel.js","sourceRoot":"","sources":["../../Source/Command/Command.Barrel.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC"}
|
|
@@ -4,5 +4,16 @@
|
|
|
4
4
|
* @copyright (c) 2026 Gage Sorrell
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
|
-
|
|
7
|
+
import type { Command } from "@effect/cli";
|
|
8
|
+
import type { Option } from "effect/Option";
|
|
9
|
+
/** The type representing any {@link Command!Command | command}. */
|
|
10
|
+
export type Any = Command.Command<any, any, any, any>;
|
|
11
|
+
/**
|
|
12
|
+
* The type of the command returned by {@link GetMain}.
|
|
13
|
+
*
|
|
14
|
+
* @template NameType - The type of the name of the command having this type.
|
|
15
|
+
*/
|
|
16
|
+
export type MainCommand<NameType extends string = string> = Command.Command<NameType, any, any, Readonly<{
|
|
17
|
+
subcommand: Option<any>;
|
|
18
|
+
}>>;
|
|
8
19
|
//# sourceMappingURL=Command.Types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Command.Types.d.ts","sourceRoot":"","sources":["../../Source/Command/Command.Types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,MAAM
|
|
1
|
+
{"version":3,"file":"Command.Types.d.ts","sourceRoot":"","sources":["../../Source/Command/Command.Types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAG3C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAI5C,mEAAmE;AACnE,MAAM,MAAM,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;AAEtD;;;;GAIG;AACH,MAAM,MAAM,WAAW,CAAC,QAAQ,SAAS,MAAM,GAAG,MAAM,IACpD,OAAO,CAAC,OAAO,CACX,QAAQ,EACR,GAAG,EACH,GAAG,EACH,QAAQ,CAAC;IAAE,UAAU,EAAE,MAAM,CAAC,GAAG,CAAC,CAAA;CAAE,CAAC,CACxC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Command.Types.js","sourceRoot":"","sources":["../../Source/Command/Command.Types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
|
|
1
|
+
{"version":3,"file":"Command.Types.js","sourceRoot":"","sources":["../../Source/Command/Command.Types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAyBH,sDAAsD"}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* @copyright (c) 2026 Gage Sorrell
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
|
-
import {
|
|
7
|
+
import type { Any, MainCommand } from "./Command.Types.js";
|
|
8
8
|
import type { NonEmptyArray } from "effect/Array";
|
|
9
9
|
/**
|
|
10
10
|
* For a given command, get the name of that command, such that it will
|
|
@@ -38,12 +38,21 @@ export declare function GetCommandName(PlainName: string): string;
|
|
|
38
38
|
* @param Name - The name of the main command. This should be the name of the `"bin"` entry
|
|
39
39
|
* in your `package.json`.
|
|
40
40
|
*
|
|
41
|
+
* @param SubCommands - The subcommands of the {@link Command.Command | command} that this returns.
|
|
42
|
+
*
|
|
43
|
+
* @returns {MainCommand<typeof Name>} The "empty" command of the given {@link Name}, and
|
|
44
|
+
* given {@link SubCommands}.
|
|
45
|
+
*/
|
|
46
|
+
export declare function GetMain(Name: string, SubCommands: NonEmptyArray<Any>): MainCommand<typeof Name>;
|
|
47
|
+
/**
|
|
48
|
+
* Run your CLI tool, given its name, version, and its commands.
|
|
49
|
+
*
|
|
50
|
+
* @param Name - The name of the main command. This should be the name of the `"bin"` entry
|
|
51
|
+
* in your `package.json`.
|
|
52
|
+
*
|
|
41
53
|
* @param Version - The semver of your CLI tool.
|
|
42
54
|
*
|
|
43
55
|
* @param SubCommands - The commands of your application.
|
|
44
|
-
*
|
|
45
|
-
* @returns {Command.Command<typeof Name, never, never, object>} The "empty" command to have
|
|
46
|
-
* your packages commands piped to it (as subcommands).
|
|
47
56
|
*/
|
|
48
|
-
export declare function
|
|
57
|
+
export declare function RunCli(Name: string, Version: string, SubCommands: NonEmptyArray<Any>): void;
|
|
49
58
|
//# sourceMappingURL=Command.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Command.d.ts","sourceRoot":"","sources":["../../Source/Command/Command.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"Command.d.ts","sourceRoot":"","sources":["../../Source/Command/Command.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAI3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAElD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAKxD;AAID;;;;;;;;;;GAUG;AACH,wBAAgB,OAAO,CACnB,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,aAAa,CAAC,GAAG,CAAC,GAChC,WAAW,CAAC,OAAO,IAAI,CAAC,CAO1B;AAED;;;;;;;;;GASG;AACH,wBAAgB,MAAM,CAClB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,aAAa,CAAC,GAAG,CAAC,GAChC,IAAI,CAmBN"}
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
* @copyright (c) 2026 Gage Sorrell
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
|
+
import { NodeContext, NodeRuntime } from "@effect/platform-node";
|
|
7
8
|
import { Command } from "@effect/cli";
|
|
8
9
|
import { Effect } from "effect";
|
|
9
|
-
import { NodeContext, NodeRuntime } from "@effect/platform-node";
|
|
10
10
|
/**
|
|
11
11
|
* For a given command, get the name of that command, such that it will
|
|
12
12
|
* work, even if the command will be run inside of a Windows shell terminal.
|
|
@@ -44,23 +44,34 @@ export function GetCommandName(PlainName) {
|
|
|
44
44
|
* @param Name - The name of the main command. This should be the name of the `"bin"` entry
|
|
45
45
|
* in your `package.json`.
|
|
46
46
|
*
|
|
47
|
+
* @param SubCommands - The subcommands of the {@link Command.Command | command} that this returns.
|
|
48
|
+
*
|
|
49
|
+
* @returns {MainCommand<typeof Name>} The "empty" command of the given {@link Name}, and
|
|
50
|
+
* given {@link SubCommands}.
|
|
51
|
+
*/
|
|
52
|
+
export function GetMain(Name, SubCommands) {
|
|
53
|
+
/* eslint-disable-next-line @typescript-eslint/no-empty-object-type */
|
|
54
|
+
const MainCommand = Command.make(Name, {}, (_) => Effect.succeed(undefined));
|
|
55
|
+
return MainCommand.pipe(Command.withSubcommands(SubCommands));
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Run your CLI tool, given its name, version, and its commands.
|
|
59
|
+
*
|
|
60
|
+
* @param Name - The name of the main command. This should be the name of the `"bin"` entry
|
|
61
|
+
* in your `package.json`.
|
|
62
|
+
*
|
|
47
63
|
* @param Version - The semver of your CLI tool.
|
|
48
64
|
*
|
|
49
65
|
* @param SubCommands - The commands of your application.
|
|
50
|
-
*
|
|
51
|
-
* @returns {Command.Command<typeof Name, never, never, object>} The "empty" command to have
|
|
52
|
-
* your packages commands piped to it (as subcommands).
|
|
53
66
|
*/
|
|
54
|
-
export function
|
|
67
|
+
export function RunCli(Name, Version, SubCommands) {
|
|
55
68
|
/* eslint-disable-next-line @typescript-eslint/no-empty-object-type */
|
|
56
69
|
const MainCommand = Command.make(Name, {}, (_) => Effect.succeed(undefined));
|
|
57
70
|
const CliRunnable = Command.run(MainCommand.pipe(Command.withSubcommands(SubCommands)), {
|
|
58
71
|
name: "code-auger",
|
|
59
72
|
version: Version
|
|
60
73
|
});
|
|
61
|
-
|
|
62
|
-
CliRunnable(process.argv).pipe(Effect.provide(NodeContext.layer), NodeRuntime.runMain);
|
|
63
|
-
};
|
|
74
|
+
CliRunnable(process.argv).pipe(Effect.provide(NodeContext.layer), NodeRuntime.runMain);
|
|
64
75
|
}
|
|
65
76
|
/* eslint-enable jsdoc/require-example */
|
|
66
77
|
//# sourceMappingURL=Command.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Command.js","sourceRoot":"","sources":["../../Source/Command/Command.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"Command.js","sourceRoot":"","sources":["../../Source/Command/Command.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGhC;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,UAAU,cAAc,CAAC,SAAiB;IAE5C,OAAO,OAAO,CAAC,QAAQ,KAAK,OAAO;QAC/B,CAAC,CAAC,GAAI,SAAU,MAAM;QACtB,CAAC,CAAC,SAAS,CAAC;AACpB,CAAC;AAED,8EAA8E;AAE9E;;;;;;;;;;GAUG;AACH,MAAM,UAAU,OAAO,CACnB,IAAY,EACZ,WAA+B;IAG/B,sEAAsE;IACtE,MAAM,WAAW,GACb,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,EAAG,EAAE,CAAC,CAAS,EAAiC,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC;IAErG,OAAO,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC,CAAC;AAClE,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,MAAM,CAClB,IAAY,EACZ,OAAe,EACf,WAA+B;IAG/B,sEAAsE;IACtE,MAAM,WAAW,GACb,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,EAAG,EAAE,CAAC,CAAS,EAAiC,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC;IAErG,MAAM,WAAW,GACb,OAAO,CAAC,GAAG,CACP,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC,EACtD;QACI,IAAI,EAAE,YAAY;QAClB,OAAO,EAAE,OAAO;KACnB,CACJ,CAAC;IAEN,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,IAAI,CAC1B,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,KAAK,CAAQ,EACxC,WAAW,CAAC,OAAO,CACtB,CAAC;AACN,CAAC;AAED,yCAAyC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../Source/Command/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../Source/Command/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,OAAO,MAAM,qBAAqB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../Source/Command/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../Source/Command/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,OAAO,MAAM,qBAAqB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../Source/PackageConfig/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../Source/PackageConfig/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,cAAc,oBAAoB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../Source/PackageConfig/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../Source/PackageConfig/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,cAAc,oBAAoB,CAAC"}
|
package/package.json
CHANGED