@rpgjs/vite 5.0.0-alpha.4 → 5.0.0-alpha.40
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/dist/entry-point-plugin.d.ts +48 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +1062 -468
- package/dist/index.js.map +1 -1
- package/dist/replace-config-import.d.ts +4 -0
- package/dist/rpgjs-plugin.d.ts +23 -0
- package/dist/server-plugin.d.ts +285 -0
- package/package.json +16 -12
- package/src/entry-point-plugin.ts +99 -0
- package/src/index.ts +4 -0
- package/src/module-config.ts +13 -0
- package/src/replace-config-import.ts +24 -0
- package/src/rpgjs-plugin.ts +29 -0
- package/src/server-plugin.ts +977 -0
- package/src/types/rpgjs__server.d.ts +11 -0
- package/tests/entry-point-plugin.spec.ts +172 -0
- package/tests/latency-simulation.spec.ts +209 -0
- package/vite.config.ts +2 -1
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Plugin } from 'vite';
|
|
2
|
+
export interface EntryPointPluginOptions {
|
|
3
|
+
/**
|
|
4
|
+
* Entry points configuration for different RPG types
|
|
5
|
+
* @default { rpg: './src/standalone.ts', mmorpg: './src/client.ts' }
|
|
6
|
+
*/
|
|
7
|
+
entryPoints?: {
|
|
8
|
+
rpg?: string;
|
|
9
|
+
mmorpg?: string;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* RPG type from environment variable
|
|
13
|
+
* @default process.env.RPG_TYPE || 'rpg'
|
|
14
|
+
*/
|
|
15
|
+
rpgType?: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Plugin Vite qui gère les points d'entrée selon le type de RPG
|
|
19
|
+
*
|
|
20
|
+
* Ce plugin modifie automatiquement le fichier HTML pour insérer la bonne balise script
|
|
21
|
+
* selon la variable d'environnement RPG_TYPE. Il supporte deux types :
|
|
22
|
+
* - 'rpg' : pour le mode standalone
|
|
23
|
+
* - 'mmorpg' : pour le mode multijoueur
|
|
24
|
+
*
|
|
25
|
+
* Le plugin recherche dans le HTML les balises script existantes et les remplace
|
|
26
|
+
* par le bon point d'entrée selon le type configuré.
|
|
27
|
+
*
|
|
28
|
+
* @param options - Configuration du plugin
|
|
29
|
+
* @returns Plugin Vite
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```typescript
|
|
33
|
+
* // vite.config.ts
|
|
34
|
+
* import { entryPointPlugin } from '@rpgjs/vite';
|
|
35
|
+
*
|
|
36
|
+
* export default defineConfig({
|
|
37
|
+
* plugins: [
|
|
38
|
+
* entryPointPlugin({
|
|
39
|
+
* entryPoints: {
|
|
40
|
+
* rpg: './src/standalone.ts',
|
|
41
|
+
* mmorpg: './src/client.ts'
|
|
42
|
+
* }
|
|
43
|
+
* })
|
|
44
|
+
* ]
|
|
45
|
+
* });
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
export declare function entryPointPlugin(options?: EntryPointPluginOptions): Plugin;
|
package/dist/index.d.ts
CHANGED
|
@@ -2,3 +2,7 @@ export { tiledMapFolderPlugin, type DataFolderPluginOptions } from './tiled-map-
|
|
|
2
2
|
export { rpgjsModuleViteConfig } from './module-config';
|
|
3
3
|
export { directivePlugin, type DirectivePluginOptions } from './directive-plugin';
|
|
4
4
|
export { removeImportsPlugin, type RemoveImportsPluginOptions } from './remove-imports-plugin';
|
|
5
|
+
export { replaceConfigImport } from './replace-config-import';
|
|
6
|
+
export { rpgjs } from './rpgjs-plugin';
|
|
7
|
+
export { serverPlugin } from './server-plugin';
|
|
8
|
+
export { entryPointPlugin, type EntryPointPluginOptions } from './entry-point-plugin';
|