vite-plugin-vercel 0.3.3 → 0.3.5

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 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 [vite-plugin-ssr](/packages/vike-integration/vite-plugin-ssr.ts) for example
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 vite-plugin-ssr
40
+ ## Usage with vike
41
41
 
42
- [vite-plugin-ssr](https://vite-plugin-ssr.com/) is supported through [@vite-plugin-vercel/vike](/packages/vike-integration/README.md) plugin.
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
- ### vite-plugin-ssr V1 design
50
+ ### vike V1 design
51
51
 
52
- `vite-plugin-vercel` fully supports [vite-plugin-ssr V1 design](https://vite-plugin-ssr.com/migration/v1-design),
53
- and thus you can leverage [config files](https://vite-plugin-ssr.com/config) to customize ISR configuration:
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 'vite-plugin-ssr/types';
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://vite-plugin-ssr.com/config#renderer) so that `vite-plugin-ssr` is aware of the new parameter:
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 'vite-plugin-ssr/types';
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/vite-plugin-ssr/vite-plugin-ssr.ts` `prerender` for an example
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/vite-plugin-ssr/vite-plugin-ssr.ts` `vitePluginVercelVpsIsrPlugin` for advanced usage.
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
@@ -566,6 +566,7 @@ async function cleanOutputDirectory(resolvedConfig) {
566
566
  recursive: true,
567
567
  force: true
568
568
  });
569
+ await import_promises4.default.mkdir(getOutput(resolvedConfig), { recursive: true });
569
570
  }
570
571
  async function computeStaticHtmlOverrides(resolvedConfig) {
571
572
  const staticAbsolutePath = getOutput(resolvedConfig, "static");
@@ -601,11 +602,17 @@ async function getStaticHtmlFiles(src) {
601
602
  }
602
603
  async function tryImportVpvv() {
603
604
  try {
604
- await import("vite-plugin-ssr/plugin");
605
+ await import("vike/plugin");
605
606
  const vpvv = await import("@vite-plugin-vercel/vike");
606
607
  return vpvv.default();
607
608
  } catch (e) {
608
- return null;
609
+ try {
610
+ await import("vite-plugin-ssr/plugin");
611
+ const vpvv = await import("@vite-plugin-vercel/vike");
612
+ return vpvv.default();
613
+ } catch (e2) {
614
+ return null;
615
+ }
609
616
  }
610
617
  }
611
618
  function allPlugins(options = {}) {
package/dist/index.js CHANGED
@@ -532,6 +532,7 @@ async function cleanOutputDirectory(resolvedConfig) {
532
532
  recursive: true,
533
533
  force: true
534
534
  });
535
+ await fs4.mkdir(getOutput(resolvedConfig), { recursive: true });
535
536
  }
536
537
  async function computeStaticHtmlOverrides(resolvedConfig) {
537
538
  const staticAbsolutePath = getOutput(resolvedConfig, "static");
@@ -567,11 +568,17 @@ async function getStaticHtmlFiles(src) {
567
568
  }
568
569
  async function tryImportVpvv() {
569
570
  try {
570
- await import("vite-plugin-ssr/plugin");
571
+ await import("vike/plugin");
571
572
  const vpvv = await import("@vite-plugin-vercel/vike");
572
573
  return vpvv.default();
573
574
  } catch (e) {
574
- return null;
575
+ try {
576
+ await import("vite-plugin-ssr/plugin");
577
+ const vpvv = await import("@vite-plugin-vercel/vike");
578
+ return vpvv.default();
579
+ } catch (e2) {
580
+ return null;
581
+ }
575
582
  }
576
583
  }
577
584
  function allPlugins(options = {}) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite-plugin-vercel",
3
- "version": "0.3.3",
3
+ "version": "0.3.5",
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
- "vite-plugin-ssr": "*",
25
- "@vite-plugin-vercel/vike": "0.3.3"
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
- "vite-plugin-ssr": {
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
- "vite-plugin-ssr": "^0.4.141",
44
- "@vite-plugin-vercel/vike": "0.3.3"
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",