astro 5.6.0 → 5.6.1
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/actions/plugins.js +1 -1
- package/dist/assets/vite-plugin-assets.js +31 -28
- package/dist/content/content-layer.js +3 -3
- package/dist/content/vite-plugin-content-virtual-mod.js +7 -9
- package/dist/core/build/plugins/plugin-component-entry.js +3 -1
- package/dist/core/build/plugins/plugin-manifest.js +1 -1
- package/dist/core/build/plugins/plugin-pages.js +1 -1
- package/dist/core/build/plugins/plugin-prerender.js +3 -0
- package/dist/core/build/plugins/plugin-renderers.js +3 -3
- package/dist/core/build/plugins/plugin-ssr.js +2 -2
- package/dist/core/config/schemas/base.js +1 -0
- package/dist/core/config/schemas/refined.js +0 -7
- 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/middleware/vite-plugin.js +3 -3
- package/dist/core/server-islands/vite-plugin-server-islands.js +1 -1
- package/dist/env/vite-plugin-env.js +3 -3
- package/dist/integrations/hooks.js +3 -0
- package/dist/manifest/virtual-module.js +2 -2
- package/dist/prefetch/vite-plugin-prefetch.js +1 -1
- package/dist/toolbar/vite-plugin-dev-toolbar.js +41 -39
- package/dist/transitions/vite-plugin-transitions.js +22 -18
- package/dist/vite-plugin-load-fallback/index.js +4 -2
- package/dist/vite-plugin-scripts/index.js +9 -3
- package/dist/vite-plugin-ssr-manifest/index.js +4 -3
- package/package.json +4 -4
package/dist/actions/plugins.js
CHANGED
|
@@ -88,33 +88,32 @@ function assets({ settings }) {
|
|
|
88
88
|
},
|
|
89
89
|
load(id) {
|
|
90
90
|
if (id === resolvedVirtualModuleId) {
|
|
91
|
-
return
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
export { inferRemoteSize } from "astro/assets/utils/inferRemoteSize.js";
|
|
91
|
+
return {
|
|
92
|
+
code: `
|
|
93
|
+
export { getConfiguredImageService, isLocalService } from "astro/assets";
|
|
94
|
+
import { getImage as getImageInternal } from "astro/assets";
|
|
95
|
+
export { default as Image } from "astro/components/${imageComponentPrefix}Image.astro";
|
|
96
|
+
export { default as Picture } from "astro/components/${imageComponentPrefix}Picture.astro";
|
|
97
|
+
export { inferRemoteSize } from "astro/assets/utils/inferRemoteSize.js";
|
|
99
98
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
99
|
+
export const imageConfig = ${JSON.stringify({ ...settings.config.image, experimentalResponsiveImages: settings.config.experimental.responsiveImages })};
|
|
100
|
+
// This is used by the @astrojs/node integration to locate images.
|
|
101
|
+
// It's unused on other platforms, but on some platforms like Netlify (and presumably also Vercel)
|
|
102
|
+
// new URL("dist/...") is interpreted by the bundler as a signal to include that directory
|
|
103
|
+
// in the Lambda bundle, which would bloat the bundle with images.
|
|
104
|
+
// To prevent this, we mark the URL construction as pure,
|
|
105
|
+
// so that it's tree-shaken away for all platforms that don't need it.
|
|
106
|
+
export const outDir = /* #__PURE__ */ new URL(${JSON.stringify(
|
|
108
107
|
new URL(
|
|
109
108
|
settings.buildOutput === "server" ? settings.config.build.client : settings.config.outDir
|
|
110
109
|
)
|
|
111
110
|
)});
|
|
112
|
-
|
|
111
|
+
export const assetsDir = /* #__PURE__ */ new URL(${JSON.stringify(
|
|
113
112
|
settings.config.build.assets
|
|
114
113
|
)}, outDir);
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
114
|
+
export const getImage = async (options) => await getImageInternal(options, imageConfig);
|
|
115
|
+
`
|
|
116
|
+
};
|
|
118
117
|
}
|
|
119
118
|
},
|
|
120
119
|
buildStart() {
|
|
@@ -123,7 +122,7 @@ function assets({ settings }) {
|
|
|
123
122
|
},
|
|
124
123
|
// In build, rewrite paths to ESM imported images in code to their final location
|
|
125
124
|
async renderChunk(code) {
|
|
126
|
-
const assetUrlRE = /__ASTRO_ASSET_IMAGE__([\w$]
|
|
125
|
+
const assetUrlRE = /__ASTRO_ASSET_IMAGE__([\w$]+)__(?:_(.*?)__)?/g;
|
|
127
126
|
let match;
|
|
128
127
|
let s;
|
|
129
128
|
while (match = assetUrlRE.exec(code)) {
|
|
@@ -167,7 +166,7 @@ function assets({ settings }) {
|
|
|
167
166
|
if (!assetRegexEnds.test(id)) {
|
|
168
167
|
return;
|
|
169
168
|
}
|
|
170
|
-
const emitFile = shouldEmitFile ? this.emitFile : void 0;
|
|
169
|
+
const emitFile = shouldEmitFile ? this.emitFile.bind(this) : void 0;
|
|
171
170
|
const imageMetadata = await emitESMImage(
|
|
172
171
|
id,
|
|
173
172
|
this.meta.watchMode,
|
|
@@ -182,16 +181,20 @@ function assets({ settings }) {
|
|
|
182
181
|
}
|
|
183
182
|
if (settings.config.experimental.svg && /\.svg$/.test(id)) {
|
|
184
183
|
const { contents, ...metadata } = imageMetadata;
|
|
185
|
-
return makeSvgComponent(metadata, contents);
|
|
184
|
+
return { code: makeSvgComponent(metadata, contents) };
|
|
186
185
|
}
|
|
187
186
|
if (options?.ssr) {
|
|
188
|
-
return
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
187
|
+
return {
|
|
188
|
+
code: `export default ${getProxyCode(
|
|
189
|
+
imageMetadata,
|
|
190
|
+
settings.buildOutput === "server"
|
|
191
|
+
)}`
|
|
192
|
+
};
|
|
192
193
|
} else {
|
|
193
194
|
globalThis.astroAsset.referencedImages.add(imageMetadata.fsPath);
|
|
194
|
-
return
|
|
195
|
+
return {
|
|
196
|
+
code: `export default ${JSON.stringify(imageMetadata)}`
|
|
197
|
+
};
|
|
195
198
|
}
|
|
196
199
|
}
|
|
197
200
|
}
|
|
@@ -153,7 +153,7 @@ ${contentConfig.error.message}`);
|
|
|
153
153
|
logger.info("Content config changed");
|
|
154
154
|
shouldClear = true;
|
|
155
155
|
}
|
|
156
|
-
if (previousAstroVersion && previousAstroVersion !== "5.6.
|
|
156
|
+
if (previousAstroVersion && previousAstroVersion !== "5.6.1") {
|
|
157
157
|
logger.info("Astro version changed");
|
|
158
158
|
shouldClear = true;
|
|
159
159
|
}
|
|
@@ -161,8 +161,8 @@ ${contentConfig.error.message}`);
|
|
|
161
161
|
logger.info("Clearing content store");
|
|
162
162
|
this.#store.clearAll();
|
|
163
163
|
}
|
|
164
|
-
if ("5.6.
|
|
165
|
-
await this.#store.metaStore().set("astro-version", "5.6.
|
|
164
|
+
if ("5.6.1") {
|
|
165
|
+
await this.#store.metaStore().set("astro-version", "5.6.1");
|
|
166
166
|
}
|
|
167
167
|
if (currentConfigDigest) {
|
|
168
168
|
await this.#store.metaStore().set("content-config-digest", currentConfigDigest);
|
|
@@ -122,7 +122,7 @@ function astroContentVirtualModPlugin({
|
|
|
122
122
|
}
|
|
123
123
|
if (id === RESOLVED_DATA_STORE_VIRTUAL_ID) {
|
|
124
124
|
if (!fs.existsSync(dataStoreFile)) {
|
|
125
|
-
return "export default new Map()";
|
|
125
|
+
return { code: "export default new Map()" };
|
|
126
126
|
}
|
|
127
127
|
const jsonData = await fs.promises.readFile(dataStoreFile, "utf-8");
|
|
128
128
|
try {
|
|
@@ -140,17 +140,15 @@ function astroContentVirtualModPlugin({
|
|
|
140
140
|
}
|
|
141
141
|
if (id === ASSET_IMPORTS_RESOLVED_STUB_ID) {
|
|
142
142
|
const assetImportsFile = new URL(ASSET_IMPORTS_FILE, settings.dotAstroDir);
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
}
|
|
146
|
-
return fs.readFileSync(assetImportsFile, "utf-8");
|
|
143
|
+
return {
|
|
144
|
+
code: fs.existsSync(assetImportsFile) ? fs.readFileSync(assetImportsFile, "utf-8") : "export default new Map()"
|
|
145
|
+
};
|
|
147
146
|
}
|
|
148
147
|
if (id === MODULES_MJS_VIRTUAL_ID) {
|
|
149
148
|
const modules = new URL(MODULES_IMPORTS_FILE, settings.dotAstroDir);
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
}
|
|
153
|
-
return fs.readFileSync(modules, "utf-8");
|
|
149
|
+
return {
|
|
150
|
+
code: fs.existsSync(modules) ? fs.readFileSync(modules, "utf-8") : "export default new Map()"
|
|
151
|
+
};
|
|
154
152
|
}
|
|
155
153
|
},
|
|
156
154
|
configureServer(server) {
|
|
@@ -44,7 +44,9 @@ function vitePluginComponentEntry(internals) {
|
|
|
44
44
|
const componentId = id.slice(astroEntryPrefix.length);
|
|
45
45
|
const exportNames = componentToExportNames.get(componentId);
|
|
46
46
|
if (exportNames) {
|
|
47
|
-
return
|
|
47
|
+
return {
|
|
48
|
+
code: `export { ${exportNames.join(", ")} } from ${JSON.stringify(componentId)}`
|
|
49
|
+
};
|
|
48
50
|
}
|
|
49
51
|
}
|
|
50
52
|
}
|
|
@@ -48,7 +48,7 @@ function vitePluginManifest(options, internals) {
|
|
|
48
48
|
`_privateSetManifestDontUseThis(manifest);`
|
|
49
49
|
];
|
|
50
50
|
const exports = [`export { manifest }`];
|
|
51
|
-
return [...imports, ...contents, ...exports].join("\n");
|
|
51
|
+
return { code: [...imports, ...contents, ...exports].join("\n") };
|
|
52
52
|
}
|
|
53
53
|
},
|
|
54
54
|
async generateBundle(_opts, bundle) {
|
|
@@ -40,7 +40,7 @@ function vitePluginPages(opts, internals) {
|
|
|
40
40
|
exports.push(`export const page = () => _page`);
|
|
41
41
|
imports.push(`import { renderers } from "${RENDERERS_MODULE_ID}";`);
|
|
42
42
|
exports.push(`export { renderers };`);
|
|
43
|
-
return `${imports.join("\n")}${exports.join("\n")}
|
|
43
|
+
return { code: `${imports.join("\n")}${exports.join("\n")}` };
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
}
|
|
@@ -41,6 +41,9 @@ function getNonPrerenderOnlyChunks(bundle, internals) {
|
|
|
41
41
|
}
|
|
42
42
|
nonPrerenderOnlyEntryChunks.add(chunk);
|
|
43
43
|
}
|
|
44
|
+
if (chunk.type === "chunk" && chunk.isDynamicEntry) {
|
|
45
|
+
nonPrerenderOnlyEntryChunks.add(chunk);
|
|
46
|
+
}
|
|
44
47
|
}
|
|
45
48
|
const nonPrerenderOnlyChunks = new Set(nonPrerenderOnlyEntryChunks);
|
|
46
49
|
for (const chunk of nonPrerenderOnlyChunks) {
|
|
@@ -26,10 +26,10 @@ function vitePluginRenderers(opts) {
|
|
|
26
26
|
i++;
|
|
27
27
|
}
|
|
28
28
|
exports.push(`export const renderers = [${rendererItems}];`);
|
|
29
|
-
return `${imports.join("\n")}
|
|
30
|
-
${exports.join("\n")}
|
|
29
|
+
return { code: `${imports.join("\n")}
|
|
30
|
+
${exports.join("\n")}` };
|
|
31
31
|
} else {
|
|
32
|
-
return `export const renderers = []
|
|
32
|
+
return { code: `export const renderers = [];` };
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
}
|
|
@@ -22,7 +22,7 @@ function vitePluginAdapter(adapter) {
|
|
|
22
22
|
},
|
|
23
23
|
async load(id) {
|
|
24
24
|
if (id === RESOLVED_ADAPTER_VIRTUAL_MODULE_ID) {
|
|
25
|
-
return `export * from ${JSON.stringify(adapter.serverEntrypoint)}
|
|
25
|
+
return { code: `export * from ${JSON.stringify(adapter.serverEntrypoint)};` };
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
};
|
|
@@ -86,7 +86,7 @@ function vitePluginSSR(internals, adapter, options) {
|
|
|
86
86
|
const ssrCode = generateSSRCode(adapter, middleware.id);
|
|
87
87
|
imports.push(...ssrCode.imports);
|
|
88
88
|
contents.push(...ssrCode.contents);
|
|
89
|
-
return [...imports, ...contents, ...exports].join("\n");
|
|
89
|
+
return { code: [...imports, ...contents, ...exports].join("\n") };
|
|
90
90
|
}
|
|
91
91
|
},
|
|
92
92
|
async generateBundle(_opts, bundle) {
|
|
@@ -227,6 +227,7 @@ const AstroConfigSchema = z.object({
|
|
|
227
227
|
routing: z.literal("manual").or(
|
|
228
228
|
z.object({
|
|
229
229
|
prefixDefaultLocale: z.boolean().optional().default(false),
|
|
230
|
+
// TODO: Astro 6.0 change to false
|
|
230
231
|
redirectToDefaultLocale: z.boolean().optional().default(true),
|
|
231
232
|
fallbackType: z.enum(["redirect", "rewrite"]).optional().default("redirect")
|
|
232
233
|
})
|
|
@@ -24,13 +24,6 @@ const AstroConfigRefinedSchema = z.custom().superRefine((config, ctx) => {
|
|
|
24
24
|
});
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
|
-
if (config.i18n && typeof config.i18n.routing !== "string" && !config.i18n.routing.redirectToDefaultLocale && !config.i18n.routing.prefixDefaultLocale) {
|
|
28
|
-
ctx.addIssue({
|
|
29
|
-
code: z.ZodIssueCode.custom,
|
|
30
|
-
message: "The option `i18n.routing.redirectToDefaultLocale` is only useful when the `i18n.routing.prefixDefaultLocale` is set to `true`. Remove the option `i18n.routing.redirectToDefaultLocale`, or change its value to `true`.",
|
|
31
|
-
path: ["i18n", "routing", "redirectToDefaultLocale"]
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
27
|
if (config.outDir.toString().startsWith(config.publicDir.toString())) {
|
|
35
28
|
ctx.addIssue({
|
|
36
29
|
code: z.ZodIssueCode.custom,
|
package/dist/core/constants.js
CHANGED
package/dist/core/dev/dev.js
CHANGED
|
@@ -22,7 +22,7 @@ async function dev(inlineConfig) {
|
|
|
22
22
|
await telemetry.record([]);
|
|
23
23
|
const restart = await createContainerWithAutomaticRestart({ inlineConfig, fs });
|
|
24
24
|
const logger = restart.container.logger;
|
|
25
|
-
const currentVersion = "5.6.
|
|
25
|
+
const currentVersion = "5.6.1";
|
|
26
26
|
const isPrerelease = currentVersion.includes("-");
|
|
27
27
|
if (!isPrerelease) {
|
|
28
28
|
try {
|
package/dist/core/messages.js
CHANGED
|
@@ -38,7 +38,7 @@ function serverStart({
|
|
|
38
38
|
host,
|
|
39
39
|
base
|
|
40
40
|
}) {
|
|
41
|
-
const version = "5.6.
|
|
41
|
+
const version = "5.6.1";
|
|
42
42
|
const localPrefix = `${dim("\u2503")} Local `;
|
|
43
43
|
const networkPrefix = `${dim("\u2503")} Network `;
|
|
44
44
|
const emptyPrefix = " ".repeat(11);
|
|
@@ -282,7 +282,7 @@ function printHelp({
|
|
|
282
282
|
message.push(
|
|
283
283
|
linebreak(),
|
|
284
284
|
` ${bgGreen(black(` ${commandName} `))} ${green(
|
|
285
|
-
`v${"5.6.
|
|
285
|
+
`v${"5.6.1"}`
|
|
286
286
|
)} ${headline}`
|
|
287
287
|
);
|
|
288
288
|
}
|
|
@@ -36,14 +36,14 @@ function vitePluginMiddleware({ settings }) {
|
|
|
36
36
|
if (!userMiddlewareIsPresent && settings.config.i18n?.routing === "manual") {
|
|
37
37
|
throw new AstroError(MissingMiddlewareForInternationalization);
|
|
38
38
|
}
|
|
39
|
-
return "export const onRequest = (_, next) => next()";
|
|
39
|
+
return { code: "export const onRequest = (_, next) => next()" };
|
|
40
40
|
} else if (id === MIDDLEWARE_MODULE_ID) {
|
|
41
41
|
if (!userMiddlewareIsPresent && settings.config.i18n?.routing === "manual") {
|
|
42
42
|
throw new AstroError(MissingMiddlewareForInternationalization);
|
|
43
43
|
}
|
|
44
44
|
const preMiddleware = createMiddlewareImports(settings.middlewares.pre, "pre");
|
|
45
45
|
const postMiddleware = createMiddlewareImports(settings.middlewares.post, "post");
|
|
46
|
-
const
|
|
46
|
+
const code = `
|
|
47
47
|
${userMiddlewareIsPresent ? `import { onRequest as userOnRequest } from '${resolvedMiddlewareId}';` : ""}
|
|
48
48
|
import { sequence } from 'astro:middleware';
|
|
49
49
|
${preMiddleware.importsCode}${postMiddleware.importsCode}
|
|
@@ -54,7 +54,7 @@ export const onRequest = sequence(
|
|
|
54
54
|
${postMiddleware.sequenceCode}
|
|
55
55
|
);
|
|
56
56
|
`.trim();
|
|
57
|
-
return
|
|
57
|
+
return { code };
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
};
|
|
@@ -22,7 +22,7 @@ function vitePluginServerIslands({ settings, logger }) {
|
|
|
22
22
|
},
|
|
23
23
|
load(id) {
|
|
24
24
|
if (id === RESOLVED_VIRTUAL_ISLAND_MAP_ID) {
|
|
25
|
-
return `export const serverIslandMap = ${serverIslandPlaceholder}
|
|
25
|
+
return { code: `export const serverIslandMap = ${serverIslandPlaceholder};` };
|
|
26
26
|
}
|
|
27
27
|
},
|
|
28
28
|
transform(_code, id) {
|
|
@@ -54,12 +54,12 @@ function astroEnv({ settings, sync, envLoader }) {
|
|
|
54
54
|
load(id, options) {
|
|
55
55
|
if (id === resolveVirtualModuleId(VIRTUAL_MODULES_IDS.client)) {
|
|
56
56
|
ensureTemplateAreLoaded();
|
|
57
|
-
return templates.client;
|
|
57
|
+
return { code: templates.client };
|
|
58
58
|
}
|
|
59
59
|
if (id === resolveVirtualModuleId(VIRTUAL_MODULES_IDS.server)) {
|
|
60
60
|
if (options?.ssr) {
|
|
61
61
|
ensureTemplateAreLoaded();
|
|
62
|
-
return templates.server;
|
|
62
|
+
return { code: templates.server };
|
|
63
63
|
}
|
|
64
64
|
throw new AstroError({
|
|
65
65
|
...AstroErrorData.ServerOnlyModule,
|
|
@@ -68,7 +68,7 @@ function astroEnv({ settings, sync, envLoader }) {
|
|
|
68
68
|
}
|
|
69
69
|
if (id === resolveVirtualModuleId(VIRTUAL_MODULES_IDS.internal)) {
|
|
70
70
|
ensureTemplateAreLoaded();
|
|
71
|
-
return templates.internal;
|
|
71
|
+
return { code: templates.internal };
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
};
|
|
@@ -256,6 +256,9 @@ async function runHookConfigSetup({
|
|
|
256
256
|
if (astroJSXRenderer) {
|
|
257
257
|
updatedSettings.renderers.push(astroJSXRenderer);
|
|
258
258
|
}
|
|
259
|
+
if (updatedConfig.i18n && typeof updatedConfig.i18n.routing !== "string") {
|
|
260
|
+
updatedConfig.i18n.routing.redirectToDefaultLocale ??= updatedConfig.i18n.routing.prefixDefaultLocale || false;
|
|
261
|
+
}
|
|
259
262
|
updatedSettings.config = updatedConfig;
|
|
260
263
|
return updatedSettings;
|
|
261
264
|
}
|
|
@@ -28,7 +28,7 @@ function virtualModulePlugin({
|
|
|
28
28
|
message: CantUseAstroConfigModuleError.message(VIRTUAL_CLIENT_ID)
|
|
29
29
|
});
|
|
30
30
|
}
|
|
31
|
-
return
|
|
31
|
+
return { code: serializeClientConfig(manifest) };
|
|
32
32
|
} else if (id == RESOLVED_VIRTUAL_SERVER_ID) {
|
|
33
33
|
if (!settings.config.experimental.serializeConfig) {
|
|
34
34
|
throw new AstroError({
|
|
@@ -42,7 +42,7 @@ function virtualModulePlugin({
|
|
|
42
42
|
message: AstroErrorData.ServerOnlyModule.message(VIRTUAL_SERVER_ID)
|
|
43
43
|
});
|
|
44
44
|
}
|
|
45
|
-
return
|
|
45
|
+
return { code: serializeServerConfig(manifest) };
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
};
|
|
@@ -25,7 +25,7 @@ function astroPrefetch({ settings }) {
|
|
|
25
25
|
load(id) {
|
|
26
26
|
if (id === resolvedVirtualModuleId) {
|
|
27
27
|
if (!prefetch) throwPrefetchNotEnabledError();
|
|
28
|
-
return `export { prefetch } from "astro/virtual-modules/prefetch.js"
|
|
28
|
+
return { code: `export { prefetch } from "astro/virtual-modules/prefetch.js";` };
|
|
29
29
|
}
|
|
30
30
|
},
|
|
31
31
|
transform(code, id) {
|
|
@@ -50,58 +50,60 @@ ${args.error}`
|
|
|
50
50
|
},
|
|
51
51
|
async load(id) {
|
|
52
52
|
if (id === resolvedPrivateVirtualModuleId) {
|
|
53
|
-
return
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
plugin
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
53
|
+
return {
|
|
54
|
+
code: `
|
|
55
|
+
export const loadDevToolbarApps = async () => {
|
|
56
|
+
return (await Promise.all([${settings.devToolbarApps.map(
|
|
57
|
+
(plugin) => `safeLoadPlugin(${JSON.stringify(
|
|
58
|
+
plugin
|
|
59
|
+
)}, async () => (await import(${JSON.stringify(
|
|
60
|
+
typeof plugin === "string" ? plugin : plugin.entrypoint.toString()
|
|
61
|
+
)})).default, ${JSON.stringify(
|
|
62
|
+
typeof plugin === "string" ? plugin : plugin.entrypoint.toString()
|
|
63
|
+
)})`
|
|
64
|
+
).join(",")}]));
|
|
65
|
+
};
|
|
65
66
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
67
|
+
async function safeLoadPlugin(appDefinition, importEntrypoint, entrypoint) {
|
|
68
|
+
try {
|
|
69
|
+
let app;
|
|
70
|
+
if (typeof appDefinition === 'string') {
|
|
71
|
+
app = await importEntrypoint();
|
|
71
72
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
73
|
+
if (typeof app !== 'object' || !app.id || !app.name) {
|
|
74
|
+
throw new Error("Apps must default export an object with an id, and a name.");
|
|
75
|
+
}
|
|
76
|
+
} else {
|
|
77
|
+
app = appDefinition;
|
|
77
78
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
79
|
+
if (typeof app !== 'object' || !app.id || !app.name || !app.entrypoint) {
|
|
80
|
+
throw new Error("Apps must be an object with an id, a name and an entrypoint.");
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const loadedApp = await importEntrypoint();
|
|
81
84
|
|
|
82
|
-
|
|
85
|
+
if (typeof loadedApp !== 'object') {
|
|
86
|
+
throw new Error("App entrypoint must default export an object.");
|
|
87
|
+
}
|
|
83
88
|
|
|
84
|
-
|
|
85
|
-
throw new Error("App entrypoint must default export an object.");
|
|
89
|
+
app = { ...app, ...loadedApp };
|
|
86
90
|
}
|
|
87
91
|
|
|
88
|
-
|
|
89
|
-
}
|
|
92
|
+
return app;
|
|
93
|
+
} catch (err) {
|
|
94
|
+
console.error(\`Failed to load dev toolbar app from \${entrypoint}: \${err.message}\`);
|
|
90
95
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
96
|
+
if (import.meta.hot) {
|
|
97
|
+
import.meta.hot.send('astro:devtoolbar:error:load', { entrypoint: entrypoint, error: err.message })
|
|
98
|
+
}
|
|
94
99
|
|
|
95
|
-
|
|
96
|
-
import.meta.hot.send('astro:devtoolbar:error:load', { entrypoint: entrypoint, error: err.message })
|
|
100
|
+
return undefined;
|
|
97
101
|
}
|
|
98
102
|
|
|
99
103
|
return undefined;
|
|
100
104
|
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
}
|
|
104
|
-
`;
|
|
105
|
+
`
|
|
106
|
+
};
|
|
105
107
|
}
|
|
106
108
|
}
|
|
107
109
|
};
|
|
@@ -22,26 +22,30 @@ function astroTransitions({ settings }) {
|
|
|
22
22
|
},
|
|
23
23
|
load(id) {
|
|
24
24
|
if (id === resolvedVirtualModuleId) {
|
|
25
|
-
return
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
25
|
+
return {
|
|
26
|
+
code: `
|
|
27
|
+
export * from "astro/virtual-modules/transitions.js";
|
|
28
|
+
export {
|
|
29
|
+
default as ViewTransitions,
|
|
30
|
+
default as ClientRouter
|
|
31
|
+
} from "astro/components/ClientRouter.astro";
|
|
32
|
+
`
|
|
33
|
+
};
|
|
32
34
|
}
|
|
33
35
|
if (id === resolvedVirtualClientModuleId) {
|
|
34
|
-
return
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
36
|
+
return {
|
|
37
|
+
code: `
|
|
38
|
+
export { navigate, supportsViewTransitions, transitionEnabledOnThisPage } from "astro/virtual-modules/transitions-router.js";
|
|
39
|
+
export * from "astro/virtual-modules/transitions-types.js";
|
|
40
|
+
export {
|
|
41
|
+
TRANSITION_BEFORE_PREPARATION, isTransitionBeforePreparationEvent, TransitionBeforePreparationEvent,
|
|
42
|
+
TRANSITION_AFTER_PREPARATION,
|
|
43
|
+
TRANSITION_BEFORE_SWAP, isTransitionBeforeSwapEvent, TransitionBeforeSwapEvent,
|
|
44
|
+
TRANSITION_AFTER_SWAP, TRANSITION_PAGE_LOAD
|
|
45
|
+
} from "astro/virtual-modules/transitions-events.js";
|
|
46
|
+
export { swapFunctions } from "astro/virtual-modules/transitions-swap-functions.js";
|
|
47
|
+
`
|
|
48
|
+
};
|
|
45
49
|
}
|
|
46
50
|
},
|
|
47
51
|
transform(code, id) {
|
|
@@ -17,13 +17,19 @@ function astroScriptsPlugin({ settings }) {
|
|
|
17
17
|
},
|
|
18
18
|
async load(id) {
|
|
19
19
|
if (id === BEFORE_HYDRATION_SCRIPT_ID) {
|
|
20
|
-
return
|
|
20
|
+
return {
|
|
21
|
+
code: settings.scripts.filter((s) => s.stage === "before-hydration").map((s) => s.content).join("\n")
|
|
22
|
+
};
|
|
21
23
|
}
|
|
22
24
|
if (id === PAGE_SCRIPT_ID) {
|
|
23
|
-
return
|
|
25
|
+
return {
|
|
26
|
+
code: settings.scripts.filter((s) => s.stage === "page").map((s) => s.content).join("\n")
|
|
27
|
+
};
|
|
24
28
|
}
|
|
25
29
|
if (id === PAGE_SSR_SCRIPT_ID) {
|
|
26
|
-
return
|
|
30
|
+
return {
|
|
31
|
+
code: settings.scripts.filter((s) => s.stage === "page-ssr").map((s) => s.content).join("\n")
|
|
32
|
+
};
|
|
27
33
|
}
|
|
28
34
|
return null;
|
|
29
35
|
},
|
|
@@ -11,12 +11,13 @@ function vitePluginSSRManifest() {
|
|
|
11
11
|
},
|
|
12
12
|
load(id) {
|
|
13
13
|
if (id === resolvedManifestVirtualModuleId) {
|
|
14
|
-
return
|
|
14
|
+
return {
|
|
15
|
+
code: `export let manifest = {};
|
|
15
16
|
export function _privateSetManifestDontUseThis(ssrManifest) {
|
|
16
17
|
manifest = ssrManifest;
|
|
17
|
-
}
|
|
18
|
+
}`
|
|
19
|
+
};
|
|
18
20
|
}
|
|
19
|
-
return void 0;
|
|
20
21
|
}
|
|
21
22
|
};
|
|
22
23
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "astro",
|
|
3
|
-
"version": "5.6.
|
|
3
|
+
"version": "5.6.1",
|
|
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",
|
|
@@ -145,7 +145,7 @@
|
|
|
145
145
|
"tinyexec": "^0.3.2",
|
|
146
146
|
"tinyglobby": "^0.2.12",
|
|
147
147
|
"tsconfck": "^3.1.5",
|
|
148
|
-
"ultrahtml": "^1.
|
|
148
|
+
"ultrahtml": "^1.6.0",
|
|
149
149
|
"unist-util-visit": "^5.0.0",
|
|
150
150
|
"unstorage": "^1.15.0",
|
|
151
151
|
"vfile": "^6.0.3",
|
|
@@ -157,9 +157,9 @@
|
|
|
157
157
|
"zod": "^3.24.2",
|
|
158
158
|
"zod-to-json-schema": "^3.24.5",
|
|
159
159
|
"zod-to-ts": "^1.2.0",
|
|
160
|
-
"@astrojs/internal-helpers": "0.6.1",
|
|
161
160
|
"@astrojs/markdown-remark": "6.3.1",
|
|
162
|
-
"@astrojs/telemetry": "3.2.0"
|
|
161
|
+
"@astrojs/telemetry": "3.2.0",
|
|
162
|
+
"@astrojs/internal-helpers": "0.6.1"
|
|
163
163
|
},
|
|
164
164
|
"optionalDependencies": {
|
|
165
165
|
"sharp": "^0.33.3"
|