astro 2.7.3 → 2.7.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/astro.js +0 -1
- package/dist/@types/astro.d.ts +1 -1
- package/dist/assets/image-endpoint.js +1 -1
- package/dist/assets/services/vendor/squoosh/codecs.js +0 -2
- package/dist/assets/vendor/image-size/types/tiff.js +1 -1
- package/dist/content/utils.d.ts +1 -1
- package/dist/content/utils.js +1 -1
- package/dist/core/app/node.d.ts +1 -1
- package/dist/core/build/generate.js +12 -22
- package/dist/core/build/plugins/index.js +3 -3
- package/dist/core/build/plugins/plugin-analyzer.js +1 -1
- package/dist/core/build/plugins/plugin-css.js +1 -1
- package/dist/core/build/plugins/plugin-middleware.d.ts +2 -3
- package/dist/core/build/plugins/plugin-middleware.js +3 -3
- package/dist/core/build/plugins/plugin-renderers.d.ts +2 -3
- package/dist/core/build/plugins/plugin-renderers.js +3 -4
- package/dist/core/build/plugins/plugin-ssr.js +4 -11
- package/dist/core/compile/compile.js +0 -1
- package/dist/core/config/schema.d.ts +73 -73
- package/dist/core/config/schema.js +0 -1
- package/dist/core/constants.js +1 -1
- package/dist/core/cookies/cookies.js +4 -2
- package/dist/core/create-vite.js +2 -2
- package/dist/core/dev/dev.js +1 -1
- package/dist/core/dev/restart.js +1 -1
- package/dist/core/errors/dev/utils.js +2 -2
- package/dist/core/errors/errors.d.ts +6 -6
- package/dist/core/errors/overlay.d.ts +1 -2
- package/dist/core/errors/overlay.js +3 -2
- package/dist/core/errors/utils.js +1 -1
- package/dist/core/messages.js +2 -2
- package/dist/core/middleware/callMiddleware.js +0 -4
- package/dist/core/module-loader/loader.d.ts +1 -0
- package/dist/core/render/context.js +2 -2
- package/dist/core/render/core.d.ts +1 -21
- package/dist/core/render/core.js +0 -63
- package/dist/core/render/dev/index.js +2 -1
- package/dist/core/render/dev/vite.js +7 -8
- package/dist/core/render/environment.d.ts +13 -8
- package/dist/core/render/environment.js +0 -19
- package/dist/core/render/index.d.ts +3 -2
- package/dist/core/render/index.js +3 -10
- package/dist/core/render/params-and-props.d.ts +13 -0
- package/dist/core/render/params-and-props.js +57 -0
- package/dist/core/render/result.d.ts +12 -0
- package/dist/core/render/route-cache.d.ts +3 -2
- package/dist/core/render/route-cache.js +13 -7
- package/dist/core/routing/manifest/create.js +2 -22
- package/dist/events/error.js +6 -2
- package/dist/runtime/client/visible.js +1 -2
- package/dist/runtime/client/visible.prebuilt.d.ts +1 -1
- package/dist/runtime/client/visible.prebuilt.js +1 -1
- package/dist/runtime/server/astro-global.js +1 -1
- package/dist/runtime/server/astro-island.js +2 -2
- package/dist/runtime/server/astro-island.prebuilt.d.ts +1 -1
- package/dist/runtime/server/astro-island.prebuilt.js +1 -1
- package/dist/runtime/server/endpoint.js +1 -1
- package/dist/runtime/server/jsx.js +1 -1
- package/dist/runtime/server/render/head.js +1 -1
- package/dist/runtime/server/render/util.js +11 -3
- package/dist/vite-plugin-astro/compile.js +2 -4
- package/dist/vite-plugin-astro/hmr.js +1 -1
- package/dist/vite-plugin-astro-postprocess/index.d.ts +1 -6
- package/dist/vite-plugin-astro-postprocess/index.js +1 -1
- package/dist/vite-plugin-astro-server/plugin.js +2 -2
- package/dist/vite-plugin-astro-server/route.js +17 -12
- package/dist/vite-plugin-head/index.d.ts +2 -6
- package/dist/vite-plugin-head/index.js +2 -4
- package/dist/vite-plugin-html/transform/escape.js +2 -2
- package/dist/vite-plugin-html/transform/slots.js +1 -1
- package/dist/vite-plugin-jsx/import-source.js +1 -1
- package/dist/vite-plugin-jsx/tag.d.ts +1 -1
- package/dist/vite-plugin-jsx/tag.js +1 -2
- package/dist/vite-plugin-markdown/content-entry-type.js +2 -3
- package/dist/vite-plugin-scanner/scan.js +1 -1
- package/dist/vite-plugin-scripts/index.js +1 -1
- package/dist/vite-plugin-ssr-manifest/index.js +1 -1
- package/package.json +1 -1
package/astro.js
CHANGED
package/dist/@types/astro.d.ts
CHANGED
|
@@ -23,7 +23,7 @@ const get = async ({ request }) => {
|
|
|
23
23
|
}
|
|
24
24
|
const url = new URL(request.url);
|
|
25
25
|
const transform = await imageService.parseURL(url, imageServiceConfig);
|
|
26
|
-
if (!transform
|
|
26
|
+
if (!(transform == null ? void 0 : transform.src)) {
|
|
27
27
|
throw new Error("Incorrect transform returned by `parseURL`");
|
|
28
28
|
}
|
|
29
29
|
let inputBuffer = void 0;
|
|
@@ -211,7 +211,6 @@ const codecs = {
|
|
|
211
211
|
avif: {
|
|
212
212
|
name: "AVIF",
|
|
213
213
|
extension: "avif",
|
|
214
|
-
// eslint-disable-next-line no-control-regex
|
|
215
214
|
detectors: [/^\x00\x00\x00 ftypavif\x00\x00\x00\x00/],
|
|
216
215
|
dec: () => instantiateEmscriptenWasm(avifDec, avifDecWasm),
|
|
217
216
|
enc: async () => {
|
|
@@ -241,7 +240,6 @@ const codecs = {
|
|
|
241
240
|
oxipng: {
|
|
242
241
|
name: "OxiPNG",
|
|
243
242
|
extension: "png",
|
|
244
|
-
// eslint-disable-next-line no-control-regex
|
|
245
243
|
detectors: [/^\x89PNG\x0D\x0A\x1A\x0A/],
|
|
246
244
|
dec: async () => {
|
|
247
245
|
await pngEncDecInit();
|
|
@@ -26,7 +26,7 @@ function nextTag(buffer) {
|
|
|
26
26
|
function extractTags(buffer, isBigEndian) {
|
|
27
27
|
const tags = {};
|
|
28
28
|
let temp = buffer;
|
|
29
|
-
while (temp
|
|
29
|
+
while (temp == null ? void 0 : temp.length) {
|
|
30
30
|
const code = readUInt(temp, 16, 0, isBigEndian);
|
|
31
31
|
const type = readUInt(temp, 16, 2, isBigEndian);
|
|
32
32
|
const length = readUInt(temp, 32, 4, isBigEndian);
|
package/dist/content/utils.d.ts
CHANGED
|
@@ -119,7 +119,7 @@ export declare function getContentEntryIdAndSlug({ entry, contentDir, collection
|
|
|
119
119
|
};
|
|
120
120
|
export declare function getEntryType(entryPath: string, paths: Pick<ContentPaths, 'config' | 'contentDir'>, contentFileExts: string[], dataFileExts: string[], experimentalAssets?: boolean): 'content' | 'data' | 'config' | 'ignored' | 'unsupported';
|
|
121
121
|
export declare function hasUnderscoreBelowContentDirectoryPath(fileUrl: URL, contentDir: ContentPaths['contentDir']): boolean;
|
|
122
|
-
export declare function parseFrontmatter(fileContents: string
|
|
122
|
+
export declare function parseFrontmatter(fileContents: string): matter.GrayMatterFile<string>;
|
|
123
123
|
/**
|
|
124
124
|
* The content config is loaded separately from other `src/` files.
|
|
125
125
|
* This global observable lets dependent plugins (like the content flag plugin)
|
package/dist/content/utils.js
CHANGED
|
@@ -209,7 +209,7 @@ function getYAMLErrorLine(rawData, objectKey) {
|
|
|
209
209
|
const numNewlinesBeforeKey = dataBeforeKey.split("\n").length;
|
|
210
210
|
return numNewlinesBeforeKey;
|
|
211
211
|
}
|
|
212
|
-
function parseFrontmatter(fileContents
|
|
212
|
+
function parseFrontmatter(fileContents) {
|
|
213
213
|
try {
|
|
214
214
|
matter.clearCache();
|
|
215
215
|
return matter(fileContents);
|
package/dist/core/app/node.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ declare class NodeIncomingMessage extends IncomingMessage {
|
|
|
7
7
|
/**
|
|
8
8
|
* The read-only body property of the Request interface contains a ReadableStream with the body contents that have been added to the request.
|
|
9
9
|
*/
|
|
10
|
-
body?:
|
|
10
|
+
body?: unknown;
|
|
11
11
|
}
|
|
12
12
|
export declare class NodeApp extends App {
|
|
13
13
|
match(req: NodeIncomingMessage | Request, opts?: MatchOptions): RouteData | undefined;
|
|
@@ -222,27 +222,25 @@ async function getPathsForRoute(pageData, mod, opts, builtPaths) {
|
|
|
222
222
|
builtPaths.add(pageData.route.pathname);
|
|
223
223
|
} else {
|
|
224
224
|
const route = pageData.route;
|
|
225
|
-
const
|
|
225
|
+
const staticPaths = await callGetStaticPaths({
|
|
226
226
|
mod,
|
|
227
|
-
route
|
|
227
|
+
route,
|
|
228
|
+
routeCache: opts.routeCache,
|
|
228
229
|
isValidate: false,
|
|
229
230
|
logging: opts.logging,
|
|
230
231
|
ssr: isServerLikeOutput(opts.settings.config)
|
|
231
|
-
}).then((_result) => {
|
|
232
|
-
const label = _result.staticPaths.length === 1 ? "page" : "pages";
|
|
233
|
-
debug(
|
|
234
|
-
"build",
|
|
235
|
-
`\u251C\u2500\u2500 ${colors.bold(colors.green("\u2714"))} ${route.component} \u2192 ${colors.magenta(
|
|
236
|
-
`[${_result.staticPaths.length} ${label}]`
|
|
237
|
-
)}`
|
|
238
|
-
);
|
|
239
|
-
return _result;
|
|
240
232
|
}).catch((err) => {
|
|
241
233
|
debug("build", `\u251C\u2500\u2500 ${colors.bold(colors.red("\u2717"))} ${route.component}`);
|
|
242
234
|
throw err;
|
|
243
235
|
});
|
|
244
|
-
|
|
245
|
-
|
|
236
|
+
const label = staticPaths.length === 1 ? "page" : "pages";
|
|
237
|
+
debug(
|
|
238
|
+
"build",
|
|
239
|
+
`\u251C\u2500\u2500 ${colors.bold(colors.green("\u2714"))} ${route.component} \u2192 ${colors.magenta(
|
|
240
|
+
`[${staticPaths.length} ${label}]`
|
|
241
|
+
)}`
|
|
242
|
+
);
|
|
243
|
+
paths = staticPaths.map((staticPath) => {
|
|
246
244
|
try {
|
|
247
245
|
return route.generate(staticPath.params);
|
|
248
246
|
} catch (e) {
|
|
@@ -330,15 +328,7 @@ function getUrlForPath(pathname, base, origin, format, routeType) {
|
|
|
330
328
|
}
|
|
331
329
|
async function generatePath(pathname, opts, gopts, onRequest) {
|
|
332
330
|
const { settings, logging, origin, routeCache } = opts;
|
|
333
|
-
const {
|
|
334
|
-
mod,
|
|
335
|
-
internals,
|
|
336
|
-
linkIds,
|
|
337
|
-
scripts: hoistedScripts,
|
|
338
|
-
styles: _styles,
|
|
339
|
-
pageData,
|
|
340
|
-
renderers
|
|
341
|
-
} = gopts;
|
|
331
|
+
const { mod, internals, scripts: hoistedScripts, styles: _styles, pageData, renderers } = gopts;
|
|
342
332
|
if (pageData.route.type === "page") {
|
|
343
333
|
addPageName(pathname, opts);
|
|
344
334
|
}
|
|
@@ -16,11 +16,11 @@ function registerAllPlugins({ internals, options, register }) {
|
|
|
16
16
|
register(pluginAliasResolve(internals));
|
|
17
17
|
register(pluginAnalyzer(internals));
|
|
18
18
|
register(pluginInternals(internals));
|
|
19
|
-
register(pluginRenderers(options
|
|
20
|
-
register(pluginMiddleware(options
|
|
19
|
+
register(pluginRenderers(options));
|
|
20
|
+
register(pluginMiddleware(options));
|
|
21
21
|
register(pluginPages(options, internals));
|
|
22
22
|
register(pluginCSS(options, internals));
|
|
23
|
-
register(astroHeadBuildPlugin(
|
|
23
|
+
register(astroHeadBuildPlugin(internals));
|
|
24
24
|
register(pluginPrerender(options, internals));
|
|
25
25
|
register(astroConfigBuildPlugin(options, internals));
|
|
26
26
|
register(pluginHoistedScripts(options, internals));
|
|
@@ -98,7 +98,7 @@ function vitePluginAnalyzer(internals) {
|
|
|
98
98
|
const ids = this.getModuleIds();
|
|
99
99
|
for (const id of ids) {
|
|
100
100
|
const info = this.getModuleInfo(id);
|
|
101
|
-
if (!
|
|
101
|
+
if (!((_a = info == null ? void 0 : info.meta) == null ? void 0 : _a.astro))
|
|
102
102
|
continue;
|
|
103
103
|
const astro = info.meta.astro;
|
|
104
104
|
const pageData = getPageDataByViteID(internals, id);
|
|
@@ -64,7 +64,7 @@ function rollupPluginAstroBuildCSS(options) {
|
|
|
64
64
|
});
|
|
65
65
|
},
|
|
66
66
|
async generateBundle(_outputOptions, bundle) {
|
|
67
|
-
for (const [
|
|
67
|
+
for (const [, chunk] of Object.entries(bundle)) {
|
|
68
68
|
if (chunk.type !== "chunk")
|
|
69
69
|
continue;
|
|
70
70
|
if ("viteMetadata" in chunk === false)
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { Plugin as VitePlugin } from 'vite';
|
|
2
|
-
import type { BuildInternals } from '../internal.js';
|
|
3
2
|
import type { AstroBuildPlugin } from '../plugin';
|
|
4
3
|
import type { StaticBuildOptions } from '../types';
|
|
5
4
|
export declare const MIDDLEWARE_MODULE_ID = "@astro-middleware";
|
|
6
|
-
export declare function vitePluginMiddleware(opts: StaticBuildOptions
|
|
7
|
-
export declare function pluginMiddleware(opts: StaticBuildOptions
|
|
5
|
+
export declare function vitePluginMiddleware(opts: StaticBuildOptions): VitePlugin;
|
|
6
|
+
export declare function pluginMiddleware(opts: StaticBuildOptions): AstroBuildPlugin;
|
|
@@ -2,7 +2,7 @@ import { MIDDLEWARE_PATH_SEGMENT_NAME } from "../../constants.js";
|
|
|
2
2
|
import { addRollupInput } from "../add-rollup-input.js";
|
|
3
3
|
const MIDDLEWARE_MODULE_ID = "@astro-middleware";
|
|
4
4
|
const EMPTY_MIDDLEWARE = "\0empty-middleware";
|
|
5
|
-
function vitePluginMiddleware(opts
|
|
5
|
+
function vitePluginMiddleware(opts) {
|
|
6
6
|
return {
|
|
7
7
|
name: "@astro/plugin-middleware",
|
|
8
8
|
options(options) {
|
|
@@ -30,13 +30,13 @@ function vitePluginMiddleware(opts, _internals) {
|
|
|
30
30
|
}
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
|
-
function pluginMiddleware(opts
|
|
33
|
+
function pluginMiddleware(opts) {
|
|
34
34
|
return {
|
|
35
35
|
build: "ssr",
|
|
36
36
|
hooks: {
|
|
37
37
|
"build:before": () => {
|
|
38
38
|
return {
|
|
39
|
-
vitePlugin: vitePluginMiddleware(opts
|
|
39
|
+
vitePlugin: vitePluginMiddleware(opts)
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
42
|
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import type { Plugin as VitePlugin } from 'vite';
|
|
2
|
-
import type { BuildInternals } from '../internal.js';
|
|
3
2
|
import type { AstroBuildPlugin } from '../plugin';
|
|
4
3
|
import type { StaticBuildOptions } from '../types';
|
|
5
4
|
export declare const RENDERERS_MODULE_ID = "@astro-renderers";
|
|
6
5
|
export declare const RESOLVED_RENDERERS_MODULE_ID: string;
|
|
7
|
-
export declare function vitePluginRenderers(opts: StaticBuildOptions
|
|
8
|
-
export declare function pluginRenderers(opts: StaticBuildOptions
|
|
6
|
+
export declare function vitePluginRenderers(opts: StaticBuildOptions): VitePlugin;
|
|
7
|
+
export declare function pluginRenderers(opts: StaticBuildOptions): AstroBuildPlugin;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { addRollupInput } from "../add-rollup-input.js";
|
|
2
2
|
const RENDERERS_MODULE_ID = "@astro-renderers";
|
|
3
3
|
const RESOLVED_RENDERERS_MODULE_ID = `\0${RENDERERS_MODULE_ID}`;
|
|
4
|
-
|
|
5
|
-
function vitePluginRenderers(opts, _internals) {
|
|
4
|
+
function vitePluginRenderers(opts) {
|
|
6
5
|
return {
|
|
7
6
|
name: "@astro/plugin-renderers",
|
|
8
7
|
options(options) {
|
|
@@ -34,13 +33,13 @@ ${exports.join("\n")}`;
|
|
|
34
33
|
}
|
|
35
34
|
};
|
|
36
35
|
}
|
|
37
|
-
function pluginRenderers(opts
|
|
36
|
+
function pluginRenderers(opts) {
|
|
38
37
|
return {
|
|
39
38
|
build: "ssr",
|
|
40
39
|
hooks: {
|
|
41
40
|
"build:before": () => {
|
|
42
41
|
return {
|
|
43
|
-
vitePlugin: vitePluginRenderers(opts
|
|
42
|
+
vitePlugin: vitePluginRenderers(opts)
|
|
44
43
|
};
|
|
45
44
|
}
|
|
46
45
|
}
|
|
@@ -31,10 +31,7 @@ function vitePluginSSR(internals, adapter, options) {
|
|
|
31
31
|
},
|
|
32
32
|
async load(id) {
|
|
33
33
|
if (id === RESOLVED_SSR_VIRTUAL_MODULE_ID) {
|
|
34
|
-
const {
|
|
35
|
-
settings: { config },
|
|
36
|
-
allPages
|
|
37
|
-
} = options;
|
|
34
|
+
const { allPages } = options;
|
|
38
35
|
const imports = [];
|
|
39
36
|
const contents = [];
|
|
40
37
|
const exports = [];
|
|
@@ -66,7 +63,7 @@ function vitePluginSSR(internals, adapter, options) {
|
|
|
66
63
|
return void 0;
|
|
67
64
|
},
|
|
68
65
|
async generateBundle(_opts, bundle) {
|
|
69
|
-
for (const [
|
|
66
|
+
for (const [, chunk] of Object.entries(bundle)) {
|
|
70
67
|
if (chunk.type === "asset") {
|
|
71
68
|
internals.staticFiles.add(chunk.fileName);
|
|
72
69
|
}
|
|
@@ -141,10 +138,6 @@ function vitePluginSSRSplit(internals, adapter, options) {
|
|
|
141
138
|
},
|
|
142
139
|
async load(id) {
|
|
143
140
|
if (id.startsWith(RESOLVED_SPLIT_MODULE_ID)) {
|
|
144
|
-
const {
|
|
145
|
-
settings: { config },
|
|
146
|
-
allPages
|
|
147
|
-
} = options;
|
|
148
141
|
const imports = [];
|
|
149
142
|
const contents = [];
|
|
150
143
|
const exports = [];
|
|
@@ -162,7 +155,7 @@ function vitePluginSSRSplit(internals, adapter, options) {
|
|
|
162
155
|
return void 0;
|
|
163
156
|
},
|
|
164
157
|
async generateBundle(_opts, bundle) {
|
|
165
|
-
for (const [
|
|
158
|
+
for (const [, chunk] of Object.entries(bundle)) {
|
|
166
159
|
if (chunk.type === "asset") {
|
|
167
160
|
internals.staticFiles.add(chunk.fileName);
|
|
168
161
|
}
|
|
@@ -215,7 +208,7 @@ function pluginSSRSplit(options, internals) {
|
|
|
215
208
|
logging: options.logging,
|
|
216
209
|
entryPoints: internals.entryPoints
|
|
217
210
|
});
|
|
218
|
-
for (const [
|
|
211
|
+
for (const [, chunk] of internals.ssrSplitEntryChunks) {
|
|
219
212
|
const code = injectManifest(manifest, chunk);
|
|
220
213
|
mutate(chunk, "server", code);
|
|
221
214
|
}
|