@wildshard/engine 0.1.17 → 0.1.19
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/CHANGELOG.md +16 -0
- package/budgets/shard-size-baseline.json +10 -4
- package/index.html +6 -4
- package/lint/engine-sides.json +21 -0
- package/lint/host-callback-syntax.mjs +2 -1
- package/lint/host-callbacks.mjs +3 -3
- package/lint/host-files.mjs +5 -4
- package/lint/no-base64.mjs +3 -1
- package/lint/ratchet.json +0 -68
- package/lint/ratchet.mjs +1 -4
- package/lint/shard-imports.mjs +6 -7
- package/lint/shard-source.d.mts +9 -0
- package/lint/shard-source.mjs +91 -0
- package/lint/shardfile-boundaries.mjs +10 -8
- package/lint/sim-closure.mjs +6 -3
- package/lint/wildshard-plugin.d.ts +4 -0
- package/lint/wildshard-plugin.js +22 -23
- package/package.json +25 -16
- package/scripts/agent-sync.mjs +27 -8
- package/scripts/app-build/appCook.ts +8 -2
- package/scripts/app-build/catalogue.ts +10 -7
- package/scripts/app-build/gen.ts +22 -2
- package/scripts/app-build/isolation.d.mts +10 -0
- package/scripts/app-build/isolation.mjs +47 -0
- package/scripts/app-build/outputProducts.d.mts +3 -0
- package/scripts/app-build/outputProducts.mjs +35 -0
- package/scripts/app-build/previousDeploy.d.mts +2 -0
- package/scripts/app-build/previousDeploy.mjs +10 -1
- package/scripts/app-build/serviceWorker.ts +10 -3
- package/scripts/app-build/splitOutput.mjs +4 -2
- package/scripts/app-build/standaloneOutput.d.mts +1 -1
- package/scripts/app-build/standaloneOutput.mjs +5 -3
- package/scripts/app-build/titlePreloads.d.mts +8 -0
- package/scripts/app-build/titlePreloads.mjs +69 -0
- package/scripts/app-build/worldMapAtlas.ts +10 -6
- package/scripts/app-build-pipeline.mjs +34 -3
- package/scripts/built-product.mjs +1 -1
- package/scripts/cell-mem-bench.mjs +81 -23
- package/scripts/check-custom-sections-zero.mjs +1 -1
- package/scripts/check-devserver.mjs +3 -1
- package/scripts/check-models.mjs +2 -0
- package/scripts/check-paths.allow.json +0 -115
- package/scripts/check-paths.mjs +2 -2
- package/scripts/check-platform-ratchets.mjs +2 -3
- package/scripts/chromium-keychain-check.mjs +4 -2
- package/scripts/chromium-keychain.d.mts +1 -1
- package/scripts/chromium-keychain.mjs +3 -1
- package/scripts/ci-static.sh +1 -1
- package/scripts/committed-fast-checks.mjs +0 -2
- package/scripts/content-sw-proof.mjs +2 -1
- package/scripts/cook-worker.mjs +9 -3
- package/scripts/cook.mjs +20 -3
- package/scripts/devices.d.mts +4 -0
- package/scripts/devices.mjs +39 -0
- package/scripts/devserver-client.d.mts +4 -2
- package/scripts/devserver-client.mjs +25 -8
- package/scripts/docs-inputs-proof.mjs +6 -6
- package/scripts/doctor-proof.mjs +1 -1
- package/scripts/e2e-faults.mjs +159 -0
- package/scripts/e7-voice-staging-proof.mjs +1 -1
- package/scripts/gate-related-tests.mjs +1 -1
- package/scripts/git-source-view.mjs +1 -1
- package/scripts/goldens/capture.mjs +17 -5
- package/scripts/grid-crossing-nightly.mjs +59 -0
- package/scripts/grid-crossing-qa.mjs +44 -0
- package/scripts/grid-crossing-ratchet.d.mts +6 -0
- package/scripts/grid-crossing-ratchet.mjs +52 -0
- package/scripts/grid-crossing-report.mjs +122 -0
- package/scripts/grid-crossing-stages.mjs +47 -0
- package/scripts/grid-crossing-tour.mjs +277 -0
- package/scripts/grid-crossing-walk-proof.mjs +136 -18
- package/scripts/host-ruler/roots.mjs +2 -2
- package/scripts/host-ruler.d.mts +91 -0
- package/scripts/host-ruler.mjs +565 -0
- package/scripts/live-prepush.py +3 -5
- package/scripts/loading-flow/benchmax.mjs +3 -1
- package/scripts/look-loop/test_look_loop.py +1 -38
- package/scripts/memory-proof.mjs +213 -0
- package/scripts/mmo-bots.mjs +8 -2
- package/scripts/net-lag-proof.mjs +219 -0
- package/scripts/night-market-kit-budget.mjs +2 -2
- package/scripts/offline-proof-rules.d.mts +5 -3
- package/scripts/offline-proof-rules.mjs +34 -7
- package/scripts/offline-proof.mjs +88 -18
- package/scripts/{shard-platform-output.mjs → output-reader.mjs} +1 -1
- package/scripts/page-release/content.d.mts +9 -1
- package/scripts/page-release/content.mjs +131 -17
- package/scripts/page-release/flow.mjs +36 -10
- package/scripts/page-release/stamp-content.mjs +24 -0
- package/scripts/page-release.mjs +28 -6
- package/scripts/page-size.mjs +2 -1
- package/scripts/pin-packs.ts +1 -1
- package/scripts/pins.ts +4 -4
- package/scripts/precommit-checks.mjs +1 -7
- package/scripts/precommit-jobs.mjs +0 -1
- package/scripts/precommit-source.py +1 -9
- package/scripts/program-discovery.mjs +1 -1
- package/scripts/ring-cook.mjs +2 -1
- package/scripts/ring-step.ts +1 -1
- package/scripts/script-scenario-metrics.mjs +1 -1
- package/scripts/shard-output-content.d.mts +1 -1
- package/scripts/shard-output-content.mjs +2 -2
- package/scripts/shard-outputs.mjs +1 -1
- package/scripts/shard-public.mjs +1 -1
- package/scripts/shard-wire-meter.mjs +24 -9
- package/scripts/side-parity.mjs +4 -2
- package/scripts/standalone-smoke.mjs +8 -3
- package/scripts/tier-textures-proof.mjs +101 -0
- package/scripts/tier-textures.mjs +78 -0
- package/scripts/tile-bake-report.mjs +1 -1
- package/scripts/tile-bakes.mjs +1 -1
- package/scripts/title-assets.generated.json +2 -0
- package/scripts/tsconfig.json +1 -2
- package/scripts/vendor/basisu/LICENSE +201 -0
- package/scripts/vendor/basisu/basis_encoder.cjs +2 -0
- package/scripts/vendor/basisu/basis_encoder.wasm +0 -0
- package/scripts/vitest-push-guards.config.ts +1 -1
- package/scripts/vps/harden-apply.sh +4 -1
- package/scripts/vps/harden-prometheus.sh +176 -0
- package/scripts/vps/harden.sh +16 -0
- package/scripts/vps/rebuild.sh +18 -0
- package/scripts/vps/wildshard-config +84 -24
- package/scripts/worker-client-play.mjs +7 -2
- package/scripts/worker-client-proof.mjs +1 -1
- package/scripts/worker-client-slug.mjs +44 -0
- package/scripts/worktree-reap.mjs +5 -5
- package/src/.oxlintrc.json +3 -182
- package/src/client/app/entry.ts +47 -12
- package/src/client/engine/boot/bootCache.ts +2 -2
- package/src/client/engine/boot/bootTrace.ts +12 -4
- package/src/client/engine/boot/browserChunkRecovery.ts +4 -0
- package/src/client/engine/boot/clearDownloads.ts +5 -2
- package/src/client/engine/boot/contentRead.ts +11 -0
- package/src/client/engine/boot/gpuFiles.ts +4 -2
- package/src/client/engine/boot/lastEnd.ts +99 -12
- package/src/client/engine/boot/parsedPages.ts +127 -58
- package/src/client/engine/boot/texturePack.ts +2 -2
- package/src/client/engine/build.d.ts +2 -0
- package/src/client/engine/core/Game.ts +18 -0
- package/src/client/engine/core/bootstrap.ts +4 -1
- package/src/client/engine/debug/probe.ts +18 -1
- package/src/client/engine/fx/LightPool.ts +41 -1
- package/src/client/engine/net/netPlayer.ts +19 -2
- package/src/client/engine/net/otherPlayers.ts +55 -8
- package/src/client/engine/net/predictor.ts +33 -9
- package/src/client/engine/net/redial.ts +29 -6
- package/src/client/engine/pwa/cacheNames.ts +58 -1
- package/src/client/engine/pwa/sw.js +53 -14
- package/src/client/engine/render/dataLook.ts +152 -40
- package/src/client/engine/render/families/detail.ts +89 -0
- package/src/client/engine/render/families/pbr.ts +7 -1
- package/src/client/engine/render/look.ts +6 -0
- package/src/client/engine/render/lookLight.ts +103 -11
- package/src/client/engine/render/lookRender.ts +105 -0
- package/src/client/engine/render/precompile.ts +20 -14
- package/src/client/engine/saves/indexed.ts +2 -2
- package/src/client/engine/telemetry/browserErrors.ts +28 -4
- package/src/client/engine/telemetry/deviceSnapshot.ts +155 -0
- package/src/client/engine/telemetry/staleBuildReport.ts +22 -1
- package/src/client/engine/ui/debugOptions.ts +1 -1
- package/src/client/engine/ui/lookLightOption.ts +10 -6
- package/src/client/engine/ui/namePrompt.ts +7 -0
- package/src/client/game/boot/audio.generated.ts +114 -216
- package/src/client/game/boot/bytes.generated.ts +118 -238
- package/src/client/game/boot/placedSpawn.ts +35 -0
- package/src/client/game/boot/spawnDownload.ts +25 -6
- package/src/client/game/boot/versions.generated.ts +7 -7
- package/src/client/game/devScene/hook.ts +291 -0
- package/src/client/game/grid/area.ts +38 -0
- package/src/client/game/grid/cellLoading.ts +12 -2
- package/src/client/game/grid/live.ts +134 -12
- package/src/client/game/grid/liveSession.ts +47 -5
- package/src/client/game/grid/mapAtlas.ts +18 -4
- package/src/client/game/grid/menu.ts +4 -0
- package/src/client/game/grid/minimapBlend.ts +15 -5
- package/src/client/game/grid/neighbourPanels.ts +10 -1
- package/src/client/game/grid/oneWayIn.ts +5 -1
- package/src/client/game/grid/placedCards.ts +55 -0
- package/src/client/game/grid/placedCells.ts +233 -0
- package/src/client/game/grid/placedContent.ts +85 -0
- package/src/client/game/grid/prefetch.ts +9 -1
- package/src/client/game/grid/productInputs.ts +3 -1
- package/src/client/game/grid/productLeases.ts +4 -1
- package/src/client/game/grid/products.ts +8 -4
- package/src/client/game/grid/regionalRuntime.ts +6 -0
- package/src/client/game/grid/regionalWorld.ts +15 -2
- package/src/client/game/grid/roadCull.ts +44 -14
- package/src/client/game/grid/roadLook.ts +24 -15
- package/src/client/game/grid/roadLookPlatform.ts +4 -2
- package/src/client/game/grid/roadResources.ts +24 -0
- package/src/client/game/grid/roadSign.worker.ts +4 -3
- package/src/client/game/grid/roadSignPaint.ts +16 -5
- package/src/client/game/grid/roadSignPreparation.ts +4 -3
- package/src/client/game/grid/roadSignScale.ts +8 -0
- package/src/client/game/grid/roadTileBacking.ts +13 -3
- package/src/client/game/grid/roadTileCapture.worker.ts +3 -1
- package/src/client/game/grid/roadTileCaptureWorker.ts +2 -1
- package/src/client/game/grid/roadTileWrite.worker.ts +4 -2
- package/src/client/game/grid/roadTileWriter.ts +2 -1
- package/src/client/game/grid/screenReports.ts +39 -0
- package/src/client/game/grid/session.ts +29 -4
- package/src/client/game/grid/shardfileFar.ts +9 -3
- package/src/client/game/grid/softWallLook.ts +25 -8
- package/src/client/game/mainMenu.ts +6 -2
- package/src/client/game/plugin/context.ts +2 -1
- package/src/client/game/plugin/followedMovers.ts +7 -1
- package/src/client/game/quest/figures.ts +2 -0
- package/src/client/game/session/finish.ts +11 -1
- package/src/client/game/shard/titleList.ts +6 -2
- package/src/client/game/shardfile/assetCache.ts +4 -4
- package/src/client/game/shardfile/client.ts +4 -1
- package/src/client/game/shardfile/clientAssets.ts +9 -5
- package/src/client/game/shardfile/clientLibrary.ts +1 -1
- package/src/client/game/shardfile/clientWater.ts +51 -9
- package/src/client/game/shardfile/clientWorker.ts +21 -8
- package/src/client/game/shardfile/look.ts +8 -3
- package/src/client/game/shardfile/product.ts +34 -7
- package/src/client/game/shardfile/productChecks.ts +2 -2
- package/src/client/game/shardfile/productCost.ts +2 -2
- package/src/client/game/shardfile/readAsset.ts +2 -2
- package/src/client/game/shardfile/reflectingWater.ts +73 -0
- package/src/client/game/shardfile/seatGrace.ts +9 -0
- package/src/client/game/shardfile/skinPlayback.ts +1 -1
- package/src/client/game/systems/npc/figureRows.ts +9 -0
- package/src/client/game/titleDeck.ts +4 -3
- package/src/client/host/online/doctor.ts +2 -0
- package/src/client/host/online/linkScreens.ts +30 -4
- package/src/client/host/online/shell.ts +14 -0
- package/src/client/host/standalone/shell.ts +4 -0
- package/src/cook/game/astc6Encode.ts +55 -0
- package/src/cook/game/astc6Wasm.ts +176 -0
- package/src/cook/game/cookJob.ts +30 -6
- package/src/cook/game/cookWorker.ts +38 -11
- package/src/cook/game/entryTotals.ts +51 -24
- package/src/cook/game/shardCook.ts +67 -9
- package/src/cook/game/spawnParts.ts +33 -8
- package/src/cook/game/tierTextures.ts +349 -0
- package/src/e2e/smoke/game.ts +19 -14
- package/src/e2e/smoke/page-globals.d.ts +9 -8
- package/src/e2e/smoke/template2.spec.ts +8 -7
- package/src/server/engine/ai/bossContenders.ts +27 -3
- package/src/server/engine/ai/phases.ts +1 -1
- package/src/server/engine/entities/creatureRefill.ts +9 -2
- package/src/server/engine/net/ledgerBook.ts +2 -0
- package/src/server/engine/net/room.ts +15 -0
- package/src/server/engine/sim/respawn.ts +8 -0
- package/src/server/game/boss/arenaRoomEntry.ts +5 -1
- package/src/server/game/boss/arenaRoomNative.ts +2 -0
- package/src/server/game/boss/native.ts +2 -1
- package/src/server/game/boss/nativeWake.ts +9 -5
- package/src/server/game/boss/openArenaNative.ts +2 -2
- package/src/server/game/boss/openArenaRoom.ts +3 -1
- package/src/server/game/grid/room.ts +44 -3
- package/src/server/game/grid/simulation.ts +23 -0
- package/src/server/game/population/mixedRoster.ts +11 -3
- package/src/server/game/population/nativeBake.ts +8 -3
- package/src/server/game/population/nativeReturns.ts +6 -3
- package/src/server/game/population/roster.ts +5 -3
- package/src/server/game/quest/eliteDrops.ts +15 -4
- package/src/server/game/quest/nativeChapter.ts +1 -1
- package/src/server/game/quest/nativeComposition.ts +5 -1
- package/src/server/game/riding/nativeTaming.ts +10 -6
- package/src/server/game/riding/wildRefill.ts +3 -2
- package/src/server/game/shardfile/bossRow.ts +4 -2
- package/src/server/game/shardfile/homeKeeper.ts +4 -2
- package/src/server/host/bake/headlessWorker.ts +1 -1
- package/src/server/host/dedicated/cellHost.ts +98 -16
- package/src/server/host/dedicated/cellProtocol.ts +16 -1
- package/src/server/host/dedicated/cellWorker.ts +8 -5
- package/src/server/host/dedicated/dedicatedRoom.ts +16 -6
- package/src/server/host/dedicated/gridCells.ts +15 -6
- package/src/server/host/dedicated/loopLag.ts +21 -0
- package/src/server/host/dedicated/main.ts +13 -5
- package/src/server/host/dedicated/packReader.ts +3 -3
- package/src/server/host/dedicated/placementFile.ts +4 -19
- package/src/server/host/dedicated/roadRoom.ts +34 -4
- package/src/server/host/dedicated/serverMetrics.ts +126 -0
- package/src/server/host/dedicated/socketPump.ts +21 -4
- package/src/server/host/dedicated/socketTransport.ts +2 -1
- package/src/server/host/dedicated/workerTable.ts +15 -4
- package/src/server/host/dedicated/world.ts +95 -8
- package/src/server/host/headless.ts +1 -1
- package/src/server/host/headlessRuntime.ts +1 -1
- package/src/server/host/standalone/roadWorld.ts +15 -3
- package/src/server/host/standalone/serverHost.ts +4 -1
- package/src/server/host/standalone/serverProduct.ts +41 -11
- package/src/shared/engine/ai/BossBrain.ts +8 -0
- package/src/shared/engine/net/deviceWord.ts +138 -0
- package/src/shared/engine/net/socketFrames.ts +7 -4
- package/src/shared/game/boss/wake.ts +6 -0
- package/src/shared/game/devColliders.ts +47 -0
- package/src/shared/game/eliteSystem.ts +8 -0
- package/src/shared/game/grid/allocator.ts +3 -0
- package/src/shared/game/grid/catalogueSlot.ts +7 -0
- package/src/shared/game/grid/placementRows.ts +36 -0
- package/src/shared/game/plugin/bossRecord.ts +3 -2
- package/src/shared/game/shardfile/ktx2Targets.ts +23 -3
- package/src/shared/game/shardfile/outputDescriptor.ts +9 -5
- package/src/shared/game/shardfile/packReads.ts +28 -3
- package/src/shared/game/shardfile/serverPack.ts +9 -0
- package/src/shared/game/systems/looks/trampleField.ts +2 -0
- package/src/shared/host/formatJsonSchema.ts +2 -2
- package/src/tsconfig.json +1 -27
- package/lint/host-reviews.json +0 -14
- package/lint/listed-view-code.json +0 -13
- package/lint/platform-pending-users.json +0 -2520
- package/lint/platform-pending-users.md +0 -18
- package/scripts/cell-mem/metrics-preload.mjs +0 -65
- package/scripts/check-closed-components.d.mts +0 -7
- package/scripts/check-closed-components.mjs +0 -87
- package/scripts/g571-hosts.d.mts +0 -3
- package/scripts/g571-hosts.mjs +0 -54
- package/scripts/host-ruler/register-migrate.mjs +0 -242
- package/scripts/listed-view-code.d.mts +0 -7
- package/scripts/listed-view-code.mjs +0 -93
- package/scripts/look-loop/fit-lut.py +0 -142
- package/scripts/look-loop/palette-delta.py +0 -183
- package/scripts/look-loop/regions/driftwood-isle.json +0 -25
- package/scripts/look-loop/regions/far-reach.json +0 -225
- package/scripts/look-loop/regions/open-plot-night-market.json +0 -855
- package/scripts/look-loop/regions/pine-hollow.json +0 -22
- package/scripts/look-loop/regions/sunscar-dunes.json +0 -281
- package/scripts/platform-chargebacks.d.mts +0 -9
- package/scripts/platform-chargebacks.mjs +0 -135
- package/scripts/shard-component-spans.d.mts +0 -15
- package/scripts/shard-component-spans.mjs +0 -18
- package/scripts/shard-components.d.mts +0 -16
- package/scripts/shard-components.mjs +0 -363
- package/scripts/shard-platform-hosts.d.mts +0 -2
- package/scripts/shard-platform-hosts.mjs +0 -93
- package/scripts/shard-platform-sections.d.mts +0 -2
- package/scripts/shard-platform-sections.mjs +0 -9
- package/scripts/shard-platform.d.mts +0 -76
- package/scripts/shard-platform.mjs +0 -1072
- package/src/.oxfmtrc.json +0 -48
- package/src/scripts/ask-new.sh +0 -29
- package/src/scripts/asks.mjs +0 -142
- package/src/scripts/herdr-prompt.sh +0 -34
- package/src/scripts/herdr-question-open.sh +0 -67
- package/src/scripts/md-wrap.mjs +0 -229
- /package/scripts/{shard-platform-format.d.mts → node-format.d.mts} +0 -0
- /package/scripts/{shard-platform-format.mjs → node-format.mjs} +0 -0
- /package/scripts/{shard-platform-output.d.mts → output-reader.d.mts} +0 -0
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
import { existsSync, readFileSync } from 'node:fs';
|
|
3
3
|
import { dirname, relative, resolve } from 'node:path';
|
|
4
4
|
import { parseSync } from 'vite';
|
|
5
|
+
import { shardFile } from './shard-source.mjs';
|
|
5
6
|
|
|
6
7
|
const BUILD = /^(?:data|generators|bake|behaviour|assets|blender)(?:\/|$)|^shard\.config(?:\.[cm]?[jt]s)?$/u;
|
|
7
8
|
const PLAY = /^(?:runtime|world|look|models|weapons|quest|quests|combat|species|creatures|npc|loadout|ride|vm|grapple|life|compendium|boot|debug|dev|playground|explore|audio|loot|onboarding)(?:\/|$)/u;
|
|
8
|
-
|
|
9
|
+
/** [source path, slug, shard-local path] for `path` (relative to `root`, either layout, SA45), or null. */
|
|
10
|
+
const shard = (root, path) => { const found = shardFile(root, path); return found === null ? null : [found.path, found.slug, found.local]; };
|
|
9
11
|
const text = node => node?.type === 'Literal' && typeof node.value === 'string' ? node.value
|
|
10
12
|
: node?.type === 'TemplateLiteral' && node.expressions.length === 0 ? node.quasis[0]?.value.cooked ?? null : null;
|
|
11
13
|
const prefix = node => text(node) ?? (node?.type === 'TemplateLiteral' ? node.quasis[0]?.value.cooked
|
|
@@ -34,8 +36,8 @@ function target(root, file, source) {
|
|
|
34
36
|
}
|
|
35
37
|
|
|
36
38
|
function violation(root, file, source, computed, glob, rule) {
|
|
37
|
-
const own = shard(file), dest = source === null ? null : target(root, file, source);
|
|
38
|
-
const other = dest === null ? null : shard(dest);
|
|
39
|
+
const own = shard(root, file), dest = source === null ? null : target(root, file, source);
|
|
40
|
+
const other = dest === null ? null : shard(root, dest);
|
|
39
41
|
const build = own !== null && BUILD.test(own[2]);
|
|
40
42
|
if (rule === 'runtime-standalone') {
|
|
41
43
|
if (own === null || !own[2].startsWith('runtime/')) return null;
|
|
@@ -43,14 +45,14 @@ function violation(root, file, source, computed, glob, rule) {
|
|
|
43
45
|
if (/[?#]/u.test(source)) return 'runtime/ cannot import assets, JSON, ?raw or ?url; read the admitted product instead';
|
|
44
46
|
if (/\.[^/]+$/u.test(source) && !/\.[cm]?[jt]sx?$/u.test(source)) return `runtime/ cannot import JSON or assets: ${source}; read the admitted product instead`;
|
|
45
47
|
if (dest === null) return publicPackage(root, source) ? null : `runtime/ imports only its own files and public engine/game/SDK/format, three or valibot modules: ${source}`;
|
|
46
|
-
if (!
|
|
48
|
+
if (other?.[1] !== own[1] || !other[2].startsWith('runtime/')) return `runtime/ is standalone: ${source} leaves its own runtime/; read a built section or move play code into runtime/`;
|
|
47
49
|
if (/\.[^/]+$/u.test(dest) && !/\.[cm]?tsx?$/u.test(dest) || glob && !/\.[cm]?tsx?$/u.test(dest)) return `runtime/ cannot import JSON or assets: ${source}; read the admitted product instead`;
|
|
48
50
|
return null;
|
|
49
51
|
}
|
|
50
52
|
if (rule === 'no-build-time-import') {
|
|
51
53
|
if (!file.startsWith('src/') || file.startsWith('src/commons/') || /^src\/sharddev\/(?:cli|bake)\//u.test(file)) return null;
|
|
52
54
|
if (other === null || !BUILD.test(other[2])) {
|
|
53
|
-
return computed && dest?.startsWith('src/shards/') && !build ? `Play code cannot compute a path into shard build-time folders: ${source}` : null;
|
|
55
|
+
return computed && (other !== null || dest?.startsWith('src/shards/') === true) && !build ? `Play code cannot compute a path into shard build-time folders: ${source}` : null;
|
|
54
56
|
}
|
|
55
57
|
if (build && own[1] === other[1]) return null;
|
|
56
58
|
return `Play code cannot import build-time code: ${source}; read it from the built shard's sections or blobs`;
|
|
@@ -64,7 +66,7 @@ function violation(root, file, source, computed, glob, rule) {
|
|
|
64
66
|
|
|
65
67
|
/** Same AST visitors for the linter and copier. Type-only, lazy and resource imports are all boundaries. */
|
|
66
68
|
export function shardfileBoundaryVisitors(root, file, rule, report) {
|
|
67
|
-
const own = shard(file);
|
|
69
|
+
const own = shard(root, file);
|
|
68
70
|
if (rule === 'runtime-standalone' && !own?.[2].startsWith('runtime/')) return {};
|
|
69
71
|
if (rule === 'no-runtime-in-build' && (own === null || !BUILD.test(own[2]))) return {};
|
|
70
72
|
const check = (node, raw, glob = false) => {
|
|
@@ -83,7 +85,7 @@ export function shardfileBoundaryVisitors(root, file, rule, report) {
|
|
|
83
85
|
if (node.callee.type === 'Identifier' && node.callee.name === 'require') check(node, node.arguments[0]);
|
|
84
86
|
if ((member(node.callee, 'glob') || member(node.callee, 'globEager')) && importMeta(node.callee.object)) {
|
|
85
87
|
const raw = node.arguments[0], patterns = raw?.type === 'ArrayExpression' ? raw.elements : [raw];
|
|
86
|
-
if (rule === 'runtime-standalone' &&
|
|
88
|
+
if (rule === 'runtime-standalone' && own?.[2].startsWith('runtime/') && node.arguments[1]?.type === 'ObjectExpression'
|
|
87
89
|
&& node.arguments[1].properties.some(property => ['query', 'as'].includes(property.key?.name ?? text(property.key)))) {
|
|
88
90
|
report(node, 'runtime/ globs cannot transform modules into assets with query/as');
|
|
89
91
|
}
|
|
@@ -99,7 +101,7 @@ export function shardfileBoundaryVisitors(root, file, rule, report) {
|
|
|
99
101
|
};
|
|
100
102
|
}
|
|
101
103
|
|
|
102
|
-
/** Raw violations, without migration allowances. `file` is
|
|
104
|
+
/** Raw violations, without migration allowances. `file` is relative to `root`: src/shards/<slug>/... or a single-shard src/... (SA45).
|
|
103
105
|
* @returns {{rule: string, message: string, start: number, end: number}[]} */
|
|
104
106
|
export function shardfileBoundaryViolations(root, file, source) {
|
|
105
107
|
const parsed = parseSync(file, source);
|
package/lint/sim-closure.mjs
CHANGED
|
@@ -4,6 +4,7 @@ import { currentSources, sourceStamp } from './source-stamps.mjs';
|
|
|
4
4
|
import { existsSync, readFileSync, globSync, statSync } from 'node:fs';
|
|
5
5
|
import { dirname, resolve, relative } from 'node:path';
|
|
6
6
|
import { parseSync } from 'vite';
|
|
7
|
+
import { shardFile } from './shard-source.mjs';
|
|
7
8
|
|
|
8
9
|
const VIEW = /^src\/(?:client|cook|server|shared)\/engine\/(?:app\/view\/|ai\/view\/|combat\/view\/|quest\/view(?:\/|\.ts$)|saves\/view\/|entities\/AnimalView\.ts$)/u;
|
|
9
10
|
const FORBIDDEN = /^src\/(?:client|cook|server|shared)\/engine\/(?:app\/runtime(?:\.ts)?$|core\/(?:tier|frameCost)(?:\.ts)?$|render\/|ui\/|fx\/|anim\/)/u;
|
|
@@ -61,7 +62,9 @@ export function reference(node, parent) {
|
|
|
61
62
|
return true;
|
|
62
63
|
}
|
|
63
64
|
const closureResults = new Map();
|
|
64
|
-
|
|
65
|
+
/** simRoot of `path` (relative to `root`) read in the one shard layout, so a single-shard repo's src/data/ counts (SA45). */
|
|
66
|
+
const simRootIn = (root, path) => simRoot(shardFile(root, path)?.path ?? path);
|
|
67
|
+
export function simClosure(root, entries = globSync('src/**/*.ts', { cwd: root }).filter(path => simRootIn(root, path))) {
|
|
65
68
|
const key = JSON.stringify([root, entries]), cached = closureResults.get(key);
|
|
66
69
|
const copy = rows => rows.map(row => ({ ...row, trace: [...row.trace] }));
|
|
67
70
|
if (cached !== undefined && currentSources(cached.observed)) return copy(cached.rows);
|
|
@@ -78,7 +81,7 @@ export function simClosure(root, entries = globSync('src/**/*.ts', { cwd: root }
|
|
|
78
81
|
};
|
|
79
82
|
const inspect = (node, parent) => {
|
|
80
83
|
if (['ImportDeclaration', 'ExportNamedDeclaration', 'ExportAllDeclaration', 'ImportExpression'].includes(node.type)) {
|
|
81
|
-
if (
|
|
84
|
+
if (simRootIn(root, path) && value(node.source) === 'three' && node.importKind === 'type' && node.specifiers?.some((s) => s.type !== 'ImportSpecifier' || !MATH.has(s.imported.name))) add('import', 'three');
|
|
82
85
|
if (node.importKind === 'type' || node.exportKind === 'type' || (node.specifiers?.length && node.specifiers.every((s) => s.importKind === 'type'))) return;
|
|
83
86
|
const source = value(node.source);
|
|
84
87
|
if (source === null) { if (node.source) add('import', 'dynamic'); return; }
|
|
@@ -97,7 +100,7 @@ export function simClosure(root, entries = globSync('src/**/*.ts', { cwd: root }
|
|
|
97
100
|
if (FORBIDDEN.test(destPath) || VIEW.test(destPath)) add('import', destPath);
|
|
98
101
|
else if (/\.[cm]?[jt]s$/u.test(destPath)) next.push(destPath);
|
|
99
102
|
}
|
|
100
|
-
if (
|
|
103
|
+
if (simRootIn(root, path) && node.type === 'Identifier' && ['HTMLElement', 'HTMLCanvasElement'].includes(node.name) && parent?.type === 'TSTypeReference') add('global', node.name);
|
|
101
104
|
if (node.type === 'MemberExpression' && ['window', 'globalThis'].includes(node.object?.name) && DOM.has(node.property?.name) && node.property?.name !== 'window') add('global', node.property.name);
|
|
102
105
|
if (node.type === 'Identifier' && reference(node, parent) && DOM.has(node.name)) add('global', node.name);
|
|
103
106
|
};
|
|
@@ -11,3 +11,7 @@ export const VIEW_PATHS: readonly string[];
|
|
|
11
11
|
|
|
12
12
|
/** G645 product-surface rules that do not apply to colocated test fixtures. */
|
|
13
13
|
export const TEST_DOMAIN_RUNTIME_RULES: readonly string[];
|
|
14
|
+
|
|
15
|
+
/** The oxlint JS plugin: its name and every rule, keyed without the `wildshard/` prefix. */
|
|
16
|
+
declare const plugin: { readonly meta: { readonly name: string }; readonly rules: Readonly<Record<string, unknown>> };
|
|
17
|
+
export default plugin;
|
package/lint/wildshard-plugin.js
CHANGED
|
@@ -23,7 +23,7 @@ import { declarationConfigProgram } from './declaration-config.mjs';
|
|
|
23
23
|
// parameter it is (`num('scale', 1)`) — anything else is an error;
|
|
24
24
|
// · raw parsing of `location.search` (`.includes`, `.match`, regex `.test`, …) that dodges the above.
|
|
25
25
|
import { existsSync, readFileSync } from 'node:fs';
|
|
26
|
-
import { dirname,
|
|
26
|
+
import { dirname, resolve } from 'node:path';
|
|
27
27
|
import { fileURLToPath } from 'node:url';
|
|
28
28
|
import { simClosure, simRoot } from './sim-closure.mjs';
|
|
29
29
|
import { authoredHtmlSites } from './authored-html.mjs';
|
|
@@ -32,6 +32,7 @@ import { shardGameImport, shardEngineImport, sharddevRuntimeImport, generatorImp
|
|
|
32
32
|
import { shardfileBoundaryVisitors } from './shardfile-boundaries.mjs';
|
|
33
33
|
import { hostCallbackSites } from './host-callback-syntax.mjs';
|
|
34
34
|
import { hostPlayFile } from './host-files.mjs';
|
|
35
|
+
import { lintFile } from './shard-source.mjs';
|
|
35
36
|
|
|
36
37
|
const REPO = fileURLToPath(new URL('../', import.meta.url));
|
|
37
38
|
/** E432: the layers are workspace packages, `@wildshard/<layer>[/<sub>]` → `src/<layer>/<sub | index>`. Whether a
|
|
@@ -289,23 +290,23 @@ const noUrlSwitch = {
|
|
|
289
290
|
|
|
290
291
|
// E357 F4: syntactic ratchets; their scope and patterns are 01 §24 / 02 F4's contract.
|
|
291
292
|
// Filenames and lexical import paths are immutable during one plugin process.
|
|
293
|
+
// SA45: a single-shard repo's `src/<local>` reads as `src/shards/<slug>/<local>` (lint/shard-source.mjs), so every shard
|
|
294
|
+
// rule below matches one layout; `fileOf` keeps the real repo root and path for the rules that open files on disk.
|
|
292
295
|
const filenamePaths = new Map(), modulePaths = new Map();
|
|
293
|
-
const
|
|
296
|
+
const fileOf = (context) => {
|
|
294
297
|
const cached = filenamePaths.get(context.filename);
|
|
295
298
|
if (cached !== undefined) return cached;
|
|
296
|
-
const
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
filenamePaths.set(context.filename, normalized);
|
|
300
|
-
return normalized;
|
|
299
|
+
const file = lintFile(context.filename, REPO);
|
|
300
|
+
filenamePaths.set(context.filename, file);
|
|
301
|
+
return file;
|
|
301
302
|
};
|
|
303
|
+
const pathOf = (context) => fileOf(context).path;
|
|
302
304
|
const modulePath = (filename, source) => {
|
|
303
305
|
let paths = modulePaths.get(filename);
|
|
304
306
|
if (paths === undefined) { paths = new Map(); modulePaths.set(filename, paths); }
|
|
305
307
|
if (paths.has(source)) return paths.get(source);
|
|
306
308
|
const target = packageTarget(source);
|
|
307
|
-
const path = target ?? (!source.startsWith('.') ? source
|
|
308
|
-
: relative(REPO, resolve(dirname(filename), source)).replaceAll('\\', '/').replace(/^.*\/src\//u, 'src/'));
|
|
309
|
+
const path = target ?? (!source.startsWith('.') ? source : lintFile(resolve(dirname(filename), source), REPO).path);
|
|
309
310
|
paths.set(source, path);
|
|
310
311
|
return path;
|
|
311
312
|
};
|
|
@@ -579,9 +580,8 @@ const simAllow = JSON.parse(readFileSync(new URL('sim-closure.json', import.meta
|
|
|
579
580
|
const simNoRender = rule('Headless simulation checks its complete runtime import closure (SF3a)', (context) => {
|
|
580
581
|
if (!simRoot(pathOf(context))) return {};
|
|
581
582
|
return { Program(node) {
|
|
582
|
-
const
|
|
583
|
-
const
|
|
584
|
-
for (const item of simClosure(root, [pathOf(context)])) {
|
|
583
|
+
const { root, file } = fileOf(context);
|
|
584
|
+
for (const item of simClosure(root, [file])) {
|
|
585
585
|
const allowance = root === REPO.replace(/\/$/u, '') ? simAllow[item.id]?.count ?? 0 : 0;
|
|
586
586
|
if (item.count > allowance) report(context, node, `Simulation closure: ${item.id} (${item.count} > ${allowance}); ${item.trace.join(' → ')}`);
|
|
587
587
|
}
|
|
@@ -976,14 +976,12 @@ const shardHostCallback = {
|
|
|
976
976
|
meta: { type: 'problem', docs: { description: 'Shard host APIs take data, not TS callbacks (G454)' },
|
|
977
977
|
schema: [{ type: 'object', properties: { count: { type: 'boolean' } }, additionalProperties: false }] },
|
|
978
978
|
create(context) {
|
|
979
|
-
const file =
|
|
979
|
+
const { root, file: real, path: file } = fileOf(context);
|
|
980
980
|
if (!file.startsWith('src/shards/')) return {};
|
|
981
|
-
|
|
982
|
-
const root = index === -1 ? REPO : context.filename.slice(0, index);
|
|
983
|
-
if (!hostPlayFile(root, file)) return {};
|
|
981
|
+
if (!hostPlayFile(root, real)) return {};
|
|
984
982
|
const limit = context.options[0]?.count === true ? 0 : shardfileDebt['wildshard/no-shard-host-callback']?.[file] ?? 0;
|
|
985
983
|
return { 'Program:exit'(program) {
|
|
986
|
-
for (const issue of hostCallbackSites(root,
|
|
984
|
+
for (const issue of hostCallbackSites(root, real, program).slice(limit)) context.report({
|
|
987
985
|
loc: { start: context.sourceCode.getLocFromIndex(issue.start), end: context.sourceCode.getLocFromIndex(issue.end) }, message: issue.message,
|
|
988
986
|
});
|
|
989
987
|
} };
|
|
@@ -993,15 +991,13 @@ const shardfileBoundaryRule = name => ({
|
|
|
993
991
|
meta: { type: 'problem', docs: { description: `Shardfile source boundary: ${name} (G450)` },
|
|
994
992
|
schema: [{ type: 'object', properties: { count: { type: 'boolean' }, closedShards: { type: 'array', items: { type: 'string' }, uniqueItems: true } }, additionalProperties: false }] },
|
|
995
993
|
create(context) {
|
|
996
|
-
const file =
|
|
994
|
+
const { root, file: real, path: file } = fileOf(context);
|
|
997
995
|
if (name === 'runtime-standalone') return {};
|
|
998
|
-
const index = context.filename.replaceAll('\\', '/').lastIndexOf('/src/');
|
|
999
|
-
const root = index === -1 ? REPO : context.filename.slice(0, index);
|
|
1000
996
|
const slug = /^src\/shards\/([^/]+)\//u.exec(file)?.[1];
|
|
1001
997
|
const closed = context.options[0]?.closedShards?.includes(slug) === true;
|
|
1002
998
|
const limit = closed || context.options[0]?.count === true ? 0 : shardfileDebt[`wildshard/${name}`]?.[file] ?? 0;
|
|
1003
999
|
let count = 0;
|
|
1004
|
-
return shardfileBoundaryVisitors(root,
|
|
1000
|
+
return shardfileBoundaryVisitors(root, real, name, (node, message) => {
|
|
1005
1001
|
count += 1;
|
|
1006
1002
|
if (count > limit) report(context, node, message);
|
|
1007
1003
|
});
|
|
@@ -1014,8 +1010,11 @@ const shardfileBoundaryRule = name => ({
|
|
|
1014
1010
|
const blenderTargetsFile = resolve(process.cwd(), 'scripts/blender/targets.json'); // Shard lint: blender sources left with the shards.
|
|
1015
1011
|
const blenderTargets = existsSync(blenderTargetsFile) ? JSON.parse(readFileSync(blenderTargetsFile, 'utf8')).targets : [];
|
|
1016
1012
|
const blenderSources = new Set();
|
|
1017
|
-
for (const target of Object.values(blenderTargets)) for (const
|
|
1018
|
-
|
|
1013
|
+
for (const target of Object.values(blenderTargets)) for (const entry of [target.script, target.post, ...(target.sources ?? [])]) {
|
|
1014
|
+
// SA45: an entry names the real file (`src/blender/…` in a single-shard repo) or already the source path.
|
|
1015
|
+
const file = typeof entry !== 'string' ? null : entry.startsWith('src/shards/') ? entry : lintFile(resolve(process.cwd(), entry), REPO).path;
|
|
1016
|
+
if (file !== null && /^src\/shards\/[^/]+\/blender\/.+\.[cm]?[jt]sx?$/u.test(file)) blenderSources.add(file);
|
|
1017
|
+
}
|
|
1019
1018
|
|
|
1020
1019
|
// F3: hard structural boundary. No count option or debt allowance exists.
|
|
1021
1020
|
const noShardRuntime = rule('Primary shards contain authoring and declarations only (G694 F3)', context => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wildshard/engine",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.19",
|
|
4
4
|
"description": "The Wildshard engine: one repo with shared, client, server and cook code and three build targets (client, dedicated server, standalone listen server), shaped like Unreal or Source.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"repository": {
|
|
@@ -24,13 +24,14 @@
|
|
|
24
24
|
"build": "node src/tools/build-web.ts",
|
|
25
25
|
"typecheck": "pnpm typecheck:kit && pnpm gen:inputs && npr tsc -b tsconfig.layers.json --builders 8",
|
|
26
26
|
"lint": "pnpm lint:kit && pnpm lint:game",
|
|
27
|
-
"lint:fix": "node scripts/lint-cli.mjs -c src/.oxlintrc.json --type-aware --fix --ignore-pattern '.githooks/**' --ignore-pattern '.agents/**' --ignore-pattern 'tmp/**' --ignore-pattern 'src/client/engine/**' --ignore-pattern 'src/shared/engine/**' --ignore-pattern 'src/server/engine/**' --ignore-pattern 'src/client/game/**' --ignore-pattern 'src/shared/game/**' --ignore-pattern 'src/server/game/**' --ignore-pattern 'src/cook/game/**' --ignore-pattern 'src/client/host/**' --ignore-pattern 'src/shared/host/**' --ignore-pattern 'src/server/host/**' --ignore-pattern 'src/client/app/**' --ignore-pattern 'src/test/engine/**' --ignore-pattern 'src/test/game/**' --ignore-pattern 'scripts/**' --ignore-pattern 'test/**' --ignore-pattern 'lint/**' --ignore-pattern 'vite/**' --ignore-pattern 'types/**' --ignore-pattern 'calibration/**' --ignore-pattern 'budgets/**' --ignore-pattern 'public/**' --ignore-pattern 'vite.config.ts' --ignore-pattern 'vitest.config.ts'",
|
|
28
|
-
"format": "npr oxfmt -c
|
|
29
|
-
"format:check": "npr oxfmt -c
|
|
27
|
+
"lint:fix": "node scripts/lint-cli.mjs -c kit/.oxlintrc.json --type-aware --fix --ignore-pattern '.githooks/**' --ignore-pattern '.agents/**' --ignore-pattern 'tmp/**' --ignore-pattern 'src/client/engine/**' --ignore-pattern 'src/shared/engine/**' --ignore-pattern 'src/server/engine/**' --ignore-pattern 'src/client/game/**' --ignore-pattern 'src/shared/game/**' --ignore-pattern 'src/server/game/**' --ignore-pattern 'src/cook/game/**' --ignore-pattern 'src/client/host/**' --ignore-pattern 'src/shared/host/**' --ignore-pattern 'src/server/host/**' --ignore-pattern 'src/client/app/**' --ignore-pattern 'src/test/engine/**' --ignore-pattern 'src/test/game/**' --ignore-pattern 'scripts/**' --ignore-pattern 'test/**' --ignore-pattern 'lint/**' --ignore-pattern 'vite/**' --ignore-pattern 'types/**' --ignore-pattern 'calibration/**' --ignore-pattern 'budgets/**' --ignore-pattern 'public/**' --ignore-pattern 'vite.config.ts' --ignore-pattern 'vitest.config.ts' --ignore-pattern 'src/**' --no-error-on-unmatched-pattern && node scripts/lint-cli.mjs -c src/.oxlintrc.json --type-aware --fix --ignore-pattern '.githooks/**' --ignore-pattern '.agents/**' --ignore-pattern 'tmp/**' --ignore-pattern 'src/client/engine/**' --ignore-pattern 'src/shared/engine/**' --ignore-pattern 'src/server/engine/**' --ignore-pattern 'src/client/game/**' --ignore-pattern 'src/shared/game/**' --ignore-pattern 'src/server/game/**' --ignore-pattern 'src/cook/game/**' --ignore-pattern 'src/client/host/**' --ignore-pattern 'src/shared/host/**' --ignore-pattern 'src/server/host/**' --ignore-pattern 'src/client/app/**' --ignore-pattern 'src/test/engine/**' --ignore-pattern 'src/test/game/**' --ignore-pattern 'scripts/**' --ignore-pattern 'test/**' --ignore-pattern 'lint/**' --ignore-pattern 'vite/**' --ignore-pattern 'types/**' --ignore-pattern 'calibration/**' --ignore-pattern 'budgets/**' --ignore-pattern 'public/**' --ignore-pattern 'vite.config.ts' --ignore-pattern 'vitest.config.ts' --no-error-on-unmatched-pattern src",
|
|
28
|
+
"format": "npr oxfmt -c kit/.oxfmtrc.json kit src/cli src/tools src/e2e src/scripts",
|
|
29
|
+
"format:check": "npr oxfmt -c kit/.oxfmtrc.json --check kit src/cli src/tools src/e2e src/scripts",
|
|
30
30
|
"test": "pnpm test:kit && pnpm test:fast",
|
|
31
31
|
"test:e2e": "playwright test --config src/e2e/playwright.config.ts",
|
|
32
|
+
"test:e2e:faults": "node scripts/e2e-faults.mjs",
|
|
32
33
|
"check:sides": "node src/scripts/check-sides.mjs && node scripts/check-engine-sides.mjs",
|
|
33
|
-
"check:asks": "node
|
|
34
|
+
"check:asks": "node kit/scripts/asks.mjs check",
|
|
34
35
|
"check:agents": "node .githooks/agents-md.mjs lint",
|
|
35
36
|
"check:parity": "node scripts/agent-parity.mjs --strict",
|
|
36
37
|
"check:agent-sync": "node scripts/agent-sync.mjs --check",
|
|
@@ -39,12 +40,12 @@
|
|
|
39
40
|
"check:page-events": "node scripts/check-page-events.mjs",
|
|
40
41
|
"check:wire": "node node_modules/@wildshard/wire/bin.mjs check",
|
|
41
42
|
"check:saves": "env -u WS_PUSH_GATE_PROFILE -u WS_CPU_ADMISSION vitest run test/saves-lock.test.ts",
|
|
42
|
-
"md:wrap": "node
|
|
43
|
+
"md:wrap": "node kit/scripts/md-wrap.mjs",
|
|
43
44
|
"inbox:pull": "node scripts/inbox-pull.mjs",
|
|
44
45
|
"test:hooks": "node --test '.githooks/*.test.mjs'",
|
|
45
46
|
"check": "pnpm typecheck && pnpm lint && pnpm format:check && pnpm test && pnpm check:sides && pnpm check:asks && pnpm check:agents && pnpm check:agent-sync && pnpm test:agent-hooks && pnpm check:parity && pnpm check:page-events && pnpm check:wire && pnpm check:saves",
|
|
46
47
|
"typecheck:kit": "npr tsc -p src/tsconfig.json && npr tsc -p src/client/tsconfig.json",
|
|
47
|
-
"lint:kit": "node scripts/lint-cli.mjs -c src/.oxlintrc.json --type-aware --deny-warnings --ignore-pattern '.githooks/**' --ignore-pattern '.agents/**' --ignore-pattern 'tmp/**' --ignore-pattern 'src/client/engine/**' --ignore-pattern 'src/shared/engine/**' --ignore-pattern 'src/server/engine/**' --ignore-pattern 'src/client/game/**' --ignore-pattern 'src/shared/game/**' --ignore-pattern 'src/server/game/**' --ignore-pattern 'src/cook/game/**' --ignore-pattern 'src/client/host/**' --ignore-pattern 'src/shared/host/**' --ignore-pattern 'src/server/host/**' --ignore-pattern 'src/client/app/**' --ignore-pattern 'src/test/engine/**' --ignore-pattern 'src/test/game/**' --ignore-pattern 'scripts/**' --ignore-pattern 'test/**' --ignore-pattern 'lint/**' --ignore-pattern 'vite/**' --ignore-pattern 'types/**' --ignore-pattern 'calibration/**' --ignore-pattern 'budgets/**' --ignore-pattern 'public/**' --ignore-pattern 'vite.config.ts' --ignore-pattern 'vitest.config.ts'",
|
|
48
|
+
"lint:kit": "node scripts/lint-cli.mjs -c kit/.oxlintrc.json --type-aware --deny-warnings --ignore-pattern '.githooks/**' --ignore-pattern '.agents/**' --ignore-pattern 'tmp/**' --ignore-pattern 'src/client/engine/**' --ignore-pattern 'src/shared/engine/**' --ignore-pattern 'src/server/engine/**' --ignore-pattern 'src/client/game/**' --ignore-pattern 'src/shared/game/**' --ignore-pattern 'src/server/game/**' --ignore-pattern 'src/cook/game/**' --ignore-pattern 'src/client/host/**' --ignore-pattern 'src/shared/host/**' --ignore-pattern 'src/server/host/**' --ignore-pattern 'src/client/app/**' --ignore-pattern 'src/test/engine/**' --ignore-pattern 'src/test/game/**' --ignore-pattern 'scripts/**' --ignore-pattern 'test/**' --ignore-pattern 'lint/**' --ignore-pattern 'vite/**' --ignore-pattern 'types/**' --ignore-pattern 'calibration/**' --ignore-pattern 'budgets/**' --ignore-pattern 'public/**' --ignore-pattern 'vite.config.ts' --ignore-pattern 'vitest.config.ts' --ignore-pattern 'src/**' --no-error-on-unmatched-pattern && node scripts/lint-cli.mjs -c src/.oxlintrc.json --type-aware --deny-warnings --ignore-pattern '.githooks/**' --ignore-pattern '.agents/**' --ignore-pattern 'tmp/**' --ignore-pattern 'src/client/engine/**' --ignore-pattern 'src/shared/engine/**' --ignore-pattern 'src/server/engine/**' --ignore-pattern 'src/client/game/**' --ignore-pattern 'src/shared/game/**' --ignore-pattern 'src/server/game/**' --ignore-pattern 'src/cook/game/**' --ignore-pattern 'src/client/host/**' --ignore-pattern 'src/shared/host/**' --ignore-pattern 'src/server/host/**' --ignore-pattern 'src/client/app/**' --ignore-pattern 'src/test/engine/**' --ignore-pattern 'src/test/game/**' --ignore-pattern 'scripts/**' --ignore-pattern 'test/**' --ignore-pattern 'lint/**' --ignore-pattern 'vite/**' --ignore-pattern 'types/**' --ignore-pattern 'calibration/**' --ignore-pattern 'budgets/**' --ignore-pattern 'public/**' --ignore-pattern 'vite.config.ts' --ignore-pattern 'vitest.config.ts' --no-error-on-unmatched-pattern src",
|
|
48
49
|
"lint:game": "node scripts/lint-game.mjs",
|
|
49
50
|
"test:kit": "node --test 'src/cli/*.test.ts' 'src/server/*.test.ts' 'src/test/helpers/*.test.ts'",
|
|
50
51
|
"test:fast": "python3 scripts/heavy-lane.py full-test -- node scripts/vitest-tmp.ts run",
|
|
@@ -56,16 +57,17 @@
|
|
|
56
57
|
"ring:1": "bash scripts/ring1.sh all",
|
|
57
58
|
"lint:typed": "node scripts/lint-all.mjs",
|
|
58
59
|
"test:checks": "pnpm gen && node scripts/check-graph.mjs --source-only && node scripts/check-engine-sides.mjs && node scripts/check-sim-players.mjs",
|
|
59
|
-
"build:game": "python3 scripts/heavy-lane.py build -- bash -c 'node scripts/pins.ts install && node scripts/gen.mjs --inputs-only && npr tsc -b tsconfig.layers.json --builders 1 && WILDSHARD_CATALOGUE
|
|
60
|
+
"build:game": "python3 scripts/heavy-lane.py build -- bash -c 'node scripts/pins.ts install && node scripts/gen.mjs --inputs-only && npr tsc -b tsconfig.layers.json --builders 1 && WILDSHARD_CATALOGUE=\"${WILDSHARD_CATALOGUE:-test/pins/catalogue.json}\" node scripts/build-app.mjs && node scripts/check-devserver.mjs dist && node scripts/app-build/splitOutput.mjs dist && node scripts/page-size.mjs dist --gate'",
|
|
60
61
|
"tools:install": "npr install --frozen"
|
|
61
62
|
},
|
|
62
63
|
"dependencies": {
|
|
63
64
|
"@dimforge/rapier3d-simd": "0.21.0",
|
|
64
65
|
"@hono/node-server": "2.1.5",
|
|
66
|
+
"@prometheus-io/client": "0.16.1",
|
|
65
67
|
"@sentry/browser": "11.0.0",
|
|
66
68
|
"@sentry/core": "11.0.0",
|
|
67
69
|
"@valibot/to-json-schema": "1.8.0",
|
|
68
|
-
"@wildshard/format": "npm:@wildshard/shard-format@^0.
|
|
70
|
+
"@wildshard/format": "npm:@wildshard/shard-format@^0.5.2",
|
|
69
71
|
"@wildshard/wire": "^0.1.0",
|
|
70
72
|
"ajv": "6.15.0",
|
|
71
73
|
"fflate": "0.8.3",
|
|
@@ -245,6 +247,7 @@
|
|
|
245
247
|
"./ai/director": "./src/shared/engine/ai/director.ts",
|
|
246
248
|
"./fx/effectField": "./src/client/engine/fx/effectField.ts",
|
|
247
249
|
"./core/deflate": "./src/client/engine/core/deflate.ts",
|
|
250
|
+
"./core/apiOrigin": "./src/client/engine/core/apiOrigin.ts",
|
|
248
251
|
"./world/weatherContinuation": "./src/shared/engine/world/weatherContinuation.ts",
|
|
249
252
|
"./audio/declaredAmbience": "./src/client/engine/audio/declaredAmbience.ts",
|
|
250
253
|
"./audio/declaredBank": "./src/client/engine/audio/declaredBank.ts",
|
|
@@ -792,6 +795,7 @@
|
|
|
792
795
|
"./ui/StartTitle": "./src/client/engine/ui/StartTitle.ts",
|
|
793
796
|
"./telemetry/browserErrors": "./src/client/engine/telemetry/browserErrors.ts",
|
|
794
797
|
"./telemetry/runtime": "./src/client/engine/telemetry/runtime.ts",
|
|
798
|
+
"./telemetry/deviceSnapshot": "./src/client/engine/telemetry/deviceSnapshot.ts",
|
|
795
799
|
"./practice/TrainingDummy": "./src/client/engine/practice/TrainingDummy.ts",
|
|
796
800
|
"./practice/DummyMotion": "./src/client/engine/practice/DummyMotion.ts",
|
|
797
801
|
"./practice/DummyClips": "./src/client/engine/practice/DummyClips.ts",
|
|
@@ -888,7 +892,11 @@
|
|
|
888
892
|
"./game/grid/gridCollision": "./src/shared/game/grid/gridCollision.ts",
|
|
889
893
|
"./game/grid/voidFloor": "./src/shared/game/grid/voidFloor.ts",
|
|
890
894
|
"./game/grid/assembly": "./src/shared/game/grid/assembly.ts",
|
|
895
|
+
"./game/devColliders": "./src/shared/game/devColliders.ts",
|
|
891
896
|
"./game/grid/catalogueSlot": "./src/shared/game/grid/catalogueSlot.ts",
|
|
897
|
+
"./game/grid/placedCells": "./src/client/game/grid/placedCells.ts",
|
|
898
|
+
"./game/grid/placedCards": "./src/client/game/grid/placedCards.ts",
|
|
899
|
+
"./game/grid/placementRows": "./src/shared/game/grid/placementRows.ts",
|
|
892
900
|
"./game/grid/catalogueDocument": "./src/shared/game/grid/catalogueDocument.ts",
|
|
893
901
|
"./game/grid/room": "./src/server/game/grid/room.ts",
|
|
894
902
|
"./game/grid/roomNet": "./src/server/game/grid/roomNet.ts",
|
|
@@ -1181,7 +1189,10 @@
|
|
|
1181
1189
|
"./game/grid/runtimeCost": "./src/client/game/grid/runtimeCost.ts",
|
|
1182
1190
|
"./game/generators/pickups": "./src/client/game/generators/pickups.ts",
|
|
1183
1191
|
"./game/draftTitles": "./src/client/game/draftTitles.ts",
|
|
1192
|
+
"./game/boot/audio.generated": "./src/client/game/boot/audio.generated.ts",
|
|
1193
|
+
"./game/boot/bytes.generated": "./src/client/game/boot/bytes.generated.ts",
|
|
1184
1194
|
"./game/boot/packs.generated": "./src/client/game/boot/packs.generated.ts",
|
|
1195
|
+
"./game/boot/versions.generated": "./src/client/game/boot/versions.generated.ts",
|
|
1185
1196
|
"./host/headlessProduct": "./src/server/host/headlessProduct.ts",
|
|
1186
1197
|
"./host/shardfile": "./src/shared/host/shardfile.ts",
|
|
1187
1198
|
"./host/headless": "./src/server/host/headless.ts",
|
|
@@ -1211,7 +1222,6 @@
|
|
|
1211
1222
|
"./scripts/boot-publication.mjs": "./scripts/boot-publication.mjs",
|
|
1212
1223
|
"./scripts/build-cache-report.mjs": "./scripts/build-cache-report.mjs",
|
|
1213
1224
|
"./scripts/built-product.mjs": "./scripts/built-product.mjs",
|
|
1214
|
-
"./scripts/check-closed-components.mjs": "./scripts/check-closed-components.mjs",
|
|
1215
1225
|
"./scripts/debug-settings.mjs": "./scripts/debug-settings.mjs",
|
|
1216
1226
|
"./scripts/decision-legacy-lines.mjs": "./scripts/decision-legacy-lines.mjs",
|
|
1217
1227
|
"./scripts/format-package.mjs": "./scripts/format-package.mjs",
|
|
@@ -1237,15 +1247,13 @@
|
|
|
1237
1247
|
"./scripts/program-discovery.mjs": "./scripts/program-discovery.mjs",
|
|
1238
1248
|
"./scripts/quiet-cli.mjs": "./scripts/quiet-cli.mjs",
|
|
1239
1249
|
"./scripts/script-scenario-metrics.mjs": "./scripts/script-scenario-metrics.mjs",
|
|
1240
|
-
"./scripts/shard-component-spans.mjs": "./scripts/shard-component-spans.mjs",
|
|
1241
|
-
"./scripts/shard-components.mjs": "./scripts/shard-components.mjs",
|
|
1242
1250
|
"./scripts/shard-net-lines.mjs": "./scripts/shard-net-lines.mjs",
|
|
1243
1251
|
"./scripts/shard-output-content.mjs": "./scripts/shard-output-content.mjs",
|
|
1244
1252
|
"./scripts/shard-outputs.mjs": "./scripts/shard-outputs.mjs",
|
|
1245
|
-
"./scripts/
|
|
1246
|
-
"./scripts/
|
|
1247
|
-
"./scripts/shard-platform-
|
|
1248
|
-
"./scripts/shard-platform.mjs": "./scripts/
|
|
1253
|
+
"./scripts/node-format.mjs": "./scripts/node-format.mjs",
|
|
1254
|
+
"./scripts/output-reader.mjs": "./scripts/output-reader.mjs",
|
|
1255
|
+
"./scripts/shard-platform-format.mjs": "./scripts/node-format.mjs",
|
|
1256
|
+
"./scripts/shard-platform-output.mjs": "./scripts/output-reader.mjs",
|
|
1249
1257
|
"./scripts/shard-public.mjs": "./scripts/shard-public.mjs",
|
|
1250
1258
|
"./scripts/shard-runtime-closure.mjs": "./scripts/shard-runtime-closure.mjs",
|
|
1251
1259
|
"./scripts/shardfile-cache.mjs": "./scripts/shardfile-cache.mjs",
|
|
@@ -1277,6 +1285,7 @@
|
|
|
1277
1285
|
"./net/chatFilter": "./src/shared/engine/net/chatFilter.ts",
|
|
1278
1286
|
"./net/redial": "./src/client/engine/net/redial.ts",
|
|
1279
1287
|
"./net/socketFrames": "./src/shared/engine/net/socketFrames.ts",
|
|
1288
|
+
"./net/deviceWord": "./src/shared/engine/net/deviceWord.ts",
|
|
1280
1289
|
"./net/webSocketTransport": "./src/client/engine/net/webSocketTransport.ts",
|
|
1281
1290
|
"./net/otherPlayers": "./src/client/engine/net/otherPlayers.ts",
|
|
1282
1291
|
"./net/hurtOther": "./src/client/engine/net/hurtOther.ts",
|
package/scripts/agent-sync.mjs
CHANGED
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
// every replaced byte, and nothing outside these paths is touched.
|
|
36
36
|
// Exit 0 ok, 1 stale, invalid or refused, 2 usage.
|
|
37
37
|
import { spawnSync } from 'node:child_process';
|
|
38
|
+
import { createHash } from 'node:crypto';
|
|
38
39
|
import { chmodSync, existsSync, lstatSync, mkdirSync, readFileSync, readdirSync, readlinkSync, realpathSync, renameSync, rmSync, rmdirSync, statSync, symlinkSync, unlinkSync, writeFileSync } from 'node:fs';
|
|
39
40
|
import { dirname, isAbsolute, join, relative, resolve } from 'node:path';
|
|
40
41
|
import { pathToFileURL } from 'node:url';
|
|
@@ -283,6 +284,18 @@ export function kitFiles(kit) {
|
|
|
283
284
|
export const kitSkills = (kit) => (isRealDir(join(kit, SKILLS)) ? readdirSync(join(kit, SKILLS)).filter((name) => isRealDir(join(kit, SKILLS, name))).sort() : []);
|
|
284
285
|
|
|
285
286
|
const gitOut = (root, args) => spawnSync('git', ['-C', root, ...args], { encoding: 'utf8' });
|
|
287
|
+
/** A file's git blob id, as `git hash-object` gives it. */
|
|
288
|
+
const blobId = (bytes) => createHash('sha1').update(`blob ${bytes.length}\0`).update(bytes).digest('hex');
|
|
289
|
+
/**
|
|
290
|
+
* MA10 (e): every blob the kit's history held at any of `paths` (its current path and, for a moved file, the
|
|
291
|
+
* repo's old path), so a copy the stamp replaces reads as an older kit copy, not a local edit. Empty when the
|
|
292
|
+
* kit is not a git checkout.
|
|
293
|
+
*/
|
|
294
|
+
function kitBlobs(kit, paths) {
|
|
295
|
+
const log = gitOut(kit, ['--literal-pathspecs', 'log', '--format=', '--raw', '--no-abbrev', '--no-renames', 'HEAD', '--', ...paths]);
|
|
296
|
+
if (log.status !== 0) return new Set();
|
|
297
|
+
return new Set(log.stdout.split('\n').flatMap((line) => line.startsWith(':') ? line.split(' ').slice(2, 4) : []).filter((id) => !/^0+$/u.test(id)));
|
|
298
|
+
}
|
|
286
299
|
|
|
287
300
|
/** The first symlink at or above `rel` inside root, component by component, or null. */
|
|
288
301
|
function linkOnPath(root, rel) {
|
|
@@ -362,7 +375,7 @@ const realOr = (path) => {
|
|
|
362
375
|
* Stamp the kit's agent layout into a repo. Everything is checked before anything is written: the kit,
|
|
363
376
|
* the repo's specs and manifests, every registration the new manifests would drop, symlinks on every
|
|
364
377
|
* path it writes or removes, and uncommitted, untracked or ignored files under those paths.
|
|
365
|
-
* @returns {{ changed: string[], replaced: string[], problems: string[] }}
|
|
378
|
+
* @returns {{ changed: string[], replaced: string[], older?: string[], problems: string[] }}
|
|
366
379
|
*/
|
|
367
380
|
export function stamp(kitDir, rootDir) {
|
|
368
381
|
const kit = resolve(kitDir);
|
|
@@ -428,11 +441,16 @@ export function stamp(kitDir, rootDir) {
|
|
|
428
441
|
if (problems.length) return refuse(problems);
|
|
429
442
|
|
|
430
443
|
const changed = new Set();
|
|
431
|
-
// Copies the stamp replaces whose bytes differ from the kit's: git keeps the old bytes
|
|
444
|
+
// Copies the stamp replaces whose bytes differ from the kit's: git keeps the old bytes. One the kit's history
|
|
445
|
+
// held is an older kit copy (`older`); any other is a local edit the caller reviews (`replaced`).
|
|
432
446
|
const replaced = [];
|
|
447
|
+
const older = [];
|
|
448
|
+
const differs = (path, kitPath) => {
|
|
449
|
+
(kitBlobs(kit, [...new Set([kitPath, path])]).has(blobId(readFileSync(join(root, path)))) ? older : replaced).push(path);
|
|
450
|
+
};
|
|
433
451
|
for (const path of legacy) {
|
|
434
452
|
const want = join(kit, '.agents/hooks', path.slice('.claude/hooks/'.length));
|
|
435
|
-
if (!existsSync(want) || !readFileSync(join(root, path)).equals(readFileSync(want)))
|
|
453
|
+
if (!existsSync(want) || !readFileSync(join(root, path)).equals(readFileSync(want))) differs(path, `.agents/hooks/${path.slice('.claude/hooks/'.length)}`);
|
|
436
454
|
rmSync(join(root, path));
|
|
437
455
|
changed.add(path);
|
|
438
456
|
}
|
|
@@ -440,7 +458,7 @@ export function stamp(kitDir, rootDir) {
|
|
|
440
458
|
for (const name of oldKitSkills) {
|
|
441
459
|
const path = `${CLAUDE_SKILLS}/${name}`;
|
|
442
460
|
for (const file of entriesUnder(root, path)) {
|
|
443
|
-
if (!readFileSync(join(root, file)).equals(readFileSync(join(kit, SKILLS, name, relative(path, file)))))
|
|
461
|
+
if (!readFileSync(join(root, file)).equals(readFileSync(join(kit, SKILLS, name, relative(path, file))))) differs(file, `${SKILLS}/${name}/${relative(path, file)}`);
|
|
444
462
|
changed.add(file);
|
|
445
463
|
}
|
|
446
464
|
rmSync(join(root, path), { recursive: true });
|
|
@@ -460,7 +478,7 @@ export function stamp(kitDir, rootDir) {
|
|
|
460
478
|
const mode = statSync(from).mode & 0o777;
|
|
461
479
|
const same = existsSync(to) && readFileSync(to).equals(bytes);
|
|
462
480
|
if (!same || (statSync(to).mode & 0o777) !== mode) {
|
|
463
|
-
if (existsSync(to) && !same)
|
|
481
|
+
if (existsSync(to) && !same) differs(path, path);
|
|
464
482
|
mkdirSync(dirname(to), { recursive: true });
|
|
465
483
|
writeFileSync(to, bytes);
|
|
466
484
|
chmodSync(to, mode);
|
|
@@ -468,10 +486,10 @@ export function stamp(kitDir, rootDir) {
|
|
|
468
486
|
}
|
|
469
487
|
}
|
|
470
488
|
const next = plan(root);
|
|
471
|
-
if (next.problems.length) return { changed: [...changed].sort(), replaced, problems: next.problems };
|
|
489
|
+
if (next.problems.length) return { changed: [...changed].sort(), replaced, older, problems: next.problems };
|
|
472
490
|
apply(root, next.actions);
|
|
473
491
|
for (const action of next.actions) changed.add(action.path);
|
|
474
|
-
return { changed: [...changed].sort(), replaced: [...new Set(replaced)].sort(), problems: [] };
|
|
492
|
+
return { changed: [...changed].sort(), replaced: [...new Set(replaced)].sort(), older: [...new Set(older)].sort(), problems: [] };
|
|
475
493
|
}
|
|
476
494
|
|
|
477
495
|
// ---------------------------------------------------------------- main
|
|
@@ -497,8 +515,9 @@ function main(argv) {
|
|
|
497
515
|
}
|
|
498
516
|
root = resolve(root);
|
|
499
517
|
if (from) {
|
|
500
|
-
const { changed, replaced, problems } = stamp(resolve(from), root);
|
|
518
|
+
const { changed, replaced, older = [], problems } = stamp(resolve(from), root);
|
|
501
519
|
for (const path of changed) process.stdout.write(`stamped ${path}\n`);
|
|
520
|
+
for (const path of older) process.stdout.write(`updated ${path}: it was an older kit copy (its blob is in the kit's history)\n`);
|
|
502
521
|
for (const path of replaced) process.stdout.write(`replaced ${path}: its bytes differed from the kit's; check git diff for a local edit\n`);
|
|
503
522
|
for (const problem of problems) process.stderr.write(`agent-sync: ${problem}\n`);
|
|
504
523
|
return problems.length ? 1 : 0;
|
|
@@ -5,11 +5,17 @@ import {writeSpawnManifests as cookManifests, type BuildHalf} from '../../src/co
|
|
|
5
5
|
import {assetTableAddresses, readAssetTables} from './assetTables.mjs';
|
|
6
6
|
import {readGridSeams} from './gridSeams.mjs';
|
|
7
7
|
import {rendererRevision} from '../renderer-revision.mjs';
|
|
8
|
+
import {defaultCookTiers} from '../../src/cook/game/shardCook';
|
|
9
|
+
import {homedir} from 'node:os';
|
|
10
|
+
import {resolve} from 'node:path';
|
|
8
11
|
|
|
9
12
|
/** C1: the page's half of the cook's input, which the app build owns: its tables, seams and names. */
|
|
10
|
-
const {WILDSHARD_PREPARATION_ONLY} = process.env;
|
|
13
|
+
const {WILDSHARD_PREPARATION_ONLY, WILDSHARD_ASTC6_CACHE} = process.env;
|
|
14
|
+
/** S12d: the phone tier's 6×6 encodes, kept by input between builds. Beside the spawn parts' bodies, so CI's cache of
|
|
15
|
+
* `~/.cache/wildshard/gen/spawn-parts-br` keeps them too (a cold Pine is minutes of encode). */
|
|
16
|
+
const astc6Cache = WILDSHARD_ASTC6_CACHE ?? resolve(homedir(), '.cache/wildshard/gen/spawn-parts-br/astc6-1');
|
|
11
17
|
const build: BuildHalf = {cacheName: ASSET_CACHE_NAME, gpuFiles: GPU_FILES, tables: readAssetTables,
|
|
12
|
-
preparationOnly: WILDSHARD_PREPARATION_ONLY === '1', rendererRevision: rendererRevision(),
|
|
18
|
+
preparationOnly: WILDSHARD_PREPARATION_ONLY === '1', rendererRevision: rendererRevision(), tiers: () => defaultCookTiers(astc6Cache),
|
|
13
19
|
tableAddresses: root => assetTableAddresses(readAssetTables(root)), seams: root => readGridSeams(root).address};
|
|
14
20
|
|
|
15
21
|
export const writeSpawnManifests = (outDir: string, input: unknown, strips: Parameters<typeof cookManifests>[2], root: string, report?: Parameters<typeof cookManifests>[5]): ReturnType<typeof cookManifests> =>
|
|
@@ -4,8 +4,8 @@ import {tmpdir} from 'node:os';
|
|
|
4
4
|
import {dirname, join} from 'node:path';
|
|
5
5
|
import * as v from 'valibot';
|
|
6
6
|
import {packsBookPath, readSpawnManifest} from '../../src/shared/game/shardfile/spawnManifest';
|
|
7
|
-
import {prepareAssetDecoders} from '@wildshard/format/
|
|
8
|
-
import {
|
|
7
|
+
import {prepareAssetDecoders} from '@wildshard/format/shardfileAssets';
|
|
8
|
+
import {validateShardfileFolder} from '@wildshard/format/shardfileValidation';
|
|
9
9
|
import {assertKtx2TableTargets} from '../../src/shared/game/shardfile/ktx2Targets';
|
|
10
10
|
import {StandaloneCatalogueSchema, type StandaloneCatalogue} from '@wildshard/format/standaloneCatalogue';
|
|
11
11
|
import {readTar} from '@wildshard/format/tar';
|
|
@@ -15,6 +15,7 @@ import {bareSlug} from '../../src/shared/game/grid/catalogueSlot';
|
|
|
15
15
|
import {serverPackBookPath} from '../../src/shared/game/shardfile/serverPack';
|
|
16
16
|
import {productTarball} from '../../src/cook/game/productTarball';
|
|
17
17
|
import {titleMetadata, type TitleManifest} from '../../src/client/game/shard/titleList';
|
|
18
|
+
import {servedDiscoveryPath} from '../../src/cook/game/entryTotals';
|
|
18
19
|
|
|
19
20
|
/** C3 (J61, D7): every build bakes `catalogue.json`, so a build needs no server, and inlines it in `index.html`, so the
|
|
20
21
|
* first paint waits on no new fetch. `WILDSHARD_CATALOGUE` names a file a deploy took from `api-server`'s
|
|
@@ -45,10 +46,12 @@ export function titleRowOf(bytes: Uint8Array, home = ''): TitleManifest {
|
|
|
45
46
|
return {...titleMetadata(data), card: {thumb: at(thumb), portrait: at(portrait), landscape: at(landscape)}, discovery: `${home}/shardfiles/${data.slug}/discovery.json?v=${hash8(bytes)}`};
|
|
46
47
|
}
|
|
47
48
|
/** Every built product's title row, in title order. */
|
|
48
|
-
export function productTitleRows(products: string): readonly TitleManifest[] {
|
|
49
|
+
export function productTitleRows(products: string, outDir?: string): readonly TitleManifest[] {
|
|
49
50
|
const rows = readdirSync(products, {withFileTypes: true}).flatMap(entry => {
|
|
50
|
-
|
|
51
|
-
|
|
51
|
+
// S12d: the document as this build serves it (`servedDiscoveryPath`, the phone tier's table), so the title's `?v=` is its hash.
|
|
52
|
+
const own = join(products, entry.name, 'mounts/shardfiles', entry.name, 'discovery.json'), served = outDir === undefined ? undefined : servedDiscoveryPath(outDir, entry.name);
|
|
53
|
+
const file = served !== undefined && existsSync(served) ? served : own;
|
|
54
|
+
return entry.isDirectory() && existsSync(own) ? [titleRowOf(readFileSync(file))] : [];
|
|
52
55
|
});
|
|
53
56
|
return rows.sort((a, b) => (a.order ?? 0) - (b.order ?? 0));
|
|
54
57
|
}
|
|
@@ -84,7 +87,7 @@ export function inTreeCatalogue(root: string, products: string, listed: readonly
|
|
|
84
87
|
/** The build's step: the file a deploy names, else the tree's. */
|
|
85
88
|
export function bakeCatalogue(outDir: string, root: string): void {
|
|
86
89
|
const {WILDSHARD_CATALOGUE: source} = process.env;
|
|
87
|
-
const rows = productTitleRows(join(root, 'out'));
|
|
90
|
+
const rows = productTitleRows(join(root, 'out'), outDir);
|
|
88
91
|
const document = source === undefined ? inTreeCatalogue(root, join(root, 'out'), rows) : v.parse(StandaloneCatalogueSchema, JSON.parse(readFileSync(source, 'utf8')));
|
|
89
92
|
writeCatalogueDocument(outDir, document);
|
|
90
93
|
writeTitleRows(outDir, rows);
|
|
@@ -151,7 +154,7 @@ export function addCookedShards(outDir: string, shards: readonly CookedShard[],
|
|
|
151
154
|
export async function productVerdict(tarball: Uint8Array, out: string): Promise<{readonly verdict: unknown; readonly discovery?: Uint8Array}> {
|
|
152
155
|
await prepareAssetDecoders();
|
|
153
156
|
const files = readTar(tarball);
|
|
154
|
-
|
|
157
|
+
validateShardfileFolder({read: (path, maximum) => { const bytes = files.get(path); if (bytes === undefined || bytes.length > maximum) throw new Error(`No ${path}`); return bytes; }, paths: () => files.keys()},
|
|
155
158
|
{hash: bytes => createHash('sha256').update(bytes).digest('hex')});
|
|
156
159
|
// S11: a deploy's added shard serves its KTX2 targets itself, or the build already holds them.
|
|
157
160
|
assertKtx2TableTargets({paths: () => files.keys(), read: path => { const bytes = files.get(path); if (bytes === undefined) throw new Error(`No ${path}`); return bytes; }},
|
package/scripts/app-build/gen.ts
CHANGED
|
@@ -27,9 +27,29 @@ export function assetIndex(): string {
|
|
|
27
27
|
|
|
28
28
|
// src/client/game/boot/bytes.generated.ts: the same table as a committed TS module, so the boot plan's declared
|
|
29
29
|
// denominators need no fetch and `pnpm tsc` fails when a file a chunk declares disappears.
|
|
30
|
+
const BYTES_TABLE = 'src/client/game/boot/bytes.generated.ts';
|
|
30
31
|
function bytesModule(): string {
|
|
31
|
-
const rows = JSON.parse(assetIndex()) as Record<string, number
|
|
32
|
-
|
|
32
|
+
const rows = Object.fromEntries(Object.entries(JSON.parse(assetIndex()) as Record<string, number>).filter(([name]) => !name.endsWith('.DS_Store')));
|
|
33
|
+
// The staged table is the baseline (HEAD's, unless a fix to it is staged on purpose), not the file a local run last
|
|
34
|
+
// wrote: that may hold an older public/'s sizes.
|
|
35
|
+
let committed = '';
|
|
36
|
+
try { committed = execFileSync('git', ['show', `:${BYTES_TABLE}`], { encoding: 'utf8', maxBuffer: 16_000_000, stdio: ['ignore', 'pipe', 'ignore'] }); }
|
|
37
|
+
catch { /* no git history here (an installed package): nothing to compare */ }
|
|
38
|
+
const changed = changedContentNamed(committed, rows);
|
|
39
|
+
if (changed.length > 0) throw new Error(`${changed.length} content-named file(s) changed bytes under one URL, which players keep for a year (AUDIO AU21): ${changed.slice(0, 5).join(', ')}. A changed file needs a new name (sharddev 0.2.10 renames a re-encoded recording); a stale public/ copy needs \`pnpm pins\``);
|
|
40
|
+
return publicBytesTableSource(rows);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** AUDIO AU21: a content-named file (`contentNamed`: no `?v=`, kept by the worker, `/assets/*` immutable) is served for a
|
|
44
|
+
* year under its URL, so a new byte table may not give one of the previous table's content-named paths another size.
|
|
45
|
+
* A renamed file is a new row and passes; same size with other bytes slips past (the table holds sizes only). */
|
|
46
|
+
export function changedContentNamed(previous: string, rows: Readonly<Record<string, number>>): string[] {
|
|
47
|
+
const out: string[] = [];
|
|
48
|
+
for (const [, name, size] of previous.matchAll(/^\s*"([^"]+)": (\d+),?$/gmu)) {
|
|
49
|
+
const now = name === undefined ? undefined : rows[name];
|
|
50
|
+
if (name !== undefined && now !== undefined && contentNamed(name) && now !== Number(size)) out.push(`${name} (${size} to ${now} bytes)`);
|
|
51
|
+
}
|
|
52
|
+
return out;
|
|
33
53
|
}
|
|
34
54
|
|
|
35
55
|
// src/client/game/boot/versions.generated.ts: a content hash per file under public/assets (E160; NALATI-MERGE F4 started it for
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** PZ12 (J274): the channels whose page origin is cross-origin isolated. */
|
|
2
|
+
export const ISOLATED_CHANNELS: ReadonlySet<string>;
|
|
3
|
+
export const ISOLATION_HEADERS: Readonly<Record<string, string>>;
|
|
4
|
+
export function isolated(channel: string | undefined): boolean;
|
|
5
|
+
/** The _headers text with the isolation rule appended once for an isolated channel. */
|
|
6
|
+
export function withIsolationRule(text: string, channel: string | undefined): string;
|
|
7
|
+
/** Append the rule to a build's _headers; returns whether the channel is isolated. */
|
|
8
|
+
export function writeIsolationRule(outDir: string, channel: string | undefined): boolean;
|
|
9
|
+
/** The COOP and COEP a _headers text sends on its /* rules, lower-cased. */
|
|
10
|
+
export function documentIsolation(text: string): Record<string, string>;
|