projen 0.65.49 → 0.65.50

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 (153) 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/run-task.js +1845 -0
  101. package/lib/sample-file.js +2 -2
  102. package/lib/semver.js +1 -1
  103. package/lib/source-code.js +1 -1
  104. package/lib/task-runtime.js +1 -1
  105. package/lib/task.js +1 -1
  106. package/lib/tasks.js +1 -1
  107. package/lib/testing.js +1 -1
  108. package/lib/textfile.js +1 -1
  109. package/lib/toml.js +1 -1
  110. package/lib/typescript/projenrc.js +1 -1
  111. package/lib/typescript/typescript-typedoc.js +1 -1
  112. package/lib/typescript/typescript.js +3 -3
  113. package/lib/util/synth.d.ts +6 -0
  114. package/lib/util/synth.js +33 -5
  115. package/lib/version.js +1 -1
  116. package/lib/vscode/devcontainer.js +1 -1
  117. package/lib/vscode/extensions.js +1 -1
  118. package/lib/vscode/launch-config.js +1 -1
  119. package/lib/vscode/settings.js +1 -1
  120. package/lib/vscode/vscode.js +1 -1
  121. package/lib/web/next.js +3 -3
  122. package/lib/web/postcss.js +1 -1
  123. package/lib/web/react.js +4 -4
  124. package/lib/web/tailwind.js +1 -1
  125. package/lib/xmlfile.js +1 -1
  126. package/lib/yaml.js +1 -1
  127. package/node_modules/array-timsort/LICENSE +21 -0
  128. package/node_modules/array-timsort/README.md +288 -0
  129. package/node_modules/array-timsort/package.json +55 -0
  130. package/node_modules/array-timsort/src/index.js +1080 -0
  131. package/node_modules/comment-json/LICENSE +21 -0
  132. package/node_modules/comment-json/README.md +580 -0
  133. package/node_modules/comment-json/index.d.ts +97 -0
  134. package/node_modules/comment-json/package.json +68 -0
  135. package/node_modules/comment-json/src/array.js +288 -0
  136. package/node_modules/comment-json/src/common.js +181 -0
  137. package/node_modules/comment-json/src/index.js +13 -0
  138. package/node_modules/comment-json/src/parse.js +451 -0
  139. package/node_modules/comment-json/src/stringify.js +366 -0
  140. package/node_modules/core-util-is/LICENSE +19 -0
  141. package/node_modules/core-util-is/README.md +3 -0
  142. package/node_modules/core-util-is/lib/util.js +107 -0
  143. package/node_modules/core-util-is/package.json +38 -0
  144. package/node_modules/has-own-prop/index.d.ts +17 -0
  145. package/node_modules/has-own-prop/index.js +4 -0
  146. package/node_modules/has-own-prop/license +9 -0
  147. package/node_modules/has-own-prop/package.json +33 -0
  148. package/node_modules/has-own-prop/readme.md +30 -0
  149. package/node_modules/repeat-string/LICENSE +21 -0
  150. package/node_modules/repeat-string/README.md +136 -0
  151. package/node_modules/repeat-string/index.js +70 -0
  152. package/node_modules/repeat-string/package.json +77 -0
  153. package/package.json +3 -1
@@ -0,0 +1,68 @@
1
+ {
2
+ "name": "comment-json",
3
+ "version": "4.2.2",
4
+ "description": "Parse and stringify JSON with comments. It will retain comments even after saved!",
5
+ "main": "src/index.js",
6
+ "scripts": {
7
+ "test": "npm run test:only",
8
+ "test:only": "npm run test:ts && npm run test:node",
9
+ "test:ts": "tsc test/ts/test-ts.ts && node test/ts/test-ts.js",
10
+ "test:node": "NODE_DEBUG=comment-json nyc ava --timeout=10s --verbose",
11
+ "test:dev": "npm run test:only && npm run report:dev",
12
+ "lint": "eslint .",
13
+ "fix": "eslint . --fix",
14
+ "posttest": "npm run report",
15
+ "report": "nyc report --reporter=text-lcov > coverage.lcov && codecov",
16
+ "report:dev": "nyc report --reporter=html && npm run report:open",
17
+ "report:open": "open coverage/index.html"
18
+ },
19
+ "files": [
20
+ "src/",
21
+ "index.d.ts"
22
+ ],
23
+ "repository": {
24
+ "type": "git",
25
+ "url": "git://github.com/kaelzhang/node-comment-json.git"
26
+ },
27
+ "keywords": [
28
+ "comment-json",
29
+ "comments",
30
+ "annotations",
31
+ "json",
32
+ "json-stringify",
33
+ "json-parse",
34
+ "parser",
35
+ "comments-json",
36
+ "json-comments"
37
+ ],
38
+ "engines": {
39
+ "node": ">= 6"
40
+ },
41
+ "ava": {
42
+ "files": [
43
+ "test/*.test.js"
44
+ ]
45
+ },
46
+ "author": "kaelzhang",
47
+ "license": "MIT",
48
+ "bugs": {
49
+ "url": "https://github.com/kaelzhang/node-comment-json/issues"
50
+ },
51
+ "devDependencies": {
52
+ "@ostai/eslint-config": "^3.6.0",
53
+ "ava": "^4.0.1",
54
+ "codecov": "^3.8.2",
55
+ "eslint": "^8.8.0",
56
+ "eslint-plugin-import": "^2.25.4",
57
+ "nyc": "^15.1.0",
58
+ "test-fixture": "^2.4.1",
59
+ "typescript": "^4.5.5"
60
+ },
61
+ "dependencies": {
62
+ "array-timsort": "^1.0.3",
63
+ "core-util-is": "^1.0.3",
64
+ "esprima": "^4.0.1",
65
+ "has-own-prop": "^2.0.0",
66
+ "repeat-string": "^1.6.1"
67
+ }
68
+ }
@@ -0,0 +1,288 @@
1
+ const {isArray} = require('core-util-is')
2
+ const {sort} = require('array-timsort')
3
+
4
+ const {
5
+ SYMBOL_PREFIXES,
6
+
7
+ UNDEFINED,
8
+
9
+ symbol,
10
+ copy_comments,
11
+ swap_comments
12
+ } = require('./common')
13
+
14
+ const reverse_comments = array => {
15
+ const {length} = array
16
+ let i = 0
17
+ const max = length / 2
18
+
19
+ for (; i < max; i ++) {
20
+ swap_comments(array, i, length - i - 1)
21
+ }
22
+ }
23
+
24
+ const move_comment = (target, source, i, offset, remove) => {
25
+ copy_comments(target, source, i + offset, i, remove)
26
+ }
27
+
28
+ const move_comments = (
29
+ // `Array` target array
30
+ target,
31
+ // `Array` source array
32
+ source,
33
+ // `number` start index
34
+ start,
35
+ // `number` number of indexes to move
36
+ count,
37
+ // `number` offset to move
38
+ offset,
39
+ // `boolean` whether should remove the comments from source
40
+ remove
41
+ ) => {
42
+ if (offset > 0) {
43
+ let i = count
44
+ // | count | offset |
45
+ // source: -------------
46
+ // target: -------------
47
+ // | remove |
48
+ // => remove === offset
49
+
50
+ // From [count - 1, 0]
51
+ while (i -- > 0) {
52
+ move_comment(target, source, start + i, offset, remove)
53
+ }
54
+ return
55
+ }
56
+
57
+ let i = 0
58
+ // | remove | count |
59
+ // -------------
60
+ // -------------
61
+ // | offset |
62
+
63
+ // From [0, count - 1]
64
+ while (i < count) {
65
+ const ii = i ++
66
+ move_comment(target, source, start + ii, offset, remove)
67
+ }
68
+ }
69
+
70
+ const remove_comments = (array, key) => {
71
+ SYMBOL_PREFIXES.forEach(prefix => {
72
+ const prop = symbol(prefix, key)
73
+ delete array[prop]
74
+ })
75
+ }
76
+
77
+ const get_mapped = (map, key) => {
78
+ let mapped = key
79
+
80
+ while (mapped in map) {
81
+ mapped = map[mapped]
82
+ }
83
+
84
+ return mapped
85
+ }
86
+
87
+ class CommentArray extends Array {
88
+ // - deleteCount + items.length
89
+
90
+ // We should avoid `splice(begin, deleteCount, ...items)`,
91
+ // because `splice(0, undefined)` is not equivalent to `splice(0)`,
92
+ // as well as:
93
+ // - slice
94
+ splice (...args) {
95
+ const {length} = this
96
+ const ret = super.splice(...args)
97
+
98
+ // #16
99
+ // If no element removed, we might still need to move comments,
100
+ // because splice could add new items
101
+
102
+ // if (!ret.length) {
103
+ // return ret
104
+ // }
105
+
106
+ // JavaScript syntax is silly
107
+ // eslint-disable-next-line prefer-const
108
+ let [begin, deleteCount, ...items] = args
109
+
110
+ if (begin < 0) {
111
+ begin += length
112
+ }
113
+
114
+ if (arguments.length === 1) {
115
+ deleteCount = length - begin
116
+ } else {
117
+ deleteCount = Math.min(length - begin, deleteCount)
118
+ }
119
+
120
+ const {
121
+ length: item_length
122
+ } = items
123
+
124
+ // itemsToDelete: -
125
+ // itemsToAdd: +
126
+ // | dc | count |
127
+ // =======-------------============
128
+ // =======++++++============
129
+ // | il |
130
+ const offset = item_length - deleteCount
131
+ const start = begin + deleteCount
132
+ const count = length - start
133
+
134
+ move_comments(this, this, start, count, offset, true)
135
+
136
+ return ret
137
+ }
138
+
139
+ slice (...args) {
140
+ const {length} = this
141
+ const array = super.slice(...args)
142
+ if (!array.length) {
143
+ return new CommentArray()
144
+ }
145
+
146
+ let [begin, before] = args
147
+
148
+ // Ref:
149
+ // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice
150
+ if (before === UNDEFINED) {
151
+ before = length
152
+ } else if (before < 0) {
153
+ before += length
154
+ }
155
+
156
+ if (begin < 0) {
157
+ begin += length
158
+ } else if (begin === UNDEFINED) {
159
+ begin = 0
160
+ }
161
+
162
+ move_comments(array, this, begin, before - begin, - begin)
163
+
164
+ return array
165
+ }
166
+
167
+ unshift (...items) {
168
+ const {length} = this
169
+ const ret = super.unshift(...items)
170
+ const {
171
+ length: items_length
172
+ } = items
173
+
174
+ if (items_length > 0) {
175
+ move_comments(this, this, 0, length, items_length, true)
176
+ }
177
+
178
+ return ret
179
+ }
180
+
181
+ shift () {
182
+ const ret = super.shift()
183
+ const {length} = this
184
+
185
+ remove_comments(this, 0)
186
+ move_comments(this, this, 1, length, - 1, true)
187
+
188
+ return ret
189
+ }
190
+
191
+ reverse () {
192
+ super.reverse()
193
+
194
+ reverse_comments(this)
195
+
196
+ return this
197
+ }
198
+
199
+ pop () {
200
+ const ret = super.pop()
201
+
202
+ // Removes comments
203
+ remove_comments(this, this.length)
204
+
205
+ return ret
206
+ }
207
+
208
+ concat (...items) {
209
+ let {length} = this
210
+ const ret = super.concat(...items)
211
+
212
+ if (!items.length) {
213
+ return ret
214
+ }
215
+
216
+ move_comments(ret, this, 0, this.length, 0)
217
+
218
+ items.forEach(item => {
219
+ const prev = length
220
+ length += isArray(item)
221
+ ? item.length
222
+ : 1
223
+
224
+ if (!(item instanceof CommentArray)) {
225
+ return
226
+ }
227
+
228
+ move_comments(ret, item, 0, item.length, prev)
229
+ })
230
+
231
+ return ret
232
+ }
233
+
234
+ sort (...args) {
235
+ const result = sort(
236
+ this,
237
+ // Make sure there is no more than one argument
238
+ ...args.slice(0, 1)
239
+ )
240
+
241
+ // For example,
242
+ // if we sort ['b', 'd', 'c', 'a'],
243
+ // then `result` will be [3, 0, 2, 1], and the array is ['a', 'b', 'c', 'd']
244
+
245
+ // First, we swap index 0 (b) and index 3 (a), then the array comments are
246
+ // ['a.comments', 'd.comments', 'c.comments', 'b.comments']
247
+ // index 0 is finalized
248
+ // index 3 is actually mapped to original index 0, we present as 0 -> 3
249
+
250
+ // Then swap index 1 (d) and index 0 (-> 3, b)
251
+ // 1 (index) -> 0 (new index) -> 3 (real_index)
252
+ // ['d.comments', 'b.comments', 'c.comments', 'd.comments']
253
+ // index 1 is finalized
254
+ // index 3 is contains the item of original index 1
255
+ // - we present as 1 -> 3
256
+ // - it is ok that we don't remove mapping 0 -> 3
257
+
258
+ // Then index 2 should be skipped
259
+
260
+ // Then swap index 3 (d) and index 1 (-> 3, b), skipped
261
+
262
+ const map = Object.create(null)
263
+
264
+ result.forEach((source_index, index) => {
265
+ if (source_index === index) {
266
+ return
267
+ }
268
+
269
+ const real_source_index = get_mapped(map, source_index)
270
+
271
+ if (real_source_index === index) {
272
+ return
273
+ }
274
+
275
+ // The item of index `index` gets the final value
276
+ // delete map[index]
277
+ map[index] = real_source_index
278
+
279
+ swap_comments(this, index, real_source_index)
280
+ })
281
+
282
+ return this
283
+ }
284
+ }
285
+
286
+ module.exports = {
287
+ CommentArray
288
+ }
@@ -0,0 +1,181 @@
1
+ const hasOwnProperty = require('has-own-prop')
2
+ const {
3
+ isObject,
4
+ isArray,
5
+ isString,
6
+ isNumber
7
+ } = require('core-util-is')
8
+
9
+ const PREFIX_BEFORE = 'before'
10
+ const PREFIX_AFTER_PROP = 'after-prop'
11
+ const PREFIX_AFTER_COLON = 'after-colon'
12
+ const PREFIX_AFTER_VALUE = 'after-value'
13
+ const PREFIX_AFTER = 'after'
14
+
15
+ const PREFIX_BEFORE_ALL = 'before-all'
16
+ const PREFIX_AFTER_ALL = 'after-all'
17
+
18
+ const BRACKET_OPEN = '['
19
+ const BRACKET_CLOSE = ']'
20
+ const CURLY_BRACKET_OPEN = '{'
21
+ const CURLY_BRACKET_CLOSE = '}'
22
+ const COMMA = ','
23
+ const EMPTY = ''
24
+ const MINUS = '-'
25
+
26
+ const SYMBOL_PREFIXES = [
27
+ PREFIX_BEFORE,
28
+ PREFIX_AFTER_PROP,
29
+ PREFIX_AFTER_COLON,
30
+ PREFIX_AFTER_VALUE,
31
+ PREFIX_AFTER
32
+ ]
33
+
34
+ const NON_PROP_SYMBOL_KEYS = [
35
+ PREFIX_BEFORE,
36
+ PREFIX_BEFORE_ALL,
37
+ PREFIX_AFTER_ALL
38
+ ].map(Symbol.for)
39
+
40
+ const COLON = ':'
41
+ const UNDEFINED = undefined
42
+
43
+ const symbol = (prefix, key) => Symbol.for(prefix + COLON + key)
44
+
45
+ const define = (target, key, value) => Object.defineProperty(target, key, {
46
+ value,
47
+ writable: true,
48
+ configurable: true
49
+ })
50
+
51
+ const copy_comments_by_kind = (
52
+ target, source, target_key, source_key, prefix, remove_source
53
+ ) => {
54
+ const source_prop = symbol(prefix, source_key)
55
+ if (!hasOwnProperty(source, source_prop)) {
56
+ return
57
+ }
58
+
59
+ const target_prop = target_key === source_key
60
+ ? source_prop
61
+ : symbol(prefix, target_key)
62
+
63
+ define(target, target_prop, source[source_prop])
64
+
65
+ if (remove_source) {
66
+ delete source[source_prop]
67
+ }
68
+ }
69
+
70
+ const copy_comments = (
71
+ target, source, target_key, source_key, remove_source
72
+ ) => {
73
+ SYMBOL_PREFIXES.forEach(prefix => {
74
+ copy_comments_by_kind(
75
+ target, source, target_key, source_key, prefix, remove_source
76
+ )
77
+ })
78
+ }
79
+
80
+ const swap_comments = (array, from, to) => {
81
+ if (from === to) {
82
+ return
83
+ }
84
+
85
+ SYMBOL_PREFIXES.forEach(prefix => {
86
+ const target_prop = symbol(prefix, to)
87
+ if (!hasOwnProperty(array, target_prop)) {
88
+ copy_comments_by_kind(array, array, to, from, prefix, true)
89
+ return
90
+ }
91
+
92
+ const comments = array[target_prop]
93
+ delete array[target_prop]
94
+
95
+ copy_comments_by_kind(array, array, to, from, prefix, true)
96
+ define(array, symbol(prefix, from), comments)
97
+ })
98
+ }
99
+
100
+ const assign_non_prop_comments = (target, source) => {
101
+ NON_PROP_SYMBOL_KEYS.forEach(key => {
102
+ const comments = source[key]
103
+
104
+ if (comments) {
105
+ define(target, key, comments)
106
+ }
107
+ })
108
+ }
109
+
110
+ // Assign keys and comments
111
+ const assign = (target, source, keys) => {
112
+ keys.forEach(key => {
113
+ if (!isString(key) && !isNumber(key)) {
114
+ return
115
+ }
116
+
117
+ if (!hasOwnProperty(source, key)) {
118
+ return
119
+ }
120
+
121
+ target[key] = source[key]
122
+ copy_comments(target, source, key, key)
123
+ })
124
+
125
+ return target
126
+ }
127
+
128
+ module.exports = {
129
+ SYMBOL_PREFIXES,
130
+
131
+ PREFIX_BEFORE,
132
+ PREFIX_AFTER_PROP,
133
+ PREFIX_AFTER_COLON,
134
+ PREFIX_AFTER_VALUE,
135
+ PREFIX_AFTER,
136
+
137
+ PREFIX_BEFORE_ALL,
138
+ PREFIX_AFTER_ALL,
139
+
140
+ BRACKET_OPEN,
141
+ BRACKET_CLOSE,
142
+ CURLY_BRACKET_OPEN,
143
+ CURLY_BRACKET_CLOSE,
144
+
145
+ COLON,
146
+ COMMA,
147
+ MINUS,
148
+ EMPTY,
149
+
150
+ UNDEFINED,
151
+
152
+ symbol,
153
+ define,
154
+ copy_comments,
155
+ swap_comments,
156
+ assign_non_prop_comments,
157
+
158
+ assign (target, source, keys) {
159
+ if (!isObject(target)) {
160
+ throw new TypeError('Cannot convert undefined or null to object')
161
+ }
162
+
163
+ if (!isObject(source)) {
164
+ return target
165
+ }
166
+
167
+ if (keys === UNDEFINED) {
168
+ keys = Object.keys(source)
169
+ // We assign non-property comments
170
+ // if argument `keys` is not specified
171
+ assign_non_prop_comments(target, source)
172
+ } else if (!isArray(keys)) {
173
+ throw new TypeError('keys must be array or undefined')
174
+ } else if (keys.length === 0) {
175
+ // Or argument `keys` is an empty array
176
+ assign_non_prop_comments(target, source)
177
+ }
178
+
179
+ return assign(target, source, keys)
180
+ }
181
+ }
@@ -0,0 +1,13 @@
1
+ const {parse, tokenize} = require('./parse')
2
+ const stringify = require('./stringify')
3
+ const {CommentArray} = require('./array')
4
+ const {assign} = require('./common')
5
+
6
+ module.exports = {
7
+ parse,
8
+ stringify,
9
+ tokenize,
10
+
11
+ CommentArray,
12
+ assign
13
+ }