Spaces:
Paused

Leon4gr45 commited on
Commit
a23aa7d
·
verified ·
1 Parent(s): f2b20ec

Include updated package-lock.json

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. node_modules/.bin/acorn +4 -0
  2. node_modules/.bin/autoprefixer +22 -0
  3. node_modules/.bin/baseline-browser-mapping +2 -0
  4. node_modules/.bin/browserslist +156 -0
  5. node_modules/.bin/conc +229 -0
  6. node_modules/.bin/concurrently +229 -0
  7. node_modules/.bin/crc32 +105 -0
  8. node_modules/.bin/cssesc +116 -0
  9. node_modules/.bin/ejs +211 -0
  10. node_modules/.bin/eslint +211 -0
  11. node_modules/.bin/eslint-config-prettier +240 -0
  12. node_modules/.bin/fxparser +97 -0
  13. node_modules/.bin/jake +31 -0
  14. node_modules/.bin/jiti +16 -0
  15. node_modules/.bin/js-yaml +117 -0
  16. node_modules/.bin/jsesc +148 -0
  17. node_modules/.bin/json5 +152 -0
  18. node_modules/.bin/loose-envify +16 -0
  19. node_modules/.bin/lz-string +13 -0
  20. node_modules/.bin/marked +16 -0
  21. node_modules/.bin/mime +46 -0
  22. node_modules/.bin/msw +35 -0
  23. node_modules/.bin/nanoid +55 -0
  24. node_modules/.bin/node-which +52 -0
  25. node_modules/.bin/nodemon +16 -0
  26. node_modules/.bin/nodetouch +112 -0
  27. node_modules/.bin/parser +15 -0
  28. node_modules/.bin/pbf +17 -0
  29. node_modules/.bin/pixelmatch +42 -0
  30. node_modules/.bin/playwright +19 -0
  31. node_modules/.bin/playwright-core +21 -0
  32. node_modules/.bin/prebuild-install +78 -0
  33. node_modules/.bin/prettier +80 -0
  34. node_modules/.bin/qrcode +159 -0
  35. node_modules/.bin/rc +4 -0
  36. node_modules/.bin/regjsparser +63 -0
  37. node_modules/.bin/resolve +50 -0
  38. node_modules/.bin/rolldown +2 -0
  39. node_modules/.bin/rollup +1912 -0
  40. node_modules/.bin/semver +195 -0
  41. node_modules/.bin/specificity +14 -0
  42. node_modules/.bin/sucrase +3 -0
  43. node_modules/.bin/sucrase-node +18 -0
  44. node_modules/.bin/tailwind +3 -0
  45. node_modules/.bin/tailwindcss +3 -0
  46. node_modules/.bin/terser +21 -0
  47. node_modules/.bin/tldts +21 -0
  48. node_modules/.bin/topo2geo +106 -0
  49. node_modules/.bin/topomerge +216 -0
  50. node_modules/.bin/topoquantize +74 -0
node_modules/.bin/acorn ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ #!/usr/bin/env node
2
+ "use strict"
3
+
4
+ require("../dist/bin.js")
node_modules/.bin/autoprefixer ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env node
2
+
3
+ let mode = process.argv[2]
4
+ if (mode === '--info') {
5
+ process.stdout.write(require('../')().info() + '\n')
6
+ } else if (mode === '--version') {
7
+ process.stdout.write(
8
+ 'autoprefixer ' + require('../package.json').version + '\n'
9
+ )
10
+ } else {
11
+ process.stdout.write(
12
+ 'autoprefix\n' +
13
+ '\n' +
14
+ 'Options:\n' +
15
+ ' --info Show target browsers and used prefixes\n' +
16
+ ' --version Show version number\n' +
17
+ ' --help Show help\n' +
18
+ '\n' +
19
+ 'Usage:\n' +
20
+ ' autoprefixer --info\n'
21
+ )
22
+ }
node_modules/.bin/baseline-browser-mapping ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ #!/usr/bin/env node
2
+ "use strict";const{getCompatibleVersions:e}=require("./index.cjs"),a=process.argv.slice(2),s={};for(let e=0;e<a.length;e++){const r=a[e];r&&("-h"===r||"--help"===r?s.help=!0:"--include-downstream-browsers"===r?s["include-downstream-browsers"]=!0:"--list-all-compatible-versions"===r?s["list-all-compatible-versions"]=!0:"--include-kaios"===r?s["include-kaios"]=!0:"--suppress-warnings"===r?s["suppress-warnings"]=!0:r.startsWith("--target-year=")?s["target-year"]=r.substring(14):"--target-year"===r?s["target-year"]=a[++e]:r.startsWith("--widely-available-on-date=")?s["widely-available-on-date"]=r.substring(27):"--widely-available-on-date"===r?s["widely-available-on-date"]=a[++e]:r.startsWith("--override-last-updated=")?s["override-last-updated"]=r.substring(24):"--override-last-updated"===r?s["override-last-updated"]=a[++e]:(console.error(`Unknown argument: ${r}`),process.exit(1)))}s.help&&(console.log("\nGet Baseline Widely available browser versions or Baseline year browser versions.\n\nUsage: baseline-browser-mapping [options]\n\nOptions:\n --target-year Pass a year between 2015 and the current year to get browser versions compatible \n with all Newly Available features as of the end of the year specified.\n --widely-available-on-date Pass a date in the format 'YYYY-MM-DD' to get versions compatible with Widely \n available on the specified date.\n --include-downstream-browsers Whether to include browsers that use the same engines as a core Baseline browser.\n --include-kaios Whether to include KaiOS in downstream browsers. Requires --include-downstream-browsers.\n --list-all-compatible-versions Whether to include only the minimum compatible browser versions or all compatible versions.\n --suppress-warnings Supress potential warnings about data staleness when using a very recent feature cut off date.\n --override-last-updated Override the last updated date for the baseline data for debugging purposes.\n -h, --help Show help\n\nExamples:\n npx baseline-browser-mapping --target-year 2020\n npx baseline-browser-mapping --widely-available-on-date 2023-04-05\n npx baseline-browser-mapping --include-downstream-browsers\n npx baseline-browser-mapping --list-all-compatible-versions\n".trim()),process.exit(0)),console.log(e({targetYear:s["target-year"]?Number.parseInt(s["target-year"]):void 0,widelyAvailableOnDate:s["widely-available-on-date"],includeDownstreamBrowsers:s["include-downstream-browsers"],listAllCompatibleVersions:s["list-all-compatible-versions"],includeKaiOS:s["include-kaios"],suppressWarnings:s["suppress-warnings"],overrideLastUpdated:s["override-last-updated"]?Number.parseInt(s["override-last-updated"]):void 0}));
node_modules/.bin/browserslist ADDED
@@ -0,0 +1,156 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env node
2
+
3
+ var fs = require('fs')
4
+ var updateDb = require('update-browserslist-db')
5
+
6
+ var browserslist = require('./')
7
+ var pkg = require('./package.json')
8
+
9
+ var args = process.argv.slice(2)
10
+
11
+ var USAGE =
12
+ 'Usage:\n' +
13
+ ' npx browserslist\n' +
14
+ ' npx browserslist "QUERIES"\n' +
15
+ ' npx browserslist --json "QUERIES"\n' +
16
+ ' npx browserslist --config="path/to/browserlist/file"\n' +
17
+ ' npx browserslist --coverage "QUERIES"\n' +
18
+ ' npx browserslist --coverage=US "QUERIES"\n' +
19
+ ' npx browserslist --coverage=US,RU,global "QUERIES"\n' +
20
+ ' npx browserslist --env="environment name defined in config"\n' +
21
+ ' npx browserslist --stats="path/to/browserlist/stats/file"\n' +
22
+ ' npx browserslist --mobile-to-desktop\n' +
23
+ ' npx browserslist --ignore-unknown-versions\n'
24
+
25
+ function isArg(arg) {
26
+ return args.some(function (str) {
27
+ return str === arg || str.indexOf(arg + '=') === 0
28
+ })
29
+ }
30
+
31
+ function error(msg) {
32
+ process.stderr.write('browserslist: ' + msg + '\n')
33
+ process.exit(1)
34
+ }
35
+
36
+ if (isArg('--help') || isArg('-h')) {
37
+ process.stdout.write(pkg.description + '.\n\n' + USAGE + '\n')
38
+ } else if (isArg('--version') || isArg('-v')) {
39
+ process.stdout.write('browserslist ' + pkg.version + '\n')
40
+ } else if (isArg('--update-db')) {
41
+ /* c8 ignore next 8 */
42
+ process.stdout.write(
43
+ 'The --update-db command is deprecated.\n' +
44
+ 'Please use npx update-browserslist-db@latest instead.\n'
45
+ )
46
+ process.stdout.write('Browserslist DB update will still be made.\n')
47
+ updateDb(function (str) {
48
+ process.stdout.write(str)
49
+ })
50
+ } else {
51
+ var mode = 'browsers'
52
+ var opts = {}
53
+ var queries
54
+ var areas
55
+
56
+ for (var i = 0; i < args.length; i++) {
57
+ if (args[i][0] !== '-') {
58
+ queries = args[i].replace(/^["']|["']$/g, '')
59
+ continue
60
+ }
61
+
62
+ var arg = args[i].split('=')
63
+ var name = arg[0]
64
+ var value = arg[1]
65
+
66
+ if (value) value = value.replace(/^["']|["']$/g, '')
67
+
68
+ if (name === '--config' || name === '-b') {
69
+ opts.config = value
70
+ } else if (name === '--env' || name === '-e') {
71
+ opts.env = value
72
+ } else if (name === '--stats' || name === '-s') {
73
+ opts.stats = value
74
+ } else if (name === '--coverage' || name === '-c') {
75
+ if (mode !== 'json') mode = 'coverage'
76
+ if (value) {
77
+ areas = value.split(',')
78
+ } else {
79
+ areas = ['global']
80
+ }
81
+ } else if (name === '--json') {
82
+ mode = 'json'
83
+ } else if (name === '--mobile-to-desktop') {
84
+ /* c8 ignore next */
85
+ opts.mobileToDesktop = true
86
+ } else if (name === '--ignore-unknown-versions') {
87
+ /* c8 ignore next */
88
+ opts.ignoreUnknownVersions = true
89
+ } else {
90
+ error('Unknown arguments ' + args[i] + '.\n\n' + USAGE)
91
+ }
92
+ }
93
+
94
+ var browsers
95
+ try {
96
+ browsers = browserslist(queries, opts)
97
+ } catch (e) {
98
+ if (e.name === 'BrowserslistError') {
99
+ error(e.message)
100
+ } /* c8 ignore start */ else {
101
+ throw e
102
+ } /* c8 ignore end */
103
+ }
104
+
105
+ var coverage
106
+ if (mode === 'browsers') {
107
+ browsers.forEach(function (browser) {
108
+ process.stdout.write(browser + '\n')
109
+ })
110
+ } else if (areas) {
111
+ coverage = areas.map(function (area) {
112
+ var stats
113
+ if (area !== 'global') {
114
+ stats = area
115
+ } else if (opts.stats) {
116
+ stats = JSON.parse(fs.readFileSync(opts.stats))
117
+ }
118
+ var result = browserslist.coverage(browsers, stats)
119
+ var round = Math.round(result * 100) / 100.0
120
+
121
+ return [area, round]
122
+ })
123
+
124
+ if (mode === 'coverage') {
125
+ var prefix = 'These browsers account for '
126
+ process.stdout.write(prefix)
127
+ coverage.forEach(function (data, index) {
128
+ var area = data[0]
129
+ var round = data[1]
130
+ var end = 'globally'
131
+ if (area && area !== 'global') {
132
+ end = 'in the ' + area.toUpperCase()
133
+ } else if (opts.stats) {
134
+ end = 'in custom statistics'
135
+ }
136
+
137
+ if (index !== 0) {
138
+ process.stdout.write(prefix.replace(/./g, ' '))
139
+ }
140
+
141
+ process.stdout.write(round + '% of all users ' + end + '\n')
142
+ })
143
+ }
144
+ }
145
+
146
+ if (mode === 'json') {
147
+ var data = { browsers: browsers }
148
+ if (coverage) {
149
+ data.coverage = coverage.reduce(function (object, j) {
150
+ object[j[0]] = j[1]
151
+ return object
152
+ }, {})
153
+ }
154
+ process.stdout.write(JSON.stringify(data, null, ' ') + '\n')
155
+ }
156
+ }
node_modules/.bin/conc ADDED
@@ -0,0 +1,229 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env node
2
+ import process from 'node:process';
3
+ import yargs from 'yargs';
4
+ import { hideBin } from 'yargs/helpers';
5
+ import * as defaults from '../lib/defaults.js';
6
+ import { concurrently } from '../lib/index.js';
7
+ import { castArray, splitOutsideParens } from '../lib/utils.js';
8
+ import { normalizeCliCommand } from './normalize-cli-command.js';
9
+ import { readPackageJson } from './read-package-json.js';
10
+ const version = String(readPackageJson().version);
11
+ const epilogue = `For documentation and more examples, visit:\nhttps://github.com/open-cli-tools/concurrently/tree/v${version}/docs`;
12
+ // Clean-up arguments (yargs expects only the arguments after the program name)
13
+ const program = yargs(hideBin(process.argv))
14
+ .parserConfiguration({
15
+ // Avoids options that can be specified multiple times from requiring a `--` to pass commands
16
+ 'greedy-arrays': false,
17
+ // Makes sure that --passthrough-arguments works correctly
18
+ 'populate--': true,
19
+ })
20
+ .usage('$0 [options] <command ...>')
21
+ .help('h')
22
+ .alias('h', 'help')
23
+ .version(version)
24
+ .alias('version', 'v')
25
+ .alias('version', 'V')
26
+ // TODO: Add some tests for this.
27
+ .env('CONCURRENTLY')
28
+ .options({
29
+ // General
30
+ 'max-processes': {
31
+ alias: 'm',
32
+ describe: 'How many processes should run at once.\n' +
33
+ 'New processes only spawn after all restart tries of a process.\n' +
34
+ 'Exact number or a percent of CPUs available (for example "50%")',
35
+ type: 'string',
36
+ },
37
+ names: {
38
+ alias: 'n',
39
+ describe: 'List of custom names to be used in prefix template.\n' +
40
+ 'Example names: "main,browser,server"',
41
+ type: 'string',
42
+ },
43
+ success: {
44
+ alias: 's',
45
+ describe: 'Which command(s) must exit with code 0 in order for concurrently exit with ' +
46
+ 'code 0 too. Options are:\n' +
47
+ '- "first" for the first command to exit;\n' +
48
+ '- "last" for the last command to exit;\n' +
49
+ '- "all" for all commands;\n' +
50
+ // Note: not a typo. Multiple commands can have the same name.
51
+ '- "command-{name}"/"command-{index}" for the commands with that name or index;\n' +
52
+ '- "!command-{name}"/"!command-{index}" for all commands but the ones with that ' +
53
+ 'name or index.\n',
54
+ default: defaults.success,
55
+ },
56
+ raw: {
57
+ alias: 'r',
58
+ describe: 'Output only raw output of processes, disables prettifying ' +
59
+ 'and concurrently coloring.',
60
+ type: 'boolean',
61
+ },
62
+ // This one is provided for free. Chalk reads this itself and removes colors.
63
+ // https://www.npmjs.com/package/chalk#supportscolor
64
+ 'no-color': {
65
+ describe: 'Disables colors from logging',
66
+ type: 'boolean',
67
+ },
68
+ hide: {
69
+ describe: 'Comma-separated list of processes to hide the output.\n' +
70
+ 'The processes can be identified by their name or index.',
71
+ default: defaults.hide,
72
+ type: 'string',
73
+ },
74
+ group: {
75
+ alias: 'g',
76
+ describe: 'Order the output as if the commands were run sequentially.',
77
+ type: 'boolean',
78
+ },
79
+ timings: {
80
+ describe: 'Show timing information for all processes.',
81
+ type: 'boolean',
82
+ default: defaults.timings,
83
+ },
84
+ shell: {
85
+ describe: 'Shell to run commands with. Defaults to cmd.exe on Windows and /bin/sh elsewhere.',
86
+ type: 'string',
87
+ },
88
+ 'passthrough-arguments': {
89
+ alias: 'P',
90
+ describe: 'Passthrough additional arguments to commands (accessible via placeholders) ' +
91
+ 'instead of treating them as commands.',
92
+ type: 'boolean',
93
+ default: defaults.passthroughArguments,
94
+ },
95
+ teardown: {
96
+ describe: 'Clean up command(s) to execute before exiting concurrently. Might be specified multiple times.\n' +
97
+ "These aren't prefixed and they don't affect concurrently's exit code.",
98
+ type: 'string',
99
+ array: true,
100
+ },
101
+ // Kill others
102
+ 'kill-others': {
103
+ alias: 'k',
104
+ describe: 'Kill other processes once the first exits.',
105
+ type: 'boolean',
106
+ },
107
+ 'kill-others-on-fail': {
108
+ describe: 'Kill other processes if one exits with non zero status code.',
109
+ type: 'boolean',
110
+ },
111
+ 'kill-signal': {
112
+ alias: 'ks',
113
+ describe: 'Signal to send to other processes if one exits or dies. (SIGTERM/SIGKILL, defaults to SIGTERM)',
114
+ type: 'string',
115
+ default: defaults.killSignal,
116
+ },
117
+ 'kill-timeout': {
118
+ describe: 'How many milliseconds to wait before forcing process terminating.',
119
+ type: 'number',
120
+ },
121
+ // Prefix
122
+ prefix: {
123
+ alias: 'p',
124
+ describe: 'Prefix used in logging for each process.\n' +
125
+ 'Possible values: index, pid, time, command, name, none, or a template. ' +
126
+ 'Example template: "{time}-{pid}"',
127
+ defaultDescription: 'index or name (when --names is set)',
128
+ type: 'string',
129
+ },
130
+ 'prefix-colors': {
131
+ alias: 'c',
132
+ describe: 'Comma-separated list of Chalk colors to use on prefixes. ' +
133
+ 'If there are more commands than colors, the last color will be repeated.\n' +
134
+ '- Available modifiers: reset, bold, dim, italic, underline, inverse, hidden, strikethrough\n' +
135
+ '- Available colors: black, red, green, yellow, blue, magenta, cyan, white, gray, \n' +
136
+ 'any hex values for colors (e.g. #23de43) or auto for an automatically picked color\n' +
137
+ '- Available background colors: bgBlack, bgRed, bgGreen, bgYellow, bgBlue, bgMagenta, bgCyan, bgWhite\n' +
138
+ 'See https://www.npmjs.com/package/chalk for more information.',
139
+ default: defaults.prefixColors,
140
+ type: 'string',
141
+ },
142
+ 'prefix-length': {
143
+ alias: 'l',
144
+ describe: 'Limit how many characters of the command is displayed in prefix. ' +
145
+ 'The option can be used to shorten the prefix when it is set to "command"',
146
+ default: defaults.prefixLength,
147
+ type: 'number',
148
+ },
149
+ 'pad-prefix': {
150
+ describe: 'Pads short prefixes with spaces so that the length of all prefixes match',
151
+ type: 'boolean',
152
+ },
153
+ 'timestamp-format': {
154
+ alias: 't',
155
+ describe: 'Specify the timestamp in Unicode format:\n' +
156
+ 'https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table',
157
+ default: defaults.timestampFormat,
158
+ type: 'string',
159
+ },
160
+ // Restarting
161
+ 'restart-tries': {
162
+ describe: 'How many times a process that died should restart.\n' +
163
+ 'Negative numbers will make the process restart forever.',
164
+ default: defaults.restartTries,
165
+ type: 'number',
166
+ },
167
+ 'restart-after': {
168
+ describe: 'Delay before restarting the process, in milliseconds, or "exponential".',
169
+ default: defaults.restartDelay,
170
+ type: 'string',
171
+ },
172
+ // Input
173
+ 'handle-input': {
174
+ alias: 'i',
175
+ describe: 'Whether input should be forwarded to the child processes. ' +
176
+ 'See examples for more information.',
177
+ type: 'boolean',
178
+ },
179
+ 'default-input-target': {
180
+ default: defaults.defaultInputTarget,
181
+ describe: 'Identifier for child process to which input on stdin ' +
182
+ 'should be sent if not specified at start of input.\n' +
183
+ 'Can be either the index or the name of the process.',
184
+ },
185
+ })
186
+ .group(['m', 'n', 's', 'r', 'no-color', 'hide', 'g', 'timings', 'shell', 'P', 'teardown'], 'General')
187
+ .group(['p', 'c', 'l', 't', 'pad-prefix'], 'Prefix styling')
188
+ .group(['i', 'default-input-target'], 'Input handling')
189
+ .group(['k', 'kill-others-on-fail', 'kill-signal', 'kill-timeout'], 'Killing other processes')
190
+ .group(['restart-tries', 'restart-after'], 'Restarting')
191
+ .epilogue(epilogue);
192
+ const args = program.parseSync();
193
+ const names = (args.names || '').split(',');
194
+ const additionalArguments = castArray(args['--'] ?? []).map(String);
195
+ const commands = args.passthroughArguments ? args._ : args._.concat(additionalArguments);
196
+ if (!commands.length) {
197
+ program.showHelp();
198
+ process.exit();
199
+ }
200
+ concurrently(commands.map((command, index) => ({
201
+ command: normalizeCliCommand(String(command)),
202
+ name: names[index],
203
+ })), {
204
+ handleInput: args.handleInput,
205
+ defaultInputTarget: args.defaultInputTarget,
206
+ killOthersOn: args.killOthers
207
+ ? ['success', 'failure']
208
+ : args.killOthersOnFail
209
+ ? ['failure']
210
+ : [],
211
+ killSignal: args.killSignal,
212
+ killTimeout: args.killTimeout,
213
+ maxProcesses: args.maxProcesses,
214
+ raw: args.raw,
215
+ hide: args.hide.split(','),
216
+ group: args.group,
217
+ prefix: args.prefix,
218
+ prefixColors: splitOutsideParens(args.prefixColors, ','),
219
+ prefixLength: args.prefixLength,
220
+ padPrefix: args.padPrefix,
221
+ restartDelay: args.restartAfter === 'exponential' ? 'exponential' : Number(args.restartAfter),
222
+ restartTries: args.restartTries,
223
+ successCondition: args.success,
224
+ timestampFormat: args.timestampFormat,
225
+ timings: args.timings,
226
+ shell: args.shell,
227
+ teardown: args.teardown,
228
+ additionalArguments: args.passthroughArguments ? additionalArguments : undefined,
229
+ }).result.then(() => process.exit(0), () => process.exit(1));
node_modules/.bin/concurrently ADDED
@@ -0,0 +1,229 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env node
2
+ import process from 'node:process';
3
+ import yargs from 'yargs';
4
+ import { hideBin } from 'yargs/helpers';
5
+ import * as defaults from '../lib/defaults.js';
6
+ import { concurrently } from '../lib/index.js';
7
+ import { castArray, splitOutsideParens } from '../lib/utils.js';
8
+ import { normalizeCliCommand } from './normalize-cli-command.js';
9
+ import { readPackageJson } from './read-package-json.js';
10
+ const version = String(readPackageJson().version);
11
+ const epilogue = `For documentation and more examples, visit:\nhttps://github.com/open-cli-tools/concurrently/tree/v${version}/docs`;
12
+ // Clean-up arguments (yargs expects only the arguments after the program name)
13
+ const program = yargs(hideBin(process.argv))
14
+ .parserConfiguration({
15
+ // Avoids options that can be specified multiple times from requiring a `--` to pass commands
16
+ 'greedy-arrays': false,
17
+ // Makes sure that --passthrough-arguments works correctly
18
+ 'populate--': true,
19
+ })
20
+ .usage('$0 [options] <command ...>')
21
+ .help('h')
22
+ .alias('h', 'help')
23
+ .version(version)
24
+ .alias('version', 'v')
25
+ .alias('version', 'V')
26
+ // TODO: Add some tests for this.
27
+ .env('CONCURRENTLY')
28
+ .options({
29
+ // General
30
+ 'max-processes': {
31
+ alias: 'm',
32
+ describe: 'How many processes should run at once.\n' +
33
+ 'New processes only spawn after all restart tries of a process.\n' +
34
+ 'Exact number or a percent of CPUs available (for example "50%")',
35
+ type: 'string',
36
+ },
37
+ names: {
38
+ alias: 'n',
39
+ describe: 'List of custom names to be used in prefix template.\n' +
40
+ 'Example names: "main,browser,server"',
41
+ type: 'string',
42
+ },
43
+ success: {
44
+ alias: 's',
45
+ describe: 'Which command(s) must exit with code 0 in order for concurrently exit with ' +
46
+ 'code 0 too. Options are:\n' +
47
+ '- "first" for the first command to exit;\n' +
48
+ '- "last" for the last command to exit;\n' +
49
+ '- "all" for all commands;\n' +
50
+ // Note: not a typo. Multiple commands can have the same name.
51
+ '- "command-{name}"/"command-{index}" for the commands with that name or index;\n' +
52
+ '- "!command-{name}"/"!command-{index}" for all commands but the ones with that ' +
53
+ 'name or index.\n',
54
+ default: defaults.success,
55
+ },
56
+ raw: {
57
+ alias: 'r',
58
+ describe: 'Output only raw output of processes, disables prettifying ' +
59
+ 'and concurrently coloring.',
60
+ type: 'boolean',
61
+ },
62
+ // This one is provided for free. Chalk reads this itself and removes colors.
63
+ // https://www.npmjs.com/package/chalk#supportscolor
64
+ 'no-color': {
65
+ describe: 'Disables colors from logging',
66
+ type: 'boolean',
67
+ },
68
+ hide: {
69
+ describe: 'Comma-separated list of processes to hide the output.\n' +
70
+ 'The processes can be identified by their name or index.',
71
+ default: defaults.hide,
72
+ type: 'string',
73
+ },
74
+ group: {
75
+ alias: 'g',
76
+ describe: 'Order the output as if the commands were run sequentially.',
77
+ type: 'boolean',
78
+ },
79
+ timings: {
80
+ describe: 'Show timing information for all processes.',
81
+ type: 'boolean',
82
+ default: defaults.timings,
83
+ },
84
+ shell: {
85
+ describe: 'Shell to run commands with. Defaults to cmd.exe on Windows and /bin/sh elsewhere.',
86
+ type: 'string',
87
+ },
88
+ 'passthrough-arguments': {
89
+ alias: 'P',
90
+ describe: 'Passthrough additional arguments to commands (accessible via placeholders) ' +
91
+ 'instead of treating them as commands.',
92
+ type: 'boolean',
93
+ default: defaults.passthroughArguments,
94
+ },
95
+ teardown: {
96
+ describe: 'Clean up command(s) to execute before exiting concurrently. Might be specified multiple times.\n' +
97
+ "These aren't prefixed and they don't affect concurrently's exit code.",
98
+ type: 'string',
99
+ array: true,
100
+ },
101
+ // Kill others
102
+ 'kill-others': {
103
+ alias: 'k',
104
+ describe: 'Kill other processes once the first exits.',
105
+ type: 'boolean',
106
+ },
107
+ 'kill-others-on-fail': {
108
+ describe: 'Kill other processes if one exits with non zero status code.',
109
+ type: 'boolean',
110
+ },
111
+ 'kill-signal': {
112
+ alias: 'ks',
113
+ describe: 'Signal to send to other processes if one exits or dies. (SIGTERM/SIGKILL, defaults to SIGTERM)',
114
+ type: 'string',
115
+ default: defaults.killSignal,
116
+ },
117
+ 'kill-timeout': {
118
+ describe: 'How many milliseconds to wait before forcing process terminating.',
119
+ type: 'number',
120
+ },
121
+ // Prefix
122
+ prefix: {
123
+ alias: 'p',
124
+ describe: 'Prefix used in logging for each process.\n' +
125
+ 'Possible values: index, pid, time, command, name, none, or a template. ' +
126
+ 'Example template: "{time}-{pid}"',
127
+ defaultDescription: 'index or name (when --names is set)',
128
+ type: 'string',
129
+ },
130
+ 'prefix-colors': {
131
+ alias: 'c',
132
+ describe: 'Comma-separated list of Chalk colors to use on prefixes. ' +
133
+ 'If there are more commands than colors, the last color will be repeated.\n' +
134
+ '- Available modifiers: reset, bold, dim, italic, underline, inverse, hidden, strikethrough\n' +
135
+ '- Available colors: black, red, green, yellow, blue, magenta, cyan, white, gray, \n' +
136
+ 'any hex values for colors (e.g. #23de43) or auto for an automatically picked color\n' +
137
+ '- Available background colors: bgBlack, bgRed, bgGreen, bgYellow, bgBlue, bgMagenta, bgCyan, bgWhite\n' +
138
+ 'See https://www.npmjs.com/package/chalk for more information.',
139
+ default: defaults.prefixColors,
140
+ type: 'string',
141
+ },
142
+ 'prefix-length': {
143
+ alias: 'l',
144
+ describe: 'Limit how many characters of the command is displayed in prefix. ' +
145
+ 'The option can be used to shorten the prefix when it is set to "command"',
146
+ default: defaults.prefixLength,
147
+ type: 'number',
148
+ },
149
+ 'pad-prefix': {
150
+ describe: 'Pads short prefixes with spaces so that the length of all prefixes match',
151
+ type: 'boolean',
152
+ },
153
+ 'timestamp-format': {
154
+ alias: 't',
155
+ describe: 'Specify the timestamp in Unicode format:\n' +
156
+ 'https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table',
157
+ default: defaults.timestampFormat,
158
+ type: 'string',
159
+ },
160
+ // Restarting
161
+ 'restart-tries': {
162
+ describe: 'How many times a process that died should restart.\n' +
163
+ 'Negative numbers will make the process restart forever.',
164
+ default: defaults.restartTries,
165
+ type: 'number',
166
+ },
167
+ 'restart-after': {
168
+ describe: 'Delay before restarting the process, in milliseconds, or "exponential".',
169
+ default: defaults.restartDelay,
170
+ type: 'string',
171
+ },
172
+ // Input
173
+ 'handle-input': {
174
+ alias: 'i',
175
+ describe: 'Whether input should be forwarded to the child processes. ' +
176
+ 'See examples for more information.',
177
+ type: 'boolean',
178
+ },
179
+ 'default-input-target': {
180
+ default: defaults.defaultInputTarget,
181
+ describe: 'Identifier for child process to which input on stdin ' +
182
+ 'should be sent if not specified at start of input.\n' +
183
+ 'Can be either the index or the name of the process.',
184
+ },
185
+ })
186
+ .group(['m', 'n', 's', 'r', 'no-color', 'hide', 'g', 'timings', 'shell', 'P', 'teardown'], 'General')
187
+ .group(['p', 'c', 'l', 't', 'pad-prefix'], 'Prefix styling')
188
+ .group(['i', 'default-input-target'], 'Input handling')
189
+ .group(['k', 'kill-others-on-fail', 'kill-signal', 'kill-timeout'], 'Killing other processes')
190
+ .group(['restart-tries', 'restart-after'], 'Restarting')
191
+ .epilogue(epilogue);
192
+ const args = program.parseSync();
193
+ const names = (args.names || '').split(',');
194
+ const additionalArguments = castArray(args['--'] ?? []).map(String);
195
+ const commands = args.passthroughArguments ? args._ : args._.concat(additionalArguments);
196
+ if (!commands.length) {
197
+ program.showHelp();
198
+ process.exit();
199
+ }
200
+ concurrently(commands.map((command, index) => ({
201
+ command: normalizeCliCommand(String(command)),
202
+ name: names[index],
203
+ })), {
204
+ handleInput: args.handleInput,
205
+ defaultInputTarget: args.defaultInputTarget,
206
+ killOthersOn: args.killOthers
207
+ ? ['success', 'failure']
208
+ : args.killOthersOnFail
209
+ ? ['failure']
210
+ : [],
211
+ killSignal: args.killSignal,
212
+ killTimeout: args.killTimeout,
213
+ maxProcesses: args.maxProcesses,
214
+ raw: args.raw,
215
+ hide: args.hide.split(','),
216
+ group: args.group,
217
+ prefix: args.prefix,
218
+ prefixColors: splitOutsideParens(args.prefixColors, ','),
219
+ prefixLength: args.prefixLength,
220
+ padPrefix: args.padPrefix,
221
+ restartDelay: args.restartAfter === 'exponential' ? 'exponential' : Number(args.restartAfter),
222
+ restartTries: args.restartTries,
223
+ successCondition: args.success,
224
+ timestampFormat: args.timestampFormat,
225
+ timings: args.timings,
226
+ shell: args.shell,
227
+ teardown: args.teardown,
228
+ additionalArguments: args.passthroughArguments ? additionalArguments : undefined,
229
+ }).result.then(() => process.exit(0), () => process.exit(1));
node_modules/.bin/crc32 ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env node
2
+ /* crc32.js (C) 2014-present SheetJS -- http://sheetjs.com */
3
+ /* eslint-env node */
4
+ /* vim: set ts=2 ft=javascript: */
5
+ /*jshint node:true */
6
+
7
+ var X/*:CRC32Module*/;
8
+ try { X = require('../'); } catch(e) { X = require('crc-32'); }
9
+
10
+ function help()/*:number*/ {
11
+ [
12
+ "usage: crc32 [options] [filename]",
13
+ "",
14
+ "Options:",
15
+ " -h, --help output usage information",
16
+ " -V, --version output the version number",
17
+ " -S, --seed=<n> use integer seed as starting value (rolling CRC)",
18
+ " -H, --hex-seed=<h> use hex seed as starting value (rolling CRC)",
19
+ " -d, --signed print result with format `%d` (default)",
20
+ " -u, --unsigned print result with format `%u`",
21
+ " -x, --hex print result with format `%0.8x`",
22
+ " -X, --HEX print result with format `%0.8X`",
23
+ " -c, --crc32c use CRC32C (Castagnoli)",
24
+ " -F, --format=<s> use specified printf format",
25
+ "",
26
+ "Set filename = '-' or pipe data into crc32 to read from stdin",
27
+ "Default output mode is signed (-d)",
28
+ ""
29
+ ].forEach(function(l) { console.log(l); });
30
+ return 0;
31
+ }
32
+
33
+ function version()/*:number*/ { console.log(X.version); return 0; }
34
+
35
+ var fs = require('fs');
36
+ try { require('exit-on-epipe'); } catch(e) {}
37
+
38
+ function die(msg/*:string*/, ec/*:?number*/)/*:void*/ { console.error(msg); process.exit(ec || 0); }
39
+
40
+ var args/*:Array<string>*/ = process.argv.slice(2);
41
+ var filename/*:string*/ = "";
42
+ var fmt/*:string*/ = "";
43
+ var seed = 0, r = 10;
44
+
45
+ for(var i = 0; i < args.length; ++i) {
46
+ var arg = args[i];
47
+ if(arg.charCodeAt(0) != 45) { if(filename === "") filename = arg; continue; }
48
+ var m = arg.indexOf("=") == -1 ? arg : arg.substr(0, arg.indexOf("="));
49
+ switch(m) {
50
+ case "-": filename = "-"; break;
51
+
52
+ case "--help": case "-h": process.exit(help()); break;
53
+ case "--version": case "-V": process.exit(version()); break;
54
+
55
+ case "--crc32c": case "-c": try { X = require('../crc32c'); } catch(e) { X = require('crc-32/crc32c'); } break;
56
+
57
+ case "--signed": case "-d": fmt = "%d"; break;
58
+ case "--unsigned": case "-u": fmt = "%u"; break;
59
+ case "--hex": case "-x": fmt = "%0.8x"; break;
60
+ case "--HEX": case "-X": fmt = "%0.8X"; break;
61
+ case "--format": case "-F":
62
+ try {
63
+ require("printj");
64
+ fmt = ((m!=arg) ? arg.substr(m.length+1) : args[++i])||"";
65
+ } catch(e) {
66
+ console.error("The `crc-32` module removed the `printj` dependency for formatting");
67
+ console.error("Use the `crc32-cli` module instead:");
68
+ console.error(" $ npx crc32-cli [options] [filename]");
69
+ } break;
70
+
71
+ case "--hex-seed": case "-H": r = 16;
72
+ /* falls through */
73
+ case "--seed": case "-S":
74
+ seed=parseInt((m!=arg) ? arg.substr(m.length+1) : args[++i], r)||0; break;
75
+
76
+ default: die("crc32: unrecognized option `" + arg + "'", 22);
77
+ }
78
+ }
79
+
80
+ if(!process.stdin.isTTY) filename = filename || "-";
81
+ if(filename.length===0) die("crc32: must specify a filename ('-' for stdin)",1);
82
+
83
+ var crc32 = seed;
84
+ // $FlowIgnore -- Writable is callable but type sig disagrees
85
+ var writable = require('stream').Writable();
86
+ writable._write = function(chunk, e, cb) { crc32 = X.buf(chunk, crc32); cb(); };
87
+ writable._writev = function(chunks, cb) {
88
+ chunks.forEach(function(c) { crc32 = X.buf(c.chunk, crc32);});
89
+ cb();
90
+ };
91
+ writable.on('finish', function() {
92
+ if(fmt === "") console.log(crc32);
93
+ else try { console.log(require("printj").sprintf(fmt, crc32)); } catch(e) {
94
+ switch(fmt) {
95
+ case "%d": console.log(crc32); break;
96
+ case "%u": console.log(crc32 >>> 0); break;
97
+ case "%0.8x": console.log((crc32 >>> 0).toString(16).padStart(8, "0").toLowerCase()); break;
98
+ case "%0.8X": console.log((crc32 >>> 0).toString(16).padStart(8, "0").toUpperCase()); break;
99
+ }
100
+ }
101
+ });
102
+
103
+ if(filename === "-") process.stdin.pipe(writable);
104
+ else if(fs.existsSync(filename)) fs.createReadStream(filename).pipe(writable);
105
+ else die("crc32: " + filename + ": No such file or directory", 2);
node_modules/.bin/cssesc ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env node
2
+ const fs = require('fs');
3
+ const cssesc = require('../cssesc.js');
4
+ const strings = process.argv.splice(2);
5
+ const stdin = process.stdin;
6
+ const options = {};
7
+ const log = console.log;
8
+
9
+ const main = function() {
10
+ const option = strings[0];
11
+
12
+ if (/^(?:-h|--help|undefined)$/.test(option)) {
13
+ log(
14
+ 'cssesc v%s - https://mths.be/cssesc',
15
+ cssesc.version
16
+ );
17
+ log([
18
+ '\nUsage:\n',
19
+ '\tcssesc [string]',
20
+ '\tcssesc [-i | --identifier] [string]',
21
+ '\tcssesc [-s | --single-quotes] [string]',
22
+ '\tcssesc [-d | --double-quotes] [string]',
23
+ '\tcssesc [-w | --wrap] [string]',
24
+ '\tcssesc [-e | --escape-everything] [string]',
25
+ '\tcssesc [-v | --version]',
26
+ '\tcssesc [-h | --help]',
27
+ '\nExamples:\n',
28
+ '\tcssesc \'f\xF6o \u2665 b\xE5r \uD834\uDF06 baz\'',
29
+ '\tcssesc --identifier \'f\xF6o \u2665 b\xE5r \uD834\uDF06 baz\'',
30
+ '\tcssesc --escape-everything \'f\xF6o \u2665 b\xE5r \uD834\uDF06 baz\'',
31
+ '\tcssesc --double-quotes --wrap \'f\xF6o \u2665 b\xE5r \uD834\uDF06 baz\'',
32
+ '\techo \'f\xF6o \u2665 b\xE5r \uD834\uDF06 baz\' | cssesc'
33
+ ].join('\n'));
34
+ return process.exit(1);
35
+ }
36
+
37
+ if (/^(?:-v|--version)$/.test(option)) {
38
+ log('v%s', cssesc.version);
39
+ return process.exit(1);
40
+ }
41
+
42
+ strings.forEach(function(string) {
43
+ // Process options
44
+ if (/^(?:-i|--identifier)$/.test(string)) {
45
+ options.isIdentifier = true;
46
+ return;
47
+ }
48
+ if (/^(?:-s|--single-quotes)$/.test(string)) {
49
+ options.quotes = 'single';
50
+ return;
51
+ }
52
+ if (/^(?:-d|--double-quotes)$/.test(string)) {
53
+ options.quotes = 'double';
54
+ return;
55
+ }
56
+ if (/^(?:-w|--wrap)$/.test(string)) {
57
+ options.wrap = true;
58
+ return;
59
+ }
60
+ if (/^(?:-e|--escape-everything)$/.test(string)) {
61
+ options.escapeEverything = true;
62
+ return;
63
+ }
64
+
65
+ // Process string(s)
66
+ let result;
67
+ try {
68
+ result = cssesc(string, options);
69
+ log(result);
70
+ } catch (exception) {
71
+ log(exception.message + '\n');
72
+ log('Error: failed to escape.');
73
+ log('If you think this is a bug in cssesc, please report it:');
74
+ log('https://github.com/mathiasbynens/cssesc/issues/new');
75
+ log(
76
+ '\nStack trace using cssesc@%s:\n',
77
+ cssesc.version
78
+ );
79
+ log(exception.stack);
80
+ return process.exit(1);
81
+ }
82
+ });
83
+ // Return with exit status 0 outside of the `forEach` loop, in case
84
+ // multiple strings were passed in.
85
+ return process.exit(0);
86
+
87
+ };
88
+
89
+ if (stdin.isTTY) {
90
+ // handle shell arguments
91
+ main();
92
+ } else {
93
+ let timeout;
94
+ // Either the script is called from within a non-TTY context, or `stdin`
95
+ // content is being piped in.
96
+ if (!process.stdout.isTTY) {
97
+ // The script was called from a non-TTY context. This is a rather uncommon
98
+ // use case we don’t actively support. However, we don’t want the script
99
+ // to wait forever in such cases, so…
100
+ timeout = setTimeout(function() {
101
+ // …if no piped data arrived after a whole minute, handle shell
102
+ // arguments instead.
103
+ main();
104
+ }, 60000);
105
+ }
106
+ let data = '';
107
+ stdin.on('data', function(chunk) {
108
+ clearTimeout(timeout);
109
+ data += chunk;
110
+ });
111
+ stdin.on('end', function() {
112
+ strings.push(data.trim());
113
+ main();
114
+ });
115
+ stdin.resume();
116
+ }
node_modules/.bin/ejs ADDED
@@ -0,0 +1,211 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env node
2
+ /*
3
+ * EJS Embedded JavaScript templates
4
+ * Copyright 2112 Matthew Eernisse (mde@fleegix.org)
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ *
18
+ */
19
+
20
+ let path = require('path');
21
+
22
+ let program = require('jake').program;
23
+ delete global.jake; // NO NOT WANT
24
+ program.setTaskNames = function (n) { this.taskNames = n; };
25
+
26
+ let ejs = require('../lib/ejs');
27
+ let { hyphenToCamel } = require('../lib/utils');
28
+ let fs = require('fs');
29
+ let args = process.argv.slice(2);
30
+ let usage = fs.readFileSync(`${__dirname}/../usage.txt`).toString();
31
+
32
+ const CLI_OPTS = [
33
+ { full: 'output-file',
34
+ abbr: 'o',
35
+ expectValue: true,
36
+ },
37
+ { full: 'data-file',
38
+ abbr: 'f',
39
+ expectValue: true,
40
+ },
41
+ { full: 'data-input',
42
+ abbr: 'i',
43
+ expectValue: true,
44
+ },
45
+ { full: 'delimiter',
46
+ abbr: 'm',
47
+ expectValue: true,
48
+ passThrough: true,
49
+ },
50
+ { full: 'open-delimiter',
51
+ abbr: 'p',
52
+ expectValue: true,
53
+ passThrough: true,
54
+ },
55
+ { full: 'close-delimiter',
56
+ abbr: 'c',
57
+ expectValue: true,
58
+ passThrough: true,
59
+ },
60
+ { full: 'strict',
61
+ abbr: 's',
62
+ expectValue: false,
63
+ allowValue: false,
64
+ passThrough: true,
65
+ },
66
+ { full: 'no-with',
67
+ abbr: 'n',
68
+ expectValue: false,
69
+ allowValue: false,
70
+ },
71
+ { full: 'locals-name',
72
+ abbr: 'l',
73
+ expectValue: true,
74
+ passThrough: true,
75
+ },
76
+ { full: 'rm-whitespace',
77
+ abbr: 'w',
78
+ expectValue: false,
79
+ allowValue: false,
80
+ passThrough: true,
81
+ },
82
+ { full: 'debug',
83
+ abbr: 'd',
84
+ expectValue: false,
85
+ allowValue: false,
86
+ passThrough: true,
87
+ },
88
+ { full: 'help',
89
+ abbr: 'h',
90
+ passThrough: true,
91
+ },
92
+ { full: 'version',
93
+ abbr: 'V',
94
+ passThrough: true,
95
+ },
96
+ // Alias lowercase v
97
+ { full: 'version',
98
+ abbr: 'v',
99
+ passThrough: true,
100
+ },
101
+ ];
102
+
103
+ let preempts = {
104
+ version: function () {
105
+ program.die(ejs.VERSION);
106
+ },
107
+ help: function () {
108
+ program.die(usage);
109
+ }
110
+ };
111
+
112
+ let stdin = '';
113
+ process.stdin.setEncoding('utf8');
114
+ process.stdin.on('readable', () => {
115
+ let chunk;
116
+ while ((chunk = process.stdin.read()) !== null) {
117
+ stdin += chunk;
118
+ }
119
+ });
120
+
121
+ function run() {
122
+
123
+ program.availableOpts = CLI_OPTS;
124
+ program.parseArgs(args);
125
+
126
+ let templatePath = program.taskNames[0];
127
+ let pVals = program.envVars;
128
+ let pOpts = {};
129
+
130
+ for (let p in program.opts) {
131
+ let name = hyphenToCamel(p);
132
+ pOpts[name] = program.opts[p];
133
+ }
134
+
135
+ let opts = {};
136
+ let vals = {};
137
+
138
+ // Same-named 'passthrough' opts
139
+ CLI_OPTS.forEach((opt) => {
140
+ let optName = hyphenToCamel(opt.full);
141
+ if (opt.passThrough && typeof pOpts[optName] != 'undefined') {
142
+ opts[optName] = pOpts[optName];
143
+ }
144
+ });
145
+
146
+ // Bail out for help/version
147
+ for (let p in opts) {
148
+ if (preempts[p]) {
149
+ return preempts[p]();
150
+ }
151
+ }
152
+
153
+ // Ensure there's a template to render
154
+ if (!templatePath) {
155
+ throw new Error('Please provide a template path. (Run ejs -h for help)');
156
+ }
157
+
158
+ if (opts.strict) {
159
+ pOpts.noWith = true;
160
+ }
161
+ if (pOpts.noWith) {
162
+ opts._with = false;
163
+ }
164
+
165
+ // Grab and parse any input data, in order of precedence:
166
+ // 1. Stdin
167
+ // 2. CLI arg via -i
168
+ // 3. Data file via -f
169
+ // Any individual vals passed at the end (e.g., foo=bar) will override
170
+ // any vals previously set
171
+ let input;
172
+ let err = new Error('Please do not pass data multiple ways. Pick one of stdin, -f, or -i.');
173
+ if (stdin) {
174
+ input = stdin;
175
+ }
176
+ else if (pOpts.dataInput) {
177
+ if (input) {
178
+ throw err;
179
+ }
180
+ input = decodeURIComponent(pOpts.dataInput);
181
+ }
182
+ else if (pOpts.dataFile) {
183
+ if (input) {
184
+ throw err;
185
+ }
186
+ input = fs.readFileSync(pOpts.dataFile).toString();
187
+ }
188
+
189
+ if (input) {
190
+ vals = JSON.parse(input);
191
+ }
192
+
193
+ // Override / set any individual values passed from the command line
194
+ for (let p in pVals) {
195
+ vals[p] = pVals[p];
196
+ }
197
+
198
+ opts.filename = path.resolve(process.cwd(), templatePath);
199
+ let template = fs.readFileSync(opts.filename).toString();
200
+ let output = ejs.render(template, vals, opts);
201
+ if (pOpts.outputFile) {
202
+ fs.writeFileSync(pOpts.outputFile, output);
203
+ }
204
+ else {
205
+ process.stdout.write(output);
206
+ }
207
+ process.exit();
208
+ }
209
+
210
+ // Defer execution so that stdin can be read if necessary
211
+ setImmediate(run);
node_modules/.bin/eslint ADDED
@@ -0,0 +1,211 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * @fileoverview Main CLI that is run via the eslint command.
5
+ * @author Nicholas C. Zakas
6
+ */
7
+
8
+ /* eslint no-console:off -- CLI */
9
+
10
+ "use strict";
11
+
12
+ const mod = require("node:module");
13
+
14
+ // to use V8's code cache to speed up instantiation time
15
+ mod.enableCompileCache?.();
16
+
17
+ // must do this initialization *before* other requires in order to work
18
+ if (process.argv.includes("--debug")) {
19
+ require("debug").enable("eslint:*,-eslint:code-path,eslintrc:*");
20
+ }
21
+
22
+ //------------------------------------------------------------------------------
23
+ // Helpers
24
+ //------------------------------------------------------------------------------
25
+
26
+ /**
27
+ * Read data from stdin til the end.
28
+ *
29
+ * Note: See
30
+ * - https://github.com/nodejs/node/blob/master/doc/api/process.md#processstdin
31
+ * - https://github.com/nodejs/node/blob/master/doc/api/process.md#a-note-on-process-io
32
+ * - https://lists.gnu.org/archive/html/bug-gnu-emacs/2016-01/msg00419.html
33
+ * - https://github.com/nodejs/node/issues/7439 (historical)
34
+ *
35
+ * On Windows using `fs.readFileSync(STDIN_FILE_DESCRIPTOR, "utf8")` seems
36
+ * to read 4096 bytes before blocking and never drains to read further data.
37
+ *
38
+ * The investigation on the Emacs thread indicates:
39
+ *
40
+ * > Emacs on MS-Windows uses pipes to communicate with subprocesses; a
41
+ * > pipe on Windows has a 4K buffer. So as soon as Emacs writes more than
42
+ * > 4096 bytes to the pipe, the pipe becomes full, and Emacs then waits for
43
+ * > the subprocess to read its end of the pipe, at which time Emacs will
44
+ * > write the rest of the stuff.
45
+ * @returns {Promise<string>} The read text.
46
+ */
47
+ function readStdin() {
48
+ return new Promise((resolve, reject) => {
49
+ let content = "";
50
+ let chunk = "";
51
+
52
+ process.stdin
53
+ .setEncoding("utf8")
54
+ .on("readable", () => {
55
+ while ((chunk = process.stdin.read()) !== null) {
56
+ content += chunk;
57
+ }
58
+ })
59
+ .on("end", () => resolve(content))
60
+ .on("error", reject);
61
+ });
62
+ }
63
+
64
+ /**
65
+ * Spawns an external command and propagates its exit status.
66
+ * @param {string} command The command to run.
67
+ * @param {string[]} args The command arguments.
68
+ * @throws {Error} If the command cannot be spawned.
69
+ * @returns {void}
70
+ */
71
+ function spawnExternalCommand(command, args) {
72
+ const spawn = require("cross-spawn");
73
+ const result = spawn.sync(command, args, {
74
+ encoding: "utf8",
75
+ stdio: "inherit",
76
+ });
77
+
78
+ if (result.error) {
79
+ throw result.error;
80
+ }
81
+
82
+ if (result.signal) {
83
+ process.kill(process.pid, result.signal);
84
+ return;
85
+ }
86
+
87
+ process.exitCode = result.status ?? 0;
88
+ }
89
+
90
+ /**
91
+ * Get the error message of a given value.
92
+ * @param {any} error The value to get.
93
+ * @returns {string} The error message.
94
+ */
95
+ function getErrorMessage(error) {
96
+ // Lazy loading because this is used only if an error happened.
97
+ const util = require("node:util");
98
+
99
+ // Foolproof -- third-party module might throw non-object.
100
+ if (typeof error !== "object" || error === null) {
101
+ return String(error);
102
+ }
103
+
104
+ // Use templates if `error.messageTemplate` is present.
105
+ if (typeof error.messageTemplate === "string") {
106
+ try {
107
+ const template = require(`../messages/${error.messageTemplate}.js`);
108
+
109
+ return template(error.messageData || {});
110
+ } catch {
111
+ // Ignore template error then fallback to use `error.stack`.
112
+ }
113
+ }
114
+
115
+ // Use the stacktrace if it's an error object.
116
+ if (typeof error.stack === "string") {
117
+ return error.stack;
118
+ }
119
+
120
+ // Otherwise, dump the object.
121
+ return util.format("%o", error);
122
+ }
123
+
124
+ /**
125
+ * Tracks error messages that are shown to the user so we only ever show the
126
+ * same message once.
127
+ * @type {Set<string>}
128
+ */
129
+ const displayedErrors = new Set();
130
+
131
+ /**
132
+ * Tracks whether an unexpected error was caught
133
+ * @type {boolean}
134
+ */
135
+ let hadFatalError = false;
136
+
137
+ /**
138
+ * Catch and report unexpected error.
139
+ * @param {any} error The thrown error object.
140
+ * @returns {void}
141
+ */
142
+ function onFatalError(error) {
143
+ process.exitCode = 2;
144
+ hadFatalError = true;
145
+
146
+ const { version } = require("../package.json");
147
+ const message = `
148
+ Oops! Something went wrong! :(
149
+
150
+ ESLint: ${version}
151
+
152
+ ${getErrorMessage(error)}`;
153
+
154
+ if (!displayedErrors.has(message)) {
155
+ console.error(message);
156
+ displayedErrors.add(message);
157
+ }
158
+ }
159
+
160
+ //------------------------------------------------------------------------------
161
+ // Execution
162
+ //------------------------------------------------------------------------------
163
+
164
+ (async function main() {
165
+ process.on("uncaughtException", onFatalError);
166
+ process.on("unhandledRejection", onFatalError);
167
+
168
+ // Call the config initializer if `--init` is present.
169
+ if (process.argv.includes("--init")) {
170
+ // `eslint --init` has been moved to `@eslint/create-config`
171
+ console.warn(
172
+ "You can also run this command directly using 'npm init @eslint/config@latest'.",
173
+ );
174
+
175
+ spawnExternalCommand("npm", ["init", "@eslint/config@latest"]);
176
+ return;
177
+ }
178
+
179
+ // start the MCP server if `--mcp` is present
180
+ if (process.argv.includes("--mcp")) {
181
+ console.warn(
182
+ "You can also run this command directly using 'npx @eslint/mcp@latest'.",
183
+ );
184
+
185
+ spawnExternalCommand("npx", ["@eslint/mcp@latest"]);
186
+ return;
187
+ }
188
+
189
+ // Otherwise, call the CLI.
190
+ const cli = require("../lib/cli");
191
+ const exitCode = await cli.execute(
192
+ process.argv,
193
+ process.argv.includes("--stdin") ? await readStdin() : void 0,
194
+ );
195
+
196
+ /*
197
+ * If an uncaught exception or unhandled rejection was detected in the meantime,
198
+ * keep the fatal exit code 2 that is already assigned to `process.exitCode`.
199
+ * Without this condition, exit code 2 (unsuccessful execution) could be overwritten with
200
+ * 1 (successful execution, lint problems found) or even 0 (successful execution, no lint problems found).
201
+ * This ensures that unexpected errors that seemingly don't affect the success
202
+ * of the execution will still cause a non-zero exit code, as it's a common
203
+ * practice and the default behavior of Node.js to exit with non-zero
204
+ * in case of an uncaught exception or unhandled rejection.
205
+ *
206
+ * Otherwise, assign the exit code returned from CLI.
207
+ */
208
+ if (!hadFatalError) {
209
+ process.exitCode = exitCode;
210
+ }
211
+ })().catch(onFatalError);
node_modules/.bin/eslint-config-prettier ADDED
@@ -0,0 +1,240 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env node
2
+
3
+ "use strict";
4
+
5
+ const validators = require("./validators");
6
+ const config = require("..");
7
+ const prettier = require("../prettier");
8
+
9
+ // Require locally installed eslint, for `npx eslint-config-prettier` support
10
+ // with no local eslint-config-prettier installation.
11
+ const localRequire = (request) =>
12
+ require(
13
+ require.resolve(request, {
14
+ paths: [process.cwd(), ...require.resolve.paths("eslint")],
15
+ })
16
+ );
17
+
18
+ let experimentalApi = {};
19
+ try {
20
+ experimentalApi = localRequire("eslint/use-at-your-own-risk");
21
+ } catch (_error) {}
22
+
23
+ const { ESLint, FlatESLint = experimentalApi.FlatESLint } =
24
+ localRequire("eslint");
25
+
26
+ const SPECIAL_RULES_URL =
27
+ "https://github.com/prettier/eslint-config-prettier#special-rules";
28
+
29
+ const PRETTIER_RULES_URL =
30
+ "https://github.com/prettier/eslint-config-prettier#arrow-body-style-and-prefer-arrow-callback";
31
+
32
+ if (module === require.main) {
33
+ const args = process.argv.slice(2);
34
+
35
+ if (args.length === 0) {
36
+ console.error(help());
37
+ process.exit(1);
38
+ }
39
+
40
+ const eslint = new ESLint();
41
+ const flatESLint = FlatESLint === undefined ? undefined : new FlatESLint();
42
+
43
+ Promise.all(
44
+ args.map((file) => {
45
+ switch (process.env.ESLINT_USE_FLAT_CONFIG) {
46
+ case "true": {
47
+ return flatESLint.calculateConfigForFile(file);
48
+ }
49
+ case "false": {
50
+ return eslint.calculateConfigForFile(file);
51
+ }
52
+ default: {
53
+ // This turns synchronous errors (such as `.calculateConfigForFile` not existing)
54
+ // and turns them into promise rejections.
55
+ return Promise.resolve()
56
+ .then(() => flatESLint.calculateConfigForFile(file))
57
+ .catch(() => eslint.calculateConfigForFile(file));
58
+ }
59
+ }
60
+ })
61
+ )
62
+ .then((configs) => {
63
+ const rules = configs.flatMap(
64
+ (
65
+ // Initializing config and rules for files that aren't included in the flat config,
66
+ // which is a very unlikely scenario, but should still be treated as a success
67
+ { rules = {} } = {},
68
+ index
69
+ ) => Object.entries(rules).map((entry) => [...entry, args[index]])
70
+ );
71
+ const result = processRules(rules);
72
+ if (result.stderr) {
73
+ console.error(result.stderr);
74
+ }
75
+ if (result.stdout) {
76
+ console.error(result.stdout);
77
+ }
78
+ process.exit(result.code);
79
+ })
80
+ .catch((error) => {
81
+ console.error(error.message);
82
+ process.exit(1);
83
+ });
84
+ }
85
+
86
+ function help() {
87
+ return `
88
+ Usage: npx eslint-config-prettier FILE...
89
+
90
+ Resolves an ESLint configuration for every given FILE and checks if they
91
+ contain rules that are unnecessary or conflict with Prettier. Example:
92
+
93
+ npx eslint-config-prettier index.js test/index.js other/file/to/check.js
94
+
95
+ Exit codes:
96
+
97
+ 0: No automatically detectable problems found.
98
+ 1: General error.
99
+ 2: Conflicting rules found.
100
+
101
+ For more information, see:
102
+ https://github.com/prettier/eslint-config-prettier#cli-helper-tool
103
+ `.trim();
104
+ }
105
+
106
+ function processRules(configRules) {
107
+ const regularRules = filterRules(config.rules, (_, value) => value === "off");
108
+ const optionsRules = filterRules(
109
+ config.rules,
110
+ (ruleName, value) => value === 0 && ruleName in validators
111
+ );
112
+ const specialRules = filterRules(
113
+ config.rules,
114
+ (ruleName, value) => value === 0 && !(ruleName in validators)
115
+ );
116
+
117
+ const enabledRules = configRules
118
+ .map(([ruleName, value, source]) => {
119
+ const arrayValue = Array.isArray(value) ? value : [value];
120
+ const [level, ...options] = arrayValue;
121
+ const isOff = level === "off" || level === 0;
122
+ return isOff ? null : { ruleName, options, source };
123
+ })
124
+ .filter(Boolean);
125
+
126
+ const flaggedRules = enabledRules.filter(
127
+ ({ ruleName }) => ruleName in config.rules
128
+ );
129
+
130
+ const regularFlaggedRuleNames = filterRuleNames(
131
+ flaggedRules,
132
+ ({ ruleName }) => ruleName in regularRules
133
+ );
134
+ const optionsFlaggedRuleNames = filterRuleNames(
135
+ flaggedRules,
136
+ ({ ruleName, ...rule }) =>
137
+ ruleName in optionsRules && !validators[ruleName](rule)
138
+ );
139
+ const specialFlaggedRuleNames = filterRuleNames(
140
+ flaggedRules,
141
+ ({ ruleName }) => ruleName in specialRules
142
+ );
143
+ const prettierFlaggedRuleNames = filterRuleNames(
144
+ enabledRules,
145
+ ({ ruleName, source }) =>
146
+ ruleName in prettier.rules &&
147
+ enabledRules.some(
148
+ (rule) =>
149
+ rule.ruleName === "prettier/prettier" && rule.source === source
150
+ )
151
+ );
152
+
153
+ const regularMessage = [
154
+ "The following rules are unnecessary or might conflict with Prettier:",
155
+ "",
156
+ printRuleNames(regularFlaggedRuleNames),
157
+ ].join("\n");
158
+
159
+ const optionsMessage = [
160
+ "The following rules are enabled with config that might conflict with Prettier. See:",
161
+ SPECIAL_RULES_URL,
162
+ "",
163
+ printRuleNames(optionsFlaggedRuleNames),
164
+ ].join("\n");
165
+
166
+ const specialMessage = [
167
+ "The following rules are enabled but cannot be automatically checked. See:",
168
+ SPECIAL_RULES_URL,
169
+ "",
170
+ printRuleNames(specialFlaggedRuleNames),
171
+ ].join("\n");
172
+
173
+ const prettierMessage = [
174
+ "The following rules can cause issues when using eslint-plugin-prettier at the same time.",
175
+ "Only enable them if you know what you are doing! See:",
176
+ PRETTIER_RULES_URL,
177
+ "",
178
+ printRuleNames(prettierFlaggedRuleNames),
179
+ ].join("\n");
180
+
181
+ if (
182
+ regularFlaggedRuleNames.length === 0 &&
183
+ optionsFlaggedRuleNames.length === 0
184
+ ) {
185
+ const message =
186
+ specialFlaggedRuleNames.length === 0 &&
187
+ prettierFlaggedRuleNames.length === 0
188
+ ? "No rules that are unnecessary or conflict with Prettier were found."
189
+ : [
190
+ specialFlaggedRuleNames.length === 0 ? null : specialMessage,
191
+ prettierFlaggedRuleNames.length === 0 ? null : prettierMessage,
192
+ "Other than that, no rules that are unnecessary or conflict with Prettier were found.",
193
+ ]
194
+ .filter(Boolean)
195
+ .join("\n\n");
196
+
197
+ return {
198
+ stdout: message,
199
+ code: 0,
200
+ };
201
+ }
202
+
203
+ const message = [
204
+ regularFlaggedRuleNames.length === 0 ? null : regularMessage,
205
+ optionsFlaggedRuleNames.length === 0 ? null : optionsMessage,
206
+ specialFlaggedRuleNames.length === 0 ? null : specialMessage,
207
+ prettierFlaggedRuleNames.length === 0 ? null : prettierMessage,
208
+ ]
209
+ .filter(Boolean)
210
+ .join("\n\n");
211
+
212
+ return {
213
+ stdout: message,
214
+ code: 2,
215
+ };
216
+ }
217
+
218
+ function filterRules(rules, fn) {
219
+ return Object.fromEntries(
220
+ Object.entries(rules)
221
+ .filter(([ruleName, value]) => fn(ruleName, value))
222
+ .map(([ruleName]) => [ruleName, true])
223
+ );
224
+ }
225
+
226
+ function filterRuleNames(rules, fn) {
227
+ return [
228
+ ...new Set(rules.filter((rule) => fn(rule)).map((rule) => rule.ruleName)),
229
+ ];
230
+ }
231
+
232
+ function printRuleNames(ruleNames) {
233
+ return ruleNames
234
+ .slice()
235
+ .sort()
236
+ .map((ruleName) => `- ${ruleName}`)
237
+ .join("\n");
238
+ }
239
+
240
+ exports.processRules = processRules;
node_modules/.bin/fxparser ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+ /*eslint-disable no-console*/
4
+ import fs from 'fs';
5
+ import { resolve } from 'path';
6
+ import {XMLParser, XMLValidator} from "../fxp.js";
7
+ import ReadToEnd from './read.js';
8
+ import cmdDetail from "./man.js"
9
+
10
+ console.warn("\x1b[33m%s\x1b[0m", "⚠️ Warning: The built-in CLI interface is now deprecated.");
11
+ console.warn("Please install the dedicated CLI package instead:");
12
+ console.warn(" npm install -g fxp-cli");
13
+
14
+ if (process.argv[2] === '--help' || process.argv[2] === '-h') {
15
+ console.log(cmdDetail);
16
+ } else if (process.argv[2] === '--version') {
17
+ const packageJsonPath = resolve(process.cwd(), 'package.json');
18
+ const version = JSON.parse(fs.readFileSync(packageJsonPath).toString()).version;
19
+ console.log(version);
20
+ } else {
21
+ const options = {
22
+ removeNSPrefix: true,
23
+ ignoreAttributes: false,
24
+ parseTagValue: true,
25
+ parseAttributeValue: true,
26
+ };
27
+ let fileName = '';
28
+ let outputFileName;
29
+ let validate = false;
30
+ let validateOnly = false;
31
+ for (let i = 2; i < process.argv.length; i++) {
32
+ if (process.argv[i] === '-ns') {
33
+ options.removeNSPrefix = false;
34
+ } else if (process.argv[i] === '-a') {
35
+ options.ignoreAttributes = true;
36
+ } else if (process.argv[i] === '-c') {
37
+ options.parseTagValue = false;
38
+ options.parseAttributeValue = false;
39
+ } else if (process.argv[i] === '-o') {
40
+ outputFileName = process.argv[++i];
41
+ } else if (process.argv[i] === '-v') {
42
+ validate = true;
43
+ } else if (process.argv[i] === '-V') {
44
+ validateOnly = true;
45
+ } else {
46
+ //filename
47
+ fileName = process.argv[i];
48
+ }
49
+ }
50
+
51
+ const callback = function(xmlData) {
52
+ let output = '';
53
+ if (validateOnly) {
54
+ output = XMLValidator.validate(xmlData);
55
+ process.exitCode = output === true ? 0 : 1;
56
+ } else {
57
+ const parser = new XMLParser(options);
58
+ output = JSON.stringify(parser.parse(xmlData,validate), null, 4);
59
+ }
60
+ if (outputFileName) {
61
+ writeToFile(outputFileName, output);
62
+ } else {
63
+ console.log(output);
64
+ }
65
+ };
66
+
67
+
68
+ try {
69
+
70
+ if (!fileName) {
71
+ ReadToEnd.readToEnd(process.stdin, function(err, data) {
72
+ if (err) {
73
+ throw err;
74
+ }
75
+ callback(data.toString());
76
+ });
77
+ } else {
78
+ fs.readFile(fileName, function(err, data) {
79
+ if (err) {
80
+ throw err;
81
+ }
82
+ callback(data.toString());
83
+ });
84
+ }
85
+ } catch (e) {
86
+ console.log('Seems an invalid file or stream.' + e);
87
+ }
88
+ }
89
+
90
+ function writeToFile(fileName, data) {
91
+ fs.writeFile(fileName, data, function(err) {
92
+ if (err) {
93
+ throw err;
94
+ }
95
+ console.log('JSON output has been written to ' + fileName);
96
+ });
97
+ }
node_modules/.bin/jake ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env node
2
+ /*
3
+ * Jake JavaScript build tool
4
+ * Copyright 2112 Matthew Eernisse (mde@fleegix.org)
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ *
18
+ */
19
+
20
+ // Try to load a local jake
21
+ try {
22
+ require(`${ process.cwd() }/node_modules/jake`);
23
+ }
24
+ // If that fails, likely running globally
25
+ catch(e) {
26
+ require('../lib/jake');
27
+ }
28
+
29
+ var args = process.argv.slice(2);
30
+
31
+ jake.run.apply(jake, args);
node_modules/.bin/jiti ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env node
2
+
3
+ const { resolve } = require("node:path");
4
+
5
+ const script = process.argv.splice(2, 1)[0];
6
+
7
+ if (!script) {
8
+
9
+ console.error("Usage: jiti <path> [...arguments]");
10
+ process.exit(1);
11
+ }
12
+
13
+ const pwd = process.cwd();
14
+ const jiti = require("..")(pwd);
15
+ const resolved = (process.argv[1] = jiti.resolve(resolve(pwd, script)));
16
+ jiti(resolved);
node_modules/.bin/js-yaml ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env node
2
+
3
+ 'use strict'
4
+
5
+ const fs = require('fs')
6
+ const argparse = require('argparse')
7
+ const yaml = require('..')
8
+
9
+ /// /////////////////////////////////////////////////////////////////////////////
10
+
11
+ const cli = new argparse.ArgumentParser({
12
+ prog: 'js-yaml',
13
+ add_help: true
14
+ })
15
+
16
+ cli.add_argument('-v', '--version', {
17
+ action: 'version',
18
+ version: require('../package.json').version
19
+ })
20
+
21
+ cli.add_argument('-c', '--compact', {
22
+ help: 'Display errors in compact mode',
23
+ action: 'store_true'
24
+ })
25
+
26
+ // deprecated (not needed after we removed output colors)
27
+ // option suppressed, but not completely removed for compatibility
28
+ cli.add_argument('-j', '--to-json', {
29
+ help: argparse.SUPPRESS,
30
+ dest: 'json',
31
+ action: 'store_true'
32
+ })
33
+
34
+ cli.add_argument('-t', '--trace', {
35
+ help: 'Show stack trace on error',
36
+ action: 'store_true'
37
+ })
38
+
39
+ cli.add_argument('file', {
40
+ help: 'File to read, utf-8 encoded without BOM',
41
+ nargs: '?',
42
+ default: '-'
43
+ })
44
+
45
+ /// /////////////////////////////////////////////////////////////////////////////
46
+
47
+ const options = cli.parse_args()
48
+
49
+ /// /////////////////////////////////////////////////////////////////////////////
50
+
51
+ function readFile (filename, encoding, callback) {
52
+ if (options.file === '-') {
53
+ // read from stdin
54
+
55
+ const chunks = []
56
+
57
+ process.stdin.on('data', function (chunk) {
58
+ chunks.push(chunk)
59
+ })
60
+
61
+ process.stdin.on('end', function () {
62
+ return callback(null, Buffer.concat(chunks).toString(encoding))
63
+ })
64
+ } else {
65
+ fs.readFile(filename, encoding, callback)
66
+ }
67
+ }
68
+
69
+ readFile(options.file, 'utf8', function (error, input) {
70
+ let output
71
+ let isYaml
72
+
73
+ if (error) {
74
+ if (error.code === 'ENOENT') {
75
+ console.error('File not found: ' + options.file)
76
+ process.exit(2)
77
+ }
78
+
79
+ console.error(
80
+ (options.trace && error.stack) ||
81
+ error.message ||
82
+ String(error))
83
+
84
+ process.exit(1)
85
+ }
86
+
87
+ try {
88
+ output = JSON.parse(input)
89
+ isYaml = false
90
+ } catch (err) {
91
+ if (err instanceof SyntaxError) {
92
+ try {
93
+ output = []
94
+ yaml.loadAll(input, function (doc) { output.push(doc) }, {})
95
+ isYaml = true
96
+
97
+ if (output.length === 0) output = null
98
+ else if (output.length === 1) output = output[0]
99
+ } catch (e) {
100
+ if (options.trace && err.stack) console.error(e.stack)
101
+ else console.error(e.toString(options.compact))
102
+
103
+ process.exit(1)
104
+ }
105
+ } else {
106
+ console.error(
107
+ (options.trace && err.stack) ||
108
+ err.message ||
109
+ String(err))
110
+
111
+ process.exit(1)
112
+ }
113
+ }
114
+
115
+ if (isYaml) console.log(JSON.stringify(output, null, ' '))
116
+ else console.log(yaml.dump(output))
117
+ })
node_modules/.bin/jsesc ADDED
@@ -0,0 +1,148 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env node
2
+ (function() {
3
+
4
+ var fs = require('fs');
5
+ var stringEscape = require('../jsesc.js');
6
+ var strings = process.argv.splice(2);
7
+ var stdin = process.stdin;
8
+ var data;
9
+ var timeout;
10
+ var isObject = false;
11
+ var options = {};
12
+ var log = console.log;
13
+
14
+ var main = function() {
15
+ var option = strings[0];
16
+
17
+ if (/^(?:-h|--help|undefined)$/.test(option)) {
18
+ log(
19
+ 'jsesc v%s - https://mths.be/jsesc',
20
+ stringEscape.version
21
+ );
22
+ log([
23
+ '\nUsage:\n',
24
+ '\tjsesc [string]',
25
+ '\tjsesc [-s | --single-quotes] [string]',
26
+ '\tjsesc [-d | --double-quotes] [string]',
27
+ '\tjsesc [-w | --wrap] [string]',
28
+ '\tjsesc [-e | --escape-everything] [string]',
29
+ '\tjsesc [-t | --escape-etago] [string]',
30
+ '\tjsesc [-6 | --es6] [string]',
31
+ '\tjsesc [-l | --lowercase-hex] [string]',
32
+ '\tjsesc [-j | --json] [string]',
33
+ '\tjsesc [-o | --object] [stringified_object]', // `JSON.parse()` the argument
34
+ '\tjsesc [-p | --pretty] [string]', // `compact: false`
35
+ '\tjsesc [-v | --version]',
36
+ '\tjsesc [-h | --help]',
37
+ '\nExamples:\n',
38
+ '\tjsesc \'f\xF6o \u2665 b\xE5r \uD834\uDF06 baz\'',
39
+ '\tjsesc --json \'f\xF6o \u2665 b\xE5r \uD834\uDF06 baz\'',
40
+ '\tjsesc --json --escape-everything \'f\xF6o \u2665 b\xE5r \uD834\uDF06 baz\'',
41
+ '\tjsesc --double-quotes --wrap \'f\xF6o \u2665 b\xE5r \uD834\uDF06 baz\'',
42
+ '\techo \'f\xF6o \u2665 b\xE5r \uD834\uDF06 baz\' | jsesc'
43
+ ].join('\n'));
44
+ return process.exit(1);
45
+ }
46
+
47
+ if (/^(?:-v|--version)$/.test(option)) {
48
+ log('v%s', stringEscape.version);
49
+ return process.exit(1);
50
+ }
51
+
52
+ strings.forEach(function(string) {
53
+ // Process options
54
+ if (/^(?:-s|--single-quotes)$/.test(string)) {
55
+ options.quotes = 'single';
56
+ return;
57
+ }
58
+ if (/^(?:-d|--double-quotes)$/.test(string)) {
59
+ options.quotes = 'double';
60
+ return;
61
+ }
62
+ if (/^(?:-w|--wrap)$/.test(string)) {
63
+ options.wrap = true;
64
+ return;
65
+ }
66
+ if (/^(?:-e|--escape-everything)$/.test(string)) {
67
+ options.escapeEverything = true;
68
+ return;
69
+ }
70
+ if (/^(?:-t|--escape-etago)$/.test(string)) {
71
+ options.escapeEtago = true;
72
+ return;
73
+ }
74
+ if (/^(?:-6|--es6)$/.test(string)) {
75
+ options.es6 = true;
76
+ return;
77
+ }
78
+ if (/^(?:-l|--lowercase-hex)$/.test(string)) {
79
+ options.lowercaseHex = true;
80
+ return;
81
+ }
82
+ if (/^(?:-j|--json)$/.test(string)) {
83
+ options.json = true;
84
+ return;
85
+ }
86
+ if (/^(?:-o|--object)$/.test(string)) {
87
+ isObject = true;
88
+ return;
89
+ }
90
+ if (/^(?:-p|--pretty)$/.test(string)) {
91
+ isObject = true;
92
+ options.compact = false;
93
+ return;
94
+ }
95
+
96
+ // Process string(s)
97
+ var result;
98
+ try {
99
+ if (isObject) {
100
+ string = JSON.parse(string);
101
+ }
102
+ result = stringEscape(string, options);
103
+ log(result);
104
+ } catch(error) {
105
+ log(error.message + '\n');
106
+ log('Error: failed to escape.');
107
+ log('If you think this is a bug in jsesc, please report it:');
108
+ log('https://github.com/mathiasbynens/jsesc/issues/new');
109
+ log(
110
+ '\nStack trace using jsesc@%s:\n',
111
+ stringEscape.version
112
+ );
113
+ log(error.stack);
114
+ return process.exit(1);
115
+ }
116
+ });
117
+ // Return with exit status 0 outside of the `forEach` loop, in case
118
+ // multiple strings were passed in.
119
+ return process.exit(0);
120
+
121
+ };
122
+
123
+ if (stdin.isTTY) {
124
+ // handle shell arguments
125
+ main();
126
+ } else {
127
+ // Either the script is called from within a non-TTY context,
128
+ // or `stdin` content is being piped in.
129
+ if (!process.stdout.isTTY) { // called from a non-TTY context
130
+ timeout = setTimeout(function() {
131
+ // if no piped data arrived after a while, handle shell arguments
132
+ main();
133
+ }, 250);
134
+ }
135
+
136
+ data = '';
137
+ stdin.on('data', function(chunk) {
138
+ clearTimeout(timeout);
139
+ data += chunk;
140
+ });
141
+ stdin.on('end', function() {
142
+ strings.push(data.trim());
143
+ main();
144
+ });
145
+ stdin.resume();
146
+ }
147
+
148
+ }());
node_modules/.bin/json5 ADDED
@@ -0,0 +1,152 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env node
2
+
3
+ const fs = require('fs')
4
+ const path = require('path')
5
+ const pkg = require('../package.json')
6
+ const JSON5 = require('./')
7
+
8
+ const argv = parseArgs()
9
+
10
+ if (argv.version) {
11
+ version()
12
+ } else if (argv.help) {
13
+ usage()
14
+ } else {
15
+ const inFilename = argv.defaults[0]
16
+
17
+ let readStream
18
+ if (inFilename) {
19
+ readStream = fs.createReadStream(inFilename)
20
+ } else {
21
+ readStream = process.stdin
22
+ }
23
+
24
+ let json5 = ''
25
+ readStream.on('data', data => {
26
+ json5 += data
27
+ })
28
+
29
+ readStream.on('end', () => {
30
+ let space
31
+ if (argv.space === 't' || argv.space === 'tab') {
32
+ space = '\t'
33
+ } else {
34
+ space = Number(argv.space)
35
+ }
36
+
37
+ let value
38
+ try {
39
+ value = JSON5.parse(json5)
40
+ if (!argv.validate) {
41
+ const json = JSON.stringify(value, null, space)
42
+
43
+ let writeStream
44
+
45
+ // --convert is for backward compatibility with v0.5.1. If
46
+ // specified with <file> and not --out-file, then a file with
47
+ // the same name but with a .json extension will be written.
48
+ if (argv.convert && inFilename && !argv.outFile) {
49
+ const parsedFilename = path.parse(inFilename)
50
+ const outFilename = path.format(
51
+ Object.assign(
52
+ parsedFilename,
53
+ {base: path.basename(parsedFilename.base, parsedFilename.ext) + '.json'}
54
+ )
55
+ )
56
+
57
+ writeStream = fs.createWriteStream(outFilename)
58
+ } else if (argv.outFile) {
59
+ writeStream = fs.createWriteStream(argv.outFile)
60
+ } else {
61
+ writeStream = process.stdout
62
+ }
63
+
64
+ writeStream.write(json)
65
+ }
66
+ } catch (err) {
67
+ console.error(err.message)
68
+ process.exit(1)
69
+ }
70
+ })
71
+ }
72
+
73
+ function parseArgs () {
74
+ let convert
75
+ let space
76
+ let validate
77
+ let outFile
78
+ let version
79
+ let help
80
+ const defaults = []
81
+
82
+ const args = process.argv.slice(2)
83
+ for (let i = 0; i < args.length; i++) {
84
+ const arg = args[i]
85
+ switch (arg) {
86
+ case '--convert':
87
+ case '-c':
88
+ convert = true
89
+ break
90
+
91
+ case '--space':
92
+ case '-s':
93
+ space = args[++i]
94
+ break
95
+
96
+ case '--validate':
97
+ case '-v':
98
+ validate = true
99
+ break
100
+
101
+ case '--out-file':
102
+ case '-o':
103
+ outFile = args[++i]
104
+ break
105
+
106
+ case '--version':
107
+ case '-V':
108
+ version = true
109
+ break
110
+
111
+ case '--help':
112
+ case '-h':
113
+ help = true
114
+ break
115
+
116
+ default:
117
+ defaults.push(arg)
118
+ break
119
+ }
120
+ }
121
+
122
+ return {
123
+ convert,
124
+ space,
125
+ validate,
126
+ outFile,
127
+ version,
128
+ help,
129
+ defaults,
130
+ }
131
+ }
132
+
133
+ function version () {
134
+ console.log(pkg.version)
135
+ }
136
+
137
+ function usage () {
138
+ console.log(
139
+ `
140
+ Usage: json5 [options] <file>
141
+
142
+ If <file> is not provided, then STDIN is used.
143
+
144
+ Options:
145
+
146
+ -s, --space The number of spaces to indent or 't' for tabs
147
+ -o, --out-file [file] Output to the specified file, otherwise STDOUT
148
+ -v, --validate Validate JSON5 but do not output JSON
149
+ -V, --version Output the version number
150
+ -h, --help Output usage information`
151
+ )
152
+ }
node_modules/.bin/loose-envify ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+
4
+ var looseEnvify = require('./');
5
+ var fs = require('fs');
6
+
7
+ if (process.argv[2]) {
8
+ fs.createReadStream(process.argv[2], {encoding: 'utf8'})
9
+ .pipe(looseEnvify(process.argv[2]))
10
+ .pipe(process.stdout);
11
+ } else {
12
+ process.stdin.resume()
13
+ process.stdin
14
+ .pipe(looseEnvify(__filename))
15
+ .pipe(process.stdout);
16
+ }
node_modules/.bin/lz-string ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #! /usr/bin/env node
2
+ var lzString = require('../libs/lz-string.js');
3
+ var fs = require('fs');
4
+
5
+ if (process.argv.length < 3) {
6
+ console.error('Usage: lz-string <input_file>');
7
+ process.exit(1);
8
+ }
9
+
10
+ console.log(lzString.compress(fs.readFileSync(process.argv[2], {
11
+ encoding: 'utf8',
12
+ })));
13
+
node_modules/.bin/marked ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Marked CLI
5
+ * Copyright (c) 2018+, MarkedJS. (MIT License)
6
+ * Copyright (c) 2011-2018, Christopher Jeffrey. (MIT License)
7
+ */
8
+
9
+ import { main } from './main.js';
10
+
11
+ /**
12
+ * Expose / Entry Point
13
+ */
14
+
15
+ process.title = 'marked';
16
+ main(process);
node_modules/.bin/mime ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env node
2
+
3
+ 'use strict';
4
+
5
+ process.title = 'mime';
6
+ let mime = require('.');
7
+ let pkg = require('./package.json');
8
+ let args = process.argv.splice(2);
9
+
10
+ if (args.includes('--version') || args.includes('-v') || args.includes('--v')) {
11
+ console.log(pkg.version);
12
+ process.exit(0);
13
+ } else if (args.includes('--name') || args.includes('-n') || args.includes('--n')) {
14
+ console.log(pkg.name);
15
+ process.exit(0);
16
+ } else if (args.includes('--help') || args.includes('-h') || args.includes('--h')) {
17
+ console.log(pkg.name + ' - ' + pkg.description + '\n');
18
+ console.log(`Usage:
19
+
20
+ mime [flags] [path_or_extension]
21
+
22
+ Flags:
23
+ --help, -h Show this message
24
+ --version, -v Display the version
25
+ --name, -n Print the name of the program
26
+
27
+ Note: the command will exit after it executes if a command is specified
28
+ The path_or_extension is the path to the file or the extension of the file.
29
+
30
+ Examples:
31
+ mime --help
32
+ mime --version
33
+ mime --name
34
+ mime -v
35
+ mime src/log.js
36
+ mime new.py
37
+ mime foo.sh
38
+ `);
39
+ process.exit(0);
40
+ }
41
+
42
+ let file = args[0];
43
+ let type = mime.getType(file);
44
+
45
+ process.stdout.write(type + '\n');
46
+
node_modules/.bin/msw ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env node
2
+ import yargs from 'yargs'
3
+ import { init } from './init.js'
4
+
5
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
6
+ yargs(process.argv.slice(2))
7
+ .usage('$0 <cmd> [args]')
8
+ .command(
9
+ 'init',
10
+ 'Initializes Mock Service Worker at the specified directory',
11
+ (yargs) => {
12
+ yargs
13
+ .positional('publicDir', {
14
+ type: 'string',
15
+ description: 'Relative path to the public directory',
16
+ demandOption: false,
17
+ normalize: true,
18
+ })
19
+ .option('save', {
20
+ type: 'boolean',
21
+ description: 'Save the worker directory in your package.json',
22
+ })
23
+ .option('cwd', {
24
+ type: 'string',
25
+ description: 'Custom current worker directory',
26
+ normalize: true,
27
+ })
28
+ .example('msw init')
29
+ .example('msw init ./public')
30
+ .example('msw init ./static --save')
31
+ },
32
+ init,
33
+ )
34
+ .demandCommand()
35
+ .help().argv
node_modules/.bin/nanoid ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env node
2
+
3
+ let { nanoid, customAlphabet } = require('..')
4
+
5
+ function print(msg) {
6
+ process.stdout.write(msg + '\n')
7
+ }
8
+
9
+ function error(msg) {
10
+ process.stderr.write(msg + '\n')
11
+ process.exit(1)
12
+ }
13
+
14
+ if (process.argv.includes('--help') || process.argv.includes('-h')) {
15
+ print(`
16
+ Usage
17
+ $ nanoid [options]
18
+
19
+ Options
20
+ -s, --size Generated ID size
21
+ -a, --alphabet Alphabet to use
22
+ -h, --help Show this help
23
+
24
+ Examples
25
+ $ nanoid --s 15
26
+ S9sBF77U6sDB8Yg
27
+
28
+ $ nanoid --size 10 --alphabet abc
29
+ bcabababca`)
30
+ process.exit()
31
+ }
32
+
33
+ let alphabet, size
34
+ for (let i = 2; i < process.argv.length; i++) {
35
+ let arg = process.argv[i]
36
+ if (arg === '--size' || arg === '-s') {
37
+ size = Number(process.argv[i + 1])
38
+ i += 1
39
+ if (Number.isNaN(size) || size <= 0) {
40
+ error('Size must be positive integer')
41
+ }
42
+ } else if (arg === '--alphabet' || arg === '-a') {
43
+ alphabet = process.argv[i + 1]
44
+ i += 1
45
+ } else {
46
+ error('Unknown argument ' + arg)
47
+ }
48
+ }
49
+
50
+ if (alphabet) {
51
+ let customNanoid = customAlphabet(alphabet, size)
52
+ print(customNanoid())
53
+ } else {
54
+ print(nanoid(size))
55
+ }
node_modules/.bin/node-which ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env node
2
+ var which = require("../")
3
+ if (process.argv.length < 3)
4
+ usage()
5
+
6
+ function usage () {
7
+ console.error('usage: which [-as] program ...')
8
+ process.exit(1)
9
+ }
10
+
11
+ var all = false
12
+ var silent = false
13
+ var dashdash = false
14
+ var args = process.argv.slice(2).filter(function (arg) {
15
+ if (dashdash || !/^-/.test(arg))
16
+ return true
17
+
18
+ if (arg === '--') {
19
+ dashdash = true
20
+ return false
21
+ }
22
+
23
+ var flags = arg.substr(1).split('')
24
+ for (var f = 0; f < flags.length; f++) {
25
+ var flag = flags[f]
26
+ switch (flag) {
27
+ case 's':
28
+ silent = true
29
+ break
30
+ case 'a':
31
+ all = true
32
+ break
33
+ default:
34
+ console.error('which: illegal option -- ' + flag)
35
+ usage()
36
+ }
37
+ }
38
+ return false
39
+ })
40
+
41
+ process.exit(args.reduce(function (pv, current) {
42
+ try {
43
+ var f = which.sync(current, { all: all })
44
+ if (all)
45
+ f = f.join('\n')
46
+ if (!silent)
47
+ console.log(f)
48
+ return pv;
49
+ } catch (e) {
50
+ return 1;
51
+ }
52
+ }, 0))
node_modules/.bin/nodemon ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env node
2
+
3
+ const cli = require('../lib/cli');
4
+ const nodemon = require('../lib/');
5
+ const options = cli.parse(process.argv);
6
+
7
+ nodemon(options);
8
+
9
+ const fs = require('fs');
10
+
11
+ // checks for available update and returns an instance
12
+ const pkg = JSON.parse(fs.readFileSync(__dirname + '/../package.json'));
13
+
14
+ if (pkg.version.indexOf('0.0.0') !== 0 && options.noUpdateNotifier !== true) {
15
+ require('simple-update-notifier')({ pkg });
16
+ }
node_modules/.bin/nodetouch ADDED
@@ -0,0 +1,112 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env node
2
+ const touch = require("../index.js")
3
+
4
+ const usage = code => {
5
+ console[code ? 'error' : 'log'](
6
+ 'usage:\n' +
7
+ 'touch [-acfm] [-r file] [-t [[CC]YY]MMDDhhmm[.SS]] file ...'
8
+ )
9
+ process.exit(code)
10
+ }
11
+
12
+ const singleFlags = {
13
+ a: 'atime',
14
+ m: 'mtime',
15
+ c: 'nocreate',
16
+ f: 'force'
17
+ }
18
+
19
+ const singleOpts = {
20
+ r: 'ref',
21
+ t: 'time'
22
+ }
23
+
24
+ const files = []
25
+ const args = process.argv.slice(2)
26
+ const options = {}
27
+ for (let i = 0; i < args.length; i++) {
28
+ const arg = args[i]
29
+ if (!arg.match(/^-/)) {
30
+ files.push(arg)
31
+ continue
32
+ }
33
+
34
+ // expand shorthands
35
+ if (arg.charAt(1) !== '-') {
36
+ const expand = []
37
+ for (let f = 1; f < arg.length; f++) {
38
+ const fc = arg.charAt(f)
39
+ const sf = singleFlags[fc]
40
+ const so = singleOpts[fc]
41
+ if (sf)
42
+ expand.push('--' + sf)
43
+ else if (so) {
44
+ const soslice = arg.slice(f + 1)
45
+ const soval = soslice.charAt(0) === '=' ? soslice : '=' + soslice
46
+ expand.push('--' + so + soval)
47
+ f = arg.length
48
+ } else if (arg !== '-' + fc)
49
+ expand.push('-' + fc)
50
+ }
51
+ if (expand.length) {
52
+ args.splice.apply(args, [i, 1].concat(expand))
53
+ i--
54
+ continue
55
+ }
56
+ }
57
+
58
+ const argsplit = arg.split('=')
59
+ const key = argsplit.shift().replace(/^\-\-/, '')
60
+ const val = argsplit.length ? argsplit.join('=') : null
61
+
62
+ switch (key) {
63
+ case 'time':
64
+ const timestr = val || args[++i]
65
+ // [-t [[CC]YY]MMDDhhmm[.SS]]
66
+ const parsedtime = timestr.match(
67
+ /^(([0-9]{2})?([0-9]{2}))?([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})(\.([0-9]{2}))?$/
68
+ )
69
+ if (!parsedtime) {
70
+ console.error('touch: out of range or illegal ' +
71
+ 'time specification: ' +
72
+ '[[CC]YY]MMDDhhmm[.SS]')
73
+ process.exit(1)
74
+ } else {
75
+ const y = +parsedtime[1]
76
+ const year = parsedtime[2] ? y
77
+ : y <= 68 ? 2000 + y
78
+ : 1900 + y
79
+
80
+ const MM = +parsedtime[4] - 1
81
+ const dd = +parsedtime[5]
82
+ const hh = +parsedtime[6]
83
+ const mm = +parsedtime[7]
84
+ const ss = +parsedtime[8]
85
+
86
+ options.time = new Date(Date.UTC(year, MM, dd, hh, mm, ss))
87
+ }
88
+ continue
89
+
90
+ case 'ref':
91
+ options.ref = val || args[++i]
92
+ continue
93
+
94
+ case 'mtime':
95
+ case 'nocreate':
96
+ case 'atime':
97
+ case 'force':
98
+ options[key] = true
99
+ continue
100
+
101
+ default:
102
+ console.error('touch: illegal option -- ' + arg)
103
+ usage(1)
104
+ }
105
+ }
106
+
107
+ if (!files.length)
108
+ usage()
109
+
110
+ process.exitCode = 0
111
+ Promise.all(files.map(f => touch(f, options)))
112
+ .catch(er => process.exitCode = 1)
node_modules/.bin/parser ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env node
2
+ /* eslint-disable no-var, unicorn/prefer-node-protocol */
3
+
4
+ var parser = require("..");
5
+ var fs = require("fs");
6
+
7
+ var filename = process.argv[2];
8
+ if (!filename) {
9
+ console.error("no filename specified");
10
+ } else {
11
+ var file = fs.readFileSync(filename, "utf8");
12
+ var ast = parser.parse(file);
13
+
14
+ console.log(JSON.stringify(ast, null, " "));
15
+ }
node_modules/.bin/pbf ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env node
2
+
3
+ import resolve from 'resolve-protobuf-schema';
4
+ import {compileRaw} from '../compile.js';
5
+
6
+ if (process.argv.length < 3) {
7
+ console.error('Usage: pbf [file.proto] [--no-read] [--no-write] [--legacy]');
8
+ process.exit(0);
9
+ }
10
+
11
+ const code = compileRaw(resolve.sync(process.argv[2]), {
12
+ noRead: process.argv.indexOf('--no-read') >= 0,
13
+ noWrite: process.argv.indexOf('--no-write') >= 0,
14
+ legacy: process.argv.indexOf('--legacy') >= 0
15
+ });
16
+
17
+ process.stdout.write(code);
node_modules/.bin/pixelmatch ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env node
2
+ /* eslint-disable no-process-exit */
3
+
4
+ 'use strict';
5
+
6
+ const PNG = require('pngjs').PNG;
7
+ const fs = require('fs');
8
+ const match = require('../.');
9
+
10
+ if (process.argv.length < 4) {
11
+ console.log('Usage: pixelmatch image1.png image2.png [diff.png] [threshold] [includeAA]');
12
+ process.exit(64);
13
+ }
14
+
15
+ const [,, img1Path, img2Path, diffPath, threshold, includeAA] = process.argv;
16
+ const options = {};
17
+ if (threshold !== undefined) options.threshold = +threshold;
18
+ if (includeAA !== undefined) options.includeAA = includeAA !== 'false';
19
+
20
+ const img1 = PNG.sync.read(fs.readFileSync(img1Path));
21
+ const img2 = PNG.sync.read(fs.readFileSync(img2Path));
22
+
23
+ const {width, height} = img1;
24
+
25
+ if (img2.width !== width || img2.height !== height) {
26
+ console.log(`Image dimensions do not match: ${width}x${height} vs ${img2.width}x${img2.height}`);
27
+ process.exit(65);
28
+ }
29
+
30
+ const diff = diffPath ? new PNG({width, height}) : null;
31
+
32
+ console.time('matched in');
33
+ const diffs = match(img1.data, img2.data, diff ? diff.data : null, width, height, options);
34
+ console.timeEnd('matched in');
35
+
36
+ console.log(`different pixels: ${diffs}`);
37
+ console.log(`error: ${Math.round(100 * 100 * diffs / (width * height)) / 100}%`);
38
+
39
+ if (diff) {
40
+ fs.writeFileSync(diffPath, PNG.sync.write(diff));
41
+ }
42
+ process.exit(diffs ? 66 : 0);
node_modules/.bin/playwright ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Copyright (c) Microsoft Corporation.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ const { program } = require('playwright/lib/program');
19
+ program.parse(process.argv);
node_modules/.bin/playwright-core ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Copyright (c) Microsoft Corporation.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ const { libCli, libCliTestStub } = require('./lib/coreBundle');
18
+ const { program } = require('./lib/utilsBundle');
19
+ libCli.decorateProgram(program);
20
+ libCliTestStub.decorateProgram(program);
21
+ program.parse(process.argv);
node_modules/.bin/prebuild-install ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env node
2
+
3
+ const path = require('path')
4
+ const fs = require('fs')
5
+ const napi = require('napi-build-utils')
6
+
7
+ const pkg = require(path.resolve('package.json'))
8
+ const rc = require('./rc')(pkg)
9
+ const log = require('./log')(rc, process.env)
10
+ const download = require('./download')
11
+ const asset = require('./asset')
12
+ const util = require('./util')
13
+
14
+ const prebuildClientVersion = require('./package.json').version
15
+ if (rc.version) {
16
+ console.log(prebuildClientVersion)
17
+ process.exit(0)
18
+ }
19
+
20
+ if (rc.path) process.chdir(rc.path)
21
+
22
+ if (rc.runtime === 'electron' && rc.target[0] === '4' && rc.abi === '64') {
23
+ log.error(`Electron version ${rc.target} found - skipping prebuild-install work due to known ABI issue`)
24
+ log.error('More information about this issue can be found at https://github.com/lgeiger/node-abi/issues/54')
25
+ process.exit(1)
26
+ }
27
+
28
+ if (!fs.existsSync('package.json')) {
29
+ log.error('setup', 'No package.json found. Aborting...')
30
+ process.exit(1)
31
+ }
32
+
33
+ if (rc.help) {
34
+ console.error(fs.readFileSync(path.join(__dirname, 'help.txt'), 'utf-8'))
35
+ process.exit(0)
36
+ }
37
+
38
+ log.info('begin', 'Prebuild-install version', prebuildClientVersion)
39
+
40
+ const opts = Object.assign({}, rc, { pkg: pkg, log: log })
41
+
42
+ if (napi.isNapiRuntime(rc.runtime)) napi.logUnsupportedVersion(rc.target, log)
43
+
44
+ const origin = util.packageOrigin(process.env, pkg)
45
+
46
+ if (opts.force) {
47
+ log.warn('install', 'prebuilt binaries enforced with --force!')
48
+ log.warn('install', 'prebuilt binaries may be out of date!')
49
+ } else if (origin && origin.length > 4 && origin.substr(0, 4) === 'git+') {
50
+ log.info('install', 'installing from git repository, skipping download.')
51
+ process.exit(1)
52
+ } else if (opts.buildFromSource) {
53
+ log.info('install', '--build-from-source specified, not attempting download.')
54
+ process.exit(1)
55
+ }
56
+
57
+ const startDownload = function (downloadUrl) {
58
+ download(downloadUrl, opts, function (err) {
59
+ if (err) {
60
+ log.warn('install', err.message)
61
+ return process.exit(1)
62
+ }
63
+ log.info('install', 'Successfully installed prebuilt binary!')
64
+ })
65
+ }
66
+
67
+ if (opts.token) {
68
+ asset(opts, function (err, assetId) {
69
+ if (err) {
70
+ log.warn('install', err.message)
71
+ return process.exit(1)
72
+ }
73
+
74
+ startDownload(util.getAssetUrl(opts, assetId))
75
+ })
76
+ } else {
77
+ startDownload(util.getDownloadUrl(opts))
78
+ }
node_modules/.bin/prettier ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __commonJS = function(cb, mod) {
5
+ return function __require() {
6
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
7
+ };
8
+ };
9
+
10
+ // node_modules/semver-compare/index.js
11
+ var require_semver_compare = __commonJS({
12
+ "node_modules/semver-compare/index.js": function(exports2, module2) {
13
+ module2.exports = function cmp(a, b) {
14
+ var pa = a.split(".");
15
+ var pb = b.split(".");
16
+ for (var i = 0; i < 3; i++) {
17
+ var na = Number(pa[i]);
18
+ var nb = Number(pb[i]);
19
+ if (na > nb) return 1;
20
+ if (nb > na) return -1;
21
+ if (!isNaN(na) && isNaN(nb)) return 1;
22
+ if (isNaN(na) && !isNaN(nb)) return -1;
23
+ }
24
+ return 0;
25
+ };
26
+ }
27
+ });
28
+
29
+ // node_modules/please-upgrade-node/index.js
30
+ var require_please_upgrade_node = __commonJS({
31
+ "node_modules/please-upgrade-node/index.js": function(exports2, module2) {
32
+ var semverCompare = require_semver_compare();
33
+ module2.exports = function pleaseUpgradeNode2(pkg, opts) {
34
+ var opts = opts || {};
35
+ var requiredVersion = pkg.engines.node.replace(">=", "");
36
+ var currentVersion = process.version.replace("v", "");
37
+ if (semverCompare(currentVersion, requiredVersion) === -1) {
38
+ if (opts.message) {
39
+ console.error(opts.message(requiredVersion));
40
+ } else {
41
+ console.error(
42
+ pkg.name + " requires at least version " + requiredVersion + " of Node, please upgrade"
43
+ );
44
+ }
45
+ if (opts.hasOwnProperty("exitCode")) {
46
+ process.exit(opts.exitCode);
47
+ } else {
48
+ process.exit(1);
49
+ }
50
+ }
51
+ };
52
+ }
53
+ });
54
+
55
+ // bin/prettier.cjs
56
+ var nodeModule = require("module");
57
+ if (typeof nodeModule.enableCompileCache === "function") {
58
+ nodeModule.enableCompileCache();
59
+ }
60
+ var pleaseUpgradeNode = require_please_upgrade_node();
61
+ var packageJson = require("../package.json");
62
+ pleaseUpgradeNode(packageJson);
63
+ var dynamicImport = new Function("module", "return import(module)");
64
+ var promise;
65
+ var index = process.argv.indexOf("--experimental-cli");
66
+ if (process.env.PRETTIER_EXPERIMENTAL_CLI || index !== -1) {
67
+ if (index !== -1) {
68
+ process.argv.splice(index, 1);
69
+ }
70
+ promise = dynamicImport("../internal/experimental-cli.mjs").then(
71
+ function(cli) {
72
+ return cli.__promise;
73
+ }
74
+ );
75
+ } else {
76
+ promise = dynamicImport("../internal/legacy-cli.mjs").then(function runCli(cli) {
77
+ return cli.run();
78
+ });
79
+ }
80
+ module.exports.__promise = promise;
node_modules/.bin/qrcode ADDED
@@ -0,0 +1,159 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env node
2
+ var yargs = require('yargs')
3
+ var qr = require('../lib')
4
+
5
+ function save (file, text, options) {
6
+ qr.toFile(file, text, options, function (err, data) {
7
+ if (err) {
8
+ console.error('Error:', err.message)
9
+ process.exit(1)
10
+ }
11
+
12
+ console.log('saved qrcode to: ' + file + '\n')
13
+ })
14
+ }
15
+
16
+ function print (text, options) {
17
+ options.type = 'terminal'
18
+ qr.toString(text, options, function (err, text) {
19
+ if (err) {
20
+ console.error('Error:', err.message)
21
+ process.exit(1)
22
+ }
23
+
24
+ console.log(text)
25
+ })
26
+ }
27
+
28
+ function parseOptions (args) {
29
+ return {
30
+ version: args.qversion,
31
+ errorCorrectionLevel: args.error,
32
+ type: args.type,
33
+ small: !!args.small,
34
+ inverse: !!args.inverse,
35
+ maskPattern: args.mask,
36
+ margin: args.qzone,
37
+ width: args.width,
38
+ scale: args.scale,
39
+ color: {
40
+ light: args.lightcolor,
41
+ dark: args.darkcolor
42
+ }
43
+ }
44
+ }
45
+
46
+ function processInputs (text, opts) {
47
+ if (!text.length) {
48
+ yargs.showHelp()
49
+ process.exit(1)
50
+ }
51
+
52
+ if (opts.output) {
53
+ save(opts.output, text, parseOptions(opts))
54
+ } else {
55
+ print(text, parseOptions(opts))
56
+ }
57
+ }
58
+
59
+ var argv = yargs
60
+ .detectLocale(false)
61
+ .usage('Usage: $0 [options] <input string>')
62
+ .option('v', {
63
+ alias: 'qversion',
64
+ description: 'QR Code symbol version (1 - 40)',
65
+ group: 'QR Code options:',
66
+ type: 'number'
67
+ })
68
+ .option('e', {
69
+ alias: 'error',
70
+ description: 'Error correction level',
71
+ choices: ['L', 'M', 'Q', 'H'],
72
+ group: 'QR Code options:'
73
+ })
74
+ .option('m', {
75
+ alias: 'mask',
76
+ description: 'Mask pattern (0 - 7)',
77
+ group: 'QR Code options:',
78
+ type: 'number'
79
+ })
80
+ .option('t', {
81
+ alias: 'type',
82
+ description: 'Output type',
83
+ choices: ['png', 'svg', 'utf8'],
84
+ implies: 'output',
85
+ group: 'Renderer options:'
86
+ })
87
+ .option('i', {
88
+ alias: 'inverse',
89
+ type: 'boolean',
90
+ description: 'Invert colors',
91
+ group: 'Renderer options:'
92
+ })
93
+ .option('w', {
94
+ alias: 'width',
95
+ description: 'Image width (px)',
96
+ conflicts: 'scale',
97
+ group: 'Renderer options:',
98
+ type: 'number'
99
+ })
100
+ .option('s', {
101
+ alias: 'scale',
102
+ description: 'Scale factor',
103
+ conflicts: 'width',
104
+ group: 'Renderer options:',
105
+ type: 'number'
106
+ })
107
+ .option('q', {
108
+ alias: 'qzone',
109
+ description: 'Quiet zone size',
110
+ group: 'Renderer options:',
111
+ type: 'number'
112
+ })
113
+ .option('l', {
114
+ alias: 'lightcolor',
115
+ description: 'Light RGBA hex color',
116
+ group: 'Renderer options:'
117
+ })
118
+ .option('d', {
119
+ alias: 'darkcolor',
120
+ description: 'Dark RGBA hex color',
121
+ group: 'Renderer options:'
122
+ })
123
+ .option('small', {
124
+ type: 'boolean',
125
+ description: 'Output smaller QR code to terminal',
126
+ conflicts: 'type',
127
+ group: 'Renderer options:'
128
+ })
129
+ .option('o', {
130
+ alias: 'output',
131
+ description: 'Output file'
132
+ })
133
+ .help('h')
134
+ .alias('h', 'help')
135
+ .version()
136
+ .example('$0 "some text"', 'Draw in terminal window')
137
+ .example('$0 -o out.png "some text"', 'Save as png image')
138
+ .example('$0 -d F00 -o out.png "some text"', 'Use red as foreground color')
139
+ .parserConfiguration({'parse-numbers': false})
140
+ .argv
141
+
142
+ if (process.stdin.isTTY) {
143
+ processInputs(argv._.join(' '), argv)
144
+ } else {
145
+ var text = ''
146
+ process.stdin.setEncoding('utf8')
147
+ process.stdin.on('readable', function () {
148
+ var chunk = process.stdin.read()
149
+ if (chunk !== null) {
150
+ text += chunk
151
+ }
152
+ })
153
+
154
+ process.stdin.on('end', function () {
155
+ // this process can be run as a command outside of a tty so if there was no
156
+ // data on stdin read from argv
157
+ processInputs(text.length?text:argv._.join(' '), argv)
158
+ })
159
+ }
node_modules/.bin/rc ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ #! /usr/bin/env node
2
+ var rc = require('./index')
3
+
4
+ console.log(JSON.stringify(rc(process.argv[2]), false, 2))
node_modules/.bin/regjsparser ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env node
2
+ (function() {
3
+
4
+ var fs = require('fs');
5
+ var path = require('path');
6
+ var parse = require('../parser').parse;
7
+ var jsesc = require('jsesc');
8
+ var regexes = process.argv.splice(2);
9
+ var first = regexes[0];
10
+ var data;
11
+ var log = console.log;
12
+ var flags = '';
13
+ var main = function() {
14
+ if (/^(?:-h|--help|undefined)$/.test(first)) {
15
+ log([
16
+ '\nUsage:\n',
17
+ '\tregjsparser [regex ...]',
18
+ '\tregjsparser [-f | --flags] u [regex ...]',
19
+ '\tregjsparser [-v | --version]',
20
+ '\tregjsparser [-h | --help]',
21
+ '\nExamples:\n',
22
+ '\tregjsparser \'^foo.bar$\'',
23
+ '\tregjsparser \'[a-zA-Z0-9]\''
24
+ ].join('\n'));
25
+ return process.exit(1);
26
+ }
27
+
28
+ if (/^(?:-v|--version)$/.test(first)) {
29
+ log('v%s', require(path.resolve(__dirname, '../package.json')).version);
30
+ return process.exit(1);
31
+ }
32
+
33
+ if (/^(?:-f|--flags)$/.test(first)) {
34
+ flags = regexes[1];
35
+ regexes = regexes.slice(2);
36
+ }
37
+
38
+ regexes.forEach(function(snippet) {
39
+ try {
40
+ result = parse(snippet, flags);
41
+ log(jsesc(result, {
42
+ 'json': true,
43
+ 'compact': false,
44
+ 'indent': '\t'
45
+ }));
46
+ } catch(error) {
47
+ log(error.message + '\n');
48
+ log('Error: failed to parse. Make sure the regular expression is valid.');
49
+ log('If you think this is a bug in regjsparser, please report it:');
50
+ log('\thttps://github.com/jviereck/regjsparser/issues/new');
51
+ log('\nStack trace:\n');
52
+ log(error.stack);
53
+ return process.exit(1);
54
+ }
55
+ });
56
+ // Return with exit status 0 outside of the `forEach` loop, in case
57
+ // multiple regular expressions were passed in.
58
+ return process.exit(0);
59
+ };
60
+
61
+ main();
62
+
63
+ }());
node_modules/.bin/resolve ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env node
2
+
3
+ 'use strict';
4
+
5
+ var path = require('path');
6
+ var fs = require('fs');
7
+
8
+ if (
9
+ String(process.env.npm_lifecycle_script).slice(0, 8) !== 'resolve '
10
+ && (
11
+ !process.argv
12
+ || process.argv.length < 2
13
+ || (process.argv[1] !== __filename && fs.statSync(process.argv[1]).ino !== fs.statSync(__filename).ino)
14
+ || (process.env.npm_lifecycle_event !== 'npx' && process.env._ && fs.realpathSync(path.resolve(process.env._)) !== __filename)
15
+ )
16
+ ) {
17
+ console.error('Error: `resolve` must be run directly as an executable');
18
+ process.exit(1);
19
+ }
20
+
21
+ var supportsPreserveSymlinkFlag = require('supports-preserve-symlinks-flag');
22
+
23
+ var preserveSymlinks = false;
24
+ for (var i = 2; i < process.argv.length; i += 1) {
25
+ if (process.argv[i].slice(0, 2) === '--') {
26
+ if (supportsPreserveSymlinkFlag && process.argv[i] === '--preserve-symlinks') {
27
+ preserveSymlinks = true;
28
+ } else if (process.argv[i].length > 2) {
29
+ console.error('Unknown argument ' + process.argv[i].replace(/[=].*$/, ''));
30
+ process.exit(2);
31
+ }
32
+ process.argv.splice(i, 1);
33
+ i -= 1;
34
+ if (process.argv[i] === '--') { break; } // eslint-disable-line no-restricted-syntax
35
+ }
36
+ }
37
+
38
+ if (process.argv.length < 3) {
39
+ console.error('Error: `resolve` expects a specifier');
40
+ process.exit(2);
41
+ }
42
+
43
+ var resolve = require('../');
44
+
45
+ var result = resolve.sync(process.argv[2], {
46
+ basedir: process.cwd(),
47
+ preserveSymlinks: preserveSymlinks
48
+ });
49
+
50
+ console.log(result);
node_modules/.bin/rolldown ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ #!/usr/bin/env node
2
+ import '../dist/cli.mjs';
node_modules/.bin/rollup ADDED
@@ -0,0 +1,1912 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env node
2
+ /*
3
+ @license
4
+ Rollup.js v4.62.0
5
+ Sat, 13 Jun 2026 08:30:18 GMT - commit 5e0066d92defee0097f10fb814e63f60b2a7b612
6
+
7
+ https://github.com/rollup/rollup
8
+
9
+ Released under the MIT License.
10
+ */
11
+ 'use strict';
12
+
13
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
14
+
15
+ const process$1 = require('node:process');
16
+ const rollup = require('../shared/rollup.js');
17
+ const require$$2 = require('util');
18
+ const require$$0 = require('path');
19
+ const require$$0$1 = require('fs');
20
+ const parseAst_js = require('../shared/parseAst.js');
21
+ const fseventsImporter = require('../shared/fsevents-importer.js');
22
+ const promises = require('node:fs/promises');
23
+ const path = require('node:path');
24
+ const loadConfigFile_js = require('../shared/loadConfigFile.js');
25
+ require('../native.js');
26
+ require('node:perf_hooks');
27
+ require('node:url');
28
+ require('../getLogFilter.js');
29
+
30
+ const help = "rollup version 4.62.0\n=====================================\n\nUsage: rollup [options] <entry file>\n\nOptions:\n\n-c, --config <filename> Use this config file (if argument is used but value\n is unspecified, Rollup will try to load configuration files in\n the following order:\n rollup.config.mjs -> rollup.config.cjs -> rollup.config.js)\n-d, --dir <dirname> Directory for chunks (if absent, prints to stdout)\n-e, --external <ids> Comma-separate list of module IDs to exclude\n-f, --format <format> Type of output (amd, cjs, es, iife, umd, system)\n-g, --globals <pairs> Comma-separate list of `moduleID:Global` pairs\n-h, --help Show this help message\n-i, --input <filename> Input (alternative to <entry file>)\n-m, --sourcemap Generate sourcemap (`-m inline` for inline map)\n-n, --name <name> Name for UMD export\n-o, --file <output> Single output file (if absent, prints to stdout)\n-p, --plugin <plugin> Use the plugin specified (may be repeated)\n-v, --version Show version number\n-w, --watch Watch files in bundle and rebuild on changes\n--amd.autoId Generate the AMD ID based off the chunk name\n--amd.basePath <prefix> Path to prepend to auto generated AMD ID\n--amd.define <name> Function to use in place of `define`\n--amd.forceJsExtensionForImports Use `.js` extension in AMD imports\n--amd.id <id> ID for AMD module (default is anonymous)\n--assetFileNames <pattern> Name pattern for emitted assets\n--banner <text> Code to insert at top of bundle (outside wrapper)\n--chunkFileNames <pattern> Name pattern for emitted secondary chunks\n--compact Minify wrapper code\n--context <variable> Specify top-level `this` value\n--no-dynamicImportInCjs Write external dynamic CommonJS imports as require\n--entryFileNames <pattern> Name pattern for emitted entry chunks\n--environment <values> Settings passed to config file (see example)\n--no-esModule Do not add __esModule property\n--exports <mode> Specify export mode (auto, default, named, none)\n--extend Extend global variable defined by --name\n--no-externalImportAttributes Omit import attributes in \"es\" output\n--no-externalLiveBindings Do not generate code to support live bindings\n--failAfterWarnings Exit with an error if the build produced warnings\n--filterLogs <filter> Filter log messages\n--footer <text> Code to insert at end of bundle (outside wrapper)\n--forceExit Force exit the process when done\n--no-freeze Do not freeze namespace objects\n--generatedCode <preset> Which code features to use (es5/es2015)\n--generatedCode.arrowFunctions Use arrow functions in generated code\n--generatedCode.constBindings Use \"const\" in generated code\n--generatedCode.objectShorthand Use shorthand properties in generated code\n--no-generatedCode.reservedNamesAsProps Always quote reserved names as props\n--generatedCode.symbols Use symbols in generated code\n--hashCharacters <name> Use the specified character set for file hashes\n--no-hoistTransitiveImports Do not hoist transitive imports into entry chunks\n--importAttributesKey <name> Use the specified keyword for import attributes\n--no-indent Don't indent result\n--inlineDynamicImports Create single bundle when using dynamic imports\n--no-interop Do not include interop block\n--intro <text> Code to insert at top of bundle (inside wrapper)\n--logLevel <level> Which kind of logs to display\n--no-makeAbsoluteExternalsRelative Prevent normalization of external imports\n--maxParallelFileOps <value> How many files to read in parallel\n--minifyInternalExports Force or disable minification of internal exports\n--noConflict Generate a noConflict method for UMD globals\n--outro <text> Code to insert at end of bundle (inside wrapper)\n--perf Display performance timings\n--no-preserveEntrySignatures Avoid facade chunks for entry points\n--preserveModules Preserve module structure\n--preserveModulesRoot Put preserved modules under this path at root level\n--preserveSymlinks Do not follow symlinks when resolving files\n--no-reexportProtoFromExternal Ignore `__proto__` in star re-exports\n--no-sanitizeFileName Do not replace invalid characters in file names\n--shimMissingExports Create shim variables for missing exports\n--silent Don't print warnings\n--sourcemapBaseUrl <url> Emit absolute sourcemap URLs with given base\n--sourcemapDebugIds Emit unique debug ids in source and sourcemaps\n--sourcemapExcludeSources Do not include source code in source maps\n--sourcemapFile <file> Specify bundle position for source maps\n--sourcemapFileNames <pattern> Name pattern for emitted sourcemaps\n--stdin=ext Specify file extension used for stdin input\n--no-stdin Do not read \"-\" from stdin\n--no-strict Don't emit `\"use strict\";` in the generated modules\n--strictDeprecations Throw errors for deprecated features\n--no-systemNullSetters Do not replace empty SystemJS setters with `null`\n--no-treeshake Disable tree-shaking optimisations\n--no-treeshake.annotations Ignore pure call annotations\n--treeshake.correctVarValueBeforeDeclaration Deoptimize variables until declared\n--treeshake.manualPureFunctions <names> Manually declare functions as pure\n--no-treeshake.moduleSideEffects Assume modules have no side effects\n--no-treeshake.propertyReadSideEffects Ignore property access side effects\n--no-treeshake.tryCatchDeoptimization Do not turn off try-catch-tree-shaking\n--no-treeshake.unknownGlobalSideEffects Assume unknown globals do not throw\n--validate Validate output\n--waitForBundleInput Wait for bundle input files\n--watch.allowInputInsideOutputPath Whether the input path is allowed to be a\n subpath of the output path\n--watch.buildDelay <number> Throttle watch rebuilds\n--no-watch.clearScreen Do not clear the screen when rebuilding\n--watch.exclude <files> Exclude files from being watched\n--watch.include <files> Limit watching to specified files\n--watch.onBundleEnd <cmd> Shell command to run on `\"BUNDLE_END\"` event\n--watch.onBundleStart <cmd> Shell command to run on `\"BUNDLE_START\"` event\n--watch.onEnd <cmd> Shell command to run on `\"END\"` event\n--watch.onError <cmd> Shell command to run on `\"ERROR\"` event\n--watch.onStart <cmd> Shell command to run on `\"START\"` event\n--watch.skipWrite Do not write files to disk when watching\n\nExamples:\n\n# use settings in config file\nrollup -c\n\n# in config file, process.env.INCLUDE_DEPS === 'true'\n# and process.env.BUILD === 'production'\nrollup -c --environment INCLUDE_DEPS,BUILD:production\n\n# create CommonJS bundle.js from src/main.js\nrollup --format=cjs --file=bundle.js -- src/main.js\n\n# create self-executing IIFE using `window.jQuery`\n# and `window._` as external globals\nrollup -f iife --globals jquery:jQuery,lodash:_ \\\n -i src/app.js -o build/app.js -m build/app.js.map\n\nNotes:\n\n* When piping to stdout, only inline sourcemaps are permitted\n\nFor more information visit https://rollupjs.org\n";
31
+
32
+ /**
33
+ * @license
34
+ * Copyright (c) 2016, Contributors
35
+ * SPDX-License-Identifier: ISC
36
+ */
37
+ function camelCase(str) {
38
+ // Handle the case where an argument is provided as camel case, e.g., fooBar.
39
+ // by ensuring that the string isn't already mixed case:
40
+ const isCamelCase = str !== str.toLowerCase() && str !== str.toUpperCase();
41
+ if (!isCamelCase) {
42
+ str = str.toLowerCase();
43
+ }
44
+ if (str.indexOf('-') === -1 && str.indexOf('_') === -1) {
45
+ return str;
46
+ }
47
+ else {
48
+ let camelcase = '';
49
+ let nextChrUpper = false;
50
+ const leadingHyphens = str.match(/^-+/);
51
+ for (let i = leadingHyphens ? leadingHyphens[0].length : 0; i < str.length; i++) {
52
+ let chr = str.charAt(i);
53
+ if (nextChrUpper) {
54
+ nextChrUpper = false;
55
+ chr = chr.toUpperCase();
56
+ }
57
+ if (i !== 0 && (chr === '-' || chr === '_')) {
58
+ nextChrUpper = true;
59
+ }
60
+ else if (chr !== '-' && chr !== '_') {
61
+ camelcase += chr;
62
+ }
63
+ }
64
+ return camelcase;
65
+ }
66
+ }
67
+ function decamelize(str, joinString) {
68
+ const lowercase = str.toLowerCase();
69
+ joinString = joinString || '-';
70
+ let notCamelcase = '';
71
+ for (let i = 0; i < str.length; i++) {
72
+ const chrLower = lowercase.charAt(i);
73
+ const chrString = str.charAt(i);
74
+ if (chrLower !== chrString && i > 0) {
75
+ notCamelcase += `${joinString}${lowercase.charAt(i)}`;
76
+ }
77
+ else {
78
+ notCamelcase += chrString;
79
+ }
80
+ }
81
+ return notCamelcase;
82
+ }
83
+ function looksLikeNumber(x) {
84
+ if (x === null || x === undefined)
85
+ return false;
86
+ // if loaded from config, may already be a number.
87
+ if (typeof x === 'number')
88
+ return true;
89
+ // hexadecimal.
90
+ if (/^0x[0-9a-f]+$/i.test(x))
91
+ return true;
92
+ // don't treat 0123 as a number; as it drops the leading '0'.
93
+ if (/^0[^.]/.test(x))
94
+ return false;
95
+ return /^[-]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(x);
96
+ }
97
+
98
+ /**
99
+ * @license
100
+ * Copyright (c) 2016, Contributors
101
+ * SPDX-License-Identifier: ISC
102
+ */
103
+ // take an un-split argv string and tokenize it.
104
+ function tokenizeArgString(argString) {
105
+ if (Array.isArray(argString)) {
106
+ return argString.map(e => typeof e !== 'string' ? e + '' : e);
107
+ }
108
+ argString = argString.trim();
109
+ let i = 0;
110
+ let prevC = null;
111
+ let c = null;
112
+ let opening = null;
113
+ const args = [];
114
+ for (let ii = 0; ii < argString.length; ii++) {
115
+ prevC = c;
116
+ c = argString.charAt(ii);
117
+ // split on spaces unless we're in quotes.
118
+ if (c === ' ' && !opening) {
119
+ if (!(prevC === ' ')) {
120
+ i++;
121
+ }
122
+ continue;
123
+ }
124
+ // don't split the string if we're in matching
125
+ // opening or closing single and double quotes.
126
+ if (c === opening) {
127
+ opening = null;
128
+ }
129
+ else if ((c === "'" || c === '"') && !opening) {
130
+ opening = c;
131
+ }
132
+ if (!args[i])
133
+ args[i] = '';
134
+ args[i] += c;
135
+ }
136
+ return args;
137
+ }
138
+
139
+ /**
140
+ * @license
141
+ * Copyright (c) 2016, Contributors
142
+ * SPDX-License-Identifier: ISC
143
+ */
144
+ var DefaultValuesForTypeKey;
145
+ (function (DefaultValuesForTypeKey) {
146
+ DefaultValuesForTypeKey["BOOLEAN"] = "boolean";
147
+ DefaultValuesForTypeKey["STRING"] = "string";
148
+ DefaultValuesForTypeKey["NUMBER"] = "number";
149
+ DefaultValuesForTypeKey["ARRAY"] = "array";
150
+ })(DefaultValuesForTypeKey || (DefaultValuesForTypeKey = {}));
151
+
152
+ /**
153
+ * @license
154
+ * Copyright (c) 2016, Contributors
155
+ * SPDX-License-Identifier: ISC
156
+ */
157
+ let mixin;
158
+ class YargsParser {
159
+ constructor(_mixin) {
160
+ mixin = _mixin;
161
+ }
162
+ parse(argsInput, options) {
163
+ const opts = Object.assign({
164
+ alias: undefined,
165
+ array: undefined,
166
+ boolean: undefined,
167
+ config: undefined,
168
+ configObjects: undefined,
169
+ configuration: undefined,
170
+ coerce: undefined,
171
+ count: undefined,
172
+ default: undefined,
173
+ envPrefix: undefined,
174
+ narg: undefined,
175
+ normalize: undefined,
176
+ string: undefined,
177
+ number: undefined,
178
+ __: undefined,
179
+ key: undefined
180
+ }, options);
181
+ // allow a string argument to be passed in rather
182
+ // than an argv array.
183
+ const args = tokenizeArgString(argsInput);
184
+ // tokenizeArgString adds extra quotes to args if argsInput is a string
185
+ // only strip those extra quotes in processValue if argsInput is a string
186
+ const inputIsString = typeof argsInput === 'string';
187
+ // aliases might have transitive relationships, normalize this.
188
+ const aliases = combineAliases(Object.assign(Object.create(null), opts.alias));
189
+ const configuration = Object.assign({
190
+ 'boolean-negation': true,
191
+ 'camel-case-expansion': true,
192
+ 'combine-arrays': false,
193
+ 'dot-notation': true,
194
+ 'duplicate-arguments-array': true,
195
+ 'flatten-duplicate-arrays': true,
196
+ 'greedy-arrays': true,
197
+ 'halt-at-non-option': false,
198
+ 'nargs-eats-options': false,
199
+ 'negation-prefix': 'no-',
200
+ 'parse-numbers': true,
201
+ 'parse-positional-numbers': true,
202
+ 'populate--': false,
203
+ 'set-placeholder-key': false,
204
+ 'short-option-groups': true,
205
+ 'strip-aliased': false,
206
+ 'strip-dashed': false,
207
+ 'unknown-options-as-args': false
208
+ }, opts.configuration);
209
+ const defaults = Object.assign(Object.create(null), opts.default);
210
+ const configObjects = opts.configObjects || [];
211
+ const envPrefix = opts.envPrefix;
212
+ const notFlagsOption = configuration['populate--'];
213
+ const notFlagsArgv = notFlagsOption ? '--' : '_';
214
+ const newAliases = Object.create(null);
215
+ const defaulted = Object.create(null);
216
+ // allow a i18n handler to be passed in, default to a fake one (util.format).
217
+ const __ = opts.__ || mixin.format;
218
+ const flags = {
219
+ aliases: Object.create(null),
220
+ arrays: Object.create(null),
221
+ bools: Object.create(null),
222
+ strings: Object.create(null),
223
+ numbers: Object.create(null),
224
+ counts: Object.create(null),
225
+ normalize: Object.create(null),
226
+ configs: Object.create(null),
227
+ nargs: Object.create(null),
228
+ coercions: Object.create(null),
229
+ keys: []
230
+ };
231
+ const negative = /^-([0-9]+(\.[0-9]+)?|\.[0-9]+)$/;
232
+ const negatedBoolean = new RegExp('^--' + configuration['negation-prefix'] + '(.+)');
233
+ [].concat(opts.array || []).filter(Boolean).forEach(function (opt) {
234
+ const key = typeof opt === 'object' ? opt.key : opt;
235
+ // assign to flags[bools|strings|numbers]
236
+ const assignment = Object.keys(opt).map(function (key) {
237
+ const arrayFlagKeys = {
238
+ boolean: 'bools',
239
+ string: 'strings',
240
+ number: 'numbers'
241
+ };
242
+ return arrayFlagKeys[key];
243
+ }).filter(Boolean).pop();
244
+ // assign key to be coerced
245
+ if (assignment) {
246
+ flags[assignment][key] = true;
247
+ }
248
+ flags.arrays[key] = true;
249
+ flags.keys.push(key);
250
+ });
251
+ [].concat(opts.boolean || []).filter(Boolean).forEach(function (key) {
252
+ flags.bools[key] = true;
253
+ flags.keys.push(key);
254
+ });
255
+ [].concat(opts.string || []).filter(Boolean).forEach(function (key) {
256
+ flags.strings[key] = true;
257
+ flags.keys.push(key);
258
+ });
259
+ [].concat(opts.number || []).filter(Boolean).forEach(function (key) {
260
+ flags.numbers[key] = true;
261
+ flags.keys.push(key);
262
+ });
263
+ [].concat(opts.count || []).filter(Boolean).forEach(function (key) {
264
+ flags.counts[key] = true;
265
+ flags.keys.push(key);
266
+ });
267
+ [].concat(opts.normalize || []).filter(Boolean).forEach(function (key) {
268
+ flags.normalize[key] = true;
269
+ flags.keys.push(key);
270
+ });
271
+ if (typeof opts.narg === 'object') {
272
+ Object.entries(opts.narg).forEach(([key, value]) => {
273
+ if (typeof value === 'number') {
274
+ flags.nargs[key] = value;
275
+ flags.keys.push(key);
276
+ }
277
+ });
278
+ }
279
+ if (typeof opts.coerce === 'object') {
280
+ Object.entries(opts.coerce).forEach(([key, value]) => {
281
+ if (typeof value === 'function') {
282
+ flags.coercions[key] = value;
283
+ flags.keys.push(key);
284
+ }
285
+ });
286
+ }
287
+ if (typeof opts.config !== 'undefined') {
288
+ if (Array.isArray(opts.config) || typeof opts.config === 'string') {
289
+ [].concat(opts.config).filter(Boolean).forEach(function (key) {
290
+ flags.configs[key] = true;
291
+ });
292
+ }
293
+ else if (typeof opts.config === 'object') {
294
+ Object.entries(opts.config).forEach(([key, value]) => {
295
+ if (typeof value === 'boolean' || typeof value === 'function') {
296
+ flags.configs[key] = value;
297
+ }
298
+ });
299
+ }
300
+ }
301
+ // create a lookup table that takes into account all
302
+ // combinations of aliases: {f: ['foo'], foo: ['f']}
303
+ extendAliases(opts.key, aliases, opts.default, flags.arrays);
304
+ // apply default values to all aliases.
305
+ Object.keys(defaults).forEach(function (key) {
306
+ (flags.aliases[key] || []).forEach(function (alias) {
307
+ defaults[alias] = defaults[key];
308
+ });
309
+ });
310
+ let error = null;
311
+ checkConfiguration();
312
+ let notFlags = [];
313
+ const argv = Object.assign(Object.create(null), { _: [] });
314
+ // TODO(bcoe): for the first pass at removing object prototype we didn't
315
+ // remove all prototypes from objects returned by this API, we might want
316
+ // to gradually move towards doing so.
317
+ const argvReturn = {};
318
+ for (let i = 0; i < args.length; i++) {
319
+ const arg = args[i];
320
+ const truncatedArg = arg.replace(/^-{3,}/, '---');
321
+ let broken;
322
+ let key;
323
+ let letters;
324
+ let m;
325
+ let next;
326
+ let value;
327
+ // any unknown option (except for end-of-options, "--")
328
+ if (arg !== '--' && /^-/.test(arg) && isUnknownOptionAsArg(arg)) {
329
+ pushPositional(arg);
330
+ // ---, ---=, ----, etc,
331
+ }
332
+ else if (truncatedArg.match(/^---+(=|$)/)) {
333
+ // options without key name are invalid.
334
+ pushPositional(arg);
335
+ continue;
336
+ // -- separated by =
337
+ }
338
+ else if (arg.match(/^--.+=/) || (!configuration['short-option-groups'] && arg.match(/^-.+=/))) {
339
+ // Using [\s\S] instead of . because js doesn't support the
340
+ // 'dotall' regex modifier. See:
341
+ // http://stackoverflow.com/a/1068308/13216
342
+ m = arg.match(/^--?([^=]+)=([\s\S]*)$/);
343
+ // arrays format = '--f=a b c'
344
+ if (m !== null && Array.isArray(m) && m.length >= 3) {
345
+ if (checkAllAliases(m[1], flags.arrays)) {
346
+ i = eatArray(i, m[1], args, m[2]);
347
+ }
348
+ else if (checkAllAliases(m[1], flags.nargs) !== false) {
349
+ // nargs format = '--f=monkey washing cat'
350
+ i = eatNargs(i, m[1], args, m[2]);
351
+ }
352
+ else {
353
+ setArg(m[1], m[2], true);
354
+ }
355
+ }
356
+ }
357
+ else if (arg.match(negatedBoolean) && configuration['boolean-negation']) {
358
+ m = arg.match(negatedBoolean);
359
+ if (m !== null && Array.isArray(m) && m.length >= 2) {
360
+ key = m[1];
361
+ setArg(key, checkAllAliases(key, flags.arrays) ? [false] : false);
362
+ }
363
+ // -- separated by space.
364
+ }
365
+ else if (arg.match(/^--.+/) || (!configuration['short-option-groups'] && arg.match(/^-[^-]+/))) {
366
+ m = arg.match(/^--?(.+)/);
367
+ if (m !== null && Array.isArray(m) && m.length >= 2) {
368
+ key = m[1];
369
+ if (checkAllAliases(key, flags.arrays)) {
370
+ // array format = '--foo a b c'
371
+ i = eatArray(i, key, args);
372
+ }
373
+ else if (checkAllAliases(key, flags.nargs) !== false) {
374
+ // nargs format = '--foo a b c'
375
+ // should be truthy even if: flags.nargs[key] === 0
376
+ i = eatNargs(i, key, args);
377
+ }
378
+ else {
379
+ next = args[i + 1];
380
+ if (next !== undefined && (!next.match(/^-/) ||
381
+ next.match(negative)) &&
382
+ !checkAllAliases(key, flags.bools) &&
383
+ !checkAllAliases(key, flags.counts)) {
384
+ setArg(key, next);
385
+ i++;
386
+ }
387
+ else if (/^(true|false)$/.test(next)) {
388
+ setArg(key, next);
389
+ i++;
390
+ }
391
+ else {
392
+ setArg(key, defaultValue(key));
393
+ }
394
+ }
395
+ }
396
+ // dot-notation flag separated by '='.
397
+ }
398
+ else if (arg.match(/^-.\..+=/)) {
399
+ m = arg.match(/^-([^=]+)=([\s\S]*)$/);
400
+ if (m !== null && Array.isArray(m) && m.length >= 3) {
401
+ setArg(m[1], m[2]);
402
+ }
403
+ // dot-notation flag separated by space.
404
+ }
405
+ else if (arg.match(/^-.\..+/) && !arg.match(negative)) {
406
+ next = args[i + 1];
407
+ m = arg.match(/^-(.\..+)/);
408
+ if (m !== null && Array.isArray(m) && m.length >= 2) {
409
+ key = m[1];
410
+ if (next !== undefined && !next.match(/^-/) &&
411
+ !checkAllAliases(key, flags.bools) &&
412
+ !checkAllAliases(key, flags.counts)) {
413
+ setArg(key, next);
414
+ i++;
415
+ }
416
+ else {
417
+ setArg(key, defaultValue(key));
418
+ }
419
+ }
420
+ }
421
+ else if (arg.match(/^-[^-]+/) && !arg.match(negative)) {
422
+ letters = arg.slice(1, -1).split('');
423
+ broken = false;
424
+ for (let j = 0; j < letters.length; j++) {
425
+ next = arg.slice(j + 2);
426
+ if (letters[j + 1] && letters[j + 1] === '=') {
427
+ value = arg.slice(j + 3);
428
+ key = letters[j];
429
+ if (checkAllAliases(key, flags.arrays)) {
430
+ // array format = '-f=a b c'
431
+ i = eatArray(i, key, args, value);
432
+ }
433
+ else if (checkAllAliases(key, flags.nargs) !== false) {
434
+ // nargs format = '-f=monkey washing cat'
435
+ i = eatNargs(i, key, args, value);
436
+ }
437
+ else {
438
+ setArg(key, value);
439
+ }
440
+ broken = true;
441
+ break;
442
+ }
443
+ if (next === '-') {
444
+ setArg(letters[j], next);
445
+ continue;
446
+ }
447
+ // current letter is an alphabetic character and next value is a number
448
+ if (/[A-Za-z]/.test(letters[j]) &&
449
+ /^-?\d+(\.\d*)?(e-?\d+)?$/.test(next) &&
450
+ checkAllAliases(next, flags.bools) === false) {
451
+ setArg(letters[j], next);
452
+ broken = true;
453
+ break;
454
+ }
455
+ if (letters[j + 1] && letters[j + 1].match(/\W/)) {
456
+ setArg(letters[j], next);
457
+ broken = true;
458
+ break;
459
+ }
460
+ else {
461
+ setArg(letters[j], defaultValue(letters[j]));
462
+ }
463
+ }
464
+ key = arg.slice(-1)[0];
465
+ if (!broken && key !== '-') {
466
+ if (checkAllAliases(key, flags.arrays)) {
467
+ // array format = '-f a b c'
468
+ i = eatArray(i, key, args);
469
+ }
470
+ else if (checkAllAliases(key, flags.nargs) !== false) {
471
+ // nargs format = '-f a b c'
472
+ // should be truthy even if: flags.nargs[key] === 0
473
+ i = eatNargs(i, key, args);
474
+ }
475
+ else {
476
+ next = args[i + 1];
477
+ if (next !== undefined && (!/^(-|--)[^-]/.test(next) ||
478
+ next.match(negative)) &&
479
+ !checkAllAliases(key, flags.bools) &&
480
+ !checkAllAliases(key, flags.counts)) {
481
+ setArg(key, next);
482
+ i++;
483
+ }
484
+ else if (/^(true|false)$/.test(next)) {
485
+ setArg(key, next);
486
+ i++;
487
+ }
488
+ else {
489
+ setArg(key, defaultValue(key));
490
+ }
491
+ }
492
+ }
493
+ }
494
+ else if (arg.match(/^-[0-9]$/) &&
495
+ arg.match(negative) &&
496
+ checkAllAliases(arg.slice(1), flags.bools)) {
497
+ // single-digit boolean alias, e.g: xargs -0
498
+ key = arg.slice(1);
499
+ setArg(key, defaultValue(key));
500
+ }
501
+ else if (arg === '--') {
502
+ notFlags = args.slice(i + 1);
503
+ break;
504
+ }
505
+ else if (configuration['halt-at-non-option']) {
506
+ notFlags = args.slice(i);
507
+ break;
508
+ }
509
+ else {
510
+ pushPositional(arg);
511
+ }
512
+ }
513
+ // order of precedence:
514
+ // 1. command line arg
515
+ // 2. value from env var
516
+ // 3. value from config file
517
+ // 4. value from config objects
518
+ // 5. configured default value
519
+ applyEnvVars(argv, true); // special case: check env vars that point to config file
520
+ applyEnvVars(argv, false);
521
+ setConfig(argv);
522
+ setConfigObjects();
523
+ applyDefaultsAndAliases(argv, flags.aliases, defaults, true);
524
+ applyCoercions(argv);
525
+ if (configuration['set-placeholder-key'])
526
+ setPlaceholderKeys(argv);
527
+ // for any counts either not in args or without an explicit default, set to 0
528
+ Object.keys(flags.counts).forEach(function (key) {
529
+ if (!hasKey(argv, key.split('.')))
530
+ setArg(key, 0);
531
+ });
532
+ // '--' defaults to undefined.
533
+ if (notFlagsOption && notFlags.length)
534
+ argv[notFlagsArgv] = [];
535
+ notFlags.forEach(function (key) {
536
+ argv[notFlagsArgv].push(key);
537
+ });
538
+ if (configuration['camel-case-expansion'] && configuration['strip-dashed']) {
539
+ Object.keys(argv).filter(key => key !== '--' && key.includes('-')).forEach(key => {
540
+ delete argv[key];
541
+ });
542
+ }
543
+ if (configuration['strip-aliased']) {
544
+ [].concat(...Object.keys(aliases).map(k => aliases[k])).forEach(alias => {
545
+ if (configuration['camel-case-expansion'] && alias.includes('-')) {
546
+ delete argv[alias.split('.').map(prop => camelCase(prop)).join('.')];
547
+ }
548
+ delete argv[alias];
549
+ });
550
+ }
551
+ // Push argument into positional array, applying numeric coercion:
552
+ function pushPositional(arg) {
553
+ const maybeCoercedNumber = maybeCoerceNumber('_', arg);
554
+ if (typeof maybeCoercedNumber === 'string' || typeof maybeCoercedNumber === 'number') {
555
+ argv._.push(maybeCoercedNumber);
556
+ }
557
+ }
558
+ // how many arguments should we consume, based
559
+ // on the nargs option?
560
+ function eatNargs(i, key, args, argAfterEqualSign) {
561
+ let ii;
562
+ let toEat = checkAllAliases(key, flags.nargs);
563
+ // NaN has a special meaning for the array type, indicating that one or
564
+ // more values are expected.
565
+ toEat = typeof toEat !== 'number' || isNaN(toEat) ? 1 : toEat;
566
+ if (toEat === 0) {
567
+ if (!isUndefined(argAfterEqualSign)) {
568
+ error = Error(__('Argument unexpected for: %s', key));
569
+ }
570
+ setArg(key, defaultValue(key));
571
+ return i;
572
+ }
573
+ let available = isUndefined(argAfterEqualSign) ? 0 : 1;
574
+ if (configuration['nargs-eats-options']) {
575
+ // classic behavior, yargs eats positional and dash arguments.
576
+ if (args.length - (i + 1) + available < toEat) {
577
+ error = Error(__('Not enough arguments following: %s', key));
578
+ }
579
+ available = toEat;
580
+ }
581
+ else {
582
+ // nargs will not consume flag arguments, e.g., -abc, --foo,
583
+ // and terminates when one is observed.
584
+ for (ii = i + 1; ii < args.length; ii++) {
585
+ if (!args[ii].match(/^-[^0-9]/) || args[ii].match(negative) || isUnknownOptionAsArg(args[ii]))
586
+ available++;
587
+ else
588
+ break;
589
+ }
590
+ if (available < toEat)
591
+ error = Error(__('Not enough arguments following: %s', key));
592
+ }
593
+ let consumed = Math.min(available, toEat);
594
+ if (!isUndefined(argAfterEqualSign) && consumed > 0) {
595
+ setArg(key, argAfterEqualSign);
596
+ consumed--;
597
+ }
598
+ for (ii = i + 1; ii < (consumed + i + 1); ii++) {
599
+ setArg(key, args[ii]);
600
+ }
601
+ return (i + consumed);
602
+ }
603
+ // if an option is an array, eat all non-hyphenated arguments
604
+ // following it... YUM!
605
+ // e.g., --foo apple banana cat becomes ["apple", "banana", "cat"]
606
+ function eatArray(i, key, args, argAfterEqualSign) {
607
+ let argsToSet = [];
608
+ let next = argAfterEqualSign || args[i + 1];
609
+ // If both array and nargs are configured, enforce the nargs count:
610
+ const nargsCount = checkAllAliases(key, flags.nargs);
611
+ if (checkAllAliases(key, flags.bools) && !(/^(true|false)$/.test(next))) {
612
+ argsToSet.push(true);
613
+ }
614
+ else if (isUndefined(next) ||
615
+ (isUndefined(argAfterEqualSign) && /^-/.test(next) && !negative.test(next) && !isUnknownOptionAsArg(next))) {
616
+ // for keys without value ==> argsToSet remains an empty []
617
+ // set user default value, if available
618
+ if (defaults[key] !== undefined) {
619
+ const defVal = defaults[key];
620
+ argsToSet = Array.isArray(defVal) ? defVal : [defVal];
621
+ }
622
+ }
623
+ else {
624
+ // value in --option=value is eaten as is
625
+ if (!isUndefined(argAfterEqualSign)) {
626
+ argsToSet.push(processValue(key, argAfterEqualSign, true));
627
+ }
628
+ for (let ii = i + 1; ii < args.length; ii++) {
629
+ if ((!configuration['greedy-arrays'] && argsToSet.length > 0) ||
630
+ (nargsCount && typeof nargsCount === 'number' && argsToSet.length >= nargsCount))
631
+ break;
632
+ next = args[ii];
633
+ if (/^-/.test(next) && !negative.test(next) && !isUnknownOptionAsArg(next))
634
+ break;
635
+ i = ii;
636
+ argsToSet.push(processValue(key, next, inputIsString));
637
+ }
638
+ }
639
+ // If both array and nargs are configured, create an error if less than
640
+ // nargs positionals were found. NaN has special meaning, indicating
641
+ // that at least one value is required (more are okay).
642
+ if (typeof nargsCount === 'number' && ((nargsCount && argsToSet.length < nargsCount) ||
643
+ (isNaN(nargsCount) && argsToSet.length === 0))) {
644
+ error = Error(__('Not enough arguments following: %s', key));
645
+ }
646
+ setArg(key, argsToSet);
647
+ return i;
648
+ }
649
+ function setArg(key, val, shouldStripQuotes = inputIsString) {
650
+ if (/-/.test(key) && configuration['camel-case-expansion']) {
651
+ const alias = key.split('.').map(function (prop) {
652
+ return camelCase(prop);
653
+ }).join('.');
654
+ addNewAlias(key, alias);
655
+ }
656
+ const value = processValue(key, val, shouldStripQuotes);
657
+ const splitKey = key.split('.');
658
+ setKey(argv, splitKey, value);
659
+ // handle populating aliases of the full key
660
+ if (flags.aliases[key]) {
661
+ flags.aliases[key].forEach(function (x) {
662
+ const keyProperties = x.split('.');
663
+ setKey(argv, keyProperties, value);
664
+ });
665
+ }
666
+ // handle populating aliases of the first element of the dot-notation key
667
+ if (splitKey.length > 1 && configuration['dot-notation']) {
668
+ (flags.aliases[splitKey[0]] || []).forEach(function (x) {
669
+ let keyProperties = x.split('.');
670
+ // expand alias with nested objects in key
671
+ const a = [].concat(splitKey);
672
+ a.shift(); // nuke the old key.
673
+ keyProperties = keyProperties.concat(a);
674
+ // populate alias only if is not already an alias of the full key
675
+ // (already populated above)
676
+ if (!(flags.aliases[key] || []).includes(keyProperties.join('.'))) {
677
+ setKey(argv, keyProperties, value);
678
+ }
679
+ });
680
+ }
681
+ // Set normalize getter and setter when key is in 'normalize' but isn't an array
682
+ if (checkAllAliases(key, flags.normalize) && !checkAllAliases(key, flags.arrays)) {
683
+ const keys = [key].concat(flags.aliases[key] || []);
684
+ keys.forEach(function (key) {
685
+ Object.defineProperty(argvReturn, key, {
686
+ enumerable: true,
687
+ get() {
688
+ return val;
689
+ },
690
+ set(value) {
691
+ val = typeof value === 'string' ? mixin.normalize(value) : value;
692
+ }
693
+ });
694
+ });
695
+ }
696
+ }
697
+ function addNewAlias(key, alias) {
698
+ if (!(flags.aliases[key] && flags.aliases[key].length)) {
699
+ flags.aliases[key] = [alias];
700
+ newAliases[alias] = true;
701
+ }
702
+ if (!(flags.aliases[alias] && flags.aliases[alias].length)) {
703
+ addNewAlias(alias, key);
704
+ }
705
+ }
706
+ function processValue(key, val, shouldStripQuotes) {
707
+ // strings may be quoted, clean this up as we assign values.
708
+ if (shouldStripQuotes) {
709
+ val = stripQuotes(val);
710
+ }
711
+ // handle parsing boolean arguments --foo=true --bar false.
712
+ if (checkAllAliases(key, flags.bools) || checkAllAliases(key, flags.counts)) {
713
+ if (typeof val === 'string')
714
+ val = val === 'true';
715
+ }
716
+ let value = Array.isArray(val)
717
+ ? val.map(function (v) { return maybeCoerceNumber(key, v); })
718
+ : maybeCoerceNumber(key, val);
719
+ // increment a count given as arg (either no value or value parsed as boolean)
720
+ if (checkAllAliases(key, flags.counts) && (isUndefined(value) || typeof value === 'boolean')) {
721
+ value = increment();
722
+ }
723
+ // Set normalized value when key is in 'normalize' and in 'arrays'
724
+ if (checkAllAliases(key, flags.normalize) && checkAllAliases(key, flags.arrays)) {
725
+ if (Array.isArray(val))
726
+ value = val.map((val) => { return mixin.normalize(val); });
727
+ else
728
+ value = mixin.normalize(val);
729
+ }
730
+ return value;
731
+ }
732
+ function maybeCoerceNumber(key, value) {
733
+ if (!configuration['parse-positional-numbers'] && key === '_')
734
+ return value;
735
+ if (!checkAllAliases(key, flags.strings) && !checkAllAliases(key, flags.bools) && !Array.isArray(value)) {
736
+ const shouldCoerceNumber = looksLikeNumber(value) && configuration['parse-numbers'] && (Number.isSafeInteger(Math.floor(parseFloat(`${value}`))));
737
+ if (shouldCoerceNumber || (!isUndefined(value) && checkAllAliases(key, flags.numbers))) {
738
+ value = Number(value);
739
+ }
740
+ }
741
+ return value;
742
+ }
743
+ // set args from config.json file, this should be
744
+ // applied last so that defaults can be applied.
745
+ function setConfig(argv) {
746
+ const configLookup = Object.create(null);
747
+ // expand defaults/aliases, in-case any happen to reference
748
+ // the config.json file.
749
+ applyDefaultsAndAliases(configLookup, flags.aliases, defaults);
750
+ Object.keys(flags.configs).forEach(function (configKey) {
751
+ const configPath = argv[configKey] || configLookup[configKey];
752
+ if (configPath) {
753
+ try {
754
+ let config = null;
755
+ const resolvedConfigPath = mixin.resolve(mixin.cwd(), configPath);
756
+ const resolveConfig = flags.configs[configKey];
757
+ if (typeof resolveConfig === 'function') {
758
+ try {
759
+ config = resolveConfig(resolvedConfigPath);
760
+ }
761
+ catch (e) {
762
+ config = e;
763
+ }
764
+ if (config instanceof Error) {
765
+ error = config;
766
+ return;
767
+ }
768
+ }
769
+ else {
770
+ config = mixin.require(resolvedConfigPath);
771
+ }
772
+ setConfigObject(config);
773
+ }
774
+ catch (ex) {
775
+ // Deno will receive a PermissionDenied error if an attempt is
776
+ // made to load config without the --allow-read flag:
777
+ if (ex.name === 'PermissionDenied')
778
+ error = ex;
779
+ else if (argv[configKey])
780
+ error = Error(__('Invalid JSON config file: %s', configPath));
781
+ }
782
+ }
783
+ });
784
+ }
785
+ // set args from config object.
786
+ // it recursively checks nested objects.
787
+ function setConfigObject(config, prev) {
788
+ Object.keys(config).forEach(function (key) {
789
+ const value = config[key];
790
+ const fullKey = prev ? prev + '.' + key : key;
791
+ // if the value is an inner object and we have dot-notation
792
+ // enabled, treat inner objects in config the same as
793
+ // heavily nested dot notations (foo.bar.apple).
794
+ if (typeof value === 'object' && value !== null && !Array.isArray(value) && configuration['dot-notation']) {
795
+ // if the value is an object but not an array, check nested object
796
+ setConfigObject(value, fullKey);
797
+ }
798
+ else {
799
+ // setting arguments via CLI takes precedence over
800
+ // values within the config file.
801
+ if (!hasKey(argv, fullKey.split('.')) || (checkAllAliases(fullKey, flags.arrays) && configuration['combine-arrays'])) {
802
+ setArg(fullKey, value);
803
+ }
804
+ }
805
+ });
806
+ }
807
+ // set all config objects passed in opts
808
+ function setConfigObjects() {
809
+ if (typeof configObjects !== 'undefined') {
810
+ configObjects.forEach(function (configObject) {
811
+ setConfigObject(configObject);
812
+ });
813
+ }
814
+ }
815
+ function applyEnvVars(argv, configOnly) {
816
+ if (typeof envPrefix === 'undefined')
817
+ return;
818
+ const prefix = typeof envPrefix === 'string' ? envPrefix : '';
819
+ const env = mixin.env();
820
+ Object.keys(env).forEach(function (envVar) {
821
+ if (prefix === '' || envVar.lastIndexOf(prefix, 0) === 0) {
822
+ // get array of nested keys and convert them to camel case
823
+ const keys = envVar.split('__').map(function (key, i) {
824
+ if (i === 0) {
825
+ key = key.substring(prefix.length);
826
+ }
827
+ return camelCase(key);
828
+ });
829
+ if (((configOnly && flags.configs[keys.join('.')]) || !configOnly) && !hasKey(argv, keys)) {
830
+ setArg(keys.join('.'), env[envVar]);
831
+ }
832
+ }
833
+ });
834
+ }
835
+ function applyCoercions(argv) {
836
+ let coerce;
837
+ const applied = new Set();
838
+ Object.keys(argv).forEach(function (key) {
839
+ if (!applied.has(key)) { // If we haven't already coerced this option via one of its aliases
840
+ coerce = checkAllAliases(key, flags.coercions);
841
+ if (typeof coerce === 'function') {
842
+ try {
843
+ const value = maybeCoerceNumber(key, coerce(argv[key]));
844
+ ([].concat(flags.aliases[key] || [], key)).forEach(ali => {
845
+ applied.add(ali);
846
+ argv[ali] = value;
847
+ });
848
+ }
849
+ catch (err) {
850
+ error = err;
851
+ }
852
+ }
853
+ }
854
+ });
855
+ }
856
+ function setPlaceholderKeys(argv) {
857
+ flags.keys.forEach((key) => {
858
+ // don't set placeholder keys for dot notation options 'foo.bar'.
859
+ if (~key.indexOf('.'))
860
+ return;
861
+ if (typeof argv[key] === 'undefined')
862
+ argv[key] = undefined;
863
+ });
864
+ return argv;
865
+ }
866
+ function applyDefaultsAndAliases(obj, aliases, defaults, canLog = false) {
867
+ Object.keys(defaults).forEach(function (key) {
868
+ if (!hasKey(obj, key.split('.'))) {
869
+ setKey(obj, key.split('.'), defaults[key]);
870
+ if (canLog)
871
+ defaulted[key] = true;
872
+ (aliases[key] || []).forEach(function (x) {
873
+ if (hasKey(obj, x.split('.')))
874
+ return;
875
+ setKey(obj, x.split('.'), defaults[key]);
876
+ });
877
+ }
878
+ });
879
+ }
880
+ function hasKey(obj, keys) {
881
+ let o = obj;
882
+ if (!configuration['dot-notation'])
883
+ keys = [keys.join('.')];
884
+ keys.slice(0, -1).forEach(function (key) {
885
+ o = (o[key] || {});
886
+ });
887
+ const key = keys[keys.length - 1];
888
+ if (typeof o !== 'object')
889
+ return false;
890
+ else
891
+ return key in o;
892
+ }
893
+ function setKey(obj, keys, value) {
894
+ let o = obj;
895
+ if (!configuration['dot-notation'])
896
+ keys = [keys.join('.')];
897
+ keys.slice(0, -1).forEach(function (key) {
898
+ // TODO(bcoe): in the next major version of yargs, switch to
899
+ // Object.create(null) for dot notation:
900
+ key = sanitizeKey(key);
901
+ if (typeof o === 'object' && o[key] === undefined) {
902
+ o[key] = {};
903
+ }
904
+ if (typeof o[key] !== 'object' || Array.isArray(o[key])) {
905
+ // ensure that o[key] is an array, and that the last item is an empty object.
906
+ if (Array.isArray(o[key])) {
907
+ o[key].push({});
908
+ }
909
+ else {
910
+ o[key] = [o[key], {}];
911
+ }
912
+ // we want to update the empty object at the end of the o[key] array, so set o to that object
913
+ o = o[key][o[key].length - 1];
914
+ }
915
+ else {
916
+ o = o[key];
917
+ }
918
+ });
919
+ // TODO(bcoe): in the next major version of yargs, switch to
920
+ // Object.create(null) for dot notation:
921
+ const key = sanitizeKey(keys[keys.length - 1]);
922
+ const isTypeArray = checkAllAliases(keys.join('.'), flags.arrays);
923
+ const isValueArray = Array.isArray(value);
924
+ let duplicate = configuration['duplicate-arguments-array'];
925
+ // nargs has higher priority than duplicate
926
+ if (!duplicate && checkAllAliases(key, flags.nargs)) {
927
+ duplicate = true;
928
+ if ((!isUndefined(o[key]) && flags.nargs[key] === 1) || (Array.isArray(o[key]) && o[key].length === flags.nargs[key])) {
929
+ o[key] = undefined;
930
+ }
931
+ }
932
+ if (value === increment()) {
933
+ o[key] = increment(o[key]);
934
+ }
935
+ else if (Array.isArray(o[key])) {
936
+ if (duplicate && isTypeArray && isValueArray) {
937
+ o[key] = configuration['flatten-duplicate-arrays'] ? o[key].concat(value) : (Array.isArray(o[key][0]) ? o[key] : [o[key]]).concat([value]);
938
+ }
939
+ else if (!duplicate && Boolean(isTypeArray) === Boolean(isValueArray)) {
940
+ o[key] = value;
941
+ }
942
+ else {
943
+ o[key] = o[key].concat([value]);
944
+ }
945
+ }
946
+ else if (o[key] === undefined && isTypeArray) {
947
+ o[key] = isValueArray ? value : [value];
948
+ }
949
+ else if (duplicate && !(o[key] === undefined ||
950
+ checkAllAliases(key, flags.counts) ||
951
+ checkAllAliases(key, flags.bools))) {
952
+ o[key] = [o[key], value];
953
+ }
954
+ else {
955
+ o[key] = value;
956
+ }
957
+ }
958
+ // extend the aliases list with inferred aliases.
959
+ function extendAliases(...args) {
960
+ args.forEach(function (obj) {
961
+ Object.keys(obj || {}).forEach(function (key) {
962
+ // short-circuit if we've already added a key
963
+ // to the aliases array, for example it might
964
+ // exist in both 'opts.default' and 'opts.key'.
965
+ if (flags.aliases[key])
966
+ return;
967
+ flags.aliases[key] = [].concat(aliases[key] || []);
968
+ // For "--option-name", also set argv.optionName
969
+ flags.aliases[key].concat(key).forEach(function (x) {
970
+ if (/-/.test(x) && configuration['camel-case-expansion']) {
971
+ const c = camelCase(x);
972
+ if (c !== key && flags.aliases[key].indexOf(c) === -1) {
973
+ flags.aliases[key].push(c);
974
+ newAliases[c] = true;
975
+ }
976
+ }
977
+ });
978
+ // For "--optionName", also set argv['option-name']
979
+ flags.aliases[key].concat(key).forEach(function (x) {
980
+ if (x.length > 1 && /[A-Z]/.test(x) && configuration['camel-case-expansion']) {
981
+ const c = decamelize(x, '-');
982
+ if (c !== key && flags.aliases[key].indexOf(c) === -1) {
983
+ flags.aliases[key].push(c);
984
+ newAliases[c] = true;
985
+ }
986
+ }
987
+ });
988
+ flags.aliases[key].forEach(function (x) {
989
+ flags.aliases[x] = [key].concat(flags.aliases[key].filter(function (y) {
990
+ return x !== y;
991
+ }));
992
+ });
993
+ });
994
+ });
995
+ }
996
+ function checkAllAliases(key, flag) {
997
+ const toCheck = [].concat(flags.aliases[key] || [], key);
998
+ const keys = Object.keys(flag);
999
+ const setAlias = toCheck.find(key => keys.includes(key));
1000
+ return setAlias ? flag[setAlias] : false;
1001
+ }
1002
+ function hasAnyFlag(key) {
1003
+ const flagsKeys = Object.keys(flags);
1004
+ const toCheck = [].concat(flagsKeys.map(k => flags[k]));
1005
+ return toCheck.some(function (flag) {
1006
+ return Array.isArray(flag) ? flag.includes(key) : flag[key];
1007
+ });
1008
+ }
1009
+ function hasFlagsMatching(arg, ...patterns) {
1010
+ const toCheck = [].concat(...patterns);
1011
+ return toCheck.some(function (pattern) {
1012
+ const match = arg.match(pattern);
1013
+ return match && hasAnyFlag(match[1]);
1014
+ });
1015
+ }
1016
+ // based on a simplified version of the short flag group parsing logic
1017
+ function hasAllShortFlags(arg) {
1018
+ // if this is a negative number, or doesn't start with a single hyphen, it's not a short flag group
1019
+ if (arg.match(negative) || !arg.match(/^-[^-]+/)) {
1020
+ return false;
1021
+ }
1022
+ let hasAllFlags = true;
1023
+ let next;
1024
+ const letters = arg.slice(1).split('');
1025
+ for (let j = 0; j < letters.length; j++) {
1026
+ next = arg.slice(j + 2);
1027
+ if (!hasAnyFlag(letters[j])) {
1028
+ hasAllFlags = false;
1029
+ break;
1030
+ }
1031
+ if ((letters[j + 1] && letters[j + 1] === '=') ||
1032
+ next === '-' ||
1033
+ (/[A-Za-z]/.test(letters[j]) && /^-?\d+(\.\d*)?(e-?\d+)?$/.test(next)) ||
1034
+ (letters[j + 1] && letters[j + 1].match(/\W/))) {
1035
+ break;
1036
+ }
1037
+ }
1038
+ return hasAllFlags;
1039
+ }
1040
+ function isUnknownOptionAsArg(arg) {
1041
+ return configuration['unknown-options-as-args'] && isUnknownOption(arg);
1042
+ }
1043
+ function isUnknownOption(arg) {
1044
+ arg = arg.replace(/^-{3,}/, '--');
1045
+ // ignore negative numbers
1046
+ if (arg.match(negative)) {
1047
+ return false;
1048
+ }
1049
+ // if this is a short option group and all of them are configured, it isn't unknown
1050
+ if (hasAllShortFlags(arg)) {
1051
+ return false;
1052
+ }
1053
+ // e.g. '--count=2'
1054
+ const flagWithEquals = /^-+([^=]+?)=[\s\S]*$/;
1055
+ // e.g. '-a' or '--arg'
1056
+ const normalFlag = /^-+([^=]+?)$/;
1057
+ // e.g. '-a-'
1058
+ const flagEndingInHyphen = /^-+([^=]+?)-$/;
1059
+ // e.g. '-abc123'
1060
+ const flagEndingInDigits = /^-+([^=]+?\d+)$/;
1061
+ // e.g. '-a/usr/local'
1062
+ const flagEndingInNonWordCharacters = /^-+([^=]+?)\W+.*$/;
1063
+ // check the different types of flag styles, including negatedBoolean, a pattern defined near the start of the parse method
1064
+ return !hasFlagsMatching(arg, flagWithEquals, negatedBoolean, normalFlag, flagEndingInHyphen, flagEndingInDigits, flagEndingInNonWordCharacters);
1065
+ }
1066
+ // make a best effort to pick a default value
1067
+ // for an option based on name and type.
1068
+ function defaultValue(key) {
1069
+ if (!checkAllAliases(key, flags.bools) &&
1070
+ !checkAllAliases(key, flags.counts) &&
1071
+ `${key}` in defaults) {
1072
+ return defaults[key];
1073
+ }
1074
+ else {
1075
+ return defaultForType(guessType(key));
1076
+ }
1077
+ }
1078
+ // return a default value, given the type of a flag.,
1079
+ function defaultForType(type) {
1080
+ const def = {
1081
+ [DefaultValuesForTypeKey.BOOLEAN]: true,
1082
+ [DefaultValuesForTypeKey.STRING]: '',
1083
+ [DefaultValuesForTypeKey.NUMBER]: undefined,
1084
+ [DefaultValuesForTypeKey.ARRAY]: []
1085
+ };
1086
+ return def[type];
1087
+ }
1088
+ // given a flag, enforce a default type.
1089
+ function guessType(key) {
1090
+ let type = DefaultValuesForTypeKey.BOOLEAN;
1091
+ if (checkAllAliases(key, flags.strings))
1092
+ type = DefaultValuesForTypeKey.STRING;
1093
+ else if (checkAllAliases(key, flags.numbers))
1094
+ type = DefaultValuesForTypeKey.NUMBER;
1095
+ else if (checkAllAliases(key, flags.bools))
1096
+ type = DefaultValuesForTypeKey.BOOLEAN;
1097
+ else if (checkAllAliases(key, flags.arrays))
1098
+ type = DefaultValuesForTypeKey.ARRAY;
1099
+ return type;
1100
+ }
1101
+ function isUndefined(num) {
1102
+ return num === undefined;
1103
+ }
1104
+ // check user configuration settings for inconsistencies
1105
+ function checkConfiguration() {
1106
+ // count keys should not be set as array/narg
1107
+ Object.keys(flags.counts).find(key => {
1108
+ if (checkAllAliases(key, flags.arrays)) {
1109
+ error = Error(__('Invalid configuration: %s, opts.count excludes opts.array.', key));
1110
+ return true;
1111
+ }
1112
+ else if (checkAllAliases(key, flags.nargs)) {
1113
+ error = Error(__('Invalid configuration: %s, opts.count excludes opts.narg.', key));
1114
+ return true;
1115
+ }
1116
+ return false;
1117
+ });
1118
+ }
1119
+ return {
1120
+ aliases: Object.assign({}, flags.aliases),
1121
+ argv: Object.assign(argvReturn, argv),
1122
+ configuration: configuration,
1123
+ defaulted: Object.assign({}, defaulted),
1124
+ error: error,
1125
+ newAliases: Object.assign({}, newAliases)
1126
+ };
1127
+ }
1128
+ }
1129
+ // if any aliases reference each other, we should
1130
+ // merge them together.
1131
+ function combineAliases(aliases) {
1132
+ const aliasArrays = [];
1133
+ const combined = Object.create(null);
1134
+ let change = true;
1135
+ // turn alias lookup hash {key: ['alias1', 'alias2']} into
1136
+ // a simple array ['key', 'alias1', 'alias2']
1137
+ Object.keys(aliases).forEach(function (key) {
1138
+ aliasArrays.push([].concat(aliases[key], key));
1139
+ });
1140
+ // combine arrays until zero changes are
1141
+ // made in an iteration.
1142
+ while (change) {
1143
+ change = false;
1144
+ for (let i = 0; i < aliasArrays.length; i++) {
1145
+ for (let ii = i + 1; ii < aliasArrays.length; ii++) {
1146
+ const intersect = aliasArrays[i].filter(function (v) {
1147
+ return aliasArrays[ii].indexOf(v) !== -1;
1148
+ });
1149
+ if (intersect.length) {
1150
+ aliasArrays[i] = aliasArrays[i].concat(aliasArrays[ii]);
1151
+ aliasArrays.splice(ii, 1);
1152
+ change = true;
1153
+ break;
1154
+ }
1155
+ }
1156
+ }
1157
+ }
1158
+ // map arrays back to the hash-lookup (de-dupe while
1159
+ // we're at it).
1160
+ aliasArrays.forEach(function (aliasArray) {
1161
+ aliasArray = aliasArray.filter(function (v, i, self) {
1162
+ return self.indexOf(v) === i;
1163
+ });
1164
+ const lastAlias = aliasArray.pop();
1165
+ if (lastAlias !== undefined && typeof lastAlias === 'string') {
1166
+ combined[lastAlias] = aliasArray;
1167
+ }
1168
+ });
1169
+ return combined;
1170
+ }
1171
+ // this function should only be called when a count is given as an arg
1172
+ // it is NOT called to set a default value
1173
+ // thus we can start the count at 1 instead of 0
1174
+ function increment(orig) {
1175
+ return orig !== undefined ? orig + 1 : 1;
1176
+ }
1177
+ // TODO(bcoe): in the next major version of yargs, switch to
1178
+ // Object.create(null) for dot notation:
1179
+ function sanitizeKey(key) {
1180
+ if (key === '__proto__')
1181
+ return '___proto___';
1182
+ return key;
1183
+ }
1184
+ function stripQuotes(val) {
1185
+ return (typeof val === 'string' &&
1186
+ (val[0] === "'" || val[0] === '"') &&
1187
+ val[val.length - 1] === val[0])
1188
+ ? val.substring(1, val.length - 1)
1189
+ : val;
1190
+ }
1191
+
1192
+ /**
1193
+ * @fileoverview Main entrypoint for libraries using yargs-parser in Node.js
1194
+ * CJS and ESM environments.
1195
+ *
1196
+ * @license
1197
+ * Copyright (c) 2016, Contributors
1198
+ * SPDX-License-Identifier: ISC
1199
+ */
1200
+ var _a, _b, _c;
1201
+ // See https://github.com/yargs/yargs-parser#supported-nodejs-versions for our
1202
+ // version support policy. The YARGS_MIN_NODE_VERSION is used for testing only.
1203
+ const minNodeVersion = (process && process.env && process.env.YARGS_MIN_NODE_VERSION)
1204
+ ? Number(process.env.YARGS_MIN_NODE_VERSION)
1205
+ : 12;
1206
+ const nodeVersion = (_b = (_a = process === null || process === void 0 ? void 0 : process.versions) === null || _a === void 0 ? void 0 : _a.node) !== null && _b !== void 0 ? _b : (_c = process === null || process === void 0 ? void 0 : process.version) === null || _c === void 0 ? void 0 : _c.slice(1);
1207
+ if (nodeVersion) {
1208
+ const major = Number(nodeVersion.match(/^([^.]+)/)[1]);
1209
+ if (major < minNodeVersion) {
1210
+ throw Error(`yargs parser supports a minimum Node.js version of ${minNodeVersion}. Read our version support policy: https://github.com/yargs/yargs-parser#supported-nodejs-versions`);
1211
+ }
1212
+ }
1213
+ // Creates a yargs-parser instance using Node.js standard libraries:
1214
+ const env = process ? process.env : {};
1215
+ const parser = new YargsParser({
1216
+ cwd: process.cwd,
1217
+ env: () => {
1218
+ return env;
1219
+ },
1220
+ format: require$$2.format,
1221
+ normalize: require$$0.normalize,
1222
+ resolve: require$$0.resolve,
1223
+ // TODO: figure out a way to combine ESM and CJS coverage, such that
1224
+ // we can exercise all the lines below:
1225
+ require: (path) => {
1226
+ if (typeof require !== 'undefined') {
1227
+ return require(path);
1228
+ }
1229
+ else if (path.match(/\.json$/)) {
1230
+ // Addresses: https://github.com/yargs/yargs/issues/2040
1231
+ return JSON.parse(require$$0$1.readFileSync(path, 'utf8'));
1232
+ }
1233
+ else {
1234
+ throw Error('only .json config files are supported in ESM');
1235
+ }
1236
+ }
1237
+ });
1238
+ const yargsParser = function Parser(args, opts) {
1239
+ const result = parser.parse(args.slice(), opts);
1240
+ return result.argv;
1241
+ };
1242
+ yargsParser.detailed = function (args, opts) {
1243
+ return parser.parse(args.slice(), opts);
1244
+ };
1245
+ yargsParser.camelCase = camelCase;
1246
+ yargsParser.decamelize = decamelize;
1247
+ yargsParser.looksLikeNumber = looksLikeNumber;
1248
+
1249
+ /******************************************************************************
1250
+ Copyright (c) Microsoft Corporation.
1251
+
1252
+ Permission to use, copy, modify, and/or distribute this software for any
1253
+ purpose with or without fee is hereby granted.
1254
+
1255
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
1256
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
1257
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
1258
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
1259
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
1260
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
1261
+ PERFORMANCE OF THIS SOFTWARE.
1262
+ ***************************************************************************** */
1263
+ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
1264
+
1265
+
1266
+ function __addDisposableResource(env, value, async) {
1267
+ if (value !== null && value !== void 0) {
1268
+ if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
1269
+ var dispose, inner;
1270
+ if (async) {
1271
+ if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
1272
+ dispose = value[Symbol.asyncDispose];
1273
+ }
1274
+ if (dispose === void 0) {
1275
+ if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
1276
+ dispose = value[Symbol.dispose];
1277
+ if (async) inner = dispose;
1278
+ }
1279
+ if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
1280
+ if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };
1281
+ env.stack.push({ value: value, dispose: dispose, async: async });
1282
+ }
1283
+ else if (async) {
1284
+ env.stack.push({ async: true });
1285
+ }
1286
+ return value;
1287
+
1288
+ }
1289
+
1290
+ var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
1291
+ var e = new Error(message);
1292
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
1293
+ };
1294
+
1295
+ function __disposeResources(env) {
1296
+ function fail(e) {
1297
+ env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
1298
+ env.hasError = true;
1299
+ }
1300
+ var r, s = 0;
1301
+ function next() {
1302
+ while (r = env.stack.pop()) {
1303
+ try {
1304
+ if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
1305
+ if (r.dispose) {
1306
+ var result = r.dispose.call(r.value);
1307
+ if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
1308
+ }
1309
+ else s |= 1;
1310
+ }
1311
+ catch (e) {
1312
+ fail(e);
1313
+ }
1314
+ }
1315
+ if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
1316
+ if (env.hasError) throw env.error;
1317
+ }
1318
+ return next();
1319
+ }
1320
+
1321
+ const toZeroIfInfinity = value => Number.isFinite(value) ? value : 0;
1322
+
1323
+ function parseNumber(milliseconds) {
1324
+ return {
1325
+ days: Math.trunc(milliseconds / 86_400_000),
1326
+ hours: Math.trunc(milliseconds / 3_600_000 % 24),
1327
+ minutes: Math.trunc(milliseconds / 60_000 % 60),
1328
+ seconds: Math.trunc(milliseconds / 1000 % 60),
1329
+ milliseconds: Math.trunc(milliseconds % 1000),
1330
+ microseconds: Math.trunc(toZeroIfInfinity(milliseconds * 1000) % 1000),
1331
+ nanoseconds: Math.trunc(toZeroIfInfinity(milliseconds * 1e6) % 1000),
1332
+ };
1333
+ }
1334
+
1335
+ function parseBigint(milliseconds) {
1336
+ return {
1337
+ days: milliseconds / 86_400_000n,
1338
+ hours: milliseconds / 3_600_000n % 24n,
1339
+ minutes: milliseconds / 60_000n % 60n,
1340
+ seconds: milliseconds / 1000n % 60n,
1341
+ milliseconds: milliseconds % 1000n,
1342
+ microseconds: 0n,
1343
+ nanoseconds: 0n,
1344
+ };
1345
+ }
1346
+
1347
+ function parseMilliseconds(milliseconds) {
1348
+ switch (typeof milliseconds) {
1349
+ case 'number': {
1350
+ if (Number.isFinite(milliseconds)) {
1351
+ return parseNumber(milliseconds);
1352
+ }
1353
+
1354
+ break;
1355
+ }
1356
+
1357
+ case 'bigint': {
1358
+ return parseBigint(milliseconds);
1359
+ }
1360
+
1361
+ // No default
1362
+ }
1363
+
1364
+ throw new TypeError('Expected a finite number or bigint');
1365
+ }
1366
+
1367
+ const isZero = value => value === 0 || value === 0n;
1368
+ const pluralize = (word, count) => (count === 1 || count === 1n) ? word : `${word}s`;
1369
+
1370
+ const SECOND_ROUNDING_EPSILON = 0.000_000_1;
1371
+ const ONE_DAY_IN_MILLISECONDS = 24n * 60n * 60n * 1000n;
1372
+
1373
+ function prettyMilliseconds(milliseconds, options) {
1374
+ const isBigInt = typeof milliseconds === 'bigint';
1375
+ if (!isBigInt && !Number.isFinite(milliseconds)) {
1376
+ throw new TypeError('Expected a finite number or bigint');
1377
+ }
1378
+
1379
+ options = {...options};
1380
+
1381
+ const sign = milliseconds < 0 ? '-' : '';
1382
+ milliseconds = milliseconds < 0 ? -milliseconds : milliseconds; // Cannot use `Math.abs()` because of BigInt support.
1383
+
1384
+ if (options.colonNotation) {
1385
+ options.compact = false;
1386
+ options.formatSubMilliseconds = false;
1387
+ options.separateMilliseconds = false;
1388
+ options.verbose = false;
1389
+ }
1390
+
1391
+ if (options.compact) {
1392
+ options.unitCount = 1;
1393
+ options.secondsDecimalDigits = 0;
1394
+ options.millisecondsDecimalDigits = 0;
1395
+ }
1396
+
1397
+ let result = [];
1398
+
1399
+ const floorDecimals = (value, decimalDigits) => {
1400
+ const flooredInterimValue = Math.floor((value * (10 ** decimalDigits)) + SECOND_ROUNDING_EPSILON);
1401
+ const flooredValue = Math.round(flooredInterimValue) / (10 ** decimalDigits);
1402
+ return flooredValue.toFixed(decimalDigits);
1403
+ };
1404
+
1405
+ const add = (value, long, short, valueString) => {
1406
+ if (
1407
+ (result.length === 0 || !options.colonNotation)
1408
+ && isZero(value)
1409
+ && !(options.colonNotation && short === 'm')) {
1410
+ return;
1411
+ }
1412
+
1413
+ valueString ??= String(value);
1414
+ if (options.colonNotation) {
1415
+ const wholeDigits = valueString.includes('.') ? valueString.split('.')[0].length : valueString.length;
1416
+ const minLength = result.length > 0 ? 2 : 1;
1417
+ valueString = '0'.repeat(Math.max(0, minLength - wholeDigits)) + valueString;
1418
+ } else {
1419
+ valueString += options.verbose ? ' ' + pluralize(long, value) : short;
1420
+ }
1421
+
1422
+ result.push(valueString);
1423
+ };
1424
+
1425
+ const parsed = parseMilliseconds(milliseconds);
1426
+ const days = BigInt(parsed.days);
1427
+
1428
+ if (options.hideYearAndDays) {
1429
+ add((BigInt(days) * 24n) + BigInt(parsed.hours), 'hour', 'h');
1430
+ } else {
1431
+ if (options.hideYear) {
1432
+ add(days, 'day', 'd');
1433
+ } else {
1434
+ add(days / 365n, 'year', 'y');
1435
+ add(days % 365n, 'day', 'd');
1436
+ }
1437
+
1438
+ add(Number(parsed.hours), 'hour', 'h');
1439
+ }
1440
+
1441
+ add(Number(parsed.minutes), 'minute', 'm');
1442
+
1443
+ if (!options.hideSeconds) {
1444
+ if (
1445
+ options.separateMilliseconds
1446
+ || options.formatSubMilliseconds
1447
+ || (!options.colonNotation && milliseconds < 1000 && !options.subSecondsAsDecimals)
1448
+ ) {
1449
+ const seconds = Number(parsed.seconds);
1450
+ const milliseconds = Number(parsed.milliseconds);
1451
+ const microseconds = Number(parsed.microseconds);
1452
+ const nanoseconds = Number(parsed.nanoseconds);
1453
+
1454
+ add(seconds, 'second', 's');
1455
+
1456
+ if (options.formatSubMilliseconds) {
1457
+ add(milliseconds, 'millisecond', 'ms');
1458
+ add(microseconds, 'microsecond', 'µs');
1459
+ add(nanoseconds, 'nanosecond', 'ns');
1460
+ } else {
1461
+ const millisecondsAndBelow
1462
+ = milliseconds
1463
+ + (microseconds / 1000)
1464
+ + (nanoseconds / 1e6);
1465
+
1466
+ const millisecondsDecimalDigits
1467
+ = typeof options.millisecondsDecimalDigits === 'number'
1468
+ ? options.millisecondsDecimalDigits
1469
+ : 0;
1470
+
1471
+ const roundedMilliseconds = millisecondsAndBelow >= 1
1472
+ ? Math.round(millisecondsAndBelow)
1473
+ : Math.ceil(millisecondsAndBelow);
1474
+
1475
+ const millisecondsString = millisecondsDecimalDigits
1476
+ ? millisecondsAndBelow.toFixed(millisecondsDecimalDigits)
1477
+ : roundedMilliseconds;
1478
+
1479
+ add(
1480
+ Number.parseFloat(millisecondsString),
1481
+ 'millisecond',
1482
+ 'ms',
1483
+ millisecondsString,
1484
+ );
1485
+ }
1486
+ } else {
1487
+ const seconds = (
1488
+ (isBigInt ? Number(milliseconds % ONE_DAY_IN_MILLISECONDS) : milliseconds)
1489
+ / 1000
1490
+ ) % 60;
1491
+ const secondsDecimalDigits
1492
+ = typeof options.secondsDecimalDigits === 'number'
1493
+ ? options.secondsDecimalDigits
1494
+ : 1;
1495
+ const secondsFixed = floorDecimals(seconds, secondsDecimalDigits);
1496
+ const secondsString = options.keepDecimalsOnWholeSeconds
1497
+ ? secondsFixed
1498
+ : secondsFixed.replace(/\.0+$/, '');
1499
+ add(Number.parseFloat(secondsString), 'second', 's', secondsString);
1500
+ }
1501
+ }
1502
+
1503
+ if (result.length === 0) {
1504
+ return sign + '0' + (options.verbose ? ' milliseconds' : 'ms');
1505
+ }
1506
+
1507
+ const separator = options.colonNotation ? ':' : ' ';
1508
+ if (typeof options.unitCount === 'number') {
1509
+ result = result.slice(0, Math.max(options.unitCount, 1));
1510
+ }
1511
+
1512
+ return sign + result.join(separator);
1513
+ }
1514
+
1515
+ const BYTE_UNITS = [
1516
+ 'B',
1517
+ 'kB',
1518
+ 'MB',
1519
+ 'GB',
1520
+ 'TB',
1521
+ 'PB',
1522
+ 'EB',
1523
+ 'ZB',
1524
+ 'YB',
1525
+ ];
1526
+
1527
+ const BIBYTE_UNITS = [
1528
+ 'B',
1529
+ 'KiB',
1530
+ 'MiB',
1531
+ 'GiB',
1532
+ 'TiB',
1533
+ 'PiB',
1534
+ 'EiB',
1535
+ 'ZiB',
1536
+ 'YiB',
1537
+ ];
1538
+
1539
+ const BIT_UNITS = [
1540
+ 'b',
1541
+ 'kbit',
1542
+ 'Mbit',
1543
+ 'Gbit',
1544
+ 'Tbit',
1545
+ 'Pbit',
1546
+ 'Ebit',
1547
+ 'Zbit',
1548
+ 'Ybit',
1549
+ ];
1550
+
1551
+ const BIBIT_UNITS = [
1552
+ 'b',
1553
+ 'kibit',
1554
+ 'Mibit',
1555
+ 'Gibit',
1556
+ 'Tibit',
1557
+ 'Pibit',
1558
+ 'Eibit',
1559
+ 'Zibit',
1560
+ 'Yibit',
1561
+ ];
1562
+
1563
+ /*
1564
+ Formats the given number using `Number#toLocaleString`.
1565
+ - If locale is a string, the value is expected to be a locale-key (for example: `de`).
1566
+ - If locale is true, the system default locale is used for translation.
1567
+ - If no value for locale is specified, the number is returned unmodified.
1568
+ */
1569
+ const toLocaleString = (number, locale, options) => {
1570
+ let result = number;
1571
+ if (typeof locale === 'string' || Array.isArray(locale)) {
1572
+ result = number.toLocaleString(locale, options);
1573
+ } else if (locale === true || options !== undefined) {
1574
+ result = number.toLocaleString(undefined, options);
1575
+ }
1576
+
1577
+ return result;
1578
+ };
1579
+
1580
+ const log10 = numberOrBigInt => {
1581
+ if (typeof numberOrBigInt === 'number') {
1582
+ return Math.log10(numberOrBigInt);
1583
+ }
1584
+
1585
+ const string = numberOrBigInt.toString(10);
1586
+
1587
+ return string.length + Math.log10(`0.${string.slice(0, 15)}`);
1588
+ };
1589
+
1590
+ const log = numberOrBigInt => {
1591
+ if (typeof numberOrBigInt === 'number') {
1592
+ return Math.log(numberOrBigInt);
1593
+ }
1594
+
1595
+ return log10(numberOrBigInt) * Math.log(10);
1596
+ };
1597
+
1598
+ const divide = (numberOrBigInt, divisor) => {
1599
+ if (typeof numberOrBigInt === 'number') {
1600
+ return numberOrBigInt / divisor;
1601
+ }
1602
+
1603
+ const integerPart = numberOrBigInt / BigInt(divisor);
1604
+ const remainder = numberOrBigInt % BigInt(divisor);
1605
+ return Number(integerPart) + (Number(remainder) / divisor);
1606
+ };
1607
+
1608
+ const applyFixedWidth = (result, fixedWidth) => {
1609
+ if (fixedWidth === undefined) {
1610
+ return result;
1611
+ }
1612
+
1613
+ if (typeof fixedWidth !== 'number' || !Number.isSafeInteger(fixedWidth) || fixedWidth < 0) {
1614
+ throw new TypeError(`Expected fixedWidth to be a non-negative integer, got ${typeof fixedWidth}: ${fixedWidth}`);
1615
+ }
1616
+
1617
+ if (fixedWidth === 0) {
1618
+ return result;
1619
+ }
1620
+
1621
+ return result.length < fixedWidth ? result.padStart(fixedWidth, ' ') : result;
1622
+ };
1623
+
1624
+ const buildLocaleOptions = options => {
1625
+ const {minimumFractionDigits, maximumFractionDigits} = options;
1626
+
1627
+ if (minimumFractionDigits === undefined && maximumFractionDigits === undefined) {
1628
+ return undefined;
1629
+ }
1630
+
1631
+ return {
1632
+ ...(minimumFractionDigits !== undefined && {minimumFractionDigits}),
1633
+ ...(maximumFractionDigits !== undefined && {maximumFractionDigits}),
1634
+ roundingMode: 'trunc',
1635
+ };
1636
+ };
1637
+
1638
+ function prettyBytes(number, options) {
1639
+ if (typeof number !== 'bigint' && !Number.isFinite(number)) {
1640
+ throw new TypeError(`Expected a finite number, got ${typeof number}: ${number}`);
1641
+ }
1642
+
1643
+ options = {
1644
+ bits: false,
1645
+ binary: false,
1646
+ space: true,
1647
+ nonBreakingSpace: false,
1648
+ ...options,
1649
+ };
1650
+
1651
+ const UNITS = options.bits
1652
+ ? (options.binary ? BIBIT_UNITS : BIT_UNITS)
1653
+ : (options.binary ? BIBYTE_UNITS : BYTE_UNITS);
1654
+
1655
+ const separator = options.space ? (options.nonBreakingSpace ? '\u00A0' : ' ') : '';
1656
+
1657
+ // Handle signed zero case
1658
+ const isZero = typeof number === 'number' ? number === 0 : number === 0n;
1659
+ if (options.signed && isZero) {
1660
+ const result = ` 0${separator}${UNITS[0]}`;
1661
+ return applyFixedWidth(result, options.fixedWidth);
1662
+ }
1663
+
1664
+ const isNegative = number < 0;
1665
+ const prefix = isNegative ? '-' : (options.signed ? '+' : '');
1666
+
1667
+ if (isNegative) {
1668
+ number = -number;
1669
+ }
1670
+
1671
+ const localeOptions = buildLocaleOptions(options);
1672
+ let result;
1673
+
1674
+ if (number < 1) {
1675
+ const numberString = toLocaleString(number, options.locale, localeOptions);
1676
+ result = prefix + numberString + separator + UNITS[0];
1677
+ } else {
1678
+ const exponent = Math.min(Math.floor(options.binary ? log(number) / Math.log(1024) : log10(number) / 3), UNITS.length - 1);
1679
+ number = divide(number, (options.binary ? 1024 : 1000) ** exponent);
1680
+
1681
+ if (!localeOptions) {
1682
+ const minPrecision = Math.max(3, Math.floor(number).toString().length);
1683
+ number = number.toPrecision(minPrecision);
1684
+ }
1685
+
1686
+ const numberString = toLocaleString(Number(number), options.locale, localeOptions);
1687
+ const unit = UNITS[exponent];
1688
+ result = prefix + numberString + separator + unit;
1689
+ }
1690
+
1691
+ return applyFixedWidth(result, options.fixedWidth);
1692
+ }
1693
+
1694
+ function printTimings(timings) {
1695
+ for (const [label, [time, memory, total]] of Object.entries(timings)) {
1696
+ const appliedColor = label[0] === '#' ? (label[1] === '#' ? rollup.bold : rollup.underline) : (text) => text;
1697
+ const row = `${label}: ${time.toFixed(0)}ms, ${prettyBytes(memory)} / ${prettyBytes(total)}`;
1698
+ console.info(appliedColor(row));
1699
+ }
1700
+ }
1701
+
1702
+ async function build(inputOptions, warnings, silent = false) {
1703
+ const env_1 = { stack: [], error: void 0, hasError: false };
1704
+ try {
1705
+ const outputOptions = inputOptions.output;
1706
+ const useStdout = !outputOptions[0].file && !outputOptions[0].dir;
1707
+ const start = Date.now();
1708
+ const files = useStdout ? ['stdout'] : outputOptions.map(t => parseAst_js.relativeId(t.file || t.dir));
1709
+ if (!silent) {
1710
+ let inputFiles;
1711
+ if (typeof inputOptions.input === 'string') {
1712
+ inputFiles = inputOptions.input;
1713
+ }
1714
+ else if (Array.isArray(inputOptions.input)) {
1715
+ inputFiles = inputOptions.input.join(', ');
1716
+ }
1717
+ else if (typeof inputOptions.input === 'object' && inputOptions.input !== null) {
1718
+ inputFiles = Object.values(inputOptions.input).join(', ');
1719
+ }
1720
+ rollup.stderr(rollup.cyan(`\n${rollup.bold(inputFiles)} → ${rollup.bold(files.join(', '))}...`));
1721
+ }
1722
+ const bundle = __addDisposableResource(env_1, await rollup.rollup(inputOptions), true);
1723
+ if (useStdout) {
1724
+ const output = outputOptions[0];
1725
+ if (output.sourcemap && output.sourcemap !== 'inline') {
1726
+ rollup.handleError(parseAst_js.logOnlyInlineSourcemapsForStdout());
1727
+ }
1728
+ const { output: outputs } = await bundle.generate(output);
1729
+ for (const file of outputs) {
1730
+ if (outputs.length > 1)
1731
+ process$1.stdout.write(`\n${rollup.cyan(rollup.bold(`//→ ${file.fileName}:`))}\n`);
1732
+ process$1.stdout.write(file.type === 'asset' ? file.source : file.code);
1733
+ }
1734
+ if (!silent) {
1735
+ warnings.flush();
1736
+ }
1737
+ return;
1738
+ }
1739
+ await Promise.all(outputOptions.map(bundle.write));
1740
+ if (!silent) {
1741
+ warnings.flush();
1742
+ rollup.stderr(rollup.green(`created ${rollup.bold(files.join(', '))} in ${rollup.bold(prettyMilliseconds(Date.now() - start))}`));
1743
+ if (bundle && bundle.getTimings) {
1744
+ printTimings(bundle.getTimings());
1745
+ }
1746
+ }
1747
+ }
1748
+ catch (e_1) {
1749
+ env_1.error = e_1;
1750
+ env_1.hasError = true;
1751
+ }
1752
+ finally {
1753
+ const result_1 = __disposeResources(env_1);
1754
+ if (result_1)
1755
+ await result_1;
1756
+ }
1757
+ }
1758
+
1759
+ const DEFAULT_CONFIG_BASE = 'rollup.config';
1760
+ async function getConfigPath(commandConfig) {
1761
+ if (commandConfig === true) {
1762
+ return path.resolve(await findConfigFileNameInCwd());
1763
+ }
1764
+ if (commandConfig.slice(0, 5) === 'node:') {
1765
+ const packageName = commandConfig.slice(5);
1766
+ try {
1767
+ return require.resolve(`rollup-config-${packageName}`, { paths: [process$1.cwd()] });
1768
+ }
1769
+ catch {
1770
+ try {
1771
+ return require.resolve(packageName, { paths: [process$1.cwd()] });
1772
+ }
1773
+ catch (error) {
1774
+ if (error.code === 'MODULE_NOT_FOUND') {
1775
+ rollup.handleError(parseAst_js.logMissingExternalConfig(commandConfig));
1776
+ }
1777
+ throw error;
1778
+ }
1779
+ }
1780
+ }
1781
+ return path.resolve(commandConfig);
1782
+ }
1783
+ async function findConfigFileNameInCwd() {
1784
+ const filesInWorkingDirectory = new Set(await promises.readdir(process$1.cwd()));
1785
+ for (const extension of ['mjs', 'cjs', 'ts']) {
1786
+ const fileName = `${DEFAULT_CONFIG_BASE}.${extension}`;
1787
+ if (filesInWorkingDirectory.has(fileName))
1788
+ return fileName;
1789
+ }
1790
+ return `${DEFAULT_CONFIG_BASE}.js`;
1791
+ }
1792
+
1793
+ async function loadConfigFromCommand(commandOptions, watchMode) {
1794
+ const warnings = loadConfigFile_js.batchWarnings(commandOptions);
1795
+ if (!commandOptions.input && (commandOptions.stdin || !process$1.stdin.isTTY)) {
1796
+ commandOptions.input = loadConfigFile_js.stdinName;
1797
+ }
1798
+ const options = await rollup.mergeOptions({ input: [] }, watchMode, commandOptions, warnings.log);
1799
+ await loadConfigFile_js.addCommandPluginsToInputOptions(options, commandOptions);
1800
+ return { options: [options], warnings };
1801
+ }
1802
+
1803
+ async function runRollup(command) {
1804
+ let inputSource;
1805
+ if (command._.length > 0) {
1806
+ if (command.input) {
1807
+ rollup.handleError(parseAst_js.logDuplicateImportOptions());
1808
+ }
1809
+ inputSource = command._;
1810
+ }
1811
+ else if (typeof command.input === 'string') {
1812
+ inputSource = [command.input];
1813
+ }
1814
+ else {
1815
+ inputSource = command.input;
1816
+ }
1817
+ if (inputSource && inputSource.length > 0) {
1818
+ if (inputSource.some((input) => input.includes('='))) {
1819
+ command.input = {};
1820
+ for (const input of inputSource) {
1821
+ const equalsIndex = input.indexOf('=');
1822
+ const value = input.slice(Math.max(0, equalsIndex + 1));
1823
+ const key = input.slice(0, Math.max(0, equalsIndex)) || parseAst_js.getAliasName(input);
1824
+ command.input[key] = value;
1825
+ }
1826
+ }
1827
+ else {
1828
+ command.input = inputSource;
1829
+ }
1830
+ }
1831
+ if (command.environment) {
1832
+ const environment = Array.isArray(command.environment)
1833
+ ? command.environment
1834
+ : [command.environment];
1835
+ for (const argument of environment) {
1836
+ for (const pair of argument.split(',')) {
1837
+ const [key, ...value] = pair.split(':');
1838
+ process$1.env[key] = value.length === 0 ? String(true) : value.join(':');
1839
+ }
1840
+ }
1841
+ }
1842
+ if (rollup.isWatchEnabled(command.watch)) {
1843
+ await fseventsImporter.loadFsEvents();
1844
+ const { watch } = await Promise.resolve().then(() => require('../shared/watch-cli.js'));
1845
+ await watch(command);
1846
+ }
1847
+ else {
1848
+ try {
1849
+ const { options, warnings } = await getConfigs(command);
1850
+ try {
1851
+ for (const inputOptions of options) {
1852
+ if (!inputOptions.cache) {
1853
+ // We explicitly disable the cache when unused as the CLI will not
1854
+ // use the cache object on the bundle when not in watch mode. This
1855
+ // improves performance as the cache is not generated.
1856
+ inputOptions.cache = false;
1857
+ }
1858
+ await build(inputOptions, warnings, command.silent);
1859
+ }
1860
+ if (command.failAfterWarnings && warnings.warningOccurred) {
1861
+ warnings.flush();
1862
+ rollup.handleError(parseAst_js.logFailAfterWarnings());
1863
+ }
1864
+ }
1865
+ catch (error) {
1866
+ warnings.flush();
1867
+ rollup.handleError(error);
1868
+ }
1869
+ }
1870
+ catch (error) {
1871
+ rollup.handleError(error);
1872
+ }
1873
+ }
1874
+ }
1875
+ async function getConfigs(command) {
1876
+ if (command.config) {
1877
+ const configFile = await getConfigPath(command.config);
1878
+ const { options, warnings } = await loadConfigFile_js.loadConfigFile(configFile, command, false);
1879
+ return { options, warnings };
1880
+ }
1881
+ return await loadConfigFromCommand(command, false);
1882
+ }
1883
+
1884
+ const command = yargsParser(process$1.argv.slice(2), {
1885
+ alias: rollup.commandAliases,
1886
+ configuration: { 'camel-case-expansion': false }
1887
+ });
1888
+ if (command.help || (process$1.argv.length <= 2 && process$1.stdin.isTTY)) {
1889
+ console.log(`\n${help}\n`);
1890
+ }
1891
+ else if (command.version) {
1892
+ console.log(`rollup v${rollup.version}`);
1893
+ }
1894
+ else {
1895
+ try {
1896
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
1897
+ require('source-map-support').install();
1898
+ }
1899
+ catch {
1900
+ // do nothing
1901
+ }
1902
+ const promise = runRollup(command);
1903
+ if (command.forceExit) {
1904
+ promise.then(() => process$1.exit());
1905
+ }
1906
+ }
1907
+
1908
+ exports.getConfigPath = getConfigPath;
1909
+ exports.loadConfigFromCommand = loadConfigFromCommand;
1910
+ exports.prettyMilliseconds = prettyMilliseconds;
1911
+ exports.printTimings = printTimings;
1912
+ //# sourceMappingURL=rollup.map
node_modules/.bin/semver ADDED
@@ -0,0 +1,195 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env node
2
+ // Standalone semver comparison program.
3
+ // Exits successfully and prints matching version(s) if
4
+ // any supplied version is valid and passes all tests.
5
+
6
+ 'use strict'
7
+
8
+ const argv = process.argv.slice(2)
9
+
10
+ let versions = []
11
+
12
+ const range = []
13
+
14
+ let inc = null
15
+
16
+ const version = require('../package.json').version
17
+
18
+ let loose = false
19
+
20
+ let includePrerelease = false
21
+
22
+ let coerce = false
23
+
24
+ let rtl = false
25
+
26
+ let identifier
27
+
28
+ let identifierBase
29
+
30
+ const semver = require('../')
31
+ const parseOptions = require('../internal/parse-options')
32
+
33
+ let reverse = false
34
+
35
+ let options = {}
36
+
37
+ const main = () => {
38
+ if (!argv.length) {
39
+ return help()
40
+ }
41
+ while (argv.length) {
42
+ let a = argv.shift()
43
+ const indexOfEqualSign = a.indexOf('=')
44
+ if (indexOfEqualSign !== -1) {
45
+ const value = a.slice(indexOfEqualSign + 1)
46
+ a = a.slice(0, indexOfEqualSign)
47
+ argv.unshift(value)
48
+ }
49
+
50
+ switch (a) {
51
+ case '-rv': case '-rev': case '--rev': case '--reverse':
52
+ reverse = true
53
+ break
54
+ case '-l': case '--loose':
55
+ loose = true
56
+ break
57
+ case '-p': case '--include-prerelease':
58
+ includePrerelease = true
59
+ break
60
+ case '-v': case '--version':
61
+ versions.push(argv.shift())
62
+ break
63
+ case '-i': case '--inc': case '--increment':
64
+ if (semver.RELEASE_TYPES.includes(argv[0]) || (argv[0] === 'release')) {
65
+ inc = { value: argv.shift(), maybeErrantValue: null, option: a }
66
+ } else {
67
+ inc = { value: 'patch', maybeErrantValue: argv[0], option: a }
68
+ }
69
+ break
70
+ case '--preid':
71
+ identifier = argv.shift()
72
+ break
73
+ case '-r': case '--range':
74
+ range.push(argv.shift())
75
+ break
76
+ case '-n':
77
+ identifierBase = argv.shift()
78
+ if (identifierBase === 'false') {
79
+ identifierBase = false
80
+ }
81
+ break
82
+ case '-c': case '--coerce':
83
+ coerce = true
84
+ break
85
+ case '--rtl':
86
+ rtl = true
87
+ break
88
+ case '--ltr':
89
+ rtl = false
90
+ break
91
+ case '-h': case '--help': case '-?':
92
+ return help()
93
+ default:
94
+ versions.push(a)
95
+ break
96
+ }
97
+ }
98
+
99
+ options = parseOptions({ loose, includePrerelease, rtl })
100
+
101
+ if (
102
+ inc &&
103
+ versions.includes(inc.maybeErrantValue) &&
104
+ !semver.valid(inc.maybeErrantValue, options)
105
+ ) {
106
+ console.warn(`Invalid value for ${inc.option}; defaulting to 'patch'. This may become a failure in future major versions.`)
107
+ }
108
+
109
+ versions = versions.map((v) => {
110
+ return coerce ? (semver.coerce(v, options) || { version: v }).version : v
111
+ }).filter((v) => {
112
+ return semver.valid(v, options)
113
+ })
114
+ if (!versions.length) {
115
+ return fail()
116
+ }
117
+ if (inc && (versions.length !== 1 || range.length)) {
118
+ return failInc()
119
+ }
120
+
121
+ for (let i = 0, l = range.length; i < l; i++) {
122
+ versions = versions.filter((v) => {
123
+ return semver.satisfies(v, range[i], options)
124
+ })
125
+ if (!versions.length) {
126
+ return fail()
127
+ }
128
+ }
129
+ versions
130
+ .sort((a, b) => semver[reverse ? 'rcompare' : 'compare'](a, b, options))
131
+ .map(v => semver.clean(v, options))
132
+ .map(v => inc ? semver.inc(v, inc.value, options, identifier, identifierBase) : v)
133
+ .forEach(v => console.log(v))
134
+ }
135
+
136
+ const failInc = () => {
137
+ console.error('--inc can only be used on a single version with no range')
138
+ fail()
139
+ }
140
+
141
+ const fail = () => process.exit(1)
142
+
143
+ const help = () => console.log(
144
+ `SemVer ${version}
145
+
146
+ A JavaScript implementation of the https://semver.org/ specification
147
+ Copyright Isaac Z. Schlueter
148
+
149
+ Usage: semver [options] <version> [<version> [...]]
150
+ Prints valid versions sorted by SemVer precedence
151
+
152
+ Options:
153
+ -r --range <range>
154
+ Print versions that match the specified range.
155
+
156
+ -i --increment [<level>]
157
+ Increment a version by the specified level. Level can
158
+ be one of: major, minor, patch, premajor, preminor,
159
+ prepatch, prerelease, or release. Default level is 'patch'.
160
+ Only one version may be specified.
161
+
162
+ --preid <identifier>
163
+ Identifier to be used to prefix premajor, preminor,
164
+ prepatch or prerelease version increments.
165
+
166
+ -l --loose
167
+ Interpret versions and ranges loosely
168
+
169
+ -p --include-prerelease
170
+ Always include prerelease versions in range matching
171
+
172
+ -c --coerce
173
+ Coerce a string into SemVer if possible
174
+ (does not imply --loose)
175
+
176
+ --rtl
177
+ Coerce version strings right to left
178
+
179
+ --ltr
180
+ Coerce version strings left to right (default)
181
+
182
+ -n <base>
183
+ Base number to be used for the prerelease identifier.
184
+ Can be either 0 or 1, or false to omit the number altogether.
185
+ Defaults to 0.
186
+
187
+ Program exits successfully if any valid version satisfies
188
+ all supplied ranges, and prints all satisfying versions.
189
+
190
+ If no satisfying versions are found, then exits failure.
191
+
192
+ Versions are printed in ascending order, so supplying
193
+ multiple versions to the utility will just sort them.`)
194
+
195
+ main()
node_modules/.bin/specificity ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env node
2
+ import Specificity from '../dist/index.js';
3
+
4
+ if (!process.argv[2]) {
5
+ console.error('❌ Missing selector argument');
6
+ process.exit(1);
7
+ }
8
+
9
+ try {
10
+ const specificities = Specificity.calculate(process.argv[2]);
11
+ console.log(specificities.map((specificity) => `${specificity}`).join('\n'));
12
+ } catch (e) {
13
+ console.error(`❌ ${e.message}`);
14
+ }
node_modules/.bin/sucrase ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ #!/usr/bin/env node
2
+
3
+ require("../dist/cli").default();
node_modules/.bin/sucrase-node ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env node
2
+ const Module = require("module");
3
+ const {resolve} = require("path");
4
+
5
+ /*
6
+ * Simple wrapper around node that first registers Sucrase with default settings.
7
+ *
8
+ * This is meant for simple use cases, and doesn't support custom Node/V8 args,
9
+ * executing a code snippet, a REPL, or other things that you might find in
10
+ * node, babel-node, or ts-node. For more advanced use cases, you can use
11
+ * `node -r sucrase/register` or register a require hook programmatically from
12
+ * your own code.
13
+ */
14
+ require("../register");
15
+
16
+ process.argv.splice(1, 1);
17
+ process.argv[1] = resolve(process.argv[1]);
18
+ Module.runMain();
node_modules/.bin/tailwind ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ module.exports = require("./cli/index");
node_modules/.bin/tailwindcss ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ module.exports = require("./cli/index");
node_modules/.bin/terser ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env node
2
+
3
+ "use strict";
4
+
5
+ require("../tools/exit.cjs");
6
+
7
+ try {
8
+ require("source-map-support").install();
9
+ } catch (err) {}
10
+
11
+ const fs = require("fs");
12
+ const path = require("path");
13
+ const program = require("commander");
14
+
15
+ const packageJson = require("../package.json");
16
+ const { _run_cli: run_cli } = require("..");
17
+
18
+ run_cli({ program, packageJson, fs, path }).catch((error) => {
19
+ console.error(error);
20
+ process.exitCode = 1;
21
+ });
node_modules/.bin/tldts ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env node
2
+
3
+ 'use strict';
4
+
5
+ const { parse } = require('..');
6
+ const readline = require('readline');
7
+
8
+ if (process.argv.length > 2) {
9
+ // URL(s) was specified in the command arguments
10
+ console.log(
11
+ JSON.stringify(parse(process.argv[process.argv.length - 1]), null, 2),
12
+ );
13
+ } else {
14
+ // No arguments were specified, read URLs from each line of STDIN
15
+ const rlInterface = readline.createInterface({
16
+ input: process.stdin,
17
+ });
18
+ rlInterface.on('line', function (line) {
19
+ console.log(JSON.stringify(parse(line), null, 2));
20
+ });
21
+ }
node_modules/.bin/topo2geo ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env node
2
+
3
+ var fs = require("fs"),
4
+ path = require("path"),
5
+ commander = require("commander"),
6
+ topojson = require("../");
7
+
8
+ commander
9
+ .version(require("../package.json").version)
10
+ .usage("[options] <name=file>…")
11
+ .description("Converts TopoJSON objects to GeoJSON features.")
12
+ .option("-i, --in <file>", "input topology file name; defaults to “-” for stdin", "-")
13
+ .option("-l, --list", "list the object names on the input topology")
14
+ .option("-n, --newline-delimited", "output newline-delimited JSON")
15
+ .parse(process.argv);
16
+
17
+ if (!commander.list === commander.args.length < 1) {
18
+ console.error();
19
+ console.error(" error: " + (commander.list ? "--list does not take arguments" : "no arguments specified"));
20
+ console.error();
21
+ process.exit(1);
22
+ }
23
+
24
+ read(commander.in).then(write).catch(abort);
25
+
26
+ function read(file) {
27
+ return new Promise(function(resolve, reject) {
28
+ var data = [];
29
+ readStream(file)
30
+ .on("data", function(d) { data.push(d); })
31
+ .on("end", function() { resolve(JSON.parse(Buffer.concat(data))); })
32
+ .on("error", reject);
33
+ });
34
+ }
35
+
36
+ function readStream(file) {
37
+ return file === "-" ? process.stdin : fs.createReadStream(file);
38
+ }
39
+
40
+ function write(topology) {
41
+ var write, writer = commander.newlineDelimited ? writeNewlineDelimitedFeature : writeFeature, name;
42
+ if (commander.list) {
43
+ for (name in topology.objects) {
44
+ console.log(name);
45
+ }
46
+ return;
47
+ }
48
+ write = Promise.resolve();
49
+ commander.args.forEach(function(specifier) {
50
+ var i = specifier.indexOf("="),
51
+ file = i >= 0 ? specifier.slice(i + 1) : specifier,
52
+ name = i >= 0 ? specifier.slice(0, i) : path.basename(specifier, path.extname(specifier));
53
+ if (!(name in topology.objects)) {
54
+ console.error();
55
+ console.error(" error: object “" + name + "” not found");
56
+ console.error();
57
+ process.exit(1);
58
+ }
59
+ write = write.then(writer(file, topojson.feature(topology, topology.objects[name])));
60
+ });
61
+ return write;
62
+ }
63
+
64
+ function writeStream(file) {
65
+ return (file === "-" ? process.stdout : fs.createWriteStream(file)).on("error", handleEpipe);
66
+ }
67
+
68
+ function writeFeature(file, feature) {
69
+ return new Promise(function(resolve, reject) {
70
+ writeStream(file).on("error", reject)[file === "-" ? "write" : "end"](JSON.stringify(feature) + "\n", function(error) {
71
+ if (error) reject(error);
72
+ else resolve();
73
+ });
74
+ });
75
+ }
76
+
77
+ function writeNewlineDelimitedFeature(file, feature) {
78
+ return feature == null || feature.type != "FeatureCollection" ? writeFeature(file, feature) : new Promise(function(resolve, reject) {
79
+ var stream = writeStream(file).on("error", reject), i = -1, n = feature.features.length;
80
+
81
+ (function writeNext(error) {
82
+ if (error) return void reject(error);
83
+ if (++i >= n) {
84
+ if (file !== "-") stream.end(writeEnd);
85
+ else writeEnd();
86
+ } else {
87
+ stream.write(JSON.stringify(feature.features[i]) + "\n", writeNext);
88
+ }
89
+ })(null);
90
+
91
+ function writeEnd(error) {
92
+ if (error) return void reject(error);
93
+ resolve();
94
+ }
95
+ });
96
+ }
97
+
98
+ function handleEpipe(error) {
99
+ if (error.code === "EPIPE" || error.errno === "EPIPE") {
100
+ process.exit(0);
101
+ }
102
+ }
103
+
104
+ function abort(error) {
105
+ console.error(error.stack);
106
+ }
node_modules/.bin/topomerge ADDED
@@ -0,0 +1,216 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env node
2
+
3
+ var fs = require("fs"),
4
+ vm = require("vm"),
5
+ commander = require("commander"),
6
+ topojson = require("../");
7
+
8
+ commander
9
+ .version(require("../package.json").version)
10
+ .usage("[options] <target=source> [file]")
11
+ .description("Merges the source TopoJSON geometry collection, assigning to the target.")
12
+ .option("-o, --out <file>", "output topology file name; defaults to “-” for stdout", "-")
13
+ .option("-k, --key <expression>", "group geometries by key")
14
+ .option("-f, --filter <expression>", "filter merged geometries or meshed lines")
15
+ .option("--mesh", "mesh lines instead of merging polygons")
16
+ .parse(process.argv);
17
+
18
+ if (commander.args.length < 1) {
19
+ console.error();
20
+ console.error(" error: missing source and target names");
21
+ console.error();
22
+ process.exit(1);
23
+ } else if (commander.args.length > 2) {
24
+ console.error();
25
+ console.error(" error: multiple input files");
26
+ console.error();
27
+ process.exit(1);
28
+ } else if (commander.args.length === 1) {
29
+ commander.args.push("-");
30
+ }
31
+
32
+ var keyFunction = function() {},
33
+ postfilterFunction = function() { return true; },
34
+ prefilterFunction = function() { return true; };
35
+
36
+ if (commander.key != null) {
37
+ var keySandbox = {d: undefined, i: -1},
38
+ keyContext = new vm.createContext(keySandbox),
39
+ keyScript = new vm.Script("(" + commander.key + ")");
40
+ keyFunction = function(d, i) {
41
+ keySandbox.d = d;
42
+ keySandbox.i = i;
43
+ return keyScript.runInContext(keyContext);
44
+ };
45
+ }
46
+
47
+ if (commander.filter != null) {
48
+ if (commander.mesh) {
49
+ var filterSandbox = {a: undefined, b: undefined},
50
+ filterContext = new vm.createContext(filterSandbox),
51
+ filterScript = new vm.Script("(" + commander.filter + ")");
52
+ postfilterFunction = function(a, b) {
53
+ filterSandbox.a = a;
54
+ filterSandbox.b = b;
55
+ return filterScript.runInContext(filterContext);
56
+ };
57
+ } else {
58
+ var filterSandbox = {d: undefined, i: -1},
59
+ filterContext = new vm.createContext(filterSandbox),
60
+ filterScript = new vm.Script("(" + commander.filter + ")");
61
+ prefilterFunction = function(d, i) {
62
+ filterSandbox.d = d;
63
+ filterSandbox.i = i;
64
+ return filterScript.runInContext(filterContext);
65
+ };
66
+ }
67
+ }
68
+
69
+ read(commander.args[1]).then(merge).then(write(commander.out)).catch(abort);
70
+
71
+ function read(file) {
72
+ return new Promise(function(resolve, reject) {
73
+ var data = [], stream = file === "-" ? process.stdin : fs.createReadStream(file);
74
+ stream
75
+ .on("data", function(d) { data.push(d); })
76
+ .on("end", function() { resolve(JSON.parse(Buffer.concat(data))); })
77
+ .on("error", reject);
78
+ });
79
+ }
80
+
81
+ function merge(topology) {
82
+ var name = commander.args[0], i = name.indexOf("="),
83
+ sourceName = i >= 0 ? name.slice(i + 1) : name,
84
+ targetName = i >= 0 ? name.slice(0, i) : name,
85
+ source = topology.objects[sourceName],
86
+ target = topology.objects[targetName] = {type: "GeometryCollection", geometries: []},
87
+ geometries = target.geometries,
88
+ geometriesByKey = {},
89
+ k;
90
+
91
+ if (!source) {
92
+ console.error();
93
+ console.error(" error: source object “" + name + "” not found");
94
+ console.error();
95
+ process.exit(1);
96
+ }
97
+
98
+ if (source.type !== "GeometryCollection") {
99
+ console.error();
100
+ console.error(" error: expected GeometryCollection, not " + source.type);
101
+ console.error();
102
+ process.exit(1);
103
+ }
104
+
105
+ source.geometries.forEach(function(geometry, i) {
106
+ if (!prefilterFunction(geometry, i)) return;
107
+ var k = stringify(keyFunction(geometry, i)), v;
108
+ if (v = geometriesByKey[k]) v.push(geometry);
109
+ else geometriesByKey[k] = v = [geometry];
110
+ });
111
+
112
+ if (commander.mesh) {
113
+ for (k in geometriesByKey) {
114
+ var v = geometriesByKey[k],
115
+ o = topojson.meshArcs(topology, {type: "GeometryCollection", geometries: v}, postfilterFunction);
116
+ o.id = k.length > 1 ? k.slice(1) : undefined;
117
+ o.properties = properties(v);
118
+ geometries.push(o);
119
+ }
120
+ } else {
121
+ for (k in geometriesByKey) {
122
+ var v = geometriesByKey[k],
123
+ o = topojson.mergeArcs(topology, v);
124
+ o.id = k.length > 1 ? k.slice(1) : undefined;
125
+ o.properties = properties(v);
126
+ geometries.push(o);
127
+ }
128
+ }
129
+
130
+ return topology;
131
+ }
132
+
133
+ function stringify(key) {
134
+ return key == null ? "$" : "$" + key;
135
+ }
136
+
137
+ function properties(objects) {
138
+ var properties = undefined, hasProperties;
139
+
140
+ objects.forEach(function(object) {
141
+ var newProperties = object.properties, key;
142
+
143
+ // If no properties have yet been merged,
144
+ // then we need to initialize the merged properties object.
145
+ if (properties === undefined) {
146
+
147
+ // If the first set of properties is null, undefined or empty,
148
+ // then the result of the merge will be the empty set.
149
+ // Otherwise, the new properties can copied into the merged object.
150
+ if (newProperties != null) for (key in newProperties) {
151
+ properties = {};
152
+ for (key in newProperties) properties[key] = newProperties[key];
153
+ return;
154
+ }
155
+
156
+ properties = null;
157
+ return;
158
+ }
159
+
160
+ // If any of the new properties are null or undefined,
161
+ // then the result of the merge will be the empty set.
162
+ if (newProperties == null) properties = null;
163
+ if (properties === null) return;
164
+
165
+ // Now mark as inconsistent any of the properties
166
+ // that differ from previously-merged values.
167
+ for (key in newProperties) {
168
+ if ((key in properties) && !is(properties[key], newProperties[key])) {
169
+ properties[key] = undefined;
170
+ }
171
+ }
172
+
173
+ // And mark as inconsistent any of the properties
174
+ // that are missing from this new set of merged values.
175
+ for (key in properties) {
176
+ if (!(key in newProperties)) {
177
+ properties[key] = undefined;
178
+ }
179
+ }
180
+
181
+ return object;
182
+ });
183
+
184
+ // Return undefined if there are no properties.
185
+ for (var key in properties) {
186
+ if (properties[key] !== undefined) {
187
+ return properties;
188
+ }
189
+ }
190
+ };
191
+
192
+ function write(file) {
193
+ var stream = (file === "-" ? process.stdout : fs.createWriteStream(file)).on("error", handleEpipe);
194
+ return function(topology) {
195
+ return new Promise(function(resolve, reject) {
196
+ stream.on("error", reject)[stream === process.stdout ? "write" : "end"](JSON.stringify(topology) + "\n", function(error) {
197
+ if (error) reject(error);
198
+ else resolve();
199
+ });
200
+ });
201
+ };
202
+ }
203
+
204
+ function handleEpipe(error) {
205
+ if (error.code === "EPIPE" || error.errno === "EPIPE") {
206
+ process.exit(0);
207
+ }
208
+ }
209
+
210
+ function abort(error) {
211
+ console.error(error.stack);
212
+ }
213
+
214
+ function is(x, y) {
215
+ return x === y ? x !== 0 || 1 / x === 1 / y : x !== x && y !== y;
216
+ }
node_modules/.bin/topoquantize ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env node
2
+
3
+ var fs = require("fs"),
4
+ commander = require("commander"),
5
+ topojson = require("../");
6
+
7
+ commander
8
+ .version(require("../package.json").version)
9
+ .usage("[options] <n> [file]")
10
+ .description("Quantizes TopoJSON.")
11
+ .option("-o, --out <file>", "output topology file name; defaults to “-” for stdout", "-")
12
+ .parse(process.argv);
13
+
14
+ if (commander.args.length < 1) {
15
+ console.error();
16
+ console.error(" error: missing quantization parameter n");
17
+ console.error();
18
+ process.exit(1);
19
+ } else if (commander.args.length > 2) {
20
+ console.error();
21
+ console.error(" error: multiple input files");
22
+ console.error();
23
+ process.exit(1);
24
+ } else if (commander.args.length === 1) {
25
+ commander.args.push("-");
26
+ }
27
+
28
+ if (!(Math.floor(commander.args[0]) >= 2)) {
29
+ console.error();
30
+ console.error(" error: invalid quantization parameter " + commander.args[0]);
31
+ console.error();
32
+ process.exit(1);
33
+ }
34
+
35
+ read(commander.args[1]).then(quantize).then(write(commander.out)).catch(abort);
36
+
37
+ function read(file) {
38
+ return new Promise(function(resolve, reject) {
39
+ var data = [], stream = file === "-" ? process.stdin : fs.createReadStream(file);
40
+ stream
41
+ .on("data", function(d) { data.push(d); })
42
+ .on("end", function() { resolve(JSON.parse(Buffer.concat(data))); })
43
+ .on("error", reject);
44
+ });
45
+ }
46
+
47
+ function quantize(topology) {
48
+ return topojson.quantize(topology, +commander.args[0]);
49
+ }
50
+
51
+ function write(file) {
52
+ var stream = (file === "-" ? process.stdout : fs.createWriteStream(file)).on("error", handleEpipe);
53
+ return function(topology) {
54
+ return new Promise(function(resolve, reject) {
55
+ stream.on("error", reject)[stream === process.stdout ? "write" : "end"](JSON.stringify(topology) + "\n", function(error) {
56
+ if (error) reject(error);
57
+ else resolve();
58
+ });
59
+ });
60
+ };
61
+ }
62
+
63
+ function handleEpipe(error) {
64
+ if (error.code === "EPIPE" || error.errno === "EPIPE") {
65
+ process.exit(0);
66
+ }
67
+ }
68
+
69
+ function abort(error) {
70
+ console.error();
71
+ console.error(" error: " + error.message);
72
+ console.error();
73
+ process.exit(1);
74
+ }