@rpgjs/vite 5.0.0-beta.8 → 5.0.0-beta.9
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/CHANGELOG.md +11 -0
- package/dist/compatibility-v4/flag-transform.d.ts +6 -0
- package/dist/compatibility-v4/index.d.ts +22 -0
- package/dist/compatibility-v4/load-config-file.d.ts +2 -0
- package/dist/compatibility-v4/require-transform.d.ts +2 -0
- package/dist/compatibility-v4/utils.d.ts +55 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1329 -164
- package/dist/index.js.map +1 -1
- package/dist/rpgjs-plugin.d.ts +1 -0
- package/package.json +17 -9
- package/src/compatibility-v4/flag-transform.ts +61 -0
- package/src/compatibility-v4/index.ts +713 -0
- package/src/compatibility-v4/load-config-file.ts +38 -0
- package/src/compatibility-v4/require-transform.ts +67 -0
- package/src/compatibility-v4/utils.ts +170 -0
- package/src/index.ts +2 -1
- package/tests/compatibility-v4.spec.ts +105 -0
- package/tests/fixtures/v4-game/rpg.toml +11 -0
- package/tests/fixtures/v4-game/src/modules/main/characters/assets/hero.svg +2 -0
- package/tests/fixtures/v4-game/src/modules/main/characters/hero.ts +2 -0
- package/tests/fixtures/v4-game/src/modules/main/client.ts +4 -0
- package/tests/fixtures/v4-game/src/modules/main/database/potion.ts +6 -0
- package/tests/fixtures/v4-game/src/modules/main/events/npc.ts +4 -0
- package/tests/fixtures/v4-game/src/modules/main/gui/menu.vue +2 -0
- package/tests/fixtures/v4-game/src/modules/main/maps/map.tmx +2 -0
- package/tests/fixtures/v4-game/src/modules/main/maps/map.ts +7 -0
- package/tests/fixtures/v4-game/src/modules/main/player.ts +4 -0
- package/tests/fixtures/v4-game/src/modules/main/scene-map.ts +4 -0
- package/tests/fixtures/v4-game/src/modules/main/server.ts +4 -0
- package/tests/fixtures/v4-game/src/modules/main/sounds/theme.ogg +2 -0
- package/tests/fixtures/v4-game/src/modules/main/sounds/theme.ts +5 -0
- package/tests/fixtures/v4-game/src/modules/main/sprite.ts +4 -0
- package/tests/fixtures/v4-game/src/modules/main/worlds/maps/world-map.tmx +6 -0
- package/tests/fixtures/v4-game/src/modules/main/worlds/world.world +13 -0
- package/vite.config.ts +7 -1
package/CHANGELOG.md
CHANGED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Plugin } from 'vite';
|
|
2
|
+
import { ClientBuildConfigOptions, Config, ImportObject } from './utils';
|
|
3
|
+
type ImportImageObject = ImportObject & {
|
|
4
|
+
propImagesString: string;
|
|
5
|
+
};
|
|
6
|
+
export declare function createTiledMapEntries(modulePath: string, options: ClientBuildConfigOptions, projectRoot?: string): string;
|
|
7
|
+
export declare function createWorldMapEntries(modulePath: string, projectRoot?: string): string;
|
|
8
|
+
export declare function loadServerModuleFiles(modulePath: string, options: ClientBuildConfigOptions & {
|
|
9
|
+
modulesCreated?: string[];
|
|
10
|
+
}, config: Config, projectRoot?: string): string;
|
|
11
|
+
export declare function loadServerFiles(modulePath: string, options: ClientBuildConfigOptions & {
|
|
12
|
+
modulesCreated?: string[];
|
|
13
|
+
}, config: Config, projectRoot?: string): string;
|
|
14
|
+
export declare function loadSpriteSheet(directoryName: string, modulePath: string, options: ClientBuildConfigOptions, projectRoot?: string, warning?: boolean): ImportImageObject;
|
|
15
|
+
export declare function loadClientFiles(modulePath: string, options: ClientBuildConfigOptions, config: Config, projectRoot?: string): string;
|
|
16
|
+
export declare function createModuleLoad(id: string, variableName: string, modulePath: string, options: ClientBuildConfigOptions & {
|
|
17
|
+
modulesCreated?: string[];
|
|
18
|
+
}, config: Config, projectRoot?: string): string;
|
|
19
|
+
export declare function createModulesLoad(modules: string[]): string;
|
|
20
|
+
export declare function createClientConfigLoad(config: Config, options?: Pick<ClientBuildConfigOptions, "tiledMapBasePath">): string;
|
|
21
|
+
export default function compatibilityV4Plugin(options?: Partial<ClientBuildConfigOptions>): Plugin[];
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
export interface ClientBuildConfigOptions {
|
|
2
|
+
serveMode?: boolean;
|
|
3
|
+
side?: "client" | "server";
|
|
4
|
+
type?: "rpg" | "mmorpg";
|
|
5
|
+
mode?: string;
|
|
6
|
+
config?: Config;
|
|
7
|
+
tiledMapBasePath?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface Config {
|
|
10
|
+
modules?: string[];
|
|
11
|
+
modulesRoot?: string;
|
|
12
|
+
startMap?: string;
|
|
13
|
+
start?: {
|
|
14
|
+
map?: string;
|
|
15
|
+
graphic?: string;
|
|
16
|
+
hitbox?: [number, number];
|
|
17
|
+
};
|
|
18
|
+
inputs?: Record<string, {
|
|
19
|
+
bind: string | string[];
|
|
20
|
+
}>;
|
|
21
|
+
spritesheetDirectories?: string[];
|
|
22
|
+
compilerOptions?: {
|
|
23
|
+
alias?: Record<string, string>;
|
|
24
|
+
build?: {
|
|
25
|
+
outputDir?: string;
|
|
26
|
+
pwaEnabled?: boolean;
|
|
27
|
+
assetsPath?: string;
|
|
28
|
+
serverUrl?: string;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
autostart?: boolean;
|
|
32
|
+
type?: "rpg" | "mmorpg";
|
|
33
|
+
vite?: any;
|
|
34
|
+
[key: string]: any;
|
|
35
|
+
}
|
|
36
|
+
export interface ImportObject {
|
|
37
|
+
importString: string;
|
|
38
|
+
variablesString: string;
|
|
39
|
+
folder: string;
|
|
40
|
+
relativePath: string;
|
|
41
|
+
}
|
|
42
|
+
export declare function dedent(strings: TemplateStringsArray, ...values: unknown[]): string;
|
|
43
|
+
export declare function warn(message: string): void;
|
|
44
|
+
export declare function toPosix(value: string): string;
|
|
45
|
+
export declare function formatVariableName(value: string): string;
|
|
46
|
+
export declare function transformPathIfModule(moduleName: string): string;
|
|
47
|
+
export declare function resolveModuleImport(moduleName: string): string;
|
|
48
|
+
export declare function getAllFiles(dirPath: string): string[];
|
|
49
|
+
export declare function importPathForFile(file: string, root: string): string;
|
|
50
|
+
export declare function importString(modulePath: string, fileName: string, variableName?: string, projectRoot?: string): string;
|
|
51
|
+
export declare function searchFolderAndTransformToImportString(folderPath: string, modulePath: string, extensionFilter: string | string[], returnCb?: (file: string, variableName: string, absoluteFile: string) => string, options?: {
|
|
52
|
+
customFilter?: (file: string) => boolean;
|
|
53
|
+
}, projectRoot?: string): ImportObject;
|
|
54
|
+
export declare function replaceEnvVars(obj: any, envs: Record<string, string | undefined>): any;
|
|
55
|
+
export declare function assetsFolder(outputDir: string): string;
|
package/dist/index.d.ts
CHANGED
|
@@ -6,3 +6,4 @@ export { replaceConfigImport } from './replace-config-import';
|
|
|
6
6
|
export { rpgjs } from './rpgjs-plugin';
|
|
7
7
|
export { serverPlugin } from './server-plugin';
|
|
8
8
|
export { entryPointPlugin, type EntryPointPluginOptions } from './entry-point-plugin';
|
|
9
|
+
export { default as compatibilityV4Plugin } from './compatibility-v4';
|