@cdklabs/cdk-cicd-wrapper 0.2.15 → 0.2.17

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 (164) hide show
  1. package/.eslintrc.js +1 -1
  2. package/.jsii +6 -6
  3. package/lib/code-pipeline/AppStage.js +1 -1
  4. package/lib/code-pipeline/CDKPipeline.js +1 -1
  5. package/lib/code-pipeline/PostDeployBuildStep.js +1 -1
  6. package/lib/code-pipeline/PreDeployBuildStep.js +1 -1
  7. package/lib/common/spi/ResourceContext.js +1 -1
  8. package/lib/common/types/BaseStackProvider.js +1 -1
  9. package/lib/common/types/DefaultStackProvider.js +1 -1
  10. package/lib/common/types/Types.js +2 -2
  11. package/lib/constructs/CodeCommitRepositoryConstruct.js +1 -1
  12. package/lib/constructs/CodeStarConnectionConstruct.js +1 -1
  13. package/lib/plugins/index.js +1 -1
  14. package/lib/plugins/optimization/DestroyEncryptionKeysOnDeletePlugin.js +1 -1
  15. package/lib/plugins/pipeline/GitHubPipelinePlugin.js +1 -1
  16. package/lib/plugins/security/AccessLogsForBucketPlugin.js +1 -1
  17. package/lib/plugins/security/DisablePublicIPAssignmentForEC2Plugin.js +1 -1
  18. package/lib/plugins/security/EncryptBucketOnTransitPlugin.js +1 -1
  19. package/lib/plugins/security/EncryptCloudWatchLogGroupsPlugin.js +1 -1
  20. package/lib/plugins/security/EncryptSNSTopicOnTransitPlugin.js +1 -1
  21. package/lib/plugins/security/LambdaDLQPlugin.js +1 -1
  22. package/lib/plugins/security/RotateEncryptionKeysPlugin.js +1 -1
  23. package/lib/plugins/utils/CodeArtifactPlugin.js +1 -1
  24. package/lib/resource-providers/CIDefinitionProvider.js +2 -2
  25. package/lib/resource-providers/CodeBuildFactoryProvider.js +2 -2
  26. package/lib/resource-providers/ComplianceBucketProvider.js +1 -1
  27. package/lib/resource-providers/EncryptionProvider.js +1 -1
  28. package/lib/resource-providers/HooksProvider.js +2 -2
  29. package/lib/resource-providers/LoggingProvider.js +1 -1
  30. package/lib/resource-providers/ParameterProvider.js +1 -1
  31. package/lib/resource-providers/PhaseCommandProvider.js +6 -6
  32. package/lib/resource-providers/ProxyProvider.js +1 -1
  33. package/lib/resource-providers/RepositoryProvider.js +4 -4
  34. package/lib/resource-providers/StageProvider.js +1 -1
  35. package/lib/resource-providers/VPCProvider.js +1 -1
  36. package/lib/stacks/CodeStarConnectRepositoryStack.js +1 -1
  37. package/lib/stacks/EncryptionStack.js +1 -1
  38. package/lib/stacks/PipelineBlueprint.js +2 -2
  39. package/lib/stacks/PostDeployExecutorStack.js +1 -1
  40. package/lib/stacks/SSMParameterStack.js +1 -1
  41. package/lib/stacks/compliance-bucket/ComplianceBucketStack.js +1 -1
  42. package/lib/stacks/vpc/ManagedVPCStack.js +1 -1
  43. package/lib/stacks/vpc/NoVPCStack.js +1 -1
  44. package/lib/stacks/vpc/VPCFromLookUpStack.js +1 -1
  45. package/lib/utils/ParameterResolver.js +1 -1
  46. package/node_modules/yaml/README.md +44 -11
  47. package/node_modules/yaml/browser/dist/compose/compose-doc.js +1 -0
  48. package/node_modules/yaml/browser/dist/compose/compose-node.js +10 -0
  49. package/node_modules/yaml/browser/dist/compose/compose-scalar.js +14 -8
  50. package/node_modules/yaml/browser/dist/compose/resolve-block-map.js +2 -0
  51. package/node_modules/yaml/browser/dist/compose/resolve-block-seq.js +2 -0
  52. package/node_modules/yaml/browser/dist/compose/resolve-flow-collection.js +4 -0
  53. package/node_modules/yaml/browser/dist/compose/resolve-props.js +1 -1
  54. package/node_modules/yaml/browser/dist/compose/util-map-includes.js +1 -5
  55. package/node_modules/yaml/browser/dist/doc/Document.js +3 -2
  56. package/node_modules/yaml/browser/dist/log.js +1 -4
  57. package/node_modules/yaml/browser/dist/nodes/addPairToJSMap.js +7 -49
  58. package/node_modules/yaml/browser/dist/public-api.js +3 -0
  59. package/node_modules/yaml/browser/dist/schema/Schema.js +1 -2
  60. package/node_modules/yaml/browser/dist/schema/json/schema.js +1 -1
  61. package/node_modules/yaml/browser/dist/schema/tags.js +26 -13
  62. package/node_modules/yaml/browser/dist/schema/yaml-1.1/binary.js +2 -11
  63. package/node_modules/yaml/browser/dist/schema/yaml-1.1/merge.js +64 -0
  64. package/node_modules/yaml/browser/dist/schema/yaml-1.1/schema.js +2 -0
  65. package/node_modules/yaml/browser/dist/schema/yaml-1.1/timestamp.js +1 -1
  66. package/node_modules/yaml/browser/dist/stringify/stringify.js +6 -1
  67. package/node_modules/yaml/browser/dist/stringify/stringifyString.js +20 -11
  68. package/node_modules/yaml/browser/dist/util.js +1 -1
  69. package/node_modules/yaml/dist/compose/compose-collection.d.ts +4 -4
  70. package/node_modules/yaml/dist/compose/compose-doc.d.ts +6 -6
  71. package/node_modules/yaml/dist/compose/compose-doc.js +1 -0
  72. package/node_modules/yaml/dist/compose/compose-node.d.ts +8 -7
  73. package/node_modules/yaml/dist/compose/compose-node.js +10 -0
  74. package/node_modules/yaml/dist/compose/compose-scalar.d.ts +4 -4
  75. package/node_modules/yaml/dist/compose/compose-scalar.js +13 -7
  76. package/node_modules/yaml/dist/compose/composer.d.ts +7 -6
  77. package/node_modules/yaml/dist/compose/composer.js +2 -1
  78. package/node_modules/yaml/dist/compose/resolve-block-map.d.ts +5 -5
  79. package/node_modules/yaml/dist/compose/resolve-block-map.js +2 -0
  80. package/node_modules/yaml/dist/compose/resolve-block-scalar.d.ts +5 -5
  81. package/node_modules/yaml/dist/compose/resolve-block-seq.d.ts +5 -5
  82. package/node_modules/yaml/dist/compose/resolve-block-seq.js +2 -0
  83. package/node_modules/yaml/dist/compose/resolve-end.d.ts +2 -2
  84. package/node_modules/yaml/dist/compose/resolve-flow-collection.d.ts +7 -7
  85. package/node_modules/yaml/dist/compose/resolve-flow-collection.js +4 -0
  86. package/node_modules/yaml/dist/compose/resolve-flow-scalar.d.ts +4 -4
  87. package/node_modules/yaml/dist/compose/resolve-props.d.ts +2 -2
  88. package/node_modules/yaml/dist/compose/resolve-props.js +1 -1
  89. package/node_modules/yaml/dist/compose/util-contains-newline.d.ts +1 -1
  90. package/node_modules/yaml/dist/compose/util-empty-scalar-position.d.ts +1 -1
  91. package/node_modules/yaml/dist/compose/util-flow-indent-check.d.ts +2 -2
  92. package/node_modules/yaml/dist/compose/util-map-includes.d.ts +3 -3
  93. package/node_modules/yaml/dist/compose/util-map-includes.js +1 -5
  94. package/node_modules/yaml/dist/doc/Document.d.ts +11 -11
  95. package/node_modules/yaml/dist/doc/Document.js +3 -2
  96. package/node_modules/yaml/dist/doc/anchors.d.ts +2 -2
  97. package/node_modules/yaml/dist/doc/createNode.d.ts +4 -4
  98. package/node_modules/yaml/dist/doc/directives.d.ts +1 -1
  99. package/node_modules/yaml/dist/errors.d.ts +1 -1
  100. package/node_modules/yaml/dist/index.d.ts +21 -18
  101. package/node_modules/yaml/dist/log.js +4 -2
  102. package/node_modules/yaml/dist/nodes/Alias.d.ts +9 -8
  103. package/node_modules/yaml/dist/nodes/Collection.d.ts +4 -4
  104. package/node_modules/yaml/dist/nodes/Node.d.ts +15 -9
  105. package/node_modules/yaml/dist/nodes/Pair.d.ts +9 -8
  106. package/node_modules/yaml/dist/nodes/Scalar.d.ts +4 -3
  107. package/node_modules/yaml/dist/nodes/YAMLMap.d.ts +10 -10
  108. package/node_modules/yaml/dist/nodes/YAMLSeq.d.ts +10 -10
  109. package/node_modules/yaml/dist/nodes/addPairToJSMap.d.ts +3 -3
  110. package/node_modules/yaml/dist/nodes/addPairToJSMap.js +6 -48
  111. package/node_modules/yaml/dist/nodes/identity.d.ts +7 -7
  112. package/node_modules/yaml/dist/nodes/toJS.d.ts +2 -2
  113. package/node_modules/yaml/dist/options.d.ts +16 -10
  114. package/node_modules/yaml/dist/parse/cst-scalar.d.ts +4 -4
  115. package/node_modules/yaml/dist/parse/cst-stringify.d.ts +1 -1
  116. package/node_modules/yaml/dist/parse/cst-visit.d.ts +2 -2
  117. package/node_modules/yaml/dist/parse/cst.d.ts +4 -3
  118. package/node_modules/yaml/dist/parse/lexer.d.ts +1 -1
  119. package/node_modules/yaml/dist/parse/parser.d.ts +4 -4
  120. package/node_modules/yaml/dist/parse/parser.js +2 -1
  121. package/node_modules/yaml/dist/public-api.d.ts +6 -5
  122. package/node_modules/yaml/dist/public-api.js +3 -0
  123. package/node_modules/yaml/dist/schema/Schema.d.ts +4 -5
  124. package/node_modules/yaml/dist/schema/Schema.js +1 -2
  125. package/node_modules/yaml/dist/schema/common/map.d.ts +1 -1
  126. package/node_modules/yaml/dist/schema/common/null.d.ts +1 -1
  127. package/node_modules/yaml/dist/schema/common/seq.d.ts +1 -1
  128. package/node_modules/yaml/dist/schema/common/string.d.ts +1 -1
  129. package/node_modules/yaml/dist/schema/core/bool.d.ts +1 -1
  130. package/node_modules/yaml/dist/schema/core/float.d.ts +1 -1
  131. package/node_modules/yaml/dist/schema/core/int.d.ts +1 -1
  132. package/node_modules/yaml/dist/schema/core/schema.d.ts +1 -1
  133. package/node_modules/yaml/dist/schema/json/schema.d.ts +1 -1
  134. package/node_modules/yaml/dist/schema/json/schema.js +1 -1
  135. package/node_modules/yaml/dist/schema/tags.d.ts +11 -3
  136. package/node_modules/yaml/dist/schema/tags.js +26 -13
  137. package/node_modules/yaml/dist/schema/types.d.ts +14 -12
  138. package/node_modules/yaml/dist/schema/yaml-1.1/binary.d.ts +1 -1
  139. package/node_modules/yaml/dist/schema/yaml-1.1/binary.js +6 -5
  140. package/node_modules/yaml/dist/schema/yaml-1.1/bool.d.ts +1 -1
  141. package/node_modules/yaml/dist/schema/yaml-1.1/float.d.ts +1 -1
  142. package/node_modules/yaml/dist/schema/yaml-1.1/int.d.ts +1 -1
  143. package/node_modules/yaml/dist/schema/yaml-1.1/merge.d.ts +9 -0
  144. package/node_modules/yaml/dist/schema/yaml-1.1/merge.js +68 -0
  145. package/node_modules/yaml/dist/schema/yaml-1.1/omap.d.ts +11 -17
  146. package/node_modules/yaml/dist/schema/yaml-1.1/pairs.d.ts +7 -7
  147. package/node_modules/yaml/dist/schema/yaml-1.1/schema.d.ts +1 -1
  148. package/node_modules/yaml/dist/schema/yaml-1.1/schema.js +2 -0
  149. package/node_modules/yaml/dist/schema/yaml-1.1/set.d.ts +9 -9
  150. package/node_modules/yaml/dist/schema/yaml-1.1/timestamp.d.ts +1 -1
  151. package/node_modules/yaml/dist/schema/yaml-1.1/timestamp.js +1 -1
  152. package/node_modules/yaml/dist/stringify/stringify.d.ts +3 -3
  153. package/node_modules/yaml/dist/stringify/stringify.js +6 -1
  154. package/node_modules/yaml/dist/stringify/stringifyCollection.d.ts +2 -2
  155. package/node_modules/yaml/dist/stringify/stringifyDocument.d.ts +3 -3
  156. package/node_modules/yaml/dist/stringify/stringifyNumber.d.ts +1 -1
  157. package/node_modules/yaml/dist/stringify/stringifyPair.d.ts +2 -2
  158. package/node_modules/yaml/dist/stringify/stringifyString.d.ts +2 -2
  159. package/node_modules/yaml/dist/stringify/stringifyString.js +20 -11
  160. package/node_modules/yaml/dist/util.d.ts +16 -12
  161. package/node_modules/yaml/dist/util.js +2 -2
  162. package/node_modules/yaml/dist/visit.d.ts +7 -7
  163. package/node_modules/yaml/package.json +4 -4
  164. package/package.json +13 -13
@@ -1,12 +1,12 @@
1
- import { CreateNodeContext } from '../doc/createNode.js';
2
- import type { BlockSequence, FlowCollection } from '../parse/cst.js';
3
- import type { Schema } from '../schema/Schema.js';
4
- import type { StringifyContext } from '../stringify/stringify.js';
5
- import { Collection } from './Collection.js';
6
- import type { ParsedNode, Range } from './Node.js';
7
- import type { Pair } from './Pair.js';
8
- import { Scalar } from './Scalar.js';
9
- import { ToJSContext } from './toJS.js';
1
+ import type { CreateNodeContext } from '../doc/createNode';
2
+ import type { BlockSequence, FlowCollection } from '../parse/cst';
3
+ import type { Schema } from '../schema/Schema';
4
+ import type { StringifyContext } from '../stringify/stringify';
5
+ import { Collection } from './Collection';
6
+ import type { ParsedNode, Range } from './Node';
7
+ import type { Pair } from './Pair';
8
+ import type { Scalar } from './Scalar';
9
+ import type { ToJSContext } from './toJS';
10
10
  export declare namespace YAMLSeq {
11
11
  interface Parsed<T extends ParsedNode | Pair<ParsedNode, ParsedNode | null> = ParsedNode> extends YAMLSeq<T> {
12
12
  items: T[];
@@ -56,5 +56,5 @@ export declare class YAMLSeq<T = unknown> extends Collection {
56
56
  set(key: unknown, value: T): void;
57
57
  toJSON(_?: unknown, ctx?: ToJSContext): unknown[];
58
58
  toString(ctx?: StringifyContext, onComment?: () => void, onChompKeep?: () => void): string;
59
- static from(schema: Schema, obj: unknown, ctx: CreateNodeContext): YAMLSeq<unknown>;
59
+ static from(schema: Schema, obj: unknown, ctx: CreateNodeContext): YAMLSeq;
60
60
  }
@@ -1,4 +1,4 @@
1
- import type { Pair } from './Pair.js';
2
- import { ToJSContext } from './toJS.js';
3
- import type { MapLike } from './YAMLMap.js';
1
+ import type { Pair } from './Pair';
2
+ import type { ToJSContext } from './toJS';
3
+ import type { MapLike } from './YAMLMap';
4
4
  export declare function addPairToJSMap(ctx: ToJSContext | undefined, map: MapLike, { key, value }: Pair): MapLike;
@@ -1,24 +1,17 @@
1
1
  'use strict';
2
2
 
3
3
  var log = require('../log.js');
4
+ var merge = require('../schema/yaml-1.1/merge.js');
4
5
  var stringify = require('../stringify/stringify.js');
5
6
  var identity = require('./identity.js');
6
- var Scalar = require('./Scalar.js');
7
7
  var toJS = require('./toJS.js');
8
8
 
9
- const MERGE_KEY = '<<';
10
9
  function addPairToJSMap(ctx, map, { key, value }) {
11
- if (ctx?.doc.schema.merge && isMergeKey(key)) {
12
- value = identity.isAlias(value) ? value.resolve(ctx.doc) : value;
13
- if (identity.isSeq(value))
14
- for (const it of value.items)
15
- mergeToJSMap(ctx, map, it);
16
- else if (Array.isArray(value))
17
- for (const it of value)
18
- mergeToJSMap(ctx, map, it);
19
- else
20
- mergeToJSMap(ctx, map, value);
21
- }
10
+ if (identity.isNode(key) && key.addToJSMap)
11
+ key.addToJSMap(ctx, map, value);
12
+ // TODO: Should drop this special case for bare << handling
13
+ else if (merge.isMergeKey(ctx, key))
14
+ merge.addMergeToJSMap(ctx, map, value);
22
15
  else {
23
16
  const jsKey = toJS.toJS(key, '', ctx);
24
17
  if (map instanceof Map) {
@@ -43,41 +36,6 @@ function addPairToJSMap(ctx, map, { key, value }) {
43
36
  }
44
37
  return map;
45
38
  }
46
- const isMergeKey = (key) => key === MERGE_KEY ||
47
- (identity.isScalar(key) &&
48
- key.value === MERGE_KEY &&
49
- (!key.type || key.type === Scalar.Scalar.PLAIN));
50
- // If the value associated with a merge key is a single mapping node, each of
51
- // its key/value pairs is inserted into the current mapping, unless the key
52
- // already exists in it. If the value associated with the merge key is a
53
- // sequence, then this sequence is expected to contain mapping nodes and each
54
- // of these nodes is merged in turn according to its order in the sequence.
55
- // Keys in mapping nodes earlier in the sequence override keys specified in
56
- // later mapping nodes. -- http://yaml.org/type/merge.html
57
- function mergeToJSMap(ctx, map, value) {
58
- const source = ctx && identity.isAlias(value) ? value.resolve(ctx.doc) : value;
59
- if (!identity.isMap(source))
60
- throw new Error('Merge sources must be maps or map aliases');
61
- const srcMap = source.toJSON(null, ctx, Map);
62
- for (const [key, value] of srcMap) {
63
- if (map instanceof Map) {
64
- if (!map.has(key))
65
- map.set(key, value);
66
- }
67
- else if (map instanceof Set) {
68
- map.add(key);
69
- }
70
- else if (!Object.prototype.hasOwnProperty.call(map, key)) {
71
- Object.defineProperty(map, key, {
72
- value,
73
- writable: true,
74
- enumerable: true,
75
- configurable: true
76
- });
77
- }
78
- }
79
- return map;
80
- }
81
39
  function stringifyKey(key, jsKey, ctx) {
82
40
  if (jsKey === null)
83
41
  return '';
@@ -1,10 +1,10 @@
1
- import type { Document } from '../doc/Document.js';
2
- import type { Alias } from './Alias.js';
3
- import type { Node } from './Node.js';
4
- import type { Pair } from './Pair.js';
5
- import type { Scalar } from './Scalar.js';
6
- import type { YAMLMap } from './YAMLMap.js';
7
- import type { YAMLSeq } from './YAMLSeq.js';
1
+ import type { Document } from '../doc/Document';
2
+ import type { Alias } from './Alias';
3
+ import type { Node } from './Node';
4
+ import type { Pair } from './Pair';
5
+ import type { Scalar } from './Scalar';
6
+ import type { YAMLMap } from './YAMLMap';
7
+ import type { YAMLSeq } from './YAMLSeq';
8
8
  export declare const ALIAS: unique symbol;
9
9
  export declare const DOC: unique symbol;
10
10
  export declare const MAP: unique symbol;
@@ -1,5 +1,5 @@
1
- import type { Document } from '../doc/Document.js';
2
- import type { Node } from './Node.js';
1
+ import type { Document } from '../doc/Document';
2
+ import type { Node } from './Node';
3
3
  export interface AnchorData {
4
4
  aliasCount: number;
5
5
  count: number;
@@ -1,13 +1,13 @@
1
- import type { Reviver } from './doc/applyReviver.js';
2
- import type { Directives } from './doc/directives.js';
3
- import type { LogLevelId } from './log.js';
4
- import type { ParsedNode } from './nodes/Node.js';
5
- import type { Pair } from './nodes/Pair.js';
6
- import type { Scalar } from './nodes/Scalar.js';
7
- import type { LineCounter } from './parse/line-counter.js';
8
- import type { Schema } from './schema/Schema.js';
9
- import type { Tags } from './schema/tags.js';
10
- import type { CollectionTag, ScalarTag } from './schema/types.js';
1
+ import type { Reviver } from './doc/applyReviver';
2
+ import type { Directives } from './doc/directives';
3
+ import type { LogLevelId } from './log';
4
+ import type { ParsedNode } from './nodes/Node';
5
+ import type { Pair } from './nodes/Pair';
6
+ import type { Scalar } from './nodes/Scalar';
7
+ import type { LineCounter } from './parse/line-counter';
8
+ import type { Schema } from './schema/Schema';
9
+ import type { Tags } from './schema/tags';
10
+ import type { CollectionTag, ScalarTag } from './schema/types';
11
11
  export type ParseOptions = {
12
12
  /**
13
13
  * Whether integers should be parsed into BigInt rather than number values.
@@ -42,6 +42,12 @@ export type ParseOptions = {
42
42
  * Default: `true`
43
43
  */
44
44
  strict?: boolean;
45
+ /**
46
+ * Parse all mapping keys as strings. Treat all non-scalar keys as errors.
47
+ *
48
+ * Default: `false`
49
+ */
50
+ stringKeys?: boolean;
45
51
  /**
46
52
  * YAML requires map keys to be unique. By default, this is checked by
47
53
  * comparing scalar values with `===`; deep equality is not checked for
@@ -1,7 +1,7 @@
1
- import { ErrorCode } from '../errors.js';
2
- import { Range } from '../nodes/Node.js';
3
- import type { Scalar } from '../nodes/Scalar.js';
4
- import type { BlockScalar, FlowScalar, SourceToken, Token } from './cst.js';
1
+ import type { ErrorCode } from '../errors';
2
+ import type { Range } from '../nodes/Node';
3
+ import type { Scalar } from '../nodes/Scalar';
4
+ import type { BlockScalar, FlowScalar, SourceToken, Token } from './cst';
5
5
  /**
6
6
  * If `token` is a CST flow or block scalar, determine its string value and a few other attributes.
7
7
  * Otherwise, return `null`.
@@ -1,4 +1,4 @@
1
- import type { CollectionItem, Token } from './cst.js';
1
+ import type { CollectionItem, Token } from './cst';
2
2
  /**
3
3
  * Stringify a CST document, token, or collection item
4
4
  *
@@ -1,4 +1,4 @@
1
- import type { CollectionItem, Document } from './cst.js';
1
+ import type { BlockMap, BlockSequence, CollectionItem, Document, FlowCollection } from './cst';
2
2
  export type VisitPath = readonly ['key' | 'value', number][];
3
3
  export type Visitor = (item: CollectionItem, path: VisitPath) => number | symbol | Visitor | void;
4
4
  /**
@@ -35,5 +35,5 @@ export declare namespace visit {
35
35
  var SKIP: symbol;
36
36
  var REMOVE: symbol;
37
37
  var itemAtPath: (cst: Document | CollectionItem, path: VisitPath) => CollectionItem | undefined;
38
- var parentCollection: (cst: Document | CollectionItem, path: VisitPath) => import("./cst.js").BlockMap | import("./cst.js").BlockSequence | import("./cst.js").FlowCollection;
38
+ var parentCollection: (cst: Document | CollectionItem, path: VisitPath) => BlockMap | BlockSequence | FlowCollection;
39
39
  }
@@ -1,6 +1,7 @@
1
- export { createScalarToken, resolveAsScalar, setScalarValue } from './cst-scalar.js';
2
- export { stringify } from './cst-stringify.js';
3
- export { visit, Visitor, VisitPath } from './cst-visit.js';
1
+ export { createScalarToken, resolveAsScalar, setScalarValue } from './cst-scalar';
2
+ export { stringify } from './cst-stringify';
3
+ export type { Visitor, VisitPath } from './cst-visit';
4
+ export { visit } from './cst-visit';
4
5
  export interface SourceToken {
5
6
  type: 'byte-order-mark' | 'doc-mode' | 'doc-start' | 'space' | 'comment' | 'newline' | 'directive-line' | 'anchor' | 'tag' | 'seq-item-ind' | 'explicit-key-ind' | 'map-value-ind' | 'flow-map-start' | 'flow-map-end' | 'flow-seq-start' | 'flow-seq-end' | 'flow-error-end' | 'comma' | 'block-scalar-header';
6
7
  offset: number;
@@ -59,7 +59,7 @@ export declare class Lexer {
59
59
  *
60
60
  * @returns A generator of lexical tokens
61
61
  */
62
- lex(source: string, incomplete?: boolean): Generator<string, void, unknown>;
62
+ lex(source: string, incomplete?: boolean): Generator<string, void>;
63
63
  private atLineEnd;
64
64
  private charAt;
65
65
  private continueScalar;
@@ -1,4 +1,4 @@
1
- import { Token } from './cst.js';
1
+ import type { Token } from './cst';
2
2
  /**
3
3
  * A YAML concrete syntax tree (CST) parser
4
4
  *
@@ -57,14 +57,14 @@ export declare class Parser {
57
57
  *
58
58
  * @returns A generator of tokens representing each directive, document, and other structure.
59
59
  */
60
- parse(source: string, incomplete?: boolean): Generator<Token, void, unknown>;
60
+ parse(source: string, incomplete?: boolean): Generator<Token, void>;
61
61
  /**
62
62
  * Advance the parser by the `source` of one lexical token.
63
63
  */
64
- next(source: string): Generator<Token, void, unknown>;
64
+ next(source: string): Generator<Token, void>;
65
65
  private lexer;
66
66
  /** Call at end of input to push out any remaining constructions */
67
- end(): Generator<Token, void, unknown>;
67
+ end(): Generator<Token, void>;
68
68
  private get sourceToken();
69
69
  private step;
70
70
  private peek;
@@ -1,5 +1,6 @@
1
1
  'use strict';
2
2
 
3
+ var node_process = require('node:process');
3
4
  var cst = require('./cst.js');
4
5
  var lexer = require('./lexer.js');
5
6
 
@@ -166,7 +167,7 @@ class Parser {
166
167
  */
167
168
  *next(source) {
168
169
  this.source = source;
169
- if (process.env.LOG_TOKENS)
170
+ if (node_process.env.LOG_TOKENS)
170
171
  console.log('|', cst.prettyToken(source));
171
172
  if (this.atScalar) {
172
173
  this.atScalar = false;
@@ -1,8 +1,9 @@
1
- import { Composer } from './compose/composer.js';
2
- import type { Reviver } from './doc/applyReviver.js';
3
- import { Document, Replacer } from './doc/Document.js';
4
- import type { Node, ParsedNode } from './nodes/Node.js';
5
- import type { CreateNodeOptions, DocumentOptions, ParseOptions, SchemaOptions, ToJSOptions, ToStringOptions } from './options.js';
1
+ import { Composer } from './compose/composer';
2
+ import type { Reviver } from './doc/applyReviver';
3
+ import type { Replacer } from './doc/Document';
4
+ import { Document } from './doc/Document';
5
+ import type { Node, ParsedNode } from './nodes/Node';
6
+ import type { CreateNodeOptions, DocumentOptions, ParseOptions, SchemaOptions, ToJSOptions, ToStringOptions } from './options';
6
7
  export interface EmptyStream extends Array<Document.Parsed>, ReturnType<Composer['streamInfo']> {
7
8
  empty: true;
8
9
  }
@@ -4,6 +4,7 @@ var composer = require('./compose/composer.js');
4
4
  var Document = require('./doc/Document.js');
5
5
  var errors = require('./errors.js');
6
6
  var log = require('./log.js');
7
+ var identity = require('./nodes/identity.js');
7
8
  var lineCounter = require('./parse/line-counter.js');
8
9
  var parser = require('./parse/parser.js');
9
10
 
@@ -95,6 +96,8 @@ function stringify(value, replacer, options) {
95
96
  if (!keepUndefined)
96
97
  return undefined;
97
98
  }
99
+ if (identity.isDocument(value) && !_replacer)
100
+ return value.toString(options);
98
101
  return new Document.Document(value, _replacer, options).toString(options);
99
102
  }
100
103
 
@@ -1,11 +1,10 @@
1
- import { MAP, SCALAR, SEQ } from '../nodes/identity.js';
2
- import type { Pair } from '../nodes/Pair.js';
3
- import type { SchemaOptions, ToStringOptions } from '../options.js';
4
- import type { CollectionTag, ScalarTag } from './types.js';
1
+ import { MAP, SCALAR, SEQ } from '../nodes/identity';
2
+ import type { Pair } from '../nodes/Pair';
3
+ import type { SchemaOptions, ToStringOptions } from '../options';
4
+ import type { CollectionTag, ScalarTag } from './types';
5
5
  export declare class Schema {
6
6
  compat: Array<CollectionTag | ScalarTag> | null;
7
7
  knownTags: Record<string, CollectionTag | ScalarTag>;
8
- merge: boolean;
9
8
  name: string;
10
9
  sortMapEntries: ((a: Pair, b: Pair) => number) | null;
11
10
  tags: Array<CollectionTag | ScalarTag>;
@@ -14,10 +14,9 @@ class Schema {
14
14
  : compat
15
15
  ? tags.getTags(null, compat)
16
16
  : null;
17
- this.merge = !!merge;
18
17
  this.name = (typeof schema === 'string' && schema) || 'core';
19
18
  this.knownTags = resolveKnownTags ? tags.coreKnownTags : {};
20
- this.tags = tags.getTags(customTags, this.name);
19
+ this.tags = tags.getTags(customTags, this.name, merge);
21
20
  this.toStringOptions = toStringDefaults ?? null;
22
21
  Object.defineProperty(this, identity.MAP, { value: map.map });
23
22
  Object.defineProperty(this, identity.SCALAR, { value: string.string });
@@ -1,2 +1,2 @@
1
- import type { CollectionTag } from '../types.js';
1
+ import type { CollectionTag } from '../types';
2
2
  export declare const map: CollectionTag;
@@ -1,4 +1,4 @@
1
- import type { ScalarTag } from '../types.js';
1
+ import type { ScalarTag } from '../types';
2
2
  export declare const nullTag: ScalarTag & {
3
3
  test: RegExp;
4
4
  };
@@ -1,2 +1,2 @@
1
- import type { CollectionTag } from '../types.js';
1
+ import type { CollectionTag } from '../types';
2
2
  export declare const seq: CollectionTag;
@@ -1,2 +1,2 @@
1
- import type { ScalarTag } from '../types.js';
1
+ import type { ScalarTag } from '../types';
2
2
  export declare const string: ScalarTag;
@@ -1,4 +1,4 @@
1
- import type { ScalarTag } from '../types.js';
1
+ import type { ScalarTag } from '../types';
2
2
  export declare const boolTag: ScalarTag & {
3
3
  test: RegExp;
4
4
  };
@@ -1,4 +1,4 @@
1
- import type { ScalarTag } from '../types.js';
1
+ import type { ScalarTag } from '../types';
2
2
  export declare const floatNaN: ScalarTag;
3
3
  export declare const floatExp: ScalarTag;
4
4
  export declare const float: ScalarTag;
@@ -1,4 +1,4 @@
1
- import type { ScalarTag } from '../types.js';
1
+ import type { ScalarTag } from '../types';
2
2
  export declare const intOct: ScalarTag;
3
3
  export declare const int: ScalarTag;
4
4
  export declare const intHex: ScalarTag;
@@ -1 +1 @@
1
- export declare const schema: (import("../types.js").CollectionTag | import("../types.js").ScalarTag)[];
1
+ export declare const schema: (import('../types').CollectionTag | import('../types').ScalarTag)[];
@@ -1,2 +1,2 @@
1
- import { CollectionTag, ScalarTag } from '../types.js';
1
+ import type { CollectionTag, ScalarTag } from '../types';
2
2
  export declare const schema: (CollectionTag | ScalarTag)[];
@@ -29,7 +29,7 @@ const jsonScalars = [
29
29
  identify: value => typeof value === 'boolean',
30
30
  default: true,
31
31
  tag: 'tag:yaml.org,2002:bool',
32
- test: /^true|false$/,
32
+ test: /^true$|^false$/,
33
33
  resolve: str => str === 'true',
34
34
  stringify: stringifyJSON
35
35
  },
@@ -1,5 +1,5 @@
1
- import { SchemaOptions } from '../options.js';
2
- import type { CollectionTag, ScalarTag } from './types.js';
1
+ import type { SchemaOptions } from '../options';
2
+ import type { CollectionTag, ScalarTag } from './types';
3
3
  declare const tagsByName: {
4
4
  binary: ScalarTag;
5
5
  bool: ScalarTag & {
@@ -14,6 +14,10 @@ declare const tagsByName: {
14
14
  intOct: ScalarTag;
15
15
  intTime: ScalarTag;
16
16
  map: CollectionTag;
17
+ merge: ScalarTag & {
18
+ identify(value: unknown): boolean;
19
+ test: RegExp;
20
+ };
17
21
  null: ScalarTag & {
18
22
  test: RegExp;
19
23
  };
@@ -29,6 +33,10 @@ export type TagId = keyof typeof tagsByName;
29
33
  export type Tags = Array<ScalarTag | CollectionTag | TagId>;
30
34
  export declare const coreKnownTags: {
31
35
  'tag:yaml.org,2002:binary': ScalarTag;
36
+ 'tag:yaml.org,2002:merge': ScalarTag & {
37
+ identify(value: unknown): boolean;
38
+ test: RegExp;
39
+ };
32
40
  'tag:yaml.org,2002:omap': CollectionTag;
33
41
  'tag:yaml.org,2002:pairs': CollectionTag;
34
42
  'tag:yaml.org,2002:set': CollectionTag;
@@ -36,5 +44,5 @@ export declare const coreKnownTags: {
36
44
  test: RegExp;
37
45
  };
38
46
  };
39
- export declare function getTags(customTags: SchemaOptions['customTags'] | undefined, schemaName: string): (CollectionTag | ScalarTag)[];
47
+ export declare function getTags(customTags: SchemaOptions['customTags'] | undefined, schemaName: string, addMergeTag?: boolean): (CollectionTag | ScalarTag)[];
40
48
  export {};
@@ -10,6 +10,7 @@ var int = require('./core/int.js');
10
10
  var schema = require('./core/schema.js');
11
11
  var schema$1 = require('./json/schema.js');
12
12
  var binary = require('./yaml-1.1/binary.js');
13
+ var merge = require('./yaml-1.1/merge.js');
13
14
  var omap = require('./yaml-1.1/omap.js');
14
15
  var pairs = require('./yaml-1.1/pairs.js');
15
16
  var schema$2 = require('./yaml-1.1/schema.js');
@@ -35,6 +36,7 @@ const tagsByName = {
35
36
  intOct: int.intOct,
36
37
  intTime: timestamp.intTime,
37
38
  map: map.map,
39
+ merge: merge.merge,
38
40
  null: _null.nullTag,
39
41
  omap: omap.omap,
40
42
  pairs: pairs.pairs,
@@ -44,13 +46,20 @@ const tagsByName = {
44
46
  };
45
47
  const coreKnownTags = {
46
48
  'tag:yaml.org,2002:binary': binary.binary,
49
+ 'tag:yaml.org,2002:merge': merge.merge,
47
50
  'tag:yaml.org,2002:omap': omap.omap,
48
51
  'tag:yaml.org,2002:pairs': pairs.pairs,
49
52
  'tag:yaml.org,2002:set': set.set,
50
53
  'tag:yaml.org,2002:timestamp': timestamp.timestamp
51
54
  };
52
- function getTags(customTags, schemaName) {
53
- let tags = schemas.get(schemaName);
55
+ function getTags(customTags, schemaName, addMergeTag) {
56
+ const schemaTags = schemas.get(schemaName);
57
+ if (schemaTags && !customTags) {
58
+ return addMergeTag && !schemaTags.includes(merge.merge)
59
+ ? schemaTags.concat(merge.merge)
60
+ : schemaTags.slice();
61
+ }
62
+ let tags = schemaTags;
54
63
  if (!tags) {
55
64
  if (Array.isArray(customTags))
56
65
  tags = [];
@@ -69,17 +78,21 @@ function getTags(customTags, schemaName) {
69
78
  else if (typeof customTags === 'function') {
70
79
  tags = customTags(tags.slice());
71
80
  }
72
- return tags.map(tag => {
73
- if (typeof tag !== 'string')
74
- return tag;
75
- const tagObj = tagsByName[tag];
76
- if (tagObj)
77
- return tagObj;
78
- const keys = Object.keys(tagsByName)
79
- .map(key => JSON.stringify(key))
80
- .join(', ');
81
- throw new Error(`Unknown custom tag "${tag}"; use one of ${keys}`);
82
- });
81
+ if (addMergeTag)
82
+ tags = tags.concat(merge.merge);
83
+ return tags.reduce((tags, tag) => {
84
+ const tagObj = typeof tag === 'string' ? tagsByName[tag] : tag;
85
+ if (!tagObj) {
86
+ const tagName = JSON.stringify(tag);
87
+ const keys = Object.keys(tagsByName)
88
+ .map(key => JSON.stringify(key))
89
+ .join(', ');
90
+ throw new Error(`Unknown custom tag ${tagName}; use one of ${keys}`);
91
+ }
92
+ if (!tags.includes(tagObj))
93
+ tags.push(tagObj);
94
+ return tags;
95
+ }, []);
83
96
  }
84
97
 
85
98
  exports.coreKnownTags = coreKnownTags;
@@ -1,22 +1,24 @@
1
- import type { CreateNodeContext } from '../doc/createNode.js';
2
- import type { Node } from '../nodes/Node.js';
3
- import type { Scalar } from '../nodes/Scalar.js';
4
- import type { YAMLMap } from '../nodes/YAMLMap.js';
5
- import type { YAMLSeq } from '../nodes/YAMLSeq.js';
6
- import type { ParseOptions } from '../options.js';
7
- import type { StringifyContext } from '../stringify/stringify.js';
8
- import type { Schema } from './Schema.js';
1
+ import type { CreateNodeContext } from '../doc/createNode';
2
+ import type { Node } from '../nodes/Node';
3
+ import type { Scalar } from '../nodes/Scalar';
4
+ import type { YAMLMap } from '../nodes/YAMLMap';
5
+ import type { YAMLSeq } from '../nodes/YAMLSeq';
6
+ import type { ParseOptions } from '../options';
7
+ import type { StringifyContext } from '../stringify/stringify';
8
+ import type { Schema } from './Schema';
9
9
  interface TagBase {
10
10
  /**
11
11
  * An optional factory function, used e.g. by collections when wrapping JS objects as AST nodes.
12
12
  */
13
13
  createNode?: (schema: Schema, value: unknown, ctx: CreateNodeContext) => Node;
14
14
  /**
15
- * If `true`, together with `test` allows for values to be stringified without
16
- * an explicit tag. For most cases, it's unlikely that you'll actually want to
17
- * use this, even if you first think you do.
15
+ * If `true`, allows for values to be stringified without
16
+ * an explicit tag together with `test`.
17
+ * If `'key'`, this only applies if the value is used as a mapping key.
18
+ * For most cases, it's unlikely that you'll actually want to use this,
19
+ * even if you first think you do.
18
20
  */
19
- default?: boolean;
21
+ default?: boolean | 'key';
20
22
  /**
21
23
  * If a tag has multiple forms that should be parsed and/or stringified
22
24
  * differently, use `format` to identify them.
@@ -1,2 +1,2 @@
1
- import type { ScalarTag } from '../types.js';
1
+ import type { ScalarTag } from '../types';
2
2
  export declare const binary: ScalarTag;
@@ -1,5 +1,6 @@
1
1
  'use strict';
2
2
 
3
+ var node_buffer = require('node:buffer');
3
4
  var Scalar = require('../../nodes/Scalar.js');
4
5
  var stringifyString = require('../../stringify/stringifyString.js');
5
6
 
@@ -16,8 +17,8 @@ const binary = {
16
17
  * document.querySelector('#photo').src = URL.createObjectURL(blob)
17
18
  */
18
19
  resolve(src, onError) {
19
- if (typeof Buffer === 'function') {
20
- return Buffer.from(src, 'base64');
20
+ if (typeof node_buffer.Buffer === 'function') {
21
+ return node_buffer.Buffer.from(src, 'base64');
21
22
  }
22
23
  else if (typeof atob === 'function') {
23
24
  // On IE 11, atob() can't handle newlines
@@ -35,11 +36,11 @@ const binary = {
35
36
  stringify({ comment, type, value }, ctx, onComment, onChompKeep) {
36
37
  const buf = value; // checked earlier by binary.identify()
37
38
  let str;
38
- if (typeof Buffer === 'function') {
39
+ if (typeof node_buffer.Buffer === 'function') {
39
40
  str =
40
- buf instanceof Buffer
41
+ buf instanceof node_buffer.Buffer
41
42
  ? buf.toString('base64')
42
- : Buffer.from(buf.buffer).toString('base64');
43
+ : node_buffer.Buffer.from(buf.buffer).toString('base64');
43
44
  }
44
45
  else if (typeof btoa === 'function') {
45
46
  let s = '';
@@ -1,4 +1,4 @@
1
- import type { ScalarTag } from '../types.js';
1
+ import type { ScalarTag } from '../types';
2
2
  export declare const trueTag: ScalarTag & {
3
3
  test: RegExp;
4
4
  };
@@ -1,4 +1,4 @@
1
- import type { ScalarTag } from '../types.js';
1
+ import type { ScalarTag } from '../types';
2
2
  export declare const floatNaN: ScalarTag;
3
3
  export declare const floatExp: ScalarTag;
4
4
  export declare const float: ScalarTag;
@@ -1,4 +1,4 @@
1
- import type { ScalarTag } from '../types.js';
1
+ import type { ScalarTag } from '../types';
2
2
  export declare const intBin: ScalarTag;
3
3
  export declare const intOct: ScalarTag;
4
4
  export declare const int: ScalarTag;
@@ -0,0 +1,9 @@
1
+ import type { ToJSContext } from '../../nodes/toJS';
2
+ import type { MapLike } from '../../nodes/YAMLMap';
3
+ import type { ScalarTag } from '../types';
4
+ export declare const merge: ScalarTag & {
5
+ identify(value: unknown): boolean;
6
+ test: RegExp;
7
+ };
8
+ export declare const isMergeKey: (ctx: ToJSContext | undefined, key: unknown) => boolean | undefined;
9
+ export declare function addMergeToJSMap(ctx: ToJSContext | undefined, map: MapLike, value: unknown): void;