@playcademy/vite-plugin 0.0.1-beta.9 → 0.1.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.
- package/README.md +291 -69
- package/dist/index.d.ts +1 -17
- package/dist/index.js +258500 -103652
- package/dist/lib/cli-server.d.ts +27 -0
- package/dist/lib/logging.d.ts +23 -0
- package/dist/lib/manifest.d.ts +1 -13
- package/dist/lib/sandbox.d.ts +6 -8
- package/dist/lib/server.d.ts +2 -2
- package/dist/pglite.data +0 -0
- package/dist/pglite.wasm +0 -0
- package/dist/types.d.ts +76 -0
- package/dist/types.js +0 -0
- package/dist/utils.d.ts +9 -6
- package/package.json +20 -13
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { startPlaycademyDevServer } from 'playcademy/utils';
|
|
2
|
+
import type { PlaycademyConfig } from 'playcademy/types';
|
|
3
|
+
import type { ResolvedConfig } from 'vite';
|
|
4
|
+
/**
|
|
5
|
+
* Determines if the CLI dev server is needed based on configuration.
|
|
6
|
+
* Checks for integrations or custom routes that require the game backend.
|
|
7
|
+
*
|
|
8
|
+
* @param config - Playcademy configuration
|
|
9
|
+
* @returns True if CLI dev server is needed
|
|
10
|
+
*/
|
|
11
|
+
export declare function needsCliDevServer(config: PlaycademyConfig): boolean;
|
|
12
|
+
interface CliServerManager {
|
|
13
|
+
server: Awaited<ReturnType<typeof startPlaycademyDevServer>>;
|
|
14
|
+
stopHotReload: () => void;
|
|
15
|
+
}
|
|
16
|
+
export interface CliDevServerOptions {
|
|
17
|
+
port: number;
|
|
18
|
+
config: PlaycademyConfig;
|
|
19
|
+
viteConfig: ResolvedConfig;
|
|
20
|
+
platformUrl?: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Starts the CLI dev server with hot reload enabled.
|
|
24
|
+
* Used by the Vite plugin to manage the game backend server.
|
|
25
|
+
*/
|
|
26
|
+
export declare function startCliDevServer(options: CliDevServerOptions): Promise<CliServerManager>;
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ResolvedConfig } from 'vite';
|
|
2
|
+
import type { ProjectInfo } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* Centralized logging utilities for the Vite plugin.
|
|
5
|
+
* Provides clear, prefixed, and color-coded output for multiple servers.
|
|
6
|
+
*/
|
|
7
|
+
export declare const log: {
|
|
8
|
+
sandbox: (msg: string) => void;
|
|
9
|
+
backend: (msg: string) => void;
|
|
10
|
+
playcademy: (msg: string) => void;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Prints a startup banner showing all running servers in Vite's style.
|
|
14
|
+
*
|
|
15
|
+
* @param viteConfig - Vite resolved configuration
|
|
16
|
+
* @param servers - Object containing port numbers for each server
|
|
17
|
+
* @param projectInfo - Project information
|
|
18
|
+
* @param sandboxVersion - Sandbox version string
|
|
19
|
+
*/
|
|
20
|
+
export declare function printBanner(viteConfig: ResolvedConfig, servers: {
|
|
21
|
+
sandbox: number;
|
|
22
|
+
backend?: number;
|
|
23
|
+
}, projectInfo: ProjectInfo, sandboxVersion: string): void;
|
package/dist/lib/manifest.d.ts
CHANGED
|
@@ -2,19 +2,7 @@
|
|
|
2
2
|
* Manifest generation and build output functionality
|
|
3
3
|
*/
|
|
4
4
|
import type { ResolvedConfig } from 'vite';
|
|
5
|
-
import type {
|
|
6
|
-
export interface PlaycademyOutputData {
|
|
7
|
-
manifestPath?: string;
|
|
8
|
-
manifestSizeKb?: string;
|
|
9
|
-
zipPath?: string;
|
|
10
|
-
zipSizeKb?: string;
|
|
11
|
-
}
|
|
12
|
-
export interface ManifestOptions {
|
|
13
|
-
bootMode: ManifestV1['bootMode'];
|
|
14
|
-
entryPoint: string;
|
|
15
|
-
styles: string[];
|
|
16
|
-
platform: ManifestV1['platform'];
|
|
17
|
-
}
|
|
5
|
+
import type { ManifestOptions, PlaycademyOutputData } from '../types';
|
|
18
6
|
export declare function generatePlaycademyManifest(config: ResolvedConfig, options: ManifestOptions, outDir: string, buildOutputs: PlaycademyOutputData): Promise<void>;
|
|
19
7
|
export declare function createOutputZipArchive(config: ResolvedConfig, outDir: string, buildOutputs: PlaycademyOutputData): Promise<void>;
|
|
20
8
|
export declare function performPlaycademyLogging(config: ResolvedConfig, buildOutputs: PlaycademyOutputData): void;
|
package/dist/lib/sandbox.d.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { type ProjectInfo } from '../utils';
|
|
2
1
|
import type { ResolvedConfig } from 'vite';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export {};
|
|
2
|
+
import type { SandboxManager } from '../types';
|
|
3
|
+
export declare function startSandbox(viteConfig: ResolvedConfig, autoStart?: boolean, options?: {
|
|
4
|
+
verbose?: boolean;
|
|
5
|
+
customUrl?: string;
|
|
6
|
+
quiet?: boolean;
|
|
7
|
+
}): Promise<SandboxManager>;
|
package/dist/lib/server.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { ViteDevServer } from 'vite';
|
|
2
|
-
import type {
|
|
3
|
-
export declare function devServerMiddleware(server: ViteDevServer,
|
|
2
|
+
import type { SandboxManager } from '../types';
|
|
3
|
+
export declare function devServerMiddleware(server: ViteDevServer, sandbox: SandboxManager, gameUrl: string | undefined, showBadge: boolean): void;
|
package/dist/pglite.data
CHANGED
|
Binary file
|
package/dist/pglite.wasm
CHANGED
|
Binary file
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type definitions for the Playcademy Vite Plugin
|
|
3
|
+
*/
|
|
4
|
+
import type { ManifestV1 } from '@playcademy/data/types';
|
|
5
|
+
/**
|
|
6
|
+
* Project information extracted from package.json and directory structure
|
|
7
|
+
*/
|
|
8
|
+
export interface ProjectInfo {
|
|
9
|
+
slug: string;
|
|
10
|
+
displayName: string;
|
|
11
|
+
version: string;
|
|
12
|
+
description?: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Configuration options for exporting Playcademy games
|
|
16
|
+
*/
|
|
17
|
+
export interface PlaycademyExportOptions {
|
|
18
|
+
bootMode?: ManifestV1['bootMode'];
|
|
19
|
+
entryPoint?: string;
|
|
20
|
+
styles?: string[];
|
|
21
|
+
platform?: ManifestV1['platform'];
|
|
22
|
+
autoZip?: boolean;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Configuration options for the Playcademy sandbox server
|
|
26
|
+
*/
|
|
27
|
+
export interface PlaycademySandboxOptions {
|
|
28
|
+
autoStart?: boolean;
|
|
29
|
+
url?: string;
|
|
30
|
+
verbose?: boolean;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Configuration options for the dev server shell
|
|
34
|
+
*/
|
|
35
|
+
export interface PlaycademyDevOptions {
|
|
36
|
+
/**
|
|
37
|
+
* Show the Playcademy badge in the corner during development
|
|
38
|
+
* @default true
|
|
39
|
+
*/
|
|
40
|
+
showBadge?: boolean;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Main plugin configuration options
|
|
44
|
+
*/
|
|
45
|
+
export interface PlaycademyPluginOptions {
|
|
46
|
+
export?: PlaycademyExportOptions;
|
|
47
|
+
sandbox?: PlaycademySandboxOptions;
|
|
48
|
+
dev?: PlaycademyDevOptions;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Build output data for logging and tracking
|
|
52
|
+
*/
|
|
53
|
+
export interface PlaycademyOutputData {
|
|
54
|
+
manifestPath?: string;
|
|
55
|
+
manifestSizeKb?: string;
|
|
56
|
+
zipPath?: string;
|
|
57
|
+
zipSizeKb?: string;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Options for manifest generation
|
|
61
|
+
*/
|
|
62
|
+
export interface ManifestOptions {
|
|
63
|
+
bootMode: ManifestV1['bootMode'];
|
|
64
|
+
entryPoint: string;
|
|
65
|
+
styles: string[];
|
|
66
|
+
platform: ManifestV1['platform'];
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Sandbox manager interface for controlling sandbox lifecycle
|
|
70
|
+
*/
|
|
71
|
+
export interface SandboxManager {
|
|
72
|
+
baseUrl: string;
|
|
73
|
+
realtimeUrl: string;
|
|
74
|
+
project: ProjectInfo | null;
|
|
75
|
+
cleanup: () => void;
|
|
76
|
+
}
|
package/dist/types.js
ADDED
|
File without changes
|
package/dist/utils.d.ts
CHANGED
|
@@ -2,12 +2,15 @@
|
|
|
2
2
|
* Utility functions for the Playcademy Vite plugin
|
|
3
3
|
*/
|
|
4
4
|
import type { ResolvedConfig } from 'vite';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
displayName: string;
|
|
8
|
-
version: string;
|
|
9
|
-
description?: string;
|
|
10
|
-
}
|
|
5
|
+
import type { PlaycademyConfig } from '@playcademy/sdk/server';
|
|
6
|
+
import type { ProjectInfo } from './types';
|
|
11
7
|
export declare function extractProjectInfo(viteConfig: ResolvedConfig): ProjectInfo;
|
|
12
8
|
export declare function formatNumberWithCommas(numStr: string): string;
|
|
13
9
|
export declare function findAvailablePort(startPort?: number): Promise<number>;
|
|
10
|
+
/**
|
|
11
|
+
* Loads the Playcademy configuration from the project root.
|
|
12
|
+
*
|
|
13
|
+
* @param viteConfig - Vite resolved configuration
|
|
14
|
+
* @returns Playcademy configuration or null if not found
|
|
15
|
+
*/
|
|
16
|
+
export declare function loadPlaycademyConfig(viteConfig: ResolvedConfig): Promise<PlaycademyConfig | null>;
|
package/package.json
CHANGED
|
@@ -1,34 +1,41 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@playcademy/vite-plugin",
|
|
3
|
+
"version": "0.1.1",
|
|
3
4
|
"type": "module",
|
|
4
|
-
"version": "0.0.1-beta.9",
|
|
5
|
-
"main": "dist/index.js",
|
|
6
|
-
"module": "dist/index.js",
|
|
7
5
|
"exports": {
|
|
8
6
|
".": {
|
|
9
7
|
"import": "./dist/index.js",
|
|
10
8
|
"types": "./dist/index.d.ts"
|
|
9
|
+
},
|
|
10
|
+
"./types": {
|
|
11
|
+
"import": "./dist/types.js",
|
|
12
|
+
"types": "./dist/types.d.ts"
|
|
11
13
|
}
|
|
12
14
|
},
|
|
15
|
+
"main": "dist/index.js",
|
|
16
|
+
"module": "dist/index.js",
|
|
13
17
|
"files": [
|
|
14
18
|
"dist"
|
|
15
19
|
],
|
|
16
20
|
"scripts": {
|
|
17
21
|
"build": "rm -rf dist && bun build.ts",
|
|
18
|
-
"pub": "bun
|
|
19
|
-
"
|
|
22
|
+
"pub": "bun publish.ts",
|
|
23
|
+
"docs": "typedoc --skipErrorChecking"
|
|
24
|
+
},
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"archiver": "^7.0.1",
|
|
27
|
+
"picocolors": "^1.1.1"
|
|
20
28
|
},
|
|
21
29
|
"devDependencies": {
|
|
22
|
-
"@
|
|
23
|
-
"@playcademy/sandbox": "0.1.0
|
|
30
|
+
"@inquirer/prompts": "^7.8.6",
|
|
31
|
+
"@playcademy/sandbox": "0.1.0",
|
|
32
|
+
"playcademy": "0.11.4",
|
|
24
33
|
"@types/archiver": "^6.0.3",
|
|
25
|
-
"@types/bun": "latest"
|
|
34
|
+
"@types/bun": "latest",
|
|
35
|
+
"yocto-spinner": "^0.2.2"
|
|
26
36
|
},
|
|
27
37
|
"peerDependencies": {
|
|
28
|
-
"typescript": "^5"
|
|
29
|
-
|
|
30
|
-
"dependencies": {
|
|
31
|
-
"archiver": "^7.0.1",
|
|
32
|
-
"picocolors": "^1.1.1"
|
|
38
|
+
"typescript": "^5",
|
|
39
|
+
"vite": "^5 || ^6"
|
|
33
40
|
}
|
|
34
41
|
}
|