astro 3.2.1 → 3.2.2
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/@types/astro.d.ts +1 -1
- package/dist/content/vite-plugin-content-assets.js +2 -2
- package/dist/core/constants.js +1 -1
- package/dist/core/dev/dev.js +1 -1
- package/dist/core/messages.js +2 -2
- package/dist/core/render/result.js +1 -1
- package/dist/runtime/server/render/astro/instance.js +2 -2
- package/dist/vite-plugin-astro-server/css.d.ts +7 -1
- package/dist/vite-plugin-astro-server/css.js +6 -2
- package/dist/vite-plugin-astro-server/route.js +7 -3
- package/package.json +1 -1
package/dist/@types/astro.d.ts
CHANGED
|
@@ -1967,7 +1967,7 @@ export interface SSRMetadata {
|
|
|
1967
1967
|
hasRenderedHead: boolean;
|
|
1968
1968
|
headInTree: boolean;
|
|
1969
1969
|
extraHead: string[];
|
|
1970
|
-
propagators:
|
|
1970
|
+
propagators: Set<AstroComponentInstance>;
|
|
1971
1971
|
}
|
|
1972
1972
|
export interface PreviewServer {
|
|
1973
1973
|
host?: string;
|
|
@@ -49,7 +49,7 @@ function astroContentAssetPropagationPlugin({
|
|
|
49
49
|
if (!devModuleLoader.getModuleById(basePath)?.ssrModule) {
|
|
50
50
|
await devModuleLoader.import(basePath);
|
|
51
51
|
}
|
|
52
|
-
const {
|
|
52
|
+
const { styles, urls } = await getStylesForURL(
|
|
53
53
|
pathToFileURL(basePath),
|
|
54
54
|
devModuleLoader,
|
|
55
55
|
"development"
|
|
@@ -60,7 +60,7 @@ function astroContentAssetPropagationPlugin({
|
|
|
60
60
|
devModuleLoader
|
|
61
61
|
);
|
|
62
62
|
stringifiedLinks = JSON.stringify([...urls]);
|
|
63
|
-
stringifiedStyles = JSON.stringify(
|
|
63
|
+
stringifiedStyles = JSON.stringify(styles.map((s) => s.content));
|
|
64
64
|
stringifiedScripts = JSON.stringify([...hoistedScripts]);
|
|
65
65
|
} else {
|
|
66
66
|
stringifiedLinks = JSON.stringify(LINKS_PLACEHOLDER);
|
package/dist/core/constants.js
CHANGED
package/dist/core/dev/dev.js
CHANGED
|
@@ -20,7 +20,7 @@ async function dev(inlineConfig) {
|
|
|
20
20
|
base: restart.container.settings.config.base
|
|
21
21
|
})
|
|
22
22
|
);
|
|
23
|
-
const currentVersion = "3.2.
|
|
23
|
+
const currentVersion = "3.2.2";
|
|
24
24
|
if (currentVersion.includes("-")) {
|
|
25
25
|
logger.warn(null, msg.prerelease({ currentVersion }));
|
|
26
26
|
}
|
package/dist/core/messages.js
CHANGED
|
@@ -50,7 +50,7 @@ function serverStart({
|
|
|
50
50
|
base,
|
|
51
51
|
isRestart = false
|
|
52
52
|
}) {
|
|
53
|
-
const version = "3.2.
|
|
53
|
+
const version = "3.2.2";
|
|
54
54
|
const localPrefix = `${dim("\u2503")} Local `;
|
|
55
55
|
const networkPrefix = `${dim("\u2503")} Network `;
|
|
56
56
|
const emptyPrefix = " ".repeat(11);
|
|
@@ -235,7 +235,7 @@ function printHelp({
|
|
|
235
235
|
message.push(
|
|
236
236
|
linebreak(),
|
|
237
237
|
` ${bgGreen(black(` ${commandName} `))} ${green(
|
|
238
|
-
`v${"3.2.
|
|
238
|
+
`v${"3.2.2"}`
|
|
239
239
|
)} ${headline}`
|
|
240
240
|
);
|
|
241
241
|
}
|
|
@@ -55,8 +55,8 @@ function validateComponentProps(props, displayName) {
|
|
|
55
55
|
function createAstroComponentInstance(result, displayName, factory, props, slots = {}) {
|
|
56
56
|
validateComponentProps(props, displayName);
|
|
57
57
|
const instance = new AstroComponentInstance(result, props, slots, factory);
|
|
58
|
-
if (isAPropagatingComponent(result, factory)
|
|
59
|
-
result._metadata.propagators.
|
|
58
|
+
if (isAPropagatingComponent(result, factory)) {
|
|
59
|
+
result._metadata.propagators.add(instance);
|
|
60
60
|
}
|
|
61
61
|
return instance;
|
|
62
62
|
}
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import type { RuntimeMode } from '../@types/astro.js';
|
|
2
2
|
import type { ModuleLoader } from '../core/module-loader/index.js';
|
|
3
|
+
interface ImportedStyle {
|
|
4
|
+
id: string;
|
|
5
|
+
url: string;
|
|
6
|
+
content: string;
|
|
7
|
+
}
|
|
3
8
|
/** Given a filePath URL, crawl Vite’s module graph to find all style imports. */
|
|
4
9
|
export declare function getStylesForURL(filePath: URL, loader: ModuleLoader, mode: RuntimeMode): Promise<{
|
|
5
10
|
urls: Set<string>;
|
|
6
|
-
|
|
11
|
+
styles: ImportedStyle[];
|
|
7
12
|
}>;
|
|
13
|
+
export {};
|
|
@@ -14,7 +14,11 @@ async function getStylesForURL(filePath, loader, mode) {
|
|
|
14
14
|
}
|
|
15
15
|
if (mode === "development" && // only inline in development
|
|
16
16
|
typeof ssrModule?.default === "string") {
|
|
17
|
-
importedStylesMap.set(importedModule.
|
|
17
|
+
importedStylesMap.set(importedModule.url, {
|
|
18
|
+
id: importedModule.id ?? importedModule.url,
|
|
19
|
+
url: importedModule.url,
|
|
20
|
+
content: ssrModule.default
|
|
21
|
+
});
|
|
18
22
|
} else {
|
|
19
23
|
importedCssUrls.add(importedModule.url);
|
|
20
24
|
}
|
|
@@ -22,7 +26,7 @@ async function getStylesForURL(filePath, loader, mode) {
|
|
|
22
26
|
}
|
|
23
27
|
return {
|
|
24
28
|
urls: importedCssUrls,
|
|
25
|
-
|
|
29
|
+
styles: [...importedStylesMap.values()]
|
|
26
30
|
};
|
|
27
31
|
}
|
|
28
32
|
export {
|
|
@@ -213,7 +213,11 @@ async function getScriptsAndStyles({ pipeline, filePath }) {
|
|
|
213
213
|
});
|
|
214
214
|
}
|
|
215
215
|
}
|
|
216
|
-
const { urls: styleUrls,
|
|
216
|
+
const { urls: styleUrls, styles: importedStyles } = await getStylesForURL(
|
|
217
|
+
filePath,
|
|
218
|
+
moduleLoader,
|
|
219
|
+
mode
|
|
220
|
+
);
|
|
217
221
|
let links = /* @__PURE__ */ new Set();
|
|
218
222
|
[...styleUrls].forEach((href) => {
|
|
219
223
|
links.add({
|
|
@@ -225,7 +229,7 @@ async function getScriptsAndStyles({ pipeline, filePath }) {
|
|
|
225
229
|
});
|
|
226
230
|
});
|
|
227
231
|
let styles = /* @__PURE__ */ new Set();
|
|
228
|
-
|
|
232
|
+
importedStyles.forEach(({ id, url, content }) => {
|
|
229
233
|
scripts.add({
|
|
230
234
|
props: {
|
|
231
235
|
type: "module",
|
|
@@ -235,7 +239,7 @@ async function getScriptsAndStyles({ pipeline, filePath }) {
|
|
|
235
239
|
});
|
|
236
240
|
styles.add({
|
|
237
241
|
props: {
|
|
238
|
-
"data-vite-dev-id":
|
|
242
|
+
"data-vite-dev-id": id
|
|
239
243
|
},
|
|
240
244
|
children: content
|
|
241
245
|
});
|