vite-plugin-vercel 4.0.0 → 4.0.2
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 +13 -0
- package/dist/index.cjs +49 -21
- package/dist/index.d.cts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +49 -21
- package/package.json +12 -12
package/README.md
CHANGED
|
@@ -4,6 +4,19 @@ Vercel adapter for [Vite](https://vitejs.dev/).
|
|
|
4
4
|
|
|
5
5
|
Bundle your Vite application as supported by [Vercel Output API (v3)](https://vercel.com/docs/build-output-api/v3).
|
|
6
6
|
|
|
7
|
+
## Install
|
|
8
|
+
```bash
|
|
9
|
+
npm i -D vite-plugin-vercel
|
|
10
|
+
```
|
|
11
|
+
```bash
|
|
12
|
+
yarn add -D vite-plugin-vercel
|
|
13
|
+
```
|
|
14
|
+
```bash
|
|
15
|
+
pnpm add -D vite-plugin-vercel
|
|
16
|
+
```
|
|
17
|
+
```bash
|
|
18
|
+
bun add -D vite-plugin-vercel
|
|
19
|
+
```
|
|
7
20
|
## Features
|
|
8
21
|
|
|
9
22
|
- [x] [SSG/Static files](https://vercel.com/docs/build-output-api/v3/primitives#static-files)
|
package/dist/index.cjs
CHANGED
|
@@ -664,6 +664,27 @@ async function getIsrConfig(resolvedConfig) {
|
|
|
664
664
|
|
|
665
665
|
// src/index.ts
|
|
666
666
|
var import_path6 = __toESM(require("path"), 1);
|
|
667
|
+
function vercelPluginCleanup() {
|
|
668
|
+
let resolvedConfig;
|
|
669
|
+
return {
|
|
670
|
+
apply: "build",
|
|
671
|
+
name: "vite-plugin-vercel:cleanup",
|
|
672
|
+
enforce: "pre",
|
|
673
|
+
configResolved(config) {
|
|
674
|
+
resolvedConfig = config;
|
|
675
|
+
},
|
|
676
|
+
writeBundle: {
|
|
677
|
+
order: "pre",
|
|
678
|
+
sequential: true,
|
|
679
|
+
async handler() {
|
|
680
|
+
var _a;
|
|
681
|
+
if (!((_a = resolvedConfig.build) == null ? void 0 : _a.ssr)) {
|
|
682
|
+
await cleanOutputDirectory(resolvedConfig);
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
};
|
|
687
|
+
}
|
|
667
688
|
function vercelPlugin() {
|
|
668
689
|
let resolvedConfig;
|
|
669
690
|
let vikeFound = false;
|
|
@@ -682,28 +703,31 @@ function vercelPlugin() {
|
|
|
682
703
|
resolvedConfig.vercel.distContainsOnlyStatic = !vikeFound;
|
|
683
704
|
}
|
|
684
705
|
},
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
706
|
+
writeBundle: {
|
|
707
|
+
order: "post",
|
|
708
|
+
sequential: true,
|
|
709
|
+
async handler() {
|
|
710
|
+
var _a;
|
|
711
|
+
if (!((_a = resolvedConfig.build) == null ? void 0 : _a.ssr)) {
|
|
712
|
+
if (vikeFound) {
|
|
713
|
+
return;
|
|
714
|
+
}
|
|
691
715
|
}
|
|
716
|
+
const overrides = await execPrerender(resolvedConfig);
|
|
717
|
+
const userOverrides = await computeStaticHtmlOverrides(resolvedConfig);
|
|
718
|
+
const { rewrites, isr, headers } = await buildEndpoints(resolvedConfig);
|
|
719
|
+
rewrites.push(...await buildPrerenderConfigs(resolvedConfig, isr));
|
|
720
|
+
await writeConfig(
|
|
721
|
+
resolvedConfig,
|
|
722
|
+
rewrites,
|
|
723
|
+
{
|
|
724
|
+
...userOverrides,
|
|
725
|
+
...overrides
|
|
726
|
+
},
|
|
727
|
+
headers
|
|
728
|
+
);
|
|
729
|
+
await copyDistToStatic(resolvedConfig);
|
|
692
730
|
}
|
|
693
|
-
const overrides = await execPrerender(resolvedConfig);
|
|
694
|
-
const userOverrides = await computeStaticHtmlOverrides(resolvedConfig);
|
|
695
|
-
const { rewrites, isr, headers } = await buildEndpoints(resolvedConfig);
|
|
696
|
-
rewrites.push(...await buildPrerenderConfigs(resolvedConfig, isr));
|
|
697
|
-
await writeConfig(
|
|
698
|
-
resolvedConfig,
|
|
699
|
-
rewrites,
|
|
700
|
-
{
|
|
701
|
-
...userOverrides,
|
|
702
|
-
...overrides
|
|
703
|
-
},
|
|
704
|
-
headers
|
|
705
|
-
);
|
|
706
|
-
await copyDistToStatic(resolvedConfig);
|
|
707
731
|
}
|
|
708
732
|
};
|
|
709
733
|
}
|
|
@@ -771,5 +795,9 @@ async function tryImportVpvv() {
|
|
|
771
795
|
}
|
|
772
796
|
}
|
|
773
797
|
function allPlugins(options = {}) {
|
|
774
|
-
return [
|
|
798
|
+
return [
|
|
799
|
+
vercelPluginCleanup(),
|
|
800
|
+
vercelPlugin(),
|
|
801
|
+
options.smart !== false ? tryImportVpvv() : null
|
|
802
|
+
];
|
|
775
803
|
}
|
package/dist/index.d.cts
CHANGED
|
@@ -438,22 +438,22 @@ declare const vercelOutputVcConfigSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
438
438
|
environment: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
439
439
|
regions: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
440
440
|
}, "strict", z.ZodTypeAny, {
|
|
441
|
-
runtime: string;
|
|
442
441
|
handler: string;
|
|
442
|
+
runtime: string;
|
|
443
443
|
memory?: number | undefined;
|
|
444
444
|
maxDuration?: number | undefined;
|
|
445
445
|
environment?: Record<string, string> | undefined;
|
|
446
446
|
regions?: string[] | undefined;
|
|
447
447
|
}, {
|
|
448
|
-
runtime: string;
|
|
449
448
|
handler: string;
|
|
449
|
+
runtime: string;
|
|
450
450
|
memory?: number | undefined;
|
|
451
451
|
maxDuration?: number | undefined;
|
|
452
452
|
environment?: Record<string, string> | undefined;
|
|
453
453
|
regions?: string[] | undefined;
|
|
454
454
|
}>, z.ZodObject<{
|
|
455
|
-
runtime: z.ZodString;
|
|
456
455
|
handler: z.ZodString;
|
|
456
|
+
runtime: z.ZodString;
|
|
457
457
|
memory: z.ZodOptional<z.ZodNumber>;
|
|
458
458
|
maxDuration: z.ZodOptional<z.ZodNumber>;
|
|
459
459
|
environment: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
@@ -463,8 +463,8 @@ declare const vercelOutputVcConfigSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
463
463
|
shouldAddSourcemapSupport: z.ZodOptional<z.ZodBoolean>;
|
|
464
464
|
awsLambdaHandler: z.ZodOptional<z.ZodString>;
|
|
465
465
|
}, "strict", z.ZodTypeAny, {
|
|
466
|
-
runtime: string;
|
|
467
466
|
handler: string;
|
|
467
|
+
runtime: string;
|
|
468
468
|
launcherType: "Nodejs";
|
|
469
469
|
memory?: number | undefined;
|
|
470
470
|
maxDuration?: number | undefined;
|
|
@@ -474,8 +474,8 @@ declare const vercelOutputVcConfigSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
474
474
|
shouldAddSourcemapSupport?: boolean | undefined;
|
|
475
475
|
awsLambdaHandler?: string | undefined;
|
|
476
476
|
}, {
|
|
477
|
-
runtime: string;
|
|
478
477
|
handler: string;
|
|
478
|
+
runtime: string;
|
|
479
479
|
launcherType: "Nodejs";
|
|
480
480
|
memory?: number | undefined;
|
|
481
481
|
maxDuration?: number | undefined;
|
package/dist/index.d.ts
CHANGED
|
@@ -438,22 +438,22 @@ declare const vercelOutputVcConfigSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
438
438
|
environment: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
439
439
|
regions: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
440
440
|
}, "strict", z.ZodTypeAny, {
|
|
441
|
-
runtime: string;
|
|
442
441
|
handler: string;
|
|
442
|
+
runtime: string;
|
|
443
443
|
memory?: number | undefined;
|
|
444
444
|
maxDuration?: number | undefined;
|
|
445
445
|
environment?: Record<string, string> | undefined;
|
|
446
446
|
regions?: string[] | undefined;
|
|
447
447
|
}, {
|
|
448
|
-
runtime: string;
|
|
449
448
|
handler: string;
|
|
449
|
+
runtime: string;
|
|
450
450
|
memory?: number | undefined;
|
|
451
451
|
maxDuration?: number | undefined;
|
|
452
452
|
environment?: Record<string, string> | undefined;
|
|
453
453
|
regions?: string[] | undefined;
|
|
454
454
|
}>, z.ZodObject<{
|
|
455
|
-
runtime: z.ZodString;
|
|
456
455
|
handler: z.ZodString;
|
|
456
|
+
runtime: z.ZodString;
|
|
457
457
|
memory: z.ZodOptional<z.ZodNumber>;
|
|
458
458
|
maxDuration: z.ZodOptional<z.ZodNumber>;
|
|
459
459
|
environment: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
@@ -463,8 +463,8 @@ declare const vercelOutputVcConfigSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
463
463
|
shouldAddSourcemapSupport: z.ZodOptional<z.ZodBoolean>;
|
|
464
464
|
awsLambdaHandler: z.ZodOptional<z.ZodString>;
|
|
465
465
|
}, "strict", z.ZodTypeAny, {
|
|
466
|
-
runtime: string;
|
|
467
466
|
handler: string;
|
|
467
|
+
runtime: string;
|
|
468
468
|
launcherType: "Nodejs";
|
|
469
469
|
memory?: number | undefined;
|
|
470
470
|
maxDuration?: number | undefined;
|
|
@@ -474,8 +474,8 @@ declare const vercelOutputVcConfigSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
474
474
|
shouldAddSourcemapSupport?: boolean | undefined;
|
|
475
475
|
awsLambdaHandler?: string | undefined;
|
|
476
476
|
}, {
|
|
477
|
-
runtime: string;
|
|
478
477
|
handler: string;
|
|
478
|
+
runtime: string;
|
|
479
479
|
launcherType: "Nodejs";
|
|
480
480
|
memory?: number | undefined;
|
|
481
481
|
maxDuration?: number | undefined;
|
package/dist/index.js
CHANGED
|
@@ -634,6 +634,27 @@ async function getIsrConfig(resolvedConfig) {
|
|
|
634
634
|
|
|
635
635
|
// src/index.ts
|
|
636
636
|
import path6 from "path";
|
|
637
|
+
function vercelPluginCleanup() {
|
|
638
|
+
let resolvedConfig;
|
|
639
|
+
return {
|
|
640
|
+
apply: "build",
|
|
641
|
+
name: "vite-plugin-vercel:cleanup",
|
|
642
|
+
enforce: "pre",
|
|
643
|
+
configResolved(config) {
|
|
644
|
+
resolvedConfig = config;
|
|
645
|
+
},
|
|
646
|
+
writeBundle: {
|
|
647
|
+
order: "pre",
|
|
648
|
+
sequential: true,
|
|
649
|
+
async handler() {
|
|
650
|
+
var _a;
|
|
651
|
+
if (!((_a = resolvedConfig.build) == null ? void 0 : _a.ssr)) {
|
|
652
|
+
await cleanOutputDirectory(resolvedConfig);
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
};
|
|
657
|
+
}
|
|
637
658
|
function vercelPlugin() {
|
|
638
659
|
let resolvedConfig;
|
|
639
660
|
let vikeFound = false;
|
|
@@ -652,28 +673,31 @@ function vercelPlugin() {
|
|
|
652
673
|
resolvedConfig.vercel.distContainsOnlyStatic = !vikeFound;
|
|
653
674
|
}
|
|
654
675
|
},
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
676
|
+
writeBundle: {
|
|
677
|
+
order: "post",
|
|
678
|
+
sequential: true,
|
|
679
|
+
async handler() {
|
|
680
|
+
var _a;
|
|
681
|
+
if (!((_a = resolvedConfig.build) == null ? void 0 : _a.ssr)) {
|
|
682
|
+
if (vikeFound) {
|
|
683
|
+
return;
|
|
684
|
+
}
|
|
661
685
|
}
|
|
686
|
+
const overrides = await execPrerender(resolvedConfig);
|
|
687
|
+
const userOverrides = await computeStaticHtmlOverrides(resolvedConfig);
|
|
688
|
+
const { rewrites, isr, headers } = await buildEndpoints(resolvedConfig);
|
|
689
|
+
rewrites.push(...await buildPrerenderConfigs(resolvedConfig, isr));
|
|
690
|
+
await writeConfig(
|
|
691
|
+
resolvedConfig,
|
|
692
|
+
rewrites,
|
|
693
|
+
{
|
|
694
|
+
...userOverrides,
|
|
695
|
+
...overrides
|
|
696
|
+
},
|
|
697
|
+
headers
|
|
698
|
+
);
|
|
699
|
+
await copyDistToStatic(resolvedConfig);
|
|
662
700
|
}
|
|
663
|
-
const overrides = await execPrerender(resolvedConfig);
|
|
664
|
-
const userOverrides = await computeStaticHtmlOverrides(resolvedConfig);
|
|
665
|
-
const { rewrites, isr, headers } = await buildEndpoints(resolvedConfig);
|
|
666
|
-
rewrites.push(...await buildPrerenderConfigs(resolvedConfig, isr));
|
|
667
|
-
await writeConfig(
|
|
668
|
-
resolvedConfig,
|
|
669
|
-
rewrites,
|
|
670
|
-
{
|
|
671
|
-
...userOverrides,
|
|
672
|
-
...overrides
|
|
673
|
-
},
|
|
674
|
-
headers
|
|
675
|
-
);
|
|
676
|
-
await copyDistToStatic(resolvedConfig);
|
|
677
701
|
}
|
|
678
702
|
};
|
|
679
703
|
}
|
|
@@ -741,7 +765,11 @@ async function tryImportVpvv() {
|
|
|
741
765
|
}
|
|
742
766
|
}
|
|
743
767
|
function allPlugins(options = {}) {
|
|
744
|
-
return [
|
|
768
|
+
return [
|
|
769
|
+
vercelPluginCleanup(),
|
|
770
|
+
vercelPlugin(),
|
|
771
|
+
options.smart !== false ? tryImportVpvv() : null
|
|
772
|
+
];
|
|
745
773
|
}
|
|
746
774
|
export {
|
|
747
775
|
allPlugins as default
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vite-plugin-vercel",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"peerDependencies": {
|
|
23
23
|
"vike": "*",
|
|
24
24
|
"vite": "^4.4 || ^5.0.2",
|
|
25
|
-
"@vite-plugin-vercel/vike": "4.0.
|
|
25
|
+
"@vite-plugin-vercel/vike": "4.0.2"
|
|
26
26
|
},
|
|
27
27
|
"peerDependenciesMeta": {
|
|
28
28
|
"@vite-plugin-vercel/vike": {
|
|
@@ -34,20 +34,20 @@
|
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@types/node": "^16.18.76",
|
|
37
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
38
|
-
"@typescript-eslint/parser": "^
|
|
39
|
-
"eslint": "^8.
|
|
40
|
-
"tsup": "^8.0.
|
|
41
|
-
"typescript": "^5.
|
|
42
|
-
"vike": "^0.4.
|
|
43
|
-
"vite": "^5.
|
|
44
|
-
"@vite-plugin-vercel/vike": "4.0.
|
|
37
|
+
"@typescript-eslint/eslint-plugin": "^7.1.1",
|
|
38
|
+
"@typescript-eslint/parser": "^7.1.1",
|
|
39
|
+
"eslint": "^8.57.0",
|
|
40
|
+
"tsup": "^8.0.2",
|
|
41
|
+
"typescript": "^5.4.2",
|
|
42
|
+
"vike": "^0.4.165",
|
|
43
|
+
"vite": "^5.1.6",
|
|
44
|
+
"@vite-plugin-vercel/vike": "4.0.2"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@brillout/libassert": "^0.5.8",
|
|
48
|
-
"@vercel/build-utils": "^7.
|
|
48
|
+
"@vercel/build-utils": "^7.8.0",
|
|
49
49
|
"@vercel/routing-utils": "^3.1.0",
|
|
50
|
-
"esbuild": "^0.
|
|
50
|
+
"esbuild": "^0.20.1",
|
|
51
51
|
"eval": "^0.1.8",
|
|
52
52
|
"fast-glob": "^3.3.2",
|
|
53
53
|
"magicast": "^0.3.3",
|