cdklabs-projen-project-types 0.2.16 → 0.2.18

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 (50) hide show
  1. package/.jsii +371 -371
  2. package/API.md +10 -0
  3. package/lib/cdk-construct-library-options.d.ts +1 -0
  4. package/lib/cdk-construct-library-options.js +1 -1
  5. package/lib/cdk-jsii-options.d.ts +1 -0
  6. package/lib/cdk-jsii-options.js +1 -1
  7. package/lib/cdk.js +2 -2
  8. package/lib/cdklabs.js +3 -3
  9. package/lib/jsii.js +1 -1
  10. package/lib/rosetta.js +1 -1
  11. package/lib/yarn/monorepo-options.d.ts +1 -0
  12. package/lib/yarn/monorepo-options.js +1 -1
  13. package/lib/yarn/monorepo-release-options.d.ts +1 -0
  14. package/lib/yarn/monorepo-release-options.js +1 -1
  15. package/lib/yarn/monorepo-release.js +1 -1
  16. package/lib/yarn/monorepo.js +2 -2
  17. package/lib/yarn/typescript-workspace-options.d.ts +1 -0
  18. package/lib/yarn/typescript-workspace-options.js +1 -1
  19. package/lib/yarn/typescript-workspace-release.js +1 -1
  20. package/lib/yarn/typescript-workspace.js +4 -2
  21. package/node_modules/yaml/browser/dist/compose/resolve-props.js +2 -4
  22. package/node_modules/yaml/browser/dist/compose/util-empty-scalar-position.js +1 -2
  23. package/node_modules/yaml/browser/dist/doc/anchors.js +1 -2
  24. package/node_modules/yaml/browser/dist/doc/createNode.js +1 -2
  25. package/node_modules/yaml/browser/dist/nodes/Alias.js +24 -11
  26. package/node_modules/yaml/browser/dist/nodes/YAMLMap.js +1 -1
  27. package/node_modules/yaml/browser/dist/nodes/addPairToJSMap.js +1 -0
  28. package/node_modules/yaml/browser/dist/schema/tags.js +3 -3
  29. package/node_modules/yaml/browser/dist/schema/yaml-1.1/binary.js +1 -2
  30. package/node_modules/yaml/browser/dist/schema/yaml-1.1/pairs.js +1 -1
  31. package/node_modules/yaml/browser/dist/stringify/stringify.js +3 -4
  32. package/node_modules/yaml/browser/dist/stringify/stringifyString.js +3 -4
  33. package/node_modules/yaml/dist/cli.d.ts +1 -1
  34. package/node_modules/yaml/dist/cli.mjs +5 -3
  35. package/node_modules/yaml/dist/compose/composer.js +1 -1
  36. package/node_modules/yaml/dist/compose/resolve-props.js +2 -4
  37. package/node_modules/yaml/dist/compose/util-empty-scalar-position.js +1 -2
  38. package/node_modules/yaml/dist/doc/anchors.js +1 -2
  39. package/node_modules/yaml/dist/doc/createNode.js +1 -2
  40. package/node_modules/yaml/dist/log.js +1 -1
  41. package/node_modules/yaml/dist/nodes/Alias.d.ts +1 -1
  42. package/node_modules/yaml/dist/nodes/Alias.js +23 -10
  43. package/node_modules/yaml/dist/nodes/addPairToJSMap.js +1 -0
  44. package/node_modules/yaml/dist/nodes/toJS.d.ts +2 -0
  45. package/node_modules/yaml/dist/parse/parser.js +1 -1
  46. package/node_modules/yaml/dist/schema/yaml-1.1/binary.js +2 -3
  47. package/node_modules/yaml/dist/stringify/stringify.js +3 -4
  48. package/node_modules/yaml/dist/stringify/stringifyString.js +2 -3
  49. package/node_modules/yaml/package.json +2 -2
  50. package/package.json +7 -7
@@ -1,5 +1,5 @@
1
- import { resolve } from 'node:path';
2
- import { parseArgs } from 'node:util';
1
+ import { resolve } from 'path';
2
+ import { parseArgs } from 'util';
3
3
  import { prettyToken } from './parse/cst.js';
4
4
  import { Lexer } from './parse/lexer.js';
5
5
  import { Parser } from './parse/parser.js';
@@ -23,6 +23,7 @@ Options:
23
23
  --help, -h Show this message.
24
24
  --json, -j Output JSON.
25
25
  --indent 2 Output pretty-printed data, indented by the given number of spaces.
26
+ --merge, -m Enable support for "<<" merge keys.
26
27
 
27
28
  Additional options for bare "yaml" command:
28
29
  --doc, -d Output pretty-printed JS Document objects.
@@ -48,6 +49,7 @@ async function cli(stdin, done, argv) {
48
49
  doc: { type: 'boolean', short: 'd' },
49
50
  help: { type: 'boolean', short: 'h' },
50
51
  indent: { type: 'string', short: 'i' },
52
+ merge: { type: 'boolean', short: 'm' },
51
53
  json: { type: 'boolean', short: 'j' },
52
54
  single: { type: 'boolean', short: '1' },
53
55
  strict: { type: 'boolean', short: 's' },
@@ -117,7 +119,7 @@ async function cli(stdin, done, argv) {
117
119
  const lineCounter = new LineCounter();
118
120
  const parser = new Parser(lineCounter.addNewLine);
119
121
  // @ts-expect-error Version is validated at runtime
120
- const composer = new Composer({ version: opt.yaml });
122
+ const composer = new Composer({ version: opt.yaml, merge: opt.merge });
121
123
  const visitor = opt.visit
122
124
  ? (await import(resolve(opt.visit))).default
123
125
  : null;
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var node_process = require('node:process');
3
+ var node_process = require('process');
4
4
  var directives = require('../doc/directives.js');
5
5
  var Document = require('../doc/Document.js');
6
6
  var errors = require('../errors.js');
@@ -74,8 +74,7 @@ function resolveProps(tokens, { flow, indicator, next, offset, onError, parentIn
74
74
  if (token.source.endsWith(':'))
75
75
  onError(token.offset + token.source.length - 1, 'BAD_ALIAS', 'Anchor ending in : is ambiguous', true);
76
76
  anchor = token;
77
- if (start === null)
78
- start = token.offset;
77
+ start ?? (start = token.offset);
79
78
  atNewline = false;
80
79
  hasSpace = false;
81
80
  reqSpace = true;
@@ -84,8 +83,7 @@ function resolveProps(tokens, { flow, indicator, next, offset, onError, parentIn
84
83
  if (tag)
85
84
  onError(token, 'MULTIPLE_TAGS', 'A node can have at most one tag');
86
85
  tag = token;
87
- if (start === null)
88
- start = token.offset;
86
+ start ?? (start = token.offset);
89
87
  atNewline = false;
90
88
  hasSpace = false;
91
89
  reqSpace = true;
@@ -2,8 +2,7 @@
2
2
 
3
3
  function emptyScalarPosition(offset, before, pos) {
4
4
  if (before) {
5
- if (pos === null)
6
- pos = before.length;
5
+ pos ?? (pos = before.length);
7
6
  for (let i = pos - 1; i >= 0; --i) {
8
7
  let st = before[i];
9
8
  switch (st.type) {
@@ -41,8 +41,7 @@ function createNodeAnchors(doc, prefix) {
41
41
  return {
42
42
  onAnchor: (source) => {
43
43
  aliasObjects.push(source);
44
- if (!prevAnchors)
45
- prevAnchors = anchorNames(doc);
44
+ prevAnchors ?? (prevAnchors = anchorNames(doc));
46
45
  const anchor = findNewAnchor(prefix, prevAnchors);
47
46
  prevAnchors.add(anchor);
48
47
  return anchor;
@@ -40,8 +40,7 @@ function createNode(value, tagName, ctx) {
40
40
  if (aliasDuplicateObjects && value && typeof value === 'object') {
41
41
  ref = sourceObjects.get(value);
42
42
  if (ref) {
43
- if (!ref.anchor)
44
- ref.anchor = onAnchor(value);
43
+ ref.anchor ?? (ref.anchor = onAnchor(value));
45
44
  return new Alias.Alias(ref.anchor);
46
45
  }
47
46
  else {
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var node_process = require('node:process');
3
+ var node_process = require('process');
4
4
 
5
5
  function debug(logLevel, ...messages) {
6
6
  if (logLevel === 'debug')
@@ -23,7 +23,7 @@ export declare class Alias extends NodeBase {
23
23
  * Resolve the value of this alias within `doc`, finding the last
24
24
  * instance of the `source` anchor before this node.
25
25
  */
26
- resolve(doc: Document): Scalar | YAMLMap | YAMLSeq | undefined;
26
+ resolve(doc: Document, ctx?: ToJSContext): Scalar | YAMLMap | YAMLSeq | undefined;
27
27
  toJSON(_arg?: unknown, ctx?: ToJSContext): unknown;
28
28
  toString(ctx?: StringifyContext, _onComment?: () => void, _onChompKeep?: () => void): string;
29
29
  }
@@ -20,23 +20,36 @@ class Alias extends Node.NodeBase {
20
20
  * Resolve the value of this alias within `doc`, finding the last
21
21
  * instance of the `source` anchor before this node.
22
22
  */
23
- resolve(doc) {
23
+ resolve(doc, ctx) {
24
+ let nodes;
25
+ if (ctx?.aliasResolveCache) {
26
+ nodes = ctx.aliasResolveCache;
27
+ }
28
+ else {
29
+ nodes = [];
30
+ visit.visit(doc, {
31
+ Node: (_key, node) => {
32
+ if (identity.isAlias(node) || identity.hasAnchor(node))
33
+ nodes.push(node);
34
+ }
35
+ });
36
+ if (ctx)
37
+ ctx.aliasResolveCache = nodes;
38
+ }
24
39
  let found = undefined;
25
- visit.visit(doc, {
26
- Node: (_key, node) => {
27
- if (node === this)
28
- return visit.visit.BREAK;
29
- if (node.anchor === this.source)
30
- found = node;
31
- }
32
- });
40
+ for (const node of nodes) {
41
+ if (node === this)
42
+ break;
43
+ if (node.anchor === this.source)
44
+ found = node;
45
+ }
33
46
  return found;
34
47
  }
35
48
  toJSON(_arg, ctx) {
36
49
  if (!ctx)
37
50
  return { source: this.source };
38
51
  const { anchors, doc, maxAliasCount } = ctx;
39
- const source = this.resolve(doc);
52
+ const source = this.resolve(doc, ctx);
40
53
  if (!source) {
41
54
  const msg = `Unresolved alias (the anchor must be set before the alias): ${this.source}`;
42
55
  throw new ReferenceError(msg);
@@ -39,6 +39,7 @@ function addPairToJSMap(ctx, map, { key, value }) {
39
39
  function stringifyKey(key, jsKey, ctx) {
40
40
  if (jsKey === null)
41
41
  return '';
42
+ // eslint-disable-next-line @typescript-eslint/no-base-to-string
42
43
  if (typeof jsKey !== 'object')
43
44
  return String(jsKey);
44
45
  if (identity.isNode(key) && ctx?.doc) {
@@ -7,6 +7,8 @@ export interface AnchorData {
7
7
  }
8
8
  export interface ToJSContext {
9
9
  anchors: Map<Node, AnchorData>;
10
+ /** Cached anchor and alias nodes in the order they occur in the document */
11
+ aliasResolveCache?: Node[];
10
12
  doc: Document<Node, boolean>;
11
13
  keep: boolean;
12
14
  mapAsMap: boolean;
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var node_process = require('node:process');
3
+ var node_process = require('process');
4
4
  var cst = require('./cst.js');
5
5
  var lexer = require('./lexer.js');
6
6
 
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var node_buffer = require('node:buffer');
3
+ var node_buffer = require('buffer');
4
4
  var Scalar = require('../../nodes/Scalar.js');
5
5
  var stringifyString = require('../../stringify/stringifyString.js');
6
6
 
@@ -53,8 +53,7 @@ const binary = {
53
53
  else {
54
54
  throw new Error('This environment does not support writing binary tags; either Buffer or btoa is required');
55
55
  }
56
- if (!type)
57
- type = Scalar.Scalar.BLOCK_LITERAL;
56
+ type ?? (type = Scalar.Scalar.BLOCK_LITERAL);
58
57
  if (type !== Scalar.Scalar.QUOTE_DOUBLE) {
59
58
  const lineWidth = Math.max(ctx.options.lineWidth - ctx.indent.length, ctx.options.minContentWidth);
60
59
  const n = Math.ceil(str.length / lineWidth);
@@ -70,7 +70,7 @@ function getTagObject(tags, item) {
70
70
  tagObj = tags.find(t => t.nodeClass && obj instanceof t.nodeClass);
71
71
  }
72
72
  if (!tagObj) {
73
- const name = obj?.constructor?.name ?? typeof obj;
73
+ const name = obj?.constructor?.name ?? (obj === null ? 'null' : typeof obj);
74
74
  throw new Error(`Tag not resolved for ${name} value`);
75
75
  }
76
76
  return tagObj;
@@ -85,7 +85,7 @@ function stringifyProps(node, tagObj, { anchors: anchors$1, doc }) {
85
85
  anchors$1.add(anchor);
86
86
  props.push(`&${anchor}`);
87
87
  }
88
- const tag = node.tag ? node.tag : tagObj.default ? null : tagObj.tag;
88
+ const tag = node.tag ?? (tagObj.default ? null : tagObj.tag);
89
89
  if (tag)
90
90
  props.push(doc.directives.tagString(tag));
91
91
  return props.join(' ');
@@ -111,8 +111,7 @@ function stringify(item, ctx, onComment, onChompKeep) {
111
111
  const node = identity.isNode(item)
112
112
  ? item
113
113
  : ctx.doc.createNode(item, { onTagObj: o => (tagObj = o) });
114
- if (!tagObj)
115
- tagObj = getTagObject(ctx.doc.schema.tags, node);
114
+ tagObj ?? (tagObj = getTagObject(ctx.doc.schema.tags, node));
116
115
  const props = stringifyProps(node, tagObj, ctx);
117
116
  if (props.length > 0)
118
117
  ctx.indentAtStart = (ctx.indentAtStart ?? 0) + props.length + 1;
@@ -255,10 +255,9 @@ function plainString(item, ctx, onComment, onChompKeep) {
255
255
  (inFlow && /[[\]{},]/.test(value))) {
256
256
  return quotedString(value, ctx);
257
257
  }
258
- if (!value ||
259
- /^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(value)) {
258
+ if (/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(value)) {
260
259
  // not allowed:
261
- // - empty string, '-' or '?'
260
+ // - '-' or '?'
262
261
  // - start with an indicator character (except [?:-]) or /[?-] /
263
262
  // - '\n ', ': ' or ' \n' anywhere
264
263
  // - '#' not preceded by a non-space char
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yaml",
3
- "version": "2.7.1",
3
+ "version": "2.8.0",
4
4
  "license": "ISC",
5
5
  "author": "Eemeli Aro <eemeli@gmail.com>",
6
6
  "repository": "github:eemeli/yaml",
@@ -91,6 +91,6 @@
91
91
  "typescript-eslint": "^8.4.0"
92
92
  },
93
93
  "engines": {
94
- "node": ">= 14"
94
+ "node": ">= 14.6"
95
95
  }
96
96
  }
package/package.json CHANGED
@@ -35,7 +35,7 @@
35
35
  "organization": true
36
36
  },
37
37
  "devDependencies": {
38
- "@jsii/spec": "^1.111.0",
38
+ "@jsii/spec": "^1.112.0",
39
39
  "@stylistic/eslint-plugin": "^2",
40
40
  "@types/jest": "^29",
41
41
  "@types/node": "^18",
@@ -49,12 +49,12 @@
49
49
  "jest": "^29",
50
50
  "jest-junit": "^16",
51
51
  "jsii": "~5.5",
52
- "jsii-diff": "^1.111.0",
52
+ "jsii-diff": "^1.112.0",
53
53
  "jsii-docgen": "^10.5.0",
54
- "jsii-pacmak": "^1.111.0",
55
- "jsii-reflect": "^1.111.0",
54
+ "jsii-pacmak": "^1.112.0",
55
+ "jsii-reflect": "^1.112.0",
56
56
  "jsii-rosetta": "~5.5",
57
- "projen": "^0.91.20",
57
+ "projen": "^0.92.3",
58
58
  "ts-jest": "^29",
59
59
  "ts-node": "^10.9.2",
60
60
  "typescript": "~5.5"
@@ -64,7 +64,7 @@
64
64
  "projen": ">=0.88.6 <1.0.0"
65
65
  },
66
66
  "dependencies": {
67
- "yaml": "^2.7.1"
67
+ "yaml": "^2.8.0"
68
68
  },
69
69
  "bundledDependencies": [
70
70
  "yaml"
@@ -74,7 +74,7 @@
74
74
  "publishConfig": {
75
75
  "access": "public"
76
76
  },
77
- "version": "0.2.16",
77
+ "version": "0.2.18",
78
78
  "jest": {
79
79
  "coverageProvider": "v8",
80
80
  "testMatch": [