veryfront 0.1.623 → 0.1.625

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 (151) hide show
  1. package/README.md +3 -3
  2. package/esm/cli/commands/knowledge/command-help.d.ts.map +1 -1
  3. package/esm/cli/commands/knowledge/command-help.js +2 -3
  4. package/esm/cli/commands/knowledge/command.d.ts +2 -47
  5. package/esm/cli/commands/knowledge/command.d.ts.map +1 -1
  6. package/esm/cli/commands/knowledge/command.js +22 -124
  7. package/esm/cli/commands/knowledge/parser.d.ts +40 -0
  8. package/esm/cli/commands/knowledge/parser.d.ts.map +1 -0
  9. package/esm/cli/commands/knowledge/parser.js +353 -0
  10. package/esm/cli/commands/knowledge/result.d.ts +3 -3
  11. package/esm/cli/commands/knowledge/result.js +1 -1
  12. package/esm/cli/commands/styles/command.js +2 -2
  13. package/esm/cli/commands/task/command.js +4 -4
  14. package/esm/cli/commands/worker/command-help.js +4 -4
  15. package/esm/cli/commands/worker/command.d.ts +1 -1
  16. package/esm/cli/commands/worker/command.js +9 -9
  17. package/esm/cli/commands/workflow/command.js +4 -4
  18. package/esm/cli/utils/sanitize-run-output.d.ts +2 -0
  19. package/esm/cli/utils/sanitize-run-output.d.ts.map +1 -0
  20. package/esm/cli/utils/{sanitize-job-output.js → sanitize-run-output.js} +1 -1
  21. package/esm/cli/utils/write-run-result.d.ts +2 -0
  22. package/esm/cli/utils/write-run-result.d.ts.map +1 -0
  23. package/esm/cli/utils/write-run-result.js +16 -0
  24. package/esm/deno.d.ts +4 -3
  25. package/esm/deno.js +6 -5
  26. package/esm/src/build/production-build/static-generation.d.ts.map +1 -1
  27. package/esm/src/build/production-build/static-generation.js +85 -0
  28. package/esm/src/html/hydration-script-builder/templates/renderer.d.ts.map +1 -1
  29. package/esm/src/html/hydration-script-builder/templates/renderer.js +37 -4
  30. package/esm/src/integrations/_data.js +1 -1
  31. package/esm/src/integrations/schema.d.ts +8 -0
  32. package/esm/src/integrations/schema.d.ts.map +1 -1
  33. package/esm/src/integrations/schema.js +3 -0
  34. package/esm/src/internal-agents/run-stream.d.ts.map +1 -1
  35. package/esm/src/internal-agents/run-stream.js +20 -3
  36. package/esm/src/platform/adapters/veryfront-api-client/operations.d.ts +2 -2
  37. package/esm/src/platform/adapters/veryfront-api-client/operations.d.ts.map +1 -1
  38. package/esm/src/platform/adapters/veryfront-api-client/operations.js +2 -2
  39. package/esm/src/platform/adapters/veryfront-api-client/schemas/api.schema.d.ts +1 -1
  40. package/esm/src/platform/adapters/veryfront-api-client/schemas/api.schema.js +1 -1
  41. package/esm/src/react/components/chat/chat/components/attachment-pill.js +1 -1
  42. package/esm/src/react/components/chat/chat/composition/chat-composer.d.ts +1 -0
  43. package/esm/src/react/components/chat/chat/composition/chat-composer.d.ts.map +1 -1
  44. package/esm/src/react/components/chat/chat/composition/chat-composer.js +27 -11
  45. package/esm/src/react/components/chat/chat/index.d.ts +1 -0
  46. package/esm/src/react/components/chat/chat/index.d.ts.map +1 -1
  47. package/esm/src/react/components/chat/chat/index.js +2 -2
  48. package/esm/src/react/components/chat/theme.js +1 -1
  49. package/esm/src/rendering/layouts/utils/applicator.d.ts.map +1 -1
  50. package/esm/src/rendering/layouts/utils/applicator.js +1 -1
  51. package/esm/src/rendering/layouts/utils/component-loader.d.ts +8 -0
  52. package/esm/src/rendering/layouts/utils/component-loader.d.ts.map +1 -1
  53. package/esm/src/rendering/layouts/utils/component-loader.js +19 -0
  54. package/esm/src/rendering/rsc/client-boot.ts +23 -6
  55. package/esm/src/runs/index.d.ts +27 -0
  56. package/esm/src/runs/index.d.ts.map +1 -0
  57. package/esm/src/runs/index.js +26 -0
  58. package/esm/src/runs/runs-client.d.ts +95 -0
  59. package/esm/src/runs/runs-client.d.ts.map +1 -0
  60. package/esm/src/runs/runs-client.js +181 -0
  61. package/esm/src/{jobs → runs}/runtime-env.d.ts.map +1 -1
  62. package/esm/src/{jobs → runs}/runtime-env.js +2 -2
  63. package/esm/src/runs/schemas.d.ts +236 -0
  64. package/esm/src/runs/schemas.d.ts.map +1 -0
  65. package/esm/src/runs/schemas.js +61 -0
  66. package/esm/src/security/deno-permissions.d.ts +2 -2
  67. package/esm/src/security/deno-permissions.js +2 -2
  68. package/esm/src/security/index.d.ts +1 -1
  69. package/esm/src/security/index.js +1 -1
  70. package/esm/src/server/build-app-route-renderer.d.ts +2 -0
  71. package/esm/src/server/build-app-route-renderer.d.ts.map +1 -1
  72. package/esm/src/server/build-app-route-renderer.js +51 -28
  73. package/esm/src/server/handlers/dev/framework-candidates.generated.d.ts.map +1 -1
  74. package/esm/src/server/handlers/dev/framework-candidates.generated.js +54 -8
  75. package/esm/src/server/services/rsc/endpoints/rsc-bundles.generated.d.ts.map +1 -1
  76. package/esm/src/server/services/rsc/endpoints/rsc-bundles.generated.js +1 -1
  77. package/esm/src/server/services/static/static-file.service.d.ts.map +1 -1
  78. package/esm/src/server/services/static/static-file.service.js +9 -4
  79. package/esm/src/skill/index.d.ts +1 -1
  80. package/esm/src/skill/index.d.ts.map +1 -1
  81. package/esm/src/skill/index.js +1 -1
  82. package/esm/src/skill/prompt-augmentation.js +2 -2
  83. package/esm/src/skill/tools.d.ts +1 -1
  84. package/esm/src/skill/tools.d.ts.map +1 -1
  85. package/esm/src/skill/tools.js +11 -9
  86. package/esm/src/skill/types.d.ts +1 -0
  87. package/esm/src/skill/types.d.ts.map +1 -1
  88. package/esm/src/skill/types.js +1 -0
  89. package/esm/src/task/runner.js +1 -1
  90. package/esm/src/task/types.d.ts +4 -4
  91. package/esm/src/task/types.d.ts.map +1 -1
  92. package/esm/src/task/types.js +1 -1
  93. package/esm/src/tool/factory.d.ts.map +1 -1
  94. package/esm/src/tool/factory.js +10 -0
  95. package/esm/src/tool/types.d.ts +5 -4
  96. package/esm/src/tool/types.d.ts.map +1 -1
  97. package/esm/src/utils/index.d.ts +1 -1
  98. package/esm/src/utils/index.js +1 -1
  99. package/esm/src/utils/logger/index.d.ts +1 -1
  100. package/esm/src/utils/logger/index.js +1 -1
  101. package/esm/src/utils/logger/logger.d.ts +6 -6
  102. package/esm/src/utils/logger/logger.d.ts.map +1 -1
  103. package/esm/src/utils/logger/logger.js +10 -10
  104. package/esm/src/utils/version-constant.d.ts +1 -1
  105. package/esm/src/utils/version-constant.js +1 -1
  106. package/esm/src/workflow/executor/workflow-executor.js +3 -3
  107. package/esm/src/workflow/worker/{dynamic-job-entrypoint.d.ts → dynamic-run-entrypoint.d.ts} +2 -2
  108. package/esm/src/workflow/worker/{dynamic-job-entrypoint.d.ts.map → dynamic-run-entrypoint.d.ts.map} +1 -1
  109. package/esm/src/workflow/worker/{dynamic-job-entrypoint.js → dynamic-run-entrypoint.js} +1 -1
  110. package/esm/src/workflow/worker/executors/index.d.ts +8 -8
  111. package/esm/src/workflow/worker/executors/index.d.ts.map +1 -1
  112. package/esm/src/workflow/worker/executors/index.js +5 -5
  113. package/esm/src/workflow/worker/executors/k8s.d.ts +34 -34
  114. package/esm/src/workflow/worker/executors/k8s.d.ts.map +1 -1
  115. package/esm/src/workflow/worker/executors/k8s.js +59 -58
  116. package/esm/src/workflow/worker/executors/process.d.ts +15 -15
  117. package/esm/src/workflow/worker/executors/process.d.ts.map +1 -1
  118. package/esm/src/workflow/worker/executors/process.js +86 -86
  119. package/esm/src/workflow/worker/executors/types.d.ts +38 -39
  120. package/esm/src/workflow/worker/executors/types.d.ts.map +1 -1
  121. package/esm/src/workflow/worker/executors/types.js +9 -10
  122. package/esm/src/workflow/worker/index.d.ts +7 -7
  123. package/esm/src/workflow/worker/index.d.ts.map +1 -1
  124. package/esm/src/workflow/worker/index.js +9 -9
  125. package/esm/src/workflow/worker/{job-entrypoint.d.ts → run-entrypoint.d.ts} +3 -3
  126. package/esm/src/workflow/worker/{job-entrypoint.d.ts.map → run-entrypoint.d.ts.map} +1 -1
  127. package/esm/src/workflow/worker/{job-entrypoint.js → run-entrypoint.js} +2 -2
  128. package/esm/src/workflow/worker/{job-manager.d.ts → run-manager.d.ts} +32 -32
  129. package/esm/src/workflow/worker/run-manager.d.ts.map +1 -0
  130. package/esm/src/workflow/worker/{job-manager.js → run-manager.js} +63 -63
  131. package/esm/src/workflow/worker/shared.js +1 -1
  132. package/package.json +4 -4
  133. package/esm/cli/commands/knowledge/parser-source.d.ts +0 -2
  134. package/esm/cli/commands/knowledge/parser-source.d.ts.map +0 -1
  135. package/esm/cli/commands/knowledge/parser-source.js +0 -641
  136. package/esm/cli/utils/sanitize-job-output.d.ts +0 -2
  137. package/esm/cli/utils/sanitize-job-output.d.ts.map +0 -1
  138. package/esm/cli/utils/write-job-result.d.ts +0 -2
  139. package/esm/cli/utils/write-job-result.d.ts.map +0 -1
  140. package/esm/cli/utils/write-job-result.js +0 -16
  141. package/esm/src/jobs/index.d.ts +0 -25
  142. package/esm/src/jobs/index.d.ts.map +0 -1
  143. package/esm/src/jobs/index.js +0 -24
  144. package/esm/src/jobs/jobs-client.d.ts +0 -182
  145. package/esm/src/jobs/jobs-client.d.ts.map +0 -1
  146. package/esm/src/jobs/jobs-client.js +0 -255
  147. package/esm/src/jobs/schemas.d.ts +0 -1146
  148. package/esm/src/jobs/schemas.d.ts.map +0 -1
  149. package/esm/src/jobs/schemas.js +0 -294
  150. package/esm/src/workflow/worker/job-manager.d.ts.map +0 -1
  151. /package/esm/src/{jobs → runs}/runtime-env.d.ts +0 -0
package/esm/deno.js CHANGED
@@ -1,6 +1,6 @@
1
1
  export default {
2
2
  "name": "veryfront",
3
- "version": "0.1.623",
3
+ "version": "0.1.625",
4
4
  "license": "Apache-2.0",
5
5
  "nodeModulesDir": "auto",
6
6
  "workspace": [
@@ -62,7 +62,7 @@ export default {
62
62
  "./schemas": "./src/schemas/index.ts",
63
63
  "./prompt": "./src/prompt/index.ts",
64
64
  "./resource": "./src/resource/index.ts",
65
- "./jobs": "./src/jobs/index.ts",
65
+ "./runs": "./src/runs/index.ts",
66
66
  "./mcp": "./src/mcp/index.ts",
67
67
  "./middleware": "./src/middleware/index.ts",
68
68
  "./observability": "./src/observability/index.ts",
@@ -122,7 +122,7 @@ export default {
122
122
  "veryfront/components/chat": "./src/react/components/chat/index.ts",
123
123
  "veryfront/sandbox": "./src/sandbox/index.ts",
124
124
  "veryfront/embedding": "./src/embedding/index.ts",
125
- "veryfront/jobs": "./src/jobs/index.ts",
125
+ "veryfront/runs": "./src/runs/index.ts",
126
126
  "veryfront/agent/identity": "./src/agent/identity-contracts.ts",
127
127
  "veryfront/agent/react": "./src/agent/react/index.ts",
128
128
  "veryfront/agent/testing": "./src/agent/testing/index.ts",
@@ -207,7 +207,8 @@ export default {
207
207
  "#veryfront/react": "./src/react/index.ts",
208
208
  "#veryfront/rendering": "./src/rendering/index.ts",
209
209
  "#veryfront/resource": "./src/resource/index.ts",
210
- "#veryfront/jobs": "./src/jobs/index.ts",
210
+ "#veryfront/runs": "./src/runs/index.ts",
211
+ "#veryfront/runs/": "./src/runs/",
211
212
  "#veryfront/routing": "./src/routing/index.ts",
212
213
  "#veryfront/security": "./src/security/index.ts",
213
214
  "#veryfront/skill": "./src/skill/index.ts",
@@ -335,7 +336,7 @@ export default {
335
336
  "lint": "DENO_NO_PACKAGE_JSON=1 deno lint src/ cli/ react/ && deno lint --config=scripts/test.deno.json scripts/test/ scripts/build/npm-package-metadata.test.ts",
336
337
  "fmt": "deno fmt src/ cli/ react/ && deno fmt --config=scripts/test.deno.json scripts/test/",
337
338
  "fmt:check": "deno fmt --check src/ cli/ react/ && deno fmt --check --config=scripts/test.deno.json scripts/test/",
338
- "typecheck": "deno task generate:manifests:check && deno check src/index.ts cli/main.ts src/server/index.ts src/routing/api/index.ts src/rendering/index.ts src/platform/index.ts src/platform/adapters/index.ts src/build/index.ts src/build/production-build/index.ts src/transforms/index.ts src/config/index.ts src/utils/index.ts src/data/index.ts src/security/index.ts src/middleware/index.ts src/server/handlers/dev/index.ts src/server/handlers/request/api/index.ts src/rendering/cache/index.ts src/rendering/cache/stores/index.ts src/rendering/rsc/actions/index.ts src/html/index.ts src/modules/index.ts src/proxy/main.ts src/chat/index.ts src/markdown/index.ts src/mdx/index.ts src/fs/index.ts src/oauth/index.ts src/agent/index.ts src/agent/service/route-export.check.ts src/tool/index.ts src/workflow/index.ts src/prompt/index.ts src/resource/index.ts src/jobs/index.ts src/mcp/index.ts src/provider/index.ts",
339
+ "typecheck": "deno task generate:manifests:check && deno check src/index.ts cli/main.ts src/server/index.ts src/routing/api/index.ts src/rendering/index.ts src/platform/index.ts src/platform/adapters/index.ts src/build/index.ts src/build/production-build/index.ts src/transforms/index.ts src/config/index.ts src/utils/index.ts src/data/index.ts src/security/index.ts src/middleware/index.ts src/server/handlers/dev/index.ts src/server/handlers/request/api/index.ts src/rendering/cache/index.ts src/rendering/cache/stores/index.ts src/rendering/rsc/actions/index.ts src/html/index.ts src/modules/index.ts src/proxy/main.ts src/chat/index.ts src/markdown/index.ts src/mdx/index.ts src/fs/index.ts src/oauth/index.ts src/agent/index.ts src/agent/service/route-export.check.ts src/tool/index.ts src/workflow/index.ts src/prompt/index.ts src/resource/index.ts src/runs/index.ts src/mcp/index.ts src/provider/index.ts",
339
340
  "verify": "deno task generate:manifests:check && deno task fmt:check && deno task lint && deno task lint:style && deno task lint:cli-boundary && deno task lint:wildcard-exports && deno task lint:barrel-jsdoc && deno task lint:ban-zod && deno task lint:core-deps && deno task lint:dependency-boundaries && deno task lint:extension-contracts && deno task lint:extension-capabilities && deno task docs:validate && deno task typecheck && deno task test && deno task test:e2e:binary",
340
341
  "verify:quick": "deno task generate:manifests:check && deno task fmt:check && deno task lint && deno task lint:style && deno task lint:cli-boundary && deno task lint:wildcard-exports && deno task lint:barrel-jsdoc && deno task lint:ban-zod && deno task lint:core-deps && deno task lint:dependency-boundaries && deno task lint:extension-contracts && deno task lint:extension-capabilities && deno task docs:validate && deno task typecheck",
341
342
  "docs": "deno run --allow-read --allow-write --allow-run --allow-env scripts/docs/generate-api-reference.ts",
@@ -1 +1 @@
1
- {"version":3,"file":"static-generation.d.ts","sourceRoot":"","sources":["../../../../src/src/build/production-build/static-generation.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AAC7E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAI3E,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACtC,QAAQ,CAAC,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC9D,UAAU,CAAC,EAAE;QACX,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,KAAK,GAAG,WAAW,CAAC;KAC3B,CAAC;IACF,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,cAAc,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,MAAM,EAAE,eAAe,CAAC;IACxB,cAAc,EAAE,OAAO,CAAC;IACxB,aAAa,EAAE,aAAa,GAAG,IAAI,CAAC;IACpC,mGAAmG;IACnG,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;IAClE,8CAA8C;IAC9C,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAoBD,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,SAAS,EAAE,EACnB,OAAO,EAAE,UAAU,GAClB,OAAO,CAAC,QAAQ,CAAC,CAmGnB;AAED,wBAAsB,cAAc,CAClC,SAAS,EAAE,YAAY,EAAE,EACzB,OAAO,EAAE,UAAU,GAClB,OAAO,CAAC,QAAQ,CAAC,CA4CnB"}
1
+ {"version":3,"file":"static-generation.d.ts","sourceRoot":"","sources":["../../../../src/src/build/production-build/static-generation.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AAC7E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAY3E,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACtC,QAAQ,CAAC,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC9D,UAAU,CAAC,EAAE;QACX,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,KAAK,GAAG,WAAW,CAAC;KAC3B,CAAC;IACF,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,cAAc,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,MAAM,EAAE,eAAe,CAAC;IACxB,cAAc,EAAE,OAAO,CAAC;IACxB,aAAa,EAAE,aAAa,GAAG,IAAI,CAAC;IACpC,mGAAmG;IACnG,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;IAClE,8CAA8C;IAC9C,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAsHD,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,SAAS,EAAE,EACnB,OAAO,EAAE,UAAU,GAClB,OAAO,CAAC,QAAQ,CAAC,CAmGnB;AAED,wBAAsB,cAAc,CAClC,SAAS,EAAE,YAAY,EAAE,EACzB,OAAO,EAAE,UAAU,GAClB,OAAO,CAAC,QAAQ,CAAC,CAkDnB"}
@@ -7,6 +7,9 @@ import { dirname, join } from "../../platform/compat/path/index.js";
7
7
  import { renderAppRouteToHTML } from "../../server/build-app-route-renderer.js";
8
8
  import { loadClientStyles } from "./asset-generation.js";
9
9
  import { generateImportMap } from "./client-runtime.js";
10
+ import { cacheCSSAsync, extractCandidatesFromFiles, generateTailwindCSS, hashCSS, } from "../../html/styles-builder/index.js";
11
+ import { DEFAULT_STYLESHEET } from "../../html/styles-builder/css-hash-cache.js";
12
+ import { FRAMEWORK_CANDIDATES } from "../../server/handlers/dev/framework-candidates.generated.js";
10
13
  function getOutputPath(outputDir, slug) {
11
14
  if (slug === "index")
12
15
  return join(outputDir, "index.html");
@@ -23,6 +26,85 @@ function defaultTraceStep(_, fn) {
23
26
  function getByteLength(text) {
24
27
  return new TextEncoder().encode(text).length;
25
28
  }
29
+ const APP_ROUTE_STYLE_SOURCE_EXTENSIONS = [".tsx", ".jsx", ".ts", ".js", ".mdx", ".md"];
30
+ const APP_ROUTE_STYLE_SKIP_DIRS = new Set([
31
+ ".deno_cache",
32
+ ".git",
33
+ ".veryfront",
34
+ "coverage",
35
+ "dist",
36
+ "node_modules",
37
+ ]);
38
+ async function readOptionalFile(adapter, path) {
39
+ try {
40
+ return await adapter.fs.readFile(path);
41
+ }
42
+ catch (_) {
43
+ return undefined;
44
+ }
45
+ }
46
+ async function collectAppRouteStyleSources(adapter, dir) {
47
+ const files = [];
48
+ async function walk(currentDir) {
49
+ let entries;
50
+ try {
51
+ entries = adapter.fs.readDir(currentDir);
52
+ }
53
+ catch (_) {
54
+ return;
55
+ }
56
+ for await (const entry of entries) {
57
+ if (entry.isDirectory) {
58
+ if (!APP_ROUTE_STYLE_SKIP_DIRS.has(entry.name)) {
59
+ await walk(join(currentDir, entry.name));
60
+ }
61
+ continue;
62
+ }
63
+ if (!entry.isFile)
64
+ continue;
65
+ if (!APP_ROUTE_STYLE_SOURCE_EXTENSIONS.some((ext) => entry.name.endsWith(ext)))
66
+ continue;
67
+ const path = join(currentDir, entry.name);
68
+ const content = await readOptionalFile(adapter, path);
69
+ if (content !== undefined)
70
+ files.push({ path, content });
71
+ }
72
+ }
73
+ await walk(dir);
74
+ return files;
75
+ }
76
+ async function prepareAppRouteStylesheet(options) {
77
+ const stylesheetPath = options.config.tailwind?.stylesheet ?? "globals.css";
78
+ const stylesheet = await readOptionalFile(options.adapter, join(options.projectDir, stylesheetPath));
79
+ const sourceFiles = await collectAppRouteStyleSources(options.adapter, options.projectDir);
80
+ const candidates = extractCandidatesFromFiles(sourceFiles, {
81
+ projectDir: options.projectDir,
82
+ });
83
+ for (const candidate of FRAMEWORK_CANDIDATES)
84
+ candidates.add(candidate);
85
+ const generated = await generateTailwindCSS(stylesheet, candidates, {
86
+ minify: true,
87
+ environment: "production",
88
+ buildMode: "production",
89
+ });
90
+ if (generated.error) {
91
+ logger.error("Failed to generate App Router CSS:", generated.error);
92
+ return undefined;
93
+ }
94
+ const hash = hashCSS(generated.css);
95
+ if (!hash)
96
+ return undefined;
97
+ await cacheCSSAsync(generated.css, hash, {
98
+ candidates,
99
+ stylesheet: stylesheet ?? DEFAULT_STYLESHEET,
100
+ });
101
+ if (!options.dryRun) {
102
+ const cssPath = join(options.outputDir, "_vf/css", `${hash}.css`);
103
+ await options.adapter.fs.mkdir(dirname(cssPath), { recursive: true });
104
+ await options.adapter.fs.writeFile(cssPath, generated.css);
105
+ }
106
+ return `/_vf/css/${hash}.css`;
107
+ }
26
108
  export async function buildPagesRoutes(routes, options) {
27
109
  const { adapter, outputDir, renderer, enablePrefetch, chunkManifest, contentSourceId = "build-static", baseUrl = "", dryRun = false, traceStep = defaultTraceStep, } = options;
28
110
  const stats = { pages: 0, totalSize: 0, ssgPaths: [] };
@@ -87,6 +169,7 @@ export async function buildAppRoutes(appRoutes, options) {
87
169
  if (appRoutes.length === 0)
88
170
  return stats;
89
171
  logger.info("Building App Router static pages...");
172
+ const stylesheetHref = await traceStep("app:styles", () => prepareAppRouteStylesheet(options));
90
173
  for (const route of appRoutes) {
91
174
  try {
92
175
  const html = await traceStep(`app:${route.path}`, () => renderAppRouteToHTML({
@@ -96,6 +179,8 @@ export async function buildAppRoutes(appRoutes, options) {
96
179
  pageFile: route.pageFile,
97
180
  contentSourceId,
98
181
  reactVersion,
182
+ stylesheetHref,
183
+ includePreviewStylesheet: false,
99
184
  }));
100
185
  const outputPath = getAppRouteOutputPath(outputDir, route.path);
101
186
  if (!dryRun) {
@@ -1 +1 @@
1
- {"version":3,"file":"renderer.d.ts","sourceRoot":"","sources":["../../../../../src/src/html/hydration-script-builder/templates/renderer.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB,cAiL7B,CAAC"}
1
+ {"version":3,"file":"renderer.d.ts","sourceRoot":"","sources":["../../../../../src/src/html/hydration-script-builder/templates/renderer.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB,cAkN7B,CAAC"}
@@ -41,6 +41,32 @@ export const getRendererScript = () => `
41
41
  const shouldRenderRscClientPage =
42
42
  data.clientModuleStrategy === 'rsc-module' && normalizedPagePath.startsWith('app/');
43
43
 
44
+ async function loadHydrationComponent(path, preferRscModule) {
45
+ const normalizedPath = typeof path === 'string' ? path.replace(/^\\/+/, '') : '';
46
+ if (preferRscModule && normalizedPath.startsWith('app/')) {
47
+ const moduleUrl = '/_veryfront/rsc/module?rel=' + encodeURIComponent(path);
48
+ log('Loading App Router component from RSC module:', moduleUrl);
49
+ const module = await import(moduleUrl);
50
+ return module.default || module;
51
+ }
52
+
53
+ return loadComponent(path);
54
+ }
55
+
56
+ function unwrapAppRouterDocumentLayout(LayoutComponent) {
57
+ return function AppRouterDocumentLayout(props) {
58
+ const element = LayoutComponent(props);
59
+ if (!React.isValidElement(element) || element.type !== 'html') {
60
+ return element;
61
+ }
62
+
63
+ const body = React.Children.toArray(element.props?.children).find((child) =>
64
+ React.isValidElement(child) && child.type === 'body'
65
+ );
66
+ return body?.props?.children ?? props.children;
67
+ };
68
+ }
69
+
44
70
  if (data.pagePath) {
45
71
  const moduleUrl = shouldRenderRscClientPage
46
72
  ? '/_veryfront/rsc/module?rel=' + encodeURIComponent(data.pagePath)
@@ -83,18 +109,25 @@ export const getRendererScript = () => `
83
109
  const pageProps = { ...(data.props || {}), params: data.params || {} };
84
110
  let tree = React.createElement(PageComponent, pageProps);
85
111
 
86
- const layouts = shouldRenderRscClientPage ? [] : data.layouts;
112
+ const layouts = data.layouts;
87
113
  if (layouts?.length) {
88
114
  for (let i = layouts.length - 1; i >= 0; i--) {
89
- const LayoutComponent = await loadComponent(layouts[i].path);
115
+ const LayoutComponent = await loadHydrationComponent(
116
+ layouts[i].path,
117
+ shouldRenderRscClientPage,
118
+ );
90
119
  if (LayoutComponent) {
91
- tree = React.createElement(LayoutComponent, { children: tree });
120
+ const WrappedLayoutComponent =
121
+ shouldRenderRscClientPage && layouts[i].path === 'app/layout.tsx'
122
+ ? unwrapAppRouterDocumentLayout(LayoutComponent)
123
+ : LayoutComponent;
124
+ tree = React.createElement(WrappedLayoutComponent, { children: tree });
92
125
  }
93
126
  }
94
127
  }
95
128
 
96
129
  if (data.appPath) {
97
- const AppComponent = await loadComponent(data.appPath);
130
+ const AppComponent = await loadHydrationComponent(data.appPath, shouldRenderRscClientPage);
98
131
  if (AppComponent) {
99
132
  tree = React.createElement(AppComponent, { children: tree });
100
133
  }