Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@miniflare/cli-parser

Package Overview
Dependencies
Maintainers
1
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@miniflare/cli-parser - npm Package Compare versions

Comparing version 2.0.0-next.2 to 2.0.0-next.3

235

dist/src/index.js

@@ -1,129 +0,1 @@

var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
var __commonJS = (cb, mod) => function __require() {
return mod || (0, cb[Object.keys(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
};
var __reExport = (target, module, desc) => {
if (module && typeof module === "object" || typeof module === "function") {
for (let key of __getOwnPropNames(module))
if (!__hasOwnProp.call(target, key) && key !== "default")
__defProp(target, key, { get: () => module[key], enumerable: !(desc = __getOwnPropDesc(module, key)) || desc.enumerable });
}
return target;
};
var __toModule = (module) => {
return __reExport(__markAsModule(__defProp(module != null ? __create(__getProtoOf(module)) : {}, "default", module && module.__esModule && "default" in module ? { get: () => module.default, enumerable: true } : { value: module, enumerable: true })), module);
};
// node_modules/mri/lib/index.js
var require_lib = __commonJS({
"node_modules/mri/lib/index.js"(exports, module) {
function toArr(any) {
return any == null ? [] : Array.isArray(any) ? any : [any];
}
function toVal(out, key, val, opts) {
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;
out[key] = old == null ? nxt : Array.isArray(old) ? old.concat(nxt) : [old, nxt];
}
module.exports = function(args, opts) {
args = args || [];
opts = opts || {};
var k, arr, arg, name, val, out = { _: [] };
var i = 0, j = 0, idx = 0, len = args.length;
const alibi = opts.alias !== void 0;
const strict = opts.unknown !== void 0;
const defaults = opts.default !== void 0;
opts.alias = opts.alias || {};
opts.string = toArr(opts.string);
opts.boolean = toArr(opts.boolean);
if (alibi) {
for (k in opts.alias) {
arr = opts.alias[k] = toArr(opts.alias[k]);
for (i = 0; i < arr.length; i++) {
(opts.alias[arr[i]] = arr.concat(k)).splice(i, 1);
}
}
}
for (i = opts.boolean.length; i-- > 0; ) {
arr = opts.alias[opts.boolean[i]] || [];
for (j = arr.length; j-- > 0; )
opts.boolean.push(arr[j]);
}
for (i = opts.string.length; i-- > 0; ) {
arr = opts.alias[opts.string[i]] || [];
for (j = arr.length; j-- > 0; )
opts.string.push(arr[j]);
}
if (defaults) {
for (k in opts.default) {
name = typeof opts.default[k];
arr = opts.alias[k] = opts.alias[k] || [];
if (opts[name] !== void 0) {
opts[name].push(k);
for (i = 0; i < arr.length; i++) {
opts[name].push(arr[i]);
}
}
}
}
const keys = strict ? Object.keys(opts.alias) : [];
for (i = 0; i < len; i++) {
arg = args[i];
if (arg === "--") {
out._ = out._.concat(args.slice(++i));
break;
}
for (j = 0; j < arg.length; j++) {
if (arg.charCodeAt(j) !== 45)
break;
}
if (j === 0) {
out._.push(arg);
} else if (arg.substring(j, j + 3) === "no-") {
name = arg.substring(j + 3);
if (strict && !~keys.indexOf(name)) {
return opts.unknown(arg);
}
out[name] = false;
} else {
for (idx = j + 1; idx < arg.length; idx++) {
if (arg.charCodeAt(idx) === 61)
break;
}
name = arg.substring(j, idx);
val = arg.substring(++idx) || (i + 1 === len || ("" + args[i + 1]).charCodeAt(0) === 45 || args[++i]);
arr = j === 2 ? [name] : name;
for (idx = 0; idx < arr.length; idx++) {
name = arr[idx];
if (strict && !~keys.indexOf(name))
return opts.unknown("-".repeat(j) + name);
toVal(out, name, idx + 1 < arr.length || val, opts);
}
}
}
if (defaults) {
for (k in opts.default) {
if (out[k] === void 0) {
out[k] = opts.default[k];
}
}
}
if (alibi) {
for (k in out) {
arr = opts.alias[k] || [];
while (arr.length > 0) {
out[arr.shift()] = out[k];
}
}
}
return out;
};
}
});
// packages/cli-parser/src/help.ts

@@ -242,3 +114,2 @@ import {

// packages/cli-parser/src/parse.ts
var import_mri = __toModule(require_lib());
import { readFileSync } from "fs";

@@ -251,2 +122,106 @@ import path from "path";

} from "@miniflare/shared";
// node_modules/mri/lib/index.mjs
function toArr(any) {
return any == null ? [] : Array.isArray(any) ? any : [any];
}
function toVal(out, key, val, opts) {
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;
out[key] = old == null ? nxt : Array.isArray(old) ? old.concat(nxt) : [old, nxt];
}
function lib_default(args, opts) {
args = args || [];
opts = opts || {};
var k, arr, arg, name, val, out = { _: [] };
var i = 0, j = 0, idx = 0, len = args.length;
const alibi = opts.alias !== void 0;
const strict = opts.unknown !== void 0;
const defaults = opts.default !== void 0;
opts.alias = opts.alias || {};
opts.string = toArr(opts.string);
opts.boolean = toArr(opts.boolean);
if (alibi) {
for (k in opts.alias) {
arr = opts.alias[k] = toArr(opts.alias[k]);
for (i = 0; i < arr.length; i++) {
(opts.alias[arr[i]] = arr.concat(k)).splice(i, 1);
}
}
}
for (i = opts.boolean.length; i-- > 0; ) {
arr = opts.alias[opts.boolean[i]] || [];
for (j = arr.length; j-- > 0; )
opts.boolean.push(arr[j]);
}
for (i = opts.string.length; i-- > 0; ) {
arr = opts.alias[opts.string[i]] || [];
for (j = arr.length; j-- > 0; )
opts.string.push(arr[j]);
}
if (defaults) {
for (k in opts.default) {
name = typeof opts.default[k];
arr = opts.alias[k] = opts.alias[k] || [];
if (opts[name] !== void 0) {
opts[name].push(k);
for (i = 0; i < arr.length; i++) {
opts[name].push(arr[i]);
}
}
}
}
const keys = strict ? Object.keys(opts.alias) : [];
for (i = 0; i < len; i++) {
arg = args[i];
if (arg === "--") {
out._ = out._.concat(args.slice(++i));
break;
}
for (j = 0; j < arg.length; j++) {
if (arg.charCodeAt(j) !== 45)
break;
}
if (j === 0) {
out._.push(arg);
} else if (arg.substring(j, j + 3) === "no-") {
name = arg.substring(j + 3);
if (strict && !~keys.indexOf(name)) {
return opts.unknown(arg);
}
out[name] = false;
} else {
for (idx = j + 1; idx < arg.length; idx++) {
if (arg.charCodeAt(idx) === 61)
break;
}
name = arg.substring(j, idx);
val = arg.substring(++idx) || (i + 1 === len || ("" + args[i + 1]).charCodeAt(0) === 45 || args[++i]);
arr = j === 2 ? [name] : name;
for (idx = 0; idx < arr.length; idx++) {
name = arr[idx];
if (strict && !~keys.indexOf(name))
return opts.unknown("-".repeat(j) + name);
toVal(out, name, idx + 1 < arr.length || val, opts);
}
}
}
if (defaults) {
for (k in opts.default) {
if (out[k] === void 0) {
out[k] = opts.default[k];
}
}
}
if (alibi) {
for (k in out) {
arr = opts.alias[k] || [];
while (arr.length > 0) {
out[arr.shift()] = out[k];
}
}
}
return out;
}
// packages/cli-parser/src/parse.ts
var ParseError = class extends MiniflareError {

@@ -285,3 +260,3 @@ };

}
const parsed = (0, import_mri.default)(argv, {
const parsed = lib_default(argv, {
boolean: booleans,

@@ -288,0 +263,0 @@ string: strings,

{
"name": "@miniflare/cli-parser",
"version": "2.0.0-next.2",
"version": "2.0.0-next.3",
"description": "CLI option parsing module for Miniflare: a fun, full-featured, fully-local simulator for Cloudflare Workers",

@@ -20,2 +20,5 @@ "keywords": [

],
"engines": {
"node": ">=16.7"
},
"publishConfig": {

@@ -26,9 +29,9 @@ "access": "public"

"type": "git",
"url": "git+https://github.com/mrbbot/miniflare.git",
"url": "git+https://github.com/cloudflare/miniflare.git",
"directory": "packages/cli"
},
"bugs": {
"url": "https://github.com/mrbbot/miniflare/issues"
"url": "https://github.com/cloudflare/miniflare/issues"
},
"homepage": "https://github.com/mrbbot/miniflare/tree/master/packages/cli#readme",
"homepage": "https://github.com/cloudflare/miniflare/tree/master/packages/cli#readme",
"volta": {

@@ -38,8 +41,8 @@ "extends": "../../package.json"

"dependencies": {
"@miniflare/shared": "2.0.0-next.2",
"@miniflare/shared": "2.0.0-next.3",
"kleur": "^4.1.4"
},
"devDependencies": {
"@miniflare/core": "2.0.0-next.2",
"@miniflare/shared-test": "2.0.0-next.2",
"@miniflare/core": "2.0.0-next.3",
"@miniflare/shared-test": "2.0.0-next.3",
"@types/mri": "^1.1.1",

@@ -46,0 +49,0 @@ "mri": "^1.1.6"

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc