@edgeone/nuxt-pages 1.0.0

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.
Files changed (47) hide show
  1. package/README.md +275 -0
  2. package/dist/build/content/server.js +18 -0
  3. package/dist/build/content/static.js +17 -0
  4. package/dist/build/functions/server.js +19 -0
  5. package/dist/build/plugin-context.js +18 -0
  6. package/dist/build/routes.js +18 -0
  7. package/dist/build/templates/nuxt-handler-backup.js +305 -0
  8. package/dist/build/templates/nuxt-handler-monorepo.tmpl-ipx_backup.js +511 -0
  9. package/dist/build/templates/nuxt-handler-monorepo.tmpl.js +243 -0
  10. package/dist/build/templates/nuxt-handler.tmpl.js +212 -0
  11. package/dist/esm-chunks/chunk-5YBUNNZ4.js +81 -0
  12. package/dist/esm-chunks/chunk-6BT4RYQJ.js +43 -0
  13. package/dist/esm-chunks/chunk-6YERJDAJ.js +208 -0
  14. package/dist/esm-chunks/chunk-GX4Z7KQX.js +15065 -0
  15. package/dist/esm-chunks/chunk-HBXUWFGE.js +19 -0
  16. package/dist/esm-chunks/chunk-HY3HNABZ.js +87 -0
  17. package/dist/esm-chunks/chunk-KGYBHZC3.js +1467 -0
  18. package/dist/esm-chunks/chunk-MMMRMLH2.js +132 -0
  19. package/dist/esm-chunks/chunk-NJ4SUJNF.js +5635 -0
  20. package/dist/esm-chunks/chunk-QG7JLDXY.js +127 -0
  21. package/dist/esm-chunks/chunk-RPSYO4VM.js +562 -0
  22. package/dist/esm-chunks/chunk-UOPC2N5A.js +69 -0
  23. package/dist/esm-chunks/chunk-V2LFVP3C.js +838 -0
  24. package/dist/index.js +61 -0
  25. package/dist/run/config.js +17 -0
  26. package/dist/run/constants.js +17 -0
  27. package/dist/run/handlers/cache.cjs +1410 -0
  28. package/dist/run/handlers/nuxt-cache.cjs +200 -0
  29. package/dist/run/handlers/nuxt-server.js +156 -0
  30. package/dist/run/handlers/request-context.cjs +148 -0
  31. package/dist/run/handlers/server.js +77 -0
  32. package/dist/run/handlers/tags-handler.cjs +177 -0
  33. package/dist/run/handlers/tracer.cjs +1004 -0
  34. package/dist/run/handlers/use-cache-handler.js +220 -0
  35. package/dist/run/handlers/wait-until.cjs +123 -0
  36. package/dist/run/headers.js +17 -0
  37. package/dist/run/revalidate.js +34 -0
  38. package/dist/run/storage/regional-blob-store.cjs +64 -0
  39. package/dist/run/storage/request-scoped-in-memory-cache.cjs +1582 -0
  40. package/dist/run/storage/storage.cjs +191 -0
  41. package/dist/shared/blob-types.cjs +37 -0
  42. package/dist/shared/blobkey.js +25 -0
  43. package/dist/shared/cache-types.cjs +33 -0
  44. package/dist/shared/nuxt-cache-types.cjs +18 -0
  45. package/dist/types/options.js +6 -0
  46. package/dist/utils.js +25 -0
  47. package/package.json +58 -0
@@ -0,0 +1,191 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/run/storage/storage.cts
21
+ var storage_exports = {};
22
+ __export(storage_exports, {
23
+ getMemoizedKeyValueStoreBackedByRegionalBlobStore: () => getMemoizedKeyValueStoreBackedByRegionalBlobStore,
24
+ setFetchBeforeNuxtPatchedIt: () => setFetchBeforeNuxtPatchedIt,
25
+ setInMemoryCacheMaxSizeFromNuxtConfig: () => setInMemoryCacheMaxSizeFromNuxtConfig
26
+ });
27
+ module.exports = __toCommonJS(storage_exports);
28
+
29
+ // node_modules/lru-cache/dist/esm/index.js
30
+ var perf = typeof performance === "object" && performance && typeof performance.now === "function" ? performance : Date;
31
+ var PROCESS = typeof process === "object" && !!process ? process : {};
32
+ var emitWarning = (msg, type, code, fn) => {
33
+ typeof PROCESS.emitWarning === "function" ? PROCESS.emitWarning(msg, type, code, fn) : console.error(`[${code}] ${type}: ${msg}`);
34
+ };
35
+ var AC = globalThis.AbortController;
36
+ var AS = globalThis.AbortSignal;
37
+ if (typeof AC === "undefined") {
38
+ AS = class AbortSignal {
39
+ onabort;
40
+ _onabort = [];
41
+ reason;
42
+ aborted = false;
43
+ addEventListener(_, fn) {
44
+ this._onabort.push(fn);
45
+ }
46
+ };
47
+ AC = class AbortController {
48
+ constructor() {
49
+ warnACPolyfill();
50
+ }
51
+ signal = new AS();
52
+ abort(reason) {
53
+ if (this.signal.aborted)
54
+ return;
55
+ this.signal.reason = reason;
56
+ this.signal.aborted = true;
57
+ for (const fn of this.signal._onabort) {
58
+ fn(reason);
59
+ }
60
+ this.signal.onabort?.(reason);
61
+ }
62
+ };
63
+ let printACPolyfillWarning = PROCESS.env?.LRU_CACHE_IGNORE_AC_WARNING !== "1";
64
+ const warnACPolyfill = () => {
65
+ if (!printACPolyfillWarning)
66
+ return;
67
+ printACPolyfillWarning = false;
68
+ emitWarning("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.", "NO_ABORT_CONTROLLER", "ENOTSUP", warnACPolyfill);
69
+ };
70
+ }
71
+ var TYPE = Symbol("type");
72
+
73
+ // node_modules/@netlify/functions/dist/internal.js
74
+ var import_process = require("process");
75
+ var systemLogTag = "__nfSystemLog";
76
+ var serializeError = (error) => {
77
+ const cause = error?.cause instanceof Error ? serializeError(error.cause) : error.cause;
78
+ return {
79
+ error: error.message,
80
+ error_cause: cause,
81
+ error_stack: error.stack
82
+ };
83
+ };
84
+ var SystemLogger = class _SystemLogger {
85
+ fields;
86
+ logLevel;
87
+ constructor(fields = {}, logLevel = 2) {
88
+ this.fields = fields;
89
+ this.logLevel = logLevel;
90
+ }
91
+ doLog(logger, message) {
92
+ if (import_process.env.NETLIFY_DEV && !import_process.env.NETLIFY_ENABLE_SYSTEM_LOGGING) {
93
+ return;
94
+ }
95
+ logger(systemLogTag, JSON.stringify({ msg: message, fields: this.fields }));
96
+ }
97
+ log(message) {
98
+ if (this.logLevel > 2) {
99
+ return;
100
+ }
101
+ this.doLog(console.log, message);
102
+ }
103
+ debug(message) {
104
+ if (this.logLevel > 1) {
105
+ return;
106
+ }
107
+ this.doLog(console.debug, message);
108
+ }
109
+ error(message) {
110
+ if (this.logLevel > 3) {
111
+ return;
112
+ }
113
+ this.doLog(console.error, message);
114
+ }
115
+ withLogLevel(level) {
116
+ return new _SystemLogger(this.fields, level);
117
+ }
118
+ withFields(fields) {
119
+ return new _SystemLogger(
120
+ {
121
+ ...this.fields,
122
+ ...fields
123
+ },
124
+ this.logLevel
125
+ );
126
+ }
127
+ withError(error) {
128
+ const fields = error instanceof Error ? serializeError(error) : { error };
129
+ return this.withFields(fields);
130
+ }
131
+ };
132
+ var systemLogger = new SystemLogger();
133
+
134
+ // src/run/handlers/request-context.cts
135
+ var REQUEST_CONTEXT_GLOBAL_KEY = Symbol.for("nf-request-context-async-local-storage");
136
+ var REQUEST_COUNTER_KEY = Symbol.for("nf-request-counter");
137
+
138
+ // src/run/storage/request-scoped-in-memory-cache.cts
139
+ var NullValue = Symbol.for("null-value");
140
+ var IN_MEMORY_CACHE_MAX_SIZE = Symbol.for("nf-in-memory-cache-max-size");
141
+ var IN_MEMORY_LRU_CACHE = Symbol.for("nf-in-memory-lru-cache");
142
+ var extendedGlobalThis = globalThis;
143
+ var DEFAULT_FALLBACK_MAX_SIZE = 50 * 1024 * 1024;
144
+ function setInMemoryCacheMaxSizeFromNuxtConfig(size) {
145
+ if (typeof size === "number") {
146
+ extendedGlobalThis[IN_MEMORY_CACHE_MAX_SIZE] = size;
147
+ }
148
+ }
149
+
150
+ // src/run/storage/regional-blob-store.cts
151
+ var FETCH_BEFORE_NUXT_PATCHED_IT = Symbol.for("nf-not-patched-fetch");
152
+ var extendedGlobalThis2 = globalThis;
153
+ function attemptToGetOriginalFetch(fetch) {
154
+ return fetch._nuxtOriginalFetch ?? fetch;
155
+ }
156
+ function forceOptOutOfUsingDataCache(fetch) {
157
+ return (input, init) => {
158
+ return fetch(input, {
159
+ ...init,
160
+ next: {
161
+ ...init?.next,
162
+ // setting next.internal = true should prevent from trying to use data cache
163
+ // https://github.com/vercel/next.js/blob/fa214c74c1d8023098c0e94e57f917ef9f1afd1a/packages/next/src/server/lib/patch-fetch.ts#L174
164
+ // https://github.com/vercel/next.js/blob/fa214c74c1d8023098c0e94e57f917ef9f1afd1a/packages/next/src/server/lib/patch-fetch.ts#L210-L213
165
+ // this is last line of defense in case we didn't manage to get unpatched fetch that will not affect
166
+ // fetch if it's unpatched so it should be safe to apply always if we aren't sure if we use patched fetch
167
+ // @ts-expect-error - this is an internal field that Next.js doesn't add to its global
168
+ // type overrides for RequestInit type (like `next.revalidate` or `next.tags`)
169
+ internal: true
170
+ }
171
+ });
172
+ };
173
+ }
174
+ var setFetchBeforeNuxtPatchedIt = (fetch) => {
175
+ extendedGlobalThis2[FETCH_BEFORE_NUXT_PATCHED_IT] = forceOptOutOfUsingDataCache(
176
+ attemptToGetOriginalFetch(fetch)
177
+ );
178
+ };
179
+ var fetchBeforeNuxtPatchedItFallback = forceOptOutOfUsingDataCache(
180
+ attemptToGetOriginalFetch(globalThis.fetch)
181
+ );
182
+
183
+ // src/run/storage/storage.cts
184
+ var getMemoizedKeyValueStoreBackedByRegionalBlobStore = (...args) => {
185
+ };
186
+ // Annotate the CommonJS export names for ESM import in node:
187
+ 0 && (module.exports = {
188
+ getMemoizedKeyValueStoreBackedByRegionalBlobStore,
189
+ setFetchBeforeNuxtPatchedIt,
190
+ setInMemoryCacheMaxSizeFromNuxtConfig
191
+ });
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/shared/blob-types.cts
21
+ var blob_types_exports = {};
22
+ __export(blob_types_exports, {
23
+ isHtmlBlob: () => isHtmlBlob,
24
+ isTagManifest: () => isTagManifest
25
+ });
26
+ module.exports = __toCommonJS(blob_types_exports);
27
+ var isTagManifest = (value) => {
28
+ return typeof value === "object" && value !== null && "revalidatedAt" in value && typeof value.revalidatedAt === "number" && Object.keys(value).length === 1;
29
+ };
30
+ var isHtmlBlob = (value) => {
31
+ return typeof value === "object" && value !== null && "html" in value && "isFullyStaticPage" in value && typeof value.html === "string" && typeof value.isFullyStaticPage === "boolean" && Object.keys(value).length === 2;
32
+ };
33
+ // Annotate the CommonJS export names for ESM import in node:
34
+ 0 && (module.exports = {
35
+ isHtmlBlob,
36
+ isTagManifest
37
+ });
@@ -0,0 +1,25 @@
1
+
2
+ var require = await (async () => {
3
+ var { createRequire } = await import("node:module");
4
+ return createRequire(import.meta.url);
5
+ })();
6
+
7
+ import "../esm-chunks/chunk-6BT4RYQJ.js";
8
+
9
+ // src/shared/blobkey.ts
10
+ import { Buffer } from "node:buffer";
11
+ import { webcrypto as crypto } from "node:crypto";
12
+ var maxLength = 180;
13
+ async function encodeBlobKey(key) {
14
+ const buffer = Buffer.from(key);
15
+ const base64 = buffer.toString("base64url");
16
+ if (base64.length <= maxLength) {
17
+ return base64;
18
+ }
19
+ const digest = await crypto.subtle.digest("SHA-256", buffer);
20
+ const hash = Buffer.from(digest).toString("base64url");
21
+ return `${base64.slice(0, maxLength - hash.length - 1)}-${hash}`;
22
+ }
23
+ export {
24
+ encodeBlobKey
25
+ };
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/shared/cache-types.cts
21
+ var cache_types_exports = {};
22
+ __export(cache_types_exports, {
23
+ isCachedPageValue: () => isCachedPageValue,
24
+ isCachedRouteValue: () => isCachedRouteValue
25
+ });
26
+ module.exports = __toCommonJS(cache_types_exports);
27
+ var isCachedPageValue = (value) => value.kind === "PAGE" || value.kind === "PAGES";
28
+ var isCachedRouteValue = (value) => value.kind === "ROUTE" || value.kind === "APP_ROUTE";
29
+ // Annotate the CommonJS export names for ESM import in node:
30
+ 0 && (module.exports = {
31
+ isCachedPageValue,
32
+ isCachedRouteValue
33
+ });
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+
16
+ // src/shared/nuxt-cache-types.cts
17
+ var nuxt_cache_types_exports = {};
18
+ module.exports = __toCommonJS(nuxt_cache_types_exports);
@@ -0,0 +1,6 @@
1
+
2
+ var require = await (async () => {
3
+ var { createRequire } = await import("node:module");
4
+ return createRequire(import.meta.url);
5
+ })();
6
+
package/dist/utils.js ADDED
@@ -0,0 +1,25 @@
1
+
2
+ var require = await (async () => {
3
+ var { createRequire } = await import("node:module");
4
+ return createRequire(import.meta.url);
5
+ })();
6
+
7
+ import {
8
+ addCodeToGenerateEdgeoneWithAST,
9
+ getHandlersArrayWithAST,
10
+ getModulesWithAST,
11
+ getPrerenderRoutesWithAST,
12
+ getRouteRulesWithAST,
13
+ getRoutesArrayWithAST,
14
+ resetNitroConfigWithAST
15
+ } from "./esm-chunks/chunk-GX4Z7KQX.js";
16
+ import "./esm-chunks/chunk-6BT4RYQJ.js";
17
+ export {
18
+ addCodeToGenerateEdgeoneWithAST,
19
+ getHandlersArrayWithAST,
20
+ getModulesWithAST,
21
+ getPrerenderRoutesWithAST,
22
+ getRouteRulesWithAST,
23
+ getRoutesArrayWithAST,
24
+ resetNitroConfigWithAST
25
+ };
package/package.json ADDED
@@ -0,0 +1,58 @@
1
+ {
2
+ "name": "@edgeone/nuxt-pages",
3
+ "version": "1.0.0",
4
+ "main": "./dist/index.js",
5
+ "scripts": {
6
+ "test": "ts-node src/test.ts",
7
+ "build": "node ./tools/build.js",
8
+ "build:watch": "node ./tools/build.js --watch",
9
+ "start": "node dist/index.js",
10
+ "audit": "npm audit",
11
+ "audit:fix": "npm audit fix",
12
+ "security": "npm audit && npm outdated"
13
+ },
14
+ "type": "module",
15
+ "publishConfig": {
16
+ "access": "public",
17
+ "registry": "https://registry.npmjs.org/"
18
+ },
19
+ "files": [
20
+ "dist"
21
+ ],
22
+ "keywords": [
23
+ "nuxt",
24
+ "deploy",
25
+ "edgeone"
26
+ ],
27
+ "author": "Venzil",
28
+ "repository": {
29
+ "type": "git",
30
+ "url": "https://github.com/q153877011/edgeone-nuxt-deploy.git"
31
+ },
32
+ "bugs": {
33
+ "url": "https://github.com/q153877011/edgeone-nuxt-deploy/issues"
34
+ },
35
+ "homepage": "https://github.com/q153877011/edgeone-nuxt-deploy#readme",
36
+ "license": "ISC",
37
+ "description": "",
38
+ "dependencies": {
39
+ "@babel/parser": "^7.28.4",
40
+ "@babel/traverse": "^7.28.4",
41
+ "@babel/types": "^7.28.4",
42
+ "@netlify/functions": "^3.1.10",
43
+ "@nuxt/kit": "^3.14.0",
44
+ "@opentelemetry/api": "^1.9.0",
45
+ "fast-glob": "^3.3.3",
46
+ "lru-cache": "^10.4.3",
47
+ "vitest": "^3.2.4"
48
+ },
49
+ "devDependencies": {
50
+ "@types/node": "^20.19.23",
51
+ "@types/picomatch": "^3.0.2",
52
+ "@types/uuid": "^10.0.0",
53
+ "esbuild": "^0.25.11",
54
+ "execa": "^8.0.1",
55
+ "ts-node": "^10.9.2",
56
+ "typescript": "^5.9.3"
57
+ }
58
+ }