@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,19 @@
1
+
2
+ var require = await (async () => {
3
+ var { createRequire } = await import("node:module");
4
+ return createRequire(import.meta.url);
5
+ })();
6
+
7
+
8
+ // src/run/constants.ts
9
+ import { resolve } from "node:path";
10
+ import { fileURLToPath } from "node:url";
11
+ var MODULE_DIR = fileURLToPath(new URL(".", import.meta.url));
12
+ var PLUGIN_DIR = resolve(`${MODULE_DIR}../../..`);
13
+ var RUN_CONFIG_FILE = "run-config.json";
14
+
15
+ export {
16
+ MODULE_DIR,
17
+ PLUGIN_DIR,
18
+ RUN_CONFIG_FILE
19
+ };
@@ -0,0 +1,87 @@
1
+
2
+ var require = await (async () => {
3
+ var { createRequire } = await import("node:module");
4
+ return createRequire(import.meta.url);
5
+ })();
6
+
7
+ import {
8
+ PLUGIN_DIR,
9
+ RUN_CONFIG_FILE
10
+ } from "./chunk-HBXUWFGE.js";
11
+
12
+ // src/run/config.ts
13
+ import { existsSync } from "node:fs";
14
+ import { readFile } from "node:fs/promises";
15
+ import { join, resolve } from "node:path";
16
+
17
+ // src/run/storage/request-scoped-in-memory-cache.cts
18
+ var NullValue = Symbol.for("null-value");
19
+ var IN_MEMORY_CACHE_MAX_SIZE = Symbol.for("nf-in-memory-cache-max-size");
20
+ var IN_MEMORY_LRU_CACHE = Symbol.for("nf-in-memory-lru-cache");
21
+ var extendedGlobalThis = globalThis;
22
+ var DEFAULT_FALLBACK_MAX_SIZE = 50 * 1024 * 1024;
23
+ function setInMemoryCacheMaxSizeFromNuxtConfig(size) {
24
+ if (typeof size === "number") {
25
+ extendedGlobalThis[IN_MEMORY_CACHE_MAX_SIZE] = size;
26
+ }
27
+ }
28
+
29
+ // src/run/storage/regional-blob-store.cts
30
+ var FETCH_BEFORE_NUXT_PATCHED_IT = Symbol.for("nf-not-patched-fetch");
31
+ var extendedGlobalThis2 = globalThis;
32
+ function attemptToGetOriginalFetch(fetch) {
33
+ return fetch._nuxtOriginalFetch ?? fetch;
34
+ }
35
+ function forceOptOutOfUsingDataCache(fetch) {
36
+ return (input, init) => {
37
+ return fetch(input, {
38
+ ...init,
39
+ next: {
40
+ ...init?.next,
41
+ // setting next.internal = true should prevent from trying to use data cache
42
+ // https://github.com/vercel/next.js/blob/fa214c74c1d8023098c0e94e57f917ef9f1afd1a/packages/next/src/server/lib/patch-fetch.ts#L174
43
+ // https://github.com/vercel/next.js/blob/fa214c74c1d8023098c0e94e57f917ef9f1afd1a/packages/next/src/server/lib/patch-fetch.ts#L210-L213
44
+ // this is last line of defense in case we didn't manage to get unpatched fetch that will not affect
45
+ // fetch if it's unpatched so it should be safe to apply always if we aren't sure if we use patched fetch
46
+ // @ts-expect-error - this is an internal field that Next.js doesn't add to its global
47
+ // type overrides for RequestInit type (like `next.revalidate` or `next.tags`)
48
+ internal: true
49
+ }
50
+ });
51
+ };
52
+ }
53
+ var setFetchBeforeNuxtPatchedIt = (fetch) => {
54
+ extendedGlobalThis2[FETCH_BEFORE_NUXT_PATCHED_IT] = forceOptOutOfUsingDataCache(
55
+ attemptToGetOriginalFetch(fetch)
56
+ );
57
+ };
58
+ var fetchBeforeNuxtPatchedItFallback = forceOptOutOfUsingDataCache(
59
+ attemptToGetOriginalFetch(globalThis.fetch)
60
+ );
61
+
62
+ // src/run/config.ts
63
+ var getRunConfig = async () => {
64
+ return JSON.parse(await readFile(resolve(PLUGIN_DIR, RUN_CONFIG_FILE), "utf-8"));
65
+ };
66
+ var setRunConfig = (config) => {
67
+ const cacheHandler = join(PLUGIN_DIR, ".edgeone/dist/run/handlers/cache.cjs");
68
+ if (!existsSync(cacheHandler)) {
69
+ throw new Error(`Cache handler not found at ${cacheHandler}`);
70
+ }
71
+ config.experimental = {
72
+ ...config.experimental,
73
+ // Before Next.js 14.1.0 path to the cache handler was in experimental section, see NextConfigForMultipleVersions type
74
+ incrementalCacheHandlerPath: cacheHandler
75
+ };
76
+ config.cacheHandler = cacheHandler;
77
+ setInMemoryCacheMaxSizeFromNuxtConfig(
78
+ config.cacheMaxMemorySize ?? config.experimental?.isrMemoryCacheSize
79
+ );
80
+ process.env.__NEXT_PRIVATE_STANDALONE_CONFIG = JSON.stringify(config);
81
+ };
82
+
83
+ export {
84
+ setFetchBeforeNuxtPatchedIt,
85
+ getRunConfig,
86
+ setRunConfig
87
+ };