@babylonjsmarket/cli 1.0.2
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/LICENSE +21 -0
- package/README.md +179 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +7114 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/inject/detect-target.d.ts +43 -0
- package/dist/lib/inject/detect-target.js +26 -0
- package/dist/lib/inject/detect-target.js.map +1 -0
- package/dist/lib/inject/engine.d.ts +41 -0
- package/dist/lib/inject/engine.js +655 -0
- package/dist/lib/inject/engine.js.map +1 -0
- package/dist/lib/inject/index.d.ts +3 -0
- package/dist/lib/inject/index.js +656 -0
- package/dist/lib/inject/index.js.map +1 -0
- package/dist/lib/inject/inject-options.d.ts +3 -0
- package/dist/lib/inject/inject-options.js +33 -0
- package/dist/lib/inject/inject-options.js.map +1 -0
- package/package.json +96 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/inject/engine.ts","../../../src/lib/inject/inject-options.ts","../../../src/lib/inject/detect-target.ts","../../../src/lib/inject/monorepo-root.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport path from \"node:path\";\nimport mri from \"mri\";\nimport colors from \"picocolors\";\nimport { INJECT_HELP } from \"./inject-options.js\";\nimport {\n detectTarget,\n detectLayer,\n type Target,\n type VizLayer,\n type SeedFile,\n} from \"./detect-target.js\";\nimport { findMonorepoRoot } from \"./monorepo-root.js\";\n\nconst { cyan, green, yellow, dim, bold } = colors;\n\n// ─── Public collect-mode result shape ────────────────────────────────────────\n\nexport interface InjectPatch {\n /** Path of the file being patched, relative to the target package root. */\n file: string;\n kind: \"registry-append\" | \"barrel-append\";\n /** The line that would be appended/inserted. */\n line: string;\n}\n\nexport interface InjectFile {\n /** Path relative to the target package root (e.g. `src/Components/Foo/Foo.ts`). */\n path: string;\n contents: string;\n}\n\nexport interface InjectCollectResult {\n target: Target;\n files: InjectFile[];\n patches: InjectPatch[];\n warnings: string[];\n}\n\n// ─── Filesystem helpers (mirrors eject.ts) ────────────────────────────────────\n\n/** Every .ts/.tsx file inside a project component folder. */\nfunction componentFiles(dir: string): string[] {\n const out: string[] = [];\n const walk = (d: string) => {\n for (const e of fs.readdirSync(d, { withFileTypes: true })) {\n const p = path.join(d, e.name);\n if (e.isDirectory()) walk(p);\n else if (/\\.(ts|tsx)$/.test(e.name)) out.push(p);\n }\n };\n if (fs.existsSync(dir)) walk(dir);\n return out;\n}\n\n/** Every file (including non-ts assets like meta.json) inside a component folder. */\nfunction allComponentFiles(dir: string): string[] {\n const out: string[] = [];\n const walk = (d: string) => {\n for (const e of fs.readdirSync(d, { withFileTypes: true })) {\n const p = path.join(d, e.name);\n if (e.isDirectory()) walk(p);\n else out.push(p);\n }\n };\n if (fs.existsSync(dir)) walk(dir);\n return out;\n}\n\n/** All top-level project component names = `<project>/src/components/*` (minus `_shared`). */\nfunction projectComponentNames(projectDir: string): string[] {\n const dir = path.join(projectDir, \"src\", \"components\");\n if (!fs.existsSync(dir)) return [];\n return fs\n .readdirSync(dir, { withFileTypes: true })\n .filter((e) => e.isDirectory() && e.name !== \"_shared\")\n .map((e) => e.name);\n}\n\n/** Component names a given seed imports via `../Sibling/`, `~/components/Sibling/`, or its meta.json deps. */\nfunction directDeps(\n name: string,\n componentsDir: string,\n allNames: Set<string>,\n): Set<string> {\n const deps = new Set<string>();\n const metaPath = path.join(componentsDir, name, \"meta.json\");\n if (fs.existsSync(metaPath)) {\n try {\n const meta = JSON.parse(fs.readFileSync(metaPath, \"utf8\")) as { dependencies?: string[] };\n for (const d of meta.dependencies ?? []) if (allNames.has(d)) deps.add(d);\n } catch {\n /* tolerate malformed meta.json — import scan is the safety net */\n }\n }\n const relRe = /['\"]\\.\\.\\/([A-Z][A-Za-z0-9_]*)\\//g;\n const aliasRe = /['\"]~\\/components\\/([A-Z][A-Za-z0-9_]*)\\//g;\n for (const file of componentFiles(path.join(componentsDir, name))) {\n const src = fs.readFileSync(file, \"utf8\");\n let m: RegExpExecArray | null;\n while ((m = relRe.exec(src))) if (allNames.has(m[1])) deps.add(m[1]);\n while ((m = aliasRe.exec(src))) if (allNames.has(m[1])) deps.add(m[1]);\n }\n return deps;\n}\n\n/** Expand a seed set to its transitive sibling closure. */\nfunction resolveClosure(\n seed: Set<string>,\n componentsDir: string,\n allNames: string[],\n): Set<string> {\n const all = new Set(allNames);\n const out = new Set(seed);\n const queue = [...seed];\n while (queue.length) {\n const next = queue.pop()!;\n for (const dep of directDeps(next, componentsDir, all)) {\n if (!out.has(dep)) {\n out.add(dep);\n queue.push(dep);\n }\n }\n }\n return out;\n}\n\n/**\n * Reverse of eject's rewriteImports:\n *\n * `'@babylonjsmarket/arcade/<Sibling>'` → `'../<Sibling>/<Sibling>'`\n * `'@babylonjsmarket/arcade-pro/<Sibling>'` → `'../<Sibling>/<Sibling>'`\n *\n * …but only when <Sibling> is co-injected for the same target package. Other\n * package subpaths (including ecs / babylon / solid-js / etc.) are left alone.\n *\n * For arcade-pro, components share a parent (`src/Components/`), so the\n * relative path is always `../<Sibling>/<Sibling>`. For viz-pro the caller\n * supplies a `layerMap` and the originating file's layer; the relative path\n * resolves through the per-file layer routing.\n */\nfunction rewriteArcadeImports(src: string, injected: Set<string>): string {\n return src.replace(\n /(['\"])@babylonjsmarket\\/(?:arcade|arcade-pro)\\/([A-Z][A-Za-z0-9_]*)\\1/g,\n (whole, quote, sibling) => {\n if (injected.has(sibling)) {\n return `${quote}../${sibling}/${sibling}${quote}`;\n }\n return whole;\n },\n );\n}\n\n/**\n * viz-pro variant. Rewrites `@babylonjsmarket/viz-pro/<Sibling>` (or\n * `@babylonjsmarket/arcade/<Sibling>` referencing a viz-pro sibling) to the\n * correct flat-layer relative path: `../<targetLayer>/<Sibling>`. Same-layer\n * siblings collapse to `./<Sibling>`.\n */\nfunction rewriteVizImports(\n src: string,\n injected: Set<string>,\n layerOf: (name: string) => VizLayer | undefined,\n fromLayer: VizLayer,\n): string {\n return src.replace(\n /(['\"])@babylonjsmarket\\/(?:viz-pro|arcade|arcade-pro)\\/([A-Z][A-Za-z0-9_]*)\\1/g,\n (whole, quote, sibling) => {\n if (!injected.has(sibling)) return whole;\n const dest = layerOf(sibling);\n if (!dest) return whole;\n const rel = dest === fromLayer ? `./${sibling}` : `../${dest}/${sibling}`;\n return `${quote}${rel}${quote}`;\n },\n );\n}\n\n// ─── Registry / barrel patchers ───────────────────────────────────────────────\n\n/**\n * Append lazy resolver lines into ARCADE_PRO_COMPONENT_REGISTRY. Pure decision\n * step: returns what to add without touching disk.\n *\n * `existingRegistry` is the current registry.ts contents, or `undefined` when\n * the file isn't present (apply mode missing the marker emits a warning; in\n * collect mode we always assume the marker is present).\n */\nfunction planArcadeProRegistry(\n existingRegistry: string | undefined,\n names: string[],\n registryRelPath = \"src/registry.ts\",\n): { lines: string[]; added: string[]; warnings: string[]; markerFound: boolean } {\n const warnings: string[] = [];\n if (existingRegistry === undefined) {\n warnings.push(\n `! packages/arcade-pro/${registryRelPath} not found — add resolvers manually for: ${names.join(\", \")}`,\n );\n return { lines: [], added: [], warnings, markerFound: false };\n }\n const marker = /ARCADE_PRO_COMPONENT_REGISTRY:\\s*Record<string,\\s*LazyComponentResolver>\\s*=\\s*\\{/;\n if (!marker.test(existingRegistry)) {\n warnings.push(\n `! Could not find 'ARCADE_PRO_COMPONENT_REGISTRY' marker — add resolvers manually for: ${names.join(\", \")}`,\n );\n return { lines: [], added: [], warnings, markerFound: false };\n }\n const added: string[] = [];\n const lines: string[] = [];\n for (const name of names) {\n if (existingRegistry.includes(`./Components/${name}/${name}`)) continue; // already wired\n lines.push(` ${name}: () => import('./Components/${name}/${name}'),`);\n added.push(name);\n }\n return { lines, added, warnings, markerFound: true };\n}\n\n/** Append a lazy resolver line into ARCADE_PRO_COMPONENT_REGISTRY (idempotent, on-disk). */\nfunction patchArcadeProRegistry(\n arcadeProRoot: string,\n names: string[],\n dryRun: boolean,\n): string[] {\n const registryPath = path.join(arcadeProRoot, \"src\", \"registry.ts\");\n const existing = fs.existsSync(registryPath) ? fs.readFileSync(registryPath, \"utf8\") : undefined;\n const plan = planArcadeProRegistry(existing, names);\n if (plan.warnings.length) return plan.warnings;\n if (plan.added.length && !dryRun) {\n const marker = /ARCADE_PRO_COMPONENT_REGISTRY:\\s*Record<string,\\s*LazyComponentResolver>\\s*=\\s*\\{/;\n const next = (existing as string).replace(marker, (m) => `${m}\\n${plan.lines.join(\"\\n\")}`);\n fs.writeFileSync(registryPath, next);\n }\n return plan.added.map((n) => ` patched registry: ${n}`);\n}\n\n/**\n * Pure planner for the viz-pro layer barrel: returns the line to append if any.\n */\nfunction planVizProBarrel(\n existingBarrel: string | undefined,\n layer: VizLayer,\n fileName: string,\n): { line: string | null; warnings: string[] } {\n if (existingBarrel === undefined) {\n return {\n line: null,\n warnings: [\n `! packages/viz-pro/src/${layer}/index.ts not found — add the barrel re-export manually for ${fileName}`,\n ],\n };\n }\n const needle = `from './${fileName}'`;\n if (existingBarrel.includes(needle)) return { line: null, warnings: [] };\n return { line: `export * from './${fileName}';`, warnings: [] };\n}\n\n/** Append `export * from './<FileName>';` to a viz-pro layer barrel (idempotent, on-disk). */\nfunction patchVizProBarrel(\n vizProRoot: string,\n layer: VizLayer,\n fileName: string,\n dryRun: boolean,\n): string[] {\n const barrelPath = path.join(vizProRoot, \"src\", layer, \"index.ts\");\n const existing = fs.existsSync(barrelPath) ? fs.readFileSync(barrelPath, \"utf8\") : undefined;\n const plan = planVizProBarrel(existing, layer, fileName);\n if (plan.warnings.length) return plan.warnings;\n if (plan.line === null) return [];\n if (!dryRun) {\n const next = existing!.endsWith(\"\\n\")\n ? existing + plan.line + \"\\n\"\n : existing + \"\\n\" + plan.line + \"\\n\";\n fs.writeFileSync(barrelPath, next);\n }\n return [` patched ${layer}/index.ts: ${fileName}`];\n}\n\n/**\n * Strip a lazy-resolver line of the form\n * ` Foo: () => import('./components/Foo/Foo'),`\n * from `<project>/src/registry.ts`. Returns the list of names actually removed.\n */\nfunction stripProjectRegistry(\n projectDir: string,\n names: string[],\n dryRun: boolean,\n): string[] {\n const registryPath = path.join(projectDir, \"src\", \"registry.ts\");\n if (!fs.existsSync(registryPath)) return [];\n let text = fs.readFileSync(registryPath, \"utf8\");\n const removed: string[] = [];\n for (const name of names) {\n const re = new RegExp(\n `^\\\\s*${name}\\\\s*:\\\\s*\\\\(\\\\)\\\\s*=>\\\\s*import\\\\(\\\\s*['\"]\\\\.\\\\/components\\\\/${name}\\\\/${name}['\"]\\\\s*\\\\)\\\\s*,?\\\\s*\\\\r?\\\\n`,\n \"m\",\n );\n if (re.test(text)) {\n text = text.replace(re, \"\");\n removed.push(name);\n }\n }\n if (removed.length && !dryRun) fs.writeFileSync(registryPath, text);\n return removed;\n}\n\n// ─── Plan + main entry ────────────────────────────────────────────────────────\n\ninterface ResolvedSeed {\n /** Name as the operator typed it (and as it lives under `src/components/`). */\n name: string;\n /** Absolute path to the seed's source directory (post `--source` override). */\n sourceDir: string;\n}\n\nexport interface InjectOptions {\n /**\n * What the engine does with the resolved file list:\n * - 'apply' → writes into the resolved packageRoot/vizProRoot (operator mode).\n * - 'collect' → returns the file map + patch plan without touching disk\n * (member mode; payload goes to the marketplace endpoint).\n */\n mode?: \"apply\" | \"collect\";\n /** Tmpdir-friendly: the arcade-pro package root (the dir containing `src/registry.ts`). Apply mode only. */\n packageRoot?: string;\n /** Tmpdir-friendly: the viz-pro package root (the dir containing `src/{core,solid,ecs}/index.ts`). Apply mode only. */\n vizProRoot?: string;\n /** The project we're injecting FROM. Defaults to `cwd`. */\n projectDir?: string;\n /** Override for `process.cwd()`. Tests use this; the CLI entry passes `process.cwd()`. */\n cwd?: string;\n}\n\nexport async function inject(\n args: string[],\n opts: InjectOptions = {},\n): Promise<InjectCollectResult | void> {\n if (args.includes(\"-h\") || args.includes(\"--help\")) {\n console.log(INJECT_HELP);\n return;\n }\n\n const argv = mri(args, {\n boolean: [\"dry-run\", \"move\", \"confirm\", \"force\"],\n string: [\"target\", \"source\", \"layer\"],\n });\n\n const mode: \"apply\" | \"collect\" = opts.mode ?? \"apply\";\n const dryRun = Boolean(argv[\"dry-run\"]);\n const move = Boolean(argv.move);\n const confirm = Boolean(argv.confirm);\n const force = Boolean(argv.force);\n const explicitTarget = argv.target as Target | undefined;\n const sourceOverride = argv.source as string | undefined;\n const layerOverride = argv.layer as VizLayer | undefined;\n const names = argv._.map(String);\n\n const cwd = opts.cwd ?? process.cwd();\n const projectDir = opts.projectDir ?? cwd;\n\n // ─── Arg validation ───\n if (names.length === 0) {\n console.error(yellow(\"No component names given. Pass at least one, e.g. `bjs inject Foo`.\"));\n process.exit(1);\n return;\n }\n // --move / --confirm are operator-only knobs. In collect mode they're\n // meaningless (no project to mutate); flag and bail.\n if (mode === \"collect\" && (move || confirm)) {\n console.error(yellow(\"--move and --confirm are not available in member submission mode.\"));\n process.exit(1);\n return;\n }\n if (move && !confirm) {\n console.error(yellow(\"--move requires --confirm (it deletes project files). Pass --move --confirm.\"));\n process.exit(1);\n return;\n }\n if (move && dryRun) {\n console.error(yellow(\"--move and --dry-run are mutually exclusive. Drop one.\"));\n process.exit(1);\n return;\n }\n if (explicitTarget && explicitTarget !== \"arcade-pro\" && explicitTarget !== \"viz-pro\") {\n console.error(yellow(`Unknown --target ${explicitTarget}. Use arcade-pro or viz-pro.`));\n process.exit(1);\n return;\n }\n if (layerOverride && layerOverride !== \"core\" && layerOverride !== \"solid\" && layerOverride !== \"ecs\") {\n console.error(yellow(`Unknown --layer ${layerOverride}. Use core, solid, or ecs.`));\n process.exit(1);\n return;\n }\n if (sourceOverride && names.length > 1) {\n console.error(yellow(\"--source applies to a single seed; pass one NAME with --source.\"));\n process.exit(1);\n return;\n }\n\n // ─── Phase 0: resolve roots (apply mode only) ───\n let packageRoot = opts.packageRoot;\n let vizProRoot = opts.vizProRoot;\n if (mode === \"apply\" && (!packageRoot || !vizProRoot)) {\n try {\n const monorepo = findMonorepoRoot();\n packageRoot ??= monorepo.arcadeProRoot;\n vizProRoot ??= monorepo.vizProRoot;\n } catch (e) {\n console.error(yellow((e as Error).message));\n process.exit(1);\n return;\n }\n }\n\n // ─── Phase 1: locate seeds + walk closure ───\n const componentsDir = path.join(projectDir, \"src\", \"components\");\n const allProjectNames = projectComponentNames(projectDir);\n\n const seeds: ResolvedSeed[] = [];\n for (const name of names) {\n const sourceDir = sourceOverride\n ? path.resolve(cwd, sourceOverride)\n : path.join(componentsDir, name);\n if (!fs.existsSync(sourceDir)) {\n console.error(\n yellow(\n `Could not find source for \"${name}\". Looked at ${sourceDir}. ` +\n `Use --source <path> to point at the seed explicitly.`,\n ),\n );\n process.exit(1);\n return;\n }\n seeds.push({ name, sourceDir });\n }\n\n // Run the closure walk in the project's components dir (only when seeds live\n // under <project>/src/components/, which is the default and the case we can\n // reason about transitively). With --source we still inject the seed itself\n // but skip the transitive walk — caller is in unusual territory.\n const seedNames = new Set(seeds.map((s) => s.name));\n const closure: Set<string> = sourceOverride\n ? seedNames\n : resolveClosure(seedNames, componentsDir, allProjectNames);\n\n // ─── Phase 2: target detection ───\n const closureFiles: SeedFile[] = [];\n for (const name of closure) {\n const dir = sourceOverride && seedNames.has(name)\n ? seeds.find((s) => s.name === name)!.sourceDir\n : path.join(componentsDir, name);\n for (const f of componentFiles(dir)) {\n closureFiles.push({ path: f, source: fs.readFileSync(f, \"utf8\") });\n }\n }\n\n const target: Target = explicitTarget ?? detectTarget(closureFiles);\n\n // For multi-seed inputs, every seed individually must agree with `target`.\n if (!explicitTarget && seeds.length > 1) {\n for (const seed of seeds) {\n const dir = seed.sourceDir;\n const files: SeedFile[] = componentFiles(dir).map((f) => ({\n path: f,\n source: fs.readFileSync(f, \"utf8\"),\n }));\n const perSeed = detectTarget(files);\n if (perSeed !== target) {\n console.error(\n yellow(\n `Auto-detect disagrees across seeds: \"${seed.name}\" → ${perSeed}, ` +\n `others → ${target}. Pass --target explicitly or split into separate runs.`,\n ),\n );\n process.exit(1);\n return;\n }\n }\n }\n\n // ─── Apply-mode root checks ───\n let chosenRoot: string | undefined;\n if (mode === \"apply\") {\n try {\n if (target === \"arcade-pro\") {\n if (!fs.existsSync(packageRoot!)) {\n throw new Error(\n `packages/arcade-pro is not checked out at ${packageRoot}. Run \\`git submodule update --init packages/arcade-pro\\` and retry.`,\n );\n }\n chosenRoot = packageRoot!;\n } else {\n if (!fs.existsSync(vizProRoot!)) {\n throw new Error(\n `packages/viz-pro is not checked out at ${vizProRoot}. Run \\`git submodule update --init packages/viz-pro\\` and retry.`,\n );\n }\n chosenRoot = vizProRoot!;\n }\n } catch (e) {\n console.error(yellow((e as Error).message));\n process.exit(1);\n return;\n }\n }\n\n // ─── Plan logging header ───\n console.log(\n bold(dryRun ? \"\\nInject plan (dry run — nothing written):\" : \"\\nInjecting:\"),\n );\n console.log(` target: ${cyan(target)}`);\n console.log(` components: ${cyan([...closure].sort().join(\", \"))}`);\n\n // ─── Phase 3: copy files ───\n if (mode === \"collect\") {\n const result =\n target === \"arcade-pro\"\n ? collectArcadePro({ seeds, closure, componentsDir, sourceOverride })\n : collectVizPro({ seeds, closure, componentsDir, sourceOverride, layerOverride });\n for (const f of result.files) console.log(green(` + packages/${target}/${f.path}`));\n for (const w of result.warnings) console.log(yellow(w));\n console.log(\n dryRun\n ? dim(\"\\nRe-run without --dry-run to submit.\\n\")\n : dim(\"\\nCollect-mode plan ready (no submission performed by the library).\\n\"),\n );\n return { ...result, target };\n }\n\n // mode === 'apply'\n if (target === \"arcade-pro\") {\n await injectArcadePro({\n seeds,\n closure,\n componentsDir,\n sourceOverride,\n arcadeProRoot: chosenRoot!,\n dryRun,\n force,\n });\n } else {\n await injectVizPro({\n seeds,\n closure,\n componentsDir,\n sourceOverride,\n vizProRoot: chosenRoot!,\n dryRun,\n force,\n layerOverride,\n });\n }\n\n // ─── Phase 6 (optional): source cleanup ───\n if (move) {\n if (sourceOverride) {\n console.log(\n yellow(\n \" ! --move with --source: only the source dir is removed; cannot reliably patch a foreign project's registry.\",\n ),\n );\n }\n for (const seed of seeds) {\n if (fs.existsSync(seed.sourceDir)) {\n if (!dryRun) fs.rmSync(seed.sourceDir, { recursive: true, force: true });\n console.log(dim(` - ${path.relative(projectDir, seed.sourceDir)}/ (project copy removed)`));\n }\n }\n const removed = stripProjectRegistry(\n projectDir,\n seeds.map((s) => s.name),\n dryRun,\n );\n for (const name of removed) {\n console.log(dim(` - project registry entry: ${name}`));\n }\n }\n\n console.log(\n dryRun\n ? dim(\"\\nRe-run without --dry-run to apply.\\n\")\n : green(`\\nDone. Components landed in packages/${target}/.\\n`),\n );\n}\n\n// ─── arcade-pro injection (apply mode) ───────────────────────────────────────\n\nasync function injectArcadePro(args: {\n seeds: ResolvedSeed[];\n closure: Set<string>;\n componentsDir: string;\n sourceOverride: string | undefined;\n arcadeProRoot: string;\n dryRun: boolean;\n force: boolean;\n}): Promise<void> {\n const { seeds, closure, componentsDir, sourceOverride, arcadeProRoot, dryRun, force } = args;\n const destComponents = path.join(arcadeProRoot, \"src\", \"Components\");\n if (!dryRun) fs.mkdirSync(destComponents, { recursive: true });\n\n const sourceOf = (name: string): string => {\n const seed = seeds.find((s) => s.name === name);\n return seed && sourceOverride ? seed.sourceDir : path.join(componentsDir, name);\n };\n\n for (const name of [...closure].sort()) {\n const src = sourceOf(name);\n const dest = path.join(destComponents, name);\n if (fs.existsSync(dest) && !force) {\n console.log(\n yellow(` ! packages/arcade-pro/src/Components/${name}/ already exists — pass --force to overwrite.`),\n );\n continue;\n }\n if (!dryRun) {\n if (fs.existsSync(dest)) fs.rmSync(dest, { recursive: true, force: true });\n fs.cpSync(src, dest, { recursive: true });\n }\n console.log(green(` + packages/arcade-pro/src/Components/${name}/`));\n }\n\n // Phase 4: import rewriting across each copied folder.\n if (!dryRun) {\n for (const name of closure) {\n const dest = path.join(destComponents, name);\n if (!fs.existsSync(dest)) continue;\n rewriteTree(dest, (text) => rewriteArcadeImports(text, closure));\n }\n }\n\n // Phase 5: arcade-pro registry patch.\n for (const line of patchArcadeProRegistry(\n arcadeProRoot,\n [...closure].sort(),\n dryRun,\n )) {\n console.log(line.startsWith(\"!\") ? yellow(line) : dim(line));\n }\n}\n\n// ─── arcade-pro collection (collect mode) ────────────────────────────────────\n\nfunction collectArcadePro(args: {\n seeds: ResolvedSeed[];\n closure: Set<string>;\n componentsDir: string;\n sourceOverride: string | undefined;\n}): { files: InjectFile[]; patches: InjectPatch[]; warnings: string[] } {\n const { seeds, closure, componentsDir, sourceOverride } = args;\n const sourceOf = (name: string): string => {\n const seed = seeds.find((s) => s.name === name);\n return seed && sourceOverride ? seed.sourceDir : path.join(componentsDir, name);\n };\n\n const files: InjectFile[] = [];\n const warnings: string[] = [];\n\n for (const name of [...closure].sort()) {\n const src = sourceOf(name);\n if (!fs.existsSync(src)) {\n warnings.push(` ! source for ${name} missing at ${src}`);\n continue;\n }\n for (const abs of allComponentFiles(src)) {\n const rel = path.relative(src, abs);\n const baseRel = path.posix.join(\"src\", \"Components\", name, rel.split(path.sep).join(\"/\"));\n const isText = /\\.(ts|tsx)$/i.test(abs);\n const raw = fs.readFileSync(abs, \"utf8\");\n const contents = isText ? rewriteArcadeImports(raw, closure) : raw;\n files.push({ path: baseRel, contents });\n }\n }\n\n // Plan the registry patch — but submit the *desired* added lines, not the\n // raw existing+new file. The server applies the patch against whatever the\n // pro package looks like at merge time.\n const patches: InjectPatch[] = [];\n for (const name of [...closure].sort()) {\n patches.push({\n file: \"src/registry.ts\",\n kind: \"registry-append\",\n line: ` ${name}: () => import('./Components/${name}/${name}'),`,\n });\n }\n\n return { files, patches, warnings };\n}\n\n// ─── viz-pro injection (apply mode) ──────────────────────────────────────────\n\ninterface ViewFile {\n src: string;\n base: string;\n owner: string;\n source: string;\n layer: VizLayer;\n destBase: string;\n}\n\nfunction classifyVizFiles(args: {\n seeds: ResolvedSeed[];\n closure: Set<string>;\n componentsDir: string;\n sourceOverride: string | undefined;\n layerOverride: VizLayer | undefined;\n}): { files: ViewFile[]; primaryLayer: Map<string, VizLayer> } {\n const { seeds, closure, componentsDir, sourceOverride, layerOverride } = args;\n\n const sourceOf = (name: string): string => {\n const seed = seeds.find((s) => s.name === name);\n return seed && sourceOverride ? seed.sourceDir : path.join(componentsDir, name);\n };\n\n const files: ViewFile[] = [];\n\n // Pass A — non-tests\n for (const name of closure) {\n const dir = sourceOf(name);\n for (const abs of componentFiles(dir)) {\n const base = path.basename(abs);\n if (/\\.test\\.tsx?$/.test(base)) continue;\n const source = fs.readFileSync(abs, \"utf8\");\n const layer = layerOverride ?? detectLayer(abs, source);\n files.push({ src: abs, base, owner: name, source, layer, destBase: base });\n }\n }\n // Pass B — tests (look up their subject's layer)\n for (const name of closure) {\n const dir = sourceOf(name);\n for (const abs of componentFiles(dir)) {\n const base = path.basename(abs);\n if (!/\\.test\\.tsx?$/.test(base)) continue;\n const source = fs.readFileSync(abs, \"utf8\");\n const subjectBase = base.replace(/\\.test(\\.tsx?)$/, \"$1\");\n const subjectAlt = base.replace(/\\.test\\.tsx?$/, \".tsx\");\n const subject = files.find((f) => f.owner === name && (f.base === subjectBase || f.base === subjectAlt));\n const layer = layerOverride ?? detectLayer(abs, source, subject?.layer);\n files.push({ src: abs, base, owner: name, source, layer, destBase: base });\n }\n }\n\n const primaryLayer = new Map<string, VizLayer>();\n for (const f of files) {\n if (/\\.test\\.tsx?$/.test(f.base)) continue;\n if (!primaryLayer.has(f.owner)) primaryLayer.set(f.owner, f.layer);\n }\n\n return { files, primaryLayer };\n}\n\nasync function injectVizPro(args: {\n seeds: ResolvedSeed[];\n closure: Set<string>;\n componentsDir: string;\n sourceOverride: string | undefined;\n vizProRoot: string;\n dryRun: boolean;\n force: boolean;\n layerOverride: VizLayer | undefined;\n}): Promise<void> {\n const { closure, vizProRoot, dryRun, force } = args;\n const { files, primaryLayer } = classifyVizFiles(args);\n const layerOf = (name: string): VizLayer | undefined => primaryLayer.get(name);\n\n for (const f of files) {\n const dest = path.join(vizProRoot, \"src\", f.layer, f.destBase);\n if (fs.existsSync(dest) && !force) {\n console.log(\n yellow(\n ` ! packages/viz-pro/src/${f.layer}/${f.destBase} already exists — pass --force to overwrite.`,\n ),\n );\n }\n }\n\n for (const f of files) {\n const destDir = path.join(vizProRoot, \"src\", f.layer);\n const dest = path.join(destDir, f.destBase);\n if (fs.existsSync(dest) && !force) continue;\n if (!dryRun) {\n fs.mkdirSync(destDir, { recursive: true });\n const rewritten = rewriteVizImports(f.source, closure, layerOf, f.layer);\n fs.writeFileSync(dest, rewritten);\n }\n console.log(green(` + packages/viz-pro/src/${f.layer}/${f.destBase}`));\n }\n\n // Phase 5 — patch the layer barrels.\n const barrelNames = new Set<string>();\n for (const f of files) {\n if (/\\.test\\.tsx?$/.test(f.base)) continue;\n const stem = f.destBase.replace(/\\.tsx?$/, \"\");\n const key = `${f.layer}:${stem}`;\n if (barrelNames.has(key)) continue;\n barrelNames.add(key);\n for (const line of patchVizProBarrel(vizProRoot, f.layer, stem, dryRun)) {\n console.log(line.startsWith(\"!\") ? yellow(line) : dim(line));\n }\n }\n\n console.log(\n dim(\n \" hint: if you want named re-exports from the package root, edit packages/viz-pro/src/index.ts by hand.\",\n ),\n );\n}\n\n// ─── viz-pro collection (collect mode) ───────────────────────────────────────\n\nfunction collectVizPro(args: {\n seeds: ResolvedSeed[];\n closure: Set<string>;\n componentsDir: string;\n sourceOverride: string | undefined;\n layerOverride: VizLayer | undefined;\n}): { files: InjectFile[]; patches: InjectPatch[]; warnings: string[] } {\n const { closure } = args;\n const { files: classified, primaryLayer } = classifyVizFiles(args);\n const layerOf = (name: string): VizLayer | undefined => primaryLayer.get(name);\n\n const files: InjectFile[] = [];\n const warnings: string[] = [];\n\n for (const f of classified) {\n const rel = path.posix.join(\"src\", f.layer, f.destBase);\n const contents = rewriteVizImports(f.source, closure, layerOf, f.layer);\n files.push({ path: rel, contents });\n }\n\n const patches: InjectPatch[] = [];\n const barrelKeys = new Set<string>();\n for (const f of classified) {\n if (/\\.test\\.tsx?$/.test(f.base)) continue;\n const stem = f.destBase.replace(/\\.tsx?$/, \"\");\n const key = `${f.layer}:${stem}`;\n if (barrelKeys.has(key)) continue;\n barrelKeys.add(key);\n patches.push({\n file: `src/${f.layer}/index.ts`,\n kind: \"barrel-append\",\n line: `export * from './${stem}';`,\n });\n }\n\n return { files, patches, warnings };\n}\n\n/** Run a rewriter over every .ts/.tsx file under a directory tree. */\nfunction rewriteTree(dir: string, rewrite: (text: string) => string): void {\n for (const e of fs.readdirSync(dir, { withFileTypes: true })) {\n const p = path.join(dir, e.name);\n if (e.isDirectory()) rewriteTree(p, rewrite);\n else if (/\\.(ts|tsx)$/.test(e.name)) {\n const before = fs.readFileSync(p, \"utf8\");\n const after = rewrite(before);\n if (after !== before) fs.writeFileSync(p, after);\n }\n }\n}\n\n// Re-export pure classifiers + helpers so callers can pick them up from one place.\nexport { detectTarget, detectLayer };\nexport type { Target, VizLayer, SeedFile };\n","import colors from \"picocolors\";\n\nconst { cyan, bold } = colors;\n\nexport const INJECT_HELP = `\\\nUsage: bjs inject [OPTION]... NAME...\n\nSubmit a component or system from your project's ${cyan(\"src/components/<Name>/\")} to\nBabylonJS Market for curator review (reverse of ${cyan(\"arcade eject\")}).\n\nWith no ${bold(\"--target\")}, the tool auto-detects per seed:\n * any file extending ${cyan(\"PanelDebuggerSystem\")} / ${cyan(\"StateStepperSystem\")} or\n importing from ${cyan(\"@babylonjsmarket/viz-pro\")} → ${cyan(\"viz-pro\")},\n * otherwise → ${cyan(\"arcade-pro\")}.\n\nMulti-seed inputs must all detect to the same target.\n\nOptions:\n --target <arcade-pro|viz-pro> skip auto-detection\n --source <path> override <cwd>/src/components/<Name>/\n --layer <core|solid|ecs> viz-pro only; skip per-file layer detection\n --force allow overwriting an existing target\n --dry-run print the plan, write nothing, do not submit\n -h, --help print this help message\n\nExamples:\n bjs inject Foo # auto-detect target\n bjs inject Foo Bar --dry-run # multi-name, preview\n bjs inject MyPanelDebugger --target viz-pro\n bjs inject Foo --source ./packages/demo/src/components/Foo\n`;\n","/**\n * Pure classifiers for the inject engine.\n *\n * `detectTarget` decides whether a seed of project files belongs in\n * `@babylonjsmarket/arcade-pro` (per-component, registered) or\n * `@babylonjsmarket/viz-pro` (flat per-layer barrels).\n *\n * `detectLayer` decides which viz-pro layer (`core`, `solid`, `ecs`) owns a\n * single source file. Order matters: rules are evaluated top-down and the\n * first match wins. The order mirrors the plan.\n */\n\nexport type Target = \"arcade-pro\" | \"viz-pro\";\nexport type VizLayer = \"core\" | \"solid\" | \"ecs\";\n\nexport interface SeedFile {\n path: string;\n source: string;\n}\n\n/**\n * Classify a closure of seed files to one of the two pro packages. Any single\n * file extending a viz-pro System class or importing from `@babylonjsmarket/viz-pro`\n * tips the whole seed to `viz-pro`.\n */\nexport function detectTarget(seedFiles: SeedFile[]): Target {\n for (const { source } of seedFiles) {\n if (/from\\s+['\"]@babylonjsmarket\\/viz-pro['\"]/.test(source)) return \"viz-pro\";\n if (/extends\\s+(PanelDebuggerSystem|StateStepperSystem)\\b/.test(source)) return \"viz-pro\";\n }\n return \"arcade-pro\";\n}\n\n/**\n * Classify a single source file to a viz-pro layer.\n *\n * Order is load-bearing:\n * 1. *.test.ts(x) → route alongside the subject file (re-detect on the\n * subject's source if known, else default 'core').\n * 2. *.tsx that imports from 'solid-js' → 'solid'.\n * 3. extends (PanelDebuggerSystem|StateStepperSystem|System) or filename\n * ends in 'System.ts' → 'ecs'.\n * 4. extends Component and no Solid import → 'ecs'.\n * 5. contains `definePanel(` and no Solid import → 'core'.\n * 6. fallback → 'core'.\n *\n * `subjectLayer` lets the caller pin a test file to its subject's layer; pass\n * `undefined` when the subject isn't co-injected, which falls through to\n * rule (1)'s default.\n */\nexport function detectLayer(\n filePath: string,\n source: string,\n subjectLayer?: VizLayer,\n): VizLayer {\n const base = filePath.split(/[\\\\/]/).pop() ?? filePath;\n\n // (1) test files travel with their subject\n if (/\\.test\\.tsx?$/.test(base)) {\n return subjectLayer ?? \"core\";\n }\n\n const hasSolidImport = /from\\s+['\"]solid-js['\"]/.test(source);\n\n // (2) Solid .tsx\n if (/\\.tsx$/.test(base) && hasSolidImport) return \"solid\";\n\n // (3) System subclasses or *System.ts filenames\n if (/extends\\s+(PanelDebuggerSystem|StateStepperSystem|System)\\b/.test(source)) return \"ecs\";\n if (/System\\.ts$/.test(base)) return \"ecs\";\n\n // (4) Component subclasses (no Solid)\n if (/extends\\s+Component\\b/.test(source) && !hasSolidImport) return \"ecs\";\n\n // (5) definePanel files (no Solid)\n if (/\\bdefinePanel\\s*\\(/.test(source) && !hasSolidImport) return \"core\";\n\n // (6) fallback\n return \"core\";\n}\n","import fs from \"node:fs\";\nimport path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\nexport interface MonorepoPaths {\n root: string;\n arcadeProRoot: string;\n vizProRoot: string;\n}\n\n/**\n * Walk up from this file (dist/lib/inject/monorepo-root.js or\n * src/lib/inject/monorepo-root.ts) looking for the umbrella `package.json`\n * whose `name === \"babylonjs-market-monorepo\"`. Returns the umbrella root plus\n * the two pro-package roots.\n *\n * Only called from `apply` mode — `collect` mode never touches the local\n * monorepo because it operates against a tmpdir workRoot supplied by the\n * caller.\n *\n * Does NOT validate that the pro-package directories exist — `requireTargetRoot`\n * does that lazily so callers can run --help / classifier-only paths without\n * the submodule being present.\n */\nexport function findMonorepoRoot(): MonorepoPaths {\n const here = path.dirname(fileURLToPath(import.meta.url));\n let dir = here;\n // eslint-disable-next-line no-constant-condition\n while (true) {\n const pkgPath = path.join(dir, \"package.json\");\n if (fs.existsSync(pkgPath)) {\n try {\n const pkg = JSON.parse(fs.readFileSync(pkgPath, \"utf8\")) as { name?: string };\n if (pkg.name === \"babylonjs-market-monorepo\") {\n return {\n root: dir,\n arcadeProRoot: path.join(dir, \"packages\", \"arcade-pro\"),\n vizProRoot: path.join(dir, \"packages\", \"viz-pro\"),\n };\n }\n } catch {\n /* unreadable / non-JSON — keep walking */\n }\n }\n const parent = path.dirname(dir);\n if (parent === dir) {\n throw new Error(\n `Could not locate umbrella repo (no ancestor package.json with name \"babylonjs-market-monorepo\" above ${here}).`,\n );\n }\n dir = parent;\n }\n}\n\n/**\n * Verify the requested target package's submodule directory exists on disk.\n * Throws with a precise message naming the missing path so the operator knows\n * to `git submodule update --init` the relevant repo.\n */\nexport function requireTargetRoot(\n paths: MonorepoPaths,\n target: \"arcade-pro\" | \"viz-pro\",\n): string {\n const root = target === \"arcade-pro\" ? paths.arcadeProRoot : paths.vizProRoot;\n if (!fs.existsSync(root)) {\n throw new Error(\n `packages/${target} is not checked out at ${root}. Run \\`git submodule update --init packages/${target}\\` and retry.`,\n );\n }\n return root;\n}\n"],"mappings":";AAAA,OAAOA,SAAQ;AACf,OAAOC,WAAU;AACjB,OAAO,SAAS;AAChB,OAAOC,aAAY;;;ACHnB,OAAO,YAAY;AAEnB,IAAM,EAAE,MAAM,KAAK,IAAI;AAEhB,IAAM,cAAc;AAAA;AAAA,mDAGwB,KAAK,wBAAwB,CAAC;AAAA,kDAC/B,KAAK,cAAc,CAAC;AAAA;AAAA,UAE5D,KAAK,UAAU,CAAC;AAAA,yBACD,KAAK,qBAAqB,CAAC,MAAM,KAAK,oBAAoB,CAAC;AAAA,qBAC/D,KAAK,0BAA0B,CAAC,WAAM,KAAK,SAAS,CAAC;AAAA,uBACxD,KAAK,YAAY,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACY7B,SAAS,aAAa,WAA+B;AAC1D,aAAW,EAAE,OAAO,KAAK,WAAW;AAClC,QAAI,2CAA2C,KAAK,MAAM,EAAG,QAAO;AACpE,QAAI,uDAAuD,KAAK,MAAM,EAAG,QAAO;AAAA,EAClF;AACA,SAAO;AACT;AAmBO,SAAS,YACd,UACA,QACA,cACU;AACV,QAAM,OAAO,SAAS,MAAM,OAAO,EAAE,IAAI,KAAK;AAG9C,MAAI,gBAAgB,KAAK,IAAI,GAAG;AAC9B,WAAO,gBAAgB;AAAA,EACzB;AAEA,QAAM,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