@optique/core 1.0.0-dev.561 → 1.0.0-dev.562
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/dist/facade.cjs +14 -2
- package/dist/facade.js +14 -2
- package/package.json +1 -1
package/dist/facade.cjs
CHANGED
|
@@ -67,6 +67,10 @@ function createVersionParser(commandConfig, optionConfig) {
|
|
|
67
67
|
versionOption
|
|
68
68
|
};
|
|
69
69
|
}
|
|
70
|
+
const metaResultBrand = Symbol("@optique/core/facade/meta");
|
|
71
|
+
function isMetaParseResult(value$1) {
|
|
72
|
+
return typeof value$1 === "object" && value$1 != null && metaResultBrand in value$1;
|
|
73
|
+
}
|
|
70
74
|
/**
|
|
71
75
|
* Creates completion parsers based on the sub-config.
|
|
72
76
|
*/
|
|
@@ -163,8 +167,10 @@ function combineWithHelpVersion(originalParser, helpParsers, versionParsers, com
|
|
|
163
167
|
...context,
|
|
164
168
|
buffer: [],
|
|
165
169
|
state: {
|
|
170
|
+
[metaResultBrand]: true,
|
|
166
171
|
help: true,
|
|
167
172
|
version: false,
|
|
173
|
+
completion: false,
|
|
168
174
|
commands,
|
|
169
175
|
helpFlag: true
|
|
170
176
|
}
|
|
@@ -234,8 +240,10 @@ function combineWithHelpVersion(originalParser, helpParsers, versionParsers, com
|
|
|
234
240
|
...context,
|
|
235
241
|
buffer: [],
|
|
236
242
|
state: {
|
|
243
|
+
[metaResultBrand]: true,
|
|
237
244
|
help: false,
|
|
238
245
|
version: true,
|
|
246
|
+
completion: false,
|
|
239
247
|
versionFlag: true
|
|
240
248
|
}
|
|
241
249
|
},
|
|
@@ -268,6 +276,7 @@ function combineWithHelpVersion(originalParser, helpParsers, versionParsers, com
|
|
|
268
276
|
}
|
|
269
277
|
if (versionParsers.versionCommand) {
|
|
270
278
|
const versionParser = require_constructs.object({
|
|
279
|
+
[metaResultBrand]: require_primitives.constant(true),
|
|
271
280
|
help: require_primitives.constant(false),
|
|
272
281
|
version: require_primitives.constant(true),
|
|
273
282
|
completion: require_primitives.constant(false),
|
|
@@ -278,6 +287,7 @@ function combineWithHelpVersion(originalParser, helpParsers, versionParsers, com
|
|
|
278
287
|
}
|
|
279
288
|
if (completionParsers.completionCommand) {
|
|
280
289
|
const completionParser = require_constructs.object({
|
|
290
|
+
[metaResultBrand]: require_primitives.constant(true),
|
|
281
291
|
help: require_primitives.constant(false),
|
|
282
292
|
version: require_primitives.constant(false),
|
|
283
293
|
completion: require_primitives.constant(true),
|
|
@@ -288,6 +298,7 @@ function combineWithHelpVersion(originalParser, helpParsers, versionParsers, com
|
|
|
288
298
|
}
|
|
289
299
|
if (helpParsers.helpCommand) {
|
|
290
300
|
const helpParser = require_constructs.object({
|
|
301
|
+
[metaResultBrand]: require_primitives.constant(true),
|
|
291
302
|
help: require_primitives.constant(true),
|
|
292
303
|
version: require_primitives.constant(false),
|
|
293
304
|
completion: require_primitives.constant(false),
|
|
@@ -296,6 +307,7 @@ function combineWithHelpVersion(originalParser, helpParsers, versionParsers, com
|
|
|
296
307
|
parsers.push(groups?.helpCommandGroup ? require_constructs.group(groups.helpCommandGroup, helpParser) : helpParser);
|
|
297
308
|
}
|
|
298
309
|
parsers.push(require_constructs.object({
|
|
310
|
+
[metaResultBrand]: require_primitives.constant(true),
|
|
299
311
|
help: require_primitives.constant(false),
|
|
300
312
|
version: require_primitives.constant(false),
|
|
301
313
|
completion: require_primitives.constant(false),
|
|
@@ -332,7 +344,7 @@ function classifyResult(result, args, helpOptionNames, helpCommandNames, version
|
|
|
332
344
|
error: result.error
|
|
333
345
|
};
|
|
334
346
|
const value$1 = result.value;
|
|
335
|
-
if (
|
|
347
|
+
if (isMetaParseResult(value$1)) {
|
|
336
348
|
const parsedValue = value$1;
|
|
337
349
|
const hasVersionOption = versionOptionNames.some((n) => args.includes(n));
|
|
338
350
|
const hasVersionCommand = args.length > 0 && versionCommandNames.includes(args[0]);
|
|
@@ -364,7 +376,7 @@ function classifyResult(result, args, helpOptionNames, helpCommandNames, version
|
|
|
364
376
|
};
|
|
365
377
|
return {
|
|
366
378
|
type: "success",
|
|
367
|
-
value: parsedValue.result
|
|
379
|
+
value: "result" in parsedValue ? parsedValue.result : value$1
|
|
368
380
|
};
|
|
369
381
|
}
|
|
370
382
|
return {
|
package/dist/facade.js
CHANGED
|
@@ -67,6 +67,10 @@ function createVersionParser(commandConfig, optionConfig) {
|
|
|
67
67
|
versionOption
|
|
68
68
|
};
|
|
69
69
|
}
|
|
70
|
+
const metaResultBrand = Symbol("@optique/core/facade/meta");
|
|
71
|
+
function isMetaParseResult(value$1) {
|
|
72
|
+
return typeof value$1 === "object" && value$1 != null && metaResultBrand in value$1;
|
|
73
|
+
}
|
|
70
74
|
/**
|
|
71
75
|
* Creates completion parsers based on the sub-config.
|
|
72
76
|
*/
|
|
@@ -163,8 +167,10 @@ function combineWithHelpVersion(originalParser, helpParsers, versionParsers, com
|
|
|
163
167
|
...context,
|
|
164
168
|
buffer: [],
|
|
165
169
|
state: {
|
|
170
|
+
[metaResultBrand]: true,
|
|
166
171
|
help: true,
|
|
167
172
|
version: false,
|
|
173
|
+
completion: false,
|
|
168
174
|
commands,
|
|
169
175
|
helpFlag: true
|
|
170
176
|
}
|
|
@@ -234,8 +240,10 @@ function combineWithHelpVersion(originalParser, helpParsers, versionParsers, com
|
|
|
234
240
|
...context,
|
|
235
241
|
buffer: [],
|
|
236
242
|
state: {
|
|
243
|
+
[metaResultBrand]: true,
|
|
237
244
|
help: false,
|
|
238
245
|
version: true,
|
|
246
|
+
completion: false,
|
|
239
247
|
versionFlag: true
|
|
240
248
|
}
|
|
241
249
|
},
|
|
@@ -268,6 +276,7 @@ function combineWithHelpVersion(originalParser, helpParsers, versionParsers, com
|
|
|
268
276
|
}
|
|
269
277
|
if (versionParsers.versionCommand) {
|
|
270
278
|
const versionParser = object({
|
|
279
|
+
[metaResultBrand]: constant(true),
|
|
271
280
|
help: constant(false),
|
|
272
281
|
version: constant(true),
|
|
273
282
|
completion: constant(false),
|
|
@@ -278,6 +287,7 @@ function combineWithHelpVersion(originalParser, helpParsers, versionParsers, com
|
|
|
278
287
|
}
|
|
279
288
|
if (completionParsers.completionCommand) {
|
|
280
289
|
const completionParser = object({
|
|
290
|
+
[metaResultBrand]: constant(true),
|
|
281
291
|
help: constant(false),
|
|
282
292
|
version: constant(false),
|
|
283
293
|
completion: constant(true),
|
|
@@ -288,6 +298,7 @@ function combineWithHelpVersion(originalParser, helpParsers, versionParsers, com
|
|
|
288
298
|
}
|
|
289
299
|
if (helpParsers.helpCommand) {
|
|
290
300
|
const helpParser = object({
|
|
301
|
+
[metaResultBrand]: constant(true),
|
|
291
302
|
help: constant(true),
|
|
292
303
|
version: constant(false),
|
|
293
304
|
completion: constant(false),
|
|
@@ -296,6 +307,7 @@ function combineWithHelpVersion(originalParser, helpParsers, versionParsers, com
|
|
|
296
307
|
parsers.push(groups?.helpCommandGroup ? group(groups.helpCommandGroup, helpParser) : helpParser);
|
|
297
308
|
}
|
|
298
309
|
parsers.push(object({
|
|
310
|
+
[metaResultBrand]: constant(true),
|
|
299
311
|
help: constant(false),
|
|
300
312
|
version: constant(false),
|
|
301
313
|
completion: constant(false),
|
|
@@ -332,7 +344,7 @@ function classifyResult(result, args, helpOptionNames, helpCommandNames, version
|
|
|
332
344
|
error: result.error
|
|
333
345
|
};
|
|
334
346
|
const value$1 = result.value;
|
|
335
|
-
if (
|
|
347
|
+
if (isMetaParseResult(value$1)) {
|
|
336
348
|
const parsedValue = value$1;
|
|
337
349
|
const hasVersionOption = versionOptionNames.some((n) => args.includes(n));
|
|
338
350
|
const hasVersionCommand = args.length > 0 && versionCommandNames.includes(args[0]);
|
|
@@ -364,7 +376,7 @@ function classifyResult(result, args, helpOptionNames, helpCommandNames, version
|
|
|
364
376
|
};
|
|
365
377
|
return {
|
|
366
378
|
type: "success",
|
|
367
|
-
value: parsedValue.result
|
|
379
|
+
value: "result" in parsedValue ? parsedValue.result : value$1
|
|
368
380
|
};
|
|
369
381
|
}
|
|
370
382
|
return {
|