vinext 0.0.37 → 0.0.38

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 (86) hide show
  1. package/dist/cache.d.ts +2 -0
  2. package/dist/cache.js +2 -0
  3. package/dist/cli.js +6 -22
  4. package/dist/cli.js.map +1 -1
  5. package/dist/client/empty-module.d.ts +1 -0
  6. package/dist/client/empty-module.js +1 -0
  7. package/dist/client/entry.js +2 -0
  8. package/dist/client/entry.js.map +1 -1
  9. package/dist/client/instrumentation-client-state.d.ts +10 -0
  10. package/dist/client/instrumentation-client-state.js +19 -0
  11. package/dist/client/instrumentation-client-state.js.map +1 -0
  12. package/dist/client/instrumentation-client.d.ts +8 -0
  13. package/dist/client/instrumentation-client.js +8 -0
  14. package/dist/client/instrumentation-client.js.map +1 -0
  15. package/dist/cloudflare/tpr.js +1 -3
  16. package/dist/cloudflare/tpr.js.map +1 -1
  17. package/dist/deploy.js +9 -3
  18. package/dist/deploy.js.map +1 -1
  19. package/dist/entries/app-rsc-entry.js +27 -22
  20. package/dist/entries/app-rsc-entry.js.map +1 -1
  21. package/dist/entries/pages-client-entry.js +2 -0
  22. package/dist/entries/pages-client-entry.js.map +1 -1
  23. package/dist/entries/pages-server-entry.js +41 -260
  24. package/dist/entries/pages-server-entry.js.map +1 -1
  25. package/dist/entries/runtime-entry-module.d.ts +13 -1
  26. package/dist/entries/runtime-entry-module.js +18 -4
  27. package/dist/entries/runtime-entry-module.js.map +1 -1
  28. package/dist/index.d.ts +13 -11
  29. package/dist/index.js +101 -696
  30. package/dist/index.js.map +1 -1
  31. package/dist/plugins/fix-use-server-closure-collision.d.ts +29 -0
  32. package/dist/plugins/fix-use-server-closure-collision.js +204 -0
  33. package/dist/plugins/fix-use-server-closure-collision.js.map +1 -0
  34. package/dist/plugins/fonts.d.ts +39 -0
  35. package/dist/plugins/fonts.js +432 -0
  36. package/dist/plugins/fonts.js.map +1 -0
  37. package/dist/plugins/instrumentation-client.d.ts +7 -0
  38. package/dist/plugins/instrumentation-client.js +29 -0
  39. package/dist/plugins/instrumentation-client.js.map +1 -0
  40. package/dist/plugins/og-assets.d.ts +26 -0
  41. package/dist/plugins/og-assets.js +118 -0
  42. package/dist/plugins/og-assets.js.map +1 -0
  43. package/dist/server/api-handler.js +6 -23
  44. package/dist/server/api-handler.js.map +1 -1
  45. package/dist/server/app-browser-entry.js +4 -0
  46. package/dist/server/app-browser-entry.js.map +1 -1
  47. package/dist/server/dev-server.js +3 -1
  48. package/dist/server/dev-server.js.map +1 -1
  49. package/dist/server/instrumentation.d.ts +5 -1
  50. package/dist/server/instrumentation.js +15 -6
  51. package/dist/server/instrumentation.js.map +1 -1
  52. package/dist/server/middleware.d.ts +2 -0
  53. package/dist/server/middleware.js +14 -7
  54. package/dist/server/middleware.js.map +1 -1
  55. package/dist/server/pages-api-route.d.ts +23 -0
  56. package/dist/server/pages-api-route.js +40 -0
  57. package/dist/server/pages-api-route.js.map +1 -0
  58. package/dist/server/pages-media-type.d.ts +16 -0
  59. package/dist/server/pages-media-type.js +25 -0
  60. package/dist/server/pages-media-type.js.map +1 -0
  61. package/dist/server/pages-node-compat.d.ts +45 -0
  62. package/dist/server/pages-node-compat.js +148 -0
  63. package/dist/server/pages-node-compat.js.map +1 -0
  64. package/dist/server/prod-server.js +1 -0
  65. package/dist/server/prod-server.js.map +1 -1
  66. package/dist/shims/cache-for-request.d.ts +58 -0
  67. package/dist/shims/cache-for-request.js +74 -0
  68. package/dist/shims/cache-for-request.js.map +1 -0
  69. package/dist/shims/dynamic.js +25 -10
  70. package/dist/shims/dynamic.js.map +1 -1
  71. package/dist/shims/headers.js +1 -1
  72. package/dist/shims/image.js +24 -8
  73. package/dist/shims/image.js.map +1 -1
  74. package/dist/shims/layout-segment-context.js +9 -3
  75. package/dist/shims/layout-segment-context.js.map +1 -1
  76. package/dist/shims/link.js +2 -0
  77. package/dist/shims/link.js.map +1 -1
  78. package/dist/shims/navigation.js +2 -0
  79. package/dist/shims/navigation.js.map +1 -1
  80. package/dist/shims/server.d.ts +1 -0
  81. package/dist/shims/server.js +3 -0
  82. package/dist/shims/server.js.map +1 -1
  83. package/dist/shims/unified-request-context.d.ts +2 -0
  84. package/dist/shims/unified-request-context.js +1 -0
  85. package/dist/shims/unified-request-context.js.map +1 -1
  86. package/package.json +8 -4
@@ -1,4 +1,16 @@
1
1
  //#region src/entries/runtime-entry-module.d.ts
2
+ /**
3
+ * Resolve a sibling module path relative to a caller's `import.meta.url`,
4
+ * returning a forward-slash path safe for embedding in generated code.
5
+ *
6
+ * This is the single place that owns the
7
+ * `fileURLToPath(new URL(rel, base)).replace(/\\/g, "/")` idiom so callers
8
+ * don't duplicate it.
9
+ *
10
+ * @param rel - Relative path to the target module (e.g. `"../server/foo.js"`)
11
+ * @param base - The caller's `import.meta.url`
12
+ */
13
+ declare function resolveEntryPath(rel: string, base: string): string;
2
14
  /**
3
15
  * Resolve a real runtime module for a virtual entry generator.
4
16
  *
@@ -9,5 +21,5 @@
9
21
  */
10
22
  declare function resolveRuntimeEntryModule(name: string): string;
11
23
  //#endregion
12
- export { resolveRuntimeEntryModule };
24
+ export { resolveEntryPath, resolveRuntimeEntryModule };
13
25
  //# sourceMappingURL=runtime-entry-module.d.ts.map
@@ -2,6 +2,20 @@ import fs from "node:fs";
2
2
  import { fileURLToPath } from "node:url";
3
3
  //#region src/entries/runtime-entry-module.ts
4
4
  /**
5
+ * Resolve a sibling module path relative to a caller's `import.meta.url`,
6
+ * returning a forward-slash path safe for embedding in generated code.
7
+ *
8
+ * This is the single place that owns the
9
+ * `fileURLToPath(new URL(rel, base)).replace(/\\/g, "/")` idiom so callers
10
+ * don't duplicate it.
11
+ *
12
+ * @param rel - Relative path to the target module (e.g. `"../server/foo.js"`)
13
+ * @param base - The caller's `import.meta.url`
14
+ */
15
+ function resolveEntryPath(rel, base) {
16
+ return fileURLToPath(new URL(rel, base)).replace(/\\/g, "/");
17
+ }
18
+ /**
5
19
  * Resolve a real runtime module for a virtual entry generator.
6
20
  *
7
21
  * During local development we want to point at source files (for example `.ts`),
@@ -16,12 +30,12 @@ function resolveRuntimeEntryModule(name) {
16
30
  ".mts",
17
31
  ".mjs"
18
32
  ]) {
19
- const filePath = fileURLToPath(new URL(`../server/${name}${ext}`, import.meta.url));
20
- if (fs.existsSync(filePath)) return filePath.replace(/\\/g, "/");
33
+ const filePath = resolveEntryPath(`../server/${name}${ext}`, import.meta.url);
34
+ if (fs.existsSync(filePath)) return filePath;
21
35
  }
22
- return fileURLToPath(new URL(`../server/${name}.js`, import.meta.url)).replace(/\\/g, "/");
36
+ return resolveEntryPath(`../server/${name}.js`, import.meta.url);
23
37
  }
24
38
  //#endregion
25
- export { resolveRuntimeEntryModule };
39
+ export { resolveEntryPath, resolveRuntimeEntryModule };
26
40
 
27
41
  //# sourceMappingURL=runtime-entry-module.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"runtime-entry-module.js","names":[],"sources":["../../src/entries/runtime-entry-module.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport { fileURLToPath } from \"node:url\";\n\n/**\n * Resolve a real runtime module for a virtual entry generator.\n *\n * During local development we want to point at source files (for example `.ts`),\n * while packed builds only contain emitted `.js` files in `dist/`. Probe the\n * common source/build extensions and fall back to the `.js` path that exists in\n * published packages.\n */\nexport function resolveRuntimeEntryModule(name: string): string {\n for (const ext of [\".ts\", \".js\", \".mts\", \".mjs\"]) {\n const filePath = fileURLToPath(new URL(`../server/${name}${ext}`, import.meta.url));\n if (fs.existsSync(filePath)) {\n return filePath.replace(/\\\\/g, \"/\");\n }\n }\n\n return fileURLToPath(new URL(`../server/${name}.js`, import.meta.url)).replace(/\\\\/g, \"/\");\n}\n"],"mappings":";;;;;;;;;;;AAWA,SAAgB,0BAA0B,MAAsB;AAC9D,MAAK,MAAM,OAAO;EAAC;EAAO;EAAO;EAAQ;EAAO,EAAE;EAChD,MAAM,WAAW,cAAc,IAAI,IAAI,aAAa,OAAO,OAAO,OAAO,KAAK,IAAI,CAAC;AACnF,MAAI,GAAG,WAAW,SAAS,CACzB,QAAO,SAAS,QAAQ,OAAO,IAAI;;AAIvC,QAAO,cAAc,IAAI,IAAI,aAAa,KAAK,MAAM,OAAO,KAAK,IAAI,CAAC,CAAC,QAAQ,OAAO,IAAI"}
1
+ {"version":3,"file":"runtime-entry-module.js","names":[],"sources":["../../src/entries/runtime-entry-module.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport { fileURLToPath } from \"node:url\";\n\n/**\n * Resolve a sibling module path relative to a caller's `import.meta.url`,\n * returning a forward-slash path safe for embedding in generated code.\n *\n * This is the single place that owns the\n * `fileURLToPath(new URL(rel, base)).replace(/\\\\/g, \"/\")` idiom so callers\n * don't duplicate it.\n *\n * @param rel - Relative path to the target module (e.g. `\"../server/foo.js\"`)\n * @param base - The caller's `import.meta.url`\n */\nexport function resolveEntryPath(rel: string, base: string): string {\n return fileURLToPath(new URL(rel, base)).replace(/\\\\/g, \"/\");\n}\n\n/**\n * Resolve a real runtime module for a virtual entry generator.\n *\n * During local development we want to point at source files (for example `.ts`),\n * while packed builds only contain emitted `.js` files in `dist/`. Probe the\n * common source/build extensions and fall back to the `.js` path that exists in\n * published packages.\n */\nexport function resolveRuntimeEntryModule(name: string): string {\n for (const ext of [\".ts\", \".js\", \".mts\", \".mjs\"]) {\n const filePath = resolveEntryPath(`../server/${name}${ext}`, import.meta.url);\n if (fs.existsSync(filePath)) {\n return filePath;\n }\n }\n\n return resolveEntryPath(`../server/${name}.js`, import.meta.url);\n}\n"],"mappings":";;;;;;;;;;;;;;AAcA,SAAgB,iBAAiB,KAAa,MAAsB;AAClE,QAAO,cAAc,IAAI,IAAI,KAAK,KAAK,CAAC,CAAC,QAAQ,OAAO,IAAI;;;;;;;;;;AAW9D,SAAgB,0BAA0B,MAAsB;AAC9D,MAAK,MAAM,OAAO;EAAC;EAAO;EAAO;EAAQ;EAAO,EAAE;EAChD,MAAM,WAAW,iBAAiB,aAAa,OAAO,OAAO,OAAO,KAAK,IAAI;AAC7E,MAAI,GAAG,WAAW,SAAS,CACzB,QAAO;;AAIX,QAAO,iBAAiB,aAAa,KAAK,MAAM,OAAO,KAAK,IAAI"}
package/dist/index.d.ts CHANGED
@@ -2,20 +2,11 @@ import { NextConfig, NextConfigInput } from "./config/next-config.js";
2
2
  import { AppStaticExportOptions, StaticExportOptions, StaticExportResult, staticExportApp, staticExportPages } from "./build/static-export.js";
3
3
  import { matchConfigPattern } from "./config/config-matchers.js";
4
4
  import { asyncHooksStubPlugin } from "./plugins/async-hooks-stub.js";
5
+ import { parseStaticObjectLiteral } from "./plugins/fonts.js";
5
6
  import { PluginOption } from "vite";
6
7
  import { Options } from "@vitejs/plugin-react";
7
8
 
8
9
  //#region src/index.d.ts
9
- /**
10
- * Safely parse a static JS object literal string into a plain object.
11
- * Uses Vite's parseAst (Rollup/acorn) so no code is ever evaluated.
12
- * Returns null if the expression contains anything dynamic (function calls,
13
- * template literals, identifiers, computed properties, etc.).
14
- *
15
- * Supports: string literals, numeric literals, boolean literals,
16
- * arrays of the above, and nested object literals.
17
- */
18
- declare function parseStaticObjectLiteral(objectStr: string): Record<string, unknown> | null;
19
10
  /**
20
11
  * Module-level cache for resolvePostcssStringPlugins — avoids re-scanning per Vite environment.
21
12
  * Stores the Promise itself so concurrent calls (RSC/SSR/Client config() hooks firing in
@@ -109,6 +100,17 @@ declare const clientTreeshakeConfig: {
109
100
  preset: "recommended";
110
101
  moduleSideEffects: "no-external";
111
102
  };
103
+ declare function getClientOutputConfigForVite(viteMajorVersion: number): {
104
+ manualChunks: typeof clientManualChunks;
105
+ experimentalMinChunkSize: number;
106
+ } | {
107
+ codeSplitting: {
108
+ minSize: number;
109
+ groups: {
110
+ name(moduleId: string): string | null;
111
+ }[];
112
+ };
113
+ };
112
114
  type BuildManifestChunk = {
113
115
  file: string;
114
116
  isEntry?: boolean;
@@ -238,5 +240,5 @@ declare const _mdxScanCache: Map<string, boolean>;
238
240
  */
239
241
  declare function hasMdxFiles(root: string, appDir: string | null, pagesDir: string | null): boolean;
240
242
  //#endregion
241
- export { type AppStaticExportOptions, type NextConfig, type StaticExportOptions, type StaticExportResult, VinextOptions, asyncHooksStubPlugin as _asyncHooksStubPlugin, augmentSsrManifestFromBundle as _augmentSsrManifestFromBundle, hasMdxFiles as _hasMdxFiles, _mdxScanCache, parseStaticObjectLiteral as _parseStaticObjectLiteral, _postcssCache, resolvePostcssStringPlugins as _resolvePostcssStringPlugins, stripServerExports as _stripServerExports, clientManualChunks, clientOutputConfig, clientTreeshakeConfig, computeLazyChunks, vinext as default, matchConfigPattern, staticExportApp, staticExportPages };
243
+ export { type AppStaticExportOptions, type NextConfig, type StaticExportOptions, type StaticExportResult, VinextOptions, asyncHooksStubPlugin as _asyncHooksStubPlugin, augmentSsrManifestFromBundle as _augmentSsrManifestFromBundle, hasMdxFiles as _hasMdxFiles, _mdxScanCache, parseStaticObjectLiteral as _parseStaticObjectLiteral, _postcssCache, resolvePostcssStringPlugins as _resolvePostcssStringPlugins, stripServerExports as _stripServerExports, clientManualChunks, clientOutputConfig, clientTreeshakeConfig, computeLazyChunks, vinext as default, getClientOutputConfigForVite, matchConfigPattern, staticExportApp, staticExportPages };
242
244
  //# sourceMappingURL=index.d.ts.map