projen 0.80.0 → 0.80.2

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 (147) hide show
  1. package/.jsii +22 -22
  2. package/lib/awscdk/auto-discover.js +5 -5
  3. package/lib/awscdk/awscdk-app-java.js +1 -1
  4. package/lib/awscdk/awscdk-app-py.js +1 -1
  5. package/lib/awscdk/awscdk-app-ts.js +1 -1
  6. package/lib/awscdk/awscdk-construct.js +2 -2
  7. package/lib/awscdk/awscdk-deps-java.js +1 -1
  8. package/lib/awscdk/awscdk-deps-js.js +1 -1
  9. package/lib/awscdk/awscdk-deps-py.js +1 -1
  10. package/lib/awscdk/awscdk-deps.js +1 -1
  11. package/lib/awscdk/cdk-config.js +1 -1
  12. package/lib/awscdk/cdk-tasks.js +1 -1
  13. package/lib/awscdk/integration-test.js +1 -1
  14. package/lib/awscdk/lambda-extension.js +1 -1
  15. package/lib/awscdk/lambda-function.js +2 -2
  16. package/lib/build/build-workflow.js +1 -1
  17. package/lib/cdk/auto-discover-base.js +2 -2
  18. package/lib/cdk/construct-lib.js +1 -1
  19. package/lib/cdk/integration-test-base.js +1 -1
  20. package/lib/cdk/jsii-docgen.js +1 -1
  21. package/lib/cdk/jsii-project.js +1 -1
  22. package/lib/cdk8s/auto-discover.js +2 -2
  23. package/lib/cdk8s/cdk8s-app-py.js +1 -1
  24. package/lib/cdk8s/cdk8s-app-ts.js +1 -1
  25. package/lib/cdk8s/cdk8s-construct.js +1 -1
  26. package/lib/cdk8s/cdk8s-deps-py.js +1 -1
  27. package/lib/cdk8s/cdk8s-deps.js +1 -1
  28. package/lib/cdk8s/integration-test.js +1 -1
  29. package/lib/cdktf/cdktf-construct.js +1 -1
  30. package/lib/circleci/circleci.js +1 -1
  31. package/lib/component.js +1 -1
  32. package/lib/dependencies.js +1 -1
  33. package/lib/dev-env.js +1 -1
  34. package/lib/docker-compose/docker-compose-service.js +1 -1
  35. package/lib/docker-compose/docker-compose.js +1 -1
  36. package/lib/file.js +1 -1
  37. package/lib/gitattributes.js +1 -1
  38. package/lib/github/actions-provider.js +1 -1
  39. package/lib/github/auto-approve.js +1 -1
  40. package/lib/github/auto-merge.js +1 -1
  41. package/lib/github/dependabot.js +1 -1
  42. package/lib/github/github-credentials.js +1 -1
  43. package/lib/github/github-project.js +1 -1
  44. package/lib/github/github.js +1 -1
  45. package/lib/github/mergify.js +1 -1
  46. package/lib/github/pr-template.js +1 -1
  47. package/lib/github/pull-request-lint.js +1 -1
  48. package/lib/github/stale.js +1 -1
  49. package/lib/github/task-workflow-job.js +1 -1
  50. package/lib/github/task-workflow.js +1 -1
  51. package/lib/github/workflow-actions.js +1 -1
  52. package/lib/github/workflow-jobs.js +1 -1
  53. package/lib/github/workflow-steps.js +1 -1
  54. package/lib/github/workflows.js +1 -1
  55. package/lib/gitlab/configuration.js +1 -1
  56. package/lib/gitlab/gitlab-configuration.js +1 -1
  57. package/lib/gitlab/nested-configuration.js +1 -1
  58. package/lib/gitpod.js +1 -1
  59. package/lib/ignore-file.js +1 -1
  60. package/lib/ini.js +1 -1
  61. package/lib/java/java-project.js +1 -1
  62. package/lib/java/junit.js +1 -1
  63. package/lib/java/maven-compile.js +1 -1
  64. package/lib/java/maven-packaging.js +1 -1
  65. package/lib/java/maven-sample.js +1 -1
  66. package/lib/java/pom.js +1 -1
  67. package/lib/java/projenrc.js +1 -1
  68. package/lib/javascript/bundler.js +1 -1
  69. package/lib/javascript/eslint.js +1 -1
  70. package/lib/javascript/jest.js +4 -4
  71. package/lib/javascript/license-checker.js +1 -1
  72. package/lib/javascript/node-package.js +1 -1
  73. package/lib/javascript/node-project.js +4 -3
  74. package/lib/javascript/npm-config.js +1 -1
  75. package/lib/javascript/prettier.js +1 -1
  76. package/lib/javascript/projenrc.js +1 -1
  77. package/lib/javascript/typescript-config.js +2 -2
  78. package/lib/javascript/upgrade-dependencies.js +2 -2
  79. package/lib/javascript/util.js +2 -2
  80. package/lib/javascript/yarnrc.js +1 -1
  81. package/lib/json-patch.js +1 -1
  82. package/lib/json.js +1 -1
  83. package/lib/license.js +1 -1
  84. package/lib/logger.js +1 -1
  85. package/lib/makefile.js +1 -1
  86. package/lib/object-file.js +1 -1
  87. package/lib/project-build.js +1 -1
  88. package/lib/project-tree.js +1 -1
  89. package/lib/project.js +1 -1
  90. package/lib/projects.js +1 -1
  91. package/lib/projenrc-json.js +2 -2
  92. package/lib/projenrc.js +1 -1
  93. package/lib/python/pip.js +1 -1
  94. package/lib/python/poetry.js +2 -2
  95. package/lib/python/projenrc.js +1 -1
  96. package/lib/python/pytest-sample.js +1 -1
  97. package/lib/python/pytest.js +1 -1
  98. package/lib/python/python-project.js +1 -1
  99. package/lib/python/python-sample.js +1 -1
  100. package/lib/python/requirements-file.js +1 -1
  101. package/lib/python/setuppy.js +1 -1
  102. package/lib/python/setuptools.js +1 -1
  103. package/lib/python/venv.js +1 -1
  104. package/lib/readme.js +1 -1
  105. package/lib/release/publisher.js +1 -1
  106. package/lib/release/release-trigger.js +1 -1
  107. package/lib/release/release.js +1 -1
  108. package/lib/renovatebot.js +1 -1
  109. package/lib/sample-file.js +2 -2
  110. package/lib/semver.js +1 -1
  111. package/lib/source-code.js +1 -1
  112. package/lib/task-runtime.js +1 -1
  113. package/lib/task.js +1 -1
  114. package/lib/tasks.js +1 -1
  115. package/lib/testing.js +1 -1
  116. package/lib/textfile.js +1 -1
  117. package/lib/toml.js +1 -1
  118. package/lib/typescript/projenrc-ts.js +1 -1
  119. package/lib/typescript/projenrc.js +1 -1
  120. package/lib/typescript/typescript-typedoc.js +1 -1
  121. package/lib/typescript/typescript.js +6 -6
  122. package/lib/version.js +2 -2
  123. package/lib/vscode/devcontainer.js +1 -1
  124. package/lib/vscode/extensions.js +1 -1
  125. package/lib/vscode/launch-config.js +1 -1
  126. package/lib/vscode/settings.js +1 -1
  127. package/lib/vscode/vscode.js +1 -1
  128. package/lib/web/next.js +3 -3
  129. package/lib/web/postcss.js +1 -1
  130. package/lib/web/react.js +4 -4
  131. package/lib/web/tailwind.js +1 -1
  132. package/lib/xmlfile.js +1 -1
  133. package/lib/yaml.js +1 -1
  134. package/node_modules/yaml/README.md +11 -9
  135. package/node_modules/yaml/bin.mjs +11 -0
  136. package/node_modules/yaml/browser/dist/compose/resolve-flow-scalar.js +13 -13
  137. package/node_modules/yaml/browser/dist/schema/yaml-1.1/binary.js +1 -1
  138. package/node_modules/yaml/browser/dist/stringify/stringifyCollection.js +1 -2
  139. package/node_modules/yaml/dist/cli.d.ts +9 -0
  140. package/node_modules/yaml/dist/cli.mjs +195 -0
  141. package/node_modules/yaml/dist/compose/resolve-flow-scalar.js +13 -13
  142. package/node_modules/yaml/dist/nodes/Pair.d.ts +1 -1
  143. package/node_modules/yaml/dist/parse/cst.d.ts +1 -1
  144. package/node_modules/yaml/dist/schema/yaml-1.1/binary.js +1 -1
  145. package/node_modules/yaml/dist/stringify/stringifyCollection.js +1 -2
  146. package/node_modules/yaml/package.json +10 -7
  147. package/package.json +2 -2
@@ -0,0 +1,195 @@
1
+ import { resolve } from 'node:path';
2
+ import { parseArgs } from 'node:util';
3
+ import { prettyToken } from './parse/cst.js';
4
+ import { Lexer } from './parse/lexer.js';
5
+ import { Parser } from './parse/parser.js';
6
+ import { Composer } from './compose/composer.js';
7
+ import { LineCounter } from './parse/line-counter.js';
8
+ import { prettifyError } from './errors.js';
9
+ import { visit } from './visit.js';
10
+
11
+ const help = `\
12
+ yaml: A command-line YAML processor and inspector
13
+
14
+ Reads stdin and writes output to stdout and errors & warnings to stderr.
15
+
16
+ Usage:
17
+ yaml Process a YAML stream, outputting it as YAML
18
+ yaml cst Parse the CST of a YAML stream
19
+ yaml lex Parse the lexical tokens of a YAML stream
20
+ yaml valid Validate a YAML stream, returning 0 on success
21
+
22
+ Options:
23
+ --help, -h Show this message.
24
+ --json, -j Output JSON.
25
+
26
+ Additional options for bare "yaml" command:
27
+ --doc, -d Output pretty-printed JS Document objects.
28
+ --single, -1 Require the input to consist of a single YAML document.
29
+ --strict, -s Stop on errors.
30
+ --visit, -v Apply a visitor to each document (requires a path to import)
31
+ --yaml 1.1 Set the YAML version. (default: 1.2)`;
32
+ class UserError extends Error {
33
+ constructor(code, message) {
34
+ super(`Error: ${message}`);
35
+ this.code = code;
36
+ }
37
+ }
38
+ UserError.ARGS = 2;
39
+ UserError.SINGLE = 3;
40
+ async function cli(stdin, done, argv) {
41
+ let args;
42
+ try {
43
+ args = parseArgs({
44
+ args: argv,
45
+ allowPositionals: true,
46
+ options: {
47
+ doc: { type: 'boolean', short: 'd' },
48
+ help: { type: 'boolean', short: 'h' },
49
+ json: { type: 'boolean', short: 'j' },
50
+ single: { type: 'boolean', short: '1' },
51
+ strict: { type: 'boolean', short: 's' },
52
+ visit: { type: 'string', short: 'v' },
53
+ yaml: { type: 'string', default: '1.2' }
54
+ }
55
+ });
56
+ }
57
+ catch (error) {
58
+ return done(new UserError(UserError.ARGS, error.message));
59
+ }
60
+ const { positionals: [mode], values: opt } = args;
61
+ stdin.setEncoding('utf-8');
62
+ // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
63
+ switch (opt.help || mode) {
64
+ /* istanbul ignore next */
65
+ case true: // --help
66
+ console.log(help);
67
+ break;
68
+ case 'lex': {
69
+ const lexer = new Lexer();
70
+ const data = [];
71
+ const add = (tok) => {
72
+ if (opt.json)
73
+ data.push(tok);
74
+ else
75
+ console.log(prettyToken(tok));
76
+ };
77
+ stdin.on('data', (chunk) => {
78
+ for (const tok of lexer.lex(chunk, true))
79
+ add(tok);
80
+ });
81
+ stdin.on('end', () => {
82
+ for (const tok of lexer.lex('', false))
83
+ add(tok);
84
+ if (opt.json)
85
+ console.log(JSON.stringify(data));
86
+ done();
87
+ });
88
+ break;
89
+ }
90
+ case 'cst': {
91
+ const parser = new Parser();
92
+ const data = [];
93
+ const add = (tok) => {
94
+ if (opt.json)
95
+ data.push(tok);
96
+ else
97
+ console.dir(tok, { depth: null });
98
+ };
99
+ stdin.on('data', (chunk) => {
100
+ for (const tok of parser.parse(chunk, true))
101
+ add(tok);
102
+ });
103
+ stdin.on('end', () => {
104
+ for (const tok of parser.parse('', false))
105
+ add(tok);
106
+ if (opt.json)
107
+ console.log(JSON.stringify(data));
108
+ done();
109
+ });
110
+ break;
111
+ }
112
+ case undefined:
113
+ case 'valid': {
114
+ const lineCounter = new LineCounter();
115
+ const parser = new Parser(lineCounter.addNewLine);
116
+ // @ts-expect-error Version is validated at runtime
117
+ const composer = new Composer({ version: opt.yaml });
118
+ const visitor = opt.visit
119
+ ? (await import(resolve(opt.visit))).default
120
+ : null;
121
+ let source = '';
122
+ let hasDoc = false;
123
+ let reqDocEnd = false;
124
+ const data = [];
125
+ const add = (doc) => {
126
+ if (hasDoc && opt.single) {
127
+ return done(new UserError(UserError.SINGLE, 'Input stream contains multiple documents'));
128
+ }
129
+ for (const error of doc.errors) {
130
+ prettifyError(source, lineCounter)(error);
131
+ if (opt.strict || mode === 'valid')
132
+ return done(error);
133
+ console.error(error);
134
+ }
135
+ for (const warning of doc.warnings) {
136
+ prettifyError(source, lineCounter)(warning);
137
+ console.error(warning);
138
+ }
139
+ if (visitor)
140
+ visit(doc, visitor);
141
+ if (mode === 'valid')
142
+ doc.toJS();
143
+ else if (opt.json)
144
+ data.push(doc);
145
+ else if (opt.doc) {
146
+ Object.defineProperties(doc, {
147
+ options: { enumerable: false },
148
+ schema: { enumerable: false }
149
+ });
150
+ console.dir(doc, { depth: null });
151
+ }
152
+ else {
153
+ if (reqDocEnd)
154
+ console.log('...');
155
+ try {
156
+ const str = String(doc);
157
+ console.log(str.endsWith('\n') ? str.slice(0, -1) : str);
158
+ }
159
+ catch (error) {
160
+ done(error);
161
+ }
162
+ }
163
+ hasDoc = true;
164
+ reqDocEnd = !doc.directives?.docEnd;
165
+ };
166
+ stdin.on('data', (chunk) => {
167
+ source += chunk;
168
+ for (const tok of parser.parse(chunk, true)) {
169
+ for (const doc of composer.next(tok))
170
+ add(doc);
171
+ }
172
+ });
173
+ stdin.on('end', () => {
174
+ for (const tok of parser.parse('', false)) {
175
+ for (const doc of composer.next(tok))
176
+ add(doc);
177
+ }
178
+ for (const doc of composer.end(false))
179
+ add(doc);
180
+ if (opt.single && !hasDoc) {
181
+ return done(new UserError(UserError.SINGLE, 'Input stream contained no documents'));
182
+ }
183
+ if (mode !== 'valid' && opt.json) {
184
+ console.log(JSON.stringify(opt.single ? data[0] : data));
185
+ }
186
+ done();
187
+ });
188
+ break;
189
+ }
190
+ default:
191
+ done(new UserError(UserError.ARGS, `Unknown command: ${JSON.stringify(mode)}`));
192
+ }
193
+ }
194
+
195
+ export { UserError, cli, help };
@@ -191,19 +191,19 @@ function foldNewline(source, offset) {
191
191
  return { fold, offset };
192
192
  }
193
193
  const escapeCodes = {
194
- '0': '\0',
195
- a: '\x07',
196
- b: '\b',
197
- e: '\x1b',
198
- f: '\f',
199
- n: '\n',
200
- r: '\r',
201
- t: '\t',
202
- v: '\v',
203
- N: '\u0085',
204
- _: '\u00a0',
205
- L: '\u2028',
206
- P: '\u2029',
194
+ '0': '\0', // null character
195
+ a: '\x07', // bell character
196
+ b: '\b', // backspace
197
+ e: '\x1b', // escape character
198
+ f: '\f', // form feed
199
+ n: '\n', // line feed
200
+ r: '\r', // carriage return
201
+ t: '\t', // horizontal tab
202
+ v: '\v', // vertical tab
203
+ N: '\u0085', // Unicode next line
204
+ _: '\u00a0', // Unicode non-breaking space
205
+ L: '\u2028', // Unicode line separator
206
+ P: '\u2029', // Unicode paragraph separator
207
207
  ' ': ' ',
208
208
  '"': '"',
209
209
  '/': '/',
@@ -5,7 +5,7 @@ import type { StringifyContext } from '../stringify/stringify.js';
5
5
  import { addPairToJSMap } from './addPairToJSMap.js';
6
6
  import { NODE_TYPE } from './identity.js';
7
7
  import type { ToJSContext } from './toJS.js';
8
- export declare function createPair(key: unknown, value: unknown, ctx: CreateNodeContext): Pair<import("./Node.js").Node, import("./YAMLMap.js").YAMLMap<unknown, unknown> | import("./Scalar.js").Scalar<unknown> | import("./Alias.js").Alias | import("./YAMLSeq.js").YAMLSeq<unknown>>;
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>>;
9
9
  export declare class Pair<K = unknown, V = unknown> {
10
10
  readonly [NODE_TYPE]: symbol;
11
11
  /** Always Node or null when parsed, but can be set to anything. */
@@ -99,7 +99,7 @@ export declare const SCALAR = "\u001F";
99
99
  /** @returns `true` if `token` is a flow or block collection */
100
100
  export declare const isCollection: (token: Token | null | undefined) => token is BlockMap | BlockSequence | FlowCollection;
101
101
  /** @returns `true` if `token` is a flow or block scalar; not an alias */
102
- export declare const isScalar: (token: Token | null | undefined) => token is BlockScalar | FlowScalar;
102
+ export declare const isScalar: (token: Token | null | undefined) => token is FlowScalar | BlockScalar;
103
103
  /** Get a printable representation of a lexer token */
104
104
  export declare function prettyToken(token: string): string;
105
105
  /** Identify the type of a lexer token. May return `null` for unknown tokens. */
@@ -4,7 +4,7 @@ var Scalar = require('../../nodes/Scalar.js');
4
4
  var stringifyString = require('../../stringify/stringifyString.js');
5
5
 
6
6
  const binary = {
7
- identify: value => value instanceof Uint8Array,
7
+ identify: value => value instanceof Uint8Array, // Buffer inherits from Uint8Array
8
8
  default: false,
9
9
  tag: 'tag:yaml.org,2002:binary',
10
10
  /**
@@ -1,6 +1,5 @@
1
1
  'use strict';
2
2
 
3
- var Collection = require('../nodes/Collection.js');
4
3
  var identity = require('../nodes/identity.js');
5
4
  var stringify = require('./stringify.js');
6
5
  var stringifyComment = require('./stringifyComment.js');
@@ -122,7 +121,7 @@ function stringifyFlowCollection({ comment, items }, ctx, { flowChars, itemInden
122
121
  else {
123
122
  if (!reqNewline) {
124
123
  const len = lines.reduce((sum, line) => sum + line.length + 2, 2);
125
- reqNewline = len > Collection.Collection.maxFlowStringSingleLineLength;
124
+ reqNewline = ctx.options.lineWidth > 0 && len > ctx.options.lineWidth;
126
125
  }
127
126
  if (reqNewline) {
128
127
  str = start;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yaml",
3
- "version": "2.3.4",
3
+ "version": "2.4.0",
4
4
  "license": "ISC",
5
5
  "author": "Eemeli Aro <eemeli@gmail.com>",
6
6
  "repository": "github:eemeli/yaml",
@@ -18,6 +18,7 @@
18
18
  ],
19
19
  "type": "commonjs",
20
20
  "main": "./dist/index.js",
21
+ "bin": "./bin.mjs",
21
22
  "browser": {
22
23
  "./dist/index.js": "./browser/index.js",
23
24
  "./dist/util.js": "./browser/dist/util.js",
@@ -52,7 +53,9 @@
52
53
  "test:dist:types": "tsc --allowJs --moduleResolution node --noEmit --target es5 dist/index.js",
53
54
  "test:types": "tsc --noEmit && tsc --noEmit -p tests/tsconfig.json",
54
55
  "docs:install": "cd docs-slate && bundle install",
56
+ "predocs:deploy": "node docs/prepare-docs.mjs",
55
57
  "docs:deploy": "cd docs-slate && ./deploy.sh",
58
+ "predocs": "node docs/prepare-docs.mjs",
56
59
  "docs": "cd docs-slate && bundle exec middleman server",
57
60
  "preversion": "npm test && npm run build",
58
61
  "prepublishOnly": "npm run clean && npm test && npm run build"
@@ -66,17 +69,17 @@
66
69
  },
67
70
  "devDependencies": {
68
71
  "@babel/core": "^7.12.10",
69
- "@babel/plugin-proposal-class-properties": "^7.12.1",
70
- "@babel/plugin-proposal-nullish-coalescing-operator": "^7.12.1",
72
+ "@babel/plugin-transform-class-properties": "^7.23.3",
73
+ "@babel/plugin-transform-nullish-coalescing-operator": "^7.23.4",
71
74
  "@babel/plugin-transform-typescript": "^7.12.17",
72
75
  "@babel/preset-env": "^7.12.11",
73
76
  "@rollup/plugin-babel": "^6.0.3",
74
77
  "@rollup/plugin-replace": "^5.0.2",
75
78
  "@rollup/plugin-typescript": "^11.0.0",
76
79
  "@types/jest": "^29.2.4",
77
- "@types/node": "^14.18.35",
78
- "@typescript-eslint/eslint-plugin": "^6.4.1",
79
- "@typescript-eslint/parser": "^6.4.1",
80
+ "@types/node": "^20.11.20",
81
+ "@typescript-eslint/eslint-plugin": "^7.0.2",
82
+ "@typescript-eslint/parser": "^7.0.2",
80
83
  "babel-jest": "^29.0.1",
81
84
  "cross-env": "^7.0.3",
82
85
  "eslint": "^8.2.0",
@@ -85,7 +88,7 @@
85
88
  "jest": "^29.0.1",
86
89
  "jest-ts-webcompat-resolver": "^1.0.0",
87
90
  "prettier": "^3.0.2",
88
- "rollup": "^3.7.5",
91
+ "rollup": "^4.12.0",
89
92
  "tslib": "^2.1.0",
90
93
  "typescript": "^5.0.3"
91
94
  },
package/package.json CHANGED
@@ -54,7 +54,7 @@
54
54
  "@types/ini": "^1.3.34",
55
55
  "@types/jest": "^27",
56
56
  "@types/node": "^16",
57
- "@types/semver": "^7.5.7",
57
+ "@types/semver": "^7.5.8",
58
58
  "@types/yargs": "^16.0.9",
59
59
  "@typescript-eslint/eslint-plugin": "^6",
60
60
  "@typescript-eslint/parser": "^6",
@@ -126,7 +126,7 @@
126
126
  },
127
127
  "main": "lib/index.js",
128
128
  "license": "Apache-2.0",
129
- "version": "0.80.0",
129
+ "version": "0.80.2",
130
130
  "jest": {
131
131
  "maxWorkers": "50%",
132
132
  "testMatch": [