@evjs/cli 0.0.3 → 0.0.4
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/cli.d.ts +2 -0
- package/dist/config.d.ts +116 -0
- package/dist/create-webpack-config.d.ts +8 -0
- package/dist/index.d.ts +23 -0
- package/dist/load-config.d.ts +8 -0
- package/package.json +1 -1
package/dist/cli.d.ts
ADDED
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Server configuration.
|
|
3
|
+
*
|
|
4
|
+
* Controls server backend, entry, plugins, and dev options.
|
|
5
|
+
*/
|
|
6
|
+
export interface ServerConfig {
|
|
7
|
+
/** Explicit server entry file. If provided, overrides auto-generated entry. */
|
|
8
|
+
entry?: string;
|
|
9
|
+
/** Server backend command. Default: "node". */
|
|
10
|
+
backend?: string;
|
|
11
|
+
/** Server function configuration. */
|
|
12
|
+
functions?: {
|
|
13
|
+
/** Server function endpoint path. Default: "/api/fn". */
|
|
14
|
+
endpoint?: string;
|
|
15
|
+
};
|
|
16
|
+
/** Build plugins for the server bundle. */
|
|
17
|
+
plugins?: EvPlugin[];
|
|
18
|
+
/** Dev server options. */
|
|
19
|
+
dev?: {
|
|
20
|
+
/** API server port (dev mode). Default: 3001. */
|
|
21
|
+
port?: number;
|
|
22
|
+
/** Enable HTTPS. */
|
|
23
|
+
https?: boolean;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Client configuration.
|
|
28
|
+
*
|
|
29
|
+
* Controls entry point, HTML template, dev server, and transport.
|
|
30
|
+
*/
|
|
31
|
+
export interface ClientConfig {
|
|
32
|
+
/** Client entry point. Default: "./src/main.tsx". */
|
|
33
|
+
entry?: string;
|
|
34
|
+
/** HTML template path. Default: "./index.html". */
|
|
35
|
+
html?: string;
|
|
36
|
+
/** Build plugins for the client bundle. */
|
|
37
|
+
plugins?: EvPlugin[];
|
|
38
|
+
/** Dev server options. */
|
|
39
|
+
dev?: {
|
|
40
|
+
/** Dev server port. Default: 3000. */
|
|
41
|
+
port?: number;
|
|
42
|
+
/** Enable HTTPS. */
|
|
43
|
+
https?: boolean;
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* A single loader entry.
|
|
48
|
+
*
|
|
49
|
+
* Can be a plain package name or an object with per-loader options.
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```ts
|
|
53
|
+
* "css-loader"
|
|
54
|
+
* { loader: "css-loader", options: { modules: true } }
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
export type EvLoaderEntry = string | {
|
|
58
|
+
loader: string;
|
|
59
|
+
options?: Record<string, unknown>;
|
|
60
|
+
};
|
|
61
|
+
/** A loader rule declared by a plugin. */
|
|
62
|
+
export interface EvPluginLoader {
|
|
63
|
+
/** File matching pattern (e.g. /\.css$/, /\.svg$/). */
|
|
64
|
+
test: RegExp;
|
|
65
|
+
/** Pattern to exclude (e.g. /node_modules/). */
|
|
66
|
+
exclude?: RegExp;
|
|
67
|
+
/** Loader(s) to apply. */
|
|
68
|
+
use: EvLoaderEntry | EvLoaderEntry[];
|
|
69
|
+
}
|
|
70
|
+
/** An evjs build plugin. */
|
|
71
|
+
export interface EvPlugin {
|
|
72
|
+
/** Plugin name for debugging and logging. */
|
|
73
|
+
name: string;
|
|
74
|
+
/** Loaders to add to the build pipeline. */
|
|
75
|
+
loaders?: EvPluginLoader[];
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* evjs framework configuration.
|
|
79
|
+
*/
|
|
80
|
+
export interface EvConfig {
|
|
81
|
+
server?: ServerConfig;
|
|
82
|
+
client?: ClientConfig;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Default configuration values.
|
|
86
|
+
*
|
|
87
|
+
* Single source of truth for all defaults across the framework.
|
|
88
|
+
*/
|
|
89
|
+
export declare const CONFIG_DEFAULTS: {
|
|
90
|
+
readonly entry: "./src/main.tsx";
|
|
91
|
+
readonly html: "./index.html";
|
|
92
|
+
readonly clientPort: 3000;
|
|
93
|
+
readonly serverPort: 3001;
|
|
94
|
+
readonly endpoint: "/api/fn";
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
* Define configuration for the evjs framework.
|
|
98
|
+
*
|
|
99
|
+
* @example
|
|
100
|
+
* ```ts
|
|
101
|
+
* // ev.config.ts
|
|
102
|
+
* import { defineConfig } from "@evjs/cli";
|
|
103
|
+
*
|
|
104
|
+
* export default defineConfig({
|
|
105
|
+
* client: {
|
|
106
|
+
* entry: "./src/main.tsx",
|
|
107
|
+
* dev: { port: 3000 },
|
|
108
|
+
* },
|
|
109
|
+
* server: {
|
|
110
|
+
* functions: { endpoint: "/api/fn" },
|
|
111
|
+
* dev: { port: 3001 },
|
|
112
|
+
* },
|
|
113
|
+
* });
|
|
114
|
+
* ```
|
|
115
|
+
*/
|
|
116
|
+
export declare function defineConfig(config: EvConfig): EvConfig;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type EvConfig } from "./config.js";
|
|
2
|
+
/**
|
|
3
|
+
* Create a webpack configuration object from EvfConfig.
|
|
4
|
+
*
|
|
5
|
+
* Returns a plain object that can be passed directly to the webpack Node API.
|
|
6
|
+
* No temp files are generated.
|
|
7
|
+
*/
|
|
8
|
+
export declare function createWebpackConfig(config: EvConfig | undefined, cwd: string): Record<string, unknown>;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { EvConfig } from "./config.js";
|
|
2
|
+
export type { ClientConfig, EvConfig, EvLoaderEntry, EvPlugin, EvPluginLoader, ServerConfig, } from "./config.js";
|
|
3
|
+
export { CONFIG_DEFAULTS, defineConfig } from "./config.js";
|
|
4
|
+
export interface DevOptions {
|
|
5
|
+
cwd?: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Start the development server programmatically.
|
|
9
|
+
*
|
|
10
|
+
* @param config - evjs configuration object (from `defineConfig`)
|
|
11
|
+
* @param options - additional options like `cwd`
|
|
12
|
+
*/
|
|
13
|
+
export declare function dev(config?: EvConfig, options?: DevOptions): Promise<void>;
|
|
14
|
+
export interface BuildOptions {
|
|
15
|
+
cwd?: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Run a production build programmatically.
|
|
19
|
+
*
|
|
20
|
+
* @param config - evjs configuration object (from `defineConfig`)
|
|
21
|
+
* @param options - additional options like `cwd`
|
|
22
|
+
*/
|
|
23
|
+
export declare function build(config?: EvConfig, options?: BuildOptions): Promise<void>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { EvConfig } from "./config.js";
|
|
2
|
+
/**
|
|
3
|
+
* Load evjs config from the project root.
|
|
4
|
+
*
|
|
5
|
+
* Looks for `ev.config.ts`, `.js`, or `.mjs` in the given directory.
|
|
6
|
+
* Returns undefined if no config file is found.
|
|
7
|
+
*/
|
|
8
|
+
export declare function loadConfig(cwd: string): Promise<EvConfig | undefined>;
|