vite-plugin-vanjs 0.0.4 → 0.0.6
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/LICENSE +0 -0
- package/README.md +31 -28
- package/client/global.d.ts +5 -1
- package/client/index.mjs +99 -5
- package/client/package.json +0 -0
- package/client/types.d.ts +5 -1
- package/jsx/fragment.d.ts +0 -0
- package/jsx/fragment.mjs +0 -0
- package/jsx/global.d.ts +3 -2
- package/jsx/index.mjs +3 -3
- package/jsx/jsx-dev-runtime.d.ts +0 -0
- package/jsx/jsx-dev-runtime.mjs +1 -1
- package/jsx/jsx-runtime.d.ts +0 -0
- package/jsx/jsx-runtime.mjs +1 -1
- package/jsx/jsx.d.ts +42 -9
- package/jsx/jsx.mjs +10 -10
- package/jsx/package.json +0 -0
- package/jsx/types.d.ts +0 -0
- package/jsx-dev-runtime.d.ts +0 -0
- package/jsx-runtime.d.ts +0 -0
- package/meta/Head.mjs +4 -4
- package/meta/global.d.ts +24 -12
- package/meta/helpers.mjs +5 -3
- package/meta/index.mjs +3 -3
- package/meta/package.json +0 -0
- package/meta/tags.mjs +6 -8
- package/meta/types.d.ts +7 -7
- package/package.json +20 -18
- package/router/a.mjs +16 -10
- package/router/global.d.ts +75 -16
- package/router/helpers.mjs +28 -9
- package/router/index.mjs +7 -6
- package/router/lazy.mjs +2 -2
- package/router/package.json +0 -0
- package/router/router.mjs +20 -13
- package/router/routes.mjs +2 -2
- package/router/state.mjs +2 -1
- package/router/types.d.ts +86 -22
- package/server/global.d.ts +1 -0
- package/server/index.mjs +3 -3
- package/server/package.json +0 -0
- package/server/types.d.ts +1 -1
- package/setup/global.d.ts +0 -0
- package/setup/index-debug.mjs +21 -0
- package/setup/index.mjs +0 -0
- package/setup/package.json +0 -0
- package/setup/types.d.ts +0 -0
- package/setup/van-debug.mjs +2 -0
- package/setup/van.d.ts +0 -0
- package/setup/van.mjs +0 -0
- package/setup/vanX.d.ts +0 -0
- package/setup/vanX.mjs +0 -0
- package/src/index.mjs +19 -4
- package/src/types.d.ts +2 -3
- package/tsconfig.json +1 -1
package/server/index.mjs
CHANGED
|
@@ -43,10 +43,10 @@ export const renderToString = async (inputSource) => {
|
|
|
43
43
|
* @returns {string}
|
|
44
44
|
*/
|
|
45
45
|
function renderPreloadLink(file) {
|
|
46
|
-
if (file.endsWith(".js")
|
|
47
|
-
return `<link rel="
|
|
46
|
+
if (file.endsWith(".js")) {
|
|
47
|
+
return `<link rel="preload" href="${file}" as="script" crossorigin>`;
|
|
48
48
|
} else if (file.endsWith(".css")) {
|
|
49
|
-
return `<link rel="
|
|
49
|
+
return `<link rel="preload" href="${file}" as="style" crossorigin>`;
|
|
50
50
|
} else if (file.endsWith(".woff")) {
|
|
51
51
|
return ` <link rel="preload" href="${file}" as="font" type="font/woff" crossorigin>`;
|
|
52
52
|
} else if (file.endsWith(".woff2")) {
|
package/server/package.json
CHANGED
|
File without changes
|
package/server/types.d.ts
CHANGED
package/setup/global.d.ts
CHANGED
|
File without changes
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { dummyVanX, registerEnv } from "mini-van-plate/shared";
|
|
2
|
+
import vanPlate from "mini-van-plate/van-plate";
|
|
3
|
+
import vanCore from "vanjs-core/debug";
|
|
4
|
+
import * as vanX from "vanjs-ext";
|
|
5
|
+
|
|
6
|
+
const vanXObject = { ...vanX, default: vanX };
|
|
7
|
+
const dummyObject = { ...dummyVanX, default: dummyVanX };
|
|
8
|
+
|
|
9
|
+
const setup = {
|
|
10
|
+
isServer: typeof window === "undefined",
|
|
11
|
+
get van() {
|
|
12
|
+
return this.isServer ? vanPlate : vanCore;
|
|
13
|
+
},
|
|
14
|
+
get vanX() {
|
|
15
|
+
return this.isServer ? dummyObject : vanXObject;
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
registerEnv(setup);
|
|
20
|
+
|
|
21
|
+
export default setup;
|
package/setup/index.mjs
CHANGED
|
File without changes
|
package/setup/package.json
CHANGED
|
File without changes
|
package/setup/types.d.ts
CHANGED
|
File without changes
|
package/setup/van.d.ts
CHANGED
|
File without changes
|
package/setup/van.mjs
CHANGED
|
File without changes
|
package/setup/vanX.d.ts
CHANGED
|
File without changes
|
package/setup/vanX.mjs
CHANGED
|
File without changes
|
package/src/index.mjs
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { fileURLToPath } from "node:url";
|
|
2
2
|
import { dirname, resolve } from "node:path";
|
|
3
|
+
import process from "node:process";
|
|
3
4
|
|
|
4
5
|
const __filename = fileURLToPath(import.meta.url);
|
|
5
6
|
const __dirname = dirname(__filename);
|
|
7
|
+
const isProduction = process.env.NODE_ENV === "production";
|
|
6
8
|
|
|
7
9
|
export default function VitePluginVanJS() {
|
|
8
10
|
return {
|
|
@@ -10,22 +12,35 @@ export default function VitePluginVanJS() {
|
|
|
10
12
|
enforce: "pre",
|
|
11
13
|
config() {
|
|
12
14
|
return {
|
|
15
|
+
ssr: {
|
|
16
|
+
noExternal: ["vanjs-*", "*-vanjs", "@vanjs/*"],
|
|
17
|
+
},
|
|
13
18
|
resolve: {
|
|
14
19
|
alias: {
|
|
15
|
-
"@vanjs/setup": resolve(
|
|
16
|
-
|
|
20
|
+
"@vanjs/setup": resolve(
|
|
21
|
+
__dirname,
|
|
22
|
+
isProduction
|
|
23
|
+
? /* istanbul ignore next */ "../setup/index"
|
|
24
|
+
: "../setup/index-debug",
|
|
25
|
+
),
|
|
26
|
+
"@vanjs/van": resolve(
|
|
27
|
+
__dirname,
|
|
28
|
+
isProduction
|
|
29
|
+
? /* istanbul ignore next */ "../setup/van"
|
|
30
|
+
: "../setup/van-debug",
|
|
31
|
+
),
|
|
17
32
|
"@vanjs/vanX": resolve(__dirname, "../setup/vanX"),
|
|
18
33
|
"@vanjs/client": resolve(__dirname, "../client"),
|
|
19
34
|
"@vanjs/server": resolve(__dirname, "../server"),
|
|
20
35
|
"@vanjs/meta": resolve(__dirname, "../meta"),
|
|
21
36
|
"@vanjs/router": resolve(__dirname, "../router"),
|
|
22
37
|
"@vanjs/jsx": resolve(__dirname, "../jsx"),
|
|
38
|
+
"@vanjs/parser": resolve(__dirname, "../parser"),
|
|
23
39
|
},
|
|
24
40
|
},
|
|
25
41
|
esbuild: {
|
|
26
42
|
jsx: "automatic",
|
|
27
|
-
|
|
28
|
-
jsxFragment: "Fragment",
|
|
43
|
+
jsxImportSource: "@vanjs/jsx",
|
|
29
44
|
},
|
|
30
45
|
};
|
|
31
46
|
},
|
package/src/types.d.ts
CHANGED
|
@@ -4,19 +4,18 @@ export * from "../router/types";
|
|
|
4
4
|
export * from "../meta/types";
|
|
5
5
|
export * from "../server/types";
|
|
6
6
|
export * from "../client/types";
|
|
7
|
+
export * from "../parser/types";
|
|
7
8
|
|
|
8
9
|
declare const VitePluginVanJS: () => {
|
|
9
10
|
name: "string";
|
|
10
11
|
enforce: "pre" | "post" | undefined;
|
|
11
|
-
apply: "build";
|
|
12
12
|
config(): {
|
|
13
13
|
resolve: {
|
|
14
14
|
alias: Record<string, string>;
|
|
15
15
|
};
|
|
16
16
|
esBuild: {
|
|
17
17
|
jsx: "string";
|
|
18
|
-
|
|
19
|
-
jsxFragment: "string";
|
|
18
|
+
jsxImportSource: "string";
|
|
20
19
|
};
|
|
21
20
|
};
|
|
22
21
|
transform(code: string, id?: string): {
|