@edgeone/nuxt-pages 1.0.5 → 1.0.7

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.
@@ -7,9 +7,9 @@
7
7
  import {
8
8
  addNitroBuildOutputConfig,
9
9
  resetNitroConfig
10
- } from "../../esm-chunks/chunk-3YPB33TX.js";
10
+ } from "../../esm-chunks/chunk-7JK67XZ2.js";
11
11
  import "../../esm-chunks/chunk-V2LFVP3C.js";
12
- import "../../esm-chunks/chunk-AX7OAFFE.js";
12
+ import "../../esm-chunks/chunk-5VJRCUAW.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-YLEWZSAK.js";
12
- import "../esm-chunks/chunk-AX7OAFFE.js";
11
+ } from "../esm-chunks/chunk-ZYJTEPF7.js";
12
+ import "../esm-chunks/chunk-5VJRCUAW.js";
13
13
  import "../esm-chunks/chunk-6BT4RYQJ.js";
14
14
  export {
15
15
  EDGE_HANDLER_NAME,
@@ -8,8 +8,8 @@ import {
8
8
  convertNuxtRoutePattern,
9
9
  createNuxtApiRoutesMeta,
10
10
  createNuxtPagesRouteMeta
11
- } from "../esm-chunks/chunk-SAO2LN63.js";
12
- import "../esm-chunks/chunk-AX7OAFFE.js";
11
+ } from "../esm-chunks/chunk-VCO654TD.js";
12
+ import "../esm-chunks/chunk-5VJRCUAW.js";
13
13
  import "../esm-chunks/chunk-6BT4RYQJ.js";
14
14
  export {
15
15
  convertNuxtRoutePattern,
@@ -14588,7 +14588,6 @@ 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";
14592
14591
  var require2 = createRequire(import.meta.url);
14593
14592
  var traverse = require2("@babel/traverse").default;
14594
14593
  function astNodeToObject(node) {
@@ -15052,25 +15051,6 @@ function getModulesWithAST(code) {
15052
15051
  return [];
15053
15052
  }
15054
15053
  }
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
- };
15074
15054
 
15075
15055
  export {
15076
15056
  getRouteRulesWithAST,
@@ -15079,8 +15059,5 @@ export {
15079
15059
  getHandlersArrayWithAST,
15080
15060
  addCodeToGenerateEdgeoneWithAST,
15081
15061
  resetNitroConfigWithAST,
15082
- getModulesWithAST,
15083
- checkModules,
15084
- checkNuxtVersion,
15085
- removeServerHandler
15062
+ getModulesWithAST
15086
15063
  };
@@ -11,7 +11,7 @@ import {
11
11
  import {
12
12
  addCodeToGenerateEdgeoneWithAST,
13
13
  resetNitroConfigWithAST
14
- } from "./chunk-AX7OAFFE.js";
14
+ } from "./chunk-5VJRCUAW.js";
15
15
 
16
16
  // src/build/content/static.ts
17
17
  import { existsSync } from "node:fs";
@@ -6,7 +6,7 @@
6
6
 
7
7
  import {
8
8
  getHandlersArrayWithAST
9
- } from "./chunk-AX7OAFFE.js";
9
+ } from "./chunk-5VJRCUAW.js";
10
10
 
11
11
  // src/build/routes.ts
12
12
  import * as fs from "fs";
@@ -9,13 +9,14 @@ import {
9
9
  getPrerenderRoutesWithAST,
10
10
  getRouteRulesWithAST,
11
11
  getRoutesArrayWithAST
12
- } from "./chunk-AX7OAFFE.js";
12
+ } from "./chunk-5VJRCUAW.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 { execSync } from "node:child_process";
17
+ import { createRequire } from "node:module";
18
18
  import { join, relative, resolve } from "node:path";
19
+ import { join as posixJoin } from "node:path/posix";
19
20
  import { fileURLToPath } from "node:url";
20
21
  var MODULE_DIR = fileURLToPath(new URL(".", import.meta.url));
21
22
  var PLUGIN_DIR = join(MODULE_DIR, "../..");
@@ -494,17 +495,9 @@ var PluginContext = class {
494
495
  get nuxtVersion() {
495
496
  if (this.#nuxtVersion === void 0) {
496
497
  try {
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
- }
498
+ const serverHandlerRequire = createRequire(posixJoin(this.outputRootDir, ":internal:"));
499
+ const { version } = serverHandlerRequire("nuxt/package.json");
500
+ this.#nuxtVersion = version;
508
501
  } catch {
509
502
  this.#nuxtVersion = null;
510
503
  }
package/dist/index.js CHANGED
@@ -4,30 +4,45 @@
4
4
  return createRequire(import.meta.url);
5
5
  })();
6
6
 
7
- import {
8
- addNitroBuildOutputConfig,
9
- resetNitroConfig
10
- } from "./esm-chunks/chunk-3YPB33TX.js";
11
7
  import {
12
8
  createServerHandler,
13
9
  patchNitroHandler
14
10
  } from "./esm-chunks/chunk-QG7JLDXY.js";
15
11
  import "./esm-chunks/chunk-NJ4SUJNF.js";
12
+ import {
13
+ addNitroBuildOutputConfig,
14
+ resetNitroConfig
15
+ } from "./esm-chunks/chunk-7JK67XZ2.js";
16
16
  import "./esm-chunks/chunk-V2LFVP3C.js";
17
17
  import {
18
18
  PluginContext
19
- } from "./esm-chunks/chunk-YLEWZSAK.js";
19
+ } from "./esm-chunks/chunk-ZYJTEPF7.js";
20
20
  import {
21
21
  createNuxtApiRoutesMeta,
22
22
  createNuxtPagesRouteMeta
23
- } from "./esm-chunks/chunk-SAO2LN63.js";
24
- import {
25
- checkNuxtVersion,
26
- removeServerHandler
27
- } from "./esm-chunks/chunk-AX7OAFFE.js";
23
+ } from "./esm-chunks/chunk-VCO654TD.js";
24
+ import "./esm-chunks/chunk-5VJRCUAW.js";
28
25
  import "./esm-chunks/chunk-6BT4RYQJ.js";
29
26
 
30
27
  // src/index.ts
28
+ import { rm } from "node:fs/promises";
29
+ import { join } from "node:path";
30
+ import { existsSync } from "node:fs";
31
+ function checkNuxtVersion(version) {
32
+ const versionData = version.split(".");
33
+ if (versionData.length === 3 && Number(versionData[0]) < 3) {
34
+ console.error("Nuxt version must be greater than 3.16.0. Compatibility for lower versions is under development...");
35
+ process.exit(1);
36
+ }
37
+ }
38
+ var removeServerHandler = async (ctx) => {
39
+ await rm(ctx.serverHandlerDir, { recursive: true, force: true });
40
+ };
41
+ var removeIndexMJS = async (ctx) => {
42
+ if (existsSync(join(ctx.serverHandlerDir, "index.mjs"))) {
43
+ await rm(join(ctx.serverHandlerDir, "index.mjs"), { force: true });
44
+ }
45
+ };
31
46
  var recordOldNitroConfig = null;
32
47
  var onPreBuild = async (options) => {
33
48
  try {
@@ -53,6 +68,7 @@ var onPostBuild = async (options) => {
53
68
  const ctx = new PluginContext(options);
54
69
  if (recordOldNitroConfig) {
55
70
  await resetNitroConfig(recordOldNitroConfig.oldOutput, recordOldNitroConfig.oldPreset);
71
+ await removeIndexMJS(ctx);
56
72
  }
57
73
  };
58
74
  export {
@@ -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.5";
202
+ var version = "1.0.6";
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.5";
31
+ var version = "1.0.6";
32
32
 
33
33
  // src/run/handlers/request-context.cts
34
34
  var import_node_async_hooks = require("node:async_hooks");
@@ -20,7 +20,7 @@ import { Buffer } from "node:buffer";
20
20
 
21
21
  // package.json
22
22
  var name = "@edgeone/nuxt-pages";
23
- var version = "1.0.5";
23
+ var version = "1.0.6";
24
24
 
25
25
  // src/run/handlers/tags-handler.cts
26
26
  var purgeCacheUserAgent = `${name}@${version}`;
package/dist/utils.js CHANGED
@@ -6,26 +6,20 @@
6
6
 
7
7
  import {
8
8
  addCodeToGenerateEdgeoneWithAST,
9
- checkModules,
10
- checkNuxtVersion,
11
9
  getHandlersArrayWithAST,
12
10
  getModulesWithAST,
13
11
  getPrerenderRoutesWithAST,
14
12
  getRouteRulesWithAST,
15
13
  getRoutesArrayWithAST,
16
- removeServerHandler,
17
14
  resetNitroConfigWithAST
18
- } from "./esm-chunks/chunk-AX7OAFFE.js";
15
+ } from "./esm-chunks/chunk-5VJRCUAW.js";
19
16
  import "./esm-chunks/chunk-6BT4RYQJ.js";
20
17
  export {
21
18
  addCodeToGenerateEdgeoneWithAST,
22
- checkModules,
23
- checkNuxtVersion,
24
19
  getHandlersArrayWithAST,
25
20
  getModulesWithAST,
26
21
  getPrerenderRoutesWithAST,
27
22
  getRouteRulesWithAST,
28
23
  getRoutesArrayWithAST,
29
- removeServerHandler,
30
24
  resetNitroConfigWithAST
31
25
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edgeone/nuxt-pages",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "main": "./dist/index.js",
5
5
  "scripts": {
6
6
  "test": "ts-node src/test.ts",