everything-dev 1.15.0 → 1.16.1
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/cli/init.cjs +6 -18
- package/dist/cli/init.cjs.map +1 -1
- package/dist/cli/init.d.cts.map +1 -1
- package/dist/cli/init.d.mts.map +1 -1
- package/dist/cli/init.mjs +6 -18
- package/dist/cli/init.mjs.map +1 -1
- package/dist/cli/prompts.cjs +8 -8
- package/dist/cli/prompts.cjs.map +1 -1
- package/dist/cli/prompts.mjs +8 -8
- package/dist/cli/prompts.mjs.map +1 -1
- package/dist/cli/upgrade.cjs +75 -7
- package/dist/cli/upgrade.cjs.map +1 -1
- package/dist/cli/upgrade.mjs +74 -8
- package/dist/cli/upgrade.mjs.map +1 -1
- package/dist/cli.cjs +2 -0
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.mjs +2 -0
- package/dist/cli.mjs.map +1 -1
- package/dist/config.cjs +2 -24
- package/dist/config.cjs.map +1 -1
- package/dist/config.d.cts.map +1 -1
- package/dist/config.d.mts.map +1 -1
- package/dist/config.mjs +3 -25
- package/dist/config.mjs.map +1 -1
- package/dist/contract.cjs +2 -0
- package/dist/contract.cjs.map +1 -1
- package/dist/contract.d.cts +10 -6
- package/dist/contract.d.cts.map +1 -1
- package/dist/contract.d.mts +10 -6
- package/dist/contract.d.mts.map +1 -1
- package/dist/contract.meta.cjs +2 -2
- package/dist/contract.meta.cjs.map +1 -1
- package/dist/contract.meta.d.cts +2 -2
- package/dist/contract.meta.d.mts +2 -2
- package/dist/contract.meta.mjs +2 -2
- package/dist/contract.meta.mjs.map +1 -1
- package/dist/contract.mjs +2 -0
- package/dist/contract.mjs.map +1 -1
- package/dist/fastkv.cjs +0 -45
- package/dist/fastkv.cjs.map +1 -1
- package/dist/fastkv.d.cts +1 -19
- package/dist/fastkv.d.cts.map +1 -1
- package/dist/fastkv.d.mts +1 -19
- package/dist/fastkv.d.mts.map +1 -1
- package/dist/fastkv.mjs +1 -44
- package/dist/fastkv.mjs.map +1 -1
- package/dist/index.cjs +0 -2
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +2 -2
- package/dist/merge.cjs +6 -11
- package/dist/merge.cjs.map +1 -1
- package/dist/merge.d.cts +1 -1
- package/dist/merge.d.cts.map +1 -1
- package/dist/merge.d.mts +1 -1
- package/dist/merge.d.mts.map +1 -1
- package/dist/merge.mjs +6 -11
- package/dist/merge.mjs.map +1 -1
- package/dist/near-cli.cjs +29 -52
- package/dist/near-cli.cjs.map +1 -1
- package/dist/near-cli.mjs +29 -52
- package/dist/near-cli.mjs.map +1 -1
- package/dist/plugin.cjs +36 -38
- package/dist/plugin.cjs.map +1 -1
- package/dist/plugin.d.cts +6 -4
- package/dist/plugin.d.mts +6 -4
- package/dist/plugin.mjs +36 -38
- package/dist/plugin.mjs.map +1 -1
- package/dist/types.d.cts +2 -2
- package/dist/types.d.mts +2 -2
- package/package.json +2 -1
- package/src/cli/init.ts +4 -24
- package/src/cli/prompts.ts +12 -8
- package/src/cli/upgrade.ts +117 -6
- package/src/cli.ts +6 -0
- package/src/config.ts +5 -34
- package/src/contract.meta.ts +2 -2
- package/src/contract.ts +2 -0
- package/src/fastkv.ts +0 -72
- package/src/merge.ts +8 -19
- package/src/near-cli.ts +42 -69
- package/src/plugin.ts +53 -47
package/dist/cli.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.cjs","names":["colors","frames","icons","gradients","findConfigPath","findCommandDescriptor","bosPlugin","parseCommandInput"],"sources":["../src/cli.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { findCommandDescriptor } from \"./cli/catalog\";\nimport { printHelp } from \"./cli/help\";\nimport { parseCommandInput } from \"./cli/parse\";\nimport { findConfigPath } from \"./config\";\nimport bosPlugin from \"./plugin\";\nimport { createPluginRuntime } from \"./sdk\";\nimport { printBanner } from \"./utils/banner\";\nimport { colors, frames, gradients, icons } from \"./utils/theme\";\n\nfunction printConfigView(result: {\n account: string;\n domain?: string;\n staging?: { domain: string };\n app: {\n host: { name?: string; development: string; production?: string };\n ui: { name?: string; development?: string; production?: string; ssr?: string };\n api: { name?: string; development?: string; production?: string; proxy?: string };\n };\n}) {\n console.log();\n console.log(colors.cyan(frames.top(52)));\n console.log(` ${icons.app} ${gradients.cyber(\"CONFIG\")}`);\n console.log(colors.cyan(frames.bottom(52)));\n console.log();\n\n console.log(` ${colors.dim(\"Account\")} ${colors.cyan(result.account)}`);\n console.log(` ${colors.dim(\"Domain\")} ${colors.white(result.domain ?? \"not configured\")}`);\n if (result.staging) {\n console.log(` ${colors.dim(\"Staging\")} ${colors.magenta(result.staging.domain)}`);\n }\n console.log();\n}\n\nfunction formatTimeAgo(isoTimestamp: string): string {\n const now = Date.now();\n const then = new Date(isoTimestamp).getTime();\n const diffMs = now - then;\n const diffMins = Math.floor(diffMs / 60_000);\n if (diffMins < 1) return \"just now\";\n if (diffMins < 60) return `${diffMins} minute${diffMins > 1 ? \"s\" : \"\"} ago`;\n const diffHours = Math.floor(diffMins / 60);\n if (diffHours < 24) return `${diffHours} hour${diffHours > 1 ? \"s\" : \"\"} ago`;\n const diffDays = Math.floor(diffHours / 24);\n if (diffDays < 30) return `${diffDays} day${diffDays > 1 ? \"s\" : \"\"} ago`;\n return isoTimestamp.split(\"T\")[0] ?? isoTimestamp;\n}\n\nfunction normalizeVersion(v: string): string {\n return v.replace(/^[\\^~>=v]+/, \"\").trim();\n}\n\nasync function warnIfOutdated(client: any, command: string): Promise<void> {\n if (![\"dev\", \"build\", \"start\"].includes(command)) return;\n\n try {\n const status = await client.status();\n if (status.status === \"error\" || !status.packages) return;\n\n const outdated = status.packages.filter(\n (p: { name: string; installed?: string; latest?: string }) =>\n p.installed && p.latest && normalizeVersion(p.installed) !== normalizeVersion(p.latest),\n );\n\n if (outdated.length === 0) return;\n\n console.log();\n console.log(colors.yellow(` ! Outdated packages detected:`));\n for (const pkg of outdated) {\n console.log(colors.dim(` ${pkg.name} ${pkg.installed} → ${pkg.latest}`));\n }\n console.log(\n colors.dim(\n ` Run ${colors.cyan(\"bos upgrade\")} to update packages and sync template files.`,\n ),\n );\n console.log();\n } catch {\n // silently ignore if status check fails\n }\n}\n\nasync function main() {\n const args = process.argv.slice(2);\n\n if (args.includes(\"--help\") || args.includes(\"-h\")) {\n printHelp();\n return;\n }\n\n const invocationArgs = args.length > 0 ? args : [\"dev\"];\n const command = invocationArgs[0] ?? \"dev\";\n const configPath = findConfigPath();\n\n const commandMatch = findCommandDescriptor(invocationArgs);\n if (!commandMatch) {\n console.error(`Unknown command: ${command}`);\n process.exit(1);\n }\n\n const { descriptor, consumed } = commandMatch;\n const commandArgs = invocationArgs.slice(consumed);\n\n printBanner();\n\n const runtime = createPluginRuntime({\n registry: {\n bos: { module: bosPlugin },\n },\n secrets: {},\n });\n\n const pluginRuntime: any = runtime;\n const loadPlugin = pluginRuntime.usePlugin.bind(pluginRuntime);\n const plugin = await loadPlugin(\"bos\", {\n variables: {\n configPath: configPath ?? undefined,\n },\n secrets: {},\n });\n\n const client = plugin.createClient();\n\n await warnIfOutdated(client, command);\n\n try {\n const input = parseCommandInput(descriptor, commandArgs);\n const result = await (client as any)[descriptor.key](input);\n\n if (descriptor.key === \"config\") {\n if (!result.config) {\n console.error(\"No bos.config.json found\");\n process.exit(1);\n }\n\n printConfigView(result.config);\n process.stdout.write(`${JSON.stringify(result.config, null, 2)}\\n`);\n return;\n }\n\n if (descriptor.key === \"init\") {\n console.log();\n if (result.status === \"error\") {\n console.error(`[CLI] ${result.error || \"Unknown error\"}`);\n process.exit(1);\n }\n console.log(colors.green(`${icons.ok} Project initialized`));\n console.log(` ${colors.dim(\"Extends:\")} ${result.extends}`);\n console.log(` ${colors.dim(\"Directory:\")} ${result.directory}`);\n if (result.account) console.log(` ${colors.dim(\"Account:\")} ${result.account}`);\n if (result.domain) console.log(` ${colors.dim(\"Domain:\")} ${result.domain}`);\n if (result.plugins && result.plugins.length > 0)\n console.log(` ${colors.dim(\"Plugins:\")} ${result.plugins.join(\", \")}`);\n console.log(` ${colors.dim(\"Files copied:\")} ${result.filesCopied}`);\n console.log();\n console.log(colors.dim(\" Next steps:\"));\n console.log(colors.dim(` cd ${result.directory}`));\n if (result.status === \"initialized\" && !(input as any)?.noInstall) {\n console.log(colors.dim(\" docker compose up -d --wait\"));\n console.log(colors.dim(\" bun run dev\"));\n } else {\n console.log(colors.dim(\" bun install\"));\n console.log(colors.dim(\" docker compose up -d --wait\"));\n console.log(colors.dim(\" bun run dev\"));\n }\n console.log();\n return;\n }\n\n if (descriptor.key === \"sync\") {\n console.log();\n if (result.status === \"error\") {\n console.error(`[CLI] ${result.error || \"Unknown error\"}`);\n process.exit(1);\n }\n if (result.status === \"dry-run\") {\n console.log(colors.cyan(`${icons.ok} Dry run — no files written`));\n } else {\n console.log(colors.green(`${icons.ok} Template synced`));\n }\n if (result.updated.length > 0) {\n console.log(` ${colors.dim(\"Updated:\")} ${result.updated.length} file(s)`);\n for (const f of result.updated) console.log(` ${colors.dim(f)}`);\n }\n if (result.added.length > 0) {\n console.log(` ${colors.dim(\"Added:\")} ${result.added.length} file(s)`);\n for (const f of result.added) console.log(` ${colors.dim(f)}`);\n }\n if (result.skipped.length > 0) {\n console.log(\n ` ${colors.yellow(\"Skipped:\")} ${result.skipped.length} file(s) (locally modified, use --force to overwrite)`,\n );\n for (const f of result.skipped) console.log(` ${colors.dim(f)}`);\n }\n if (result.updated.length === 0 && result.added.length === 0 && result.skipped.length === 0) {\n console.log(` ${colors.dim(\"Already up to date\")}`);\n }\n if (result.status !== \"dry-run\" && result.updated.length > 0) {\n console.log();\n console.log(colors.dim(\" Review changes — your customizations take priority:\"));\n console.log(\n colors.dim(\n \" • api/src/contract.ts, api/src/index.ts, api/src/db/schema.ts — never overwritten\",\n ),\n );\n console.log(\n colors.dim(\" • ui/src/components/**, ui/src/styles.css — never overwritten\"),\n );\n console.log(\n colors.dim(\n \" • Other updated files — accept framework improvements, then restore your changes\",\n ),\n );\n console.log(colors.dim(\" • Skipped files — yours already, only update with --force\"));\n }\n console.log();\n return;\n }\n\n if (descriptor.key === \"upgrade\") {\n console.log();\n if (result.status === \"error\") {\n console.error(`[CLI] ${result.error || \"Unknown error\"}`);\n process.exit(1);\n }\n if (result.status === \"dry-run\") {\n console.log(colors.cyan(`${icons.ok} Dry run — no changes applied`));\n } else {\n console.log(colors.green(`${icons.ok} Upgrade successful`));\n }\n for (const pkg of result.packages) {\n if (pkg.from && pkg.from !== pkg.to) {\n console.log(` ${colors.dim(`${pkg.name}:`)} ${pkg.from} → ${pkg.to}`);\n } else if (!pkg.from) {\n console.log(` ${colors.dim(`${pkg.name}:`)} ${pkg.to} (new)`);\n } else {\n console.log(` ${colors.dim(`${pkg.name}:`)} ${pkg.to} (up to date)`);\n }\n }\n if (result.changelogUrl) {\n console.log(` ${colors.dim(\"Changelog:\")} ${result.changelogUrl}`);\n }\n if (result.sync) {\n const sync = result.sync;\n if (sync.updated.length > 0) {\n console.log(` ${colors.dim(\"Updated:\")} ${sync.updated.length} file(s)`);\n for (const f of sync.updated) console.log(` ${colors.dim(f)}`);\n }\n if (sync.added.length > 0) {\n console.log(` ${colors.dim(\"Added:\")} ${sync.added.length} file(s)`);\n for (const f of sync.added) console.log(` ${colors.dim(f)}`);\n }\n if (sync.skipped.length > 0) {\n console.log(\n ` ${colors.yellow(\"Skipped:\")} ${sync.skipped.length} file(s) (locally modified, use --force to overwrite)`,\n );\n for (const f of sync.skipped) console.log(` ${colors.dim(f)}`);\n }\n if (\n result.status !== \"dry-run\" &&\n (sync.updated.length > 0 || sync.added.length > 0 || sync.skipped.length > 0)\n ) {\n console.log();\n console.log(colors.dim(\" Resolve differences — your code takes priority:\"));\n console.log();\n console.log(colors.dim(\" Never overwritten (safe):\"));\n console.log(\n colors.dim(\" • api/src/contract.ts, api/src/index.ts, api/src/db/schema.ts\"),\n );\n console.log(colors.dim(\" • ui/src/components/**, ui/src/styles.css\"));\n console.log();\n console.log(colors.dim(\" Replaced — review and keep your changes:\"));\n console.log(\n colors.dim(\n \" • api/drizzle.config.ts, api/tsconfig.json, api/tsconfig.contract.json\",\n ),\n );\n console.log(colors.dim(\" • api/plugin.dev.ts, api/rspack.config.js\"));\n console.log(colors.dim(\" • ui/src/routes/* (core routes only)\"));\n console.log();\n console.log(colors.dim(\" Merged — your deps preserved:\"));\n console.log(colors.dim(\" • package.json, api/package.json, ui/package.json\"));\n console.log();\n console.log(colors.dim(\" Skipped — already yours:\"));\n console.log(colors.dim(\" • Use --force only if you want framework updates\"));\n }\n }\n if (result.migrated && result.migrated.length > 0) {\n console.log(` ${colors.yellow(\"Removed:\")} ${result.migrated.length} obsolete file(s)`);\n for (const f of result.migrated) console.log(` ${colors.dim(f)}`);\n }\n console.log();\n return;\n }\n\n if (descriptor.key === \"status\") {\n console.log();\n if (result.status === \"error\") {\n console.error(`[CLI] ${result.error || \"Unknown error\"}`);\n process.exit(1);\n }\n console.log(colors.cyan(frames.top(52)));\n console.log(` ${icons.app} ${gradients.cyber(\"STATUS\")}`);\n console.log(colors.cyan(frames.bottom(52)));\n console.log();\n if (result.extends) console.log(` ${colors.dim(\"Extends:\")} ${result.extends}`);\n if (result.account) console.log(` ${colors.dim(\"Account:\")} ${result.account}`);\n if (result.domain) console.log(` ${colors.dim(\"Domain:\")} ${result.domain}`);\n console.log();\n console.log(` ${colors.dim(\"Packages:\")}`);\n for (const pkg of result.packages) {\n const hasUpdate =\n pkg.installed &&\n pkg.latest &&\n normalizeVersion(pkg.installed) !== normalizeVersion(pkg.latest);\n const versionStr = hasUpdate\n ? `${pkg.installed} → ${pkg.latest}`\n : pkg.installed || \"not installed\";\n const label = hasUpdate ? colors.yellow(versionStr) : colors.dim(versionStr);\n console.log(` ${colors.dim(`${pkg.name}`)} ${label}`);\n }\n console.log();\n if (result.lastSync) {\n const ago = formatTimeAgo(result.lastSync);\n console.log(` ${colors.dim(\"Last sync:\")} ${ago}`);\n } else {\n console.log(` ${colors.dim(\"Last sync:\")} never`);\n }\n const envLabel =\n result.envFile === \"found\"\n ? colors.green(\"found\")\n : result.envFile === \"example-only\"\n ? colors.yellow(\"missing (only .env.example found)\")\n : colors.error(\"missing\");\n console.log(` ${colors.dim(\".env:\")} ${envLabel}`);\n if (result.parentReachable !== undefined) {\n const parentLabel = result.parentReachable\n ? colors.green(\"reachable\")\n : colors.error(\"unreachable\");\n console.log(` ${colors.dim(\"Parent:\")} ${parentLabel}`);\n }\n const hasUpdates = result.packages.some(\n (p: { installed?: string; latest?: string }) =>\n p.installed && p.latest && normalizeVersion(p.installed) !== normalizeVersion(p.latest),\n );\n if (hasUpdates) {\n console.log();\n console.log(\n colors.dim(\n ` Run ${colors.cyan(\"bos upgrade\")} to update packages and sync template files.`,\n ),\n );\n }\n console.log();\n return;\n }\n\n if (descriptor.key === \"typesGen\") {\n console.log();\n if (result.status === \"error\") {\n console.error(`[CLI] ${result.error || \"Unknown error\"}`);\n process.exit(1);\n }\n console.log(colors.green(`${icons.ok} Types generated`));\n if (result.source) {\n console.log(\n ` ${colors.dim(\"Mode:\")} ${result.source === \"remote\" ? colors.cyan(\"remote\") : colors.dim(\"local\")}`,\n );\n }\n if (result.generated.length > 0) {\n console.log(` ${colors.dim(\"Generated:\")}`);\n for (const f of result.generated) console.log(` ${colors.dim(f)}`);\n }\n if (result.fetched.length > 0) {\n console.log(` ${colors.dim(\"Fetched from remote:\")}`);\n for (const url of result.fetched) console.log(` ${colors.dim(url)}`);\n }\n if (result.skipped.length > 0) {\n console.log(` ${colors.dim(\"Skipped (local):\")}`);\n for (const s of result.skipped) console.log(` ${colors.dim(s)}`);\n }\n if (result.failed.length > 0) {\n console.log(` ${colors.yellow(\"Failed:\")}`);\n for (const f of result.failed) console.log(` ${colors.error(f)}`);\n }\n console.log();\n return;\n }\n\n if (result?.status === \"error\") {\n console.error(`[CLI] ${result.error || \"Unknown error\"}`);\n process.exit(1);\n }\n\n if (descriptor.key === \"keyPublish\") {\n process.stdout.write(`Generated publish key for ${result.account}\\n`);\n process.stdout.write(` Network: ${result.network}\\n`);\n process.stdout.write(` Contract: ${result.contract}\\n`);\n process.stdout.write(` Allowance: ${result.allowance}\\n`);\n process.stdout.write(` Functions: ${result.functionNames.join(\", \")}\\n`);\n process.stdout.write(` Public key: ${result.publicKey}\\n`);\n process.stdout.write(` Private key: ${result.privateKey}\\n`);\n process.stdout.write(` Copy: NEAR_PRIVATE_KEY=${result.privateKey}\\n`);\n }\n\n if (descriptor.key === \"pluginAdd\") {\n console.log();\n console.log(colors.green(`${icons.ok} Added plugin ${result.key}`));\n if (result.development) console.log(` ${colors.dim(\"Development:\")} ${result.development}`);\n if (result.production) console.log(` ${colors.dim(\"Production:\")} ${result.production}`);\n console.log();\n return;\n }\n\n if (descriptor.key === \"pluginRemove\") {\n console.log();\n console.log(colors.green(`${icons.ok} Removed plugin ${result.key}`));\n console.log();\n return;\n }\n\n if (descriptor.key === \"pluginList\") {\n console.log();\n console.log(colors.cyan(frames.top(52)));\n console.log(` ${icons.config} ${gradients.cyber(\"PLUGINS\")}`);\n console.log(colors.cyan(frames.bottom(52)));\n console.log();\n if (result.plugins.length === 0) {\n console.log(colors.dim(\" No plugins configured\"));\n } else {\n for (const pluginItem of result.plugins) {\n console.log(` ${colors.cyan(pluginItem.key)}`);\n if (pluginItem.development)\n console.log(` ${colors.dim(\"Development:\")} ${pluginItem.development}`);\n if (pluginItem.production)\n console.log(` ${colors.dim(\"Production:\")} ${pluginItem.production}`);\n }\n }\n console.log();\n return;\n }\n\n if (descriptor.key === \"pluginPublish\") {\n console.log();\n console.log(colors.green(`${icons.ok} Published plugin ${result.key}`));\n if (result.path) console.log(` ${colors.dim(\"Path:\")} ${result.path}`);\n if (result.script) console.log(` ${colors.dim(\"Script:\")} bun run ${result.script}`);\n if (result.production) console.log(` ${colors.dim(\"Production:\")} ${result.production}`);\n console.log();\n return;\n }\n\n if (descriptor.key === \"publish\") {\n if (result.status === \"dry-run\") {\n console.log();\n console.log(colors.cyan(`${icons.ok} Dry run complete`));\n console.log(` ${colors.dim(\"Registry URL:\")} ${result.registryUrl}`);\n console.log();\n return;\n }\n\n if (result.status === \"published\") {\n console.log();\n console.log(colors.green(`${icons.ok} Published successfully`));\n console.log(` ${colors.dim(\"Registry URL:\")} ${result.registryUrl}`);\n if (result.txHash) {\n console.log(` ${colors.dim(\"Transaction:\")} ${result.txHash}`);\n }\n if (result.built && result.built.length > 0) {\n console.log(` ${colors.dim(\"Built:\")} ${result.built.join(\", \")}`);\n }\n if (result.skipped && result.skipped.length > 0) {\n console.log(` ${colors.dim(\"Skipped:\")} ${result.skipped.join(\", \")}`);\n }\n console.log();\n return;\n }\n }\n } catch (error) {\n console.error(`[CLI] ${error instanceof Error ? error.message : String(error)}`);\n process.exit(1);\n }\n}\n\nmain().catch((error) => {\n console.error(\"[CLI] Fatal error:\", error);\n process.exit(1);\n});\n"],"mappings":";;;;;;;;;;;;;AAUA,SAAS,gBAAgB,QAStB;AACD,SAAQ,KAAK;AACb,SAAQ,IAAIA,qBAAO,KAAKC,qBAAO,IAAI,GAAG,CAAC,CAAC;AACxC,SAAQ,IAAI,KAAKC,oBAAM,IAAI,GAAGC,wBAAU,MAAM,SAAS,GAAG;AAC1D,SAAQ,IAAIH,qBAAO,KAAKC,qBAAO,OAAO,GAAG,CAAC,CAAC;AAC3C,SAAQ,KAAK;AAEb,SAAQ,IAAI,KAAKD,qBAAO,IAAI,UAAU,CAAC,IAAIA,qBAAO,KAAK,OAAO,QAAQ,GAAG;AACzE,SAAQ,IAAI,KAAKA,qBAAO,IAAI,SAAS,CAAC,KAAKA,qBAAO,MAAM,OAAO,UAAU,iBAAiB,GAAG;AAC7F,KAAI,OAAO,QACT,SAAQ,IAAI,KAAKA,qBAAO,IAAI,UAAU,CAAC,IAAIA,qBAAO,QAAQ,OAAO,QAAQ,OAAO,GAAG;AAErF,SAAQ,KAAK;;AAGf,SAAS,cAAc,cAA8B;CAGnD,MAAM,SAFM,KAAK,KAAK,GACT,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Q,IAAI,KAAKA,qBAAO,IAAI,cAAc,CAAC,GAAG,OAAO,aAAa;AACzF,WAAQ,KAAK;AACb;;AAGF,MAAI,WAAW,QAAQ,WAAW;AAChC,OAAI,OAAO,WAAW,WAAW;AAC/B,YAAQ,KAAK;AACb,YAAQ,IAAIA,qBAAO,KAAK,GAAGE,oBAAM,GAAG,mBAAmB,CAAC;AACxD,YAAQ,IAAI,KAAKF,qBAAO,IAAI,gBAAgB,CAAC,GAAG,OAAO,cAAc;AACrE,YAAQ,KAAK;AACb;;AAGF,OAAI,OAAO,WAAW,aAAa;AACjC,YAAQ,KAAK;AACb,YAAQ,IAAIA,qBAAO,MAAM,GAAGE,oBAAM,GAAG,yBAAyB,CAAC;AAC/D,YAAQ,IAAI,KAAKF,qBAAO,IAAI,gBAAgB,CAAC,GAAG,OAAO,cAAc;AACrE,QAAI,OAAO,OACT,SAAQ,IAAI,KAAKA,qBAAO,IAAI,eAAe,CAAC,GAAG,OAAO,SAAS;AAEjE,QAAI,OAAO,SAAS,OAAO,MAAM,SAAS,EACxC,SAAQ,IAAI,KAAKA,qBAAO,IAAI,SAAS,CAAC,GAAG,OAAO,MAAM,KAAK,KAAK,GAAG;AAErE,QAAI,OAAO,WAAW,OAAO,QAAQ,SAAS,EAC5C,SAAQ,IAAI,KAAKA,qBAAO,IAAI,WAAW,CAAC,GAAG,OAAO,QAAQ,KAAK,KAAK,GAAG;AAEzE,YAAQ,KAAK;AACb;;;UAGG,OAAO;AACd,UAAQ,MAAM,SAAS,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM,GAAG;AAChF,UAAQ,KAAK,EAAE;;;AAInB,MAAM,CAAC,OAAO,UAAU;AACtB,SAAQ,MAAM,sBAAsB,MAAM;AAC1C,SAAQ,KAAK,EAAE;EACf"}
|
|
1
|
+
{"version":3,"file":"cli.cjs","names":["colors","frames","icons","gradients","findConfigPath","findCommandDescriptor","bosPlugin","parseCommandInput"],"sources":["../src/cli.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { findCommandDescriptor } from \"./cli/catalog\";\nimport { printHelp } from \"./cli/help\";\nimport { parseCommandInput } from \"./cli/parse\";\nimport { findConfigPath } from \"./config\";\nimport bosPlugin from \"./plugin\";\nimport { createPluginRuntime } from \"./sdk\";\nimport { printBanner } from \"./utils/banner\";\nimport { colors, frames, gradients, icons } from \"./utils/theme\";\n\nfunction printConfigView(result: {\n account: string;\n domain?: string;\n staging?: { domain: string };\n app: {\n host: { name?: string; development: string; production?: string };\n ui: { name?: string; development?: string; production?: string; ssr?: string };\n api: { name?: string; development?: string; production?: string; proxy?: string };\n };\n}) {\n console.log();\n console.log(colors.cyan(frames.top(52)));\n console.log(` ${icons.app} ${gradients.cyber(\"CONFIG\")}`);\n console.log(colors.cyan(frames.bottom(52)));\n console.log();\n\n console.log(` ${colors.dim(\"Account\")} ${colors.cyan(result.account)}`);\n console.log(` ${colors.dim(\"Domain\")} ${colors.white(result.domain ?? \"not configured\")}`);\n if (result.staging) {\n console.log(` ${colors.dim(\"Staging\")} ${colors.magenta(result.staging.domain)}`);\n }\n console.log();\n}\n\nfunction formatTimeAgo(isoTimestamp: string): string {\n const now = Date.now();\n const then = new Date(isoTimestamp).getTime();\n const diffMs = now - then;\n const diffMins = Math.floor(diffMs / 60_000);\n if (diffMins < 1) return \"just now\";\n if (diffMins < 60) return `${diffMins} minute${diffMins > 1 ? \"s\" : \"\"} ago`;\n const diffHours = Math.floor(diffMins / 60);\n if (diffHours < 24) return `${diffHours} hour${diffHours > 1 ? \"s\" : \"\"} ago`;\n const diffDays = Math.floor(diffHours / 24);\n if (diffDays < 30) return `${diffDays} day${diffDays > 1 ? \"s\" : \"\"} ago`;\n return isoTimestamp.split(\"T\")[0] ?? isoTimestamp;\n}\n\nfunction normalizeVersion(v: string): string {\n return v.replace(/^[\\^~>=v]+/, \"\").trim();\n}\n\nasync function warnIfOutdated(client: any, command: string): Promise<void> {\n if (![\"dev\", \"build\", \"start\"].includes(command)) return;\n\n try {\n const status = await client.status();\n if (status.status === \"error\" || !status.packages) return;\n\n const outdated = status.packages.filter(\n (p: { name: string; installed?: string; latest?: string }) =>\n p.installed && p.latest && normalizeVersion(p.installed) !== normalizeVersion(p.latest),\n );\n\n if (outdated.length === 0) return;\n\n console.log();\n console.log(colors.yellow(` ! Outdated packages detected:`));\n for (const pkg of outdated) {\n console.log(colors.dim(` ${pkg.name} ${pkg.installed} → ${pkg.latest}`));\n }\n console.log(\n colors.dim(\n ` Run ${colors.cyan(\"bos upgrade\")} to update packages and sync template files.`,\n ),\n );\n console.log();\n } catch {\n // silently ignore if status check fails\n }\n}\n\nasync function main() {\n const args = process.argv.slice(2);\n\n if (args.includes(\"--help\") || args.includes(\"-h\")) {\n printHelp();\n return;\n }\n\n const invocationArgs = args.length > 0 ? args : [\"dev\"];\n const command = invocationArgs[0] ?? \"dev\";\n const configPath = findConfigPath();\n\n const commandMatch = findCommandDescriptor(invocationArgs);\n if (!commandMatch) {\n console.error(`Unknown command: ${command}`);\n process.exit(1);\n }\n\n const { descriptor, consumed } = commandMatch;\n const commandArgs = invocationArgs.slice(consumed);\n\n printBanner();\n\n const runtime = createPluginRuntime({\n registry: {\n bos: { module: bosPlugin },\n },\n secrets: {},\n });\n\n const pluginRuntime: any = runtime;\n const loadPlugin = pluginRuntime.usePlugin.bind(pluginRuntime);\n const plugin = await loadPlugin(\"bos\", {\n variables: {\n configPath: configPath ?? undefined,\n },\n secrets: {},\n });\n\n const client = plugin.createClient();\n\n await warnIfOutdated(client, command);\n\n try {\n const input = parseCommandInput(descriptor, commandArgs);\n const result = await (client as any)[descriptor.key](input);\n\n if (descriptor.key === \"config\") {\n if (!result.config) {\n console.error(\"No bos.config.json found\");\n process.exit(1);\n }\n\n printConfigView(result.config);\n process.stdout.write(`${JSON.stringify(result.config, null, 2)}\\n`);\n return;\n }\n\n if (descriptor.key === \"init\") {\n console.log();\n if (result.status === \"error\") {\n console.error(`[CLI] ${result.error || \"Unknown error\"}`);\n process.exit(1);\n }\n console.log(colors.green(`${icons.ok} Project initialized`));\n console.log(` ${colors.dim(\"Extends:\")} ${result.extends}`);\n console.log(` ${colors.dim(\"Directory:\")} ${result.directory}`);\n if (result.account) console.log(` ${colors.dim(\"Account:\")} ${result.account}`);\n if (result.domain) console.log(` ${colors.dim(\"Domain:\")} ${result.domain}`);\n if (result.plugins && result.plugins.length > 0)\n console.log(` ${colors.dim(\"Plugins:\")} ${result.plugins.join(\", \")}`);\n console.log(` ${colors.dim(\"Files copied:\")} ${result.filesCopied}`);\n console.log();\n console.log(colors.dim(\" Next steps:\"));\n console.log(colors.dim(` cd ${result.directory}`));\n if (result.status === \"initialized\" && !(input as any)?.noInstall) {\n console.log(colors.dim(\" docker compose up -d --wait\"));\n console.log(colors.dim(\" bun run dev\"));\n } else {\n console.log(colors.dim(\" bun install\"));\n console.log(colors.dim(\" docker compose up -d --wait\"));\n console.log(colors.dim(\" bun run dev\"));\n }\n console.log();\n return;\n }\n\n if (descriptor.key === \"sync\") {\n console.log();\n if (result.status === \"error\") {\n console.error(`[CLI] ${result.error || \"Unknown error\"}`);\n process.exit(1);\n }\n if (result.status === \"dry-run\") {\n console.log(colors.cyan(`${icons.ok} Dry run — no files written`));\n } else {\n console.log(colors.green(`${icons.ok} Template synced`));\n }\n if (result.updated.length > 0) {\n console.log(` ${colors.dim(\"Updated:\")} ${result.updated.length} file(s)`);\n for (const f of result.updated) console.log(` ${colors.dim(f)}`);\n }\n if (result.added.length > 0) {\n console.log(` ${colors.dim(\"Added:\")} ${result.added.length} file(s)`);\n for (const f of result.added) console.log(` ${colors.dim(f)}`);\n }\n if (result.skipped.length > 0) {\n console.log(\n ` ${colors.yellow(\"Skipped:\")} ${result.skipped.length} file(s) (locally modified, use --force to overwrite)`,\n );\n for (const f of result.skipped) console.log(` ${colors.dim(f)}`);\n }\n if (result.updated.length === 0 && result.added.length === 0 && result.skipped.length === 0) {\n console.log(` ${colors.dim(\"Already up to date\")}`);\n }\n if (result.status !== \"dry-run\" && result.updated.length > 0) {\n console.log();\n console.log(colors.dim(\" Review changes — your customizations take priority:\"));\n console.log(\n colors.dim(\n \" • api/src/contract.ts, api/src/index.ts, api/src/db/schema.ts — never overwritten\",\n ),\n );\n console.log(\n colors.dim(\" • ui/src/components/**, ui/src/styles.css — never overwritten\"),\n );\n console.log(\n colors.dim(\n \" • Other updated files — accept framework improvements, then restore your changes\",\n ),\n );\n console.log(colors.dim(\" • Skipped files — yours already, only update with --force\"));\n }\n console.log();\n return;\n }\n\n if (descriptor.key === \"upgrade\") {\n console.log();\n if (result.status === \"error\") {\n console.error(`[CLI] ${result.error || \"Unknown error\"}`);\n process.exit(1);\n }\n if (result.status === \"dry-run\") {\n console.log(colors.cyan(`${icons.ok} Dry run — no changes applied`));\n } else {\n console.log(colors.green(`${icons.ok} Upgrade successful`));\n }\n for (const pkg of result.packages) {\n if (pkg.from && pkg.from !== pkg.to) {\n console.log(` ${colors.dim(`${pkg.name}:`)} ${pkg.from} → ${pkg.to}`);\n } else if (!pkg.from) {\n console.log(` ${colors.dim(`${pkg.name}:`)} ${pkg.to} (new)`);\n } else {\n console.log(` ${colors.dim(`${pkg.name}:`)} ${pkg.to} (up to date)`);\n }\n }\n if (result.changelogUrl) {\n console.log(` ${colors.dim(\"Changelog:\")} ${result.changelogUrl}`);\n }\n if (result.availablePlugins && result.availablePlugins.length > 0) {\n console.log(` ${colors.dim(\"New parent plugins:\")} ${result.availablePlugins.join(\", \")}`);\n }\n if (result.selectedPlugins && result.selectedPlugins.length > 0) {\n console.log(` ${colors.dim(\"Added plugins:\")} ${result.selectedPlugins.join(\", \")}`);\n }\n if (result.sync) {\n const sync = result.sync;\n if (sync.updated.length > 0) {\n console.log(` ${colors.dim(\"Updated:\")} ${sync.updated.length} file(s)`);\n for (const f of sync.updated) console.log(` ${colors.dim(f)}`);\n }\n if (sync.added.length > 0) {\n console.log(` ${colors.dim(\"Added:\")} ${sync.added.length} file(s)`);\n for (const f of sync.added) console.log(` ${colors.dim(f)}`);\n }\n if (sync.skipped.length > 0) {\n console.log(\n ` ${colors.yellow(\"Skipped:\")} ${sync.skipped.length} file(s) (locally modified, use --force to overwrite)`,\n );\n for (const f of sync.skipped) console.log(` ${colors.dim(f)}`);\n }\n if (\n result.status !== \"dry-run\" &&\n (sync.updated.length > 0 || sync.added.length > 0 || sync.skipped.length > 0)\n ) {\n console.log();\n console.log(colors.dim(\" Resolve differences — your code takes priority:\"));\n console.log();\n console.log(colors.dim(\" Never overwritten (safe):\"));\n console.log(\n colors.dim(\" • api/src/contract.ts, api/src/index.ts, api/src/db/schema.ts\"),\n );\n console.log(colors.dim(\" • ui/src/components/**, ui/src/styles.css\"));\n console.log();\n console.log(colors.dim(\" Replaced — review and keep your changes:\"));\n console.log(\n colors.dim(\n \" • api/drizzle.config.ts, api/tsconfig.json, api/tsconfig.contract.json\",\n ),\n );\n console.log(colors.dim(\" • api/plugin.dev.ts, api/rspack.config.js\"));\n console.log(colors.dim(\" • ui/src/routes/* (core routes only)\"));\n console.log();\n console.log(colors.dim(\" Merged — your deps preserved:\"));\n console.log(colors.dim(\" • package.json, api/package.json, ui/package.json\"));\n console.log();\n console.log(colors.dim(\" Skipped — already yours:\"));\n console.log(colors.dim(\" • Use --force only if you want framework updates\"));\n }\n }\n if (result.migrated && result.migrated.length > 0) {\n console.log(` ${colors.yellow(\"Removed:\")} ${result.migrated.length} obsolete file(s)`);\n for (const f of result.migrated) console.log(` ${colors.dim(f)}`);\n }\n console.log();\n return;\n }\n\n if (descriptor.key === \"status\") {\n console.log();\n if (result.status === \"error\") {\n console.error(`[CLI] ${result.error || \"Unknown error\"}`);\n process.exit(1);\n }\n console.log(colors.cyan(frames.top(52)));\n console.log(` ${icons.app} ${gradients.cyber(\"STATUS\")}`);\n console.log(colors.cyan(frames.bottom(52)));\n console.log();\n if (result.extends) console.log(` ${colors.dim(\"Extends:\")} ${result.extends}`);\n if (result.account) console.log(` ${colors.dim(\"Account:\")} ${result.account}`);\n if (result.domain) console.log(` ${colors.dim(\"Domain:\")} ${result.domain}`);\n console.log();\n console.log(` ${colors.dim(\"Packages:\")}`);\n for (const pkg of result.packages) {\n const hasUpdate =\n pkg.installed &&\n pkg.latest &&\n normalizeVersion(pkg.installed) !== normalizeVersion(pkg.latest);\n const versionStr = hasUpdate\n ? `${pkg.installed} → ${pkg.latest}`\n : pkg.installed || \"not installed\";\n const label = hasUpdate ? colors.yellow(versionStr) : colors.dim(versionStr);\n console.log(` ${colors.dim(`${pkg.name}`)} ${label}`);\n }\n console.log();\n if (result.lastSync) {\n const ago = formatTimeAgo(result.lastSync);\n console.log(` ${colors.dim(\"Last sync:\")} ${ago}`);\n } else {\n console.log(` ${colors.dim(\"Last sync:\")} never`);\n }\n const envLabel =\n result.envFile === \"found\"\n ? colors.green(\"found\")\n : result.envFile === \"example-only\"\n ? colors.yellow(\"missing (only .env.example found)\")\n : colors.error(\"missing\");\n console.log(` ${colors.dim(\".env:\")} ${envLabel}`);\n if (result.parentReachable !== undefined) {\n const parentLabel = result.parentReachable\n ? colors.green(\"reachable\")\n : colors.error(\"unreachable\");\n console.log(` ${colors.dim(\"Parent:\")} ${parentLabel}`);\n }\n const hasUpdates = result.packages.some(\n (p: { installed?: string; latest?: string }) =>\n p.installed && p.latest && normalizeVersion(p.installed) !== normalizeVersion(p.latest),\n );\n if (hasUpdates) {\n console.log();\n console.log(\n colors.dim(\n ` Run ${colors.cyan(\"bos upgrade\")} to update packages and sync template files.`,\n ),\n );\n }\n console.log();\n return;\n }\n\n if (descriptor.key === \"typesGen\") {\n console.log();\n if (result.status === \"error\") {\n console.error(`[CLI] ${result.error || \"Unknown error\"}`);\n process.exit(1);\n }\n console.log(colors.green(`${icons.ok} Types generated`));\n if (result.source) {\n console.log(\n ` ${colors.dim(\"Mode:\")} ${result.source === \"remote\" ? colors.cyan(\"remote\") : colors.dim(\"local\")}`,\n );\n }\n if (result.generated.length > 0) {\n console.log(` ${colors.dim(\"Generated:\")}`);\n for (const f of result.generated) console.log(` ${colors.dim(f)}`);\n }\n if (result.fetched.length > 0) {\n console.log(` ${colors.dim(\"Fetched from remote:\")}`);\n for (const url of result.fetched) console.log(` ${colors.dim(url)}`);\n }\n if (result.skipped.length > 0) {\n console.log(` ${colors.dim(\"Skipped (local):\")}`);\n for (const s of result.skipped) console.log(` ${colors.dim(s)}`);\n }\n if (result.failed.length > 0) {\n console.log(` ${colors.yellow(\"Failed:\")}`);\n for (const f of result.failed) console.log(` ${colors.error(f)}`);\n }\n console.log();\n return;\n }\n\n if (result?.status === \"error\") {\n console.error(`[CLI] ${result.error || \"Unknown error\"}`);\n process.exit(1);\n }\n\n if (descriptor.key === \"keyPublish\") {\n process.stdout.write(`Generated publish key for ${result.account}\\n`);\n process.stdout.write(` Network: ${result.network}\\n`);\n process.stdout.write(` Contract: ${result.contract}\\n`);\n process.stdout.write(` Allowance: ${result.allowance}\\n`);\n process.stdout.write(` Functions: ${result.functionNames.join(\", \")}\\n`);\n process.stdout.write(` Public key: ${result.publicKey}\\n`);\n process.stdout.write(` Private key: ${result.privateKey}\\n`);\n process.stdout.write(` Copy: NEAR_PRIVATE_KEY=${result.privateKey}\\n`);\n }\n\n if (descriptor.key === \"pluginAdd\") {\n console.log();\n console.log(colors.green(`${icons.ok} Added plugin ${result.key}`));\n if (result.development) console.log(` ${colors.dim(\"Development:\")} ${result.development}`);\n if (result.production) console.log(` ${colors.dim(\"Production:\")} ${result.production}`);\n console.log();\n return;\n }\n\n if (descriptor.key === \"pluginRemove\") {\n console.log();\n console.log(colors.green(`${icons.ok} Removed plugin ${result.key}`));\n console.log();\n return;\n }\n\n if (descriptor.key === \"pluginList\") {\n console.log();\n console.log(colors.cyan(frames.top(52)));\n console.log(` ${icons.config} ${gradients.cyber(\"PLUGINS\")}`);\n console.log(colors.cyan(frames.bottom(52)));\n console.log();\n if (result.plugins.length === 0) {\n console.log(colors.dim(\" No plugins configured\"));\n } else {\n for (const pluginItem of result.plugins) {\n console.log(` ${colors.cyan(pluginItem.key)}`);\n if (pluginItem.development)\n console.log(` ${colors.dim(\"Development:\")} ${pluginItem.development}`);\n if (pluginItem.production)\n console.log(` ${colors.dim(\"Production:\")} ${pluginItem.production}`);\n }\n }\n console.log();\n return;\n }\n\n if (descriptor.key === \"pluginPublish\") {\n console.log();\n console.log(colors.green(`${icons.ok} Published plugin ${result.key}`));\n if (result.path) console.log(` ${colors.dim(\"Path:\")} ${result.path}`);\n if (result.script) console.log(` ${colors.dim(\"Script:\")} bun run ${result.script}`);\n if (result.production) console.log(` ${colors.dim(\"Production:\")} ${result.production}`);\n console.log();\n return;\n }\n\n if (descriptor.key === \"publish\") {\n if (result.status === \"dry-run\") {\n console.log();\n console.log(colors.cyan(`${icons.ok} Dry run complete`));\n console.log(` ${colors.dim(\"Registry URL:\")} ${result.registryUrl}`);\n console.log();\n return;\n }\n\n if (result.status === \"published\") {\n console.log();\n console.log(colors.green(`${icons.ok} Published successfully`));\n console.log(` ${colors.dim(\"Registry URL:\")} ${result.registryUrl}`);\n if (result.txHash) {\n console.log(` ${colors.dim(\"Transaction:\")} ${result.txHash}`);\n }\n if (result.built && result.built.length > 0) {\n console.log(` ${colors.dim(\"Built:\")} ${result.built.join(\", \")}`);\n }\n if (result.skipped && result.skipped.length > 0) {\n console.log(` ${colors.dim(\"Skipped:\")} ${result.skipped.join(\", \")}`);\n }\n console.log();\n return;\n }\n }\n } catch (error) {\n console.error(`[CLI] ${error instanceof Error ? error.message : String(error)}`);\n process.exit(1);\n }\n}\n\nmain().catch((error) => {\n console.error(\"[CLI] Fatal error:\", error);\n process.exit(1);\n});\n"],"mappings":";;;;;;;;;;;;;AAUA,SAAS,gBAAgB,QAStB;AACD,SAAQ,KAAK;AACb,SAAQ,IAAIA,qBAAO,KAAKC,qBAAO,IAAI,GAAG,CAAC,CAAC;AACxC,SAAQ,IAAI,KAAKC,oBAAM,IAAI,GAAGC,wBAAU,MAAM,SAAS,GAAG;AAC1D,SAAQ,IAAIH,qBAAO,KAAKC,qBAAO,OAAO,GAAG,CAAC,CAAC;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,OACT,SAAQ,IAAI,KAAKA,qBAAO,IAAI,eAAe,CAAC,GAAG,OAAO,SAAS;AAEjE,QAAI,OAAO,SAAS,OAAO,MAAM,SAAS,EACxC,SAAQ,IAAI,KAAKA,qBAAO,IAAI,SAAS,CAAC,GAAG,OAAO,MAAM,KAAK,KAAK,GAAG;AAErE,QAAI,OAAO,WAAW,OAAO,QAAQ,SAAS,EAC5C,SAAQ,IAAI,KAAKA,qBAAO,IAAI,WAAW,CAAC,GAAG,OAAO,QAAQ,KAAK,KAAK,GAAG;AAEzE,YAAQ,KAAK;AACb;;;UAGG,OAAO;AACd,UAAQ,MAAM,SAAS,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM,GAAG;AAChF,UAAQ,KAAK,EAAE;;;AAInB,MAAM,CAAC,OAAO,UAAU;AACtB,SAAQ,MAAM,sBAAsB,MAAM;AAC1C,SAAQ,KAAK,EAAE;EACf"}
|
package/dist/cli.mjs
CHANGED
|
@@ -161,6 +161,8 @@ async function main() {
|
|
|
161
161
|
else if (!pkg.from) console.log(` ${colors.dim(`${pkg.name}:`)} ${pkg.to} (new)`);
|
|
162
162
|
else console.log(` ${colors.dim(`${pkg.name}:`)} ${pkg.to} (up to date)`);
|
|
163
163
|
if (result.changelogUrl) console.log(` ${colors.dim("Changelog:")} ${result.changelogUrl}`);
|
|
164
|
+
if (result.availablePlugins && result.availablePlugins.length > 0) console.log(` ${colors.dim("New parent plugins:")} ${result.availablePlugins.join(", ")}`);
|
|
165
|
+
if (result.selectedPlugins && result.selectedPlugins.length > 0) console.log(` ${colors.dim("Added plugins:")} ${result.selectedPlugins.join(", ")}`);
|
|
164
166
|
if (result.sync) {
|
|
165
167
|
const sync = result.sync;
|
|
166
168
|
if (sync.updated.length > 0) {
|
package/dist/cli.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.mjs","names":["bosPlugin"],"sources":["../src/cli.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { findCommandDescriptor } from \"./cli/catalog\";\nimport { printHelp } from \"./cli/help\";\nimport { parseCommandInput } from \"./cli/parse\";\nimport { findConfigPath } from \"./config\";\nimport bosPlugin from \"./plugin\";\nimport { createPluginRuntime } from \"./sdk\";\nimport { printBanner } from \"./utils/banner\";\nimport { colors, frames, gradients, icons } from \"./utils/theme\";\n\nfunction printConfigView(result: {\n account: string;\n domain?: string;\n staging?: { domain: string };\n app: {\n host: { name?: string; development: string; production?: string };\n ui: { name?: string; development?: string; production?: string; ssr?: string };\n api: { name?: string; development?: string; production?: string; proxy?: string };\n };\n}) {\n console.log();\n console.log(colors.cyan(frames.top(52)));\n console.log(` ${icons.app} ${gradients.cyber(\"CONFIG\")}`);\n console.log(colors.cyan(frames.bottom(52)));\n console.log();\n\n console.log(` ${colors.dim(\"Account\")} ${colors.cyan(result.account)}`);\n console.log(` ${colors.dim(\"Domain\")} ${colors.white(result.domain ?? \"not configured\")}`);\n if (result.staging) {\n console.log(` ${colors.dim(\"Staging\")} ${colors.magenta(result.staging.domain)}`);\n }\n console.log();\n}\n\nfunction formatTimeAgo(isoTimestamp: string): string {\n const now = Date.now();\n const then = new Date(isoTimestamp).getTime();\n const diffMs = now - then;\n const diffMins = Math.floor(diffMs / 60_000);\n if (diffMins < 1) return \"just now\";\n if (diffMins < 60) return `${diffMins} minute${diffMins > 1 ? \"s\" : \"\"} ago`;\n const diffHours = Math.floor(diffMins / 60);\n if (diffHours < 24) return `${diffHours} hour${diffHours > 1 ? \"s\" : \"\"} ago`;\n const diffDays = Math.floor(diffHours / 24);\n if (diffDays < 30) return `${diffDays} day${diffDays > 1 ? \"s\" : \"\"} ago`;\n return isoTimestamp.split(\"T\")[0] ?? isoTimestamp;\n}\n\nfunction normalizeVersion(v: string): string {\n return v.replace(/^[\\^~>=v]+/, \"\").trim();\n}\n\nasync function warnIfOutdated(client: any, command: string): Promise<void> {\n if (![\"dev\", \"build\", \"start\"].includes(command)) return;\n\n try {\n const status = await client.status();\n if (status.status === \"error\" || !status.packages) return;\n\n const outdated = status.packages.filter(\n (p: { name: string; installed?: string; latest?: string }) =>\n p.installed && p.latest && normalizeVersion(p.installed) !== normalizeVersion(p.latest),\n );\n\n if (outdated.length === 0) return;\n\n console.log();\n console.log(colors.yellow(` ! Outdated packages detected:`));\n for (const pkg of outdated) {\n console.log(colors.dim(` ${pkg.name} ${pkg.installed} → ${pkg.latest}`));\n }\n console.log(\n colors.dim(\n ` Run ${colors.cyan(\"bos upgrade\")} to update packages and sync template files.`,\n ),\n );\n console.log();\n } catch {\n // silently ignore if status check fails\n }\n}\n\nasync function main() {\n const args = process.argv.slice(2);\n\n if (args.includes(\"--help\") || args.includes(\"-h\")) {\n printHelp();\n return;\n }\n\n const invocationArgs = args.length > 0 ? args : [\"dev\"];\n const command = invocationArgs[0] ?? \"dev\";\n const configPath = findConfigPath();\n\n const commandMatch = findCommandDescriptor(invocationArgs);\n if (!commandMatch) {\n console.error(`Unknown command: ${command}`);\n process.exit(1);\n }\n\n const { descriptor, consumed } = commandMatch;\n const commandArgs = invocationArgs.slice(consumed);\n\n printBanner();\n\n const runtime = createPluginRuntime({\n registry: {\n bos: { module: bosPlugin },\n },\n secrets: {},\n });\n\n const pluginRuntime: any = runtime;\n const loadPlugin = pluginRuntime.usePlugin.bind(pluginRuntime);\n const plugin = await loadPlugin(\"bos\", {\n variables: {\n configPath: configPath ?? undefined,\n },\n secrets: {},\n });\n\n const client = plugin.createClient();\n\n await warnIfOutdated(client, command);\n\n try {\n const input = parseCommandInput(descriptor, commandArgs);\n const result = await (client as any)[descriptor.key](input);\n\n if (descriptor.key === \"config\") {\n if (!result.config) {\n console.error(\"No bos.config.json found\");\n process.exit(1);\n }\n\n printConfigView(result.config);\n process.stdout.write(`${JSON.stringify(result.config, null, 2)}\\n`);\n return;\n }\n\n if (descriptor.key === \"init\") {\n console.log();\n if (result.status === \"error\") {\n console.error(`[CLI] ${result.error || \"Unknown error\"}`);\n process.exit(1);\n }\n console.log(colors.green(`${icons.ok} Project initialized`));\n console.log(` ${colors.dim(\"Extends:\")} ${result.extends}`);\n console.log(` ${colors.dim(\"Directory:\")} ${result.directory}`);\n if (result.account) console.log(` ${colors.dim(\"Account:\")} ${result.account}`);\n if (result.domain) console.log(` ${colors.dim(\"Domain:\")} ${result.domain}`);\n if (result.plugins && result.plugins.length > 0)\n console.log(` ${colors.dim(\"Plugins:\")} ${result.plugins.join(\", \")}`);\n console.log(` ${colors.dim(\"Files copied:\")} ${result.filesCopied}`);\n console.log();\n console.log(colors.dim(\" Next steps:\"));\n console.log(colors.dim(` cd ${result.directory}`));\n if (result.status === \"initialized\" && !(input as any)?.noInstall) {\n console.log(colors.dim(\" docker compose up -d --wait\"));\n console.log(colors.dim(\" bun run dev\"));\n } else {\n console.log(colors.dim(\" bun install\"));\n console.log(colors.dim(\" docker compose up -d --wait\"));\n console.log(colors.dim(\" bun run dev\"));\n }\n console.log();\n return;\n }\n\n if (descriptor.key === \"sync\") {\n console.log();\n if (result.status === \"error\") {\n console.error(`[CLI] ${result.error || \"Unknown error\"}`);\n process.exit(1);\n }\n if (result.status === \"dry-run\") {\n console.log(colors.cyan(`${icons.ok} Dry run — no files written`));\n } else {\n console.log(colors.green(`${icons.ok} Template synced`));\n }\n if (result.updated.length > 0) {\n console.log(` ${colors.dim(\"Updated:\")} ${result.updated.length} file(s)`);\n for (const f of result.updated) console.log(` ${colors.dim(f)}`);\n }\n if (result.added.length > 0) {\n console.log(` ${colors.dim(\"Added:\")} ${result.added.length} file(s)`);\n for (const f of result.added) console.log(` ${colors.dim(f)}`);\n }\n if (result.skipped.length > 0) {\n console.log(\n ` ${colors.yellow(\"Skipped:\")} ${result.skipped.length} file(s) (locally modified, use --force to overwrite)`,\n );\n for (const f of result.skipped) console.log(` ${colors.dim(f)}`);\n }\n if (result.updated.length === 0 && result.added.length === 0 && result.skipped.length === 0) {\n console.log(` ${colors.dim(\"Already up to date\")}`);\n }\n if (result.status !== \"dry-run\" && result.updated.length > 0) {\n console.log();\n console.log(colors.dim(\" Review changes — your customizations take priority:\"));\n console.log(\n colors.dim(\n \" • api/src/contract.ts, api/src/index.ts, api/src/db/schema.ts — never overwritten\",\n ),\n );\n console.log(\n colors.dim(\" • ui/src/components/**, ui/src/styles.css — never overwritten\"),\n );\n console.log(\n colors.dim(\n \" • Other updated files — accept framework improvements, then restore your changes\",\n ),\n );\n console.log(colors.dim(\" • Skipped files — yours already, only update with --force\"));\n }\n console.log();\n return;\n }\n\n if (descriptor.key === \"upgrade\") {\n console.log();\n if (result.status === \"error\") {\n console.error(`[CLI] ${result.error || \"Unknown error\"}`);\n process.exit(1);\n }\n if (result.status === \"dry-run\") {\n console.log(colors.cyan(`${icons.ok} Dry run — no changes applied`));\n } else {\n console.log(colors.green(`${icons.ok} Upgrade successful`));\n }\n for (const pkg of result.packages) {\n if (pkg.from && pkg.from !== pkg.to) {\n console.log(` ${colors.dim(`${pkg.name}:`)} ${pkg.from} → ${pkg.to}`);\n } else if (!pkg.from) {\n console.log(` ${colors.dim(`${pkg.name}:`)} ${pkg.to} (new)`);\n } else {\n console.log(` ${colors.dim(`${pkg.name}:`)} ${pkg.to} (up to date)`);\n }\n }\n if (result.changelogUrl) {\n console.log(` ${colors.dim(\"Changelog:\")} ${result.changelogUrl}`);\n }\n if (result.sync) {\n const sync = result.sync;\n if (sync.updated.length > 0) {\n console.log(` ${colors.dim(\"Updated:\")} ${sync.updated.length} file(s)`);\n for (const f of sync.updated) console.log(` ${colors.dim(f)}`);\n }\n if (sync.added.length > 0) {\n console.log(` ${colors.dim(\"Added:\")} ${sync.added.length} file(s)`);\n for (const f of sync.added) console.log(` ${colors.dim(f)}`);\n }\n if (sync.skipped.length > 0) {\n console.log(\n ` ${colors.yellow(\"Skipped:\")} ${sync.skipped.length} file(s) (locally modified, use --force to overwrite)`,\n );\n for (const f of sync.skipped) console.log(` ${colors.dim(f)}`);\n }\n if (\n result.status !== \"dry-run\" &&\n (sync.updated.length > 0 || sync.added.length > 0 || sync.skipped.length > 0)\n ) {\n console.log();\n console.log(colors.dim(\" Resolve differences — your code takes priority:\"));\n console.log();\n console.log(colors.dim(\" Never overwritten (safe):\"));\n console.log(\n colors.dim(\" • api/src/contract.ts, api/src/index.ts, api/src/db/schema.ts\"),\n );\n console.log(colors.dim(\" • ui/src/components/**, ui/src/styles.css\"));\n console.log();\n console.log(colors.dim(\" Replaced — review and keep your changes:\"));\n console.log(\n colors.dim(\n \" • api/drizzle.config.ts, api/tsconfig.json, api/tsconfig.contract.json\",\n ),\n );\n console.log(colors.dim(\" • api/plugin.dev.ts, api/rspack.config.js\"));\n console.log(colors.dim(\" • ui/src/routes/* (core routes only)\"));\n console.log();\n console.log(colors.dim(\" Merged — your deps preserved:\"));\n console.log(colors.dim(\" • package.json, api/package.json, ui/package.json\"));\n console.log();\n console.log(colors.dim(\" Skipped — already yours:\"));\n console.log(colors.dim(\" • Use --force only if you want framework updates\"));\n }\n }\n if (result.migrated && result.migrated.length > 0) {\n console.log(` ${colors.yellow(\"Removed:\")} ${result.migrated.length} obsolete file(s)`);\n for (const f of result.migrated) console.log(` ${colors.dim(f)}`);\n }\n console.log();\n return;\n }\n\n if (descriptor.key === \"status\") {\n console.log();\n if (result.status === \"error\") {\n console.error(`[CLI] ${result.error || \"Unknown error\"}`);\n process.exit(1);\n }\n console.log(colors.cyan(frames.top(52)));\n console.log(` ${icons.app} ${gradients.cyber(\"STATUS\")}`);\n console.log(colors.cyan(frames.bottom(52)));\n console.log();\n if (result.extends) console.log(` ${colors.dim(\"Extends:\")} ${result.extends}`);\n if (result.account) console.log(` ${colors.dim(\"Account:\")} ${result.account}`);\n if (result.domain) console.log(` ${colors.dim(\"Domain:\")} ${result.domain}`);\n console.log();\n console.log(` ${colors.dim(\"Packages:\")}`);\n for (const pkg of result.packages) {\n const hasUpdate =\n pkg.installed &&\n pkg.latest &&\n normalizeVersion(pkg.installed) !== normalizeVersion(pkg.latest);\n const versionStr = hasUpdate\n ? `${pkg.installed} → ${pkg.latest}`\n : pkg.installed || \"not installed\";\n const label = hasUpdate ? colors.yellow(versionStr) : colors.dim(versionStr);\n console.log(` ${colors.dim(`${pkg.name}`)} ${label}`);\n }\n console.log();\n if (result.lastSync) {\n const ago = formatTimeAgo(result.lastSync);\n console.log(` ${colors.dim(\"Last sync:\")} ${ago}`);\n } else {\n console.log(` ${colors.dim(\"Last sync:\")} never`);\n }\n const envLabel =\n result.envFile === \"found\"\n ? colors.green(\"found\")\n : result.envFile === \"example-only\"\n ? colors.yellow(\"missing (only .env.example found)\")\n : colors.error(\"missing\");\n console.log(` ${colors.dim(\".env:\")} ${envLabel}`);\n if (result.parentReachable !== undefined) {\n const parentLabel = result.parentReachable\n ? colors.green(\"reachable\")\n : colors.error(\"unreachable\");\n console.log(` ${colors.dim(\"Parent:\")} ${parentLabel}`);\n }\n const hasUpdates = result.packages.some(\n (p: { installed?: string; latest?: string }) =>\n p.installed && p.latest && normalizeVersion(p.installed) !== normalizeVersion(p.latest),\n );\n if (hasUpdates) {\n console.log();\n console.log(\n colors.dim(\n ` Run ${colors.cyan(\"bos upgrade\")} to update packages and sync template files.`,\n ),\n );\n }\n console.log();\n return;\n }\n\n if (descriptor.key === \"typesGen\") {\n console.log();\n if (result.status === \"error\") {\n console.error(`[CLI] ${result.error || \"Unknown error\"}`);\n process.exit(1);\n }\n console.log(colors.green(`${icons.ok} Types generated`));\n if (result.source) {\n console.log(\n ` ${colors.dim(\"Mode:\")} ${result.source === \"remote\" ? colors.cyan(\"remote\") : colors.dim(\"local\")}`,\n );\n }\n if (result.generated.length > 0) {\n console.log(` ${colors.dim(\"Generated:\")}`);\n for (const f of result.generated) console.log(` ${colors.dim(f)}`);\n }\n if (result.fetched.length > 0) {\n console.log(` ${colors.dim(\"Fetched from remote:\")}`);\n for (const url of result.fetched) console.log(` ${colors.dim(url)}`);\n }\n if (result.skipped.length > 0) {\n console.log(` ${colors.dim(\"Skipped (local):\")}`);\n for (const s of result.skipped) console.log(` ${colors.dim(s)}`);\n }\n if (result.failed.length > 0) {\n console.log(` ${colors.yellow(\"Failed:\")}`);\n for (const f of result.failed) console.log(` ${colors.error(f)}`);\n }\n console.log();\n return;\n }\n\n if (result?.status === \"error\") {\n console.error(`[CLI] ${result.error || \"Unknown error\"}`);\n process.exit(1);\n }\n\n if (descriptor.key === \"keyPublish\") {\n process.stdout.write(`Generated publish key for ${result.account}\\n`);\n process.stdout.write(` Network: ${result.network}\\n`);\n process.stdout.write(` Contract: ${result.contract}\\n`);\n process.stdout.write(` Allowance: ${result.allowance}\\n`);\n process.stdout.write(` Functions: ${result.functionNames.join(\", \")}\\n`);\n process.stdout.write(` Public key: ${result.publicKey}\\n`);\n process.stdout.write(` Private key: ${result.privateKey}\\n`);\n process.stdout.write(` Copy: NEAR_PRIVATE_KEY=${result.privateKey}\\n`);\n }\n\n if (descriptor.key === \"pluginAdd\") {\n console.log();\n console.log(colors.green(`${icons.ok} Added plugin ${result.key}`));\n if (result.development) console.log(` ${colors.dim(\"Development:\")} ${result.development}`);\n if (result.production) console.log(` ${colors.dim(\"Production:\")} ${result.production}`);\n console.log();\n return;\n }\n\n if (descriptor.key === \"pluginRemove\") {\n console.log();\n console.log(colors.green(`${icons.ok} Removed plugin ${result.key}`));\n console.log();\n return;\n }\n\n if (descriptor.key === \"pluginList\") {\n console.log();\n console.log(colors.cyan(frames.top(52)));\n console.log(` ${icons.config} ${gradients.cyber(\"PLUGINS\")}`);\n console.log(colors.cyan(frames.bottom(52)));\n console.log();\n if (result.plugins.length === 0) {\n console.log(colors.dim(\" No plugins configured\"));\n } else {\n for (const pluginItem of result.plugins) {\n console.log(` ${colors.cyan(pluginItem.key)}`);\n if (pluginItem.development)\n console.log(` ${colors.dim(\"Development:\")} ${pluginItem.development}`);\n if (pluginItem.production)\n console.log(` ${colors.dim(\"Production:\")} ${pluginItem.production}`);\n }\n }\n console.log();\n return;\n }\n\n if (descriptor.key === \"pluginPublish\") {\n console.log();\n console.log(colors.green(`${icons.ok} Published plugin ${result.key}`));\n if (result.path) console.log(` ${colors.dim(\"Path:\")} ${result.path}`);\n if (result.script) console.log(` ${colors.dim(\"Script:\")} bun run ${result.script}`);\n if (result.production) console.log(` ${colors.dim(\"Production:\")} ${result.production}`);\n console.log();\n return;\n }\n\n if (descriptor.key === \"publish\") {\n if (result.status === \"dry-run\") {\n console.log();\n console.log(colors.cyan(`${icons.ok} Dry run complete`));\n console.log(` ${colors.dim(\"Registry URL:\")} ${result.registryUrl}`);\n console.log();\n return;\n }\n\n if (result.status === \"published\") {\n console.log();\n console.log(colors.green(`${icons.ok} Published successfully`));\n console.log(` ${colors.dim(\"Registry URL:\")} ${result.registryUrl}`);\n if (result.txHash) {\n console.log(` ${colors.dim(\"Transaction:\")} ${result.txHash}`);\n }\n if (result.built && result.built.length > 0) {\n console.log(` ${colors.dim(\"Built:\")} ${result.built.join(\", \")}`);\n }\n if (result.skipped && result.skipped.length > 0) {\n console.log(` ${colors.dim(\"Skipped:\")} ${result.skipped.join(\", \")}`);\n }\n console.log();\n return;\n }\n }\n } catch (error) {\n console.error(`[CLI] ${error instanceof Error ? error.message : String(error)}`);\n process.exit(1);\n }\n}\n\nmain().catch((error) => {\n console.error(\"[CLI] Fatal error:\", error);\n process.exit(1);\n});\n"],"mappings":";;;;;;;;;;;AAUA,SAAS,gBAAgB,QAStB;AACD,SAAQ,KAAK;AACb,SAAQ,IAAI,OAAO,KAAK,OAAO,IAAI,GAAG,CAAC,CAAC;AACxC,SAAQ,IAAI,KAAK,MAAM,IAAI,GAAG,UAAU,MAAM,SAAS,GAAG;AAC1D,SAAQ,IAAI,OAAO,KAAK,OAAO,OAAO,GAAG,CAAC,CAAC;AAC3C,SAAQ,KAAK;AAEb,SAAQ,IAAI,KAAK,OAAO,IAAI,UAAU,CAAC,IAAI,OAAO,KAAK,OAAO,QAAQ,GAAG;AACzE,SAAQ,IAAI,KAAK,OAAO,IAAI,SAAS,CAAC,KAAK,OAAO,MAAM,OAAO,UAAU,iBAAiB,GAAG;AAC7F,KAAI,OAAO,QACT,S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AChC,OAAI,OAAO,WAAW,WAAW;AAC/B,YAAQ,KAAK;AACb,YAAQ,IAAI,OAAO,KAAK,GAAG,MAAM,GAAG,mBAAmB,CAAC;AACxD,YAAQ,IAAI,KAAK,OAAO,IAAI,gBAAgB,CAAC,GAAG,OAAO,cAAc;AACrE,YAAQ,KAAK;AACb;;AAGF,OAAI,OAAO,WAAW,aAAa;AACjC,YAAQ,KAAK;AACb,YAAQ,IAAI,OAAO,MAAM,GAAG,MAAM,GAAG,yBAAyB,CAAC;AAC/D,YAAQ,IAAI,KAAK,OAAO,IAAI,gBAAgB,CAAC,GAAG,OAAO,cAAc;AACrE,QAAI,OAAO,OACT,SAAQ,IAAI,KAAK,OAAO,IAAI,eAAe,CAAC,GAAG,OAAO,SAAS;AAEjE,QAAI,OAAO,SAAS,OAAO,MAAM,SAAS,EACxC,SAAQ,IAAI,KAAK,OAAO,IAAI,SAAS,CAAC,GAAG,OAAO,MAAM,KAAK,KAAK,GAAG;AAErE,QAAI,OAAO,WAAW,OAAO,QAAQ,SAAS,EAC5C,SAAQ,IAAI,KAAK,OAAO,IAAI,WAAW,CAAC,GAAG,OAAO,QAAQ,KAAK,KAAK,GAAG;AAEzE,YAAQ,KAAK;AACb;;;UAGG,OAAO;AACd,UAAQ,MAAM,SAAS,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM,GAAG;AAChF,UAAQ,KAAK,EAAE;;;AAInB,MAAM,CAAC,OAAO,UAAU;AACtB,SAAQ,MAAM,sBAAsB,MAAM;AAC1C,SAAQ,KAAK,EAAE;EACf"}
|
|
1
|
+
{"version":3,"file":"cli.mjs","names":["bosPlugin"],"sources":["../src/cli.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { findCommandDescriptor } from \"./cli/catalog\";\nimport { printHelp } from \"./cli/help\";\nimport { parseCommandInput } from \"./cli/parse\";\nimport { findConfigPath } from \"./config\";\nimport bosPlugin from \"./plugin\";\nimport { createPluginRuntime } from \"./sdk\";\nimport { printBanner } from \"./utils/banner\";\nimport { colors, frames, gradients, icons } from \"./utils/theme\";\n\nfunction printConfigView(result: {\n account: string;\n domain?: string;\n staging?: { domain: string };\n app: {\n host: { name?: string; development: string; production?: string };\n ui: { name?: string; development?: string; production?: string; ssr?: string };\n api: { name?: string; development?: string; production?: string; proxy?: string };\n };\n}) {\n console.log();\n console.log(colors.cyan(frames.top(52)));\n console.log(` ${icons.app} ${gradients.cyber(\"CONFIG\")}`);\n console.log(colors.cyan(frames.bottom(52)));\n console.log();\n\n console.log(` ${colors.dim(\"Account\")} ${colors.cyan(result.account)}`);\n console.log(` ${colors.dim(\"Domain\")} ${colors.white(result.domain ?? \"not configured\")}`);\n if (result.staging) {\n console.log(` ${colors.dim(\"Staging\")} ${colors.magenta(result.staging.domain)}`);\n }\n console.log();\n}\n\nfunction formatTimeAgo(isoTimestamp: string): string {\n const now = Date.now();\n const then = new Date(isoTimestamp).getTime();\n const diffMs = now - then;\n const diffMins = Math.floor(diffMs / 60_000);\n if (diffMins < 1) return \"just now\";\n if (diffMins < 60) return `${diffMins} minute${diffMins > 1 ? \"s\" : \"\"} ago`;\n const diffHours = Math.floor(diffMins / 60);\n if (diffHours < 24) return `${diffHours} hour${diffHours > 1 ? \"s\" : \"\"} ago`;\n const diffDays = Math.floor(diffHours / 24);\n if (diffDays < 30) return `${diffDays} day${diffDays > 1 ? \"s\" : \"\"} ago`;\n return isoTimestamp.split(\"T\")[0] ?? isoTimestamp;\n}\n\nfunction normalizeVersion(v: string): string {\n return v.replace(/^[\\^~>=v]+/, \"\").trim();\n}\n\nasync function warnIfOutdated(client: any, command: string): Promise<void> {\n if (![\"dev\", \"build\", \"start\"].includes(command)) return;\n\n try {\n const status = await client.status();\n if (status.status === \"error\" || !status.packages) return;\n\n const outdated = status.packages.filter(\n (p: { name: string; installed?: string; latest?: string }) =>\n p.installed && p.latest && normalizeVersion(p.installed) !== normalizeVersion(p.latest),\n );\n\n if (outdated.length === 0) return;\n\n console.log();\n console.log(colors.yellow(` ! Outdated packages detected:`));\n for (const pkg of outdated) {\n console.log(colors.dim(` ${pkg.name} ${pkg.installed} → ${pkg.latest}`));\n }\n console.log(\n colors.dim(\n ` Run ${colors.cyan(\"bos upgrade\")} to update packages and sync template files.`,\n ),\n );\n console.log();\n } catch {\n // silently ignore if status check fails\n }\n}\n\nasync function main() {\n const args = process.argv.slice(2);\n\n if (args.includes(\"--help\") || args.includes(\"-h\")) {\n printHelp();\n return;\n }\n\n const invocationArgs = args.length > 0 ? args : [\"dev\"];\n const command = invocationArgs[0] ?? \"dev\";\n const configPath = findConfigPath();\n\n const commandMatch = findCommandDescriptor(invocationArgs);\n if (!commandMatch) {\n console.error(`Unknown command: ${command}`);\n process.exit(1);\n }\n\n const { descriptor, consumed } = commandMatch;\n const commandArgs = invocationArgs.slice(consumed);\n\n printBanner();\n\n const runtime = createPluginRuntime({\n registry: {\n bos: { module: bosPlugin },\n },\n secrets: {},\n });\n\n const pluginRuntime: any = runtime;\n const loadPlugin = pluginRuntime.usePlugin.bind(pluginRuntime);\n const plugin = await loadPlugin(\"bos\", {\n variables: {\n configPath: configPath ?? undefined,\n },\n secrets: {},\n });\n\n const client = plugin.createClient();\n\n await warnIfOutdated(client, command);\n\n try {\n const input = parseCommandInput(descriptor, commandArgs);\n const result = await (client as any)[descriptor.key](input);\n\n if (descriptor.key === \"config\") {\n if (!result.config) {\n console.error(\"No bos.config.json found\");\n process.exit(1);\n }\n\n printConfigView(result.config);\n process.stdout.write(`${JSON.stringify(result.config, null, 2)}\\n`);\n return;\n }\n\n if (descriptor.key === \"init\") {\n console.log();\n if (result.status === \"error\") {\n console.error(`[CLI] ${result.error || \"Unknown error\"}`);\n process.exit(1);\n }\n console.log(colors.green(`${icons.ok} Project initialized`));\n console.log(` ${colors.dim(\"Extends:\")} ${result.extends}`);\n console.log(` ${colors.dim(\"Directory:\")} ${result.directory}`);\n if (result.account) console.log(` ${colors.dim(\"Account:\")} ${result.account}`);\n if (result.domain) console.log(` ${colors.dim(\"Domain:\")} ${result.domain}`);\n if (result.plugins && result.plugins.length > 0)\n console.log(` ${colors.dim(\"Plugins:\")} ${result.plugins.join(\", \")}`);\n console.log(` ${colors.dim(\"Files copied:\")} ${result.filesCopied}`);\n console.log();\n console.log(colors.dim(\" Next steps:\"));\n console.log(colors.dim(` cd ${result.directory}`));\n if (result.status === \"initialized\" && !(input as any)?.noInstall) {\n console.log(colors.dim(\" docker compose up -d --wait\"));\n console.log(colors.dim(\" bun run dev\"));\n } else {\n console.log(colors.dim(\" bun install\"));\n console.log(colors.dim(\" docker compose up -d --wait\"));\n console.log(colors.dim(\" bun run dev\"));\n }\n console.log();\n return;\n }\n\n if (descriptor.key === \"sync\") {\n console.log();\n if (result.status === \"error\") {\n console.error(`[CLI] ${result.error || \"Unknown error\"}`);\n process.exit(1);\n }\n if (result.status === \"dry-run\") {\n console.log(colors.cyan(`${icons.ok} Dry run — no files written`));\n } else {\n console.log(colors.green(`${icons.ok} Template synced`));\n }\n if (result.updated.length > 0) {\n console.log(` ${colors.dim(\"Updated:\")} ${result.updated.length} file(s)`);\n for (const f of result.updated) console.log(` ${colors.dim(f)}`);\n }\n if (result.added.length > 0) {\n console.log(` ${colors.dim(\"Added:\")} ${result.added.length} file(s)`);\n for (const f of result.added) console.log(` ${colors.dim(f)}`);\n }\n if (result.skipped.length > 0) {\n console.log(\n ` ${colors.yellow(\"Skipped:\")} ${result.skipped.length} file(s) (locally modified, use --force to overwrite)`,\n );\n for (const f of result.skipped) console.log(` ${colors.dim(f)}`);\n }\n if (result.updated.length === 0 && result.added.length === 0 && result.skipped.length === 0) {\n console.log(` ${colors.dim(\"Already up to date\")}`);\n }\n if (result.status !== \"dry-run\" && result.updated.length > 0) {\n console.log();\n console.log(colors.dim(\" Review changes — your customizations take priority:\"));\n console.log(\n colors.dim(\n \" • api/src/contract.ts, api/src/index.ts, api/src/db/schema.ts — never overwritten\",\n ),\n );\n console.log(\n colors.dim(\" • ui/src/components/**, ui/src/styles.css — never overwritten\"),\n );\n console.log(\n colors.dim(\n \" • Other updated files — accept framework improvements, then restore your changes\",\n ),\n );\n console.log(colors.dim(\" • Skipped files — yours already, only update with --force\"));\n }\n console.log();\n return;\n }\n\n if (descriptor.key === \"upgrade\") {\n console.log();\n if (result.status === \"error\") {\n console.error(`[CLI] ${result.error || \"Unknown error\"}`);\n process.exit(1);\n }\n if (result.status === \"dry-run\") {\n console.log(colors.cyan(`${icons.ok} Dry run — no changes applied`));\n } else {\n console.log(colors.green(`${icons.ok} Upgrade successful`));\n }\n for (const pkg of result.packages) {\n if (pkg.from && pkg.from !== pkg.to) {\n console.log(` ${colors.dim(`${pkg.name}:`)} ${pkg.from} → ${pkg.to}`);\n } else if (!pkg.from) {\n console.log(` ${colors.dim(`${pkg.name}:`)} ${pkg.to} (new)`);\n } else {\n console.log(` ${colors.dim(`${pkg.name}:`)} ${pkg.to} (up to date)`);\n }\n }\n if (result.changelogUrl) {\n console.log(` ${colors.dim(\"Changelog:\")} ${result.changelogUrl}`);\n }\n if (result.availablePlugins && result.availablePlugins.length > 0) {\n console.log(` ${colors.dim(\"New parent plugins:\")} ${result.availablePlugins.join(\", \")}`);\n }\n if (result.selectedPlugins && result.selectedPlugins.length > 0) {\n console.log(` ${colors.dim(\"Added plugins:\")} ${result.selectedPlugins.join(\", \")}`);\n }\n if (result.sync) {\n const sync = result.sync;\n if (sync.updated.length > 0) {\n console.log(` ${colors.dim(\"Updated:\")} ${sync.updated.length} file(s)`);\n for (const f of sync.updated) console.log(` ${colors.dim(f)}`);\n }\n if (sync.added.length > 0) {\n console.log(` ${colors.dim(\"Added:\")} ${sync.added.length} file(s)`);\n for (const f of sync.added) console.log(` ${colors.dim(f)}`);\n }\n if (sync.skipped.length > 0) {\n console.log(\n ` ${colors.yellow(\"Skipped:\")} ${sync.skipped.length} file(s) (locally modified, use --force to overwrite)`,\n );\n for (const f of sync.skipped) console.log(` ${colors.dim(f)}`);\n }\n if (\n result.status !== \"dry-run\" &&\n (sync.updated.length > 0 || sync.added.length > 0 || sync.skipped.length > 0)\n ) {\n console.log();\n console.log(colors.dim(\" Resolve differences — your code takes priority:\"));\n console.log();\n console.log(colors.dim(\" Never overwritten (safe):\"));\n console.log(\n colors.dim(\" • api/src/contract.ts, api/src/index.ts, api/src/db/schema.ts\"),\n );\n console.log(colors.dim(\" • ui/src/components/**, ui/src/styles.css\"));\n console.log();\n console.log(colors.dim(\" Replaced — review and keep your changes:\"));\n console.log(\n colors.dim(\n \" • api/drizzle.config.ts, api/tsconfig.json, api/tsconfig.contract.json\",\n ),\n );\n console.log(colors.dim(\" • api/plugin.dev.ts, api/rspack.config.js\"));\n console.log(colors.dim(\" • ui/src/routes/* (core routes only)\"));\n console.log();\n console.log(colors.dim(\" Merged — your deps preserved:\"));\n console.log(colors.dim(\" • package.json, api/package.json, ui/package.json\"));\n console.log();\n console.log(colors.dim(\" Skipped — already yours:\"));\n console.log(colors.dim(\" • Use --force only if you want framework updates\"));\n }\n }\n if (result.migrated && result.migrated.length > 0) {\n console.log(` ${colors.yellow(\"Removed:\")} ${result.migrated.length} obsolete file(s)`);\n for (const f of result.migrated) console.log(` ${colors.dim(f)}`);\n }\n console.log();\n return;\n }\n\n if (descriptor.key === \"status\") {\n console.log();\n if (result.status === \"error\") {\n console.error(`[CLI] ${result.error || \"Unknown error\"}`);\n process.exit(1);\n }\n console.log(colors.cyan(frames.top(52)));\n console.log(` ${icons.app} ${gradients.cyber(\"STATUS\")}`);\n console.log(colors.cyan(frames.bottom(52)));\n console.log();\n if (result.extends) console.log(` ${colors.dim(\"Extends:\")} ${result.extends}`);\n if (result.account) console.log(` ${colors.dim(\"Account:\")} ${result.account}`);\n if (result.domain) console.log(` ${colors.dim(\"Domain:\")} ${result.domain}`);\n console.log();\n console.log(` ${colors.dim(\"Packages:\")}`);\n for (const pkg of result.packages) {\n const hasUpdate =\n pkg.installed &&\n pkg.latest &&\n normalizeVersion(pkg.installed) !== normalizeVersion(pkg.latest);\n const versionStr = hasUpdate\n ? `${pkg.installed} → ${pkg.latest}`\n : pkg.installed || \"not installed\";\n const label = hasUpdate ? colors.yellow(versionStr) : colors.dim(versionStr);\n console.log(` ${colors.dim(`${pkg.name}`)} ${label}`);\n }\n console.log();\n if (result.lastSync) {\n const ago = formatTimeAgo(result.lastSync);\n console.log(` ${colors.dim(\"Last sync:\")} ${ago}`);\n } else {\n console.log(` ${colors.dim(\"Last sync:\")} never`);\n }\n const envLabel =\n result.envFile === \"found\"\n ? colors.green(\"found\")\n : result.envFile === \"example-only\"\n ? colors.yellow(\"missing (only .env.example found)\")\n : colors.error(\"missing\");\n console.log(` ${colors.dim(\".env:\")} ${envLabel}`);\n if (result.parentReachable !== undefined) {\n const parentLabel = result.parentReachable\n ? colors.green(\"reachable\")\n : colors.error(\"unreachable\");\n console.log(` ${colors.dim(\"Parent:\")} ${parentLabel}`);\n }\n const hasUpdates = result.packages.some(\n (p: { installed?: string; latest?: string }) =>\n p.installed && p.latest && normalizeVersion(p.installed) !== normalizeVersion(p.latest),\n );\n if (hasUpdates) {\n console.log();\n console.log(\n colors.dim(\n ` Run ${colors.cyan(\"bos upgrade\")} to update packages and sync template files.`,\n ),\n );\n }\n console.log();\n return;\n }\n\n if (descriptor.key === \"typesGen\") {\n console.log();\n if (result.status === \"error\") {\n console.error(`[CLI] ${result.error || \"Unknown error\"}`);\n process.exit(1);\n }\n console.log(colors.green(`${icons.ok} Types generated`));\n if (result.source) {\n console.log(\n ` ${colors.dim(\"Mode:\")} ${result.source === \"remote\" ? colors.cyan(\"remote\") : colors.dim(\"local\")}`,\n );\n }\n if (result.generated.length > 0) {\n console.log(` ${colors.dim(\"Generated:\")}`);\n for (const f of result.generated) console.log(` ${colors.dim(f)}`);\n }\n if (result.fetched.length > 0) {\n console.log(` ${colors.dim(\"Fetched from remote:\")}`);\n for (const url of result.fetched) console.log(` ${colors.dim(url)}`);\n }\n if (result.skipped.length > 0) {\n console.log(` ${colors.dim(\"Skipped (local):\")}`);\n for (const s of result.skipped) console.log(` ${colors.dim(s)}`);\n }\n if (result.failed.length > 0) {\n console.log(` ${colors.yellow(\"Failed:\")}`);\n for (const f of result.failed) console.log(` ${colors.error(f)}`);\n }\n console.log();\n return;\n }\n\n if (result?.status === \"error\") {\n console.error(`[CLI] ${result.error || \"Unknown error\"}`);\n process.exit(1);\n }\n\n if (descriptor.key === \"keyPublish\") {\n process.stdout.write(`Generated publish key for ${result.account}\\n`);\n process.stdout.write(` Network: ${result.network}\\n`);\n process.stdout.write(` Contract: ${result.contract}\\n`);\n process.stdout.write(` Allowance: ${result.allowance}\\n`);\n process.stdout.write(` Functions: ${result.functionNames.join(\", \")}\\n`);\n process.stdout.write(` Public key: ${result.publicKey}\\n`);\n process.stdout.write(` Private key: ${result.privateKey}\\n`);\n process.stdout.write(` Copy: NEAR_PRIVATE_KEY=${result.privateKey}\\n`);\n }\n\n if (descriptor.key === \"pluginAdd\") {\n console.log();\n console.log(colors.green(`${icons.ok} Added plugin ${result.key}`));\n if (result.development) console.log(` ${colors.dim(\"Development:\")} ${result.development}`);\n if (result.production) console.log(` ${colors.dim(\"Production:\")} ${result.production}`);\n console.log();\n return;\n }\n\n if (descriptor.key === \"pluginRemove\") {\n console.log();\n console.log(colors.green(`${icons.ok} Removed plugin ${result.key}`));\n console.log();\n return;\n }\n\n if (descriptor.key === \"pluginList\") {\n console.log();\n console.log(colors.cyan(frames.top(52)));\n console.log(` ${icons.config} ${gradients.cyber(\"PLUGINS\")}`);\n console.log(colors.cyan(frames.bottom(52)));\n console.log();\n if (result.plugins.length === 0) {\n console.log(colors.dim(\" No plugins configured\"));\n } else {\n for (const pluginItem of result.plugins) {\n console.log(` ${colors.cyan(pluginItem.key)}`);\n if (pluginItem.development)\n console.log(` ${colors.dim(\"Development:\")} ${pluginItem.development}`);\n if (pluginItem.production)\n console.log(` ${colors.dim(\"Production:\")} ${pluginItem.production}`);\n }\n }\n console.log();\n return;\n }\n\n if (descriptor.key === \"pluginPublish\") {\n console.log();\n console.log(colors.green(`${icons.ok} Published plugin ${result.key}`));\n if (result.path) console.log(` ${colors.dim(\"Path:\")} ${result.path}`);\n if (result.script) console.log(` ${colors.dim(\"Script:\")} bun run ${result.script}`);\n if (result.production) console.log(` ${colors.dim(\"Production:\")} ${result.production}`);\n console.log();\n return;\n }\n\n if (descriptor.key === \"publish\") {\n if (result.status === \"dry-run\") {\n console.log();\n console.log(colors.cyan(`${icons.ok} Dry run complete`));\n console.log(` ${colors.dim(\"Registry URL:\")} ${result.registryUrl}`);\n console.log();\n return;\n }\n\n if (result.status === \"published\") {\n console.log();\n console.log(colors.green(`${icons.ok} Published successfully`));\n console.log(` ${colors.dim(\"Registry URL:\")} ${result.registryUrl}`);\n if (result.txHash) {\n console.log(` ${colors.dim(\"Transaction:\")} ${result.txHash}`);\n }\n if (result.built && result.built.length > 0) {\n console.log(` ${colors.dim(\"Built:\")} ${result.built.join(\", \")}`);\n }\n if (result.skipped && result.skipped.length > 0) {\n console.log(` ${colors.dim(\"Skipped:\")} ${result.skipped.join(\", \")}`);\n }\n console.log();\n return;\n }\n }\n } catch (error) {\n console.error(`[CLI] ${error instanceof Error ? error.message : String(error)}`);\n process.exit(1);\n }\n}\n\nmain().catch((error) => {\n console.error(\"[CLI] Fatal error:\", error);\n process.exit(1);\n});\n"],"mappings":";;;;;;;;;;;AAUA,SAAS,gBAAgB,QAStB;AACD,SAAQ,KAAK;AACb,SAAQ,IAAI,OAAO,KAAK,OAAO,IAAI,GAAG,CAAC,CAAC;AACxC,SAAQ,IAAI,KAAK,MAAM,IAAI,GAAG,UAAU,MAAM,SAAS,GAAG;AAC1D,SAAQ,IAAI,OAAO,KAAK,OAAO,OAAO,GAAG,CAAC,CAAC;AAC3C,SAAQ,KAAK;AAEb,SAAQ,IAAI,KAAK,OAAO,IAAI,UAAU,CAAC,IAAI,OAAO,KAAK,OAAO,QAAQ,GAAG;AACzE,SAAQ,IAAI,KAAK,OAAO,IAAI,SAAS,CAAC,KAAK,OAAO,MAAM,OAAO,UAAU,iBAAiB,GAAG;A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MAAM;AAC1C,SAAQ,KAAK,EAAE;EACf"}
|
package/dist/config.cjs
CHANGED
|
@@ -302,22 +302,6 @@ async function resolveRemotePluginRuntimeName(baseUrl, fallback) {
|
|
|
302
302
|
return fallback;
|
|
303
303
|
}
|
|
304
304
|
}
|
|
305
|
-
async function resolveBosPluginUrl(bosUrl) {
|
|
306
|
-
const parsed = require_fastkv.parsePluginBosUrl(bosUrl);
|
|
307
|
-
if (!parsed) return null;
|
|
308
|
-
try {
|
|
309
|
-
const entry = await require_fastkv.fetchPluginFromRegistry(parsed.accountId, parsed.pluginName);
|
|
310
|
-
if (!entry) return null;
|
|
311
|
-
const cdnUrl = entry.metadata.cdnUrl;
|
|
312
|
-
if (!cdnUrl) return null;
|
|
313
|
-
return {
|
|
314
|
-
url: cdnUrl,
|
|
315
|
-
integrity: entry.metadata.integrity ?? void 0
|
|
316
|
-
};
|
|
317
|
-
} catch {
|
|
318
|
-
return null;
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
305
|
async function buildRuntimePluginConfig(pluginId, config, baseDir, env, source) {
|
|
322
306
|
const apiConfig = config.app?.api ?? {};
|
|
323
307
|
const apiDevelopment = typeof apiConfig.development === "string" ? apiConfig.development : void 0;
|
|
@@ -326,14 +310,8 @@ async function buildRuntimePluginConfig(pluginId, config, baseDir, env, source)
|
|
|
326
310
|
const sourceProduction = typeof source.production === "string" ? source.production : void 0;
|
|
327
311
|
const proxy = typeof apiConfig.proxy === "string" ? apiConfig.proxy : void 0;
|
|
328
312
|
const development = apiDevelopment ?? sourceDevelopment;
|
|
329
|
-
|
|
330
|
-
if (production?.startsWith("bos://")) {
|
|
331
|
-
const resolved = await resolveBosPluginUrl(production);
|
|
332
|
-
if (resolved) {
|
|
333
|
-
production = resolved.url;
|
|
334
|
-
if (resolved.integrity && env === "production") source.integrity = resolved.integrity;
|
|
335
|
-
}
|
|
336
|
-
}
|
|
313
|
+
const production = apiProduction ?? sourceProduction;
|
|
314
|
+
if (production?.startsWith("bos://")) throw new Error(`Plugin "${pluginId}" has unsupported production target "${production}". Use extends: "bos://account/domain" for plugin configs or a CDN URL for production.`);
|
|
337
315
|
const runtimeTarget = env === "development" ? resolveDevelopmentTarget(development, production, baseDir) : resolveRuntimeTarget(production, baseDir, "remote");
|
|
338
316
|
const apiName = resolvePluginRuntimeName(typeof apiConfig.name === "string" ? apiConfig.name : void 0, runtimeTarget.localPath, pluginId);
|
|
339
317
|
const uiConfig = config.app?.ui;
|
package/dist/config.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.cjs","names":["BosConfigSchema","isPlainObject","rebuildOrderedConfig","getNetworkIdForAccount","fetchBosConfigFromFastKv","resolveExtendsRef","mergeBosConfigWithExtends","parsePluginBosUrl","fetchPluginFromRegistry"],"sources":["../src/config.ts"],"sourcesContent":["import { existsSync, mkdirSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { dirname, isAbsolute, join, resolve } from \"node:path\";\nimport { fetchBosConfigFromFastKv, fetchPluginFromRegistry, parsePluginBosUrl } from \"./fastkv\";\nimport {\n type BosEnv,\n isPlainObject,\n mergeBosConfigWithExtends,\n type ResolvedConfigMeta,\n rebuildOrderedConfig,\n resolveExtendsRef,\n} from \"./merge\";\nimport { getNetworkIdForAccount } from \"./network\";\nimport type {\n BosConfig,\n BosConfigInput,\n BosPluginRef,\n ExtendsConfig,\n PluginEntryValue,\n RuntimeConfig,\n RuntimePluginConfig,\n SharedDepConfig,\n} from \"./types\";\nimport { BosConfigSchema } from \"./types\";\n\nconst LOCAL_PREFIX = \"local:\";\nconst DEFAULT_HOST_PORT = 3000;\nconst RESOLVED_CONFIG_FILENAME = \"bos.resolved-config.json\";\n\ninterface RuntimeTarget {\n source: \"local\" | \"remote\";\n url: string;\n localPath?: string;\n port?: number;\n}\n\nlet cachedConfig: BosConfig | null = null;\nlet projectRoot: string | null = null;\n\nexport function clearConfigCache(): void {\n cachedConfig = null;\n projectRoot = null;\n}\n\nexport function findConfigPath(cwd?: string): string | null {\n let dir = cwd ?? process.cwd();\n while (dir !== \"/\") {\n const configPath = join(dir, \"bos.config.json\");\n if (existsSync(configPath)) {\n return configPath;\n }\n dir = dirname(dir);\n }\n return null;\n}\n\nexport function getConfig(): BosConfig | null {\n return cachedConfig;\n}\n\nexport function getProjectRoot(): string {\n if (!projectRoot) {\n throw new Error(\"Config not loaded. Call loadConfig() first.\");\n }\n return projectRoot;\n}\n\nexport interface ConfigResult {\n config: BosConfig;\n runtime: RuntimeConfig;\n source: {\n path: string;\n extended?: string[];\n remote?: boolean;\n };\n}\n\nexport async function loadConfig(options?: {\n cwd?: string;\n path?: string;\n env?: BosEnv;\n}): Promise<ConfigResult | null> {\n const configPath = options?.path ?? findConfigPath(options?.cwd);\n if (!configPath) {\n projectRoot = options?.cwd ?? process.cwd();\n return null;\n }\n\n const baseDir = dirname(configPath);\n const env = options?.env ?? \"development\";\n const runtimeEnv: BosEnv = env === \"staging\" ? \"production\" : env;\n\n try {\n const extendedChain: string[] = [];\n const parsed = await resolveConfigWithExtends(\n configPath,\n baseDir,\n new Set(),\n extendedChain,\n env,\n );\n const config = BosConfigSchema.parse(parsed);\n\n cachedConfig = config;\n projectRoot = baseDir;\n\n const pluginRuntime = await resolveRuntimePlugins(config.plugins ?? {}, baseDir, runtimeEnv);\n const runtime = buildRuntimeConfig(config, baseDir, runtimeEnv, {\n plugins: pluginRuntime,\n });\n\n return {\n config,\n runtime,\n source: {\n path: configPath,\n extended: extendedChain.length > 0 ? extendedChain : undefined,\n remote: extendedChain.some((entry) => entry.startsWith(\"bos://\")),\n },\n };\n } catch (error) {\n throw new Error(`Failed to load config from ${configPath}: ${error}`);\n }\n}\n\nexport async function loadBosConfig(options?: {\n cwd?: string;\n path?: string;\n env?: BosEnv;\n}): Promise<RuntimeConfig> {\n const result = await loadConfig(options);\n if (!result) {\n throw new Error(\"No bos.config.json found\");\n }\n\n return result.runtime;\n}\n\nexport async function buildRuntimePluginsForConfig(\n config: BosConfig,\n baseDir: string,\n env: BosEnv,\n): Promise<Record<string, RuntimePluginConfig> | undefined> {\n const plugins = await resolveRuntimePlugins(config.plugins ?? {}, baseDir, env);\n return Object.keys(plugins).length > 0 ? plugins : undefined;\n}\n\nexport function getResolvedConfigPath(configDir: string): string {\n return join(configDir, \".bos\", RESOLVED_CONFIG_FILENAME);\n}\n\nexport function loadResolvedConfig(configDir: string): BosConfig | null {\n const resolvedPath = getResolvedConfigPath(configDir);\n if (!existsSync(resolvedPath)) return null;\n try {\n const raw = JSON.parse(readFileSync(resolvedPath, \"utf-8\"));\n if (!isPlainObject(raw)) return null;\n const { _resolved, ...configData } = raw;\n return BosConfigSchema.parse(configData);\n } catch {\n return null;\n }\n}\n\nexport function writeResolvedConfig(\n configDir: string,\n config: BosConfig,\n env: BosEnv,\n extendsChain?: string[],\n source?: string,\n): void {\n const resolvedPath = getResolvedConfigPath(configDir);\n const resolvedDir = dirname(resolvedPath);\n if (!existsSync(resolvedDir)) {\n mkdirSync(resolvedDir, { recursive: true });\n }\n\n const ordered = rebuildOrderedConfig(config);\n const meta: ResolvedConfigMeta = {\n env,\n resolvedAt: new Date().toISOString(),\n extendsChain: extendsChain ?? [],\n ...(source ? { source } : {}),\n };\n const output = {\n _resolved: meta,\n ...ordered,\n };\n\n const content = `${JSON.stringify(output, null, 2)}\\n`;\n try {\n if (readFileSync(resolvedPath, \"utf-8\") === content) return;\n } catch {\n // file doesn't exist yet\n }\n writeFileSync(resolvedPath, content);\n}\n\nexport function resolveBosConfigPath(configDir: string): string {\n const resolvedPath = getResolvedConfigPath(configDir);\n if (existsSync(resolvedPath)) return resolvedPath;\n return join(configDir, \"bos.config.json\");\n}\n\nexport function readBosConfigForBuild(configDir: string): Record<string, unknown> {\n const resolvedPath = getResolvedConfigPath(configDir);\n if (existsSync(resolvedPath)) {\n try {\n const raw = JSON.parse(readFileSync(resolvedPath, \"utf-8\"));\n if (isPlainObject(raw)) {\n const { _resolved, ...configData } = raw;\n return configData as Record<string, unknown>;\n }\n } catch {}\n }\n const bosConfigPath = join(configDir, \"bos.config.json\");\n return JSON.parse(readFileSync(bosConfigPath, \"utf-8\")) as Record<string, unknown>;\n}\n\nfunction resolveDevelopmentTarget(\n development: string | undefined,\n production: string | undefined,\n baseDir: string,\n forceSource?: \"local\" | \"remote\",\n): RuntimeTarget {\n if (forceSource === \"remote\") {\n return resolveRuntimeTarget(production, baseDir, \"remote\");\n }\n const devTarget = resolveRuntimeTarget(development, baseDir);\n if (devTarget.source === \"local\" && (!devTarget.localPath || !existsSync(devTarget.localPath))) {\n return resolveRuntimeTarget(production, baseDir, \"remote\");\n }\n return devTarget;\n}\n\nexport interface BuildRuntimeConfigOptions {\n plugins?: Record<string, RuntimePluginConfig>;\n hostSource?: \"local\" | \"remote\";\n uiSource?: \"local\" | \"remote\";\n apiSource?: \"local\" | \"remote\";\n authSource?: \"local\" | \"remote\";\n proxy?: string;\n}\n\nexport function buildRuntimeConfig(\n config: BosConfig,\n baseDir: string,\n env: BosEnv,\n options?: BuildRuntimeConfigOptions,\n): RuntimeConfig {\n const uiConfig = config.app.ui;\n const apiConfig = config.app.api;\n const authConfig = config.app.auth;\n const uiRuntime =\n env === \"development\"\n ? resolveDevelopmentTarget(\n uiConfig.development,\n uiConfig.production,\n baseDir,\n options?.uiSource,\n )\n : resolveRuntimeTarget(uiConfig.production, baseDir, \"remote\");\n const apiRuntime =\n env === \"development\"\n ? resolveDevelopmentTarget(\n apiConfig.development,\n apiConfig.production,\n baseDir,\n options?.apiSource,\n )\n : resolveRuntimeTarget(apiConfig.production, baseDir, \"remote\");\n const authRuntime = authConfig\n ? env === \"development\"\n ? resolveDevelopmentTarget(\n authConfig.development,\n authConfig.production,\n baseDir,\n options?.authSource,\n )\n : resolveRuntimeTarget(authConfig.production, baseDir, \"remote\")\n : undefined;\n\n const hostConfig = config.app.host;\n const hostRuntime =\n env === \"development\"\n ? resolveDevelopmentTarget(\n hostConfig.development,\n hostConfig.production,\n baseDir,\n options?.hostSource,\n )\n : resolveRuntimeTarget(hostConfig.production, baseDir, \"remote\");\n\n const hostListeningUrl =\n env === \"development\"\n ? resolveDevelopmentHostUrl(hostConfig.development)\n : `http://localhost:${hostRuntime.port ?? DEFAULT_HOST_PORT}`;\n\n const hostIsRemote = hostRuntime.source === \"remote\";\n const uiIsRemote = uiRuntime.source === \"remote\";\n const apiIsRemote = apiRuntime.source === \"remote\";\n\n return {\n env,\n account: config.account,\n domain: config.domain,\n title: config.title,\n description: config.description,\n networkId: getNetworkIdForAccount(config.account),\n repository: config.repository,\n host: {\n name: \"host\",\n url: hostListeningUrl,\n entry: `${hostListeningUrl}/mf-manifest.json`,\n localPath: hostRuntime.localPath,\n port: hostRuntime.port ?? DEFAULT_HOST_PORT,\n secrets: hostConfig.secrets,\n integrity: hostIsRemote ? hostConfig.integrity : undefined,\n source: hostRuntime.source,\n remoteUrl: hostIsRemote ? hostRuntime.url : undefined,\n },\n shared: config.shared,\n ui: {\n name: uiConfig.name,\n url: uiRuntime.url,\n entry: uiRuntime.url ? `${uiRuntime.url}/mf-manifest.json` : \"/mf-manifest.json\",\n localPath: uiRuntime.localPath,\n port: uiRuntime.port,\n ssrUrl: uiIsRemote ? uiConfig.ssr : undefined,\n ssrIntegrity: uiIsRemote ? uiConfig.ssrIntegrity : undefined,\n integrity: uiIsRemote ? uiConfig.integrity : undefined,\n source: uiRuntime.source,\n },\n api: {\n name: apiConfig.name,\n url: apiRuntime.url,\n entry: apiRuntime.url ? `${apiRuntime.url}/mf-manifest.json` : \"/mf-manifest.json\",\n localPath: apiRuntime.localPath,\n port: apiRuntime.port,\n source: apiRuntime.source,\n proxy: options?.proxy ?? apiConfig.proxy,\n variables: apiConfig.variables,\n secrets: apiConfig.secrets,\n integrity: apiIsRemote ? apiConfig.integrity : undefined,\n },\n auth: (() => {\n if (!authConfig || !authRuntime) return undefined;\n return {\n name: resolvePluginRuntimeName(undefined, authRuntime.localPath, authConfig.name),\n url: authRuntime.url,\n entry: authRuntime.url ? `${authRuntime.url}/mf-manifest.json` : \"/mf-manifest.json\",\n localPath: authRuntime.localPath,\n port: authRuntime.port,\n source: authRuntime.source,\n proxy: authConfig.proxy,\n variables: authConfig.variables,\n secrets: authConfig.secrets,\n integrity: authRuntime.source === \"remote\" ? authConfig.integrity : undefined,\n sidebar: authConfig.sidebar?.map((item) => ({\n ...item,\n to: item.to ?? \"/auth\",\n roleRequired: item.roleRequired ?? (\"member\" as const),\n })),\n };\n })(),\n plugins:\n options?.plugins && Object.keys(options.plugins).length > 0 ? options.plugins : undefined,\n };\n}\n\nasync function loadConfigFile(configPath: string, baseDir: string): Promise<BosConfigInput> {\n if (configPath.startsWith(\"bos://\")) {\n return fetchBosConfigFromFastKv<BosConfigInput>(configPath);\n }\n\n const resolvedPath = isAbsolute(configPath) ? configPath : resolve(baseDir, configPath);\n return JSON.parse(readFileSync(resolvedPath, \"utf-8\")) as BosConfigInput;\n}\n\nasync function resolveConfigWithExtends(\n configPath: string,\n baseDir: string,\n visited: Set<string>,\n chain: string[],\n env: BosEnv = \"development\",\n): Promise<BosConfigInput> {\n if (visited.has(configPath)) {\n throw new Error(`Circular extends detected: ${[...visited, configPath].join(\" -> \")}`);\n }\n\n const config = await loadConfigFile(configPath, baseDir);\n chain.push(configPath);\n\n if (!config.extends) {\n return config;\n }\n\n const extendsRef = resolveExtendsRef(config.extends as string | ExtendsConfig, env);\n if (!extendsRef) {\n return config;\n }\n\n const nextVisited = new Set(visited);\n nextVisited.add(configPath);\n const parentBaseDir = extendsRef.startsWith(\"bos://\")\n ? baseDir\n : isAbsolute(extendsRef)\n ? dirname(extendsRef)\n : baseDir;\n const parent = await resolveConfigWithExtends(extendsRef, parentBaseDir, nextVisited, chain, env);\n\n return mergeBosConfigWithExtends(parent, config);\n}\n\ntype PluginOverrideValue = PluginEntryValue | null | false;\n\nfunction normalizePluginEntry(raw: PluginOverrideValue): BosPluginRef | null | false {\n if (raw === null || raw === false) return raw;\n if (typeof raw === \"string\") {\n return { extends: raw };\n }\n return raw;\n}\n\nasync function resolveRuntimePlugins(\n plugins: Record<string, PluginOverrideValue>,\n baseDir: string,\n env: BosEnv,\n): Promise<Record<string, RuntimePluginConfig>> {\n const out: Record<string, RuntimePluginConfig> = {};\n\n for (const [pluginId, rawInput] of Object.entries(plugins)) {\n const normalized = normalizePluginEntry(rawInput);\n if (normalized === null || normalized === false) continue;\n\n let resolvedConfig: BosConfigInput = {};\n let pluginBaseDir = baseDir;\n\n if (normalized.extends) {\n try {\n const extendsUrl = resolveExtendsRef(normalized.extends, env);\n if (extendsUrl) {\n const remoteConfig = await fetchBosConfigFromFastKv<BosConfigInput>(extendsUrl);\n resolvedConfig = remoteConfig;\n }\n } catch {\n resolvedConfig = {};\n }\n }\n\n if (normalized.development?.startsWith(LOCAL_PREFIX)) {\n const localPath = resolve(baseDir, normalized.development.slice(LOCAL_PREFIX.length).trim());\n if (existsSync(localPath)) {\n const localConfigPath = join(localPath, \"bos.config.json\");\n if (existsSync(localConfigPath)) {\n try {\n const localRaw = JSON.parse(readFileSync(localConfigPath, \"utf-8\")) as BosConfigInput;\n resolvedConfig = mergeBosConfigWithExtends(resolvedConfig, localRaw);\n pluginBaseDir = localPath;\n } catch {}\n }\n }\n }\n\n if (normalized.app && isPlainObject(normalized.app)) {\n const mergedApp: Record<string, unknown> = {\n ...((resolvedConfig.app as Record<string, unknown>) ?? {}),\n ...(normalized.app as Record<string, unknown>),\n };\n resolvedConfig = { ...resolvedConfig, app: mergedApp as BosConfigInput[\"app\"] };\n }\n if (normalized.shared && isPlainObject(normalized.shared)) {\n const mergedShared: Record<string, Record<string, SharedDepConfig>> = {\n ...(resolvedConfig.shared ?? {}),\n ...(normalized.shared as Record<string, Record<string, SharedDepConfig>>),\n };\n resolvedConfig = { ...resolvedConfig, shared: mergedShared };\n }\n if (normalized.sidebar) {\n resolvedConfig = { ...resolvedConfig, sidebar: normalized.sidebar };\n }\n if (normalized.routes) {\n resolvedConfig = { ...resolvedConfig, routes: normalized.routes };\n }\n\n const pluginRuntime = await buildRuntimePluginConfig(\n pluginId,\n resolvedConfig,\n pluginBaseDir,\n env,\n normalized,\n );\n if (\n normalized.name &&\n typeof normalized.name === \"string\" &&\n !pluginRuntime.name.includes(\"/\")\n ) {\n pluginRuntime.name = normalized.name;\n }\n\n const integrity = normalized.integrity;\n if (env === \"production\" && integrity) {\n pluginRuntime.integrity = integrity;\n }\n\n if (\n pluginRuntime.source === \"remote\" &&\n pluginRuntime.url &&\n !pluginRuntime.localPath &&\n typeof resolvedConfig.app?.api?.name !== \"string\" &&\n !normalized.name\n ) {\n pluginRuntime.name = await resolveRemotePluginRuntimeName(\n pluginRuntime.url,\n pluginRuntime.name,\n );\n }\n\n out[pluginId] = pluginRuntime;\n }\n\n return out;\n}\n\nasync function resolveRemotePluginRuntimeName(baseUrl: string, fallback: string): Promise<string> {\n try {\n const controller = new AbortController();\n const timeout = setTimeout(() => controller.abort(), 5000);\n const response = await fetch(`${baseUrl.replace(/\\/$/, \"\")}/plugin.manifest.json`, {\n signal: controller.signal,\n });\n clearTimeout(timeout);\n\n if (!response.ok) {\n return fallback;\n }\n\n const manifest = (await response.json()) as {\n plugin?: { name?: unknown };\n };\n\n return typeof manifest.plugin?.name === \"string\" && manifest.plugin.name.length > 0\n ? manifest.plugin.name\n : fallback;\n } catch {\n return fallback;\n }\n}\n\ninterface ResolvedBosPlugin {\n url: string;\n integrity?: string;\n}\n\nasync function resolveBosPluginUrl(bosUrl: string): Promise<ResolvedBosPlugin | null> {\n const parsed = parsePluginBosUrl(bosUrl);\n if (!parsed) return null;\n\n try {\n const entry = await fetchPluginFromRegistry(parsed.accountId, parsed.pluginName);\n if (!entry) return null;\n\n const cdnUrl = entry.metadata.cdnUrl;\n if (!cdnUrl) return null;\n\n return {\n url: cdnUrl,\n integrity: entry.metadata.integrity ?? undefined,\n };\n } catch {\n return null;\n }\n}\n\nasync function buildRuntimePluginConfig(\n pluginId: string,\n config: BosConfigInput,\n baseDir: string,\n env: BosEnv,\n source: BosPluginRef,\n): Promise<RuntimePluginConfig> {\n const apiConfig = config.app?.api ?? {};\n const apiDevelopment =\n typeof apiConfig.development === \"string\" ? apiConfig.development : undefined;\n const apiProduction = typeof apiConfig.production === \"string\" ? apiConfig.production : undefined;\n const sourceDevelopment = typeof source.development === \"string\" ? source.development : undefined;\n const sourceProduction = typeof source.production === \"string\" ? source.production : undefined;\n const proxy = typeof apiConfig.proxy === \"string\" ? apiConfig.proxy : undefined;\n const development = apiDevelopment ?? sourceDevelopment;\n let production = apiProduction ?? sourceProduction;\n\n if (production?.startsWith(\"bos://\")) {\n const resolved = await resolveBosPluginUrl(production);\n if (resolved) {\n production = resolved.url;\n if (resolved.integrity && env === \"production\") {\n source.integrity = resolved.integrity;\n }\n }\n }\n\n const runtimeTarget =\n env === \"development\"\n ? resolveDevelopmentTarget(development, production, baseDir)\n : resolveRuntimeTarget(production, baseDir, \"remote\");\n const apiName = resolvePluginRuntimeName(\n typeof apiConfig.name === \"string\" ? apiConfig.name : undefined,\n runtimeTarget.localPath,\n pluginId,\n );\n\n const uiConfig = config.app?.ui;\n const uiDevelopment =\n typeof uiConfig?.development === \"string\" ? uiConfig.development : undefined;\n const uiProduction = typeof uiConfig?.production === \"string\" ? uiConfig.production : undefined;\n const uiRuntime =\n uiConfig && (uiDevelopment || uiProduction)\n ? env === \"development\"\n ? resolveDevelopmentTarget(uiDevelopment, uiProduction, baseDir)\n : resolveRuntimeTarget(uiProduction, baseDir, \"remote\")\n : undefined;\n\n const sidebar = (config.sidebar ?? source.sidebar)?.map((item) => ({\n ...item,\n to: item.to ?? `/${pluginId}`,\n roleRequired: item.roleRequired ?? (\"member\" as const),\n }));\n\n const routes = config.routes ?? source.routes;\n\n return {\n name: apiName,\n url: runtimeTarget.url,\n entry: runtimeTarget.url\n ? `${runtimeTarget.url.replace(/\\/$/, \"\")}/mf-manifest.json`\n : \"/mf-manifest.json\",\n source: runtimeTarget.source,\n localPath: runtimeTarget.localPath,\n port: runtimeTarget.port,\n proxy: proxy ?? (typeof source.proxy === \"string\" ? source.proxy : undefined),\n variables: normalizeStringRecord(apiConfig.variables ?? source.variables),\n secrets: normalizeStringArray(apiConfig.secrets ?? source.secrets),\n ui: uiRuntime\n ? {\n name: typeof uiConfig?.name === \"string\" ? uiConfig.name : `${apiName}-ui`,\n url: uiRuntime.url,\n entry: uiRuntime.url\n ? `${uiRuntime.url.replace(/\\/$/, \"\")}/mf-manifest.json`\n : \"/mf-manifest.json\",\n source: uiRuntime.source,\n localPath: uiRuntime.localPath,\n port: uiRuntime.port,\n integrity:\n uiRuntime.source === \"remote\" && typeof uiConfig?.integrity === \"string\"\n ? uiConfig.integrity\n : undefined,\n }\n : undefined,\n sidebar,\n routes,\n };\n}\n\nexport function resolvePluginRuntimeName(\n explicitName: string | undefined,\n localPath: string | undefined,\n fallback: string,\n): string {\n if (explicitName) {\n return explicitName;\n }\n\n if (!localPath) {\n return fallback;\n }\n\n try {\n const packageJsonPath = join(localPath, \"package.json\");\n const packageJson = JSON.parse(readFileSync(packageJsonPath, \"utf-8\")) as { name?: unknown };\n if (typeof packageJson.name === \"string\" && packageJson.name.length > 0) {\n return packageJson.name;\n }\n } catch {}\n\n return fallback;\n}\n\nfunction normalizeStringRecord(value: unknown): Record<string, string> | undefined {\n if (!isPlainObject(value)) return undefined;\n const out: Record<string, string> = {};\n for (const [key, raw] of Object.entries(value)) {\n if (typeof raw === \"string\") {\n out[key] = raw;\n }\n }\n return Object.keys(out).length > 0 ? out : undefined;\n}\n\nfunction normalizeStringArray(value: unknown): string[] | undefined {\n if (!Array.isArray(value)) return undefined;\n const out = value.filter((item): item is string => typeof item === \"string\" && item.length > 0);\n return out.length > 0 ? out : undefined;\n}\n\nfunction resolveRuntimeTarget(\n value: string | undefined,\n baseDir: string,\n defaultSource: \"local\" | \"remote\" = \"remote\",\n): RuntimeTarget {\n if (!value) {\n return { source: defaultSource, url: \"\" };\n }\n\n if (value.startsWith(LOCAL_PREFIX)) {\n const localTarget = value?.slice(LOCAL_PREFIX.length).trim();\n if (!localTarget) {\n throw new Error(`Invalid local development target: ${value}`);\n }\n\n const localPath = resolve(baseDir, localTarget);\n if (!existsSync(localPath)) {\n return { source: \"local\", url: \"\" };\n }\n\n return {\n source: \"local\",\n url: \"\",\n localPath,\n };\n }\n\n return {\n source: defaultSource,\n url: value.replace(/\\/$/, \"\"),\n port: parsePort(value),\n };\n}\n\nexport function isLocalDevelopmentTarget(\n value: string | undefined,\n): value is `${typeof LOCAL_PREFIX}${string}` {\n return typeof value === \"string\" && value.startsWith(LOCAL_PREFIX);\n}\n\nexport function resolveLocalDevelopmentPath(\n value: string | undefined,\n baseDir: string,\n): string | null {\n if (!isLocalDevelopmentTarget(value)) {\n return null;\n }\n\n const localTarget = value.slice(LOCAL_PREFIX.length).trim();\n return localTarget ? resolve(baseDir, localTarget) : null;\n}\n\nexport function resolveDevelopmentHostUrl(value: string | undefined): string {\n if (!value || isLocalDevelopmentTarget(value)) {\n return `http://localhost:${DEFAULT_HOST_PORT}`;\n }\n\n return value.replace(/\\/$/, \"\");\n}\n\nexport function getHostDevelopmentPort(value: string | undefined): number {\n return parsePort(resolveDevelopmentHostUrl(value));\n}\n\nexport function parsePort(url: string): number {\n try {\n const parsed = new URL(url);\n return parsed.port ? parseInt(parsed.port, 10) : parsed.protocol === \"https:\" ? 443 : 80;\n } catch {\n return 3000;\n }\n}\n\nexport { BOS_CONFIG_ORDER, rebuildOrderedConfig } from \"./merge\";\nexport type { BosConfig, RuntimeConfig } from \"./types\";\nexport { BosConfigSchema } from \"./types\";\n"],"mappings":";;;;;;;;;;AAwBA,MAAM,eAAe;AACrB,MAAM,oBAAoB;AAC1B,MAAM,2BAA2B;AASjC,IAAI,eAAiC;AACrC,IAAI,cAA6B;AAEjC,SAAgB,mBAAyB;AACvC,gBAAe;AACf,eAAc;;AAGhB,SAAgB,eAAe,KAA6B;CAC1D,IAAI,MAAM,OAAO,QAAQ,KAAK;AAC9B,QAAO,QAAQ,KAAK;EAClB,MAAM,iCAAkB,KA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,YACH,OAAM,IAAI,MAAM,qCAAqC,QAAQ;EAG/D,MAAM,mCAAoB,SAAS,YAAY;AAC/C,MAAI,yBAAY,UAAU,CACxB,QAAO;GAAE,QAAQ;GAAS,KAAK;GAAI;AAGrC,SAAO;GACL,QAAQ;GACR,KAAK;GACL;GACD;;AAGH,QAAO;EACL,QAAQ;EACR,KAAK,MAAM,QAAQ,OAAO,GAAG;EAC7B,MAAM,UAAU,MAAM;EACvB;;AAGH,SAAgB,yBACd,OAC4C;AAC5C,QAAO,OAAO,UAAU,YAAY,MAAM,WAAW,aAAa;;AAGpE,SAAgB,4BACd,OACA,SACe;AACf,KAAI,CAAC,yBAAyB,MAAM,CAClC,QAAO;CAGT,MAAM,cAAc,MAAM,MAAM,EAAoB,CAAC,MAAM;AAC3D,QAAO,qCAAsB,SAAS,YAAY,GAAG;;AAGvD,SAAgB,0BAA0B,OAAmC;AAC3E,KAAI,CAAC,SAAS,yBAAyB,MAAM,CAC3C,QAAO,oBAAoB;AAG7B,QAAO,MAAM,QAAQ,OAAO,GAAG;;AAGjC,SAAgB,uBAAuB,OAAmC;AACxE,QAAO,UAAU,0BAA0B,MAAM,CAAC;;AAGpD,SAAgB,UAAU,KAAqB;AAC7C,KAAI;EACF,MAAM,SAAS,IAAI,IAAI,IAAI;AAC3B,SAAO,OAAO,OAAO,SAAS,OAAO,MAAM,GAAG,GAAG,OAAO,aAAa,WAAW,MAAM;SAChF;AACN,SAAO"}
|
|
1
|
+
{"version":3,"file":"config.cjs","names":["BosConfigSchema","isPlainObject","rebuildOrderedConfig","getNetworkIdForAccount","fetchBosConfigFromFastKv","resolveExtendsRef","mergeBosConfigWithExtends"],"sources":["../src/config.ts"],"sourcesContent":["import { existsSync, mkdirSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { dirname, isAbsolute, join, resolve } from \"node:path\";\nimport { fetchBosConfigFromFastKv } from \"./fastkv\";\nimport {\n type BosEnv,\n isPlainObject,\n mergeBosConfigWithExtends,\n type ResolvedConfigMeta,\n rebuildOrderedConfig,\n resolveExtendsRef,\n} from \"./merge\";\nimport { getNetworkIdForAccount } from \"./network\";\nimport type {\n BosConfig,\n BosConfigInput,\n BosPluginRef,\n ExtendsConfig,\n PluginEntryValue,\n RuntimeConfig,\n RuntimePluginConfig,\n SharedDepConfig,\n} from \"./types\";\nimport { BosConfigSchema } from \"./types\";\n\nconst LOCAL_PREFIX = \"local:\";\nconst DEFAULT_HOST_PORT = 3000;\nconst RESOLVED_CONFIG_FILENAME = \"bos.resolved-config.json\";\n\ninterface RuntimeTarget {\n source: \"local\" | \"remote\";\n url: string;\n localPath?: string;\n port?: number;\n}\n\nlet cachedConfig: BosConfig | null = null;\nlet projectRoot: string | null = null;\n\nexport function clearConfigCache(): void {\n cachedConfig = null;\n projectRoot = null;\n}\n\nexport function findConfigPath(cwd?: string): string | null {\n let dir = cwd ?? process.cwd();\n while (dir !== \"/\") {\n const configPath = join(dir, \"bos.config.json\");\n if (existsSync(configPath)) {\n return configPath;\n }\n dir = dirname(dir);\n }\n return null;\n}\n\nexport function getConfig(): BosConfig | null {\n return cachedConfig;\n}\n\nexport function getProjectRoot(): string {\n if (!projectRoot) {\n throw new Error(\"Config not loaded. Call loadConfig() first.\");\n }\n return projectRoot;\n}\n\nexport interface ConfigResult {\n config: BosConfig;\n runtime: RuntimeConfig;\n source: {\n path: string;\n extended?: string[];\n remote?: boolean;\n };\n}\n\nexport async function loadConfig(options?: {\n cwd?: string;\n path?: string;\n env?: BosEnv;\n}): Promise<ConfigResult | null> {\n const configPath = options?.path ?? findConfigPath(options?.cwd);\n if (!configPath) {\n projectRoot = options?.cwd ?? process.cwd();\n return null;\n }\n\n const baseDir = dirname(configPath);\n const env = options?.env ?? \"development\";\n const runtimeEnv: BosEnv = env === \"staging\" ? \"production\" : env;\n\n try {\n const extendedChain: string[] = [];\n const parsed = await resolveConfigWithExtends(\n configPath,\n baseDir,\n new Set(),\n extendedChain,\n env,\n );\n const config = BosConfigSchema.parse(parsed);\n\n cachedConfig = config;\n projectRoot = baseDir;\n\n const pluginRuntime = await resolveRuntimePlugins(config.plugins ?? {}, baseDir, runtimeEnv);\n const runtime = buildRuntimeConfig(config, baseDir, runtimeEnv, {\n plugins: pluginRuntime,\n });\n\n return {\n config,\n runtime,\n source: {\n path: configPath,\n extended: extendedChain.length > 0 ? extendedChain : undefined,\n remote: extendedChain.some((entry) => entry.startsWith(\"bos://\")),\n },\n };\n } catch (error) {\n throw new Error(`Failed to load config from ${configPath}: ${error}`);\n }\n}\n\nexport async function loadBosConfig(options?: {\n cwd?: string;\n path?: string;\n env?: BosEnv;\n}): Promise<RuntimeConfig> {\n const result = await loadConfig(options);\n if (!result) {\n throw new Error(\"No bos.config.json found\");\n }\n\n return result.runtime;\n}\n\nexport async function buildRuntimePluginsForConfig(\n config: BosConfig,\n baseDir: string,\n env: BosEnv,\n): Promise<Record<string, RuntimePluginConfig> | undefined> {\n const plugins = await resolveRuntimePlugins(config.plugins ?? {}, baseDir, env);\n return Object.keys(plugins).length > 0 ? plugins : undefined;\n}\n\nexport function getResolvedConfigPath(configDir: string): string {\n return join(configDir, \".bos\", RESOLVED_CONFIG_FILENAME);\n}\n\nexport function loadResolvedConfig(configDir: string): BosConfig | null {\n const resolvedPath = getResolvedConfigPath(configDir);\n if (!existsSync(resolvedPath)) return null;\n try {\n const raw = JSON.parse(readFileSync(resolvedPath, \"utf-8\"));\n if (!isPlainObject(raw)) return null;\n const { _resolved, ...configData } = raw;\n return BosConfigSchema.parse(configData);\n } catch {\n return null;\n }\n}\n\nexport function writeResolvedConfig(\n configDir: string,\n config: BosConfig,\n env: BosEnv,\n extendsChain?: string[],\n source?: string,\n): void {\n const resolvedPath = getResolvedConfigPath(configDir);\n const resolvedDir = dirname(resolvedPath);\n if (!existsSync(resolvedDir)) {\n mkdirSync(resolvedDir, { recursive: true });\n }\n\n const ordered = rebuildOrderedConfig(config);\n const meta: ResolvedConfigMeta = {\n env,\n resolvedAt: new Date().toISOString(),\n extendsChain: extendsChain ?? [],\n ...(source ? { source } : {}),\n };\n const output = {\n _resolved: meta,\n ...ordered,\n };\n\n const content = `${JSON.stringify(output, null, 2)}\\n`;\n try {\n if (readFileSync(resolvedPath, \"utf-8\") === content) return;\n } catch {\n // file doesn't exist yet\n }\n writeFileSync(resolvedPath, content);\n}\n\nexport function resolveBosConfigPath(configDir: string): string {\n const resolvedPath = getResolvedConfigPath(configDir);\n if (existsSync(resolvedPath)) return resolvedPath;\n return join(configDir, \"bos.config.json\");\n}\n\nexport function readBosConfigForBuild(configDir: string): Record<string, unknown> {\n const resolvedPath = getResolvedConfigPath(configDir);\n if (existsSync(resolvedPath)) {\n try {\n const raw = JSON.parse(readFileSync(resolvedPath, \"utf-8\"));\n if (isPlainObject(raw)) {\n const { _resolved, ...configData } = raw;\n return configData as Record<string, unknown>;\n }\n } catch {}\n }\n const bosConfigPath = join(configDir, \"bos.config.json\");\n return JSON.parse(readFileSync(bosConfigPath, \"utf-8\")) as Record<string, unknown>;\n}\n\nfunction resolveDevelopmentTarget(\n development: string | undefined,\n production: string | undefined,\n baseDir: string,\n forceSource?: \"local\" | \"remote\",\n): RuntimeTarget {\n if (forceSource === \"remote\") {\n return resolveRuntimeTarget(production, baseDir, \"remote\");\n }\n const devTarget = resolveRuntimeTarget(development, baseDir);\n if (devTarget.source === \"local\" && (!devTarget.localPath || !existsSync(devTarget.localPath))) {\n return resolveRuntimeTarget(production, baseDir, \"remote\");\n }\n return devTarget;\n}\n\nexport interface BuildRuntimeConfigOptions {\n plugins?: Record<string, RuntimePluginConfig>;\n hostSource?: \"local\" | \"remote\";\n uiSource?: \"local\" | \"remote\";\n apiSource?: \"local\" | \"remote\";\n authSource?: \"local\" | \"remote\";\n proxy?: string;\n}\n\nexport function buildRuntimeConfig(\n config: BosConfig,\n baseDir: string,\n env: BosEnv,\n options?: BuildRuntimeConfigOptions,\n): RuntimeConfig {\n const uiConfig = config.app.ui;\n const apiConfig = config.app.api;\n const authConfig = config.app.auth;\n const uiRuntime =\n env === \"development\"\n ? resolveDevelopmentTarget(\n uiConfig.development,\n uiConfig.production,\n baseDir,\n options?.uiSource,\n )\n : resolveRuntimeTarget(uiConfig.production, baseDir, \"remote\");\n const apiRuntime =\n env === \"development\"\n ? resolveDevelopmentTarget(\n apiConfig.development,\n apiConfig.production,\n baseDir,\n options?.apiSource,\n )\n : resolveRuntimeTarget(apiConfig.production, baseDir, \"remote\");\n const authRuntime = authConfig\n ? env === \"development\"\n ? resolveDevelopmentTarget(\n authConfig.development,\n authConfig.production,\n baseDir,\n options?.authSource,\n )\n : resolveRuntimeTarget(authConfig.production, baseDir, \"remote\")\n : undefined;\n\n const hostConfig = config.app.host;\n const hostRuntime =\n env === \"development\"\n ? resolveDevelopmentTarget(\n hostConfig.development,\n hostConfig.production,\n baseDir,\n options?.hostSource,\n )\n : resolveRuntimeTarget(hostConfig.production, baseDir, \"remote\");\n\n const hostListeningUrl =\n env === \"development\"\n ? resolveDevelopmentHostUrl(hostConfig.development)\n : `http://localhost:${hostRuntime.port ?? DEFAULT_HOST_PORT}`;\n\n const hostIsRemote = hostRuntime.source === \"remote\";\n const uiIsRemote = uiRuntime.source === \"remote\";\n const apiIsRemote = apiRuntime.source === \"remote\";\n\n return {\n env,\n account: config.account,\n domain: config.domain,\n title: config.title,\n description: config.description,\n networkId: getNetworkIdForAccount(config.account),\n repository: config.repository,\n host: {\n name: \"host\",\n url: hostListeningUrl,\n entry: `${hostListeningUrl}/mf-manifest.json`,\n localPath: hostRuntime.localPath,\n port: hostRuntime.port ?? DEFAULT_HOST_PORT,\n secrets: hostConfig.secrets,\n integrity: hostIsRemote ? hostConfig.integrity : undefined,\n source: hostRuntime.source,\n remoteUrl: hostIsRemote ? hostRuntime.url : undefined,\n },\n shared: config.shared,\n ui: {\n name: uiConfig.name,\n url: uiRuntime.url,\n entry: uiRuntime.url ? `${uiRuntime.url}/mf-manifest.json` : \"/mf-manifest.json\",\n localPath: uiRuntime.localPath,\n port: uiRuntime.port,\n ssrUrl: uiIsRemote ? uiConfig.ssr : undefined,\n ssrIntegrity: uiIsRemote ? uiConfig.ssrIntegrity : undefined,\n integrity: uiIsRemote ? uiConfig.integrity : undefined,\n source: uiRuntime.source,\n },\n api: {\n name: apiConfig.name,\n url: apiRuntime.url,\n entry: apiRuntime.url ? `${apiRuntime.url}/mf-manifest.json` : \"/mf-manifest.json\",\n localPath: apiRuntime.localPath,\n port: apiRuntime.port,\n source: apiRuntime.source,\n proxy: options?.proxy ?? apiConfig.proxy,\n variables: apiConfig.variables,\n secrets: apiConfig.secrets,\n integrity: apiIsRemote ? apiConfig.integrity : undefined,\n },\n auth: (() => {\n if (!authConfig || !authRuntime) return undefined;\n return {\n name: resolvePluginRuntimeName(undefined, authRuntime.localPath, authConfig.name),\n url: authRuntime.url,\n entry: authRuntime.url ? `${authRuntime.url}/mf-manifest.json` : \"/mf-manifest.json\",\n localPath: authRuntime.localPath,\n port: authRuntime.port,\n source: authRuntime.source,\n proxy: authConfig.proxy,\n variables: authConfig.variables,\n secrets: authConfig.secrets,\n integrity: authRuntime.source === \"remote\" ? authConfig.integrity : undefined,\n sidebar: authConfig.sidebar?.map((item) => ({\n ...item,\n to: item.to ?? \"/auth\",\n roleRequired: item.roleRequired ?? (\"member\" as const),\n })),\n };\n })(),\n plugins:\n options?.plugins && Object.keys(options.plugins).length > 0 ? options.plugins : undefined,\n };\n}\n\nasync function loadConfigFile(configPath: string, baseDir: string): Promise<BosConfigInput> {\n if (configPath.startsWith(\"bos://\")) {\n return fetchBosConfigFromFastKv<BosConfigInput>(configPath);\n }\n\n const resolvedPath = isAbsolute(configPath) ? configPath : resolve(baseDir, configPath);\n return JSON.parse(readFileSync(resolvedPath, \"utf-8\")) as BosConfigInput;\n}\n\nasync function resolveConfigWithExtends(\n configPath: string,\n baseDir: string,\n visited: Set<string>,\n chain: string[],\n env: BosEnv = \"development\",\n): Promise<BosConfigInput> {\n if (visited.has(configPath)) {\n throw new Error(`Circular extends detected: ${[...visited, configPath].join(\" -> \")}`);\n }\n\n const config = await loadConfigFile(configPath, baseDir);\n chain.push(configPath);\n\n if (!config.extends) {\n return config;\n }\n\n const extendsRef = resolveExtendsRef(config.extends as string | ExtendsConfig, env);\n if (!extendsRef) {\n return config;\n }\n\n const nextVisited = new Set(visited);\n nextVisited.add(configPath);\n const parentBaseDir = extendsRef.startsWith(\"bos://\")\n ? baseDir\n : isAbsolute(extendsRef)\n ? dirname(extendsRef)\n : baseDir;\n const parent = await resolveConfigWithExtends(extendsRef, parentBaseDir, nextVisited, chain, env);\n\n return mergeBosConfigWithExtends(parent, config);\n}\n\ntype PluginOverrideValue = PluginEntryValue | null | false;\n\nfunction normalizePluginEntry(raw: PluginOverrideValue): BosPluginRef | null | false {\n if (raw === null || raw === false) return raw;\n if (typeof raw === \"string\") {\n return { extends: raw };\n }\n return raw;\n}\n\nasync function resolveRuntimePlugins(\n plugins: Record<string, PluginOverrideValue>,\n baseDir: string,\n env: BosEnv,\n): Promise<Record<string, RuntimePluginConfig>> {\n const out: Record<string, RuntimePluginConfig> = {};\n\n for (const [pluginId, rawInput] of Object.entries(plugins)) {\n const normalized = normalizePluginEntry(rawInput);\n if (normalized === null || normalized === false) continue;\n\n let resolvedConfig: BosConfigInput = {};\n let pluginBaseDir = baseDir;\n\n if (normalized.extends) {\n try {\n const extendsUrl = resolveExtendsRef(normalized.extends, env);\n if (extendsUrl) {\n const remoteConfig = await fetchBosConfigFromFastKv<BosConfigInput>(extendsUrl);\n resolvedConfig = remoteConfig;\n }\n } catch {\n resolvedConfig = {};\n }\n }\n\n if (normalized.development?.startsWith(LOCAL_PREFIX)) {\n const localPath = resolve(baseDir, normalized.development.slice(LOCAL_PREFIX.length).trim());\n if (existsSync(localPath)) {\n const localConfigPath = join(localPath, \"bos.config.json\");\n if (existsSync(localConfigPath)) {\n try {\n const localRaw = JSON.parse(readFileSync(localConfigPath, \"utf-8\")) as BosConfigInput;\n resolvedConfig = mergeBosConfigWithExtends(resolvedConfig, localRaw);\n pluginBaseDir = localPath;\n } catch {}\n }\n }\n }\n\n if (normalized.app && isPlainObject(normalized.app)) {\n const mergedApp: Record<string, unknown> = {\n ...((resolvedConfig.app as Record<string, unknown>) ?? {}),\n ...(normalized.app as Record<string, unknown>),\n };\n resolvedConfig = { ...resolvedConfig, app: mergedApp as BosConfigInput[\"app\"] };\n }\n if (normalized.shared && isPlainObject(normalized.shared)) {\n const mergedShared: Record<string, Record<string, SharedDepConfig>> = {\n ...(resolvedConfig.shared ?? {}),\n ...(normalized.shared as Record<string, Record<string, SharedDepConfig>>),\n };\n resolvedConfig = { ...resolvedConfig, shared: mergedShared };\n }\n if (normalized.sidebar) {\n resolvedConfig = { ...resolvedConfig, sidebar: normalized.sidebar };\n }\n if (normalized.routes) {\n resolvedConfig = { ...resolvedConfig, routes: normalized.routes };\n }\n\n const pluginRuntime = await buildRuntimePluginConfig(\n pluginId,\n resolvedConfig,\n pluginBaseDir,\n env,\n normalized,\n );\n if (\n normalized.name &&\n typeof normalized.name === \"string\" &&\n !pluginRuntime.name.includes(\"/\")\n ) {\n pluginRuntime.name = normalized.name;\n }\n\n const integrity = normalized.integrity;\n if (env === \"production\" && integrity) {\n pluginRuntime.integrity = integrity;\n }\n\n if (\n pluginRuntime.source === \"remote\" &&\n pluginRuntime.url &&\n !pluginRuntime.localPath &&\n typeof resolvedConfig.app?.api?.name !== \"string\" &&\n !normalized.name\n ) {\n pluginRuntime.name = await resolveRemotePluginRuntimeName(\n pluginRuntime.url,\n pluginRuntime.name,\n );\n }\n\n out[pluginId] = pluginRuntime;\n }\n\n return out;\n}\n\nasync function resolveRemotePluginRuntimeName(baseUrl: string, fallback: string): Promise<string> {\n try {\n const controller = new AbortController();\n const timeout = setTimeout(() => controller.abort(), 5000);\n const response = await fetch(`${baseUrl.replace(/\\/$/, \"\")}/plugin.manifest.json`, {\n signal: controller.signal,\n });\n clearTimeout(timeout);\n\n if (!response.ok) {\n return fallback;\n }\n\n const manifest = (await response.json()) as {\n plugin?: { name?: unknown };\n };\n\n return typeof manifest.plugin?.name === \"string\" && manifest.plugin.name.length > 0\n ? manifest.plugin.name\n : fallback;\n } catch {\n return fallback;\n }\n}\n\nasync function buildRuntimePluginConfig(\n pluginId: string,\n config: BosConfigInput,\n baseDir: string,\n env: BosEnv,\n source: BosPluginRef,\n): Promise<RuntimePluginConfig> {\n const apiConfig = config.app?.api ?? {};\n const apiDevelopment =\n typeof apiConfig.development === \"string\" ? apiConfig.development : undefined;\n const apiProduction = typeof apiConfig.production === \"string\" ? apiConfig.production : undefined;\n const sourceDevelopment = typeof source.development === \"string\" ? source.development : undefined;\n const sourceProduction = typeof source.production === \"string\" ? source.production : undefined;\n const proxy = typeof apiConfig.proxy === \"string\" ? apiConfig.proxy : undefined;\n const development = apiDevelopment ?? sourceDevelopment;\n const production = apiProduction ?? sourceProduction;\n\n if (production?.startsWith(\"bos://\")) {\n throw new Error(\n `Plugin \"${pluginId}\" has unsupported production target \"${production}\". Use extends: \"bos://account/domain\" for plugin configs or a CDN URL for production.`,\n );\n }\n\n const runtimeTarget =\n env === \"development\"\n ? resolveDevelopmentTarget(development, production, baseDir)\n : resolveRuntimeTarget(production, baseDir, \"remote\");\n const apiName = resolvePluginRuntimeName(\n typeof apiConfig.name === \"string\" ? apiConfig.name : undefined,\n runtimeTarget.localPath,\n pluginId,\n );\n\n const uiConfig = config.app?.ui;\n const uiDevelopment =\n typeof uiConfig?.development === \"string\" ? uiConfig.development : undefined;\n const uiProduction = typeof uiConfig?.production === \"string\" ? uiConfig.production : undefined;\n const uiRuntime =\n uiConfig && (uiDevelopment || uiProduction)\n ? env === \"development\"\n ? resolveDevelopmentTarget(uiDevelopment, uiProduction, baseDir)\n : resolveRuntimeTarget(uiProduction, baseDir, \"remote\")\n : undefined;\n\n const sidebar = (config.sidebar ?? source.sidebar)?.map((item) => ({\n ...item,\n to: item.to ?? `/${pluginId}`,\n roleRequired: item.roleRequired ?? (\"member\" as const),\n }));\n\n const routes = config.routes ?? source.routes;\n\n return {\n name: apiName,\n url: runtimeTarget.url,\n entry: runtimeTarget.url\n ? `${runtimeTarget.url.replace(/\\/$/, \"\")}/mf-manifest.json`\n : \"/mf-manifest.json\",\n source: runtimeTarget.source,\n localPath: runtimeTarget.localPath,\n port: runtimeTarget.port,\n proxy: proxy ?? (typeof source.proxy === \"string\" ? source.proxy : undefined),\n variables: normalizeStringRecord(apiConfig.variables ?? source.variables),\n secrets: normalizeStringArray(apiConfig.secrets ?? source.secrets),\n ui: uiRuntime\n ? {\n name: typeof uiConfig?.name === \"string\" ? uiConfig.name : `${apiName}-ui`,\n url: uiRuntime.url,\n entry: uiRuntime.url\n ? `${uiRuntime.url.replace(/\\/$/, \"\")}/mf-manifest.json`\n : \"/mf-manifest.json\",\n source: uiRuntime.source,\n localPath: uiRuntime.localPath,\n port: uiRuntime.port,\n integrity:\n uiRuntime.source === \"remote\" && typeof uiConfig?.integrity === \"string\"\n ? uiConfig.integrity\n : undefined,\n }\n : undefined,\n sidebar,\n routes,\n };\n}\n\nexport function resolvePluginRuntimeName(\n explicitName: string | undefined,\n localPath: string | undefined,\n fallback: string,\n): string {\n if (explicitName) {\n return explicitName;\n }\n\n if (!localPath) {\n return fallback;\n }\n\n try {\n const packageJsonPath = join(localPath, \"package.json\");\n const packageJson = JSON.parse(readFileSync(packageJsonPath, \"utf-8\")) as { name?: unknown };\n if (typeof packageJson.name === \"string\" && packageJson.name.length > 0) {\n return packageJson.name;\n }\n } catch {}\n\n return fallback;\n}\n\nfunction normalizeStringRecord(value: unknown): Record<string, string> | undefined {\n if (!isPlainObject(value)) return undefined;\n const out: Record<string, string> = {};\n for (const [key, raw] of Object.entries(value)) {\n if (typeof raw === \"string\") {\n out[key] = raw;\n }\n }\n return Object.keys(out).length > 0 ? out : undefined;\n}\n\nfunction normalizeStringArray(value: unknown): string[] | undefined {\n if (!Array.isArray(value)) return undefined;\n const out = value.filter((item): item is string => typeof item === \"string\" && item.length > 0);\n return out.length > 0 ? out : undefined;\n}\n\nfunction resolveRuntimeTarget(\n value: string | undefined,\n baseDir: string,\n defaultSource: \"local\" | \"remote\" = \"remote\",\n): RuntimeTarget {\n if (!value) {\n return { source: defaultSource, url: \"\" };\n }\n\n if (value.startsWith(LOCAL_PREFIX)) {\n const localTarget = value?.slice(LOCAL_PREFIX.length).trim();\n if (!localTarget) {\n throw new Error(`Invalid local development target: ${value}`);\n }\n\n const localPath = resolve(baseDir, localTarget);\n if (!existsSync(localPath)) {\n return { source: \"local\", url: \"\" };\n }\n\n return {\n source: \"local\",\n url: \"\",\n localPath,\n };\n }\n\n return {\n source: defaultSource,\n url: value.replace(/\\/$/, \"\"),\n port: parsePort(value),\n };\n}\n\nexport function isLocalDevelopmentTarget(\n value: string | undefined,\n): value is `${typeof LOCAL_PREFIX}${string}` {\n return typeof value === \"string\" && value.startsWith(LOCAL_PREFIX);\n}\n\nexport function resolveLocalDevelopmentPath(\n value: string | undefined,\n baseDir: string,\n): string | null {\n if (!isLocalDevelopmentTarget(value)) {\n return null;\n }\n\n const localTarget = value.slice(LOCAL_PREFIX.length).trim();\n return localTarget ? resolve(baseDir, localTarget) : null;\n}\n\nexport function resolveDevelopmentHostUrl(value: string | undefined): string {\n if (!value || isLocalDevelopmentTarget(value)) {\n return `http://localhost:${DEFAULT_HOST_PORT}`;\n }\n\n return value.replace(/\\/$/, \"\");\n}\n\nexport function getHostDevelopmentPort(value: string | undefined): number {\n return parsePort(resolveDevelopmentHostUrl(value));\n}\n\nexport function parsePort(url: string): number {\n try {\n const parsed = new URL(url);\n return parsed.port ? parseInt(parsed.port, 10) : parsed.protocol === \"https:\" ? 443 : 80;\n } catch {\n return 3000;\n }\n}\n\nexport { BOS_CONFIG_ORDER, rebuildOrderedConfig } from \"./merge\";\nexport type { BosConfig, RuntimeConfig } from \"./types\";\nexport { BosConfigSchema } from \"./types\";\n"],"mappings":";;;;;;;;;;AAwBA,MAAM,eAAe;AACrB,MAAM,oBAAoB;AAC1B,MAAM,2BAA2B;AASjC,IAAI,eAAiC;AACrC,IAA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AAA,CAAc,OAAA;EAClC,GAAA;EACA,IAAA;EACA,GAAA,GAAM,MAAA;AAAA,IACJ,OAAA,CAAQ,aAAA;AAAA,iBASU,4BAAA,CACpB,MAAA,EAAQ,SAAA,EACR,OAAA,UACA,GAAA,EAAK,MAAA,GACJ,OAAA,CAAQ,MAAA,SAAe,mBAAA;AAAA,iBAKV,qBAAA,CAAsB,SAAA;AAAA,iBAItB,kBAAA,CAAmB,SAAA,WAAoB,SAAA;AAAA,iBAavC,mBAAA,CACd,SAAA,UACA,MAAA,EAAQ,SAAA,EACR,GAAA,EAAK,MAAA,EACL,YAAA,aACA,MAAA;AAAA,iBA6Bc,oBAAA,CAAqB,SAAA;AAAA,iBAMrB,qBAAA,CAAsB,SAAA,WAAoB,MAAA;AAAA,UA+BzC,yBAAA;EACf,OAAA,GAAU,MAAA,SAAe,mBAAA;EACzB,UAAA;EACA,QAAA;EACA,SAAA;EACA,UAAA;EACA,KAAA;AAAA;AAAA,iBAGc,kBAAA,CACd,MAAA,EAAQ,SAAA,EACR,OAAA,UACA,GAAA,EAAK,MAAA,EACL,OAAA,GAAU,yBAAA,GACT,aAAA;AAAA,iBAiYa,wBAAA,CACd,YAAA,sBACA,SAAA,sBACA,QAAA;AAAA,iBAwEc,wBAAA,CACd,KAAA,uBACC,KAAA,cAAmB,YAAA;AAAA,iBAIN,2BAAA,CACd,KAAA,sBACA,OAAA;AAAA,iBAUc,yBAAA,CAA0B,KAAA;AAAA,iBAQ1B,sBAAA,CAAuB,KAAA;AAAA,iBAIvB,SAAA,CAAU,GAAA"}
|
package/dist/config.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { fetchBosConfigFromFastKv
|
|
1
|
+
import { fetchBosConfigFromFastKv } from "./fastkv.mjs";
|
|
2
2
|
import { BOS_CONFIG_ORDER, isPlainObject, mergeBosConfigWithExtends, rebuildOrderedConfig, resolveExtendsRef } from "./merge.mjs";
|
|
3
3
|
import { getNetworkIdForAccount } from "./network.mjs";
|
|
4
4
|
import { BosConfigSchema } from "./types.mjs";
|
|
@@ -300,22 +300,6 @@ async function resolveRemotePluginRuntimeName(baseUrl, fallback) {
|
|
|
300
300
|
return fallback;
|
|
301
301
|
}
|
|
302
302
|
}
|
|
303
|
-
async function resolveBosPluginUrl(bosUrl) {
|
|
304
|
-
const parsed = parsePluginBosUrl(bosUrl);
|
|
305
|
-
if (!parsed) return null;
|
|
306
|
-
try {
|
|
307
|
-
const entry = await fetchPluginFromRegistry(parsed.accountId, parsed.pluginName);
|
|
308
|
-
if (!entry) return null;
|
|
309
|
-
const cdnUrl = entry.metadata.cdnUrl;
|
|
310
|
-
if (!cdnUrl) return null;
|
|
311
|
-
return {
|
|
312
|
-
url: cdnUrl,
|
|
313
|
-
integrity: entry.metadata.integrity ?? void 0
|
|
314
|
-
};
|
|
315
|
-
} catch {
|
|
316
|
-
return null;
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
303
|
async function buildRuntimePluginConfig(pluginId, config, baseDir, env, source) {
|
|
320
304
|
const apiConfig = config.app?.api ?? {};
|
|
321
305
|
const apiDevelopment = typeof apiConfig.development === "string" ? apiConfig.development : void 0;
|
|
@@ -324,14 +308,8 @@ async function buildRuntimePluginConfig(pluginId, config, baseDir, env, source)
|
|
|
324
308
|
const sourceProduction = typeof source.production === "string" ? source.production : void 0;
|
|
325
309
|
const proxy = typeof apiConfig.proxy === "string" ? apiConfig.proxy : void 0;
|
|
326
310
|
const development = apiDevelopment ?? sourceDevelopment;
|
|
327
|
-
|
|
328
|
-
if (production?.startsWith("bos://")) {
|
|
329
|
-
const resolved = await resolveBosPluginUrl(production);
|
|
330
|
-
if (resolved) {
|
|
331
|
-
production = resolved.url;
|
|
332
|
-
if (resolved.integrity && env === "production") source.integrity = resolved.integrity;
|
|
333
|
-
}
|
|
334
|
-
}
|
|
311
|
+
const production = apiProduction ?? sourceProduction;
|
|
312
|
+
if (production?.startsWith("bos://")) throw new Error(`Plugin "${pluginId}" has unsupported production target "${production}". Use extends: "bos://account/domain" for plugin configs or a CDN URL for production.`);
|
|
335
313
|
const runtimeTarget = env === "development" ? resolveDevelopmentTarget(development, production, baseDir) : resolveRuntimeTarget(production, baseDir, "remote");
|
|
336
314
|
const apiName = resolvePluginRuntimeName(typeof apiConfig.name === "string" ? apiConfig.name : void 0, runtimeTarget.localPath, pluginId);
|
|
337
315
|
const uiConfig = config.app?.ui;
|