projen 0.65.49 → 0.65.51

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 (152) hide show
  1. package/.jsii +27 -10
  2. package/docs/api/API.md +8 -0
  3. package/lib/awscdk/auto-discover.js +5 -5
  4. package/lib/awscdk/awscdk-app-java.js +1 -1
  5. package/lib/awscdk/awscdk-app-py.js +1 -1
  6. package/lib/awscdk/awscdk-app-ts.js +1 -1
  7. package/lib/awscdk/awscdk-construct.js +2 -2
  8. package/lib/awscdk/awscdk-deps-java.js +1 -1
  9. package/lib/awscdk/awscdk-deps-js.js +1 -1
  10. package/lib/awscdk/awscdk-deps-py.js +1 -1
  11. package/lib/awscdk/awscdk-deps.js +1 -1
  12. package/lib/awscdk/cdk-config.js +1 -1
  13. package/lib/awscdk/cdk-tasks.js +1 -1
  14. package/lib/awscdk/integration-test.js +1 -1
  15. package/lib/awscdk/lambda-extension.js +1 -1
  16. package/lib/awscdk/lambda-function.js +2 -2
  17. package/lib/build/build-workflow.js +1 -1
  18. package/lib/cdk/auto-discover-base.js +2 -2
  19. package/lib/cdk/construct-lib.js +1 -1
  20. package/lib/cdk/integration-test-base.js +1 -1
  21. package/lib/cdk/jsii-docgen.js +1 -1
  22. package/lib/cdk/jsii-project.js +1 -1
  23. package/lib/cdk8s/auto-discover.js +2 -2
  24. package/lib/cdk8s/cdk8s-app-py.js +1 -1
  25. package/lib/cdk8s/cdk8s-app-ts.js +1 -1
  26. package/lib/cdk8s/cdk8s-construct.js +1 -1
  27. package/lib/cdk8s/cdk8s-deps-py.js +1 -1
  28. package/lib/cdk8s/cdk8s-deps.js +1 -1
  29. package/lib/cdk8s/integration-test.js +1 -1
  30. package/lib/cdktf/cdktf-construct.js +1 -1
  31. package/lib/circleci/circleci.js +1 -1
  32. package/lib/component.js +1 -1
  33. package/lib/dependencies.js +1 -1
  34. package/lib/dev-env.js +1 -1
  35. package/lib/docker-compose.js +2 -2
  36. package/lib/file.js +1 -1
  37. package/lib/gitattributes.js +1 -1
  38. package/lib/github/auto-approve.js +1 -1
  39. package/lib/github/auto-merge.js +1 -1
  40. package/lib/github/dependabot.js +1 -1
  41. package/lib/github/github-credentials.js +1 -1
  42. package/lib/github/github-project.js +1 -1
  43. package/lib/github/github.js +1 -1
  44. package/lib/github/mergify.js +1 -1
  45. package/lib/github/pr-template.js +1 -1
  46. package/lib/github/pull-request-lint.js +1 -1
  47. package/lib/github/stale.js +1 -1
  48. package/lib/github/task-workflow.js +1 -1
  49. package/lib/github/workflows.js +1 -1
  50. package/lib/gitlab/configuration.js +1 -1
  51. package/lib/gitlab/gitlab-configuration.js +1 -1
  52. package/lib/gitlab/nested-configuration.js +1 -1
  53. package/lib/gitpod.js +1 -1
  54. package/lib/ignore-file.js +1 -1
  55. package/lib/ini.js +1 -1
  56. package/lib/java/java-project.js +1 -1
  57. package/lib/java/junit.js +1 -1
  58. package/lib/java/maven-compile.js +1 -1
  59. package/lib/java/maven-packaging.js +1 -1
  60. package/lib/java/maven-sample.js +1 -1
  61. package/lib/java/pom.js +1 -1
  62. package/lib/java/projenrc.js +1 -1
  63. package/lib/javascript/bundler.js +1 -1
  64. package/lib/javascript/eslint.js +6 -4
  65. package/lib/javascript/jest.js +1 -1
  66. package/lib/javascript/node-package.js +1 -1
  67. package/lib/javascript/node-project.js +1 -1
  68. package/lib/javascript/npm-config.js +1 -1
  69. package/lib/javascript/prettier.js +1 -1
  70. package/lib/javascript/projenrc.js +1 -1
  71. package/lib/javascript/typescript-config.js +1 -1
  72. package/lib/javascript/upgrade-dependencies.js +2 -2
  73. package/lib/json-patch.js +1 -1
  74. package/lib/json.d.ts +1 -1
  75. package/lib/json.js +3 -3
  76. package/lib/license.js +1 -1
  77. package/lib/logger.js +1 -1
  78. package/lib/makefile.js +1 -1
  79. package/lib/object-file.js +1 -1
  80. package/lib/project-build.js +1 -1
  81. package/lib/project.js +1 -1
  82. package/lib/projects.js +1 -1
  83. package/lib/projenrc-json.js +1 -1
  84. package/lib/python/pip.js +1 -1
  85. package/lib/python/poetry.js +2 -2
  86. package/lib/python/projenrc.js +1 -1
  87. package/lib/python/pytest-sample.js +1 -1
  88. package/lib/python/pytest.js +1 -1
  89. package/lib/python/python-project.js +1 -1
  90. package/lib/python/python-sample.js +1 -1
  91. package/lib/python/requirements-file.js +1 -1
  92. package/lib/python/setuppy.js +1 -1
  93. package/lib/python/setuptools.js +1 -1
  94. package/lib/python/venv.js +1 -1
  95. package/lib/readme.js +1 -1
  96. package/lib/release/publisher.js +1 -1
  97. package/lib/release/release-trigger.js +1 -1
  98. package/lib/release/release.js +1 -1
  99. package/lib/renovatebot.js +1 -1
  100. package/lib/sample-file.js +2 -2
  101. package/lib/semver.js +1 -1
  102. package/lib/source-code.js +1 -1
  103. package/lib/task-runtime.js +1 -1
  104. package/lib/task.js +1 -1
  105. package/lib/tasks.js +1 -1
  106. package/lib/testing.js +1 -1
  107. package/lib/textfile.js +1 -1
  108. package/lib/toml.js +1 -1
  109. package/lib/typescript/projenrc.js +1 -1
  110. package/lib/typescript/typescript-typedoc.js +1 -1
  111. package/lib/typescript/typescript.js +3 -3
  112. package/lib/util/synth.d.ts +6 -0
  113. package/lib/util/synth.js +42 -6
  114. package/lib/version.js +1 -1
  115. package/lib/vscode/devcontainer.js +1 -1
  116. package/lib/vscode/extensions.js +1 -1
  117. package/lib/vscode/launch-config.js +1 -1
  118. package/lib/vscode/settings.js +1 -1
  119. package/lib/vscode/vscode.js +1 -1
  120. package/lib/web/next.js +3 -3
  121. package/lib/web/postcss.js +1 -1
  122. package/lib/web/react.js +4 -4
  123. package/lib/web/tailwind.js +1 -1
  124. package/lib/xmlfile.js +1 -1
  125. package/lib/yaml.js +1 -1
  126. package/node_modules/array-timsort/LICENSE +21 -0
  127. package/node_modules/array-timsort/README.md +288 -0
  128. package/node_modules/array-timsort/package.json +55 -0
  129. package/node_modules/array-timsort/src/index.js +1080 -0
  130. package/node_modules/comment-json/LICENSE +21 -0
  131. package/node_modules/comment-json/README.md +580 -0
  132. package/node_modules/comment-json/index.d.ts +97 -0
  133. package/node_modules/comment-json/package.json +68 -0
  134. package/node_modules/comment-json/src/array.js +288 -0
  135. package/node_modules/comment-json/src/common.js +181 -0
  136. package/node_modules/comment-json/src/index.js +13 -0
  137. package/node_modules/comment-json/src/parse.js +451 -0
  138. package/node_modules/comment-json/src/stringify.js +366 -0
  139. package/node_modules/core-util-is/LICENSE +19 -0
  140. package/node_modules/core-util-is/README.md +3 -0
  141. package/node_modules/core-util-is/lib/util.js +107 -0
  142. package/node_modules/core-util-is/package.json +38 -0
  143. package/node_modules/has-own-prop/index.d.ts +17 -0
  144. package/node_modules/has-own-prop/index.js +4 -0
  145. package/node_modules/has-own-prop/license +9 -0
  146. package/node_modules/has-own-prop/package.json +33 -0
  147. package/node_modules/has-own-prop/readme.md +30 -0
  148. package/node_modules/repeat-string/LICENSE +21 -0
  149. package/node_modules/repeat-string/README.md +136 -0
  150. package/node_modules/repeat-string/index.js +70 -0
  151. package/node_modules/repeat-string/package.json +77 -0
  152. package/package.json +3 -2
@@ -0,0 +1,451 @@
1
+ // JSON formatting
2
+
3
+ const esprima = require('esprima')
4
+
5
+ const {
6
+ CommentArray,
7
+ } = require('./array')
8
+
9
+ const {
10
+ PREFIX_BEFORE,
11
+ PREFIX_AFTER_PROP,
12
+ PREFIX_AFTER_COLON,
13
+ PREFIX_AFTER_VALUE,
14
+ PREFIX_AFTER,
15
+
16
+ PREFIX_BEFORE_ALL,
17
+ PREFIX_AFTER_ALL,
18
+
19
+ BRACKET_OPEN,
20
+ BRACKET_CLOSE,
21
+ CURLY_BRACKET_OPEN,
22
+ CURLY_BRACKET_CLOSE,
23
+
24
+ COLON,
25
+ COMMA,
26
+ MINUS,
27
+ EMPTY,
28
+
29
+ UNDEFINED,
30
+
31
+ define,
32
+ assign_non_prop_comments
33
+ } = require('./common')
34
+
35
+ const tokenize = code => esprima.tokenize(code, {
36
+ comment: true,
37
+ loc: true
38
+ })
39
+
40
+ const previous_hosts = []
41
+ let comments_host = null
42
+ let unassigned_comments = null
43
+
44
+ const previous_props = []
45
+ let last_prop
46
+
47
+ let remove_comments = false
48
+ let inline = false
49
+ let tokens = null
50
+ let last = null
51
+ let current = null
52
+ let index
53
+ let reviver = null
54
+
55
+ const clean = () => {
56
+ previous_props.length =
57
+ previous_hosts.length = 0
58
+
59
+ last = null
60
+ last_prop = UNDEFINED
61
+ }
62
+
63
+ const free = () => {
64
+ clean()
65
+
66
+ tokens.length = 0
67
+
68
+ unassigned_comments =
69
+ comments_host =
70
+ tokens =
71
+ last =
72
+ current =
73
+ reviver = null
74
+ }
75
+
76
+ const symbolFor = prefix => Symbol.for(
77
+ last_prop !== UNDEFINED
78
+ ? prefix + COLON + last_prop
79
+ : prefix
80
+ )
81
+
82
+ const transform = (k, v) => reviver
83
+ ? reviver(k, v)
84
+ : v
85
+
86
+ const unexpected = () => {
87
+ const error = new SyntaxError(`Unexpected token ${current.value.slice(0, 1)}`)
88
+ Object.assign(error, current.loc.start)
89
+
90
+ throw error
91
+ }
92
+
93
+ const unexpected_end = () => {
94
+ const error = new SyntaxError('Unexpected end of JSON input')
95
+ Object.assign(error, last
96
+ ? last.loc.end
97
+ // Empty string
98
+ : {
99
+ line: 1,
100
+ column: 0
101
+ })
102
+
103
+ throw error
104
+ }
105
+
106
+ // Move the reader to the next
107
+ const next = () => {
108
+ const new_token = tokens[++ index]
109
+ inline = current
110
+ && new_token
111
+ && current.loc.end.line === new_token.loc.start.line
112
+ || false
113
+
114
+ last = current
115
+ current = new_token
116
+ }
117
+
118
+ const type = () => {
119
+ if (!current) {
120
+ unexpected_end()
121
+ }
122
+
123
+ return current.type === 'Punctuator'
124
+ ? current.value
125
+ : current.type
126
+ }
127
+
128
+ const is = t => type() === t
129
+
130
+ const expect = a => {
131
+ if (!is(a)) {
132
+ unexpected()
133
+ }
134
+ }
135
+
136
+ const set_comments_host = new_host => {
137
+ previous_hosts.push(comments_host)
138
+ comments_host = new_host
139
+ }
140
+
141
+ const restore_comments_host = () => {
142
+ comments_host = previous_hosts.pop()
143
+ }
144
+
145
+ const assign_after_comments = () => {
146
+ if (!unassigned_comments) {
147
+ return
148
+ }
149
+
150
+ const after_comments = []
151
+
152
+ for (const comment of unassigned_comments) {
153
+ // If the comment is inline, then it is an after-comma comment
154
+ if (comment.inline) {
155
+ after_comments.push(comment)
156
+ // Otherwise, all comments are before:<next-prop> comment
157
+ } else {
158
+ break
159
+ }
160
+ }
161
+
162
+ const {length} = after_comments
163
+ if (!length) {
164
+ return
165
+ }
166
+
167
+ if (length === unassigned_comments.length) {
168
+ // If unassigned_comments are all consumed
169
+ unassigned_comments = null
170
+ } else {
171
+ unassigned_comments.splice(0, length)
172
+ }
173
+
174
+ define(comments_host, symbolFor(PREFIX_AFTER), after_comments)
175
+ }
176
+
177
+ const assign_comments = prefix => {
178
+ if (!unassigned_comments) {
179
+ return
180
+ }
181
+
182
+ define(comments_host, symbolFor(prefix), unassigned_comments)
183
+
184
+ unassigned_comments = null
185
+ }
186
+
187
+ const parse_comments = prefix => {
188
+ const comments = []
189
+
190
+ while (
191
+ current
192
+ && (
193
+ is('LineComment')
194
+ || is('BlockComment')
195
+ )
196
+ ) {
197
+ const comment = {
198
+ ...current,
199
+ inline
200
+ }
201
+
202
+ // delete comment.loc
203
+ comments.push(comment)
204
+
205
+ next()
206
+ }
207
+
208
+ if (remove_comments) {
209
+ return
210
+ }
211
+
212
+ if (!comments.length) {
213
+ return
214
+ }
215
+
216
+ if (prefix) {
217
+ define(comments_host, symbolFor(prefix), comments)
218
+ return
219
+ }
220
+
221
+ unassigned_comments = comments
222
+ }
223
+
224
+ const set_prop = (prop, push) => {
225
+ if (push) {
226
+ previous_props.push(last_prop)
227
+ }
228
+
229
+ last_prop = prop
230
+ }
231
+
232
+ const restore_prop = () => {
233
+ last_prop = previous_props.pop()
234
+ }
235
+
236
+ const parse_object = () => {
237
+ const obj = {}
238
+ set_comments_host(obj)
239
+ set_prop(UNDEFINED, true)
240
+
241
+ let started = false
242
+ let name
243
+
244
+ parse_comments()
245
+
246
+ while (!is(CURLY_BRACKET_CLOSE)) {
247
+ if (started) {
248
+ assign_comments(PREFIX_AFTER_VALUE)
249
+
250
+ // key-value pair delimiter
251
+ expect(COMMA)
252
+ next()
253
+ parse_comments()
254
+
255
+ assign_after_comments()
256
+
257
+ // If there is a trailing comma, we might reach the end
258
+ // ```
259
+ // {
260
+ // "a": 1,
261
+ // }
262
+ // ```
263
+ if (is(CURLY_BRACKET_CLOSE)) {
264
+ break
265
+ }
266
+ }
267
+
268
+ started = true
269
+ expect('String')
270
+ name = JSON.parse(current.value)
271
+
272
+ set_prop(name)
273
+ assign_comments(PREFIX_BEFORE)
274
+
275
+ next()
276
+ parse_comments(PREFIX_AFTER_PROP)
277
+
278
+ expect(COLON)
279
+
280
+ next()
281
+ parse_comments(PREFIX_AFTER_COLON)
282
+
283
+ obj[name] = transform(name, walk())
284
+ parse_comments()
285
+ }
286
+
287
+ if (started) {
288
+ // If there are properties,
289
+ // then the unassigned comments are after comments
290
+ assign_comments(PREFIX_AFTER)
291
+ }
292
+
293
+ // bypass }
294
+ next()
295
+ last_prop = undefined
296
+
297
+ if (!started) {
298
+ // Otherwise, they are before comments
299
+ assign_comments(PREFIX_BEFORE)
300
+ }
301
+
302
+ restore_comments_host()
303
+ restore_prop()
304
+
305
+ return obj
306
+ }
307
+
308
+ const parse_array = () => {
309
+ const array = new CommentArray()
310
+ set_comments_host(array)
311
+ set_prop(UNDEFINED, true)
312
+
313
+ let started = false
314
+ let i = 0
315
+
316
+ parse_comments()
317
+
318
+ while (!is(BRACKET_CLOSE)) {
319
+ if (started) {
320
+ assign_comments(PREFIX_AFTER_VALUE)
321
+ expect(COMMA)
322
+ next()
323
+ parse_comments()
324
+
325
+ assign_after_comments()
326
+
327
+ if (is(BRACKET_CLOSE)) {
328
+ break
329
+ }
330
+ }
331
+
332
+ started = true
333
+
334
+ set_prop(i)
335
+ assign_comments(PREFIX_BEFORE)
336
+
337
+ array[i] = transform(i, walk())
338
+ i ++
339
+
340
+ parse_comments()
341
+ }
342
+
343
+ if (started) {
344
+ assign_comments(PREFIX_AFTER)
345
+ }
346
+
347
+ next()
348
+ last_prop = undefined
349
+
350
+ if (!started) {
351
+ assign_comments(PREFIX_BEFORE)
352
+ }
353
+
354
+ restore_comments_host()
355
+ restore_prop()
356
+
357
+ return array
358
+ }
359
+
360
+ function walk () {
361
+ let tt = type()
362
+
363
+ if (tt === CURLY_BRACKET_OPEN) {
364
+ next()
365
+ return parse_object()
366
+ }
367
+
368
+ if (tt === BRACKET_OPEN) {
369
+ next()
370
+ return parse_array()
371
+ }
372
+
373
+ let negative = EMPTY
374
+
375
+ // -1
376
+ if (tt === MINUS) {
377
+ next()
378
+ tt = type()
379
+ negative = MINUS
380
+ }
381
+
382
+ let v
383
+
384
+ switch (tt) {
385
+ case 'String':
386
+ case 'Boolean':
387
+ case 'Null':
388
+ case 'Numeric':
389
+ v = current.value
390
+ next()
391
+ return JSON.parse(negative + v)
392
+ default:
393
+ }
394
+ }
395
+
396
+ const isObject = subject => Object(subject) === subject
397
+
398
+ const parse = (code, rev, no_comments) => {
399
+ // Clean variables in closure
400
+ clean()
401
+
402
+ tokens = tokenize(code)
403
+ reviver = rev
404
+ remove_comments = no_comments
405
+
406
+ if (!tokens.length) {
407
+ unexpected_end()
408
+ }
409
+
410
+ index = - 1
411
+ next()
412
+
413
+ set_comments_host({})
414
+
415
+ parse_comments(PREFIX_BEFORE_ALL)
416
+
417
+ let result = walk()
418
+
419
+ parse_comments(PREFIX_AFTER_ALL)
420
+
421
+ if (current) {
422
+ unexpected()
423
+ }
424
+
425
+ if (!no_comments && result !== null) {
426
+ if (!isObject(result)) {
427
+ // 1 -> new Number(1)
428
+ // true -> new Boolean(1)
429
+ // "foo" -> new String("foo")
430
+
431
+ // eslint-disable-next-line no-new-object
432
+ result = new Object(result)
433
+ }
434
+
435
+ assign_non_prop_comments(result, comments_host)
436
+ }
437
+
438
+ restore_comments_host()
439
+
440
+ // reviver
441
+ result = transform('', result)
442
+
443
+ free()
444
+
445
+ return result
446
+ }
447
+
448
+ module.exports = {
449
+ parse,
450
+ tokenize
451
+ }