@lomray/vite-ssr-boost 8.0.0-beta.1 → 8.0.0-beta.2

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 (204) hide show
  1. package/README.md +2 -1
  2. package/adapters/body.d.ts +1 -1
  3. package/adapters/body.js +1 -1
  4. package/adapters/body.js.map +1 -1
  5. package/adapters/compression.d.ts +5 -5
  6. package/adapters/compression.js +1 -1
  7. package/adapters/compression.js.map +1 -1
  8. package/adapters/edge.d.ts +5 -5
  9. package/adapters/edge.js.map +1 -1
  10. package/adapters/express/create-request.d.ts +2 -2
  11. package/adapters/express/create-request.js.map +1 -1
  12. package/adapters/express/entry.d.ts +17 -19
  13. package/adapters/express/entry.js.map +1 -1
  14. package/adapters/express/prepare-server.d.ts +7 -25
  15. package/adapters/express/prepare-server.js +1 -1
  16. package/adapters/express/prepare-server.js.map +1 -1
  17. package/adapters/express/render.d.ts +14 -15
  18. package/adapters/express/render.js +1 -1
  19. package/adapters/express/render.js.map +1 -1
  20. package/adapters/express/server.d.ts +5 -6
  21. package/adapters/express/server.js +1 -1
  22. package/adapters/express/server.js.map +1 -1
  23. package/adapters/express.d.ts +5 -5
  24. package/adapters/express.js.map +1 -1
  25. package/adapters/fastify.d.ts +5 -5
  26. package/adapters/fastify.js +1 -1
  27. package/adapters/fastify.js.map +1 -1
  28. package/adapters/hono.d.ts +2 -2
  29. package/adapters/hono.js.map +1 -1
  30. package/adapters/node.d.ts +6 -5
  31. package/adapters/node.js.map +1 -1
  32. package/browser/entry.d.ts +9 -9
  33. package/browser/entry.js +1 -1
  34. package/browser/entry.js.map +1 -1
  35. package/cli/build.d.ts +2 -2
  36. package/cli/build.js.map +1 -1
  37. package/cli/helpers/keyboard-input.d.ts +1 -1
  38. package/cli/helpers/keyboard-input.js +1 -1
  39. package/cli/helpers/keyboard-input.js.map +1 -1
  40. package/cli/helpers/vite-reset-cache.d.ts +1 -1
  41. package/cli/helpers/vite-reset-cache.js.map +1 -1
  42. package/cli/interfaces/actions.d.ts +8 -9
  43. package/cli/run-amplify-build.d.ts +1 -1
  44. package/cli/run-amplify-build.js.map +1 -1
  45. package/cli/run-dev.d.ts +3 -4
  46. package/cli/run-dev.js.map +1 -1
  47. package/cli/run-docker-build.d.ts +2 -2
  48. package/cli/run-docker-build.js.map +1 -1
  49. package/cli/run-prod.d.ts +4 -5
  50. package/cli/run-prod.js.map +1 -1
  51. package/cli/run-serverless.d.ts +2 -2
  52. package/cli/run-serverless.js.map +1 -1
  53. package/cli/run-vercel-build.d.ts +1 -1
  54. package/cli/run-vercel-build.js.map +1 -1
  55. package/cli.js +1 -1
  56. package/cli.js.map +1 -1
  57. package/components/navigate.d.ts +3 -3
  58. package/components/navigate.js.map +1 -1
  59. package/components/only-client.d.ts +2 -2
  60. package/components/only-client.js +1 -1
  61. package/components/only-client.js.map +1 -1
  62. package/components/render-client.d.ts +4 -4
  63. package/components/render-client.js +1 -1
  64. package/components/render-client.js.map +1 -1
  65. package/components/response-status.d.ts +2 -2
  66. package/components/response-status.js.map +1 -1
  67. package/components/scroll-to-top.d.ts +2 -2
  68. package/components/scroll-to-top.js +1 -1
  69. package/components/scroll-to-top.js.map +1 -1
  70. package/components/with-suspense.d.ts +3 -3
  71. package/components/with-suspense.js.map +1 -1
  72. package/constants/cli-actions.d.ts +1 -1
  73. package/constants/cli-actions.js.map +1 -1
  74. package/constants/cli-context.d.ts +4 -5
  75. package/constants/cli-context.js.map +1 -1
  76. package/constants/cli-name.d.ts +1 -1
  77. package/constants/cli-name.js.map +1 -1
  78. package/constants/cli-shortcuts.d.ts +2 -2
  79. package/constants/cli-shortcuts.js +1 -1
  80. package/constants/cli-shortcuts.js.map +1 -1
  81. package/constants/common.js.map +1 -1
  82. package/constants/plugin-name.d.ts +1 -1
  83. package/constants/plugin-name.js.map +1 -1
  84. package/constants/stream-error.d.ts +1 -1
  85. package/constants/stream-error.js.map +1 -1
  86. package/context/server.d.ts +3 -4
  87. package/context/server.js.map +1 -1
  88. package/core/compose-html.d.ts +2 -2
  89. package/core/compose-html.js.map +1 -1
  90. package/core/early-hints.d.ts +2 -2
  91. package/core/early-hints.js.map +1 -1
  92. package/core/handler.d.ts +3 -3
  93. package/core/handler.js.map +1 -1
  94. package/core/head-response.d.ts +1 -1
  95. package/core/head-response.js.map +1 -1
  96. package/core/headers.d.ts +3 -4
  97. package/core/headers.js +1 -1
  98. package/core/headers.js.map +1 -1
  99. package/core/render.d.ts +13 -13
  100. package/core/render.js +1 -1
  101. package/core/render.js.map +1 -1
  102. package/core/transform-html.d.ts +1 -1
  103. package/core/transform-html.js.map +1 -1
  104. package/core/types.d.ts +2 -3
  105. package/edge/render-to-stream.d.ts +2 -2
  106. package/edge/render-to-stream.js +1 -1
  107. package/edge/render-to-stream.js.map +1 -1
  108. package/helpers/build-custom-state.d.ts +1 -1
  109. package/helpers/build-custom-state.js +1 -1
  110. package/helpers/build-custom-state.js.map +1 -1
  111. package/helpers/build-router-state.d.ts +2 -2
  112. package/helpers/build-router-state.js.map +1 -1
  113. package/helpers/create-focus-only.d.ts +3 -3
  114. package/helpers/create-focus-only.js.map +1 -1
  115. package/helpers/dev-marker.d.ts +1 -1
  116. package/helpers/dev-marker.js.map +1 -1
  117. package/helpers/get-server-state.d.ts +1 -1
  118. package/helpers/get-server-state.js.map +1 -1
  119. package/helpers/html-escape.d.ts +1 -1
  120. package/helpers/html-escape.js +1 -1
  121. package/helpers/html-escape.js.map +1 -1
  122. package/helpers/import-route.d.ts +7 -7
  123. package/helpers/import-route.js +1 -1
  124. package/helpers/import-route.js.map +1 -1
  125. package/helpers/is-route-file.d.ts +1 -1
  126. package/helpers/is-route-file.js.map +1 -1
  127. package/helpers/obtain-stream-error.d.ts +3 -3
  128. package/helpers/obtain-stream-error.js.map +1 -1
  129. package/helpers/plugin-config.d.ts +5 -5
  130. package/helpers/plugin-config.js +1 -1
  131. package/helpers/plugin-config.js.map +1 -1
  132. package/helpers/print-server-info.d.ts +3 -4
  133. package/helpers/print-server-info.js +1 -1
  134. package/helpers/print-server-info.js.map +1 -1
  135. package/helpers/print-server-urls.d.ts +2 -2
  136. package/helpers/print-server-urls.js +1 -1
  137. package/helpers/print-server-urls.js.map +1 -1
  138. package/helpers/process-stop.d.ts +1 -1
  139. package/helpers/process-stop.js.map +1 -1
  140. package/helpers/resolve-server-urls.d.ts +3 -4
  141. package/helpers/resolve-server-urls.js +1 -1
  142. package/helpers/resolve-server-urls.js.map +1 -1
  143. package/helpers/serialize-errors.d.ts +2 -2
  144. package/helpers/serialize-errors.js.map +1 -1
  145. package/helpers/vite-aliases.d.ts +2 -2
  146. package/helpers/vite-aliases.js +1 -1
  147. package/helpers/vite-aliases.js.map +1 -1
  148. package/interfaces/fc-route.d.ts +4 -4
  149. package/interfaces/fc-route.js.map +1 -1
  150. package/interfaces/fc.d.ts +3 -4
  151. package/interfaces/route-object.d.ts +6 -6
  152. package/node/compress-response.d.ts +2 -2
  153. package/node/compress-response.js +1 -1
  154. package/node/compress-response.js.map +1 -1
  155. package/node/create-headers.d.ts +1 -1
  156. package/node/create-headers.js.map +1 -1
  157. package/node/create-request.d.ts +2 -2
  158. package/node/create-request.js.map +1 -1
  159. package/node/http.d.ts +4 -6
  160. package/node/render-to-stream.d.ts +2 -2
  161. package/node/render-to-stream.js +1 -1
  162. package/node/render-to-stream.js.map +1 -1
  163. package/node/request-signal.d.ts +2 -2
  164. package/node/request-signal.js.map +1 -1
  165. package/node/split-link-header.d.ts +1 -1
  166. package/node/split-link-header.js.map +1 -1
  167. package/node/write-early-hints.d.ts +2 -2
  168. package/node/write-early-hints.js.map +1 -1
  169. package/node/write-fetch-response.d.ts +3 -2
  170. package/node/write-fetch-response.js +1 -1
  171. package/node/write-fetch-response.js.map +1 -1
  172. package/package.json +52 -32
  173. package/plugin.d.ts +7 -7
  174. package/plugin.js.map +1 -1
  175. package/plugins/create-spa-index.d.ts +3 -3
  176. package/plugins/create-spa-index.js.map +1 -1
  177. package/plugins/handle-custom-entrypoint.d.ts +4 -4
  178. package/plugins/handle-custom-entrypoint.js +1 -1
  179. package/plugins/handle-custom-entrypoint.js.map +1 -1
  180. package/plugins/make-aliases.d.ts +3 -3
  181. package/plugins/make-aliases.js +1 -1
  182. package/plugins/make-aliases.js.map +1 -1
  183. package/plugins/normalize-route.d.ts +3 -3
  184. package/plugins/normalize-route.js.map +1 -1
  185. package/services/build.d.ts +5 -51
  186. package/services/build.js +1 -1
  187. package/services/build.js.map +1 -1
  188. package/services/logger.d.ts +2 -30
  189. package/services/logger.js.map +1 -1
  190. package/services/parse-routes.d.ts +5 -42
  191. package/services/parse-routes.js +1 -1
  192. package/services/parse-routes.js.map +1 -1
  193. package/services/path-normalize.d.ts +3 -18
  194. package/services/path-normalize.js +1 -1
  195. package/services/path-normalize.js.map +1 -1
  196. package/services/server-api.d.ts +1 -7
  197. package/services/server-api.js.map +1 -1
  198. package/services/server-config.d.ts +4 -48
  199. package/services/server-config.js +1 -1
  200. package/services/server-config.js.map +1 -1
  201. package/services/ssr-manifest.d.ts +6 -63
  202. package/services/ssr-manifest.js +1 -1
  203. package/services/ssr-manifest.js.map +1 -1
  204. package/workflow/Dockerfile +1 -1
@@ -1,6 +1,6 @@
1
- import { StaticHandlerContext } from 'react-router';
1
+ import type { StaticHandlerContext } from 'react-router';
2
2
  /**
3
3
  * Build router state
4
4
  */
5
5
  declare function buildRouterState(context: StaticHandlerContext): string;
6
- export { buildRouterState as default };
6
+ export default buildRouterState;
@@ -1 +1 @@
1
- {"version":3,"file":"build-router-state.js","sources":["../../src/helpers/build-router-state.ts"],"sourcesContent":["import type { StaticHandlerContext } from 'react-router';\nimport htmlEscape from '@helpers/html-escape';\nimport serializeErrors from '@helpers/serialize-errors';\n\n/**\n * Build router state\n */\nfunction buildRouterState(context: StaticHandlerContext): string {\n const { loaderData, actionData, errors } = context;\n const routerState = {\n loaderData,\n actionData,\n errors: serializeErrors(errors),\n };\n const json = htmlEscape(JSON.stringify(JSON.stringify(routerState)));\n\n return `<script async>window.__staticRouterHydrationData = JSON.parse(${json});</script>`;\n}\n\nexport default buildRouterState;\n"],"names":["buildRouterState","context","loaderData","actionData","errors","routerState","serializeErrors","htmlEscape","JSON","stringify"],"mappings":"qEAOA,SAASA,EAAiBC,GACxB,MAAMC,WAAEA,EAAUC,WAAEA,EAAUC,OAAEA,GAAWH,EACrCI,EAAc,CAClBH,aACAC,aACAC,OAAQE,EAAgBF,IAI1B,MAAO,iEAFMG,EAAWC,KAAKC,UAAUD,KAAKC,UAAUJ,kBAGxD"}
1
+ {"version":3,"file":"build-router-state.js","sources":["../../src/helpers/build-router-state.ts"],"sourcesContent":[null],"names":["buildRouterState","context","loaderData","actionData","errors","routerState","serializeErrors","htmlEscape","JSON","stringify"],"mappings":"qEAOA,SAASA,EAAiBC,GACxB,MAAMC,WAAEA,EAAUC,WAAEA,EAAUC,OAAEA,GAAWH,EACrCI,EAAc,CAClBH,aACAC,aACAC,OAAQE,EAAgBF,IAI1B,MAAO,iEAFMG,EAAWC,KAAKC,UAAUD,KAAKC,UAAUJ,kBAGxD"}
@@ -1,11 +1,11 @@
1
- import { IBuildParams } from "../services/build.js";
1
+ import type { IBuildParams } from '../services/build.js';
2
2
  /**
3
3
  * Small focus only helper to provide simple and useful methods to detect focus state
4
4
  */
5
- declare const createFocusOnly: (focus: IBuildParams['focusOnly']) => {
5
+ declare const createFocusOnly: (focus: IBuildParams["focusOnly"]) => {
6
6
  isOnlyClient: () => boolean;
7
7
  isClient: () => boolean;
8
8
  isServer: () => boolean;
9
9
  isEntrypoint: () => boolean;
10
10
  };
11
- export { createFocusOnly as default };
11
+ export default createFocusOnly;
@@ -1 +1 @@
1
- {"version":3,"file":"create-focus-only.js","sources":["../../src/helpers/create-focus-only.ts"],"sourcesContent":["import type { IBuildParams } from '@services/build';\n\n/**\n * Small focus only helper to provide simple and useful methods to detect focus state\n */\nconst createFocusOnly = (focus: IBuildParams['focusOnly']) => ({\n isOnlyClient: () => focus === 'client',\n isClient: () => ['all', 'app', 'client'].includes(focus!),\n isServer: () => ['all', 'app', 'server'].includes(focus!),\n isEntrypoint: () => ['all', 'entrypoint'].includes(focus!),\n});\n\nexport default createFocusOnly;\n"],"names":["createFocusOnly","focus","isOnlyClient","isClient","includes","isServer","isEntrypoint"],"mappings":"AAKA,MAAMA,EAAmBC,IAAgC,CACvDC,aAAc,IAAgB,WAAVD,EACpBE,SAAU,IAAM,CAAC,MAAO,MAAO,UAAUC,SAASH,GAClDI,SAAU,IAAM,CAAC,MAAO,MAAO,UAAUD,SAASH,GAClDK,aAAc,IAAM,CAAC,MAAO,cAAcF,SAASH"}
1
+ {"version":3,"file":"create-focus-only.js","sources":["../../src/helpers/create-focus-only.ts"],"sourcesContent":[null],"names":["createFocusOnly","focus","isOnlyClient","isClient","includes","isServer","isEntrypoint"],"mappings":"AAKA,MAAMA,EAAmBC,IAAgC,CACvDC,aAAc,IAAgB,WAAVD,EACpBE,SAAU,IAAM,CAAC,MAAO,MAAO,UAAUC,SAASH,GAClDI,SAAU,IAAM,CAAC,MAAO,MAAO,UAAUD,SAASH,GAClDK,aAAc,IAAM,CAAC,MAAO,cAAcF,SAASH"}
@@ -1,4 +1,4 @@
1
- import { ResolvedConfig } from 'vite';
1
+ import type { ResolvedConfig } from 'vite';
2
2
  declare const getMarkerFile: (root: string, withFile?: boolean) => string;
3
3
  /**
4
4
  * Create dev marker
@@ -1 +1 @@
1
- {"version":3,"file":"dev-marker.js","sources":["../../src/helpers/dev-marker.ts"],"sourcesContent":["import fs from 'node:fs';\nimport path from 'node:path';\nimport type { ResolvedConfig } from 'vite';\n\nconst getMarkerFile = (root: string, withFile = true): string =>\n [root, 'server', withFile && '.dev'].filter(Boolean).join('/');\n\n/**\n * Create dev marker\n *\n * @see printServerInfo\n */\nconst createDevMarker = (isProd: boolean, { root, build: buildConf }: ResolvedConfig): void => {\n const buildRoot = path.resolve(root, buildConf.outDir);\n const devMarkerPath = getMarkerFile(buildRoot, false);\n const devMarker = getMarkerFile(buildRoot);\n\n if (!isProd) {\n if (!fs.existsSync(devMarkerPath)) {\n fs.mkdirSync(devMarkerPath, { recursive: true });\n }\n\n fs.writeFileSync(devMarker, '');\n } else if (fs.existsSync(devMarker)) {\n fs.rmSync(devMarker);\n }\n};\n\nexport { createDevMarker, getMarkerFile };\n"],"names":["getMarkerFile","root","withFile","filter","Boolean","join","createDevMarker","isProd","build","buildConf","buildRoot","path","resolve","outDir","devMarkerPath","devMarker","fs","existsSync","rmSync","mkdirSync","recursive","writeFileSync"],"mappings":"gDAIA,MAAMA,EAAgB,CAACC,EAAcC,GAAW,IAC9C,CAACD,EAAM,SAAUC,GAAY,QAAQC,OAAOC,SAASC,KAAK,KAOtDC,EAAkB,CAACC,GAAmBN,OAAMO,MAAOC,MACvD,MAAMC,EAAYC,EAAKC,QAAQX,EAAMQ,EAAUI,QACzCC,EAAgBd,EAAcU,GAAW,GACzCK,EAAYf,EAAcU,GAE3BH,EAMMS,EAAGC,WAAWF,IACvBC,EAAGE,OAAOH,IANLC,EAAGC,WAAWH,IACjBE,EAAGG,UAAUL,EAAe,CAAEM,WAAW,IAG3CJ,EAAGK,cAAcN,EAAW,IAG9B"}
1
+ {"version":3,"file":"dev-marker.js","sources":["../../src/helpers/dev-marker.ts"],"sourcesContent":[null],"names":["getMarkerFile","root","withFile","filter","Boolean","join","createDevMarker","isProd","build","buildConf","buildRoot","path","resolve","outDir","devMarkerPath","devMarker","fs","existsSync","rmSync","mkdirSync","recursive","writeFileSync"],"mappings":"gDAIA,MAAMA,EAAgB,CAACC,EAAcC,GAAW,IAC9C,CAACD,EAAM,SAAUC,GAAY,QAAQC,OAAOC,SAASC,KAAK,KAOtDC,EAAkB,CAACC,GAAmBN,OAAMO,MAAOC,MACvD,MAAMC,EAAYC,EAAKC,QAAQX,EAAMQ,EAAUI,QACzCC,EAAgBd,EAAcU,GAAW,GACzCK,EAAYf,EAAcU,GAE3BH,EAMMS,EAAGC,WAAWF,IACvBC,EAAGE,OAAOH,IANLC,EAAGC,WAAWH,IACjBE,EAAGG,UAAUL,EAAe,CAAEM,WAAW,IAG3CJ,EAAGK,cAAcN,EAAW"}
@@ -2,4 +2,4 @@
2
2
  * Get server state on the client side
3
3
  */
4
4
  declare const getServerState: <TP = Record<string, any>>(name: string, shouldRemove?: boolean) => TP;
5
- export { getServerState as default };
5
+ export default getServerState;
@@ -1 +1 @@
1
- {"version":3,"file":"get-server-state.js","sources":["../../src/helpers/get-server-state.ts"],"sourcesContent":["/**\n * Get server state on the client side\n */\nconst getServerState = <TP = Record<string, any>>(name: string, shouldRemove = true): TP => {\n const data = (window as Record<any, any>)[name] as TP;\n\n if (shouldRemove && data) {\n delete (window as Record<any, any>)[name];\n }\n\n return (data ?? {}) as TP;\n};\n\nexport default getServerState;\n"],"names":["getServerState","name","shouldRemove","data","window"],"mappings":"AAGA,MAAMA,EAAiB,CAA2BC,EAAcC,GAAe,KAC7E,MAAMC,EAAQC,OAA4BH,GAM1C,OAJIC,GAAgBC,UACVC,OAA4BH,GAG9BE,GAAQ,CAAA,CAAE"}
1
+ {"version":3,"file":"get-server-state.js","sources":["../../src/helpers/get-server-state.ts"],"sourcesContent":[null],"names":["getServerState","name","shouldRemove","data","window"],"mappings":"AAGA,MAAMA,EAAiB,CAA2BC,EAAcC,GAAe,KAC7E,MAAMC,EAAQC,OAA4BH,GAM1C,OAJIC,GAAgBC,UACVC,OAA4BH,GAG9BE,GAAQ,CAAA"}
@@ -3,4 +3,4 @@
3
3
  * License: https://github.com/zertosh/htmlescape/blob/0527ca7156a524d256101bb310a9f970f63078ad/LICENSE
4
4
  */
5
5
  declare const htmlEscape: (str: string) => string;
6
- export { htmlEscape as default };
6
+ export default htmlEscape;
@@ -1,2 +1,2 @@
1
- const u={"&":"\\u0026",">":"\\u003e","<":"\\u003c","\u2028":"\\u2028","\u2029":"\\u2029"},e=/[&><\u2028\u2029]/g,a=a=>a.replace(e,(e=>u[e]));export{a as default};
1
+ const u={"&":"\\u0026",">":"\\u003e","<":"\\u003c","\u2028":"\\u2028","\u2029":"\\u2029"},e=/[&><\u2028\u2029]/g,a=a=>a.replace(e,e=>u[e]);export{a as default};
2
2
  //# sourceMappingURL=html-escape.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"html-escape.js","sources":["../../src/helpers/html-escape.ts"],"sourcesContent":["const ESCAPE_LOOKUP: { [match: string]: string } = {\n '&': '\\\\u0026',\n '>': '\\\\u003e',\n '<': '\\\\u003c',\n '\\u2028': '\\\\u2028',\n '\\u2029': '\\\\u2029',\n};\nconst ESCAPE_REGEX = /[&><\\u2028\\u2029]/g;\n\n/**\n * This utility is based on https://github.com/zertosh/htmlescape\n * License: https://github.com/zertosh/htmlescape/blob/0527ca7156a524d256101bb310a9f970f63078ad/LICENSE\n */\nconst htmlEscape = (str: string): string => {\n return str.replace(ESCAPE_REGEX, (match) => ESCAPE_LOOKUP[match]);\n};\n\nexport default htmlEscape;\n"],"names":["ESCAPE_LOOKUP","ESCAPE_REGEX","htmlEscape","str","replace","match"],"mappings":"AAAA,MAAMA,EAA6C,CACjD,IAAK,UACL,IAAK,UACL,IAAK,UACL,SAAU,UACV,SAAU,WAENC,EAAe,qBAMfC,EAAcC,GACXA,EAAIC,QAAQH,GAAeI,GAAUL,EAAcK"}
1
+ {"version":3,"file":"html-escape.js","sources":["../../src/helpers/html-escape.ts"],"sourcesContent":[null],"names":["ESCAPE_LOOKUP","ESCAPE_REGEX","htmlEscape","str","replace","match"],"mappings":"AAAA,MAAMA,EAA6C,CACjD,IAAK,UACL,IAAK,UACL,IAAK,UACL,SAAU,UACV,SAAU,WAENC,EAAe,qBAMfC,EAAcC,GACXA,EAAIC,QAAQH,EAAeI,GAAUL,EAAcK"}
@@ -1,15 +1,15 @@
1
- import { IndexRouteObject, NonIndexRouteObject } from 'react-router';
2
- import { FCCRoute, FCRoute } from "../interfaces/fc-route.js";
3
- import { TOnlyClientProp } from "../interfaces/route-object.js";
4
- type IDynamicRoute = () => Promise<{
1
+ import type { IndexRouteObject, NonIndexRouteObject } from 'react-router';
2
+ import type { FCCRoute, FCRoute } from '../interfaces/fc-route.js';
3
+ import type { TOnlyClientProp } from '../interfaces/route-object.js';
4
+ export type IDynamicRoute = () => Promise<{
5
5
  default: FCRoute | FCCRoute<any>;
6
6
  }>;
7
- type ImmutableRouteKey = 'lazy' | 'caseSensitive' | 'path' | 'id' | 'index' | 'children';
8
- type IAsyncRoute = {
7
+ export type ImmutableRouteKey = 'lazy' | 'caseSensitive' | 'path' | 'id' | 'index' | 'children';
8
+ export type IAsyncRoute = {
9
9
  pathId?: string;
10
10
  } & (Omit<IndexRouteObject, ImmutableRouteKey> | Omit<NonIndexRouteObject, ImmutableRouteKey>);
11
11
  /**
12
12
  * Import dynamic route
13
13
  */
14
14
  declare const importRoute: (route: IDynamicRoute, onlyClient?: TOnlyClientProp) => (() => Promise<IAsyncRoute>);
15
- export { importRoute as default, IDynamicRoute, ImmutableRouteKey, IAsyncRoute };
15
+ export default importRoute;
@@ -1,2 +1,2 @@
1
- import{isValidElement as o}from"react";import n from"../components/render-client.js";import t from"../components/with-suspense.js";import{IS_SERVER as e}from"../constants/common.js";import{keys as m}from"../interfaces/fc-route.js";const p=(p,r)=>async()=>{const s=(n=>o(n)?{element:n}:"function"!=typeof n&&"object"!=typeof n||null===n?{Component:null}:{Component:n})(r);if(r&&e)return s;const c=await p();if("Component"in c){const o=r?n(c.Component,s):c.Component;return{...c,Component:o}}const f=c.default,i={Component:f};return m.forEach((o=>{f[o]&&(i[o]=f[o])})),f.Suspense&&(i.Component=t(f,f.Suspense)),r&&(i.Component=n(i.Component,s)),i};export{p as default};
1
+ import{isValidElement as o}from"react";import n from"../components/render-client.js";import t from"../components/with-suspense.js";import{IS_SERVER as e}from"../constants/common.js";import{keys as m}from"../interfaces/fc-route.js";const p=(p,r)=>async()=>{const s=(n=>o(n)?{element:n}:"function"!=typeof n&&"object"!=typeof n||null===n?{Component:null}:{Component:n})(r);if(r&&e)return s;const c=await p();if("Component"in c){const o=r?n(c.Component,s):c.Component;return{...c,Component:o}}const f=c.default,i={Component:f};return m.forEach(o=>{f[o]&&(i[o]=f[o])}),f.Suspense&&(i.Component=t(f,f.Suspense)),r&&(i.Component=n(i.Component,s)),i};export{p as default};
2
2
  //# sourceMappingURL=import-route.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"import-route.js","sources":["../../src/helpers/import-route.ts"],"sourcesContent":["import type { FC, ReactNode } from 'react';\nimport { isValidElement } from 'react';\nimport type { IndexRouteObject, NonIndexRouteObject } from 'react-router';\nimport renderClient from '@components/render-client';\nimport withSuspense from '@components/with-suspense';\nimport { IS_SERVER } from '@constants/common';\nimport type { FCCRoute, FCRoute } from '@interfaces/fc-route';\nimport { keys } from '@interfaces/fc-route';\nimport type { TOnlyClientProp } from '@interfaces/route-object';\n\nexport type IDynamicRoute = () => Promise<{ default: FCRoute | FCCRoute<any> }>;\n\nexport type ImmutableRouteKey = 'lazy' | 'caseSensitive' | 'path' | 'id' | 'index' | 'children';\n\nexport type IAsyncRoute = { pathId?: string } & (\n | Omit<IndexRouteObject, ImmutableRouteKey>\n | Omit<NonIndexRouteObject, ImmutableRouteKey>\n);\n\n/**\n * Return right fallback syntax\n */\nconst getFallback = (\n Fallback?: TOnlyClientProp,\n): { element: ReactNode } | { Component: FC | null } => {\n if (isValidElement(Fallback)) {\n return { element: Fallback };\n }\n\n if ((typeof Fallback === 'function' || typeof Fallback === 'object') && Fallback !== null) {\n return { Component: Fallback as FC };\n }\n\n return { Component: null };\n};\n\n/**\n * Import dynamic route\n */\nconst importRoute = (\n route: IDynamicRoute,\n onlyClient?: TOnlyClientProp,\n): (() => Promise<IAsyncRoute>) => {\n return async (): Promise<IAsyncRoute> => {\n const Fallback = getFallback(onlyClient);\n\n if (onlyClient && IS_SERVER) {\n return Fallback;\n }\n\n const resolved = await route();\n\n // fallback to react router export style\n if ('Component' in resolved) {\n const Component = onlyClient\n ? renderClient(resolved.Component as FCRoute | FCCRoute<any>, Fallback)\n : resolved.Component;\n\n return { ...resolved, Component } as IAsyncRoute;\n }\n\n const Component = resolved.default;\n const result: IAsyncRoute = { Component };\n\n keys.forEach((key) => {\n if (Component[key]) {\n // @ts-ignore\n result[key] = Component[key] as NonNullable<IAsyncRoute[typeof key]>;\n }\n });\n\n if (Component.Suspense) {\n result.Component = withSuspense(Component, Component.Suspense);\n }\n\n if (onlyClient) {\n result.Component = renderClient(result.Component as FCRoute | FCCRoute<any>, Fallback);\n }\n\n return result;\n };\n};\n\nexport default importRoute;\n"],"names":["importRoute","route","onlyClient","async","Fallback","isValidElement","element","Component","getFallback","IS_SERVER","resolved","renderClient","default","result","keys","forEach","key","Suspense","withSuspense"],"mappings":"uOAsBA,MAiBMA,EAAc,CAClBC,EACAC,IAEOC,UACL,MAAMC,EAtBU,CAClBA,GAEIC,EAAeD,GACV,CAAEE,QAASF,GAGK,mBAAbA,GAA+C,iBAAbA,GAAuC,OAAbA,EAIjE,CAAEG,UAAW,MAHX,CAAEA,UAAWH,GAcHI,CAAYN,GAE7B,GAAIA,GAAcO,EAChB,OAAOL,EAGT,MAAMM,QAAiBT,IAGvB,GAAI,cAAeS,EAAU,CAC3B,MAAMH,EAAYL,EACdS,EAAaD,EAASH,UAAsCH,GAC5DM,EAASH,UAEb,MAAO,IAAKG,EAAUH,YACxB,CAEA,MAAMA,EAAYG,EAASE,QACrBC,EAAsB,CAAEN,aAiB9B,OAfAO,EAAKC,SAASC,IACRT,EAAUS,KAEZH,EAAOG,GAAOT,EAAUS,GAC1B,IAGET,EAAUU,WACZJ,EAAON,UAAYW,EAAaX,EAAWA,EAAUU,WAGnDf,IACFW,EAAON,UAAYI,EAAaE,EAAON,UAAsCH,IAGxES,CAAM"}
1
+ {"version":3,"file":"import-route.js","sources":["../../src/helpers/import-route.ts"],"sourcesContent":[null],"names":["importRoute","route","onlyClient","async","Fallback","isValidElement","element","Component","getFallback","IS_SERVER","resolved","renderClient","default","result","keys","forEach","key","Suspense","withSuspense"],"mappings":"uOAqBA,MAiBMA,EAAc,CAClBC,EACAC,IAEOC,UACL,MAAMC,EAtBU,CAClBA,GAEIC,EAAeD,GACV,CAAEE,QAASF,GAGK,mBAAbA,GAA+C,iBAAbA,GAAuC,OAAbA,EAIjE,CAAEG,UAAW,MAHX,CAAEA,UAAWH,GAcHI,CAAYN,GAE7B,GAAIA,GAAcO,EAChB,OAAOL,EAGT,MAAMM,QAAiBT,IAGvB,GAAI,cAAeS,EAAU,CAC3B,MAAMH,EAAYL,EACdS,EAAaD,EAASH,UAAsCH,GAC5DM,EAASH,UAEb,MAAO,IAAKG,EAAUH,YACxB,CAEA,MAAMA,EAAYG,EAASE,QACrBC,EAAsB,CAAEN,aAiB9B,OAfAO,EAAKC,QAASC,IACRT,EAAUS,KAEZH,EAAOG,GAAOT,EAAUS,MAIxBT,EAAUU,WACZJ,EAAON,UAAYW,EAAaX,EAAWA,EAAUU,WAGnDf,IACFW,EAAON,UAAYI,EAAaE,EAAON,UAAsCH,IAGxES"}
@@ -2,4 +2,4 @@
2
2
  * Detect route file
3
3
  */
4
4
  declare const isRoutesFile: (code: string) => boolean;
5
- export { isRoutesFile as default };
5
+ export default isRoutesFile;
@@ -1 +1 @@
1
- {"version":3,"file":"is-route-file.js","sources":["../../src/helpers/is-route-file.ts"],"sourcesContent":["/**\n * Detect route file\n */\nconst isRoutesFile = (code: string): boolean =>\n /{.*path:.*(lazy:.+import|Component:|element:)|{.*(lazy:.+import|Component:|element:).*path:/s.test(\n code,\n );\n\nexport default isRoutesFile;\n"],"names":["isRoutesFile","code","test"],"mappings":"AAGA,MAAMA,EAAgBC,GACpB,+FAA+FC,KAC7FD"}
1
+ {"version":3,"file":"is-route-file.js","sources":["../../src/helpers/is-route-file.ts"],"sourcesContent":[null],"names":["isRoutesFile","code","test"],"mappings":"AAGA,MAAMA,EAAgBC,GACpB,+FAA+FC,KAC7FD"}
@@ -1,5 +1,5 @@
1
- import StreamError from "../constants/stream-error.js";
2
- interface IObtainStreamErrorOut {
1
+ import StreamError from '../constants/stream-error.js';
2
+ export interface IObtainStreamErrorOut {
3
3
  code: StreamError;
4
4
  message: string;
5
5
  original: unknown;
@@ -8,4 +8,4 @@ interface IObtainStreamErrorOut {
8
8
  * Get react stream error
9
9
  */
10
10
  declare const obtainStreamError: (err: unknown) => IObtainStreamErrorOut;
11
- export { obtainStreamError as default, IObtainStreamErrorOut };
11
+ export default obtainStreamError;
@@ -1 +1 @@
1
- {"version":3,"file":"obtain-stream-error.js","sources":["../../src/helpers/obtain-stream-error.ts"],"sourcesContent":["import StreamError from '@constants/stream-error';\n\nexport interface IObtainStreamErrorOut {\n code: StreamError;\n message: string;\n original: unknown;\n}\n\n/**\n * Get react stream error\n */\nconst obtainStreamError = (err: unknown): IObtainStreamErrorOut => {\n const message = ((err as Error)?.message ?? 'Unknown.').replace('Error: ', '');\n\n if (\n (err as Error)?.name === 'AbortError' ||\n message === 'The render was aborted by the server without a reason.'\n ) {\n return {\n code: StreamError.RenderAborted,\n message,\n original: err,\n };\n } else if (message === 'The destination stream closed early.') {\n return {\n code: StreamError.RenderSkip,\n message,\n original: err,\n };\n }\n\n return {\n code: StreamError.Unknown,\n message: message || 'Unknown error',\n original: err,\n };\n};\n\nexport default obtainStreamError;\n"],"names":["obtainStreamError","err","message","replace","name","code","StreamError","RenderAborted","original","RenderSkip","Unknown"],"mappings":"4CAWA,MAAMA,EAAqBC,IACzB,MAAMC,GAAYD,GAAeC,SAAW,YAAYC,QAAQ,UAAW,IAE3E,MAC2B,eAAxBF,GAAeG,MACJ,2DAAZF,EAEO,CACLG,KAAMC,EAAYC,cAClBL,UACAM,SAAUP,GAES,yCAAZC,EACF,CACLG,KAAMC,EAAYG,WAClBP,UACAM,SAAUP,GAIP,CACLI,KAAMC,EAAYI,QAClBR,QAASA,GAAW,gBACpBM,SAAUP,EACX"}
1
+ {"version":3,"file":"obtain-stream-error.js","sources":["../../src/helpers/obtain-stream-error.ts"],"sourcesContent":[null],"names":["obtainStreamError","err","message","replace","name","code","StreamError","RenderAborted","original","RenderSkip","Unknown"],"mappings":"4CAWA,MAAMA,EAAqBC,IACzB,MAAMC,GAAYD,GAAeC,SAAW,YAAYC,QAAQ,UAAW,IAE3E,MAC2B,eAAxBF,GAAeG,MACJ,2DAAZF,EAEO,CACLG,KAAMC,EAAYC,cAClBL,UACAM,SAAUP,GAES,yCAAZC,EACF,CACLG,KAAMC,EAAYG,WAClBP,UACAM,SAAUP,GAIP,CACLI,KAAMC,EAAYI,QAClBR,QAASA,GAAW,gBACpBM,SAAUP"}
@@ -1,7 +1,7 @@
1
- import { ResolvedConfig } from 'vite';
2
- import CliActions from "../constants/cli-actions.js";
3
- import { IPluginOptions } from "../plugin.js";
4
- interface IPluginConfig extends Required<IPluginOptions> {
1
+ import type { ResolvedConfig } from 'vite';
2
+ import type CliActions from '../constants/cli-actions.js';
3
+ import type { IPluginOptions } from '../plugin.js';
4
+ export interface IPluginConfig extends Required<IPluginOptions> {
5
5
  pluginPath: string;
6
6
  action: CliActions;
7
7
  isDev: boolean;
@@ -10,4 +10,4 @@ interface IPluginConfig extends Required<IPluginOptions> {
10
10
  * Get plugin config from vite config
11
11
  */
12
12
  declare function getPluginConfig(viteConfig: ResolvedConfig): IPluginConfig;
13
- export { getPluginConfig as default, IPluginConfig };
13
+ export default getPluginConfig;
@@ -1,2 +1,2 @@
1
- import n from"../constants/plugin-name.js";function t(t){const o=t.plugins.find((t=>t.name===n)),i=o?.pluginOptions;if(!i)throw new Error(`Failed to get to plugin config. Make sure you add the plugin '${n}' to the VITE config.`);return i}export{t as default};
1
+ import n from"../constants/plugin-name.js";function t(t){const o=t.plugins.find(t=>t.name===n),i=o?.pluginOptions;if(!i)throw new Error(`Failed to get to plugin config. Make sure you add the plugin '${n}' to the VITE config.`);return i}export{t as default};
2
2
  //# sourceMappingURL=plugin-config.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"plugin-config.js","sources":["../../src/helpers/plugin-config.ts"],"sourcesContent":["import type { ResolvedConfig } from 'vite';\nimport type CliActions from '@constants/cli-actions';\nimport PLUGIN_NAME from '@constants/plugin-name';\nimport type { IPluginOptions } from '../plugin';\n\nexport interface IPluginConfig extends Required<IPluginOptions> {\n pluginPath: string;\n action: CliActions;\n isDev: boolean;\n}\n\n/**\n * Get plugin config from vite config\n */\nfunction getPluginConfig(viteConfig: ResolvedConfig): IPluginConfig {\n const pluginConfig = viteConfig.plugins.find(\n (plugin) => plugin.name === PLUGIN_NAME,\n ) as ResolvedConfig['plugins'][number] & { pluginOptions?: IPluginConfig };\n const pluginOptions = pluginConfig?.pluginOptions;\n\n if (!pluginOptions) {\n throw new Error(\n `Failed to get to plugin config. Make sure you add the plugin '${PLUGIN_NAME}' to the VITE config.`,\n );\n }\n\n return pluginOptions;\n}\n\nexport default getPluginConfig;\n"],"names":["getPluginConfig","viteConfig","pluginConfig","plugins","find","plugin","name","PLUGIN_NAME","pluginOptions","Error"],"mappings":"2CAcA,SAASA,EAAgBC,GACvB,MAAMC,EAAeD,EAAWE,QAAQC,MACrCC,GAAWA,EAAOC,OAASC,IAExBC,EAAgBN,GAAcM,cAEpC,IAAKA,EACH,MAAM,IAAIC,MACR,iEAAiEF,0BAIrE,OAAOC,CACT"}
1
+ {"version":3,"file":"plugin-config.js","sources":["../../src/helpers/plugin-config.ts"],"sourcesContent":[null],"names":["getPluginConfig","viteConfig","pluginConfig","plugins","find","plugin","name","PLUGIN_NAME","pluginOptions","Error"],"mappings":"2CAcA,SAASA,EAAgBC,GACvB,MAAMC,EAAeD,EAAWE,QAAQC,KACrCC,GAAWA,EAAOC,OAASC,GAExBC,EAAgBN,GAAcM,cAEpC,IAAKA,EACH,MAAM,IAAIC,MACR,iEAAiEF,0BAIrE,OAAOC,CACT"}
@@ -1,6 +1,5 @@
1
- /// <reference types="node" />
2
- import { Server } from 'node:net';
3
- import ServerConfig from "../services/server-config.js";
1
+ import type { Server } from 'node:net';
2
+ import type ServerConfig from '../services/server-config.js';
4
3
  interface IPrintServerInfoParams {
5
4
  version?: string;
6
5
  server?: Server;
@@ -9,4 +8,4 @@ interface IPrintServerInfoParams {
9
8
  * Print server info
10
9
  */
11
10
  declare function printServerInfo(config: ServerConfig, { server, version }?: IPrintServerInfoParams): Promise<void>;
12
- export { printServerInfo as default };
11
+ export default printServerInfo;
@@ -1,2 +1,2 @@
1
- import e from"node:fs";import{performance as o}from"node:perf_hooks";import r from"chalk";import s from"../constants/cli-actions.js";import t from"../constants/cli-name.js";import{getMarkerFile as i}from"./dev-marker.js";import n from"./print-server-urls.js";import m from"./resolve-server-urls.js";async function a(a,{server:d,version:l="unknown"}={}){const{action:p}=a.getPluginConfig()??{},{isProd:f,host:c,root:g,isSPA:v}=a.getParams(),h=i(g),u=a.getLogger(),w=global.viteBoostStartTime??o.now(),b=r.dim(`ready in ${r.reset(r.bold(Math.ceil(o.now()-w)))} ms`);u.info(`\n ${r.green(`${r.bold(t.toUpperCase())} v${l}`)} ${b}\n`,{clear:!u.hasWarned});const S=a.getVite()?.config,$=!S?.mode&&!e.existsSync(h),j=d?await m(d,{host:c,isHttps:Boolean(S?.server.https),rawBase:S?.rawBase}):null,P=S?.mode||$?a.mode:`production ${r.red("NODE_ENV=development")}`,k=v?"SPA":"SSR";if(u.info(r.dim(r.green(" ➜"))+r.dim(" Mode: ")+r.blue(P)),u.info(r.dim(r.green(" ➜"))+r.dim(" Type: ")+r.blue(k)),f)j&&n(j,(e=>u.info(e)));else{const e=a.getVite();e.resolvedUrls=j,e.printUrls()}p===s.dev&&u.info(r.dim(r.green(" ➜"))+r.dim(" press ")+r.bold("h")+r.dim(" to show help"))}export{a as default};
1
+ import e from"node:fs";import{performance as o}from"node:perf_hooks";import r from"chalk";import s from"../constants/cli-actions.js";import t from"../constants/cli-name.js";import{getMarkerFile as i}from"./dev-marker.js";import n from"./print-server-urls.js";import m from"./resolve-server-urls.js";async function a(a,{server:d,version:l="unknown"}={}){const{action:p}=a.getPluginConfig()??{},{isProd:f,host:c,root:g,isSPA:v}=a.getParams(),h=i(g),u=a.getLogger(),w=global.viteBoostStartTime??o.now(),b=r.dim(`ready in ${r.reset(r.bold(Math.ceil(o.now()-w)))} ms`);u.info(`\n ${r.green(`${r.bold(t.toUpperCase())} v${l}`)} ${b}\n`,{clear:!u.hasWarned});const S=a.getVite()?.config,$=!S?.mode&&!e.existsSync(h),j=d?await m(d,{host:c,isHttps:Boolean(S?.server.https),rawBase:S?.rawBase}):null,P=S?.mode||$?a.mode:`production ${r.red("NODE_ENV=development")}`,k=v?"SPA":"SSR";if(u.info(r.dim(r.green(" ➜"))+r.dim(" Mode: ")+r.blue(P)),u.info(r.dim(r.green(" ➜"))+r.dim(" Type: ")+r.blue(k)),f)j&&n(j,e=>u.info(e));else{const e=a.getVite();e.resolvedUrls=j,e.printUrls()}p===s.dev&&u.info(r.dim(r.green(" ➜"))+r.dim(" press ")+r.bold("h")+r.dim(" to show help"))}export{a as default};
2
2
  //# sourceMappingURL=print-server-info.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"print-server-info.js","sources":["../../src/helpers/print-server-info.ts"],"sourcesContent":["import fs from 'node:fs';\nimport type { Server } from 'node:net';\nimport { performance } from 'node:perf_hooks';\nimport chalk from 'chalk';\nimport type { ResolvedConfig } from 'vite';\nimport CliActions from '@constants/cli-actions';\nimport cliName from '@constants/cli-name';\nimport { getMarkerFile } from '@helpers/dev-marker';\nimport printServerUrls from '@helpers/print-server-urls';\nimport resolveServerUrls from '@helpers/resolve-server-urls';\nimport type ServerConfig from '@services/server-config';\n\ninterface IPrintServerInfoParams {\n version?: string;\n server?: Server;\n}\n\n/**\n * Print server info\n */\nasync function printServerInfo(\n config: ServerConfig,\n { server, version = 'unknown' }: IPrintServerInfoParams = {},\n): Promise<void> {\n const { action } = config.getPluginConfig() ?? {};\n const { isProd, host, root, isSPA } = config.getParams();\n const devMarker = getMarkerFile(root);\n\n const Logger = config.getLogger();\n const perfStart = global.viteBoostStartTime ?? performance.now();\n const startupDurationString = chalk.dim(\n `ready in ${chalk.reset(chalk.bold(Math.ceil(performance.now() - perfStart)))} ms`,\n );\n\n Logger.info(\n `\\n ${chalk.green(\n `${chalk.bold(cliName.toUpperCase())} v${version}`,\n )} ${startupDurationString}\\n`,\n { clear: !Logger.hasWarned },\n );\n\n const viteConfig = config.getVite()?.config as\n | (ResolvedConfig & { rawBase?: string })\n | undefined;\n const isProdBuild = !viteConfig?.mode && !fs.existsSync(devMarker);\n const resolvedUrls = server\n ? await resolveServerUrls(server, {\n host,\n isHttps: Boolean(viteConfig?.server.https),\n rawBase: viteConfig?.rawBase,\n })\n : null;\n const mode =\n viteConfig?.mode || isProdBuild\n ? config.mode\n : `production ${chalk.red('NODE_ENV=development')}`;\n const type = isSPA ? 'SPA' : 'SSR';\n\n Logger.info(chalk.dim(chalk.green(' ➜')) + chalk.dim(' Mode: ') + chalk.blue(mode));\n Logger.info(chalk.dim(chalk.green(' ➜')) + chalk.dim(' Type: ') + chalk.blue(type));\n\n if (!isProd) {\n const vite = config.getVite()!;\n\n vite.resolvedUrls = resolvedUrls;\n vite.printUrls();\n } else if (resolvedUrls) {\n printServerUrls(resolvedUrls, (msg) => Logger.info(msg));\n }\n\n if (action === CliActions.dev) {\n Logger.info(\n chalk.dim(chalk.green(' ➜')) +\n chalk.dim(' press ') +\n chalk.bold('h') +\n chalk.dim(' to show help'),\n );\n }\n}\n\nexport default printServerInfo;\n"],"names":["async","printServerInfo","config","server","version","action","getPluginConfig","isProd","host","root","isSPA","getParams","devMarker","getMarkerFile","Logger","getLogger","perfStart","global","viteBoostStartTime","performance","now","startupDurationString","chalk","dim","reset","bold","Math","ceil","info","green","cliName","toUpperCase","clear","hasWarned","viteConfig","getVite","isProdBuild","mode","fs","existsSync","resolvedUrls","resolveServerUrls","isHttps","Boolean","https","rawBase","red","type","blue","printServerUrls","msg","vite","printUrls","CliActions","dev"],"mappings":"2SAoBAA,eAAeC,EACbC,GACAC,OAAEA,EAAMC,QAAEA,EAAU,WAAsC,IAE1D,MAAMC,OAAEA,GAAWH,EAAOI,mBAAqB,CAAA,GACzCC,OAAEA,EAAMC,KAAEA,EAAIC,KAAEA,EAAIC,MAAEA,GAAUR,EAAOS,YACvCC,EAAYC,EAAcJ,GAE1BK,EAASZ,EAAOa,YAChBC,EAAYC,OAAOC,oBAAsBC,EAAYC,MACrDC,EAAwBC,EAAMC,IAClC,YAAYD,EAAME,MAAMF,EAAMG,KAAKC,KAAKC,KAAKR,EAAYC,MAAQJ,WAGnEF,EAAOc,KACL,OAAON,EAAMO,MACX,GAAGP,EAAMG,KAAKK,EAAQC,mBAAmB3B,SACrCiB,MACN,CAAEW,OAAQlB,EAAOmB,YAGnB,MAAMC,EAAahC,EAAOiC,WAAWjC,OAG/BkC,GAAeF,GAAYG,OAASC,EAAGC,WAAW3B,GAClD4B,EAAerC,QACXsC,EAAkBtC,EAAQ,CAC9BK,OACAkC,QAASC,QAAQT,GAAY/B,OAAOyC,OACpCC,QAASX,GAAYW,UAEvB,KACER,EACJH,GAAYG,MAAQD,EAChBlC,EAAOmC,KACP,cAAcf,EAAMwB,IAAI,0BACxBC,EAAOrC,EAAQ,MAAQ,MAK7B,GAHAI,EAAOc,KAAKN,EAAMC,IAAID,EAAMO,MAAM,QAAUP,EAAMC,IAAI,eAAiBD,EAAM0B,KAAKX,IAClFvB,EAAOc,KAAKN,EAAMC,IAAID,EAAMO,MAAM,QAAUP,EAAMC,IAAI,eAAiBD,EAAM0B,KAAKD,IAE7ExC,EAKMiC,GACTS,EAAgBT,GAAeU,GAAQpC,EAAOc,KAAKsB,SANxC,CACX,MAAMC,EAAOjD,EAAOiC,UAEpBgB,EAAKX,aAAeA,EACpBW,EAAKC,WACP,CAII/C,IAAWgD,EAAWC,KACxBxC,EAAOc,KACLN,EAAMC,IAAID,EAAMO,MAAM,QACpBP,EAAMC,IAAI,YACVD,EAAMG,KAAK,KACXH,EAAMC,IAAI,iBAGlB"}
1
+ {"version":3,"file":"print-server-info.js","sources":["../../src/helpers/print-server-info.ts"],"sourcesContent":[null],"names":["async","printServerInfo","config","server","version","action","getPluginConfig","isProd","host","root","isSPA","getParams","devMarker","getMarkerFile","Logger","getLogger","perfStart","global","viteBoostStartTime","performance","now","startupDurationString","chalk","dim","reset","bold","Math","ceil","info","green","cliName","toUpperCase","clear","hasWarned","viteConfig","getVite","isProdBuild","mode","fs","existsSync","resolvedUrls","resolveServerUrls","isHttps","Boolean","https","rawBase","red","type","blue","printServerUrls","msg","vite","printUrls","CliActions","dev"],"mappings":"2SAoBAA,eAAeC,EACbC,GACAC,OAAEA,EAAMC,QAAEA,EAAU,WAAsC,IAE1D,MAAMC,OAAEA,GAAWH,EAAOI,mBAAqB,CAAA,GACzCC,OAAEA,EAAMC,KAAEA,EAAIC,KAAEA,EAAIC,MAAEA,GAAUR,EAAOS,YACvCC,EAAYC,EAAcJ,GAE1BK,EAASZ,EAAOa,YAChBC,EAAYC,OAAOC,oBAAsBC,EAAYC,MACrDC,EAAwBC,EAAMC,IAClC,YAAYD,EAAME,MAAMF,EAAMG,KAAKC,KAAKC,KAAKR,EAAYC,MAAQJ,WAGnEF,EAAOc,KACL,OAAON,EAAMO,MACX,GAAGP,EAAMG,KAAKK,EAAQC,mBAAmB3B,SACrCiB,MACN,CAAEW,OAAQlB,EAAOmB,YAGnB,MAAMC,EAAkEhC,EAAOiC,WAAWjC,OACpFkC,GAAeF,GAAYG,OAASC,EAAGC,WAAW3B,GAClD4B,EAAerC,QACXsC,EAAkBtC,EAAQ,CAC9BK,OACAkC,QAASC,QAAQT,GAAY/B,OAAOyC,OACpCC,QAASX,GAAYW,UAEvB,KACER,EACJH,GAAYG,MAAQD,EAChBlC,EAAOmC,KACP,cAAcf,EAAMwB,IAAI,0BACxBC,EAAOrC,EAAQ,MAAQ,MAK7B,GAHAI,EAAOc,KAAKN,EAAMC,IAAID,EAAMO,MAAM,QAAUP,EAAMC,IAAI,eAAiBD,EAAM0B,KAAKX,IAClFvB,EAAOc,KAAKN,EAAMC,IAAID,EAAMO,MAAM,QAAUP,EAAMC,IAAI,eAAiBD,EAAM0B,KAAKD,IAE7ExC,EAKMiC,GACTS,EAAgBT,EAAeU,GAAQpC,EAAOc,KAAKsB,QANxC,CACX,MAAMC,EAAOjD,EAAOiC,UAEpBgB,EAAKX,aAAeA,EACpBW,EAAKC,WACP,CAII/C,IAAWgD,EAAWC,KACxBxC,EAAOc,KACLN,EAAMC,IAAID,EAAMO,MAAM,QACpBP,EAAMC,IAAI,YACVD,EAAMG,KAAK,KACXH,EAAMC,IAAI,iBAGlB"}
@@ -1,8 +1,8 @@
1
- import { Logger, ResolvedServerUrls } from 'vite';
1
+ import type { Logger, ResolvedServerUrls } from 'vite';
2
2
  /**
3
3
  * Print server urls
4
4
  * @see https://github.com/vitejs/vite/blob/711dd807610b39538e9955970145d52e4ca1d8c0/packages/vite/src/node/logger.ts#LL142C1-L162C2
5
5
  * vite not export this function
6
6
  */
7
7
  declare function printServerUrls(urls: ResolvedServerUrls, info: Logger['info']): void;
8
- export { printServerUrls as default };
8
+ export default printServerUrls;
@@ -1,2 +1,2 @@
1
- import o from"chalk";function e(e,n){const r=e=>o.cyan(e.replace(/:(\d+)\//,((e,n)=>`:${o.bold(n)}/`)));for(const c of e.local)n(` ${o.green("➜")} ${o.bold("Local")}: ${r(c)}`);for(const c of e.network)n(` ${o.green("➜")} ${o.bold("Network")}: ${r(c)}`);n("\n")}export{e as default};
1
+ import o from"chalk";function e(e,n){const r=e=>o.cyan(e.replace(/:(\d+)\//,(e,n)=>`:${o.bold(n)}/`));for(const c of e.local)n(` ${o.green("➜")} ${o.bold("Local")}: ${r(c)}`);for(const c of e.network)n(` ${o.green("➜")} ${o.bold("Network")}: ${r(c)}`);n("\n")}export{e as default};
2
2
  //# sourceMappingURL=print-server-urls.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"print-server-urls.js","sources":["../../src/helpers/print-server-urls.ts"],"sourcesContent":["import chalk from 'chalk';\nimport type { Logger, ResolvedServerUrls } from 'vite';\n\n/**\n * Print server urls\n * @see https://github.com/vitejs/vite/blob/711dd807610b39538e9955970145d52e4ca1d8c0/packages/vite/src/node/logger.ts#LL142C1-L162C2\n * vite not export this function\n */\nfunction printServerUrls(urls: ResolvedServerUrls, info: Logger['info']): void {\n const colorUrl = (url: string) =>\n chalk.cyan(url.replace(/:(\\d+)\\//, (_, port) => `:${chalk.bold(port)}/`));\n for (const url of urls.local) {\n info(` ${chalk.green('➜')} ${chalk.bold('Local')}: ${colorUrl(url)}`);\n }\n for (const url of urls.network) {\n info(` ${chalk.green('➜')} ${chalk.bold('Network')}: ${colorUrl(url)}`);\n }\n\n info('\\n');\n}\n\nexport default printServerUrls;\n"],"names":["printServerUrls","urls","info","colorUrl","url","chalk","cyan","replace","_","port","bold","local","green","network"],"mappings":"qBAQA,SAASA,EAAgBC,EAA0BC,GACjD,MAAMC,EAAYC,GAChBC,EAAMC,KAAKF,EAAIG,QAAQ,YAAY,CAACC,EAAGC,IAAS,IAAIJ,EAAMK,KAAKD,SACjE,IAAK,MAAML,KAAOH,EAAKU,MACrBT,EAAK,KAAKG,EAAMO,MAAM,SAASP,EAAMK,KAAK,eAAeP,EAASC,MAEpE,IAAK,MAAMA,KAAOH,EAAKY,QACrBX,EAAK,KAAKG,EAAMO,MAAM,SAASP,EAAMK,KAAK,eAAeP,EAASC,MAGpEF,EAAK,KACP"}
1
+ {"version":3,"file":"print-server-urls.js","sources":["../../src/helpers/print-server-urls.ts"],"sourcesContent":[null],"names":["printServerUrls","urls","info","colorUrl","url","chalk","cyan","replace","_","port","bold","local","green","network"],"mappings":"qBAQA,SAASA,EAAgBC,EAA0BC,GACjD,MAAMC,EAAYC,GAChBC,EAAMC,KAAKF,EAAIG,QAAQ,WAAY,CAACC,EAAGC,IAAS,IAAIJ,EAAMK,KAAKD,QACjE,IAAK,MAAML,KAAOH,EAAKU,MACrBT,EAAK,KAAKG,EAAMO,MAAM,SAASP,EAAMK,KAAK,eAAeP,EAASC,MAEpE,IAAK,MAAMA,KAAOH,EAAKY,QACrBX,EAAK,KAAKG,EAAMO,MAAM,SAASP,EAAMK,KAAK,eAAeP,EAASC,MAGpEF,EAAK,KACP"}
@@ -2,4 +2,4 @@
2
2
  * Stop node process
3
3
  */
4
4
  declare const processStop: (code?: number | string | null, isOnlyError?: boolean) => void;
5
- export { processStop as default };
5
+ export default processStop;
@@ -1 +1 @@
1
- {"version":3,"file":"process-stop.js","sources":["../../src/helpers/process-stop.ts"],"sourcesContent":["import process from 'node:process';\n\n/**\n * Stop node process\n */\nconst processStop = (code: number | string | null = 0, isOnlyError = false): void => {\n if (isOnlyError && (code === 0 || code === null)) {\n return;\n }\n\n if (typeof code === 'string') {\n console.error(code);\n\n return process.exit(1);\n }\n\n process.exit(code === null ? 0 : code);\n};\n\nexport default processStop;\n"],"names":["processStop","code","isOnlyError","console","error","process","exit"],"mappings":"4BAKA,MAAMA,EAAc,CAACC,EAA+B,EAAGC,GAAc,KACnE,IAAIA,GAAyB,IAATD,GAAuB,OAATA,EAIlC,MAAoB,iBAATA,GACTE,QAAQC,MAAMH,GAEPI,EAAQC,KAAK,SAGtBD,EAAQC,KAAc,OAATL,EAAgB,EAAIA,EAAK"}
1
+ {"version":3,"file":"process-stop.js","sources":["../../src/helpers/process-stop.ts"],"sourcesContent":[null],"names":["processStop","code","isOnlyError","console","error","process","exit"],"mappings":"4BAKA,MAAMA,EAAc,CAACC,EAA+B,EAAGC,GAAc,KACnE,IAAIA,GAAyB,IAATD,GAAuB,OAATA,EAIlC,MAAoB,iBAATA,GACTE,QAAQC,MAAMH,GAEPI,EAAQC,KAAK,SAGtBD,EAAQC,KAAc,OAATL,EAAgB,EAAIA"}
@@ -1,6 +1,5 @@
1
- /// <reference types="node" />
2
- import { Server } from 'node:net';
3
- import { ResolvedServerUrls } from 'vite';
1
+ import type { Server } from 'node:net';
2
+ import type { ResolvedServerUrls } from 'vite';
4
3
  interface IResolveServerUrlsOptions {
5
4
  host: string;
6
5
  isHttps?: boolean;
@@ -12,4 +11,4 @@ interface IResolveServerUrlsOptions {
12
11
  * vite not export this function
13
12
  */
14
13
  declare function resolveServerUrls(server: Server, options: IResolveServerUrlsOptions): Promise<ResolvedServerUrls>;
15
- export { resolveServerUrls as default };
14
+ export default resolveServerUrls;
@@ -1,2 +1,2 @@
1
- import{promises as s}from"node:dns";import o from"node:os";const t=new Set(["localhost","127.0.0.1","::1","0000:0000:0000:0000:0000:0000:0000:0001"]),a=new Set(["0.0.0.0","::","0000:0000:0000:0000:0000:0000:0000:0000"]);async function e(o){let t;t=void 0===o||!1===o?"localhost":!0===o?void 0:o;let e=void 0===t||a.has(t)?"localhost":t;if("localhost"===t){const o=await async function(){const[o,t]=await Promise.all([s.lookup("localhost"),s.lookup("localhost",{verbatim:!0})]);return o.family===t.family&&o.address===t.address?void 0:o.address}();o&&(e=o)}return{host:t,name:e}}async function l(s,l){const n=s.address();if("object"!=typeof(r=n)||!Boolean(r?.address))return{local:[],network:[]};var r;const{host:c,isHttps:d,rawBase:i}=l,h=[],f=[],u=await e(c),p=d?"https":"http",{port:m}=n,$="./"!==i&&""!==i&&i?i:"/";if(void 0===u.host||a.has(u.host))Object.values(o.networkInterfaces()).flatMap((s=>s??[])).filter((s=>s&&s.address&&("IPv4"===s.family||4===s.family))).forEach((s=>{let o=s.address.replace("127.0.0.1",u.name);o.includes(":")&&(o=`[${o}]`);const t=`${p}://${o}:${m}${$}`;s.address.includes("127.0.0.1")?h.push(t):f.push(t)}));else{let s=u.name;s.includes(":")&&(s=`[${s}]`);const o=`${p}://${s}:${m}${$}`;t.has(u.host)?h.push(o):f.push(o)}return{local:h,network:f}}export{l as default};
1
+ import{promises as s}from"node:dns";import o from"node:os";const t=new Set(["localhost","127.0.0.1","::1","0000:0000:0000:0000:0000:0000:0000:0001"]),a=new Set(["0.0.0.0","::","0000:0000:0000:0000:0000:0000:0000:0000"]);async function e(o){let t;t=void 0===o||!1===o?"localhost":!0===o?void 0:o;let e=void 0===t||a.has(t)?"localhost":t;if("localhost"===t){const o=await async function(){const[o,t]=await Promise.all([s.lookup("localhost"),s.lookup("localhost",{verbatim:!0})]);return o.family===t.family&&o.address===t.address?void 0:o.address}();o&&(e=o)}return{host:t,name:e}}async function l(s,l){const n=s.address();if("object"!=typeof(r=n)||!Boolean(r?.address))return{local:[],network:[]};var r;const{host:c,isHttps:d,rawBase:i}=l,h=[],f=[],u=await e(c),p=d?"https":"http",{port:m}=n,$="./"!==i&&""!==i&&i?i:"/";if(void 0===u.host||a.has(u.host))Object.values(o.networkInterfaces()).flatMap(s=>s??[]).filter(s=>s&&s.address&&("IPv4"===s.family||4===s.family)).forEach(s=>{let o=s.address.replace("127.0.0.1",u.name);o.includes(":")&&(o=`[${o}]`);const t=`${p}://${o}:${m}${$}`;s.address.includes("127.0.0.1")?h.push(t):f.push(t)});else{let s=u.name;s.includes(":")&&(s=`[${s}]`);const o=`${p}://${s}:${m}${$}`;t.has(u.host)?h.push(o):f.push(o)}return{local:h,network:f}}export{l as default};
2
2
  //# sourceMappingURL=resolve-server-urls.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"resolve-server-urls.js","sources":["../../src/helpers/resolve-server-urls.ts"],"sourcesContent":["import { promises as dns } from 'node:dns';\nimport type { AddressInfo, Server } from 'node:net';\nimport os from 'node:os';\nimport type { ResolvedServerUrls } from 'vite';\n\ninterface IHostname {\n host: string | undefined;\n name: string;\n}\n\nconst loopbackHosts = new Set([\n 'localhost',\n '127.0.0.1',\n '::1',\n '0000:0000:0000:0000:0000:0000:0000:0001',\n]);\n\nconst wildcardHosts = new Set(['0.0.0.0', '::', '0000:0000:0000:0000:0000:0000:0000:0000']);\n\n/**\n * @see https://github.com/vitejs/vite/blob/main/packages/vite/src/node/utils.ts#LL819C8-L830C2\n */\nasync function getLocalhostAddressIfDiffersFromDNS(): Promise<string | undefined> {\n const [nodeResult, dnsResult] = await Promise.all([\n dns.lookup('localhost'),\n dns.lookup('localhost', { verbatim: true }),\n ]);\n const isSame = nodeResult.family === dnsResult.family && nodeResult.address === dnsResult.address;\n\n return isSame ? undefined : nodeResult.address;\n}\n\n/**\n * Resolve hostname\n * @see https://github.com/vitejs/vite/blob/main/packages/vite/src/node/utils.ts#LL852C1-L878C2\n * vite not export this function\n */\nasync function resolveHostname(optionsHost: string | boolean | undefined): Promise<IHostname> {\n let host: string | undefined;\n\n if (optionsHost === undefined || optionsHost === false) {\n // Use a secure default\n host = 'localhost';\n } else if (optionsHost === true) {\n // If passed --host in the CLI without arguments\n host = undefined; // undefined typically means 0.0.0.0 or :: (listen on all IPs)\n } else {\n host = optionsHost;\n }\n\n // Set host name to localhost when possible\n let name = host === undefined || wildcardHosts.has(host) ? 'localhost' : host;\n\n if (host === 'localhost') {\n // See #8647 for more details.\n const localhostAddr = await getLocalhostAddressIfDiffersFromDNS();\n\n if (localhostAddr) {\n name = localhostAddr;\n }\n }\n\n return { host, name };\n}\n\ninterface IResolveServerUrlsOptions {\n host: string;\n isHttps?: boolean;\n rawBase?: string;\n}\n\n/**\n * Resolve server urls\n * @see https://github.com/vitejs/vite/blob/main/packages/vite/src/node/utils.ts#L956\n * vite not export this function\n */\nasync function resolveServerUrls(\n server: Server,\n options: IResolveServerUrlsOptions,\n): Promise<ResolvedServerUrls> {\n const address = server.address();\n\n const isAddressInfo = (x: AddressInfo | null | string): x is AddressInfo =>\n (typeof x === 'object' && Boolean(x?.address)) || false;\n\n if (!isAddressInfo(address)) {\n return { local: [], network: [] };\n }\n\n const { host, isHttps, rawBase } = options;\n\n const local: string[] = [];\n const network: string[] = [];\n const hostname = await resolveHostname(host);\n const protocol = isHttps ? 'https' : 'http';\n const { port } = address;\n const base = rawBase === './' || rawBase === '' || !rawBase ? '/' : rawBase;\n\n if (hostname.host !== undefined && !wildcardHosts.has(hostname.host)) {\n let hostnameName = hostname.name;\n\n // ipv6 host\n if (hostnameName.includes(':')) {\n hostnameName = `[${hostnameName}]`;\n }\n\n const addressUrl = `${protocol}://${hostnameName}:${port}${base}`;\n\n if (loopbackHosts.has(hostname.host)) {\n local.push(addressUrl);\n } else {\n network.push(addressUrl);\n }\n } else {\n Object.values(os.networkInterfaces())\n .flatMap((nInterface) => nInterface ?? [])\n .filter(\n (detail) =>\n detail &&\n detail.address &&\n (detail.family === 'IPv4' ||\n // @ts-expect-error Node 18.0 - 18.3 returns number\n detail.family === 4),\n )\n .forEach((detail) => {\n let resultHost = detail.address.replace('127.0.0.1', hostname.name);\n\n // ipv6 host\n if (resultHost.includes(':')) {\n resultHost = `[${resultHost}]`;\n }\n\n const url = `${protocol}://${resultHost}:${port}${base}`;\n\n if (detail.address.includes('127.0.0.1')) {\n local.push(url);\n } else {\n network.push(url);\n }\n });\n }\n\n return { local, network };\n}\n\nexport default resolveServerUrls;\n"],"names":["loopbackHosts","Set","wildcardHosts","async","resolveHostname","optionsHost","host","undefined","name","has","localhostAddr","nodeResult","dnsResult","Promise","all","dns","lookup","verbatim","family","address","getLocalhostAddressIfDiffersFromDNS","resolveServerUrls","server","options","x","Boolean","local","network","isHttps","rawBase","hostname","protocol","port","base","Object","values","os","networkInterfaces","flatMap","nInterface","filter","detail","forEach","resultHost","replace","includes","url","push","hostnameName","addressUrl"],"mappings":"2DAUA,MAAMA,EAAgB,IAAIC,IAAI,CAC5B,YACA,YACA,MACA,4CAGIC,EAAgB,IAAID,IAAI,CAAC,UAAW,KAAM,4CAoBhDE,eAAeC,EAAgBC,GAC7B,IAAIC,EAIFA,OAFkBC,IAAhBF,IAA6C,IAAhBA,EAExB,aACkB,IAAhBA,OAEFE,EAEAF,EAIT,IAAIG,OAAgBD,IAATD,GAAsBJ,EAAcO,IAAIH,GAAQ,YAAcA,EAEzE,GAAa,cAATA,EAAsB,CAExB,MAAMI,QAjCVP,iBACE,MAAOQ,EAAYC,SAAmBC,QAAQC,IAAI,CAChDC,EAAIC,OAAO,aACXD,EAAIC,OAAO,YAAa,CAAEC,UAAU,MAItC,OAFeN,EAAWO,SAAWN,EAAUM,QAAUP,EAAWQ,UAAYP,EAAUO,aAE1EZ,EAAYI,EAAWQ,OACzC,CAyBgCC,GAExBV,IACFF,EAAOE,EAEX,CAEA,MAAO,CAAEJ,OAAME,OACjB,CAaAL,eAAekB,EACbC,EACAC,GAEA,MAAMJ,EAAUG,EAAOH,UAKvB,GAFgB,iBADOK,EAGJL,KAFSM,QAAQD,GAAGL,SAGrC,MAAO,CAAEO,MAAO,GAAIC,QAAS,IAJT,IAACH,EAOvB,MAAMlB,KAAEA,EAAIsB,QAAEA,EAAOC,QAAEA,GAAYN,EAE7BG,EAAkB,GAClBC,EAAoB,GACpBG,QAAiB1B,EAAgBE,GACjCyB,EAAWH,EAAU,QAAU,QAC/BI,KAAEA,GAASb,EACXc,EAAmB,OAAZJ,GAAgC,KAAZA,GAAmBA,EAAgBA,EAAN,IAE9D,QAAsBtB,IAAlBuB,EAASxB,MAAuBJ,EAAcO,IAAIqB,EAASxB,MAgB7D4B,OAAOC,OAAOC,EAAGC,qBACdC,SAASC,GAAeA,GAAc,KACtCC,QACEC,GACCA,GACAA,EAAOtB,UACY,SAAlBsB,EAAOvB,QAEY,IAAlBuB,EAAOvB,UAEZwB,SAASD,IACR,IAAIE,EAAaF,EAAOtB,QAAQyB,QAAQ,YAAad,EAAStB,MAG1DmC,EAAWE,SAAS,OACtBF,EAAa,IAAIA,MAGnB,MAAMG,EAAM,GAAGf,OAAcY,KAAcX,IAAOC,IAE9CQ,EAAOtB,QAAQ0B,SAAS,aAC1BnB,EAAMqB,KAAKD,GAEXnB,EAAQoB,KAAKD,EACf,QAxCgE,CACpE,IAAIE,EAAelB,EAAStB,KAGxBwC,EAAaH,SAAS,OACxBG,EAAe,IAAIA,MAGrB,MAAMC,EAAa,GAAGlB,OAAciB,KAAgBhB,IAAOC,IAEvDjC,EAAcS,IAAIqB,EAASxB,MAC7BoB,EAAMqB,KAAKE,GAEXtB,EAAQoB,KAAKE,EAEjB,CA6BA,MAAO,CAAEvB,QAAOC,UAClB"}
1
+ {"version":3,"file":"resolve-server-urls.js","sources":["../../src/helpers/resolve-server-urls.ts"],"sourcesContent":[null],"names":["loopbackHosts","Set","wildcardHosts","async","resolveHostname","optionsHost","host","undefined","name","has","localhostAddr","nodeResult","dnsResult","Promise","all","dns","lookup","verbatim","family","address","getLocalhostAddressIfDiffersFromDNS","resolveServerUrls","server","options","x","Boolean","local","network","isHttps","rawBase","hostname","protocol","port","base","Object","values","os","networkInterfaces","flatMap","nInterface","filter","detail","forEach","resultHost","replace","includes","url","push","hostnameName","addressUrl"],"mappings":"2DAUA,MAAMA,EAAgB,IAAIC,IAAI,CAC5B,YACA,YACA,MACA,4CAGIC,EAAgB,IAAID,IAAI,CAAC,UAAW,KAAM,4CAoBhDE,eAAeC,EAAgBC,GAC7B,IAAIC,EAIFA,OAFkBC,IAAhBF,IAA6C,IAAhBA,EAExB,aACkB,IAAhBA,OAEFE,EAEAF,EAIT,IAAIG,OAAgBD,IAATD,GAAsBJ,EAAcO,IAAIH,GAAQ,YAAcA,EAEzE,GAAa,cAATA,EAAsB,CAExB,MAAMI,QAjCVP,iBACE,MAAOQ,EAAYC,SAAmBC,QAAQC,IAAI,CAChDC,EAAIC,OAAO,aACXD,EAAIC,OAAO,YAAa,CAAEC,UAAU,MAItC,OAFeN,EAAWO,SAAWN,EAAUM,QAAUP,EAAWQ,UAAYP,EAAUO,aAE1EZ,EAAYI,EAAWQ,OACzC,CAyBgCC,GAExBV,IACFF,EAAOE,EAEX,CAEA,MAAO,CAAEJ,OAAME,OACjB,CAaAL,eAAekB,EACbC,EACAC,GAEA,MAAMJ,EAAUG,EAAOH,UAKvB,GAFgB,iBADOK,EAGJL,KAFSM,QAAQD,GAAGL,SAGrC,MAAO,CAAEO,MAAO,GAAIC,QAAS,IAJT,IAACH,EAOvB,MAAMlB,KAAEA,EAAIsB,QAAEA,EAAOC,QAAEA,GAAYN,EAE7BG,EAAkB,GAClBC,EAAoB,GACpBG,QAAiB1B,EAAgBE,GACjCyB,EAAWH,EAAU,QAAU,QAC/BI,KAAEA,GAASb,EACXc,EAAmB,OAAZJ,GAAgC,KAAZA,GAAmBA,EAAgBA,EAAN,IAE9D,QAAsBtB,IAAlBuB,EAASxB,MAAuBJ,EAAcO,IAAIqB,EAASxB,MAgB7D4B,OAAOC,OAAOC,EAAGC,qBACdC,QAASC,GAAeA,GAAc,IACtCC,OACEC,GACCA,GACAA,EAAOtB,UACY,SAAlBsB,EAAOvB,QAEY,IAAlBuB,EAAOvB,SAEZwB,QAASD,IACR,IAAIE,EAAaF,EAAOtB,QAAQyB,QAAQ,YAAad,EAAStB,MAG1DmC,EAAWE,SAAS,OACtBF,EAAa,IAAIA,MAGnB,MAAMG,EAAM,GAAGf,OAAcY,KAAcX,IAAOC,IAE9CQ,EAAOtB,QAAQ0B,SAAS,aAC1BnB,EAAMqB,KAAKD,GAEXnB,EAAQoB,KAAKD,SAvCiD,CACpE,IAAIE,EAAelB,EAAStB,KAGxBwC,EAAaH,SAAS,OACxBG,EAAe,IAAIA,MAGrB,MAAMC,EAAa,GAAGlB,OAAciB,KAAgBhB,IAAOC,IAEvDjC,EAAcS,IAAIqB,EAASxB,MAC7BoB,EAAMqB,KAAKE,GAEXtB,EAAQoB,KAAKE,EAEjB,CA6BA,MAAO,CAAEvB,QAAOC,UAClB"}
@@ -1,8 +1,8 @@
1
- import { StaticHandlerContext } from 'react-router';
1
+ import type { StaticHandlerContext } from 'react-router';
2
2
  /**
3
3
  * Serialize react router errors
4
4
  * @see https://github.com/remix-run/react-router/blob/main/packages/react-router-dom/server.tsx#LL166C1-L188C2
5
5
  * https://github.com/remix-run/react-router/blob/main/LICENSE.md
6
6
  */
7
7
  declare function serializeErrors(errors: StaticHandlerContext['errors']): StaticHandlerContext['errors'];
8
- export { serializeErrors as default };
8
+ export default serializeErrors;
@@ -1 +1 @@
1
- {"version":3,"file":"serialize-errors.js","sources":["../../src/helpers/serialize-errors.ts"],"sourcesContent":["import { isRouteErrorResponse } from 'react-router';\nimport type { StaticHandlerContext } from 'react-router';\n\n/**\n * Serialize react router errors\n * @see https://github.com/remix-run/react-router/blob/main/packages/react-router-dom/server.tsx#LL166C1-L188C2\n * https://github.com/remix-run/react-router/blob/main/LICENSE.md\n */\nfunction serializeErrors(errors: StaticHandlerContext['errors']): StaticHandlerContext['errors'] {\n if (!errors) {\n return null;\n }\n\n const entries = Object.entries(errors);\n const serialized: StaticHandlerContext['errors'] = {};\n for (const [key, val] of entries) {\n // Hey you! If you change this, please change the corresponding logic in\n // deserializeErrors in react-router-dom/index.tsx :)\n if (isRouteErrorResponse(val)) {\n serialized[key] = { ...val, __type: 'RouteErrorResponse' };\n } else if (val instanceof Error) {\n // Do not serialize stack traces from SSR for security reasons\n serialized[key] = {\n message: val.message,\n __type: 'Error',\n };\n } else {\n serialized[key] = val as unknown;\n }\n }\n\n return serialized;\n}\n\nexport default serializeErrors;\n"],"names":["serializeErrors","errors","entries","Object","serialized","key","val","isRouteErrorResponse","__type","Error","message"],"mappings":"oDAQA,SAASA,EAAgBC,GACvB,IAAKA,EACH,OAAO,KAGT,MAAMC,EAAUC,OAAOD,QAAQD,GACzBG,EAA6C,CAAA,EACnD,IAAK,MAAOC,EAAKC,KAAQJ,EAGnBK,EAAqBD,GACvBF,EAAWC,GAAO,IAAKC,EAAKE,OAAQ,sBAC3BF,aAAeG,MAExBL,EAAWC,GAAO,CAChBK,QAASJ,EAAII,QACbF,OAAQ,SAGVJ,EAAWC,GAAOC,EAItB,OAAOF,CACT"}
1
+ {"version":3,"file":"serialize-errors.js","sources":["../../src/helpers/serialize-errors.ts"],"sourcesContent":[null],"names":["serializeErrors","errors","entries","Object","serialized","key","val","isRouteErrorResponse","__type","Error","message"],"mappings":"oDAQA,SAASA,EAAgBC,GACvB,IAAKA,EACH,OAAO,KAGT,MAAMC,EAAUC,OAAOD,QAAQD,GACzBG,EAA6C,CAAA,EACnD,IAAK,MAAOC,EAAKC,KAAQJ,EAGnBK,EAAqBD,GACvBF,EAAWC,GAAO,IAAKC,EAAKE,OAAQ,sBAC3BF,aAAeG,MAExBL,EAAWC,GAAO,CAChBK,QAASJ,EAAII,QACbF,OAAQ,SAGVJ,EAAWC,GAAOC,EAItB,OAAOF,CACT"}
@@ -1,6 +1,6 @@
1
- import { Alias } from 'vite';
1
+ import type { Alias } from 'vite';
2
2
  /**
3
3
  * Set vite aliases
4
4
  */
5
5
  declare const viteAliases: (aliases: [string, string][], root?: string) => Alias[];
6
- export { viteAliases as default };
6
+ export default viteAliases;
@@ -1,2 +1,2 @@
1
- import{fileURLToPath as e,URL as r,pathToFileURL as t}from"node:url";const a=e=>e.replace("./","/").replace(/([^:]\/)\/+/g,"$1"),o=(o,p="")=>o.map((([o,l])=>({find:o,replacement:e(new r(t(`${p}${a(l)}`).toString(),import.meta.url))})));export{o as default};
1
+ import{fileURLToPath as e,URL as r,pathToFileURL as t}from"node:url";const a=e=>e.replace("./","/").replace(/([^:]\/)\/+/g,"$1"),o=(o,p="")=>o.map(([o,l])=>({find:o,replacement:e(new r(t(`${p}${a(l)}`).toString(),import.meta.url))}));export{o as default};
2
2
  //# sourceMappingURL=vite-aliases.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"vite-aliases.js","sources":["../../src/helpers/vite-aliases.ts"],"sourcesContent":["import { fileURLToPath, pathToFileURL, URL } from 'node:url';\nimport type { Alias } from 'vite';\n\nconst cleanupPath = (path: string) => path.replace('./', '/').replace(/([^:]\\/)\\/+/g, '$1');\n\n/**\n * Set vite aliases\n */\nconst viteAliases = (aliases: [string, string][], root = ''): Alias[] =>\n aliases.map(([find, path]) => ({\n find,\n replacement: fileURLToPath(\n new URL(pathToFileURL(`${root}${cleanupPath(path)}`).toString(), import.meta.url),\n ),\n }));\n\nexport default viteAliases;\n"],"names":["cleanupPath","path","replace","viteAliases","aliases","root","map","find","replacement","fileURLToPath","URL","pathToFileURL","toString","url"],"mappings":"qEAGA,MAAMA,EAAeC,GAAiBA,EAAKC,QAAQ,KAAM,KAAKA,QAAQ,eAAgB,MAKhFC,EAAc,CAACC,EAA6BC,EAAO,KACvDD,EAAQE,KAAI,EAAEC,EAAMN,MAAK,CACvBM,OACAC,YAAaC,EACX,IAAIC,EAAIC,EAAc,GAAGN,IAAOL,EAAYC,MAASW,uBAAwBC"}
1
+ {"version":3,"file":"vite-aliases.js","sources":["../../src/helpers/vite-aliases.ts"],"sourcesContent":[null],"names":["cleanupPath","path","replace","viteAliases","aliases","root","map","find","replacement","fileURLToPath","URL","pathToFileURL","toString","url"],"mappings":"qEAGA,MAAMA,EAAeC,GAAiBA,EAAKC,QAAQ,KAAM,KAAKA,QAAQ,eAAgB,MAKhFC,EAAc,CAACC,EAA6BC,EAAO,KACvDD,EAAQE,IAAI,EAAEC,EAAMN,MAAK,CACvBM,OACAC,YAAaC,EACX,IAAIC,EAAIC,EAAc,GAAGN,IAAOL,EAAYC,MAASW,uBAAwBC"}
@@ -1,7 +1,7 @@
1
- import { FC, PropsWithChildren } from 'react';
2
- import { RouteObject } from 'react-router';
3
- import { IRequestContext } from "../adapters/express/render.js";
4
- import { FCC } from "./fc.js";
1
+ import type { FC, PropsWithChildren } from 'react';
2
+ import type { RouteObject } from 'react-router';
3
+ import type { IRequestContext } from '../adapters/express/render.js';
4
+ import type { FCC } from './fc.js';
5
5
  declare module 'react-router' {
6
6
  interface LoaderFunctionArgs {
7
7
  context?: IRequestContext;
@@ -1 +1 @@
1
- {"version":3,"file":"fc-route.js","sources":["../../src/interfaces/fc-route.ts"],"sourcesContent":["import type { FC, PropsWithChildren } from 'react';\nimport type { RouteObject } from 'react-router';\nimport type { IRequestContext } from '@adapters/express/render';\nimport type { FCC } from '@interfaces/fc';\n\ndeclare module 'react-router' {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n export interface LoaderFunctionArgs {\n context?: IRequestContext;\n }\n\n // eslint-disable-next-line @typescript-eslint/naming-convention\n export interface ActionFunctionArgs {\n context?: IRequestContext;\n }\n}\n\nconst keys = ['loader', 'action', 'ErrorBoundary', 'errorElement'] as const;\n\ntype IRouteParams = Pick<RouteObject, (typeof keys)[number]> & {\n Suspense?: FCC<Record<string, any>>;\n};\n\ntype FCRoute<TProps = Record<string, any>> = FC<TProps> & IRouteParams;\ntype FCCRoute<TProps = Record<string, any>> = FC<PropsWithChildren<TProps>> & IRouteParams;\n\nexport type { FCRoute, FCCRoute, IRouteParams };\n\nexport { keys };\n"],"names":["keys"],"mappings":"AAiBA,MAAMA,EAAO,CAAC,SAAU,SAAU,gBAAiB"}
1
+ {"version":3,"file":"fc-route.js","sources":["../../src/interfaces/fc-route.ts"],"sourcesContent":[null],"names":["keys"],"mappings":"AAiBA,MAAMA,EAAO,CAAC,SAAU,SAAU,gBAAiB"}
@@ -1,4 +1,3 @@
1
- import { FC, PropsWithChildren } from 'react';
2
- type FCC<T extends Record<string, any>> = FC<PropsWithChildren<T>>;
3
- type FCAny<T extends Record<string, any>> = FC<T> | FCC<T>;
4
- export { FCC, FCAny };
1
+ import type { FC, PropsWithChildren } from 'react';
2
+ export type FCC<T extends Record<string, any>> = FC<PropsWithChildren<T>>;
3
+ export type FCAny<T extends Record<string, any>> = FC<T> | FCC<T>;
@@ -1,13 +1,13 @@
1
- import { RouteObject, LazyRouteFunction, RouterInit } from 'react-router';
2
- import { IDynamicRoute } from "../helpers/import-route.js";
1
+ import type { RouteObject, LazyRouteFunction, RouterInit } from 'react-router';
2
+ import type { IDynamicRoute } from '../helpers/import-route.js';
3
3
  type LazyRoute = LazyRouteFunction<RouterInit['routes'][number]>;
4
- type TOnlyClientProp = RouteObject['Component'] | RouteObject['element'];
5
- type TRouteObjectNR = Omit<RouteObject, 'lazy' | 'children'> & {
4
+ export type TOnlyClientProp = RouteObject['Component'] | RouteObject['element'];
5
+ export type TRouteObjectNR = Omit<RouteObject, 'lazy' | 'children'> & {
6
6
  lazy?: IDynamicRoute | LazyRoute;
7
7
  onlyClient?: TOnlyClientProp;
8
8
  children?: TRouteObject[];
9
9
  };
10
- type TRouteObject = (Omit<RouteObject, 'lazy'> & {
10
+ export type TRouteObject = (Omit<RouteObject, 'lazy'> & {
11
11
  lazy: LazyRoute;
12
12
  }) | TRouteObjectNR;
13
- export { TOnlyClientProp, TRouteObjectNR, TRouteObject };
13
+ export {};
@@ -1,6 +1,6 @@
1
- import { TCompression } from "../adapters/compression.js";
1
+ import type { TCompression } from '../adapters/compression.js';
2
2
  /**
3
3
  * Flush each compressed chunk so browsers can render the shell while React is suspended.
4
4
  */
5
5
  declare const compressNodeResponse: (request: Request, response: Response, compression?: TCompression) => Response;
6
- export { compressNodeResponse as default };
6
+ export default compressNodeResponse;
@@ -1,2 +1,2 @@
1
- import{Writable as e,Readable as r}from"node:stream";import{constants as t,createGzip as a,createDeflate as o}from"node:zlib";import s from"../adapters/compression.js";const i=(i,m,b)=>s(i,m,b,(s=>{const i=("gzip"===s?a:o)({flush:t.Z_SYNC_FLUSH});return{readable:r.toWeb(i,{strategy:{highWaterMark:i.readableHighWaterMark,size:e=>e.byteLength}}),writable:e.toWeb(i)}}));export{i as default};
1
+ import{Writable as e,Readable as r}from"node:stream";import{constants as t,createGzip as a,createDeflate as o}from"node:zlib";import s from"../adapters/compression.js";const i=(i,m,b)=>s(i,m,b,s=>{const i=("gzip"===s?a:o)({flush:t.Z_SYNC_FLUSH});return{readable:r.toWeb(i,{strategy:{highWaterMark:i.readableHighWaterMark,size:e=>e.byteLength}}),writable:e.toWeb(i)}});export{i as default};
2
2
  //# sourceMappingURL=compress-response.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"compress-response.js","sources":["../../src/node/compress-response.ts"],"sourcesContent":["import { Readable, Writable } from 'node:stream';\nimport { constants, createDeflate, createGzip } from 'node:zlib';\nimport compressResponse from '@adapters/compression';\nimport type { TCompression } from '@adapters/compression';\n\n/**\n * Flush each compressed chunk so browsers can render the shell while React is suspended.\n */\nconst compressNodeResponse = (\n request: Request,\n response: Response,\n compression?: TCompression,\n): Response =>\n compressResponse(request, response, compression, (format) => {\n const create = format === 'gzip' ? createGzip : createDeflate;\n const stream = create({ flush: constants.Z_SYNC_FLUSH });\n\n return {\n readable: Readable.toWeb(stream, {\n strategy: {\n highWaterMark: stream.readableHighWaterMark,\n size: (chunk: Uint8Array) => chunk.byteLength,\n },\n }),\n writable: Writable.toWeb(stream),\n } as ReadableWritablePair<Uint8Array, Uint8Array>;\n });\n\nexport default compressNodeResponse;\n"],"names":["compressNodeResponse","request","response","compression","compressResponse","format","stream","createGzip","createDeflate","flush","constants","Z_SYNC_FLUSH","readable","Readable","toWeb","strategy","highWaterMark","readableHighWaterMark","size","chunk","byteLength","writable","Writable"],"mappings":"wKAQA,MAAMA,EAAuB,CAC3BC,EACAC,EACAC,IAEAC,EAAiBH,EAASC,EAAUC,GAAcE,IAChD,MACMC,GADoB,SAAXD,EAAoBE,EAAaC,GAC1B,CAAEC,MAAOC,EAAUC,eAEzC,MAAO,CACLC,SAAUC,EAASC,MAAMR,EAAQ,CAC/BS,SAAU,CACRC,cAAeV,EAAOW,sBACtBC,KAAOC,GAAsBA,EAAMC,cAGvCC,SAAUC,EAASR,MAAMR,GACsB"}
1
+ {"version":3,"file":"compress-response.js","sources":["../../src/node/compress-response.ts"],"sourcesContent":[null],"names":["compressNodeResponse","request","response","compression","compressResponse","format","stream","createGzip","createDeflate","flush","constants","Z_SYNC_FLUSH","readable","Readable","toWeb","strategy","highWaterMark","readableHighWaterMark","size","chunk","byteLength","writable","Writable"],"mappings":"wKAQA,MAAMA,EAAuB,CAC3BC,EACAC,EACAC,IAEAC,EAAiBH,EAASC,EAAUC,EAAcE,IAChD,MACMC,GADoB,SAAXD,EAAoBE,EAAaC,GAC1B,CAAEC,MAAOC,EAAUC,eAEzC,MAAO,CACLC,SAAUC,EAASC,MAAMR,EAAQ,CAC/BS,SAAU,CACRC,cAAeV,EAAOW,sBACtBC,KAAOC,GAAsBA,EAAMC,cAGvCC,SAAUC,EAASR,MAAMR"}
@@ -3,4 +3,4 @@ type TNodeHeaders = Record<string, string | string[] | number | undefined>;
3
3
  * Convert Node headers to Fetch headers, excluding HTTP/2 pseudo-headers.
4
4
  */
5
5
  declare const createHeaders: (values: TNodeHeaders) => Headers;
6
- export { createHeaders as default };
6
+ export default createHeaders;
@@ -1 +1 @@
1
- {"version":3,"file":"create-headers.js","sources":["../../src/node/create-headers.ts"],"sourcesContent":["type TNodeHeaders = Record<string, string | string[] | number | undefined>;\n\n/**\n * Convert Node headers to Fetch headers, excluding HTTP/2 pseudo-headers.\n */\nconst createHeaders = (values: TNodeHeaders): Headers => {\n const headers = new Headers();\n\n for (const [name, value] of Object.entries(values)) {\n if (name.startsWith(':') || value === undefined) {\n continue;\n }\n\n if (Array.isArray(value)) {\n for (const item of value) {\n headers.append(name, item);\n }\n } else {\n headers.set(name, typeof value === 'number' ? String(value) : value);\n }\n }\n\n return headers;\n};\n\nexport default createHeaders;\n"],"names":["createHeaders","values","headers","Headers","name","value","Object","entries","startsWith","undefined","Array","isArray","item","append","set","String"],"mappings":"AAKA,MAAMA,EAAiBC,IACrB,MAAMC,EAAU,IAAIC,QAEpB,IAAK,MAAOC,EAAMC,KAAUC,OAAOC,QAAQN,GACzC,IAAIG,EAAKI,WAAW,WAAkBC,IAAVJ,EAI5B,GAAIK,MAAMC,QAAQN,GAChB,IAAK,MAAMO,KAAQP,EACjBH,EAAQW,OAAOT,EAAMQ,QAGvBV,EAAQY,IAAIV,EAAuB,iBAAVC,EAAqBU,OAAOV,GAASA,GAIlE,OAAOH,CAAO"}
1
+ {"version":3,"file":"create-headers.js","sources":["../../src/node/create-headers.ts"],"sourcesContent":[null],"names":["createHeaders","values","headers","Headers","name","value","Object","entries","startsWith","undefined","Array","isArray","item","append","set","String"],"mappings":"AAKA,MAAMA,EAAiBC,IACrB,MAAMC,EAAU,IAAIC,QAEpB,IAAK,MAAOC,EAAMC,KAAUC,OAAOC,QAAQN,GACzC,IAAIG,EAAKI,WAAW,WAAkBC,IAAVJ,EAI5B,GAAIK,MAAMC,QAAQN,GAChB,IAAK,MAAMO,KAAQP,EACjBH,EAAQW,OAAOT,EAAMQ,QAGvBV,EAAQY,IAAIV,EAAuB,iBAAVC,EAAqBU,OAAOV,GAASA,GAIlE,OAAOH"}
@@ -1,4 +1,4 @@
1
- import { TIncomingMessage } from "./http.js";
1
+ import type { TIncomingMessage } from './http.js';
2
2
  interface ICreateRequestOptions {
3
3
  body?: BodyInit | null;
4
4
  origin?: string;
@@ -10,4 +10,4 @@ interface ICreateRequestOptions {
10
10
  */
11
11
  declare const createRequest: (req: TIncomingMessage, options?: ICreateRequestOptions) => Request;
12
12
  export type { ICreateRequestOptions };
13
- export { createRequest as default };
13
+ export default createRequest;
@@ -1 +1 @@
1
- {"version":3,"file":"create-request.js","sources":["../../src/node/create-request.ts"],"sourcesContent":["import createHeaders from '@node/create-headers';\nimport type { TIncomingMessage } from '@node/http';\n\ninterface ICreateRequestOptions {\n body?: BodyInit | null;\n origin?: string;\n signal?: AbortSignal;\n url?: string;\n}\n\n/**\n * Preserve the Node request URL, body and cancellation signal for Fetch handlers.\n */\nconst createRequest = (req: TIncomingMessage, options: ICreateRequestOptions = {}): Request => {\n const { body, origin, signal } = options;\n const headers = createHeaders(req.headers);\n const protocol =\n req.socket && 'encrypted' in req.socket && req.socket.encrypted ? 'https' : 'http';\n const authority = req.headers[':authority'];\n const host = headers.get('host') ?? (typeof authority === 'string' ? authority : null);\n const requestOrigin = new URL(origin ?? `${protocol}://${host}`).origin;\n const target = options.url ?? req.url ?? '/';\n\n /**\n * An origin-form target beginning with // is a path, not a replacement hostname.\n */\n const url = new URL(target.startsWith('/') ? requestOrigin + target : target, requestOrigin);\n const init: RequestInit & { duplex?: 'half' } = {\n headers,\n method: req.method,\n signal,\n };\n\n if (req.method !== 'GET' && req.method !== 'HEAD') {\n if ('body' in options) {\n headers.delete('Content-Length');\n\n if (body instanceof FormData) {\n /**\n * Fetch must generate the boundary for a newly serialized multipart body.\n */\n headers.delete('Content-Type');\n }\n\n init.body = body;\n } else {\n init.body = req as unknown as BodyInit;\n }\n\n init.duplex = 'half';\n }\n\n return new Request(url, init);\n};\n\nexport type { ICreateRequestOptions };\n\nexport default createRequest;\n"],"names":["createRequest","req","options","body","origin","signal","headers","createHeaders","protocol","socket","encrypted","authority","host","get","requestOrigin","URL","target","url","startsWith","init","method","delete","FormData","duplex","Request"],"mappings":"mCAaA,MAAMA,EAAgB,CAACC,EAAuBC,EAAiC,MAC7E,MAAMC,KAAEA,EAAIC,OAAEA,EAAMC,OAAEA,GAAWH,EAC3BI,EAAUC,EAAcN,EAAIK,SAC5BE,EACJP,EAAIQ,QAAU,cAAeR,EAAIQ,QAAUR,EAAIQ,OAAOC,UAAY,QAAU,OACxEC,EAAYV,EAAIK,QAAQ,cACxBM,EAAON,EAAQO,IAAI,UAAiC,iBAAdF,EAAyBA,EAAY,MAC3EG,EAAgB,IAAIC,IAAIX,GAAU,GAAGI,OAAcI,KAAQR,OAC3DY,EAASd,EAAQe,KAAOhB,EAAIgB,KAAO,IAKnCA,EAAM,IAAIF,IAAIC,EAAOE,WAAW,KAAOJ,EAAgBE,EAASA,EAAQF,GACxEK,EAA0C,CAC9Cb,UACAc,OAAQnB,EAAImB,OACZf,UAsBF,MAnBmB,QAAfJ,EAAImB,QAAmC,SAAfnB,EAAImB,SAC1B,SAAUlB,GACZI,EAAQe,OAAO,kBAEXlB,aAAgBmB,UAIlBhB,EAAQe,OAAO,gBAGjBF,EAAKhB,KAAOA,GAEZgB,EAAKhB,KAAOF,EAGdkB,EAAKI,OAAS,QAGT,IAAIC,QAAQP,EAAKE,EAAK"}
1
+ {"version":3,"file":"create-request.js","sources":["../../src/node/create-request.ts"],"sourcesContent":[null],"names":["createRequest","req","options","body","origin","signal","headers","createHeaders","protocol","socket","encrypted","authority","host","get","requestOrigin","URL","target","url","startsWith","init","method","delete","FormData","duplex","Request"],"mappings":"mCAaA,MAAMA,EAAgB,CAACC,EAAuBC,EAAiC,MAC7E,MAAMC,KAAEA,EAAIC,OAAEA,EAAMC,OAAEA,GAAWH,EAC3BI,EAAUC,EAAcN,EAAIK,SAC5BE,EACJP,EAAIQ,QAAU,cAAeR,EAAIQ,QAAUR,EAAIQ,OAAOC,UAAY,QAAU,OACxEC,EAAYV,EAAIK,QAAQ,cACxBM,EAAON,EAAQO,IAAI,UAAiC,iBAAdF,EAAyBA,EAAY,MAC3EG,EAAgB,IAAIC,IAAIX,GAAU,GAAGI,OAAcI,KAAQR,OAC3DY,EAASd,EAAQe,KAAOhB,EAAIgB,KAAO,IAKnCA,EAAM,IAAIF,IAAIC,EAAOE,WAAW,KAAOJ,EAAgBE,EAASA,EAAQF,GACxEK,EAA0C,CAC9Cb,UACAc,OAAQnB,EAAImB,OACZf,UAsBF,MAnBmB,QAAfJ,EAAImB,QAAmC,SAAfnB,EAAImB,SAC1B,SAAUlB,GACZI,EAAQe,OAAO,kBAEXlB,aAAgBmB,UAIlBhB,EAAQe,OAAO,gBAGjBF,EAAKhB,KAAOA,GAEZgB,EAAKhB,KAAOF,EAGdkB,EAAKI,OAAS,QAGT,IAAIC,QAAQP,EAAKE"}
package/node/http.d.ts CHANGED
@@ -1,6 +1,4 @@
1
- /// <reference types="node" />
2
- import { IncomingMessage, ServerResponse } from 'node:http';
3
- import { Http2ServerRequest, Http2ServerResponse } from 'node:http2';
4
- type TIncomingMessage = IncomingMessage | Http2ServerRequest;
5
- type TServerResponse = ServerResponse | Http2ServerResponse;
6
- export { TIncomingMessage, TServerResponse };
1
+ import type { IncomingMessage, ServerResponse } from 'node:http';
2
+ import type { Http2ServerRequest, Http2ServerResponse } from 'node:http2';
3
+ export type TIncomingMessage = IncomingMessage | Http2ServerRequest;
4
+ export type TServerResponse = ServerResponse | Http2ServerResponse;
@@ -1,6 +1,6 @@
1
- import { TRenderToStream } from "../core/render.js";
1
+ import type { TRenderToStream } from '../core/render.js';
2
2
  /**
3
3
  * Adapt React pipeable rendering to Fetch streams with byte-based backpressure.
4
4
  */
5
5
  declare const renderToStream: TRenderToStream;
6
- export { renderToStream as default };
6
+ export default renderToStream;
@@ -1,2 +1,2 @@
1
- import{PassThrough as r,Readable as e}from"node:stream";import{renderToPipeableStream as t}from"react-dom/server";const o=(o,n)=>{const a=new r,s=e.toWeb(a,{strategy:{highWaterMark:a.readableHighWaterMark,size:r=>r.byteLength}});let i,l,c,d;const g=new Promise(((r,e)=>{i=e,c=r})),h=new Promise(((r,e)=>{l=e,d=r}));g.catch((()=>{})),h.catch((()=>{}));let m=!1,b=!1;const E=t(o,{onAllReady:c,onError:n.onError,onShellError:r=>{const e=r instanceof Error?r:new Error(String(r));m=!0,i(e),l(e)},onShellReady:()=>{m=!0,d()}}),f=r=>{if(!b){if(b=!0,!m){m=!0;const e=r instanceof Error?r:new Error("string"==typeof r?r:"Render aborted");l(e),i(e)}E.abort(r)}},y=()=>f(n.signal.reason),p=()=>n.signal.removeEventListener("abort",y);n.signal.aborted?y():n.signal.addEventListener("abort",y,{once:!0}),g.then(p,p);let w=!1;return{allReady:g,abort:f,shellReady:h,start:()=>{w||(w=!0,E.pipe(a))},stream:s}};export{o as default};
1
+ import{PassThrough as r,Readable as e}from"node:stream";import{renderToPipeableStream as t}from"react-dom/server";const o=(o,n)=>{const a=new r,s=e.toWeb(a,{strategy:{highWaterMark:a.readableHighWaterMark,size:r=>r.byteLength}});let i,l,c,d;const g=new Promise((r,e)=>{i=e,c=r}),h=new Promise((r,e)=>{l=e,d=r});g.catch(()=>{}),h.catch(()=>{});let m=!1,b=!1;const E=t(o,{onAllReady:c,onError:n.onError,onShellError:r=>{const e=r instanceof Error?r:new Error(String(r));m=!0,i(e),l(e)},onShellReady:()=>{m=!0,d()}}),f=r=>{if(!b){if(b=!0,!m){m=!0;const e=r instanceof Error?r:new Error("string"==typeof r?r:"Render aborted");l(e),i(e)}E.abort(r)}},y=()=>f(n.signal.reason),p=()=>n.signal.removeEventListener("abort",y);n.signal.aborted?y():n.signal.addEventListener("abort",y,{once:!0}),g.then(p,p);let w=!1;return{allReady:g,abort:f,shellReady:h,start:()=>{w||(w=!0,E.pipe(a))},stream:s}};export{o as default};
2
2
  //# sourceMappingURL=render-to-stream.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"render-to-stream.js","sources":["../../src/node/render-to-stream.ts"],"sourcesContent":["import { PassThrough, Readable } from 'node:stream';\nimport { renderToPipeableStream } from 'react-dom/server';\nimport type { TRenderToStream } from '@core/render';\n\n/**\n * Adapt React pipeable rendering to Fetch streams with byte-based backpressure.\n */\nconst renderToStream: TRenderToStream = (node, options) => {\n const destination = new PassThrough();\n const stream = Readable.toWeb(destination, {\n strategy: {\n highWaterMark: destination.readableHighWaterMark,\n\n /**\n * Measure queued data in bytes, matching the Node stream high-water mark.\n */\n size: (chunk: Uint8Array) => chunk.byteLength,\n },\n }) as ReadableStream<Uint8Array>;\n let rejectAll!: (error: Error) => void;\n let rejectShell!: (error: Error) => void;\n let resolveAll!: () => void;\n let resolveShell!: () => void;\n\n /**\n * Track completion independently from the first available shell.\n */\n const allReady = new Promise<void>((resolve, reject) => {\n rejectAll = reject;\n resolveAll = resolve;\n });\n\n /**\n * Let the core wait for the shell without waiting for suspended content.\n */\n const shellReady = new Promise<void>((resolve, reject) => {\n rejectShell = reject;\n resolveShell = resolve;\n });\n\n void allReady.catch(() => undefined);\n void shellReady.catch(() => undefined);\n\n let hasShellSettled = false;\n let hasAborted = false;\n const rendered = renderToPipeableStream(node, {\n onAllReady: resolveAll,\n onError: options.onError,\n\n /**\n * Reject both readiness promises when React cannot create a shell.\n */\n onShellError: (error) => {\n const shellError = error instanceof Error ? error : new Error(String(error));\n\n hasShellSettled = true;\n rejectAll(shellError);\n rejectShell(shellError);\n },\n\n /**\n * Allow the core to commit headers once the shell is ready.\n */\n onShellReady: () => {\n hasShellSettled = true;\n resolveShell();\n },\n });\n\n /**\n * Settle pending React 18 readiness promises before aborting the renderer.\n */\n const abort = (reason?: unknown): void => {\n if (hasAborted) {\n return;\n }\n\n hasAborted = true;\n\n /**\n * React 18 may omit shell callbacks when the root task is aborted.\n */\n if (!hasShellSettled) {\n hasShellSettled = true;\n const message = typeof reason === 'string' ? reason : 'Render aborted';\n const error = reason instanceof Error ? reason : new Error(message);\n\n rejectShell(error);\n rejectAll(error);\n }\n\n rendered.abort(reason);\n };\n\n /**\n * Forward the transport cancellation reason to React.\n */\n const onAbort = (): void => abort(options.signal.reason);\n\n /**\n * Detach the transport signal after React settles.\n */\n const cleanup = (): void => options.signal.removeEventListener('abort', onAbort);\n\n if (options.signal.aborted) {\n onAbort();\n } else {\n options.signal.addEventListener('abort', onAbort, { once: true });\n }\n\n void allReady.then(cleanup, cleanup);\n let hasStarted = false;\n\n return {\n allReady,\n abort,\n shellReady,\n\n /**\n * Pipe only after the core has finalized response headers and hooks.\n */\n start: () => {\n if (!hasStarted) {\n hasStarted = true;\n rendered.pipe(destination);\n }\n },\n stream,\n };\n};\n\nexport default renderToStream;\n"],"names":["renderToStream","node","options","destination","PassThrough","stream","Readable","toWeb","strategy","highWaterMark","readableHighWaterMark","size","chunk","byteLength","rejectAll","rejectShell","resolveAll","resolveShell","allReady","Promise","resolve","reject","shellReady","catch","hasShellSettled","hasAborted","rendered","renderToPipeableStream","onAllReady","onError","onShellError","error","shellError","Error","String","onShellReady","abort","reason","onAbort","signal","cleanup","removeEventListener","aborted","addEventListener","once","then","hasStarted","start","pipe"],"mappings":"kHAOA,MAAMA,EAAkC,CAACC,EAAMC,KAC7C,MAAMC,EAAc,IAAIC,EAClBC,EAASC,EAASC,MAAMJ,EAAa,CACzCK,SAAU,CACRC,cAAeN,EAAYO,sBAK3BC,KAAOC,GAAsBA,EAAMC,cAGvC,IAAIC,EACAC,EACAC,EACAC,EAKJ,MAAMC,EAAW,IAAIC,SAAc,CAACC,EAASC,KAC3CP,EAAYO,EACZL,EAAaI,CAAO,IAMhBE,EAAa,IAAIH,SAAc,CAACC,EAASC,KAC7CN,EAAcM,EACdJ,EAAeG,CAAO,IAGnBF,EAASK,OAAM,KAAe,IAC9BD,EAAWC,OAAM,KAAe,IAErC,IAAIC,GAAkB,EAClBC,GAAa,EACjB,MAAMC,EAAWC,EAAuB1B,EAAM,CAC5C2B,WAAYZ,EACZa,QAAS3B,EAAQ2B,QAKjBC,aAAeC,IACb,MAAMC,EAAaD,aAAiBE,MAAQF,EAAQ,IAAIE,MAAMC,OAAOH,IAErEP,GAAkB,EAClBV,EAAUkB,GACVjB,EAAYiB,EAAW,EAMzBG,aAAc,KACZX,GAAkB,EAClBP,GAAc,IAOZmB,EAASC,IACb,IAAIZ,EAAJ,CASA,GALAA,GAAa,GAKRD,EAAiB,CACpBA,GAAkB,EAClB,MACMO,EAAQM,aAAkBJ,MAAQI,EAAS,IAAIJ,MADnB,iBAAXI,EAAsBA,EAAS,kBAGtDtB,EAAYgB,GACZjB,EAAUiB,EACZ,CAEAL,EAASU,MAAMC,EAhBf,CAgBsB,EAMlBC,EAAU,IAAYF,EAAMlC,EAAQqC,OAAOF,QAK3CG,EAAU,IAAYtC,EAAQqC,OAAOE,oBAAoB,QAASH,GAEpEpC,EAAQqC,OAAOG,QACjBJ,IAEApC,EAAQqC,OAAOI,iBAAiB,QAASL,EAAS,CAAEM,MAAM,IAGvD1B,EAAS2B,KAAKL,EAASA,GAC5B,IAAIM,GAAa,EAEjB,MAAO,CACL5B,WACAkB,QACAd,aAKAyB,MAAO,KACAD,IACHA,GAAa,EACbpB,EAASsB,KAAK7C,GAChB,EAEFE,SACD"}
1
+ {"version":3,"file":"render-to-stream.js","sources":["../../src/node/render-to-stream.ts"],"sourcesContent":[null],"names":["renderToStream","node","options","destination","PassThrough","stream","Readable","toWeb","strategy","highWaterMark","readableHighWaterMark","size","chunk","byteLength","rejectAll","rejectShell","resolveAll","resolveShell","allReady","Promise","resolve","reject","shellReady","catch","hasShellSettled","hasAborted","rendered","renderToPipeableStream","onAllReady","onError","onShellError","error","shellError","Error","String","onShellReady","abort","reason","onAbort","signal","cleanup","removeEventListener","aborted","addEventListener","once","then","hasStarted","start","pipe"],"mappings":"kHAOA,MAAMA,EAAkC,CAACC,EAAMC,KAC7C,MAAMC,EAAc,IAAIC,EAClBC,EAASC,EAASC,MAAMJ,EAAa,CACzCK,SAAU,CACRC,cAAeN,EAAYO,sBAK3BC,KAAOC,GAAsBA,EAAMC,cAGvC,IAAIC,EACAC,EACAC,EACAC,EAKJ,MAAMC,EAAW,IAAIC,QAAc,CAACC,EAASC,KAC3CP,EAAYO,EACZL,EAAaI,IAMTE,EAAa,IAAIH,QAAc,CAACC,EAASC,KAC7CN,EAAcM,EACdJ,EAAeG,IAGZF,EAASK,MAAM,QACfD,EAAWC,MAAM,QAEtB,IAAIC,GAAkB,EAClBC,GAAa,EACjB,MAAMC,EAAWC,EAAuB1B,EAAM,CAC5C2B,WAAYZ,EACZa,QAAS3B,EAAQ2B,QAKjBC,aAAeC,IACb,MAAMC,EAAaD,aAAiBE,MAAQF,EAAQ,IAAIE,MAAMC,OAAOH,IAErEP,GAAkB,EAClBV,EAAUkB,GACVjB,EAAYiB,IAMdG,aAAc,KACZX,GAAkB,EAClBP,OAOEmB,EAASC,IACb,IAAIZ,EAAJ,CASA,GALAA,GAAa,GAKRD,EAAiB,CACpBA,GAAkB,EAClB,MACMO,EAAQM,aAAkBJ,MAAQI,EAAS,IAAIJ,MADnB,iBAAXI,EAAsBA,EAAS,kBAGtDtB,EAAYgB,GACZjB,EAAUiB,EACZ,CAEAL,EAASU,MAAMC,EAhBf,GAsBIC,EAAU,IAAYF,EAAMlC,EAAQqC,OAAOF,QAK3CG,EAAU,IAAYtC,EAAQqC,OAAOE,oBAAoB,QAASH,GAEpEpC,EAAQqC,OAAOG,QACjBJ,IAEApC,EAAQqC,OAAOI,iBAAiB,QAASL,EAAS,CAAEM,MAAM,IAGvD1B,EAAS2B,KAAKL,EAASA,GAC5B,IAAIM,GAAa,EAEjB,MAAO,CACL5B,WACAkB,QACAd,aAKAyB,MAAO,KACAD,IACHA,GAAa,EACbpB,EAASsB,KAAK7C,KAGlBE"}