@playcademy/vite-plugin 0.1.26-alpha.4 → 0.1.26-alpha.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 +10 -7
- package/dist/index.js +9 -8
- package/dist/lib/sandbox/server.d.ts +1 -0
- package/dist/server/platform-mode.d.ts +1 -0
- package/dist/types/internal.d.ts +1 -0
- package/dist/types/options.d.ts +5 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -120,7 +120,8 @@ export default defineConfig({
|
|
|
120
120
|
sandbox: {
|
|
121
121
|
autoStart: false, // Disable auto-start
|
|
122
122
|
url: 'http://localhost:8080', // Custom port
|
|
123
|
-
verbose: true, // Enable
|
|
123
|
+
verbose: true, // Enable verbose logging
|
|
124
|
+
logLevel: 'debug', // Set log level (debug, info, warn, error)
|
|
124
125
|
},
|
|
125
126
|
}),
|
|
126
127
|
],
|
|
@@ -142,12 +143,14 @@ Configuration for manifest generation and build output:
|
|
|
142
143
|
|
|
143
144
|
Configuration for the development sandbox server:
|
|
144
145
|
|
|
145
|
-
| Option
|
|
146
|
-
|
|
|
147
|
-
| `autoStart`
|
|
148
|
-
| `url`
|
|
149
|
-
| `verbose`
|
|
150
|
-
| `
|
|
146
|
+
| Option | Type | Default | Description |
|
|
147
|
+
| ------------ | ---------------------------------------- | ----------------------------- | -------------------------------- |
|
|
148
|
+
| `autoStart` | `boolean` | `true` | Start sandbox during development |
|
|
149
|
+
| `url` | `string` | `'http://localhost:4321/api'` | Sandbox server URL |
|
|
150
|
+
| `verbose` | `boolean` | `false` | Enable verbose logging |
|
|
151
|
+
| `logLevel` | `'debug' \| 'info' \| 'warn' \| 'error'` | `'info'` | Log level for sandbox server |
|
|
152
|
+
| `recreateDb` | `boolean` | `false` | Recreate database on each start |
|
|
153
|
+
| `realtime` | `object` | `{...}` | Real-time server configuration |
|
|
151
154
|
|
|
152
155
|
## Build Output
|
|
153
156
|
|
package/dist/index.js
CHANGED
|
@@ -194815,7 +194815,7 @@ function processServerOptions(port, options) {
|
|
|
194815
194815
|
timeback: timeback3,
|
|
194816
194816
|
logger: customLogger2
|
|
194817
194817
|
} = options;
|
|
194818
|
-
const effectiveLogLevel =
|
|
194818
|
+
const effectiveLogLevel = logLevel;
|
|
194819
194819
|
if (effectiveLogLevel) {
|
|
194820
194820
|
process.env.LOG_LEVEL = effectiveLogLevel;
|
|
194821
194821
|
}
|
|
@@ -205407,7 +205407,7 @@ function printSandboxInfo(viteConfig, apiPort, realtimePort, projectInfo) {
|
|
|
205407
205407
|
viteConfig.logger.info("");
|
|
205408
205408
|
}
|
|
205409
205409
|
async function startSandbox(viteConfig, autoStart = true, options = {}) {
|
|
205410
|
-
const { verbose = false, customUrl, quiet = false, recreateDb = false } = options;
|
|
205410
|
+
const { verbose = false, customUrl, quiet = false, recreateDb = false, logLevel = "info" } = options;
|
|
205411
205411
|
if (!autoStart || viteConfig.command !== "serve") {
|
|
205412
205412
|
const baseUrl = customUrl ?? `http://localhost:${DEFAULT_PORTS2.SANDBOX}`;
|
|
205413
205413
|
const deriveRealtimeUrl = (url) => {
|
|
@@ -205440,6 +205440,7 @@ async function startSandbox(viteConfig, autoStart = true, options = {}) {
|
|
|
205440
205440
|
quiet,
|
|
205441
205441
|
seed: true,
|
|
205442
205442
|
recreateDb,
|
|
205443
|
+
logLevel,
|
|
205443
205444
|
realtime: { enabled: false, port: realtimePort },
|
|
205444
205445
|
timeback: timebackOptions,
|
|
205445
205446
|
logger: createLoggerAdapter("sandbox")
|
|
@@ -205952,6 +205953,7 @@ function devServerMiddleware(server, sandbox, gameUrl, showBadge) {
|
|
|
205952
205953
|
async function configurePlatformMode(server, viteConfig, options) {
|
|
205953
205954
|
const sandbox = await startSandbox(viteConfig, options.startSandbox, {
|
|
205954
205955
|
verbose: options.verbose,
|
|
205956
|
+
logLevel: options.logLevel,
|
|
205955
205957
|
customUrl: options.sandboxUrl,
|
|
205956
205958
|
quiet: true,
|
|
205957
205959
|
recreateDb: options.recreateDb
|
|
@@ -206009,9 +206011,6 @@ async function toggleMode(options) {
|
|
|
206009
206011
|
options.viteConfig.logger.error("[Playcademy] Cannot toggle mode: no Vite server reference");
|
|
206010
206012
|
return;
|
|
206011
206013
|
}
|
|
206012
|
-
options.viteConfig.logger.info("");
|
|
206013
|
-
options.viteConfig.logger.info(import_picocolors7.default.yellow(`Switching from ${import_picocolors7.default.bold(currentMode)} to ${import_picocolors7.default.bold(newMode)} mode...`));
|
|
206014
|
-
options.viteConfig.logger.info("");
|
|
206015
206014
|
await cleanupServers();
|
|
206016
206015
|
await new Promise((resolve2) => setTimeout(resolve2, 100));
|
|
206017
206016
|
setCurrentMode(newMode);
|
|
@@ -206020,9 +206019,9 @@ async function toggleMode(options) {
|
|
|
206020
206019
|
} else {
|
|
206021
206020
|
await configurePlatformMode(viteServer, options.viteConfig, options.platformModeOptions);
|
|
206022
206021
|
}
|
|
206023
|
-
options.viteConfig.logger.info(
|
|
206024
|
-
|
|
206025
|
-
|
|
206022
|
+
options.viteConfig.logger.info(`
|
|
206023
|
+
${import_picocolors7.default.green(`✓ Switched to ${import_picocolors7.default.bold(newMode)} mode`)}
|
|
206024
|
+
`);
|
|
206026
206025
|
}
|
|
206027
206026
|
|
|
206028
206027
|
// src/hooks/configure-server.ts
|
|
@@ -206041,6 +206040,7 @@ async function configureServerHook(server, context) {
|
|
|
206041
206040
|
const platformModeOptions = {
|
|
206042
206041
|
startSandbox: context.options.startSandbox,
|
|
206043
206042
|
verbose: context.options.verbose,
|
|
206043
|
+
logLevel: context.options.logLevel,
|
|
206044
206044
|
sandboxUrl: context.options.sandboxUrl,
|
|
206045
206045
|
recreateDb: context.options.recreateDb,
|
|
206046
206046
|
showBadge: context.options.showBadge,
|
|
@@ -206106,6 +206106,7 @@ function resolveOptions(options) {
|
|
|
206106
206106
|
sandboxUrl: sandboxOptions.url ?? `http://localhost:${DEFAULT_PORTS4.SANDBOX}`,
|
|
206107
206107
|
startSandbox: sandboxOptions.url ? false : sandboxOptions.autoStart ?? true,
|
|
206108
206108
|
verbose: sandboxOptions.verbose ?? false,
|
|
206109
|
+
logLevel: sandboxOptions.logLevel ?? "info",
|
|
206109
206110
|
recreateDb: sandboxOptions.recreateDb ?? false,
|
|
206110
206111
|
showBadge: shellOptions.showBadge ?? true
|
|
206111
206112
|
};
|
package/dist/types/internal.d.ts
CHANGED
package/dist/types/options.d.ts
CHANGED
|
@@ -24,6 +24,11 @@ export interface PlaycademySandboxOptions {
|
|
|
24
24
|
autoStart?: boolean;
|
|
25
25
|
url?: string;
|
|
26
26
|
verbose?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Log level for the sandbox server
|
|
29
|
+
* @default 'info'
|
|
30
|
+
*/
|
|
31
|
+
logLevel?: 'debug' | 'info' | 'warn' | 'error';
|
|
27
32
|
/**
|
|
28
33
|
* Recreate the sandbox database on each start
|
|
29
34
|
* @default false
|