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.
- package/.jsii +27 -10
- package/docs/api/API.md +8 -0
- package/lib/awscdk/auto-discover.js +5 -5
- package/lib/awscdk/awscdk-app-java.js +1 -1
- package/lib/awscdk/awscdk-app-py.js +1 -1
- package/lib/awscdk/awscdk-app-ts.js +1 -1
- package/lib/awscdk/awscdk-construct.js +2 -2
- package/lib/awscdk/awscdk-deps-java.js +1 -1
- package/lib/awscdk/awscdk-deps-js.js +1 -1
- package/lib/awscdk/awscdk-deps-py.js +1 -1
- package/lib/awscdk/awscdk-deps.js +1 -1
- package/lib/awscdk/cdk-config.js +1 -1
- package/lib/awscdk/cdk-tasks.js +1 -1
- package/lib/awscdk/integration-test.js +1 -1
- package/lib/awscdk/lambda-extension.js +1 -1
- package/lib/awscdk/lambda-function.js +2 -2
- package/lib/build/build-workflow.js +1 -1
- package/lib/cdk/auto-discover-base.js +2 -2
- package/lib/cdk/construct-lib.js +1 -1
- package/lib/cdk/integration-test-base.js +1 -1
- package/lib/cdk/jsii-docgen.js +1 -1
- package/lib/cdk/jsii-project.js +1 -1
- package/lib/cdk8s/auto-discover.js +2 -2
- package/lib/cdk8s/cdk8s-app-py.js +1 -1
- package/lib/cdk8s/cdk8s-app-ts.js +1 -1
- package/lib/cdk8s/cdk8s-construct.js +1 -1
- package/lib/cdk8s/cdk8s-deps-py.js +1 -1
- package/lib/cdk8s/cdk8s-deps.js +1 -1
- package/lib/cdk8s/integration-test.js +1 -1
- package/lib/cdktf/cdktf-construct.js +1 -1
- package/lib/circleci/circleci.js +1 -1
- package/lib/component.js +1 -1
- package/lib/dependencies.js +1 -1
- package/lib/dev-env.js +1 -1
- package/lib/docker-compose.js +2 -2
- package/lib/file.js +1 -1
- package/lib/gitattributes.js +1 -1
- package/lib/github/auto-approve.js +1 -1
- package/lib/github/auto-merge.js +1 -1
- package/lib/github/dependabot.js +1 -1
- package/lib/github/github-credentials.js +1 -1
- package/lib/github/github-project.js +1 -1
- package/lib/github/github.js +1 -1
- package/lib/github/mergify.js +1 -1
- package/lib/github/pr-template.js +1 -1
- package/lib/github/pull-request-lint.js +1 -1
- package/lib/github/stale.js +1 -1
- package/lib/github/task-workflow.js +1 -1
- package/lib/github/workflows.js +1 -1
- package/lib/gitlab/configuration.js +1 -1
- package/lib/gitlab/gitlab-configuration.js +1 -1
- package/lib/gitlab/nested-configuration.js +1 -1
- package/lib/gitpod.js +1 -1
- package/lib/ignore-file.js +1 -1
- package/lib/ini.js +1 -1
- package/lib/java/java-project.js +1 -1
- package/lib/java/junit.js +1 -1
- package/lib/java/maven-compile.js +1 -1
- package/lib/java/maven-packaging.js +1 -1
- package/lib/java/maven-sample.js +1 -1
- package/lib/java/pom.js +1 -1
- package/lib/java/projenrc.js +1 -1
- package/lib/javascript/bundler.js +1 -1
- package/lib/javascript/eslint.js +6 -4
- package/lib/javascript/jest.js +1 -1
- package/lib/javascript/node-package.js +1 -1
- package/lib/javascript/node-project.js +1 -1
- package/lib/javascript/npm-config.js +1 -1
- package/lib/javascript/prettier.js +1 -1
- package/lib/javascript/projenrc.js +1 -1
- package/lib/javascript/typescript-config.js +1 -1
- package/lib/javascript/upgrade-dependencies.js +2 -2
- package/lib/json-patch.js +1 -1
- package/lib/json.d.ts +1 -1
- package/lib/json.js +3 -3
- package/lib/license.js +1 -1
- package/lib/logger.js +1 -1
- package/lib/makefile.js +1 -1
- package/lib/object-file.js +1 -1
- package/lib/project-build.js +1 -1
- package/lib/project.js +1 -1
- package/lib/projects.js +1 -1
- package/lib/projenrc-json.js +1 -1
- package/lib/python/pip.js +1 -1
- package/lib/python/poetry.js +2 -2
- package/lib/python/projenrc.js +1 -1
- package/lib/python/pytest-sample.js +1 -1
- package/lib/python/pytest.js +1 -1
- package/lib/python/python-project.js +1 -1
- package/lib/python/python-sample.js +1 -1
- package/lib/python/requirements-file.js +1 -1
- package/lib/python/setuppy.js +1 -1
- package/lib/python/setuptools.js +1 -1
- package/lib/python/venv.js +1 -1
- package/lib/readme.js +1 -1
- package/lib/release/publisher.js +1 -1
- package/lib/release/release-trigger.js +1 -1
- package/lib/release/release.js +1 -1
- package/lib/renovatebot.js +1 -1
- package/lib/sample-file.js +2 -2
- package/lib/semver.js +1 -1
- package/lib/source-code.js +1 -1
- package/lib/task-runtime.js +1 -1
- package/lib/task.js +1 -1
- package/lib/tasks.js +1 -1
- package/lib/testing.js +1 -1
- package/lib/textfile.js +1 -1
- package/lib/toml.js +1 -1
- package/lib/typescript/projenrc.js +1 -1
- package/lib/typescript/typescript-typedoc.js +1 -1
- package/lib/typescript/typescript.js +3 -3
- package/lib/util/synth.d.ts +6 -0
- package/lib/util/synth.js +42 -6
- package/lib/version.js +1 -1
- package/lib/vscode/devcontainer.js +1 -1
- package/lib/vscode/extensions.js +1 -1
- package/lib/vscode/launch-config.js +1 -1
- package/lib/vscode/settings.js +1 -1
- package/lib/vscode/vscode.js +1 -1
- package/lib/web/next.js +3 -3
- package/lib/web/postcss.js +1 -1
- package/lib/web/react.js +4 -4
- package/lib/web/tailwind.js +1 -1
- package/lib/xmlfile.js +1 -1
- package/lib/yaml.js +1 -1
- package/node_modules/array-timsort/LICENSE +21 -0
- package/node_modules/array-timsort/README.md +288 -0
- package/node_modules/array-timsort/package.json +55 -0
- package/node_modules/array-timsort/src/index.js +1080 -0
- package/node_modules/comment-json/LICENSE +21 -0
- package/node_modules/comment-json/README.md +580 -0
- package/node_modules/comment-json/index.d.ts +97 -0
- package/node_modules/comment-json/package.json +68 -0
- package/node_modules/comment-json/src/array.js +288 -0
- package/node_modules/comment-json/src/common.js +181 -0
- package/node_modules/comment-json/src/index.js +13 -0
- package/node_modules/comment-json/src/parse.js +451 -0
- package/node_modules/comment-json/src/stringify.js +366 -0
- package/node_modules/core-util-is/LICENSE +19 -0
- package/node_modules/core-util-is/README.md +3 -0
- package/node_modules/core-util-is/lib/util.js +107 -0
- package/node_modules/core-util-is/package.json +38 -0
- package/node_modules/has-own-prop/index.d.ts +17 -0
- package/node_modules/has-own-prop/index.js +4 -0
- package/node_modules/has-own-prop/license +9 -0
- package/node_modules/has-own-prop/package.json +33 -0
- package/node_modules/has-own-prop/readme.md +30 -0
- package/node_modules/repeat-string/LICENSE +21 -0
- package/node_modules/repeat-string/README.md +136 -0
- package/node_modules/repeat-string/index.js +70 -0
- package/node_modules/repeat-string/package.json +77 -0
- package/package.json +3 -2
|
@@ -0,0 +1,366 @@
|
|
|
1
|
+
const {
|
|
2
|
+
isArray, isObject, isFunction, isNumber, isString
|
|
3
|
+
} = require('core-util-is')
|
|
4
|
+
const repeat = require('repeat-string')
|
|
5
|
+
|
|
6
|
+
const {
|
|
7
|
+
PREFIX_BEFORE_ALL,
|
|
8
|
+
PREFIX_BEFORE,
|
|
9
|
+
PREFIX_AFTER_PROP,
|
|
10
|
+
PREFIX_AFTER_COLON,
|
|
11
|
+
PREFIX_AFTER_VALUE,
|
|
12
|
+
PREFIX_AFTER,
|
|
13
|
+
PREFIX_AFTER_ALL,
|
|
14
|
+
|
|
15
|
+
BRACKET_OPEN,
|
|
16
|
+
BRACKET_CLOSE,
|
|
17
|
+
CURLY_BRACKET_OPEN,
|
|
18
|
+
CURLY_BRACKET_CLOSE,
|
|
19
|
+
COLON,
|
|
20
|
+
COMMA,
|
|
21
|
+
EMPTY,
|
|
22
|
+
|
|
23
|
+
UNDEFINED
|
|
24
|
+
} = require('./common')
|
|
25
|
+
|
|
26
|
+
// eslint-disable-next-line no-control-regex, no-misleading-character-class
|
|
27
|
+
const ESCAPABLE = /[\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g
|
|
28
|
+
|
|
29
|
+
// String constants
|
|
30
|
+
const SPACE = ' '
|
|
31
|
+
const LF = '\n'
|
|
32
|
+
const STR_NULL = 'null'
|
|
33
|
+
|
|
34
|
+
// Symbol tags
|
|
35
|
+
const BEFORE = prop => `${PREFIX_BEFORE}:${prop}`
|
|
36
|
+
const AFTER_PROP = prop => `${PREFIX_AFTER_PROP}:${prop}`
|
|
37
|
+
const AFTER_COLON = prop => `${PREFIX_AFTER_COLON}:${prop}`
|
|
38
|
+
const AFTER_VALUE = prop => `${PREFIX_AFTER_VALUE}:${prop}`
|
|
39
|
+
const AFTER = prop => `${PREFIX_AFTER}:${prop}`
|
|
40
|
+
|
|
41
|
+
// table of character substitutions
|
|
42
|
+
const meta = {
|
|
43
|
+
'\b': '\\b',
|
|
44
|
+
'\t': '\\t',
|
|
45
|
+
'\n': '\\n',
|
|
46
|
+
'\f': '\\f',
|
|
47
|
+
'\r': '\\r',
|
|
48
|
+
'"': '\\"',
|
|
49
|
+
'\\': '\\\\'
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const escape = string => {
|
|
53
|
+
ESCAPABLE.lastIndex = 0
|
|
54
|
+
|
|
55
|
+
if (!ESCAPABLE.test(string)) {
|
|
56
|
+
return string
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return string.replace(ESCAPABLE, a => {
|
|
60
|
+
const c = meta[a]
|
|
61
|
+
return typeof c === 'string'
|
|
62
|
+
? c
|
|
63
|
+
: a
|
|
64
|
+
})
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// Escape no control characters, no quote characters,
|
|
68
|
+
// and no backslash characters,
|
|
69
|
+
// then we can safely slap some quotes around it.
|
|
70
|
+
const quote = string => `"${escape(string)}"`
|
|
71
|
+
const comment_stringify = (value, line) => line
|
|
72
|
+
? `//${value}`
|
|
73
|
+
: `/*${value}*/`
|
|
74
|
+
|
|
75
|
+
// display_block `boolean` whether the
|
|
76
|
+
// WHOLE block of comments is always a block group
|
|
77
|
+
const process_comments = (host, symbol_tag, deeper_gap, display_block) => {
|
|
78
|
+
const comments = host[Symbol.for(symbol_tag)]
|
|
79
|
+
if (!comments || !comments.length) {
|
|
80
|
+
return EMPTY
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
let is_line_comment = false
|
|
84
|
+
|
|
85
|
+
const str = comments.reduce((prev, {
|
|
86
|
+
inline,
|
|
87
|
+
type,
|
|
88
|
+
value
|
|
89
|
+
}) => {
|
|
90
|
+
const delimiter = inline
|
|
91
|
+
? SPACE
|
|
92
|
+
: LF + deeper_gap
|
|
93
|
+
|
|
94
|
+
is_line_comment = type === 'LineComment'
|
|
95
|
+
|
|
96
|
+
return prev + delimiter + comment_stringify(value, is_line_comment)
|
|
97
|
+
}, EMPTY)
|
|
98
|
+
|
|
99
|
+
return display_block
|
|
100
|
+
// line comment should always end with a LF
|
|
101
|
+
|| is_line_comment
|
|
102
|
+
? str + LF + deeper_gap
|
|
103
|
+
: str
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
let replacer = null
|
|
107
|
+
let indent = EMPTY
|
|
108
|
+
|
|
109
|
+
const clean = () => {
|
|
110
|
+
replacer = null
|
|
111
|
+
indent = EMPTY
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
const join = (one, two, gap) =>
|
|
115
|
+
one
|
|
116
|
+
? two
|
|
117
|
+
// Symbol.for('before') and Symbol.for('before:prop')
|
|
118
|
+
// might both exist if user mannually add comments to the object
|
|
119
|
+
// and make a mistake.
|
|
120
|
+
// SO, we are not to only trimRight but trim for both sides
|
|
121
|
+
? one + two.trim() + LF + gap
|
|
122
|
+
: one.trimRight() + LF + gap
|
|
123
|
+
: two
|
|
124
|
+
? two.trimRight() + LF + gap
|
|
125
|
+
: EMPTY
|
|
126
|
+
|
|
127
|
+
const join_content = (inside, value, gap) => {
|
|
128
|
+
const comment = process_comments(value, PREFIX_BEFORE, gap + indent, true)
|
|
129
|
+
|
|
130
|
+
return join(comment, inside, gap)
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// | deeper_gap |
|
|
134
|
+
// | gap | indent |
|
|
135
|
+
// [
|
|
136
|
+
// "foo",
|
|
137
|
+
// "bar"
|
|
138
|
+
// ]
|
|
139
|
+
const array_stringify = (value, gap) => {
|
|
140
|
+
const deeper_gap = gap + indent
|
|
141
|
+
|
|
142
|
+
const {length} = value
|
|
143
|
+
|
|
144
|
+
// From the item to before close
|
|
145
|
+
let inside = EMPTY
|
|
146
|
+
let after_comma = EMPTY
|
|
147
|
+
|
|
148
|
+
// Never use Array.prototype.forEach,
|
|
149
|
+
// that we should iterate all items
|
|
150
|
+
for (let i = 0; i < length; i ++) {
|
|
151
|
+
if (i !== 0) {
|
|
152
|
+
inside += COMMA
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
const before = join(
|
|
156
|
+
after_comma,
|
|
157
|
+
process_comments(value, BEFORE(i), deeper_gap),
|
|
158
|
+
deeper_gap
|
|
159
|
+
)
|
|
160
|
+
|
|
161
|
+
inside += before || (LF + deeper_gap)
|
|
162
|
+
|
|
163
|
+
// JSON.stringify([undefined]) => [null]
|
|
164
|
+
inside += stringify(i, value, deeper_gap) || STR_NULL
|
|
165
|
+
|
|
166
|
+
inside += process_comments(value, AFTER_VALUE(i), deeper_gap)
|
|
167
|
+
|
|
168
|
+
after_comma = process_comments(value, AFTER(i), deeper_gap)
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
inside += join(
|
|
172
|
+
after_comma,
|
|
173
|
+
process_comments(value, PREFIX_AFTER, deeper_gap),
|
|
174
|
+
deeper_gap
|
|
175
|
+
)
|
|
176
|
+
|
|
177
|
+
return BRACKET_OPEN
|
|
178
|
+
+ join_content(inside, value, gap)
|
|
179
|
+
+ BRACKET_CLOSE
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
// | deeper_gap |
|
|
183
|
+
// | gap | indent |
|
|
184
|
+
// {
|
|
185
|
+
// "foo": 1,
|
|
186
|
+
// "bar": 2
|
|
187
|
+
// }
|
|
188
|
+
const object_stringify = (value, gap) => {
|
|
189
|
+
// Due to a specification blunder in ECMAScript, typeof null is 'object',
|
|
190
|
+
// so watch out for that case.
|
|
191
|
+
if (!value) {
|
|
192
|
+
return 'null'
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
const deeper_gap = gap + indent
|
|
196
|
+
|
|
197
|
+
// From the first element to before close
|
|
198
|
+
let inside = EMPTY
|
|
199
|
+
let after_comma = EMPTY
|
|
200
|
+
let first = true
|
|
201
|
+
|
|
202
|
+
const keys = isArray(replacer)
|
|
203
|
+
? replacer
|
|
204
|
+
: Object.keys(value)
|
|
205
|
+
|
|
206
|
+
const iteratee = key => {
|
|
207
|
+
// Stringified value
|
|
208
|
+
const sv = stringify(key, value, deeper_gap)
|
|
209
|
+
|
|
210
|
+
// If a value is undefined, then the key-value pair should be ignored
|
|
211
|
+
if (sv === UNDEFINED) {
|
|
212
|
+
return
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
// The treat ment
|
|
216
|
+
if (!first) {
|
|
217
|
+
inside += COMMA
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
first = false
|
|
221
|
+
|
|
222
|
+
const before = join(
|
|
223
|
+
after_comma,
|
|
224
|
+
process_comments(value, BEFORE(key), deeper_gap),
|
|
225
|
+
deeper_gap
|
|
226
|
+
)
|
|
227
|
+
|
|
228
|
+
inside += before || (LF + deeper_gap)
|
|
229
|
+
|
|
230
|
+
inside += quote(key)
|
|
231
|
+
+ process_comments(value, AFTER_PROP(key), deeper_gap)
|
|
232
|
+
+ COLON
|
|
233
|
+
+ process_comments(value, AFTER_COLON(key), deeper_gap)
|
|
234
|
+
+ SPACE
|
|
235
|
+
+ sv
|
|
236
|
+
+ process_comments(value, AFTER_VALUE(key), deeper_gap)
|
|
237
|
+
|
|
238
|
+
after_comma = process_comments(value, AFTER(key), deeper_gap)
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
keys.forEach(iteratee)
|
|
242
|
+
|
|
243
|
+
// if (after_comma) {
|
|
244
|
+
// inside += COMMA
|
|
245
|
+
// }
|
|
246
|
+
|
|
247
|
+
inside += join(
|
|
248
|
+
after_comma,
|
|
249
|
+
process_comments(value, PREFIX_AFTER, deeper_gap),
|
|
250
|
+
deeper_gap
|
|
251
|
+
)
|
|
252
|
+
|
|
253
|
+
return CURLY_BRACKET_OPEN
|
|
254
|
+
+ join_content(inside, value, gap)
|
|
255
|
+
+ CURLY_BRACKET_CLOSE
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
// @param {string} key
|
|
259
|
+
// @param {Object} holder
|
|
260
|
+
// @param {function()|Array} replacer
|
|
261
|
+
// @param {string} indent
|
|
262
|
+
// @param {string} gap
|
|
263
|
+
function stringify (key, holder, gap) {
|
|
264
|
+
let value = holder[key]
|
|
265
|
+
|
|
266
|
+
// If the value has a toJSON method, call it to obtain a replacement value.
|
|
267
|
+
if (isObject(value) && isFunction(value.toJSON)) {
|
|
268
|
+
value = value.toJSON(key)
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
// If we were called with a replacer function, then call the replacer to
|
|
272
|
+
// obtain a replacement value.
|
|
273
|
+
if (isFunction(replacer)) {
|
|
274
|
+
value = replacer.call(holder, key, value)
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
switch (typeof value) {
|
|
278
|
+
case 'string':
|
|
279
|
+
return quote(value)
|
|
280
|
+
|
|
281
|
+
case 'number':
|
|
282
|
+
// JSON numbers must be finite. Encode non-finite numbers as null.
|
|
283
|
+
return Number.isFinite(value) ? String(value) : STR_NULL
|
|
284
|
+
|
|
285
|
+
case 'boolean':
|
|
286
|
+
case 'null':
|
|
287
|
+
|
|
288
|
+
// If the value is a boolean or null, convert it to a string. Note:
|
|
289
|
+
// typeof null does not produce 'null'. The case is included here in
|
|
290
|
+
// the remote chance that this gets fixed someday.
|
|
291
|
+
return String(value)
|
|
292
|
+
|
|
293
|
+
// If the type is 'object', we might be dealing with an object or an array or
|
|
294
|
+
// null.
|
|
295
|
+
case 'object':
|
|
296
|
+
return isArray(value)
|
|
297
|
+
? array_stringify(value, gap)
|
|
298
|
+
: object_stringify(value, gap)
|
|
299
|
+
|
|
300
|
+
// undefined
|
|
301
|
+
default:
|
|
302
|
+
// JSON.stringify(undefined) === undefined
|
|
303
|
+
// JSON.stringify('foo', () => undefined) === undefined
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
const get_indent = space => isString(space)
|
|
308
|
+
// If the space parameter is a string, it will be used as the indent string.
|
|
309
|
+
? space
|
|
310
|
+
: isNumber(space)
|
|
311
|
+
? repeat(SPACE, space)
|
|
312
|
+
: EMPTY
|
|
313
|
+
|
|
314
|
+
const {toString} = Object.prototype
|
|
315
|
+
const PRIMITIVE_OBJECT_TYPES = [
|
|
316
|
+
'[object Number]',
|
|
317
|
+
'[object String]',
|
|
318
|
+
'[object Boolean]'
|
|
319
|
+
]
|
|
320
|
+
|
|
321
|
+
const is_primitive_object = subject => {
|
|
322
|
+
if (typeof subject !== 'object') {
|
|
323
|
+
return false
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
const str = toString.call(subject)
|
|
327
|
+
return PRIMITIVE_OBJECT_TYPES.includes(str)
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
// @param {function()|Array} replacer
|
|
331
|
+
// @param {string|number} space
|
|
332
|
+
module.exports = (value, replacer_, space) => {
|
|
333
|
+
// The stringify method takes a value and an optional replacer, and an optional
|
|
334
|
+
// space parameter, and returns a JSON text. The replacer can be a function
|
|
335
|
+
// that can replace values, or an array of strings that will select the keys.
|
|
336
|
+
// A default replacer method can be provided. Use of the space parameter can
|
|
337
|
+
// produce text that is more easily readable.
|
|
338
|
+
|
|
339
|
+
// If the space parameter is a number, make an indent string containing that
|
|
340
|
+
// many spaces.
|
|
341
|
+
const indent_ = get_indent(space)
|
|
342
|
+
|
|
343
|
+
if (!indent_) {
|
|
344
|
+
return JSON.stringify(value, replacer_)
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
// vanilla `JSON.parse` allow invalid replacer
|
|
348
|
+
if (!isFunction(replacer_) && !isArray(replacer_)) {
|
|
349
|
+
replacer_ = null
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
replacer = replacer_
|
|
353
|
+
indent = indent_
|
|
354
|
+
|
|
355
|
+
const str = is_primitive_object(value)
|
|
356
|
+
? JSON.stringify(value)
|
|
357
|
+
: stringify('', {'': value}, EMPTY)
|
|
358
|
+
|
|
359
|
+
clean()
|
|
360
|
+
|
|
361
|
+
return isObject(value)
|
|
362
|
+
? process_comments(value, PREFIX_BEFORE_ALL, EMPTY).trimLeft()
|
|
363
|
+
+ str
|
|
364
|
+
+ process_comments(value, PREFIX_AFTER_ALL, EMPTY).trimRight()
|
|
365
|
+
: str
|
|
366
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Copyright Node.js contributors. All rights reserved.
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
+
of this software and associated documentation files (the "Software"), to
|
|
5
|
+
deal in the Software without restriction, including without limitation the
|
|
6
|
+
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
|
7
|
+
sell copies of the Software, and to permit persons to whom the Software is
|
|
8
|
+
furnished to do so, subject to the following conditions:
|
|
9
|
+
|
|
10
|
+
The above copyright notice and this permission notice shall be included in
|
|
11
|
+
all copies or substantial portions of the Software.
|
|
12
|
+
|
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
18
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
19
|
+
IN THE SOFTWARE.
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
// Copyright Joyent, Inc. and other Node contributors.
|
|
2
|
+
//
|
|
3
|
+
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
4
|
+
// copy of this software and associated documentation files (the
|
|
5
|
+
// "Software"), to deal in the Software without restriction, including
|
|
6
|
+
// without limitation the rights to use, copy, modify, merge, publish,
|
|
7
|
+
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
|
8
|
+
// persons to whom the Software is furnished to do so, subject to the
|
|
9
|
+
// following conditions:
|
|
10
|
+
//
|
|
11
|
+
// The above copyright notice and this permission notice shall be included
|
|
12
|
+
// in all copies or substantial portions of the Software.
|
|
13
|
+
//
|
|
14
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
15
|
+
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
16
|
+
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
|
17
|
+
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
|
18
|
+
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
19
|
+
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
|
20
|
+
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
21
|
+
|
|
22
|
+
// NOTE: These type checking functions intentionally don't use `instanceof`
|
|
23
|
+
// because it is fragile and can be easily faked with `Object.create()`.
|
|
24
|
+
|
|
25
|
+
function isArray(arg) {
|
|
26
|
+
if (Array.isArray) {
|
|
27
|
+
return Array.isArray(arg);
|
|
28
|
+
}
|
|
29
|
+
return objectToString(arg) === '[object Array]';
|
|
30
|
+
}
|
|
31
|
+
exports.isArray = isArray;
|
|
32
|
+
|
|
33
|
+
function isBoolean(arg) {
|
|
34
|
+
return typeof arg === 'boolean';
|
|
35
|
+
}
|
|
36
|
+
exports.isBoolean = isBoolean;
|
|
37
|
+
|
|
38
|
+
function isNull(arg) {
|
|
39
|
+
return arg === null;
|
|
40
|
+
}
|
|
41
|
+
exports.isNull = isNull;
|
|
42
|
+
|
|
43
|
+
function isNullOrUndefined(arg) {
|
|
44
|
+
return arg == null;
|
|
45
|
+
}
|
|
46
|
+
exports.isNullOrUndefined = isNullOrUndefined;
|
|
47
|
+
|
|
48
|
+
function isNumber(arg) {
|
|
49
|
+
return typeof arg === 'number';
|
|
50
|
+
}
|
|
51
|
+
exports.isNumber = isNumber;
|
|
52
|
+
|
|
53
|
+
function isString(arg) {
|
|
54
|
+
return typeof arg === 'string';
|
|
55
|
+
}
|
|
56
|
+
exports.isString = isString;
|
|
57
|
+
|
|
58
|
+
function isSymbol(arg) {
|
|
59
|
+
return typeof arg === 'symbol';
|
|
60
|
+
}
|
|
61
|
+
exports.isSymbol = isSymbol;
|
|
62
|
+
|
|
63
|
+
function isUndefined(arg) {
|
|
64
|
+
return arg === void 0;
|
|
65
|
+
}
|
|
66
|
+
exports.isUndefined = isUndefined;
|
|
67
|
+
|
|
68
|
+
function isRegExp(re) {
|
|
69
|
+
return objectToString(re) === '[object RegExp]';
|
|
70
|
+
}
|
|
71
|
+
exports.isRegExp = isRegExp;
|
|
72
|
+
|
|
73
|
+
function isObject(arg) {
|
|
74
|
+
return typeof arg === 'object' && arg !== null;
|
|
75
|
+
}
|
|
76
|
+
exports.isObject = isObject;
|
|
77
|
+
|
|
78
|
+
function isDate(d) {
|
|
79
|
+
return objectToString(d) === '[object Date]';
|
|
80
|
+
}
|
|
81
|
+
exports.isDate = isDate;
|
|
82
|
+
|
|
83
|
+
function isError(e) {
|
|
84
|
+
return (objectToString(e) === '[object Error]' || e instanceof Error);
|
|
85
|
+
}
|
|
86
|
+
exports.isError = isError;
|
|
87
|
+
|
|
88
|
+
function isFunction(arg) {
|
|
89
|
+
return typeof arg === 'function';
|
|
90
|
+
}
|
|
91
|
+
exports.isFunction = isFunction;
|
|
92
|
+
|
|
93
|
+
function isPrimitive(arg) {
|
|
94
|
+
return arg === null ||
|
|
95
|
+
typeof arg === 'boolean' ||
|
|
96
|
+
typeof arg === 'number' ||
|
|
97
|
+
typeof arg === 'string' ||
|
|
98
|
+
typeof arg === 'symbol' || // ES6 symbol
|
|
99
|
+
typeof arg === 'undefined';
|
|
100
|
+
}
|
|
101
|
+
exports.isPrimitive = isPrimitive;
|
|
102
|
+
|
|
103
|
+
exports.isBuffer = require('buffer').Buffer.isBuffer;
|
|
104
|
+
|
|
105
|
+
function objectToString(o) {
|
|
106
|
+
return Object.prototype.toString.call(o);
|
|
107
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "core-util-is",
|
|
3
|
+
"version": "1.0.3",
|
|
4
|
+
"description": "The `util.is*` functions introduced in Node v0.12.",
|
|
5
|
+
"main": "lib/util.js",
|
|
6
|
+
"files": [
|
|
7
|
+
"lib"
|
|
8
|
+
],
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git://github.com/isaacs/core-util-is"
|
|
12
|
+
},
|
|
13
|
+
"keywords": [
|
|
14
|
+
"util",
|
|
15
|
+
"isBuffer",
|
|
16
|
+
"isArray",
|
|
17
|
+
"isNumber",
|
|
18
|
+
"isString",
|
|
19
|
+
"isRegExp",
|
|
20
|
+
"isThis",
|
|
21
|
+
"isThat",
|
|
22
|
+
"polyfill"
|
|
23
|
+
],
|
|
24
|
+
"author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)",
|
|
25
|
+
"license": "MIT",
|
|
26
|
+
"bugs": {
|
|
27
|
+
"url": "https://github.com/isaacs/core-util-is/issues"
|
|
28
|
+
},
|
|
29
|
+
"scripts": {
|
|
30
|
+
"test": "tap test.js",
|
|
31
|
+
"preversion": "npm test",
|
|
32
|
+
"postversion": "npm publish",
|
|
33
|
+
"prepublishOnly": "git push origin --follow-tags"
|
|
34
|
+
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"tap": "^15.0.9"
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
Shortcut for `Object.prototype.hasOwnProperty.call(object, property)`.
|
|
3
|
+
|
|
4
|
+
@example
|
|
5
|
+
```
|
|
6
|
+
import hasOwnProp = require('has-own-prop');
|
|
7
|
+
|
|
8
|
+
hasOwnProp({}, 'hello');
|
|
9
|
+
//=> false
|
|
10
|
+
|
|
11
|
+
hasOwnProp([1, 2, 3], 0);
|
|
12
|
+
//=> true
|
|
13
|
+
```
|
|
14
|
+
*/
|
|
15
|
+
declare function hasOwnProp(object: unknown, key: string | number | symbol): boolean;
|
|
16
|
+
|
|
17
|
+
export = hasOwnProp;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "has-own-prop",
|
|
3
|
+
"version": "2.0.0",
|
|
4
|
+
"description": "A safer `.hasOwnProperty()`",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": "sindresorhus/has-own-prop",
|
|
7
|
+
"author": {
|
|
8
|
+
"name": "Sindre Sorhus",
|
|
9
|
+
"email": "sindresorhus@gmail.com",
|
|
10
|
+
"url": "sindresorhus.com"
|
|
11
|
+
},
|
|
12
|
+
"engines": {
|
|
13
|
+
"node": ">=8"
|
|
14
|
+
},
|
|
15
|
+
"scripts": {
|
|
16
|
+
"test": "xo && ava && tsd"
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"index.js",
|
|
20
|
+
"index.d.ts"
|
|
21
|
+
],
|
|
22
|
+
"keywords": [
|
|
23
|
+
"object",
|
|
24
|
+
"has",
|
|
25
|
+
"own",
|
|
26
|
+
"property"
|
|
27
|
+
],
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"ava": "^2.1.0",
|
|
30
|
+
"tsd": "^0.7.3",
|
|
31
|
+
"xo": "^0.24.0"
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# has-own-prop [](https://travis-ci.org/sindresorhus/has-own-prop)
|
|
2
|
+
|
|
3
|
+
> A safer `.hasOwnProperty()`
|
|
4
|
+
|
|
5
|
+
Shortcut for `Object.prototype.hasOwnProperty.call(object, property)`.
|
|
6
|
+
|
|
7
|
+
You shouldn't use `.hasOwnProperty()` as it won't exist on [objects created with `Object.create(null)`](https://stackoverflow.com/a/12017703/64949) or it can have been overridden.
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
## Install
|
|
11
|
+
|
|
12
|
+
```
|
|
13
|
+
$ npm install has-own-prop
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
```js
|
|
20
|
+
const hasOwnProp = require('has-own-prop');
|
|
21
|
+
|
|
22
|
+
const object = Object.create(null);
|
|
23
|
+
object.unicorn = true;
|
|
24
|
+
|
|
25
|
+
object.hasOwnProperty('unicorn');
|
|
26
|
+
//=> 'TypeError: undefined is not a function'
|
|
27
|
+
|
|
28
|
+
hasOwnProp(object, 'unicorn');
|
|
29
|
+
//=> true
|
|
30
|
+
```
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2014-2016, Jon Schlinkert.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|