@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,6 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var Alias = require('../nodes/Alias.js');
4
+ var identity = require('../nodes/identity.js');
4
5
  var composeCollection = require('./compose-collection.js');
5
6
  var composeScalar = require('./compose-scalar.js');
6
7
  var resolveEnd = require('./resolve-end.js');
@@ -8,6 +9,7 @@ var utilEmptyScalarPosition = require('./util-empty-scalar-position.js');
8
9
 
9
10
  const CN = { composeNode, composeEmptyNode };
10
11
  function composeNode(ctx, token, props, onError) {
12
+ const atKey = ctx.atKey;
11
13
  const { spaceBefore, comment, anchor, tag } = props;
12
14
  let node;
13
15
  let isSrcToken = true;
@@ -43,6 +45,14 @@ function composeNode(ctx, token, props, onError) {
43
45
  }
44
46
  if (anchor && node.anchor === '')
45
47
  onError(anchor, 'BAD_ALIAS', 'Anchor cannot be an empty string');
48
+ if (atKey &&
49
+ ctx.options.stringKeys &&
50
+ (!identity.isScalar(node) ||
51
+ typeof node.value !== 'string' ||
52
+ (node.tag && node.tag !== 'tag:yaml.org,2002:str'))) {
53
+ const msg = 'With stringKeys, all keys must be strings';
54
+ onError(tag ?? token, 'NON_STRING_KEY', msg);
55
+ }
46
56
  if (spaceBefore)
47
57
  node.spaceBefore = true;
48
58
  if (comment) {
@@ -1,5 +1,5 @@
1
- import { Scalar } from '../nodes/Scalar.js';
2
- import type { BlockScalar, FlowScalar, SourceToken } from '../parse/cst.js';
3
- import type { ComposeContext } from './compose-node.js';
4
- import type { ComposeErrorHandler } from './composer.js';
1
+ import { Scalar } from '../nodes/Scalar';
2
+ import type { BlockScalar, FlowScalar, SourceToken } from '../parse/cst';
3
+ import type { ComposeContext } from './compose-node';
4
+ import type { ComposeErrorHandler } from './composer';
5
5
  export declare function composeScalar(ctx: ComposeContext, token: FlowScalar | BlockScalar, tagToken: SourceToken | null, onError: ComposeErrorHandler): Scalar.Parsed;
@@ -12,11 +12,16 @@ function composeScalar(ctx, token, tagToken, onError) {
12
12
  const tagName = tagToken
13
13
  ? ctx.directives.tagName(tagToken.source, msg => onError(tagToken, 'TAG_RESOLVE_FAILED', msg))
14
14
  : null;
15
- const tag = tagToken && tagName
16
- ? findScalarTagByName(ctx.schema, value, tagName, tagToken, onError)
17
- : token.type === 'scalar'
18
- ? findScalarTagByTest(ctx, value, token, onError)
19
- : ctx.schema[identity.SCALAR];
15
+ let tag;
16
+ if (ctx.options.stringKeys && ctx.atKey) {
17
+ tag = ctx.schema[identity.SCALAR];
18
+ }
19
+ else if (tagName)
20
+ tag = findScalarTagByName(ctx.schema, value, tagName, tagToken, onError);
21
+ else if (token.type === 'scalar')
22
+ tag = findScalarTagByTest(ctx, value, token, onError);
23
+ else
24
+ tag = ctx.schema[identity.SCALAR];
20
25
  let scalar;
21
26
  try {
22
27
  const res = tag.resolve(value, msg => onError(tagToken ?? token, 'TAG_RESOLVE_FAILED', msg), ctx.options);
@@ -64,8 +69,9 @@ function findScalarTagByName(schema, value, tagName, tagToken, onError) {
64
69
  onError(tagToken, 'TAG_RESOLVE_FAILED', `Unresolved tag: ${tagName}`, tagName !== 'tag:yaml.org,2002:str');
65
70
  return schema[identity.SCALAR];
66
71
  }
67
- function findScalarTagByTest({ directives, schema }, value, token, onError) {
68
- const tag = schema.tags.find(tag => tag.default && tag.test?.test(value)) || schema[identity.SCALAR];
72
+ function findScalarTagByTest({ atKey, directives, schema }, value, token, onError) {
73
+ const tag = schema.tags.find(tag => (tag.default === true || (atKey && tag.default === 'key')) &&
74
+ tag.test?.test(value)) || schema[identity.SCALAR];
69
75
  if (schema.compat) {
70
76
  const compat = schema.compat.find(tag => tag.default && tag.test?.test(value)) ??
71
77
  schema[identity.SCALAR];
@@ -1,9 +1,10 @@
1
- import { Directives } from '../doc/directives.js';
2
- import { Document } from '../doc/Document.js';
3
- import { ErrorCode, YAMLParseError, YAMLWarning } from '../errors.js';
4
- import type { ParsedNode, Range } from '../nodes/Node.js';
5
- import type { DocumentOptions, ParseOptions, SchemaOptions } from '../options.js';
6
- import type { Token } from '../parse/cst.js';
1
+ import { Directives } from '../doc/directives';
2
+ import { Document } from '../doc/Document';
3
+ import type { ErrorCode } from '../errors';
4
+ import { YAMLParseError, YAMLWarning } from '../errors';
5
+ import type { ParsedNode, Range } from '../nodes/Node';
6
+ import type { DocumentOptions, ParseOptions, SchemaOptions } from '../options';
7
+ import type { Token } from '../parse/cst';
7
8
  type ErrorSource = number | [number, number] | Range | {
8
9
  offset: number;
9
10
  source?: string;
@@ -1,5 +1,6 @@
1
1
  'use strict';
2
2
 
3
+ var node_process = require('node:process');
3
4
  var directives = require('../doc/directives.js');
4
5
  var Document = require('../doc/Document.js');
5
6
  var errors = require('../errors.js');
@@ -133,7 +134,7 @@ class Composer {
133
134
  }
134
135
  /** Advance the composer by one CST token. */
135
136
  *next(token) {
136
- if (process.env.LOG_STREAM)
137
+ if (node_process.env.LOG_STREAM)
137
138
  console.dir(token, { depth: null });
138
139
  switch (token.type) {
139
140
  case 'directive':
@@ -1,6 +1,6 @@
1
- import { YAMLMap } from '../nodes/YAMLMap.js';
2
- import type { BlockMap } from '../parse/cst.js';
3
- import { CollectionTag } from '../schema/types.js';
4
- import type { ComposeContext, ComposeNode } from './compose-node.js';
5
- import type { ComposeErrorHandler } from './composer.js';
1
+ import { YAMLMap } from '../nodes/YAMLMap';
2
+ import type { BlockMap } from '../parse/cst';
3
+ import type { CollectionTag } from '../schema/types';
4
+ import type { ComposeContext, ComposeNode } from './compose-node';
5
+ import type { ComposeErrorHandler } from './composer';
6
6
  export declare function resolveBlockMap({ composeNode, composeEmptyNode }: ComposeNode, ctx: ComposeContext, bm: BlockMap, onError: ComposeErrorHandler, tag?: CollectionTag): YAMLMap.Parsed;
@@ -52,12 +52,14 @@ function resolveBlockMap({ composeNode, composeEmptyNode }, ctx, bm, onError, ta
52
52
  onError(offset, 'BAD_INDENT', startColMsg);
53
53
  }
54
54
  // key value
55
+ ctx.atKey = true;
55
56
  const keyStart = keyProps.end;
56
57
  const keyNode = key
57
58
  ? composeNode(ctx, key, keyProps, onError)
58
59
  : composeEmptyNode(ctx, keyStart, start, null, keyProps, onError);
59
60
  if (ctx.schema.compat)
60
61
  utilFlowIndentCheck.flowIndentCheck(bm.indent, key, onError);
62
+ ctx.atKey = false;
61
63
  if (utilMapIncludes.mapIncludes(ctx, map.items, keyNode))
62
64
  onError(keyStart, 'DUPLICATE_KEY', 'Map keys must be unique');
63
65
  // value properties
@@ -1,8 +1,8 @@
1
- import { Range } from '../nodes/Node.js';
2
- import { Scalar } from '../nodes/Scalar.js';
3
- import type { BlockScalar } from '../parse/cst.js';
4
- import type { ComposeContext } from './compose-node.js';
5
- import type { ComposeErrorHandler } from './composer.js';
1
+ import type { Range } from '../nodes/Node';
2
+ import { Scalar } from '../nodes/Scalar';
3
+ import type { BlockScalar } from '../parse/cst';
4
+ import type { ComposeContext } from './compose-node';
5
+ import type { ComposeErrorHandler } from './composer';
6
6
  export declare function resolveBlockScalar(ctx: ComposeContext, scalar: BlockScalar, onError: ComposeErrorHandler): {
7
7
  value: string;
8
8
  type: Scalar.BLOCK_FOLDED | Scalar.BLOCK_LITERAL | null;
@@ -1,6 +1,6 @@
1
- import { YAMLSeq } from '../nodes/YAMLSeq.js';
2
- import type { BlockSequence } from '../parse/cst.js';
3
- import { CollectionTag } from '../schema/types.js';
4
- import type { ComposeContext, ComposeNode } from './compose-node.js';
5
- import type { ComposeErrorHandler } from './composer.js';
1
+ import { YAMLSeq } from '../nodes/YAMLSeq';
2
+ import type { BlockSequence } from '../parse/cst';
3
+ import type { CollectionTag } from '../schema/types';
4
+ import type { ComposeContext, ComposeNode } from './compose-node';
5
+ import type { ComposeErrorHandler } from './composer';
6
6
  export declare function resolveBlockSeq({ composeNode, composeEmptyNode }: ComposeNode, ctx: ComposeContext, bs: BlockSequence, onError: ComposeErrorHandler, tag?: CollectionTag): YAMLSeq.Parsed;
@@ -9,6 +9,8 @@ function resolveBlockSeq({ composeNode, composeEmptyNode }, ctx, bs, onError, ta
9
9
  const seq = new NodeClass(ctx.schema);
10
10
  if (ctx.atRoot)
11
11
  ctx.atRoot = false;
12
+ if (ctx.atKey)
13
+ ctx.atKey = false;
12
14
  let offset = bs.offset;
13
15
  let commentEnd = null;
14
16
  for (const { start, value } of bs.items) {
@@ -1,5 +1,5 @@
1
- import type { SourceToken } from '../parse/cst.js';
2
- import type { ComposeErrorHandler } from './composer.js';
1
+ import type { SourceToken } from '../parse/cst';
2
+ import type { ComposeErrorHandler } from './composer';
3
3
  export declare function resolveEnd(end: SourceToken[] | undefined, offset: number, reqSpace: boolean, onError: ComposeErrorHandler): {
4
4
  comment: string;
5
5
  offset: number;
@@ -1,7 +1,7 @@
1
- import { YAMLMap } from '../nodes/YAMLMap.js';
2
- import { YAMLSeq } from '../nodes/YAMLSeq.js';
3
- import type { FlowCollection } from '../parse/cst.js';
4
- import { CollectionTag } from '../schema/types.js';
5
- import type { ComposeContext, ComposeNode } from './compose-node.js';
6
- import type { ComposeErrorHandler } from './composer.js';
7
- export declare function resolveFlowCollection({ composeNode, composeEmptyNode }: ComposeNode, ctx: ComposeContext, fc: FlowCollection, onError: ComposeErrorHandler, tag?: CollectionTag): YAMLMap.Parsed<import("../index.js").ParsedNode, import("../index.js").ParsedNode | null> | YAMLSeq.Parsed<import("../index.js").ParsedNode>;
1
+ import { YAMLMap } from '../nodes/YAMLMap';
2
+ import { YAMLSeq } from '../nodes/YAMLSeq';
3
+ import type { FlowCollection } from '../parse/cst';
4
+ import type { CollectionTag } from '../schema/types';
5
+ import type { ComposeContext, ComposeNode } from './compose-node';
6
+ import type { ComposeErrorHandler } from './composer';
7
+ export declare function resolveFlowCollection({ composeNode, composeEmptyNode }: ComposeNode, ctx: ComposeContext, fc: FlowCollection, onError: ComposeErrorHandler, tag?: CollectionTag): YAMLMap.Parsed<import('../index').ParsedNode, import('../index').ParsedNode | null> | YAMLSeq.Parsed<import('../index').ParsedNode>;
@@ -20,6 +20,8 @@ function resolveFlowCollection({ composeNode, composeEmptyNode }, ctx, fc, onErr
20
20
  const atRoot = ctx.atRoot;
21
21
  if (atRoot)
22
22
  ctx.atRoot = false;
23
+ if (ctx.atKey)
24
+ ctx.atKey = false;
23
25
  let offset = fc.offset + fc.start.source.length;
24
26
  for (let i = 0; i < fc.items.length; ++i) {
25
27
  const collItem = fc.items[i];
@@ -99,12 +101,14 @@ function resolveFlowCollection({ composeNode, composeEmptyNode }, ctx, fc, onErr
99
101
  else {
100
102
  // item is a key+value pair
101
103
  // key value
104
+ ctx.atKey = true;
102
105
  const keyStart = props.end;
103
106
  const keyNode = key
104
107
  ? composeNode(ctx, key, props, onError)
105
108
  : composeEmptyNode(ctx, keyStart, start, null, props, onError);
106
109
  if (isBlock(key))
107
110
  onError(keyNode.range, 'BLOCK_IN_FLOW', blockMsg);
111
+ ctx.atKey = false;
108
112
  // value properties
109
113
  const valueProps = resolveProps.resolveProps(sep ?? [], {
110
114
  flow: fcName,
@@ -1,7 +1,7 @@
1
- import { Range } from '../nodes/Node.js';
2
- import { Scalar } from '../nodes/Scalar.js';
3
- import type { FlowScalar } from '../parse/cst.js';
4
- import type { ComposeErrorHandler } from './composer.js';
1
+ import type { Range } from '../nodes/Node';
2
+ import { Scalar } from '../nodes/Scalar';
3
+ import type { FlowScalar } from '../parse/cst';
4
+ import type { ComposeErrorHandler } from './composer';
5
5
  export declare function resolveFlowScalar(scalar: FlowScalar, strict: boolean, onError: ComposeErrorHandler): {
6
6
  value: string;
7
7
  type: Scalar.PLAIN | Scalar.QUOTE_DOUBLE | Scalar.QUOTE_SINGLE | null;
@@ -1,5 +1,5 @@
1
- import type { SourceToken, Token } from '../parse/cst.js';
2
- import type { ComposeErrorHandler } from './composer.js';
1
+ import type { SourceToken, Token } from '../parse/cst';
2
+ import type { ComposeErrorHandler } from './composer';
3
3
  export interface ResolvePropsArg {
4
4
  flow?: 'flow map' | 'flow sequence';
5
5
  indicator: 'doc-start' | 'explicit-key-ind' | 'map-value-ind' | 'seq-item-ind';
@@ -57,7 +57,7 @@ function resolveProps(tokens, { flow, indicator, next, offset, onError, parentIn
57
57
  if (atNewline) {
58
58
  if (comment)
59
59
  comment += token.source;
60
- else
60
+ else if (!found || indicator !== 'seq-item-ind')
61
61
  spaceBefore = true;
62
62
  }
63
63
  else
@@ -1,2 +1,2 @@
1
- import type { Token } from '../parse/cst.js';
1
+ import type { Token } from '../parse/cst';
2
2
  export declare function containsNewline(key: Token | null | undefined): boolean | null;
@@ -1,2 +1,2 @@
1
- import type { Token } from '../parse/cst.js';
1
+ import type { Token } from '../parse/cst';
2
2
  export declare function emptyScalarPosition(offset: number, before: Token[] | undefined, pos: number | null): number;
@@ -1,3 +1,3 @@
1
- import { Token } from '../parse/cst';
2
- import { ComposeErrorHandler } from './composer';
1
+ import type { Token } from '../parse/cst';
2
+ import type { ComposeErrorHandler } from './composer';
3
3
  export declare function flowIndentCheck(indent: number, fc: Token | null | undefined, onError: ComposeErrorHandler): void;
@@ -1,4 +1,4 @@
1
- import type { ParsedNode } from '../nodes/Node.js';
2
- import type { Pair } from '../nodes/Pair.js';
3
- import type { ComposeContext } from './compose-node.js';
1
+ import type { ParsedNode } from '../nodes/Node';
2
+ import type { Pair } from '../nodes/Pair';
3
+ import type { ComposeContext } from './compose-node';
4
4
  export declare function mapIncludes(ctx: ComposeContext, items: Pair<ParsedNode>[], search: ParsedNode): boolean;
@@ -8,11 +8,7 @@ function mapIncludes(ctx, items, search) {
8
8
  return false;
9
9
  const isEqual = typeof uniqueKeys === 'function'
10
10
  ? uniqueKeys
11
- : (a, b) => a === b ||
12
- (identity.isScalar(a) &&
13
- identity.isScalar(b) &&
14
- a.value === b.value &&
15
- !(a.value === '<<' && ctx.schema.merge));
11
+ : (a, b) => a === b || (identity.isScalar(a) && identity.isScalar(b) && a.value === b.value);
16
12
  return items.some(pair => isEqual(pair.key, search));
17
13
  }
18
14
 
@@ -1,14 +1,14 @@
1
- import type { YAMLError, YAMLWarning } from '../errors.js';
2
- import { Alias } from '../nodes/Alias.js';
3
- import { NODE_TYPE } from '../nodes/identity.js';
4
- import type { Node, NodeType, ParsedNode, Range } from '../nodes/Node.js';
5
- import { Pair } from '../nodes/Pair.js';
6
- import type { Scalar } from '../nodes/Scalar.js';
7
- import type { YAMLMap } from '../nodes/YAMLMap.js';
8
- import type { YAMLSeq } from '../nodes/YAMLSeq.js';
9
- import type { CreateNodeOptions, DocumentOptions, ParseOptions, SchemaOptions, ToJSOptions, ToStringOptions } from '../options.js';
10
- import { Schema } from '../schema/Schema.js';
11
- import { Directives } from './directives.js';
1
+ import type { YAMLError, YAMLWarning } from '../errors';
2
+ import { Alias } from '../nodes/Alias';
3
+ import { NODE_TYPE } from '../nodes/identity';
4
+ import type { Node, NodeType, ParsedNode, Range } from '../nodes/Node';
5
+ import { Pair } from '../nodes/Pair';
6
+ import type { Scalar } from '../nodes/Scalar';
7
+ import type { YAMLMap } from '../nodes/YAMLMap';
8
+ import type { YAMLSeq } from '../nodes/YAMLSeq';
9
+ import type { CreateNodeOptions, DocumentOptions, ParseOptions, SchemaOptions, ToJSOptions, ToStringOptions } from '../options';
10
+ import { Schema } from '../schema/Schema';
11
+ import { Directives } from './directives';
12
12
  export type Replacer = any[] | ((key: any, value: any) => unknown);
13
13
  export declare namespace Document {
14
14
  /** @ts-ignore The typing of directives fails in TS <= 4.2 */
@@ -37,6 +37,7 @@ class Document {
37
37
  logLevel: 'warn',
38
38
  prettyErrors: true,
39
39
  strict: true,
40
+ stringKeys: false,
40
41
  uniqueKeys: true,
41
42
  version: '1.2'
42
43
  }, options);
@@ -260,7 +261,7 @@ class Document {
260
261
  this.directives.yaml.version = '1.1';
261
262
  else
262
263
  this.directives = new directives.Directives({ version: '1.1' });
263
- opt = { merge: true, resolveKnownTags: false, schema: 'yaml-1.1' };
264
+ opt = { resolveKnownTags: false, schema: 'yaml-1.1' };
264
265
  break;
265
266
  case '1.2':
266
267
  case 'next':
@@ -268,7 +269,7 @@ class Document {
268
269
  this.directives.yaml.version = version;
269
270
  else
270
271
  this.directives = new directives.Directives({ version });
271
- opt = { merge: false, resolveKnownTags: true, schema: 'core' };
272
+ opt = { resolveKnownTags: true, schema: 'core' };
272
273
  break;
273
274
  case null:
274
275
  if (this.directives)
@@ -1,5 +1,5 @@
1
- import type { Node } from '../nodes/Node.js';
2
- import type { Document } from './Document.js';
1
+ import type { Node } from '../nodes/Node';
2
+ import type { Document } from './Document';
3
3
  /**
4
4
  * Verify that the input string is a valid anchor.
5
5
  *
@@ -1,7 +1,7 @@
1
- import type { Node } from '../nodes/Node.js';
2
- import type { Schema } from '../schema/Schema.js';
3
- import type { CollectionTag, ScalarTag } from '../schema/types.js';
4
- import type { Replacer } from './Document.js';
1
+ import type { Node } from '../nodes/Node';
2
+ import type { Schema } from '../schema/Schema';
3
+ import type { CollectionTag, ScalarTag } from '../schema/types';
4
+ import type { Replacer } from './Document';
5
5
  export interface CreateNodeContext {
6
6
  aliasDuplicateObjects: boolean;
7
7
  keepUndefined: boolean;
@@ -1,4 +1,4 @@
1
- import type { Document } from './Document.js';
1
+ import type { Document } from './Document';
2
2
  export declare class Directives {
3
3
  static defaultYaml: Directives['yaml'];
4
4
  static defaultTags: Directives['tags'];
@@ -1,5 +1,5 @@
1
1
  import type { LineCounter } from './parse/line-counter';
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' | 'BAD_COLLECTION_TYPE';
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' | 'NON_STRING_KEY' | 'TAB_AS_INDENT' | 'TAG_RESOLVE_FAILED' | 'UNEXPECTED_TOKEN' | 'BAD_COLLECTION_TYPE';
3
3
  export type LinePos = {
4
4
  line: number;
5
5
  col: number;
@@ -1,22 +1,25 @@
1
- export { Composer } from './compose/composer.js';
2
- export { Document } from './doc/Document.js';
3
- export { Schema } from './schema/Schema.js';
4
- export { ErrorCode, YAMLError, YAMLParseError, YAMLWarning } from './errors.js';
5
- export { Alias } from './nodes/Alias.js';
6
- export { isAlias, isCollection, isDocument, isMap, isNode, isPair, isScalar, isSeq } from './nodes/identity.js';
7
- export { Node, ParsedNode, Range } from './nodes/Node.js';
8
- export { Pair } from './nodes/Pair.js';
9
- export { Scalar } from './nodes/Scalar.js';
10
- export { YAMLMap } from './nodes/YAMLMap.js';
11
- export { YAMLSeq } from './nodes/YAMLSeq.js';
12
- export type { CreateNodeOptions, DocumentOptions, ParseOptions, SchemaOptions, ToJSOptions, ToStringOptions } from './options.js';
13
- export * as CST from './parse/cst.js';
14
- export { Lexer } from './parse/lexer.js';
15
- export { LineCounter } from './parse/line-counter.js';
16
- export { Parser } from './parse/parser.js';
17
- export { EmptyStream, parse, parseAllDocuments, parseDocument, stringify } from './public-api.js';
1
+ export { Composer } from './compose/composer';
2
+ export { Document } from './doc/Document';
3
+ export { Schema } from './schema/Schema';
4
+ export type { ErrorCode } from './errors';
5
+ export { YAMLError, YAMLParseError, YAMLWarning } from './errors';
6
+ export { Alias } from './nodes/Alias';
7
+ export { isAlias, isCollection, isDocument, isMap, isNode, isPair, isScalar, isSeq } from './nodes/identity';
8
+ export type { Node, ParsedNode, Range } from './nodes/Node';
9
+ export { Pair } from './nodes/Pair';
10
+ export { Scalar } from './nodes/Scalar';
11
+ export { YAMLMap } from './nodes/YAMLMap';
12
+ export { YAMLSeq } from './nodes/YAMLSeq';
13
+ export type { CreateNodeOptions, DocumentOptions, ParseOptions, SchemaOptions, ToJSOptions, ToStringOptions } from './options';
14
+ export * as CST from './parse/cst';
15
+ export { Lexer } from './parse/lexer';
16
+ export { LineCounter } from './parse/line-counter';
17
+ export { Parser } from './parse/parser';
18
+ export type { EmptyStream } from './public-api';
19
+ export { parse, parseAllDocuments, parseDocument, stringify } from './public-api';
18
20
  export type { TagId, Tags } from './schema/tags';
19
21
  export type { CollectionTag, ScalarTag } from './schema/types';
20
22
  export type { YAMLOMap } from './schema/yaml-1.1/omap';
21
23
  export type { YAMLSet } from './schema/yaml-1.1/set';
22
- export { asyncVisitor, asyncVisitorFn, visit, visitAsync, visitor, visitorFn } from './visit.js';
24
+ export type { asyncVisitor, asyncVisitorFn, visitor, visitorFn } from './visit';
25
+ export { visit, visitAsync } from './visit';
@@ -1,13 +1,15 @@
1
1
  'use strict';
2
2
 
3
+ var node_process = require('node:process');
4
+
3
5
  function debug(logLevel, ...messages) {
4
6
  if (logLevel === 'debug')
5
7
  console.log(...messages);
6
8
  }
7
9
  function warn(logLevel, warning) {
8
10
  if (logLevel === 'debug' || logLevel === 'warn') {
9
- if (typeof process !== 'undefined' && process.emitWarning)
10
- process.emitWarning(warning);
11
+ if (typeof node_process.emitWarning === 'function')
12
+ node_process.emitWarning(warning);
11
13
  else
12
14
  console.warn(warning);
13
15
  }
@@ -1,11 +1,12 @@
1
- import type { Document } from '../doc/Document.js';
2
- import type { FlowScalar } from '../parse/cst.js';
3
- import type { StringifyContext } from '../stringify/stringify.js';
4
- import { NodeBase, Range } from './Node.js';
1
+ import type { Document } from '../doc/Document';
2
+ import type { FlowScalar } from '../parse/cst';
3
+ import type { StringifyContext } from '../stringify/stringify';
4
+ import type { Range } from './Node';
5
+ import { NodeBase } from './Node';
5
6
  import type { Scalar } from './Scalar';
6
- import { ToJSContext } from './toJS.js';
7
- import type { YAMLMap } from './YAMLMap.js';
8
- import type { YAMLSeq } from './YAMLSeq.js';
7
+ import type { ToJSContext } from './toJS';
8
+ import type { YAMLMap } from './YAMLMap';
9
+ import type { YAMLSeq } from './YAMLSeq';
9
10
  export declare namespace Alias {
10
11
  interface Parsed extends Alias {
11
12
  range: Range;
@@ -23,6 +24,6 @@ export declare class Alias extends NodeBase {
23
24
  * instance of the `source` anchor before this node.
24
25
  */
25
26
  resolve(doc: Document): Scalar | YAMLMap | YAMLSeq | undefined;
26
- toJSON(_arg?: unknown, ctx?: ToJSContext): {} | null;
27
+ toJSON(_arg?: unknown, ctx?: ToJSContext): unknown;
27
28
  toString(ctx?: StringifyContext, _onComment?: () => void, _onChompKeep?: () => void): string;
28
29
  }
@@ -1,7 +1,7 @@
1
- import type { Schema } from '../schema/Schema.js';
2
- import { NODE_TYPE } from './identity.js';
3
- import { NodeBase } from './Node.js';
4
- export declare function collectionFromPath(schema: Schema, path: unknown[], value: unknown): import("./Node.js").Node;
1
+ import type { Schema } from '../schema/Schema';
2
+ import { NODE_TYPE } from './identity';
3
+ import { NodeBase } from './Node';
4
+ export declare function collectionFromPath(schema: Schema, path: unknown[], value: unknown): import('./Node').Node;
5
5
  export declare const isEmptyPath: (path: Iterable<unknown> | null | undefined) => path is null | undefined;
6
6
  export declare abstract class Collection extends NodeBase {
7
7
  schema: Schema | undefined;
@@ -1,12 +1,13 @@
1
- import type { Document } from '../doc/Document.js';
2
- import type { ToJSOptions } from '../options.js';
3
- import { Token } from '../parse/cst.js';
4
- import type { StringifyContext } from '../stringify/stringify.js';
5
- import type { Alias } from './Alias.js';
6
- import { NODE_TYPE } from './identity.js';
7
- import type { Scalar } from './Scalar.js';
8
- import type { YAMLMap } from './YAMLMap.js';
9
- import type { YAMLSeq } from './YAMLSeq.js';
1
+ import type { Document } from '../doc/Document';
2
+ import type { ToJSOptions } from '../options';
3
+ import type { Token } from '../parse/cst';
4
+ import type { StringifyContext } from '../stringify/stringify';
5
+ import type { Alias } from './Alias';
6
+ import { NODE_TYPE } from './identity';
7
+ import type { Scalar } from './Scalar';
8
+ import type { ToJSContext } from './toJS';
9
+ import type { MapLike, YAMLMap } from './YAMLMap';
10
+ import type { YAMLSeq } from './YAMLSeq';
10
11
  export type Node<T = unknown> = Alias | Scalar<T> | YAMLMap<unknown, T> | YAMLSeq<T>;
11
12
  /** Utility type mapper */
12
13
  export type NodeType<T> = T extends string | number | bigint | boolean | null | undefined ? Scalar<T> : T extends Date ? Scalar<string | Date> : T extends Array<any> ? YAMLSeq<NodeType<T[number]>> : T extends {
@@ -36,6 +37,11 @@ export declare abstract class NodeBase {
36
37
  srcToken?: Token;
37
38
  /** A fully qualified tag, if required */
38
39
  tag?: string;
40
+ /**
41
+ * Customize the way that a key-value pair is resolved.
42
+ * Used for YAML 1.1 !!merge << handling.
43
+ */
44
+ addToJSMap?: (ctx: ToJSContext | undefined, map: MapLike, value: unknown) => void;
39
45
  /** A plain JS representation of this node */
40
46
  abstract toJSON(): any;
41
47
  abstract toString(ctx?: StringifyContext, onComment?: () => void, onChompKeep?: () => void): string;
@@ -1,11 +1,12 @@
1
- import { CreateNodeContext } from '../doc/createNode.js';
2
- import type { CollectionItem } from '../parse/cst.js';
3
- import type { Schema } from '../schema/Schema.js';
4
- import type { StringifyContext } from '../stringify/stringify.js';
5
- import { addPairToJSMap } from './addPairToJSMap.js';
6
- import { NODE_TYPE } from './identity.js';
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>>;
1
+ import type { CreateNodeContext } from '../doc/createNode';
2
+ import type { CollectionItem } from '../parse/cst';
3
+ import type { Schema } from '../schema/Schema';
4
+ import type { StringifyContext } from '../stringify/stringify';
5
+ import { addPairToJSMap } from './addPairToJSMap';
6
+ import { NODE_TYPE } from './identity';
7
+ import type { Node } from './Node';
8
+ import type { ToJSContext } from './toJS';
9
+ export declare function createPair(key: unknown, value: unknown, ctx: CreateNodeContext): Pair<Node, Node>;
9
10
  export declare class Pair<K = unknown, V = unknown> {
10
11
  readonly [NODE_TYPE]: symbol;
11
12
  /** Always Node or null when parsed, but can be set to anything. */
@@ -1,6 +1,7 @@
1
- import type { BlockScalar, FlowScalar } from '../parse/cst.js';
2
- import { NodeBase, Range } from './Node.js';
3
- import { ToJSContext } from './toJS.js';
1
+ import type { BlockScalar, FlowScalar } from '../parse/cst';
2
+ import type { Range } from './Node';
3
+ import { NodeBase } from './Node';
4
+ import type { ToJSContext } from './toJS';
4
5
  export declare const isScalarValue: (value: unknown) => boolean;
5
6
  export declare namespace Scalar {
6
7
  interface Parsed extends Scalar {
@@ -1,12 +1,12 @@
1
- import type { BlockMap, FlowCollection } from '../parse/cst.js';
2
- import type { Schema } from '../schema/Schema.js';
3
- import type { StringifyContext } from '../stringify/stringify.js';
4
- import { CreateNodeContext } from '../util.js';
5
- import { Collection } from './Collection.js';
6
- import type { ParsedNode, Range } from './Node.js';
7
- import { Pair } from './Pair.js';
8
- import { Scalar } from './Scalar.js';
9
- import type { ToJSContext } from './toJS.js';
1
+ import type { BlockMap, FlowCollection } from '../parse/cst';
2
+ import type { Schema } from '../schema/Schema';
3
+ import type { StringifyContext } from '../stringify/stringify';
4
+ import type { CreateNodeContext } from '../util';
5
+ import { Collection } from './Collection';
6
+ import type { ParsedNode, Range } from './Node';
7
+ import { Pair } from './Pair';
8
+ import type { Scalar } from './Scalar';
9
+ import type { ToJSContext } from './toJS';
10
10
  export type MapLike = Map<unknown, unknown> | Set<unknown> | Record<string | number | symbol, unknown>;
11
11
  export declare function findPair<K = unknown, V = unknown>(items: Iterable<Pair<K, V>>, key: unknown): Pair<K, V> | undefined;
12
12
  export declare namespace YAMLMap {
@@ -24,7 +24,7 @@ export declare class YAMLMap<K = unknown, V = unknown> extends Collection {
24
24
  * A generic collection parsing method that can be extended
25
25
  * to other node classes that inherit from YAMLMap
26
26
  */
27
- static from(schema: Schema, obj: unknown, ctx: CreateNodeContext): YAMLMap<unknown, unknown>;
27
+ static from(schema: Schema, obj: unknown, ctx: CreateNodeContext): YAMLMap;
28
28
  /**
29
29
  * Adds a value to the collection.
30
30
  *