@optique/core 0.10.6-dev.424 → 0.10.6

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 CHANGED
@@ -1048,6 +1048,7 @@ function runWithAsync(parser, programName, contexts, options) {
1048
1048
  * @returns A new parser with annotations in its initial state.
1049
1049
  */
1050
1050
  function injectAnnotationsIntoParser(parser, annotations) {
1051
+ if (parser.initialState == null) return parser;
1051
1052
  const newInitialState = {
1052
1053
  ...parser.initialState,
1053
1054
  [require_annotations.annotationKey]: annotations
package/dist/facade.js CHANGED
@@ -1048,6 +1048,7 @@ function runWithAsync(parser, programName, contexts, options) {
1048
1048
  * @returns A new parser with annotations in its initial state.
1049
1049
  */
1050
1050
  function injectAnnotationsIntoParser(parser, annotations) {
1051
+ if (parser.initialState == null) return parser;
1051
1052
  const newInitialState = {
1052
1053
  ...parser.initialState,
1053
1054
  [annotationKey]: annotations
package/dist/parser.cjs CHANGED
@@ -30,8 +30,8 @@ const require_primitives = require('./primitives.cjs');
30
30
  */
31
31
  function parseSync(parser, args, options) {
32
32
  let initialState = parser.initialState;
33
- if (options?.annotations) initialState = {
34
- ...typeof initialState === "object" && initialState !== null ? initialState : {},
33
+ if (options?.annotations && initialState != null) initialState = {
34
+ ...typeof initialState === "object" ? initialState : {},
35
35
  [require_annotations.annotationKey]: options.annotations
36
36
  };
37
37
  let context = {
@@ -83,8 +83,8 @@ function parseSync(parser, args, options) {
83
83
  */
84
84
  async function parseAsync(parser, args, options) {
85
85
  let initialState = parser.initialState;
86
- if (options?.annotations) initialState = {
87
- ...typeof initialState === "object" && initialState !== null ? initialState : {},
86
+ if (options?.annotations && initialState != null) initialState = {
87
+ ...typeof initialState === "object" ? initialState : {},
88
88
  [require_annotations.annotationKey]: options.annotations
89
89
  };
90
90
  let context = {
@@ -181,8 +181,8 @@ function suggestSync(parser, args, options) {
181
181
  const allButLast = args.slice(0, -1);
182
182
  const prefix = args[args.length - 1];
183
183
  let initialState = parser.initialState;
184
- if (options?.annotations) initialState = {
185
- ...typeof initialState === "object" && initialState !== null ? initialState : {},
184
+ if (options?.annotations && initialState != null) initialState = {
185
+ ...typeof initialState === "object" ? initialState : {},
186
186
  [require_annotations.annotationKey]: options.annotations
187
187
  };
188
188
  let context = {
@@ -224,8 +224,8 @@ async function suggestAsync(parser, args, options) {
224
224
  const allButLast = args.slice(0, -1);
225
225
  const prefix = args[args.length - 1];
226
226
  let initialState = parser.initialState;
227
- if (options?.annotations) initialState = {
228
- ...typeof initialState === "object" && initialState !== null ? initialState : {},
227
+ if (options?.annotations && initialState != null) initialState = {
228
+ ...typeof initialState === "object" ? initialState : {},
229
229
  [require_annotations.annotationKey]: options.annotations
230
230
  };
231
231
  let context = {
@@ -340,8 +340,8 @@ function getDocPage(parser, args = [], options) {
340
340
  */
341
341
  function getDocPageSyncImpl(parser, args, options) {
342
342
  let initialState = parser.initialState;
343
- if (options?.annotations) initialState = {
344
- ...typeof initialState === "object" && initialState !== null ? initialState : {},
343
+ if (options?.annotations && initialState != null) initialState = {
344
+ ...typeof initialState === "object" ? initialState : {},
345
345
  [require_annotations.annotationKey]: options.annotations
346
346
  };
347
347
  let context = {
@@ -362,8 +362,8 @@ function getDocPageSyncImpl(parser, args, options) {
362
362
  */
363
363
  async function getDocPageAsyncImpl(parser, args, options) {
364
364
  let initialState = parser.initialState;
365
- if (options?.annotations) initialState = {
366
- ...typeof initialState === "object" && initialState !== null ? initialState : {},
365
+ if (options?.annotations && initialState != null) initialState = {
366
+ ...typeof initialState === "object" ? initialState : {},
367
367
  [require_annotations.annotationKey]: options.annotations
368
368
  };
369
369
  let context = {
package/dist/parser.js CHANGED
@@ -30,8 +30,8 @@ import { argument, command, constant, flag, option, passThrough } from "./primit
30
30
  */
31
31
  function parseSync(parser, args, options) {
32
32
  let initialState = parser.initialState;
33
- if (options?.annotations) initialState = {
34
- ...typeof initialState === "object" && initialState !== null ? initialState : {},
33
+ if (options?.annotations && initialState != null) initialState = {
34
+ ...typeof initialState === "object" ? initialState : {},
35
35
  [annotationKey]: options.annotations
36
36
  };
37
37
  let context = {
@@ -83,8 +83,8 @@ function parseSync(parser, args, options) {
83
83
  */
84
84
  async function parseAsync(parser, args, options) {
85
85
  let initialState = parser.initialState;
86
- if (options?.annotations) initialState = {
87
- ...typeof initialState === "object" && initialState !== null ? initialState : {},
86
+ if (options?.annotations && initialState != null) initialState = {
87
+ ...typeof initialState === "object" ? initialState : {},
88
88
  [annotationKey]: options.annotations
89
89
  };
90
90
  let context = {
@@ -181,8 +181,8 @@ function suggestSync(parser, args, options) {
181
181
  const allButLast = args.slice(0, -1);
182
182
  const prefix = args[args.length - 1];
183
183
  let initialState = parser.initialState;
184
- if (options?.annotations) initialState = {
185
- ...typeof initialState === "object" && initialState !== null ? initialState : {},
184
+ if (options?.annotations && initialState != null) initialState = {
185
+ ...typeof initialState === "object" ? initialState : {},
186
186
  [annotationKey]: options.annotations
187
187
  };
188
188
  let context = {
@@ -224,8 +224,8 @@ async function suggestAsync(parser, args, options) {
224
224
  const allButLast = args.slice(0, -1);
225
225
  const prefix = args[args.length - 1];
226
226
  let initialState = parser.initialState;
227
- if (options?.annotations) initialState = {
228
- ...typeof initialState === "object" && initialState !== null ? initialState : {},
227
+ if (options?.annotations && initialState != null) initialState = {
228
+ ...typeof initialState === "object" ? initialState : {},
229
229
  [annotationKey]: options.annotations
230
230
  };
231
231
  let context = {
@@ -340,8 +340,8 @@ function getDocPage(parser, args = [], options) {
340
340
  */
341
341
  function getDocPageSyncImpl(parser, args, options) {
342
342
  let initialState = parser.initialState;
343
- if (options?.annotations) initialState = {
344
- ...typeof initialState === "object" && initialState !== null ? initialState : {},
343
+ if (options?.annotations && initialState != null) initialState = {
344
+ ...typeof initialState === "object" ? initialState : {},
345
345
  [annotationKey]: options.annotations
346
346
  };
347
347
  let context = {
@@ -362,8 +362,8 @@ function getDocPageSyncImpl(parser, args, options) {
362
362
  */
363
363
  async function getDocPageAsyncImpl(parser, args, options) {
364
364
  let initialState = parser.initialState;
365
- if (options?.annotations) initialState = {
366
- ...typeof initialState === "object" && initialState !== null ? initialState : {},
365
+ if (options?.annotations && initialState != null) initialState = {
366
+ ...typeof initialState === "object" ? initialState : {},
367
367
  [annotationKey]: options.annotations
368
368
  };
369
369
  let context = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@optique/core",
3
- "version": "0.10.6-dev.424+53b58708",
3
+ "version": "0.10.6",
4
4
  "description": "Type-safe combinatorial command-line interface parser",
5
5
  "keywords": [
6
6
  "CLI",