@playcademy/vite-plugin 0.1.26-alpha.6 → 0.1.27
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 +53 -10
- package/dist/index.js +86476 -82127
- package/dist/lib/logging/utils.d.ts +2 -0
- package/dist/lib/sandbox/server.d.ts +5 -0
- package/dist/server/platform-mode.d.ts +5 -0
- package/dist/types/internal.d.ts +6 -0
- package/dist/types/options.d.ts +270 -9
- package/package.json +3 -3
|
@@ -5,5 +5,10 @@ export declare function startSandbox(viteConfig: ResolvedConfig, autoStart?: boo
|
|
|
5
5
|
customUrl?: string;
|
|
6
6
|
quiet?: boolean;
|
|
7
7
|
recreateDb?: boolean;
|
|
8
|
+
seed?: boolean;
|
|
9
|
+
memoryOnly?: boolean;
|
|
10
|
+
databasePath?: string;
|
|
11
|
+
realtimeEnabled?: boolean;
|
|
12
|
+
realtimePort?: number;
|
|
8
13
|
logLevel?: 'debug' | 'info' | 'warn' | 'error';
|
|
9
14
|
}): Promise<SandboxManager>;
|
|
@@ -9,6 +9,11 @@ export interface PlatformModeOptions {
|
|
|
9
9
|
logLevel: 'debug' | 'info' | 'warn' | 'error';
|
|
10
10
|
sandboxUrl: string;
|
|
11
11
|
recreateDb: boolean;
|
|
12
|
+
seed: boolean;
|
|
13
|
+
memoryOnly: boolean;
|
|
14
|
+
databasePath?: string;
|
|
15
|
+
realtimeEnabled: boolean;
|
|
16
|
+
realtimePort?: number;
|
|
12
17
|
showBadge: boolean;
|
|
13
18
|
preferredBackendPort: number;
|
|
14
19
|
}
|
package/dist/types/internal.d.ts
CHANGED
|
@@ -14,6 +14,11 @@ export interface ResolvedPluginOptions {
|
|
|
14
14
|
verbose: boolean;
|
|
15
15
|
logLevel: 'debug' | 'info' | 'warn' | 'error';
|
|
16
16
|
recreateDb: boolean;
|
|
17
|
+
seed: boolean;
|
|
18
|
+
memoryOnly: boolean;
|
|
19
|
+
databasePath?: string;
|
|
20
|
+
realtimeEnabled: boolean;
|
|
21
|
+
realtimePort?: number;
|
|
17
22
|
showBadge: boolean;
|
|
18
23
|
}
|
|
19
24
|
/**
|
|
@@ -50,6 +55,7 @@ export interface SandboxManager {
|
|
|
50
55
|
baseUrl: string;
|
|
51
56
|
realtimeUrl: string;
|
|
52
57
|
port: number;
|
|
58
|
+
realtimePort?: number;
|
|
53
59
|
project: ProjectInfo | null;
|
|
54
60
|
cleanup: () => void;
|
|
55
61
|
}
|
package/dist/types/options.d.ts
CHANGED
|
@@ -3,58 +3,319 @@
|
|
|
3
3
|
*/
|
|
4
4
|
/**
|
|
5
5
|
* Plugin operation mode
|
|
6
|
-
*
|
|
7
|
-
*
|
|
6
|
+
*
|
|
7
|
+
* Controls how the Vite plugin operates during development:
|
|
8
|
+
* - `'platform'`: Full Playcademy platform experience with sandbox server, backend bundling, and shell wrapper (default)
|
|
9
|
+
* - `'standalone'`: Backend only, no sandbox or shell
|
|
10
|
+
*
|
|
11
|
+
* @default 'platform'
|
|
8
12
|
*/
|
|
9
13
|
export type PlaycademyMode = 'platform' | 'standalone';
|
|
10
14
|
/**
|
|
11
|
-
* Configuration options for exporting Playcademy games
|
|
15
|
+
* Configuration options for exporting/building Playcademy games
|
|
16
|
+
*
|
|
17
|
+
* Controls how your game is packaged for deployment.
|
|
12
18
|
*/
|
|
13
19
|
export interface PlaycademyExportOptions {
|
|
14
20
|
/**
|
|
15
|
-
* Automatically create a deployment zip archive
|
|
21
|
+
* Automatically create a deployment zip archive after build.
|
|
22
|
+
*
|
|
23
|
+
* The zip file is created at `.playcademy/{project-name}.zip` and contains
|
|
24
|
+
* all files needed for deployment (frontend assets + backend bundle).
|
|
25
|
+
*
|
|
16
26
|
* @default true
|
|
27
|
+
* @example
|
|
28
|
+
* ```ts
|
|
29
|
+
* export: {
|
|
30
|
+
* autoZip: false // Disable auto-zipping
|
|
31
|
+
* }
|
|
32
|
+
* ```
|
|
17
33
|
*/
|
|
18
34
|
autoZip?: boolean;
|
|
19
35
|
}
|
|
20
36
|
/**
|
|
21
37
|
* Configuration options for the Playcademy sandbox server
|
|
38
|
+
*
|
|
39
|
+
* The sandbox server provides a local development environment that simulates
|
|
40
|
+
* the Playcademy platform, including API endpoints, authentication, and database.
|
|
22
41
|
*/
|
|
23
42
|
export interface PlaycademySandboxOptions {
|
|
43
|
+
/**
|
|
44
|
+
* Automatically start the sandbox server when Vite starts.
|
|
45
|
+
*
|
|
46
|
+
* Set to `false` if you want to start the sandbox server manually.
|
|
47
|
+
*
|
|
48
|
+
* @default true
|
|
49
|
+
* @example
|
|
50
|
+
* ```ts
|
|
51
|
+
* sandbox: {
|
|
52
|
+
* autoStart: false // Start sandbox manually
|
|
53
|
+
* }
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
24
56
|
autoStart?: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Custom URL for the sandbox server.
|
|
59
|
+
*
|
|
60
|
+
* Useful if you need to run the sandbox on a specific host or port.
|
|
61
|
+
* By default, the sandbox uses `http://localhost:{port}` where port
|
|
62
|
+
* is auto-assigned.
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* ```ts
|
|
66
|
+
* sandbox: {
|
|
67
|
+
* url: 'http://localhost:8788'
|
|
68
|
+
* }
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
25
71
|
url?: string;
|
|
72
|
+
/**
|
|
73
|
+
* Enable verbose logging for the sandbox server.
|
|
74
|
+
*
|
|
75
|
+
* Shows detailed information about requests, database operations, and more.
|
|
76
|
+
* Equivalent to setting `logLevel: 'debug'`.
|
|
77
|
+
*
|
|
78
|
+
* @default false
|
|
79
|
+
* @example
|
|
80
|
+
* ```ts
|
|
81
|
+
* sandbox: {
|
|
82
|
+
* verbose: true
|
|
83
|
+
* }
|
|
84
|
+
* ```
|
|
85
|
+
*/
|
|
26
86
|
verbose?: boolean;
|
|
27
87
|
/**
|
|
28
|
-
* Log level for the sandbox server
|
|
88
|
+
* Log level for the sandbox server.
|
|
89
|
+
*
|
|
90
|
+
* Controls the verbosity of sandbox server logs:
|
|
91
|
+
* - `'debug'`: Very detailed logs (all operations)
|
|
92
|
+
* - `'info'`: Standard operational logs
|
|
93
|
+
* - `'warn'`: Warnings only
|
|
94
|
+
* - `'error'`: Errors only
|
|
95
|
+
*
|
|
29
96
|
* @default 'info'
|
|
97
|
+
* @example
|
|
98
|
+
* ```ts
|
|
99
|
+
* sandbox: {
|
|
100
|
+
* logLevel: 'debug' // Show all debug info
|
|
101
|
+
* }
|
|
102
|
+
* ```
|
|
30
103
|
*/
|
|
31
104
|
logLevel?: 'debug' | 'info' | 'warn' | 'error';
|
|
32
105
|
/**
|
|
33
|
-
* Recreate the sandbox database on each start
|
|
106
|
+
* Recreate the sandbox database on each server start.
|
|
107
|
+
*
|
|
108
|
+
* When `true`, the database is dropped and recreated with seed data
|
|
109
|
+
* every time the dev server starts. Useful for ensuring a clean state
|
|
110
|
+
* during development.
|
|
111
|
+
*
|
|
112
|
+
* **Warning**: All existing data will be lost on each restart.
|
|
113
|
+
*
|
|
34
114
|
* @default false
|
|
115
|
+
* @example
|
|
116
|
+
* ```ts
|
|
117
|
+
* sandbox: {
|
|
118
|
+
* recreateDb: true // Fresh database on every restart
|
|
119
|
+
* }
|
|
120
|
+
* ```
|
|
35
121
|
*/
|
|
36
122
|
recreateDb?: boolean;
|
|
123
|
+
/**
|
|
124
|
+
* Seed the database with demo data on startup.
|
|
125
|
+
*
|
|
126
|
+
* Creates demo users, games, achievements, and other platform data
|
|
127
|
+
* for testing. Disable if you want to start with an empty database.
|
|
128
|
+
*
|
|
129
|
+
* @default true
|
|
130
|
+
* @example
|
|
131
|
+
* ```ts
|
|
132
|
+
* sandbox: {
|
|
133
|
+
* seed: false // Start with empty database
|
|
134
|
+
* }
|
|
135
|
+
* ```
|
|
136
|
+
*/
|
|
137
|
+
seed?: boolean;
|
|
138
|
+
/**
|
|
139
|
+
* Use an in-memory database instead of a file.
|
|
140
|
+
*
|
|
141
|
+
* The database only exists in RAM and is lost when the server stops.
|
|
142
|
+
* Faster but non-persistent. Useful for testing and CI environments.
|
|
143
|
+
*
|
|
144
|
+
* @default false
|
|
145
|
+
* @example
|
|
146
|
+
* ```ts
|
|
147
|
+
* sandbox: {
|
|
148
|
+
* memoryOnly: true // Database in RAM only
|
|
149
|
+
* }
|
|
150
|
+
* ```
|
|
151
|
+
*/
|
|
152
|
+
memoryOnly?: boolean;
|
|
153
|
+
/**
|
|
154
|
+
* Custom path for the database file.
|
|
155
|
+
*
|
|
156
|
+
* Specifies where the SQLite database file should be stored.
|
|
157
|
+
* If not provided, defaults to a path based on node_modules location.
|
|
158
|
+
*
|
|
159
|
+
* Special value `':memory:'` creates an in-memory database
|
|
160
|
+
* (equivalent to `memoryOnly: true`).
|
|
161
|
+
*
|
|
162
|
+
* @example
|
|
163
|
+
* ```ts
|
|
164
|
+
* sandbox: {
|
|
165
|
+
* databasePath: './my-game-sandbox.db'
|
|
166
|
+
* }
|
|
167
|
+
* ```
|
|
168
|
+
*
|
|
169
|
+
* @example
|
|
170
|
+
* ```ts
|
|
171
|
+
* sandbox: {
|
|
172
|
+
* databasePath: ':memory:' // In-memory database
|
|
173
|
+
* }
|
|
174
|
+
* ```
|
|
175
|
+
*/
|
|
176
|
+
databasePath?: string;
|
|
177
|
+
/**
|
|
178
|
+
* Real-time/WebSocket server configuration.
|
|
179
|
+
*
|
|
180
|
+
* The real-time server provides WebSocket support for live updates,
|
|
181
|
+
* multiplayer features, and other real-time functionality.
|
|
182
|
+
*
|
|
183
|
+
* @default { enabled: false }
|
|
184
|
+
* @example
|
|
185
|
+
* ```ts
|
|
186
|
+
* sandbox: {
|
|
187
|
+
* realtime: {
|
|
188
|
+
* enabled: true,
|
|
189
|
+
* port: 4322 // Custom WebSocket port
|
|
190
|
+
* }
|
|
191
|
+
* }
|
|
192
|
+
* ```
|
|
193
|
+
*/
|
|
194
|
+
realtime?: {
|
|
195
|
+
/**
|
|
196
|
+
* Enable the real-time/WebSocket server.
|
|
197
|
+
*
|
|
198
|
+
* @default false
|
|
199
|
+
*/
|
|
200
|
+
enabled?: boolean;
|
|
201
|
+
/**
|
|
202
|
+
* Port for the WebSocket server.
|
|
203
|
+
*
|
|
204
|
+
* By default, uses the HTTP port + 1 (e.g., if HTTP is 4321,
|
|
205
|
+
* WebSocket will be 4322).
|
|
206
|
+
*/
|
|
207
|
+
port?: number;
|
|
208
|
+
};
|
|
37
209
|
}
|
|
38
210
|
/**
|
|
39
211
|
* Configuration options for the development shell wrapper
|
|
212
|
+
*
|
|
213
|
+
* The shell provides the platform UI during development, including the
|
|
214
|
+
* Playcademy badge, game selection, and other platform features.
|
|
40
215
|
*/
|
|
41
216
|
export interface PlaycademyShellOptions {
|
|
42
217
|
/**
|
|
43
|
-
* Show the Playcademy badge in the corner during development
|
|
218
|
+
* Show the Playcademy badge in the corner during development.
|
|
219
|
+
*
|
|
44
220
|
* @default true
|
|
221
|
+
* @example
|
|
222
|
+
* ```ts
|
|
223
|
+
* shell: {
|
|
224
|
+
* showBadge: false // Hide the badge
|
|
225
|
+
* }
|
|
226
|
+
* ```
|
|
45
227
|
*/
|
|
46
228
|
showBadge?: boolean;
|
|
47
229
|
}
|
|
48
230
|
/**
|
|
49
|
-
* Main
|
|
231
|
+
* Main configuration options for the Playcademy Vite plugin
|
|
232
|
+
*
|
|
233
|
+
* Configure how your game integrates with the Playcademy platform during
|
|
234
|
+
* development and build.
|
|
235
|
+
*
|
|
236
|
+
* @example
|
|
237
|
+
* ```ts
|
|
238
|
+
* // vite.config.ts
|
|
239
|
+
* import { playcademy } from '@playcademy/vite-plugin'
|
|
240
|
+
*
|
|
241
|
+
* export default defineConfig({
|
|
242
|
+
* plugins: [
|
|
243
|
+
* playcademy({
|
|
244
|
+
* mode: 'platform',
|
|
245
|
+
* sandbox: {
|
|
246
|
+
* logLevel: 'debug',
|
|
247
|
+
* recreateDb: true
|
|
248
|
+
* },
|
|
249
|
+
* shell: {
|
|
250
|
+
* showBadge: true
|
|
251
|
+
* }
|
|
252
|
+
* })
|
|
253
|
+
* ]
|
|
254
|
+
* })
|
|
255
|
+
* ```
|
|
50
256
|
*/
|
|
51
257
|
export interface PlaycademyPluginOptions {
|
|
52
258
|
/**
|
|
53
|
-
* Plugin operation mode
|
|
259
|
+
* Plugin operation mode.
|
|
260
|
+
*
|
|
261
|
+
* - `'platform'`: Full development experience with sandbox server and shell (recommended)
|
|
262
|
+
* - `'standalone'`: Backend bundling only, no platform features
|
|
263
|
+
*
|
|
264
|
+
* Most games should use `'platform'` mode.
|
|
265
|
+
*
|
|
54
266
|
* @default 'platform'
|
|
267
|
+
* @example
|
|
268
|
+
* ```ts
|
|
269
|
+
* {
|
|
270
|
+
* mode: 'standalone' // For testing backend in isolation
|
|
271
|
+
* }
|
|
272
|
+
* ```
|
|
55
273
|
*/
|
|
56
274
|
mode?: PlaycademyMode;
|
|
275
|
+
/**
|
|
276
|
+
* Export/build configuration options.
|
|
277
|
+
*
|
|
278
|
+
* Controls how your game is packaged for deployment.
|
|
279
|
+
*
|
|
280
|
+
* @example
|
|
281
|
+
* ```ts
|
|
282
|
+
* {
|
|
283
|
+
* export: {
|
|
284
|
+
* autoZip: true // Create deployment zip automatically
|
|
285
|
+
* }
|
|
286
|
+
* }
|
|
287
|
+
* ```
|
|
288
|
+
*/
|
|
57
289
|
export?: PlaycademyExportOptions;
|
|
290
|
+
/**
|
|
291
|
+
* Sandbox server configuration options.
|
|
292
|
+
*
|
|
293
|
+
* The sandbox provides a local Playcademy platform environment for development.
|
|
294
|
+
*
|
|
295
|
+
* @example
|
|
296
|
+
* ```ts
|
|
297
|
+
* {
|
|
298
|
+
* sandbox: {
|
|
299
|
+
* logLevel: 'debug',
|
|
300
|
+
* recreateDb: true
|
|
301
|
+
* }
|
|
302
|
+
* }
|
|
303
|
+
* ```
|
|
304
|
+
*/
|
|
58
305
|
sandbox?: PlaycademySandboxOptions;
|
|
306
|
+
/**
|
|
307
|
+
* Development shell configuration options.
|
|
308
|
+
*
|
|
309
|
+
* The shell wraps your game with platform UI during development.
|
|
310
|
+
*
|
|
311
|
+
* @example
|
|
312
|
+
* ```ts
|
|
313
|
+
* {
|
|
314
|
+
* shell: {
|
|
315
|
+
* showBadge: false
|
|
316
|
+
* }
|
|
317
|
+
* }
|
|
318
|
+
* ```
|
|
319
|
+
*/
|
|
59
320
|
shell?: PlaycademyShellOptions;
|
|
60
321
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@playcademy/vite-plugin",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.27",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -21,11 +21,11 @@
|
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"archiver": "^7.0.1",
|
|
23
23
|
"picocolors": "^1.1.1",
|
|
24
|
-
"playcademy": "0.14.
|
|
24
|
+
"playcademy": "0.14.5"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@inquirer/prompts": "^7.8.6",
|
|
28
|
-
"@playcademy/sandbox": "0.1.
|
|
28
|
+
"@playcademy/sandbox": "0.1.10",
|
|
29
29
|
"@types/archiver": "^6.0.3",
|
|
30
30
|
"@types/bun": "latest"
|
|
31
31
|
},
|