@lunora/cli 1.0.0-alpha.80 → 1.0.0-alpha.82
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/dist/bin.mjs +1 -1
- package/dist/index.d.mts +3 -17
- package/dist/index.d.ts +3 -17
- package/dist/index.mjs +3 -4
- package/dist/packem_chunks/handler10.mjs +1 -1
- package/dist/packem_chunks/handler11.mjs +3 -2
- package/dist/packem_chunks/handler15.mjs +1 -1
- package/dist/packem_chunks/handler19.mjs +1 -1
- package/dist/packem_chunks/handler2.mjs +1 -1
- package/dist/packem_chunks/handler20.mjs +1 -1
- package/dist/packem_chunks/handler3.mjs +3 -2
- package/dist/packem_chunks/handler5.mjs +1 -1
- package/dist/packem_chunks/handler6.mjs +1 -1
- package/dist/packem_chunks/handler9.mjs +24 -16
- package/dist/packem_chunks/planDevCommand.mjs +1 -1
- package/dist/packem_chunks/runDeployCommand.mjs +1 -1
- package/dist/packem_chunks/runInitCommand.mjs +1 -1
- package/dist/packem_chunks/runMigrateGenerateCommand.mjs +43 -38
- package/dist/packem_shared/{COMMANDS-DW8lQmuW.mjs → COMMANDS-D0tmnAwr.mjs} +21 -4
- package/dist/packem_shared/{DEFAULT_IMPORT_BATCH_SIZE-CRQmmBZM.mjs → DEFAULT_IMPORT_BATCH_SIZE-D0VOTerB.mjs} +4 -0
- package/dist/packem_shared/{createRecordingSpawner-Cw5Iu73G.mjs → createRecordingSpawner-WuSn20kb.mjs} +13 -2
- package/package.json +7 -7
- package/dist/packem_shared/parseArgs-YXFuKdEk.mjs +0 -56
package/dist/bin.mjs
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -163,6 +163,8 @@ interface ImportCommandOptions {
|
|
|
163
163
|
table?: string;
|
|
164
164
|
token?: string;
|
|
165
165
|
url?: string;
|
|
166
|
+
/** Confirm bulk-writing production. Required alongside `--prod`. */
|
|
167
|
+
yes?: boolean;
|
|
166
168
|
}
|
|
167
169
|
interface ImportCommandResult {
|
|
168
170
|
body: unknown;
|
|
@@ -978,22 +980,6 @@ interface ResetCommandResult {
|
|
|
978
980
|
}
|
|
979
981
|
declare const runResetCommand: (options: ResetCommandOptions) => Promise<ResetCommandResult>;
|
|
980
982
|
/** `lunora reset` handler (lazy-loaded via the command's `loader`). */
|
|
981
|
-
/**
|
|
982
|
-
* Tiny argv parser.
|
|
983
|
-
*
|
|
984
|
-
* Supports long options (`--name value`, `--name=value`, `--flag`), short
|
|
985
|
-
* options (`-x value`, `-xvalue`), positional arguments (everything else, in
|
|
986
|
-
* order), and a `--` terminator after which everything is positional.
|
|
987
|
-
*
|
|
988
|
-
* Intentionally small — replaces a full CLI library for the handful of
|
|
989
|
-
* subcommands we need.
|
|
990
|
-
*/
|
|
991
|
-
interface ParsedArgs {
|
|
992
|
-
flags: Record<string, boolean>;
|
|
993
|
-
options: Record<string, string>;
|
|
994
|
-
positional: ReadonlyArray<string>;
|
|
995
|
-
}
|
|
996
|
-
declare const parseArgs: (argv: ReadonlyArray<string>, booleanFlags?: ReadonlySet<string>) => ParsedArgs;
|
|
997
983
|
type InsertSchemaExtensionResult = {
|
|
998
984
|
ok: true;
|
|
999
985
|
text: string;
|
|
@@ -1072,4 +1058,4 @@ declare const diffSnapshots: (previous: SchemaSnapshot | undefined, next: Schema
|
|
|
1072
1058
|
*/
|
|
1073
1059
|
declare const renderMigrationFile: (name: string, diff: SchemaDiff, generatedAt: string) => string;
|
|
1074
1060
|
declare const schemaIrToSnapshot: (ir: SchemaIR) => SchemaSnapshot;
|
|
1075
|
-
export { type AddCommandOptions, type AddCommandResult, COMMANDS, type ColumnSnapshot, type CommandName, DEFAULT_IMPORT_BATCH_SIZE, type DeployCommandOptions, type DeployCommandResult, type DevCommandOptions, type DevCommandPlan, type DiffEntry, type ExportCommandOptions, type ExportCommandResult, type FetchLike, type ImportCommandOptions, type ImportCommandResult, type IndexSnapshot, type InitCommandOptions, type InitCommandResult, type InsertSchemaExtensionResult, type Logger, type MigrateGenerateCommandOptions, type MigrateGenerateCommandResult, type RecordedSpawn, type RegistryBinding, type RegistryFile, type RegistryManifest, type ResetCommandOptions, type ResetCommandResult, type RunCliOptions, type RunCommandOptions, type RunCommandResult, type SchemaDiff, type SchemaSnapshot, type SpawnDescriptor, type SpawnResult, type Spawner, type StreamingFetchLike, type TableSnapshot, type Template, type UnsupportedEntry, VERSION, buildRegistryIndex, createLogger, createRecordingSpawner, defaultSpawner, diffSnapshots, insertSchemaExtension, pail,
|
|
1061
|
+
export { type AddCommandOptions, type AddCommandResult, COMMANDS, type ColumnSnapshot, type CommandName, DEFAULT_IMPORT_BATCH_SIZE, type DeployCommandOptions, type DeployCommandResult, type DevCommandOptions, type DevCommandPlan, type DiffEntry, type ExportCommandOptions, type ExportCommandResult, type FetchLike, type ImportCommandOptions, type ImportCommandResult, type IndexSnapshot, type InitCommandOptions, type InitCommandResult, type InsertSchemaExtensionResult, type Logger, type MigrateGenerateCommandOptions, type MigrateGenerateCommandResult, type RecordedSpawn, type RegistryBinding, type RegistryFile, type RegistryManifest, type ResetCommandOptions, type ResetCommandResult, type RunCliOptions, type RunCommandOptions, type RunCommandResult, type SchemaDiff, type SchemaSnapshot, type SpawnDescriptor, type SpawnResult, type Spawner, type StreamingFetchLike, type TableSnapshot, type Template, type UnsupportedEntry, VERSION, buildRegistryIndex, createLogger, createRecordingSpawner, defaultSpawner, diffSnapshots, insertSchemaExtension, pail, parseManifest, planDevCommand, renderAddColumn, renderCreateIndex, renderCreateTable, renderDropIndex, renderDropTable, renderMigrationFile, runAddCommand, runBuildIndexCommand, runCli, runCodegenCommand, runDeployCommand, runDevCommand, runExportCommand, runImportCommand, runInitCommand, runMigrateGenerateCommand, runRegistryViewCommand, runResetCommand, runRpcCommand, schemaIrToSnapshot, validatorKindToSqlType };
|
package/dist/index.d.ts
CHANGED
|
@@ -163,6 +163,8 @@ interface ImportCommandOptions {
|
|
|
163
163
|
table?: string;
|
|
164
164
|
token?: string;
|
|
165
165
|
url?: string;
|
|
166
|
+
/** Confirm bulk-writing production. Required alongside `--prod`. */
|
|
167
|
+
yes?: boolean;
|
|
166
168
|
}
|
|
167
169
|
interface ImportCommandResult {
|
|
168
170
|
body: unknown;
|
|
@@ -978,22 +980,6 @@ interface ResetCommandResult {
|
|
|
978
980
|
}
|
|
979
981
|
declare const runResetCommand: (options: ResetCommandOptions) => Promise<ResetCommandResult>;
|
|
980
982
|
/** `lunora reset` handler (lazy-loaded via the command's `loader`). */
|
|
981
|
-
/**
|
|
982
|
-
* Tiny argv parser.
|
|
983
|
-
*
|
|
984
|
-
* Supports long options (`--name value`, `--name=value`, `--flag`), short
|
|
985
|
-
* options (`-x value`, `-xvalue`), positional arguments (everything else, in
|
|
986
|
-
* order), and a `--` terminator after which everything is positional.
|
|
987
|
-
*
|
|
988
|
-
* Intentionally small — replaces a full CLI library for the handful of
|
|
989
|
-
* subcommands we need.
|
|
990
|
-
*/
|
|
991
|
-
interface ParsedArgs {
|
|
992
|
-
flags: Record<string, boolean>;
|
|
993
|
-
options: Record<string, string>;
|
|
994
|
-
positional: ReadonlyArray<string>;
|
|
995
|
-
}
|
|
996
|
-
declare const parseArgs: (argv: ReadonlyArray<string>, booleanFlags?: ReadonlySet<string>) => ParsedArgs;
|
|
997
983
|
type InsertSchemaExtensionResult = {
|
|
998
984
|
ok: true;
|
|
999
985
|
text: string;
|
|
@@ -1072,4 +1058,4 @@ declare const diffSnapshots: (previous: SchemaSnapshot | undefined, next: Schema
|
|
|
1072
1058
|
*/
|
|
1073
1059
|
declare const renderMigrationFile: (name: string, diff: SchemaDiff, generatedAt: string) => string;
|
|
1074
1060
|
declare const schemaIrToSnapshot: (ir: SchemaIR) => SchemaSnapshot;
|
|
1075
|
-
export { type AddCommandOptions, type AddCommandResult, COMMANDS, type ColumnSnapshot, type CommandName, DEFAULT_IMPORT_BATCH_SIZE, type DeployCommandOptions, type DeployCommandResult, type DevCommandOptions, type DevCommandPlan, type DiffEntry, type ExportCommandOptions, type ExportCommandResult, type FetchLike, type ImportCommandOptions, type ImportCommandResult, type IndexSnapshot, type InitCommandOptions, type InitCommandResult, type InsertSchemaExtensionResult, type Logger, type MigrateGenerateCommandOptions, type MigrateGenerateCommandResult, type RecordedSpawn, type RegistryBinding, type RegistryFile, type RegistryManifest, type ResetCommandOptions, type ResetCommandResult, type RunCliOptions, type RunCommandOptions, type RunCommandResult, type SchemaDiff, type SchemaSnapshot, type SpawnDescriptor, type SpawnResult, type Spawner, type StreamingFetchLike, type TableSnapshot, type Template, type UnsupportedEntry, VERSION, buildRegistryIndex, createLogger, createRecordingSpawner, defaultSpawner, diffSnapshots, insertSchemaExtension, pail,
|
|
1061
|
+
export { type AddCommandOptions, type AddCommandResult, COMMANDS, type ColumnSnapshot, type CommandName, DEFAULT_IMPORT_BATCH_SIZE, type DeployCommandOptions, type DeployCommandResult, type DevCommandOptions, type DevCommandPlan, type DiffEntry, type ExportCommandOptions, type ExportCommandResult, type FetchLike, type ImportCommandOptions, type ImportCommandResult, type IndexSnapshot, type InitCommandOptions, type InitCommandResult, type InsertSchemaExtensionResult, type Logger, type MigrateGenerateCommandOptions, type MigrateGenerateCommandResult, type RecordedSpawn, type RegistryBinding, type RegistryFile, type RegistryManifest, type ResetCommandOptions, type ResetCommandResult, type RunCliOptions, type RunCommandOptions, type RunCommandResult, type SchemaDiff, type SchemaSnapshot, type SpawnDescriptor, type SpawnResult, type Spawner, type StreamingFetchLike, type TableSnapshot, type Template, type UnsupportedEntry, VERSION, buildRegistryIndex, createLogger, createRecordingSpawner, defaultSpawner, diffSnapshots, insertSchemaExtension, pail, parseManifest, planDevCommand, renderAddColumn, renderCreateIndex, renderCreateTable, renderDropIndex, renderDropTable, renderMigrationFile, runAddCommand, runBuildIndexCommand, runCli, runCodegenCommand, runDeployCommand, runDevCommand, runExportCommand, runImportCommand, runInitCommand, runMigrateGenerateCommand, runRegistryViewCommand, runResetCommand, runRpcCommand, schemaIrToSnapshot, validatorKindToSqlType };
|
package/dist/index.mjs
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
export { COMMANDS, VERSION, runCli } from './packem_shared/COMMANDS-
|
|
1
|
+
export { COMMANDS, VERSION, runCli } from './packem_shared/COMMANDS-D0tmnAwr.mjs';
|
|
2
2
|
export { runCodegenCommand } from './packem_chunks/runCodegenCommand.mjs';
|
|
3
|
-
export { DEFAULT_IMPORT_BATCH_SIZE, runExportCommand, runImportCommand } from './packem_shared/DEFAULT_IMPORT_BATCH_SIZE-
|
|
3
|
+
export { DEFAULT_IMPORT_BATCH_SIZE, runExportCommand, runImportCommand } from './packem_shared/DEFAULT_IMPORT_BATCH_SIZE-D0VOTerB.mjs';
|
|
4
4
|
export { runDeployCommand } from './packem_chunks/runDeployCommand.mjs';
|
|
5
5
|
export { planDevCommand, runDevCommand } from './packem_chunks/planDevCommand.mjs';
|
|
6
6
|
export { runInitCommand } from './packem_chunks/runInitCommand.mjs';
|
|
7
7
|
export { runMigrateGenerateCommand } from './packem_chunks/runMigrateGenerateCommand.mjs';
|
|
8
8
|
export { runResetCommand } from './packem_chunks/runResetCommand.mjs';
|
|
9
9
|
export { runRpcCommand } from './packem_chunks/runRpcCommand.mjs';
|
|
10
|
-
export { default as parseArgs } from './packem_shared/parseArgs-YXFuKdEk.mjs';
|
|
11
10
|
export { insertSchemaExtension } from './packem_shared/insertSchemaExtension-DAqbfr9Z.mjs';
|
|
12
11
|
export { createLogger, pail } from './packem_shared/createLogger-CIWSHrTL.mjs';
|
|
13
12
|
export { diffSnapshots, renderAddColumn, renderCreateIndex, renderCreateTable, renderDropIndex, renderDropTable, renderMigrationFile, validatorKindToSqlType } from './packem_shared/diffSnapshots-BeDvvNiF.mjs';
|
|
14
13
|
export { default as schemaIrToSnapshot } from './packem_shared/schemaIrToSnapshot-DdsljJT-.mjs';
|
|
15
|
-
export { createRecordingSpawner, defaultSpawner } from './packem_shared/createRecordingSpawner-
|
|
14
|
+
export { createRecordingSpawner, defaultSpawner } from './packem_shared/createRecordingSpawner-WuSn20kb.mjs';
|
|
16
15
|
export { default as parseManifest } from './packem_shared/parseManifest-Dbp-Q2q3.mjs';
|
|
17
16
|
export { REQUIRED_COMPATIBILITY_DATE, REQUIRED_FLAG, validateWranglerProject as validateWrangler, validateWranglerConfig } from '@lunora/config';
|
|
18
17
|
export { buildRegistryIndex } from './packem_shared/buildRegistryIndex-BS5ig822.mjs';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { d as defineHandler } from '../packem_shared/command-lYnl4QyF.mjs';
|
|
2
2
|
import { a as resolveProductionWorkerUrl } from '../packem_shared/resolve-target-qbsJ_5sF.mjs';
|
|
3
|
-
import { runExportCommand } from '../packem_shared/DEFAULT_IMPORT_BATCH_SIZE-
|
|
3
|
+
import { runExportCommand } from '../packem_shared/DEFAULT_IMPORT_BATCH_SIZE-D0VOTerB.mjs';
|
|
4
4
|
|
|
5
5
|
const execute = defineHandler(
|
|
6
6
|
({ argument, cwd, logger, options }) => runExportCommand({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { d as defineHandler } from '../packem_shared/command-lYnl4QyF.mjs';
|
|
2
2
|
import { a as resolveProductionWorkerUrl } from '../packem_shared/resolve-target-qbsJ_5sF.mjs';
|
|
3
|
-
import { runImportCommand } from '../packem_shared/DEFAULT_IMPORT_BATCH_SIZE-
|
|
3
|
+
import { runImportCommand } from '../packem_shared/DEFAULT_IMPORT_BATCH_SIZE-D0VOTerB.mjs';
|
|
4
4
|
|
|
5
5
|
const execute = defineHandler(({ argument, cwd, logger, options }) => {
|
|
6
6
|
const file = argument[0];
|
|
@@ -15,7 +15,8 @@ const execute = defineHandler(({ argument, cwd, logger, options }) => {
|
|
|
15
15
|
prod: options.prod === true,
|
|
16
16
|
table: options.table,
|
|
17
17
|
token: options.token,
|
|
18
|
-
url: resolveProductionWorkerUrl({ cwd, prod: options.prod === true, url: options.url })
|
|
18
|
+
url: resolveProductionWorkerUrl({ cwd, prod: options.prod === true, url: options.url }),
|
|
19
|
+
yes: options.yes === true
|
|
19
20
|
});
|
|
20
21
|
});
|
|
21
22
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { readLinkedProject } from '@lunora/config';
|
|
2
2
|
import { d as defineHandler } from '../packem_shared/command-lYnl4QyF.mjs';
|
|
3
3
|
import { e as execArgsFor, d as detectPackageManager } from '../packem_shared/detect-package-manager-DvEthdCw.mjs';
|
|
4
|
-
import { defaultSpawner } from '../packem_shared/createRecordingSpawner-
|
|
4
|
+
import { defaultSpawner } from '../packem_shared/createRecordingSpawner-WuSn20kb.mjs';
|
|
5
5
|
|
|
6
6
|
const LOG_FORMATS = /* @__PURE__ */ new Set(["json", "pretty"]);
|
|
7
7
|
const runLogsCommand = async (options) => {
|
|
@@ -8,7 +8,7 @@ import { Project } from 'ts-morph';
|
|
|
8
8
|
import { d as defineHandler } from '../packem_shared/command-lYnl4QyF.mjs';
|
|
9
9
|
import { a as resolveProductionWorkerUrl } from '../packem_shared/resolve-target-qbsJ_5sF.mjs';
|
|
10
10
|
import { b as tuiConfirm } from '../packem_shared/tui-prompts-BjEN8XgP.mjs';
|
|
11
|
-
import { runImportCommand } from '../packem_shared/DEFAULT_IMPORT_BATCH_SIZE-
|
|
11
|
+
import { runImportCommand } from '../packem_shared/DEFAULT_IMPORT_BATCH_SIZE-D0VOTerB.mjs';
|
|
12
12
|
import { runResetCommand } from './runResetCommand.mjs';
|
|
13
13
|
|
|
14
14
|
const isLocalUrl = (url) => {
|
|
@@ -3,7 +3,7 @@ import { tmpdir } from 'node:os';
|
|
|
3
3
|
import { join, relative } from 'node:path';
|
|
4
4
|
import { d as defineHandler } from '../packem_shared/command-lYnl4QyF.mjs';
|
|
5
5
|
import { e as execArgsFor, d as detectPackageManager } from '../packem_shared/detect-package-manager-DvEthdCw.mjs';
|
|
6
|
-
import { defaultSpawner } from '../packem_shared/createRecordingSpawner-
|
|
6
|
+
import { defaultSpawner } from '../packem_shared/createRecordingSpawner-WuSn20kb.mjs';
|
|
7
7
|
|
|
8
8
|
const walk = (root) => {
|
|
9
9
|
const entries = [];
|
|
@@ -7,7 +7,7 @@ import { d as defineHandler } from '../packem_shared/command-lYnl4QyF.mjs';
|
|
|
7
7
|
import { e as execArgsFor, d as detectPackageManager } from '../packem_shared/detect-package-manager-DvEthdCw.mjs';
|
|
8
8
|
import { v as validateOutputFormat, i as isJsonFormat, p as printJson, l as loggerForFormat } from '../packem_shared/output-format-B4642rjE.mjs';
|
|
9
9
|
import { r as runSchemaDriftGate } from '../packem_shared/schema-drift-gate-BtBt0as0.mjs';
|
|
10
|
-
import { defaultSpawner } from '../packem_shared/createRecordingSpawner-
|
|
10
|
+
import { defaultSpawner } from '../packem_shared/createRecordingSpawner-WuSn20kb.mjs';
|
|
11
11
|
import { validateWranglerProject } from '@lunora/config';
|
|
12
12
|
|
|
13
13
|
const runTypecheckStep = async (cwd, spawner) => {
|
|
@@ -5,7 +5,7 @@ import { LunoraError } from '@lunora/errors';
|
|
|
5
5
|
import { r as resolveAdminBaseUrl } from '../packem_shared/admin-url-4UzT-CI4.mjs';
|
|
6
6
|
import { d as defineHandler } from '../packem_shared/command-lYnl4QyF.mjs';
|
|
7
7
|
import { a as resolveProductionWorkerUrl } from '../packem_shared/resolve-target-qbsJ_5sF.mjs';
|
|
8
|
-
import { runExportCommand, runImportCommand } from '../packem_shared/DEFAULT_IMPORT_BATCH_SIZE-
|
|
8
|
+
import { runExportCommand, runImportCommand } from '../packem_shared/DEFAULT_IMPORT_BATCH_SIZE-D0VOTerB.mjs';
|
|
9
9
|
|
|
10
10
|
const DEFAULT_BACKUP_DIR = ".lunora-backups";
|
|
11
11
|
const MANIFEST_FILE = "manifest.json";
|
|
@@ -89,7 +89,8 @@ const runBackupRestore = async (options, directory) => {
|
|
|
89
89
|
logger: options.logger,
|
|
90
90
|
prod: options.prod,
|
|
91
91
|
token: options.token,
|
|
92
|
-
url: options.url
|
|
92
|
+
url: options.url,
|
|
93
|
+
yes: options.yes
|
|
93
94
|
});
|
|
94
95
|
return { code: result.code };
|
|
95
96
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { d as defineHandler } from '../packem_shared/command-lYnl4QyF.mjs';
|
|
2
2
|
import { e as execArgsFor, d as detectPackageManager } from '../packem_shared/detect-package-manager-DvEthdCw.mjs';
|
|
3
3
|
import { i as isDockerAvailable } from '../packem_shared/docker-hMQ97KSQ.mjs';
|
|
4
|
-
import { defaultSpawner } from '../packem_shared/createRecordingSpawner-
|
|
4
|
+
import { defaultSpawner } from '../packem_shared/createRecordingSpawner-WuSn20kb.mjs';
|
|
5
5
|
|
|
6
6
|
const SUBCOMMANDS = /* @__PURE__ */ new Set(["build", "delete", "images", "info", "list", "push"]);
|
|
7
7
|
const NEEDS_DOCKER = /* @__PURE__ */ new Set(["build", "push"]);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { d as defineHandler } from '../packem_shared/command-lYnl4QyF.mjs';
|
|
2
2
|
import { e as execArgsFor, d as detectPackageManager } from '../packem_shared/detect-package-manager-DvEthdCw.mjs';
|
|
3
|
-
import { defaultSpawner } from '../packem_shared/createRecordingSpawner-
|
|
3
|
+
import { defaultSpawner } from '../packem_shared/createRecordingSpawner-WuSn20kb.mjs';
|
|
4
4
|
|
|
5
5
|
const withEnv = (args, env) => {
|
|
6
6
|
if (env !== void 0) {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { existsSync, readFileSync, writeFileSync } from 'node:fs';
|
|
2
2
|
import { join } from 'node:path';
|
|
3
3
|
import { DEV_VARS_FILE, DEV_VARS_KEY_PATTERN, generateSecretValue, DEV_VARS_EXAMPLE_FILE, parseDevVariableEntries, isPlaceholderValue, packageNamesFromBindings, inferLunoraBindings, requiredSecrets, isMintableSecretKey } from '@lunora/config';
|
|
4
4
|
import { d as defineHandler } from '../packem_shared/command-lYnl4QyF.mjs';
|
|
5
5
|
import { d as detectPackageManager, e as execArgsFor } from '../packem_shared/detect-package-manager-DvEthdCw.mjs';
|
|
6
|
-
import { defaultSpawner } from '../packem_shared/createRecordingSpawner-
|
|
6
|
+
import { defaultSpawner } from '../packem_shared/createRecordingSpawner-WuSn20kb.mjs';
|
|
7
7
|
import { l as listRemoteSecrets } from '../packem_shared/wrangler-secrets-Dq_Fkbm-.mjs';
|
|
8
8
|
|
|
9
9
|
const NEWLINE_PRESENT = /[\r\n]/u;
|
|
@@ -15,14 +15,23 @@ const parseDevVariables = (content) => {
|
|
|
15
15
|
}
|
|
16
16
|
return map;
|
|
17
17
|
};
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
const devVariableLinePattern = (key) => new RegExp(String.raw`^[ \t]*${key}[ \t]*=.*$`, "mu");
|
|
19
|
+
const upsertDevVariableLine = (content, key, value) => {
|
|
20
|
+
const rendered = `${key}="${value}"`;
|
|
21
|
+
const pattern = devVariableLinePattern(key);
|
|
22
|
+
if (pattern.test(content)) {
|
|
23
|
+
return content.replace(pattern, () => rendered);
|
|
24
|
+
}
|
|
25
|
+
if (content === "") {
|
|
26
|
+
return `${rendered}
|
|
27
|
+
`;
|
|
22
28
|
}
|
|
23
|
-
return
|
|
29
|
+
return content.endsWith("\n") ? `${content}${rendered}
|
|
30
|
+
` : `${content}
|
|
31
|
+
${rendered}
|
|
24
32
|
`;
|
|
25
33
|
};
|
|
34
|
+
const removeDevVariableLine = (content, key) => content.replaceAll(new RegExp(String.raw`^[ \t]*${key}[ \t]*=.*(?:\r?\n|$)`, "gmu"), "");
|
|
26
35
|
const redact = (value) => {
|
|
27
36
|
if (value.length <= 4) {
|
|
28
37
|
return "****";
|
|
@@ -83,9 +92,8 @@ const runEnvSet = (context) => {
|
|
|
83
92
|
logger.error(`env: value for "${options.key}" contains a double-quote or backslash, which .dev.vars cannot round-trip`);
|
|
84
93
|
return { code: 1, descriptors: [] };
|
|
85
94
|
}
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
writeFileSync(devVariablesPath, serializeDevVariables(map), "utf8");
|
|
95
|
+
const raw = existsSync(devVariablesPath) ? readFileSync(devVariablesPath, "utf8") : "";
|
|
96
|
+
writeFileSync(devVariablesPath, upsertDevVariableLine(raw, options.key, options.value), "utf8");
|
|
89
97
|
logger.success(`env: set ${options.key} (${redact(options.value)}) in ${DEV_VARS_FILE}`);
|
|
90
98
|
return { code: 0, descriptors: [] };
|
|
91
99
|
};
|
|
@@ -95,12 +103,12 @@ const runEnvUnset = (context) => {
|
|
|
95
103
|
logger.error("env unset requires a key. Usage: lunora env unset <KEY>");
|
|
96
104
|
return { code: 1, descriptors: [] };
|
|
97
105
|
}
|
|
98
|
-
const
|
|
99
|
-
if (!
|
|
106
|
+
const raw = existsSync(devVariablesPath) ? readFileSync(devVariablesPath, "utf8") : "";
|
|
107
|
+
if (!parseDevVariables(raw).has(options.key)) {
|
|
100
108
|
logger.warn(`env: ${options.key} was not set in ${DEV_VARS_FILE}`);
|
|
101
109
|
return { code: 0, descriptors: [] };
|
|
102
110
|
}
|
|
103
|
-
writeFileSync(devVariablesPath,
|
|
111
|
+
writeFileSync(devVariablesPath, removeDevVariableLine(raw, options.key), "utf8");
|
|
104
112
|
logger.success(`env: unset ${options.key} in ${DEV_VARS_FILE}`);
|
|
105
113
|
return { code: 0, descriptors: [] };
|
|
106
114
|
};
|
|
@@ -243,11 +251,11 @@ const runEnvGenerate = async (context) => {
|
|
|
243
251
|
return { key, value: generateSecretValue() };
|
|
244
252
|
});
|
|
245
253
|
if (options.set === true) {
|
|
246
|
-
|
|
254
|
+
let raw = existsSync(devVariablesPath) ? readFileSync(devVariablesPath, "utf8") : "";
|
|
247
255
|
for (const entry of generated) {
|
|
248
|
-
|
|
256
|
+
raw = upsertDevVariableLine(raw, entry.key, entry.value);
|
|
249
257
|
}
|
|
250
|
-
writeFileSync(devVariablesPath,
|
|
258
|
+
writeFileSync(devVariablesPath, raw, "utf8");
|
|
251
259
|
logger.success(`env: generated ${String(generated.length)} secret(s) into ${DEV_VARS_FILE}: ${generated.map((entry) => entry.key).join(", ")}`);
|
|
252
260
|
return { code: 0, descriptors: [] };
|
|
253
261
|
}
|
|
@@ -10,7 +10,7 @@ import { d as detectPackageManager, e as execArgsFor, r as runScriptCommand } fr
|
|
|
10
10
|
import { createServer, connect } from 'node:net';
|
|
11
11
|
import { forceJsonLogging } from '../packem_shared/createLogger-CIWSHrTL.mjs';
|
|
12
12
|
import { networkInterfaces } from 'node:os';
|
|
13
|
-
import { spawnShellCompat } from '../packem_shared/createRecordingSpawner-
|
|
13
|
+
import { spawnShellCompat } from '../packem_shared/createRecordingSpawner-WuSn20kb.mjs';
|
|
14
14
|
import { createServer as createServer$1, request } from 'node:http';
|
|
15
15
|
import { loadStudioAssets, studioAssetsStamp, renderStudioHtml, resolveAdminToken, SCHEMA_EDIT_ENDPOINT, POLICY_SCAFFOLD_ENDPOINT, SEED_ENDPOINT, serveJsonHandler, isStandaloneModulePath, readStandaloneAsset, assetContentType, handleSchemaEditRequest, handlePolicyScaffoldRequest, handleSeedRequest } from '@lunora/config/studio-host';
|
|
16
16
|
import { c as createTuiConfirm } from '../packem_shared/tui-prompts-BjEN8XgP.mjs';
|
|
@@ -11,7 +11,7 @@ import { e as execArgsFor, d as detectPackageManager } from '../packem_shared/de
|
|
|
11
11
|
import { a as isRailpackAvailable, i as isDockerAvailable } from '../packem_shared/docker-hMQ97KSQ.mjs';
|
|
12
12
|
import { v as validateOutputFormat, i as isJsonFormat, p as printJson, l as loggerForFormat } from '../packem_shared/output-format-B4642rjE.mjs';
|
|
13
13
|
import { containerBuildTag } from '@lunora/container';
|
|
14
|
-
import { defaultSpawner } from '../packem_shared/createRecordingSpawner-
|
|
14
|
+
import { defaultSpawner } from '../packem_shared/createRecordingSpawner-WuSn20kb.mjs';
|
|
15
15
|
import { r as resolveWorkerUrl } from '../packem_shared/resolve-target-qbsJ_5sF.mjs';
|
|
16
16
|
import { r as runSchemaDriftGate } from '../packem_shared/schema-drift-gate-BtBt0as0.mjs';
|
|
17
17
|
import { c as createTuiConfirm } from '../packem_shared/tui-prompts-BjEN8XgP.mjs';
|
|
@@ -12,7 +12,7 @@ import MagicString from 'magic-string';
|
|
|
12
12
|
import { Project, SyntaxKind } from 'ts-morph';
|
|
13
13
|
import { P as PromptCancelledError } from '../packem_shared/prompt-cancelled-APzX1Im-.mjs';
|
|
14
14
|
import { c as resolveTagVersions, d as resolveSourceRef, e as resolvePinnedSourceRef, f as resolveDistTag, r as runAddCommand } from '../packem_shared/commands-ClEvcz3V.mjs';
|
|
15
|
-
import { defaultSpawner } from '../packem_shared/createRecordingSpawner-
|
|
15
|
+
import { defaultSpawner } from '../packem_shared/createRecordingSpawner-WuSn20kb.mjs';
|
|
16
16
|
import { d as tuiMascot, e as tuiStep, f as tuiMoonrise, t as tuiText, g as tuiHeadline, h as tuiInfo, a as tuiSelect, b as tuiConfirm, w as withTuiSpinner, i as tuiNextSteps, j as tuiTasks, k as tuiMultiSelect, l as withTuiBadgeProgress } from '../packem_shared/tui-prompts-BjEN8XgP.mjs';
|
|
17
17
|
import { logStep } from '../packem_shared/createLogger-CIWSHrTL.mjs';
|
|
18
18
|
import { E as EMAIL_ITEM, p as promptBucketName, w as withStorageBucketName, M as MAIL_DESTINATION_PROMPT, r as resolveTypedDestination, f as withMailDestination, e as promptAuthProvider, c as promptDatabaseName, g as withAuthDatabaseName } from '../packem_shared/storage-DEXpJkXh.mjs';
|
|
@@ -9,7 +9,7 @@ import { d as defineHandler } from '../packem_shared/command-lYnl4QyF.mjs';
|
|
|
9
9
|
import { diffSnapshots, renderMigrationFile } from '../packem_shared/diffSnapshots-BeDvvNiF.mjs';
|
|
10
10
|
import { a as resolveProductionWorkerUrl } from '../packem_shared/resolve-target-qbsJ_5sF.mjs';
|
|
11
11
|
import schemaIrToSnapshot from '../packem_shared/schemaIrToSnapshot-DdsljJT-.mjs';
|
|
12
|
-
import { runExportCommand, runImportCommand } from '../packem_shared/DEFAULT_IMPORT_BATCH_SIZE-
|
|
12
|
+
import { runExportCommand, runImportCommand } from '../packem_shared/DEFAULT_IMPORT_BATCH_SIZE-D0VOTerB.mjs';
|
|
13
13
|
|
|
14
14
|
const SNAPSHOT_FILENAME = ".snapshot.json";
|
|
15
15
|
const NON_ALPHANUMERIC = /[^\da-z]+/gu;
|
|
@@ -306,44 +306,49 @@ const runMigrateToHyperdriveCommand = async (options) => {
|
|
|
306
306
|
}
|
|
307
307
|
const temporaryDirectory = options.out === void 0 ? mkdtempSync(join(tmpdir(), "lunora-d1ps-")) : void 0;
|
|
308
308
|
const dumpPath = options.out ?? join(temporaryDirectory, "dump.ndjson");
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
309
|
+
try {
|
|
310
|
+
logger.info(`Exporting .global() data from the D1 source (${fromUrl ?? "http://localhost:8787"}) …`);
|
|
311
|
+
const exportResult = await runExportCommand({
|
|
312
|
+
fetchImpl: options.fetchImpl,
|
|
313
|
+
logger,
|
|
314
|
+
out: dumpPath,
|
|
315
|
+
prod: options.prod,
|
|
316
|
+
tables: options.tables,
|
|
317
|
+
token: options.fromToken,
|
|
318
|
+
url: fromUrl
|
|
319
|
+
});
|
|
320
|
+
if (exportResult.code !== 0) {
|
|
321
|
+
return { code: exportResult.code };
|
|
322
|
+
}
|
|
323
|
+
logger.info(`Exported ${String(exportResult.rows)} row(s) (${String(exportResult.bytes)} bytes).`);
|
|
324
|
+
logger.info(`Importing into the Hyperdrive target (${toUrl ?? "http://localhost:8787"}) …`);
|
|
325
|
+
const importResult = await runImportCommand({
|
|
326
|
+
batchSize: options.batchSize,
|
|
327
|
+
fetchImpl: options.fetchImpl,
|
|
328
|
+
file: dumpPath,
|
|
329
|
+
logger,
|
|
330
|
+
prod: options.prod,
|
|
331
|
+
token: options.toToken,
|
|
332
|
+
url: toUrl
|
|
333
|
+
});
|
|
334
|
+
if (importResult.code !== 0) {
|
|
335
|
+
return { code: importResult.code };
|
|
336
|
+
}
|
|
337
|
+
if (importResult.inserted === exportResult.rows) {
|
|
338
|
+
logger.info(
|
|
339
|
+
`✓ Migrated ${String(exportResult.rows)} row(s) — counts match. Verify your app reads from Hyperdrive, then decommission the D1 binding.`
|
|
340
|
+
);
|
|
341
|
+
} else {
|
|
342
|
+
logger.warn(
|
|
343
|
+
`Imported ${String(importResult.inserted)} of ${String(exportResult.rows)} exported row(s) — the remainder likely already existed in the target (see conflicts above). Re-run after resolving, or inspect the dump with --out.`
|
|
344
|
+
);
|
|
345
|
+
}
|
|
346
|
+
return { code: 0 };
|
|
347
|
+
} finally {
|
|
348
|
+
if (temporaryDirectory !== void 0) {
|
|
349
|
+
rmSync(temporaryDirectory, { force: true, recursive: true });
|
|
350
|
+
}
|
|
345
351
|
}
|
|
346
|
-
return { code: 0 };
|
|
347
352
|
};
|
|
348
353
|
const execute = defineHandler(({ argument, cwd, logger, options }) => {
|
|
349
354
|
const sub = argument[0];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { readFileSync, writeFileSync } from 'node:fs';
|
|
1
|
+
import { mkdirSync, readFileSync, lstatSync, writeFileSync } from 'node:fs';
|
|
2
2
|
import { resolveHint, isLunoraError, flattenHint, findSolutionByMessage } from '@lunora/errors';
|
|
3
3
|
import { createCerebro } from '@visulima/cerebro';
|
|
4
4
|
import completionCommand from '@visulima/cerebro/command/completion';
|
|
@@ -6,7 +6,7 @@ import versionCommand from '@visulima/cerebro/command/version';
|
|
|
6
6
|
import { A as API_SPEC_HELP } from './api-spec-Bx0iKbxA.mjs';
|
|
7
7
|
import { createLogger } from './createLogger-CIWSHrTL.mjs';
|
|
8
8
|
import { VisulimaError, renderError } from '@visulima/error';
|
|
9
|
-
import {
|
|
9
|
+
import { homedir } from 'node:os';
|
|
10
10
|
import { join } from 'node:path';
|
|
11
11
|
|
|
12
12
|
const addCommand = {
|
|
@@ -351,6 +351,7 @@ const importCommand = {
|
|
|
351
351
|
{ description: "Wrap each bare doc as `{table:<name>,doc:...}`", name: "table", type: String },
|
|
352
352
|
{ description: "Rows per HTTP request (default 500)", name: "batch-size", type: Number },
|
|
353
353
|
{ description: "Target production — requires an explicit --url", name: "prod", type: Boolean },
|
|
354
|
+
{ description: "Confirm bulk-writing production (required with --prod)", name: "yes", type: Boolean },
|
|
354
355
|
{ description: "Worker URL (default http://localhost:8787)", name: "url", type: String },
|
|
355
356
|
{
|
|
356
357
|
description: "Admin bearer token (prefer LUNORA_ADMIN_TOKEN; --token is visible to other local processes via the process table)",
|
|
@@ -813,6 +814,15 @@ const isNewer = (current, latest) => compareVersions(latest, current) > 0;
|
|
|
813
814
|
const isCacheFresh = (checkedAt, nowMs, ttlMs) => nowMs - checkedAt < ttlMs;
|
|
814
815
|
const formatUpdateNotice = (current, latest) => `Update available for @lunora/cli: ${current} → ${latest} — run \`pnpm add -D @lunora/cli@latest\``;
|
|
815
816
|
const cacheFilePath = (cacheDirectory) => join(cacheDirectory, "lunora-cli-update.json");
|
|
817
|
+
const defaultCacheDirectory = (env) => {
|
|
818
|
+
const base = env.XDG_CACHE_HOME && env.XDG_CACHE_HOME.length > 0 ? env.XDG_CACHE_HOME : join(homedir(), ".cache");
|
|
819
|
+
const directory = join(base, "lunora");
|
|
820
|
+
try {
|
|
821
|
+
mkdirSync(directory, { mode: 448, recursive: true });
|
|
822
|
+
} catch {
|
|
823
|
+
}
|
|
824
|
+
return directory;
|
|
825
|
+
};
|
|
816
826
|
const readCache = (cacheDirectory) => {
|
|
817
827
|
try {
|
|
818
828
|
const parsed = JSON.parse(readFileSync(cacheFilePath(cacheDirectory), "utf8"));
|
|
@@ -828,7 +838,14 @@ const readCache = (cacheDirectory) => {
|
|
|
828
838
|
};
|
|
829
839
|
const writeCache = (cacheDirectory, cache) => {
|
|
830
840
|
try {
|
|
831
|
-
|
|
841
|
+
const path = cacheFilePath(cacheDirectory);
|
|
842
|
+
try {
|
|
843
|
+
if (lstatSync(path).isSymbolicLink()) {
|
|
844
|
+
return;
|
|
845
|
+
}
|
|
846
|
+
} catch {
|
|
847
|
+
}
|
|
848
|
+
writeFileSync(path, `${JSON.stringify(cache)}
|
|
832
849
|
`, "utf8");
|
|
833
850
|
} catch {
|
|
834
851
|
}
|
|
@@ -853,7 +870,7 @@ const maybeNotifyUpdate = async (deps) => {
|
|
|
853
870
|
if (isNotifierDisabled(deps.current, env, isTty)) {
|
|
854
871
|
return;
|
|
855
872
|
}
|
|
856
|
-
const cacheDirectory = deps.cacheDir ??
|
|
873
|
+
const cacheDirectory = deps.cacheDir ?? defaultCacheDirectory(env);
|
|
857
874
|
const nowMs = (deps.now ?? Date.now)();
|
|
858
875
|
const ttlMs = deps.ttlMs ?? CACHE_TTL_MS;
|
|
859
876
|
const cache = readCache(cacheDirectory);
|
|
@@ -130,6 +130,10 @@ const resolveImportRequest = async (options) => {
|
|
|
130
130
|
options.logger.error("--prod requires an explicit --url (refusing to import to the implicit localhost worker)");
|
|
131
131
|
return void 0;
|
|
132
132
|
}
|
|
133
|
+
if (options.prod && options.yes !== true) {
|
|
134
|
+
options.logger.error("import --prod bulk-writes production. Re-run with --yes to confirm.");
|
|
135
|
+
return void 0;
|
|
136
|
+
}
|
|
133
137
|
const token = options.token ?? process.env["LUNORA_ADMIN_TOKEN"];
|
|
134
138
|
if (!token) {
|
|
135
139
|
options.logger.error("admin token required — pass --token or set LUNORA_ADMIN_TOKEN");
|
|
@@ -1,11 +1,22 @@
|
|
|
1
1
|
import { spawn } from 'node:child_process';
|
|
2
2
|
|
|
3
|
-
const NEEDS_CMD_QUOTING =
|
|
3
|
+
const NEEDS_CMD_QUOTING = /[\s"%&<>^|]/u;
|
|
4
|
+
const BACKSLASH_RUN_BEFORE_QUOTE = /(\\*)"/gu;
|
|
5
|
+
const TRAILING_BACKSLASH_RUN = /(\\+)$/u;
|
|
4
6
|
const spawnShellCompat = (command, args, platform = process.platform) => {
|
|
5
7
|
if (platform !== "win32" || command === process.execPath) {
|
|
6
8
|
return { args: [...args], command, shell: false };
|
|
7
9
|
}
|
|
8
|
-
const quote = (value) =>
|
|
10
|
+
const quote = (value) => {
|
|
11
|
+
if (value === "") {
|
|
12
|
+
return `""`;
|
|
13
|
+
}
|
|
14
|
+
if (!NEEDS_CMD_QUOTING.test(value)) {
|
|
15
|
+
return value;
|
|
16
|
+
}
|
|
17
|
+
const escaped = value.replaceAll(BACKSLASH_RUN_BEFORE_QUOTE, String.raw`$1$1\"`).replace(TRAILING_BACKSLASH_RUN, "$1$1");
|
|
18
|
+
return `"${escaped}"`;
|
|
19
|
+
};
|
|
9
20
|
return { args: args.map((argument) => quote(argument)), command: quote(command), shell: true };
|
|
10
21
|
};
|
|
11
22
|
const defaultSpawner = (descriptor) => new Promise((resolve, reject) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lunora/cli",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.82",
|
|
4
4
|
"description": "The Lunora CLI: init, dev, deploy, codegen, run, reset, and migrate commands",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agent-skills",
|
|
@@ -52,12 +52,12 @@
|
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
54
|
"@bomb.sh/tab": "0.0.18",
|
|
55
|
-
"@lunora/codegen": "1.0.0-alpha.
|
|
56
|
-
"@lunora/config": "1.0.0-alpha.
|
|
57
|
-
"@lunora/container": "1.0.0-alpha.
|
|
58
|
-
"@lunora/d1": "1.0.0-alpha.
|
|
59
|
-
"@lunora/errors": "1.0.0-alpha.
|
|
60
|
-
"@lunora/seed": "1.0.0-alpha.
|
|
55
|
+
"@lunora/codegen": "1.0.0-alpha.41",
|
|
56
|
+
"@lunora/config": "1.0.0-alpha.63",
|
|
57
|
+
"@lunora/container": "1.0.0-alpha.10",
|
|
58
|
+
"@lunora/d1": "1.0.0-alpha.26",
|
|
59
|
+
"@lunora/errors": "1.0.0-alpha.4",
|
|
60
|
+
"@lunora/seed": "1.0.0-alpha.22",
|
|
61
61
|
"@visulima/cerebro": "3.0.0",
|
|
62
62
|
"@visulima/error": "6.0.0",
|
|
63
63
|
"@visulima/fs": "5.0.0",
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
const consumeLongOption = (body, next, booleanFlags, accumulator) => {
|
|
2
|
-
const eqIndex = body.indexOf("=");
|
|
3
|
-
if (eqIndex !== -1) {
|
|
4
|
-
accumulator.options[body.slice(0, eqIndex)] = body.slice(eqIndex + 1);
|
|
5
|
-
return 1;
|
|
6
|
-
}
|
|
7
|
-
if (booleanFlags.has(body)) {
|
|
8
|
-
accumulator.flags[body] = true;
|
|
9
|
-
return 1;
|
|
10
|
-
}
|
|
11
|
-
if (next !== void 0 && !next.startsWith("-")) {
|
|
12
|
-
accumulator.options[body] = next;
|
|
13
|
-
return 2;
|
|
14
|
-
}
|
|
15
|
-
accumulator.flags[body] = true;
|
|
16
|
-
return 1;
|
|
17
|
-
};
|
|
18
|
-
const consumeShortOption = (body, next, accumulator) => {
|
|
19
|
-
if (body.length > 1) {
|
|
20
|
-
accumulator.options[body[0]] = body.slice(1);
|
|
21
|
-
return 1;
|
|
22
|
-
}
|
|
23
|
-
if (next !== void 0 && !next.startsWith("-")) {
|
|
24
|
-
accumulator.options[body] = next;
|
|
25
|
-
return 2;
|
|
26
|
-
}
|
|
27
|
-
accumulator.flags[body] = true;
|
|
28
|
-
return 1;
|
|
29
|
-
};
|
|
30
|
-
const parseArgs = (argv, booleanFlags = /* @__PURE__ */ new Set()) => {
|
|
31
|
-
const accumulator = { flags: {}, options: {}, positional: [] };
|
|
32
|
-
let index = 0;
|
|
33
|
-
let terminated = false;
|
|
34
|
-
while (index < argv.length) {
|
|
35
|
-
const token = argv[index];
|
|
36
|
-
if (token === void 0) {
|
|
37
|
-
index += 1;
|
|
38
|
-
continue;
|
|
39
|
-
}
|
|
40
|
-
if (terminated || !token.startsWith("-") || token.length === 1) {
|
|
41
|
-
accumulator.positional.push(token);
|
|
42
|
-
index += 1;
|
|
43
|
-
continue;
|
|
44
|
-
}
|
|
45
|
-
if (token === "--") {
|
|
46
|
-
terminated = true;
|
|
47
|
-
index += 1;
|
|
48
|
-
continue;
|
|
49
|
-
}
|
|
50
|
-
const next = argv[index + 1];
|
|
51
|
-
index += token.startsWith("--") ? consumeLongOption(token.slice(2), next, booleanFlags, accumulator) : consumeShortOption(token.slice(1), next, accumulator);
|
|
52
|
-
}
|
|
53
|
-
return { flags: accumulator.flags, options: accumulator.options, positional: accumulator.positional };
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
export { parseArgs as default };
|