astro 1.2.1 → 1.2.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.
@@ -36,10 +36,7 @@ export declare const AstroConfigSchema: z.ZodObject<{
36
36
  }>, "many">>, {
37
37
  name: string;
38
38
  hooks: {};
39
- }[], {
40
- hooks?: {} | undefined;
41
- name: string;
42
- }[] | undefined>;
39
+ }[], unknown>;
43
40
  build: z.ZodDefault<z.ZodOptional<z.ZodObject<{
44
41
  format: z.ZodDefault<z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"file">, z.ZodLiteral<"directory">]>>>;
45
42
  }, "strip", z.ZodTypeAny, {
@@ -59,10 +56,7 @@ export declare const AstroConfigSchema: z.ZodObject<{
59
56
  }>>>, {
60
57
  host: string | boolean;
61
58
  port: number;
62
- }, {
63
- host?: string | boolean | undefined;
64
- port?: number | undefined;
65
- } | undefined>;
59
+ }, unknown>;
66
60
  style: z.ZodDefault<z.ZodOptional<z.ZodObject<{
67
61
  postcss: z.ZodDefault<z.ZodOptional<z.ZodObject<{
68
62
  options: z.ZodAny;
@@ -206,19 +200,13 @@ export declare const AstroConfigSchema: z.ZodObject<{
206
200
  publicDir?: string | undefined;
207
201
  outDir?: string | undefined;
208
202
  trailingSlash?: "never" | "always" | "ignore" | undefined;
209
- server?: {
210
- host?: string | boolean | undefined;
211
- port?: number | undefined;
212
- } | undefined;
203
+ server?: unknown;
213
204
  output?: "static" | "server" | undefined;
214
205
  adapter?: {
215
206
  hooks?: {} | undefined;
216
207
  name: string;
217
208
  } | undefined;
218
- integrations?: {
219
- hooks?: {} | undefined;
220
- name: string;
221
- }[] | undefined;
209
+ integrations?: unknown;
222
210
  build?: {
223
211
  format?: "file" | "directory" | undefined;
224
212
  } | undefined;
@@ -48,7 +48,7 @@ async function dev(config, options) {
48
48
  isRestart
49
49
  })
50
50
  );
51
- const currentVersion = "1.2.1";
51
+ const currentVersion = "1.2.2";
52
52
  if (currentVersion.includes("-")) {
53
53
  warn(options.logging, null, msg.prerelease({ currentVersion }));
54
54
  }
@@ -17,21 +17,27 @@ function cleanErrorStack(stack) {
17
17
  function fixViteErrorMessage(_err, server, filePath) {
18
18
  var _a, _b;
19
19
  const err = createSafeError(_err);
20
- server == null ? void 0 : server.ssrFixStacktrace(err);
20
+ try {
21
+ server == null ? void 0 : server.ssrFixStacktrace(err);
22
+ } catch {
23
+ }
21
24
  if (err.message === "import.meta.glob() can only accept string literals.") {
22
25
  err.message = "Astro.glob() and import.meta.glob() can only accept string literals.";
23
26
  }
24
27
  if (filePath && /failed to load module for ssr:/.test(err.message)) {
25
28
  const importName = (_a = err.message.split("for ssr:").at(1)) == null ? void 0 : _a.trim();
26
29
  if (importName) {
27
- const content = fs.readFileSync(fileURLToPath(filePath)).toString();
28
- const lns = content.split("\n");
29
- const line = lns.findIndex((ln) => ln.includes(importName));
30
- if (line == -1)
31
- return err;
32
- const column = (_b = lns[line]) == null ? void 0 : _b.indexOf(importName);
33
- if (!err.id) {
34
- err.id = `${fileURLToPath(filePath)}:${line + 1}:${column + 1}`;
30
+ try {
31
+ const content = fs.readFileSync(fileURLToPath(filePath)).toString();
32
+ const lns = content.split("\n");
33
+ const line = lns.findIndex((ln) => ln.includes(importName));
34
+ if (line == -1)
35
+ return err;
36
+ const column = (_b = lns[line]) == null ? void 0 : _b.indexOf(importName);
37
+ if (!err.id) {
38
+ err.id = `${fileURLToPath(filePath)}:${line + 1}:${column + 1}`;
39
+ }
40
+ } catch {
35
41
  }
36
42
  }
37
43
  }
@@ -47,7 +47,7 @@ function devStart({
47
47
  site,
48
48
  isRestart = false
49
49
  }) {
50
- const version = "1.2.1";
50
+ const version = "1.2.2";
51
51
  const rootPath = site ? site.pathname : "/";
52
52
  const localPrefix = `${dim("\u2503")} Local `;
53
53
  const networkPrefix = `${dim("\u2503")} Network `;
@@ -226,7 +226,7 @@ function printHelp({
226
226
  message.push(
227
227
  linebreak(),
228
228
  ` ${bgGreen(black(` ${commandName} `))} ${green(
229
- `v${"1.2.1"}`
229
+ `v${"1.2.2"}`
230
230
  )} ${headline}`
231
231
  );
232
232
  }
package/dist/core/util.js CHANGED
@@ -5,7 +5,7 @@ import resolve from "resolve";
5
5
  import slash from "slash";
6
6
  import { fileURLToPath, pathToFileURL } from "url";
7
7
  import { prependForwardSlash, removeTrailingForwardSlash } from "./path.js";
8
- const ASTRO_VERSION = "1.2.1";
8
+ const ASTRO_VERSION = "1.2.2";
9
9
  function isObject(value) {
10
10
  return typeof value === "object" && value != null;
11
11
  }
@@ -35,6 +35,12 @@ async function runHookConfigSetup({
35
35
  config: updatedConfig,
36
36
  command,
37
37
  addRenderer(renderer) {
38
+ if (!renderer.name) {
39
+ throw new Error(`Integration ${bold(integration.name)} has an unnamed renderer.`);
40
+ }
41
+ if (!renderer.serverEntrypoint) {
42
+ throw new Error(`Renderer ${bold(renderer.name)} does not provide a serverEntrypoint.`);
43
+ }
38
44
  updatedConfig._ctx.renderers.push(renderer);
39
45
  },
40
46
  injectScript: (stage, content) => {
@@ -1,4 +1,4 @@
1
- const ASTRO_VERSION = "1.2.1";
1
+ const ASTRO_VERSION = "1.2.2";
2
2
  function createDeprecatedFetchContentFn() {
3
3
  return () => {
4
4
  throw new Error("Deprecated: Astro.fetchContent() has been replaced with Astro.glob().");
@@ -14,7 +14,7 @@ import { preload, ssr } from "../core/render/dev/index.js";
14
14
  import { RouteCache } from "../core/render/route-cache.js";
15
15
  import { createRequest } from "../core/request.js";
16
16
  import { createRouteManifest, matchAllRoutes } from "../core/routing/index.js";
17
- import { createSafeError, resolvePages } from "../core/util.js";
17
+ import { resolvePages } from "../core/util.js";
18
18
  import notFoundTemplate, { subpathNotUsedTemplate } from "../template/4xx.js";
19
19
  function truncateString(str, n) {
20
20
  if (str.length > n) {
@@ -255,7 +255,7 @@ async function handleRequest(routeCache, viteServer, logging, manifest, config,
255
255
  return await writeSSRResult(result, res);
256
256
  }
257
257
  } catch (_err) {
258
- const err = fixViteErrorMessage(createSafeError(_err), viteServer, filePath);
258
+ const err = fixViteErrorMessage(_err, viteServer, filePath);
259
259
  const errorWithMetadata = collectErrorMetadata(err);
260
260
  error(logging, null, msg.formatErrorMessage(errorWithMetadata));
261
261
  handle500Response(viteServer, origin, req, res, errorWithMetadata);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "astro",
3
- "version": "1.2.1",
3
+ "version": "1.2.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",