@moostjs/vite 0.5.21 → 0.5.23

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/index.d.ts CHANGED
@@ -1,90 +1,18 @@
1
1
  import { Plugin } from 'vite';
2
2
 
3
3
  interface TMoostViteDevOptions {
4
- /**
5
- * The entry file for the application.
6
- * This file serves as the main entry point for the build process and SSR server.
7
- *
8
- * Example: './src/main.ts'
9
- */
10
4
  entry: string;
11
- /**
12
- * The port number for the Vite dev server.
13
- *
14
- * Default: `3000`.
15
- */
16
5
  port?: number;
17
- /**
18
- * The hostname or IP address for the Vite dev server.
19
- * If not specified, defaults to `'localhost'`.
20
- *
21
- * Example: '0.0.0.0'
22
- */
23
6
  host?: string;
24
- /**
25
- * The output directory for the build artifacts.
26
- *
27
- * Default to: `'dist'`.
28
- */
29
7
  outDir?: string;
30
- /**
31
- * The output format for the build artifacts.
32
- * - `'cjs'`: CommonJS, suitable for Node.js environments.
33
- * - `'esm'`: ES Module, suitable for modern environments.
34
- *
35
- * Default: `'esm'`.
36
- */
37
8
  format?: 'cjs' | 'esm';
38
- /**
39
- * Whether to generate source maps for the build output.
40
- * Source maps are useful for debugging purposes by mapping minified code back to the original source.
41
- *
42
- * Default: `true`.
43
- */
44
9
  sourcemap?: boolean;
45
- /**
46
- * Configuration for defining external dependencies during the build process.
47
- *
48
- * This helps in excluding certain modules from the bundled output, reducing the bundle size and
49
- * allowing them to be resolved at runtime instead.
50
- *
51
- * Default: `true`.
52
- */
53
10
  externals?: {
54
- /**
55
- * Whether to exclude Node.js built-in modules (e.g., `fs`, `path`, `node:fs`) from the build output.
56
- * If `true`, all Node.js built-ins will be marked as external.
57
- * Default: `false`.
58
- */
59
11
  node?: boolean;
60
- /**
61
- * Whether to exclude workspace dependencies (e.g., packages marked with `workspace:*` in `package.json`) from the build output.
62
- * If `true`, all workspace dependencies will be marked as external.
63
- * Default: `false`.
64
- */
65
12
  workspace?: boolean;
66
13
  } | boolean;
67
14
  onEject?: (instance: object, dependency: Function) => boolean;
68
15
  }
69
- /**
70
- * The main Vite plugin for integrating Moost applications.
71
- *
72
- * Features:
73
- * - **Adapter Detection**: Detects Moost adapter usage (`http`, `cli`, `wf`) and applies relevant configurations.
74
- * - **Dev Mode Middleware**:
75
- * - Patches `MoostHttp.prototype.listen` to register a custom middleware for serving the app via Vite's dev server instead of binding to a port.
76
- * - Handles Moost state cleanup and hot module replacement (HMR) during development.
77
- * - **Class Tracking**: Injects a `__VITE_ID()` decorator into exported classes to enable tracking and cleanup during hot reloads.
78
- * - **Externals Support**:
79
- * - Allows marking Node.js built-in modules and dependencies from `package.json` (optionally excluding workspace dependencies) as external during builds.
80
- * - Configured via the `externals` option, which helps reduce bundle size and ensures compatibility with runtime environments.
81
- * - **Build and Test Friendly**:
82
- * - Avoids interfering with Vitest runs by skipping dev-specific behaviors during tests.
83
- * - Ensures proper SSR entry setup and Rollup configurations for production builds.
84
- *
85
- * @param {TMoostViteDevOptions} options - Configuration options for the Moost Vite plugin.
86
- * @returns {Plugin} The configured Vite plugin.
87
- */
88
16
  declare function moostVite(options: TMoostViteDevOptions): Plugin;
89
17
 
90
18
  export { moostVite };