astro 1.0.0-beta.41 → 1.0.0-beta.44

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.
Files changed (70) hide show
  1. package/dist/cli/check.js +2 -2
  2. package/dist/cli/index.js +15 -15
  3. package/dist/core/add/babel.js +2 -2
  4. package/dist/core/add/index.js +15 -15
  5. package/dist/core/app/index.js +4 -4
  6. package/dist/core/app/node.js +1 -1
  7. package/dist/core/build/generate.js +2 -2
  8. package/dist/core/build/index.js +9 -15
  9. package/dist/core/build/page-data.js +3 -3
  10. package/dist/core/build/static-build.js +11 -9
  11. package/dist/core/build/vite-plugin-pages.js +2 -2
  12. package/dist/core/build/vite-plugin-ssr.js +6 -6
  13. package/dist/core/config.js +6 -6
  14. package/dist/core/create-vite.js +6 -6
  15. package/dist/core/dev/index.js +10 -6
  16. package/dist/core/errors.js +12 -0
  17. package/dist/core/logger/console.js +2 -2
  18. package/dist/core/logger/node.js +4 -4
  19. package/dist/core/messages.js +30 -29
  20. package/dist/core/preview/index.js +3 -3
  21. package/dist/core/render/core.js +3 -1
  22. package/dist/core/render/dev/css.js +12 -3
  23. package/dist/core/render/dev/index.js +23 -19
  24. package/dist/core/render/result.js +2 -2
  25. package/dist/core/render/route-cache.js +2 -2
  26. package/dist/core/routing/index.js +1 -1
  27. package/dist/integrations/index.js +1 -1
  28. package/dist/runtime/client/hmr.js +61 -2
  29. package/dist/runtime/client/idle.js +1 -1
  30. package/dist/runtime/client/load.js +1 -1
  31. package/dist/runtime/client/media.js +1 -1
  32. package/dist/runtime/client/visible.js +1 -1
  33. package/dist/runtime/server/hydration.js +1 -1
  34. package/dist/runtime/server/index.js +1 -1
  35. package/dist/types/@types/astro.d.ts +6 -6
  36. package/dist/types/cli/telemetry.d.ts +1 -1
  37. package/dist/types/core/add/babel.d.ts +1 -1
  38. package/dist/types/core/add/index.d.ts +1 -1
  39. package/dist/types/core/app/common.d.ts +1 -1
  40. package/dist/types/core/app/node.d.ts +1 -1
  41. package/dist/types/core/app/types.d.ts +1 -1
  42. package/dist/types/core/build/index.d.ts +1 -1
  43. package/dist/types/core/build/page-data.d.ts +2 -2
  44. package/dist/types/core/build/types.d.ts +3 -3
  45. package/dist/types/core/build/vite-plugin-hoisted-scripts.d.ts +1 -1
  46. package/dist/types/core/build/vite-plugin-ssr.d.ts +1 -1
  47. package/dist/types/core/config.d.ts +31 -31
  48. package/dist/types/core/dev/index.d.ts +1 -1
  49. package/dist/types/core/messages.d.ts +1 -1
  50. package/dist/types/core/preview/index.d.ts +1 -1
  51. package/dist/types/core/render/core.d.ts +2 -1
  52. package/dist/types/core/render/dev/css.d.ts +5 -1
  53. package/dist/types/core/render/result.d.ts +2 -1
  54. package/dist/types/core/routing/index.d.ts +1 -1
  55. package/dist/types/core/routing/manifest/serialization.d.ts +1 -1
  56. package/dist/types/integrations/index.d.ts +1 -1
  57. package/dist/types/runtime/server/hydration.d.ts +1 -2
  58. package/dist/types/vite-plugin-astro/compile.d.ts +1 -1
  59. package/dist/types/vite-plugin-astro/hmr.d.ts +2 -2
  60. package/dist/types/vite-plugin-build-css/index.d.ts +1 -1
  61. package/dist/types/vite-plugin-build-css/resolve.d.ts +2 -2
  62. package/dist/vite-plugin-astro/compile.js +4 -4
  63. package/dist/vite-plugin-astro/hmr.js +1 -1
  64. package/dist/vite-plugin-astro/index.js +11 -8
  65. package/dist/vite-plugin-astro-server/index.js +10 -10
  66. package/dist/vite-plugin-build-css/index.js +84 -71
  67. package/dist/vite-plugin-config-alias/index.js +1 -1
  68. package/dist/vite-plugin-jsx/index.js +1 -1
  69. package/dist/vite-plugin-markdown/index.js +14 -5
  70. package/package.json +3 -3
package/dist/cli/check.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import { AstroCheck, DiagnosticSeverity } from "@astrojs/language-server";
2
- import { bold, black, bgWhite, red, cyan, yellow } from "kleur/colors";
3
2
  import glob from "fast-glob";
3
+ import * as fs from "fs";
4
+ import { bgWhite, black, bold, cyan, red, yellow } from "kleur/colors";
4
5
  import * as path from "path";
5
6
  import { pathToFileURL } from "url";
6
- import * as fs from "fs";
7
7
  async function openAllDocuments(workspaceUri, filePathsToIgnore, checker) {
8
8
  const files = await glob("**/*.astro", {
9
9
  cwd: workspaceUri.pathname,
package/dist/cli/index.js CHANGED
@@ -1,19 +1,19 @@
1
+ import { AstroTelemetry } from "@astrojs/telemetry";
2
+ import * as event from "@astrojs/telemetry/events";
1
3
  import * as colors from "kleur/colors";
2
4
  import yargs from "yargs-parser";
3
5
  import { z } from "zod";
4
- import { AstroTelemetry } from "@astrojs/telemetry";
5
- import * as event from "@astrojs/telemetry/events";
6
- import { nodeLogDestination, enableVerboseLogging } from "../core/logger/node.js";
7
- import build from "../core/build/index.js";
8
6
  import add from "../core/add/index.js";
7
+ import build from "../core/build/index.js";
8
+ import { openConfig } from "../core/config.js";
9
9
  import devServer from "../core/dev/index.js";
10
+ import { enableVerboseLogging, nodeLogDestination } from "../core/logger/node.js";
11
+ import { formatConfigErrorMessage, formatErrorMessage, printHelp } from "../core/messages.js";
10
12
  import preview from "../core/preview/index.js";
13
+ import { createSafeError } from "../core/util.js";
11
14
  import { check } from "./check.js";
12
15
  import { openInBrowser } from "./open.js";
13
16
  import * as telemetryHandler from "./telemetry.js";
14
- import { openConfig } from "../core/config.js";
15
- import { printHelp, formatErrorMessage, formatConfigErrorMessage } from "../core/messages.js";
16
- import { createSafeError } from "../core/util.js";
17
17
  function printAstroHelp() {
18
18
  printHelp({
19
19
  commandName: "astro",
@@ -40,7 +40,7 @@ function printAstroHelp() {
40
40
  });
41
41
  }
42
42
  async function printVersion() {
43
- const version = "1.0.0-beta.41";
43
+ const version = "1.0.0-beta.44";
44
44
  console.log();
45
45
  console.log(` ${colors.bgGreen(colors.black(` astro `))} ${colors.green(`v${version}`)}`);
46
46
  }
@@ -83,7 +83,7 @@ async function cli(args) {
83
83
  } else if (flags.silent) {
84
84
  logging.level = "silent";
85
85
  }
86
- const telemetry = new AstroTelemetry({ version: "1.0.0-beta.41" });
86
+ const telemetry = new AstroTelemetry({ version: "1.0.0-beta.44" });
87
87
  if (cmd === "telemetry") {
88
88
  try {
89
89
  const subcommand = (_a = flags._[3]) == null ? void 0 : _a.toString();
@@ -97,7 +97,7 @@ async function cli(args) {
97
97
  try {
98
98
  const packages = flags._.slice(3);
99
99
  telemetry.record(event.eventCliSession({
100
- astroVersion: "1.0.0-beta.41",
100
+ astroVersion: "1.0.0-beta.44",
101
101
  cliCommand: "add"
102
102
  }));
103
103
  return await add(packages, { cwd: root, flags, logging, telemetry });
@@ -108,7 +108,7 @@ async function cli(args) {
108
108
  case "dev": {
109
109
  try {
110
110
  const { astroConfig, userConfig } = await openConfig({ cwd: root, flags, cmd });
111
- telemetry.record(event.eventCliSession({ astroVersion: "1.0.0-beta.41", cliCommand: "dev" }, userConfig, flags));
111
+ telemetry.record(event.eventCliSession({ astroVersion: "1.0.0-beta.44", cliCommand: "dev" }, userConfig, flags));
112
112
  await devServer(astroConfig, { logging, telemetry });
113
113
  return await new Promise(() => {
114
114
  });
@@ -119,7 +119,7 @@ async function cli(args) {
119
119
  case "build": {
120
120
  try {
121
121
  const { astroConfig, userConfig } = await openConfig({ cwd: root, flags, cmd });
122
- telemetry.record(event.eventCliSession({ astroVersion: "1.0.0-beta.41", cliCommand: "build" }, userConfig, flags));
122
+ telemetry.record(event.eventCliSession({ astroVersion: "1.0.0-beta.44", cliCommand: "build" }, userConfig, flags));
123
123
  return await build(astroConfig, { logging, telemetry });
124
124
  } catch (err) {
125
125
  return throwAndExit(err);
@@ -127,14 +127,14 @@ async function cli(args) {
127
127
  }
128
128
  case "check": {
129
129
  const { astroConfig, userConfig } = await openConfig({ cwd: root, flags, cmd });
130
- telemetry.record(event.eventCliSession({ astroVersion: "1.0.0-beta.41", cliCommand: "check" }, userConfig, flags));
130
+ telemetry.record(event.eventCliSession({ astroVersion: "1.0.0-beta.44", cliCommand: "check" }, userConfig, flags));
131
131
  const ret = await check(astroConfig);
132
132
  return process.exit(ret);
133
133
  }
134
134
  case "preview": {
135
135
  try {
136
136
  const { astroConfig, userConfig } = await openConfig({ cwd: root, flags, cmd });
137
- telemetry.record(event.eventCliSession({ astroVersion: "1.0.0-beta.41", cliCommand: "preview" }, userConfig, flags));
137
+ telemetry.record(event.eventCliSession({ astroVersion: "1.0.0-beta.44", cliCommand: "preview" }, userConfig, flags));
138
138
  const server = await preview(astroConfig, { logging, telemetry });
139
139
  return await server.closed();
140
140
  } catch (err) {
@@ -144,7 +144,7 @@ async function cli(args) {
144
144
  case "docs": {
145
145
  try {
146
146
  await telemetry.record(event.eventCliSession({
147
- astroVersion: "1.0.0-beta.41",
147
+ astroVersion: "1.0.0-beta.44",
148
148
  cliCommand: "docs"
149
149
  }));
150
150
  return await openInBrowser("https://docs.astro.build/");
@@ -1,7 +1,7 @@
1
- import traverse from "@babel/traverse";
2
1
  import generator from "@babel/generator";
3
- import * as t from "@babel/types";
4
2
  import parser from "@babel/parser";
3
+ import traverse from "@babel/traverse";
4
+ import * as t from "@babel/types";
5
5
  const visit = traverse.default;
6
6
  async function generate(ast) {
7
7
  const astToText = generator.default;
@@ -1,24 +1,24 @@
1
- import path from "path";
2
- import { existsSync, promises as fs } from "fs";
3
- import { execa } from "execa";
4
- import { fileURLToPath, pathToFileURL } from "url";
5
- import { diffWords } from "diff";
6
1
  import boxen from "boxen";
7
- import prompts from "prompts";
8
- import preferredPM from "preferred-pm";
2
+ import { diffWords } from "diff";
3
+ import { execa } from "execa";
4
+ import { existsSync, promises as fs } from "fs";
5
+ import { bold, cyan, dim, green, magenta } from "kleur/colors";
9
6
  import ora from "ora";
7
+ import path from "path";
8
+ import preferredPM from "preferred-pm";
9
+ import prompts from "prompts";
10
+ import { fileURLToPath, pathToFileURL } from "url";
10
11
  import { resolveConfigURL } from "../config.js";
11
- import { apply as applyPolyfill } from "../polyfill.js";
12
- import { error, info, debug } from "../logger/core.js";
13
- import { printHelp } from "../messages.js";
12
+ import { debug, error, info } from "../logger/core.js";
14
13
  import * as msg from "../messages.js";
15
- import * as CONSTS from "./consts.js";
16
- import { dim, cyan, green, magenta, bold } from "kleur/colors";
14
+ import { printHelp } from "../messages.js";
15
+ import { appendForwardSlash } from "../path.js";
16
+ import { apply as applyPolyfill } from "../polyfill.js";
17
17
  import { parseNpmName } from "../util.js";
18
- import { wrapDefaultExport } from "./wrapper.js";
18
+ import { generate, parse, t, visit } from "./babel.js";
19
+ import * as CONSTS from "./consts.js";
19
20
  import { ensureImport } from "./imports.js";
20
- import { t, parse, visit, generate } from "./babel.js";
21
- import { appendForwardSlash } from "../path.js";
21
+ import { wrapDefaultExport } from "./wrapper.js";
22
22
  async function add(names, { cwd, flags, logging, telemetry }) {
23
23
  if (flags.help) {
24
24
  printHelp({
@@ -22,17 +22,17 @@ var __privateMethod = (obj, member, method) => {
22
22
  };
23
23
  var _manifest, _manifestData, _routeDataToRouteInfo, _routeCache, _encoder, _logging, _renderPage, renderPage_fn, _callEndpoint, callEndpoint_fn;
24
24
  import mime from "mime";
25
+ import { call as callEndpoint } from "../endpoint/index.js";
25
26
  import { consoleLogDestination } from "../logger/console.js";
26
- import { deserializeManifest } from "./common.js";
27
- import { matchRoute } from "../routing/match.js";
27
+ import { joinPaths, prependForwardSlash } from "../path.js";
28
28
  import { render } from "../render/core.js";
29
- import { call as callEndpoint } from "../endpoint/index.js";
30
29
  import { RouteCache } from "../render/route-cache.js";
31
30
  import {
32
31
  createLinkStylesheetElementSet,
33
32
  createModuleScriptElementWithSrcSet
34
33
  } from "../render/ssr-element.js";
35
- import { joinPaths, prependForwardSlash } from "../path.js";
34
+ import { matchRoute } from "../routing/match.js";
35
+ import { deserializeManifest } from "./common.js";
36
36
  const pagesVirtualModuleId = "@astrojs-pages-virtual-entry";
37
37
  const resolvedPagesVirtualModuleId = "\0" + pagesVirtualModuleId;
38
38
  class App {
@@ -1,6 +1,6 @@
1
1
  import * as fs from "fs";
2
- import { App } from "./index.js";
3
2
  import { deserializeManifest } from "./common.js";
3
+ import { App } from "./index.js";
4
4
  function createRequestFromNodeRequest(req) {
5
5
  let url = `http://${req.headers.host}${req.url}`;
6
6
  const entries = Object.entries(req.headers);
@@ -2,20 +2,20 @@ import fs from "fs";
2
2
  import { bgGreen, black, cyan, dim, green, magenta } from "kleur/colors";
3
3
  import npath from "path";
4
4
  import { fileURLToPath } from "url";
5
- import { debug, info } from "../logger/core.js";
6
5
  import { joinPaths, prependForwardSlash, removeLeadingForwardSlash } from "../../core/path.js";
7
6
  import { BEFORE_HYDRATION_SCRIPT_ID } from "../../vite-plugin-scripts/index.js";
8
7
  import { call as callEndpoint } from "../endpoint/index.js";
8
+ import { debug, info } from "../logger/core.js";
9
9
  import { render } from "../render/core.js";
10
10
  import {
11
11
  createLinkStylesheetElementSet,
12
12
  createModuleScriptElementWithSrcSet
13
13
  } from "../render/ssr-element.js";
14
+ import { createRequest } from "../request.js";
14
15
  import { getOutputFilename, isBuildingToSSR } from "../util.js";
15
16
  import { getOutFile, getOutFolder } from "./common.js";
16
17
  import { eachPageData, getPageDataByComponent } from "./internal.js";
17
18
  import { getTimeStat } from "./util.js";
18
- import { createRequest } from "../request.js";
19
19
  const MAX_CONCURRENT_RENDERS = 1;
20
20
  function* throttle(max, inPaths) {
21
21
  let tmp = [];
@@ -1,29 +1,23 @@
1
1
  import fs from "fs";
2
2
  import * as colors from "kleur/colors";
3
- import { apply as applyPolyfill } from "../polyfill.js";
4
3
  import { performance } from "perf_hooks";
5
4
  import * as vite from "vite";
6
- import { createVite } from "../create-vite.js";
7
- import {
8
- debug,
9
- info,
10
- levels,
11
- timerMessage,
12
- warnIfUsingExperimentalSSR
13
- } from "../logger/core.js";
14
- import { createRouteManifest } from "../routing/index.js";
15
- import { collectPagesData } from "./page-data.js";
16
- import { staticBuild } from "./static-build.js";
17
- import { RouteCache } from "../render/route-cache.js";
18
5
  import {
19
6
  runHookBuildDone,
20
7
  runHookBuildStart,
21
8
  runHookConfigDone,
22
9
  runHookConfigSetup
23
10
  } from "../../integrations/index.js";
24
- import { getTimeStat } from "./util.js";
25
- import { createSafeError, isBuildingToSSR } from "../util.js";
11
+ import { createVite } from "../create-vite.js";
26
12
  import { fixViteErrorMessage } from "../errors.js";
13
+ import { debug, info, levels, timerMessage, warnIfUsingExperimentalSSR } from "../logger/core.js";
14
+ import { apply as applyPolyfill } from "../polyfill.js";
15
+ import { RouteCache } from "../render/route-cache.js";
16
+ import { createRouteManifest } from "../routing/index.js";
17
+ import { createSafeError, isBuildingToSSR } from "../util.js";
18
+ import { collectPagesData } from "./page-data.js";
19
+ import { staticBuild } from "./static-build.js";
20
+ import { getTimeStat } from "./util.js";
27
21
  async function build(config, options) {
28
22
  applyPolyfill();
29
23
  const builder = new AstroBuilder(config, options);
@@ -1,12 +1,12 @@
1
1
  import { info } from "../logger/core.js";
2
- import { fileURLToPath } from "url";
3
2
  import * as colors from "kleur/colors";
3
+ import { fileURLToPath } from "url";
4
4
  import { debug } from "../logger/core.js";
5
+ import { removeTrailingForwardSlash } from "../path.js";
5
6
  import { preload as ssrPreload } from "../render/dev/index.js";
6
7
  import { callGetStaticPaths } from "../render/route-cache.js";
7
- import { removeTrailingForwardSlash } from "../path.js";
8
- import { isBuildingToSSR } from "../util.js";
9
8
  import { matchRoute } from "../routing/match.js";
9
+ import { isBuildingToSSR } from "../util.js";
10
10
  async function collectPagesData(opts) {
11
11
  const { astroConfig, logging, manifest, origin, routeCache, viteServer } = opts;
12
12
  const assets = {};
@@ -17,26 +17,28 @@ var __spreadValues = (a, b) => {
17
17
  return a;
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
- import { trackClientOnlyPageDatas } from "../../core/build/internal.js";
21
20
  import glob from "fast-glob";
22
21
  import fs from "fs";
23
22
  import { bgGreen, bgMagenta, black, dim } from "kleur/colors";
24
23
  import { fileURLToPath } from "url";
25
24
  import * as vite from "vite";
26
- import { createBuildInternals } from "../../core/build/internal.js";
27
- import { info } from "../logger/core.js";
25
+ import {
26
+ createBuildInternals,
27
+ trackClientOnlyPageDatas
28
+ } from "../../core/build/internal.js";
28
29
  import { prependForwardSlash } from "../../core/path.js";
29
30
  import { emptyDir, removeDir } from "../../core/util.js";
31
+ import { runHookBuildSetup } from "../../integrations/index.js";
30
32
  import { rollupPluginAstroBuildCSS } from "../../vite-plugin-build-css/index.js";
31
- import { vitePluginHoistedScripts } from "./vite-plugin-hoisted-scripts.js";
32
- import { vitePluginInternals } from "./vite-plugin-internals.js";
33
- import { vitePluginSSR } from "./vite-plugin-ssr.js";
34
- import { vitePluginPages } from "./vite-plugin-pages.js";
33
+ import { info } from "../logger/core.js";
34
+ import { isBuildingToSSR } from "../util.js";
35
35
  import { generatePages } from "./generate.js";
36
36
  import { trackPageData } from "./internal.js";
37
- import { isBuildingToSSR } from "../util.js";
38
- import { runHookBuildSetup } from "../../integrations/index.js";
39
37
  import { getTimeStat } from "./util.js";
38
+ import { vitePluginHoistedScripts } from "./vite-plugin-hoisted-scripts.js";
39
+ import { vitePluginInternals } from "./vite-plugin-internals.js";
40
+ import { vitePluginPages } from "./vite-plugin-pages.js";
41
+ import { vitePluginSSR } from "./vite-plugin-ssr.js";
40
42
  async function staticBuild(opts) {
41
43
  const { allPages, astroConfig } = opts;
42
44
  const pageInput = /* @__PURE__ */ new Set();
@@ -1,7 +1,7 @@
1
+ import { pagesVirtualModuleId, resolvedPagesVirtualModuleId } from "../app/index.js";
2
+ import { isBuildingToSSR } from "../util.js";
1
3
  import { addRollupInput } from "./add-rollup-input.js";
2
4
  import { eachPageData } from "./internal.js";
3
- import { isBuildingToSSR } from "../util.js";
4
- import { resolvedPagesVirtualModuleId, pagesVirtualModuleId } from "../app/index.js";
5
5
  function vitePluginPages(opts, internals) {
6
6
  return {
7
7
  name: "@astro/plugin-build-pages",
@@ -1,11 +1,11 @@
1
- import { serializeRouteData } from "../routing/index.js";
2
- import { eachPageData } from "./internal.js";
3
- import { addRollupInput } from "./add-rollup-input.js";
4
- import { fileURLToPath } from "url";
5
1
  import glob from "fast-glob";
6
- import { pagesVirtualModuleId } from "../app/index.js";
7
- import { BEFORE_HYDRATION_SCRIPT_ID } from "../../vite-plugin-scripts/index.js";
2
+ import { fileURLToPath } from "url";
8
3
  import { runHookBuildSsr } from "../../integrations/index.js";
4
+ import { BEFORE_HYDRATION_SCRIPT_ID } from "../../vite-plugin-scripts/index.js";
5
+ import { pagesVirtualModuleId } from "../app/index.js";
6
+ import { serializeRouteData } from "../routing/index.js";
7
+ import { addRollupInput } from "./add-rollup-input.js";
8
+ import { eachPageData } from "./internal.js";
9
9
  const virtualModuleId = "@astrojs-ssr-virtual-entry";
10
10
  const resolvedVirtualModuleId = "\0" + virtualModuleId;
11
11
  const manifestReplace = "@@ASTRO_MANIFEST_REPLACE@@";
@@ -17,17 +17,17 @@ var __spreadValues = (a, b) => {
17
17
  return a;
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+ import load, { ProloadError, resolve } from "@proload/core";
21
+ import loadTypeScript from "@proload/plugin-tsm";
20
22
  import * as colors from "kleur/colors";
21
23
  import path from "path";
22
- import { pathToFileURL, fileURLToPath } from "url";
23
- import { mergeConfig as mergeViteConfig } from "vite";
24
+ import postcssrc from "postcss-load-config";
24
25
  import { BUNDLED_THEMES } from "shiki";
26
+ import { fileURLToPath, pathToFileURL } from "url";
27
+ import { mergeConfig as mergeViteConfig } from "vite";
25
28
  import { z } from "zod";
26
- import load, { resolve, ProloadError } from "@proload/core";
27
- import loadTypeScript from "@proload/plugin-tsm";
28
- import postcssrc from "postcss-load-config";
29
- import { arraify, isObject } from "./util.js";
30
29
  import { appendForwardSlash, prependForwardSlash, trimSlashes } from "./path.js";
30
+ import { arraify, isObject } from "./util.js";
31
31
  load.use([loadTypeScript]);
32
32
  const ASTRO_CONFIG_DEFAULTS = {
33
33
  root: ".",
@@ -1,16 +1,16 @@
1
+ import fs from "fs";
1
2
  import { builtinModules } from "module";
2
3
  import { fileURLToPath } from "url";
3
- import fs from "fs";
4
4
  import * as vite from "vite";
5
- import astroVitePlugin from "../vite-plugin-astro/index.js";
6
- import astroViteServerPlugin from "../vite-plugin-astro-server/index.js";
7
5
  import astroPostprocessVitePlugin from "../vite-plugin-astro-postprocess/index.js";
6
+ import astroViteServerPlugin from "../vite-plugin-astro-server/index.js";
7
+ import astroVitePlugin from "../vite-plugin-astro/index.js";
8
8
  import configAliasVitePlugin from "../vite-plugin-config-alias/index.js";
9
- import markdownVitePlugin from "../vite-plugin-markdown/index.js";
10
- import jsxVitePlugin from "../vite-plugin-jsx/index.js";
11
9
  import envVitePlugin from "../vite-plugin-env/index.js";
12
- import astroScriptsPlugin from "../vite-plugin-scripts/index.js";
13
10
  import astroIntegrationsContainerPlugin from "../vite-plugin-integrations-container/index.js";
11
+ import jsxVitePlugin from "../vite-plugin-jsx/index.js";
12
+ import markdownVitePlugin from "../vite-plugin-markdown/index.js";
13
+ import astroScriptsPlugin from "../vite-plugin-scripts/index.js";
14
14
  const ALWAYS_EXTERNAL = /* @__PURE__ */ new Set([
15
15
  ...builtinModules.map((name) => `node:${name}`),
16
16
  "@sveltejs/vite-plugin-svelte",
@@ -1,5 +1,3 @@
1
- import glob from "fast-glob";
2
- import path from "path";
3
1
  import { performance } from "perf_hooks";
4
2
  import * as vite from "vite";
5
3
  import {
@@ -20,13 +18,19 @@ async function dev(config, options) {
20
18
  await options.telemetry.record([]);
21
19
  config = await runHookConfigSetup({ config, command: "dev" });
22
20
  const { host, port } = config.server;
23
- const clientRuntimeScripts = await glob(new URL("../../runtime/client/*.js", import.meta.url).pathname);
24
- const clientRuntimeFilePaths = clientRuntimeScripts.map((script) => `astro/client/${path.basename(script)}`).filter((filePath) => filePath !== "astro/client/hmr.js");
21
+ const rendererClientEntries = config._ctx.renderers.map((r) => r.clientEntrypoint).filter(Boolean);
25
22
  const viteConfig = await createVite({
26
23
  mode: "development",
27
24
  server: { host },
28
25
  optimizeDeps: {
29
- include: clientRuntimeFilePaths
26
+ include: [
27
+ "astro/client/idle.js",
28
+ "astro/client/load.js",
29
+ "astro/client/visible.js",
30
+ "astro/client/media.js",
31
+ "astro/client/only.js",
32
+ ...rendererClientEntries
33
+ ]
30
34
  }
31
35
  }, { astroConfig: config, logging: options.logging, mode: "dev" });
32
36
  await runHookConfigDone({ config });
@@ -43,7 +47,7 @@ async function dev(config, options) {
43
47
  site,
44
48
  https: !!((_a = viteConfig.server) == null ? void 0 : _a.https)
45
49
  }));
46
- const currentVersion = "1.0.0-beta.41";
50
+ const currentVersion = "1.0.0-beta.44";
47
51
  if (currentVersion.includes("-")) {
48
52
  warn(options.logging, null, msg.prerelease({ currentVersion }));
49
53
  }
@@ -32,6 +32,18 @@ function collectErrorMetadata(e) {
32
32
  if (e.stack) {
33
33
  e.stack = eol.lf(e.stack);
34
34
  }
35
+ if (e.name === "YAMLException") {
36
+ const err = e;
37
+ err.loc = { file: e.id, line: e.mark.line, column: e.mark.column };
38
+ err.message = e.reason;
39
+ if (!err.frame) {
40
+ try {
41
+ const fileContents = fs.readFileSync(err.loc.file, "utf8");
42
+ err.frame = codeFrame(fileContents, err.loc);
43
+ } catch {
44
+ }
45
+ }
46
+ }
35
47
  if (Array.isArray(e.errors)) {
36
48
  const { location, pluginName, text } = e.errors[0];
37
49
  const err = e;
@@ -1,6 +1,6 @@
1
- import { bold, cyan, dim, red, yellow, reset } from "kleur/colors";
1
+ import { bold, cyan, dim, red, reset, yellow } from "kleur/colors";
2
2
  import { format as utilFormat } from "util";
3
- import { levels, dateTimeFormat } from "./core.js";
3
+ import { dateTimeFormat, levels } from "./core.js";
4
4
  let lastMessage;
5
5
  let lastMessageCount = 1;
6
6
  const consoleLogDestination = {
@@ -1,10 +1,10 @@
1
- import { bold, cyan, dim, red, yellow, reset } from "kleur/colors";
2
- import stringWidth from "string-width";
3
1
  import debugPackage from "debug";
4
- import { format as utilFormat } from "util";
2
+ import { bold, cyan, dim, red, reset, yellow } from "kleur/colors";
5
3
  import * as readline from "readline";
6
4
  import { Writable } from "stream";
7
- import { info, warn, error, dateTimeFormat } from "./core.js";
5
+ import stringWidth from "string-width";
6
+ import { format as utilFormat } from "util";
7
+ import { dateTimeFormat, error, info, warn } from "./core.js";
8
8
  let lastMessage;
9
9
  let lastMessageCount = 1;
10
10
  const nodeLogDestination = new Writable({
@@ -1,21 +1,21 @@
1
- import os from "os";
1
+ import boxen from "boxen";
2
2
  import {
3
+ bgCyan,
4
+ bgGreen,
5
+ bgRed,
6
+ bgWhite,
7
+ bgYellow,
8
+ black,
3
9
  bold,
10
+ cyan,
4
11
  dim,
5
- red,
6
12
  green,
13
+ red,
7
14
  underline,
8
- yellow,
9
- bgYellow,
10
- cyan,
11
- bgGreen,
12
- black,
13
- bgRed,
14
- bgWhite,
15
- bgCyan
15
+ yellow
16
16
  } from "kleur/colors";
17
- import boxen from "boxen";
18
- import { collectErrorMetadata, cleanErrorStack } from "./errors.js";
17
+ import os from "os";
18
+ import { cleanErrorStack, collectErrorMetadata } from "./errors.js";
19
19
  import { emoji, getLocalAddress, padMultilineString } from "./util.js";
20
20
  const PREFIX_PADDING = 6;
21
21
  function req({
@@ -47,7 +47,7 @@ function devStart({
47
47
  https,
48
48
  site
49
49
  }) {
50
- const version = "1.0.0-beta.41";
50
+ const version = "1.0.0-beta.44";
51
51
  const rootPath = site ? site.pathname : "/";
52
52
  const localPrefix = `${dim("\u2503")} Local `;
53
53
  const networkPrefix = `${dim("\u2503")} Network `;
@@ -55,31 +55,32 @@ function devStart({
55
55
  const localAddress = getLocalAddress(networkAddress, config.server.host);
56
56
  const networkLogging = getNetworkLogging(config.server.host);
57
57
  const toDisplayUrl = (hostname) => `${https ? "https" : "http"}://${hostname}:${port}${rootPath}`;
58
- let addresses = [];
59
- if (networkLogging === "none") {
60
- addresses = [`${localPrefix}${bold(cyan(toDisplayUrl(localAddress)))}`];
61
- } else if (networkLogging === "host-to-expose") {
62
- addresses = [
63
- `${localPrefix}${bold(cyan(toDisplayUrl(localAddress)))}`,
64
- `${networkPrefix}${dim("use --host to expose")}`
65
- ];
66
- } else {
67
- addresses = Object.values(os.networkInterfaces()).flatMap((networkInterface) => networkInterface ?? []).filter((networkInterface) => (networkInterface == null ? void 0 : networkInterface.address) && (networkInterface == null ? void 0 : networkInterface.family) === "IPv4").map(({ address }) => {
58
+ let local = `${localPrefix}${bold(cyan(toDisplayUrl(localAddress)))}`;
59
+ let network = null;
60
+ if (networkLogging === "host-to-expose") {
61
+ network = `${networkPrefix}${dim("use --host to expose")}`;
62
+ } else if (networkLogging === "visible") {
63
+ const ipv4Networks = Object.values(os.networkInterfaces()).flatMap((networkInterface) => networkInterface ?? []).filter((networkInterface) => (networkInterface == null ? void 0 : networkInterface.address) && (networkInterface == null ? void 0 : networkInterface.family) === "IPv4");
64
+ for (let { address } of ipv4Networks) {
68
65
  if (address.includes("127.0.0.1")) {
69
66
  const displayAddress = address.replace("127.0.0.1", localAddress);
70
- return `${localPrefix}${bold(cyan(toDisplayUrl(displayAddress)))}`;
67
+ local = `${localPrefix}${bold(cyan(toDisplayUrl(displayAddress)))}`;
71
68
  } else {
72
- return `${networkPrefix}${bold(cyan(toDisplayUrl(address)))}`;
69
+ network = `${networkPrefix}${bold(cyan(toDisplayUrl(address)))}`;
73
70
  }
74
- }).sort((msg) => msg.startsWith(localPrefix) ? -1 : 1);
71
+ }
72
+ if (!network) {
73
+ network = `${networkPrefix}${dim("unable to find network to expose")}`;
74
+ }
75
75
  }
76
76
  const messages = [
77
77
  `${emoji("\u{1F680} ", "")}${bgGreen(black(` astro `))} ${green(`v${version}`)} ${dim(`started in ${Math.round(startupTime)}ms`)}`,
78
78
  "",
79
- ...addresses,
79
+ local,
80
+ network,
80
81
  ""
81
82
  ];
82
- return messages.map((msg) => ` ${msg}`).join("\n");
83
+ return messages.filter((msg) => typeof msg === "string").map((msg) => ` ${msg}`).join("\n");
83
84
  }
84
85
  function telemetryNotice() {
85
86
  const headline = yellow(`Astro now collects ${bold("anonymous")} usage data.`);
@@ -206,7 +207,7 @@ function printHelp({
206
207
  };
207
208
  let message = [];
208
209
  if (headline) {
209
- message.push(linebreak(), ` ${bgGreen(black(` ${commandName} `))} ${green(`v${"1.0.0-beta.41"}`)} ${headline}`);
210
+ message.push(linebreak(), ` ${bgGreen(black(` ${commandName} `))} ${green(`v${"1.0.0-beta.44"}`)} ${headline}`);
210
211
  }
211
212
  if (usage) {
212
213
  message.push(linebreak(), ` ${green(commandName)} ${bold(usage)}`);
@@ -1,10 +1,10 @@
1
1
  import http from "http";
2
- import sirv from "sirv";
3
2
  import { performance } from "perf_hooks";
3
+ import sirv from "sirv";
4
4
  import { fileURLToPath } from "url";
5
- import * as msg from "../messages.js";
5
+ import { notFoundTemplate, subpathNotUsedTemplate } from "../../template/4xx.js";
6
6
  import { error, info } from "../logger/core.js";
7
- import { subpathNotUsedTemplate, notFoundTemplate } from "../../template/4xx.js";
7
+ import * as msg from "../messages.js";
8
8
  import { getResolvedHostForHttpServer } from "./util.js";
9
9
  const HAS_FILE_EXTENSION_REGEXP = /^.*\.[^\\]+$/;
10
10
  async function preview(config, { logging }) {
@@ -17,7 +17,7 @@ var __spreadValues = (a, b) => {
17
17
  import { renderHead, renderPage } from "../../runtime/server/index.js";
18
18
  import { getParams } from "../routing/params.js";
19
19
  import { createResult } from "./result.js";
20
- import { findPathItemByKey, callGetStaticPaths } from "./route-cache.js";
20
+ import { callGetStaticPaths, findPathItemByKey } from "./route-cache.js";
21
21
  var GetParamsAndPropsError = /* @__PURE__ */ ((GetParamsAndPropsError2) => {
22
22
  GetParamsAndPropsError2[GetParamsAndPropsError2["NoMatchingStaticPath"] = 0] = "NoMatchingStaticPath";
23
23
  return GetParamsAndPropsError2;
@@ -51,6 +51,7 @@ async function getParamsAndProps(opts) {
51
51
  async function render(opts) {
52
52
  const {
53
53
  links,
54
+ styles,
54
55
  logging,
55
56
  origin,
56
57
  markdown,
@@ -84,6 +85,7 @@ async function render(opts) {
84
85
  throw new Error(`Unable to SSR non-Astro component (${route == null ? void 0 : route.component})`);
85
86
  const result = createResult({
86
87
  links,
88
+ styles,
87
89
  logging,
88
90
  markdown,
89
91
  origin,