astro 1.1.6 → 1.1.7
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/core/create-vite.js +1 -1
- package/dist/core/dev/index.js +1 -1
- package/dist/core/messages.js +2 -2
- package/dist/core/util.js +1 -1
- package/dist/jsx/babel.js +2 -1
- package/dist/runtime/server/astro-global.js +1 -1
- package/dist/runtime/server/hydration.js +1 -1
- package/dist/runtime/server/render/component.js +2 -1
- package/dist/runtime/server/serialize.d.ts +2 -1
- package/dist/runtime/server/serialize.js +26 -11
- package/dist/vite-plugin-astro-server/index.js +1 -0
- package/package.json +2 -2
package/dist/core/create-vite.js
CHANGED
package/dist/core/dev/index.js
CHANGED
|
@@ -46,7 +46,7 @@ async function dev(config, options) {
|
|
|
46
46
|
https: !!((_a = viteConfig.server) == null ? void 0 : _a.https)
|
|
47
47
|
})
|
|
48
48
|
);
|
|
49
|
-
const currentVersion = "1.1.
|
|
49
|
+
const currentVersion = "1.1.7";
|
|
50
50
|
if (currentVersion.includes("-")) {
|
|
51
51
|
warn(options.logging, null, msg.prerelease({ currentVersion }));
|
|
52
52
|
}
|
package/dist/core/messages.js
CHANGED
|
@@ -46,7 +46,7 @@ function devStart({
|
|
|
46
46
|
https,
|
|
47
47
|
site
|
|
48
48
|
}) {
|
|
49
|
-
const version = "1.1.
|
|
49
|
+
const version = "1.1.7";
|
|
50
50
|
const rootPath = site ? site.pathname : "/";
|
|
51
51
|
const localPrefix = `${dim("\u2503")} Local `;
|
|
52
52
|
const networkPrefix = `${dim("\u2503")} Network `;
|
|
@@ -225,7 +225,7 @@ function printHelp({
|
|
|
225
225
|
message.push(
|
|
226
226
|
linebreak(),
|
|
227
227
|
` ${bgGreen(black(` ${commandName} `))} ${green(
|
|
228
|
-
`v${"1.1.
|
|
228
|
+
`v${"1.1.7"}`
|
|
229
229
|
)} ${headline}`
|
|
230
230
|
);
|
|
231
231
|
}
|
package/dist/core/util.js
CHANGED
|
@@ -5,7 +5,7 @@ import resolve from "resolve";
|
|
|
5
5
|
import slash from "slash";
|
|
6
6
|
import { fileURLToPath, pathToFileURL } from "url";
|
|
7
7
|
import { prependForwardSlash, removeTrailingForwardSlash } from "./path.js";
|
|
8
|
-
const ASTRO_VERSION = "1.1.
|
|
8
|
+
const ASTRO_VERSION = "1.1.7";
|
|
9
9
|
function isObject(value) {
|
|
10
10
|
return typeof value === "object" && value != null;
|
|
11
11
|
}
|
package/dist/jsx/babel.js
CHANGED
|
@@ -185,7 +185,8 @@ function astroJSX() {
|
|
|
185
185
|
break;
|
|
186
186
|
}
|
|
187
187
|
if (namespace.at(0) === local) {
|
|
188
|
-
|
|
188
|
+
const name = imported === "*" ? imported : tagName;
|
|
189
|
+
path.setData("import", { name, path: source });
|
|
189
190
|
break;
|
|
190
191
|
}
|
|
191
192
|
}
|
|
@@ -89,7 +89,7 @@ async function generateHydrateScript(scriptOptions, metadata) {
|
|
|
89
89
|
if (renderer.clientEntrypoint) {
|
|
90
90
|
island.props["component-export"] = componentExport.value;
|
|
91
91
|
island.props["renderer-url"] = await result.resolve(decodeURI(renderer.clientEntrypoint));
|
|
92
|
-
island.props["props"] = escapeHTML(serializeProps(props));
|
|
92
|
+
island.props["props"] = escapeHTML(serializeProps(props, metadata));
|
|
93
93
|
}
|
|
94
94
|
island.props["ssr"] = "";
|
|
95
95
|
island.props["client"] = hydrate;
|
|
@@ -231,7 +231,8 @@ If you're still stuck, please open an issue on GitHub or join us at https://astr
|
|
|
231
231
|
`<!--${metadata.componentExport.value}:${metadata.componentUrl}-->
|
|
232
232
|
${html}
|
|
233
233
|
${serializeProps(
|
|
234
|
-
props
|
|
234
|
+
props,
|
|
235
|
+
metadata
|
|
235
236
|
)}`
|
|
236
237
|
);
|
|
237
238
|
const island = await generateHydrateScript(
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import type { AstroComponentMetadata } from '../../@types/astro';
|
|
2
|
+
export declare function serializeProps(props: any, metadata: AstroComponentMetadata): string;
|
|
@@ -8,17 +8,23 @@ const PROP_TYPE = {
|
|
|
8
8
|
BigInt: 6,
|
|
9
9
|
URL: 7
|
|
10
10
|
};
|
|
11
|
-
function serializeArray(value) {
|
|
12
|
-
return value.map((v) => convertToSerializedForm(v));
|
|
11
|
+
function serializeArray(value, metadata) {
|
|
12
|
+
return value.map((v) => convertToSerializedForm(v, metadata));
|
|
13
13
|
}
|
|
14
|
-
function serializeObject(value) {
|
|
14
|
+
function serializeObject(value, metadata) {
|
|
15
|
+
if (cyclicRefs.has(value)) {
|
|
16
|
+
throw new Error(`Cyclic reference detected while serializing props for <${metadata.displayName} client:${metadata.hydrate}>!
|
|
17
|
+
|
|
18
|
+
Cyclic references cannot be safely serialized for client-side usage. Please remove the cyclic reference.`);
|
|
19
|
+
}
|
|
20
|
+
cyclicRefs.add(value);
|
|
15
21
|
return Object.fromEntries(
|
|
16
22
|
Object.entries(value).map(([k, v]) => {
|
|
17
|
-
return [k, convertToSerializedForm(v)];
|
|
23
|
+
return [k, convertToSerializedForm(v, metadata)];
|
|
18
24
|
})
|
|
19
25
|
);
|
|
20
26
|
}
|
|
21
|
-
function convertToSerializedForm(value) {
|
|
27
|
+
function convertToSerializedForm(value, metadata) {
|
|
22
28
|
const tag = Object.prototype.toString.call(value);
|
|
23
29
|
switch (tag) {
|
|
24
30
|
case "[object Date]": {
|
|
@@ -28,10 +34,16 @@ function convertToSerializedForm(value) {
|
|
|
28
34
|
return [PROP_TYPE.RegExp, value.source];
|
|
29
35
|
}
|
|
30
36
|
case "[object Map]": {
|
|
31
|
-
return [
|
|
37
|
+
return [
|
|
38
|
+
PROP_TYPE.Map,
|
|
39
|
+
JSON.stringify(serializeArray(Array.from(value), metadata))
|
|
40
|
+
];
|
|
32
41
|
}
|
|
33
42
|
case "[object Set]": {
|
|
34
|
-
return [
|
|
43
|
+
return [
|
|
44
|
+
PROP_TYPE.Set,
|
|
45
|
+
JSON.stringify(serializeArray(Array.from(value), metadata))
|
|
46
|
+
];
|
|
35
47
|
}
|
|
36
48
|
case "[object BigInt]": {
|
|
37
49
|
return [PROP_TYPE.BigInt, value.toString()];
|
|
@@ -40,19 +52,22 @@ function convertToSerializedForm(value) {
|
|
|
40
52
|
return [PROP_TYPE.URL, value.toString()];
|
|
41
53
|
}
|
|
42
54
|
case "[object Array]": {
|
|
43
|
-
return [PROP_TYPE.JSON, JSON.stringify(serializeArray(value))];
|
|
55
|
+
return [PROP_TYPE.JSON, JSON.stringify(serializeArray(value, metadata))];
|
|
44
56
|
}
|
|
45
57
|
default: {
|
|
46
58
|
if (value !== null && typeof value === "object") {
|
|
47
|
-
return [PROP_TYPE.Value, serializeObject(value)];
|
|
59
|
+
return [PROP_TYPE.Value, serializeObject(value, metadata)];
|
|
48
60
|
} else {
|
|
49
61
|
return [PROP_TYPE.Value, value];
|
|
50
62
|
}
|
|
51
63
|
}
|
|
52
64
|
}
|
|
53
65
|
}
|
|
54
|
-
|
|
55
|
-
|
|
66
|
+
let cyclicRefs = /* @__PURE__ */ new WeakSet();
|
|
67
|
+
function serializeProps(props, metadata) {
|
|
68
|
+
const serialized = JSON.stringify(serializeObject(props, metadata));
|
|
69
|
+
cyclicRefs = /* @__PURE__ */ new WeakSet();
|
|
70
|
+
return serialized;
|
|
56
71
|
}
|
|
57
72
|
export {
|
|
58
73
|
serializeProps
|
|
@@ -83,6 +83,7 @@ async function handle404Response(origin, config, req, res) {
|
|
|
83
83
|
async function handle500Response(viteServer, origin, req, res, err) {
|
|
84
84
|
res.on("close", () => setTimeout(() => viteServer.ws.send(getViteErrorPayload(err)), 200));
|
|
85
85
|
if (res.headersSent) {
|
|
86
|
+
res.write(`<script type="module" src="/@vite/client"><\/script>`);
|
|
86
87
|
res.end();
|
|
87
88
|
} else {
|
|
88
89
|
writeHtmlResponse(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "astro",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.7",
|
|
4
4
|
"description": "Astro is a modern site builder with web best practices, performance, and DX front-of-mind.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "withastro",
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
"vendor"
|
|
83
83
|
],
|
|
84
84
|
"dependencies": {
|
|
85
|
-
"@astrojs/compiler": "^0.23.
|
|
85
|
+
"@astrojs/compiler": "^0.23.5",
|
|
86
86
|
"@astrojs/language-server": "^0.23.0",
|
|
87
87
|
"@astrojs/markdown-remark": "^1.1.1",
|
|
88
88
|
"@astrojs/telemetry": "^1.0.0",
|