@wular/pnext 0.1.7 → 0.1.9

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 (172) hide show
  1. package/dist/server/_chunks/{aliases-j47a10ce.js → aliases-fhv4dt06.js} +7 -5
  2. package/dist/server/_chunks/{analyze-arswqe6s.js → analyze-09kx9q6r.js} +17 -13
  3. package/dist/server/_chunks/{boot-af0mv3dy.js → boot-8aj7efqk.js} +13 -11
  4. package/dist/server/_chunks/{build-spy3dxp4.js → build-jda155c9.js} +7 -5
  5. package/dist/server/_chunks/{build-tier-m7yvqz61.js → build-tier-qrkpfsk1.js} +59 -75
  6. package/dist/server/_chunks/{build-t9h0hec3.js → build-wspv5h60.js} +1004 -1191
  7. package/dist/server/_chunks/{compile-53j02j27.js → compile-040r79gj.js} +2 -2
  8. package/dist/server/_chunks/{config-n2z7yxps.js → config-7h84p6q8.js} +6 -4
  9. package/dist/server/_chunks/{config-1yzwexq6.js → config-d4hqyygy.js} +12 -3
  10. package/dist/server/_chunks/{create-meec9hs6.js → create-skj8wzt5.js} +4 -3
  11. package/dist/server/_chunks/{dev-fjmqg6en.js → dev-pennd36n.js} +2 -2
  12. package/dist/server/_chunks/{generate-n9sh6hzt.js → generate-d8vb1d21.js} +5 -4
  13. package/dist/server/_chunks/{index-eeaanp2e.js → index-0qt2vapb.js} +3 -3
  14. package/dist/server/_chunks/{index-91x12ykq.js → index-0r5eqfc7.js} +6 -1
  15. package/dist/server/_chunks/{index-9ych9ma8.js → index-0wm2p3ks.js} +2 -2
  16. package/dist/server/_chunks/{index-357na4a8.js → index-141vcwk6.js} +1 -1
  17. package/dist/server/_chunks/{index-2dv4y4wd.js → index-1y0cesgn.js} +16 -10
  18. package/dist/server/_chunks/{index-ytjvpbm2.js → index-26gwrm07.js} +3 -3
  19. package/dist/server/_chunks/{index-8k7pfejn.js → index-3r6qpe8a.js} +7 -7
  20. package/dist/server/_chunks/{index-rn8dyr1f.js → index-42fef2rv.js} +8 -48
  21. package/dist/server/_chunks/{index-ncnes8c6.js → index-47gx7trn.js} +2 -2
  22. package/dist/server/_chunks/{index-20ppawv7.js → index-4qsce64w.js} +3 -3
  23. package/dist/server/_chunks/{index-1011cscr.js → index-4vf121ws.js} +61 -29
  24. package/dist/server/_chunks/{index-cf4rvxv6.js → index-52k54ykj.js} +1 -1
  25. package/dist/server/_chunks/{index-nyrba2kr.js → index-53fnn598.js} +11 -11
  26. package/dist/server/_chunks/{index-4hgjrqh7.js → index-6tb725m8.js} +2 -2
  27. package/dist/server/_chunks/{index-3xbr4eyv.js → index-912z4mfx.js} +3 -3
  28. package/dist/server/_chunks/{index-sjpckxqn.js → index-9f49w76j.js} +1 -1
  29. package/dist/server/_chunks/{index-jepjvcrf.js → index-aarf1brn.js} +1 -1
  30. package/dist/server/_chunks/{index-9n2914ww.js → index-akkrvjn6.js} +1 -1
  31. package/dist/server/_chunks/index-bzd2ef7t.js +10 -0
  32. package/dist/server/_chunks/{index-sv8m6789.js → index-cqcwwxfp.js} +5 -5
  33. package/dist/server/_chunks/{index-yz54pxrh.js → index-d1jsmhhk.js} +4 -9
  34. package/dist/server/_chunks/{index-vvmmknm1.js → index-da0fphj0.js} +19 -15
  35. package/dist/server/_chunks/{index-sctcgyvv.js → index-drwv61cc.js} +2 -2
  36. package/dist/server/_chunks/{index-z84ab1w0.js → index-e176wk6x.js} +3 -3
  37. package/dist/server/_chunks/{index-9hx2641q.js → index-entm8bmz.js} +1 -1
  38. package/dist/server/_chunks/index-fpghsgb4.js +352 -0
  39. package/dist/server/_chunks/{index-jx7bqvw1.js → index-hr63fvzn.js} +1 -1
  40. package/dist/server/_chunks/{index-eajaspjk.js → index-j0m1jxqa.js} +1 -1
  41. package/dist/server/_chunks/index-jbj7ehef.js +50 -0
  42. package/dist/server/_chunks/{index-egykcqg3.js → index-jexsy9a8.js} +1 -1
  43. package/dist/server/_chunks/{index-fkp000p1.js → index-jjppzw0s.js} +2 -2
  44. package/dist/server/_chunks/index-jt8e1pje.js +12 -0
  45. package/dist/server/_chunks/{index-ggk2j965.js → index-kpdph69z.js} +56 -50
  46. package/dist/server/_chunks/{index-6e4fqv30.js → index-m63czgq5.js} +2 -0
  47. package/dist/server/_chunks/{index-c0g2wf3z.js → index-md5jchzy.js} +1 -1
  48. package/dist/server/_chunks/{index-tvqkq6e6.js → index-n814hcky.js} +1 -1
  49. package/dist/server/_chunks/{index-06nyqntx.js → index-q3r9z8mq.js} +1 -1
  50. package/dist/server/_chunks/{index-4q2gbfwk.js → index-qjrh7w2g.js} +2 -2
  51. package/dist/server/_chunks/{index-3b3at80h.js → index-s61bx2aj.js} +6 -3
  52. package/dist/server/_chunks/{index-ym67zqxp.js → index-tf4j19ge.js} +1 -1
  53. package/dist/server/_chunks/{index-qn4z5s3c.js → index-typcbcsv.js} +3 -3
  54. package/dist/server/_chunks/{index-p77b4kcx.js → index-veycp46e.js} +1 -1
  55. package/dist/server/_chunks/{index-11sfk4hb.js → index-vmr35jjw.js} +1 -1
  56. package/dist/server/_chunks/{index-kq8kpzye.js → index-vqs3rebe.js} +3 -3
  57. package/dist/server/_chunks/{index-danncfhy.js → index-wm36rj4v.js} +1 -1
  58. package/dist/server/_chunks/{index-z4z9zv3b.js → index-x9c55pzy.js} +141 -3
  59. package/dist/server/_chunks/{index-y2jr2n72.js → index-xrsg0041.js} +4 -4
  60. package/dist/server/_chunks/{index-k1g3epw0.js → index-xs3411qh.js} +10 -10
  61. package/dist/server/_chunks/{index-0374j2b9.js → index-y4d02znn.js} +1 -1
  62. package/dist/server/_chunks/{index-wpfhfbs4.js → index-y71a76dn.js} +4 -4
  63. package/dist/server/_chunks/{index-qm6kmhqs.js → index-y7mzvq2q.js} +1 -1
  64. package/dist/server/_chunks/{index-hkdfj58q.js → index-y9bygr95.js} +1 -1
  65. package/dist/server/_chunks/{index-3tf1xjsp.js → index-yghskk8w.js} +11 -11
  66. package/dist/server/_chunks/{index-5gyr4emz.js → index-yzcpr3yw.js} +4 -4
  67. package/dist/server/_chunks/{index-x93hv0sc.js → index-zedjt25v.js} +23 -10
  68. package/dist/server/_chunks/{index-tq0pc7eg.js → index-zfrwq472.js} +3 -3
  69. package/dist/server/_chunks/{loader-7yw0j98z.js → loader-w1e0n5sm.js} +12 -10
  70. package/dist/server/_chunks/{modules-jn8bmbn8.js → modules-730j14cm.js} +14 -12
  71. package/dist/server/_chunks/{pipeline-yy9jhydf.js → pipeline-yjdnwbhm.js} +25 -21
  72. package/dist/server/_chunks/{production-jar9ztm3.js → production-1xe9b7wd.js} +14 -3
  73. package/dist/server/_chunks/{proxy-config-j84dgksn.js → proxy-config-9r9e0jvn.js} +7 -5
  74. package/dist/server/_chunks/{proxy-w1d0wmsn.js → proxy-pnevsbfd.js} +12 -10
  75. package/dist/server/_chunks/{router-k1reahfn.js → router-rzge0vz8.js} +10 -7
  76. package/dist/server/_chunks/{routes-2s277fc6.js → routes-0x8wjvcj.js} +12 -10
  77. package/dist/server/_chunks/{run-pvd8bs1t.js → run-tk90r3ac.js} +5 -4
  78. package/dist/server/_chunks/{server-mt4a994c.js → server-gev78ejc.js} +38 -34
  79. package/dist/server/_chunks/{tsconfig-defaults-1nb3308g.js → tsconfig-defaults-qe9wd6ne.js} +5 -4
  80. package/dist/server/_chunks/{typegen-0qr0459b.js → typegen-0yw8sry8.js} +15 -13
  81. package/dist/server/cli/index.js +12 -15
  82. package/dist/server/cli/start.js +35 -14
  83. package/dist/server/compat/next/cache.js +5 -5
  84. package/dist/server/compat/next/config-headers.js +8 -6
  85. package/dist/server/compat/next/config-loader.js +1 -1
  86. package/dist/server/compat/next/dist/server/web/spec-extension/revalidate.js +5 -5
  87. package/dist/server/compat/next/dist/server/web/spec-extension/unstable-cache.js +5 -5
  88. package/dist/server/compat/next/dist/server/web/spec-extension/unstable-no-store.js +5 -5
  89. package/dist/server/compat/next/dynamic.js +3 -14
  90. package/dist/server/compat/next/font/cache.js +6 -4
  91. package/dist/server/compat/next/font/local.js +7 -5
  92. package/dist/server/compat/next/font/runtime.js +7 -5
  93. package/dist/server/compat/next/headers.js +4 -4
  94. package/dist/server/compat/next/image/config.js +2 -2
  95. package/dist/server/compat/next/image/optimizer.js +3 -3
  96. package/dist/server/compat/next/image/static-metadata.js +4 -4
  97. package/dist/server/compat/next/legacy-request-apis.js +3 -3
  98. package/dist/server/compat/next/link-transform.js +4 -3
  99. package/dist/server/compat/next/navigation.js +5 -4
  100. package/dist/server/compat/next/redirects.js +8 -6
  101. package/dist/server/compat/next/resource-hints.js +2 -2
  102. package/dist/server/compat/next/rewrites.js +7 -5
  103. package/dist/server/compat/next/root-params.js +3 -3
  104. package/dist/server/compat/next/route-state.js +2 -2
  105. package/dist/server/compat/next/script.js +2 -2
  106. package/dist/server/compat/next/server.js +5 -5
  107. package/dist/server/generation.json +1 -1
  108. package/package.json +1 -1
  109. package/reference/compat.md +1 -1
  110. package/reference/config.md +2 -2
  111. package/reference/dev.md +1 -1
  112. package/reference/getting-started.md +1 -1
  113. package/reference/rendering.md +4 -4
  114. package/src/api/dynamic.tsx +84 -4
  115. package/src/cli/adapters/vercel-warm.ts +40 -29
  116. package/src/cli/adapters/vercel.ts +101 -1265
  117. package/src/cli/analyze.ts +3 -2
  118. package/src/cli/build/cache.ts +6 -6
  119. package/src/cli/build.ts +33 -33
  120. package/src/cli/index.ts +4 -6
  121. package/src/cli/serve/pipeline.ts +16 -10
  122. package/src/cli/serve/standalone-worker.ts +8 -0
  123. package/src/cli/serve/standalone.ts +727 -0
  124. package/src/cli/start.ts +29 -8
  125. package/src/client/build.ts +1 -1
  126. package/src/client/reference-stub.ts +2 -34
  127. package/src/compat/actions/extensions.ts +3 -2
  128. package/src/compat/bundler/require-context.ts +2 -1
  129. package/src/compat/bundler/webpack-loaders.ts +3 -2
  130. package/src/compat/bundler/worker.ts +2 -2
  131. package/src/compat/css/inline-css.ts +1 -1
  132. package/src/compat/export/build-complete.ts +1 -1
  133. package/src/compat/export/emit.ts +4 -4
  134. package/src/compat/export/standalone.ts +30 -65
  135. package/src/compat/image-optimizer/optimize.ts +1 -1
  136. package/src/compat/lifecycle/instrumentation-client.ts +4 -3
  137. package/src/compat/metadata-artifacts.ts +1 -1
  138. package/src/compat/next/config-loader.ts +3 -0
  139. package/src/compat/next/dynamic.tsx +10 -23
  140. package/src/compat/next/font/cache.ts +2 -1
  141. package/src/compat/next/font/runtime.ts +1 -1
  142. package/src/compat/register/image.ts +1 -1
  143. package/src/compat/typecheck/check.ts +6 -4
  144. package/src/config.ts +28 -5
  145. package/src/css/assets.ts +1 -1
  146. package/src/css/build.ts +16 -9
  147. package/src/dev/client-chunk-store.ts +2 -1
  148. package/src/dev/restart/client-key.ts +2 -1
  149. package/src/dev/restart/global-css.ts +2 -1
  150. package/src/dev/restart/route-bundle-key.ts +2 -1
  151. package/src/dev/restart/route-facts.ts +2 -1
  152. package/src/dev/server.ts +8 -7
  153. package/src/out-paths.ts +10 -0
  154. package/src/render/renderer.ts +1 -1
  155. package/src/resolve/dynamic.ts +4 -0
  156. package/src/resolve/engine.ts +2 -12
  157. package/src/resolve/scan-facts.ts +185 -1
  158. package/src/routing/metadata-files.ts +1 -1
  159. package/src/runtime/loader.ts +5 -3
  160. package/src/runtime/module-cache.ts +2 -1
  161. package/src/runtime/modules.ts +50 -16
  162. package/src/runtime/prebundle.ts +23 -3
  163. package/src/runtime/production.ts +105 -40
  164. package/src/runtime/release-graph.ts +21 -13
  165. package/src/runtime/vendor-build.ts +45 -23
  166. package/src/types.ts +2 -3
  167. package/src/utils/directive.ts +40 -0
  168. package/src/utils/fs.ts +7 -2
  169. package/src/utils/resource-query.ts +12 -0
  170. package/dist/server/_chunks/index-tqn2qnnn.js +0 -241
  171. package/dist/server/_chunks/index-y36a0ybw.js +0 -57
  172. package/src/cli/serve/entry.ts +0 -52
@@ -0,0 +1,352 @@
1
+ // @bun
2
+ import { join as __pnextJoin } from "node:path";
3
+ const __PNEXT_PACKAGE_ROOT__ = __pnextJoin(import.meta.dirname, "../../..");
4
+ import {
5
+ splitResourceQuery
6
+ } from "./index-jt8e1pje.js";
7
+
8
+ // src/runtime/production.ts
9
+ import { existsSync, readFileSync as readFileSync2, readdirSync, realpathSync } from "fs";
10
+ import { rename, writeFile } from "fs/promises";
11
+ import path2 from "path";
12
+ import { pathToFileURL } from "url";
13
+
14
+ // src/runtime/prebundle.ts
15
+ import { readFileSync } from "fs";
16
+ import path from "path";
17
+ import { fileURLToPath } from "url";
18
+ var PREBUNDLE_STAMP = path.join("dist", "server", "generation.json");
19
+ var prebundle = typeof { version: "0.1.9", fingerprint: "5c05030a635e53e4", entries: ["cli/index", "cli/start", "client/reference", "api/client-cache", "compat/next/canonical-url", "compat/next/link-transform", "compat/next/client-navigation", "compat/next/og", "compat/next/link", "compat/next/usage", "compat/next/client-script", "compat/next/headers", "compat/next/custom-server", "compat/next/legacy-image", "compat/next/router", "compat/next/navigation", "compat/next/dist/server/web/spec-extension/unstable-no-store", "compat/next/dist/server/web/spec-extension/unstable-cache", "compat/next/dist/server/web/spec-extension/revalidate", "compat/next/dist/client/components/app-router-headers", "compat/next/web-vitals", "compat/next/root-params", "compat/next/route-state", "compat/next/server-only", "compat/next/client-server", "compat/next/legacy-request-apis", "compat/next/redirects", "compat/next/resource-hints", "compat/next/svgr", "compat/next/client-only", "compat/next/image/props", "compat/next/image/optimizer", "compat/next/image/validate", "compat/next/image/shared", "compat/next/image/patterns", "compat/next/image/config", "compat/next/image/client", "compat/next/image/static-metadata", "compat/next/user-agent", "compat/next/client-cache", "compat/next/head", "compat/next/dynamic", "compat/next/telemetry", "compat/next/offline", "compat/next/cache", "compat/next/constants", "compat/next/error", "compat/next/script", "compat/next/index", "compat/next/font/shared", "compat/next/font/runtime", "compat/next/font/google", "compat/next/font/cache", "compat/next/font/runtime-client", "compat/next/font/local", "compat/next/font/index", "compat/next/config-loader", "compat/next/config", "compat/next/image", "compat/next/server", "compat/next/rewrites", "compat/next/preferred-region", "compat/next/config-headers", "compat/next/form", "compat/react/dom", "compat/react/hooks-extra", "compat/react/react-server", "compat/react/dom-client", "compat/react/style-values", "compat/react/compiler-runtime", "compat/react/router-shim", "compat/react/dom-server", "compat/react/dom-react-server", "compat/react/server-component-use", "compat/react/action-state", "compat/react/client", "compat/react/client-lite", "compat/react/server-inserted-html", "compat/react/parity", "compat/react/preact", "compat/react/use", "compat/react/view-transition", "compat/react/internals", "compat/react/server"] } === "object" ? { version: "0.1.9", fingerprint: "5c05030a635e53e4", entries: ["cli/index", "cli/start", "client/reference", "api/client-cache", "compat/next/canonical-url", "compat/next/link-transform", "compat/next/client-navigation", "compat/next/og", "compat/next/link", "compat/next/usage", "compat/next/client-script", "compat/next/headers", "compat/next/custom-server", "compat/next/legacy-image", "compat/next/router", "compat/next/navigation", "compat/next/dist/server/web/spec-extension/unstable-no-store", "compat/next/dist/server/web/spec-extension/unstable-cache", "compat/next/dist/server/web/spec-extension/revalidate", "compat/next/dist/client/components/app-router-headers", "compat/next/web-vitals", "compat/next/root-params", "compat/next/route-state", "compat/next/server-only", "compat/next/client-server", "compat/next/legacy-request-apis", "compat/next/redirects", "compat/next/resource-hints", "compat/next/svgr", "compat/next/client-only", "compat/next/image/props", "compat/next/image/optimizer", "compat/next/image/validate", "compat/next/image/shared", "compat/next/image/patterns", "compat/next/image/config", "compat/next/image/client", "compat/next/image/static-metadata", "compat/next/user-agent", "compat/next/client-cache", "compat/next/head", "compat/next/dynamic", "compat/next/telemetry", "compat/next/offline", "compat/next/cache", "compat/next/constants", "compat/next/error", "compat/next/script", "compat/next/index", "compat/next/font/shared", "compat/next/font/runtime", "compat/next/font/google", "compat/next/font/cache", "compat/next/font/runtime-client", "compat/next/font/local", "compat/next/font/index", "compat/next/config-loader", "compat/next/config", "compat/next/image", "compat/next/server", "compat/next/rewrites", "compat/next/preferred-region", "compat/next/config-headers", "compat/next/form", "compat/react/dom", "compat/react/hooks-extra", "compat/react/react-server", "compat/react/dom-client", "compat/react/style-values", "compat/react/compiler-runtime", "compat/react/router-shim", "compat/react/dom-server", "compat/react/dom-react-server", "compat/react/server-component-use", "compat/react/action-state", "compat/react/client", "compat/react/client-lite", "compat/react/server-inserted-html", "compat/react/parity", "compat/react/preact", "compat/react/use", "compat/react/view-transition", "compat/react/internals", "compat/react/server"] } : undefined;
20
+ var packageRoot = path.resolve(__PNEXT_PACKAGE_ROOT__ + "/src/runtime", "..", "..");
21
+ var srcRoot = path.join(packageRoot, "src") + path.sep;
22
+ var distRoot = path.join(packageRoot, "dist", "server");
23
+ var entries = new Set(prebundle?.entries);
24
+ function packageVersion(root) {
25
+ return JSON.parse(readFileSync(path.join(root, "package.json"), "utf8")).version;
26
+ }
27
+ function readPrebundleStamp(frameworkRoot, fingerprint) {
28
+ let stamp;
29
+ try {
30
+ stamp = JSON.parse(readFileSync(path.join(frameworkRoot, PREBUNDLE_STAMP), "utf8"));
31
+ } catch {
32
+ return;
33
+ }
34
+ return stamp.fingerprint === fingerprint && stamp.version === packageVersion(frameworkRoot) ? stamp : undefined;
35
+ }
36
+ function prebundledFile(file) {
37
+ if (!prebundle || !file.startsWith(srcRoot))
38
+ return file;
39
+ const entry = file.slice(srcRoot.length).replace(/\.tsx?$/, "");
40
+ return entries.has(entry) ? path.join(distRoot, `${entry}.js`) : file;
41
+ }
42
+ function registerResolvePlugin(plugin) {
43
+ globalThis.Bun.plugin(plugin);
44
+ }
45
+ var registered = false;
46
+ function registerPrebundleResolve() {
47
+ if (!prebundle || registered)
48
+ return;
49
+ registered = true;
50
+ const escaped = srcRoot.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
51
+ registerResolvePlugin({
52
+ name: "pnext-prebundle",
53
+ setup(build) {
54
+ build.onResolve({ filter: new RegExp(`^${escaped}.*\\.tsx?$`) }, (args) => {
55
+ const target = prebundledFile(args.path);
56
+ return target === args.path ? undefined : { path: target };
57
+ });
58
+ build.onResolve({ filter: /^file:.*\.tsx?$/ }, (args) => {
59
+ const file = fileURLToPath(args.path);
60
+ const target = prebundledFile(file);
61
+ return target === file ? undefined : { path: target };
62
+ });
63
+ build.onResolve({ filter: /^\.\.?\/.*\/src\/.*\.tsx?$/ }, (args) => {
64
+ const file = path.resolve(path.dirname(args.importer), args.path);
65
+ const target = prebundledFile(file);
66
+ return target === file ? undefined : { path: target };
67
+ });
68
+ }
69
+ });
70
+ }
71
+
72
+ // src/runtime/production.ts
73
+ var BUILD_INDEX_VERSION = 1;
74
+ var releases = new WeakMap;
75
+ var WORK_UNIT_STORAGE = Symbol.for("pnext.workUnitStorage");
76
+ function buildIndexFile(outPath) {
77
+ return path2.join(outPath, "server", "build-index.json");
78
+ }
79
+ function buildManifestFile(outPath) {
80
+ return path2.join(outPath, "server", "manifest.json");
81
+ }
82
+ function releaseFrameworkRoot(outPath) {
83
+ try {
84
+ const { name } = JSON.parse(readFileSync2(path2.join(frameworkRoot, "package.json"), "utf8"));
85
+ return realpathSync(path2.join(outPath, "node_modules", name));
86
+ } catch {
87
+ return frameworkRoot;
88
+ }
89
+ }
90
+ function releaseSourceRoot(outPath, serializedOutPath) {
91
+ return path2.resolve(outPath, path2.relative(serializedOutPath, "."));
92
+ }
93
+ function standaloneOriginsFile(outPath) {
94
+ return path2.join(path2.dirname(outPath), "cache", "standalone.json");
95
+ }
96
+ var shippedRelease;
97
+ function servingReleaseDir() {
98
+ if (shippedRelease === undefined) {
99
+ shippedRelease = null;
100
+ for (let dir = path2.dirname(frameworkRoot);dir !== path2.dirname(dir); dir = path2.dirname(dir)) {
101
+ if (path2.basename(dir) === "node_modules" && existsSync(buildIndexFile(path2.dirname(dir)))) {
102
+ shippedRelease = path2.dirname(dir);
103
+ break;
104
+ }
105
+ }
106
+ }
107
+ return shippedRelease ?? undefined;
108
+ }
109
+ var linkedReleases = new Map;
110
+ function linkStandaloneOrigins(release) {
111
+ if (servingReleaseDir() === release)
112
+ return true;
113
+ const known = linkedReleases.get(release);
114
+ if (known !== undefined)
115
+ return known;
116
+ let origins;
117
+ try {
118
+ const parsed = JSON.parse(readFileSync2(standaloneOriginsFile(release), "utf8"));
119
+ if (parsed.release === release)
120
+ origins = parsed.origins;
121
+ } catch {
122
+ origins = undefined;
123
+ }
124
+ linkedReleases.set(release, origins !== undefined);
125
+ if (!origins)
126
+ return false;
127
+ const files = origins;
128
+ const modules = `${path2.join(release, "node_modules")}${path2.sep}`;
129
+ registerResolvePlugin({
130
+ name: "pnext-standalone-origins",
131
+ setup(build) {
132
+ build.onResolve({ filter: /node_modules\// }, (args) => {
133
+ const file = path2.resolve(path2.dirname(args.importer), splitResourceQuery(args.path).path);
134
+ if (!file.startsWith(modules))
135
+ return;
136
+ const origin = files[path2.relative(release, file).split(path2.sep).join("/")];
137
+ return origin && existsSync(origin) ? { path: prebundledFile(origin) } : undefined;
138
+ });
139
+ }
140
+ });
141
+ return true;
142
+ }
143
+ function releaseModuleKey(layer, target, file) {
144
+ return `${layer}:${target}:${file}`;
145
+ }
146
+ function productionRelease(config) {
147
+ return releases.get(config);
148
+ }
149
+ function servedRelease() {
150
+ const units = globalThis[WORK_UNIT_STORAGE];
151
+ return units?.getStore()?.release;
152
+ }
153
+ function servedConventions() {
154
+ return servedRelease()?.conventions;
155
+ }
156
+ function frozenDirListing(dir) {
157
+ const facts = servedConventions();
158
+ if (!facts || !isInsideDir(facts.appPath, dir))
159
+ return;
160
+ return facts.dirs.get(dir) ?? { files: new Set, dirs: [] };
161
+ }
162
+ function conventionFileExists(file) {
163
+ return frozenDirListing(path2.dirname(file))?.files.has(path2.basename(file)) ?? existsSync(file);
164
+ }
165
+ function releaseModuleHref(release, layer, target, file) {
166
+ const href = release.modules.get(releaseModuleKey(layer, target, path2.resolve(file)));
167
+ if (!href) {
168
+ throw new Error(`pnext: ${file} (${layer}, ${target}) is not in this build's release. Run 'pnext build' again.`);
169
+ }
170
+ return href;
171
+ }
172
+ function attachRelease(config, index = readBuildIndex(config.outPath)) {
173
+ const existing = releases.get(config);
174
+ if (existing)
175
+ return existing;
176
+ const fromRoot = (file) => path2.resolve(config.root, file);
177
+ const framework = releaseFrameworkRoot(config.outPath);
178
+ const modules = new Map;
179
+ for (const [key, artifact] of Object.entries(index.modules)) {
180
+ const second = key.indexOf(":", key.indexOf(":") + 1);
181
+ modules.set(`${key.slice(0, second + 1)}${releaseSourceFile(key.slice(second + 1), config.root, config.workspaceRoot, framework)}`, pathToFileURL(path2.resolve(config.outPath, artifact)).href);
182
+ }
183
+ const dirs = new Map;
184
+ for (const [dir, names] of Object.entries(index.conventions)) {
185
+ dirs.set(fromRoot(dir), {
186
+ files: new Set(names.filter((name) => !name.endsWith("/"))),
187
+ dirs: names.filter((name) => name.endsWith("/")).map((name) => name.slice(0, -1))
188
+ });
189
+ }
190
+ const release = {
191
+ modules,
192
+ conventions: {
193
+ appPath: config.appPath,
194
+ dirs,
195
+ client: new Set(index.clientConventions.map(fromRoot)),
196
+ documentLayouts: new Set(index.documentLayouts.map(fromRoot))
197
+ },
198
+ globalCss: index.globalCss.map(fromRoot),
199
+ proxy: index.proxy ? { ...index.proxy, file: fromRoot(index.proxy.file) } : {},
200
+ ...index.compat ? { compat: index.compat } : {},
201
+ ...index.instrumentation ? {
202
+ instrumentation: {
203
+ file: path2.resolve(config.outPath, index.instrumentation.file),
204
+ ...index.instrumentation.edge ? { edge: path2.resolve(config.outPath, index.instrumentation.edge) } : {}
205
+ }
206
+ } : {},
207
+ ...index.fonts ? {
208
+ fonts: Object.fromEntries(Object.entries(index.fonts).map(([key, font]) => [
209
+ key,
210
+ { ...font, files: font.files.map((file) => path2.resolve(config.outPath, file)) }
211
+ ]))
212
+ } : {}
213
+ };
214
+ releases.set(config, release);
215
+ return release;
216
+ }
217
+ var conventionBases = new Set([
218
+ "page",
219
+ "route",
220
+ "layout",
221
+ "template",
222
+ "loading",
223
+ "error",
224
+ "not-found",
225
+ "default",
226
+ "forbidden",
227
+ "unauthorized",
228
+ "global-error",
229
+ "global-not-found"
230
+ ]);
231
+ var metadataBase = /^(?:robots|sitemap|manifest|favicon|(?:apple-)?icon\d*|opengraph-image\d*|twitter-image\d*)$/;
232
+ var codeFile = /\.(?:[cm]?[jt]sx?|mdx?)$/;
233
+ function capturedFile(name) {
234
+ const base = /^[^.]+/.exec(name)?.[0] ?? name;
235
+ return conventionBases.has(base) || metadataBase.test(base);
236
+ }
237
+ function servedAppFiles(facts) {
238
+ return [...facts.dirs].flatMap(([dir, listing]) => [...listing.files].map((name) => path2.join(dir, name)));
239
+ }
240
+ function captureConventions(root, appPath) {
241
+ const conventions = {};
242
+ const files = [];
243
+ const visit = (dir) => {
244
+ let entries2;
245
+ try {
246
+ entries2 = readdirSync(dir, { withFileTypes: true });
247
+ } catch {
248
+ return;
249
+ }
250
+ const names = [];
251
+ for (const entry of entries2) {
252
+ if (entry.isDirectory()) {
253
+ if (entry.name === "node_modules" || entry.name.startsWith("."))
254
+ continue;
255
+ names.push(`${entry.name}/`);
256
+ visit(path2.join(dir, entry.name));
257
+ } else if (capturedFile(entry.name)) {
258
+ names.push(entry.name);
259
+ if (codeFile.test(entry.name))
260
+ files.push(path2.join(dir, entry.name));
261
+ }
262
+ }
263
+ conventions[toPosix(path2.relative(root, dir)) || "."] = names.sort();
264
+ };
265
+ visit(appPath);
266
+ return { conventions, files };
267
+ }
268
+ var frameworkRoot = path2.resolve(__PNEXT_PACKAGE_ROOT__ + "/src/runtime", "..", "..");
269
+ function releaseSourceKey(file, root, workspaceRoot) {
270
+ const inRoot = path2.relative(root, file);
271
+ if (!inRoot.startsWith("..") && !path2.isAbsolute(inRoot))
272
+ return `r:${toPosix(inRoot)}`;
273
+ const inWorkspace = path2.relative(workspaceRoot, file);
274
+ if (!inWorkspace.startsWith("..") && !path2.isAbsolute(inWorkspace))
275
+ return `w:${toPosix(inWorkspace)}`;
276
+ const inFramework = path2.relative(frameworkRoot, file);
277
+ if (!inFramework.startsWith("..") && !path2.isAbsolute(inFramework))
278
+ return `f:${toPosix(inFramework)}`;
279
+ return `r:${toPosix(inRoot)}`;
280
+ }
281
+ function releaseSourceFile(key, root, workspaceRoot, framework = frameworkRoot) {
282
+ const value = key.slice(2);
283
+ if (key.startsWith("r:"))
284
+ return path2.join(root, value);
285
+ if (key.startsWith("w:"))
286
+ return path2.resolve(workspaceRoot, value);
287
+ if (key.startsWith("f:"))
288
+ return path2.resolve(framework, value);
289
+ return path2.join(root, value);
290
+ }
291
+ function toPosix(file) {
292
+ return file.split(path2.sep).join("/");
293
+ }
294
+ function isInsideDir(root, file) {
295
+ return file === root || file.startsWith(`${root}${path2.sep}`);
296
+ }
297
+ function readBuildIndex(outPath) {
298
+ const file = buildIndexFile(outPath);
299
+ let index;
300
+ try {
301
+ index = JSON.parse(readFileSync2(file, "utf8"));
302
+ } catch (error) {
303
+ if (error.code !== "ENOENT")
304
+ throw error;
305
+ throw new Error("No production build found. Run 'pnext build' first.");
306
+ }
307
+ if (index.version !== BUILD_INDEX_VERSION) {
308
+ throw new Error(`pnext: ${file} is from another pnext version. Run 'pnext build' again.`);
309
+ }
310
+ return index;
311
+ }
312
+ function serializeReleaseConfig(config) {
313
+ const relative = (file) => path2.relative(config.root, file) || ".";
314
+ return JSON.parse(JSON.stringify({
315
+ ...config,
316
+ root: ".",
317
+ workspaceRoot: relative(config.workspaceRoot),
318
+ appPath: relative(config.appPath),
319
+ publicPath: relative(config.publicPath),
320
+ outPath: relative(config.outPath),
321
+ outRootPath: relative(config.outRootPath),
322
+ typesPath: relative(config.typesPath),
323
+ checksPath: relative(config.checksPath)
324
+ }, (_key, value) => value instanceof RegExp ? { $regexp: [value.source, value.flags] } : value));
325
+ }
326
+ function releaseConfig(serialized, root, outPath) {
327
+ const config = JSON.parse(JSON.stringify(serialized), (_key, value) => {
328
+ const pattern = value?.$regexp;
329
+ return pattern ? new RegExp(pattern[0], pattern[1]) : value;
330
+ });
331
+ const fromRoot = (file) => path2.resolve(root, file);
332
+ const fromOut = (file) => path2.resolve(outPath, path2.relative(config.outPath, file));
333
+ return {
334
+ ...config,
335
+ root,
336
+ workspaceRoot: fromRoot(config.workspaceRoot),
337
+ appPath: fromRoot(config.appPath),
338
+ publicPath: fromRoot(config.publicPath),
339
+ outPath,
340
+ outRootPath: fromOut(config.outRootPath),
341
+ typesPath: fromOut(config.typesPath),
342
+ checksPath: fromOut(config.checksPath)
343
+ };
344
+ }
345
+ async function writeBuildIndex(config, index) {
346
+ const file = buildIndexFile(config.outPath);
347
+ const temporary = `${file}.${process.pid}.tmp`;
348
+ await writeFile(temporary, JSON.stringify(index));
349
+ await rename(temporary, file);
350
+ }
351
+
352
+ export { PREBUNDLE_STAMP, readPrebundleStamp, prebundledFile, registerPrebundleResolve, BUILD_INDEX_VERSION, buildIndexFile, buildManifestFile, releaseFrameworkRoot, releaseSourceRoot, standaloneOriginsFile, servingReleaseDir, linkStandaloneOrigins, releaseModuleKey, productionRelease, servedRelease, servedConventions, frozenDirListing, conventionFileExists, releaseModuleHref, attachRelease, servedAppFiles, captureConventions, releaseSourceKey, releaseSourceFile, readBuildIndex, serializeReleaseConfig, releaseConfig, writeBuildIndex };
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  pnextVersionRange
4
- } from "./index-20ppawv7.js";
4
+ } from "./index-4qsce64w.js";
5
5
  import {
6
6
  bold,
7
7
  cyan,
@@ -3,7 +3,7 @@ import {
3
3
  rdcProcessId,
4
4
  rebaseRdcTagSeq,
5
5
  setUseCacheRevalidateSink
6
- } from "./index-9n2914ww.js";
6
+ } from "./index-akkrvjn6.js";
7
7
  import {
8
8
  getWorkUnit
9
9
  } from "./index-grta8ap3.js";
@@ -0,0 +1,50 @@
1
+ // @bun
2
+ // src/utils/directive.ts
3
+ function hasModuleDirective(source, directive) {
4
+ const isSpace = (index) => {
5
+ const code = source.charCodeAt(index);
6
+ return code === 32 || code >= 9 && code <= 13 || code > 127 && /\s/.test(source[index]);
7
+ };
8
+ let i = 0;
9
+ for (;; ) {
10
+ while (i < source.length && isSpace(i))
11
+ i += 1;
12
+ if (source.startsWith("//", i)) {
13
+ const newline = source.indexOf(`
14
+ `, i);
15
+ if (newline === -1)
16
+ return false;
17
+ i = newline + 1;
18
+ continue;
19
+ }
20
+ if (source.startsWith("/*", i)) {
21
+ const end2 = source.indexOf("*/", i + 2);
22
+ if (end2 === -1)
23
+ return false;
24
+ i = end2 + 2;
25
+ continue;
26
+ }
27
+ const quote = source[i];
28
+ if (quote !== '"' && quote !== "'")
29
+ return false;
30
+ let end = i + 1;
31
+ while (end < source.length) {
32
+ const char = source[end];
33
+ if (char === quote || char === `
34
+ ` || char === "\\")
35
+ break;
36
+ end += 1;
37
+ }
38
+ if (source[end] !== quote)
39
+ return false;
40
+ if (source.slice(i + 1, end) === directive)
41
+ return true;
42
+ i = end + 1;
43
+ while (i < source.length && isSpace(i))
44
+ i += 1;
45
+ if (source[i] === ";")
46
+ i += 1;
47
+ }
48
+ }
49
+
50
+ export { hasModuleDirective };
@@ -6,7 +6,7 @@ import {
6
6
  loadResolvedNextConfig,
7
7
  parseConditions,
8
8
  substitute
9
- } from "./index-z84ab1w0.js";
9
+ } from "./index-e176wk6x.js";
10
10
 
11
11
  // src/compat/next/config-headers.ts
12
12
  async function loadCompatHeaders(root) {
@@ -8,10 +8,10 @@ import {
8
8
  pathnameSegments,
9
9
  slotConventionFile,
10
10
  slotDirectoriesIn
11
- } from "./index-p77b4kcx.js";
11
+ } from "./index-veycp46e.js";
12
12
  import {
13
13
  toPosixPath
14
- } from "./index-20ppawv7.js";
14
+ } from "./index-4qsce64w.js";
15
15
  import {
16
16
  getRenderExtensions
17
17
  } from "./index-zqpqyg8p.js";
@@ -0,0 +1,12 @@
1
+ // @bun
2
+ // src/utils/resource-query.ts
3
+ function splitResourceQuery(specifier) {
4
+ const offset = specifier.startsWith("#") ? 1 : 0;
5
+ const match = /[?#]/.exec(specifier.slice(offset));
6
+ if (!match)
7
+ return { path: specifier, query: "" };
8
+ const index = offset + match.index;
9
+ return { path: specifier.slice(0, index), query: specifier.slice(index) };
10
+ }
11
+
12
+ export { splitResourceQuery };