vite-plugin-vanjs 0.1.10 → 0.1.12
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 +0 -5
- package/jsx/fragment.d.ts +1 -1
- package/jsx/jsx.d.ts +36 -38
- package/jsx/jsx.mjs +4 -4
- package/jsx/types.d.ts +2 -2
- package/package.json +11 -13
- package/plugin/index.mjs +6 -6
- package/plugin/types.d.ts +9 -10
- package/router/types.d.ts +1 -1
- package/tsconfig.json +0 -2
- /package/jsx/{namespaceElements.mjs → ns.mjs} +0 -0
package/README.md
CHANGED
|
@@ -4,11 +4,6 @@
|
|
|
4
4
|
[](https://github.com/thednp/vite-plugin-vanjs/actions/workflows/ci.yml)
|
|
5
5
|
[](https://www.npmjs.com/package/vite-plugin-vanjs)
|
|
6
6
|
[](http://npm-stat.com/charts.html?package=vite-plugin-vanjs)
|
|
7
|
-
[](https://www.typescriptlang.org/)
|
|
8
|
-
[](https://github.com/vanjs-org/van)
|
|
9
|
-
[](https://github.com/vanjs-org/mini-van-plate)
|
|
10
|
-
[](https://www.vitest.dev/)
|
|
11
|
-
[](https://vite.dev)
|
|
12
7
|
|
|
13
8
|
A mini meta-framework for [VanJS](https://vanjs.org/) developed around the awesome [vite](https://vite.dev) and tested with [vitest](https://vitest.dev). The plugin comes with a set of modules to streamline your workflow:
|
|
14
9
|
* ***@vanjs/router*** - one of the most important part of an application which allows you to split code and lazy load page like components with ease, handles both Client Side Rendering (SSR) and Server Side Rendering (CSR) and makes it really easy to work with;
|
package/jsx/fragment.d.ts
CHANGED
package/jsx/jsx.d.ts
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
// deno-lint-ignore-file no-empty-interface ban-types
|
|
2
2
|
|
|
3
3
|
import * as csstype from "csstype";
|
|
4
|
-
import type {
|
|
4
|
+
import type {
|
|
5
|
+
Primitive,
|
|
6
|
+
PropValueOrDerived,
|
|
7
|
+
State,
|
|
8
|
+
StateView,
|
|
9
|
+
} from "vanjs-core";
|
|
5
10
|
import { Element as VElement } from "mini-van-plate/van-plate";
|
|
6
11
|
|
|
7
12
|
/**
|
|
@@ -21,7 +26,7 @@ export type VanNode =
|
|
|
21
26
|
| null
|
|
22
27
|
| undefined;
|
|
23
28
|
|
|
24
|
-
export type { Fragment } from "./fragment";
|
|
29
|
+
export type { Fragment } from "./fragment.d.ts";
|
|
25
30
|
|
|
26
31
|
export as namespace JSX;
|
|
27
32
|
export = JSX;
|
|
@@ -32,8 +37,6 @@ declare global {
|
|
|
32
37
|
}
|
|
33
38
|
|
|
34
39
|
declare namespace JSX {
|
|
35
|
-
// type FunctionMaybe<T = unknown> = { (): T } | T;
|
|
36
|
-
// type Element = VanNode;
|
|
37
40
|
type FunctionMaybe<T = unknown> = (() => T) | StateView<T> | T | undefined;
|
|
38
41
|
type Element =
|
|
39
42
|
| State<Primitive | null | undefined>
|
|
@@ -41,8 +44,6 @@ declare namespace JSX {
|
|
|
41
44
|
| DOMElement
|
|
42
45
|
| HTMLElement
|
|
43
46
|
| ArrayElement
|
|
44
|
-
// | TagComponent<any>
|
|
45
|
-
// | Component
|
|
46
47
|
| FunctionElement
|
|
47
48
|
| (string & {})
|
|
48
49
|
| Primitive
|
|
@@ -142,8 +143,7 @@ declare namespace JSX {
|
|
|
142
143
|
extends
|
|
143
144
|
CustomAttributes<T>,
|
|
144
145
|
CustomEventHandlersCamelCase<T>,
|
|
145
|
-
CustomEventHandlersLowerCase<T
|
|
146
|
-
CustomEventHandlersNamespaced<T> {
|
|
146
|
+
CustomEventHandlersLowerCase<T> {
|
|
147
147
|
children?: Element;
|
|
148
148
|
innerHTML?: string;
|
|
149
149
|
innerText?: string | number;
|
|
@@ -2344,36 +2344,34 @@ declare namespace JSX {
|
|
|
2344
2344
|
/** @type {MathMLElementTagNameMap} */
|
|
2345
2345
|
interface MathMLElementTags {
|
|
2346
2346
|
math: MathMLMathAttributes<MathMLElement>;
|
|
2347
|
-
mi: MathMLAnnotationAttributes<
|
|
2348
|
-
mn: MathMLAnnotationAttributes<
|
|
2349
|
-
mo: MathMLOperatorAttributes<
|
|
2350
|
-
ms: MathMLAnnotationAttributes<
|
|
2351
|
-
mtext: MathMLAnnotationAttributes<
|
|
2352
|
-
mspace: MathMLMspaceAttributes<
|
|
2353
|
-
mrow: MathMLRowAttributes<
|
|
2354
|
-
mfrac: MathMLFracAttributes<
|
|
2355
|
-
msqrt: MathMLRowAttributes<
|
|
2356
|
-
mroot: MathMLRowAttributes<
|
|
2357
|
-
mstyle: MathMLStyleAttributes<
|
|
2358
|
-
merror: MathMLRowAttributes<
|
|
2359
|
-
mpadded: MathMLPaddedAttributes<
|
|
2360
|
-
mphantom: MathMLRowAttributes<
|
|
2361
|
-
mfenced: MathMLFencedAttributes<
|
|
2362
|
-
mtable: MathMLTableAttributes<
|
|
2363
|
-
mtr: MathMLTableRowAttributes<
|
|
2364
|
-
mtd: MathMLTableCellAttributes<
|
|
2365
|
-
msub: MathMLScriptAttributes<
|
|
2366
|
-
msup: MathMLScriptAttributes<
|
|
2367
|
-
msubsup: MathMLScriptAttributes<
|
|
2368
|
-
mmultiscripts: MathMLMultiscriptsAttributes<
|
|
2369
|
-
mover: MathMLScriptAttributes<
|
|
2370
|
-
munder: MathMLScriptAttributes<
|
|
2371
|
-
munderover: MathMLScriptAttributes<
|
|
2372
|
-
semantics: MathMLSemanticsAttributes<
|
|
2373
|
-
annotation: MathMLAnnotationElementAttributes<
|
|
2374
|
-
"annotation-xml": MathMLAnnotationElementAttributes<
|
|
2375
|
-
MathMLAnnotationXMLElement
|
|
2376
|
-
>;
|
|
2347
|
+
mi: MathMLAnnotationAttributes<MathMLElement>;
|
|
2348
|
+
mn: MathMLAnnotationAttributes<MathMLElement>;
|
|
2349
|
+
mo: MathMLOperatorAttributes<MathMLElement>;
|
|
2350
|
+
ms: MathMLAnnotationAttributes<MathMLElement>;
|
|
2351
|
+
mtext: MathMLAnnotationAttributes<MathMLElement>;
|
|
2352
|
+
mspace: MathMLMspaceAttributes<MathMLElement>;
|
|
2353
|
+
mrow: MathMLRowAttributes<MathMLElement>;
|
|
2354
|
+
mfrac: MathMLFracAttributes<MathMLElement>;
|
|
2355
|
+
msqrt: MathMLRowAttributes<MathMLElement>;
|
|
2356
|
+
mroot: MathMLRowAttributes<MathMLElement>;
|
|
2357
|
+
mstyle: MathMLStyleAttributes<MathMLElement>;
|
|
2358
|
+
merror: MathMLRowAttributes<MathMLElement>;
|
|
2359
|
+
mpadded: MathMLPaddedAttributes<MathMLElement>;
|
|
2360
|
+
mphantom: MathMLRowAttributes<MathMLElement>;
|
|
2361
|
+
mfenced: MathMLFencedAttributes<MathMLElement>;
|
|
2362
|
+
mtable: MathMLTableAttributes<MathMLElement>;
|
|
2363
|
+
mtr: MathMLTableRowAttributes<MathMLElement>;
|
|
2364
|
+
mtd: MathMLTableCellAttributes<MathMLElement>;
|
|
2365
|
+
msub: MathMLScriptAttributes<MathMLElement>;
|
|
2366
|
+
msup: MathMLScriptAttributes<MathMLElement>;
|
|
2367
|
+
msubsup: MathMLScriptAttributes<MathMLElement>;
|
|
2368
|
+
mmultiscripts: MathMLMultiscriptsAttributes<MathMLElement>;
|
|
2369
|
+
mover: MathMLScriptAttributes<MathMLElement>;
|
|
2370
|
+
munder: MathMLScriptAttributes<MathMLElement>;
|
|
2371
|
+
munderover: MathMLScriptAttributes<MathMLElement>;
|
|
2372
|
+
semantics: MathMLSemanticsAttributes<MathMLElement>;
|
|
2373
|
+
annotation: MathMLAnnotationElementAttributes<MathMLElement>;
|
|
2374
|
+
"annotation-xml": MathMLAnnotationElementAttributes<MathMLElement>;
|
|
2377
2375
|
}
|
|
2378
2376
|
|
|
2379
2377
|
/** MathML-specific attribute interfaces */
|
package/jsx/jsx.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
/// <reference types="./jsx.d.ts" />
|
|
2
|
+
|
|
1
3
|
import van from "vanjs-core";
|
|
2
4
|
import isServer from "../setup/isServer.mjs";
|
|
3
5
|
import { setAttributeNS, styleToString } from "../client/index.mjs";
|
|
4
|
-
import { namespaceElements } from "./
|
|
5
|
-
|
|
6
|
-
let currentNamespace;
|
|
6
|
+
import { namespaceElements } from "./ns.mjs";
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Compiles JSX to VanJS elements with automatic namespace resolution.
|
|
@@ -19,7 +19,7 @@ export const jsx = (jsxTag, { children, ref, style, ...rest }) => {
|
|
|
19
19
|
);
|
|
20
20
|
|
|
21
21
|
if (typeof jsxTag === "string") {
|
|
22
|
-
const ns =
|
|
22
|
+
const ns = namespaceElements[jsxTag];
|
|
23
23
|
const newElement = (ns ? van.tags(ns) : van.tags)[jsxTag](props, children);
|
|
24
24
|
|
|
25
25
|
// Handle style reactively
|
package/jsx/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference path="global.d.ts" />
|
|
2
|
-
import type { Fragment } from "./fragment";
|
|
2
|
+
import type { Fragment } from "./fragment.d.ts";
|
|
3
3
|
|
|
4
4
|
declare function jsx(
|
|
5
5
|
type: unknown,
|
|
@@ -12,5 +12,5 @@ declare function jsx(
|
|
|
12
12
|
[key: string]: unknown;
|
|
13
13
|
})[];
|
|
14
14
|
|
|
15
|
-
export type { JSX } from "./jsx";
|
|
15
|
+
export type { JSX } from "./jsx.d.ts";
|
|
16
16
|
export { Fragment, jsx, jsx as jsxDEV, jsx as jsxs };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vite-plugin-vanjs",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.12",
|
|
4
4
|
"author": "thednp",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "A mini meta-framework for VanJS powered by Vite",
|
|
@@ -81,22 +81,21 @@
|
|
|
81
81
|
"vanjs-ext": "*"
|
|
82
82
|
},
|
|
83
83
|
"dependencies": {
|
|
84
|
-
"csstype": "^3.
|
|
84
|
+
"csstype": "^3.2.3",
|
|
85
85
|
"mini-van-plate": "^0.6.3",
|
|
86
|
-
"vanjs-core": "^1.
|
|
86
|
+
"vanjs-core": "^1.6.0",
|
|
87
87
|
"vanjs-ext": "^0.6.3"
|
|
88
88
|
},
|
|
89
89
|
"devDependencies": {
|
|
90
|
-
"@types/node": "^
|
|
91
|
-
"@vitest/browser": "^
|
|
92
|
-
"@vitest/coverage-istanbul": "^
|
|
93
|
-
"@vitest/ui": "^
|
|
94
|
-
"happy-dom": "^
|
|
95
|
-
"typescript": "
|
|
96
|
-
"vite": "^
|
|
97
|
-
"vitest": "^
|
|
90
|
+
"@types/node": "^25.5.0",
|
|
91
|
+
"@vitest/browser": "^4.1.2",
|
|
92
|
+
"@vitest/coverage-istanbul": "^4.1.2",
|
|
93
|
+
"@vitest/ui": "^4.1.2",
|
|
94
|
+
"happy-dom": "^20.8.8",
|
|
95
|
+
"typescript": "6.0.2",
|
|
96
|
+
"vite": "^8.0.3",
|
|
97
|
+
"vitest": "^4.1.2"
|
|
98
98
|
},
|
|
99
|
-
"packageManager": "pnpm@8.6.12",
|
|
100
99
|
"engines": {
|
|
101
100
|
"node": ">=20",
|
|
102
101
|
"pnpm": ">=8.6.0"
|
|
@@ -104,7 +103,6 @@
|
|
|
104
103
|
"scripts": {
|
|
105
104
|
"test": "vitest --config vitest.config.ts",
|
|
106
105
|
"test-ui": "vitest --config vitest.config.ts --ui=true",
|
|
107
|
-
"badges": "npx -p dependency-version-badge update-badge vanjs-core mini-van-plate typescript vitest vite",
|
|
108
106
|
"format": "deno fmt plugin meta router setup client server jsx",
|
|
109
107
|
"lint": "pnpm lint:ts && pnpm check:ts",
|
|
110
108
|
"lint:ts": "deno lint plugin meta router setup client server jsx",
|
package/plugin/index.mjs
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import { fileURLToPath } from "node:url";
|
|
6
6
|
import { dirname, join, resolve } from "node:path";
|
|
7
7
|
import process from "node:process";
|
|
8
|
-
import {
|
|
8
|
+
import { transformWithOxc } from "vite";
|
|
9
9
|
import { routes } from "../router/routes.mjs";
|
|
10
10
|
import { generateRoute, getRoutes } from "./helpers.mjs";
|
|
11
11
|
|
|
@@ -89,7 +89,7 @@ export default function VitePluginVanJS(options = {}) {
|
|
|
89
89
|
"@vanjs/jsx": toAbsolute("../jsx"),
|
|
90
90
|
},
|
|
91
91
|
},
|
|
92
|
-
|
|
92
|
+
oxc: {
|
|
93
93
|
jsx: "automatic",
|
|
94
94
|
jsxImportSource: "@vanjs/jsx",
|
|
95
95
|
},
|
|
@@ -175,7 +175,7 @@ export default function VitePluginVanJS(options = {}) {
|
|
|
175
175
|
isResolvedVanFile || (source === "vanjs-core" && !isSetupFile)
|
|
176
176
|
? "@vanjs/van"
|
|
177
177
|
: isResolvedVanXFile ||
|
|
178
|
-
(source === "vanjs-ext" && /* istanbul ignore next */
|
|
178
|
+
(source === "vanjs-ext" && /* istanbul ignore next @preserve */
|
|
179
179
|
!isImportedVanXFile)
|
|
180
180
|
? "@vanjs/vanX"
|
|
181
181
|
: isResolvedSetupFile && (!ssr && isSetupFile || ssr && !isSetupFile)
|
|
@@ -214,14 +214,14 @@ ${currentRoutes.map(generateRoute).join("\n")}
|
|
|
214
214
|
${
|
|
215
215
|
ops.ssr && currentRoutes.length
|
|
216
216
|
? `console.log(\`🍦 @vanjs/router registered ${currentRoutes.length} routes.\`)`
|
|
217
|
-
: /* istanbul ignore next - satisfied */ ""
|
|
217
|
+
: /* istanbul ignore next @preserve - satisfied */ ""
|
|
218
218
|
}
|
|
219
219
|
`;
|
|
220
220
|
|
|
221
|
-
const result = await
|
|
221
|
+
const result = await transformWithOxc(
|
|
222
222
|
routesScript,
|
|
223
223
|
id,
|
|
224
|
-
{
|
|
224
|
+
{ lang: "js" },
|
|
225
225
|
);
|
|
226
226
|
|
|
227
227
|
return {
|
package/plugin/types.d.ts
CHANGED
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
// plugin/types.ts
|
|
2
|
-
export * from "../jsx/types";
|
|
3
|
-
export * from "../setup/types";
|
|
4
|
-
export * from "../router/types";
|
|
5
|
-
export * from "../meta/types";
|
|
6
|
-
export * from "../server/types";
|
|
7
|
-
export * from "../client/types";
|
|
8
|
-
export * from "../parser/types";
|
|
2
|
+
export * from "../jsx/types.d.ts";
|
|
3
|
+
export * from "../setup/types.d.ts";
|
|
4
|
+
export * from "../router/types.d.ts";
|
|
5
|
+
export * from "../meta/types.d.ts";
|
|
6
|
+
export * from "../server/types.d.ts";
|
|
7
|
+
export * from "../client/types.d.ts";
|
|
9
8
|
import type { PluginOption } from "vite";
|
|
10
9
|
|
|
11
10
|
export type VanJSPluginOptions = {
|
|
12
|
-
routesDir
|
|
13
|
-
extensions
|
|
11
|
+
routesDir?: string;
|
|
12
|
+
extensions?: string[];
|
|
14
13
|
};
|
|
15
14
|
|
|
16
15
|
export declare const VitePluginVanJS: (
|
|
17
|
-
config?:
|
|
16
|
+
config?: VanJSPluginOptions,
|
|
18
17
|
) => PluginOption<VanJSPluginOptions>;
|
|
19
18
|
|
|
20
19
|
export default VitePluginVanJS;
|
package/router/types.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ import type {
|
|
|
12
12
|
PropValueOrDerived,
|
|
13
13
|
State,
|
|
14
14
|
} from "vanjs-core";
|
|
15
|
-
import { LayoutFile } from "../plugin/types";
|
|
15
|
+
import { LayoutFile } from "../plugin/types.d.ts";
|
|
16
16
|
|
|
17
17
|
// type VanElement = VElement | Exclude<Primitive, boolean | undefined>;
|
|
18
18
|
// type DOMElement = globalThis.Element;
|
package/tsconfig.json
CHANGED
|
File without changes
|