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.
- package/dist/assets/build/generate.js +4 -3
- package/dist/assets/fonts/core/collect-font-data.js +1 -0
- package/dist/assets/fonts/types.d.ts +1 -0
- package/dist/cli/add/index.js +1 -44
- package/dist/cli/dev/background.js +1 -1
- package/dist/cli/dev/index.js +1 -1
- package/dist/cli/flags.js +4 -6
- package/dist/cli/help/index.js +1 -2
- package/dist/cli/index.js +1 -15
- package/dist/cli/infra/build-time-astro-version-provider.js +1 -1
- package/dist/container/index.d.ts +3 -3
- package/dist/container/index.js +1 -4
- package/dist/content/content-layer.js +3 -3
- package/dist/content/runtime.d.ts +1 -1
- package/dist/content/runtime.js +1 -0
- package/dist/content/vite-plugin-content-virtual-mod.js +27 -0
- package/dist/core/app/base.d.ts +1 -1
- package/dist/core/app/base.js +14 -24
- package/dist/core/app/dev/pipeline.js +0 -9
- package/dist/core/app/manifest.d.ts +0 -2
- package/dist/core/app/manifest.js +0 -8
- package/dist/core/app/types.d.ts +1 -8
- package/dist/core/base-pipeline.d.ts +3 -9
- package/dist/core/base-pipeline.js +4 -23
- package/dist/core/build/app.d.ts +0 -2
- package/dist/core/build/app.js +0 -5
- package/dist/core/build/generate.js +0 -14
- package/dist/core/build/pipeline.js +0 -9
- package/dist/core/build/plugins/plugin-css.js +1 -0
- package/dist/core/build/plugins/plugin-manifest.js +4 -9
- package/dist/core/config/config.js +3 -2
- package/dist/core/config/schemas/base.d.ts +9 -22
- package/dist/core/config/schemas/base.js +11 -27
- package/dist/core/config/schemas/relative.d.ts +15 -36
- package/dist/core/config/validate.js +10 -2
- package/dist/core/constants.js +1 -1
- package/dist/core/dev/dev.js +1 -1
- package/dist/core/errors/default-handler.js +21 -8
- package/dist/core/fetch/fetch-state.js +3 -16
- package/dist/core/fetch/types.d.ts +1 -1
- package/dist/core/fetch/vite-plugin.js +4 -6
- package/dist/core/hono/index.d.ts +1 -0
- package/dist/core/hono/index.js +1 -0
- package/dist/core/logger/impls/node.js +0 -1
- package/dist/core/logger/load.js +3 -2
- package/dist/core/messages/runtime.js +1 -1
- package/dist/core/middleware/index.js +8 -1
- package/dist/core/middleware/vite-plugin.d.ts +1 -0
- package/dist/core/middleware/vite-plugin.js +5 -1
- package/dist/core/util/normalized-url.js +2 -5
- package/dist/core/util/pathname.d.ts +13 -7
- package/dist/core/util/pathname.js +9 -6
- package/dist/i18n/index.js +6 -2
- package/dist/manifest/serialized.js +4 -5
- package/dist/runtime/server/index.d.ts +1 -1
- package/dist/runtime/server/index.js +4 -0
- package/dist/runtime/server/jsx.js +2 -1
- package/dist/runtime/server/render/astro/render-template.d.ts +1 -1
- package/dist/runtime/server/render/astro/render.d.ts +0 -4
- package/dist/runtime/server/render/astro/render.js +76 -68
- package/dist/runtime/server/render/head.js +2 -1
- package/dist/runtime/server/render/index.d.ts +1 -0
- package/dist/runtime/server/render/index.js +2 -0
- package/dist/runtime/server/render/page.js +9 -44
- package/dist/runtime/server/render/streaming.d.ts +23 -0
- package/dist/runtime/server/render/streaming.js +238 -0
- package/dist/runtime/server/render/util.js +5 -1
- package/dist/types/public/config.d.ts +115 -123
- package/dist/types/public/context.d.ts +1 -1
- package/dist/types/public/internal.d.ts +0 -15
- package/dist/vite-plugin-app/app.js +1 -1
- package/dist/vite-plugin-app/pipeline.js +0 -9
- package/dist/vite-plugin-hmr-reload/index.js +19 -6
- package/dist/vite-plugin-html/transform/slots.js +4 -1
- package/dist/vite-plugin-pages/pages.d.ts +11 -0
- package/dist/vite-plugin-pages/pages.js +1 -3
- package/package.json +13 -7
- package/dist/cli/db/index.d.ts +0 -4
- package/dist/cli/db/index.js +0 -25
- package/dist/jsx/rehype.d.ts +0 -5
- package/dist/jsx/rehype.js +0 -241
- package/dist/runtime/server/html-string-cache.d.ts +0 -48
- package/dist/runtime/server/html-string-cache.js +0 -119
- package/dist/runtime/server/render/queue/builder.d.ts +0 -14
- package/dist/runtime/server/render/queue/builder.js +0 -182
- package/dist/runtime/server/render/queue/jsx-builder.d.ts +0 -33
- package/dist/runtime/server/render/queue/jsx-builder.js +0 -146
- package/dist/runtime/server/render/queue/pool.d.ts +0 -123
- package/dist/runtime/server/render/queue/pool.js +0 -203
- package/dist/runtime/server/render/queue/renderer.d.ts +0 -12
- package/dist/runtime/server/render/queue/renderer.js +0 -103
- package/dist/runtime/server/render/queue/types.d.ts +0 -81
- 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
|