@gunshi/bone 1.0.0-beta.1 → 1.0.0-rc.1
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/lib/index.d.ts +2 -2
- package/lib/index.js +45 -35
- package/package.json +5 -5
package/lib/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//#region ../../node_modules/.pnpm/args-tokens@1.0.0
|
|
1
|
+
//#region ../../node_modules/.pnpm/args-tokens@1.0.0/node_modules/args-tokens/lib/parser-DhESN1gR.d.ts
|
|
2
2
|
//#region src/parser.d.ts
|
|
3
3
|
/**
|
|
4
4
|
* Entry point of argument parser.
|
|
@@ -56,7 +56,7 @@ interface ArgToken {
|
|
|
56
56
|
inlineValue?: boolean | undefined;
|
|
57
57
|
}
|
|
58
58
|
//#endregion
|
|
59
|
-
//#region ../../node_modules/.pnpm/args-tokens@1.0.0
|
|
59
|
+
//#region ../../node_modules/.pnpm/args-tokens@1.0.0/node_modules/args-tokens/lib/resolver.d.ts
|
|
60
60
|
//#region src/resolver.d.ts
|
|
61
61
|
/**
|
|
62
62
|
* An argument schema definition for command-line argument parsing.
|
package/lib/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//#region ../../node_modules/.pnpm/args-tokens@1.0.0
|
|
1
|
+
//#region ../../node_modules/.pnpm/args-tokens@1.0.0/node_modules/args-tokens/lib/parser.js
|
|
2
2
|
/**
|
|
3
3
|
* forked from `nodejs/node` (`pkgjs/parseargs`)
|
|
4
4
|
* repository url: https://github.com/nodejs/node (https://github.com/pkgjs/parseargs)
|
|
@@ -201,7 +201,7 @@ function hasLongOptionPrefix(arg) {
|
|
|
201
201
|
return arg.startsWith(LONG_OPTION_PREFIX) && arg.length > 2;
|
|
202
202
|
}
|
|
203
203
|
//#endregion
|
|
204
|
-
//#region ../../node_modules/.pnpm/args-tokens@1.0.0
|
|
204
|
+
//#region ../../node_modules/.pnpm/args-tokens@1.0.0/node_modules/args-tokens/lib/utils.js
|
|
205
205
|
/**
|
|
206
206
|
* Entry point of utils.
|
|
207
207
|
*
|
|
@@ -232,7 +232,7 @@ function formatChoices(choices) {
|
|
|
232
232
|
return choices.map((value) => JSON.stringify(value)).join(", ");
|
|
233
233
|
}
|
|
234
234
|
//#endregion
|
|
235
|
-
//#region ../../node_modules/.pnpm/args-tokens@1.0.0
|
|
235
|
+
//#region ../../node_modules/.pnpm/args-tokens@1.0.0/node_modules/args-tokens/lib/resolver-CAlgxe_R.js
|
|
236
236
|
/**
|
|
237
237
|
* Internal definitions shared by the modules of `args-tokens`.
|
|
238
238
|
*
|
|
@@ -1134,7 +1134,7 @@ function checkConflicts(args, explicit, toKebab, actualInputNames) {
|
|
|
1134
1134
|
return [];
|
|
1135
1135
|
}
|
|
1136
1136
|
//#endregion
|
|
1137
|
-
//#region ../../node_modules/.pnpm/args-tokens@1.0.0
|
|
1137
|
+
//#region ../../node_modules/.pnpm/args-tokens@1.0.0/node_modules/args-tokens/lib/index.js
|
|
1138
1138
|
/**
|
|
1139
1139
|
* @author kazuya kawaguchi (a.k.a. kazupon)
|
|
1140
1140
|
* @license MIT
|
|
@@ -1254,37 +1254,6 @@ function create(obj = null) {
|
|
|
1254
1254
|
return Object.create(obj);
|
|
1255
1255
|
}
|
|
1256
1256
|
/**
|
|
1257
|
-
* Resolve the arguments of a command, the way gunshi parses and renders them.
|
|
1258
|
-
*
|
|
1259
|
-
* The global options belong to no command definition, so they are merged into the arguments of the
|
|
1260
|
-
* command that runs. An argument of the command shadows the global option of the same name, and it
|
|
1261
|
-
* shadows the same way by short name: a global option gives up its short name to an argument of the
|
|
1262
|
-
* command that claims the same letter, and keeps its long name.
|
|
1263
|
-
*
|
|
1264
|
-
* @param globalOptions - The global options that plugins registered with `addGlobalOption`
|
|
1265
|
-
* @param args - The arguments that the command declares
|
|
1266
|
-
* @returns The merged arguments
|
|
1267
|
-
*/
|
|
1268
|
-
function resolveCommandArgs(globalOptions, args) {
|
|
1269
|
-
return Object.assign(create(), resolveGlobalOptions(globalOptions, args), args);
|
|
1270
|
-
}
|
|
1271
|
-
function resolveGlobalOptions(globalOptions, args) {
|
|
1272
|
-
if (!globalOptions) return;
|
|
1273
|
-
const shortNames = /* @__PURE__ */ new Set();
|
|
1274
|
-
for (const schema of Object.values(args || {})) if (schema.type !== "positional" && schema.short) shortNames.add(schema.short);
|
|
1275
|
-
const resolved = create();
|
|
1276
|
-
for (const [name, schema] of globalOptions)
|
|
1277
|
-
/**
|
|
1278
|
-
* NOTE(kazupon): a copy, because the schema is the one that the plugin registered, which every
|
|
1279
|
-
* command of the CLI shares. Only this command gives up the short name.
|
|
1280
|
-
*/
|
|
1281
|
-
resolved[name] = schema.short && shortNames.has(schema.short) ? {
|
|
1282
|
-
...schema,
|
|
1283
|
-
short: void 0
|
|
1284
|
-
} : schema;
|
|
1285
|
-
return resolved;
|
|
1286
|
-
}
|
|
1287
|
-
/**
|
|
1288
1257
|
* Log a message to the console.
|
|
1289
1258
|
*
|
|
1290
1259
|
* @param args - Arguments to log
|
|
@@ -1796,6 +1765,47 @@ function resolveDependencies(plugins) {
|
|
|
1796
1765
|
return sorted;
|
|
1797
1766
|
}
|
|
1798
1767
|
//#endregion
|
|
1768
|
+
//#region ../gunshi/src/cli/args.ts
|
|
1769
|
+
/**
|
|
1770
|
+
* @author kazuya kawaguchi (a.k.a. kazupon)
|
|
1771
|
+
* @license MIT
|
|
1772
|
+
*/
|
|
1773
|
+
/**
|
|
1774
|
+
* Resolve the arguments of a command, the way gunshi parses and renders them.
|
|
1775
|
+
*
|
|
1776
|
+
* The global options belong to no command definition, so they are merged into the arguments of the
|
|
1777
|
+
* command that runs. An argument of the command shadows the global option of the same name, and it
|
|
1778
|
+
* shadows the same way by short name: a global option gives up its short name to an argument of the
|
|
1779
|
+
* command that claims the same letter, and keeps its long name.
|
|
1780
|
+
*
|
|
1781
|
+
* NOTE(kazupon): this is not exported from the entry points. `@gunshi/plugin-completion` completes
|
|
1782
|
+
* the arguments the same way with the copy in `@gunshi/shared`, and the tests of that copy pin it
|
|
1783
|
+
* to the results of this one, so a change here has to be made there too.
|
|
1784
|
+
*
|
|
1785
|
+
* @param globalOptions - The global options that plugins registered with `addGlobalOption`
|
|
1786
|
+
* @param args - The arguments that the command declares
|
|
1787
|
+
* @returns The merged arguments
|
|
1788
|
+
*/
|
|
1789
|
+
function resolveCommandArgs(globalOptions, args) {
|
|
1790
|
+
return Object.assign(create(), resolveGlobalOptions(globalOptions, args), args);
|
|
1791
|
+
}
|
|
1792
|
+
function resolveGlobalOptions(globalOptions, args) {
|
|
1793
|
+
if (!globalOptions) return;
|
|
1794
|
+
const shortNames = /* @__PURE__ */ new Set();
|
|
1795
|
+
for (const schema of Object.values(args || {})) if (schema.type !== "positional" && schema.short) shortNames.add(schema.short);
|
|
1796
|
+
const resolved = create();
|
|
1797
|
+
for (const [name, schema] of globalOptions)
|
|
1798
|
+
/**
|
|
1799
|
+
* NOTE(kazupon): a copy, because the schema is the one that the plugin registered, which every
|
|
1800
|
+
* command of the CLI shares. Only this command gives up the short name.
|
|
1801
|
+
*/
|
|
1802
|
+
resolved[name] = schema.short && shortNames.has(schema.short) ? {
|
|
1803
|
+
...schema,
|
|
1804
|
+
short: void 0
|
|
1805
|
+
} : schema;
|
|
1806
|
+
return resolved;
|
|
1807
|
+
}
|
|
1808
|
+
//#endregion
|
|
1799
1809
|
//#region ../gunshi/src/cli/core.ts
|
|
1800
1810
|
/**
|
|
1801
1811
|
* @author kazuya kawaguchi (a.k.a. kazupon)
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gunshi/bone",
|
|
3
3
|
"description": "gunshi minimum",
|
|
4
|
-
"version": "1.0.0-
|
|
4
|
+
"version": "1.0.0-rc.1",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "kazuya kawaguchi",
|
|
7
7
|
"email": "kawakazu80@gmail.com"
|
|
@@ -51,11 +51,11 @@
|
|
|
51
51
|
}
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
|
-
"@gunshi/definition": "1.0.0-
|
|
55
|
-
"@gunshi/plugin-global": "1.0.0-
|
|
56
|
-
"@gunshi/plugin-renderer": "1.0.0-
|
|
54
|
+
"@gunshi/definition": "1.0.0-rc.1",
|
|
55
|
+
"@gunshi/plugin-global": "1.0.0-rc.1",
|
|
56
|
+
"@gunshi/plugin-renderer": "1.0.0-rc.1",
|
|
57
57
|
"deno": "^2.7.14",
|
|
58
|
-
"gunshi": "1.0.0-
|
|
58
|
+
"gunshi": "1.0.0-rc.1",
|
|
59
59
|
"jsr": "^0.14.3",
|
|
60
60
|
"jsr-exports-lint": "^0.4.2",
|
|
61
61
|
"publint": "^0.3.20",
|