vite-plugin-vercel 0.3.3 → 0.3.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/README.md +11 -11
- package/dist/index.cjs +8 -2
- package/dist/index.js +8 -2
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@ Its purpose is to help you bundle your application in `.vercel` folder as suppor
|
|
|
13
13
|
- `.[jt]s` files under the `<root>/api` folder of your project are automatically bundled as Serverless functions under `.vercel/output/functions/api/*.func`
|
|
14
14
|
- see [`additionalEndpoints` config](/packages/vercel/src/types.ts#L62)
|
|
15
15
|
- [x] [ISR/Prerender functions support](https://vercel.com/docs/build-output-api/v3/primitives#prerender-functions)
|
|
16
|
-
- see [`isr` config](/packages/vercel/src/types.ts#L89). Also see implementation of [
|
|
16
|
+
- see [`isr` config](/packages/vercel/src/types.ts#L89). Also see implementation of [vike](/packages/vike-integration/vike.ts) for example
|
|
17
17
|
- [x] [Edge functions support](https://vercel.com/docs/build-output-api/v3/primitives#edge-functions)
|
|
18
18
|
- [ ] [Images optimization support](https://vercel.com/docs/build-output-api/v3/configuration#images)
|
|
19
19
|
- [ ] [Preview mode support](https://vercel.com/docs/build-output-api/v3/features#preview-mode)
|
|
@@ -37,9 +37,9 @@ export default defineConfig({
|
|
|
37
37
|
});
|
|
38
38
|
```
|
|
39
39
|
|
|
40
|
-
## Usage with
|
|
40
|
+
## Usage with vike
|
|
41
41
|
|
|
42
|
-
[
|
|
42
|
+
[vike](https://vike.dev/) is supported through [@vite-plugin-vercel/vike](/packages/vike-integration/README.md) plugin.
|
|
43
43
|
|
|
44
44
|
You only need to install `@vite-plugin-vercel/vike`, the Vite config stays the same as above.
|
|
45
45
|
|
|
@@ -47,16 +47,16 @@ You only need to install `@vite-plugin-vercel/vike`, the Vite config stays the s
|
|
|
47
47
|
> `@vite-plugin-vercel/vike` supersedes the old `@magne4000/vite-plugin-vercel-ssr` package.
|
|
48
48
|
> As such, you should remove `@magne4000/vite-plugin-vercel-ssr` from your package.json and vite config file.
|
|
49
49
|
|
|
50
|
-
###
|
|
50
|
+
### vike V1 design
|
|
51
51
|
|
|
52
|
-
`vite-plugin-vercel` fully supports [
|
|
53
|
-
and thus you can leverage [config files](https://
|
|
52
|
+
`vite-plugin-vercel` fully supports [vike V1 design](https://vike.dev/migration/v1-design),
|
|
53
|
+
and thus you can leverage [config files](https://vike.dev/config) to customize ISR configuration:
|
|
54
54
|
|
|
55
55
|
```ts
|
|
56
56
|
// /pages/product/+config.h.ts
|
|
57
57
|
|
|
58
58
|
import Page from './Page';
|
|
59
|
-
import type { Config } from '
|
|
59
|
+
import type { Config } from 'vike/types';
|
|
60
60
|
|
|
61
61
|
// Customize ISR config for this page
|
|
62
62
|
export default {
|
|
@@ -64,13 +64,13 @@ export default {
|
|
|
64
64
|
} satisfies Config;
|
|
65
65
|
```
|
|
66
66
|
|
|
67
|
-
You will also need to extend the [renderer config](https://
|
|
67
|
+
You will also need to extend the [renderer config](https://vike.dev/config#renderer) so that `vike` is aware of the new parameter:
|
|
68
68
|
|
|
69
69
|
```ts
|
|
70
70
|
// /renderer/+config.h.ts
|
|
71
71
|
|
|
72
72
|
import config from '@vite-plugin-vercel/vike/config';
|
|
73
|
-
import type { Config } from '
|
|
73
|
+
import type { Config } from 'vike/types';
|
|
74
74
|
|
|
75
75
|
export default {
|
|
76
76
|
extends: config,
|
|
@@ -105,7 +105,7 @@ export default defineConfig({
|
|
|
105
105
|
* Defaults to `false`, which disables prerendering.
|
|
106
106
|
*/
|
|
107
107
|
prerender(resolvedConfig) {
|
|
108
|
-
// Check `/packages/
|
|
108
|
+
// Check `/packages/vike/vike.ts` `prerender` for an example
|
|
109
109
|
},
|
|
110
110
|
/**
|
|
111
111
|
* See https://vercel.com/docs/projects/project-configuration#rewrites
|
|
@@ -160,7 +160,7 @@ export default defineConfig({
|
|
|
160
160
|
*
|
|
161
161
|
* Can be an object or a function returning an object (or a Promise of an object).
|
|
162
162
|
*
|
|
163
|
-
* Check `/packages/
|
|
163
|
+
* Check `/packages/vike/vike.ts` `vitePluginVercelVpsIsrPlugin` for advanced usage.
|
|
164
164
|
*/
|
|
165
165
|
isr: {
|
|
166
166
|
// `symlink: 'ssr_'` means that a function is available under `.vercel/output/functions/ssr_.func`
|
package/dist/index.cjs
CHANGED
|
@@ -601,11 +601,17 @@ async function getStaticHtmlFiles(src) {
|
|
|
601
601
|
}
|
|
602
602
|
async function tryImportVpvv() {
|
|
603
603
|
try {
|
|
604
|
-
await import("
|
|
604
|
+
await import("vike/plugin");
|
|
605
605
|
const vpvv = await import("@vite-plugin-vercel/vike");
|
|
606
606
|
return vpvv.default();
|
|
607
607
|
} catch (e) {
|
|
608
|
-
|
|
608
|
+
try {
|
|
609
|
+
await import("vite-plugin-ssr/plugin");
|
|
610
|
+
const vpvv = await import("@vite-plugin-vercel/vike");
|
|
611
|
+
return vpvv.default();
|
|
612
|
+
} catch (e2) {
|
|
613
|
+
return null;
|
|
614
|
+
}
|
|
609
615
|
}
|
|
610
616
|
}
|
|
611
617
|
function allPlugins(options = {}) {
|
package/dist/index.js
CHANGED
|
@@ -567,11 +567,17 @@ async function getStaticHtmlFiles(src) {
|
|
|
567
567
|
}
|
|
568
568
|
async function tryImportVpvv() {
|
|
569
569
|
try {
|
|
570
|
-
await import("
|
|
570
|
+
await import("vike/plugin");
|
|
571
571
|
const vpvv = await import("@vite-plugin-vercel/vike");
|
|
572
572
|
return vpvv.default();
|
|
573
573
|
} catch (e) {
|
|
574
|
-
|
|
574
|
+
try {
|
|
575
|
+
await import("vite-plugin-ssr/plugin");
|
|
576
|
+
const vpvv = await import("@vite-plugin-vercel/vike");
|
|
577
|
+
return vpvv.default();
|
|
578
|
+
} catch (e2) {
|
|
579
|
+
return null;
|
|
580
|
+
}
|
|
575
581
|
}
|
|
576
582
|
}
|
|
577
583
|
function allPlugins(options = {}) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vite-plugin-vercel",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -21,14 +21,14 @@
|
|
|
21
21
|
"license": "MIT",
|
|
22
22
|
"peerDependencies": {
|
|
23
23
|
"vite": "^4.2.0",
|
|
24
|
-
"
|
|
25
|
-
"@vite-plugin-vercel/vike": "0.
|
|
24
|
+
"vike": "*",
|
|
25
|
+
"@vite-plugin-vercel/vike": "0.4.0"
|
|
26
26
|
},
|
|
27
27
|
"peerDependenciesMeta": {
|
|
28
28
|
"@vite-plugin-vercel/vike": {
|
|
29
29
|
"optional": true
|
|
30
30
|
},
|
|
31
|
-
"
|
|
31
|
+
"vike": {
|
|
32
32
|
"optional": true
|
|
33
33
|
}
|
|
34
34
|
},
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"tsup": "^7.2.0",
|
|
41
41
|
"typescript": "^5.2.2",
|
|
42
42
|
"vite": "^4.4.9",
|
|
43
|
-
"
|
|
44
|
-
"@vite-plugin-vercel/vike": "0.
|
|
43
|
+
"vike": "^0.4.142",
|
|
44
|
+
"@vite-plugin-vercel/vike": "0.4.0"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@brillout/libassert": "^0.5.8",
|