@typed/vite-plugin 1.0.0-beta.2 → 1.0.0-beta.3
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/README.md +19 -21
- package/package.json +13 -13
- package/src/index.test.ts +10 -2
package/README.md
CHANGED
|
@@ -10,14 +10,14 @@
|
|
|
10
10
|
|
|
11
11
|
## Capabilities
|
|
12
12
|
|
|
13
|
-
| Area
|
|
14
|
-
|
|
15
|
-
| **Router VM**
|
|
16
|
-
| **HttpApi VM**
|
|
17
|
-
| **TypeInfo**
|
|
18
|
-
| **tsconfig paths** | Path alias resolution (default: on)
|
|
19
|
-
| **Analyzer**
|
|
20
|
-
| **Compression**
|
|
13
|
+
| Area | What you get |
|
|
14
|
+
| ------------------ | ----------------------------------------------------------------------------------------------- |
|
|
15
|
+
| **Router VM** | `router:./path` → typed Matcher from route files |
|
|
16
|
+
| **HttpApi VM** | `api:./path` → typed Api + Client + OpenAPI (when `apiVmOptions` set) |
|
|
17
|
+
| **TypeInfo** | Structural type-checking of route/endpoint contracts (when `createTypeInfoApiSession` provided) |
|
|
18
|
+
| **tsconfig paths** | Path alias resolution (default: on) |
|
|
19
|
+
| **Analyzer** | `dist/stats.html` treemap when `ANALYZE=1` |
|
|
20
|
+
| **Compression** | Brotli `.br` for build output (default: on) |
|
|
21
21
|
|
|
22
22
|
## Architecture
|
|
23
23
|
|
|
@@ -69,8 +69,7 @@ import { createTypeInfoApiSessionForApp } from "@typed/app";
|
|
|
69
69
|
|
|
70
70
|
export default defineConfig({
|
|
71
71
|
plugins: typedVitePlugin({
|
|
72
|
-
createTypeInfoApiSession: ({ ts, program }) =>
|
|
73
|
-
createTypeInfoApiSessionForApp({ ts, program }),
|
|
72
|
+
createTypeInfoApiSession: ({ ts, program }) => createTypeInfoApiSessionForApp({ ts, program }),
|
|
74
73
|
routerVmOptions: {},
|
|
75
74
|
apiVmOptions: {},
|
|
76
75
|
}),
|
|
@@ -84,14 +83,13 @@ export default defineConfig({
|
|
|
84
83
|
|
|
85
84
|
## Options
|
|
86
85
|
|
|
87
|
-
| Option
|
|
88
|
-
|
|
|
89
|
-
| `routerVmOptions`
|
|
90
|
-
| `apiVmOptions`
|
|
91
|
-
| `createTypeInfoApiSession` | `CreateTypeInfoApiSession`
|
|
92
|
-
| `tsconfig`
|
|
93
|
-
| `tsconfigPaths`
|
|
94
|
-
| `analyze`
|
|
95
|
-
| `warnOnError`
|
|
96
|
-
| `compression`
|
|
97
|
-
|
|
86
|
+
| Option | Type | Default | Description |
|
|
87
|
+
| -------------------------- | ----------------------------------- | ----------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
88
|
+
| `routerVmOptions` | `RouterVirtualModulePluginOptions` | `{}` | Options for the router VM plugin. |
|
|
89
|
+
| `apiVmOptions` | `HttpApiVirtualModulePluginOptions` | — | When set, enables the HttpApi VM plugin. |
|
|
90
|
+
| `createTypeInfoApiSession` | `CreateTypeInfoApiSession` | — | Required for router VM type-checking in dev. |
|
|
91
|
+
| `tsconfig` | `string` | — | Path to `tsconfig.json` (relative to cwd or absolute). When set, both the Language Service session and vite-tsconfig-paths use this tsconfig. Default: auto-discovered from project root. |
|
|
92
|
+
| `tsconfigPaths` | `boolean \| object` | `true` | Enable tsconfig path resolution. |
|
|
93
|
+
| `analyze` | `boolean \| object` | `process.env.ANALYZE === '1'` | Enable bundle analyzer (dist/stats.html). |
|
|
94
|
+
| `warnOnError` | `boolean` | `true` | Log virtual module resolution errors. |
|
|
95
|
+
| `compression` | `boolean \| object` | `true` | Brotli compression for build output. |
|
package/package.json
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@typed/vite-plugin",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.3",
|
|
4
|
+
"files": [
|
|
5
|
+
"dist",
|
|
6
|
+
"src"
|
|
7
|
+
],
|
|
4
8
|
"type": "module",
|
|
5
9
|
"exports": {
|
|
6
10
|
".": {
|
|
@@ -12,27 +16,23 @@
|
|
|
12
16
|
"access": "public"
|
|
13
17
|
},
|
|
14
18
|
"dependencies": {
|
|
15
|
-
"rollup-plugin-visualizer": "^
|
|
19
|
+
"rollup-plugin-visualizer": "^7.0.1",
|
|
16
20
|
"vite-plugin-compression": "^0.5.1",
|
|
17
|
-
"vite-tsconfig-paths": "^6.1.
|
|
18
|
-
"@typed/
|
|
19
|
-
"@typed/virtual-modules-vite": "1.0.0-beta.
|
|
20
|
-
"@typed/
|
|
21
|
+
"vite-tsconfig-paths": "^6.1.1",
|
|
22
|
+
"@typed/virtual-modules": "1.0.0-beta.3",
|
|
23
|
+
"@typed/virtual-modules-vite": "1.0.0-beta.3",
|
|
24
|
+
"@typed/app": "1.0.0-beta.3"
|
|
21
25
|
},
|
|
22
26
|
"devDependencies": {
|
|
23
|
-
"@types/node": "^25.
|
|
27
|
+
"@types/node": "^25.5.0",
|
|
24
28
|
"typescript": "5.9.3",
|
|
25
|
-
"vite": "^
|
|
26
|
-
"vitest": "4.
|
|
29
|
+
"vite": "^8.0.2",
|
|
30
|
+
"vitest": "4.1.1"
|
|
27
31
|
},
|
|
28
32
|
"peerDependencies": {
|
|
29
33
|
"typescript": ">=5.0.0",
|
|
30
34
|
"vite": ">=5.0.0"
|
|
31
35
|
},
|
|
32
|
-
"files": [
|
|
33
|
-
"dist",
|
|
34
|
-
"src"
|
|
35
|
-
],
|
|
36
36
|
"scripts": {
|
|
37
37
|
"build": "[ -d dist ] || rm -f tsconfig.tsbuildinfo; tsc",
|
|
38
38
|
"test": "vitest run --passWithNoTests"
|
package/src/index.test.ts
CHANGED
|
@@ -80,7 +80,11 @@ describe("typedVitePlugin", () => {
|
|
|
80
80
|
it("returns virtual-modules plugin with resolveId and load", () => {
|
|
81
81
|
const plugins = typedVitePlugin({ tsconfigPaths: false, compression: false });
|
|
82
82
|
const virtualPlugin = plugins.find(
|
|
83
|
-
(p) =>
|
|
83
|
+
(p) =>
|
|
84
|
+
p &&
|
|
85
|
+
typeof p === "object" &&
|
|
86
|
+
"name" in p &&
|
|
87
|
+
(p as { name?: string }).name === "virtual-modules",
|
|
84
88
|
);
|
|
85
89
|
expect(virtualPlugin).toBeDefined();
|
|
86
90
|
});
|
|
@@ -88,7 +92,11 @@ describe("typedVitePlugin", () => {
|
|
|
88
92
|
it("auto-creates LS-backed session when createTypeInfoApiSession is not provided", () => {
|
|
89
93
|
const plugins = typedVitePlugin({ tsconfigPaths: false, compression: false });
|
|
90
94
|
const virtualPlugin = plugins.find(
|
|
91
|
-
(p) =>
|
|
95
|
+
(p) =>
|
|
96
|
+
p &&
|
|
97
|
+
typeof p === "object" &&
|
|
98
|
+
"name" in p &&
|
|
99
|
+
(p as { name?: string }).name === "virtual-modules",
|
|
92
100
|
);
|
|
93
101
|
expect(virtualPlugin).toBeDefined();
|
|
94
102
|
expect(virtualPlugin).toHaveProperty("resolveId");
|