@playcademy/vite-plugin 0.0.1-beta.3 → 0.0.1-beta.6

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/README.md CHANGED
@@ -30,12 +30,18 @@ import { playcademy } from '@playcademy/vite-plugin'
30
30
  export default defineConfig({
31
31
  plugins: [
32
32
  playcademy({
33
- // Optional: configure plugin options here
34
- // bootMode: 'direct',
35
- // entryPoint: 'my-game.html',
36
- // styles: ['src/main.css'],
37
- // engine: 'phaser',
38
- // autoZip: true, // Set to true to enable zipping locally
33
+ export: {
34
+ // bootMode: 'iframe',
35
+ // entryPoint: 'my-game.html',
36
+ // styles: ['src/main.css'],
37
+ // platform: 'web',
38
+ // autoZip: true, // Set to true to enable zipping locally
39
+ },
40
+ sandbox: {
41
+ // autoStart: true, // Auto-start sandbox during development
42
+ // url: 'http://localhost:4321/api', // Custom sandbox URL
43
+ // verbose: true, // Enable verbose logging from sandbox
44
+ },
39
45
  }),
40
46
  ],
41
47
  // ...other Vite config
@@ -44,19 +50,26 @@ export default defineConfig({
44
50
 
45
51
  ## What it does
46
52
 
47
- 1. **Generates `playcademy.manifest.json`**:
53
+ 1. **Auto-starts Development Sandbox**:
54
+ During development (`vite dev`), the plugin automatically starts a local Playcademy sandbox server that provides game APIs for testing. This allows you to develop your game locally with full API integration.
55
+
56
+ 2. **Generates `playcademy.manifest.json`**:
48
57
  This file is created in your Vite build's output directory (`dist` by default). It contains metadata about your game, such as its entry point, boot mode, and engine type, which is used by the Playcademy platform.
49
58
 
50
- 2. **Creates Output Zip Archive (Optional)**:
59
+ 3. **Creates Output Zip Archive (Optional)**:
51
60
  If `autoZip` is enabled, the plugin will create a zip file named `{your-project-name}.zip` inside a `.playcademy` directory at the root of your project (e.g., `my-game/.playcademy/my-game.zip`).
52
61
  This archive contains all the contents of your build output directory and can be uploaded directly to the Playcademy platform.
53
62
 
54
- 3. **Sets Vite `base` Configuration (if not set by user)**:
63
+ 4. **Sets Vite `base` Configuration (if not set by user)**:
55
64
  The plugin defaults Vite's `base` configuration to `'./'`. This is necessary for games to correctly reference assets when deployed on the Playcademy platform. If you explicitly set a `base` path in your `vite.config.ts`, the plugin will respect your configuration and not override it.
56
65
 
57
66
  ## Options (`PlaycademyPluginOptions`)
58
67
 
59
- The `playcademy()` plugin function accepts an optional options object:
68
+ The `playcademy()` plugin accepts an optional options object with two main namespaces:
69
+
70
+ ### Export Options (`export`)
71
+
72
+ Configuration for manifest generation and build output:
60
73
 
61
74
  - **`bootMode`**:
62
75
 
@@ -76,10 +89,10 @@ The `playcademy()` plugin function accepts an optional options object:
76
89
  - Default: `[]`
77
90
  - An array of CSS file paths (relative to the project root) that should be loaded by the Playcademy platform.
78
91
 
79
- - **`engine`**:
92
+ - **`platform`**:
80
93
 
81
- - Type: `'three' | 'phaser' | 'godot' | 'unity' | 'custom'`
82
- - Default: `'custom'`
94
+ - Type: `'web' | 'godot' | 'unity'`
95
+ - Default: `'web'`
83
96
  - Specifies the game engine used.
84
97
 
85
98
  - **`autoZip`**:
@@ -87,6 +100,27 @@ The `playcademy()` plugin function accepts an optional options object:
87
100
  - Default: `false`
88
101
  - Controls whether to automatically create a zip archive of the build output.
89
102
 
103
+ ### Sandbox Options (`sandbox`)
104
+
105
+ Configuration for the development sandbox server:
106
+
107
+ - **`autoStart`**:
108
+
109
+ - Type: `boolean`
110
+ - Default: `true`
111
+ - Controls whether to automatically start the development sandbox during `vite dev`.
112
+
113
+ - **`url`**:
114
+
115
+ - Type: `string`
116
+ - Default: `'http://localhost:4321/api'`
117
+ - The URL of the sandbox server to use (useful if you're running your own sandbox instance).
118
+
119
+ - **`verbose`**:
120
+ - Type: `boolean`
121
+ - Default: `false`
122
+ - Enables verbose logging from the sandbox server and API handlers for debugging.
123
+
90
124
  ## Development
91
125
 
92
126
  To install dependencies for this package:
package/dist/index.d.ts CHANGED
@@ -1,10 +1,27 @@
1
+ /**
2
+ * Playcademy Vite Plugin
3
+ *
4
+ * Provides:
5
+ * - Auto-starting sandbox server during development
6
+ * - Hijacking dev server to serve Playcademy loader environment
7
+ * - Build-time manifest generation and optional zip packaging
8
+ */
1
9
  import type { Plugin } from 'vite';
2
10
  import type { ManifestV1 } from '@playcademy/types';
3
- export interface PlaycademyPluginOptions {
11
+ export interface PlaycademyExportOptions {
4
12
  bootMode?: ManifestV1['bootMode'];
5
13
  entryPoint?: string;
6
14
  styles?: string[];
7
- engine?: ManifestV1['engine'];
15
+ platform?: ManifestV1['platform'];
8
16
  autoZip?: boolean;
9
17
  }
18
+ export interface PlaycademySandboxOptions {
19
+ autoStart?: boolean;
20
+ url?: string;
21
+ verbose?: boolean;
22
+ }
23
+ export interface PlaycademyPluginOptions {
24
+ export?: PlaycademyExportOptions;
25
+ sandbox?: PlaycademySandboxOptions;
26
+ }
10
27
  export declare function playcademy(options?: PlaycademyPluginOptions): Plugin;