astro 2.0.0 → 2.0.2

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.
@@ -58,7 +58,6 @@ const highlighter = await getHighlighter({
58
58
  });
59
59
  const _html = highlighter.codeToHtml(code, {
60
60
  lang: typeof lang === 'string' ? lang : lang.id,
61
- theme,
62
61
  });
63
62
  const html = repairShikiTheme(_html);
64
63
  ---
@@ -19,7 +19,9 @@ function stringify(opts) {
19
19
  */
20
20
  async function resolveHighlighter(opts) {
21
21
  const resolvedThemes = [];
22
- if (opts.theme && opts.theme in themes) {
22
+ if (Object.keys(opts.theme).length) {
23
+ resolvedThemes.push(opts.theme);
24
+ } else if (opts.theme && opts.theme in themes) {
23
25
  resolvedThemes.push(await themes[opts.theme]());
24
26
  }
25
27
 
@@ -159,7 +159,8 @@ async function loadContentConfig({
159
159
  return void 0;
160
160
  }
161
161
  try {
162
- unparsedConfig = await tempConfigServer.ssrLoadModule(contentPaths.config.pathname);
162
+ const configPathname = fileURLToPath(contentPaths.config);
163
+ unparsedConfig = await tempConfigServer.ssrLoadModule(configPathname);
163
164
  } catch (e) {
164
165
  throw e;
165
166
  } finally {
@@ -1,10 +1,12 @@
1
1
  import * as fs from "fs";
2
+ import { TLSSocket } from "tls";
2
3
  import { deserializeManifest } from "./common.js";
3
4
  import { App } from "./index.js";
4
5
  const clientAddressSymbol = Symbol.for("astro.clientAddress");
5
6
  function createRequestFromNodeRequest(req, body) {
6
7
  var _a;
7
- let url = `http://${req.headers.host}${req.url}`;
8
+ const protocol = req.socket instanceof TLSSocket || req.headers["x-forwarded-proto"] === "https" ? "https" : "http";
9
+ let url = `${protocol}://${req.headers.host}${req.url}`;
8
10
  let rawHeaders = req.headers;
9
11
  const entries = Object.entries(rawHeaders);
10
12
  const method = req.method || "GET";
@@ -1,4 +1,4 @@
1
- const ASTRO_VERSION = "2.0.0";
1
+ const ASTRO_VERSION = "2.0.2";
2
2
  const SUPPORTED_MARKDOWN_FILE_EXTENSIONS = [
3
3
  ".markdown",
4
4
  ".mdown",
@@ -29,7 +29,7 @@ async function dev(settings, options) {
29
29
  isRestart: options.isRestart
30
30
  })
31
31
  );
32
- const currentVersion = "2.0.0";
32
+ const currentVersion = "2.0.2";
33
33
  if (currentVersion.includes("-")) {
34
34
  warn(options.logging, null, msg.prerelease({ currentVersion }));
35
35
  }
@@ -55,10 +55,15 @@ function padStr(str, len) {
55
55
  }
56
56
  let defaultLogLevel;
57
57
  if (typeof process !== "undefined") {
58
- if (process.argv.includes("--verbose")) {
59
- defaultLogLevel = "debug";
60
- } else if (process.argv.includes("--silent")) {
61
- defaultLogLevel = "silent";
58
+ let proc = process;
59
+ if ("argv" in proc && Array.isArray(proc.argv)) {
60
+ if (proc.argv.includes("--verbose")) {
61
+ defaultLogLevel = "debug";
62
+ } else if (proc.argv.includes("--silent")) {
63
+ defaultLogLevel = "silent";
64
+ } else {
65
+ defaultLogLevel = "info";
66
+ }
62
67
  } else {
63
68
  defaultLogLevel = "info";
64
69
  }
@@ -47,7 +47,7 @@ function serverStart({
47
47
  base,
48
48
  isRestart = false
49
49
  }) {
50
- const version = "2.0.0";
50
+ const version = "2.0.2";
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.0"}`
236
+ `v${"2.0.2"}`
237
237
  )} ${headline}`
238
238
  );
239
239
  }
@@ -25,7 +25,7 @@ async function getParamsAndProps(opts) {
25
25
  routeCache.set(route, routeCacheEntry);
26
26
  }
27
27
  const matchedStaticPath = findPathItemByKey(routeCacheEntry.staticPaths, params, route);
28
- if (!matchedStaticPath && !ssr) {
28
+ if (!matchedStaticPath && (ssr ? mod.prerender : true)) {
29
29
  return 0 /* NoMatchingStaticPath */;
30
30
  }
31
31
  pageProps = (matchedStaticPath == null ? void 0 : matchedStaticPath.props) ? { ...matchedStaticPath.props } : {};
@@ -25,12 +25,12 @@ function guessRenderers(componentUrl) {
25
25
  return ["@astrojs/vue"];
26
26
  case "jsx":
27
27
  case "tsx":
28
- return ["@astrojs/react", "@astrojs/preact", "@astrojs/solid", "@astrojs/vue (jsx)"];
28
+ return ["@astrojs/react", "@astrojs/preact", "@astrojs/solid-js", "@astrojs/vue (jsx)"];
29
29
  default:
30
30
  return [
31
31
  "@astrojs/react",
32
32
  "@astrojs/preact",
33
- "@astrojs/solid",
33
+ "@astrojs/solid-js",
34
34
  "@astrojs/vue",
35
35
  "@astrojs/svelte"
36
36
  ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "astro",
3
- "version": "2.0.0",
3
+ "version": "2.0.2",
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",
@@ -87,7 +87,7 @@
87
87
  "dependencies": {
88
88
  "@astrojs/compiler": "^1.0.1",
89
89
  "@astrojs/language-server": "^0.28.3",
90
- "@astrojs/markdown-remark": "^2.0.0",
90
+ "@astrojs/markdown-remark": "^2.0.1",
91
91
  "@astrojs/telemetry": "^2.0.0",
92
92
  "@astrojs/webapi": "^2.0.0",
93
93
  "@babel/core": "^7.18.2",
@@ -122,7 +122,7 @@
122
122
  "preferred-pm": "^3.0.3",
123
123
  "prompts": "^2.4.2",
124
124
  "rehype": "^12.0.1",
125
- "semver": "^7.3.7",
125
+ "semver": "^7.3.8",
126
126
  "server-destroy": "^1.0.1",
127
127
  "shiki": "^0.11.1",
128
128
  "slash": "^4.0.0",
@@ -44,10 +44,10 @@ declare module 'astro:content' {
44
44
  ): E extends ValidEntrySlug<C>
45
45
  ? Promise<CollectionEntry<C>>
46
46
  : Promise<CollectionEntry<C> | undefined>;
47
- export function getCollection<C extends keyof typeof entryMap>(
47
+ export function getCollection<C extends keyof typeof entryMap, E extends CollectionEntry<C>>(
48
48
  collection: C,
49
- filter?: (data: CollectionEntry<C>) => boolean
50
- ): Promise<CollectionEntry<C>[]>;
49
+ filter?: (entry: CollectionEntry<C>) => entry is E
50
+ ): Promise<E[]>;
51
51
 
52
52
  type InferEntrySchema<C extends keyof typeof entryMap> = import('astro/zod').infer<
53
53
  Required<ContentConfig['collections'][C]>['schema']