@edgeone/nuxt-pages 1.0.1 → 1.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/dist/build/plugin-context.js +1 -1
- package/dist/esm-chunks/{chunk-RPSYO4VM.js → chunk-SHMQI7KT.js} +8 -0
- package/dist/index.js +10 -1
- package/dist/run/handlers/cache.cjs +1 -1
- package/dist/run/handlers/tags-handler.cjs +1 -1
- package/dist/run/handlers/use-cache-handler.js +1 -1
- package/package.json +1 -1
|
@@ -352,6 +352,7 @@ var PluginContext = class {
|
|
|
352
352
|
return configPath;
|
|
353
353
|
}
|
|
354
354
|
}
|
|
355
|
+
console.log("Can't find nuxt.config.ts file");
|
|
355
356
|
return null;
|
|
356
357
|
}
|
|
357
358
|
/** Detect and locate server.mjs file */
|
|
@@ -545,6 +546,13 @@ var PluginContext = class {
|
|
|
545
546
|
return [];
|
|
546
547
|
}
|
|
547
548
|
}
|
|
549
|
+
async nuxtStaticGeneration() {
|
|
550
|
+
const nitroJSON = await readFile(join(this.outputDir, "nitro.json"), "utf-8") || "{}";
|
|
551
|
+
if (!nitroJSON) return false;
|
|
552
|
+
const nitroJSONData = JSON.parse(nitroJSON);
|
|
553
|
+
if (nitroJSONData.preset && nitroJSONData.preset === "static") return true;
|
|
554
|
+
return false;
|
|
555
|
+
}
|
|
548
556
|
/** Fails a build with a message and an optional error */
|
|
549
557
|
failBuild(message, error) {
|
|
550
558
|
console.error(message);
|
package/dist/index.js
CHANGED
|
@@ -16,7 +16,7 @@ import "./esm-chunks/chunk-NJ4SUJNF.js";
|
|
|
16
16
|
import "./esm-chunks/chunk-V2LFVP3C.js";
|
|
17
17
|
import {
|
|
18
18
|
PluginContext
|
|
19
|
-
} from "./esm-chunks/chunk-
|
|
19
|
+
} from "./esm-chunks/chunk-SHMQI7KT.js";
|
|
20
20
|
import {
|
|
21
21
|
createNuxtApiRoutesMeta,
|
|
22
22
|
createNuxtPagesRouteMeta
|
|
@@ -25,6 +25,7 @@ import "./esm-chunks/chunk-GX4Z7KQX.js";
|
|
|
25
25
|
import "./esm-chunks/chunk-6BT4RYQJ.js";
|
|
26
26
|
|
|
27
27
|
// src/index.ts
|
|
28
|
+
import { rm } from "node:fs/promises";
|
|
28
29
|
function checkNuxtVersion(version) {
|
|
29
30
|
const versionData = version.split(".");
|
|
30
31
|
if (versionData.length === 3 && Number(versionData[0]) < 3) {
|
|
@@ -32,6 +33,9 @@ function checkNuxtVersion(version) {
|
|
|
32
33
|
process.exit(1);
|
|
33
34
|
}
|
|
34
35
|
}
|
|
36
|
+
var removeServerHandler = async (ctx) => {
|
|
37
|
+
await rm(ctx.serverHandlerDir, { recursive: true, force: true });
|
|
38
|
+
};
|
|
35
39
|
var recordOldNitroConfig = null;
|
|
36
40
|
var onPreBuild = async (options) => {
|
|
37
41
|
try {
|
|
@@ -44,6 +48,11 @@ var onPreBuild = async (options) => {
|
|
|
44
48
|
};
|
|
45
49
|
var onBuild = async (options) => {
|
|
46
50
|
const ctx = new PluginContext(options);
|
|
51
|
+
const isStaticGeneration = await ctx.nuxtStaticGeneration();
|
|
52
|
+
if (isStaticGeneration) {
|
|
53
|
+
await removeServerHandler(ctx);
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
47
56
|
await createServerHandler(ctx), await createNuxtPagesRouteMeta(ctx);
|
|
48
57
|
await createNuxtApiRoutesMeta(ctx);
|
|
49
58
|
await patchNitroHandler(ctx);
|
|
@@ -199,7 +199,7 @@ var getMemoizedKeyValueStoreBackedByRegionalBlobStore = (...args) => {
|
|
|
199
199
|
|
|
200
200
|
// package.json
|
|
201
201
|
var name = "@edgeone/nuxt-pages";
|
|
202
|
-
var version = "1.0.
|
|
202
|
+
var version = "1.0.2";
|
|
203
203
|
|
|
204
204
|
// src/run/handlers/tags-handler.cts
|
|
205
205
|
var purgeCacheUserAgent = `${name}@${version}`;
|
|
@@ -28,7 +28,7 @@ module.exports = __toCommonJS(tags_handler_exports);
|
|
|
28
28
|
|
|
29
29
|
// package.json
|
|
30
30
|
var name = "@edgeone/nuxt-pages";
|
|
31
|
-
var version = "1.0.
|
|
31
|
+
var version = "1.0.2";
|
|
32
32
|
|
|
33
33
|
// src/run/handlers/request-context.cts
|
|
34
34
|
var import_node_async_hooks = require("node:async_hooks");
|