@edgeone/nuxt-pages 1.0.3 → 1.0.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/dist/build/content/static.js +2 -2
- package/dist/build/plugin-context.js +2 -2
- package/dist/build/routes.js +2 -2
- package/dist/esm-chunks/{chunk-MMMRMLH2.js → chunk-3YPB33TX.js} +1 -2
- package/dist/esm-chunks/{chunk-GX4Z7KQX.js → chunk-AX7OAFFE.js} +25 -4
- package/dist/esm-chunks/{chunk-6YERJDAJ.js → chunk-SAO2LN63.js} +23 -5
- package/dist/esm-chunks/{chunk-SHMQI7KT.js → chunk-YLEWZSAK.js} +13 -6
- package/dist/index.js +8 -16
- package/dist/run/handlers/cache.cjs +1 -1
- package/dist/run/handlers/nuxt-server.js +0 -1
- package/dist/run/handlers/tags-handler.cjs +1 -1
- package/dist/run/handlers/use-cache-handler.js +1 -1
- package/dist/utils.js +7 -1
- package/package.json +1 -1
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
import {
|
|
8
8
|
addNitroBuildOutputConfig,
|
|
9
9
|
resetNitroConfig
|
|
10
|
-
} from "../../esm-chunks/chunk-
|
|
10
|
+
} from "../../esm-chunks/chunk-3YPB33TX.js";
|
|
11
11
|
import "../../esm-chunks/chunk-V2LFVP3C.js";
|
|
12
|
-
import "../../esm-chunks/chunk-
|
|
12
|
+
import "../../esm-chunks/chunk-AX7OAFFE.js";
|
|
13
13
|
import "../../esm-chunks/chunk-6BT4RYQJ.js";
|
|
14
14
|
export {
|
|
15
15
|
addNitroBuildOutputConfig,
|
|
@@ -8,8 +8,8 @@ import {
|
|
|
8
8
|
EDGE_HANDLER_NAME,
|
|
9
9
|
PluginContext,
|
|
10
10
|
SERVER_HANDLER_NAME
|
|
11
|
-
} from "../esm-chunks/chunk-
|
|
12
|
-
import "../esm-chunks/chunk-
|
|
11
|
+
} from "../esm-chunks/chunk-YLEWZSAK.js";
|
|
12
|
+
import "../esm-chunks/chunk-AX7OAFFE.js";
|
|
13
13
|
import "../esm-chunks/chunk-6BT4RYQJ.js";
|
|
14
14
|
export {
|
|
15
15
|
EDGE_HANDLER_NAME,
|
package/dist/build/routes.js
CHANGED
|
@@ -8,8 +8,8 @@ import {
|
|
|
8
8
|
convertNuxtRoutePattern,
|
|
9
9
|
createNuxtApiRoutesMeta,
|
|
10
10
|
createNuxtPagesRouteMeta
|
|
11
|
-
} from "../esm-chunks/chunk-
|
|
12
|
-
import "../esm-chunks/chunk-
|
|
11
|
+
} from "../esm-chunks/chunk-SAO2LN63.js";
|
|
12
|
+
import "../esm-chunks/chunk-AX7OAFFE.js";
|
|
13
13
|
import "../esm-chunks/chunk-6BT4RYQJ.js";
|
|
14
14
|
export {
|
|
15
15
|
convertNuxtRoutePattern,
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
import {
|
|
12
12
|
addCodeToGenerateEdgeoneWithAST,
|
|
13
13
|
resetNitroConfigWithAST
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-AX7OAFFE.js";
|
|
15
15
|
|
|
16
16
|
// src/build/content/static.ts
|
|
17
17
|
import { existsSync } from "node:fs";
|
|
@@ -32,7 +32,6 @@ var addNitroBuildOutputConfig = async (ctx) => {
|
|
|
32
32
|
const defaultNuxtConfig = `export default defineNuxtConfig({
|
|
33
33
|
srcDir: 'app',
|
|
34
34
|
nitro: {
|
|
35
|
-
preset: 'node-server',
|
|
36
35
|
output: {
|
|
37
36
|
dir: '.edgeone',
|
|
38
37
|
publicDir: '.edgeone/assets',
|
|
@@ -14588,6 +14588,7 @@ var require_lib = __commonJS({
|
|
|
14588
14588
|
// src/utils.ts
|
|
14589
14589
|
var parser = __toESM(require_lib(), 1);
|
|
14590
14590
|
import { createRequire } from "node:module";
|
|
14591
|
+
import { rm } from "node:fs/promises";
|
|
14591
14592
|
var require2 = createRequire(import.meta.url);
|
|
14592
14593
|
var traverse = require2("@babel/traverse").default;
|
|
14593
14594
|
function astNodeToObject(node) {
|
|
@@ -14788,7 +14789,6 @@ function addCodeToGenerateEdgeoneWithAST(code, insertCode) {
|
|
|
14788
14789
|
oldOutputValue = null;
|
|
14789
14790
|
const existingConfigContent = code.slice(configStart + 1, configEnd - 1).trim();
|
|
14790
14791
|
const nitroConfig = ` nitro: {
|
|
14791
|
-
preset: 'node-server',
|
|
14792
14792
|
output: {
|
|
14793
14793
|
dir: '.edgeone',
|
|
14794
14794
|
publicDir: '.edgeone/assets',
|
|
@@ -14833,7 +14833,6 @@ ${nitroConfig}
|
|
|
14833
14833
|
publicDir: '.edgeone/assets',
|
|
14834
14834
|
serverDir: '.edgeone/server-handler',
|
|
14835
14835
|
}`;
|
|
14836
|
-
const presetConfigStr = ` preset: 'node-server'`;
|
|
14837
14836
|
let newNitroContent;
|
|
14838
14837
|
const properties = [];
|
|
14839
14838
|
for (const nitroProp of nitroProperty.value.properties) {
|
|
@@ -14841,7 +14840,7 @@ ${nitroConfig}
|
|
|
14841
14840
|
if (nitroProp.key.name === "output") {
|
|
14842
14841
|
properties.push(outputConfigStr);
|
|
14843
14842
|
} else if (nitroProp.key.name === "preset") {
|
|
14844
|
-
|
|
14843
|
+
continue;
|
|
14845
14844
|
} else {
|
|
14846
14845
|
const propStart = nitroProp.start - nitroStart;
|
|
14847
14846
|
const propEnd = nitroProp.end - nitroStart;
|
|
@@ -15053,6 +15052,25 @@ function getModulesWithAST(code) {
|
|
|
15053
15052
|
return [];
|
|
15054
15053
|
}
|
|
15055
15054
|
}
|
|
15055
|
+
function checkModules(modules) {
|
|
15056
|
+
const excludeModules = ["@nuxt/image"];
|
|
15057
|
+
const invalidModules = modules.filter((module) => excludeModules.includes(module));
|
|
15058
|
+
if (invalidModules.length > 0) {
|
|
15059
|
+
console.error("\x1B[31mThe following modules are not supported: \x1B[0m", invalidModules.join(", "));
|
|
15060
|
+
console.log("Further optimizations and adaptations are under development...");
|
|
15061
|
+
process.exit(1);
|
|
15062
|
+
}
|
|
15063
|
+
}
|
|
15064
|
+
function checkNuxtVersion(version) {
|
|
15065
|
+
const versionData = version.split(".");
|
|
15066
|
+
if (versionData.length === 3 && Number(versionData[0]) < 3) {
|
|
15067
|
+
console.error("Nuxt version must be greater than 3.16.0. Compatibility for lower versions is under development...");
|
|
15068
|
+
process.exit(1);
|
|
15069
|
+
}
|
|
15070
|
+
}
|
|
15071
|
+
var removeServerHandler = async (ctx) => {
|
|
15072
|
+
await rm(ctx.serverHandlerDir, { recursive: true, force: true });
|
|
15073
|
+
};
|
|
15056
15074
|
|
|
15057
15075
|
export {
|
|
15058
15076
|
getRouteRulesWithAST,
|
|
@@ -15061,5 +15079,8 @@ export {
|
|
|
15061
15079
|
getHandlersArrayWithAST,
|
|
15062
15080
|
addCodeToGenerateEdgeoneWithAST,
|
|
15063
15081
|
resetNitroConfigWithAST,
|
|
15064
|
-
getModulesWithAST
|
|
15082
|
+
getModulesWithAST,
|
|
15083
|
+
checkModules,
|
|
15084
|
+
checkNuxtVersion,
|
|
15085
|
+
removeServerHandler
|
|
15065
15086
|
};
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
import {
|
|
8
8
|
getHandlersArrayWithAST
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-AX7OAFFE.js";
|
|
10
10
|
|
|
11
11
|
// src/build/routes.ts
|
|
12
12
|
import * as fs from "fs";
|
|
@@ -60,9 +60,6 @@ var createNuxtPagesRouteMeta = async (ctx) => {
|
|
|
60
60
|
if (!routeMap[route]) {
|
|
61
61
|
routeMap[route] = {};
|
|
62
62
|
}
|
|
63
|
-
if (routeInfo.ssr !== void 0 && routeInfo.ssr) {
|
|
64
|
-
routeMap[route].ssr = routeInfo.ssr;
|
|
65
|
-
}
|
|
66
63
|
if (routeInfo.prerender !== void 0) {
|
|
67
64
|
routeMap[route].isStatic = routeInfo.prerender;
|
|
68
65
|
}
|
|
@@ -160,7 +157,7 @@ var createNuxtApiRoutesMeta = async (ctx) => {
|
|
|
160
157
|
frameworkRoutes: existingMetaData.routes.concat(apiRoutes.map((route) => ({ path: route.path })))
|
|
161
158
|
};
|
|
162
159
|
const excludeRoutes = ["/**"];
|
|
163
|
-
|
|
160
|
+
let processedRoutes = mergedMetaData.frameworkRoutes.filter((route) => !excludeRoutes.includes(route.path)).map((route) => {
|
|
164
161
|
if (!route.path || route.path === "/**") {
|
|
165
162
|
return {
|
|
166
163
|
...route,
|
|
@@ -192,6 +189,27 @@ var createNuxtApiRoutesMeta = async (ctx) => {
|
|
|
192
189
|
processedRoutes.push({
|
|
193
190
|
path: ".*-ssr-functions/:path*"
|
|
194
191
|
});
|
|
192
|
+
processedRoutes = processedRoutes.map((route) => {
|
|
193
|
+
if (route.hasOwnProperty("ssr")) {
|
|
194
|
+
Reflect.deleteProperty(route, "ssr");
|
|
195
|
+
}
|
|
196
|
+
route.path = route.path.replace(/\(/g, "").replace(/\)/g, "");
|
|
197
|
+
return route;
|
|
198
|
+
});
|
|
199
|
+
processedRoutes = processedRoutes.map((route) => {
|
|
200
|
+
if (route.path.startsWith("/:")) {
|
|
201
|
+
if (route.hasOwnProperty("isStatic")) {
|
|
202
|
+
route.isStatic = true;
|
|
203
|
+
} else {
|
|
204
|
+
Reflect.defineProperty(route, "isStatic", {
|
|
205
|
+
value: true,
|
|
206
|
+
enumerable: true
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
return route;
|
|
210
|
+
}
|
|
211
|
+
return route;
|
|
212
|
+
});
|
|
195
213
|
const finalMetaData = {
|
|
196
214
|
frameworkRoutes: processedRoutes,
|
|
197
215
|
conf: {
|
|
@@ -9,14 +9,13 @@ import {
|
|
|
9
9
|
getPrerenderRoutesWithAST,
|
|
10
10
|
getRouteRulesWithAST,
|
|
11
11
|
getRoutesArrayWithAST
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-AX7OAFFE.js";
|
|
13
13
|
|
|
14
14
|
// src/build/plugin-context.ts
|
|
15
15
|
import { existsSync, readFileSync } from "node:fs";
|
|
16
16
|
import { readFile } from "node:fs/promises";
|
|
17
|
-
import {
|
|
17
|
+
import { execSync } from "node:child_process";
|
|
18
18
|
import { join, relative, resolve } from "node:path";
|
|
19
|
-
import { join as posixJoin } from "node:path/posix";
|
|
20
19
|
import { fileURLToPath } from "node:url";
|
|
21
20
|
var MODULE_DIR = fileURLToPath(new URL(".", import.meta.url));
|
|
22
21
|
var PLUGIN_DIR = join(MODULE_DIR, "../..");
|
|
@@ -495,9 +494,17 @@ var PluginContext = class {
|
|
|
495
494
|
get nuxtVersion() {
|
|
496
495
|
if (this.#nuxtVersion === void 0) {
|
|
497
496
|
try {
|
|
498
|
-
const
|
|
499
|
-
|
|
500
|
-
|
|
497
|
+
const output = execSync("npx nuxt info", {
|
|
498
|
+
encoding: "utf-8",
|
|
499
|
+
cwd: process.cwd(),
|
|
500
|
+
stdio: ["pipe", "pipe", "pipe"]
|
|
501
|
+
});
|
|
502
|
+
const versionMatch = output.match(/(?:nuxt|version)[:\s]+(\d+\.\d+\.\d+)/i);
|
|
503
|
+
if (versionMatch && versionMatch[1]) {
|
|
504
|
+
this.#nuxtVersion = versionMatch[1];
|
|
505
|
+
} else {
|
|
506
|
+
this.#nuxtVersion = null;
|
|
507
|
+
}
|
|
501
508
|
} catch {
|
|
502
509
|
this.#nuxtVersion = null;
|
|
503
510
|
}
|
package/dist/index.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import {
|
|
8
8
|
addNitroBuildOutputConfig,
|
|
9
9
|
resetNitroConfig
|
|
10
|
-
} from "./esm-chunks/chunk-
|
|
10
|
+
} from "./esm-chunks/chunk-3YPB33TX.js";
|
|
11
11
|
import {
|
|
12
12
|
createServerHandler,
|
|
13
13
|
patchNitroHandler
|
|
@@ -16,31 +16,23 @@ 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-YLEWZSAK.js";
|
|
20
20
|
import {
|
|
21
21
|
createNuxtApiRoutesMeta,
|
|
22
22
|
createNuxtPagesRouteMeta
|
|
23
|
-
} from "./esm-chunks/chunk-
|
|
24
|
-
import
|
|
23
|
+
} from "./esm-chunks/chunk-SAO2LN63.js";
|
|
24
|
+
import {
|
|
25
|
+
checkNuxtVersion,
|
|
26
|
+
removeServerHandler
|
|
27
|
+
} from "./esm-chunks/chunk-AX7OAFFE.js";
|
|
25
28
|
import "./esm-chunks/chunk-6BT4RYQJ.js";
|
|
26
29
|
|
|
27
30
|
// src/index.ts
|
|
28
|
-
import { rm } from "node:fs/promises";
|
|
29
|
-
function checkNuxtVersion(version) {
|
|
30
|
-
const versionData = version.split(".");
|
|
31
|
-
if (versionData.length === 3 && Number(versionData[0]) < 3) {
|
|
32
|
-
console.error("Nuxt version must be greater than 3.8.0. Compatibility for lower versions is under development...");
|
|
33
|
-
process.exit(1);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
var removeServerHandler = async (ctx) => {
|
|
37
|
-
await rm(ctx.serverHandlerDir, { recursive: true, force: true });
|
|
38
|
-
};
|
|
39
31
|
var recordOldNitroConfig = null;
|
|
40
32
|
var onPreBuild = async (options) => {
|
|
41
33
|
try {
|
|
42
34
|
const ctx = new PluginContext(options);
|
|
43
|
-
checkNuxtVersion(ctx.nuxtVersion || "
|
|
35
|
+
checkNuxtVersion(ctx.nuxtVersion || "1.0.0");
|
|
44
36
|
recordOldNitroConfig = await addNitroBuildOutputConfig(ctx);
|
|
45
37
|
} catch (error) {
|
|
46
38
|
console.error("onPreBuild failed:", error);
|
|
@@ -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.5";
|
|
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.5";
|
|
32
32
|
|
|
33
33
|
// src/run/handlers/request-context.cts
|
|
34
34
|
var import_node_async_hooks = require("node:async_hooks");
|
package/dist/utils.js
CHANGED
|
@@ -6,20 +6,26 @@
|
|
|
6
6
|
|
|
7
7
|
import {
|
|
8
8
|
addCodeToGenerateEdgeoneWithAST,
|
|
9
|
+
checkModules,
|
|
10
|
+
checkNuxtVersion,
|
|
9
11
|
getHandlersArrayWithAST,
|
|
10
12
|
getModulesWithAST,
|
|
11
13
|
getPrerenderRoutesWithAST,
|
|
12
14
|
getRouteRulesWithAST,
|
|
13
15
|
getRoutesArrayWithAST,
|
|
16
|
+
removeServerHandler,
|
|
14
17
|
resetNitroConfigWithAST
|
|
15
|
-
} from "./esm-chunks/chunk-
|
|
18
|
+
} from "./esm-chunks/chunk-AX7OAFFE.js";
|
|
16
19
|
import "./esm-chunks/chunk-6BT4RYQJ.js";
|
|
17
20
|
export {
|
|
18
21
|
addCodeToGenerateEdgeoneWithAST,
|
|
22
|
+
checkModules,
|
|
23
|
+
checkNuxtVersion,
|
|
19
24
|
getHandlersArrayWithAST,
|
|
20
25
|
getModulesWithAST,
|
|
21
26
|
getPrerenderRoutesWithAST,
|
|
22
27
|
getRouteRulesWithAST,
|
|
23
28
|
getRoutesArrayWithAST,
|
|
29
|
+
removeServerHandler,
|
|
24
30
|
resetNitroConfigWithAST
|
|
25
31
|
};
|