@playcademy/vite-plugin 1.0.1-beta.4 → 1.1.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Local asset dev support.
3
+ *
4
+ * In production the edge worker injects the asset manifest into the page and
5
+ * serves `/api/assets/*` from R2. There is no edge worker in `vite dev`, so the
6
+ * plugin reproduces both against the local Miniflare bucket that
7
+ * `playcademy bucket sync` writes to — making the SDK's `asset()` resolver work
8
+ * locally exactly as it does on the platform.
9
+ *
10
+ * A single Miniflare instance is opened for the dev server's lifetime (not one
11
+ * per request) and reused for the manifest read and every asset read. It still
12
+ * observes `bucket sync` writes to the same persist dir, so it stays fresh
13
+ * across syncs without reopening.
14
+ *
15
+ * The local-bucket reads go through `playcademy/bucket` (Node-only, build-time
16
+ * tooling). This never reaches a game's browser bundle — frontends use the
17
+ * dependency-free `@playcademy/sdk/assets` `asset()` resolver instead.
18
+ */
19
+ import type { ViteDevServer } from 'vite';
20
+ /** Dispose the persistent local-bucket session (call on dev-server shutdown). */
21
+ export declare function disposeAssetBucket(): Promise<void>;
22
+ /**
23
+ * Build the `<script>` injecting `self.__PLAYCADEMY_ASSET_MANIFEST` for dev,
24
+ * read from the local bucket. Returns `null` when bucket storage isn't enabled
25
+ * or no `bucket sync` has populated the local bucket yet — in the latter case,
26
+ * warns once so the dev knows why `asset()` paths 404 (re-syncing then reloading
27
+ * picks up the manifest without restarting the dev server).
28
+ */
29
+ export declare function getDevManifestScript(configPath?: string): Promise<string | null>;
30
+ /**
31
+ * Register the dev middleware that serves `/api/assets/*` from the local bucket,
32
+ * mirroring the edge asset route (the request path after the route prefix maps
33
+ * to the stored object).
34
+ *
35
+ * No-op when bucket storage isn't enabled, or when the game defines its own
36
+ * `server/api/assets` route — in that case `/api/assets/*` proxies to the
37
+ * backend so the custom route runs, matching production where a custom route
38
+ * supersedes the built-in one.
39
+ */
40
+ export declare function registerAssetMiddleware(server: ViteDevServer, projectRoot: string, configPath?: string): Promise<void>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@playcademy/vite-plugin",
3
- "version": "1.0.1-beta.4",
3
+ "version": "1.1.0-beta.1",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -19,14 +19,14 @@
19
19
  "dependencies": {
20
20
  "archiver": "^7.0.1",
21
21
  "picocolors": "^1.1.1",
22
- "playcademy": "0.24.0"
22
+ "playcademy": "0.25.0"
23
23
  },
24
24
  "devDependencies": {
25
25
  "@electric-sql/pglite": "^0.3.16",
26
26
  "@inquirer/prompts": "^7.8.6",
27
27
  "@playcademy/constants": "0.0.1",
28
- "@playcademy/sandbox": "0.5.0",
29
- "@playcademy/sdk": "0.12.0",
28
+ "@playcademy/sandbox": "0.5.1",
29
+ "@playcademy/sdk": "0.13.0",
30
30
  "@playcademy/types": "0.0.1",
31
31
  "@playcademy/utils": "0.0.1",
32
32
  "@types/archiver": "^6.0.3",