@ecopages/core 0.2.0-beta.1 → 0.2.0-beta.10

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 (216) hide show
  1. package/package.json +107 -3
  2. package/src/adapters/abstract/application-adapter.d.ts +73 -1
  3. package/src/adapters/abstract/application-adapter.js +89 -0
  4. package/src/adapters/abstract/server-adapter.d.ts +3 -0
  5. package/src/adapters/abstract/ws-pattern-matcher.d.ts +60 -0
  6. package/src/adapters/abstract/ws-pattern-matcher.js +61 -0
  7. package/src/adapters/bun/client-bridge.d.ts +1 -0
  8. package/src/adapters/bun/client-bridge.js +3 -0
  9. package/src/adapters/bun/create-app.d.ts +5 -3
  10. package/src/adapters/bun/create-app.js +44 -39
  11. package/src/adapters/bun/hmr-manager.d.ts +2 -1
  12. package/src/adapters/bun/hmr-manager.js +2 -2
  13. package/src/adapters/bun/server-adapter.d.ts +81 -20
  14. package/src/adapters/bun/server-adapter.js +220 -78
  15. package/src/adapters/bun/static-preview-host.js +25 -20
  16. package/src/adapters/create-app.d.ts +13 -0
  17. package/src/adapters/create-app.js +10 -1
  18. package/src/adapters/node/create-app.d.ts +4 -0
  19. package/src/adapters/node/create-app.js +38 -9
  20. package/src/adapters/node/node-client-bridge.d.ts +1 -0
  21. package/src/adapters/node/node-client-bridge.js +3 -0
  22. package/src/adapters/node/node-hmr-manager.d.ts +2 -1
  23. package/src/adapters/node/node-hmr-manager.js +2 -2
  24. package/src/adapters/node/server-adapter-dependencies.js +2 -0
  25. package/src/adapters/node/server-adapter.d.ts +55 -19
  26. package/src/adapters/node/server-adapter.js +140 -132
  27. package/src/adapters/node/static-content-server.d.ts +1 -0
  28. package/src/adapters/node/static-content-server.js +10 -2
  29. package/src/adapters/node/static-preview-host.js +27 -12
  30. package/src/adapters/shared/bun-user-websocket-lifecycle.d.ts +22 -0
  31. package/src/adapters/shared/bun-user-websocket-lifecycle.js +96 -0
  32. package/src/adapters/shared/copy-runtime-public-dir.d.ts +6 -0
  33. package/src/adapters/shared/copy-runtime-public-dir.js +24 -0
  34. package/src/adapters/shared/hmr-html-response.d.ts +1 -1
  35. package/src/adapters/shared/hmr-html-response.js +4 -1
  36. package/src/adapters/shared/node-http-websocket-upgrades.d.ts +21 -0
  37. package/src/adapters/shared/node-http-websocket-upgrades.js +100 -0
  38. package/src/adapters/shared/port-manager.d.ts +116 -0
  39. package/src/adapters/shared/port-manager.js +196 -0
  40. package/src/adapters/shared/runtime-app-bootstrap.d.ts +2 -1
  41. package/src/adapters/shared/runtime-app-bootstrap.js +3 -6
  42. package/src/adapters/shared/runtime-server-lifecycle.d.ts +38 -0
  43. package/src/adapters/shared/runtime-server-lifecycle.js +39 -0
  44. package/src/adapters/shared/server-adapter.d.ts +2 -1
  45. package/src/adapters/shared/server-adapter.js +12 -4
  46. package/src/adapters/shared/server-route-handler.d.ts +4 -1
  47. package/src/adapters/shared/server-route-handler.js +5 -2
  48. package/src/adapters/shared/server-static-builder.d.ts +14 -29
  49. package/src/adapters/shared/server-static-builder.js +91 -70
  50. package/src/adapters/shared/shared-hmr-manager.d.ts +12 -0
  51. package/src/adapters/shared/shared-hmr-manager.js +64 -7
  52. package/src/adapters/shared/static-preview-host.d.ts +5 -0
  53. package/src/adapters/shared/websocket-lifecycle.d.ts +24 -0
  54. package/src/adapters/shared/websocket-lifecycle.js +55 -0
  55. package/src/build/README.md +77 -14
  56. package/src/build/app-build-manifest-runtime.d.ts +10 -0
  57. package/src/build/app-build-manifest-runtime.js +90 -0
  58. package/src/build/build-adapter.d.ts +17 -319
  59. package/src/build/build-adapter.js +28 -94
  60. package/src/build/build-contracts.d.ts +97 -0
  61. package/src/build/build-contracts.js +0 -0
  62. package/src/build/build-input-fingerprint.d.ts +28 -0
  63. package/src/build/build-input-fingerprint.js +31 -0
  64. package/src/build/build-profile-options.d.ts +7 -0
  65. package/src/build/build-profile-options.js +37 -0
  66. package/src/build/build-runtime.d.ts +24 -0
  67. package/src/build/build-runtime.js +65 -0
  68. package/src/build/deduping-build-executor.d.ts +28 -0
  69. package/src/build/deduping-build-executor.js +56 -0
  70. package/src/build/jsx-ownership-plugins.d.ts +24 -0
  71. package/src/build/jsx-ownership-plugins.js +41 -0
  72. package/src/build/pages-unified-graph-build.d.ts +31 -0
  73. package/src/build/pages-unified-graph-build.js +206 -0
  74. package/src/build/parallel-build-executor.d.ts +21 -0
  75. package/src/build/parallel-build-executor.js +52 -0
  76. package/src/build/production-build-cache.d.ts +20 -0
  77. package/src/build/production-build-cache.js +63 -0
  78. package/src/build/rolldown-adapter-helpers.d.ts +3 -6
  79. package/src/build/rolldown-adapter-helpers.js +71 -6
  80. package/src/build/rolldown-build-adapter.d.ts +2 -6
  81. package/src/build/rolldown-build-adapter.js +3 -3
  82. package/src/build/rolldown-build-invocation-metrics.d.ts +12 -0
  83. package/src/build/rolldown-build-invocation-metrics.js +43 -0
  84. package/src/build/rolldown-plugin-bridge.d.ts +15 -1
  85. package/src/build/rolldown-plugin-bridge.js +20 -5
  86. package/src/build/rolldown-source-transform-pass.d.ts +15 -0
  87. package/src/build/rolldown-source-transform-pass.js +58 -0
  88. package/src/build/runtime-build-executor.d.ts +8 -15
  89. package/src/build/runtime-build-executor.js +12 -15
  90. package/src/build/runtime-build-output-normalizer.d.ts +7 -0
  91. package/src/build/runtime-build-output-normalizer.js +94 -2
  92. package/src/build/server-entry-build-cache.d.ts +44 -0
  93. package/src/build/server-entry-build-cache.js +161 -0
  94. package/src/config/config-builder.d.ts +12 -7
  95. package/src/config/config-builder.js +12 -9
  96. package/src/dev/client-bridge-registry.d.ts +5 -0
  97. package/src/dev/client-bridge-registry.js +15 -0
  98. package/src/dev/dev-client-ownership.d.ts +7 -0
  99. package/src/dev/dev-client-ownership.js +6 -0
  100. package/src/dev/host-runtime.d.ts +3 -0
  101. package/src/dev/host-runtime.js +7 -0
  102. package/src/hmr/client/hmr-runtime.js +5 -2
  103. package/src/hmr/strategies/server-rendered-template-hmr-strategy.d.ts +17 -0
  104. package/src/hmr/strategies/server-rendered-template-hmr-strategy.js +29 -0
  105. package/src/integrations/ghtml/ghtml-renderer.d.ts +2 -6
  106. package/src/integrations/ghtml/ghtml-renderer.js +2 -51
  107. package/src/integrations/ghtml/ghtml.plugin.d.ts +3 -16
  108. package/src/integrations/ghtml/ghtml.plugin.js +7 -14
  109. package/src/plugins/define-integration.d.ts +26 -0
  110. package/src/plugins/define-integration.js +19 -0
  111. package/src/plugins/eco-component-meta-plugin.js +5 -8
  112. package/src/plugins/foreign-jsx-override-plugin.js +4 -6
  113. package/src/plugins/integration-plugin.d.ts +19 -9
  114. package/src/plugins/integration-plugin.js +7 -4
  115. package/src/plugins/jsx-import-source.utils.d.ts +8 -0
  116. package/src/plugins/jsx-import-source.utils.js +26 -0
  117. package/src/plugins/processor.d.ts +19 -4
  118. package/src/plugins/processor.js +22 -4
  119. package/src/plugins/source-transform.d.ts +31 -0
  120. package/src/plugins/source-transform.js +23 -1
  121. package/src/route-renderer/GRAPH.md +8 -8
  122. package/src/route-renderer/README.md +30 -28
  123. package/src/route-renderer/orchestration/component-graph-collectors.d.ts +10 -0
  124. package/src/route-renderer/orchestration/component-graph-collectors.js +143 -0
  125. package/src/route-renderer/orchestration/component-graph.d.ts +36 -0
  126. package/src/route-renderer/orchestration/component-graph.js +90 -0
  127. package/src/route-renderer/orchestration/component-render-context.d.ts +3 -10
  128. package/src/route-renderer/orchestration/component-render-context.js +3 -1
  129. package/src/route-renderer/orchestration/declared-ownership-graph.d.ts +1 -18
  130. package/src/route-renderer/orchestration/declared-ownership-graph.js +5 -31
  131. package/src/route-renderer/orchestration/document-shell-render.service.d.ts +54 -0
  132. package/src/route-renderer/orchestration/document-shell-render.service.js +54 -0
  133. package/src/route-renderer/orchestration/foreign-subtree-execution.service.d.ts +59 -29
  134. package/src/route-renderer/orchestration/foreign-subtree-execution.service.js +164 -35
  135. package/src/route-renderer/orchestration/global-injector-assets.service.d.ts +7 -0
  136. package/src/route-renderer/orchestration/global-injector-assets.service.js +32 -0
  137. package/src/route-renderer/orchestration/integration-renderer.d.ts +18 -54
  138. package/src/route-renderer/orchestration/integration-renderer.js +108 -194
  139. package/src/route-renderer/orchestration/integration-route-render-adapter.d.ts +38 -0
  140. package/src/route-renderer/orchestration/integration-route-render-adapter.js +27 -0
  141. package/src/route-renderer/orchestration/ownership-validation.service.d.ts +4 -0
  142. package/src/route-renderer/orchestration/ownership-validation.service.js +11 -1
  143. package/src/route-renderer/orchestration/page-browser-graph-contribution.loader.d.ts +9 -0
  144. package/src/route-renderer/orchestration/page-browser-graph-contribution.loader.js +7 -0
  145. package/src/route-renderer/orchestration/page-browser-graph.service.d.ts +25 -0
  146. package/src/route-renderer/orchestration/page-browser-graph.service.js +174 -0
  147. package/src/route-renderer/orchestration/render-output.utils.d.ts +2 -0
  148. package/src/route-renderer/orchestration/render-output.utils.js +4 -0
  149. package/src/route-renderer/orchestration/route-html-finalization.service.d.ts +17 -0
  150. package/src/route-renderer/orchestration/route-html-finalization.service.js +26 -0
  151. package/src/route-renderer/orchestration/route-prepared-options.builder.d.ts +24 -0
  152. package/src/route-renderer/orchestration/route-prepared-options.builder.js +52 -0
  153. package/src/route-renderer/orchestration/route-prepared-options.utils.d.ts +4 -0
  154. package/src/route-renderer/orchestration/route-prepared-options.utils.js +33 -0
  155. package/src/route-renderer/orchestration/route-render-orchestrator.d.ts +5 -38
  156. package/src/route-renderer/orchestration/route-render-orchestrator.js +51 -459
  157. package/src/route-renderer/orchestration/string-markup-renderer.d.ts +14 -0
  158. package/src/route-renderer/orchestration/string-markup-renderer.js +54 -0
  159. package/src/router/client/navigation-coordinator.d.ts +1 -1
  160. package/src/router/client/navigation-coordinator.js +12 -2
  161. package/src/services/assets/asset-processing-service/browser-runtime-asset.factory.d.ts +1 -0
  162. package/src/services/assets/asset-processing-service/browser-runtime-asset.factory.js +1 -0
  163. package/src/services/assets/asset-processing-service/browser-runtime-entry.factory.d.ts +4 -2
  164. package/src/services/assets/asset-processing-service/browser-runtime-entry.factory.js +27 -7
  165. package/src/services/assets/asset-processing-service/processors/script/file-script.processor.js +32 -14
  166. package/src/services/assets/asset-processing-service/processors/script/node-module-script.processor.js +17 -3
  167. package/src/services/assets/asset-processing-service/processors/stylesheet/content-stylesheet.processor.d.ts +0 -3
  168. package/src/services/assets/asset-processing-service/processors/stylesheet/content-stylesheet.processor.js +2 -31
  169. package/src/services/assets/asset-processing-service/processors/stylesheet/file-stylesheet.processor.d.ts +0 -3
  170. package/src/services/assets/asset-processing-service/processors/stylesheet/file-stylesheet.processor.js +2 -30
  171. package/src/services/assets/asset-processing-service/processors/stylesheet/stylesheet-processor-pipeline.d.ts +2 -0
  172. package/src/services/assets/asset-processing-service/processors/stylesheet/stylesheet-processor-pipeline.js +43 -0
  173. package/src/services/assets/browser-bundle.service.d.ts +3 -1
  174. package/src/services/assets/browser-bundle.service.js +17 -5
  175. package/src/services/html/html-transformer.service.d.ts +1 -1
  176. package/src/services/html/html-transformer.service.js +4 -4
  177. package/src/services/invalidation/development-invalidation.service.d.ts +10 -1
  178. package/src/services/invalidation/development-invalidation.service.js +31 -2
  179. package/src/services/module-loading/README.md +49 -0
  180. package/src/services/module-loading/app-server-module-transpiler.service.js +5 -17
  181. package/src/services/module-loading/page-module-import.service.d.ts +4 -1
  182. package/src/services/module-loading/page-module-import.service.js +61 -41
  183. package/src/services/module-loading/route-module-build-cache-registry.d.ts +24 -0
  184. package/src/services/module-loading/route-module-build-cache-registry.js +37 -0
  185. package/src/services/module-loading/route-module-build-cache.d.ts +4 -0
  186. package/src/services/module-loading/route-module-build-cache.js +38 -0
  187. package/src/services/module-loading/route-module-build-cache.store.d.ts +57 -0
  188. package/src/services/module-loading/route-module-build-cache.store.js +207 -0
  189. package/src/services/module-loading/route-module-build-manifest.d.ts +61 -0
  190. package/src/services/module-loading/route-module-build-manifest.js +116 -0
  191. package/src/services/module-loading/route-module-dependency-hasher.d.ts +81 -0
  192. package/src/services/module-loading/route-module-dependency-hasher.js +121 -0
  193. package/src/services/module-loading/server-module-transpiler.service.js +1 -1
  194. package/src/static-site-generator/README.md +33 -0
  195. package/src/static-site-generator/static-build-invalidation.d.ts +10 -0
  196. package/src/static-site-generator/static-build-invalidation.js +59 -0
  197. package/src/static-site-generator/static-export-context.d.ts +22 -0
  198. package/src/static-site-generator/static-export-context.js +0 -0
  199. package/src/static-site-generator/static-site-generator.d.ts +17 -20
  200. package/src/static-site-generator/static-site-generator.js +188 -85
  201. package/src/types/internal-types.d.ts +12 -9
  202. package/src/types/public-types.d.ts +87 -22
  203. package/src/utils/parse-cli-args.d.ts +1 -0
  204. package/src/utils/parse-cli-args.js +3 -0
  205. package/src/watchers/project-watcher.d.ts +14 -2
  206. package/src/watchers/project-watcher.js +50 -20
  207. package/src/build/rolldown-dev-build-adapter.d.ts +0 -82
  208. package/src/build/rolldown-dev-build-adapter.js +0 -166
  209. package/src/hmr/hmr.postcss.test.e2e.d.ts +0 -1
  210. package/src/hmr/hmr.postcss.test.e2e.js +0 -31
  211. package/src/hmr/hmr.test.e2e.d.ts +0 -1
  212. package/src/hmr/hmr.test.e2e.js +0 -43
  213. package/src/route-renderer/orchestration/ownership-planning.service.d.ts +0 -24
  214. package/src/route-renderer/orchestration/ownership-planning.service.js +0 -63
  215. package/src/route-renderer/orchestration/queued-foreign-subtree-resolution.service.d.ts +0 -91
  216. package/src/route-renderer/orchestration/queued-foreign-subtree-resolution.service.js +0 -170
@@ -4,6 +4,8 @@ import path from "node:path";
4
4
  import { pathToFileURL } from "node:url";
5
5
  const corePackageRequire = createRequire(new URL("../../package.json", import.meta.url));
6
6
  const appDeclaredPackageCache = /* @__PURE__ */ new Map();
7
+ const appWorkspacePackageCache = /* @__PURE__ */ new Map();
8
+ const CORE_RUNTIME_BARE_SPECIFIER_PACKAGES = /* @__PURE__ */ new Set(["ws"]);
7
9
  function tryResolveRuntimeImport(specifier, resolver) {
8
10
  try {
9
11
  return resolver.resolve(specifier);
@@ -14,6 +16,24 @@ function tryResolveRuntimeImport(specifier, resolver) {
14
16
  function isBareRuntimeImport(specifier) {
15
17
  return !specifier.startsWith(".") && !path.isAbsolute(specifier) && !specifier.startsWith("/") && !specifier.startsWith("node:") && !specifier.startsWith("@/") && !specifier.startsWith("~/") && !specifier.startsWith("#") && !specifier.includes(":");
16
18
  }
19
+ function extractPackageNameFromFileUrl(specifier) {
20
+ if (!specifier.startsWith("file://")) {
21
+ return void 0;
22
+ }
23
+ const lastNodeModulesIndex = specifier.lastIndexOf("/node_modules/");
24
+ if (lastNodeModulesIndex === -1) {
25
+ return void 0;
26
+ }
27
+ const afterNodeModules = specifier.slice(lastNodeModulesIndex + "/node_modules/".length);
28
+ const parts = afterNodeModules.split("/");
29
+ if (parts.length === 0) {
30
+ return void 0;
31
+ }
32
+ if (parts[0]?.startsWith("@") && parts.length > 1) {
33
+ return `${parts[0]}/${parts[1]}`;
34
+ }
35
+ return parts[0];
36
+ }
17
37
  function getPackageNameFromSpecifier(specifier) {
18
38
  if (specifier.startsWith("@")) {
19
39
  return specifier.split("/").slice(0, 2).join("/");
@@ -46,14 +66,52 @@ function getDeclaredAppPackages(rootDir) {
46
66
  appDeclaredPackageCache.set(cacheKey, declaredPackages);
47
67
  return declaredPackages;
48
68
  }
69
+ function getWorkspacePackages(rootDir) {
70
+ const cacheKey = path.resolve(rootDir);
71
+ const cached = appWorkspacePackageCache.get(cacheKey);
72
+ if (cached) {
73
+ return cached;
74
+ }
75
+ const packageJsonPath = path.resolve(rootDir, "package.json");
76
+ const workspacePackages = /* @__PURE__ */ new Set();
77
+ try {
78
+ const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf-8"));
79
+ for (const field of ["dependencies", "devDependencies", "peerDependencies", "optionalDependencies"]) {
80
+ const entries = packageJson[field];
81
+ if (!entries || typeof entries !== "object") {
82
+ continue;
83
+ }
84
+ for (const [packageName, version] of Object.entries(entries)) {
85
+ if (typeof version === "string" && version.startsWith("workspace:")) {
86
+ workspacePackages.add(packageName);
87
+ }
88
+ }
89
+ }
90
+ } catch {
91
+ appWorkspacePackageCache.set(cacheKey, workspacePackages);
92
+ return workspacePackages;
93
+ }
94
+ appWorkspacePackageCache.set(cacheKey, workspacePackages);
95
+ return workspacePackages;
96
+ }
97
+ function isWorkspacePackageImport(specifier, rootDir) {
98
+ return getWorkspacePackages(rootDir).has(getPackageNameFromSpecifier(specifier));
99
+ }
49
100
  function isDeclaredAppPackageImport(specifier, rootDir) {
50
101
  return getDeclaredAppPackages(rootDir).has(getPackageNameFromSpecifier(specifier));
51
102
  }
103
+ function isDeclaredInResolutionChain(specifier, rootDir) {
104
+ const packageName = getPackageNameFromSpecifier(specifier);
105
+ if (CORE_RUNTIME_BARE_SPECIFIER_PACKAGES.has(packageName)) {
106
+ return true;
107
+ }
108
+ return isDeclaredAppPackageImport(specifier, rootDir);
109
+ }
52
110
  function rewriteRuntimeImportSpecifier(specifier, quote, rootDir) {
53
111
  if (!isBareRuntimeImport(specifier)) {
54
112
  return void 0;
55
113
  }
56
- if (isDeclaredAppPackageImport(specifier, rootDir)) {
114
+ if (isDeclaredInResolutionChain(specifier, rootDir)) {
57
115
  return void 0;
58
116
  }
59
117
  const resolvedPath = tryResolveRuntimeImport(specifier, corePackageRequire);
@@ -67,6 +125,23 @@ function rewriteRuntimeBuildOutputImports(code, rootDir) {
67
125
  const rewrittenSpecifier = rewriteRuntimeImportSpecifier(specifier, quote, rootDir);
68
126
  return `${prefix}${rewrittenSpecifier ?? `${quote}${specifier}${quote}`}`;
69
127
  };
128
+ const rewriteFileUrl = (prefix, quote, specifier) => {
129
+ const packageName = extractPackageNameFromFileUrl(specifier);
130
+ if (!packageName) {
131
+ return `${prefix}${quote}${specifier}${quote}`;
132
+ }
133
+ if (!isDeclaredInResolutionChain(packageName, rootDir)) {
134
+ return `${prefix}${quote}${specifier}${quote}`;
135
+ }
136
+ const lastNodeModulesIndex = specifier.lastIndexOf("/node_modules/");
137
+ if (lastNodeModulesIndex === -1) {
138
+ return `${prefix}${quote}${specifier}${quote}`;
139
+ }
140
+ const afterNodeModules = specifier.slice(lastNodeModulesIndex + "/node_modules/".length);
141
+ const afterPackage = afterNodeModules.slice(packageName.length);
142
+ const bareSpecifier = packageName + afterPackage;
143
+ return `${prefix}${quote}${bareSpecifier}${quote}`;
144
+ };
70
145
  const withResolvedPackages = code.replace(
71
146
  /(\bfrom\s+)(['"])([^'"\\]+)\2/g,
72
147
  (_match, prefix, quote, specifier) => rewriteSpecifier(prefix, quote, specifier)
@@ -77,7 +152,17 @@ function rewriteRuntimeBuildOutputImports(code, rootDir) {
77
152
  /(\bimport\s*\(\s*)(['"])([^'"\\]+)\2/g,
78
153
  (_match, prefix, quote, specifier) => rewriteSpecifier(prefix, quote, specifier)
79
154
  );
80
- return withResolvedPackages.replace(
155
+ const withBareSpecifiers = withResolvedPackages.replace(
156
+ /(\bfrom\s+)(['"])(file:\/\/[^'"\\]+)\2/g,
157
+ (_match, prefix, quote, specifier) => rewriteFileUrl(prefix, quote, specifier)
158
+ ).replace(
159
+ /(\bimport\s+)(['"])(file:\/\/[^'"\\]+)\2/g,
160
+ (_match, prefix, quote, specifier) => rewriteFileUrl(prefix, quote, specifier)
161
+ ).replace(
162
+ /(\bimport\s*\(\s*)(['"])(file:\/\/[^'"\\]+)\2/g,
163
+ (_match, prefix, quote, specifier) => rewriteFileUrl(prefix, quote, specifier)
164
+ );
165
+ return withBareSpecifiers.replace(
81
166
  /(['"])(@oxc-project\/runtime\/(?:helpers(?:\/esm)?\/[^'"\\]+))\1/g,
82
167
  (match, quote, specifier) => {
83
168
  const resolvedPath = tryResolveRuntimeImport(specifier, corePackageRequire);
@@ -86,6 +171,9 @@ function rewriteRuntimeBuildOutputImports(code, rootDir) {
86
171
  );
87
172
  }
88
173
  function normalizeNodeRuntimeBuildOutputFile(filePath, rootDir) {
174
+ if (process.env.ECOPAGES_LOGGER_DEBUG === "true") {
175
+ console.log(`[normalizeNodeRuntimeBuildOutputFile] Checking ${filePath}`);
176
+ }
89
177
  if (!/\.(?:[cm]?js)$/u.test(filePath)) {
90
178
  return;
91
179
  }
@@ -96,6 +184,9 @@ function normalizeNodeRuntimeBuildOutputFile(filePath, rootDir) {
96
184
  const code = fileSystem.readFileSync(filePath, "utf-8");
97
185
  const rewritten = rewriteRuntimeBuildOutputImports(code, rootDir);
98
186
  if (rewritten !== code) {
187
+ if (process.env.ECOPAGES_LOGGER_DEBUG === "true") {
188
+ console.log(`[normalizeNodeRuntimeBuildOutputFile] Rewriting ${filePath}`);
189
+ }
99
190
  fileSystem.writeFileSync(filePath, rewritten);
100
191
  }
101
192
  }
@@ -106,6 +197,7 @@ function normalizeNodeRuntimeBuildOutputs(outputPaths, rootDir) {
106
197
  }
107
198
  export {
108
199
  isDeclaredAppPackageImport,
200
+ isWorkspacePackageImport,
109
201
  normalizeNodeRuntimeBuildOutputFile,
110
202
  normalizeNodeRuntimeBuildOutputs
111
203
  };
@@ -0,0 +1,44 @@
1
+ import type { BuildResult } from './build-adapter.js';
2
+ import type { EcoPagesAppConfig } from '../types/internal-types.js';
3
+ /** @deprecated Use {@link ROUTE_MODULE_BUILD_CACHE_FILENAME}; both caches share the same manifest filename. */
4
+ export declare const SERVER_ENTRY_BUILD_CACHE_FILENAME = ".build-cache.json";
5
+ export declare const SERVER_BUNDLE_MANIFEST_FILENAME = "manifest.json";
6
+ export interface ServerBundleDeployManifest {
7
+ serverEntry: string;
8
+ distDir: string;
9
+ builtAt: number;
10
+ }
11
+ export interface ServerEntryBuildCacheManifest {
12
+ invalidationVersion: string;
13
+ entryPath: string;
14
+ entryHash: string;
15
+ buildInputsFingerprint: string;
16
+ buildKey: string;
17
+ outputPaths: string[];
18
+ dependencyHashes: Record<string, string>;
19
+ builtAt: number;
20
+ }
21
+ export interface ServerEntryBuildCacheLookup {
22
+ manifest: ServerEntryBuildCacheManifest;
23
+ outputPaths: string[];
24
+ }
25
+ export declare function getServerBundleOutputPaths(appConfig: EcoPagesAppConfig): {
26
+ distDir: string;
27
+ serverOutdir: string;
28
+ serverEntryPath: string;
29
+ manifestPath: string;
30
+ };
31
+ export declare function readServerEntryBuildCacheManifest(appConfig: EcoPagesAppConfig): ServerEntryBuildCacheManifest | undefined;
32
+ export declare function writeServerBundleDeployManifest(appConfig: EcoPagesAppConfig, serverEntryPath: string): void;
33
+ export declare function lookupServerEntryBuildCache(options: {
34
+ appConfig: EcoPagesAppConfig;
35
+ entryPath: string;
36
+ force?: boolean;
37
+ }): ServerEntryBuildCacheLookup | undefined;
38
+ export declare function recordServerEntryBuildCache(options: {
39
+ appConfig: EcoPagesAppConfig;
40
+ entryPath: string;
41
+ buildResult: BuildResult;
42
+ outputPaths: string[];
43
+ }): void;
44
+ export declare function resolveProductionServerEntry(cwd?: string): string | undefined;
@@ -0,0 +1,161 @@
1
+ import path from "node:path";
2
+ import { fileSystem } from "@ecopages/file-system";
3
+ import { getAppServerBuildPlugins } from "./build-adapter.js";
4
+ import { createBuildInputsFingerprint } from "./build-input-fingerprint.js";
5
+ import {
6
+ isProductionCacheManifestCurrent,
7
+ matchesProductionCacheBuildKey,
8
+ matchesProductionCacheFingerprint,
9
+ readProductionCacheManifest,
10
+ writeProductionCacheManifest
11
+ } from "./production-build-cache.js";
12
+ import { getCorePackageVersion } from "../services/module-loading/route-module-build-manifest.js";
13
+ import {
14
+ RouteModuleDependencyHasher,
15
+ createRouteModuleDependencyHashes
16
+ } from "../services/module-loading/route-module-dependency-hasher.js";
17
+ import { resolveInternalExecutionDir } from "../utils/resolve-work-dir.js";
18
+ import { SERVER_BUNDLE_DIR, SERVER_BUNDLE_FILENAME } from "../utils/resolve-entry-file.js";
19
+ import { ROUTE_MODULE_BUILD_CACHE_FILENAME } from "../services/module-loading/route-module-build-manifest.js";
20
+ const SERVER_ENTRY_BUILD_CACHE_FILENAME = ROUTE_MODULE_BUILD_CACHE_FILENAME;
21
+ const SERVER_BUNDLE_MANIFEST_FILENAME = "manifest.json";
22
+ function getServerEntryCacheDir(appConfig) {
23
+ return path.join(resolveInternalExecutionDir(appConfig), ".server-entry");
24
+ }
25
+ function getServerEntryCacheManifestPath(appConfig) {
26
+ return path.join(getServerEntryCacheDir(appConfig), SERVER_ENTRY_BUILD_CACHE_FILENAME);
27
+ }
28
+ function hashDependencyGraph(entryPath, dependencyGraph, hasher, rootDir) {
29
+ if (!dependencyGraph) {
30
+ return { [path.resolve(entryPath)]: fileSystem.hash(entryPath) };
31
+ }
32
+ return createRouteModuleDependencyHashes(hasher, { dependencyGraph }, entryPath, rootDir);
33
+ }
34
+ function createServerEntryBuildKey(appConfig) {
35
+ try {
36
+ const plugins = getAppServerBuildPlugins(appConfig);
37
+ const pluginNames = plugins.map((plugin) => plugin.name).sort().join("|");
38
+ return ["node", "esm", "external-packages", pluginNames].join("::");
39
+ } catch {
40
+ return "node::esm::external-packages";
41
+ }
42
+ }
43
+ function getServerBundleOutputPaths(appConfig) {
44
+ const distDir = appConfig.absolutePaths?.distDir ?? path.join(appConfig.rootDir, appConfig.distDir);
45
+ const serverOutdir = path.join(distDir, SERVER_BUNDLE_DIR);
46
+ const serverEntryPath = path.join(serverOutdir, SERVER_BUNDLE_FILENAME);
47
+ const manifestPath = path.join(serverOutdir, SERVER_BUNDLE_MANIFEST_FILENAME);
48
+ return { distDir, serverOutdir, serverEntryPath, manifestPath };
49
+ }
50
+ function readServerEntryBuildCacheManifest(appConfig) {
51
+ return readProductionCacheManifest(getServerEntryCacheManifestPath(appConfig));
52
+ }
53
+ function writeServerEntryBuildCacheManifest(appConfig, manifest) {
54
+ writeProductionCacheManifest(
55
+ path.join(getServerEntryCacheDir(appConfig), SERVER_ENTRY_BUILD_CACHE_FILENAME),
56
+ manifest
57
+ );
58
+ }
59
+ function writeServerBundleDeployManifest(appConfig, serverEntryPath) {
60
+ const { distDir, manifestPath } = getServerBundleOutputPaths(appConfig);
61
+ fileSystem.ensureDir(path.dirname(manifestPath));
62
+ const payload = {
63
+ serverEntry: path.relative(path.dirname(manifestPath), serverEntryPath) || SERVER_BUNDLE_FILENAME,
64
+ distDir,
65
+ builtAt: Date.now()
66
+ };
67
+ fileSystem.write(manifestPath, `${JSON.stringify(payload, null, " ")}
68
+ `);
69
+ }
70
+ function lookupServerEntryBuildCache(options) {
71
+ if (options.force) {
72
+ return void 0;
73
+ }
74
+ if (process.env.NODE_ENV !== "production") {
75
+ return void 0;
76
+ }
77
+ const entryPath = path.resolve(options.entryPath);
78
+ const entryHash = fileSystem.hash(entryPath);
79
+ const buildInputsFingerprint = createBuildInputsFingerprint(options.appConfig);
80
+ const buildKey = createServerEntryBuildKey(options.appConfig);
81
+ const manifest = readServerEntryBuildCacheManifest(options.appConfig);
82
+ if (!manifest) {
83
+ return void 0;
84
+ }
85
+ if (!isProductionCacheManifestCurrent(manifest, getCorePackageVersion())) {
86
+ return void 0;
87
+ }
88
+ if (manifest.entryPath !== entryPath || manifest.entryHash !== entryHash || !matchesProductionCacheFingerprint(manifest, buildInputsFingerprint) || !matchesProductionCacheBuildKey(manifest, buildKey)) {
89
+ return void 0;
90
+ }
91
+ const hasher = new RouteModuleDependencyHasher();
92
+ if (!hasher.matchesStoredHashes(manifest.dependencyHashes, entryPath, entryHash)) {
93
+ return void 0;
94
+ }
95
+ const existingOutputs = manifest.outputPaths.filter((outputPath) => fileSystem.exists(outputPath));
96
+ if (existingOutputs.length === 0) {
97
+ return void 0;
98
+ }
99
+ return {
100
+ manifest,
101
+ outputPaths: existingOutputs
102
+ };
103
+ }
104
+ function recordServerEntryBuildCache(options) {
105
+ if (process.env.NODE_ENV !== "production") {
106
+ return;
107
+ }
108
+ const entryPath = path.resolve(options.entryPath);
109
+ const entryHash = fileSystem.hash(entryPath);
110
+ const hasher = new RouteModuleDependencyHasher();
111
+ const dependencyHashes = hashDependencyGraph(
112
+ entryPath,
113
+ options.buildResult.dependencyGraph,
114
+ hasher,
115
+ options.appConfig.rootDir
116
+ );
117
+ const manifest = {
118
+ invalidationVersion: getCorePackageVersion(),
119
+ entryPath,
120
+ entryHash,
121
+ buildInputsFingerprint: createBuildInputsFingerprint(options.appConfig),
122
+ buildKey: createServerEntryBuildKey(options.appConfig),
123
+ outputPaths: options.outputPaths,
124
+ dependencyHashes,
125
+ builtAt: Date.now()
126
+ };
127
+ writeServerEntryBuildCacheManifest(options.appConfig, manifest);
128
+ }
129
+ function resolveProductionServerEntry(cwd = process.cwd()) {
130
+ const manifestPath = path.join(cwd, "dist", SERVER_BUNDLE_DIR, SERVER_BUNDLE_MANIFEST_FILENAME);
131
+ if (fileSystem.exists(manifestPath)) {
132
+ try {
133
+ const parsed = JSON.parse(fileSystem.readFileSync(manifestPath));
134
+ if (parsed?.serverEntry) {
135
+ const fromManifest = path.isAbsolute(parsed.serverEntry) ? parsed.serverEntry : path.join(path.dirname(manifestPath), parsed.serverEntry);
136
+ if (fileSystem.exists(fromManifest)) {
137
+ return fromManifest;
138
+ }
139
+ }
140
+ if (parsed?.distDir) {
141
+ const fromDistDir = path.join(parsed.distDir, SERVER_BUNDLE_DIR, SERVER_BUNDLE_FILENAME);
142
+ if (fileSystem.exists(fromDistDir)) {
143
+ return fromDistDir;
144
+ }
145
+ }
146
+ } catch {
147
+ }
148
+ }
149
+ const legacyPath = path.join(cwd, "dist", SERVER_BUNDLE_DIR, SERVER_BUNDLE_FILENAME);
150
+ return fileSystem.exists(legacyPath) ? legacyPath : void 0;
151
+ }
152
+ export {
153
+ SERVER_BUNDLE_MANIFEST_FILENAME,
154
+ SERVER_ENTRY_BUILD_CACHE_FILENAME,
155
+ getServerBundleOutputPaths,
156
+ lookupServerEntryBuildCache,
157
+ readServerEntryBuildCacheManifest,
158
+ recordServerEntryBuildCache,
159
+ resolveProductionServerEntry,
160
+ writeServerBundleDeployManifest
161
+ };
@@ -70,12 +70,7 @@ export declare class ConfigBuilder {
70
70
  *
71
71
  * - `'rolldown'` (default): Ecopages runs builds through
72
72
  * {@link RolldownBuildAdapter}, creating a new `rolldown()` instance
73
- * per build. Best for one-shot production builds and benchmarks.
74
- * - `'rolldown-dev'`: Ecopages runs builds through
75
- * {@link RolldownDevBuildAdapter}, which wraps Rolldown's experimental
76
- * `DevEngine` and reuses the cached module graph, resolver, and
77
- * transform cache across rebuilds. Best for HMR and watch mode where
78
- * the same entrypoints are rebuilt repeatedly.
73
+ * per build.
79
74
  * - `'vite-host'`: a host runtime owns the build. Ecopages exposes a
80
75
  * {@link ViteHostBuildAdapter} boundary marker that throws on direct
81
76
  * use. Select this only for host-driven compatibility flows where
@@ -250,7 +245,17 @@ export declare class ConfigBuilder {
250
245
  private compareVersions;
251
246
  /**
252
247
  * Initializes default loaders that are required for EcoPages to function.
253
- * This includes the eco-component-meta-plugin which auto-injects __eco metadata into component configs.
248
+ *
249
+ * @remarks
250
+ * `eco-component-meta` is registered twice on purpose:
251
+ *
252
+ * - `sourceTransforms` is the canonical browser/HMR path. The Rolldown bridge
253
+ * runs these after first-wins `onLoad` plugins rewrite module source.
254
+ * - `loaders` keeps the same transform available to server-oriented builds
255
+ * that still use competing `onLoad` handlers directly.
256
+ *
257
+ * Browser builds exclude the loader copy in {@link getAppBrowserBuildPlugins}
258
+ * when the transform name is already present in `sourceTransforms`.
254
259
  */
255
260
  private initializeDefaultLoaders;
256
261
  private reviewBaseUrl;
@@ -9,7 +9,6 @@ import {
9
9
  collectConfiguredAppBuildManifestContributions,
10
10
  createBuildAdapter,
11
11
  setAppBuildAdapter,
12
- setAppBuildExecutor,
13
12
  updateAppBuildManifest
14
13
  } from "../build/build-adapter.js";
15
14
  import { GHTML_PLUGIN_NAME } from "../integrations/ghtml/ghtml.constants.js";
@@ -112,12 +111,7 @@ class ConfigBuilder {
112
111
  *
113
112
  * - `'rolldown'` (default): Ecopages runs builds through
114
113
  * {@link RolldownBuildAdapter}, creating a new `rolldown()` instance
115
- * per build. Best for one-shot production builds and benchmarks.
116
- * - `'rolldown-dev'`: Ecopages runs builds through
117
- * {@link RolldownDevBuildAdapter}, which wraps Rolldown's experimental
118
- * `DevEngine` and reuses the cached module graph, resolver, and
119
- * transform cache across rebuilds. Best for HMR and watch mode where
120
- * the same entrypoints are rebuilt repeatedly.
114
+ * per build.
121
115
  * - `'vite-host'`: a host runtime owns the build. Ecopages exposes a
122
116
  * {@link ViteHostBuildAdapter} boundary marker that throws on direct
123
117
  * use. Select this only for host-driven compatibility flows where
@@ -547,7 +541,17 @@ class ConfigBuilder {
547
541
  }
548
542
  /**
549
543
  * Initializes default loaders that are required for EcoPages to function.
550
- * This includes the eco-component-meta-plugin which auto-injects __eco metadata into component configs.
544
+ *
545
+ * @remarks
546
+ * `eco-component-meta` is registered twice on purpose:
547
+ *
548
+ * - `sourceTransforms` is the canonical browser/HMR path. The Rolldown bridge
549
+ * runs these after first-wins `onLoad` plugins rewrite module source.
550
+ * - `loaders` keeps the same transform available to server-oriented builds
551
+ * that still use competing `onLoad` handlers directly.
552
+ *
553
+ * Browser builds exclude the loader copy in {@link getAppBrowserBuildPlugins}
554
+ * when the transform name is already present in `sourceTransforms`.
551
555
  */
552
556
  async initializeDefaultLoaders() {
553
557
  const componentMetaTransform = createEcoComponentMetaTransform({ config: this.config });
@@ -593,7 +597,6 @@ class ConfigBuilder {
593
597
  updateAppBuildManifest(this.config, await collectConfiguredAppBuildManifestContributions(this.config));
594
598
  setAppServerInvalidationState(this.config, new CounterServerInvalidationState());
595
599
  setAppEntrypointDependencyGraph(this.config, new NoopEntrypointDependencyGraph());
596
- setAppBuildExecutor(this.config, buildAdapter);
597
600
  return this.config;
598
601
  }
599
602
  }
@@ -0,0 +1,5 @@
1
+ import type { EcoPagesAppConfig } from '../types/public-types.js';
2
+ import type { IClientBridge } from '../types/public-types.js';
3
+ export declare function setAppDevClientBridge(appConfig: EcoPagesAppConfig, bridge: IClientBridge): void;
4
+ export declare function getAppDevClientBridge(appConfig: EcoPagesAppConfig): IClientBridge | undefined;
5
+ export declare function clearAppDevClientBridge(appConfig: EcoPagesAppConfig): void;
@@ -0,0 +1,15 @@
1
+ const appDevClientBridges = /* @__PURE__ */ new WeakMap();
2
+ function setAppDevClientBridge(appConfig, bridge) {
3
+ appDevClientBridges.set(appConfig, bridge);
4
+ }
5
+ function getAppDevClientBridge(appConfig) {
6
+ return appDevClientBridges.get(appConfig);
7
+ }
8
+ function clearAppDevClientBridge(appConfig) {
9
+ appDevClientBridges.delete(appConfig);
10
+ }
11
+ export {
12
+ clearAppDevClientBridge,
13
+ getAppDevClientBridge,
14
+ setAppDevClientBridge
15
+ };
@@ -0,0 +1,7 @@
1
+ import type { ApplicationRuntimeOptions } from '../adapters/abstract/application-adapter.js';
2
+ /**
3
+ * Returns whether the host dev server owns all browser dev-client bootstrap.
4
+ *
5
+ * When true, core must not inject the HMR runtime or signal full-page reloads.
6
+ */
7
+ export declare function hostOwnsDevClient(runtime?: ApplicationRuntimeOptions): boolean;
@@ -0,0 +1,6 @@
1
+ function hostOwnsDevClient(runtime) {
2
+ return runtime?.devClientOwner === "host" || runtime?.delegateBrowserReloadToHost === true;
3
+ }
4
+ export {
5
+ hostOwnsDevClient
6
+ };
@@ -1,10 +1,13 @@
1
1
  import type { EcoPagesAppConfig } from '../types/public-types.js';
2
2
  import { type DevelopmentInvalidationPlan } from '../services/invalidation/development-invalidation.service.js';
3
+ import type { ClientBridgeEvent } from '../types/public-types.js';
3
4
  export type HostRuntimeModuleLoader = (id: string) => Promise<unknown>;
4
5
  export interface DevelopmentHostRuntime {
5
6
  registerHostModuleLoader(loader: HostRuntimeModuleLoader): void;
6
7
  planFileChange(filePath: string): DevelopmentInvalidationPlan;
7
8
  invalidateServerModules(changedFiles?: string[]): void;
8
9
  resetRuntimeState(changedFiles?: string[]): void;
10
+ broadcastClientEvent(event: ClientBridgeEvent): void;
11
+ isServerRenderedTemplatePlan(plan: DevelopmentInvalidationPlan): boolean;
9
12
  }
10
13
  export declare function createDevelopmentHostRuntime(appConfig: EcoPagesAppConfig): DevelopmentHostRuntime;
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  DevelopmentInvalidationService
3
3
  } from "../services/invalidation/development-invalidation.service.js";
4
+ import { getAppDevClientBridge } from "./client-bridge-registry.js";
4
5
  import { setHostModuleLoader } from "../services/module-loading/host-module-loader-registry.js";
5
6
  function createDevelopmentHostRuntime(appConfig) {
6
7
  const invalidationService = new DevelopmentInvalidationService(appConfig);
@@ -16,6 +17,12 @@ function createDevelopmentHostRuntime(appConfig) {
16
17
  },
17
18
  resetRuntimeState(changedFiles) {
18
19
  invalidationService.resetRuntimeState(changedFiles);
20
+ },
21
+ broadcastClientEvent(event) {
22
+ getAppDevClientBridge(appConfig)?.broadcast(event);
23
+ },
24
+ isServerRenderedTemplatePlan(plan) {
25
+ return plan.category === "include-source" || plan.category === "explicit-server-view";
19
26
  }
20
27
  };
21
28
  }
@@ -12,7 +12,7 @@ import { getEcoNavigationRuntime } from "../../router/client/navigation-coordina
12
12
  socket.addEventListener("message", async (event) => {
13
13
  try {
14
14
  const payload = JSON.parse(event.data);
15
- handleMessage(payload);
15
+ await handleMessage(payload);
16
16
  } catch (e) {
17
17
  console.error("[ecopages] Invalid HMR message:", e);
18
18
  }
@@ -29,12 +29,15 @@ import { getEcoNavigationRuntime } from "../../router/client/navigation-coordina
29
29
  switch (payload.type) {
30
30
  case "reload":
31
31
  await waitForNavigationToSettle(navigationRuntime);
32
+ if (window.__ECOPAGES_HOST_OWNS_RELOAD__) {
33
+ break;
34
+ }
32
35
  location.reload();
33
36
  break;
34
37
  case "layout-update": {
35
38
  await waitForNavigationToSettle(navigationRuntime);
36
39
  if (await navigationRuntime.reloadCurrentPage({ clearCache: true, moduleUrl: getActiveHmrModuleUrl() })) {
37
- } else {
40
+ } else if (!window.__ECOPAGES_HOST_OWNS_RELOAD__) {
38
41
  location.reload();
39
42
  }
40
43
  break;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * HMR strategy for server-rendered include templates and explicit server views.
3
+ *
4
+ * These files affect SSR output (head, layout shell, explicit views) but are not
5
+ * client HMR entrypoints. Broadcast a layout-update so the active navigation
6
+ * runtime can refresh the current page without a full document reload.
7
+ */
8
+ import { HmrStrategy, type HmrAction } from '../hmr-strategy.js';
9
+ import type { DevelopmentInvalidationService } from '../../services/invalidation/development-invalidation.service.js';
10
+ export declare class ServerRenderedTemplateHmrStrategy extends HmrStrategy {
11
+ private readonly invalidationService;
12
+ readonly type: 100;
13
+ readonly priorityOffset = 50;
14
+ constructor(invalidationService: DevelopmentInvalidationService);
15
+ matches(filePath: string): boolean;
16
+ process(filePath: string): Promise<HmrAction>;
17
+ }
@@ -0,0 +1,29 @@
1
+ import { HmrStrategy, HmrStrategyType } from "../hmr-strategy.js";
2
+ const SERVER_RENDERED_TEMPLATE_PRIORITY_OFFSET = 50;
3
+ class ServerRenderedTemplateHmrStrategy extends HmrStrategy {
4
+ constructor(invalidationService) {
5
+ super();
6
+ this.invalidationService = invalidationService;
7
+ }
8
+ invalidationService;
9
+ type = HmrStrategyType.INTEGRATION;
10
+ priorityOffset = SERVER_RENDERED_TEMPLATE_PRIORITY_OFFSET;
11
+ matches(filePath) {
12
+ return this.invalidationService.isIncludeSourceFile(filePath) || this.invalidationService.isExplicitServerViewFile(filePath);
13
+ }
14
+ async process(filePath) {
15
+ return {
16
+ type: "broadcast",
17
+ events: [
18
+ {
19
+ type: "layout-update",
20
+ path: filePath,
21
+ timestamp: Date.now()
22
+ }
23
+ ]
24
+ };
25
+ }
26
+ }
27
+ export {
28
+ ServerRenderedTemplateHmrStrategy
29
+ };
@@ -2,15 +2,11 @@
2
2
  * This module contains the ghtml renderer
3
3
  * @module
4
4
  */
5
- import type { ComponentRenderInput, ComponentRenderResult, EcoComponent, EcoPagesElement, IntegrationRendererRenderOptions, RouteRendererBody } from '../../types/public-types.js';
6
- import { IntegrationRenderer, type RenderToResponseContext } from '../../route-renderer/orchestration/integration-renderer.js';
5
+ import { StringMarkupRenderer } from '../../route-renderer/orchestration/string-markup-renderer.js';
7
6
  /**
8
7
  * A renderer for the ghtml integration.
9
8
  * It renders a page using the HtmlTemplate and Page components.
10
9
  */
11
- export declare class GhtmlRenderer extends IntegrationRenderer<EcoPagesElement> {
10
+ export declare class GhtmlRenderer extends StringMarkupRenderer {
12
11
  name: string;
13
- renderComponent(input: ComponentRenderInput): Promise<ComponentRenderResult>;
14
- render({ params, query, props, locals, pageLocals, metadata, Page, Layout, HtmlTemplate, }: IntegrationRendererRenderOptions): Promise<RouteRendererBody>;
15
- renderToResponse<P = Record<string, unknown>>(view: EcoComponent<P>, props: P, ctx: RenderToResponseContext): Promise<Response>;
16
12
  }
@@ -1,56 +1,7 @@
1
- import {
2
- IntegrationRenderer
3
- } from "../../route-renderer/orchestration/integration-renderer.js";
1
+ import { StringMarkupRenderer } from "../../route-renderer/orchestration/string-markup-renderer.js";
4
2
  import { GHTML_PLUGIN_NAME } from "./ghtml.constants.js";
5
- class GhtmlRenderer extends IntegrationRenderer {
3
+ class GhtmlRenderer extends StringMarkupRenderer {
6
4
  name = GHTML_PLUGIN_NAME;
7
- async renderComponent(input) {
8
- return this.renderStringComponentWithQueuedForeignSubtrees(
9
- input,
10
- input.component
11
- );
12
- }
13
- async render({
14
- params,
15
- query,
16
- props,
17
- locals,
18
- pageLocals,
19
- metadata,
20
- Page,
21
- Layout,
22
- HtmlTemplate
23
- }) {
24
- try {
25
- return await this.renderPageWithDocumentShell({
26
- page: {
27
- component: Page,
28
- props: { params, query, ...props, locals: pageLocals }
29
- },
30
- layout: Layout ? {
31
- component: Layout,
32
- props: locals ? { locals } : {}
33
- } : void 0,
34
- htmlTemplate: HtmlTemplate,
35
- metadata,
36
- pageProps: props ?? {}
37
- });
38
- } catch (error) {
39
- throw this.createRenderError("Error rendering page", error);
40
- }
41
- }
42
- async renderToResponse(view, props, ctx) {
43
- try {
44
- return await this.renderViewWithDocumentShell({
45
- view,
46
- props,
47
- ctx,
48
- layout: view.config?.layout
49
- });
50
- } catch (error) {
51
- throw this.createRenderError("Error rendering view", error);
52
- }
53
- }
54
5
  }
55
6
  export {
56
7
  GhtmlRenderer