astro 2.0.16 → 2.0.18

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.
@@ -11,6 +11,7 @@ import type { z } from 'zod';
11
11
  import type { SerializedSSRManifest } from '../core/app/types';
12
12
  import type { PageBuildData } from '../core/build/types';
13
13
  import type { AstroConfigSchema } from '../core/config';
14
+ import type { AstroTimer } from '../core/config/timer';
14
15
  import type { AstroCookies } from '../core/cookies';
15
16
  import type { AstroComponentFactory, AstroComponentInstance } from '../runtime/server';
16
17
  import { SUPPORTED_MARKDOWN_FILE_EXTENSIONS } from './../core/constants.js';
@@ -915,6 +916,7 @@ export interface AstroSettings {
915
916
  tsConfigPath: string | undefined;
916
917
  watchFiles: string[];
917
918
  forceDisableTelemetry: boolean;
919
+ timer: AstroTimer;
918
920
  }
919
921
  export type AsyncRendererComponentFn<U> = (Component: any, props: any, slots: Record<string, string>, metadata?: AstroComponentMetadata) => Promise<U>;
920
922
  /** Generic interface for a component (Astro, Svelte, React, etc.) */
package/dist/cli/index.js CHANGED
@@ -154,7 +154,7 @@ async function runCommand(cmd, flags) {
154
154
  }
155
155
  case "build": {
156
156
  const { default: build } = await import("../core/build/index.js");
157
- return await build(settings, { ...flags, logging, telemetry });
157
+ return await build(settings, { ...flags, logging, telemetry, teardownCompiler: true });
158
158
  }
159
159
  case "check": {
160
160
  const ret = await check(settings, { logging });
@@ -421,7 +421,8 @@ async function updateAstroConfig({
421
421
  let output = await generate(ast);
422
422
  const comment = "// https://astro.build/config";
423
423
  const defaultExport = "export default defineConfig";
424
- output = output.replace(` ${comment}`, "");
424
+ output = output.replace(`
425
+ ${comment}`, "");
425
426
  output = output.replace(`${defaultExport}`, `
426
427
  ${comment}
427
428
  ${defaultExport}`);
@@ -216,7 +216,7 @@ callEndpoint_fn = async function(request, routeData, mod, status = 200) {
216
216
  route: routeData,
217
217
  status
218
218
  });
219
- const result = await callEndpoint(handler, __privateGet(this, _env), ctx);
219
+ const result = await callEndpoint(handler, __privateGet(this, _env), ctx, __privateGet(this, _logging));
220
220
  if (result.type === "response") {
221
221
  if (result.response.headers.get("X-Astro-Response") === "Not-Found") {
222
222
  const fourOhFourRequest = new Request(new URL("/404", request.url));
@@ -271,7 +271,7 @@ async function generatePath(pathname, opts, gopts) {
271
271
  let encoding;
272
272
  if (pageData.route.type === "endpoint") {
273
273
  const endpointHandler = mod;
274
- const result = await callEndpoint(endpointHandler, env, ctx);
274
+ const result = await callEndpoint(endpointHandler, env, ctx, logging);
275
275
  if (result.type === "response") {
276
276
  throwIfRedirectNotAllowed(result.response, opts.settings.config);
277
277
  if (!result.response.body)
@@ -5,6 +5,11 @@ export interface BuildOptions {
5
5
  mode?: RuntimeMode;
6
6
  logging: LogOptions;
7
7
  telemetry: AstroTelemetry;
8
+ /**
9
+ * Teardown the compiler WASM instance after build. This can improve performance when
10
+ * building once, but may cause a performance hit if building multiple times in a row.
11
+ */
12
+ teardownCompiler?: boolean;
8
13
  }
9
14
  /** `astro build` */
10
15
  export default function build(settings: AstroSettings, options: BuildOptions): Promise<void>;
@@ -13,7 +13,7 @@ import { apply as applyPolyfill } from "../polyfill.js";
13
13
  import { RouteCache } from "../render/route-cache.js";
14
14
  import { createRouteManifest } from "../routing/index.js";
15
15
  import { collectPagesData } from "./page-data.js";
16
- import { staticBuild } from "./static-build.js";
16
+ import { staticBuild, viteBuild } from "./static-build.js";
17
17
  import { getTimeStat } from "./util.js";
18
18
  async function build(settings, options) {
19
19
  applyPolyfill();
@@ -28,6 +28,7 @@ class AstroBuilder {
28
28
  }
29
29
  this.settings = settings;
30
30
  this.logging = options.logging;
31
+ this.teardownCompiler = options.teardownCompiler ?? false;
31
32
  this.routeCache = new RouteCache(this.logging);
32
33
  this.origin = settings.config.site ? new URL(settings.config.site).origin : `http://localhost:${settings.config.server.port}`;
33
34
  this.manifest = { routes: [] };
@@ -51,7 +52,7 @@ class AstroBuilder {
51
52
  middlewareMode: true
52
53
  }
53
54
  },
54
- { settings: this.settings, logging, mode: "build" }
55
+ { settings: this.settings, logging, mode: "build", command: "build" }
55
56
  );
56
57
  await runHookConfigDone({ settings: this.settings, logging });
57
58
  const { sync } = await import("../sync/index.js");
@@ -88,7 +89,7 @@ class AstroBuilder {
88
89
  "build",
89
90
  colors.dim(`Completed in ${getTimeStat(this.timer.init, performance.now())}.`)
90
91
  );
91
- await staticBuild({
92
+ const opts = {
92
93
  allPages,
93
94
  settings: this.settings,
94
95
  logging: this.logging,
@@ -97,9 +98,12 @@ class AstroBuilder {
97
98
  origin: this.origin,
98
99
  pageNames,
99
100
  routeCache: this.routeCache,
101
+ teardownCompiler: this.teardownCompiler,
100
102
  viteConfig,
101
103
  buildConfig
102
- });
104
+ };
105
+ const { internals } = await viteBuild(opts);
106
+ await staticBuild(opts, internals);
103
107
  this.timer.assetsStart = performance.now();
104
108
  Object.keys(assets).map((k) => {
105
109
  if (!assets[k])
@@ -125,6 +129,7 @@ class AstroBuilder {
125
129
  buildMode: this.settings.config.output
126
130
  });
127
131
  }
132
+ this.settings.timer.writeStats();
128
133
  }
129
134
  async run() {
130
135
  const setupData = await this.setup();
@@ -1,2 +1,6 @@
1
+ import { BuildInternals } from '../../core/build/internal.js';
1
2
  import type { StaticBuildOptions } from './types';
2
- export declare function staticBuild(opts: StaticBuildOptions): Promise<void>;
3
+ export declare function viteBuild(opts: StaticBuildOptions): Promise<{
4
+ internals: BuildInternals;
5
+ }>;
6
+ export declare function staticBuild(opts: StaticBuildOptions, internals: BuildInternals): Promise<void>;
@@ -1,3 +1,4 @@
1
+ import { teardown } from "@astrojs/compiler";
1
2
  import * as eslexer from "es-module-lexer";
2
3
  import glob from "fast-glob";
3
4
  import fs from "fs";
@@ -22,17 +23,16 @@ import { trackPageData } from "./internal.js";
22
23
  import { createPluginContainer } from "./plugin.js";
23
24
  import { registerAllPlugins } from "./plugins/index.js";
24
25
  import { getTimeStat } from "./util.js";
25
- async function staticBuild(opts) {
26
+ async function viteBuild(opts) {
26
27
  var _a, _b, _c;
27
28
  const { allPages, settings } = opts;
28
29
  if (isModeServerWithNoAdapter(opts.settings)) {
29
30
  throw new AstroError(AstroErrorData.NoAdapterInstalled);
30
31
  }
32
+ settings.timer.start("SSR build");
31
33
  const pageInput = /* @__PURE__ */ new Set();
32
34
  const facadeIdToPageDataMap = /* @__PURE__ */ new Map();
33
35
  const internals = createBuildInternals();
34
- const timer = {};
35
- timer.buildStart = performance.now();
36
36
  for (const [component, pageData] of Object.entries(allPages)) {
37
37
  const astroModuleURL = new URL("./" + component, settings.config.root);
38
38
  const astroModuleId = prependForwardSlash(component);
@@ -45,10 +45,12 @@ async function staticBuild(opts) {
45
45
  }
46
46
  const container = createPluginContainer(opts, internals);
47
47
  registerAllPlugins(container);
48
- timer.ssr = performance.now();
48
+ const ssrTime = performance.now();
49
49
  info(opts.logging, "build", `Building ${settings.config.output} entrypoints...`);
50
50
  const ssrOutput = await ssrBuild(opts, internals, pageInput, container);
51
- info(opts.logging, "build", dim(`Completed in ${getTimeStat(timer.ssr, performance.now())}.`));
51
+ info(opts.logging, "build", dim(`Completed in ${getTimeStat(ssrTime, performance.now())}.`));
52
+ settings.timer.end("SSR build");
53
+ settings.timer.start("Client build");
52
54
  const rendererClientEntrypoints = settings.renderers.map((r) => r.clientEntrypoint).filter((a) => typeof a === "string");
53
55
  const clientInput = /* @__PURE__ */ new Set([
54
56
  ...internals.discoveredHydratedComponents,
@@ -59,23 +61,34 @@ async function staticBuild(opts) {
59
61
  if (settings.scripts.some((script) => script.stage === "page")) {
60
62
  clientInput.add(PAGE_SCRIPT_ID);
61
63
  }
62
- timer.clientBuild = performance.now();
63
64
  const clientOutput = await clientBuild(opts, internals, clientInput, container);
64
- timer.generate = performance.now();
65
65
  await runPostBuildHooks(container, ssrOutput, clientOutput);
66
+ settings.timer.end("Client build");
67
+ internals.ssrEntryChunk = void 0;
68
+ if (opts.teardownCompiler) {
69
+ teardown();
70
+ }
71
+ return { internals };
72
+ }
73
+ async function staticBuild(opts, internals) {
74
+ const { settings } = opts;
66
75
  switch (settings.config.output) {
67
76
  case "static": {
77
+ settings.timer.start("Static generate");
68
78
  await generatePages(opts, internals);
69
79
  await cleanServerOutput(opts);
80
+ settings.timer.end("Static generate");
70
81
  return;
71
82
  }
72
83
  case "server": {
84
+ settings.timer.start("Server generate");
73
85
  await generatePages(opts, internals);
74
86
  await cleanStaticOutput(opts, internals);
75
87
  info(opts.logging, null, `
76
88
  ${bgMagenta(black(" finalizing server assets "))}
77
89
  `);
78
90
  await ssrMoveAssets(opts);
91
+ settings.timer.end("Server generate");
79
92
  return;
80
93
  }
81
94
  }
@@ -284,5 +297,6 @@ async function ssrMoveAssets(opts) {
284
297
  }
285
298
  }
286
299
  export {
287
- staticBuild
300
+ staticBuild,
301
+ viteBuild
288
302
  };
@@ -33,6 +33,7 @@ export interface StaticBuildOptions {
33
33
  pageNames: string[];
34
34
  routeCache: RouteCache;
35
35
  viteConfig: InlineConfig;
36
+ teardownCompiler: boolean;
36
37
  }
37
38
  export interface SingleFileBuiltModule {
38
39
  pageMap: Map<ComponentPath, ComponentInstance>;
@@ -2,6 +2,7 @@ import { SUPPORTED_MARKDOWN_FILE_EXTENSIONS } from "./../constants.js";
2
2
  import { fileURLToPath, pathToFileURL } from "url";
3
3
  import jsxRenderer from "../../jsx/renderer.js";
4
4
  import { createDefaultDevConfig } from "./config.js";
5
+ import { AstroTimer } from "./timer.js";
5
6
  import { loadTSConfig } from "./tsconfig.js";
6
7
  function createBaseSettings(config) {
7
8
  return {
@@ -14,7 +15,8 @@ function createBaseSettings(config) {
14
15
  renderers: [jsxRenderer],
15
16
  scripts: [],
16
17
  watchFiles: [],
17
- forceDisableTelemetry: false
18
+ forceDisableTelemetry: false,
19
+ timer: new AstroTimer()
18
20
  };
19
21
  }
20
22
  function createSettings(config, cwd) {
@@ -0,0 +1,27 @@
1
+ export interface Stat {
2
+ elapsedTime: number;
3
+ heapUsedChange: number;
4
+ heapUsedTotal: number;
5
+ }
6
+ /**
7
+ * Timer to track certain operations' performance. Used by Astro's scripts only.
8
+ * Set `process.env.ASTRO_TIMER_PATH` truthy to enable.
9
+ */
10
+ export declare class AstroTimer {
11
+ private enabled;
12
+ private ongoingTimers;
13
+ private stats;
14
+ constructor();
15
+ /**
16
+ * Start a timer for a scope with a given name.
17
+ */
18
+ start(name: string): void;
19
+ /**
20
+ * End a timer for a scope with a given name.
21
+ */
22
+ end(name: string): void;
23
+ /**
24
+ * Write stats to `process.env.ASTRO_TIMER_PATH`
25
+ */
26
+ writeStats(): void;
27
+ }
@@ -0,0 +1,42 @@
1
+ import fs from "fs";
2
+ class AstroTimer {
3
+ constructor() {
4
+ this.ongoingTimers = /* @__PURE__ */ new Map();
5
+ this.stats = {};
6
+ this.enabled = !!process.env.ASTRO_TIMER_PATH;
7
+ }
8
+ start(name) {
9
+ var _a;
10
+ if (!this.enabled)
11
+ return;
12
+ (_a = globalThis.gc) == null ? void 0 : _a.call(globalThis);
13
+ this.ongoingTimers.set(name, {
14
+ startTime: performance.now(),
15
+ startHeap: process.memoryUsage().heapUsed
16
+ });
17
+ }
18
+ end(name) {
19
+ var _a;
20
+ if (!this.enabled)
21
+ return;
22
+ const stat = this.ongoingTimers.get(name);
23
+ if (!stat)
24
+ return;
25
+ (_a = globalThis.gc) == null ? void 0 : _a.call(globalThis);
26
+ const endHeap = process.memoryUsage().heapUsed;
27
+ this.stats[name] = {
28
+ elapsedTime: performance.now() - stat.startTime,
29
+ heapUsedChange: endHeap - stat.startHeap,
30
+ heapUsedTotal: endHeap
31
+ };
32
+ this.ongoingTimers.delete(name);
33
+ }
34
+ writeStats() {
35
+ if (!this.enabled)
36
+ return;
37
+ fs.writeFileSync(process.env.ASTRO_TIMER_PATH, JSON.stringify(this.stats, null, 2));
38
+ }
39
+ }
40
+ export {
41
+ AstroTimer
42
+ };
@@ -1,4 +1,4 @@
1
- const ASTRO_VERSION = "2.0.16";
1
+ const ASTRO_VERSION = "2.0.18";
2
2
  const SUPPORTED_MARKDOWN_FILE_EXTENSIONS = [
3
3
  ".markdown",
4
4
  ".mdown",
@@ -7,8 +7,9 @@ interface CreateViteOptions {
7
7
  settings: AstroSettings;
8
8
  logging: LogOptions;
9
9
  mode: 'dev' | 'build' | string;
10
+ command?: 'dev' | 'build';
10
11
  fs?: typeof nodeFs;
11
12
  }
12
13
  /** Return a common starting point for all Vite actions */
13
- export declare function createVite(commandConfig: vite.InlineConfig, { settings, logging, mode, fs }: CreateViteOptions): Promise<vite.InlineConfig>;
14
+ export declare function createVite(commandConfig: vite.InlineConfig, { settings, logging, mode, command, fs }: CreateViteOptions): Promise<vite.InlineConfig>;
14
15
  export {};
@@ -28,18 +28,18 @@ const ALWAYS_NOEXTERNAL = [
28
28
  "@nanostores/preact",
29
29
  "@fontsource/*"
30
30
  ];
31
- async function createVite(commandConfig, { settings, logging, mode, fs = nodeFs }) {
32
- var _a;
31
+ async function createVite(commandConfig, { settings, logging, mode, command, fs = nodeFs }) {
32
+ var _a, _b;
33
33
  const astroPkgsConfig = await crawlFrameworkPkgs({
34
34
  root: fileURLToPath(settings.config.root),
35
35
  isBuild: mode === "build",
36
36
  viteUserConfig: settings.config.vite,
37
37
  isFrameworkPkgByJson(pkgJson) {
38
- var _a2, _b, _c, _d, _e;
38
+ var _a2, _b2, _c, _d, _e;
39
39
  if (((_a2 = pkgJson == null ? void 0 : pkgJson.astro) == null ? void 0 : _a2.external) === true) {
40
40
  return false;
41
41
  }
42
- return ((_b = pkgJson.peerDependencies) == null ? void 0 : _b.astro) || ((_c = pkgJson.dependencies) == null ? void 0 : _c.astro) || ((_d = pkgJson.keywords) == null ? void 0 : _d.includes("astro")) || ((_e = pkgJson.keywords) == null ? void 0 : _e.includes("astro-component")) || /^(@[^\/]+\/)?astro\-/.test(pkgJson.name);
42
+ return ((_b2 = pkgJson.peerDependencies) == null ? void 0 : _b2.astro) || ((_c = pkgJson.dependencies) == null ? void 0 : _c.astro) || ((_d = pkgJson.keywords) == null ? void 0 : _d.includes("astro")) || ((_e = pkgJson.keywords) == null ? void 0 : _e.includes("astro-component")) || /^(@[^\/]+\/)?astro\-/.test(pkgJson.name);
43
43
  },
44
44
  isFrameworkPkgByName(pkgName) {
45
45
  const isNotAstroPkg = isCommonNotAstro(pkgName);
@@ -112,7 +112,26 @@ async function createVite(commandConfig, { settings, logging, mode, fs = nodeFs
112
112
  }
113
113
  };
114
114
  let result = commonConfig;
115
- result = vite.mergeConfig(result, settings.config.vite || {});
115
+ if (command && ((_b = settings.config.vite) == null ? void 0 : _b.plugins)) {
116
+ let { plugins, ...rest } = settings.config.vite;
117
+ const applyToFilter = command === "build" ? "serve" : "build";
118
+ const applyArgs = [
119
+ { ...settings.config.vite, mode },
120
+ { command, mode }
121
+ ];
122
+ plugins = plugins.flat(Infinity).filter((p) => {
123
+ if (!p || (p == null ? void 0 : p.apply) === applyToFilter) {
124
+ return false;
125
+ }
126
+ if (typeof p.apply === "function") {
127
+ return p.apply(applyArgs[0], applyArgs[1]);
128
+ }
129
+ return true;
130
+ });
131
+ result = vite.mergeConfig(result, { ...rest, plugins });
132
+ } else {
133
+ result = vite.mergeConfig(result, settings.config.vite || {});
134
+ }
116
135
  result = vite.mergeConfig(result, commandConfig);
117
136
  if (result.plugins) {
118
137
  sortPlugins(result.plugins);
@@ -47,7 +47,7 @@ async function createContainer(params = {}) {
47
47
  "import.meta.env.BASE_URL": settings.config.base ? JSON.stringify(settings.config.base) : "undefined"
48
48
  }
49
49
  },
50
- { settings, logging, mode: "dev", fs }
50
+ { settings, logging, mode: "dev", command: "dev", fs }
51
51
  );
52
52
  await runHookConfigDone({ settings, logging });
53
53
  const viteServer = await vite.createServer(viteConfig);
@@ -31,7 +31,7 @@ async function dev(settings, options) {
31
31
  isRestart: options.isRestart
32
32
  })
33
33
  );
34
- const currentVersion = "2.0.16";
34
+ const currentVersion = "2.0.18";
35
35
  if (currentVersion.includes("-")) {
36
36
  warn(options.logging, null, msg.prerelease({ currentVersion }));
37
37
  }
@@ -1,6 +1,7 @@
1
1
  /// <reference types="node" />
2
+ import type { LogOptions } from '../../logger/core';
2
3
  import type { SSROptions } from '../../render/dev';
3
- export declare function call(options: SSROptions): Promise<{
4
+ export declare function call(options: SSROptions, logging: LogOptions): Promise<{
4
5
  type: "simple";
5
6
  body: string;
6
7
  encoding?: BufferEncoding | undefined;
@@ -1,6 +1,6 @@
1
1
  import { createRenderContext } from "../../render/index.js";
2
2
  import { call as callEndpoint } from "../index.js";
3
- async function call(options) {
3
+ async function call(options, logging) {
4
4
  const {
5
5
  env,
6
6
  preload: [, mod]
@@ -12,7 +12,7 @@ async function call(options) {
12
12
  pathname: options.pathname,
13
13
  route: options.route
14
14
  });
15
- return await callEndpoint(endpointHandler, env, ctx);
15
+ return await callEndpoint(endpointHandler, env, ctx, logging);
16
16
  }
17
17
  export {
18
18
  call
@@ -2,6 +2,7 @@
2
2
  import type { AstroConfig, EndpointHandler } from '../../@types/astro';
3
3
  import type { Environment, RenderContext } from '../render/index';
4
4
  import { AstroCookies } from '../cookies/index.js';
5
+ import { LogOptions } from '../logger/core.js';
5
6
  type EndpointCallResult = {
6
7
  type: 'simple';
7
8
  body: string;
@@ -11,6 +12,6 @@ type EndpointCallResult = {
11
12
  type: 'response';
12
13
  response: Response;
13
14
  };
14
- export declare function call(mod: EndpointHandler, env: Environment, ctx: RenderContext): Promise<EndpointCallResult>;
15
+ export declare function call(mod: EndpointHandler, env: Environment, ctx: RenderContext, logging: LogOptions): Promise<EndpointCallResult>;
15
16
  export declare function throwIfRedirectNotAllowed(response: Response, config: AstroConfig): void;
16
17
  export {};
@@ -2,6 +2,7 @@ import { renderEndpoint } from "../../runtime/server/index.js";
2
2
  import { ASTRO_VERSION } from "../constants.js";
3
3
  import { AstroCookies, attachToResponse } from "../cookies/index.js";
4
4
  import { AstroError, AstroErrorData } from "../errors/index.js";
5
+ import { warn } from "../logger/core.js";
5
6
  import { getParamsAndProps, GetParamsAndPropsError } from "../render/core.js";
6
7
  const clientAddressSymbol = Symbol.for("astro.clientAddress");
7
8
  function createAPIContext({
@@ -42,7 +43,7 @@ function createAPIContext({
42
43
  }
43
44
  };
44
45
  }
45
- async function call(mod, env, ctx) {
46
+ async function call(mod, env, ctx, logging) {
46
47
  var _a, _b;
47
48
  const paramsAndPropsResp = await getParamsAndProps({
48
49
  mod,
@@ -75,6 +76,22 @@ async function call(mod, env, ctx) {
75
76
  response
76
77
  };
77
78
  }
79
+ if (env.ssr && !mod.prerender) {
80
+ if (response.hasOwnProperty("headers")) {
81
+ warn(
82
+ logging,
83
+ "ssr",
84
+ "Setting headers is not supported when returning an object. Please return an instance of Response. See https://docs.astro.build/en/core-concepts/endpoints/#server-endpoints-api-routes for more information."
85
+ );
86
+ }
87
+ if (response.encoding) {
88
+ warn(
89
+ logging,
90
+ "ssr",
91
+ "`encoding` is ignored in SSR. To return a charset other than UTF-8, please return an instance of Response. See https://docs.astro.build/en/core-concepts/endpoints/#server-endpoints-api-routes for more information."
92
+ );
93
+ }
94
+ }
78
95
  return {
79
96
  type: "simple",
80
97
  body: response.body,
@@ -47,7 +47,7 @@ function serverStart({
47
47
  base,
48
48
  isRestart = false
49
49
  }) {
50
- const version = "2.0.16";
50
+ const version = "2.0.18";
51
51
  const localPrefix = `${dim("\u2503")} Local `;
52
52
  const networkPrefix = `${dim("\u2503")} Network `;
53
53
  const emptyPrefix = " ".repeat(11);
@@ -233,7 +233,7 @@ function printHelp({
233
233
  message.push(
234
234
  linebreak(),
235
235
  ` ${bgGreen(black(` ${commandName} `))} ${green(
236
- `v${"2.0.16"}`
236
+ `v${"2.0.18"}`
237
237
  )} ${headline}`
238
238
  );
239
239
  }
@@ -1,11 +1,11 @@
1
1
  import { viteID } from "../../util.js";
2
- import { isCSSRequest } from "./util.js";
2
+ import { isBuildableCSSRequest } from "./util.js";
3
3
  import { crawlGraph } from "./vite.js";
4
4
  async function getStylesForURL(filePath, loader, mode) {
5
5
  const importedCssUrls = /* @__PURE__ */ new Set();
6
6
  const importedStylesMap = /* @__PURE__ */ new Map();
7
7
  for await (const importedModule of crawlGraph(loader, viteID(filePath), true)) {
8
- if (isCSSRequest(importedModule.url)) {
8
+ if (isBuildableCSSRequest(importedModule.url)) {
9
9
  let ssrModule;
10
10
  try {
11
11
  ssrModule = importedModule.ssrModule ?? await loader.import(importedModule.url);
@@ -26,7 +26,7 @@ async function sync(settings, { logging, fs }) {
26
26
  optimizeDeps: { entries: [] },
27
27
  logLevel: "silent"
28
28
  },
29
- { settings, logging, mode: "build", fs }
29
+ { settings, logging, mode: "build", command: "build", fs }
30
30
  )
31
31
  );
32
32
  try {
@@ -114,7 +114,7 @@ async function handleRoute(matchedRoute, url, pathname, body, origin, env, manif
114
114
  route
115
115
  };
116
116
  if (route.type === "endpoint") {
117
- const result = await callEndpoint(options);
117
+ const result = await callEndpoint(options, logging);
118
118
  if (result.type === "response") {
119
119
  if (result.response.headers.get("X-Astro-Response") === "Not-Found") {
120
120
  const fourOhFourRoute = await matchRoute("/404", env, manifest);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "astro",
3
- "version": "2.0.16",
3
+ "version": "2.0.18",
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",
@@ -85,11 +85,11 @@
85
85
  "src/content/template"
86
86
  ],
87
87
  "dependencies": {
88
- "@astrojs/compiler": "^1.1.0",
88
+ "@astrojs/compiler": "^1.2.0",
89
89
  "@astrojs/language-server": "^0.28.3",
90
90
  "@astrojs/markdown-remark": "^2.0.1",
91
91
  "@astrojs/telemetry": "^2.0.1",
92
- "@astrojs/webapi": "^2.0.2",
92
+ "@astrojs/webapi": "^2.0.3",
93
93
  "@babel/core": "^7.18.2",
94
94
  "@babel/generator": "^7.18.2",
95
95
  "@babel/parser": "^7.18.4",
@@ -160,7 +160,7 @@
160
160
  "@types/send": "^0.17.1",
161
161
  "@types/server-destroy": "^1.0.1",
162
162
  "@types/unist": "^2.0.6",
163
- "astro-scripts": "0.0.12",
163
+ "astro-scripts": "0.0.13",
164
164
  "chai": "^4.3.6",
165
165
  "cheerio": "^1.0.0-rc.11",
166
166
  "eol": "^0.9.1",
@@ -187,7 +187,6 @@
187
187
  "build:ci": "pnpm run prebuild && astro-scripts build \"src/**/*.ts\"",
188
188
  "dev": "astro-scripts dev --prebuild \"src/runtime/server/astro-island.ts\" --prebuild \"src/runtime/client/{idle,load,media,only,visible}.ts\" \"src/**/*.ts\"",
189
189
  "postbuild": "astro-scripts copy \"src/**/*.astro\"",
190
- "benchmark": "node test/benchmark/dev.bench.js && node test/benchmark/build.bench.js",
191
190
  "test:unit": "mocha --exit --timeout 30000 ./test/units/**/*.test.js",
192
191
  "test:unit:match": "mocha --exit --timeout 30000 ./test/units/**/*.test.js -g",
193
192
  "test": "pnpm run test:unit && mocha --exit --timeout 20000 --ignore **/lit-element.test.js && mocha --timeout 20000 **/lit-element.test.js",