fast-npm-meta 2.1.0 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/cli.mjs +5 -622
  2. package/package.json +6 -4
package/dist/cli.mjs CHANGED
@@ -1,625 +1,8 @@
1
1
  #!/usr/bin/env node
2
- import process$1 from "node:process";
3
- //#region ../node_modules/.pnpm/cac@7.0.0/node_modules/cac/dist/index.js
4
- function toArr(any) {
5
- return any == null ? [] : Array.isArray(any) ? any : [any];
6
- }
7
- function toVal(out, key, val, opts) {
8
- var x, old = out[key], nxt = !!~opts.string.indexOf(key) ? val == null || val === true ? "" : String(val) : typeof val === "boolean" ? val : !!~opts.boolean.indexOf(key) ? val === "false" ? false : val === "true" || (out._.push((x = +val, x * 0 === 0) ? x : val), !!val) : (x = +val, x * 0 === 0) ? x : val;
9
- out[key] = old == null ? nxt : Array.isArray(old) ? old.concat(nxt) : [old, nxt];
10
- }
11
- function lib_default(args, opts) {
12
- args = args || [];
13
- opts = opts || {};
14
- var k, arr, arg, name, val, out = { _: [] };
15
- var i = 0, j = 0, idx = 0, len = args.length;
16
- const alibi = opts.alias !== void 0;
17
- const strict = opts.unknown !== void 0;
18
- const defaults = opts.default !== void 0;
19
- opts.alias = opts.alias || {};
20
- opts.string = toArr(opts.string);
21
- opts.boolean = toArr(opts.boolean);
22
- if (alibi) for (k in opts.alias) {
23
- arr = opts.alias[k] = toArr(opts.alias[k]);
24
- for (i = 0; i < arr.length; i++) (opts.alias[arr[i]] = arr.concat(k)).splice(i, 1);
25
- }
26
- for (i = opts.boolean.length; i-- > 0;) {
27
- arr = opts.alias[opts.boolean[i]] || [];
28
- for (j = arr.length; j-- > 0;) opts.boolean.push(arr[j]);
29
- }
30
- for (i = opts.string.length; i-- > 0;) {
31
- arr = opts.alias[opts.string[i]] || [];
32
- for (j = arr.length; j-- > 0;) opts.string.push(arr[j]);
33
- }
34
- if (defaults) for (k in opts.default) {
35
- name = typeof opts.default[k];
36
- arr = opts.alias[k] = opts.alias[k] || [];
37
- if (opts[name] !== void 0) {
38
- opts[name].push(k);
39
- for (i = 0; i < arr.length; i++) opts[name].push(arr[i]);
40
- }
41
- }
42
- const keys = strict ? Object.keys(opts.alias) : [];
43
- for (i = 0; i < len; i++) {
44
- arg = args[i];
45
- if (arg === "--") {
46
- out._ = out._.concat(args.slice(++i));
47
- break;
48
- }
49
- for (j = 0; j < arg.length; j++) if (arg.charCodeAt(j) !== 45) break;
50
- if (j === 0) out._.push(arg);
51
- else if (arg.substring(j, j + 3) === "no-") {
52
- name = arg.substring(j + 3);
53
- if (strict && !~keys.indexOf(name)) return opts.unknown(arg);
54
- out[name] = false;
55
- } else {
56
- for (idx = j + 1; idx < arg.length; idx++) if (arg.charCodeAt(idx) === 61) break;
57
- name = arg.substring(j, idx);
58
- val = arg.substring(++idx) || i + 1 === len || ("" + args[i + 1]).charCodeAt(0) === 45 || args[++i];
59
- arr = j === 2 ? [name] : name;
60
- for (idx = 0; idx < arr.length; idx++) {
61
- name = arr[idx];
62
- if (strict && !~keys.indexOf(name)) return opts.unknown("-".repeat(j) + name);
63
- toVal(out, name, idx + 1 < arr.length || val, opts);
64
- }
65
- }
66
- }
67
- if (defaults) {
68
- for (k in opts.default) if (out[k] === void 0) out[k] = opts.default[k];
69
- }
70
- if (alibi) for (k in out) {
71
- arr = opts.alias[k] || [];
72
- while (arr.length > 0) out[arr.shift()] = out[k];
73
- }
74
- return out;
75
- }
76
- function removeBrackets(v) {
77
- return v.replace(/[<[].+/, "").trim();
78
- }
79
- function findAllBrackets(v) {
80
- const ANGLED_BRACKET_RE_GLOBAL = /<([^>]+)>/g;
81
- const SQUARE_BRACKET_RE_GLOBAL = /\[([^\]]+)\]/g;
82
- const res = [];
83
- const parse = (match) => {
84
- let variadic = false;
85
- let value = match[1];
86
- if (value.startsWith("...")) {
87
- value = value.slice(3);
88
- variadic = true;
89
- }
90
- return {
91
- required: match[0].startsWith("<"),
92
- value,
93
- variadic
94
- };
95
- };
96
- let angledMatch;
97
- while (angledMatch = ANGLED_BRACKET_RE_GLOBAL.exec(v)) res.push(parse(angledMatch));
98
- let squareMatch;
99
- while (squareMatch = SQUARE_BRACKET_RE_GLOBAL.exec(v)) res.push(parse(squareMatch));
100
- return res;
101
- }
102
- function getMriOptions(options) {
103
- const result = {
104
- alias: {},
105
- boolean: []
106
- };
107
- for (const [index, option] of options.entries()) {
108
- if (option.names.length > 1) result.alias[option.names[0]] = option.names.slice(1);
109
- if (option.isBoolean) if (option.negated) {
110
- if (!options.some((o, i) => {
111
- return i !== index && o.names.some((name) => option.names.includes(name)) && typeof o.required === "boolean";
112
- })) result.boolean.push(option.names[0]);
113
- } else result.boolean.push(option.names[0]);
114
- }
115
- return result;
116
- }
117
- function findLongest(arr) {
118
- return arr.sort((a, b) => {
119
- return a.length > b.length ? -1 : 1;
120
- })[0];
121
- }
122
- function padRight(str, length) {
123
- return str.length >= length ? str : `${str}${" ".repeat(length - str.length)}`;
124
- }
125
- function camelcase(input) {
126
- return input.replaceAll(/([a-z])-([a-z])/g, (_, p1, p2) => {
127
- return p1 + p2.toUpperCase();
128
- });
129
- }
130
- function setDotProp(obj, keys, val) {
131
- let current = obj;
132
- for (let i = 0; i < keys.length; i++) {
133
- const key = keys[i];
134
- if (i === keys.length - 1) {
135
- current[key] = val;
136
- return;
137
- }
138
- if (current[key] == null) {
139
- const nextKeyIsArrayIndex = +keys[i + 1] > -1;
140
- current[key] = nextKeyIsArrayIndex ? [] : {};
141
- }
142
- current = current[key];
143
- }
144
- }
145
- function setByType(obj, transforms) {
146
- for (const key of Object.keys(transforms)) {
147
- const transform = transforms[key];
148
- if (transform.shouldTransform) {
149
- obj[key] = [obj[key]].flat();
150
- if (typeof transform.transformFunction === "function") obj[key] = obj[key].map(transform.transformFunction);
151
- }
152
- }
153
- }
154
- function getFileName(input) {
155
- const m = /([^\\/]+)$/.exec(input);
156
- return m ? m[1] : "";
157
- }
158
- function camelcaseOptionName(name) {
159
- return name.split(".").map((v, i) => {
160
- return i === 0 ? camelcase(v) : v;
161
- }).join(".");
162
- }
163
- var CACError = class extends Error {
164
- constructor(message) {
165
- super(message);
166
- this.name = "CACError";
167
- if (typeof Error.captureStackTrace !== "function") this.stack = new Error(message).stack;
168
- }
169
- };
170
- var Option = class {
171
- rawName;
172
- description;
173
- /** Option name */
174
- name;
175
- /** Option name and aliases */
176
- names;
177
- isBoolean;
178
- required;
179
- config;
180
- negated;
181
- constructor(rawName, description, config) {
182
- this.rawName = rawName;
183
- this.description = description;
184
- this.config = Object.assign({}, config);
185
- rawName = rawName.replaceAll(".*", "");
186
- this.negated = false;
187
- this.names = removeBrackets(rawName).split(",").map((v) => {
188
- let name = v.trim().replace(/^-{1,2}/, "");
189
- if (name.startsWith("no-")) {
190
- this.negated = true;
191
- name = name.replace(/^no-/, "");
192
- }
193
- return camelcaseOptionName(name);
194
- }).sort((a, b) => a.length > b.length ? 1 : -1);
195
- this.name = this.names.at(-1);
196
- if (this.negated && this.config.default == null) this.config.default = true;
197
- if (rawName.includes("<")) this.required = true;
198
- else if (rawName.includes("[")) this.required = false;
199
- else this.isBoolean = true;
200
- }
201
- };
202
- let runtimeProcessArgs;
203
- let runtimeInfo;
204
- if (typeof process !== "undefined") {
205
- let runtimeName;
206
- if (typeof Deno !== "undefined" && typeof Deno.version?.deno === "string") runtimeName = "deno";
207
- else if (typeof Bun !== "undefined" && typeof Bun.version === "string") runtimeName = "bun";
208
- else runtimeName = "node";
209
- runtimeInfo = `${process.platform}-${process.arch} ${runtimeName}-${process.version}`;
210
- runtimeProcessArgs = process.argv;
211
- } else if (typeof navigator === "undefined") runtimeInfo = `unknown`;
212
- else runtimeInfo = `${navigator.platform} ${navigator.userAgent}`;
213
- var Command = class {
214
- rawName;
215
- description;
216
- config;
217
- cli;
218
- options;
219
- aliasNames;
220
- name;
221
- args;
222
- commandAction;
223
- usageText;
224
- versionNumber;
225
- examples;
226
- helpCallback;
227
- globalCommand;
228
- constructor(rawName, description, config = {}, cli) {
229
- this.rawName = rawName;
230
- this.description = description;
231
- this.config = config;
232
- this.cli = cli;
233
- this.options = [];
234
- this.aliasNames = [];
235
- this.name = removeBrackets(rawName);
236
- this.args = findAllBrackets(rawName);
237
- this.examples = [];
238
- }
239
- usage(text) {
240
- this.usageText = text;
241
- return this;
242
- }
243
- allowUnknownOptions() {
244
- this.config.allowUnknownOptions = true;
245
- return this;
246
- }
247
- ignoreOptionDefaultValue() {
248
- this.config.ignoreOptionDefaultValue = true;
249
- return this;
250
- }
251
- version(version, customFlags = "-v, --version") {
252
- this.versionNumber = version;
253
- this.option(customFlags, "Display version number");
254
- return this;
255
- }
256
- example(example) {
257
- this.examples.push(example);
258
- return this;
259
- }
260
- /**
261
- * Add a option for this command
262
- * @param rawName Raw option name(s)
263
- * @param description Option description
264
- * @param config Option config
265
- */
266
- option(rawName, description, config) {
267
- const option = new Option(rawName, description, config);
268
- this.options.push(option);
269
- return this;
270
- }
271
- alias(name) {
272
- this.aliasNames.push(name);
273
- return this;
274
- }
275
- action(callback) {
276
- this.commandAction = callback;
277
- return this;
278
- }
279
- /**
280
- * Check if a command name is matched by this command
281
- * @param name Command name
282
- */
283
- isMatched(name) {
284
- return this.name === name || this.aliasNames.includes(name);
285
- }
286
- get isDefaultCommand() {
287
- return this.name === "" || this.aliasNames.includes("!");
288
- }
289
- get isGlobalCommand() {
290
- return this instanceof GlobalCommand;
291
- }
292
- /**
293
- * Check if an option is registered in this command
294
- * @param name Option name
295
- */
296
- hasOption(name) {
297
- name = name.split(".")[0];
298
- return this.options.find((option) => {
299
- return option.names.includes(name);
300
- });
301
- }
302
- outputHelp() {
303
- const { name, commands } = this.cli;
304
- const { versionNumber, options: globalOptions, helpCallback } = this.cli.globalCommand;
305
- let sections = [{ body: `${name}${versionNumber ? `/${versionNumber}` : ""}` }];
306
- sections.push({
307
- title: "Usage",
308
- body: ` $ ${name} ${this.usageText || this.rawName}`
309
- });
310
- if ((this.isGlobalCommand || this.isDefaultCommand) && commands.length > 0) {
311
- const longestCommandName = findLongest(commands.map((command) => command.rawName));
312
- sections.push({
313
- title: "Commands",
314
- body: commands.map((command) => {
315
- return ` ${padRight(command.rawName, longestCommandName.length)} ${command.description}`;
316
- }).join("\n")
317
- }, {
318
- title: `For more info, run any command with the \`--help\` flag`,
319
- body: commands.map((command) => ` $ ${name}${command.name === "" ? "" : ` ${command.name}`} --help`).join("\n")
320
- });
321
- }
322
- let options = this.isGlobalCommand ? globalOptions : [...this.options, ...globalOptions || []];
323
- if (!this.isGlobalCommand && !this.isDefaultCommand) options = options.filter((option) => option.name !== "version");
324
- if (options.length > 0) {
325
- const longestOptionName = findLongest(options.map((option) => option.rawName));
326
- sections.push({
327
- title: "Options",
328
- body: options.map((option) => {
329
- return ` ${padRight(option.rawName, longestOptionName.length)} ${option.description} ${option.config.default === void 0 ? "" : `(default: ${option.config.default})`}`;
330
- }).join("\n")
331
- });
332
- }
333
- if (this.examples.length > 0) sections.push({
334
- title: "Examples",
335
- body: this.examples.map((example) => {
336
- if (typeof example === "function") return example(name);
337
- return example;
338
- }).join("\n")
339
- });
340
- if (helpCallback) sections = helpCallback(sections) || sections;
341
- console.info(sections.map((section) => {
342
- return section.title ? `${section.title}:\n${section.body}` : section.body;
343
- }).join("\n\n"));
344
- }
345
- outputVersion() {
346
- const { name } = this.cli;
347
- const { versionNumber } = this.cli.globalCommand;
348
- if (versionNumber) console.info(`${name}/${versionNumber} ${runtimeInfo}`);
349
- }
350
- checkRequiredArgs() {
351
- const minimalArgsCount = this.args.filter((arg) => arg.required).length;
352
- if (this.cli.args.length < minimalArgsCount) throw new CACError(`missing required args for command \`${this.rawName}\``);
353
- }
354
- /**
355
- * Check if the parsed options contain any unknown options
356
- *
357
- * Exit and output error when true
358
- */
359
- checkUnknownOptions() {
360
- const { options, globalCommand } = this.cli;
361
- if (!this.config.allowUnknownOptions) {
362
- for (const name of Object.keys(options)) if (name !== "--" && !this.hasOption(name) && !globalCommand.hasOption(name)) throw new CACError(`Unknown option \`${name.length > 1 ? `--${name}` : `-${name}`}\``);
363
- }
364
- }
365
- /**
366
- * Check if the required string-type options exist
367
- */
368
- checkOptionValue() {
369
- const { options: parsedOptions, globalCommand } = this.cli;
370
- const options = [...globalCommand.options, ...this.options];
371
- for (const option of options) {
372
- const value = parsedOptions[option.name.split(".")[0]];
373
- if (option.required) {
374
- const hasNegated = options.some((o) => o.negated && o.names.includes(option.name));
375
- if (value === true || value === false && !hasNegated) throw new CACError(`option \`${option.rawName}\` value is missing`);
376
- }
377
- }
378
- }
379
- /**
380
- * Check if the number of args is more than expected
381
- */
382
- checkUnusedArgs() {
383
- const maximumArgsCount = this.args.some((arg) => arg.variadic) ? Infinity : this.args.length;
384
- if (maximumArgsCount < this.cli.args.length) throw new CACError(`Unused args: ${this.cli.args.slice(maximumArgsCount).map((arg) => `\`${arg}\``).join(", ")}`);
385
- }
386
- };
387
- var GlobalCommand = class extends Command {
388
- constructor(cli) {
389
- super("@@global@@", "", {}, cli);
390
- }
391
- };
392
- var CAC = class extends EventTarget {
393
- /** The program name to display in help and version message */
394
- name;
395
- commands;
396
- globalCommand;
397
- matchedCommand;
398
- matchedCommandName;
399
- /**
400
- * Raw CLI arguments
401
- */
402
- rawArgs;
403
- /**
404
- * Parsed CLI arguments
405
- */
406
- args;
407
- /**
408
- * Parsed CLI options, camelCased
409
- */
410
- options;
411
- showHelpOnExit;
412
- showVersionOnExit;
413
- /**
414
- * @param name The program name to display in help and version message
415
- */
416
- constructor(name = "") {
417
- super();
418
- this.name = name;
419
- this.commands = [];
420
- this.rawArgs = [];
421
- this.args = [];
422
- this.options = {};
423
- this.globalCommand = new GlobalCommand(this);
424
- this.globalCommand.usage("<command> [options]");
425
- }
426
- /**
427
- * Add a global usage text.
428
- *
429
- * This is not used by sub-commands.
430
- */
431
- usage(text) {
432
- this.globalCommand.usage(text);
433
- return this;
434
- }
435
- /**
436
- * Add a sub-command
437
- */
438
- command(rawName, description, config) {
439
- const command = new Command(rawName, description || "", config, this);
440
- command.globalCommand = this.globalCommand;
441
- this.commands.push(command);
442
- return command;
443
- }
444
- /**
445
- * Add a global CLI option.
446
- *
447
- * Which is also applied to sub-commands.
448
- */
449
- option(rawName, description, config) {
450
- this.globalCommand.option(rawName, description, config);
451
- return this;
452
- }
453
- /**
454
- * Show help message when `-h, --help` flags appear.
455
- *
456
- */
457
- help(callback) {
458
- this.globalCommand.option("-h, --help", "Display this message");
459
- this.globalCommand.helpCallback = callback;
460
- this.showHelpOnExit = true;
461
- return this;
462
- }
463
- /**
464
- * Show version number when `-v, --version` flags appear.
465
- *
466
- */
467
- version(version, customFlags = "-v, --version") {
468
- this.globalCommand.version(version, customFlags);
469
- this.showVersionOnExit = true;
470
- return this;
471
- }
472
- /**
473
- * Add a global example.
474
- *
475
- * This example added here will not be used by sub-commands.
476
- */
477
- example(example) {
478
- this.globalCommand.example(example);
479
- return this;
480
- }
481
- /**
482
- * Output the corresponding help message
483
- * When a sub-command is matched, output the help message for the command
484
- * Otherwise output the global one.
485
- *
486
- */
487
- outputHelp() {
488
- if (this.matchedCommand) this.matchedCommand.outputHelp();
489
- else this.globalCommand.outputHelp();
490
- }
491
- /**
492
- * Output the version number.
493
- *
494
- */
495
- outputVersion() {
496
- this.globalCommand.outputVersion();
497
- }
498
- setParsedInfo({ args, options }, matchedCommand, matchedCommandName) {
499
- this.args = args;
500
- this.options = options;
501
- if (matchedCommand) this.matchedCommand = matchedCommand;
502
- if (matchedCommandName) this.matchedCommandName = matchedCommandName;
503
- return this;
504
- }
505
- unsetMatchedCommand() {
506
- this.matchedCommand = void 0;
507
- this.matchedCommandName = void 0;
508
- }
509
- /**
510
- * Parse argv
511
- */
512
- parse(argv, { run = true } = {}) {
513
- if (!argv) {
514
- if (!runtimeProcessArgs) throw new Error("No argv provided and runtime process argv is not available.");
515
- argv = runtimeProcessArgs;
516
- }
517
- this.rawArgs = argv;
518
- if (!this.name) this.name = argv[1] ? getFileName(argv[1]) : "cli";
519
- let shouldParse = true;
520
- for (const command of this.commands) {
521
- const parsed = this.mri(argv.slice(2), command);
522
- const commandName = parsed.args[0];
523
- if (command.isMatched(commandName)) {
524
- shouldParse = false;
525
- const parsedInfo = {
526
- ...parsed,
527
- args: parsed.args.slice(1)
528
- };
529
- this.setParsedInfo(parsedInfo, command, commandName);
530
- this.dispatchEvent(new CustomEvent(`command:${commandName}`, { detail: command }));
531
- }
532
- }
533
- if (shouldParse) {
534
- for (const command of this.commands) if (command.isDefaultCommand) {
535
- shouldParse = false;
536
- const parsed = this.mri(argv.slice(2), command);
537
- this.setParsedInfo(parsed, command);
538
- this.dispatchEvent(new CustomEvent("command:!", { detail: command }));
539
- }
540
- }
541
- if (shouldParse) {
542
- const parsed = this.mri(argv.slice(2));
543
- this.setParsedInfo(parsed);
544
- }
545
- if (this.options.help && this.showHelpOnExit) {
546
- this.outputHelp();
547
- run = false;
548
- this.unsetMatchedCommand();
549
- }
550
- if (this.options.version && this.showVersionOnExit && this.matchedCommandName == null) {
551
- this.outputVersion();
552
- run = false;
553
- this.unsetMatchedCommand();
554
- }
555
- const parsedArgv = {
556
- args: this.args,
557
- options: this.options
558
- };
559
- if (run) this.runMatchedCommand();
560
- if (!this.matchedCommand && this.args[0]) this.dispatchEvent(new CustomEvent("command:*", { detail: this.args[0] }));
561
- return parsedArgv;
562
- }
563
- mri(argv, command) {
564
- const cliOptions = [...this.globalCommand.options, ...command ? command.options : []];
565
- const mriOptions = getMriOptions(cliOptions);
566
- let argsAfterDoubleDashes = [];
567
- const doubleDashesIndex = argv.indexOf("--");
568
- if (doubleDashesIndex !== -1) {
569
- argsAfterDoubleDashes = argv.slice(doubleDashesIndex + 1);
570
- argv = argv.slice(0, doubleDashesIndex);
571
- }
572
- let parsed = lib_default(argv, mriOptions);
573
- parsed = Object.keys(parsed).reduce((res, name) => {
574
- return {
575
- ...res,
576
- [camelcaseOptionName(name)]: parsed[name]
577
- };
578
- }, { _: [] });
579
- const args = parsed._;
580
- const options = { "--": argsAfterDoubleDashes };
581
- const ignoreDefault = command && command.config.ignoreOptionDefaultValue ? command.config.ignoreOptionDefaultValue : this.globalCommand.config.ignoreOptionDefaultValue;
582
- const transforms = Object.create(null);
583
- for (const cliOption of cliOptions) {
584
- if (!ignoreDefault && cliOption.config.default !== void 0) for (const name of cliOption.names) options[name] = cliOption.config.default;
585
- if (Array.isArray(cliOption.config.type) && transforms[cliOption.name] === void 0) {
586
- transforms[cliOption.name] = Object.create(null);
587
- transforms[cliOption.name].shouldTransform = true;
588
- transforms[cliOption.name].transformFunction = cliOption.config.type[0];
589
- }
590
- }
591
- for (const key of Object.keys(parsed)) if (key !== "_") {
592
- setDotProp(options, key.split("."), parsed[key]);
593
- setByType(options, transforms);
594
- }
595
- return {
596
- args,
597
- options
598
- };
599
- }
600
- runMatchedCommand() {
601
- const { args, options, matchedCommand: command } = this;
602
- if (!command || !command.commandAction) return;
603
- command.checkUnknownOptions();
604
- command.checkOptionValue();
605
- command.checkRequiredArgs();
606
- command.checkUnusedArgs();
607
- const actionArgs = [];
608
- command.args.forEach((arg, index) => {
609
- if (arg.variadic) actionArgs.push(args.slice(index));
610
- else actionArgs.push(args[index]);
611
- });
612
- actionArgs.push(options);
613
- return command.commandAction.apply(this, actionArgs);
614
- }
615
- };
616
- /**
617
- * @param name The program name to display in help and version message
618
- */
619
- const cac = (name = "") => new CAC(name);
620
- //#endregion
2
+ import process from "node:process";
3
+ import { cac } from "cac";
621
4
  //#region package.json
622
- var version = "2.1.0";
5
+ var version = "2.2.0";
623
6
  //#endregion
624
7
  //#region ../node_modules/.pnpm/is-network-error@1.3.0/node_modules/is-network-error/index.js
625
8
  const objectToString = Object.prototype.toString;
@@ -880,7 +263,7 @@ cli.command("version <...pkgs>", "Get the latest version of one or more packages
880
263
  } else for (const result of results) console.log(result.version);
881
264
  } catch (e) {
882
265
  console.error(e.message);
883
- process$1.exit(1);
266
+ process.exit(1);
884
267
  }
885
268
  });
886
269
  cli.command("full <...pkgs>", "Get full package metadata (versions list, dist-tags, etc.)").option("--force", "Bypass cache and get the latest data").option("--loose", "Include all versions that are newer than the specified version").option("--metadata", "Include per-version metadata (time, engines, deprecated, etc.)").option("--after <date>", "Only return versions published after this ISO date-time").option("--api-endpoint <url>", "API endpoint URL").action(async (pkgs, options) => {
@@ -896,7 +279,7 @@ cli.command("full <...pkgs>", "Get full package metadata (versions list, dist-ta
896
279
  console.log(JSON.stringify(output, null, 2));
897
280
  } catch (e) {
898
281
  console.error(e.message);
899
- process$1.exit(1);
282
+ process.exit(1);
900
283
  }
901
284
  });
902
285
  cli.help();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "fast-npm-meta",
3
3
  "type": "module",
4
- "version": "2.1.0",
4
+ "version": "2.2.0",
5
5
  "description": "Get npm package metadata",
6
6
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
7
7
  "license": "MIT",
@@ -16,6 +16,7 @@
16
16
  "sideEffects": false,
17
17
  "exports": {
18
18
  ".": "./dist/index.mjs",
19
+ "./cli": "./dist/cli.mjs",
19
20
  "./package.json": "./package.json"
20
21
  },
21
22
  "types": "./dist/index.d.mts",
@@ -26,13 +27,14 @@
26
27
  "dist",
27
28
  "skills"
28
29
  ],
30
+ "dependencies": {
31
+ "cac": "^7.0.0"
32
+ },
29
33
  "devDependencies": {
30
- "cac": "^7.0.0",
31
34
  "p-retry": "^8.0.0",
32
- "tsdown": "^0.22.3"
35
+ "tsdown": "^0.22.12"
33
36
  },
34
37
  "inlinedDependencies": {
35
- "cac": "7.0.0",
36
38
  "is-network-error": "1.3.0",
37
39
  "p-retry": "8.0.0"
38
40
  },