tina4-nodejs 3.11.4 → 3.11.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -88,13 +88,19 @@ export function parseFields(fieldsStr: string): Array<[string, string]> {
|
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
export function parseCliArgs(args: string[]): { flags: Record<string, string | boolean>; positional: string[] } {
|
|
91
|
+
// Boolean-only flags that never take a value argument
|
|
92
|
+
const booleanFlags = new Set(["no-browser", "no-reload", "production", "managed", "all", "clear"]);
|
|
93
|
+
|
|
91
94
|
const flags: Record<string, string | boolean> = {};
|
|
92
95
|
const positional: string[] = [];
|
|
93
96
|
let i = 0;
|
|
94
97
|
while (i < args.length) {
|
|
95
98
|
if (args[i].startsWith("--")) {
|
|
96
99
|
const key = args[i].slice(2);
|
|
97
|
-
if (
|
|
100
|
+
if (booleanFlags.has(key)) {
|
|
101
|
+
flags[key] = true;
|
|
102
|
+
i += 1;
|
|
103
|
+
} else if (i + 1 < args.length && !args[i + 1].startsWith("--")) {
|
|
98
104
|
flags[key] = args[i + 1];
|
|
99
105
|
i += 2;
|
|
100
106
|
} else {
|