astro 7.0.0-alpha.2 → 7.0.0-beta.4

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 (93) hide show
  1. package/dist/assets/build/generate.js +4 -3
  2. package/dist/assets/fonts/core/collect-font-data.js +1 -0
  3. package/dist/assets/fonts/types.d.ts +1 -0
  4. package/dist/cli/add/index.js +1 -44
  5. package/dist/cli/dev/background.js +1 -1
  6. package/dist/cli/dev/index.js +1 -1
  7. package/dist/cli/flags.js +4 -6
  8. package/dist/cli/help/index.js +1 -2
  9. package/dist/cli/index.js +1 -15
  10. package/dist/cli/infra/build-time-astro-version-provider.js +1 -1
  11. package/dist/container/index.d.ts +3 -3
  12. package/dist/container/index.js +1 -4
  13. package/dist/content/content-layer.js +3 -3
  14. package/dist/content/runtime.d.ts +1 -1
  15. package/dist/content/runtime.js +1 -0
  16. package/dist/content/vite-plugin-content-virtual-mod.js +27 -0
  17. package/dist/core/app/base.d.ts +1 -1
  18. package/dist/core/app/base.js +14 -24
  19. package/dist/core/app/dev/pipeline.js +0 -9
  20. package/dist/core/app/manifest.d.ts +0 -2
  21. package/dist/core/app/manifest.js +0 -8
  22. package/dist/core/app/types.d.ts +1 -8
  23. package/dist/core/base-pipeline.d.ts +3 -9
  24. package/dist/core/base-pipeline.js +4 -23
  25. package/dist/core/build/app.d.ts +0 -2
  26. package/dist/core/build/app.js +0 -5
  27. package/dist/core/build/generate.js +0 -14
  28. package/dist/core/build/pipeline.js +0 -9
  29. package/dist/core/build/plugins/plugin-css.js +1 -0
  30. package/dist/core/build/plugins/plugin-manifest.js +4 -9
  31. package/dist/core/config/config.js +3 -2
  32. package/dist/core/config/schemas/base.d.ts +9 -22
  33. package/dist/core/config/schemas/base.js +11 -27
  34. package/dist/core/config/schemas/relative.d.ts +15 -36
  35. package/dist/core/config/validate.js +10 -2
  36. package/dist/core/constants.js +1 -1
  37. package/dist/core/dev/dev.js +1 -1
  38. package/dist/core/errors/default-handler.js +21 -8
  39. package/dist/core/fetch/fetch-state.js +3 -16
  40. package/dist/core/fetch/types.d.ts +1 -1
  41. package/dist/core/fetch/vite-plugin.js +4 -6
  42. package/dist/core/hono/index.d.ts +1 -0
  43. package/dist/core/hono/index.js +1 -0
  44. package/dist/core/logger/impls/node.js +0 -1
  45. package/dist/core/logger/load.js +3 -2
  46. package/dist/core/messages/runtime.js +1 -1
  47. package/dist/core/middleware/index.js +8 -1
  48. package/dist/core/middleware/vite-plugin.d.ts +1 -0
  49. package/dist/core/middleware/vite-plugin.js +5 -1
  50. package/dist/core/util/normalized-url.js +2 -5
  51. package/dist/core/util/pathname.d.ts +13 -7
  52. package/dist/core/util/pathname.js +9 -6
  53. package/dist/i18n/index.js +6 -2
  54. package/dist/manifest/serialized.js +4 -5
  55. package/dist/runtime/server/index.d.ts +1 -1
  56. package/dist/runtime/server/index.js +4 -0
  57. package/dist/runtime/server/jsx.js +2 -1
  58. package/dist/runtime/server/render/astro/render-template.d.ts +1 -1
  59. package/dist/runtime/server/render/astro/render.d.ts +0 -4
  60. package/dist/runtime/server/render/astro/render.js +76 -68
  61. package/dist/runtime/server/render/head.js +2 -1
  62. package/dist/runtime/server/render/index.d.ts +1 -0
  63. package/dist/runtime/server/render/index.js +2 -0
  64. package/dist/runtime/server/render/page.js +9 -44
  65. package/dist/runtime/server/render/streaming.d.ts +23 -0
  66. package/dist/runtime/server/render/streaming.js +238 -0
  67. package/dist/runtime/server/render/util.js +5 -1
  68. package/dist/types/public/config.d.ts +115 -123
  69. package/dist/types/public/context.d.ts +1 -1
  70. package/dist/types/public/internal.d.ts +0 -15
  71. package/dist/vite-plugin-app/app.js +1 -1
  72. package/dist/vite-plugin-app/pipeline.js +0 -9
  73. package/dist/vite-plugin-hmr-reload/index.js +19 -6
  74. package/dist/vite-plugin-html/transform/slots.js +4 -1
  75. package/dist/vite-plugin-pages/pages.d.ts +11 -0
  76. package/dist/vite-plugin-pages/pages.js +1 -3
  77. package/package.json +13 -7
  78. package/dist/cli/db/index.d.ts +0 -4
  79. package/dist/cli/db/index.js +0 -25
  80. package/dist/jsx/rehype.d.ts +0 -5
  81. package/dist/jsx/rehype.js +0 -241
  82. package/dist/runtime/server/html-string-cache.d.ts +0 -48
  83. package/dist/runtime/server/html-string-cache.js +0 -119
  84. package/dist/runtime/server/render/queue/builder.d.ts +0 -14
  85. package/dist/runtime/server/render/queue/builder.js +0 -182
  86. package/dist/runtime/server/render/queue/jsx-builder.d.ts +0 -33
  87. package/dist/runtime/server/render/queue/jsx-builder.js +0 -146
  88. package/dist/runtime/server/render/queue/pool.d.ts +0 -123
  89. package/dist/runtime/server/render/queue/pool.js +0 -203
  90. package/dist/runtime/server/render/queue/renderer.d.ts +0 -12
  91. package/dist/runtime/server/render/queue/renderer.js +0 -103
  92. package/dist/runtime/server/render/queue/types.d.ts +0 -81
  93. package/dist/runtime/server/render/queue/types.js +0 -0
@@ -1,103 +0,0 @@
1
- import { markHTMLString, escapeHTML } from "../../escape.js";
2
- import { chunkToString } from "../common.js";
3
- async function renderQueue(queue, destination) {
4
- const result = queue.result;
5
- const pool = queue.pool;
6
- const cache = queue.htmlStringCache;
7
- let batchBuffer = "";
8
- let i = 0;
9
- while (i < queue.nodes.length) {
10
- const node = queue.nodes[i];
11
- try {
12
- if (canBatch(node)) {
13
- const batchStart = i;
14
- while (i < queue.nodes.length && canBatch(queue.nodes[i])) {
15
- batchBuffer += renderNodeToString(queue.nodes[i]);
16
- i = i + 1;
17
- }
18
- if (batchBuffer) {
19
- const htmlString = cache ? cache.getOrCreate(batchBuffer) : markHTMLString(batchBuffer);
20
- destination.write(htmlString);
21
- batchBuffer = "";
22
- }
23
- if (pool) {
24
- for (let j = batchStart; j < i; j++) {
25
- pool.release(queue.nodes[j]);
26
- }
27
- }
28
- } else {
29
- await renderNode(node, destination, result);
30
- if (pool) {
31
- pool.release(node);
32
- }
33
- i = i + 1;
34
- }
35
- } catch (error) {
36
- throw error;
37
- }
38
- }
39
- if (batchBuffer) {
40
- const htmlString = cache ? cache.getOrCreate(batchBuffer) : markHTMLString(batchBuffer);
41
- destination.write(htmlString);
42
- }
43
- }
44
- function canBatch(node) {
45
- return node.type === "text" || node.type === "html-string";
46
- }
47
- function renderNodeToString(node) {
48
- switch (node.type) {
49
- case "text":
50
- return node.content ? escapeHTML(node.content) : "";
51
- case "html-string":
52
- return node.html || "";
53
- case "component":
54
- case "instruction": {
55
- return "";
56
- }
57
- }
58
- }
59
- async function renderNode(node, destination, result) {
60
- const cache = result._experimentalQueuedRendering?.htmlStringCache;
61
- switch (node.type) {
62
- case "text": {
63
- if (node.content) {
64
- const escaped = escapeHTML(node.content);
65
- const htmlString = cache ? cache.getOrCreate(escaped) : markHTMLString(escaped);
66
- destination.write(htmlString);
67
- }
68
- break;
69
- }
70
- case "html-string": {
71
- if (node.html) {
72
- const htmlString = cache ? cache.getOrCreate(node.html) : markHTMLString(node.html);
73
- destination.write(htmlString);
74
- }
75
- break;
76
- }
77
- case "instruction": {
78
- if (node.instruction) {
79
- destination.write(node.instruction);
80
- }
81
- break;
82
- }
83
- case "component": {
84
- if (node.instance) {
85
- let componentHtml = "";
86
- const componentDestination = {
87
- write(chunk) {
88
- if (chunk instanceof Response) return;
89
- componentHtml += chunkToString(result, chunk);
90
- }
91
- };
92
- await node.instance.render(componentDestination);
93
- if (componentHtml) {
94
- destination.write(componentHtml);
95
- }
96
- }
97
- break;
98
- }
99
- }
100
- }
101
- export {
102
- renderQueue
103
- };
@@ -1,81 +0,0 @@
1
- import type { SSRResult } from '../../../../types/public/internal.js';
2
- import type { AstroComponentInstance } from '../astro/instance.js';
3
- import type { RenderInstruction } from '../instruction.js';
4
- import type { ServerIslandComponent } from '../server-islands.js';
5
- import type { NodePool } from './pool.js';
6
- import type { HTMLStringCache } from '../../html-string-cache.js';
7
- /**
8
- * Text node containing plain text content that will be HTML-escaped during rendering
9
- */
10
- export interface TextNode {
11
- type: 'text';
12
- content: string;
13
- }
14
- /**
15
- * HTML string node containing pre-rendered HTML markup that is already safe
16
- */
17
- export interface HtmlStringNode {
18
- type: 'html-string';
19
- html: string;
20
- }
21
- /**
22
- * Component node containing an Astro component instance to be rendered
23
- */
24
- export interface ComponentNode {
25
- type: 'component';
26
- instance: AstroComponentInstance | ServerIslandComponent;
27
- }
28
- /**
29
- * Instruction node containing rendering instructions (head content, hydration scripts, etc.)
30
- */
31
- export interface InstructionNode {
32
- type: 'instruction';
33
- instruction: RenderInstruction;
34
- }
35
- /**
36
- * Discriminated union of all queue node types.
37
- * TypeScript will narrow the type based on the 'type' field.
38
- */
39
- export type QueueNode = TextNode | HtmlStringNode | ComponentNode | InstructionNode;
40
- /**
41
- * The render queue containing all nodes to be rendered
42
- */
43
- export interface RenderQueue {
44
- /**
45
- * All nodes in rendering order (after reversing the built queue)
46
- */
47
- nodes: QueueNode[];
48
- /**
49
- * SSRResult context
50
- */
51
- result: SSRResult;
52
- /**
53
- * Object pool instance used for node acquisition
54
- */
55
- pool?: NodePool;
56
- /**
57
- * HTMLString cache instance for reducing memory allocations
58
- */
59
- htmlStringCache?: HTMLStringCache;
60
- }
61
- /**
62
- * Stack item used during queue building (internal use only)
63
- */
64
- export interface StackItem {
65
- /**
66
- * The value to process
67
- */
68
- node: any;
69
- /**
70
- * Parent queue node (tracked but not used during rendering)
71
- */
72
- parent: QueueNode | null;
73
- /**
74
- * Additional metadata passed through the stack (component props, slots, displayName)
75
- */
76
- metadata?: {
77
- displayName?: string;
78
- props?: Record<string, any>;
79
- slots?: any;
80
- };
81
- }
File without changes