projen 0.71.24 → 0.71.26

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.
Files changed (243) hide show
  1. package/.jsii +3 -3
  2. package/lib/awscdk/auto-discover.js +5 -5
  3. package/lib/awscdk/awscdk-app-java.js +1 -1
  4. package/lib/awscdk/awscdk-app-py.js +1 -1
  5. package/lib/awscdk/awscdk-app-ts.js +1 -1
  6. package/lib/awscdk/awscdk-construct.js +2 -2
  7. package/lib/awscdk/awscdk-deps-java.js +1 -1
  8. package/lib/awscdk/awscdk-deps-js.js +1 -1
  9. package/lib/awscdk/awscdk-deps-py.js +1 -1
  10. package/lib/awscdk/awscdk-deps.js +1 -1
  11. package/lib/awscdk/cdk-config.js +1 -1
  12. package/lib/awscdk/cdk-tasks.js +1 -1
  13. package/lib/awscdk/integration-test.js +1 -1
  14. package/lib/awscdk/lambda-extension.js +1 -1
  15. package/lib/awscdk/lambda-function.js +2 -2
  16. package/lib/build/build-workflow.js +1 -1
  17. package/lib/cdk/auto-discover-base.js +2 -2
  18. package/lib/cdk/construct-lib.js +1 -1
  19. package/lib/cdk/integration-test-base.js +1 -1
  20. package/lib/cdk/jsii-docgen.js +1 -1
  21. package/lib/cdk/jsii-project.js +1 -1
  22. package/lib/cdk8s/auto-discover.js +2 -2
  23. package/lib/cdk8s/cdk8s-app-py.js +1 -1
  24. package/lib/cdk8s/cdk8s-app-ts.js +1 -1
  25. package/lib/cdk8s/cdk8s-construct.js +1 -1
  26. package/lib/cdk8s/cdk8s-deps-py.js +1 -1
  27. package/lib/cdk8s/cdk8s-deps.js +1 -1
  28. package/lib/cdk8s/integration-test.js +1 -1
  29. package/lib/cdktf/cdktf-construct.js +1 -1
  30. package/lib/circleci/circleci.js +1 -1
  31. package/lib/component.js +1 -1
  32. package/lib/dependencies.js +1 -1
  33. package/lib/dev-env.js +1 -1
  34. package/lib/docker-compose/docker-compose-service.js +1 -1
  35. package/lib/docker-compose/docker-compose.js +1 -1
  36. package/lib/file.js +1 -1
  37. package/lib/gitattributes.js +1 -1
  38. package/lib/github/actions-provider.js +1 -1
  39. package/lib/github/auto-approve.js +1 -1
  40. package/lib/github/auto-merge.js +1 -1
  41. package/lib/github/dependabot.js +1 -1
  42. package/lib/github/github-credentials.js +1 -1
  43. package/lib/github/github-project.js +1 -1
  44. package/lib/github/github.js +1 -1
  45. package/lib/github/mergify.js +1 -1
  46. package/lib/github/pr-template.js +1 -1
  47. package/lib/github/pull-request-lint.js +1 -1
  48. package/lib/github/stale.js +1 -1
  49. package/lib/github/task-workflow.js +1 -1
  50. package/lib/github/workflow-actions.js +1 -1
  51. package/lib/github/workflow-jobs.js +1 -1
  52. package/lib/github/workflows.js +1 -1
  53. package/lib/gitlab/configuration.js +1 -1
  54. package/lib/gitlab/gitlab-configuration.js +1 -1
  55. package/lib/gitlab/nested-configuration.js +1 -1
  56. package/lib/gitpod.js +1 -1
  57. package/lib/ignore-file.js +1 -1
  58. package/lib/ini.js +1 -1
  59. package/lib/java/java-project.js +1 -1
  60. package/lib/java/junit.js +1 -1
  61. package/lib/java/maven-compile.js +1 -1
  62. package/lib/java/maven-packaging.js +1 -1
  63. package/lib/java/maven-sample.js +1 -1
  64. package/lib/java/pom.js +1 -1
  65. package/lib/java/projenrc.js +1 -1
  66. package/lib/javascript/bundler.js +1 -1
  67. package/lib/javascript/eslint.js +1 -1
  68. package/lib/javascript/jest.js +4 -4
  69. package/lib/javascript/node-package.js +1 -1
  70. package/lib/javascript/node-project.js +1 -1
  71. package/lib/javascript/npm-config.js +1 -1
  72. package/lib/javascript/prettier.js +1 -1
  73. package/lib/javascript/projenrc.js +1 -1
  74. package/lib/javascript/typescript-config.js +1 -1
  75. package/lib/javascript/upgrade-dependencies.js +2 -2
  76. package/lib/json-patch.js +1 -1
  77. package/lib/json.js +1 -1
  78. package/lib/license.js +1 -1
  79. package/lib/logger.js +1 -1
  80. package/lib/makefile.js +1 -1
  81. package/lib/object-file.js +1 -1
  82. package/lib/project-build.js +1 -1
  83. package/lib/project.js +1 -1
  84. package/lib/projects.js +1 -1
  85. package/lib/projenrc-json.js +2 -2
  86. package/lib/projenrc.js +1 -1
  87. package/lib/python/pip.js +1 -1
  88. package/lib/python/poetry.js +2 -2
  89. package/lib/python/projenrc.js +1 -1
  90. package/lib/python/pytest-sample.js +1 -1
  91. package/lib/python/pytest.js +1 -1
  92. package/lib/python/python-project.js +1 -1
  93. package/lib/python/python-sample.js +1 -1
  94. package/lib/python/requirements-file.js +1 -1
  95. package/lib/python/setuppy.js +1 -1
  96. package/lib/python/setuptools.js +1 -1
  97. package/lib/python/venv.js +1 -1
  98. package/lib/readme.js +1 -1
  99. package/lib/release/publisher.js +1 -1
  100. package/lib/release/release-trigger.js +1 -1
  101. package/lib/release/release.js +1 -1
  102. package/lib/renovatebot.js +1 -1
  103. package/lib/run-task.js +1 -1880
  104. package/lib/sample-file.js +2 -2
  105. package/lib/semver.js +1 -1
  106. package/lib/source-code.js +1 -1
  107. package/lib/task-runtime.js +1 -1
  108. package/lib/task.js +1 -1
  109. package/lib/tasks.js +1 -1
  110. package/lib/testing.js +1 -1
  111. package/lib/textfile.js +1 -1
  112. package/lib/toml.js +1 -1
  113. package/lib/typescript/projenrc-ts.js +1 -1
  114. package/lib/typescript/projenrc.js +1 -1
  115. package/lib/typescript/typescript-typedoc.js +1 -1
  116. package/lib/typescript/typescript.js +3 -3
  117. package/lib/version.js +1 -1
  118. package/lib/vscode/devcontainer.js +1 -1
  119. package/lib/vscode/extensions.js +1 -1
  120. package/lib/vscode/launch-config.js +1 -1
  121. package/lib/vscode/settings.js +1 -1
  122. package/lib/vscode/vscode.js +1 -1
  123. package/lib/web/next.js +3 -3
  124. package/lib/web/postcss.js +1 -1
  125. package/lib/web/react.js +4 -4
  126. package/lib/web/tailwind.js +1 -1
  127. package/lib/xmlfile.js +1 -1
  128. package/lib/yaml.js +1 -1
  129. package/node_modules/xmlbuilder2/node_modules/@types/node/README.md +1 -1
  130. package/node_modules/xmlbuilder2/node_modules/@types/node/globals.d.ts +1 -1
  131. package/node_modules/xmlbuilder2/node_modules/@types/node/package.json +2 -2
  132. package/node_modules/xmlbuilder2/node_modules/@types/node/ts4.8/v8.d.ts +94 -0
  133. package/node_modules/xmlbuilder2/node_modules/@types/node/v8.d.ts +94 -0
  134. package/node_modules/yaml/README.md +1 -1
  135. package/node_modules/yaml/browser/dist/compose/compose-collection.js +1 -1
  136. package/node_modules/yaml/browser/dist/compose/compose-doc.js +2 -2
  137. package/node_modules/yaml/browser/dist/compose/compose-node.js +4 -2
  138. package/node_modules/yaml/browser/dist/compose/compose-scalar.js +6 -7
  139. package/node_modules/yaml/browser/dist/compose/composer.js +2 -3
  140. package/node_modules/yaml/browser/dist/compose/resolve-block-map.js +13 -10
  141. package/node_modules/yaml/browser/dist/compose/resolve-block-scalar.js +1 -1
  142. package/node_modules/yaml/browser/dist/compose/resolve-block-seq.js +5 -5
  143. package/node_modules/yaml/browser/dist/compose/resolve-flow-collection.js +3 -4
  144. package/node_modules/yaml/browser/dist/compose/resolve-flow-scalar.js +1 -2
  145. package/node_modules/yaml/browser/dist/compose/resolve-props.js +6 -2
  146. package/node_modules/yaml/browser/dist/compose/util-empty-scalar-position.js +1 -1
  147. package/node_modules/yaml/browser/dist/compose/util-flow-indent-check.js +1 -1
  148. package/node_modules/yaml/browser/dist/doc/Document.js +6 -6
  149. package/node_modules/yaml/browser/dist/doc/createNode.js +6 -8
  150. package/node_modules/yaml/browser/dist/errors.js +1 -1
  151. package/node_modules/yaml/browser/dist/nodes/Collection.js +2 -1
  152. package/node_modules/yaml/browser/dist/nodes/Pair.js +2 -2
  153. package/node_modules/yaml/browser/dist/nodes/Scalar.js +1 -1
  154. package/node_modules/yaml/browser/dist/nodes/YAMLMap.js +9 -10
  155. package/node_modules/yaml/browser/dist/nodes/YAMLSeq.js +4 -12
  156. package/node_modules/yaml/browser/dist/nodes/addPairToJSMap.js +1 -1
  157. package/node_modules/yaml/browser/dist/nodes/toJS.js +1 -1
  158. package/node_modules/yaml/browser/dist/parse/cst-scalar.js +1 -2
  159. package/node_modules/yaml/browser/dist/parse/cst-visit.js +2 -2
  160. package/node_modules/yaml/browser/dist/parse/lexer.js +1 -2
  161. package/node_modules/yaml/browser/dist/parse/parser.js +24 -26
  162. package/node_modules/yaml/browser/dist/public-api.js +3 -4
  163. package/node_modules/yaml/browser/dist/schema/Schema.js +1 -1
  164. package/node_modules/yaml/browser/dist/schema/yaml-1.1/omap.js +1 -1
  165. package/node_modules/yaml/browser/dist/schema/yaml-1.1/pairs.js +1 -2
  166. package/node_modules/yaml/browser/dist/schema/yaml-1.1/set.js +6 -1
  167. package/node_modules/yaml/browser/dist/stringify/stringify.js +8 -8
  168. package/node_modules/yaml/browser/dist/stringify/stringifyCollection.js +4 -5
  169. package/node_modules/yaml/browser/dist/stringify/stringifyDocument.js +1 -2
  170. package/node_modules/yaml/browser/dist/stringify/stringifyPair.js +45 -20
  171. package/node_modules/yaml/browser/dist/stringify/stringifyString.js +17 -12
  172. package/node_modules/yaml/browser/dist/visit.js +5 -6
  173. package/node_modules/yaml/dist/compose/compose-collection.js +1 -1
  174. package/node_modules/yaml/dist/compose/compose-doc.js +2 -2
  175. package/node_modules/yaml/dist/compose/compose-node.d.ts +3 -2
  176. package/node_modules/yaml/dist/compose/compose-node.js +4 -2
  177. package/node_modules/yaml/dist/compose/compose-scalar.js +6 -7
  178. package/node_modules/yaml/dist/compose/composer.d.ts +2 -2
  179. package/node_modules/yaml/dist/compose/composer.js +2 -3
  180. package/node_modules/yaml/dist/compose/resolve-block-map.js +13 -10
  181. package/node_modules/yaml/dist/compose/resolve-block-scalar.js +1 -1
  182. package/node_modules/yaml/dist/compose/resolve-block-seq.js +5 -5
  183. package/node_modules/yaml/dist/compose/resolve-flow-collection.js +3 -4
  184. package/node_modules/yaml/dist/compose/resolve-flow-scalar.js +1 -2
  185. package/node_modules/yaml/dist/compose/resolve-props.d.ts +1 -0
  186. package/node_modules/yaml/dist/compose/resolve-props.js +6 -2
  187. package/node_modules/yaml/dist/compose/util-empty-scalar-position.js +1 -1
  188. package/node_modules/yaml/dist/compose/util-flow-indent-check.js +1 -1
  189. package/node_modules/yaml/dist/doc/Document.d.ts +11 -11
  190. package/node_modules/yaml/dist/doc/Document.js +6 -6
  191. package/node_modules/yaml/dist/doc/anchors.d.ts +1 -1
  192. package/node_modules/yaml/dist/doc/applyReviver.d.ts +1 -1
  193. package/node_modules/yaml/dist/doc/createNode.js +6 -8
  194. package/node_modules/yaml/dist/errors.d.ts +2 -2
  195. package/node_modules/yaml/dist/errors.js +1 -1
  196. package/node_modules/yaml/dist/index.d.ts +2 -0
  197. package/node_modules/yaml/dist/log.d.ts +1 -1
  198. package/node_modules/yaml/dist/nodes/Alias.d.ts +1 -1
  199. package/node_modules/yaml/dist/nodes/Collection.d.ts +2 -2
  200. package/node_modules/yaml/dist/nodes/Collection.js +2 -1
  201. package/node_modules/yaml/dist/nodes/Node.d.ts +17 -11
  202. package/node_modules/yaml/dist/nodes/Pair.d.ts +1 -1
  203. package/node_modules/yaml/dist/nodes/Pair.js +2 -2
  204. package/node_modules/yaml/dist/nodes/Scalar.js +1 -1
  205. package/node_modules/yaml/dist/nodes/YAMLMap.d.ts +8 -4
  206. package/node_modules/yaml/dist/nodes/YAMLMap.js +9 -10
  207. package/node_modules/yaml/dist/nodes/YAMLSeq.d.ts +4 -1
  208. package/node_modules/yaml/dist/nodes/YAMLSeq.js +4 -12
  209. package/node_modules/yaml/dist/nodes/addPairToJSMap.d.ts +2 -1
  210. package/node_modules/yaml/dist/nodes/addPairToJSMap.js +1 -1
  211. package/node_modules/yaml/dist/nodes/toJS.js +1 -1
  212. package/node_modules/yaml/dist/options.d.ts +15 -7
  213. package/node_modules/yaml/dist/parse/cst-scalar.js +1 -2
  214. package/node_modules/yaml/dist/parse/cst-visit.d.ts +2 -2
  215. package/node_modules/yaml/dist/parse/cst-visit.js +2 -2
  216. package/node_modules/yaml/dist/parse/cst.d.ts +3 -3
  217. package/node_modules/yaml/dist/parse/lexer.js +1 -2
  218. package/node_modules/yaml/dist/parse/parser.js +24 -26
  219. package/node_modules/yaml/dist/public-api.js +3 -4
  220. package/node_modules/yaml/dist/schema/Schema.d.ts +3 -3
  221. package/node_modules/yaml/dist/schema/Schema.js +1 -1
  222. package/node_modules/yaml/dist/schema/json-schema.d.ts +69 -0
  223. package/node_modules/yaml/dist/schema/tags.d.ts +2 -2
  224. package/node_modules/yaml/dist/schema/types.d.ts +1 -1
  225. package/node_modules/yaml/dist/schema/yaml-1.1/omap.d.ts +7 -3
  226. package/node_modules/yaml/dist/schema/yaml-1.1/omap.js +1 -1
  227. package/node_modules/yaml/dist/schema/yaml-1.1/pairs.js +1 -2
  228. package/node_modules/yaml/dist/schema/yaml-1.1/set.d.ts +6 -2
  229. package/node_modules/yaml/dist/schema/yaml-1.1/set.js +6 -1
  230. package/node_modules/yaml/dist/stringify/foldFlowLines.d.ts +1 -1
  231. package/node_modules/yaml/dist/stringify/stringify.d.ts +2 -1
  232. package/node_modules/yaml/dist/stringify/stringify.js +8 -8
  233. package/node_modules/yaml/dist/stringify/stringifyCollection.js +4 -5
  234. package/node_modules/yaml/dist/stringify/stringifyDocument.js +1 -2
  235. package/node_modules/yaml/dist/stringify/stringifyPair.js +45 -20
  236. package/node_modules/yaml/dist/stringify/stringifyString.d.ts +7 -1
  237. package/node_modules/yaml/dist/stringify/stringifyString.js +17 -12
  238. package/node_modules/yaml/dist/test-events.js +2 -3
  239. package/node_modules/yaml/dist/visit.d.ts +4 -4
  240. package/node_modules/yaml/dist/visit.js +5 -6
  241. package/node_modules/yaml/package.json +11 -11
  242. package/package.json +2 -2
  243. package/node_modules/yaml/dist/node_modules/tslib/tslib.es6.js +0 -76
@@ -1,6 +1,6 @@
1
1
  import type { YAMLError, YAMLWarning } from '../errors.js';
2
2
  import { Alias } from '../nodes/Alias.js';
3
- import { Node, NODE_TYPE, ParsedNode, Range } from '../nodes/Node.js';
3
+ import { Node, NodeType, NODE_TYPE, ParsedNode, Range } from '../nodes/Node.js';
4
4
  import { Pair } from '../nodes/Pair.js';
5
5
  import type { Scalar } from '../nodes/Scalar.js';
6
6
  import type { YAMLMap } from '../nodes/YAMLMap.js';
@@ -8,14 +8,14 @@ import type { YAMLSeq } from '../nodes/YAMLSeq.js';
8
8
  import type { CreateNodeOptions, DocumentOptions, ParseOptions, SchemaOptions, ToJSOptions, ToStringOptions } from '../options.js';
9
9
  import { Schema } from '../schema/Schema.js';
10
10
  import { Directives } from './directives.js';
11
- export declare type Replacer = any[] | ((key: any, value: any) => unknown);
11
+ export type Replacer = any[] | ((key: any, value: any) => unknown);
12
12
  export declare namespace Document {
13
13
  interface Parsed<T extends ParsedNode = ParsedNode> extends Document<T> {
14
14
  directives: Directives;
15
15
  range: Range;
16
16
  }
17
17
  }
18
- export declare class Document<T = unknown> {
18
+ export declare class Document<T extends Node = Node> {
19
19
  readonly [NODE_TYPE]: symbol;
20
20
  /** A comment before this Document */
21
21
  commentBefore: string | null;
@@ -26,7 +26,7 @@ export declare class Document<T = unknown> {
26
26
  directives?: Directives;
27
27
  /** Errors encountered during parsing. */
28
28
  errors: YAMLError[];
29
- options: Required<Omit<ParseOptions & DocumentOptions, 'lineCounter' | 'directives' | 'version'>>;
29
+ options: Required<Omit<ParseOptions & DocumentOptions, '_directives' | 'lineCounter' | 'version'>>;
30
30
  /**
31
31
  * The `[start, value-end, node-end]` character offsets for the part of the
32
32
  * source parsed into this document (undefined if not parsed). The `value-end`
@@ -68,8 +68,8 @@ export declare class Document<T = unknown> {
68
68
  * Convert any value into a `Node` using the current schema, recursively
69
69
  * turning objects into collections.
70
70
  */
71
- createNode(value: unknown, options?: CreateNodeOptions): Node;
72
- createNode(value: unknown, replacer: Replacer | CreateNodeOptions | null, options?: CreateNodeOptions): Node;
71
+ createNode<T = unknown>(value: T, options?: CreateNodeOptions): NodeType<T>;
72
+ createNode<T = unknown>(value: T, replacer: Replacer | CreateNodeOptions | null, options?: CreateNodeOptions): NodeType<T>;
73
73
  /**
74
74
  * Convert a key and a value into a `Pair` using the current schema,
75
75
  * recursively wrapping all values as `Scalar` or `Collection` nodes.
@@ -79,12 +79,12 @@ export declare class Document<T = unknown> {
79
79
  * Removes a value from the document.
80
80
  * @returns `true` if the item was found and removed.
81
81
  */
82
- delete(key: any): boolean;
82
+ delete(key: unknown): boolean;
83
83
  /**
84
84
  * Removes a value from the document.
85
85
  * @returns `true` if the item was found and removed.
86
86
  */
87
- deleteIn(path: Iterable<unknown>): boolean;
87
+ deleteIn(path: Iterable<unknown> | null): boolean;
88
88
  /**
89
89
  * Returns item at `key`, or `undefined` if not found. By default unwraps
90
90
  * scalar values from their surrounding node; to disable set `keepScalar` to
@@ -96,7 +96,7 @@ export declare class Document<T = unknown> {
96
96
  * scalar values from their surrounding node; to disable set `keepScalar` to
97
97
  * `true` (collections are always returned intact).
98
98
  */
99
- getIn(path: Iterable<unknown>, keepScalar?: boolean): unknown;
99
+ getIn(path: Iterable<unknown> | null, keepScalar?: boolean): unknown;
100
100
  /**
101
101
  * Checks if the document includes a value with the key `key`.
102
102
  */
@@ -104,7 +104,7 @@ export declare class Document<T = unknown> {
104
104
  /**
105
105
  * Checks if the document includes a value at `path`.
106
106
  */
107
- hasIn(path: Iterable<unknown>): boolean;
107
+ hasIn(path: Iterable<unknown> | null): boolean;
108
108
  /**
109
109
  * Sets a value in this document. For `!!set`, `value` needs to be a
110
110
  * boolean to add/remove the item from the set.
@@ -114,7 +114,7 @@ export declare class Document<T = unknown> {
114
114
  * Sets a value in this document. For `!!set`, `value` needs to be a
115
115
  * boolean to add/remove the item from the set.
116
116
  */
117
- setIn(path: Iterable<unknown>, value: unknown): void;
117
+ setIn(path: Iterable<unknown> | null, value: unknown): void;
118
118
  /**
119
119
  * Change the YAML version and schema used by the document.
120
120
  * A `null` version disables support for directives, explicit tags, anchors, and aliases.
@@ -43,8 +43,8 @@ class Document {
43
43
  }, options);
44
44
  this.options = opt;
45
45
  let { version } = opt;
46
- if (options === null || options === void 0 ? void 0 : options.directives) {
47
- this.directives = options.directives.atDocument();
46
+ if (options?._directives) {
47
+ this.directives = options._directives.atDocument();
48
48
  if (this.directives.yaml.explicit)
49
49
  version = this.directives.yaml.version;
50
50
  }
@@ -126,13 +126,13 @@ class Document {
126
126
  options = replacer;
127
127
  replacer = undefined;
128
128
  }
129
- const { aliasDuplicateObjects, anchorPrefix, flow, keepUndefined, onTagObj, tag } = options !== null && options !== void 0 ? options : {};
129
+ const { aliasDuplicateObjects, anchorPrefix, flow, keepUndefined, onTagObj, tag } = options ?? {};
130
130
  const { onAnchor, setAnchors, sourceObjects } = anchors.createNodeAnchors(this,
131
131
  // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
132
132
  anchorPrefix || 'a');
133
133
  const ctx = {
134
- aliasDuplicateObjects: aliasDuplicateObjects !== null && aliasDuplicateObjects !== void 0 ? aliasDuplicateObjects : true,
135
- keepUndefined: keepUndefined !== null && keepUndefined !== void 0 ? keepUndefined : false,
134
+ aliasDuplicateObjects: aliasDuplicateObjects ?? true,
135
+ keepUndefined: keepUndefined ?? false,
136
136
  onAnchor,
137
137
  onTagObj,
138
138
  replacer: _replacer,
@@ -296,7 +296,7 @@ class Document {
296
296
  maxAliasCount: typeof maxAliasCount === 'number' ? maxAliasCount : 100,
297
297
  stringify: stringify.stringify
298
298
  };
299
- const res = toJS.toJS(this.contents, jsonArg !== null && jsonArg !== void 0 ? jsonArg : '', ctx);
299
+ const res = toJS.toJS(this.contents, jsonArg ?? '', ctx);
300
300
  if (typeof onAnchor === 'function')
301
301
  for (const { count, res } of ctx.anchors.values())
302
302
  onAnchor(res, count);
@@ -19,6 +19,6 @@ export declare function createNodeAnchors(doc: Document, prefix: string): {
19
19
  setAnchors: () => void;
20
20
  sourceObjects: Map<unknown, {
21
21
  anchor: string | null;
22
- node: Node | null;
22
+ node: Node<unknown> | null;
23
23
  }>;
24
24
  };
@@ -1,4 +1,4 @@
1
- export declare type Reviver = (key: unknown, value: unknown) => unknown;
1
+ export type Reviver = (key: unknown, value: unknown) => unknown;
2
2
  /**
3
3
  * Applies the JSON.parse reviver algorithm as defined in the ECMA-262 spec,
4
4
  * in section 24.5.1.1 "Runtime Semantics: InternalizeJSONProperty" of the
@@ -6,31 +6,29 @@ var Scalar = require('../nodes/Scalar.js');
6
6
 
7
7
  const defaultTagPrefix = 'tag:yaml.org,2002:';
8
8
  function findTagObject(value, tagName, tags) {
9
- var _a;
10
9
  if (tagName) {
11
10
  const match = tags.filter(t => t.tag === tagName);
12
- const tagObj = (_a = match.find(t => !t.format)) !== null && _a !== void 0 ? _a : match[0];
11
+ const tagObj = match.find(t => !t.format) ?? match[0];
13
12
  if (!tagObj)
14
13
  throw new Error(`Tag ${tagName} not found`);
15
14
  return tagObj;
16
15
  }
17
- return tags.find(t => { var _a; return ((_a = t.identify) === null || _a === void 0 ? void 0 : _a.call(t, value)) && !t.format; });
16
+ return tags.find(t => t.identify?.(value) && !t.format);
18
17
  }
19
18
  function createNode(value, tagName, ctx) {
20
- var _a, _b;
21
19
  if (Node.isDocument(value))
22
20
  value = value.contents;
23
21
  if (Node.isNode(value))
24
22
  return value;
25
23
  if (Node.isPair(value)) {
26
- const map = (_b = (_a = ctx.schema[Node.MAP]).createNode) === null || _b === void 0 ? void 0 : _b.call(_a, ctx.schema, null, ctx);
24
+ const map = ctx.schema[Node.MAP].createNode?.(ctx.schema, null, ctx);
27
25
  map.items.push(value);
28
26
  return map;
29
27
  }
30
28
  if (value instanceof String ||
31
29
  value instanceof Number ||
32
30
  value instanceof Boolean ||
33
- (typeof BigInt === 'function' && value instanceof BigInt) // not supported everywhere
31
+ (typeof BigInt !== 'undefined' && value instanceof BigInt) // not supported everywhere
34
32
  ) {
35
33
  // https://tc39.es/ecma262/#sec-serializejsonproperty
36
34
  value = value.valueOf();
@@ -51,7 +49,7 @@ function createNode(value, tagName, ctx) {
51
49
  sourceObjects.set(value, ref);
52
50
  }
53
51
  }
54
- if (tagName === null || tagName === void 0 ? void 0 : tagName.startsWith('!!'))
52
+ if (tagName?.startsWith('!!'))
55
53
  tagName = defaultTagPrefix + tagName.slice(2);
56
54
  let tagObj = findTagObject(value, tagName, schema.tags);
57
55
  if (!tagObj) {
@@ -76,7 +74,7 @@ function createNode(value, tagName, ctx) {
76
74
  onTagObj(tagObj);
77
75
  delete ctx.onTagObj;
78
76
  }
79
- const node = (tagObj === null || tagObj === void 0 ? void 0 : tagObj.createNode)
77
+ const node = tagObj?.createNode
80
78
  ? tagObj.createNode(ctx.schema, value, ctx)
81
79
  : new Scalar.Scalar(value);
82
80
  if (tagName)
@@ -1,6 +1,6 @@
1
1
  import type { LineCounter } from './parse/line-counter';
2
- export declare type ErrorCode = 'ALIAS_PROPS' | 'BAD_ALIAS' | 'BAD_DIRECTIVE' | 'BAD_DQ_ESCAPE' | 'BAD_INDENT' | 'BAD_PROP_ORDER' | 'BAD_SCALAR_START' | 'BLOCK_AS_IMPLICIT_KEY' | 'BLOCK_IN_FLOW' | 'DUPLICATE_KEY' | 'IMPOSSIBLE' | 'KEY_OVER_1024_CHARS' | 'MISSING_CHAR' | 'MULTILINE_IMPLICIT_KEY' | 'MULTIPLE_ANCHORS' | 'MULTIPLE_DOCS' | 'MULTIPLE_TAGS' | 'TAB_AS_INDENT' | 'TAG_RESOLVE_FAILED' | 'UNEXPECTED_TOKEN';
3
- export declare type LinePos = {
2
+ export type ErrorCode = 'ALIAS_PROPS' | 'BAD_ALIAS' | 'BAD_DIRECTIVE' | 'BAD_DQ_ESCAPE' | 'BAD_INDENT' | 'BAD_PROP_ORDER' | 'BAD_SCALAR_START' | 'BLOCK_AS_IMPLICIT_KEY' | 'BLOCK_IN_FLOW' | 'DUPLICATE_KEY' | 'IMPOSSIBLE' | 'KEY_OVER_1024_CHARS' | 'MISSING_CHAR' | 'MULTILINE_IMPLICIT_KEY' | 'MULTIPLE_ANCHORS' | 'MULTIPLE_DOCS' | 'MULTIPLE_TAGS' | 'TAB_AS_INDENT' | 'TAG_RESOLVE_FAILED' | 'UNEXPECTED_TOKEN';
3
+ export type LinePos = {
4
4
  line: number;
5
5
  col: number;
6
6
  };
@@ -49,7 +49,7 @@ const prettifyError = (src, lc) => (error) => {
49
49
  let count = 1;
50
50
  const end = error.linePos[1];
51
51
  if (end && end.line === line && end.col > col) {
52
- count = Math.min(end.col - col, 80 - ci);
52
+ count = Math.max(1, Math.min(end.col - col, 80 - ci));
53
53
  }
54
54
  const pointer = ' '.repeat(ci) + '^'.repeat(count);
55
55
  error.message += `:\n\n${lineStr}\n${pointer}\n`;
@@ -16,4 +16,6 @@ export { Parser } from './parse/parser.js';
16
16
  export { EmptyStream, parse, parseAllDocuments, parseDocument, stringify } from './public-api.js';
17
17
  export type { TagId, Tags } from './schema/tags';
18
18
  export type { CollectionTag, ScalarTag } from './schema/types';
19
+ export type { YAMLOMap } from './schema/yaml-1.1/omap';
20
+ export type { YAMLSet } from './schema/yaml-1.1/set';
19
21
  export { asyncVisitor, asyncVisitorFn, visit, visitAsync, visitor, visitorFn } from './visit.js';
@@ -1,3 +1,3 @@
1
- export declare type LogLevelId = 'silent' | 'error' | 'warn' | 'debug';
1
+ export type LogLevelId = 'silent' | 'error' | 'warn' | 'debug';
2
2
  export declare function debug(logLevel: LogLevelId, ...messages: any[]): void;
3
3
  export declare function warn(logLevel: LogLevelId, warning: string | Error): void;
@@ -23,6 +23,6 @@ export declare class Alias extends NodeBase {
23
23
  * instance of the `source` anchor before this node.
24
24
  */
25
25
  resolve(doc: Document): Scalar | YAMLMap | YAMLSeq | undefined;
26
- toJSON(_arg?: unknown, ctx?: ToJSContext): unknown;
26
+ toJSON(_arg?: unknown, ctx?: ToJSContext): {} | null;
27
27
  toString(ctx?: StringifyContext, _onComment?: () => void, _onChompKeep?: () => void): string;
28
28
  }
@@ -1,7 +1,7 @@
1
1
  import type { Schema } from '../schema/Schema.js';
2
2
  import { NodeBase, NODE_TYPE } from './Node.js';
3
- export declare function collectionFromPath(schema: Schema, path: unknown[], value: unknown): import("./Node.js").Node;
4
- export declare const isEmptyPath: (path: Iterable<unknown> | null | undefined) => boolean;
3
+ export declare function collectionFromPath(schema: Schema, path: unknown[], value: unknown): import("./Node.js").Node<unknown>;
4
+ export declare const isEmptyPath: (path: Iterable<unknown> | null | undefined) => path is null | undefined;
5
5
  export declare abstract class Collection extends NodeBase {
6
6
  static maxFlowStringSingleLineLength: number;
7
7
  schema: Schema | undefined;
@@ -26,7 +26,8 @@ function collectionFromPath(schema, path, value) {
26
26
  sourceObjects: new Map()
27
27
  });
28
28
  }
29
- // null, undefined, or an empty non-string iterable (e.g. [])
29
+ // Type guard is intentionally a little wrong so as to be more useful,
30
+ // as it does not cover untypable empty non-string iterables (e.g. []).
30
31
  const isEmptyPath = (path) => path == null ||
31
32
  (typeof path === 'object' && !!path[Symbol.iterator]().next().done);
32
33
  class Collection extends Node.NodeBase {
@@ -6,9 +6,15 @@ import type { Pair } from './Pair.js';
6
6
  import type { Scalar } from './Scalar.js';
7
7
  import type { YAMLMap } from './YAMLMap.js';
8
8
  import type { YAMLSeq } from './YAMLSeq.js';
9
- export declare type Node = Alias | Scalar | YAMLMap | YAMLSeq;
10
- export declare type ParsedNode = Alias.Parsed | Scalar.Parsed | YAMLMap.Parsed | YAMLSeq.Parsed;
11
- export declare type Range = [number, number, number];
9
+ export type Node<T = unknown> = Alias | Scalar<T> | YAMLMap<unknown, T> | YAMLSeq<T>;
10
+ /** Utility type mapper */
11
+ export type NodeType<T> = T extends string | number | bigint | boolean | null ? Scalar<T> : T extends Array<any> ? YAMLSeq<NodeType<T[number]>> : T extends {
12
+ [key: string]: any;
13
+ } ? YAMLMap<NodeType<keyof T>, NodeType<T[keyof T]>> : T extends {
14
+ [key: number]: any;
15
+ } ? YAMLMap<NodeType<keyof T>, NodeType<T[keyof T]>> : Node;
16
+ export type ParsedNode = Alias.Parsed | Scalar.Parsed | YAMLMap.Parsed | YAMLSeq.Parsed;
17
+ export type Range = [number, number, number];
12
18
  export declare const ALIAS: unique symbol;
13
19
  export declare const DOC: unique symbol;
14
20
  export declare const MAP: unique symbol;
@@ -17,14 +23,14 @@ export declare const SCALAR: unique symbol;
17
23
  export declare const SEQ: unique symbol;
18
24
  export declare const NODE_TYPE: unique symbol;
19
25
  export declare const isAlias: (node: any) => node is Alias;
20
- export declare const isDocument: (node: any) => node is Document<unknown>;
21
- export declare const isMap: (node: any) => node is YAMLMap<unknown, unknown>;
22
- export declare const isPair: (node: any) => node is Pair<unknown, unknown>;
23
- export declare const isScalar: (node: any) => node is Scalar<unknown>;
24
- export declare const isSeq: (node: any) => node is YAMLSeq<unknown>;
25
- export declare function isCollection(node: any): node is YAMLMap | YAMLSeq;
26
- export declare function isNode(node: any): node is Node;
27
- export declare const hasAnchor: (node: unknown) => node is Scalar<unknown> | YAMLMap<unknown, unknown> | YAMLSeq<unknown>;
26
+ export declare const isDocument: <T extends Node<unknown> = Node<unknown>>(node: any) => node is Document<T>;
27
+ export declare const isMap: <K = unknown, V = unknown>(node: any) => node is YAMLMap<K, V>;
28
+ export declare const isPair: <K = unknown, V = unknown>(node: any) => node is Pair<K, V>;
29
+ export declare const isScalar: <T = unknown>(node: any) => node is Scalar<T>;
30
+ export declare const isSeq: <T = unknown>(node: any) => node is YAMLSeq<T>;
31
+ export declare function isCollection<K = unknown, V = unknown>(node: any): node is YAMLMap<K, V> | YAMLSeq<V>;
32
+ export declare function isNode<T = unknown>(node: any): node is Node<T>;
33
+ export declare const hasAnchor: <K = unknown, V = unknown>(node: unknown) => node is Scalar<V> | YAMLMap<K, V> | YAMLSeq<V>;
28
34
  export declare abstract class NodeBase {
29
35
  readonly [NODE_TYPE]: symbol;
30
36
  /** A comment on or immediately after this */
@@ -5,7 +5,7 @@ import type { StringifyContext } from '../stringify/stringify.js';
5
5
  import { addPairToJSMap } from './addPairToJSMap.js';
6
6
  import { NODE_TYPE } from './Node.js';
7
7
  import type { ToJSContext } from './toJS.js';
8
- export declare function createPair(key: unknown, value: unknown, ctx: CreateNodeContext): Pair<import("./Node.js").Node, import("./Alias.js").Alias | import("./Scalar.js").Scalar<unknown> | import("./YAMLMap.js").YAMLMap<unknown, unknown> | import("./YAMLSeq.js").YAMLSeq<unknown>>;
8
+ export declare function createPair(key: unknown, value: unknown, ctx: CreateNodeContext): Pair<import("./Node.js").Node<unknown>, import("./Alias.js").Alias | import("./Scalar.js").Scalar<unknown> | import("./YAMLMap.js").YAMLMap<unknown, unknown> | import("./YAMLSeq.js").YAMLSeq<unknown>>;
9
9
  export declare class Pair<K = unknown, V = unknown> {
10
10
  readonly [NODE_TYPE]: symbol;
11
11
  /** Always Node or null when parsed, but can be set to anything. */
@@ -25,11 +25,11 @@ class Pair {
25
25
  return new Pair(key, value);
26
26
  }
27
27
  toJSON(_, ctx) {
28
- const pair = (ctx === null || ctx === void 0 ? void 0 : ctx.mapAsMap) ? new Map() : {};
28
+ const pair = ctx?.mapAsMap ? new Map() : {};
29
29
  return addPairToJSMap.addPairToJSMap(ctx, pair, this);
30
30
  }
31
31
  toString(ctx, onComment, onChompKeep) {
32
- return (ctx === null || ctx === void 0 ? void 0 : ctx.doc)
32
+ return ctx?.doc
33
33
  ? stringifyPair.stringifyPair(this, ctx, onComment, onChompKeep)
34
34
  : JSON.stringify(this);
35
35
  }
@@ -10,7 +10,7 @@ class Scalar extends Node.NodeBase {
10
10
  this.value = value;
11
11
  }
12
12
  toJSON(arg, ctx) {
13
- return (ctx === null || ctx === void 0 ? void 0 : ctx.keep) ? this.value : toJS.toJS(this.value, arg, ctx);
13
+ return ctx?.keep ? this.value : toJS.toJS(this.value, arg, ctx);
14
14
  }
15
15
  toString() {
16
16
  return String(this.value);
@@ -4,7 +4,9 @@ import type { StringifyContext } from '../stringify/stringify.js';
4
4
  import { Collection } from './Collection.js';
5
5
  import { ParsedNode, Range } from './Node.js';
6
6
  import { Pair } from './Pair.js';
7
+ import { Scalar } from './Scalar.js';
7
8
  import type { ToJSContext } from './toJS.js';
9
+ export type MapLike = Map<unknown, unknown> | Set<unknown> | Record<string | number | symbol, unknown>;
8
10
  export declare function findPair<K = unknown, V = unknown>(items: Iterable<Pair<K, V>>, key: unknown): Pair<K, V> | undefined;
9
11
  export declare namespace YAMLMap {
10
12
  interface Parsed<K extends ParsedNode = ParsedNode, V extends ParsedNode | null = ParsedNode | null> extends YAMLMap<K, V> {
@@ -27,16 +29,18 @@ export declare class YAMLMap<K = unknown, V = unknown> extends Collection {
27
29
  key: K;
28
30
  value: V;
29
31
  }, overwrite?: boolean): void;
30
- delete(key: K): boolean;
31
- get(key: K, keepScalar?: boolean): unknown;
32
- has(key: K): boolean;
32
+ delete(key: unknown): boolean;
33
+ get(key: unknown, keepScalar: true): Scalar<V> | undefined;
34
+ get(key: unknown, keepScalar?: false): V | undefined;
35
+ get(key: unknown, keepScalar?: boolean): V | Scalar<V> | undefined;
36
+ has(key: unknown): boolean;
33
37
  set(key: K, value: V): void;
34
38
  /**
35
39
  * @param ctx - Conversion context, originally set in Document#toJS()
36
40
  * @param {Class} Type - If set, forces the returned collection type
37
41
  * @returns Instance of Type, Map, or Object
38
42
  */
39
- toJSON<T = unknown>(_?: unknown, ctx?: ToJSContext, Type?: {
43
+ toJSON<T extends MapLike = Map<unknown, unknown>>(_?: unknown, ctx?: ToJSContext, Type?: {
40
44
  new (): T;
41
45
  }): any;
42
46
  toString(ctx?: StringifyContext, onComment?: () => void, onChompKeep?: () => void): string;
@@ -20,13 +20,13 @@ function findPair(items, key) {
20
20
  return undefined;
21
21
  }
22
22
  class YAMLMap extends Collection.Collection {
23
+ static get tagName() {
24
+ return 'tag:yaml.org,2002:map';
25
+ }
23
26
  constructor(schema) {
24
27
  super(Node.MAP, schema);
25
28
  this.items = [];
26
29
  }
27
- static get tagName() {
28
- return 'tag:yaml.org,2002:map';
29
- }
30
30
  /**
31
31
  * Adds a value to the collection.
32
32
  *
@@ -34,18 +34,17 @@ class YAMLMap extends Collection.Collection {
34
34
  * collection will throw. Otherwise, overwrites the previous value.
35
35
  */
36
36
  add(pair, overwrite) {
37
- var _a;
38
37
  let _pair;
39
38
  if (Node.isPair(pair))
40
39
  _pair = pair;
41
40
  else if (!pair || typeof pair !== 'object' || !('key' in pair)) {
42
41
  // In TypeScript, this never happens.
43
- _pair = new Pair.Pair(pair, pair.value);
42
+ _pair = new Pair.Pair(pair, pair?.value);
44
43
  }
45
44
  else
46
45
  _pair = new Pair.Pair(pair.key, pair.value);
47
46
  const prev = findPair(this.items, _pair.key);
48
- const sortEntries = (_a = this.schema) === null || _a === void 0 ? void 0 : _a.sortMapEntries;
47
+ const sortEntries = this.schema?.sortMapEntries;
49
48
  if (prev) {
50
49
  if (!overwrite)
51
50
  throw new Error(`Key ${_pair.key} already set`);
@@ -75,8 +74,8 @@ class YAMLMap extends Collection.Collection {
75
74
  }
76
75
  get(key, keepScalar) {
77
76
  const it = findPair(this.items, key);
78
- const node = it === null || it === void 0 ? void 0 : it.value;
79
- return !keepScalar && Node.isScalar(node) ? node.value : node;
77
+ const node = it?.value;
78
+ return (!keepScalar && Node.isScalar(node) ? node.value : node) ?? undefined;
80
79
  }
81
80
  has(key) {
82
81
  return !!findPair(this.items, key);
@@ -90,8 +89,8 @@ class YAMLMap extends Collection.Collection {
90
89
  * @returns Instance of Type, Map, or Object
91
90
  */
92
91
  toJSON(_, ctx, Type) {
93
- const map = Type ? new Type() : (ctx === null || ctx === void 0 ? void 0 : ctx.mapAsMap) ? new Map() : {};
94
- if (ctx === null || ctx === void 0 ? void 0 : ctx.onCreate)
92
+ const map = Type ? new Type() : ctx?.mapAsMap ? new Map() : {};
93
+ if (ctx?.onCreate)
95
94
  ctx.onCreate(map);
96
95
  for (const item of this.items)
97
96
  addPairToJSMap.addPairToJSMap(ctx, map, item);
@@ -4,6 +4,7 @@ import type { StringifyContext } from '../stringify/stringify.js';
4
4
  import { Collection } from './Collection.js';
5
5
  import { ParsedNode, Range } from './Node.js';
6
6
  import type { Pair } from './Pair.js';
7
+ import { Scalar } from './Scalar.js';
7
8
  import { ToJSContext } from './toJS.js';
8
9
  export declare namespace YAMLSeq {
9
10
  interface Parsed<T extends ParsedNode | Pair<ParsedNode, ParsedNode | null> = ParsedNode> extends YAMLSeq<T> {
@@ -34,7 +35,9 @@ export declare class YAMLSeq<T = unknown> extends Collection {
34
35
  * `key` must contain a representation of an integer for this to succeed.
35
36
  * It may be wrapped in a `Scalar`.
36
37
  */
37
- get(key: unknown, keepScalar?: boolean): unknown;
38
+ get(key: unknown, keepScalar: true): Scalar<T> | undefined;
39
+ get(key: unknown, keepScalar?: false): T | undefined;
40
+ get(key: unknown, keepScalar?: boolean): T | Scalar<T> | undefined;
38
41
  /**
39
42
  * Checks if the collection includes a value with the key `key`.
40
43
  *
@@ -7,13 +7,13 @@ var Scalar = require('./Scalar.js');
7
7
  var toJS = require('./toJS.js');
8
8
 
9
9
  class YAMLSeq extends Collection.Collection {
10
+ static get tagName() {
11
+ return 'tag:yaml.org,2002:seq';
12
+ }
10
13
  constructor(schema) {
11
14
  super(Node.SEQ, schema);
12
15
  this.items = [];
13
16
  }
14
- static get tagName() {
15
- return 'tag:yaml.org,2002:seq';
16
- }
17
17
  add(value) {
18
18
  this.items.push(value);
19
19
  }
@@ -32,14 +32,6 @@ class YAMLSeq extends Collection.Collection {
32
32
  const del = this.items.splice(idx, 1);
33
33
  return del.length > 0;
34
34
  }
35
- /**
36
- * Returns item at `key`, or `undefined` if not found. By default unwraps
37
- * scalar values from their surrounding node; to disable set `keepScalar` to
38
- * `true` (collections are always returned intact).
39
- *
40
- * `key` must contain a representation of an integer for this to succeed.
41
- * It may be wrapped in a `Scalar`.
42
- */
43
35
  get(key, keepScalar) {
44
36
  const idx = asItemIndex(key);
45
37
  if (typeof idx !== 'number')
@@ -76,7 +68,7 @@ class YAMLSeq extends Collection.Collection {
76
68
  }
77
69
  toJSON(_, ctx) {
78
70
  const seq = [];
79
- if (ctx === null || ctx === void 0 ? void 0 : ctx.onCreate)
71
+ if (ctx?.onCreate)
80
72
  ctx.onCreate(seq);
81
73
  let i = 0;
82
74
  for (const item of this.items)
@@ -1,3 +1,4 @@
1
1
  import type { Pair } from './Pair.js';
2
2
  import { ToJSContext } from './toJS.js';
3
- export declare function addPairToJSMap(ctx: ToJSContext | undefined, map: Map<unknown, unknown> | Set<unknown> | Record<string | number | symbol, unknown>, { key, value }: Pair): Map<unknown, unknown> | Set<unknown> | Record<string | number | symbol, unknown>;
3
+ import type { MapLike } from './YAMLMap.js';
4
+ export declare function addPairToJSMap(ctx: ToJSContext | undefined, map: MapLike, { key, value }: Pair): MapLike;
@@ -8,7 +8,7 @@ var toJS = require('./toJS.js');
8
8
 
9
9
  const MERGE_KEY = '<<';
10
10
  function addPairToJSMap(ctx, map, { key, value }) {
11
- if ((ctx === null || ctx === void 0 ? void 0 : ctx.doc.schema.merge) && isMergeKey(key)) {
11
+ if (ctx?.doc.schema.merge && isMergeKey(key)) {
12
12
  value = Node.isAlias(value) ? value.resolve(ctx.doc) : value;
13
13
  if (Node.isSeq(value))
14
14
  for (const it of value.items)
@@ -31,7 +31,7 @@ function toJS(value, arg, ctx) {
31
31
  ctx.onCreate(res);
32
32
  return res;
33
33
  }
34
- if (typeof value === 'bigint' && !(ctx === null || ctx === void 0 ? void 0 : ctx.keep))
34
+ if (typeof value === 'bigint' && !ctx?.keep)
35
35
  return Number(value);
36
36
  return value;
37
37
  }
@@ -8,7 +8,7 @@ import type { LineCounter } from './parse/line-counter.js';
8
8
  import type { Schema } from './schema/Schema.js';
9
9
  import type { Tags } from './schema/tags.js';
10
10
  import type { CollectionTag, ScalarTag } from './schema/types.js';
11
- export declare type ParseOptions = {
11
+ export type ParseOptions = {
12
12
  /**
13
13
  * Whether integers should be parsed into BigInt rather than number values.
14
14
  *
@@ -56,12 +56,13 @@ export declare type ParseOptions = {
56
56
  */
57
57
  uniqueKeys?: boolean | ((a: ParsedNode, b: ParsedNode) => boolean);
58
58
  };
59
- export declare type DocumentOptions = {
59
+ export type DocumentOptions = {
60
60
  /**
61
+ * @internal
61
62
  * Used internally by Composer. If set and includes an explicit version,
62
63
  * that overrides the `version` option.
63
64
  */
64
- directives?: Directives;
65
+ _directives?: Directives;
65
66
  /**
66
67
  * Control the logging level during parsing
67
68
  *
@@ -75,7 +76,7 @@ export declare type DocumentOptions = {
75
76
  */
76
77
  version?: '1.1' | '1.2' | 'next';
77
78
  };
78
- export declare type SchemaOptions = {
79
+ export type SchemaOptions = {
79
80
  /**
80
81
  * When parsing, warn about compatibility issues with the given schema.
81
82
  * When stringifying, use scalar styles that are parsed correctly
@@ -132,7 +133,7 @@ export declare type SchemaOptions = {
132
133
  */
133
134
  toStringDefaults?: ToStringOptions;
134
135
  };
135
- export declare type CreateNodeOptions = {
136
+ export type CreateNodeOptions = {
136
137
  /**
137
138
  * During node construction, use anchors and aliases to keep strictly equal
138
139
  * non-null objects as equivalent in YAML.
@@ -162,7 +163,7 @@ export declare type CreateNodeOptions = {
162
163
  */
163
164
  tag?: string;
164
165
  };
165
- export declare type ToJSOptions = {
166
+ export type ToJSOptions = {
166
167
  /**
167
168
  * Use Map rather than Object to represent mappings.
168
169
  *
@@ -188,7 +189,7 @@ export declare type ToJSOptions = {
188
189
  */
189
190
  reviver?: Reviver;
190
191
  };
191
- export declare type ToStringOptions = {
192
+ export type ToStringOptions = {
192
193
  /**
193
194
  * Use block quote styles for scalar values where applicable.
194
195
  * Set to `false` to disable block quotes completely.
@@ -263,6 +264,13 @@ export declare type ToStringOptions = {
263
264
  * Default: `'false'`
264
265
  */
265
266
  falseStr?: string;
267
+ /**
268
+ * When true, a single space of padding will be added inside the delimiters
269
+ * of non-empty single-line flow collections.
270
+ *
271
+ * Default: `true`
272
+ */
273
+ flowCollectionPadding?: boolean;
266
274
  /**
267
275
  * The number of spaces to use when indenting code.
268
276
  *
@@ -40,7 +40,6 @@ function resolveAsScalar(token, strict = true, onError) {
40
40
  * @param context.type The preferred type of the scalar token. If undefined, the previous type of the `token` will be used, defaulting to `'PLAIN'`.
41
41
  */
42
42
  function createScalarToken(value, context) {
43
- var _a;
44
43
  const { implicitKey = false, indent, inFlow = false, offset = -1, type = 'PLAIN' } = context;
45
44
  const source = stringifyString.stringifyString({ type, value }, {
46
45
  implicitKey,
@@ -48,7 +47,7 @@ function createScalarToken(value, context) {
48
47
  inFlow,
49
48
  options: { blockQuote: true, lineWidth: -1 }
50
49
  });
51
- const end = (_a = context.end) !== null && _a !== void 0 ? _a : [
50
+ const end = context.end ?? [
52
51
  { type: 'newline', offset: -1, indent, source: '\n' }
53
52
  ];
54
53
  switch (source[0]) {
@@ -1,6 +1,6 @@
1
1
  import type { CollectionItem, Document } from './cst.js';
2
- export declare type VisitPath = readonly ['key' | 'value', number][];
3
- export declare type Visitor = (item: CollectionItem, path: VisitPath) => number | symbol | Visitor | void;
2
+ export type VisitPath = readonly ['key' | 'value', number][];
3
+ export type Visitor = (item: CollectionItem, path: VisitPath) => number | symbol | Visitor | void;
4
4
  /**
5
5
  * Apply a visitor to a CST document or item.
6
6
  *