vite-plugin-vercel 0.1.3 → 0.1.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 +1 -5
- package/dist/index.cjs +37 -39
- package/dist/index.js +37 -41
- package/package.json +11 -11
package/README.md
CHANGED
|
@@ -38,8 +38,7 @@ export default defineConfig({
|
|
|
38
38
|
|
|
39
39
|
### Usage with vite-plugin-ssr
|
|
40
40
|
|
|
41
|
-
[vite-plugin-ssr](https://vite-plugin-ssr.com/)
|
|
42
|
-
In the meantime, you can add experimental support yourself.
|
|
41
|
+
[vite-plugin-ssr](https://vite-plugin-ssr.com/) is supported through [@magne4000/vite-plugin-vercel-ssr](/packages/vite-plugin-ssr/README.md) plugin.
|
|
43
42
|
|
|
44
43
|
Install `@magne4000/vite-plugin-vercel-ssr` package, and update your vite config:
|
|
45
44
|
|
|
@@ -53,9 +52,6 @@ import vercelSsr from '@magne4000/vite-plugin-vercel-ssr';
|
|
|
53
52
|
export default defineConfig(async ({ command, mode }) => {
|
|
54
53
|
return {
|
|
55
54
|
plugins: [ssr(), vercel(), vercelSsr()],
|
|
56
|
-
build: {
|
|
57
|
-
polyfillDynamicImport: false,
|
|
58
|
-
},
|
|
59
55
|
vercel: {
|
|
60
56
|
// Tweak what you need, check TS definition for details
|
|
61
57
|
},
|
package/dist/index.cjs
CHANGED
|
@@ -26,38 +26,25 @@ __export(src_exports, {
|
|
|
26
26
|
default: () => allPlugins
|
|
27
27
|
});
|
|
28
28
|
module.exports = __toCommonJS(src_exports);
|
|
29
|
-
var
|
|
29
|
+
var import_promises4 = __toESM(require("fs/promises"), 1);
|
|
30
30
|
|
|
31
31
|
// src/utils.ts
|
|
32
32
|
var import_vite = require("vite");
|
|
33
33
|
var import_path = __toESM(require("path"), 1);
|
|
34
|
-
var import_promises = __toESM(require("fs/promises"), 1);
|
|
35
34
|
function getRoot(config) {
|
|
36
35
|
return (0, import_vite.normalizePath)(config.root || process.cwd());
|
|
37
36
|
}
|
|
38
|
-
function getOutDir(config, force) {
|
|
39
|
-
const p = (0, import_vite.normalizePath)(config.build.outDir);
|
|
40
|
-
if (!force)
|
|
41
|
-
return p;
|
|
42
|
-
return import_path.default.join(import_path.default.dirname(p), force);
|
|
43
|
-
}
|
|
44
37
|
function getOutput(config, suffix) {
|
|
45
38
|
var _a, _b;
|
|
46
39
|
return import_path.default.join(((_a = config.vercel) == null ? void 0 : _a.outDir) ? "" : getRoot(config), ((_b = config.vercel) == null ? void 0 : _b.outDir) ?? ".vercel/output", suffix ?? "");
|
|
47
40
|
}
|
|
41
|
+
function getPublic(config) {
|
|
42
|
+
return import_path.default.join(getRoot(config), config.publicDir || "public");
|
|
43
|
+
}
|
|
48
44
|
function pathRelativeTo(filePath, config, rel) {
|
|
49
45
|
const root = getRoot(config);
|
|
50
46
|
return (0, import_vite.normalizePath)(import_path.default.relative(import_path.default.join(root, rel), filePath));
|
|
51
47
|
}
|
|
52
|
-
async function copyDir(src, dest) {
|
|
53
|
-
await import_promises.default.mkdir(dest, { recursive: true });
|
|
54
|
-
const entries = await import_promises.default.readdir(src, { withFileTypes: true });
|
|
55
|
-
for (const entry of entries) {
|
|
56
|
-
const srcPath = import_path.default.join(src, entry.name);
|
|
57
|
-
const destPath = import_path.default.join(dest, entry.name);
|
|
58
|
-
entry.isDirectory() ? await copyDir(srcPath, destPath) : await import_promises.default.copyFile(srcPath, destPath);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
48
|
|
|
62
49
|
// src/config.ts
|
|
63
50
|
var import_path2 = __toESM(require("path"), 1);
|
|
@@ -141,7 +128,7 @@ var vercelOutputConfigSchema = import_zod.z.object({
|
|
|
141
128
|
}).strict();
|
|
142
129
|
|
|
143
130
|
// src/config.ts
|
|
144
|
-
var
|
|
131
|
+
var import_promises = __toESM(require("fs/promises"), 1);
|
|
145
132
|
var import_routing_utils = require("@vercel/routing-utils");
|
|
146
133
|
function reorderEnforce(arr) {
|
|
147
134
|
return [
|
|
@@ -187,7 +174,7 @@ function getConfigDestination(resolvedConfig) {
|
|
|
187
174
|
return import_path2.default.join(getOutput(resolvedConfig), "config.json");
|
|
188
175
|
}
|
|
189
176
|
async function writeConfig(resolvedConfig, rewrites, overrides) {
|
|
190
|
-
await
|
|
177
|
+
await import_promises.default.writeFile(getConfigDestination(resolvedConfig), JSON.stringify(getConfig(resolvedConfig, rewrites, overrides), void 0, 2), "utf-8");
|
|
191
178
|
}
|
|
192
179
|
|
|
193
180
|
// src/build.ts
|
|
@@ -234,7 +221,7 @@ var vercelOutputVcConfigSchema = import_zod2.z.union([
|
|
|
234
221
|
]);
|
|
235
222
|
|
|
236
223
|
// src/build.ts
|
|
237
|
-
var
|
|
224
|
+
var import_promises2 = __toESM(require("fs/promises"), 1);
|
|
238
225
|
function getAdditionalEndpoints(resolvedConfig) {
|
|
239
226
|
var _a;
|
|
240
227
|
return (((_a = resolvedConfig.vercel) == null ? void 0 : _a.additionalEndpoints) ?? []).map((e) => ({
|
|
@@ -290,7 +277,7 @@ async function buildFn(resolvedConfig, entry, buildOptions) {
|
|
|
290
277
|
async function writeVcConfig(resolvedConfig, destination) {
|
|
291
278
|
var _a;
|
|
292
279
|
const vcConfig = import_path3.default.join(getOutput(resolvedConfig, "functions"), destination, ".vc-config.json");
|
|
293
|
-
await
|
|
280
|
+
await import_promises2.default.writeFile(vcConfig, JSON.stringify(vercelOutputVcConfigSchema.parse({
|
|
294
281
|
runtime: "nodejs16.x",
|
|
295
282
|
handler: "index.js",
|
|
296
283
|
maxDuration: (_a = resolvedConfig.vercel) == null ? void 0 : _a.defaultMaxDuration,
|
|
@@ -329,7 +316,7 @@ var vercelOutputPrerenderConfigSchema = import_zod3.z.object({
|
|
|
329
316
|
}).strict();
|
|
330
317
|
|
|
331
318
|
// src/prerender.ts
|
|
332
|
-
var
|
|
319
|
+
var import_promises3 = __toESM(require("fs/promises"), 1);
|
|
333
320
|
function execPrerender(resolvedConfig) {
|
|
334
321
|
var _a;
|
|
335
322
|
const prerender = (_a = resolvedConfig.vercel) == null ? void 0 : _a.prerender;
|
|
@@ -342,8 +329,8 @@ var group = 1;
|
|
|
342
329
|
async function writePrerenderConfig(resolvedConfig, destination, isr) {
|
|
343
330
|
const parsed = import_path4.default.parse(destination);
|
|
344
331
|
const outfile = import_path4.default.join(getOutput(resolvedConfig, "functions"), parsed.dir, parsed.name + ".prerender-config.json");
|
|
345
|
-
await
|
|
346
|
-
await
|
|
332
|
+
await import_promises3.default.mkdir(import_path4.default.join(getOutput(resolvedConfig, "functions"), parsed.dir), { recursive: true });
|
|
333
|
+
await import_promises3.default.writeFile(outfile, JSON.stringify(vercelOutputPrerenderConfigSchema.parse({
|
|
347
334
|
group: group++,
|
|
348
335
|
...isr
|
|
349
336
|
}), void 0, 2), "utf-8");
|
|
@@ -375,6 +362,15 @@ async function buildPrerenderConfigs(resolvedConfig) {
|
|
|
375
362
|
}
|
|
376
363
|
return rewrites;
|
|
377
364
|
}
|
|
365
|
+
async function copyDir(src, dest) {
|
|
366
|
+
await import_promises3.default.mkdir(dest, { recursive: true });
|
|
367
|
+
const entries = await import_promises3.default.readdir(src, { withFileTypes: true });
|
|
368
|
+
for (const entry of entries) {
|
|
369
|
+
const srcPath = import_path4.default.join(src, entry.name);
|
|
370
|
+
const destPath = import_path4.default.join(dest, entry.name);
|
|
371
|
+
entry.isDirectory() ? await copyDir(srcPath, destPath) : await import_promises3.default.copyFile(srcPath, destPath);
|
|
372
|
+
}
|
|
373
|
+
}
|
|
378
374
|
async function getIsrConfig(resolvedConfig) {
|
|
379
375
|
var _a;
|
|
380
376
|
const isr = ((_a = resolvedConfig.vercel) == null ? void 0 : _a.isr) ?? {};
|
|
@@ -399,18 +395,15 @@ function vercelPlugin() {
|
|
|
399
395
|
if (process.env.VERCEL_ENV === "production" && !process.env.ENABLE_VC_BUILD) {
|
|
400
396
|
throw new Error("Missing ENABLE_VC_BUILD=1 to your environment variables in your project settings");
|
|
401
397
|
}
|
|
402
|
-
if (!resolvedConfig.build.ssr) {
|
|
403
|
-
await cleanOutputDirectory(resolvedConfig);
|
|
404
|
-
} else {
|
|
405
|
-
await copyDistClientToOutputStatic(resolvedConfig);
|
|
406
|
-
}
|
|
407
398
|
},
|
|
408
399
|
async writeBundle() {
|
|
409
400
|
var _a;
|
|
410
|
-
if (!((_a = resolvedConfig.build) == null ? void 0 : _a.ssr))
|
|
401
|
+
if (!((_a = resolvedConfig.build) == null ? void 0 : _a.ssr)) {
|
|
402
|
+
await cleanOutputDirectory(resolvedConfig);
|
|
411
403
|
return;
|
|
412
|
-
|
|
404
|
+
}
|
|
413
405
|
const overrides = await execPrerender(resolvedConfig);
|
|
406
|
+
const userOverrides = await computeStaticHtmlOverrides(resolvedConfig);
|
|
414
407
|
const rewrites = await buildEndpoints(resolvedConfig);
|
|
415
408
|
rewrites.push(...await buildPrerenderConfigs(resolvedConfig));
|
|
416
409
|
await writeConfig(resolvedConfig, rewrites, {
|
|
@@ -420,18 +413,18 @@ function vercelPlugin() {
|
|
|
420
413
|
}
|
|
421
414
|
};
|
|
422
415
|
}
|
|
423
|
-
async function copyDistClientToOutputStatic(resolvedConfig) {
|
|
424
|
-
await copyDir(getOutDir(resolvedConfig, "client"), getOutput(resolvedConfig, "static"));
|
|
425
|
-
}
|
|
426
416
|
async function cleanOutputDirectory(resolvedConfig) {
|
|
427
|
-
await
|
|
417
|
+
await import_promises4.default.rm(getOutput(resolvedConfig), {
|
|
428
418
|
recursive: true,
|
|
429
419
|
force: true
|
|
430
420
|
});
|
|
431
421
|
}
|
|
432
422
|
async function computeStaticHtmlOverrides(resolvedConfig) {
|
|
433
423
|
const staticAbsolutePath = getOutput(resolvedConfig, "static");
|
|
434
|
-
const files = await getStaticHtmlFiles(
|
|
424
|
+
const files = await getStaticHtmlFiles(staticAbsolutePath);
|
|
425
|
+
const publicDir = getPublic(resolvedConfig);
|
|
426
|
+
const publicFiles = await getStaticHtmlFiles(publicDir);
|
|
427
|
+
files.push(...publicFiles.map((f) => f.replace(publicDir, staticAbsolutePath)));
|
|
435
428
|
return files.reduce((acc, curr) => {
|
|
436
429
|
const relPath = import_path5.default.relative(staticAbsolutePath, curr);
|
|
437
430
|
const parsed = import_path5.default.parse(relPath);
|
|
@@ -442,12 +435,17 @@ async function computeStaticHtmlOverrides(resolvedConfig) {
|
|
|
442
435
|
return acc;
|
|
443
436
|
}, {});
|
|
444
437
|
}
|
|
445
|
-
async function getStaticHtmlFiles(
|
|
446
|
-
|
|
438
|
+
async function getStaticHtmlFiles(src) {
|
|
439
|
+
try {
|
|
440
|
+
await import_promises4.default.stat(src);
|
|
441
|
+
} catch (e) {
|
|
442
|
+
return [];
|
|
443
|
+
}
|
|
444
|
+
const entries = await import_promises4.default.readdir(src, { withFileTypes: true });
|
|
447
445
|
const htmlFiles = [];
|
|
448
446
|
for (const entry of entries) {
|
|
449
447
|
const srcPath = import_path5.default.join(src, entry.name);
|
|
450
|
-
entry.isDirectory() ? htmlFiles.push(...await getStaticHtmlFiles(
|
|
448
|
+
entry.isDirectory() ? htmlFiles.push(...await getStaticHtmlFiles(srcPath)) : srcPath.endsWith(".html") ? htmlFiles.push(srcPath) : void 0;
|
|
451
449
|
}
|
|
452
450
|
return htmlFiles;
|
|
453
451
|
}
|
package/dist/index.js
CHANGED
|
@@ -1,38 +1,23 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
1
|
// src/index.ts
|
|
4
|
-
import
|
|
2
|
+
import fs4 from "fs/promises";
|
|
5
3
|
|
|
6
4
|
// src/utils.ts
|
|
7
5
|
import { normalizePath } from "vite";
|
|
8
6
|
import path from "path";
|
|
9
|
-
import fs from "fs/promises";
|
|
10
7
|
function getRoot(config) {
|
|
11
8
|
return normalizePath(config.root || process.cwd());
|
|
12
9
|
}
|
|
13
|
-
function getOutDir(config, force) {
|
|
14
|
-
const p = normalizePath(config.build.outDir);
|
|
15
|
-
if (!force)
|
|
16
|
-
return p;
|
|
17
|
-
return path.join(path.dirname(p), force);
|
|
18
|
-
}
|
|
19
10
|
function getOutput(config, suffix) {
|
|
20
11
|
var _a, _b;
|
|
21
12
|
return path.join(((_a = config.vercel) == null ? void 0 : _a.outDir) ? "" : getRoot(config), ((_b = config.vercel) == null ? void 0 : _b.outDir) ?? ".vercel/output", suffix ?? "");
|
|
22
13
|
}
|
|
14
|
+
function getPublic(config) {
|
|
15
|
+
return path.join(getRoot(config), config.publicDir || "public");
|
|
16
|
+
}
|
|
23
17
|
function pathRelativeTo(filePath, config, rel) {
|
|
24
18
|
const root = getRoot(config);
|
|
25
19
|
return normalizePath(path.relative(path.join(root, rel), filePath));
|
|
26
20
|
}
|
|
27
|
-
async function copyDir(src, dest) {
|
|
28
|
-
await fs.mkdir(dest, { recursive: true });
|
|
29
|
-
const entries = await fs.readdir(src, { withFileTypes: true });
|
|
30
|
-
for (const entry of entries) {
|
|
31
|
-
const srcPath = path.join(src, entry.name);
|
|
32
|
-
const destPath = path.join(dest, entry.name);
|
|
33
|
-
entry.isDirectory() ? await copyDir(srcPath, destPath) : await fs.copyFile(srcPath, destPath);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
21
|
|
|
37
22
|
// src/config.ts
|
|
38
23
|
import path2 from "path";
|
|
@@ -116,7 +101,7 @@ var vercelOutputConfigSchema = z.object({
|
|
|
116
101
|
}).strict();
|
|
117
102
|
|
|
118
103
|
// src/config.ts
|
|
119
|
-
import
|
|
104
|
+
import fs from "fs/promises";
|
|
120
105
|
import { getTransformedRoutes } from "@vercel/routing-utils";
|
|
121
106
|
function reorderEnforce(arr) {
|
|
122
107
|
return [
|
|
@@ -162,7 +147,7 @@ function getConfigDestination(resolvedConfig) {
|
|
|
162
147
|
return path2.join(getOutput(resolvedConfig), "config.json");
|
|
163
148
|
}
|
|
164
149
|
async function writeConfig(resolvedConfig, rewrites, overrides) {
|
|
165
|
-
await
|
|
150
|
+
await fs.writeFile(getConfigDestination(resolvedConfig), JSON.stringify(getConfig(resolvedConfig, rewrites, overrides), void 0, 2), "utf-8");
|
|
166
151
|
}
|
|
167
152
|
|
|
168
153
|
// src/build.ts
|
|
@@ -209,7 +194,7 @@ var vercelOutputVcConfigSchema = z2.union([
|
|
|
209
194
|
]);
|
|
210
195
|
|
|
211
196
|
// src/build.ts
|
|
212
|
-
import
|
|
197
|
+
import fs2 from "fs/promises";
|
|
213
198
|
function getAdditionalEndpoints(resolvedConfig) {
|
|
214
199
|
var _a;
|
|
215
200
|
return (((_a = resolvedConfig.vercel) == null ? void 0 : _a.additionalEndpoints) ?? []).map((e) => ({
|
|
@@ -265,7 +250,7 @@ async function buildFn(resolvedConfig, entry, buildOptions) {
|
|
|
265
250
|
async function writeVcConfig(resolvedConfig, destination) {
|
|
266
251
|
var _a;
|
|
267
252
|
const vcConfig = path3.join(getOutput(resolvedConfig, "functions"), destination, ".vc-config.json");
|
|
268
|
-
await
|
|
253
|
+
await fs2.writeFile(vcConfig, JSON.stringify(vercelOutputVcConfigSchema.parse({
|
|
269
254
|
runtime: "nodejs16.x",
|
|
270
255
|
handler: "index.js",
|
|
271
256
|
maxDuration: (_a = resolvedConfig.vercel) == null ? void 0 : _a.defaultMaxDuration,
|
|
@@ -304,7 +289,7 @@ var vercelOutputPrerenderConfigSchema = z3.object({
|
|
|
304
289
|
}).strict();
|
|
305
290
|
|
|
306
291
|
// src/prerender.ts
|
|
307
|
-
import
|
|
292
|
+
import fs3 from "fs/promises";
|
|
308
293
|
function execPrerender(resolvedConfig) {
|
|
309
294
|
var _a;
|
|
310
295
|
const prerender = (_a = resolvedConfig.vercel) == null ? void 0 : _a.prerender;
|
|
@@ -317,8 +302,8 @@ var group = 1;
|
|
|
317
302
|
async function writePrerenderConfig(resolvedConfig, destination, isr) {
|
|
318
303
|
const parsed = path4.parse(destination);
|
|
319
304
|
const outfile = path4.join(getOutput(resolvedConfig, "functions"), parsed.dir, parsed.name + ".prerender-config.json");
|
|
320
|
-
await
|
|
321
|
-
await
|
|
305
|
+
await fs3.mkdir(path4.join(getOutput(resolvedConfig, "functions"), parsed.dir), { recursive: true });
|
|
306
|
+
await fs3.writeFile(outfile, JSON.stringify(vercelOutputPrerenderConfigSchema.parse({
|
|
322
307
|
group: group++,
|
|
323
308
|
...isr
|
|
324
309
|
}), void 0, 2), "utf-8");
|
|
@@ -350,6 +335,15 @@ async function buildPrerenderConfigs(resolvedConfig) {
|
|
|
350
335
|
}
|
|
351
336
|
return rewrites;
|
|
352
337
|
}
|
|
338
|
+
async function copyDir(src, dest) {
|
|
339
|
+
await fs3.mkdir(dest, { recursive: true });
|
|
340
|
+
const entries = await fs3.readdir(src, { withFileTypes: true });
|
|
341
|
+
for (const entry of entries) {
|
|
342
|
+
const srcPath = path4.join(src, entry.name);
|
|
343
|
+
const destPath = path4.join(dest, entry.name);
|
|
344
|
+
entry.isDirectory() ? await copyDir(srcPath, destPath) : await fs3.copyFile(srcPath, destPath);
|
|
345
|
+
}
|
|
346
|
+
}
|
|
353
347
|
async function getIsrConfig(resolvedConfig) {
|
|
354
348
|
var _a;
|
|
355
349
|
const isr = ((_a = resolvedConfig.vercel) == null ? void 0 : _a.isr) ?? {};
|
|
@@ -374,18 +368,15 @@ function vercelPlugin() {
|
|
|
374
368
|
if (process.env.VERCEL_ENV === "production" && !process.env.ENABLE_VC_BUILD) {
|
|
375
369
|
throw new Error("Missing ENABLE_VC_BUILD=1 to your environment variables in your project settings");
|
|
376
370
|
}
|
|
377
|
-
if (!resolvedConfig.build.ssr) {
|
|
378
|
-
await cleanOutputDirectory(resolvedConfig);
|
|
379
|
-
} else {
|
|
380
|
-
await copyDistClientToOutputStatic(resolvedConfig);
|
|
381
|
-
}
|
|
382
371
|
},
|
|
383
372
|
async writeBundle() {
|
|
384
373
|
var _a;
|
|
385
|
-
if (!((_a = resolvedConfig.build) == null ? void 0 : _a.ssr))
|
|
374
|
+
if (!((_a = resolvedConfig.build) == null ? void 0 : _a.ssr)) {
|
|
375
|
+
await cleanOutputDirectory(resolvedConfig);
|
|
386
376
|
return;
|
|
387
|
-
|
|
377
|
+
}
|
|
388
378
|
const overrides = await execPrerender(resolvedConfig);
|
|
379
|
+
const userOverrides = await computeStaticHtmlOverrides(resolvedConfig);
|
|
389
380
|
const rewrites = await buildEndpoints(resolvedConfig);
|
|
390
381
|
rewrites.push(...await buildPrerenderConfigs(resolvedConfig));
|
|
391
382
|
await writeConfig(resolvedConfig, rewrites, {
|
|
@@ -395,18 +386,18 @@ function vercelPlugin() {
|
|
|
395
386
|
}
|
|
396
387
|
};
|
|
397
388
|
}
|
|
398
|
-
async function copyDistClientToOutputStatic(resolvedConfig) {
|
|
399
|
-
await copyDir(getOutDir(resolvedConfig, "client"), getOutput(resolvedConfig, "static"));
|
|
400
|
-
}
|
|
401
389
|
async function cleanOutputDirectory(resolvedConfig) {
|
|
402
|
-
await
|
|
390
|
+
await fs4.rm(getOutput(resolvedConfig), {
|
|
403
391
|
recursive: true,
|
|
404
392
|
force: true
|
|
405
393
|
});
|
|
406
394
|
}
|
|
407
395
|
async function computeStaticHtmlOverrides(resolvedConfig) {
|
|
408
396
|
const staticAbsolutePath = getOutput(resolvedConfig, "static");
|
|
409
|
-
const files = await getStaticHtmlFiles(
|
|
397
|
+
const files = await getStaticHtmlFiles(staticAbsolutePath);
|
|
398
|
+
const publicDir = getPublic(resolvedConfig);
|
|
399
|
+
const publicFiles = await getStaticHtmlFiles(publicDir);
|
|
400
|
+
files.push(...publicFiles.map((f) => f.replace(publicDir, staticAbsolutePath)));
|
|
410
401
|
return files.reduce((acc, curr) => {
|
|
411
402
|
const relPath = path5.relative(staticAbsolutePath, curr);
|
|
412
403
|
const parsed = path5.parse(relPath);
|
|
@@ -417,12 +408,17 @@ async function computeStaticHtmlOverrides(resolvedConfig) {
|
|
|
417
408
|
return acc;
|
|
418
409
|
}, {});
|
|
419
410
|
}
|
|
420
|
-
async function getStaticHtmlFiles(
|
|
421
|
-
|
|
411
|
+
async function getStaticHtmlFiles(src) {
|
|
412
|
+
try {
|
|
413
|
+
await fs4.stat(src);
|
|
414
|
+
} catch (e) {
|
|
415
|
+
return [];
|
|
416
|
+
}
|
|
417
|
+
const entries = await fs4.readdir(src, { withFileTypes: true });
|
|
422
418
|
const htmlFiles = [];
|
|
423
419
|
for (const entry of entries) {
|
|
424
420
|
const srcPath = path5.join(src, entry.name);
|
|
425
|
-
entry.isDirectory() ? htmlFiles.push(...await getStaticHtmlFiles(
|
|
421
|
+
entry.isDirectory() ? htmlFiles.push(...await getStaticHtmlFiles(srcPath)) : srcPath.endsWith(".html") ? htmlFiles.push(srcPath) : void 0;
|
|
426
422
|
}
|
|
427
423
|
return htmlFiles;
|
|
428
424
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vite-plugin-vercel",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -20,23 +20,23 @@
|
|
|
20
20
|
"repository": "https://github.com/magne4000/vite-plugin-vercel",
|
|
21
21
|
"license": "MIT",
|
|
22
22
|
"peerDependencies": {
|
|
23
|
-
"vite": "^
|
|
23
|
+
"vite": "^3.0.0"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@types/node": "^16.11.
|
|
27
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
28
|
-
"@typescript-eslint/parser": "^5.
|
|
29
|
-
"eslint": "^8.
|
|
30
|
-
"tsup": "^6.
|
|
26
|
+
"@types/node": "^16.11.45",
|
|
27
|
+
"@typescript-eslint/eslint-plugin": "^5.31.0",
|
|
28
|
+
"@typescript-eslint/parser": "^5.31.0",
|
|
29
|
+
"eslint": "^8.20.0",
|
|
30
|
+
"tsup": "^6.2.0",
|
|
31
31
|
"typescript": "^4.7.4",
|
|
32
|
-
"vite": "^
|
|
32
|
+
"vite": "^3.0.3"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@brillout/libassert": "^0.5.8",
|
|
36
|
-
"@vercel/routing-utils": "^1.13.
|
|
37
|
-
"esbuild": "^0.14.
|
|
36
|
+
"@vercel/routing-utils": "^1.13.5",
|
|
37
|
+
"esbuild": "^0.14.50",
|
|
38
38
|
"fast-glob": "^3.2.11",
|
|
39
|
-
"zod": "^3.17.
|
|
39
|
+
"zod": "^3.17.10"
|
|
40
40
|
},
|
|
41
41
|
"scripts": {
|
|
42
42
|
"build": "tsup",
|