astro 3.6.2 → 4.0.0-beta.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/client.d.ts +19 -20
- package/components/Code.astro +0 -20
- package/components/ViewTransitions.astro +2 -2
- package/dist/@types/astro.d.ts +19 -81
- package/dist/assets/build/generate.js +2 -2
- package/dist/assets/internal.js +1 -1
- package/dist/assets/services/vendor/squoosh/avif/avif_node_dec.js +3 -3
- package/dist/assets/services/vendor/squoosh/avif/avif_node_enc.js +3 -3
- package/dist/assets/services/vendor/squoosh/mozjpeg/mozjpeg_node_dec.js +3 -3
- package/dist/assets/services/vendor/squoosh/mozjpeg/mozjpeg_node_enc.js +3 -3
- package/dist/assets/services/vendor/squoosh/webp/webp_node_dec.js +3 -3
- package/dist/assets/services/vendor/squoosh/webp/webp_node_enc.js +3 -3
- package/dist/cli/add/babel.d.ts +1 -1
- package/dist/cli/build/index.js +0 -1
- package/dist/cli/flags.js +0 -3
- package/dist/cli/info/index.d.ts +5 -0
- package/dist/cli/info/index.js +16 -7
- package/dist/cli/install-package.js +1 -1
- package/dist/cli/telemetry/index.js +6 -6
- package/dist/content/server-listeners.js +7 -7
- package/dist/content/types-generator.d.ts +1 -4
- package/dist/content/types-generator.js +31 -51
- package/dist/core/app/index.js +2 -4
- package/dist/core/build/buildPipeline.js +3 -3
- package/dist/core/build/generate.js +18 -39
- package/dist/core/build/index.js +10 -32
- package/dist/core/build/internal.js +3 -3
- package/dist/core/build/plugin.d.ts +2 -2
- package/dist/core/build/plugins/plugin-manifest.js +1 -4
- package/dist/core/build/plugins/plugin-pages.js +0 -3
- package/dist/core/build/plugins/plugin-renderers.d.ts +1 -1
- package/dist/core/build/plugins/plugin-ssr.js +5 -6
- package/dist/core/build/static-build.js +4 -7
- package/dist/core/build/types.d.ts +1 -1
- package/dist/core/build/util.js +1 -1
- package/dist/core/config/config.js +1 -2
- package/dist/core/config/schema.d.ts +209 -277
- package/dist/core/config/schema.js +5 -38
- package/dist/core/constants.js +1 -1
- package/dist/core/create-vite.d.ts +2 -2
- package/dist/core/create-vite.js +12 -1
- package/dist/core/dev/dev.js +6 -4
- package/dist/core/dev/restart.js +7 -7
- package/dist/core/endpoint/index.d.ts +2 -7
- package/dist/core/endpoint/index.js +3 -87
- package/dist/core/errors/dev/vite.js +0 -1
- package/dist/core/logger/console.d.ts +2 -4
- package/dist/core/logger/console.js +4 -28
- package/dist/core/logger/core.d.ts +17 -5
- package/dist/core/logger/core.js +27 -2
- package/dist/core/logger/node.d.ts +2 -32
- package/dist/core/logger/node.js +8 -69
- package/dist/core/messages.d.ts +4 -11
- package/dist/core/messages.js +43 -59
- package/dist/core/middleware/callMiddleware.d.ts +1 -2
- package/dist/core/middleware/callMiddleware.js +1 -12
- package/dist/core/middleware/index.d.ts +2 -2
- package/dist/core/middleware/sequence.d.ts +2 -2
- package/dist/core/pipeline.d.ts +2 -2
- package/dist/core/pipeline.js +8 -13
- package/dist/core/preview/static-preview-server.js +2 -4
- package/dist/core/preview/vite-plugin-astro-preview.js +31 -21
- package/dist/core/render/core.js +0 -6
- package/dist/core/render/index.d.ts +1 -1
- package/dist/core/render/result.js +1 -1
- package/dist/core/render/route-cache.js +2 -5
- package/dist/core/request.js +3 -3
- package/dist/core/routing/manifest/create.js +14 -12
- package/dist/core/routing/validation.js +4 -4
- package/dist/core/sync/index.js +2 -2
- package/dist/i18n/middleware.d.ts +2 -2
- package/dist/i18n/vite-plugin-i18n.js +1 -1
- package/dist/integrations/astroFeaturesValidation.d.ts +1 -1
- package/dist/integrations/astroFeaturesValidation.js +12 -18
- package/dist/integrations/index.js +28 -6
- package/dist/prefetch/vite-plugin-prefetch.js +3 -3
- package/dist/runtime/client/dev-overlay/entrypoint.js +14 -10
- package/dist/runtime/client/dev-overlay/overlay.js +1 -1
- package/dist/runtime/client/dev-overlay/plugins/astro.d.ts +14 -1
- package/dist/runtime/client/dev-overlay/plugins/astro.js +326 -15
- package/dist/runtime/client/dev-overlay/plugins/settings.js +26 -2
- package/dist/runtime/client/dev-overlay/plugins/utils/icons.d.ts +3 -0
- package/dist/runtime/client/dev-overlay/plugins/utils/icons.js +37 -0
- package/dist/runtime/client/dev-overlay/plugins/utils/window.d.ts +1 -2
- package/dist/runtime/client/dev-overlay/plugins/utils/window.js +25 -29
- package/dist/runtime/client/dev-overlay/ui-library/badge.d.ts +9 -0
- package/dist/runtime/client/dev-overlay/ui-library/badge.js +67 -0
- package/dist/runtime/client/dev-overlay/ui-library/button.d.ts +9 -0
- package/dist/runtime/client/dev-overlay/ui-library/button.js +83 -0
- package/dist/runtime/client/dev-overlay/ui-library/card.d.ts +1 -3
- package/dist/runtime/client/dev-overlay/ui-library/card.js +17 -25
- package/dist/runtime/client/dev-overlay/ui-library/highlight.js +1 -0
- package/dist/runtime/client/dev-overlay/ui-library/icon.d.ts +10 -0
- package/dist/runtime/client/dev-overlay/ui-library/icon.js +36 -0
- package/dist/runtime/client/dev-overlay/ui-library/icons.d.ts +21 -6
- package/dist/runtime/client/dev-overlay/ui-library/icons.js +22 -7
- package/dist/runtime/client/dev-overlay/ui-library/index.d.ts +8 -0
- package/dist/runtime/client/dev-overlay/ui-library/index.js +18 -0
- package/dist/runtime/client/dev-overlay/ui-library/window.d.ts +0 -4
- package/dist/runtime/client/dev-overlay/ui-library/window.js +0 -33
- package/dist/runtime/server/endpoint.d.ts +1 -1
- package/dist/runtime/server/endpoint.js +11 -22
- package/dist/transitions/vite-plugin-transitions.js +4 -4
- package/dist/virtual-modules/i18n.d.ts +1 -0
- package/dist/virtual-modules/i18n.js +1 -0
- package/dist/virtual-modules/middleware.d.ts +1 -0
- package/dist/virtual-modules/middleware.js +5 -0
- package/dist/virtual-modules/prefetch.d.ts +1 -0
- package/dist/virtual-modules/prefetch.js +1 -0
- package/dist/virtual-modules/transitions-events.d.ts +1 -0
- package/dist/virtual-modules/transitions-events.js +1 -0
- package/dist/virtual-modules/transitions-router.d.ts +1 -0
- package/dist/virtual-modules/transitions-router.js +1 -0
- package/dist/virtual-modules/transitions-types.d.ts +1 -0
- package/dist/virtual-modules/transitions-types.js +1 -0
- package/dist/virtual-modules/transitions.d.ts +1 -0
- package/dist/virtual-modules/transitions.js +1 -0
- package/dist/vite-plugin-astro/hmr.js +8 -14
- package/dist/vite-plugin-astro/index.js +28 -6
- package/dist/vite-plugin-astro-server/base.js +5 -5
- package/dist/vite-plugin-astro-server/response.js +1 -1
- package/dist/vite-plugin-astro-server/route.js +30 -6
- package/dist/vite-plugin-inject-env-ts/index.js +3 -3
- package/dist/vite-plugin-integrations-container/index.js +1 -1
- package/dist/vite-plugin-load-fallback/index.js +1 -3
- package/dist/vite-plugin-scanner/index.js +3 -6
- package/dist/vite-plugin-scripts/index.js +1 -1
- package/dist/vite-plugin-utils/index.d.ts +1 -0
- package/dist/vite-plugin-utils/index.js +5 -0
- package/package.json +56 -68
- package/dist/core/middleware/namespace.d.ts +0 -1
- package/dist/core/middleware/namespace.js +0 -5
- package/dist/vite-plugin-astro-server/common.d.ts +0 -2
- package/dist/vite-plugin-astro-server/common.js +0 -7
- package/import-meta.d.ts +0 -30
|
@@ -66,9 +66,6 @@ function vitePluginPages(opts, internals) {
|
|
|
66
66
|
};
|
|
67
67
|
}
|
|
68
68
|
function shouldBundleMiddleware(settings) {
|
|
69
|
-
if (settings.config.build.excludeMiddleware === true) {
|
|
70
|
-
return false;
|
|
71
|
-
}
|
|
72
69
|
if (settings.adapter?.adapterFeatures?.edgeMiddleware === true) {
|
|
73
70
|
return false;
|
|
74
71
|
}
|
|
@@ -2,6 +2,6 @@ import type { Plugin as VitePlugin } from 'vite';
|
|
|
2
2
|
import type { AstroBuildPlugin } from '../plugin.js';
|
|
3
3
|
import type { StaticBuildOptions } from '../types.js';
|
|
4
4
|
export declare const RENDERERS_MODULE_ID = "@astro-renderers";
|
|
5
|
-
export declare const RESOLVED_RENDERERS_MODULE_ID
|
|
5
|
+
export declare const RESOLVED_RENDERERS_MODULE_ID = "\0@astro-renderers";
|
|
6
6
|
export declare function vitePluginRenderers(opts: StaticBuildOptions): VitePlugin;
|
|
7
7
|
export declare function pluginRenderers(opts: StaticBuildOptions): AstroBuildPlugin;
|
|
@@ -80,8 +80,7 @@ function pluginSSR(options, internals) {
|
|
|
80
80
|
targets: ["server"],
|
|
81
81
|
hooks: {
|
|
82
82
|
"build:before": () => {
|
|
83
|
-
let vitePlugin = ssr &&
|
|
84
|
-
options.settings.config.build.split === false && functionPerRouteEnabled === false ? vitePluginSSR(internals, options.settings.adapter, options) : void 0;
|
|
83
|
+
let vitePlugin = ssr && functionPerRouteEnabled === false ? vitePluginSSR(internals, options.settings.adapter, options) : void 0;
|
|
85
84
|
return {
|
|
86
85
|
enforce: "after-user-plugins",
|
|
87
86
|
vitePlugin
|
|
@@ -91,7 +90,7 @@ function pluginSSR(options, internals) {
|
|
|
91
90
|
if (!ssr) {
|
|
92
91
|
return;
|
|
93
92
|
}
|
|
94
|
-
if (
|
|
93
|
+
if (functionPerRouteEnabled) {
|
|
95
94
|
return;
|
|
96
95
|
}
|
|
97
96
|
if (!internals.ssrEntryChunk) {
|
|
@@ -110,7 +109,7 @@ function vitePluginSSRSplit(internals, adapter, options) {
|
|
|
110
109
|
name: "@astrojs/vite-plugin-astro-ssr-split",
|
|
111
110
|
enforce: "post",
|
|
112
111
|
options(opts) {
|
|
113
|
-
if (
|
|
112
|
+
if (functionPerRouteEnabled) {
|
|
114
113
|
const inputs = /* @__PURE__ */ new Set();
|
|
115
114
|
for (const [path, pageData] of eachPageFromAllPages(options.allPages)) {
|
|
116
115
|
if (routeIsRedirect(pageData.route)) {
|
|
@@ -172,7 +171,7 @@ function pluginSSRSplit(options, internals) {
|
|
|
172
171
|
targets: ["server"],
|
|
173
172
|
hooks: {
|
|
174
173
|
"build:before": () => {
|
|
175
|
-
let vitePlugin = ssr &&
|
|
174
|
+
let vitePlugin = ssr && functionPerRouteEnabled ? vitePluginSSRSplit(internals, options.settings.adapter, options) : void 0;
|
|
176
175
|
return {
|
|
177
176
|
enforce: "after-user-plugins",
|
|
178
177
|
vitePlugin
|
|
@@ -185,7 +184,7 @@ function generateSSRCode(config, adapter) {
|
|
|
185
184
|
const imports = [];
|
|
186
185
|
const contents = [];
|
|
187
186
|
let pageMap;
|
|
188
|
-
if (
|
|
187
|
+
if (isFunctionPerRouteEnabled(adapter)) {
|
|
189
188
|
pageMap = "pageModule";
|
|
190
189
|
} else {
|
|
191
190
|
pageMap = "pageMap";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { teardown } from "@astrojs/compiler";
|
|
2
2
|
import * as eslexer from "es-module-lexer";
|
|
3
3
|
import glob from "fast-glob";
|
|
4
|
-
import { bgGreen, bgMagenta, black,
|
|
4
|
+
import { bgGreen, bgMagenta, black, green } from "kleur/colors";
|
|
5
5
|
import fs from "node:fs";
|
|
6
6
|
import path, { extname } from "node:path";
|
|
7
7
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
@@ -55,7 +55,7 @@ async function viteBuild(opts) {
|
|
|
55
55
|
const ssrTime = performance.now();
|
|
56
56
|
opts.logger.info("build", `Building ${settings.config.output} entrypoints...`);
|
|
57
57
|
const ssrOutput = await ssrBuild(opts, internals, pageInput, container);
|
|
58
|
-
opts.logger.info("build",
|
|
58
|
+
opts.logger.info("build", green(`\u2713 Completed in ${getTimeStat(ssrTime, performance.now())}.`));
|
|
59
59
|
settings.timer.end("SSR build");
|
|
60
60
|
settings.timer.start("Client build");
|
|
61
61
|
const rendererClientEntrypoints = settings.renderers.map((r) => r.clientEntrypoint).filter((a) => typeof a === "string");
|
|
@@ -209,7 +209,6 @@ async function ssrBuild(opts, internals, input, container) {
|
|
|
209
209
|
}
|
|
210
210
|
async function clientBuild(opts, internals, input, container) {
|
|
211
211
|
const { settings, viteConfig } = opts;
|
|
212
|
-
const timer = performance.now();
|
|
213
212
|
const ssr = isServerLikeOutput(settings.config);
|
|
214
213
|
const out = ssr ? settings.config.build.client : getOutDirWithinCwd(settings.config.outDir);
|
|
215
214
|
if (!input.size) {
|
|
@@ -219,8 +218,8 @@ async function clientBuild(opts, internals, input, container) {
|
|
|
219
218
|
return null;
|
|
220
219
|
}
|
|
221
220
|
const { lastVitePlugins, vitePlugins } = await container.runBeforeHook("client", input);
|
|
222
|
-
opts.logger.info(
|
|
223
|
-
${bgGreen(black(" building client "))}`);
|
|
221
|
+
opts.logger.info("SKIP_FORMAT", `
|
|
222
|
+
${bgGreen(black(" building client (vite) "))}`);
|
|
224
223
|
const viteBuildConfig = {
|
|
225
224
|
...viteConfig,
|
|
226
225
|
mode: viteConfig.mode || "production",
|
|
@@ -256,8 +255,6 @@ ${bgGreen(black(" building client "))}`);
|
|
|
256
255
|
logger: opts.logger
|
|
257
256
|
});
|
|
258
257
|
const buildResult = await vite.build(viteBuildConfig);
|
|
259
|
-
opts.logger.info(null, dim(`Completed in ${getTimeStat(timer, performance.now())}.
|
|
260
|
-
`));
|
|
261
258
|
return buildResult;
|
|
262
259
|
}
|
|
263
260
|
async function runPostBuildHooks(container, ssrReturn, clientReturn) {
|
|
@@ -49,7 +49,7 @@ export interface SinglePageBuiltModule {
|
|
|
49
49
|
/**
|
|
50
50
|
* The `onRequest` hook exported by the middleware
|
|
51
51
|
*/
|
|
52
|
-
onRequest?: MiddlewareHandler
|
|
52
|
+
onRequest?: MiddlewareHandler;
|
|
53
53
|
renderers: SSRLoadedRenderer[];
|
|
54
54
|
}
|
|
55
55
|
export type ViteBuildReturn = Awaited<ReturnType<typeof vite.build>>;
|
package/dist/core/build/util.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
function getTimeStat(timeStart, timeEnd) {
|
|
2
2
|
const buildTime = timeEnd - timeStart;
|
|
3
|
-
return buildTime <
|
|
3
|
+
return buildTime < 1e3 ? `${Math.round(buildTime)}ms` : `${(buildTime / 1e3).toFixed(2)}s`;
|
|
4
4
|
}
|
|
5
5
|
function shouldAppendForwardSlash(trailingSlash, buildFormat) {
|
|
6
6
|
switch (trailingSlash) {
|
|
@@ -36,8 +36,7 @@ function resolveFlags(flags) {
|
|
|
36
36
|
port: typeof flags.port === "number" ? flags.port : void 0,
|
|
37
37
|
open: typeof flags.open === "boolean" ? flags.open : void 0,
|
|
38
38
|
config: typeof flags.config === "string" ? flags.config : void 0,
|
|
39
|
-
host: typeof flags.host === "string" || typeof flags.host === "boolean" ? flags.host : void 0
|
|
40
|
-
drafts: typeof flags.drafts === "boolean" ? flags.drafts : void 0
|
|
39
|
+
host: typeof flags.host === "string" || typeof flags.host === "boolean" ? flags.host : void 0
|
|
41
40
|
};
|
|
42
41
|
}
|
|
43
42
|
function resolveRoot(cwd) {
|