@gamedevland/vite 0.0.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/LICENSE +23 -0
- package/README.md +30 -0
- package/dist/BuildDefaultLocaleEnvResolver.d.ts +6 -0
- package/dist/BuildDefaultLocaleEnvResolver.js +19 -0
- package/dist/BuildGameDistributionGameIdConfigResolver.d.ts +12 -0
- package/dist/BuildGameDistributionGameIdConfigResolver.js +58 -0
- package/dist/BuildGameDistributionSdkHeadTagCatalog.d.ts +9 -0
- package/dist/BuildGameDistributionSdkHeadTagCatalog.js +29 -0
- package/dist/BuildPlatformDevProxyCatalog.d.ts +8 -0
- package/dist/BuildPlatformDevProxyCatalog.js +17 -0
- package/dist/BuildPlatformEnvResolver.d.ts +6 -0
- package/dist/BuildPlatformEnvResolver.js +18 -0
- package/dist/BuildPlatformSdkCatalog.d.ts +13 -0
- package/dist/BuildPlatformSdkCatalog.js +28 -0
- package/dist/BuildPlatformSdkInjectPluginFactory.d.ts +9 -0
- package/dist/BuildPlatformSdkInjectPluginFactory.js +18 -0
- package/dist/GameViteConfigFactory.d.ts +11 -0
- package/dist/GameViteConfigFactory.js +56 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +13 -0
- package/package.json +53 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
Gamedev Land SDK License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Gamedev Land
|
|
4
|
+
|
|
5
|
+
This license applies to the compiled @gamedevland/vite npm package and its TypeScript declaration files.
|
|
6
|
+
|
|
7
|
+
Permission is granted to install and use the package to build, test, and distribute games, demos,
|
|
8
|
+
tutorials, and related web applications.
|
|
9
|
+
|
|
10
|
+
The package may be redistributed only as an unmodified dependency through package managers, deployment
|
|
11
|
+
artifacts, or application bundles generated as part of a game or web application.
|
|
12
|
+
|
|
13
|
+
You may not:
|
|
14
|
+
|
|
15
|
+
- claim that the SDK itself is open source;
|
|
16
|
+
- republish, sublicense, sell, or repackage the SDK as a competing SDK, engine, library, or framework;
|
|
17
|
+
- remove copyright, license, or package identity notices;
|
|
18
|
+
- use the package name, author name, or repository identity to imply endorsement without permission.
|
|
19
|
+
|
|
20
|
+
The SDK is provided "as is", without warranty of any kind, express or implied, including but not limited
|
|
21
|
+
to the warranties of merchantability, fitness for a particular purpose, and noninfringement. In no event
|
|
22
|
+
shall the authors or copyright holders be liable for any claim, damages, or other liability arising from
|
|
23
|
+
the SDK or its use.
|
package/README.md
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# @gamedevland/vite
|
|
2
|
+
|
|
3
|
+
Vite build tooling for HTML5 games built with `@gamedevland/engine`.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @gamedevland/engine @gamedevland/vite
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Vite 7 or 8 must be installed in the game project.
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import { createGameViteConfig } from '@gamedevland/vite';
|
|
17
|
+
|
|
18
|
+
export default ({ mode }: { readonly mode: string }) =>
|
|
19
|
+
createGameViteConfig({
|
|
20
|
+
mode,
|
|
21
|
+
repoRoot: __dirname,
|
|
22
|
+
});
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
The package provides the shared Gamedev Land platform configuration, development proxy setup,
|
|
26
|
+
environment resolution, and platform SDK injection used by engine-based game projects.
|
|
27
|
+
|
|
28
|
+
## License
|
|
29
|
+
|
|
30
|
+
This package is public but not open source. See [LICENSE](./LICENSE).
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { LocaleCatalog } from '@gamedevland/engine/configs';
|
|
2
|
+
import { loadEnv } from 'vite';
|
|
3
|
+
/**
|
|
4
|
+
* Resolves and validates the build-time default locale.
|
|
5
|
+
*/
|
|
6
|
+
export class BuildDefaultLocaleEnvResolver {
|
|
7
|
+
static resolve(mode, cwd) {
|
|
8
|
+
const env = loadEnv(mode, cwd, '');
|
|
9
|
+
const rawLocale = process.env.VITE_DEFAULT_LOCALE ?? env.VITE_DEFAULT_LOCALE;
|
|
10
|
+
if (rawLocale == null || rawLocale.length === 0) {
|
|
11
|
+
return LocaleCatalog.DEFAULT;
|
|
12
|
+
}
|
|
13
|
+
const normalized = LocaleCatalog.normalize(rawLocale);
|
|
14
|
+
if (normalized === null) {
|
|
15
|
+
throw new Error(`[vite] Unsupported VITE_DEFAULT_LOCALE value "${rawLocale}". Supported values: ${LocaleCatalog.getSupportedList().join(', ')}.`);
|
|
16
|
+
}
|
|
17
|
+
return normalized;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolves the GameDistribution game id from the static game JSON config.
|
|
3
|
+
*/
|
|
4
|
+
export declare class BuildGameDistributionGameIdConfigResolver {
|
|
5
|
+
private static readonly CONFIG_FILE_PATH;
|
|
6
|
+
private static readonly ROOT_PATH;
|
|
7
|
+
private static readonly GAMEDISTRIBUTION_PATH;
|
|
8
|
+
private static readonly GAME_ID_PATH;
|
|
9
|
+
static resolve(platformId: string, repoRoot: string): string | undefined;
|
|
10
|
+
private static decodeConfig;
|
|
11
|
+
private static isRecord;
|
|
12
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { PlatformCatalog, PlatformIntegrationsConfigContract } from '@gamedevland/engine/platforms';
|
|
4
|
+
/**
|
|
5
|
+
* Resolves the GameDistribution game id from the static game JSON config.
|
|
6
|
+
*/
|
|
7
|
+
export class BuildGameDistributionGameIdConfigResolver {
|
|
8
|
+
static CONFIG_FILE_PATH = 'game/assets/json/configs/common/app/platforms.json';
|
|
9
|
+
static ROOT_PATH = '$';
|
|
10
|
+
static GAMEDISTRIBUTION_PATH = '$.gamedistribution';
|
|
11
|
+
static GAME_ID_PATH = '$.gamedistribution.gameId';
|
|
12
|
+
static resolve(platformId, repoRoot) {
|
|
13
|
+
if (platformId !== PlatformCatalog.GAMEDISTRIBUTION) {
|
|
14
|
+
return undefined;
|
|
15
|
+
}
|
|
16
|
+
const filePath = path.resolve(repoRoot, BuildGameDistributionGameIdConfigResolver.CONFIG_FILE_PATH);
|
|
17
|
+
let rawContent = '';
|
|
18
|
+
try {
|
|
19
|
+
rawContent = fs.readFileSync(filePath, 'utf-8');
|
|
20
|
+
}
|
|
21
|
+
catch (cause) {
|
|
22
|
+
throw new Error(`[vite] Failed to read GameDistribution config at '${filePath}'.`, { cause });
|
|
23
|
+
}
|
|
24
|
+
let parsed;
|
|
25
|
+
try {
|
|
26
|
+
parsed = JSON.parse(rawContent);
|
|
27
|
+
}
|
|
28
|
+
catch (cause) {
|
|
29
|
+
throw new Error(`[vite] Invalid JSON in GameDistribution config '${filePath}'.`, { cause });
|
|
30
|
+
}
|
|
31
|
+
const decoded = BuildGameDistributionGameIdConfigResolver.decodeConfig(parsed, filePath);
|
|
32
|
+
return PlatformIntegrationsConfigContract.getRequiredGameDistributionGameId(decoded, filePath);
|
|
33
|
+
}
|
|
34
|
+
static decodeConfig(input, filePath) {
|
|
35
|
+
if (!BuildGameDistributionGameIdConfigResolver.isRecord(input)) {
|
|
36
|
+
throw new Error(`[vite] ${filePath} expected object at '${BuildGameDistributionGameIdConfigResolver.ROOT_PATH}'`);
|
|
37
|
+
}
|
|
38
|
+
const rawGameDistribution = input.gamedistribution;
|
|
39
|
+
if (rawGameDistribution === undefined) {
|
|
40
|
+
return {};
|
|
41
|
+
}
|
|
42
|
+
if (!BuildGameDistributionGameIdConfigResolver.isRecord(rawGameDistribution)) {
|
|
43
|
+
throw new Error(`[vite] ${filePath} expected object at '${BuildGameDistributionGameIdConfigResolver.GAMEDISTRIBUTION_PATH}'`);
|
|
44
|
+
}
|
|
45
|
+
const rawGameId = rawGameDistribution.gameId;
|
|
46
|
+
if (typeof rawGameId !== 'string' || rawGameId.trim().length === 0) {
|
|
47
|
+
throw new Error(`[vite] ${filePath} expected non-empty string at '${BuildGameDistributionGameIdConfigResolver.GAME_ID_PATH}'`);
|
|
48
|
+
}
|
|
49
|
+
return {
|
|
50
|
+
gamedistribution: {
|
|
51
|
+
gameId: rawGameId.trim(),
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
static isRecord(value) {
|
|
56
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { HtmlTagDescriptor } from 'vite';
|
|
2
|
+
/**
|
|
3
|
+
* Produces build-time HTML head tags required by the GameDistribution SDK.
|
|
4
|
+
*/
|
|
5
|
+
export declare class BuildGameDistributionSdkHeadTagCatalog {
|
|
6
|
+
static resolve(gameId: string | undefined): HtmlTagDescriptor[];
|
|
7
|
+
private static createScriptTag;
|
|
8
|
+
private static createInlineScriptTag;
|
|
9
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { GameDistributionBootstrapContract } from '@gamedevland/engine/platforms';
|
|
2
|
+
/**
|
|
3
|
+
* Produces build-time HTML head tags required by the GameDistribution SDK.
|
|
4
|
+
*/
|
|
5
|
+
export class BuildGameDistributionSdkHeadTagCatalog {
|
|
6
|
+
static resolve(gameId) {
|
|
7
|
+
if (!gameId) {
|
|
8
|
+
throw new Error('[vite] Missing GameDistribution game id while preparing SDK head tags.');
|
|
9
|
+
}
|
|
10
|
+
return [
|
|
11
|
+
BuildGameDistributionSdkHeadTagCatalog.createInlineScriptTag(GameDistributionBootstrapContract.createBootstrapScript(gameId)),
|
|
12
|
+
BuildGameDistributionSdkHeadTagCatalog.createScriptTag(GameDistributionBootstrapContract.SDK_SCRIPT_SRC, { id: GameDistributionBootstrapContract.SDK_SCRIPT_ID }),
|
|
13
|
+
];
|
|
14
|
+
}
|
|
15
|
+
static createScriptTag(src, attrs) {
|
|
16
|
+
return {
|
|
17
|
+
tag: 'script',
|
|
18
|
+
attrs: { src, ...(attrs ?? {}) },
|
|
19
|
+
injectTo: 'head-prepend',
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
static createInlineScriptTag(children) {
|
|
23
|
+
return {
|
|
24
|
+
tag: 'script',
|
|
25
|
+
children,
|
|
26
|
+
injectTo: 'head-prepend',
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ProxyOptions } from 'vite';
|
|
2
|
+
/**
|
|
3
|
+
* Build-time mapping for platform-specific dev proxy configuration.
|
|
4
|
+
*/
|
|
5
|
+
export declare class BuildPlatformDevProxyCatalog {
|
|
6
|
+
private static readonly DEV_PROXY_BY_PLATFORM;
|
|
7
|
+
static resolve(platformId: string): Readonly<Record<string, string | ProxyOptions>> | undefined;
|
|
8
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { PlatformCatalog } from '@gamedevland/engine/platforms';
|
|
2
|
+
/**
|
|
3
|
+
* Build-time mapping for platform-specific dev proxy configuration.
|
|
4
|
+
*/
|
|
5
|
+
export class BuildPlatformDevProxyCatalog {
|
|
6
|
+
static DEV_PROXY_BY_PLATFORM = {
|
|
7
|
+
[PlatformCatalog.YANDEX]: {
|
|
8
|
+
'/sdk.js': {
|
|
9
|
+
target: 'https://sdk.games.s3.yandex.net',
|
|
10
|
+
changeOrigin: true,
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
static resolve(platformId) {
|
|
15
|
+
return BuildPlatformDevProxyCatalog.DEV_PROXY_BY_PLATFORM[platformId];
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { loadEnv } from 'vite';
|
|
2
|
+
import { PlatformCatalog } from '@gamedevland/engine/platforms';
|
|
3
|
+
/**
|
|
4
|
+
* Resolves and validates build platform from environment.
|
|
5
|
+
*/
|
|
6
|
+
export class BuildPlatformEnvResolver {
|
|
7
|
+
static resolve(mode, cwd) {
|
|
8
|
+
const env = loadEnv(mode, cwd, '');
|
|
9
|
+
const rawPlatformId = process.env.VITE_PLATFORM ?? env.VITE_PLATFORM;
|
|
10
|
+
if (rawPlatformId == null || rawPlatformId.length === 0) {
|
|
11
|
+
return PlatformCatalog.getDefault();
|
|
12
|
+
}
|
|
13
|
+
if (!PlatformCatalog.isSupported(rawPlatformId)) {
|
|
14
|
+
throw new Error(`[vite] Unsupported VITE_PLATFORM value "${rawPlatformId}". Supported values: ${PlatformCatalog.getSupportedList().join(', ')}.`);
|
|
15
|
+
}
|
|
16
|
+
return rawPlatformId;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { HtmlTagDescriptor } from 'vite';
|
|
2
|
+
interface BuildPlatformSdkCatalogOptions {
|
|
3
|
+
readonly gameDistributionGameId?: string;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Build-time mapping for platform SDK head tag injection.
|
|
7
|
+
*/
|
|
8
|
+
export declare class BuildPlatformSdkCatalog {
|
|
9
|
+
private static readonly HEAD_TAG_RESOLVER_BY_PLATFORM;
|
|
10
|
+
static resolveHeadTags(platformId: string, options?: BuildPlatformSdkCatalogOptions): HtmlTagDescriptor[];
|
|
11
|
+
private static createScriptTag;
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { PlatformCatalog } from '@gamedevland/engine/platforms';
|
|
2
|
+
import { BuildGameDistributionSdkHeadTagCatalog } from './BuildGameDistributionSdkHeadTagCatalog.js';
|
|
3
|
+
/**
|
|
4
|
+
* Build-time mapping for platform SDK head tag injection.
|
|
5
|
+
*/
|
|
6
|
+
export class BuildPlatformSdkCatalog {
|
|
7
|
+
static HEAD_TAG_RESOLVER_BY_PLATFORM = {
|
|
8
|
+
[PlatformCatalog.POKI]: () => [
|
|
9
|
+
BuildPlatformSdkCatalog.createScriptTag('https://game-cdn.poki.com/scripts/v2/poki-sdk.js'),
|
|
10
|
+
],
|
|
11
|
+
[PlatformCatalog.CRAZYGAMES]: () => [
|
|
12
|
+
BuildPlatformSdkCatalog.createScriptTag('https://sdk.crazygames.com/crazygames-sdk-v3.js'),
|
|
13
|
+
],
|
|
14
|
+
[PlatformCatalog.YANDEX]: () => [BuildPlatformSdkCatalog.createScriptTag('/sdk.js')],
|
|
15
|
+
[PlatformCatalog.GAMEDISTRIBUTION]: (options) => BuildGameDistributionSdkHeadTagCatalog.resolve(options?.gameDistributionGameId),
|
|
16
|
+
};
|
|
17
|
+
static resolveHeadTags(platformId, options) {
|
|
18
|
+
const resolver = BuildPlatformSdkCatalog.HEAD_TAG_RESOLVER_BY_PLATFORM[platformId];
|
|
19
|
+
return resolver ? resolver(options) : [];
|
|
20
|
+
}
|
|
21
|
+
static createScriptTag(src, attrs) {
|
|
22
|
+
return {
|
|
23
|
+
tag: 'script',
|
|
24
|
+
attrs: { src, ...(attrs ?? {}) },
|
|
25
|
+
injectTo: 'head-prepend',
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Plugin } from 'vite';
|
|
2
|
+
/**
|
|
3
|
+
* Produces HTML transform plugin that injects platform SDK script tag.
|
|
4
|
+
*/
|
|
5
|
+
export declare class BuildPlatformSdkInjectPluginFactory {
|
|
6
|
+
static create(platformId: string, options?: {
|
|
7
|
+
readonly gameDistributionGameId?: string;
|
|
8
|
+
}): Plugin;
|
|
9
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { BuildPlatformSdkCatalog } from './BuildPlatformSdkCatalog.js';
|
|
2
|
+
/**
|
|
3
|
+
* Produces HTML transform plugin that injects platform SDK script tag.
|
|
4
|
+
*/
|
|
5
|
+
export class BuildPlatformSdkInjectPluginFactory {
|
|
6
|
+
static create(platformId, options) {
|
|
7
|
+
return {
|
|
8
|
+
name: 'platform-sdk-inject',
|
|
9
|
+
transformIndexHtml() {
|
|
10
|
+
const headTags = BuildPlatformSdkCatalog.resolveHeadTags(platformId, options);
|
|
11
|
+
if (headTags.length === 0) {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
return headTags;
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { UserConfig } from 'vite';
|
|
2
|
+
export interface GameViteConfigFactoryOptions {
|
|
3
|
+
readonly mode: string;
|
|
4
|
+
readonly repoRoot: string;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Composition root for game Vite configuration.
|
|
8
|
+
*/
|
|
9
|
+
export declare class GameViteConfigFactory {
|
|
10
|
+
static create(options: GameViteConfigFactoryOptions): UserConfig;
|
|
11
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { BuildDefaultLocaleEnvResolver } from './BuildDefaultLocaleEnvResolver.js';
|
|
3
|
+
import { BuildGameDistributionGameIdConfigResolver } from './BuildGameDistributionGameIdConfigResolver.js';
|
|
4
|
+
import { BuildPlatformDevProxyCatalog } from './BuildPlatformDevProxyCatalog.js';
|
|
5
|
+
import { BuildPlatformEnvResolver } from './BuildPlatformEnvResolver.js';
|
|
6
|
+
import { BuildPlatformSdkInjectPluginFactory } from './BuildPlatformSdkInjectPluginFactory.js';
|
|
7
|
+
/**
|
|
8
|
+
* Composition root for game Vite configuration.
|
|
9
|
+
*/
|
|
10
|
+
export class GameViteConfigFactory {
|
|
11
|
+
static create(options) {
|
|
12
|
+
const platformId = BuildPlatformEnvResolver.resolve(options.mode, process.cwd());
|
|
13
|
+
const defaultLocale = BuildDefaultLocaleEnvResolver.resolve(options.mode, process.cwd());
|
|
14
|
+
const gameDistributionGameId = BuildGameDistributionGameIdConfigResolver.resolve(platformId, options.repoRoot);
|
|
15
|
+
const platformSdkInjectOptions = gameDistributionGameId === undefined ? undefined : { gameDistributionGameId };
|
|
16
|
+
const devProxy = BuildPlatformDevProxyCatalog.resolve(platformId);
|
|
17
|
+
return {
|
|
18
|
+
root: path.resolve(options.repoRoot, 'game'),
|
|
19
|
+
// Keep built asset URLs relative so dist/index.html works from subpaths
|
|
20
|
+
// (e.g. Live Server at /dist/) and static hosts without root rewrites.
|
|
21
|
+
base: './',
|
|
22
|
+
resolve: {
|
|
23
|
+
alias: [
|
|
24
|
+
{ find: '@game', replacement: path.resolve(options.repoRoot, 'game') },
|
|
25
|
+
{ find: '@json', replacement: path.resolve(options.repoRoot, 'game/json') },
|
|
26
|
+
{ find: '@common', replacement: path.resolve(options.repoRoot, 'game/src/common') },
|
|
27
|
+
{ find: '@modules', replacement: path.resolve(options.repoRoot, 'modules') },
|
|
28
|
+
],
|
|
29
|
+
},
|
|
30
|
+
server: {
|
|
31
|
+
port: 5173,
|
|
32
|
+
open: true,
|
|
33
|
+
...(devProxy ? { proxy: devProxy } : {}),
|
|
34
|
+
},
|
|
35
|
+
preview: {
|
|
36
|
+
port: 5173,
|
|
37
|
+
},
|
|
38
|
+
define: {
|
|
39
|
+
'import.meta.env.VITE_PLATFORM': JSON.stringify(platformId),
|
|
40
|
+
'import.meta.env.VITE_DEFAULT_LOCALE': JSON.stringify(defaultLocale),
|
|
41
|
+
},
|
|
42
|
+
esbuild: {
|
|
43
|
+
// DI/FSM tokens currently rely on runtime class.name values.
|
|
44
|
+
// Keep class/function names stable in production bundles.
|
|
45
|
+
keepNames: true,
|
|
46
|
+
},
|
|
47
|
+
plugins: [
|
|
48
|
+
BuildPlatformSdkInjectPluginFactory.create(platformId, platformSdkInjectOptions),
|
|
49
|
+
],
|
|
50
|
+
build: {
|
|
51
|
+
outDir: path.resolve(options.repoRoot, 'dist'),
|
|
52
|
+
emptyOutDir: true,
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { GameViteConfigFactory } from './GameViteConfigFactory.js';
|
|
2
|
+
import type { GameViteConfigFactoryOptions } from './GameViteConfigFactory.js';
|
|
3
|
+
import type { UserConfig } from 'vite';
|
|
4
|
+
/**
|
|
5
|
+
* Creates a production-ready Vite config for Gamedev Land web games.
|
|
6
|
+
*/
|
|
7
|
+
export declare class GameViteConfig {
|
|
8
|
+
static create(options: GameViteConfigFactoryOptions): UserConfig;
|
|
9
|
+
}
|
|
10
|
+
export declare function createGameViteConfig(options: GameViteConfigFactoryOptions): UserConfig;
|
|
11
|
+
export { GameViteConfigFactory };
|
|
12
|
+
export type { GameViteConfigFactoryOptions };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { GameViteConfigFactory } from './GameViteConfigFactory.js';
|
|
2
|
+
/**
|
|
3
|
+
* Creates a production-ready Vite config for Gamedev Land web games.
|
|
4
|
+
*/
|
|
5
|
+
export class GameViteConfig {
|
|
6
|
+
static create(options) {
|
|
7
|
+
return GameViteConfigFactory.create(options);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export function createGameViteConfig(options) {
|
|
11
|
+
return GameViteConfig.create(options);
|
|
12
|
+
}
|
|
13
|
+
export { GameViteConfigFactory };
|
package/package.json
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@gamedevland/vite",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "Vite build tooling for Gamedev Land HTML5 games.",
|
|
6
|
+
"license": "SEE LICENSE IN LICENSE",
|
|
7
|
+
"author": "Gamedev Land",
|
|
8
|
+
"homepage": "https://github.com/gamedevland/sdk#readme",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/gamedevland/sdk.git",
|
|
12
|
+
"directory": "packages/vite"
|
|
13
|
+
},
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/gamedevland/sdk/issues"
|
|
16
|
+
},
|
|
17
|
+
"keywords": [
|
|
18
|
+
"gamedev",
|
|
19
|
+
"html5-game",
|
|
20
|
+
"vite",
|
|
21
|
+
"typescript",
|
|
22
|
+
"sdk"
|
|
23
|
+
],
|
|
24
|
+
"main": "./dist/index.js",
|
|
25
|
+
"types": "./dist/index.d.ts",
|
|
26
|
+
"sideEffects": false,
|
|
27
|
+
"files": [
|
|
28
|
+
"dist",
|
|
29
|
+
"README.md",
|
|
30
|
+
"LICENSE"
|
|
31
|
+
],
|
|
32
|
+
"publishConfig": {
|
|
33
|
+
"access": "public"
|
|
34
|
+
},
|
|
35
|
+
"exports": {
|
|
36
|
+
".": {
|
|
37
|
+
"types": "./dist/index.d.ts",
|
|
38
|
+
"import": "./dist/index.js"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"scripts": {
|
|
42
|
+
"clean": "rimraf dist *.tsbuildinfo",
|
|
43
|
+
"pretypecheck": "npm run build -w @gamedevland/engine",
|
|
44
|
+
"typecheck": "tsc --noEmit",
|
|
45
|
+
"build": "npm run clean && tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json --resolve-full-paths"
|
|
46
|
+
},
|
|
47
|
+
"dependencies": {
|
|
48
|
+
"@gamedevland/engine": "0.0.2"
|
|
49
|
+
},
|
|
50
|
+
"peerDependencies": {
|
|
51
|
+
"vite": "^7.1.0 || ^8.0.0"
|
|
52
|
+
}
|
|
53
|
+
}
|