@prantlf/jsonlint 13.0.1 → 14.0.0

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/CHANGELOG.md CHANGED
@@ -1,3 +1,26 @@
1
+ # [14.0.0](https://github.com/prantlf/jsonlint/compare/v13.1.0...v14.0.0) (2023-03-05)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * Replace commander with hand-written command-line parser ([af0ea29](https://github.com/prantlf/jsonlint/commit/af0ea29c3f39ea713fc0bd72829678067a6c1fc0))
7
+
8
+
9
+ ### BREAKING CHANGES
10
+
11
+ * Although you shouldn't notice any change on the behaviour of the command line, something unexpected might've changed. Something did change
12
+ - if you're annoyed by inserting "--" between the multi-value option and other
13
+ arguments, you don't have to do it any more. Multi-value options can be entered
14
+ either using the option prefix multiple times for each value, or using
15
+ the option prefix just once and separating the values by commas.
16
+
17
+ # [13.1.0](https://github.com/prantlf/jsonlint/compare/v13.0.1...v13.1.0) (2023-03-05)
18
+
19
+
20
+ ### Features
21
+
22
+ * Accept multiple schemas if external definitions are used ([32d1cab](https://github.com/prantlf/jsonlint/commit/32d1cabfc5cf00f23ec8d7b6b4a5b62e66924fa3))
23
+
1
24
  ## [13.0.1](https://github.com/prantlf/jsonlint/compare/v13.0.0...v13.0.1) (2023-03-05)
2
25
 
3
26
 
package/README.md CHANGED
@@ -16,14 +16,15 @@ This is a fork of the original project ([zaach/jsonlint](https://github.com/zaac
16
16
  * Optionally recognizes JavaScript-style comments (CJSON) and single quoted strings (JSON5).
17
17
  * Optionally ignores trailing commas and reports duplicate object keys as an error.
18
18
  * Optionally checks that also the expected format matches, including sorted object keys.
19
- * Supports [JSON Schema] drafts 04, 06 and 07.
19
+ * Supports [JSON Schema] drafts 04, 06, 07, 2019-09 and 2020-12.
20
+ * Supports [JSON Type Definition].
20
21
  * Offers pretty-printing including comment-stripping and object keys without quotes (JSON5).
21
- * Prefers the native JSON parser if possible to run [7x faster than the custom parser].
22
+ * Prefers the native JSON parser if possible to run [10x faster than the custom parser].
22
23
  * Reports errors with rich additional information. From the JSON Schema validation too.
23
24
  * Consumes configuration from both command line and [configuration files](configuration).
24
25
  * Implements JavaScript modules using [UMD] to work in Node.js, in a browser, everywhere.
25
26
  * Depends on up-to-date npm modules with no installation warnings.
26
- * Small size - 18.7 kB minified, 6.54 kB gzipped, 5.16 kB brotlied.
27
+ * Small size - 18.4 kB minified, 6.45 kB gzipped, 5.05 kB brotlied.
27
28
 
28
29
  **Note:** In comparison with the original project, this package exports only the `parse` method; not the `Parser` object.
29
30
 
@@ -113,50 +114,48 @@ The input can be checked not only to be a valid JSON, but also to be formatted a
113
114
 
114
115
  ### Usage
115
116
 
116
- Usage: `jsonlint [options] [<file, directory, pattern> ...]`
117
+ Usage: `jsonlint [options] [--] [<file, directory, pattern> ...]`
117
118
 
118
119
  #### Options
119
120
 
120
- -f, --config [file] read options from a custom configuration file
121
- -F, --no-config disable searching for configuration file
121
+ -f, --config <file> read options from a custom configuration file
122
+ -F, --no-config disable searching for configuration files
122
123
  -s, --sort-keys sort object keys (not when prettifying)
123
- -E, --extensions [ext] file extensions to process for directory walk
124
- (default: ["json","JSON"])
124
+ -E, --extensions <ext...> file extensions to process for directory walk
125
+ (default: json, JSON)
125
126
  -i, --in-place overwrite the input files
126
127
  -j, --diff print difference instead of writing the output
127
128
  -k, --check check that the input is equal to the output
128
- -t, --indent [num|char] number of spaces or specific characters
129
- to use for indentation (default: 2)
129
+ -t, --indent <num|char> number of spaces or specific characters to use
130
+ for indentation or a string with whitespace
130
131
  -c, --compact compact error display
131
- -M, --mode [mode] set other parsing flags according to a format
132
- type (default: "json")
132
+ -M, --mode <mode> set other parsing flags according to the format
133
+ of the input data (default: json)
133
134
  -B, --bom ignore the leading UTF-8 byte-order mark
134
135
  -C, --comments recognize and ignore JavaScript-style comments
135
136
  -S, --single-quoted-strings support single quotes as string delimiters
136
137
  -T, --trailing-commas ignore trailing commas in objects and arrays
137
138
  -D, --no-duplicate-keys report duplicate object keys as an error
138
- -V, --validate [file] JSON Schema file to use for validation
139
- -e, --environment [env] which specification of JSON Schema the
140
- validation file uses
141
- -x, --context [num] line count used as the diff context (default: 3)
139
+ -V, --validate <file...> JSON Schema file(s) to use for validation
140
+ -e, --environment <env> which version of JSON Schema the validation
141
+ should use
142
+ -x, --context <num> line number used as the diff context
143
+ (default: 3)
142
144
  -l, --log-files print only the parsed file names to stdout
143
145
  -q, --quiet do not print the parsed json to stdout
144
146
  -n, --continue continue with other files if an error occurs
145
147
  -p, --pretty-print prettify the input instead of stringifying
146
- the parsed object
148
+ the parsed object
147
149
  -P, --pretty-print-invalid force pretty-printing even for invalid input
148
150
  -r, --trailing-newline ensure a line break at the end of the output
149
151
  -R, --no-trailing-newline ensure no line break at the end of the output
150
152
  --prune-comments omit comments from the prettified output
151
153
  --strip-object-keys strip quotes from object keys if possible
152
- (JSON5)
153
154
  --enforce-double-quotes surrounds all strings with double quotes
154
155
  --enforce-single-quotes surrounds all strings with single quotes
155
- (JSON5)
156
156
  --trim-trailing-commas omit trailing commas from objects and arrays
157
- (JSON5)
158
157
  -v, --version output the version number
159
- -h, --help output usage information
158
+ -h, --help display help for command
160
159
 
161
160
  You can use BASH patterns for including and excluding files (only files).
162
161
  Patterns are case-sensitive and have to use slashes as directory separators.
@@ -169,6 +168,9 @@ for JSON Schema validation are "draft-04", "draft-06", "draft-07",
169
168
  with "json-schema-". JSON Type Definition can be selected by "rfc8927",
170
169
  "json-type-definition" or "jtd". If not specified, it will be "draft-07".
171
170
 
171
+ If you specify schemas using the "-V" parameter, you will have to separate
172
+ files to test with "--".
173
+
172
174
  ### Configuration
173
175
 
174
176
  In addition to the command line parameters, the options can be supplied from the following files:
@@ -274,7 +276,7 @@ The `mode` parameter (string) sets parsing options to match a common format of i
274
276
 
275
277
  ### Schema Validation
276
278
 
277
- You can validate the input against a JSON Schema using the `lib/validator` module. The `validate` method accepts either an earlier parsed JSON data or a string with the JSON input:
279
+ You can validate the input against a JSON Schema using the `lib/validator` module. The `compile` method accepts either an earlier parsed JSON Schema or a string with it:
278
280
 
279
281
  ```js
280
282
  const { compile } = require('@prantlf/jsonlint/lib/validator')
@@ -283,12 +285,18 @@ const validate = compile('string with JSON Schema')
283
285
  const parsed = validate('string with JSON data')
284
286
  ```
285
287
 
286
- If a string is passed to the `validate` method, the same options as for parsing JSON data can be passed as the second parameter. Compiling JSON Schema supports the same options as parsing JSON data too (except for `reviver`). They can be passed as the second (object) parameter. The optional second `environment` parameter can be passed either as a string or as an additional property in the options object too:
288
+ If a string is passed to the `compile` method, the same options as for parsing JSON data can be passed as the second parameter. Compiling JSON Schema supports the same options as parsing JSON data too (except for `reviver`). They can be passed as the second (object) parameter. The optional second `environment` parameter (the default value is `draft-07`) ) can be passed either as a string or as an additional property in the options object too:
287
289
 
288
290
  ```js
289
291
  const validate = compile('string with JSON Schema', { environment: 'draft-2020-12' })
290
292
  ```
291
293
 
294
+ If you use external definitions in multiple schemas, you have to pass an array of all schemas to `compile`. The `$id` properties have to be set in each sub-schema according to the `$ref` references in the main schema. The main schema is usually sent as the first one to be compiled immediately, so that the errors in any sub-schema would be reported right away:
295
+
296
+ ```js
297
+ const validate = compile(['string with main schema', 'string with a sub-schema'])
298
+ ```
299
+
292
300
  ### Pretty-Printing
293
301
 
294
302
  You can parse a JSON string to an array of tokens and print it back to a string with some changes applied. It can be unification of whitespace, reformatting or stripping comments, for example. (Raw token values must be enabled when tokenizing the JSON input.)
@@ -372,11 +380,11 @@ If you want to retain comments or whitespace for pretty-printing, for example, s
372
380
 
373
381
  ### Performance
374
382
 
375
- This is a part of an output from the [parser benchmark], when parsing a 4.2 KB formatted string ([package.json](./package.json)) with Node.js 12.14.0:
383
+ This is a part of an output from the [parser benchmark], when parsing a 4.68 KB formatted string ([package.json](./package.json)) with Node.js 18.14.2:
376
384
 
377
- jsonlint using native JSON.parse x 97,109 ops/sec ±0.81% (93 runs sampled)
378
- jsonlint using hand-coded parser x 7,256 ops/sec ±0.54% (90 runs sampled)
379
- jsonlint using tokenising parser x 6,387 ops/sec ±0.44% (88 runs sampled)
385
+ the standard jsonlint parser x 78,998 ops/sec ±0.48% (95 runs sampled)
386
+ the extended jsonlint parser x 7,923 ops/sec ±0.51% (93 runs sampled)
387
+ the tokenising jsonlint parser x 6,281 ops/sec ±0.71% (91 runs sampled)
380
388
 
381
389
  A custom JSON parser is [a lot slower] than the built-in one. However, it is more important to have a [clear error reporting] than the highest speed in scenarios like parsing configuration files. (For better error-reporting, the speed can be preserved by using the native parser initially and re-parsing with another parser only in case of failure.) Features like comments or JSON5 are also helpful in configuration files. Tokens preserve the complete input and can be used for pretty-printing without losing the comments.
382
390
 
@@ -429,6 +437,7 @@ Licensed under the [MIT License].
429
437
  [JSON]: https://tools.ietf.org/html/rfc8259
430
438
  [JSON5]: https://spec.json5.org
431
439
  [JSON Schema]: https://json-schema.org
440
+ [JSON Type Definition]: https://jsontypedef.com/
432
441
  [UMD]: https://github.com/umdjs/umd
433
442
  [`Grunt`]: https://gruntjs.com/
434
443
  [`Gulp`]: http://gulpjs.com/
package/lib/cli.js CHANGED
@@ -1,66 +1,219 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  const { readdirSync, readFileSync, statSync, writeFileSync } = require('fs')
4
- const { extname, join, normalize } = require('path')
4
+ const { extname, join } = require('path')
5
5
  const { isDynamicPattern, sync } = require('fast-glob')
6
6
  const { parse, tokenize } = require('./jsonlint')
7
7
  const { format } = require('./formatter')
8
8
  const { print } = require('./printer')
9
9
  const { sortObject } = require('./sorter')
10
10
  const { compile } = require('./validator')
11
- const { description, version } = require('../package')
12
11
 
13
- const collectValues = extension => extension.split(',')
12
+ function help() {
13
+ console.log(`${require('../package.json').description}
14
14
 
15
- const commander = require('commander')
16
- .name('jsonlint')
17
- .usage('[options] [<file, directory, pattern> ...]')
18
- .description(description)
19
- .option('-f, --config [file]', 'read options from a custom configuration file')
20
- .option('-F, --no-config', 'disable searching for configuration files')
21
- .option('-s, --sort-keys', 'sort object keys (not when prettifying)')
22
- .option('-E, --extensions [ext]', 'file extensions to process for directory walk', collectValues, ['json', 'JSON'])
23
- .option('-i, --in-place', 'overwrite the input files')
24
- .option('-j, --diff', 'print difference instead of writing the output')
25
- .option('-k, --check', 'check that the input is equal to the output')
26
- .option('-t, --indent [num|char]', 'number of spaces or specific characters to use for indentation', 2)
27
- .option('-c, --compact', 'compact error display')
28
- .option('-M, --mode [mode]', 'set other parsing flags according to a format type', 'json')
29
- .option('-B, --bom', 'ignore the leading UTF-8 byte-order mark')
30
- .option('-C, --comments', 'recognize and ignore JavaScript-style comments')
31
- .option('-S, --single-quoted-strings', 'support single quotes as string delimiters')
32
- .option('-T, --trailing-commas', 'ignore trailing commas in objects and arrays')
33
- .option('-D, --no-duplicate-keys', 'report duplicate object keys as an error')
34
- .option('-V, --validate [file]', 'JSON Schema file to use for validation')
35
- .option('-e, --environment [env]', 'which specification of JSON Schema the validation file uses')
36
- .option('-x, --context [num]', 'line count used as the diff context', 3)
37
- .option('-l, --log-files', 'print only the parsed file names to stdout')
38
- .option('-q, --quiet', 'do not print the parsed json to stdout')
39
- .option('-n, --continue', 'continue with other files if an error occurs')
40
- .option('-p, --pretty-print', 'prettify the input instead of stringifying the parsed object')
41
- .option('-P, --pretty-print-invalid', 'force pretty-printing even for invalid input')
42
- .option('-r, --trailing-newline', 'ensure a line break at the end of the output')
43
- .option('-R, --no-trailing-newline', 'ensure no line break at the end of the output')
44
- .option('--prune-comments', 'omit comments from the prettified output')
45
- .option('--strip-object-keys', 'strip quotes from object keys if possible (JSON5)')
46
- .option('--enforce-double-quotes', 'surrounds all strings with double quotes')
47
- .option('--enforce-single-quotes', 'surrounds all strings with single quotes (JSON5)')
48
- .option('--trim-trailing-commas', 'omit trailing commas from objects and arrays (JSON5)')
49
- .version(version, '-v, --version')
50
- .on('--help', () => {
51
- console.log()
52
- console.log('You can use BASH patterns for including and excluding files (only files).')
53
- console.log('Patterns are case-sensitive and have to use slashes as directory separators.')
54
- console.log('A pattern to exclude from processing starts with "!".')
55
- console.log()
56
- console.log('Parsing mode can be "cjson" or "json5" to enable other flags automatically.')
57
- console.log('If no files or directories are specified, stdin will be parsed. Environments')
58
- console.log('for JSON Schema validation are "draft-04", "draft-06", "draft-07",')
59
- console.log('"draft-2019-09" or "draft-2020-12". The environment may be prefixed')
60
- console.log('with "json-schema-". JSON Type Definition can be selected by "rfc8927",')
61
- console.log('"json-type-definition" or "jtd". If not specified, it will be "draft-07".')
62
- })
63
- .parse(process.argv)
15
+ Usage: jsonlint [options] [--] [<file, directory, pattern> ...]
16
+
17
+ Options:
18
+ -f, --config <file> read options from a custom configuration file
19
+ -F, --no-config disable searching for configuration files
20
+ -s, --sort-keys sort object keys (not when prettifying)
21
+ -E, --extensions <ext...> file extensions to process for directory walk
22
+ (default: json, JSON)
23
+ -i, --in-place overwrite the input files
24
+ -j, --diff print difference instead of writing the output
25
+ -k, --check check that the input is equal to the output
26
+ -t, --indent <num|char> number of spaces or specific characters to use
27
+ for indentation or a string with whitespace
28
+ -c, --compact compact error display
29
+ -M, --mode <mode> set other parsing flags according to the format
30
+ of the input data (default: json)
31
+ -B, --bom ignore the leading UTF-8 byte-order mark
32
+ -C, --comments recognize and ignore JavaScript-style comments
33
+ -S, --single-quoted-strings support single quotes as string delimiters
34
+ -T, --trailing-commas ignore trailing commas in objects and arrays
35
+ -D, --no-duplicate-keys report duplicate object keys as an error
36
+ -V, --validate <file...> JSON Schema file(s) to use for validation
37
+ -e, --environment <env> which version of JSON Schema the validation
38
+ should use
39
+ -x, --context <num> line number used as the diff context
40
+ (default: 3)
41
+ -l, --log-files print only the parsed file names to stdout
42
+ -q, --quiet do not print the parsed json to stdout
43
+ -n, --continue continue with other files if an error occurs
44
+ -p, --pretty-print prettify the input instead of stringifying
45
+ the parsed object
46
+ -P, --pretty-print-invalid force pretty-printing even for invalid input
47
+ -r, --trailing-newline ensure a line break at the end of the output
48
+ -R, --no-trailing-newline ensure no line break at the end of the output
49
+ --prune-comments omit comments from the prettified output
50
+ --strip-object-keys strip quotes from object keys if possible
51
+ --enforce-double-quotes surrounds all strings with double quotes
52
+ --enforce-single-quotes surrounds all strings with single quotes
53
+ --trim-trailing-commas omit trailing commas from objects and arrays
54
+ -v, --version output the version number
55
+ -h, --help display help for command
56
+
57
+ Examples:
58
+ $ jsonlint myfile.json
59
+ $ jsonlint --in-place --pretty-print mydir
60
+ $ jsonlint --comments --trailing-commas --no-duplicate-keys \\
61
+ --log-files --compact --continue '**/*.json' '!**/node_modules'`)
62
+ }
63
+
64
+ const { argv } = process
65
+ let params = { extensions: [], validate: [] }
66
+ const args = []
67
+
68
+ function fail(message) {
69
+ console.error(message)
70
+ process.exit(1)
71
+ }
72
+
73
+ for (let i = 2, l = argv.length; i < l; ++i) {
74
+ const arg = argv[i]
75
+ const match = /^(-|--)(no-)?([a-zA-Z][-a-zA-Z]*)(?:=(.*))?$/.exec(arg)
76
+ if (match) {
77
+ const parseArg = (arg, flag) => {
78
+ switch (arg) {
79
+ case 'f': case 'config':
80
+ params.config = flag ? match[4] || argv[++i] : false
81
+ return
82
+ case 'F':
83
+ params.config = false
84
+ return
85
+ case 's': case 'sort-keys':
86
+ params.sortKeys = flag
87
+ return
88
+ case 'E': case 'extensions':
89
+ arg = match[4] || argv[++i]
90
+ params.extensions.push(...arg.split(','))
91
+ return
92
+ case 'i': case 'in-place':
93
+ params.inPlace = flag
94
+ return
95
+ case 'j': case 'diff':
96
+ params.diff = flag
97
+ return
98
+ case 'k': case 'check':
99
+ params.check = flag
100
+ return
101
+ case 't': case 'indent':
102
+ arg = match[4] || argv[++i]
103
+ if (arg.trim().length > 0 && !isNaN(+arg)) arg = +arg
104
+ params.indent = arg
105
+ return
106
+ case 'c': case 'compact':
107
+ params.compact = flag
108
+ return
109
+ case 'M': case 'mode':
110
+ arg = match[4] || argv[++i]
111
+ if (arg !== 'json' && arg !== 'cjson' && arg !== 'json5') {
112
+ throw new Error(`invalid parsing mode: "${arg}"`)
113
+ }
114
+ params.mode = arg
115
+ return
116
+ case 'B': case 'bom':
117
+ params.bom = flag
118
+ return
119
+ case 'C': case 'comments':
120
+ params.comments = flag
121
+ return
122
+ case 'S': case 'single-quoted-strings':
123
+ params.singleQuotedStrings = flag
124
+ return
125
+ case 'T': case 'trailing-commas':
126
+ params.trailingCommas = flag
127
+ return
128
+ case 'duplicate-keys':
129
+ params.duplicateKeys = flag
130
+ return
131
+ case 'D':
132
+ params.duplicateKeys = false
133
+ return
134
+ case 'V': case 'validate':
135
+ arg = match[4] || argv[++i]
136
+ params.validate.push(...arg.split(','))
137
+ return
138
+ case 'e': case 'environment':
139
+ arg = match[4] || argv[++i]
140
+ if (arg !== 'json-schema-draft-04' && arg !== 'draft-04' &&
141
+ arg !== 'json-schema-draft-06' && arg !== 'draft-06' &&
142
+ arg !== 'json-schema-draft-07' && arg !== 'draft-07' &&
143
+ arg !== 'json-schema-draft-2019-09' && arg !== 'draft-2019-09' &&
144
+ arg !== 'json-schema-draft-2020-12' && arg !== 'draft-2020-12' &&
145
+ arg !== 'json-type-definition' && arg !== 'jtd' && arg !== 'rfc8927') {
146
+ throw new Error(`invalid validation environment "${arg}"`)
147
+ }
148
+ params.environment = arg
149
+ return
150
+ case 'x': case 'context':
151
+ arg = match[4] || argv[++i]
152
+ if (isNaN(+arg)) {
153
+ throw new Error(`invalid diff context: "${arg}"`)
154
+ }
155
+ params.indent = +arg
156
+ return
157
+ case 'l': case 'log-files':
158
+ params.logFiles = flag
159
+ return
160
+ case 'q': case 'quiet':
161
+ params.quiet = flag
162
+ return
163
+ case 'n': case 'continue':
164
+ params.continue = flag
165
+ return
166
+ case 'p': case 'pretty-print':
167
+ params.prettyPrint = flag
168
+ return
169
+ case 'P': case 'pretty-print-invalid':
170
+ params.prettyPrintInvalid = flag
171
+ return
172
+ case 'r': case 'trailing-newline':
173
+ params.trailingNewline = flag
174
+ return
175
+ case 'R':
176
+ params.trailingNewline = false
177
+ return
178
+ case 'prune-comments':
179
+ params.pruneComments = flag
180
+ return
181
+ case 'strip-object-keys':
182
+ params.stripObjectKeys = flag
183
+ return
184
+ case 'enforce-double-quotes':
185
+ params.enforceDoubleQuotes = flag
186
+ return
187
+ case 'enforce-single-quotes':
188
+ params.enforceSingleQuotes = flag
189
+ return
190
+ case 'trim-trailing-commas':
191
+ params.trimTrailingCommas = flag
192
+ return
193
+ case 'v': case 'version':
194
+ console.log(require('../package.json').version)
195
+ process.exit(0)
196
+ break
197
+ case 'h': case 'help':
198
+ help()
199
+ process.exit(0)
200
+ }
201
+ fail(`unknown option: "${arg}"`)
202
+ }
203
+ if (match[1] === '-') {
204
+ const flags = match[3].split('')
205
+ for (const flag of flags) parseArg(flag, true)
206
+ } else {
207
+ parseArg(match[3], match[2] !== 'no-')
208
+ }
209
+ continue
210
+ }
211
+ if (arg === '--') {
212
+ args.push(...argv.slice(i + 1, l))
213
+ break
214
+ }
215
+ args.push(arg)
216
+ }
64
217
 
65
218
  const paramNames = {
66
219
  'trailing-commas': 'trailingCommas',
@@ -79,19 +232,20 @@ const paramNames = {
79
232
  'trailing-newline': 'trailingNewline'
80
233
  }
81
234
 
82
- const params = commander.opts()
83
- let options
84
- if (params.config === false) {
85
- options = params
86
- } else {
235
+ if (params.config !== false) {
87
236
  const { cosmiconfigSync } = require('cosmiconfig')
88
237
  const configurator = cosmiconfigSync('jsonlint')
89
238
  const { config = {} } = (params.config && configurator.load(params.config)) ||
90
239
  configurator.search() || {}
91
- options = mergeOptions({}, convertConfig(config), params)
240
+ params = mergeOptions({}, convertConfig(config), params)
92
241
  }
93
242
 
94
- const extensions = options.extensions.map(extension => '.' + extension)
243
+ let extensions = params.extensions.map(extension => `.${extension}`)
244
+ if (!extensions.length) extensions = ['.json', '.JSON']
245
+ if (!params.mode) params.mode = 'json'
246
+ if (params.indent == null) params.indent = 2
247
+ if (params.context == null) params.context = 3
248
+
95
249
  let reported
96
250
 
97
251
  function convertConfig (config) {
@@ -106,7 +260,7 @@ function convertConfig (config) {
106
260
  function mergeOptions (target, ...sources) {
107
261
  for (const source of sources) {
108
262
  for (const key in source) {
109
- if (target[key] == null) {
263
+ if (target[key] == null || Array.isArray(target[key]) && !target[key].length === 0) {
110
264
  target[key] = source[key]
111
265
  }
112
266
  }
@@ -137,58 +291,61 @@ function processContents (source, file) {
137
291
  let parserOptions, parsed, formatted
138
292
  try {
139
293
  parserOptions = {
140
- mode: options.mode,
141
- ignoreBOM: options.bom,
142
- ignoreComments: options.comments,
143
- ignoreTrailingCommas: options.trailingCommas,
144
- allowSingleQuotedStrings: options.singleQuotedStrings,
145
- allowDuplicateObjectKeys: options.duplicateKeys
294
+ mode: params.mode,
295
+ ignoreBOM: params.bom,
296
+ ignoreComments: params.comments,
297
+ ignoreTrailingCommas: params.trailingCommas,
298
+ allowSingleQuotedStrings: params.singleQuotedStrings,
299
+ allowDuplicateObjectKeys: params.duplicateKeys
146
300
  }
147
- if (options.validate) {
148
- let validate
301
+ if (params.validate.length) {
302
+ const schemas = params.validate.map((file, index) => {
303
+ try {
304
+ return readFileSync(file, 'utf8')
305
+ } catch (error) {
306
+ throw new Error(`Loading the JSON Schema #${index + 1} failed: "${file}".\n${error.message}`)
307
+ }
308
+ })
309
+ parserOptions.environment = params.environment
149
310
  try {
150
- const schema = readFileSync(normalize(options.validate), 'utf8')
151
- parserOptions.environment = options.environment
152
- validate = compile(schema, parserOptions)
311
+ validate = compile(schemas, parserOptions)
153
312
  } catch (error) {
154
- const message = 'Loading the JSON Schema failed: "' +
155
- options.validate + '".\n' + error.message
156
- throw new Error(message)
313
+ throw new Error(`Loading the JSON Schema failed:\n${error.message}`)
157
314
  }
158
315
  parsed = validate(source, parserOptions)
159
316
  } else {
160
317
  parsed = parse(source, parserOptions)
161
318
  }
162
- if (options.prettyPrint) {
319
+ if (params.prettyPrint) {
163
320
  parserOptions.rawTokens = true
164
321
  const tokens = tokenize(source, parserOptions)
165
322
  // TODO: Support sorting tor the tokenized input too.
166
323
  return print(tokens, {
167
- indent: options.indent,
168
- pruneComments: options.pruneComments,
169
- stripObjectKeys: options.stripObjectKeys,
170
- enforceDoubleQuotes: options.enforceDoubleQuotes,
171
- enforceSingleQuotes: options.enforceSingleQuotes,
172
- trimTrailingCommas: options.trimTrailingCommas
324
+ indent: params.indent,
325
+ pruneComments: params.pruneComments,
326
+ stripObjectKeys: params.stripObjectKeys,
327
+ enforceDoubleQuotes: params.enforceDoubleQuotes,
328
+ enforceSingleQuotes: params.enforceSingleQuotes,
329
+ trimTrailingCommas: params.trimTrailingCommas
173
330
  })
174
331
  }
175
- if (options.sortKeys) {
332
+ if (params.sortKeys) {
176
333
  parsed = sortObject(parsed)
177
334
  }
178
- return JSON.stringify(parsed, null, options.indent)
335
+ return JSON.stringify(parsed, null, params.indent)
179
336
  } catch (e) {
180
- if (options.prettyPrintInvalid) {
337
+ if (params.prettyPrintInvalid) {
181
338
  /* From https://github.com/umbrae/jsonlintdotcom:
182
339
  * If we failed to validate, run our manual formatter and then re-validate so that we
183
340
  * can get a better line number. On a successful validate, we don't want to run our
184
341
  * manual formatter because the automatic one is faster and probably more reliable.
185
342
  */
186
343
  try {
187
- formatted = format(source, options.indent)
344
+ formatted = format(source, params.indent)
188
345
  // Re-parse so exception output gets better line numbers
189
346
  parsed = parse(formatted)
190
347
  } catch (e) {
191
- if (options.compact) {
348
+ if (params.compact) {
192
349
  logCompactError(e, file)
193
350
  } else {
194
351
  logNormalError(e, file)
@@ -197,13 +354,13 @@ function processContents (source, file) {
197
354
  console.log(formatted)
198
355
  }
199
356
  } else {
200
- if (options.compact) {
357
+ if (params.compact) {
201
358
  logCompactError(e, file)
202
359
  } else {
203
360
  logNormalError(e, file)
204
361
  }
205
362
  }
206
- if (options.continue) {
363
+ if (params.continue) {
207
364
  process.exitCode = 1
208
365
  } else {
209
366
  process.exit(1)
@@ -214,8 +371,8 @@ function processContents (source, file) {
214
371
  function ensureLineBreak (parsed, source) {
215
372
  const lines = source.split(/\r?\n/)
216
373
  const newLine = !lines[lines.length - 1]
217
- if (options.trailingNewline === true ||
218
- (options.trailingNewline !== false && newLine)) {
374
+ if (params.trailingNewline === true ||
375
+ (params.trailingNewline !== false && newLine)) {
219
376
  parsed += '\n'
220
377
  }
221
378
  return parsed
@@ -223,31 +380,31 @@ function ensureLineBreak (parsed, source) {
223
380
 
224
381
  function checkContents (file, source, parsed) {
225
382
  const { createTwoFilesPatch, structuredPatch } = require('diff')
226
- const structured = structuredPatch(`${file}.orig`, file, source, parsed, '', '', { context: options.context })
383
+ const structured = structuredPatch(`${file}.orig`, file, source, parsed, '', '', { context: params.context })
227
384
  const length = structured.hunks && structured.hunks.length
228
385
  if (length > 0) {
229
386
  const hunk = length === 1 ? 'hunk differs' : 'hunks differ'
230
387
  const message = `${length} ${hunk}`
231
- if (options.compact) {
388
+ if (params.compact) {
232
389
  console.error(`${file}: ${message}`)
233
390
  } else {
234
391
  separateBlocks()
235
392
  console.info('File:', file)
236
393
  console.error(message)
237
394
  }
238
- if (!options.quiet) {
239
- const diff = createTwoFilesPatch(`${file}.orig`, file, source, parsed, '', '', { context: options.context })
395
+ if (!params.quiet) {
396
+ const diff = createTwoFilesPatch(`${file}.orig`, file, source, parsed, '', '', { context: params.context })
240
397
  console.log(diff)
241
398
  }
242
- if (options.continue) {
399
+ if (params.continue) {
243
400
  process.exitCode = 1
244
401
  } else {
245
402
  process.exit(1)
246
403
  }
247
404
  } else {
248
- if (options.compact) {
405
+ if (params.compact) {
249
406
  console.info(`${file}: no difference`)
250
- } else if (options.logFiles) {
407
+ } else if (params.logFiles) {
251
408
  console.info(file)
252
409
  }
253
410
  }
@@ -255,13 +412,13 @@ function checkContents (file, source, parsed) {
255
412
 
256
413
  function diffContents (file, source, parsed) {
257
414
  const { createTwoFilesPatch, structuredPatch } = require('diff')
258
- const compact = options.quiet || options.compact
415
+ const compact = params.quiet || params.compact
259
416
  let diff, length
260
417
  if (compact) {
261
- diff = structuredPatch(`${file}.orig`, file, source, parsed, '', '', { context: options.context })
418
+ diff = structuredPatch(`${file}.orig`, file, source, parsed, '', '', { context: params.context })
262
419
  length = diff.hunks && diff.hunks.length
263
420
  } else {
264
- diff = createTwoFilesPatch(`${file}.orig`, file, source, parsed, '', '', { context: options.context })
421
+ diff = createTwoFilesPatch(`${file}.orig`, file, source, parsed, '', '', { context: params.context })
265
422
  length = diff.split(/\r?\n/).length - 4
266
423
  }
267
424
  if (length > 0) {
@@ -274,32 +431,31 @@ function diffContents (file, source, parsed) {
274
431
  console.log(diff)
275
432
  }
276
433
  } else {
277
- if (options.compact) {
434
+ if (params.compact) {
278
435
  console.info(`${file}: no difference`)
279
- } else if (options.logFiles) {
436
+ } else if (params.logFiles) {
280
437
  console.info(file)
281
438
  }
282
439
  }
283
440
  }
284
441
 
285
442
  function processFile (file) {
286
- file = normalize(file)
287
- if (options.logFiles && !(options.compact || options.check || options.diff)) {
443
+ if (params.logFiles && !(params.compact || params.check || params.diff)) {
288
444
  console.info(file)
289
445
  }
290
446
  const source = readFileSync(file, 'utf8')
291
447
  const parsed = processContents(source, file)
292
- if (options.inPlace) {
293
- if (options.logFiles && options.compact) {
448
+ if (params.inPlace) {
449
+ if (params.logFiles && params.compact) {
294
450
  console.info(file)
295
451
  }
296
452
  writeFileSync(file, ensureLineBreak(parsed, source))
297
- } else if (options.check) {
453
+ } else if (params.check) {
298
454
  checkContents(file, source, ensureLineBreak(parsed, source))
299
- } else if (options.diff) {
455
+ } else if (params.diff) {
300
456
  diffContents(file, source, ensureLineBreak(parsed, source))
301
457
  } else {
302
- if (!(options.quiet || options.logFiles)) {
458
+ if (!(params.quiet || params.logFiles)) {
303
459
  console.log(parsed)
304
460
  }
305
461
  }
@@ -343,16 +499,15 @@ function processPatterns (patterns) {
343
499
  }
344
500
 
345
501
  function main () {
346
- let { args: files } = commander
347
- if (!files.length) {
348
- files = options.patterns || []
502
+ if (!args.length) {
503
+ args = params.patterns || []
349
504
  }
350
- if (files.length) {
351
- const dynamic = files.some(file => isDynamicPattern(file))
505
+ if (args.length) {
506
+ const dynamic = args.some(file => isDynamicPattern(file))
352
507
  if (dynamic) {
353
- processPatterns(files)
508
+ processPatterns(args)
354
509
  } else {
355
- for (const file of files) {
510
+ for (const file of args) {
356
511
  processSource(file, false)
357
512
  }
358
513
  }
@@ -365,19 +520,19 @@ function main () {
365
520
  })
366
521
  stdin.on('end', () => {
367
522
  const file = '<stdin>'
368
- if (options.logFiles && !(options.compact || options.check || options.diff)) {
523
+ if (params.logFiles && !(params.compact || params.check || params.diff)) {
369
524
  console.info(file)
370
525
  }
371
526
  const parsed = processContents(source, file)
372
- if (options.check) {
527
+ if (params.check) {
373
528
  checkContents(file, source, ensureLineBreak(parsed, source))
374
- } else if (options.diff) {
529
+ } else if (params.diff) {
375
530
  diffContents(file, source, ensureLineBreak(parsed, source))
376
531
  } else {
377
- if (options.logFiles && options.compact) {
532
+ if (params.logFiles && params.compact) {
378
533
  console.info(file)
379
534
  }
380
- if (!(options.quiet || options.logFiles)) {
535
+ if (!(params.quiet || params.logFiles)) {
381
536
  console.log(parsed)
382
537
  }
383
538
  }
package/lib/index.d.ts CHANGED
@@ -458,7 +458,8 @@ declare module '@prantlf/jsonlint/lib/validator' {
458
458
  * with multiple options
459
459
  * @returns the validator function
460
460
  */
461
- function compile (schema: string, environmentOrOptions?: Environment | CompileOptions): Validator
461
+ function compile (schema: string | string[] | Record<string, unknown> | Record<string, unknown>[],
462
+ environmentOrOptions?: Environment | CompileOptions): Validator
462
463
  }
463
464
 
464
465
  declare module '@prantlf/jsonlint/lib/printer' {
package/lib/validator.js CHANGED
@@ -123,28 +123,33 @@
123
123
  const Ajv = requireAjv('AjvJTD')
124
124
  ajv = new Ajv()
125
125
  } else {
126
- throw new RangeError('Unsupported environment for the JSON Schema validation: "' +
127
- environment + '".')
126
+ throw new RangeError(`Unsupported environment for the JSON Schema validation: "${environment}".`)
128
127
  }
129
128
  return ajv
130
129
  }
131
130
 
132
131
  function compileSchema (ajv, schema, parseOptions) {
133
- let parsed
134
- try {
135
- parsed = jsonlint.parse(schema, parseOptions)
136
- } catch (error) {
137
- error.message = 'Parsing the JSON Schema failed.\n' + error.message
138
- throw error
139
- }
132
+ if (!Array.isArray(schema)) schema = [schema]
133
+ const [main, ...others] = schema.map((schema, index) => {
134
+ if (typeof schema !== 'string') return schema
135
+ try {
136
+ return jsonlint.parse(schema, parseOptions)
137
+ } catch (error) {
138
+ error.message = `Parsing the JSON Schema #${index + 1} failed.\n${error.message}`
139
+ throw error
140
+ }
141
+ })
140
142
  try {
141
- return ajv.compile(parsed)
143
+ for (const schema of others) {
144
+ ajv.addSchema(schema)
145
+ }
146
+ return ajv.compile(main)
142
147
  } catch (originalError) {
143
148
  const errors = ajv.errors
144
149
  const betterError = errors
145
150
  ? createError(errors, parsed, schema, parseOptions)
146
151
  : originalError
147
- betterError.message = 'Compiling the JSON Schema failed.\n' + betterError.message
152
+ betterError.message = `Compiling the JSON Schema failed.\n${betterError.message}`
148
153
  throw betterError
149
154
  }
150
155
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prantlf/jsonlint",
3
- "version": "13.0.1",
3
+ "version": "14.0.0",
4
4
  "description": "JSON/CJSON/JSON5 parser, syntax and schema validator and pretty-printer.",
5
5
  "author": "Ferdinand Prantl <prantlf@gmail.com> (http://prantl.tk)",
6
6
  "contributors": [
@@ -75,7 +75,6 @@
75
75
  "dependencies": {
76
76
  "ajv": "8.12.0",
77
77
  "ajv-draft-04": "1.0.0",
78
- "commander": "10.0.0",
79
78
  "cosmiconfig": "8.1.0",
80
79
  "diff": "5.1.0",
81
80
  "fast-glob": "3.2.12"
@@ -1,4 +1,4 @@
1
- (function(j,f){if(typeof exports=="object"&&typeof module<"u"){const c=require("./jsonlint"),l={Ajv04:"ajv-draft-04",Ajv07:"ajv",AjvJTD:"ajv/dist/jtd",Ajv2019:"ajv/dist/2019",Ajv2020:"ajv/dist/2020",Schema06:"ajv/dist/refs/json-schema-draft-06.json"},d=g=>{const h=require(l[g]);return!h.$schema&&h.default||h};f(exports,c,d)}else if(typeof define=="function"&&define.amd)define("jsonlint-validator",["exports","jsonlint","ajv"],function(c,l,d){f(c,l,h=>{const m=d[h];return!m.$schema&&m.default||m})});else{j=j||self;const c=l=>{const d=j.ajv[l];return!d.$schema&&d.default||d};f(j.jsonlintValidator={},j.jsonlint,c)}})(this,function(j,f,c){"use strict";function l(e,s,t,a){const n=t.find(function(r){return a===f.pathToPointer(r.path)});if(n){const r=n.location.start,o=r.offset,i=r.line,u=r.column,S=f.getErrorTexts(e.reason,s,o,i,u);return e.message=S.message,e.excerpt=S.excerpt,S.pointer&&(e.pointer=S.pointer,e.location={start:{column:u,line:i,offset:o}}),!0}}function d(e,s,t){const a=e.dataPath,n=e.schemaPath,r=(a||"/")+" "+e.message+"; see "+n,o={reason:r,dataPath:a,schemaPath:n};return l(o,s,t,a)||(o.message=r),o}function g(e,s,t,a){t||(t=JSON.stringify(s,void 0,2)),a||(a={}),Object.assign(a,{tokenLocations:!0,tokenPaths:!0});const n=f.tokenize(t,a),r=d(e[0],t,n),o=new SyntaxError(r.message);return Object.assign(o,r),o}function h(e){let s;if(!e||e==="json-schema-draft-06"||e==="draft-06"){const t=c("Ajv07");s=new t,s.addMetaSchema(c("Schema06"))}else if(e==="json-schema-draft-07"||e==="draft-07"){const t=c("Ajv07");s=new t}else if(e==="json-schema-draft-04"||e==="draft-04"){const t=c("Ajv04");s=new t}else if(e==="json-schema-draft-2019-09"||e==="draft-2019-09"){const t=c("Ajv2019");s=new t}else if(e==="json-schema-draft-2020-12"||e==="draft-2020-12"){const t=c("Ajv2020");s=new t}else if(e==="json-type-definition"||e==="jtd"||e==="rfc8927"){const t=c("AjvJTD");s=new t}else throw new RangeError('Unsupported environment for the JSON Schema validation: "'+e+'".');return s}function m(e,s,t){let a;try{a=f.parse(s,t)}catch(n){throw n.message=`Parsing the JSON Schema failed.
2
- `+n.message,n}try{return e.compile(a)}catch(n){const r=e.errors,o=r?g(r,a,s,t):n;throw o.message=`Compiling the JSON Schema failed.
3
- `+o.message,o}}function w(e,s){let t={};typeof s=="object"&&!(s instanceof String)&&(t=s,s=t.environment);const a=h(s),n={mode:t.mode,ignoreBOM:t.ignoreBOM,ignoreComments:t.ignoreComments,ignoreTrailingCommas:t.ignoreTrailingCommas,allowSingleQuotedStrings:t.allowSingleQuotedStrings,allowDuplicateObjectKeys:t.allowDuplicateObjectKeys},r=m(a,e,n);return function(o,i,u){if(typeof o=="string"||o instanceof String?(u=i,i=o,o=f.parse(i,u)):typeof i=="string"||i instanceof String||(u=i,i=void 0),r(o))return o;throw g(r.errors,o,i,u)}}j.compile=w,Object.defineProperty(j,"__esModule",{value:!0})});
1
+ (function(j,f){if(typeof exports=="object"&&typeof module<"u"){const c=require("./jsonlint"),l={Ajv04:"ajv-draft-04",Ajv07:"ajv",AjvJTD:"ajv/dist/jtd",Ajv2019:"ajv/dist/2019",Ajv2020:"ajv/dist/2020",Schema06:"ajv/dist/refs/json-schema-draft-06.json"},d=g=>{const u=require(l[g]);return!u.$schema&&u.default||u};f(exports,c,d)}else if(typeof define=="function"&&define.amd)define("jsonlint-validator",["exports","jsonlint","ajv"],function(c,l,d){f(c,l,u=>{const m=d[u];return!m.$schema&&m.default||m})});else{j=j||self;const c=l=>{const d=j.ajv[l];return!d.$schema&&d.default||d};f(j.jsonlintValidator={},j.jsonlint,c)}})(this,function(j,f,c){"use strict";function l(e,s,t,a){const i=t.find(function(o){return a===f.pathToPointer(o.path)});if(i){const o=i.location.start,r=o.offset,n=o.line,h=o.column,S=f.getErrorTexts(e.reason,s,r,n,h);return e.message=S.message,e.excerpt=S.excerpt,S.pointer&&(e.pointer=S.pointer,e.location={start:{column:h,line:n,offset:r}}),!0}}function d(e,s,t){const a=e.dataPath,i=e.schemaPath,o=(a||"/")+" "+e.message+"; see "+i,r={reason:o,dataPath:a,schemaPath:i};return l(r,s,t,a)||(r.message=o),r}function g(e,s,t,a){t||(t=JSON.stringify(s,void 0,2)),a||(a={}),Object.assign(a,{tokenLocations:!0,tokenPaths:!0});const i=f.tokenize(t,a),o=d(e[0],t,i),r=new SyntaxError(o.message);return Object.assign(r,o),r}function u(e){let s;if(!e||e==="json-schema-draft-06"||e==="draft-06"){const t=c("Ajv07");s=new t,s.addMetaSchema(c("Schema06"))}else if(e==="json-schema-draft-07"||e==="draft-07"){const t=c("Ajv07");s=new t}else if(e==="json-schema-draft-04"||e==="draft-04"){const t=c("Ajv04");s=new t}else if(e==="json-schema-draft-2019-09"||e==="draft-2019-09"){const t=c("Ajv2019");s=new t}else if(e==="json-schema-draft-2020-12"||e==="draft-2020-12"){const t=c("Ajv2020");s=new t}else if(e==="json-type-definition"||e==="jtd"||e==="rfc8927"){const t=c("AjvJTD");s=new t}else throw new RangeError(`Unsupported environment for the JSON Schema validation: "${e}".`);return s}function m(e,s,t){Array.isArray(s)||(s=[s]);const[a,...i]=s.map((o,r)=>{if(typeof o!="string")return o;try{return f.parse(o,t)}catch(n){throw n.message=`Parsing the JSON Schema #${r+1} failed.
2
+ ${n.message}`,n}});try{for(const o of i)e.addSchema(o);return e.compile(a)}catch(o){const r=e.errors,n=r?g(r,parsed,s,t):o;throw n.message=`Compiling the JSON Schema failed.
3
+ ${n.message}`,n}}function A(e,s){let t={};typeof s=="object"&&!(s instanceof String)&&(t=s,s=t.environment);const a=u(s),i={mode:t.mode,ignoreBOM:t.ignoreBOM,ignoreComments:t.ignoreComments,ignoreTrailingCommas:t.ignoreTrailingCommas,allowSingleQuotedStrings:t.allowSingleQuotedStrings,allowDuplicateObjectKeys:t.allowDuplicateObjectKeys},o=m(a,e,i);return function(r,n,h){if(typeof r=="string"||r instanceof String?(h=n,n=r,r=f.parse(n,h)):typeof n=="string"||n instanceof String||(h=n,n=void 0),o(r))return r;throw g(o.errors,r,n,h)}}j.compile=A,Object.defineProperty(j,"__esModule",{value:!0})});
4
4
  //# sourceMappingURL=validator.min.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../lib/validator.js"],
4
- "sourcesContent": ["(function (global, factory) {\n if (typeof exports === 'object' && typeof module !== 'undefined') {\n const jsonlint = require('./jsonlint')\n const ajv = {\n Ajv04: 'ajv-draft-04',\n Ajv07: 'ajv',\n AjvJTD: 'ajv/dist/jtd',\n Ajv2019: 'ajv/dist/2019',\n Ajv2020: 'ajv/dist/2020',\n Schema06: 'ajv/dist/refs/json-schema-draft-06.json'\n }\n const requireAjv = name => {\n const exported = require(ajv[name])\n return !exported.$schema && exported.default || exported\n }\n factory(exports, jsonlint, requireAjv)\n } else if (typeof define === 'function' && define.amd) {\n define('jsonlint-validator', ['exports', 'jsonlint', 'ajv'],\n function (exports, jsonlint, ajv) {\n const requireAjv = name => {\n const exported = ajv[name]\n return !exported.$schema && exported.default || exported\n }\n factory(exports, jsonlint, requireAjv)\n })\n } else {\n global = global || self\n const requireAjv = name => {\n const exported = global.ajv[name]\n return !exported.$schema && exported.default || exported\n }\n factory(global.jsonlintValidator = {}, global.jsonlint, requireAjv)\n }\n}(this, function (exports, jsonlint, requireAjv) {\n 'use strict'\n\n function addErrorLocation (problem, input, tokens, dataPath) {\n const token = tokens.find(function (token) {\n return dataPath === jsonlint.pathToPointer(token.path)\n })\n if (token) {\n const location = token.location.start\n const offset = location.offset\n const line = location.line\n const column = location.column\n const texts = jsonlint.getErrorTexts(problem.reason, input, offset, line, column)\n problem.message = texts.message\n problem.excerpt = texts.excerpt\n if (texts.pointer) {\n problem.pointer = texts.pointer\n problem.location = {\n start: {\n column,\n line,\n offset\n }\n }\n }\n return true\n }\n }\n\n function errorToProblem (error, input, tokens) {\n const dataPath = error.dataPath\n const schemaPath = error.schemaPath\n const reason = (dataPath || '/') + ' ' + error.message + '; see ' + schemaPath\n const problem = {\n reason,\n dataPath,\n schemaPath\n }\n if (!addErrorLocation(problem, input, tokens, dataPath)) {\n problem.message = reason\n }\n return problem\n }\n\n function createError (errors, data, input, options) {\n if (!input) {\n input = JSON.stringify(data, undefined, 2)\n }\n if (!options) {\n options = {}\n }\n Object.assign(options, {\n tokenLocations: true,\n tokenPaths: true\n })\n const tokens = jsonlint.tokenize(input, options)\n // var problems = errors.map(function (error) {\n // return errorToProblem(error, input, tokens)\n // })\n // var message = problems\n // .map(function (problem) {\n // return problem.message\n // })\n // .join('\\n')\n const problem = errorToProblem(errors[0], input, tokens)\n const error = new SyntaxError(problem.message)\n Object.assign(error, problem)\n return error\n }\n\n function createAjv (environment) {\n let ajv\n if (!environment || environment === 'json-schema-draft-06' || environment === 'draft-06') {\n const Ajv = requireAjv('Ajv07')\n ajv = new Ajv()\n ajv.addMetaSchema(requireAjv('Schema06'))\n } else if (environment === 'json-schema-draft-07' || environment === 'draft-07') {\n const Ajv = requireAjv('Ajv07')\n ajv = new Ajv()\n } else if (environment === 'json-schema-draft-04' || environment === 'draft-04') {\n const Ajv = requireAjv('Ajv04')\n ajv = new Ajv()\n } else if (environment === 'json-schema-draft-2019-09' || environment === 'draft-2019-09') {\n const Ajv = requireAjv('Ajv2019')\n ajv = new Ajv()\n } else if (environment === 'json-schema-draft-2020-12' || environment === 'draft-2020-12') {\n const Ajv = requireAjv('Ajv2020')\n ajv = new Ajv()\n } else if (environment === 'json-type-definition' || environment === 'jtd' || environment === 'rfc8927') {\n const Ajv = requireAjv('AjvJTD')\n ajv = new Ajv()\n } else {\n throw new RangeError('Unsupported environment for the JSON Schema validation: \"' +\n environment + '\".')\n }\n return ajv\n }\n\n function compileSchema (ajv, schema, parseOptions) {\n let parsed\n try {\n parsed = jsonlint.parse(schema, parseOptions)\n } catch (error) {\n error.message = 'Parsing the JSON Schema failed.\\n' + error.message\n throw error\n }\n try {\n return ajv.compile(parsed)\n } catch (originalError) {\n const errors = ajv.errors\n const betterError = errors\n ? createError(errors, parsed, schema, parseOptions)\n : originalError\n betterError.message = 'Compiling the JSON Schema failed.\\n' + betterError.message\n throw betterError\n }\n }\n\n function compile (schema, environment) {\n let options = {}\n if (typeof environment === 'object' && !(environment instanceof String)) {\n options = environment\n environment = options.environment\n }\n const ajv = createAjv(environment)\n const parseOptions = {\n mode: options.mode,\n ignoreBOM: options.ignoreBOM,\n ignoreComments: options.ignoreComments,\n ignoreTrailingCommas: options.ignoreTrailingCommas,\n allowSingleQuotedStrings: options.allowSingleQuotedStrings,\n allowDuplicateObjectKeys: options.allowDuplicateObjectKeys\n }\n const validate = compileSchema(ajv, schema, parseOptions)\n return function (data, input, options) {\n if (typeof data === 'string' || data instanceof String) {\n options = input\n input = data\n data = jsonlint.parse(input, options)\n } else if (!(typeof input === 'string' || input instanceof String)) {\n options = input\n input = undefined\n }\n if (validate(data)) {\n return data\n }\n throw createError(validate.errors, data, input, options)\n }\n }\n\n exports.compile = compile\n\n Object.defineProperty(exports, '__esModule', { value: true })\n}))\n"],
5
- "mappings": "CAAC,SAAUA,EAAQC,EAAS,CAC1B,GAAI,OAAO,SAAY,UAAY,OAAO,OAAW,IAAa,CAChE,MAAMC,EAAW,QAAQ,YAAY,EAC/BC,EAAM,CACV,MAAO,eACP,MAAO,MACP,OAAQ,eACR,QAAS,gBACT,QAAS,gBACT,SAAU,yCACZ,EACMC,EAAaC,GAAQ,CACzB,MAAMC,EAAW,QAAQH,EAAIE,CAAI,CAAC,EAClC,MAAO,CAACC,EAAS,SAAWA,EAAS,SAAWA,CAClD,EACAL,EAAQ,QAASC,EAAUE,CAAU,UAC5B,OAAO,QAAW,YAAc,OAAO,IAChD,OAAO,qBAAsB,CAAC,UAAW,WAAY,KAAK,EACxD,SAAUG,EAASL,EAAUC,EAAK,CAKhCF,EAAQM,EAASL,EAJEG,GAAQ,CACzB,MAAMC,EAAWH,EAAIE,CAAI,EACzB,MAAO,CAACC,EAAS,SAAWA,EAAS,SAAWA,CAClD,CACqC,CACvC,CAAC,MACE,CACLN,EAASA,GAAU,KACnB,MAAMI,EAAaC,GAAQ,CACzB,MAAMC,EAAWN,EAAO,IAAIK,CAAI,EAChC,MAAO,CAACC,EAAS,SAAWA,EAAS,SAAWA,CAClD,EACAL,EAAQD,EAAO,kBAAoB,CAAC,EAAGA,EAAO,SAAUI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GAAgB,UAAY,EAAEA,aAAuB,UAC9DF,EAAUE,EACVA,EAAcF,EAAQ,aAExB,MAAMvB,EAAMwB,EAAUC,CAAW,EAC3BI,EAAe,CACnB,KAAMN,EAAQ,KACd,UAAWA,EAAQ,UACnB,eAAgBA,EAAQ,eACxB,qBAAsBA,EAAQ,qBAC9B,yBAA0BA,EAAQ,yBAClC,yBAA0BA,EAAQ,wBACpC,EACMW,EAAWP,EAAc3B,EAAK4B,EAAQC,CAAY,EACxD,OAAO,SAAUP,EAAMf,EAAOgB,EAAS,CASrC,GARI,OAAOD,GAAS,UAAYA,aAAgB,QAC9CC,EAAUhB,EACVA,EAAQe,EACRA,EAAOvB,EAAS,MAAMQ,EAAOgB,CAAO,GACzB,OAAOhB,GAAU,UAAYA,aAAiB,SACzDgB,EAAUhB,EACVA,EAAQ,QAEN2B,EAASZ,CAAI,EACf,OAAOA,EAET,MAAMF,EAAYc,EAAS,OAAQZ,EAAMf,EAAOgB,CAAO,CACzD,CACF,CAEAnB,EAAQ,QAAU6B,EAElB,OAAO,eAAe7B,EAAS,aAAc,CAAE,MAAO,EAAK,CAAC,CAC9D,CAAC",
6
- "names": ["global", "factory", "jsonlint", "ajv", "requireAjv", "name", "exported", "exports", "addErrorLocation", "problem", "input", "tokens", "dataPath", "token", "location", "offset", "line", "column", "texts", "errorToProblem", "error", "schemaPath", "reason", "createError", "errors", "data", "options", "createAjv", "environment", "Ajv", "compileSchema", "schema", "parseOptions", "parsed", "originalError", "betterError", "compile", "validate"]
4
+ "sourcesContent": ["(function (global, factory) {\n if (typeof exports === 'object' && typeof module !== 'undefined') {\n const jsonlint = require('./jsonlint')\n const ajv = {\n Ajv04: 'ajv-draft-04',\n Ajv07: 'ajv',\n AjvJTD: 'ajv/dist/jtd',\n Ajv2019: 'ajv/dist/2019',\n Ajv2020: 'ajv/dist/2020',\n Schema06: 'ajv/dist/refs/json-schema-draft-06.json'\n }\n const requireAjv = name => {\n const exported = require(ajv[name])\n return !exported.$schema && exported.default || exported\n }\n factory(exports, jsonlint, requireAjv)\n } else if (typeof define === 'function' && define.amd) {\n define('jsonlint-validator', ['exports', 'jsonlint', 'ajv'],\n function (exports, jsonlint, ajv) {\n const requireAjv = name => {\n const exported = ajv[name]\n return !exported.$schema && exported.default || exported\n }\n factory(exports, jsonlint, requireAjv)\n })\n } else {\n global = global || self\n const requireAjv = name => {\n const exported = global.ajv[name]\n return !exported.$schema && exported.default || exported\n }\n factory(global.jsonlintValidator = {}, global.jsonlint, requireAjv)\n }\n}(this, function (exports, jsonlint, requireAjv) {\n 'use strict'\n\n function addErrorLocation (problem, input, tokens, dataPath) {\n const token = tokens.find(function (token) {\n return dataPath === jsonlint.pathToPointer(token.path)\n })\n if (token) {\n const location = token.location.start\n const offset = location.offset\n const line = location.line\n const column = location.column\n const texts = jsonlint.getErrorTexts(problem.reason, input, offset, line, column)\n problem.message = texts.message\n problem.excerpt = texts.excerpt\n if (texts.pointer) {\n problem.pointer = texts.pointer\n problem.location = {\n start: {\n column,\n line,\n offset\n }\n }\n }\n return true\n }\n }\n\n function errorToProblem (error, input, tokens) {\n const dataPath = error.dataPath\n const schemaPath = error.schemaPath\n const reason = (dataPath || '/') + ' ' + error.message + '; see ' + schemaPath\n const problem = {\n reason,\n dataPath,\n schemaPath\n }\n if (!addErrorLocation(problem, input, tokens, dataPath)) {\n problem.message = reason\n }\n return problem\n }\n\n function createError (errors, data, input, options) {\n if (!input) {\n input = JSON.stringify(data, undefined, 2)\n }\n if (!options) {\n options = {}\n }\n Object.assign(options, {\n tokenLocations: true,\n tokenPaths: true\n })\n const tokens = jsonlint.tokenize(input, options)\n // var problems = errors.map(function (error) {\n // return errorToProblem(error, input, tokens)\n // })\n // var message = problems\n // .map(function (problem) {\n // return problem.message\n // })\n // .join('\\n')\n const problem = errorToProblem(errors[0], input, tokens)\n const error = new SyntaxError(problem.message)\n Object.assign(error, problem)\n return error\n }\n\n function createAjv (environment) {\n let ajv\n if (!environment || environment === 'json-schema-draft-06' || environment === 'draft-06') {\n const Ajv = requireAjv('Ajv07')\n ajv = new Ajv()\n ajv.addMetaSchema(requireAjv('Schema06'))\n } else if (environment === 'json-schema-draft-07' || environment === 'draft-07') {\n const Ajv = requireAjv('Ajv07')\n ajv = new Ajv()\n } else if (environment === 'json-schema-draft-04' || environment === 'draft-04') {\n const Ajv = requireAjv('Ajv04')\n ajv = new Ajv()\n } else if (environment === 'json-schema-draft-2019-09' || environment === 'draft-2019-09') {\n const Ajv = requireAjv('Ajv2019')\n ajv = new Ajv()\n } else if (environment === 'json-schema-draft-2020-12' || environment === 'draft-2020-12') {\n const Ajv = requireAjv('Ajv2020')\n ajv = new Ajv()\n } else if (environment === 'json-type-definition' || environment === 'jtd' || environment === 'rfc8927') {\n const Ajv = requireAjv('AjvJTD')\n ajv = new Ajv()\n } else {\n throw new RangeError(`Unsupported environment for the JSON Schema validation: \"${environment}\".`)\n }\n return ajv\n }\n\n function compileSchema (ajv, schema, parseOptions) {\n if (!Array.isArray(schema)) schema = [schema]\n const [main, ...others] = schema.map((schema, index) => {\n if (typeof schema !== 'string') return schema\n try {\n return jsonlint.parse(schema, parseOptions)\n } catch (error) {\n error.message = `Parsing the JSON Schema #${index + 1} failed.\\n${error.message}`\n throw error\n }\n })\n try {\n for (const schema of others) {\n ajv.addSchema(schema)\n }\n return ajv.compile(main)\n } catch (originalError) {\n const errors = ajv.errors\n const betterError = errors\n ? createError(errors, parsed, schema, parseOptions)\n : originalError\n betterError.message = `Compiling the JSON Schema failed.\\n${betterError.message}`\n throw betterError\n }\n }\n\n function compile (schema, environment) {\n let options = {}\n if (typeof environment === 'object' && !(environment instanceof String)) {\n options = environment\n environment = options.environment\n }\n const ajv = createAjv(environment)\n const parseOptions = {\n mode: options.mode,\n ignoreBOM: options.ignoreBOM,\n ignoreComments: options.ignoreComments,\n ignoreTrailingCommas: options.ignoreTrailingCommas,\n allowSingleQuotedStrings: options.allowSingleQuotedStrings,\n allowDuplicateObjectKeys: options.allowDuplicateObjectKeys\n }\n const validate = compileSchema(ajv, schema, parseOptions)\n return function (data, input, options) {\n if (typeof data === 'string' || data instanceof String) {\n options = input\n input = data\n data = jsonlint.parse(input, options)\n } else if (!(typeof input === 'string' || input instanceof String)) {\n options = input\n input = undefined\n }\n if (validate(data)) {\n return data\n }\n throw createError(validate.errors, data, input, options)\n }\n }\n\n exports.compile = compile\n\n Object.defineProperty(exports, '__esModule', { value: true })\n}))\n"],
5
+ "mappings": "CAAC,SAAUA,EAAQC,EAAS,CAC1B,GAAI,OAAO,SAAY,UAAY,OAAO,OAAW,IAAa,CAChE,MAAMC,EAAW,QAAQ,YAAY,EAC/BC,EAAM,CACV,MAAO,eACP,MAAO,MACP,OAAQ,eACR,QAAS,gBACT,QAAS,gBACT,SAAU,yCACZ,EACMC,EAAaC,GAAQ,CACzB,MAAMC,EAAW,QAAQH,EAAIE,CAAI,CAAC,EAClC,MAAO,CAACC,EAAS,SAAWA,EAAS,SAAWA,CAClD,EACAL,EAAQ,QAASC,EAAUE,CAAU,UAC5B,OAAO,QAAW,YAAc,OAAO,IAChD,OAAO,qBAAsB,CAAC,UAAW,WAAY,KAAK,EACxD,SAAUG,EAASL,EAAUC,EAAK,CAKhCF,EAAQM,EAASL,EAJEG,GAAQ,CACzB,MAAMC,EAAWH,EAAIE,CAAI,EACzB,MAAO,CAACC,EAAS,SAAWA,EAAS,SAAWA,CAClD,CACqC,CACvC,CAAC,MACE,CACLN,EAASA,GAAU,KACnB,MAAMI,EAAaC,GAAQ,CACzB,MAAMC,EAAWN,EAAO,IAAIK,CAAI,EAChC,MAAO,CAACC,EAAS,SAAWA,EAAS,SAAWA,CAClD,EACAL,EAAQD,EAAO,kBAAoB,CAAC,EAAGA,EAAO,SAAUI,CAAU,EAEtE,GAAE,KAAM,SAAUG,EAASL,EAAUE,EAAY,CAC/C,aAEA,SAASI,EAAkBC,EAASC,EAAOC,EAAQC,EAAU,CAC3D,MAAMC,EAAQF,EAAO,KAAK,SAAUE,EAAO,CACzC,OAAOD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C,EAASP,EAAQH,EAAa,CACrC,IAAIF,EAAU,CAAC,EACX,OAAOE,GAAgB,UAAY,EAAEA,aAAuB,UAC9DF,EAAUE,EACVA,EAAcF,EAAQ,aAExB,MAAMvB,EAAMwB,EAAUC,CAAW,EAC3BI,EAAe,CACnB,KAAMN,EAAQ,KACd,UAAWA,EAAQ,UACnB,eAAgBA,EAAQ,eACxB,qBAAsBA,EAAQ,qBAC9B,yBAA0BA,EAAQ,yBAClC,yBAA0BA,EAAQ,wBACpC,EACMa,EAAWT,EAAc3B,EAAK4B,EAAQC,CAAY,EACxD,OAAO,SAAUP,EAAMf,EAAOgB,EAAS,CASrC,GARI,OAAOD,GAAS,UAAYA,aAAgB,QAC9CC,EAAUhB,EACVA,EAAQe,EACRA,EAAOvB,EAAS,MAAMQ,EAAOgB,CAAO,GACzB,OAAOhB,GAAU,UAAYA,aAAiB,SACzDgB,EAAUhB,EACVA,EAAQ,QAEN6B,EAASd,CAAI,EACf,OAAOA,EAET,MAAMF,EAAYgB,EAAS,OAAQd,EAAMf,EAAOgB,CAAO,CACzD,CACF,CAEAnB,EAAQ,QAAU+B,EAElB,OAAO,eAAe/B,EAAS,aAAc,CAAE,MAAO,EAAK,CAAC,CAC9D,CAAC",
6
+ "names": ["global", "factory", "jsonlint", "ajv", "requireAjv", "name", "exported", "exports", "addErrorLocation", "problem", "input", "tokens", "dataPath", "token", "location", "offset", "line", "column", "texts", "errorToProblem", "error", "schemaPath", "reason", "createError", "errors", "data", "options", "createAjv", "environment", "Ajv", "compileSchema", "schema", "parseOptions", "main", "others", "index", "originalError", "betterError", "compile", "validate"]
7
7
  }