vaderjs 1.3.2 → 1.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (116) hide show
  1. package/create-vader-app/example_proj/dist/vaderjs/index.js +5 -0
  2. package/create-vader-app/example_proj/dist/vaderjs/vader-min.js +1115 -0
  3. package/create-vader-app/example_proj/dist/vaderjs/vaderRouter-min.js +1 -0
  4. package/create-vader-app/example_proj/dist/vaderjs/worker.js +327 -0
  5. package/create-vader-app/example_proj/index.html +20 -0
  6. package/create-vader-app/example_proj/readme.md +2 -0
  7. package/create-vader-app/example_proj/src/pages/Index.js +13 -0
  8. package/create-vader-app/example_proj/src/views/app.html +16 -0
  9. package/create-vader-app/index.js +20 -0
  10. package/create-vader-app/node_modules/.package-lock.json +350 -0
  11. package/create-vader-app/node_modules/chalk/license +9 -0
  12. package/create-vader-app/node_modules/chalk/package.json +83 -0
  13. package/create-vader-app/node_modules/chalk/readme.md +325 -0
  14. package/create-vader-app/node_modules/chalk/source/index.d.ts +320 -0
  15. package/create-vader-app/node_modules/chalk/source/index.js +225 -0
  16. package/create-vader-app/node_modules/chalk/source/utilities.js +33 -0
  17. package/create-vader-app/node_modules/chalk/source/vendor/ansi-styles/index.d.ts +236 -0
  18. package/create-vader-app/node_modules/chalk/source/vendor/ansi-styles/index.js +223 -0
  19. package/create-vader-app/node_modules/chalk/source/vendor/supports-color/browser.d.ts +1 -0
  20. package/create-vader-app/node_modules/chalk/source/vendor/supports-color/browser.js +30 -0
  21. package/create-vader-app/node_modules/chalk/source/vendor/supports-color/index.d.ts +55 -0
  22. package/create-vader-app/node_modules/chalk/source/vendor/supports-color/index.js +182 -0
  23. package/create-vader-app/node_modules/commander/LICENSE +22 -0
  24. package/create-vader-app/node_modules/commander/Readme.md +1146 -0
  25. package/create-vader-app/node_modules/commander/esm.mjs +16 -0
  26. package/create-vader-app/node_modules/commander/index.js +27 -0
  27. package/create-vader-app/node_modules/commander/lib/argument.js +147 -0
  28. package/create-vader-app/node_modules/commander/lib/command.js +2196 -0
  29. package/create-vader-app/node_modules/commander/lib/error.js +45 -0
  30. package/create-vader-app/node_modules/commander/lib/help.js +464 -0
  31. package/create-vader-app/node_modules/commander/lib/option.js +331 -0
  32. package/create-vader-app/node_modules/commander/lib/suggestSimilar.js +100 -0
  33. package/create-vader-app/node_modules/commander/package-support.json +16 -0
  34. package/create-vader-app/node_modules/commander/package.json +90 -0
  35. package/create-vader-app/node_modules/commander/typings/esm.d.mts +3 -0
  36. package/create-vader-app/node_modules/commander/typings/index.d.ts +889 -0
  37. package/create-vader-app/node_modules/fs-extra/LICENSE +15 -0
  38. package/create-vader-app/node_modules/fs-extra/README.md +292 -0
  39. package/create-vader-app/node_modules/fs-extra/lib/copy/copy-sync.js +161 -0
  40. package/create-vader-app/node_modules/fs-extra/lib/copy/copy.js +238 -0
  41. package/create-vader-app/node_modules/fs-extra/lib/copy/index.js +7 -0
  42. package/create-vader-app/node_modules/fs-extra/lib/empty/index.js +39 -0
  43. package/create-vader-app/node_modules/fs-extra/lib/ensure/file.js +69 -0
  44. package/create-vader-app/node_modules/fs-extra/lib/ensure/index.js +23 -0
  45. package/create-vader-app/node_modules/fs-extra/lib/ensure/link.js +64 -0
  46. package/create-vader-app/node_modules/fs-extra/lib/ensure/symlink-paths.js +99 -0
  47. package/create-vader-app/node_modules/fs-extra/lib/ensure/symlink-type.js +31 -0
  48. package/create-vader-app/node_modules/fs-extra/lib/ensure/symlink.js +82 -0
  49. package/create-vader-app/node_modules/fs-extra/lib/esm.mjs +68 -0
  50. package/create-vader-app/node_modules/fs-extra/lib/fs/index.js +140 -0
  51. package/create-vader-app/node_modules/fs-extra/lib/index.js +16 -0
  52. package/create-vader-app/node_modules/fs-extra/lib/json/index.js +16 -0
  53. package/create-vader-app/node_modules/fs-extra/lib/json/jsonfile.js +11 -0
  54. package/create-vader-app/node_modules/fs-extra/lib/json/output-json-sync.js +12 -0
  55. package/create-vader-app/node_modules/fs-extra/lib/json/output-json.js +12 -0
  56. package/create-vader-app/node_modules/fs-extra/lib/mkdirs/index.js +14 -0
  57. package/create-vader-app/node_modules/fs-extra/lib/mkdirs/make-dir.js +27 -0
  58. package/create-vader-app/node_modules/fs-extra/lib/mkdirs/utils.js +21 -0
  59. package/create-vader-app/node_modules/fs-extra/lib/move/index.js +7 -0
  60. package/create-vader-app/node_modules/fs-extra/lib/move/move-sync.js +55 -0
  61. package/create-vader-app/node_modules/fs-extra/lib/move/move.js +76 -0
  62. package/create-vader-app/node_modules/fs-extra/lib/output-file/index.js +40 -0
  63. package/create-vader-app/node_modules/fs-extra/lib/path-exists/index.js +12 -0
  64. package/create-vader-app/node_modules/fs-extra/lib/remove/index.js +17 -0
  65. package/create-vader-app/node_modules/fs-extra/lib/util/stat.js +154 -0
  66. package/create-vader-app/node_modules/fs-extra/lib/util/utimes.js +26 -0
  67. package/create-vader-app/node_modules/fs-extra/package.json +71 -0
  68. package/create-vader-app/node_modules/graceful-fs/LICENSE +15 -0
  69. package/create-vader-app/node_modules/graceful-fs/README.md +143 -0
  70. package/create-vader-app/node_modules/graceful-fs/clone.js +23 -0
  71. package/create-vader-app/node_modules/graceful-fs/graceful-fs.js +448 -0
  72. package/create-vader-app/node_modules/graceful-fs/legacy-streams.js +118 -0
  73. package/create-vader-app/node_modules/graceful-fs/package.json +53 -0
  74. package/create-vader-app/node_modules/graceful-fs/polyfills.js +355 -0
  75. package/create-vader-app/node_modules/inherits/LICENSE +16 -0
  76. package/create-vader-app/node_modules/inherits/README.md +42 -0
  77. package/create-vader-app/node_modules/inherits/inherits.js +7 -0
  78. package/create-vader-app/node_modules/inherits/inherits_browser.js +23 -0
  79. package/create-vader-app/node_modules/inherits/package.json +29 -0
  80. package/create-vader-app/node_modules/jsonfile/CHANGELOG.md +171 -0
  81. package/create-vader-app/node_modules/jsonfile/LICENSE +15 -0
  82. package/create-vader-app/node_modules/jsonfile/README.md +230 -0
  83. package/create-vader-app/node_modules/jsonfile/index.js +88 -0
  84. package/create-vader-app/node_modules/jsonfile/package.json +40 -0
  85. package/create-vader-app/node_modules/jsonfile/utils.js +14 -0
  86. package/create-vader-app/node_modules/path/LICENSE +18 -0
  87. package/create-vader-app/node_modules/path/README.md +15 -0
  88. package/create-vader-app/node_modules/path/package.json +24 -0
  89. package/create-vader-app/node_modules/path/path.js +628 -0
  90. package/create-vader-app/node_modules/process/.eslintrc +21 -0
  91. package/create-vader-app/node_modules/process/LICENSE +22 -0
  92. package/create-vader-app/node_modules/process/README.md +26 -0
  93. package/create-vader-app/node_modules/process/browser.js +184 -0
  94. package/create-vader-app/node_modules/process/index.js +2 -0
  95. package/create-vader-app/node_modules/process/package.json +27 -0
  96. package/create-vader-app/node_modules/process/test.js +199 -0
  97. package/create-vader-app/node_modules/universalify/LICENSE +20 -0
  98. package/create-vader-app/node_modules/universalify/README.md +76 -0
  99. package/create-vader-app/node_modules/universalify/index.js +24 -0
  100. package/create-vader-app/node_modules/universalify/package.json +34 -0
  101. package/create-vader-app/node_modules/util/LICENSE +18 -0
  102. package/create-vader-app/node_modules/util/README.md +15 -0
  103. package/create-vader-app/node_modules/util/package.json +35 -0
  104. package/create-vader-app/node_modules/util/support/isBuffer.js +3 -0
  105. package/create-vader-app/node_modules/util/support/isBufferBrowser.js +6 -0
  106. package/create-vader-app/node_modules/util/util.js +586 -0
  107. package/create-vader-app/package-lock.json +384 -0
  108. package/create-vader-app/package.json +18 -0
  109. package/images/router.png +0 -0
  110. package/images/state.png +0 -0
  111. package/package.json +1 -1
  112. package/ts.config.json +1 -0
  113. package/vader-min.js +1 -1
  114. package/vader.js +106 -326
  115. package/worker-min.js +1 -1
  116. package/worker.js +268 -168
@@ -0,0 +1,331 @@
1
+ const { InvalidArgumentError } = require('./error.js');
2
+
3
+ // @ts-check
4
+
5
+ class Option {
6
+ /**
7
+ * Initialize a new `Option` with the given `flags` and `description`.
8
+ *
9
+ * @param {string} flags
10
+ * @param {string} [description]
11
+ */
12
+
13
+ constructor(flags, description) {
14
+ this.flags = flags;
15
+ this.description = description || '';
16
+
17
+ this.required = flags.includes('<'); // A value must be supplied when the option is specified.
18
+ this.optional = flags.includes('['); // A value is optional when the option is specified.
19
+ // variadic test ignores <value,...> et al which might be used to describe custom splitting of single argument
20
+ this.variadic = /\w\.\.\.[>\]]$/.test(flags); // The option can take multiple values.
21
+ this.mandatory = false; // The option must have a value after parsing, which usually means it must be specified on command line.
22
+ const optionFlags = splitOptionFlags(flags);
23
+ this.short = optionFlags.shortFlag;
24
+ this.long = optionFlags.longFlag;
25
+ this.negate = false;
26
+ if (this.long) {
27
+ this.negate = this.long.startsWith('--no-');
28
+ }
29
+ this.defaultValue = undefined;
30
+ this.defaultValueDescription = undefined;
31
+ this.presetArg = undefined;
32
+ this.envVar = undefined;
33
+ this.parseArg = undefined;
34
+ this.hidden = false;
35
+ this.argChoices = undefined;
36
+ this.conflictsWith = [];
37
+ this.implied = undefined;
38
+ }
39
+
40
+ /**
41
+ * Set the default value, and optionally supply the description to be displayed in the help.
42
+ *
43
+ * @param {any} value
44
+ * @param {string} [description]
45
+ * @return {Option}
46
+ */
47
+
48
+ default(value, description) {
49
+ this.defaultValue = value;
50
+ this.defaultValueDescription = description;
51
+ return this;
52
+ }
53
+
54
+ /**
55
+ * Preset to use when option used without option-argument, especially optional but also boolean and negated.
56
+ * The custom processing (parseArg) is called.
57
+ *
58
+ * @example
59
+ * new Option('--color').default('GREYSCALE').preset('RGB');
60
+ * new Option('--donate [amount]').preset('20').argParser(parseFloat);
61
+ *
62
+ * @param {any} arg
63
+ * @return {Option}
64
+ */
65
+
66
+ preset(arg) {
67
+ this.presetArg = arg;
68
+ return this;
69
+ }
70
+
71
+ /**
72
+ * Add option name(s) that conflict with this option.
73
+ * An error will be displayed if conflicting options are found during parsing.
74
+ *
75
+ * @example
76
+ * new Option('--rgb').conflicts('cmyk');
77
+ * new Option('--js').conflicts(['ts', 'jsx']);
78
+ *
79
+ * @param {string | string[]} names
80
+ * @return {Option}
81
+ */
82
+
83
+ conflicts(names) {
84
+ this.conflictsWith = this.conflictsWith.concat(names);
85
+ return this;
86
+ }
87
+
88
+ /**
89
+ * Specify implied option values for when this option is set and the implied options are not.
90
+ *
91
+ * The custom processing (parseArg) is not called on the implied values.
92
+ *
93
+ * @example
94
+ * program
95
+ * .addOption(new Option('--log', 'write logging information to file'))
96
+ * .addOption(new Option('--trace', 'log extra details').implies({ log: 'trace.txt' }));
97
+ *
98
+ * @param {Object} impliedOptionValues
99
+ * @return {Option}
100
+ */
101
+ implies(impliedOptionValues) {
102
+ let newImplied = impliedOptionValues;
103
+ if (typeof impliedOptionValues === 'string') {
104
+ // string is not documented, but easy mistake and we can do what user probably intended.
105
+ newImplied = { [impliedOptionValues]: true };
106
+ }
107
+ this.implied = Object.assign(this.implied || {}, newImplied);
108
+ return this;
109
+ }
110
+
111
+ /**
112
+ * Set environment variable to check for option value.
113
+ *
114
+ * An environment variable is only used if when processed the current option value is
115
+ * undefined, or the source of the current value is 'default' or 'config' or 'env'.
116
+ *
117
+ * @param {string} name
118
+ * @return {Option}
119
+ */
120
+
121
+ env(name) {
122
+ this.envVar = name;
123
+ return this;
124
+ }
125
+
126
+ /**
127
+ * Set the custom handler for processing CLI option arguments into option values.
128
+ *
129
+ * @param {Function} [fn]
130
+ * @return {Option}
131
+ */
132
+
133
+ argParser(fn) {
134
+ this.parseArg = fn;
135
+ return this;
136
+ }
137
+
138
+ /**
139
+ * Whether the option is mandatory and must have a value after parsing.
140
+ *
141
+ * @param {boolean} [mandatory=true]
142
+ * @return {Option}
143
+ */
144
+
145
+ makeOptionMandatory(mandatory = true) {
146
+ this.mandatory = !!mandatory;
147
+ return this;
148
+ }
149
+
150
+ /**
151
+ * Hide option in help.
152
+ *
153
+ * @param {boolean} [hide=true]
154
+ * @return {Option}
155
+ */
156
+
157
+ hideHelp(hide = true) {
158
+ this.hidden = !!hide;
159
+ return this;
160
+ }
161
+
162
+ /**
163
+ * @api private
164
+ */
165
+
166
+ _concatValue(value, previous) {
167
+ if (previous === this.defaultValue || !Array.isArray(previous)) {
168
+ return [value];
169
+ }
170
+
171
+ return previous.concat(value);
172
+ }
173
+
174
+ /**
175
+ * Only allow option value to be one of choices.
176
+ *
177
+ * @param {string[]} values
178
+ * @return {Option}
179
+ */
180
+
181
+ choices(values) {
182
+ this.argChoices = values.slice();
183
+ this.parseArg = (arg, previous) => {
184
+ if (!this.argChoices.includes(arg)) {
185
+ throw new InvalidArgumentError(`Allowed choices are ${this.argChoices.join(', ')}.`);
186
+ }
187
+ if (this.variadic) {
188
+ return this._concatValue(arg, previous);
189
+ }
190
+ return arg;
191
+ };
192
+ return this;
193
+ }
194
+
195
+ /**
196
+ * Return option name.
197
+ *
198
+ * @return {string}
199
+ */
200
+
201
+ name() {
202
+ if (this.long) {
203
+ return this.long.replace(/^--/, '');
204
+ }
205
+ return this.short.replace(/^-/, '');
206
+ }
207
+
208
+ /**
209
+ * Return option name, in a camelcase format that can be used
210
+ * as a object attribute key.
211
+ *
212
+ * @return {string}
213
+ * @api private
214
+ */
215
+
216
+ attributeName() {
217
+ return camelcase(this.name().replace(/^no-/, ''));
218
+ }
219
+
220
+ /**
221
+ * Check if `arg` matches the short or long flag.
222
+ *
223
+ * @param {string} arg
224
+ * @return {boolean}
225
+ * @api private
226
+ */
227
+
228
+ is(arg) {
229
+ return this.short === arg || this.long === arg;
230
+ }
231
+
232
+ /**
233
+ * Return whether a boolean option.
234
+ *
235
+ * Options are one of boolean, negated, required argument, or optional argument.
236
+ *
237
+ * @return {boolean}
238
+ * @api private
239
+ */
240
+
241
+ isBoolean() {
242
+ return !this.required && !this.optional && !this.negate;
243
+ }
244
+ }
245
+
246
+ /**
247
+ * This class is to make it easier to work with dual options, without changing the existing
248
+ * implementation. We support separate dual options for separate positive and negative options,
249
+ * like `--build` and `--no-build`, which share a single option value. This works nicely for some
250
+ * use cases, but is tricky for others where we want separate behaviours despite
251
+ * the single shared option value.
252
+ */
253
+ class DualOptions {
254
+ /**
255
+ * @param {Option[]} options
256
+ */
257
+ constructor(options) {
258
+ this.positiveOptions = new Map();
259
+ this.negativeOptions = new Map();
260
+ this.dualOptions = new Set();
261
+ options.forEach(option => {
262
+ if (option.negate) {
263
+ this.negativeOptions.set(option.attributeName(), option);
264
+ } else {
265
+ this.positiveOptions.set(option.attributeName(), option);
266
+ }
267
+ });
268
+ this.negativeOptions.forEach((value, key) => {
269
+ if (this.positiveOptions.has(key)) {
270
+ this.dualOptions.add(key);
271
+ }
272
+ });
273
+ }
274
+
275
+ /**
276
+ * Did the value come from the option, and not from possible matching dual option?
277
+ *
278
+ * @param {any} value
279
+ * @param {Option} option
280
+ * @returns {boolean}
281
+ */
282
+ valueFromOption(value, option) {
283
+ const optionKey = option.attributeName();
284
+ if (!this.dualOptions.has(optionKey)) return true;
285
+
286
+ // Use the value to deduce if (probably) came from the option.
287
+ const preset = this.negativeOptions.get(optionKey).presetArg;
288
+ const negativeValue = (preset !== undefined) ? preset : false;
289
+ return option.negate === (negativeValue === value);
290
+ }
291
+ }
292
+
293
+ /**
294
+ * Convert string from kebab-case to camelCase.
295
+ *
296
+ * @param {string} str
297
+ * @return {string}
298
+ * @api private
299
+ */
300
+
301
+ function camelcase(str) {
302
+ return str.split('-').reduce((str, word) => {
303
+ return str + word[0].toUpperCase() + word.slice(1);
304
+ });
305
+ }
306
+
307
+ /**
308
+ * Split the short and long flag out of something like '-m,--mixed <value>'
309
+ *
310
+ * @api private
311
+ */
312
+
313
+ function splitOptionFlags(flags) {
314
+ let shortFlag;
315
+ let longFlag;
316
+ // Use original very loose parsing to maintain backwards compatibility for now,
317
+ // which allowed for example unintended `-sw, --short-word` [sic].
318
+ const flagParts = flags.split(/[ |,]+/);
319
+ if (flagParts.length > 1 && !/^[[<]/.test(flagParts[1])) shortFlag = flagParts.shift();
320
+ longFlag = flagParts.shift();
321
+ // Add support for lone short flag without significantly changing parsing!
322
+ if (!shortFlag && /^-[^-]$/.test(longFlag)) {
323
+ shortFlag = longFlag;
324
+ longFlag = undefined;
325
+ }
326
+ return { shortFlag, longFlag };
327
+ }
328
+
329
+ exports.Option = Option;
330
+ exports.splitOptionFlags = splitOptionFlags;
331
+ exports.DualOptions = DualOptions;
@@ -0,0 +1,100 @@
1
+ const maxDistance = 3;
2
+
3
+ function editDistance(a, b) {
4
+ // https://en.wikipedia.org/wiki/Damerau–Levenshtein_distance
5
+ // Calculating optimal string alignment distance, no substring is edited more than once.
6
+ // (Simple implementation.)
7
+
8
+ // Quick early exit, return worst case.
9
+ if (Math.abs(a.length - b.length) > maxDistance) return Math.max(a.length, b.length);
10
+
11
+ // distance between prefix substrings of a and b
12
+ const d = [];
13
+
14
+ // pure deletions turn a into empty string
15
+ for (let i = 0; i <= a.length; i++) {
16
+ d[i] = [i];
17
+ }
18
+ // pure insertions turn empty string into b
19
+ for (let j = 0; j <= b.length; j++) {
20
+ d[0][j] = j;
21
+ }
22
+
23
+ // fill matrix
24
+ for (let j = 1; j <= b.length; j++) {
25
+ for (let i = 1; i <= a.length; i++) {
26
+ let cost = 1;
27
+ if (a[i - 1] === b[j - 1]) {
28
+ cost = 0;
29
+ } else {
30
+ cost = 1;
31
+ }
32
+ d[i][j] = Math.min(
33
+ d[i - 1][j] + 1, // deletion
34
+ d[i][j - 1] + 1, // insertion
35
+ d[i - 1][j - 1] + cost // substitution
36
+ );
37
+ // transposition
38
+ if (i > 1 && j > 1 && a[i - 1] === b[j - 2] && a[i - 2] === b[j - 1]) {
39
+ d[i][j] = Math.min(d[i][j], d[i - 2][j - 2] + 1);
40
+ }
41
+ }
42
+ }
43
+
44
+ return d[a.length][b.length];
45
+ }
46
+
47
+ /**
48
+ * Find close matches, restricted to same number of edits.
49
+ *
50
+ * @param {string} word
51
+ * @param {string[]} candidates
52
+ * @returns {string}
53
+ */
54
+
55
+ function suggestSimilar(word, candidates) {
56
+ if (!candidates || candidates.length === 0) return '';
57
+ // remove possible duplicates
58
+ candidates = Array.from(new Set(candidates));
59
+
60
+ const searchingOptions = word.startsWith('--');
61
+ if (searchingOptions) {
62
+ word = word.slice(2);
63
+ candidates = candidates.map(candidate => candidate.slice(2));
64
+ }
65
+
66
+ let similar = [];
67
+ let bestDistance = maxDistance;
68
+ const minSimilarity = 0.4;
69
+ candidates.forEach((candidate) => {
70
+ if (candidate.length <= 1) return; // no one character guesses
71
+
72
+ const distance = editDistance(word, candidate);
73
+ const length = Math.max(word.length, candidate.length);
74
+ const similarity = (length - distance) / length;
75
+ if (similarity > minSimilarity) {
76
+ if (distance < bestDistance) {
77
+ // better edit distance, throw away previous worse matches
78
+ bestDistance = distance;
79
+ similar = [candidate];
80
+ } else if (distance === bestDistance) {
81
+ similar.push(candidate);
82
+ }
83
+ }
84
+ });
85
+
86
+ similar.sort((a, b) => a.localeCompare(b));
87
+ if (searchingOptions) {
88
+ similar = similar.map(candidate => `--${candidate}`);
89
+ }
90
+
91
+ if (similar.length > 1) {
92
+ return `\n(Did you mean one of ${similar.join(', ')}?)`;
93
+ }
94
+ if (similar.length === 1) {
95
+ return `\n(Did you mean ${similar[0]}?)`;
96
+ }
97
+ return '';
98
+ }
99
+
100
+ exports.suggestSimilar = suggestSimilar;
@@ -0,0 +1,16 @@
1
+ {
2
+ "versions": [
3
+ {
4
+ "version": "*",
5
+ "target": {
6
+ "node": "supported"
7
+ },
8
+ "response": {
9
+ "type": "time-permitting"
10
+ },
11
+ "backing": {
12
+ "npm-funding": true
13
+ }
14
+ }
15
+ ]
16
+ }
@@ -0,0 +1,90 @@
1
+ {
2
+ "name": "commander",
3
+ "version": "11.0.0",
4
+ "description": "the complete solution for node.js command-line programs",
5
+ "keywords": [
6
+ "commander",
7
+ "command",
8
+ "option",
9
+ "parser",
10
+ "cli",
11
+ "argument",
12
+ "args",
13
+ "argv"
14
+ ],
15
+ "author": "TJ Holowaychuk <tj@vision-media.ca>",
16
+ "license": "MIT",
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "https://github.com/tj/commander.js.git"
20
+ },
21
+ "scripts": {
22
+ "lint": "npm run lint:javascript && npm run lint:typescript",
23
+ "lint:javascript": "eslint index.js esm.mjs \"lib/*.js\" \"tests/**/*.js\"",
24
+ "lint:typescript": "eslint typings/*.ts tests/*.ts",
25
+ "test": "jest && npm run test-typings",
26
+ "test-esm": "node ./tests/esm-imports-test.mjs",
27
+ "test-typings": "tsd",
28
+ "typescript-checkJS": "tsc --allowJS --checkJS index.js lib/*.js --noEmit",
29
+ "test-all": "npm run test && npm run lint && npm run typescript-checkJS && npm run test-esm"
30
+ },
31
+ "files": [
32
+ "index.js",
33
+ "lib/*.js",
34
+ "esm.mjs",
35
+ "typings/index.d.ts",
36
+ "typings/esm.d.mts",
37
+ "package-support.json"
38
+ ],
39
+ "type": "commonjs",
40
+ "main": "./index.js",
41
+ "exports": {
42
+ ".": {
43
+ "require": {
44
+ "types": "./typings/index.d.ts",
45
+ "default": "./index.js"
46
+ },
47
+ "import": {
48
+ "types": "./typings/esm.d.mts",
49
+ "default": "./esm.mjs"
50
+ },
51
+ "default": "./index.js"
52
+ },
53
+ "./esm.mjs": {
54
+ "types": "./typings/esm.d.mts",
55
+ "import": "./esm.mjs"
56
+ }
57
+ },
58
+ "devDependencies": {
59
+ "@types/jest": "^29.2.4",
60
+ "@types/node": "^20.2.5",
61
+ "@typescript-eslint/eslint-plugin": "^5.47.1",
62
+ "@typescript-eslint/parser": "^5.47.1",
63
+ "eslint": "^8.30.0",
64
+ "eslint-config-standard": "^17.0.0",
65
+ "eslint-config-standard-with-typescript": "^33.0.0",
66
+ "eslint-plugin-import": "^2.26.0",
67
+ "eslint-plugin-jest": "^27.1.7",
68
+ "eslint-plugin-n": "^15.6.0",
69
+ "eslint-plugin-promise": "^6.1.1",
70
+ "jest": "^29.3.1",
71
+ "ts-jest": "^29.0.3",
72
+ "tsd": "^0.28.1",
73
+ "typescript": "^5.0.4"
74
+ },
75
+ "types": "typings/index.d.ts",
76
+ "jest": {
77
+ "testEnvironment": "node",
78
+ "collectCoverage": true,
79
+ "transform": {
80
+ "^.+\\.tsx?$": "ts-jest"
81
+ },
82
+ "testPathIgnorePatterns": [
83
+ "/node_modules/"
84
+ ]
85
+ },
86
+ "engines": {
87
+ "node": ">=16"
88
+ },
89
+ "support": true
90
+ }
@@ -0,0 +1,3 @@
1
+ // Just reexport the types from cjs
2
+ // This is a bit indirect. There is not an index.js, but TypeScript will look for index.d.ts for types.
3
+ export * from './index.js';