create-threenative 0.2.15 → 0.2.18
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/agent-docs/kit-mcp.md +10 -0
- package/agent-docs/kit-router.md +14 -0
- package/agent-docs/kit-stuck.md +7 -0
- package/agent-docs/references/assertion-reference.md +54 -110
- package/agent-docs/references/capability-reference.md +1740 -254
- package/agent-docs/references/conventions.md +299 -0
- package/agent-docs/references/kit-action-rpg.md +40 -0
- package/agent-docs/references/kit-adventure.md +40 -0
- package/agent-docs/references/kit-collectathon.md +38 -0
- package/agent-docs/references/kit-kart.md +31 -0
- package/agent-docs/references/kit-minimal.md +29 -0
- package/agent-docs/references/kit-platformer.md +34 -0
- package/agent-docs/references/kit-puzzle.md +22 -0
- package/agent-docs/references/kit-racing.md +26 -0
- package/agent-docs/references/kit-rain.md +31 -0
- package/agent-docs/references/kit-rts.md +34 -0
- package/agent-docs/references/kit-runner.md +32 -0
- package/agent-docs/references/kit-sailing.md +41 -0
- package/agent-docs/references/kit-shooter.md +33 -0
- package/agent-docs/references/kit-snow.md +33 -0
- package/agent-docs/references/kit-starter.md +55 -0
- package/agent-docs/references/kit-tower-defense.md +27 -0
- package/agent-docs/references/performance-basics.md +8 -4
- package/agent-docs/references/terrain-authoring.md +2 -1
- package/agent-files/.agents/skills/ponytail/SKILL.md +1 -1
- package/agent-files/.agents/skills/prd-creator/SKILL.md +3 -2
- package/agent-files/.agents/skills/threenative-capabilities/SKILL.md +84 -59
- package/agent-files/.claude/hooks/discovery-gate.mjs +125 -0
- package/agent-files/.claude/hooks/ponytail-context.mjs +1 -1
- package/agent-files/.claude/settings.json +25 -0
- package/agent-files/.codex/hooks.json +18 -1
- package/dist/index.d.ts +97 -6
- package/dist/index.js +899 -271
- package/dist/terrain-kit.d.ts +7 -0
- package/dist/terrain-kit.js +82 -0
- package/dist/threenative.js +114 -16
- package/dist/web-engine-ccd-ik-solver.js +127 -0
- package/dist/web-engine-gltf-loader.js +71 -20
- package/dist/web-engine-post-effects.js +39 -14
- package/dist/web-engine-runtime.js +10011 -4101
- package/package.json +15 -9
- package/template-assets/clearwater/README.md +1 -1
- package/template-assets/patches/manifest.json +18 -0
- package/template-assets/patches/three@0.187.0.patch +2004 -407
- package/template-assets/terrain/alpine/assets.json +12 -0
- package/template-assets/terrain/alpine/bake.mjs +6 -0
- package/template-assets/terrain/alpine/credits.json +164 -0
- package/template-assets/terrain/alpine/heightmap.r16 +0 -0
- package/template-assets/terrain/alpine/recipe.json +119 -0
- package/template-assets/terrain/alpine/surface.json +53 -0
- package/template-assets/terrain/coastal/assets.json +11 -0
- package/template-assets/terrain/coastal/bake.mjs +6 -0
- package/template-assets/terrain/coastal/credits.json +117 -0
- package/template-assets/terrain/coastal/heightmap.r16 +0 -0
- package/template-assets/terrain/coastal/recipe.json +113 -0
- package/template-assets/terrain/coastal/surface.json +41 -0
- package/template-assets/terrain/desert/assets.json +12 -0
- package/template-assets/terrain/desert/bake.mjs +6 -0
- package/template-assets/terrain/desert/credits.json +164 -0
- package/template-assets/terrain/desert/heightmap.r16 +0 -0
- package/template-assets/terrain/desert/recipe.json +108 -0
- package/template-assets/terrain/desert/surface.json +54 -0
- package/template-assets/terrain/forest/assets.json +65 -0
- package/template-assets/terrain/forest/bake.mjs +8 -0
- package/template-assets/terrain/forest/credits.json +225 -0
- package/template-assets/terrain/forest/heightmap.r16 +0 -0
- package/template-assets/terrain/forest/recipe.json +350 -0
- package/template-assets/terrain/forest/surface.json +79 -0
- package/template-assets/terrain/tundra/assets.json +12 -0
- package/template-assets/terrain/tundra/bake.mjs +6 -0
- package/template-assets/terrain/tundra/credits.json +164 -0
- package/template-assets/terrain/tundra/heightmap.r16 +0 -0
- package/template-assets/terrain/tundra/recipe.json +277 -0
- package/template-assets/terrain/tundra/surface.json +54 -0
- package/templates/action-rpg/AGENTS.md +103 -84
- package/templates/action-rpg/CLAUDE.md +103 -84
- package/templates/action-rpg/kit.json +1 -0
- package/templates/action-rpg/package.json +7 -7
- package/templates/action-rpg/playtests/spells.playtest.json +20 -0
- package/templates/action-rpg/src/game.ts +2 -1
- package/templates/action-rpg/src/render/atmosphere.ts +11 -16
- package/templates/action-rpg/src/render/backlightControls.ts +10 -0
- package/templates/action-rpg/src/render/backlightMaterial.ts +4 -4
- package/templates/action-rpg/src/render/clouds.ts +13 -0
- package/templates/action-rpg/src/render/gpuSky.ts +4 -7
- package/templates/action-rpg/src/render/materialLighting.ts +5 -5
- package/templates/action-rpg/src/render/quality.ts +10 -33
- package/templates/action-rpg/src/scenes/Play.ts +30 -1
- package/templates/action-rpg/src/style.css +4 -0
- package/templates/action-rpg/src/ui/AbilityBar.tsx +1 -1
- package/templates/action-rpg/threenative.config.ts +0 -3
- package/templates/action-rpg/vite.config.ts +2 -0
- package/templates/adventure/AGENTS.md +92 -44
- package/templates/adventure/CLAUDE.md +92 -44
- package/templates/adventure/kit.json +5 -1
- package/templates/adventure/package.json +7 -7
- package/templates/adventure/src/game.ts +1 -1
- package/templates/adventure/src/style.css +4 -0
- package/templates/adventure/tsconfig.json +1 -1
- package/templates/adventure/vite.config.ts +2 -0
- package/templates/collectathon/AGENTS.md +93 -42
- package/templates/collectathon/CLAUDE.md +93 -42
- package/templates/collectathon/package.json +7 -7
- package/templates/collectathon/src/game.ts +1 -1
- package/templates/collectathon/src/level/Course.ts +55 -9
- package/templates/collectathon/src/level/terrain.ts +27 -6
- package/templates/collectathon/src/main.ts +1 -0
- package/templates/collectathon/src/render/foliage.ts +359 -98
- package/templates/collectathon/src/render/sky.ts +76 -12
- package/templates/collectathon/src/render/water.ts +32 -10
- package/templates/collectathon/src/scenes/Play.ts +18 -5
- package/templates/collectathon/src/style.css +4 -0
- package/templates/collectathon/tsconfig.json +1 -1
- package/templates/collectathon/vite.config.ts +2 -0
- package/templates/kart/AGENTS.md +87 -42
- package/templates/kart/CLAUDE.md +87 -42
- package/templates/kart/package.json +6 -6
- package/templates/kart/src/game.ts +1 -1
- package/templates/kart/src/main.ts +1 -0
- package/templates/kart/src/style.css +4 -0
- package/templates/kart/tsconfig.json +1 -1
- package/templates/kart/vite.config.ts +2 -0
- package/templates/minimal/AGENTS.md +105 -84
- package/templates/minimal/CLAUDE.md +105 -84
- package/templates/minimal/package.json +6 -6
- package/templates/minimal/playtests/stands-still.playtest.json +30 -0
- package/templates/minimal/src/game.ts +1 -1
- package/templates/minimal/src/render/atmosphere.ts +11 -16
- package/templates/minimal/src/render/backlightControls.ts +10 -0
- package/templates/minimal/src/render/backlightMaterial.ts +4 -4
- package/templates/minimal/src/render/camera.ts +13 -2
- package/templates/minimal/src/render/clouds.ts +13 -0
- package/templates/minimal/src/render/gpuSky.ts +4 -7
- package/templates/minimal/src/render/lighting.ts +4 -2
- package/templates/minimal/src/render/materialLighting.ts +5 -5
- package/templates/minimal/src/render/materials.ts +10 -0
- package/templates/minimal/src/render/quality.ts +7 -32
- package/templates/minimal/src/scenes/Play.ts +4 -1
- package/templates/minimal/vite.config.ts +7 -1
- package/templates/platformer/AGENTS.md +95 -46
- package/templates/platformer/CLAUDE.md +95 -46
- package/templates/platformer/index.html +1 -1
- package/templates/platformer/main.html +12 -0
- package/templates/platformer/package.json +7 -7
- package/templates/platformer/playtests/gamepad-idle.playtest.json +21 -0
- package/templates/platformer/playtests/gamepad.playtest.json +30 -0
- package/templates/platformer/src/entities/Fox.ts +21 -6
- package/templates/platformer/src/game.ts +1 -1
- package/templates/platformer/src/main.ts +1 -0
- package/templates/platformer/src/render/backlightControls.ts +10 -0
- package/templates/platformer/src/render/backlightMaterial.ts +4 -4
- package/templates/platformer/src/render/materialLighting.ts +5 -5
- package/templates/platformer/src/render/quality.ts +7 -32
- package/templates/platformer/src/scenes/Play.ts +2 -1
- package/templates/platformer/src/style.css +4 -0
- package/templates/platformer/src/worker-page.ts +29 -0
- package/templates/platformer/src/worker.ts +5 -0
- package/templates/platformer/tsconfig.json +1 -1
- package/templates/platformer/vite.config.ts +4 -0
- package/templates/puzzle/AGENTS.md +97 -80
- package/templates/puzzle/CLAUDE.md +97 -80
- package/templates/puzzle/package.json +7 -7
- package/templates/puzzle/src/game.ts +1 -1
- package/templates/puzzle/src/render/backlightControls.ts +10 -0
- package/templates/puzzle/src/render/backlightMaterial.ts +4 -4
- package/templates/puzzle/src/render/materialLighting.ts +5 -5
- package/templates/puzzle/src/render/quality.ts +7 -32
- package/templates/puzzle/src/scenes/Play.ts +1 -1
- package/templates/puzzle/src/style.css +4 -0
- package/templates/puzzle/tsconfig.json +1 -1
- package/templates/puzzle/vite.config.ts +2 -0
- package/templates/racing/AGENTS.md +100 -82
- package/templates/racing/CLAUDE.md +100 -82
- package/templates/racing/package.json +7 -7
- package/templates/racing/src/game.ts +1 -1
- package/templates/racing/src/render/atmosphere.ts +11 -16
- package/templates/racing/src/render/backlightControls.ts +10 -0
- package/templates/racing/src/render/backlightMaterial.ts +4 -4
- package/templates/racing/src/render/clouds.ts +13 -0
- package/templates/racing/src/render/gpuSky.ts +4 -7
- package/templates/racing/src/render/materialLighting.ts +5 -5
- package/templates/racing/src/render/quality.ts +7 -32
- package/templates/racing/src/scenes/Race.ts +4 -1
- package/templates/racing/src/style.css +4 -0
- package/templates/racing/tsconfig.json +1 -1
- package/templates/racing/vite.config.ts +2 -0
- package/templates/rain/AGENTS.md +96 -84
- package/templates/rain/CLAUDE.md +96 -84
- package/templates/rain/native-playtests/lightning.playtest.json +85 -10
- package/templates/rain/package.json +6 -6
- package/templates/rain/playtests/reduced-motion.playtest.json +6 -0
- package/templates/rain/src/game.ts +1 -1
- package/templates/rain/src/scenes/Boot.ts +1 -0
- package/templates/rain/src/state.ts +7 -0
- package/templates/rain/src/ui/GameUi.tsx +7 -1
- package/templates/rain/vite.config.ts +6 -0
- package/templates/rts/AGENTS.md +100 -85
- package/templates/rts/CLAUDE.md +100 -85
- package/templates/rts/package.json +6 -6
- package/templates/rts/src/game.ts +1 -1
- package/templates/rts/src/render/backlightControls.ts +10 -0
- package/templates/rts/src/render/backlightMaterial.ts +4 -4
- package/templates/rts/src/render/materialLighting.ts +5 -5
- package/templates/rts/src/render/quality.ts +7 -31
- package/templates/rts/src/scenes/Play.ts +1 -1
- package/templates/rts/src/style.css +4 -0
- package/templates/rts/vite.config.ts +2 -0
- package/templates/runner/AGENTS.md +97 -80
- package/templates/runner/CLAUDE.md +97 -80
- package/templates/runner/package.json +7 -7
- package/templates/runner/playtests/performance.playtest.json +1 -1
- package/templates/runner/src/game.ts +1 -1
- package/templates/runner/src/render/atmosphere.ts +11 -16
- package/templates/runner/src/render/backlightControls.ts +10 -0
- package/templates/runner/src/render/backlightMaterial.ts +4 -4
- package/templates/runner/src/render/clouds.ts +13 -0
- package/templates/runner/src/render/gpuSky.ts +4 -7
- package/templates/runner/src/render/lighting.ts +53 -11
- package/templates/runner/src/render/materialLighting.ts +5 -5
- package/templates/runner/src/render/quality.ts +7 -32
- package/templates/runner/src/scenes/Run.ts +8 -4
- package/templates/runner/src/style.css +4 -0
- package/templates/runner/threenative.config.ts +0 -3
- package/templates/runner/tsconfig.json +1 -1
- package/templates/runner/vite.config.ts +2 -0
- package/templates/sailing/AGENTS.md +96 -79
- package/templates/sailing/CLAUDE.md +96 -79
- package/templates/sailing/package.json +7 -7
- package/templates/sailing/playtests/sails.playtest.json +1 -0
- package/templates/sailing/src/game.ts +1 -1
- package/templates/sailing/src/render/backlightControls.ts +10 -0
- package/templates/sailing/src/render/backlightMaterial.ts +4 -4
- package/templates/sailing/src/render/environmentSetup.ts +1 -1
- package/templates/sailing/src/render/materialLighting.ts +5 -5
- package/templates/sailing/src/render/quality.ts +7 -32
- package/templates/sailing/src/render/sky.ts +4 -0
- package/templates/sailing/src/style.css +5 -0
- package/templates/sailing/threenative.config.ts +0 -3
- package/templates/sailing/vite.config.ts +6 -0
- package/templates/shooter/AGENTS.md +97 -68
- package/templates/shooter/CLAUDE.md +97 -68
- package/templates/shooter/package.json +7 -7
- package/templates/shooter/src/game.ts +3 -2
- package/templates/shooter/src/render/atmosphere.ts +11 -16
- package/templates/shooter/src/render/backlightControls.ts +10 -0
- package/templates/shooter/src/render/backlightMaterial.ts +4 -4
- package/templates/shooter/src/render/clouds.ts +13 -0
- package/templates/shooter/src/render/gpuSky.ts +4 -7
- package/templates/shooter/src/render/materialLighting.ts +5 -5
- package/templates/shooter/src/render/quality.ts +10 -33
- package/templates/shooter/src/scenes/Play.ts +4 -1
- package/templates/shooter/src/style.css +4 -0
- package/templates/shooter/vite.config.ts +2 -0
- package/templates/snow/AGENTS.md +95 -76
- package/templates/snow/CLAUDE.md +95 -76
- package/templates/snow/package.json +7 -7
- package/templates/snow/src/game.ts +1 -1
- package/templates/snow/src/render/backlightControls.ts +10 -0
- package/templates/snow/src/render/backlightMaterial.ts +4 -4
- package/templates/snow/src/render/materialLighting.ts +5 -5
- package/templates/snow/src/render/quality.ts +7 -32
- package/templates/snow/src/style.css +5 -0
- package/templates/snow/threenative.config.ts +0 -3
- package/templates/snow/vite.config.ts +6 -0
- package/templates/starter/AGENTS.md +109 -88
- package/templates/starter/CLAUDE.md +109 -88
- package/templates/starter/native-playtests/render-chain.playtest.json +24 -24
- package/templates/starter/native-playtests/smooth-motion.playtest.json +3 -3
- package/templates/starter/package.json +7 -7
- package/templates/starter/src/entities/Crate.ts +5 -2
- package/templates/starter/src/entities/Player.ts +10 -22
- package/templates/starter/src/game.ts +4 -3
- package/templates/starter/src/render/adaptiveQuality.ts +17 -0
- package/templates/starter/src/render/atmosphere.ts +11 -16
- package/templates/starter/src/render/backlightControls.ts +10 -0
- package/templates/starter/src/render/backlightMaterial.ts +4 -4
- package/templates/starter/src/render/clouds.ts +13 -0
- package/templates/starter/src/render/contactShadow.ts +1 -1
- package/templates/starter/src/render/gpuSky.ts +4 -7
- package/templates/starter/src/render/lighting.ts +54 -4
- package/templates/starter/src/render/materialLighting.ts +5 -5
- package/templates/starter/src/render/postprocessing.ts +11 -10
- package/templates/starter/src/render/quality.ts +14 -1
- package/templates/starter/src/render/temporalAA.ts +8 -7
- package/templates/starter/src/render/temporalAAFrame.ts +30 -9
- package/templates/starter/src/render/temporalAAResolve.ts +15 -1
- package/templates/starter/src/render/temporalClampRelease.ts +183 -0
- package/templates/starter/src/render/temporalHistoryResolve.ts +90 -0
- package/templates/starter/src/render/temporalMoire.ts +190 -0
- package/templates/starter/src/render/temporalResolve.ts +75 -16
- package/templates/starter/src/render/temporalResolveDepth.ts +2 -0
- package/templates/starter/src/scenes/Play.ts +53 -32
- package/templates/starter/src/state.ts +2 -0
- package/templates/starter/src/style.css +4 -0
- package/templates/starter/src/ui/Menu.tsx +5 -1
- package/templates/starter/vite.config.ts +2 -0
- package/templates/tower-defense/AGENTS.md +97 -81
- package/templates/tower-defense/CLAUDE.md +97 -81
- package/templates/tower-defense/package.json +7 -7
- package/templates/tower-defense/src/game.ts +1 -1
- package/templates/tower-defense/src/render/backlightControls.ts +10 -0
- package/templates/tower-defense/src/render/backlightMaterial.ts +4 -4
- package/templates/tower-defense/src/render/materialLighting.ts +5 -5
- package/templates/tower-defense/src/render/quality.ts +7 -32
- package/templates/tower-defense/src/scenes/Battle.ts +1 -1
- package/templates/tower-defense/src/style.css +4 -0
- package/templates/tower-defense/tsconfig.json +1 -1
- package/templates/tower-defense/vite.config.ts +2 -0
- package/capabilities.json +0 -9197
- package/templates/AGENTS.md +0 -21
- package/templates/CLAUDE.md +0 -23
- package/templates/action-rpg/.codex/config.toml +0 -23
- package/templates/action-rpg/.cursor/mcp.json +0 -38
- package/templates/action-rpg/.gemini/settings.json +0 -38
- package/templates/action-rpg/.mcp.json +0 -38
- package/templates/action-rpg/.vscode/mcp.json +0 -43
- package/templates/action-rpg/.zed/settings.json +0 -43
- package/templates/action-rpg/opencode.json +0 -49
- package/templates/action-rpg/src/render/environmentContribution.ts +0 -188
- package/templates/action-rpg/src/render/environmentRadiance.ts +0 -36
- package/templates/action-rpg/src/render/environmentSampleCache.ts +0 -43
- package/templates/action-rpg/src/render/environmentSampling.ts +0 -193
- package/templates/action-rpg/src/render/environmentSnapshot.ts +0 -53
- package/templates/adventure/.codex/config.toml +0 -23
- package/templates/adventure/.cursor/mcp.json +0 -38
- package/templates/adventure/.gemini/settings.json +0 -38
- package/templates/adventure/.mcp.json +0 -38
- package/templates/adventure/.vscode/mcp.json +0 -43
- package/templates/adventure/.zed/settings.json +0 -43
- package/templates/adventure/opencode.json +0 -49
- package/templates/collectathon/.codex/config.toml +0 -23
- package/templates/collectathon/.cursor/mcp.json +0 -38
- package/templates/collectathon/.gemini/settings.json +0 -38
- package/templates/collectathon/.mcp.json +0 -38
- package/templates/collectathon/.vscode/mcp.json +0 -43
- package/templates/collectathon/.zed/settings.json +0 -43
- package/templates/collectathon/opencode.json +0 -49
- package/templates/kart/.codex/config.toml +0 -23
- package/templates/kart/.cursor/mcp.json +0 -38
- package/templates/kart/.gemini/settings.json +0 -38
- package/templates/kart/.mcp.json +0 -38
- package/templates/kart/.vscode/mcp.json +0 -43
- package/templates/kart/.zed/settings.json +0 -43
- package/templates/kart/opencode.json +0 -49
- package/templates/minimal/.codex/config.toml +0 -23
- package/templates/minimal/.cursor/mcp.json +0 -38
- package/templates/minimal/.gemini/settings.json +0 -38
- package/templates/minimal/.mcp.json +0 -38
- package/templates/minimal/.vscode/mcp.json +0 -43
- package/templates/minimal/.zed/settings.json +0 -43
- package/templates/minimal/opencode.json +0 -49
- package/templates/minimal/src/render/environmentContribution.ts +0 -188
- package/templates/minimal/src/render/environmentRadiance.ts +0 -36
- package/templates/minimal/src/render/environmentSampleCache.ts +0 -43
- package/templates/minimal/src/render/environmentSampling.ts +0 -193
- package/templates/minimal/src/render/environmentSnapshot.ts +0 -53
- package/templates/platformer/.codex/config.toml +0 -23
- package/templates/platformer/.cursor/mcp.json +0 -38
- package/templates/platformer/.gemini/settings.json +0 -38
- package/templates/platformer/.mcp.json +0 -38
- package/templates/platformer/.vscode/mcp.json +0 -43
- package/templates/platformer/.zed/settings.json +0 -43
- package/templates/platformer/opencode.json +0 -49
- package/templates/platformer/src/render/environmentContribution.ts +0 -188
- package/templates/platformer/src/render/environmentRadiance.ts +0 -36
- package/templates/platformer/src/render/environmentSampleCache.ts +0 -43
- package/templates/platformer/src/render/environmentSampling.ts +0 -193
- package/templates/platformer/src/render/environmentSnapshot.ts +0 -53
- package/templates/puzzle/.codex/config.toml +0 -23
- package/templates/puzzle/.cursor/mcp.json +0 -38
- package/templates/puzzle/.gemini/settings.json +0 -38
- package/templates/puzzle/.mcp.json +0 -38
- package/templates/puzzle/.vscode/mcp.json +0 -43
- package/templates/puzzle/.zed/settings.json +0 -43
- package/templates/puzzle/opencode.json +0 -49
- package/templates/puzzle/src/render/environmentContribution.ts +0 -188
- package/templates/puzzle/src/render/environmentRadiance.ts +0 -36
- package/templates/puzzle/src/render/environmentSampleCache.ts +0 -43
- package/templates/puzzle/src/render/environmentSampling.ts +0 -193
- package/templates/puzzle/src/render/environmentSnapshot.ts +0 -53
- package/templates/racing/.codex/config.toml +0 -23
- package/templates/racing/.cursor/mcp.json +0 -38
- package/templates/racing/.gemini/settings.json +0 -38
- package/templates/racing/.mcp.json +0 -38
- package/templates/racing/.vscode/mcp.json +0 -43
- package/templates/racing/.zed/settings.json +0 -43
- package/templates/racing/opencode.json +0 -49
- package/templates/racing/src/render/environmentContribution.ts +0 -188
- package/templates/racing/src/render/environmentRadiance.ts +0 -36
- package/templates/racing/src/render/environmentSampleCache.ts +0 -43
- package/templates/racing/src/render/environmentSampling.ts +0 -193
- package/templates/racing/src/render/environmentSnapshot.ts +0 -53
- package/templates/rain/.codex/config.toml +0 -23
- package/templates/rain/.cursor/mcp.json +0 -38
- package/templates/rain/.gemini/settings.json +0 -38
- package/templates/rain/.mcp.json +0 -38
- package/templates/rain/.vscode/mcp.json +0 -43
- package/templates/rain/.zed/settings.json +0 -43
- package/templates/rain/opencode.json +0 -49
- package/templates/rts/.codex/config.toml +0 -23
- package/templates/rts/.cursor/mcp.json +0 -38
- package/templates/rts/.gemini/settings.json +0 -38
- package/templates/rts/.mcp.json +0 -38
- package/templates/rts/.vscode/mcp.json +0 -43
- package/templates/rts/.zed/settings.json +0 -43
- package/templates/rts/opencode.json +0 -49
- package/templates/rts/src/render/environmentContribution.ts +0 -188
- package/templates/rts/src/render/environmentRadiance.ts +0 -36
- package/templates/rts/src/render/environmentSampleCache.ts +0 -43
- package/templates/rts/src/render/environmentSampling.ts +0 -193
- package/templates/rts/src/render/environmentSnapshot.ts +0 -53
- package/templates/runner/.codex/config.toml +0 -23
- package/templates/runner/.cursor/mcp.json +0 -38
- package/templates/runner/.gemini/settings.json +0 -38
- package/templates/runner/.mcp.json +0 -38
- package/templates/runner/.vscode/mcp.json +0 -43
- package/templates/runner/.zed/settings.json +0 -43
- package/templates/runner/README.md +0 -43
- package/templates/runner/opencode.json +0 -49
- package/templates/runner/src/render/environmentContribution.ts +0 -188
- package/templates/runner/src/render/environmentRadiance.ts +0 -36
- package/templates/runner/src/render/environmentSampleCache.ts +0 -43
- package/templates/runner/src/render/environmentSampling.ts +0 -193
- package/templates/runner/src/render/environmentSnapshot.ts +0 -53
- package/templates/sailing/.codex/config.toml +0 -23
- package/templates/sailing/.cursor/mcp.json +0 -38
- package/templates/sailing/.gemini/settings.json +0 -38
- package/templates/sailing/.mcp.json +0 -38
- package/templates/sailing/.vscode/mcp.json +0 -43
- package/templates/sailing/.zed/settings.json +0 -43
- package/templates/sailing/README.md +0 -28
- package/templates/sailing/opencode.json +0 -49
- package/templates/sailing/src/render/environmentContribution.ts +0 -188
- package/templates/sailing/src/render/environmentRadiance.ts +0 -36
- package/templates/sailing/src/render/environmentSampleCache.ts +0 -43
- package/templates/sailing/src/render/environmentSampling.ts +0 -193
- package/templates/sailing/src/render/environmentSnapshot.ts +0 -53
- package/templates/shooter/.codex/config.toml +0 -23
- package/templates/shooter/.cursor/mcp.json +0 -38
- package/templates/shooter/.gemini/settings.json +0 -38
- package/templates/shooter/.mcp.json +0 -38
- package/templates/shooter/.vscode/mcp.json +0 -43
- package/templates/shooter/.zed/settings.json +0 -43
- package/templates/shooter/opencode.json +0 -49
- package/templates/shooter/src/render/environmentContribution.ts +0 -188
- package/templates/shooter/src/render/environmentRadiance.ts +0 -36
- package/templates/shooter/src/render/environmentSampleCache.ts +0 -43
- package/templates/shooter/src/render/environmentSampling.ts +0 -193
- package/templates/shooter/src/render/environmentSnapshot.ts +0 -53
- package/templates/snow/.codex/config.toml +0 -23
- package/templates/snow/.cursor/mcp.json +0 -38
- package/templates/snow/.gemini/settings.json +0 -38
- package/templates/snow/.mcp.json +0 -38
- package/templates/snow/.vscode/mcp.json +0 -43
- package/templates/snow/.zed/settings.json +0 -43
- package/templates/snow/README.md +0 -26
- package/templates/snow/opencode.json +0 -49
- package/templates/snow/src/render/environmentContribution.ts +0 -188
- package/templates/snow/src/render/environmentRadiance.ts +0 -36
- package/templates/snow/src/render/environmentSampleCache.ts +0 -43
- package/templates/snow/src/render/environmentSampling.ts +0 -193
- package/templates/snow/src/render/environmentSnapshot.ts +0 -53
- package/templates/starter/.codex/config.toml +0 -23
- package/templates/starter/.cursor/mcp.json +0 -38
- package/templates/starter/.gemini/settings.json +0 -38
- package/templates/starter/.mcp.json +0 -38
- package/templates/starter/.vscode/mcp.json +0 -43
- package/templates/starter/.zed/settings.json +0 -43
- package/templates/starter/opencode.json +0 -49
- package/templates/starter/src/render/environmentContribution.ts +0 -188
- package/templates/starter/src/render/environmentRadiance.ts +0 -36
- package/templates/starter/src/render/environmentSampleCache.ts +0 -43
- package/templates/starter/src/render/environmentSampling.ts +0 -193
- package/templates/starter/src/render/environmentSnapshot.ts +0 -53
- package/templates/starter/src/render/rendererGate.ts +0 -36
- package/templates/tower-defense/.codex/config.toml +0 -23
- package/templates/tower-defense/.cursor/mcp.json +0 -38
- package/templates/tower-defense/.gemini/settings.json +0 -38
- package/templates/tower-defense/.mcp.json +0 -38
- package/templates/tower-defense/.vscode/mcp.json +0 -43
- package/templates/tower-defense/.zed/settings.json +0 -43
- package/templates/tower-defense/README.md +0 -16
- package/templates/tower-defense/opencode.json +0 -49
- package/templates/tower-defense/src/render/environmentContribution.ts +0 -188
- package/templates/tower-defense/src/render/environmentRadiance.ts +0 -36
- package/templates/tower-defense/src/render/environmentSampleCache.ts +0 -43
- package/templates/tower-defense/src/render/environmentSampling.ts +0 -193
- package/templates/tower-defense/src/render/environmentSnapshot.ts +0 -53
package/dist/index.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
3
|
import { execFileSync, spawn } from 'child_process';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
4
|
+
import { createHash } from 'crypto';
|
|
5
|
+
import { existsSync, realpathSync, readdirSync, readFileSync, mkdirSync, writeFileSync, rmSync } from 'fs';
|
|
6
|
+
import { mkdir, cp, rm, rename, readFile, readdir, writeFile, mkdtemp, lstat, symlink, access, unlink, stat } from 'fs/promises';
|
|
7
|
+
import { tmpdir } from 'os';
|
|
8
|
+
import path8 from 'path';
|
|
7
9
|
import { fileURLToPath, pathToFileURL } from 'url';
|
|
8
10
|
import { LoadingManager, Box3, Vector3 } from 'three';
|
|
9
|
-
import { createHash } from 'crypto';
|
|
10
11
|
import { createRequire as createRequire$1 } from 'module';
|
|
11
12
|
import { parsePng, parseAudioConfig } from '@threenative/assets';
|
|
12
13
|
|
|
@@ -86,10 +87,10 @@ function localResourcePath(baseDirectory, uri) {
|
|
|
86
87
|
} catch (error) {
|
|
87
88
|
throw new Error(`Invalid glTF resource URI "${uri}": ${String(error)}`);
|
|
88
89
|
}
|
|
89
|
-
return
|
|
90
|
+
return path8.resolve(baseDirectory, decoded);
|
|
90
91
|
}
|
|
91
92
|
function resourceMimeType(resourcePath, declared) {
|
|
92
|
-
return declared ?? RESOURCE_MIME_TYPES[
|
|
93
|
+
return declared ?? RESOURCE_MIME_TYPES[path8.extname(resourcePath).toLowerCase()] ?? "application/octet-stream";
|
|
93
94
|
}
|
|
94
95
|
function gltfResourceReferences(document) {
|
|
95
96
|
const references = [];
|
|
@@ -118,10 +119,10 @@ async function readLocalResources(baseDirectory, references) {
|
|
|
118
119
|
return resources;
|
|
119
120
|
}
|
|
120
121
|
async function localResourceResolver(file, data) {
|
|
121
|
-
if (
|
|
122
|
+
if (path8.extname(file).toLowerCase() !== ".gltf") return (url) => url;
|
|
122
123
|
const document = JSON.parse(data.toString("utf8"));
|
|
123
124
|
const references = gltfResourceReferences(document);
|
|
124
|
-
const baseDirectory =
|
|
125
|
+
const baseDirectory = path8.dirname(path8.resolve(file));
|
|
125
126
|
const resources = await readLocalResources(baseDirectory, references);
|
|
126
127
|
return (url) => {
|
|
127
128
|
const resourcePath = localResourcePath(baseDirectory, url);
|
|
@@ -135,11 +136,11 @@ async function parseGltfAsset(file, data) {
|
|
|
135
136
|
const manager = new LoadingManager();
|
|
136
137
|
manager.setURLModifier(await localResourceResolver(file, data));
|
|
137
138
|
const loader = new GLTFLoader(manager);
|
|
138
|
-
const extension =
|
|
139
|
+
const extension = path8.extname(file).toLowerCase();
|
|
139
140
|
const payload = extension === ".gltf" ? data.toString("utf8") : data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength);
|
|
140
141
|
const parsed = await loader.parseAsync(
|
|
141
142
|
payload,
|
|
142
|
-
`${
|
|
143
|
+
`${path8.dirname(path8.resolve(file))}${path8.sep}`
|
|
143
144
|
);
|
|
144
145
|
const json = parsed.parser.json;
|
|
145
146
|
return {
|
|
@@ -199,11 +200,11 @@ function inspectScene(file, scene, animations, resourceCounts) {
|
|
|
199
200
|
bounds,
|
|
200
201
|
bones: resources.bones,
|
|
201
202
|
clips: animations.map((clip) => clip.name || "(unnamed)"),
|
|
202
|
-
file:
|
|
203
|
+
file: path8.basename(file),
|
|
203
204
|
forwardAxis: largest === void 0 ? { axis: "unknown", basis: "none", direction: "unknown" } : { axis: largest.axis, basis: "longest geometry axis", direction: "unknown" },
|
|
204
205
|
materials: resourceCounts.materials ?? resources.materials,
|
|
205
206
|
meshes: resourceCounts.meshes ?? resources.meshes,
|
|
206
|
-
path:
|
|
207
|
+
path: path8.resolve(file),
|
|
207
208
|
textures: resourceCounts.textures ?? resources.textures,
|
|
208
209
|
units: {
|
|
209
210
|
label: unitsLabel(largest?.value ?? 0),
|
|
@@ -232,7 +233,7 @@ function parseInspectArgs(argv) {
|
|
|
232
233
|
return { file, json: argv.includes("--json") };
|
|
233
234
|
}
|
|
234
235
|
async function inspectAsset(file) {
|
|
235
|
-
const extension =
|
|
236
|
+
const extension = path8.extname(file).toLowerCase();
|
|
236
237
|
if (!SUPPORTED_EXTENSIONS.has(extension)) {
|
|
237
238
|
throw new Error(`TN_ASSET_INSPECT_UNSUPPORTED: ${file}: expected a .glb or .gltf file.`);
|
|
238
239
|
}
|
|
@@ -311,6 +312,12 @@ var MCP_SERVERS = Object.freeze({
|
|
|
311
312
|
command: "node",
|
|
312
313
|
args: Object.freeze(["./node_modules/@threenative/core/mcp/engine.mjs"])
|
|
313
314
|
}),
|
|
315
|
+
// Cooks a starter terrain kit into a world.glb. The server lives in the optional
|
|
316
|
+
// `@threenative/terrain` package, which the shim resolves from the project at launch.
|
|
317
|
+
"threenative-terrain": Object.freeze({
|
|
318
|
+
command: "node",
|
|
319
|
+
args: Object.freeze(["./node_modules/@threenative/core/mcp/terrain.mjs"])
|
|
320
|
+
}),
|
|
314
321
|
// Inspects, attaches, edits and verifies character animation. Every operation is a build-time
|
|
315
322
|
// edit of one GLB, so a game that animates nothing pays for nothing.
|
|
316
323
|
"threenative-animation": Object.freeze({
|
|
@@ -369,6 +376,37 @@ var SERVER_FORMATS = Object.freeze({
|
|
|
369
376
|
})
|
|
370
377
|
});
|
|
371
378
|
Object.freeze(Object.keys(SERVER_FORMATS));
|
|
379
|
+
function mergeMcpServers(existing, format = "mcpServers") {
|
|
380
|
+
const shape = SERVER_FORMATS[format];
|
|
381
|
+
if (shape === void 0) throw new Error(`Unknown MCP config format '${format}'.`);
|
|
382
|
+
const malformed = existing !== void 0 && (typeof existing !== "object" || existing === null || Array.isArray(existing));
|
|
383
|
+
if (malformed) {
|
|
384
|
+
throw new Error("MCP config root must be an object.");
|
|
385
|
+
}
|
|
386
|
+
const previous = existing ?? {};
|
|
387
|
+
const existingServers = previous[shape.key];
|
|
388
|
+
if (existingServers !== void 0 && (typeof existingServers !== "object" || existingServers === null || Array.isArray(existingServers))) {
|
|
389
|
+
throw new Error(`MCP config '${shape.key}' must be an object.`);
|
|
390
|
+
}
|
|
391
|
+
const servers = { ...existingServers ?? {} };
|
|
392
|
+
for (const [name, server] of Object.entries(servers)) {
|
|
393
|
+
if (typeof server !== "object" || server === null || Array.isArray(server)) {
|
|
394
|
+
throw new Error(`MCP server '${name}' in '${shape.key}' must be an object.`);
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
let changed = false;
|
|
398
|
+
const conflicts = [];
|
|
399
|
+
for (const [name, server] of Object.entries(MCP_SERVERS)) {
|
|
400
|
+
const wanted = shape.entry(server);
|
|
401
|
+
if (Object.hasOwn(servers, name)) {
|
|
402
|
+
if (JSON.stringify(servers[name]) !== JSON.stringify(wanted)) conflicts.push(name);
|
|
403
|
+
continue;
|
|
404
|
+
}
|
|
405
|
+
servers[name] = wanted;
|
|
406
|
+
changed = true;
|
|
407
|
+
}
|
|
408
|
+
return { changed, conflicts, config: { ...previous, [shape.key]: servers } };
|
|
409
|
+
}
|
|
372
410
|
function codexServerBlock(name, server) {
|
|
373
411
|
const args = server.args.map((argument) => JSON.stringify(argument)).join(", ");
|
|
374
412
|
const lines = [
|
|
@@ -384,145 +422,106 @@ function codexServerBlock(name, server) {
|
|
|
384
422
|
}
|
|
385
423
|
return lines.join("\n");
|
|
386
424
|
}
|
|
387
|
-
Object.freeze(
|
|
425
|
+
var CODEX_MCP_SERVERS = Object.freeze(
|
|
388
426
|
Object.entries(MCP_SERVERS).map(
|
|
389
427
|
([name, server]) => Object.freeze({ body: codexServerBlock(name, server), name })
|
|
390
428
|
)
|
|
391
429
|
);
|
|
392
430
|
|
|
393
|
-
// src/
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
)
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
431
|
+
// ../core/src/version.ts
|
|
432
|
+
var CORE_VERSION = "0.3.13";
|
|
433
|
+
var MCP_HOSTS = Object.freeze([
|
|
434
|
+
Object.freeze({
|
|
435
|
+
id: "claude-code",
|
|
436
|
+
label: "Claude Code",
|
|
437
|
+
file: ".mcp.json",
|
|
438
|
+
format: "mcpServers"
|
|
439
|
+
}),
|
|
440
|
+
Object.freeze({ id: "codex", label: "Codex", file: ".codex/config.toml", format: "codex" }),
|
|
441
|
+
Object.freeze({ id: "cursor", label: "Cursor", file: ".cursor/mcp.json", format: "mcpServers" }),
|
|
442
|
+
Object.freeze({ id: "vscode", label: "VS Code", file: ".vscode/mcp.json", format: "vscode" }),
|
|
443
|
+
Object.freeze({
|
|
444
|
+
id: "gemini-cli",
|
|
445
|
+
label: "Gemini CLI",
|
|
446
|
+
file: ".gemini/settings.json",
|
|
447
|
+
format: "mcpServers"
|
|
448
|
+
}),
|
|
449
|
+
Object.freeze({
|
|
450
|
+
id: "opencode",
|
|
451
|
+
label: "opencode",
|
|
452
|
+
file: "opencode.json",
|
|
453
|
+
format: "opencode",
|
|
454
|
+
// Written only when this installer creates the file, so a second install still reports
|
|
455
|
+
// "unchanged" rather than rewriting a config the user has since edited.
|
|
456
|
+
seed: Object.freeze({ $schema: "https://opencode.ai/config.json" })
|
|
457
|
+
}),
|
|
458
|
+
Object.freeze({ id: "zed", label: "Zed", file: ".zed/settings.json", format: "zed" })
|
|
459
|
+
]);
|
|
460
|
+
function ensureJsonMcpConfig(target, file, format, seed = void 0) {
|
|
461
|
+
const configPath = path8.join(target, file);
|
|
462
|
+
let existing;
|
|
463
|
+
if (existsSync(configPath)) {
|
|
464
|
+
try {
|
|
465
|
+
existing = JSON.parse(readFileSync(configPath, "utf8"));
|
|
466
|
+
} catch {
|
|
467
|
+
return "unreadable";
|
|
418
468
|
}
|
|
419
469
|
}
|
|
420
|
-
|
|
421
|
-
function hashEngineDist(projectRoot) {
|
|
422
|
-
const scopeDir = path6.join(projectRoot, "node_modules", "@threenative");
|
|
423
|
-
let packages;
|
|
470
|
+
let merged;
|
|
424
471
|
try {
|
|
425
|
-
|
|
472
|
+
merged = mergeMcpServers(existing, format);
|
|
426
473
|
} catch {
|
|
427
|
-
return
|
|
474
|
+
return "unreadable";
|
|
428
475
|
}
|
|
429
|
-
const
|
|
430
|
-
|
|
431
|
-
|
|
476
|
+
const { changed, config, conflicts } = merged;
|
|
477
|
+
if (!changed) return conflicts.length > 0 ? "conflict" : "unchanged";
|
|
478
|
+
const written = existing === void 0 ? { ...seed, ...config } : config;
|
|
479
|
+
mkdirSync(path8.dirname(configPath), { recursive: true });
|
|
480
|
+
writeFileSync(configPath, `${JSON.stringify(written, null, 2)}
|
|
481
|
+
`);
|
|
482
|
+
return conflicts.length > 0 ? "conflict" : existing === void 0 ? "created" : "updated";
|
|
483
|
+
}
|
|
484
|
+
function ensureCodexMcpConfig(target) {
|
|
485
|
+
const directory = path8.join(target, ".codex");
|
|
486
|
+
const configPath = path8.join(directory, "config.toml");
|
|
487
|
+
const existing = existsSync(configPath) ? readFileSync(configPath, "utf8") : "";
|
|
488
|
+
const missing = CODEX_MCP_SERVERS.filter(
|
|
489
|
+
({ name }) => !existing.includes(`[mcp_servers.${name}]`)
|
|
490
|
+
);
|
|
491
|
+
if (missing.length === 0) return "unchanged";
|
|
492
|
+
mkdirSync(directory, { recursive: true });
|
|
493
|
+
const separator = existing.length === 0 || existing.endsWith("\n\n") ? "" : existing.endsWith("\n") ? "\n" : "\n\n";
|
|
494
|
+
writeFileSync(
|
|
495
|
+
configPath,
|
|
496
|
+
`${existing}${separator}${missing.map(({ body }) => body).join("\n\n")}
|
|
497
|
+
`
|
|
498
|
+
);
|
|
499
|
+
return existing.length === 0 ? "created" : "updated";
|
|
500
|
+
}
|
|
501
|
+
function ensureHostMcpConfigs(target) {
|
|
502
|
+
const outcomes = /* @__PURE__ */ new Map();
|
|
503
|
+
for (const host of MCP_HOSTS) {
|
|
432
504
|
try {
|
|
433
|
-
|
|
505
|
+
outcomes.set(
|
|
506
|
+
host.id,
|
|
507
|
+
host.format === "codex" ? ensureCodexMcpConfig(target) : ensureJsonMcpConfig(target, host.file, host.format, host.seed)
|
|
508
|
+
);
|
|
434
509
|
} catch {
|
|
435
|
-
|
|
510
|
+
outcomes.set(host.id, "unreadable");
|
|
436
511
|
}
|
|
437
|
-
const dist = path6.join(packageDir, "dist");
|
|
438
|
-
if (existsSync(dist)) dists.push([name, dist]);
|
|
439
|
-
}
|
|
440
|
-
if (dists.length === 0) return void 0;
|
|
441
|
-
const hash = createHash("sha256");
|
|
442
|
-
for (const [name, dist] of dists) {
|
|
443
|
-
hash.update(name);
|
|
444
|
-
hashTree(hash, dist);
|
|
445
512
|
}
|
|
446
|
-
return
|
|
447
|
-
}
|
|
448
|
-
function markerPath(projectRoot) {
|
|
449
|
-
return path6.join(projectRoot, MARKER_RELATIVE);
|
|
513
|
+
return outcomes;
|
|
450
514
|
}
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
if (pid === process.pid) return true;
|
|
460
|
-
try {
|
|
461
|
-
process.kill(pid, 0);
|
|
462
|
-
return true;
|
|
463
|
-
} catch (error) {
|
|
464
|
-
return error.code === "EPERM";
|
|
515
|
+
|
|
516
|
+
// src/mcp-servers.ts
|
|
517
|
+
var CORE_PACKAGE_NAME = "@threenative/core";
|
|
518
|
+
var CORE_PACKAGE_VERSION = CORE_VERSION;
|
|
519
|
+
function serverEntryPath(server) {
|
|
520
|
+
const entry = server.args[0];
|
|
521
|
+
if (entry === void 0) {
|
|
522
|
+
throw new Error("TN_MCP_TABLE: an MCP server entry declares no shim to launch.");
|
|
465
523
|
}
|
|
466
|
-
|
|
467
|
-
function createEngineFreshnessPlugin() {
|
|
468
|
-
let recordedHash;
|
|
469
|
-
const rootOf = (config) => path6.resolve(config.root ?? process.cwd());
|
|
470
|
-
return {
|
|
471
|
-
name: "threenative-engine-freshness",
|
|
472
|
-
config(config, env) {
|
|
473
|
-
const resolve = { dedupe: ["three", "react", "react-dom"] };
|
|
474
|
-
if (env.command !== "serve") return { resolve };
|
|
475
|
-
const root = rootOf(config);
|
|
476
|
-
recordedHash = hashEngineDist(root);
|
|
477
|
-
const marker = recordedHash === void 0 ? void 0 : readMarker(markerPath(root));
|
|
478
|
-
if (recordedHash === void 0 || marker === void 0 || marker.hash === recordedHash) {
|
|
479
|
-
return { resolve };
|
|
480
|
-
}
|
|
481
|
-
if (processIsAlive(marker.pid)) {
|
|
482
|
-
const where = marker.port === void 0 ? `pid ${marker.pid}` : `pid ${marker.pid} on port ${marker.port}`;
|
|
483
|
-
const how = marker.port === void 0 ? "" : ` (lsof -ti tcp:${marker.port} | xargs -r kill)`;
|
|
484
|
-
console.warn(
|
|
485
|
-
`threenative: a dev server is still running at ${where}, serving engine build ${marker.hash.slice(0, 8)}; the installed build is ${recordedHash.slice(0, 8)}. Kill it before playing${how} \u2014 its tab renders yesterday's engine.`
|
|
486
|
-
);
|
|
487
|
-
}
|
|
488
|
-
return { resolve, optimizeDeps: { force: true } };
|
|
489
|
-
},
|
|
490
|
-
transform(code, id) {
|
|
491
|
-
if (!DECODER_LOADER_ID.test(id)) return null;
|
|
492
|
-
const rewritten = rewriteDecoderAssetUrls(code);
|
|
493
|
-
return rewritten === code ? null : { code: rewritten, map: null };
|
|
494
|
-
},
|
|
495
|
-
configureServer(server) {
|
|
496
|
-
const root = rootOf(server.config);
|
|
497
|
-
const file = markerPath(root);
|
|
498
|
-
const writeBootMarker = (port) => {
|
|
499
|
-
const hash = recordedHash ?? hashEngineDist(root);
|
|
500
|
-
if (hash === void 0) return;
|
|
501
|
-
mkdirSync(path6.dirname(file), { recursive: true });
|
|
502
|
-
writeFileSync(
|
|
503
|
-
file,
|
|
504
|
-
JSON.stringify(
|
|
505
|
-
port === void 0 ? { hash, pid: process.pid } : { hash, pid: process.pid, port }
|
|
506
|
-
)
|
|
507
|
-
);
|
|
508
|
-
};
|
|
509
|
-
const httpServer = server.httpServer;
|
|
510
|
-
if (httpServer === void 0 || httpServer === null) {
|
|
511
|
-
writeBootMarker(void 0);
|
|
512
|
-
return;
|
|
513
|
-
}
|
|
514
|
-
httpServer.once("listening", () => {
|
|
515
|
-
const address = httpServer.address();
|
|
516
|
-
writeBootMarker(
|
|
517
|
-
typeof address === "object" && address !== null && address.port !== void 0 ? address.port : void 0
|
|
518
|
-
);
|
|
519
|
-
});
|
|
520
|
-
httpServer.once("close", () => {
|
|
521
|
-
const marker = readMarker(file);
|
|
522
|
-
if (marker?.pid === process.pid) rmSync(file, { force: true });
|
|
523
|
-
});
|
|
524
|
-
}
|
|
525
|
-
};
|
|
524
|
+
return entry;
|
|
526
525
|
}
|
|
527
526
|
var ORIENTATIONS = ["landscape", "portrait", "sensor"];
|
|
528
527
|
var CONFIG_FILE = "threenative.config.ts";
|
|
@@ -574,6 +573,13 @@ function positiveInteger(value, fallback, code, label) {
|
|
|
574
573
|
}
|
|
575
574
|
return value;
|
|
576
575
|
}
|
|
576
|
+
function priorityValue(value) {
|
|
577
|
+
if (value === void 0) return "game";
|
|
578
|
+
if (value !== "game" && value !== "normal") {
|
|
579
|
+
fail("TN_CONFIG_PRIORITY_INVALID", 'display.priority must be "game" or "normal".');
|
|
580
|
+
}
|
|
581
|
+
return value;
|
|
582
|
+
}
|
|
577
583
|
function maxFpsValue(value) {
|
|
578
584
|
if (value === void 0) return 60;
|
|
579
585
|
if (!Number.isSafeInteger(value) || value < 0 || value > 1e3) {
|
|
@@ -598,13 +604,13 @@ function defaultAppId(name) {
|
|
|
598
604
|
return `com.threenative.${segment}`;
|
|
599
605
|
}
|
|
600
606
|
function projectRequire(cwd) {
|
|
601
|
-
return createRequire$1(
|
|
607
|
+
return createRequire$1(path8.join(cwd, "package.json"));
|
|
602
608
|
}
|
|
603
609
|
function configLoaderSearch(cwd) {
|
|
604
610
|
return [
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
611
|
+
path8.join(cwd, "node_modules", "vite"),
|
|
612
|
+
path8.join(cwd, "node_modules", "esbuild"),
|
|
613
|
+
path8.resolve(path8.dirname(fileURLToPath(import.meta.url)), "..", "node_modules", "esbuild")
|
|
608
614
|
];
|
|
609
615
|
}
|
|
610
616
|
var CONFIG_BUILD_COMMAND = "pnpm exec threenative build --target web";
|
|
@@ -612,7 +618,7 @@ function configContext(cwd, layer, sources, searched, fix) {
|
|
|
612
618
|
return { cwd, fix, layer, searched, sources };
|
|
613
619
|
}
|
|
614
620
|
function packageContext(cwd) {
|
|
615
|
-
const packagePath =
|
|
621
|
+
const packagePath = path8.join(cwd, "package.json");
|
|
616
622
|
return configContext(
|
|
617
623
|
cwd,
|
|
618
624
|
"package manifest",
|
|
@@ -635,8 +641,8 @@ function validationContext(cwd, sources) {
|
|
|
635
641
|
cwd,
|
|
636
642
|
"config validation",
|
|
637
643
|
sources,
|
|
638
|
-
[
|
|
639
|
-
`fix '${
|
|
644
|
+
[path8.join(cwd, "package.json"), path8.join(cwd, CONFIG_FILE)],
|
|
645
|
+
`fix '${path8.join(cwd, CONFIG_FILE)}' and rerun ${CONFIG_BUILD_COMMAND}`
|
|
640
646
|
);
|
|
641
647
|
}
|
|
642
648
|
function configFailure(code, context, detail) {
|
|
@@ -675,8 +681,12 @@ function resolveEsbuild(cwd) {
|
|
|
675
681
|
}
|
|
676
682
|
}
|
|
677
683
|
}
|
|
684
|
+
var configLoadSequence = 0;
|
|
685
|
+
function configTempName(cwd, pid, now, sequence) {
|
|
686
|
+
return path8.join(cwd, `.threenative.config.${pid}.${now}.${sequence}.mjs`);
|
|
687
|
+
}
|
|
678
688
|
async function importConfig(cwd) {
|
|
679
|
-
const sourcePath =
|
|
689
|
+
const sourcePath = path8.join(cwd, CONFIG_FILE);
|
|
680
690
|
try {
|
|
681
691
|
await access(sourcePath);
|
|
682
692
|
} catch {
|
|
@@ -737,7 +747,8 @@ async function importConfig(cwd) {
|
|
|
737
747
|
error instanceof Error ? error.message : String(error)
|
|
738
748
|
);
|
|
739
749
|
}
|
|
740
|
-
|
|
750
|
+
configLoadSequence += 1;
|
|
751
|
+
const compiledPath = configTempName(cwd, process.pid, Date.now(), configLoadSequence);
|
|
741
752
|
try {
|
|
742
753
|
await writeFile(compiledPath, code, "utf8");
|
|
743
754
|
} catch (error) {
|
|
@@ -773,7 +784,7 @@ async function importConfig(cwd) {
|
|
|
773
784
|
async function readManifest(cwd) {
|
|
774
785
|
let parsed;
|
|
775
786
|
try {
|
|
776
|
-
parsed = JSON.parse(await readFile(
|
|
787
|
+
parsed = JSON.parse(await readFile(path8.join(cwd, "package.json"), "utf8"));
|
|
777
788
|
} catch (error) {
|
|
778
789
|
fail("TN_CONFIG_PACKAGE_INVALID", error instanceof Error ? error.message : String(error));
|
|
779
790
|
}
|
|
@@ -792,12 +803,12 @@ function packageNativeEntry(manifest) {
|
|
|
792
803
|
}
|
|
793
804
|
function validateNativeEntry(value, cwd) {
|
|
794
805
|
const entry = nonEmptyString(value, "TN_NATIVE_ENTRY_MISSING", "nativeEntry");
|
|
795
|
-
if (
|
|
806
|
+
if (path8.isAbsolute(entry)) {
|
|
796
807
|
fail("TN_CONFIG_NATIVE_ENTRY_INVALID", "nativeEntry must be project-relative.");
|
|
797
808
|
}
|
|
798
|
-
const resolved =
|
|
799
|
-
const relative =
|
|
800
|
-
if (relative === ".." || relative.startsWith(`..${
|
|
809
|
+
const resolved = path8.resolve(cwd, entry);
|
|
810
|
+
const relative = path8.relative(cwd, resolved);
|
|
811
|
+
if (relative === ".." || relative.startsWith(`..${path8.sep}`) || path8.isAbsolute(relative)) {
|
|
801
812
|
fail("TN_CONFIG_NATIVE_ENTRY_INVALID", "nativeEntry must stay inside the project.");
|
|
802
813
|
}
|
|
803
814
|
return entry;
|
|
@@ -841,18 +852,18 @@ async function validateApp(raw, name, cwd) {
|
|
|
841
852
|
}
|
|
842
853
|
async function validateProjectAsset(raw, cwd, label, options) {
|
|
843
854
|
const relative = nonEmptyString(raw, `${options.codePrefix}_INVALID`, label);
|
|
844
|
-
if (
|
|
855
|
+
if (path8.isAbsolute(relative)) {
|
|
845
856
|
fail(`${options.codePrefix}_PATH_INVALID`, `${label} must be project-relative: ${relative}`);
|
|
846
857
|
}
|
|
847
|
-
const resolved =
|
|
848
|
-
const withinProject =
|
|
849
|
-
if (withinProject === ".." || withinProject.startsWith(`..${
|
|
858
|
+
const resolved = path8.resolve(cwd, relative);
|
|
859
|
+
const withinProject = path8.relative(cwd, resolved);
|
|
860
|
+
if (withinProject === ".." || withinProject.startsWith(`..${path8.sep}`) || path8.isAbsolute(withinProject)) {
|
|
850
861
|
fail(
|
|
851
862
|
`${options.codePrefix}_PATH_INVALID`,
|
|
852
863
|
`${label} must stay inside the project: ${relative}`
|
|
853
864
|
);
|
|
854
865
|
}
|
|
855
|
-
const extension =
|
|
866
|
+
const extension = path8.extname(relative).slice(1).toLowerCase();
|
|
856
867
|
if (!options.formats.includes(extension)) {
|
|
857
868
|
fail(
|
|
858
869
|
options.codePrefix === "TN_CONFIG_ICON" ? `${options.codePrefix}_INVALID` : `${options.codePrefix}_FORMAT_INVALID`,
|
|
@@ -1012,7 +1023,13 @@ async function validateIconVariants(raw, cwd) {
|
|
|
1012
1023
|
}
|
|
1013
1024
|
function validateDisplay(raw) {
|
|
1014
1025
|
const display = assertRecord(raw, "display");
|
|
1015
|
-
assertKeys(display, "display", [
|
|
1026
|
+
assertKeys(display, "display", [
|
|
1027
|
+
"orientation",
|
|
1028
|
+
"fullscreen",
|
|
1029
|
+
"keepScreenOn",
|
|
1030
|
+
"priority",
|
|
1031
|
+
"maxFps"
|
|
1032
|
+
]);
|
|
1016
1033
|
const orientation = display.orientation === void 0 ? "landscape" : display.orientation;
|
|
1017
1034
|
if (typeof orientation !== "string" || !ORIENTATIONS.includes(orientation)) {
|
|
1018
1035
|
fail(
|
|
@@ -1034,6 +1051,7 @@ function validateDisplay(raw) {
|
|
|
1034
1051
|
"TN_CONFIG_KEEP_SCREEN_ON_INVALID",
|
|
1035
1052
|
"display.keepScreenOn"
|
|
1036
1053
|
),
|
|
1054
|
+
priority: priorityValue(display.priority),
|
|
1037
1055
|
maxFps: maxFpsValue(display.maxFps)
|
|
1038
1056
|
};
|
|
1039
1057
|
}
|
|
@@ -1854,8 +1872,8 @@ function assertProfileCapReachable(assets, overlay, name) {
|
|
|
1854
1872
|
}
|
|
1855
1873
|
}
|
|
1856
1874
|
async function loadConfigInternal(root, selection) {
|
|
1857
|
-
const packagePath =
|
|
1858
|
-
const sourcePath =
|
|
1875
|
+
const packagePath = path8.join(root, "package.json");
|
|
1876
|
+
const sourcePath = path8.join(root, CONFIG_FILE);
|
|
1859
1877
|
const manifest = await withConfigContext(
|
|
1860
1878
|
packageContext(root),
|
|
1861
1879
|
"TN_CONFIG_PACKAGE_INVALID",
|
|
@@ -1930,15 +1948,15 @@ async function loadConfigInternal(root, selection) {
|
|
|
1930
1948
|
);
|
|
1931
1949
|
}
|
|
1932
1950
|
async function loadConfig(cwd, selection) {
|
|
1933
|
-
const root =
|
|
1951
|
+
const root = path8.resolve(cwd);
|
|
1934
1952
|
return withConfigContext(
|
|
1935
|
-
validationContext(root, [
|
|
1953
|
+
validationContext(root, [path8.join(root, CONFIG_FILE), path8.join(root, "package.json")]),
|
|
1936
1954
|
"TN_CONFIG_VALIDATION_FAILED",
|
|
1937
1955
|
() => loadConfigInternal(root, selection)
|
|
1938
1956
|
);
|
|
1939
1957
|
}
|
|
1940
|
-
function webRuntimeDecoders(
|
|
1941
|
-
return
|
|
1958
|
+
function webRuntimeDecoders(_config) {
|
|
1959
|
+
return { ktx2: true, meshopt: true };
|
|
1942
1960
|
}
|
|
1943
1961
|
var WEB_ENGINE_ID = "\0threenative:web-engine";
|
|
1944
1962
|
var UPSTREAM = ["three", "three/webgpu", "three/tsl"];
|
|
@@ -1976,9 +1994,14 @@ var ENGINE_MATH_MODULES = /* @__PURE__ */ new Set([
|
|
|
1976
1994
|
"three/src/math/Sphere.js",
|
|
1977
1995
|
"three/src/math/Vector2.js",
|
|
1978
1996
|
"three/src/math/Vector3.js",
|
|
1979
|
-
"three/src/math/Vector4.js"
|
|
1997
|
+
"three/src/math/Vector4.js",
|
|
1998
|
+
// three's loader base classes (browser-loaders.ts): fetch and request tracking, no drawing.
|
|
1999
|
+
"three/src/loaders/Cache.js",
|
|
2000
|
+
"three/src/loaders/FileLoader.js",
|
|
2001
|
+
"three/src/loaders/Loader.js",
|
|
2002
|
+
"three/src/loaders/LoadingManager.js"
|
|
1980
2003
|
]);
|
|
1981
|
-
var ENGINE_MATH_IMPORTER = /[\\/](?:browser-math\.ts|web-engine-runtime\.js)(?:\?.*)?$/u;
|
|
2004
|
+
var ENGINE_MATH_IMPORTER = /[\\/](?:browser-math\.ts|browser-loaders\.ts|web-engine-runtime\.js)(?:\?.*)?$/u;
|
|
1982
2005
|
function browserModule(built, source) {
|
|
1983
2006
|
const bundled = fileURLToPath(new URL(`./${built}`, import.meta.url));
|
|
1984
2007
|
if (existsSync(bundled)) return bundled;
|
|
@@ -1998,9 +2021,9 @@ function wasmModule(root, explicit) {
|
|
|
1998
2021
|
}
|
|
1999
2022
|
let entry;
|
|
2000
2023
|
try {
|
|
2001
|
-
const require2 = createRequire$1(
|
|
2002
|
-
entry =
|
|
2003
|
-
|
|
2024
|
+
const require2 = createRequire$1(path8.join(root, "package.json"));
|
|
2025
|
+
entry = path8.join(
|
|
2026
|
+
path8.dirname(require2.resolve("@threenative/runtime-native/package.json")),
|
|
2004
2027
|
WASM_ENGINE_ENTRY
|
|
2005
2028
|
);
|
|
2006
2029
|
} catch {
|
|
@@ -2014,15 +2037,69 @@ function wasmModule(root, explicit) {
|
|
|
2014
2037
|
);
|
|
2015
2038
|
return entry;
|
|
2016
2039
|
}
|
|
2040
|
+
function esmEntry(resolved) {
|
|
2041
|
+
if (!resolved.endsWith(".cjs")) return resolved;
|
|
2042
|
+
for (let dir = path8.dirname(resolved); dir !== path8.dirname(dir); dir = path8.dirname(dir)) {
|
|
2043
|
+
const manifest = path8.join(dir, "package.json");
|
|
2044
|
+
if (!existsSync(manifest)) continue;
|
|
2045
|
+
const root = JSON.parse(readFileSync(manifest, "utf8")).exports?.["."];
|
|
2046
|
+
const sameEntry = typeof root?.require === "string" && path8.join(dir, root.require) === resolved;
|
|
2047
|
+
return sameEntry && typeof root?.import === "string" ? path8.join(dir, root.import) : resolved;
|
|
2048
|
+
}
|
|
2049
|
+
return resolved;
|
|
2050
|
+
}
|
|
2017
2051
|
async function upstreamNames(root) {
|
|
2018
|
-
const require2 = createRequire$1(
|
|
2052
|
+
const require2 = createRequire$1(path8.join(root, "package.json"));
|
|
2019
2053
|
const modules = await Promise.all(
|
|
2020
|
-
UPSTREAM.map(
|
|
2054
|
+
UPSTREAM.map(
|
|
2055
|
+
(id) => import(pathToFileURL(esmEntry(require2.resolve(id))).href)
|
|
2056
|
+
)
|
|
2021
2057
|
);
|
|
2022
2058
|
return [...new Set(modules.flatMap((module) => Object.keys(module)))].filter((name) => name !== "default" && name !== "module.exports").sort();
|
|
2023
2059
|
}
|
|
2060
|
+
var REFUSAL = /^(TN_[A-Z0-9_]+): (\S+) is not available on the Wasm engine\.$/u;
|
|
2061
|
+
async function upstreamRefusals(root, wasm) {
|
|
2062
|
+
const entry = wasmModule(root, wasm);
|
|
2063
|
+
const binary = readFileSync(entry.replace(/\.mjs$/u, ".wasm"));
|
|
2064
|
+
const create = (await import(pathToFileURL(entry).href)).default;
|
|
2065
|
+
const { bindWebEngine } = await import(pathToFileURL(runtimeModule()).href);
|
|
2066
|
+
const names = await upstreamNames(root);
|
|
2067
|
+
const bound = await bindWebEngine(
|
|
2068
|
+
(options) => create({
|
|
2069
|
+
...options,
|
|
2070
|
+
print: () => {
|
|
2071
|
+
},
|
|
2072
|
+
printErr: () => {
|
|
2073
|
+
},
|
|
2074
|
+
// The web build fetches its .wasm by URL; Node has no page to fetch from.
|
|
2075
|
+
instantiateWasm(imports, receive) {
|
|
2076
|
+
void WebAssembly.instantiate(binary, imports).then(
|
|
2077
|
+
(result) => receive(result.instance, result.module)
|
|
2078
|
+
);
|
|
2079
|
+
return {};
|
|
2080
|
+
}
|
|
2081
|
+
}),
|
|
2082
|
+
names
|
|
2083
|
+
);
|
|
2084
|
+
return refusalsOf(bound, names);
|
|
2085
|
+
}
|
|
2086
|
+
function refusalsOf(bound, names) {
|
|
2087
|
+
const refusals = /* @__PURE__ */ new Map();
|
|
2088
|
+
for (const name of names) {
|
|
2089
|
+
const value = bound[name];
|
|
2090
|
+
if (typeof value !== "function") continue;
|
|
2091
|
+
try {
|
|
2092
|
+
Reflect.ownKeys(value);
|
|
2093
|
+
} catch (error) {
|
|
2094
|
+
const match = REFUSAL.exec(error instanceof Error ? error.message : "");
|
|
2095
|
+
if (match?.[2] === name && match[1] !== void 0) refusals.set(name, match[1]);
|
|
2096
|
+
}
|
|
2097
|
+
}
|
|
2098
|
+
return refusals;
|
|
2099
|
+
}
|
|
2024
2100
|
function createWebEnginePlugin(options = {}) {
|
|
2025
2101
|
let root = options.root;
|
|
2102
|
+
let strict = options.strict ?? true;
|
|
2026
2103
|
const native = options.engine === "threenative";
|
|
2027
2104
|
const projectRoot = () => {
|
|
2028
2105
|
if (root === void 0)
|
|
@@ -2034,6 +2111,7 @@ function createWebEnginePlugin(options = {}) {
|
|
|
2034
2111
|
enforce: "pre",
|
|
2035
2112
|
configResolved(config) {
|
|
2036
2113
|
root ??= config.root;
|
|
2114
|
+
strict = options.strict ?? config.command !== "build";
|
|
2037
2115
|
},
|
|
2038
2116
|
resolveId(specifier, importer = "") {
|
|
2039
2117
|
if (!native) return null;
|
|
@@ -2053,6 +2131,8 @@ function createWebEnginePlugin(options = {}) {
|
|
|
2053
2131
|
);
|
|
2054
2132
|
if (source === "three/addons/geometries/DecalGeometry.js")
|
|
2055
2133
|
return browserModule("web-engine-decal-geometry.js", "addons/decal-geometry.ts");
|
|
2134
|
+
if (source === "three/addons/animation/CCDIKSolver.js")
|
|
2135
|
+
return browserModule("web-engine-ccd-ik-solver.js", "addons/ccd-ik-solver.ts");
|
|
2056
2136
|
if (source === "three/addons/loaders/HDRLoader.js")
|
|
2057
2137
|
return browserModule("web-engine-hdr-loader.js", "addons/hdr-loader.ts");
|
|
2058
2138
|
if (source === "three/addons/loaders/GLTFLoader.js")
|
|
@@ -2082,27 +2162,268 @@ function createWebEnginePlugin(options = {}) {
|
|
|
2082
2162
|
"__tnLoadGltf"
|
|
2083
2163
|
];
|
|
2084
2164
|
const single = wasmModule(projectRoot(), options.wasm);
|
|
2085
|
-
const threads =
|
|
2165
|
+
const threads = path8.join(path8.dirname(single), path8.basename(WASM_THREADS_ENTRY));
|
|
2086
2166
|
if (!existsSync(threads))
|
|
2087
2167
|
throw new Error(
|
|
2088
2168
|
`TN_WASM_THREADS_MISSING: engine "threenative" needs the threaded Wasm engine at ${threads}; reinstall @threenative/runtime-native, or in a ThreeNative checkout run \`pnpm wasm:build\` (presets wasm and wasm-threads). ${OPT_OUT}`
|
|
2089
2169
|
);
|
|
2090
|
-
|
|
2170
|
+
const off = (detail) => `${THREADS_OFF}: ${detail} Serve the game over https or localhost (the build's service worker adds Cross-Origin-Opener-Policy: same-origin and Cross-Origin-Embedder-Policy: require-corp), or send both headers; on itch.io enable "SharedArrayBuffer support".`;
|
|
2171
|
+
const head = [
|
|
2091
2172
|
`import { bindWebEngine } from ${JSON.stringify(runtimeModule())};`,
|
|
2173
|
+
"if (globalThis.crossOriginIsolated !== true) await globalThis.__tnIsolation;"
|
|
2174
|
+
];
|
|
2175
|
+
const threadsReport = "${globalThis.__tnWebThreads}";
|
|
2176
|
+
const lines = strict ? [
|
|
2092
2177
|
"if (globalThis.crossOriginIsolated !== true)",
|
|
2093
|
-
` throw new Error(
|
|
2178
|
+
` throw new Error(${JSON.stringify(off("this page is not cross-origin isolated, so the engine cannot start its worker threads."))});`,
|
|
2094
2179
|
`const createModule = (await import(${JSON.stringify(threads)})).default;`,
|
|
2095
2180
|
`const engine = await bindWebEngine(createModule, ${JSON.stringify(names)});`,
|
|
2096
2181
|
'if (!String(globalThis.__tnWebThreads).startsWith("on"))',
|
|
2097
|
-
` throw new Error(\`${THREADS_OFF}: the engine's job pool started no worker thread (
|
|
2098
|
-
|
|
2099
|
-
""
|
|
2100
|
-
|
|
2182
|
+
` throw new Error(\`${THREADS_OFF}: the engine's job pool started no worker thread (${threadsReport}).\`);`
|
|
2183
|
+
] : [
|
|
2184
|
+
"const createModule = (",
|
|
2185
|
+
" globalThis.crossOriginIsolated === true",
|
|
2186
|
+
` ? await import(${JSON.stringify(threads)})`,
|
|
2187
|
+
` : await import(${JSON.stringify(single)})`,
|
|
2188
|
+
").default;",
|
|
2189
|
+
`const engine = await bindWebEngine(createModule, ${JSON.stringify(names)});`,
|
|
2190
|
+
'if (!String(globalThis.__tnWebThreads).startsWith("on"))',
|
|
2191
|
+
` console.warn(\`${off(`the engine runs without worker threads (${threadsReport}), so frames cost more.`).replaceAll("`", "\\`")}\`);`
|
|
2192
|
+
];
|
|
2193
|
+
return [...head, ...lines, `export const { ${names.join(", ")} } = engine;`, ""].join("\n");
|
|
2101
2194
|
}
|
|
2102
2195
|
};
|
|
2103
2196
|
}
|
|
2104
2197
|
|
|
2105
|
-
// src/
|
|
2198
|
+
// src/engine-catalog.ts
|
|
2199
|
+
var CHECKED_SOURCES = /* @__PURE__ */ new Set(["three", "three/webgpu", "three/tsl"]);
|
|
2200
|
+
var IMPORTS_THREE = /from\s*["']three(?:\/webgpu|\/tsl)?["']/u;
|
|
2201
|
+
var SOURCE_FILE = /\.[cm]?[jt]sx?$/u;
|
|
2202
|
+
var OVERRIDE = 'createEngineCatalogPlugin({ mode: "warn" }) in vite.config.ts reports instead of failing; engine: "threejs" in threenative.config.ts binds every name.';
|
|
2203
|
+
function namedList(ts, statement) {
|
|
2204
|
+
const declaration = ts.isImportDeclaration(statement) && statement.importClause?.isTypeOnly !== true ? { bindings: statement.importClause?.namedBindings, specifier: statement.moduleSpecifier } : ts.isExportDeclaration(statement) && !statement.isTypeOnly ? { bindings: statement.exportClause, specifier: statement.moduleSpecifier } : void 0;
|
|
2205
|
+
const bindings = declaration?.bindings;
|
|
2206
|
+
const specifier = declaration?.specifier;
|
|
2207
|
+
if (bindings === void 0 || specifier === void 0 || !ts.isStringLiteral(specifier))
|
|
2208
|
+
return void 0;
|
|
2209
|
+
if (!CHECKED_SOURCES.has(specifier.text)) return void 0;
|
|
2210
|
+
return ts.isNamedImports(bindings) || ts.isNamedExports(bindings) ? { elements: bindings.elements, source: specifier.text } : void 0;
|
|
2211
|
+
}
|
|
2212
|
+
async function refusedImports(code, file, refusals) {
|
|
2213
|
+
const ts = (await import('typescript')).default;
|
|
2214
|
+
const sourceFile = ts.createSourceFile(file, code, ts.ScriptTarget.Latest, true);
|
|
2215
|
+
const found = [];
|
|
2216
|
+
for (const statement of sourceFile.statements) {
|
|
2217
|
+
const list = namedList(ts, statement);
|
|
2218
|
+
for (const element of list?.elements ?? []) {
|
|
2219
|
+
const name = (element.propertyName ?? element.name).text;
|
|
2220
|
+
const refusal = refusals.get(name);
|
|
2221
|
+
if (element.isTypeOnly || refusal === void 0 || list === void 0) continue;
|
|
2222
|
+
const position = sourceFile.getLineAndCharacterOfPosition(element.getStart(sourceFile));
|
|
2223
|
+
found.push({
|
|
2224
|
+
code: refusal,
|
|
2225
|
+
column: position.character,
|
|
2226
|
+
line: position.line + 1,
|
|
2227
|
+
name,
|
|
2228
|
+
source: list.source
|
|
2229
|
+
});
|
|
2230
|
+
}
|
|
2231
|
+
}
|
|
2232
|
+
return found;
|
|
2233
|
+
}
|
|
2234
|
+
function createEngineCatalogPlugin(options = {}) {
|
|
2235
|
+
const mode = options.mode ?? "error";
|
|
2236
|
+
let root = process.cwd();
|
|
2237
|
+
let active = false;
|
|
2238
|
+
let bootWarned = false;
|
|
2239
|
+
let refusals;
|
|
2240
|
+
async function transform(code, id) {
|
|
2241
|
+
const file = id.split("?")[0] ?? id;
|
|
2242
|
+
const where = path8.relative(root, file);
|
|
2243
|
+
if (!active || id.startsWith("\0") || where.startsWith("..") || path8.isAbsolute(where))
|
|
2244
|
+
return null;
|
|
2245
|
+
if (where.split(path8.sep).includes("node_modules")) return null;
|
|
2246
|
+
if (!SOURCE_FILE.test(file) || !IMPORTS_THREE.test(code)) return null;
|
|
2247
|
+
refusals ??= upstreamRefusals(root).catch(
|
|
2248
|
+
(error) => new Error(
|
|
2249
|
+
`TN_ENGINE_CATALOG: the installed Wasm engine did not boot under this create-threenative, so the page cannot bind it either (${error instanceof Error ? error.message : String(error)}). Install one release of both: pnpm up --latest create-threenative @threenative/*`
|
|
2250
|
+
)
|
|
2251
|
+
);
|
|
2252
|
+
const known = await refusals;
|
|
2253
|
+
if (known instanceof Error) {
|
|
2254
|
+
if (mode === "error") return this.error({ message: known.message, id: file });
|
|
2255
|
+
if (!bootWarned) this.warn(known.message);
|
|
2256
|
+
bootWarned = true;
|
|
2257
|
+
return null;
|
|
2258
|
+
}
|
|
2259
|
+
const found = await refusedImports(code, file, known);
|
|
2260
|
+
const first = found[0];
|
|
2261
|
+
if (first === void 0) return null;
|
|
2262
|
+
const message = [
|
|
2263
|
+
...found.map(
|
|
2264
|
+
(refused) => `${refused.code}: ${refused.name} from "${refused.source}" is not available on the Wasm engine (${where}:${refused.line}:${refused.column + 1}).`
|
|
2265
|
+
),
|
|
2266
|
+
OVERRIDE
|
|
2267
|
+
].join("\n");
|
|
2268
|
+
if (mode === "warn") {
|
|
2269
|
+
this.warn(message);
|
|
2270
|
+
return null;
|
|
2271
|
+
}
|
|
2272
|
+
return this.error({
|
|
2273
|
+
message,
|
|
2274
|
+
id: file,
|
|
2275
|
+
loc: { file, line: first.line, column: first.column }
|
|
2276
|
+
});
|
|
2277
|
+
}
|
|
2278
|
+
return {
|
|
2279
|
+
name: "threenative-engine-catalog",
|
|
2280
|
+
enforce: "pre",
|
|
2281
|
+
// A game booted in a worker (the kits' default page) bundles through `worker.plugins` only.
|
|
2282
|
+
config: () => ({
|
|
2283
|
+
worker: {
|
|
2284
|
+
plugins: () => [{ name: "threenative-engine-catalog-worker", enforce: "pre", transform }]
|
|
2285
|
+
}
|
|
2286
|
+
}),
|
|
2287
|
+
async configResolved(config) {
|
|
2288
|
+
root = config.root;
|
|
2289
|
+
const { engine } = await loadConfig(root);
|
|
2290
|
+
const off = engine !== "threenative" ? `engine ${engine}` : process.env.THREENATIVE_NATIVE_BUNDLE !== void 0 ? "native host bundle" : void 0;
|
|
2291
|
+
active = off === void 0;
|
|
2292
|
+
if (off !== void 0) console.info(`TN_ENGINE_CATALOG: off (${off})`);
|
|
2293
|
+
else if (mode === "warn")
|
|
2294
|
+
console.info(
|
|
2295
|
+
'TN_ENGINE_CATALOG: warn (mode "warn": a refused import is reported, and the page throws at its first use)'
|
|
2296
|
+
);
|
|
2297
|
+
},
|
|
2298
|
+
transform
|
|
2299
|
+
};
|
|
2300
|
+
}
|
|
2301
|
+
var DECODER_LOADER_ID = /[/\\]examples[/\\]jsm[/\\]loaders[/\\](?:KTX2Loader|DRACOLoader)\.js$/u;
|
|
2302
|
+
var DECODER_LIB_ASSET_URL = /new URL\(\s*(['"])\.\.\/libs\/([^'"]+)\1\s*,\s*import\.meta\.url\s*\)(?:\.toString\s*\(\s*\)|\.href\s*)?/gu;
|
|
2303
|
+
function rewriteDecoderAssetUrls(code) {
|
|
2304
|
+
return code.replace(DECODER_LIB_ASSET_URL, '"../libs/$2"');
|
|
2305
|
+
}
|
|
2306
|
+
var MARKER_RELATIVE = path8.join("node_modules", ".vite", "threenative-engine-build.json");
|
|
2307
|
+
function hashTree(hash, directory) {
|
|
2308
|
+
const entries = readdirSync(directory, { withFileTypes: true }).sort(
|
|
2309
|
+
(left, right) => left.name < right.name ? -1 : left.name > right.name ? 1 : 0
|
|
2310
|
+
);
|
|
2311
|
+
for (const entry of entries) {
|
|
2312
|
+
const full = path8.join(directory, entry.name);
|
|
2313
|
+
if (entry.isDirectory()) {
|
|
2314
|
+
hashTree(hash, full);
|
|
2315
|
+
} else if (entry.isFile()) {
|
|
2316
|
+
hash.update(path8.relative(directory, full));
|
|
2317
|
+
hash.update(readFileSync(full));
|
|
2318
|
+
}
|
|
2319
|
+
}
|
|
2320
|
+
}
|
|
2321
|
+
function hashEngineDist(projectRoot) {
|
|
2322
|
+
const scopeDir = path8.join(projectRoot, "node_modules", "@threenative");
|
|
2323
|
+
let packages;
|
|
2324
|
+
try {
|
|
2325
|
+
packages = readdirSync(scopeDir, { withFileTypes: true }).filter((entry) => entry.isDirectory() || entry.isSymbolicLink()).map((entry) => entry.name).sort((left, right) => left < right ? -1 : left > right ? 1 : 0);
|
|
2326
|
+
} catch {
|
|
2327
|
+
return void 0;
|
|
2328
|
+
}
|
|
2329
|
+
const dists = [];
|
|
2330
|
+
for (const name of packages) {
|
|
2331
|
+
let packageDir = path8.join(scopeDir, name);
|
|
2332
|
+
try {
|
|
2333
|
+
packageDir = realpathSync(packageDir);
|
|
2334
|
+
} catch {
|
|
2335
|
+
continue;
|
|
2336
|
+
}
|
|
2337
|
+
const dist = path8.join(packageDir, "dist");
|
|
2338
|
+
if (existsSync(dist)) dists.push([name, dist]);
|
|
2339
|
+
}
|
|
2340
|
+
if (dists.length === 0) return void 0;
|
|
2341
|
+
const hash = createHash("sha256");
|
|
2342
|
+
for (const [name, dist] of dists) {
|
|
2343
|
+
hash.update(name);
|
|
2344
|
+
hashTree(hash, dist);
|
|
2345
|
+
}
|
|
2346
|
+
return hash.digest("hex");
|
|
2347
|
+
}
|
|
2348
|
+
function markerPath(projectRoot) {
|
|
2349
|
+
return path8.join(projectRoot, MARKER_RELATIVE);
|
|
2350
|
+
}
|
|
2351
|
+
function readMarker(file) {
|
|
2352
|
+
try {
|
|
2353
|
+
return JSON.parse(readFileSync(file, "utf8"));
|
|
2354
|
+
} catch {
|
|
2355
|
+
return void 0;
|
|
2356
|
+
}
|
|
2357
|
+
}
|
|
2358
|
+
function processIsAlive(pid) {
|
|
2359
|
+
if (pid === process.pid) return true;
|
|
2360
|
+
try {
|
|
2361
|
+
process.kill(pid, 0);
|
|
2362
|
+
return true;
|
|
2363
|
+
} catch (error) {
|
|
2364
|
+
return error.code === "EPERM";
|
|
2365
|
+
}
|
|
2366
|
+
}
|
|
2367
|
+
function createEngineFreshnessPlugin() {
|
|
2368
|
+
let recordedHash;
|
|
2369
|
+
const rootOf = (config) => path8.resolve(config.root ?? process.cwd());
|
|
2370
|
+
return {
|
|
2371
|
+
name: "threenative-engine-freshness",
|
|
2372
|
+
config(config, env) {
|
|
2373
|
+
const resolve = { dedupe: ["three", "react", "react-dom"] };
|
|
2374
|
+
if (env.command !== "serve") return { resolve };
|
|
2375
|
+
const root = rootOf(config);
|
|
2376
|
+
recordedHash = hashEngineDist(root);
|
|
2377
|
+
const marker = recordedHash === void 0 ? void 0 : readMarker(markerPath(root));
|
|
2378
|
+
if (recordedHash === void 0 || marker === void 0 || marker.hash === recordedHash) {
|
|
2379
|
+
return { resolve };
|
|
2380
|
+
}
|
|
2381
|
+
if (processIsAlive(marker.pid)) {
|
|
2382
|
+
const where = marker.port === void 0 ? `pid ${marker.pid}` : `pid ${marker.pid} on port ${marker.port}`;
|
|
2383
|
+
const how = marker.port === void 0 ? "" : ` (lsof -ti tcp:${marker.port} | xargs -r kill)`;
|
|
2384
|
+
console.warn(
|
|
2385
|
+
`threenative: a dev server is still running at ${where}, serving engine build ${marker.hash.slice(0, 8)}; the installed build is ${recordedHash.slice(0, 8)}. Kill it before playing${how} \u2014 its tab renders yesterday's engine.`
|
|
2386
|
+
);
|
|
2387
|
+
}
|
|
2388
|
+
return { resolve, optimizeDeps: { force: true } };
|
|
2389
|
+
},
|
|
2390
|
+
transform(code, id) {
|
|
2391
|
+
if (!DECODER_LOADER_ID.test(id)) return null;
|
|
2392
|
+
const rewritten = rewriteDecoderAssetUrls(code);
|
|
2393
|
+
return rewritten === code ? null : { code: rewritten, map: null };
|
|
2394
|
+
},
|
|
2395
|
+
configureServer(server) {
|
|
2396
|
+
const root = rootOf(server.config);
|
|
2397
|
+
const file = markerPath(root);
|
|
2398
|
+
const writeBootMarker = (port) => {
|
|
2399
|
+
const hash = recordedHash ?? hashEngineDist(root);
|
|
2400
|
+
if (hash === void 0) return;
|
|
2401
|
+
mkdirSync(path8.dirname(file), { recursive: true });
|
|
2402
|
+
writeFileSync(
|
|
2403
|
+
file,
|
|
2404
|
+
JSON.stringify(
|
|
2405
|
+
port === void 0 ? { hash, pid: process.pid } : { hash, pid: process.pid, port }
|
|
2406
|
+
)
|
|
2407
|
+
);
|
|
2408
|
+
};
|
|
2409
|
+
const httpServer = server.httpServer;
|
|
2410
|
+
if (httpServer === void 0 || httpServer === null) {
|
|
2411
|
+
writeBootMarker(void 0);
|
|
2412
|
+
return;
|
|
2413
|
+
}
|
|
2414
|
+
httpServer.once("listening", () => {
|
|
2415
|
+
const address = httpServer.address();
|
|
2416
|
+
writeBootMarker(
|
|
2417
|
+
typeof address === "object" && address !== null && address.port !== void 0 ? address.port : void 0
|
|
2418
|
+
);
|
|
2419
|
+
});
|
|
2420
|
+
httpServer.once("close", () => {
|
|
2421
|
+
const marker = readMarker(file);
|
|
2422
|
+
if (marker?.pid === process.pid) rmSync(file, { force: true });
|
|
2423
|
+
});
|
|
2424
|
+
}
|
|
2425
|
+
};
|
|
2426
|
+
}
|
|
2106
2427
|
var ISOLATION_HEADERS = {
|
|
2107
2428
|
"Cross-Origin-Embedder-Policy": "require-corp",
|
|
2108
2429
|
"Cross-Origin-Opener-Policy": "same-origin"
|
|
@@ -2115,15 +2436,105 @@ var isolationMiddleware = (req, res, next) => {
|
|
|
2115
2436
|
function renderIsolationHeaders() {
|
|
2116
2437
|
return `/*
|
|
2117
2438
|
${Object.entries(ISOLATION_HEADERS).map(([key, value]) => ` ${key}: ${value}
|
|
2118
|
-
`).join("")}
|
|
2439
|
+
`).join("")}/assets/*
|
|
2440
|
+
Cache-Control: public, max-age=31536000, immutable
|
|
2441
|
+
`;
|
|
2442
|
+
}
|
|
2443
|
+
var ISOLATION_WORKER_FILE = "tn-isolation-sw.js";
|
|
2444
|
+
function renderIsolationWorker() {
|
|
2445
|
+
return `self.addEventListener("install", () => self.skipWaiting());
|
|
2446
|
+
self.addEventListener("activate", (event) => event.waitUntil(self.clients.claim()));
|
|
2447
|
+
self.addEventListener("fetch", (event) => {
|
|
2448
|
+
const request = event.request;
|
|
2449
|
+
if (request.cache === "only-if-cached" && request.mode !== "same-origin") return;
|
|
2450
|
+
event.respondWith(
|
|
2451
|
+
fetch(request).then((response) => {
|
|
2452
|
+
if (response.status === 0) return response;
|
|
2453
|
+
const headers = new Headers(response.headers);
|
|
2454
|
+
${Object.entries({ ...ISOLATION_HEADERS, "Cross-Origin-Resource-Policy": "cross-origin" }).map(
|
|
2455
|
+
([key, value]) => ` headers.set("${key}", "${value}");
|
|
2456
|
+
`
|
|
2457
|
+
).join(
|
|
2458
|
+
""
|
|
2459
|
+
)} return new Response(response.body, { headers, status: response.status, statusText: response.statusText });
|
|
2460
|
+
}),
|
|
2461
|
+
);
|
|
2462
|
+
});
|
|
2463
|
+
`;
|
|
2464
|
+
}
|
|
2465
|
+
var ISOLATION_BOOT = `<script>(() => {
|
|
2466
|
+
const key = "tnIsolationReload";
|
|
2467
|
+
const store = (use) => { try { return use(sessionStorage); } catch { return null; } };
|
|
2468
|
+
if (globalThis.crossOriginIsolated) return void store((s) => s.removeItem(key));
|
|
2469
|
+
if (!isSecureContext || !("serviceWorker" in navigator) || /[?&]tnIsolation=0(?:&|$)/.test(location.search)) return;
|
|
2470
|
+
globalThis.__tnIsolation = navigator.serviceWorker.register("${ISOLATION_WORKER_FILE}")
|
|
2471
|
+
.then(() => navigator.serviceWorker.ready)
|
|
2472
|
+
.then(() => {
|
|
2473
|
+
if (store((s) => s.getItem(key)) !== null) return void store((s) => s.removeItem(key));
|
|
2474
|
+
if (store((s) => (s.setItem(key, "1"), true)) !== true) return;
|
|
2475
|
+
location.reload();
|
|
2476
|
+
return new Promise(() => {});
|
|
2477
|
+
}, () => {});
|
|
2478
|
+
})();</script>`;
|
|
2479
|
+
function withBuildId(html) {
|
|
2480
|
+
const entry = /<script\b[^>]*\btype="module"[^>]*\bsrc="([^"]*\/assets\/[^"]+\.js)"/iu.exec(
|
|
2481
|
+
html
|
|
2482
|
+
)?.[1];
|
|
2483
|
+
if (entry === void 0) return html;
|
|
2484
|
+
return html.replace(
|
|
2485
|
+
/<script/iu,
|
|
2486
|
+
`<script>globalThis.__TN_BUILD_ID__ = ${JSON.stringify(entry).replaceAll("<", "\\u003c")};</script>
|
|
2487
|
+
<script`
|
|
2488
|
+
);
|
|
2489
|
+
}
|
|
2490
|
+
function withEnginePreload(html, bundle, threaded) {
|
|
2491
|
+
if (bundle === void 0) return html;
|
|
2492
|
+
const files = Object.values(bundle);
|
|
2493
|
+
const entry = /<script\b[^>]*\btype="module"[^>]*\bsrc="([^"]*)"/iu.exec(html)?.[1];
|
|
2494
|
+
const entryFile = files.find((file) => entry?.endsWith(file.fileName) === true);
|
|
2495
|
+
if (entry === void 0 || entryFile === void 0) return html;
|
|
2496
|
+
const base = entry.slice(0, entry.length - entryFile.fileName.length);
|
|
2497
|
+
const href = (test) => {
|
|
2498
|
+
const found = files.find(test);
|
|
2499
|
+
return found === void 0 ? void 0 : base + found.fileName;
|
|
2500
|
+
};
|
|
2501
|
+
const threads = href((file) => /tn-native-engine-web-threads-[^/]*\.wasm$/u.test(file.fileName));
|
|
2502
|
+
const plain = href(
|
|
2503
|
+
(file) => /tn-native-engine-web-(?!threads-)[^/]*\.wasm$/u.test(file.fileName)
|
|
2504
|
+
);
|
|
2505
|
+
const wasm = threaded ? threads : plain;
|
|
2506
|
+
if (wasm === void 0) return html;
|
|
2507
|
+
const rapier = href(
|
|
2508
|
+
(file) => file.type === "chunk" && file.moduleIds?.some((id) => id.includes("/@dimforge/rapier3d")) === true
|
|
2509
|
+
);
|
|
2510
|
+
const quote = (value) => JSON.stringify(value ?? null).replaceAll("<", "\\u003c");
|
|
2511
|
+
const script = `<script>(() => {
|
|
2512
|
+
const link = (rel, href, as) => {
|
|
2513
|
+
const tag = Object.assign(document.createElement("link"), { rel, href, crossOrigin: "anonymous" });
|
|
2514
|
+
if (as !== undefined) tag.as = as;
|
|
2515
|
+
return document.head.appendChild(tag);
|
|
2516
|
+
};
|
|
2517
|
+
if (${threaded} && !globalThis.crossOriginIsolated) return;
|
|
2518
|
+
const href = ${quote(wasm)};
|
|
2519
|
+
const store = (use) => { try { return use(localStorage); } catch { return null; } };
|
|
2520
|
+
if (store((s) => s.getItem("tnEngineWasm")) === href) return;
|
|
2521
|
+
const wasm = link("preload", href, "fetch");
|
|
2522
|
+
const rapier = ${quote(rapier)};
|
|
2523
|
+
wasm.onload = wasm.onerror = () => {
|
|
2524
|
+
store((s) => s.setItem("tnEngineWasm", href));
|
|
2525
|
+
if (rapier !== null) link("modulepreload", rapier);
|
|
2526
|
+
};
|
|
2527
|
+
})();</script>`;
|
|
2528
|
+
return html.replace(/<script/iu, `${script}
|
|
2529
|
+
<script`);
|
|
2119
2530
|
}
|
|
2120
2531
|
function htmlAttribute(value) {
|
|
2121
2532
|
return value.replaceAll("&", "&").replaceAll('"', """).replaceAll("<", "<");
|
|
2122
2533
|
}
|
|
2123
2534
|
function publicUrl(root, value) {
|
|
2124
2535
|
if (value === void 0) return void 0;
|
|
2125
|
-
const relative =
|
|
2126
|
-
const normalized = relative.replaceAll(
|
|
2536
|
+
const relative = path8.isAbsolute(value) ? path8.relative(root, value) : value;
|
|
2537
|
+
const normalized = relative.replaceAll(path8.sep, "/").replace(/^public\//u, "");
|
|
2127
2538
|
return `/${normalized.replace(/^\//u, "")}`;
|
|
2128
2539
|
}
|
|
2129
2540
|
function manifestIcon(root, source, purpose) {
|
|
@@ -2196,11 +2607,17 @@ function createWebBrandPlugin() {
|
|
|
2196
2607
|
let root = process.cwd();
|
|
2197
2608
|
let config;
|
|
2198
2609
|
let engine;
|
|
2610
|
+
let threaded = false;
|
|
2611
|
+
const load = async (id) => {
|
|
2612
|
+
const code = await engine?.load(id) ?? null;
|
|
2613
|
+
if (id === WEB_ENGINE_ID && code !== null) threaded = true;
|
|
2614
|
+
return code;
|
|
2615
|
+
};
|
|
2199
2616
|
return {
|
|
2200
2617
|
name: "threenative-web-brand",
|
|
2201
2618
|
enforce: "pre",
|
|
2202
2619
|
async config(vite) {
|
|
2203
|
-
const loaded = await loadConfig(
|
|
2620
|
+
const loaded = await loadConfig(path8.resolve(vite.root ?? process.cwd()));
|
|
2204
2621
|
if (loaded.engine === "threenative" && process.env.THREENATIVE_NATIVE_BUNDLE === void 0)
|
|
2205
2622
|
return {
|
|
2206
2623
|
optimizeDeps: { exclude: ["three", "three/webgpu", "three/tsl", "three-mesh-bvh"] },
|
|
@@ -2213,7 +2630,7 @@ function createWebBrandPlugin() {
|
|
|
2213
2630
|
name: "threenative-web-engine-worker",
|
|
2214
2631
|
enforce: "pre",
|
|
2215
2632
|
resolveId: (source, importer) => engine?.resolveId(source, importer) ?? null,
|
|
2216
|
-
load
|
|
2633
|
+
load
|
|
2217
2634
|
}
|
|
2218
2635
|
]
|
|
2219
2636
|
}
|
|
@@ -2223,18 +2640,23 @@ function createWebBrandPlugin() {
|
|
|
2223
2640
|
resolveId(source, importer) {
|
|
2224
2641
|
return engine?.resolveId(source, importer) ?? null;
|
|
2225
2642
|
},
|
|
2226
|
-
|
|
2227
|
-
return engine?.load(id) ?? null;
|
|
2228
|
-
},
|
|
2643
|
+
load,
|
|
2229
2644
|
async configResolved(resolved) {
|
|
2230
2645
|
root = resolved.root;
|
|
2231
2646
|
config = await loadConfig(root);
|
|
2232
2647
|
if (config.engine === "threenative" && process.env.THREENATIVE_NATIVE_BUNDLE === void 0)
|
|
2233
|
-
engine = createWebEnginePlugin({
|
|
2648
|
+
engine = createWebEnginePlugin({
|
|
2649
|
+
root,
|
|
2650
|
+
engine: config.engine,
|
|
2651
|
+
strict: resolved.command !== "build"
|
|
2652
|
+
});
|
|
2234
2653
|
},
|
|
2235
|
-
transformIndexHtml(html) {
|
|
2654
|
+
transformIndexHtml(html, context) {
|
|
2236
2655
|
if (config === void 0) throw new Error("TN_WEB_BRAND_CONFIG_MISSING");
|
|
2237
|
-
|
|
2656
|
+
const output = withBuildId(updateLaunchMarkup(root, config, html));
|
|
2657
|
+
const isolated = threaded ? output.replace(/<script/iu, `${ISOLATION_BOOT}
|
|
2658
|
+
<script`) : output;
|
|
2659
|
+
return withEnginePreload(isolated, context?.bundle, threaded);
|
|
2238
2660
|
},
|
|
2239
2661
|
// Every page links the manifest, and only a build emits it: in dev Vite would answer the link
|
|
2240
2662
|
// with index.html, which the browser reports as a manifest syntax error on each load.
|
|
@@ -2259,6 +2681,12 @@ function createWebBrandPlugin() {
|
|
|
2259
2681
|
});
|
|
2260
2682
|
if (config.engine === "threenative")
|
|
2261
2683
|
this.emitFile({ fileName: "_headers", source: renderIsolationHeaders(), type: "asset" });
|
|
2684
|
+
if (threaded)
|
|
2685
|
+
this.emitFile({
|
|
2686
|
+
fileName: ISOLATION_WORKER_FILE,
|
|
2687
|
+
source: renderIsolationWorker(),
|
|
2688
|
+
type: "asset"
|
|
2689
|
+
});
|
|
2262
2690
|
}
|
|
2263
2691
|
};
|
|
2264
2692
|
}
|
|
@@ -2283,23 +2711,24 @@ var TEXT_FILE_EXTENSIONS = /* @__PURE__ */ new Set([".css", ".html", ".json", ".
|
|
|
2283
2711
|
var TEMPLATE_NAME = /^[a-z][a-z0-9-]*$/u;
|
|
2284
2712
|
var SHARED_AGENT_MARKER_LINE = /^<!--\s*(?:shared:\s*[^>]+|\/shared)\s*-->\r?\n?/gmu;
|
|
2285
2713
|
var DEFAULT_TEMPLATE = "starter";
|
|
2714
|
+
var SUPPORTED_PACKAGE_MANAGER = "pnpm@10.25.0";
|
|
2286
2715
|
function templateRoot() {
|
|
2287
|
-
return
|
|
2716
|
+
return path8.resolve(path8.dirname(fileURLToPath(import.meta.url)), "../templates");
|
|
2288
2717
|
}
|
|
2289
|
-
var LOADING_SOURCE_RELATIVE_PATH =
|
|
2718
|
+
var LOADING_SOURCE_RELATIVE_PATH = path8.join("src", "render", "loading.ts");
|
|
2290
2719
|
var LOADING_APPEARANCE_MARKER = "BEGIN THREENATIVE LOADING APPEARANCE";
|
|
2291
2720
|
var TEMPLATE_ICON_NAME = "icon.png";
|
|
2292
2721
|
var LOADING_APPEARANCE_BLOCK_PATTERN = /\/\* BEGIN THREENATIVE LOADING APPEARANCE \*\/[\s\S]*?\/\* END THREENATIVE LOADING APPEARANCE \*\//gu;
|
|
2293
2722
|
function discoverStampedTemplates(root = templateRoot()) {
|
|
2294
2723
|
return readdirSync(root, { withFileTypes: true }).filter((entry) => entry.isDirectory() && !entry.name.startsWith(".")).map((entry) => entry.name).sort((left, right) => left.localeCompare(right)).filter((template) => {
|
|
2295
|
-
const file =
|
|
2724
|
+
const file = path8.join(root, template, LOADING_SOURCE_RELATIVE_PATH);
|
|
2296
2725
|
return existsSync(file) && readFileSync(file, "utf8").includes(LOADING_APPEARANCE_MARKER);
|
|
2297
2726
|
});
|
|
2298
2727
|
}
|
|
2299
2728
|
function canonicalLoadingPath(root = templateRoot()) {
|
|
2300
|
-
const local =
|
|
2729
|
+
const local = path8.resolve(root, "..", "template-assets", "loading.ts");
|
|
2301
2730
|
if (existsSync(local)) return local;
|
|
2302
|
-
return
|
|
2731
|
+
return path8.resolve(templateRoot(), "..", "template-assets", "loading.ts");
|
|
2303
2732
|
}
|
|
2304
2733
|
function loadingAppearanceBlock(source, file) {
|
|
2305
2734
|
const matches = source.match(LOADING_APPEARANCE_BLOCK_PATTERN) ?? [];
|
|
@@ -2316,25 +2745,36 @@ function stampLoadingSource(canonical, template) {
|
|
|
2316
2745
|
return canonical.replace(canonicalBlock, templateBlock);
|
|
2317
2746
|
}
|
|
2318
2747
|
var SHARED_RENDER_SOURCES = [
|
|
2748
|
+
// The backlight shader: mechanism every kit repeats, but its constants decide how a surface
|
|
2749
|
+
// looks, so it lives in `src/render/` (rule 3) and is stamped from one source rather than moved
|
|
2750
|
+
// into the engine.
|
|
2751
|
+
"src/render/backlightControls.ts",
|
|
2752
|
+
"src/render/backlightMaterial.ts",
|
|
2753
|
+
"src/render/atmosphere.ts",
|
|
2754
|
+
"src/render/gpuSky.ts",
|
|
2755
|
+
"src/render/kitExposure.ts",
|
|
2756
|
+
"src/render/temporalDetailStage.ts"
|
|
2757
|
+
];
|
|
2758
|
+
var ADDED_RENDER_SOURCES = [
|
|
2319
2759
|
"src/render/kitExposure.ts",
|
|
2320
2760
|
"src/render/temporalDetailStage.ts"
|
|
2321
2761
|
];
|
|
2322
2762
|
function canonicalRenderSourcePath(relativePath, root = templateRoot()) {
|
|
2323
|
-
const name =
|
|
2324
|
-
const local =
|
|
2763
|
+
const name = path8.basename(relativePath);
|
|
2764
|
+
const local = path8.resolve(root, "..", "template-assets", name);
|
|
2325
2765
|
if (existsSync(local)) return local;
|
|
2326
|
-
const starter =
|
|
2766
|
+
const starter = path8.resolve(root, "starter", relativePath);
|
|
2327
2767
|
if (existsSync(starter)) return starter;
|
|
2328
|
-
const shared =
|
|
2768
|
+
const shared = path8.resolve(templateRoot(), "..", "template-assets", name);
|
|
2329
2769
|
if (existsSync(shared)) return shared;
|
|
2330
|
-
return
|
|
2770
|
+
return path8.resolve(templateRoot(), "starter", relativePath);
|
|
2331
2771
|
}
|
|
2332
2772
|
async function restampSharedRenderCopies(root = templateRoot()) {
|
|
2333
2773
|
const stamped = [];
|
|
2334
2774
|
for (const relativePath of SHARED_RENDER_SOURCES) {
|
|
2335
2775
|
const canonical = await readFile(canonicalRenderSourcePath(relativePath, root), "utf8");
|
|
2336
2776
|
for (const template of readdirSync(root, { withFileTypes: true }).filter((entry) => entry.isDirectory() && !entry.name.startsWith(".")).map((entry) => entry.name).sort((left, right) => left.localeCompare(right))) {
|
|
2337
|
-
const file =
|
|
2777
|
+
const file = path8.join(root, template, relativePath);
|
|
2338
2778
|
if (!existsSync(file)) continue;
|
|
2339
2779
|
await writeFile(file, canonical);
|
|
2340
2780
|
stamped.push(file);
|
|
@@ -2346,7 +2786,7 @@ async function restampTemplateLoadingCopies(root = templateRoot()) {
|
|
|
2346
2786
|
const canonical = await readFile(canonicalLoadingPath(root), "utf8");
|
|
2347
2787
|
const stamped = [];
|
|
2348
2788
|
for (const template of discoverStampedTemplates(root)) {
|
|
2349
|
-
const file =
|
|
2789
|
+
const file = path8.join(root, template, LOADING_SOURCE_RELATIVE_PATH);
|
|
2350
2790
|
const source = await readFile(file, "utf8");
|
|
2351
2791
|
await writeFile(file, stampLoadingSource(canonical, source));
|
|
2352
2792
|
stamped.push(file);
|
|
@@ -2354,19 +2794,19 @@ async function restampTemplateLoadingCopies(root = templateRoot()) {
|
|
|
2354
2794
|
return stamped;
|
|
2355
2795
|
}
|
|
2356
2796
|
async function stampTemplateLoading(target, template, root) {
|
|
2357
|
-
const sourcePath =
|
|
2797
|
+
const sourcePath = path8.join(template, LOADING_SOURCE_RELATIVE_PATH);
|
|
2358
2798
|
if (!existsSync(sourcePath)) return;
|
|
2359
2799
|
const source = await readFile(sourcePath, "utf8");
|
|
2360
2800
|
if (!source.includes("BEGIN THREENATIVE LOADING APPEARANCE")) return;
|
|
2361
2801
|
const canonical = await readFile(canonicalLoadingPath(root), "utf8");
|
|
2362
2802
|
await writeFile(
|
|
2363
|
-
|
|
2803
|
+
path8.join(target, LOADING_SOURCE_RELATIVE_PATH),
|
|
2364
2804
|
stampLoadingSource(canonical, source)
|
|
2365
2805
|
);
|
|
2366
2806
|
}
|
|
2367
2807
|
async function copyTemplateIcon(target, templateRootDirectory) {
|
|
2368
|
-
const source =
|
|
2369
|
-
|
|
2808
|
+
const source = path8.join(
|
|
2809
|
+
path8.dirname(templateRootDirectory),
|
|
2370
2810
|
"template-assets",
|
|
2371
2811
|
TEMPLATE_ICON_NAME
|
|
2372
2812
|
);
|
|
@@ -2375,18 +2815,18 @@ async function copyTemplateIcon(target, templateRootDirectory) {
|
|
|
2375
2815
|
`TN_TEMPLATE_ICON_MISSING: '${source}' is not in the package; every generated project needs the native icon asset.`
|
|
2376
2816
|
);
|
|
2377
2817
|
}
|
|
2378
|
-
const destination =
|
|
2379
|
-
await mkdir(
|
|
2818
|
+
const destination = path8.join(target, "public", TEMPLATE_ICON_NAME);
|
|
2819
|
+
await mkdir(path8.dirname(destination), { recursive: true });
|
|
2380
2820
|
await cp(source, destination, { errorOnExist: true, force: false });
|
|
2381
2821
|
}
|
|
2382
2822
|
async function copySharedAssets(target, templateRootDirectory) {
|
|
2383
|
-
const shared =
|
|
2823
|
+
const shared = path8.join(path8.dirname(templateRootDirectory), "template-assets", "assets");
|
|
2384
2824
|
if (!existsSync(shared)) return;
|
|
2385
|
-
const source =
|
|
2825
|
+
const source = path8.join(target, "src");
|
|
2386
2826
|
const texts = [];
|
|
2387
2827
|
const walk = async (directory) => {
|
|
2388
2828
|
for (const entry of await readdir(directory, { withFileTypes: true })) {
|
|
2389
|
-
const file =
|
|
2829
|
+
const file = path8.join(directory, entry.name);
|
|
2390
2830
|
if (entry.isDirectory()) await walk(file);
|
|
2391
2831
|
else if (/\.(?:ts|tsx)$/u.test(entry.name)) texts.push(await readFile(file, "utf8"));
|
|
2392
2832
|
}
|
|
@@ -2404,13 +2844,13 @@ async function copySharedAssets(target, templateRootDirectory) {
|
|
|
2404
2844
|
};
|
|
2405
2845
|
for (const name of names) {
|
|
2406
2846
|
if (!copied(name)) continue;
|
|
2407
|
-
const destination =
|
|
2408
|
-
await mkdir(
|
|
2409
|
-
await cp(
|
|
2847
|
+
const destination = path8.join(target, "assets", name);
|
|
2848
|
+
await mkdir(path8.dirname(destination), { recursive: true });
|
|
2849
|
+
await cp(path8.join(shared, name), destination, { errorOnExist: true, force: false });
|
|
2410
2850
|
}
|
|
2411
2851
|
}
|
|
2412
2852
|
async function copyQualityConfig(target, templateRootDirectory) {
|
|
2413
|
-
const shared =
|
|
2853
|
+
const shared = path8.join(path8.dirname(templateRootDirectory), "template-assets", "quality");
|
|
2414
2854
|
if (!existsSync(shared)) throw new Error(`TN_QUALITY_CONFIG_MISSING: ${shared}`);
|
|
2415
2855
|
await cp(shared, target, { errorOnExist: true, recursive: true });
|
|
2416
2856
|
}
|
|
@@ -2423,7 +2863,7 @@ function nonEmptyString2(value, field, file) {
|
|
|
2423
2863
|
return value;
|
|
2424
2864
|
}
|
|
2425
2865
|
function loadManifest(directory) {
|
|
2426
|
-
const file =
|
|
2866
|
+
const file = path8.join(directory, "kit.json");
|
|
2427
2867
|
let raw;
|
|
2428
2868
|
try {
|
|
2429
2869
|
raw = readFileSync(file, "utf8");
|
|
@@ -2441,7 +2881,7 @@ function loadManifest(directory) {
|
|
|
2441
2881
|
if (typeof value !== "object" || value === null || Array.isArray(value))
|
|
2442
2882
|
return invalidManifest(file, "the root must be an object");
|
|
2443
2883
|
const record = value;
|
|
2444
|
-
const directoryName =
|
|
2884
|
+
const directoryName = path8.basename(directory);
|
|
2445
2885
|
const name = nonEmptyString2(record.name, "name", file);
|
|
2446
2886
|
if (!TEMPLATE_NAME.test(name))
|
|
2447
2887
|
return invalidManifest(file, "name must match /^[a-z][a-z0-9-]*$/");
|
|
@@ -2461,7 +2901,7 @@ function loadManifest(directory) {
|
|
|
2461
2901
|
};
|
|
2462
2902
|
}
|
|
2463
2903
|
function discoverKitManifests(root = templateRoot()) {
|
|
2464
|
-
return readdirSync(root, { withFileTypes: true }).filter((entry) => entry.isDirectory() && !entry.name.startsWith(".")).map((entry) => loadManifest(
|
|
2904
|
+
return readdirSync(root, { withFileTypes: true }).filter((entry) => entry.isDirectory() && !entry.name.startsWith(".")).map((entry) => loadManifest(path8.join(root, entry.name))).sort((left, right) => left.name.localeCompare(right.name));
|
|
2465
2905
|
}
|
|
2466
2906
|
function discoverTemplateNames(root = templateRoot()) {
|
|
2467
2907
|
return discoverKitManifests(root).map(({ name }) => name);
|
|
@@ -2507,7 +2947,7 @@ function scaffoldNextSteps(target, installed, servers = []) {
|
|
|
2507
2947
|
function projectMcpServers(target) {
|
|
2508
2948
|
try {
|
|
2509
2949
|
return Object.keys(
|
|
2510
|
-
JSON.parse(readFileSync(
|
|
2950
|
+
JSON.parse(readFileSync(path8.join(target, ".mcp.json"), "utf8")).mcpServers ?? {}
|
|
2511
2951
|
);
|
|
2512
2952
|
} catch {
|
|
2513
2953
|
return [];
|
|
@@ -2586,12 +3026,21 @@ function cliHelp() {
|
|
|
2586
3026
|
`;
|
|
2587
3027
|
}
|
|
2588
3028
|
function packageName(target) {
|
|
2589
|
-
const name =
|
|
3029
|
+
const name = path8.basename(target).toLowerCase().replace(/[^a-z0-9-_]+/g, "-");
|
|
2590
3030
|
if (name.length === 0 || name === "-" || name === "_") {
|
|
2591
3031
|
throw new Error(`Cannot derive a package name from '${target}'.`);
|
|
2592
3032
|
}
|
|
2593
3033
|
return name;
|
|
2594
3034
|
}
|
|
3035
|
+
function templateReplacements(target) {
|
|
3036
|
+
const projectName = packageName(target);
|
|
3037
|
+
const compactProjectId = projectName.toLowerCase().replace(/[^a-z0-9]+/gu, "") || "game";
|
|
3038
|
+
const projectId = /^[a-z]/u.test(compactProjectId) ? compactProjectId : `game${compactProjectId}`;
|
|
3039
|
+
return Object.fromEntries([
|
|
3040
|
+
["__PROJECT_NAME__", projectName],
|
|
3041
|
+
["__PROJECT_ID__", projectId]
|
|
3042
|
+
]);
|
|
3043
|
+
}
|
|
2595
3044
|
async function isEmpty(directory) {
|
|
2596
3045
|
const entries = await readdir(directory).catch(
|
|
2597
3046
|
(error) => error?.code === "ENOENT" ? [] : void 0
|
|
@@ -2609,12 +3058,12 @@ function substituteTemplateVariables(content, replacements) {
|
|
|
2609
3058
|
async function renderTemplate(directory, replacements) {
|
|
2610
3059
|
const files = await readdir(directory, { withFileTypes: true });
|
|
2611
3060
|
for (const entry of files) {
|
|
2612
|
-
const source =
|
|
3061
|
+
const source = path8.join(directory, entry.name);
|
|
2613
3062
|
if (entry.isDirectory()) {
|
|
2614
3063
|
await renderTemplate(source, replacements);
|
|
2615
3064
|
continue;
|
|
2616
3065
|
}
|
|
2617
|
-
if (!TEXT_FILE_EXTENSIONS.has(
|
|
3066
|
+
if (!TEXT_FILE_EXTENSIONS.has(path8.extname(entry.name))) continue;
|
|
2618
3067
|
const content = await readFile(source, "utf8");
|
|
2619
3068
|
let rendered = substituteTemplateVariables(content, replacements);
|
|
2620
3069
|
if (entry.name === "AGENTS.md" || entry.name === "CLAUDE.md") {
|
|
@@ -2629,6 +3078,8 @@ var AGENT_FILES_DIRECTORY = "agent-files";
|
|
|
2629
3078
|
var AUTHORING_GITIGNORE_RULES = [
|
|
2630
3079
|
"# ThreeNative local authoring state and dependency secrets",
|
|
2631
3080
|
".dream-loop/",
|
|
3081
|
+
// The discovery gate's per-session prompt time (PRD-827).
|
|
3082
|
+
".threenative/discovery-gate.json",
|
|
2632
3083
|
"node_modules/",
|
|
2633
3084
|
".env",
|
|
2634
3085
|
".env.*",
|
|
@@ -2644,27 +3095,28 @@ var REFERENCE_TOKEN_PATTERN = new RegExp(
|
|
|
2644
3095
|
"gu"
|
|
2645
3096
|
);
|
|
2646
3097
|
async function linkClaudeSkills(target) {
|
|
2647
|
-
const stored =
|
|
3098
|
+
const stored = path8.join(target, ".agents", "skills");
|
|
2648
3099
|
if (!existsSync(stored)) return;
|
|
2649
|
-
const hostSkills =
|
|
2650
|
-
const subagents =
|
|
3100
|
+
const hostSkills = path8.join(target, ".claude", "skills");
|
|
3101
|
+
const subagents = path8.join(target, ".claude", "agents");
|
|
2651
3102
|
await mkdir(hostSkills, { recursive: true });
|
|
2652
3103
|
for (const entry of await readdir(stored, { withFileTypes: true })) {
|
|
2653
3104
|
if (!entry.isDirectory()) continue;
|
|
2654
|
-
if (existsSync(
|
|
2655
|
-
const link =
|
|
2656
|
-
|
|
3105
|
+
if (existsSync(path8.join(subagents, `${entry.name}.md`))) continue;
|
|
3106
|
+
const link = path8.join(hostSkills, entry.name);
|
|
3107
|
+
if (await lstat(link).catch(() => void 0)) continue;
|
|
3108
|
+
const relative = path8.relative(hostSkills, path8.join(stored, entry.name));
|
|
2657
3109
|
try {
|
|
2658
3110
|
await symlink(relative, link, "dir");
|
|
2659
3111
|
} catch (error) {
|
|
2660
3112
|
const code = error.code;
|
|
2661
3113
|
if (code !== "EPERM" && code !== "EACCES") throw error;
|
|
2662
|
-
await cp(
|
|
3114
|
+
await cp(path8.join(stored, entry.name), link, { recursive: true });
|
|
2663
3115
|
}
|
|
2664
3116
|
}
|
|
2665
3117
|
}
|
|
2666
3118
|
async function copyAgentFiles(target, templateRootDirectory) {
|
|
2667
|
-
const source =
|
|
3119
|
+
const source = path8.join(path8.dirname(templateRootDirectory), AGENT_FILES_DIRECTORY);
|
|
2668
3120
|
if (!existsSync(source)) {
|
|
2669
3121
|
throw new Error(
|
|
2670
3122
|
`TN_AGENT_FILES_MISSING: '${source}' is not in the package; every generated project needs the canonical agent roles.`
|
|
@@ -2674,7 +3126,7 @@ async function copyAgentFiles(target, templateRootDirectory) {
|
|
|
2674
3126
|
await linkClaudeSkills(target);
|
|
2675
3127
|
}
|
|
2676
3128
|
async function installAuthoringGitignore(target) {
|
|
2677
|
-
const file =
|
|
3129
|
+
const file = path8.join(target, ".gitignore");
|
|
2678
3130
|
const existing = existsSync(file) ? await readFile(file, "utf8") : "";
|
|
2679
3131
|
const present = new Set(existing.split(/\r?\n/u));
|
|
2680
3132
|
const missing = AUTHORING_GITIGNORE_RULES.filter((entry) => !present.has(entry));
|
|
@@ -2688,8 +3140,8 @@ async function installAuthoringGitignore(target) {
|
|
|
2688
3140
|
);
|
|
2689
3141
|
}
|
|
2690
3142
|
async function assertReferenceBundle(target, templateRootDirectory) {
|
|
2691
|
-
const bundleDirectory =
|
|
2692
|
-
|
|
3143
|
+
const bundleDirectory = path8.join(
|
|
3144
|
+
path8.dirname(templateRootDirectory),
|
|
2693
3145
|
"agent-docs",
|
|
2694
3146
|
"references"
|
|
2695
3147
|
);
|
|
@@ -2701,7 +3153,7 @@ async function assertReferenceBundle(target, templateRootDirectory) {
|
|
|
2701
3153
|
".agents/skills/threenative-assets/SKILL.md",
|
|
2702
3154
|
".claude/skills/threenative-assets/SKILL.md"
|
|
2703
3155
|
]) {
|
|
2704
|
-
const filePath =
|
|
3156
|
+
const filePath = path8.join(target, file);
|
|
2705
3157
|
if (existsSync(filePath)) await assertReferenceTargets(file, filePath, bundleDirectory);
|
|
2706
3158
|
}
|
|
2707
3159
|
}
|
|
@@ -2715,7 +3167,7 @@ async function assertReferenceTargets(from, filePath, bundleDirectory) {
|
|
|
2715
3167
|
`RED observed: referenced recipe missing: '${from}' names '${referenced}', which is not a shipped reference page.`
|
|
2716
3168
|
);
|
|
2717
3169
|
}
|
|
2718
|
-
if (!existsSync(
|
|
3170
|
+
if (!existsSync(path8.join(bundleDirectory, referenced))) {
|
|
2719
3171
|
throw new Error(
|
|
2720
3172
|
`RED observed: referenced recipe missing: '${from}' links '${REFERENCE_BUNDLE_PREFIX}${referenced}', which the package does not ship.`
|
|
2721
3173
|
);
|
|
@@ -2723,12 +3175,17 @@ async function assertReferenceTargets(from, filePath, bundleDirectory) {
|
|
|
2723
3175
|
}
|
|
2724
3176
|
}
|
|
2725
3177
|
async function applyPackageSources(target, packageSources) {
|
|
2726
|
-
|
|
2727
|
-
const packagePath = path6.join(target, "package.json");
|
|
3178
|
+
const packagePath = path8.join(target, "package.json");
|
|
2728
3179
|
const packageJson = JSON.parse(await readFile(packagePath, "utf8"));
|
|
3180
|
+
packageJson.packageManager = SUPPORTED_PACKAGE_MANAGER;
|
|
3181
|
+
if (packageSources === void 0) {
|
|
3182
|
+
await writeFile(packagePath, `${JSON.stringify(packageJson, null, 2)}
|
|
3183
|
+
`);
|
|
3184
|
+
return;
|
|
3185
|
+
}
|
|
2729
3186
|
const localSource = (source) => {
|
|
2730
3187
|
const filePath = source.startsWith("file:") ? source.slice("file:".length) : source;
|
|
2731
|
-
return `file:${
|
|
3188
|
+
return `file:${path8.resolve(filePath)}`;
|
|
2732
3189
|
};
|
|
2733
3190
|
for (const [name, source] of Object.entries(packageSources)) {
|
|
2734
3191
|
if (source === void 0) continue;
|
|
@@ -2751,25 +3208,34 @@ async function applyPackageSources(target, packageSources) {
|
|
|
2751
3208
|
`);
|
|
2752
3209
|
}
|
|
2753
3210
|
var FRAMEWORK_PATCH_DIRECTORY = "patches";
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
3211
|
+
async function frameworkPatches(packageRoot) {
|
|
3212
|
+
const manifest = JSON.parse(
|
|
3213
|
+
await readFile(
|
|
3214
|
+
path8.join(packageRoot, "template-assets", FRAMEWORK_PATCH_DIRECTORY, "manifest.json"),
|
|
3215
|
+
"utf8"
|
|
3216
|
+
)
|
|
3217
|
+
);
|
|
3218
|
+
if (manifest.version !== 1 || !Array.isArray(manifest.patches)) {
|
|
3219
|
+
throw new Error("TN_FRAMEWORK_PATCH_MANIFEST: expected version 1 with a patches array.");
|
|
3220
|
+
}
|
|
3221
|
+
return manifest.patches;
|
|
3222
|
+
}
|
|
2759
3223
|
async function copyFrameworkPatches(target, templateRootDirectory) {
|
|
2760
|
-
const manifest = JSON.parse(await readFile(
|
|
2761
|
-
const packageRoot =
|
|
3224
|
+
const manifest = JSON.parse(await readFile(path8.join(target, "package.json"), "utf8"));
|
|
3225
|
+
const packageRoot = path8.dirname(templateRoot());
|
|
3226
|
+
const supported = await frameworkPatches(packageRoot);
|
|
3227
|
+
const repositoryRoot = path8.resolve(packageRoot, "..", "..");
|
|
2762
3228
|
for (const relative of Object.values(manifest.pnpm?.patchedDependencies ?? {})) {
|
|
2763
|
-
const name =
|
|
2764
|
-
const
|
|
2765
|
-
if (
|
|
3229
|
+
const name = path8.basename(relative);
|
|
3230
|
+
const patch = supported.find((candidate) => candidate.name === name);
|
|
3231
|
+
if (patch === void 0 || relative !== `${FRAMEWORK_PATCH_DIRECTORY}/${name}`) {
|
|
2766
3232
|
throw new Error(`TN_FRAMEWORK_PATCH_MISSING: unsupported template patch '${relative}'.`);
|
|
2767
3233
|
}
|
|
2768
|
-
const candidates = [.../* @__PURE__ */ new Set([
|
|
2769
|
-
(root) =>
|
|
3234
|
+
const candidates = [.../* @__PURE__ */ new Set([path8.dirname(templateRootDirectory), packageRoot])].map(
|
|
3235
|
+
(root) => path8.join(root, "template-assets", FRAMEWORK_PATCH_DIRECTORY, name)
|
|
2770
3236
|
);
|
|
2771
|
-
const canonical =
|
|
2772
|
-
if (existsSync(
|
|
3237
|
+
const canonical = path8.resolve(repositoryRoot, patch.source);
|
|
3238
|
+
if (existsSync(path8.join(packageRoot, "src", "index.ts"))) candidates.unshift(canonical);
|
|
2773
3239
|
else candidates.push(canonical);
|
|
2774
3240
|
const source = candidates.find((candidate) => existsSync(candidate));
|
|
2775
3241
|
if (source === void 0) {
|
|
@@ -2777,8 +3243,8 @@ async function copyFrameworkPatches(target, templateRootDirectory) {
|
|
|
2777
3243
|
`TN_FRAMEWORK_PATCH_MISSING: dependency patch '${name}' is absent from the CLI package.`
|
|
2778
3244
|
);
|
|
2779
3245
|
}
|
|
2780
|
-
const destination =
|
|
2781
|
-
await mkdir(
|
|
3246
|
+
const destination = path8.join(target, relative);
|
|
3247
|
+
await mkdir(path8.dirname(destination), { recursive: true });
|
|
2782
3248
|
await cp(source, destination);
|
|
2783
3249
|
}
|
|
2784
3250
|
}
|
|
@@ -2790,8 +3256,25 @@ function mcpPackageName(entry) {
|
|
|
2790
3256
|
const segments = entry.slice(NODE_MODULES_PREFIX.length).split("/");
|
|
2791
3257
|
return entry.startsWith(`${NODE_MODULES_PREFIX}@`) ? segments.slice(0, 2).join("/") : segments[0] ?? "";
|
|
2792
3258
|
}
|
|
3259
|
+
function writeHostMcpConfigs(target) {
|
|
3260
|
+
for (const [host, outcome] of ensureHostMcpConfigs(target)) {
|
|
3261
|
+
if (outcome === "unreadable" || outcome === "unwritable") {
|
|
3262
|
+
throw new Error(`TN_MCP_HOST_CONFIG: the ${host} MCP config is '${outcome}'.`);
|
|
3263
|
+
}
|
|
3264
|
+
}
|
|
3265
|
+
}
|
|
3266
|
+
function assertMcpShims(target) {
|
|
3267
|
+
if (!existsSync(path8.join(target, "node_modules"))) return;
|
|
3268
|
+
for (const [name, entry] of Object.entries(REQUIRED_MCP_SERVERS)) {
|
|
3269
|
+
if (existsSync(path8.resolve(target, entry))) continue;
|
|
3270
|
+
throw new Error(
|
|
3271
|
+
`MCP server '${name}' launches '${entry}', which this project does not have. Run 'pnpm install', or install one release of both: ${ENGINE_PAIR_UPGRADE}`
|
|
3272
|
+
);
|
|
3273
|
+
}
|
|
3274
|
+
}
|
|
2793
3275
|
async function assertMcpConfig(target) {
|
|
2794
|
-
|
|
3276
|
+
assertMcpShims(target);
|
|
3277
|
+
const configPath = path8.join(target, ".mcp.json");
|
|
2795
3278
|
const raw = await readFile(configPath, "utf8").catch(() => {
|
|
2796
3279
|
throw new Error(`Scaffold produced no .mcp.json at '${configPath}'.`);
|
|
2797
3280
|
});
|
|
@@ -2804,7 +3287,7 @@ async function assertMcpConfig(target) {
|
|
|
2804
3287
|
throw new Error(`'${configPath}' is missing required MCP server '${name}'.`);
|
|
2805
3288
|
}
|
|
2806
3289
|
}
|
|
2807
|
-
const manifest = JSON.parse(await readFile(
|
|
3290
|
+
const manifest = JSON.parse(await readFile(path8.join(target, "package.json"), "utf8"));
|
|
2808
3291
|
const declared = /* @__PURE__ */ new Set([
|
|
2809
3292
|
...Object.keys(manifest.dependencies ?? {}),
|
|
2810
3293
|
...Object.keys(manifest.devDependencies ?? {})
|
|
@@ -2838,7 +3321,7 @@ async function assertMcpConfig(target) {
|
|
|
2838
3321
|
);
|
|
2839
3322
|
}
|
|
2840
3323
|
}
|
|
2841
|
-
const codexPath =
|
|
3324
|
+
const codexPath = path8.join(target, ".codex", "config.toml");
|
|
2842
3325
|
const codex = await readFile(codexPath, "utf8").catch(() => {
|
|
2843
3326
|
throw new Error(`Scaffold produced no Codex MCP config at '${codexPath}'.`);
|
|
2844
3327
|
});
|
|
@@ -2848,6 +3331,149 @@ async function assertMcpConfig(target) {
|
|
|
2848
3331
|
}
|
|
2849
3332
|
}
|
|
2850
3333
|
}
|
|
3334
|
+
var AUTHORING_STAMP = path8.join(".threenative", "agent-files.json");
|
|
3335
|
+
var KIT_TITLE = /\bthe ([a-z][a-z0-9-]*) kit\b/u;
|
|
3336
|
+
var sha256 = (bytes) => createHash("sha256").update(bytes).digest("hex");
|
|
3337
|
+
async function fileHash(file) {
|
|
3338
|
+
return readFile(file).then(sha256, () => void 0);
|
|
3339
|
+
}
|
|
3340
|
+
async function hashFiles(directory, relative = "") {
|
|
3341
|
+
const hashes = {};
|
|
3342
|
+
for (const entry of await readdir(path8.join(directory, relative), { withFileTypes: true })) {
|
|
3343
|
+
const next = path8.posix.join(relative, entry.name);
|
|
3344
|
+
if (entry.isDirectory()) Object.assign(hashes, await hashFiles(directory, next));
|
|
3345
|
+
else if (entry.isFile()) hashes[next] = sha256(await readFile(path8.join(directory, next)));
|
|
3346
|
+
}
|
|
3347
|
+
return hashes;
|
|
3348
|
+
}
|
|
3349
|
+
async function renderedAuthoringLayer(target, kit, root, directory) {
|
|
3350
|
+
const into = directory ?? await mkdtemp(path8.join(tmpdir(), "threenative-authoring-"));
|
|
3351
|
+
try {
|
|
3352
|
+
for (const file of ["AGENTS.md", "CLAUDE.md"])
|
|
3353
|
+
await cp(path8.join(root, kit, file), path8.join(into, file));
|
|
3354
|
+
await copyAgentFiles(into, root);
|
|
3355
|
+
await renderTemplate(into, templateReplacements(target));
|
|
3356
|
+
return await hashFiles(into);
|
|
3357
|
+
} finally {
|
|
3358
|
+
if (directory === void 0) await rm(into, { force: true, recursive: true });
|
|
3359
|
+
}
|
|
3360
|
+
}
|
|
3361
|
+
function packageVersion(root) {
|
|
3362
|
+
const manifest = JSON.parse(
|
|
3363
|
+
readFileSync(path8.join(path8.dirname(root), "package.json"), "utf8")
|
|
3364
|
+
);
|
|
3365
|
+
if (typeof manifest.version !== "string")
|
|
3366
|
+
throw new Error("TN_AUTHORING_LAYER_VERSION: create-threenative has no version.");
|
|
3367
|
+
return manifest.version;
|
|
3368
|
+
}
|
|
3369
|
+
async function writeAuthoringStamp(target, kit, files, root) {
|
|
3370
|
+
const stamp = { createThreenative: packageVersion(root), kit, files };
|
|
3371
|
+
await mkdir(path8.join(target, path8.dirname(AUTHORING_STAMP)), { recursive: true });
|
|
3372
|
+
await writeFile(path8.join(target, AUTHORING_STAMP), `${JSON.stringify(stamp, null, 2)}
|
|
3373
|
+
`);
|
|
3374
|
+
}
|
|
3375
|
+
async function readJsonRecord(file) {
|
|
3376
|
+
const text = await readFile(file, "utf8").catch(() => void 0);
|
|
3377
|
+
if (text === void 0) return void 0;
|
|
3378
|
+
const value = JSON.parse(text);
|
|
3379
|
+
if (typeof value !== "object" || value === null || Array.isArray(value))
|
|
3380
|
+
throw new Error(`TN_AUTHORING_LAYER_STAMP: '${file}' is not a JSON object.`);
|
|
3381
|
+
return value;
|
|
3382
|
+
}
|
|
3383
|
+
async function gameKit(game, stamp, root) {
|
|
3384
|
+
const kits = discoverTemplateNames(root);
|
|
3385
|
+
const kitJson = (await readJsonRecord(path8.join(game, "kit.json")))?.name;
|
|
3386
|
+
const title = (await readFile(path8.join(game, "AGENTS.md"), "utf8").catch(() => "")).split("\n", 1)[0]?.trim();
|
|
3387
|
+
const titleKit = title === void 0 ? void 0 : KIT_TITLE.exec(title)?.[1] ?? title.split(" ").at(-1);
|
|
3388
|
+
return [stamp?.kit, kitJson, titleKit].find(
|
|
3389
|
+
(name) => typeof name === "string" && kits.includes(name)
|
|
3390
|
+
);
|
|
3391
|
+
}
|
|
3392
|
+
async function authoringContext(game, root) {
|
|
3393
|
+
const stamp = await readJsonRecord(path8.join(game, AUTHORING_STAMP));
|
|
3394
|
+
return { kit: await gameKit(game, stamp, root), stamp };
|
|
3395
|
+
}
|
|
3396
|
+
var NO_KIT = 'no stamp, kit.json or kit router title names a kit; write {"kit": "<kit>"} to .threenative/agent-files.json';
|
|
3397
|
+
var ENGINE_PAIR_UPGRADE = "pnpm up --latest create-threenative @threenative/*";
|
|
3398
|
+
async function installedCoreVersion(game) {
|
|
3399
|
+
const manifest = await readFile(
|
|
3400
|
+
path8.join(game, "node_modules", CORE_PACKAGE_NAME, "package.json"),
|
|
3401
|
+
"utf8"
|
|
3402
|
+
).catch(() => void 0);
|
|
3403
|
+
if (manifest === void 0) return void 0;
|
|
3404
|
+
try {
|
|
3405
|
+
const version = JSON.parse(manifest).version;
|
|
3406
|
+
return typeof version === "string" ? version : void 0;
|
|
3407
|
+
} catch {
|
|
3408
|
+
return void 0;
|
|
3409
|
+
}
|
|
3410
|
+
}
|
|
3411
|
+
async function assertEnginePair(game) {
|
|
3412
|
+
const installed = await installedCoreVersion(game);
|
|
3413
|
+
if (installed === CORE_PACKAGE_VERSION) return;
|
|
3414
|
+
const got = installed === void 0 ? "no installed core" : `${CORE_PACKAGE_NAME}@${installed}`;
|
|
3415
|
+
throw new Error(
|
|
3416
|
+
`TN_AUTHORING_LAYER_PAIR: this create-threenative pairs with ${CORE_PACKAGE_NAME}@${CORE_PACKAGE_VERSION}, and this game installs ${got}. Run '${ENGINE_PAIR_UPGRADE}' first, then 'pnpm exec threenative doctor --fix'.`
|
|
3417
|
+
);
|
|
3418
|
+
}
|
|
3419
|
+
async function authoringLayerStatus(game, root = templateRoot()) {
|
|
3420
|
+
const installed = packageVersion(root);
|
|
3421
|
+
const { kit, stamp } = await authoringContext(game, root);
|
|
3422
|
+
const stamped = stamp?.createThreenative;
|
|
3423
|
+
const versions = { installed, ...stamped === void 0 ? {} : { stamped } };
|
|
3424
|
+
if (kit === void 0) return { ...versions, problem: NO_KIT, stale: [] };
|
|
3425
|
+
const expected = await renderedAuthoringLayer(game, kit, root);
|
|
3426
|
+
const stale = [];
|
|
3427
|
+
for (const [file, hash] of Object.entries(expected))
|
|
3428
|
+
if (await fileHash(path8.join(game, file)) !== hash) stale.push(file);
|
|
3429
|
+
for (const file of Object.keys(stamp?.files ?? {}))
|
|
3430
|
+
if (!(file in expected) && existsSync(path8.join(game, file))) stale.push(file);
|
|
3431
|
+
return { ...versions, kit, stale: stale.sort() };
|
|
3432
|
+
}
|
|
3433
|
+
async function fixAuthoringLayer(game, options, root = templateRoot()) {
|
|
3434
|
+
await assertEnginePair(game);
|
|
3435
|
+
assertMcpShims(game);
|
|
3436
|
+
const { kit, stamp } = await authoringContext(game, root);
|
|
3437
|
+
if (kit === void 0) throw new Error(`TN_AUTHORING_LAYER_KIT: ${NO_KIT}.`);
|
|
3438
|
+
const stamped = stamp?.files ?? {};
|
|
3439
|
+
const rendered = await mkdtemp(path8.join(tmpdir(), "threenative-authoring-"));
|
|
3440
|
+
const result = { deleted: [], kept: [], written: [] };
|
|
3441
|
+
try {
|
|
3442
|
+
const expected = await renderedAuthoringLayer(game, kit, root, rendered);
|
|
3443
|
+
for (const [file, hash] of Object.entries(expected).sort(
|
|
3444
|
+
([left], [right]) => left < right ? -1 : 1
|
|
3445
|
+
)) {
|
|
3446
|
+
const current = await fileHash(path8.join(game, file));
|
|
3447
|
+
if (current === hash) continue;
|
|
3448
|
+
if (current !== void 0 && current !== stamped[file] && !options.force) {
|
|
3449
|
+
result.kept.push(file);
|
|
3450
|
+
continue;
|
|
3451
|
+
}
|
|
3452
|
+
await mkdir(path8.dirname(path8.join(game, file)), { recursive: true });
|
|
3453
|
+
await cp(path8.join(rendered, file), path8.join(game, file));
|
|
3454
|
+
result.written.push(file);
|
|
3455
|
+
}
|
|
3456
|
+
for (const file of Object.keys(stamped).sort()) {
|
|
3457
|
+
if (file in expected) continue;
|
|
3458
|
+
const current = await fileHash(path8.join(game, file));
|
|
3459
|
+
if (current === void 0) continue;
|
|
3460
|
+
if (current !== stamped[file] && !options.force) result.kept.push(file);
|
|
3461
|
+
else {
|
|
3462
|
+
await rm(path8.join(game, file));
|
|
3463
|
+
result.deleted.push(file);
|
|
3464
|
+
}
|
|
3465
|
+
}
|
|
3466
|
+
await linkClaudeSkills(game);
|
|
3467
|
+
writeHostMcpConfigs(game);
|
|
3468
|
+
await assertMcpConfig(game);
|
|
3469
|
+
await installAuthoringGitignore(game);
|
|
3470
|
+
await assertReferenceBundle(game, root);
|
|
3471
|
+
await writeAuthoringStamp(game, kit, expected, root);
|
|
3472
|
+
} finally {
|
|
3473
|
+
await rm(rendered, { force: true, recursive: true });
|
|
3474
|
+
}
|
|
3475
|
+
return result;
|
|
3476
|
+
}
|
|
2851
3477
|
async function runInstall(target) {
|
|
2852
3478
|
await new Promise((resolve, reject) => {
|
|
2853
3479
|
const child = spawn("pnpm", ["install"], { cwd: target, stdio: "inherit" });
|
|
@@ -2864,14 +3490,14 @@ async function discardScaffold(target, existedBefore) {
|
|
|
2864
3490
|
return;
|
|
2865
3491
|
}
|
|
2866
3492
|
for (const entry of await readdir(target)) {
|
|
2867
|
-
await rm(
|
|
3493
|
+
await rm(path8.join(target, entry), { force: true, recursive: true });
|
|
2868
3494
|
}
|
|
2869
3495
|
}
|
|
2870
3496
|
async function createProject(options, cwd = process.cwd(), root = templateRoot()) {
|
|
2871
3497
|
const manifests = discoverKitManifests(root);
|
|
2872
3498
|
const template = options.template ?? DEFAULT_TEMPLATE;
|
|
2873
3499
|
if (!manifests.some(({ name }) => name === template)) kitManifest(template, root);
|
|
2874
|
-
const target =
|
|
3500
|
+
const target = path8.resolve(cwd, options.target);
|
|
2875
3501
|
const targetExists = await isEmpty(target).catch(() => false);
|
|
2876
3502
|
if (!targetExists) {
|
|
2877
3503
|
throw new Error(`Target '${target}' already exists and is not empty.`);
|
|
@@ -2880,32 +3506,34 @@ async function createProject(options, cwd = process.cwd(), root = templateRoot()
|
|
|
2880
3506
|
await mkdir(target, { recursive: true });
|
|
2881
3507
|
const installed = options.install ?? true;
|
|
2882
3508
|
try {
|
|
2883
|
-
const source =
|
|
3509
|
+
const source = path8.join(root, template);
|
|
2884
3510
|
await cp(source, target, { recursive: true, errorOnExist: true });
|
|
3511
|
+
await rm(path8.join(target, "kit.json"), { force: true });
|
|
2885
3512
|
if (["starter", "collectathon", "adventure", "kart"].includes(template))
|
|
2886
|
-
for (const relative of
|
|
2887
|
-
await cp(canonicalRenderSourcePath(relative, root),
|
|
3513
|
+
for (const relative of ADDED_RENDER_SOURCES)
|
|
3514
|
+
await cp(canonicalRenderSourcePath(relative, root), path8.join(target, relative));
|
|
2888
3515
|
await copyTemplateIcon(target, root);
|
|
2889
3516
|
await copySharedAssets(target, root);
|
|
2890
3517
|
await copyQualityConfig(target, root);
|
|
2891
|
-
if (existsSync(
|
|
2892
|
-
await rename(
|
|
3518
|
+
if (existsSync(path8.join(target, "gitignore"))) {
|
|
3519
|
+
await rename(path8.join(target, "gitignore"), path8.join(target, ".gitignore"));
|
|
2893
3520
|
}
|
|
2894
3521
|
await installAuthoringGitignore(target);
|
|
2895
|
-
const
|
|
2896
|
-
const compactProjectId = projectName.toLowerCase().replace(/[^a-z0-9]+/gu, "") || "game";
|
|
2897
|
-
const projectId = /^[a-z]/u.test(compactProjectId) ? compactProjectId : `game${compactProjectId}`;
|
|
2898
|
-
const replacements = Object.fromEntries([
|
|
2899
|
-
["__PROJECT_NAME__", projectName],
|
|
2900
|
-
["__PROJECT_ID__", projectId]
|
|
2901
|
-
]);
|
|
3522
|
+
const replacements = templateReplacements(target);
|
|
2902
3523
|
await stampTemplateLoading(target, source, root);
|
|
2903
3524
|
await copyAgentFiles(target, root);
|
|
2904
3525
|
await renderTemplate(target, replacements);
|
|
2905
3526
|
await copyFrameworkPatches(target, root);
|
|
2906
3527
|
await applyPackageSources(target, options.packageSources);
|
|
3528
|
+
writeHostMcpConfigs(target);
|
|
2907
3529
|
await assertMcpConfig(target);
|
|
2908
3530
|
await assertReferenceBundle(target, root);
|
|
3531
|
+
await writeAuthoringStamp(
|
|
3532
|
+
target,
|
|
3533
|
+
template,
|
|
3534
|
+
await renderedAuthoringLayer(target, template, root),
|
|
3535
|
+
root
|
|
3536
|
+
);
|
|
2909
3537
|
if (installed) await runInstall(target);
|
|
2910
3538
|
} catch (error) {
|
|
2911
3539
|
await discardScaffold(target, existedBefore);
|
|
@@ -3024,7 +3652,7 @@ async function main() {
|
|
|
3024
3652
|
);
|
|
3025
3653
|
}
|
|
3026
3654
|
var entryPath = process.argv[1];
|
|
3027
|
-
if (entryPath !== void 0 && existsSync(entryPath) && realpathSync(
|
|
3655
|
+
if (entryPath !== void 0 && existsSync(entryPath) && realpathSync(path8.resolve(entryPath)) === realpathSync(fileURLToPath(import.meta.url))) {
|
|
3028
3656
|
main().catch((error) => {
|
|
3029
3657
|
process.stderr.write(`${error instanceof Error ? error.message : String(error)}
|
|
3030
3658
|
`);
|
|
@@ -3032,4 +3660,4 @@ if (entryPath !== void 0 && existsSync(entryPath) && realpathSync(path6.resolve(
|
|
|
3032
3660
|
});
|
|
3033
3661
|
}
|
|
3034
3662
|
|
|
3035
|
-
export { SHARED_RENDER_SOURCES, canonicalLoadingPath, canonicalRenderSourcePath, cliHelp, createEngineFreshnessPlugin, createProject, createWebBrandPlugin, discoverKitManifests, discoverStampedTemplates, discoverTemplateNames, hashEngineDist, kitManifest, packageNameFromFlag, parseArgs, projectMcpServers, referenceDigest, renderWebManifest, restampSharedRenderCopies, restampTemplateLoadingCopies, scaffoldCompletionMessage, scaffoldNextSteps, stampLoadingSource, templateForGenre, templateRoot, webRuntimeDecoders };
|
|
3663
|
+
export { ADDED_RENDER_SOURCES, SHARED_RENDER_SOURCES, authoringLayerStatus, canonicalLoadingPath, canonicalRenderSourcePath, cliHelp, createEngineCatalogPlugin, createEngineFreshnessPlugin, createProject, createWebBrandPlugin, discoverKitManifests, discoverStampedTemplates, discoverTemplateNames, fixAuthoringLayer, hashEngineDist, kitManifest, packageNameFromFlag, parseArgs, projectMcpServers, referenceDigest, renderWebManifest, restampSharedRenderCopies, restampTemplateLoadingCopies, scaffoldCompletionMessage, scaffoldNextSteps, stampLoadingSource, templateForGenre, templateRoot, webRuntimeDecoders };
|