astro 4.4.3 → 4.4.4

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.
@@ -212,7 +212,7 @@ export interface AstroGlobal<Props extends Record<string, any> = Record<string,
212
212
  * <Fragment set:html={html} />
213
213
  * ```
214
214
  *
215
- * A second parameters can be used to pass arguments to a slotted callback
215
+ * A second parameter can be used to pass arguments to a slotted callback
216
216
  *
217
217
  * Example usage:
218
218
  * ```astro
@@ -2459,6 +2459,7 @@ export interface PreviewServerParams {
2459
2459
  port: number;
2460
2460
  base: string;
2461
2461
  logger: AstroIntegrationLogger;
2462
+ headers?: OutgoingHttpHeaders;
2462
2463
  }
2463
2464
  export type CreatePreviewServer = (params: PreviewServerParams) => PreviewServer | Promise<PreviewServer>;
2464
2465
  export interface PreviewModule {
package/dist/cli/index.js CHANGED
@@ -12,6 +12,7 @@ async function printAstroHelp() {
12
12
  ["add", "Add an integration."],
13
13
  ["build", "Build your project and write it to disk."],
14
14
  ["check", "Check your project for errors."],
15
+ ["db", "Manage your Astro database."],
15
16
  ["dev", "Start the development server."],
16
17
  ["docs", "Open documentation in your web browser."],
17
18
  ["info", "List info about your current Astro setup."],
@@ -52,7 +53,11 @@ function resolveCommand(flags) {
52
53
  "check",
53
54
  "docs",
54
55
  "db",
55
- "info"
56
+ "info",
57
+ "login",
58
+ "loutout",
59
+ "link",
60
+ "init"
56
61
  ]);
57
62
  if (supportedCommands.has(cmd)) {
58
63
  return cmd;
@@ -108,7 +113,11 @@ async function runCommand(cmd, flags) {
108
113
  await add(packages, { flags });
109
114
  return;
110
115
  }
111
- case "db": {
116
+ case "db":
117
+ case "login":
118
+ case "logout":
119
+ case "link":
120
+ case "init": {
112
121
  const { db } = await import("./db/index.js");
113
122
  await db({ flags });
114
123
  return;
@@ -6,11 +6,22 @@ import prompts from "prompts";
6
6
  import resolvePackage from "resolve";
7
7
  import whichPm from "which-pm";
8
8
  import {} from "../core/logger/core.js";
9
+ import { createRequire } from "node:module";
10
+ import { sep } from "node:path";
11
+ const require2 = createRequire(import.meta.url);
9
12
  async function getPackage(packageName, logger, options, otherDeps = []) {
10
- let packageImport;
11
13
  try {
14
+ if (packageName === "@astrojs/db") {
15
+ const packageJsonLoc = require2.resolve(packageName + "/package.json", {
16
+ paths: [options.cwd ?? process.cwd()]
17
+ });
18
+ const packageLoc = packageJsonLoc.replace(`package.json`, "dist/index.js");
19
+ const packageImport2 = await import(packageLoc);
20
+ return packageImport2;
21
+ }
12
22
  await tryResolve(packageName, options.cwd ?? process.cwd());
13
- packageImport = await import(packageName);
23
+ const packageImport = await import(packageName);
24
+ return packageImport;
14
25
  } catch (e) {
15
26
  logger.info(
16
27
  null,
@@ -18,12 +29,12 @@ async function getPackage(packageName, logger, options, otherDeps = []) {
18
29
  );
19
30
  const result = await installPackage([packageName, ...otherDeps], options, logger);
20
31
  if (result) {
21
- packageImport = await import(packageName);
32
+ const packageImport = await import(packageName);
33
+ return packageImport;
22
34
  } else {
23
35
  return void 0;
24
36
  }
25
37
  }
26
- return packageImport;
27
38
  }
28
39
  function tryResolve(packageName, cwd) {
29
40
  return new Promise((resolve, reject) => {
@@ -237,6 +237,7 @@ ${bgGreen(black(" building client (vite) "))}`);
237
237
  ...viteConfig.build,
238
238
  emptyOutDir: false,
239
239
  outDir: fileURLToPath(out),
240
+ copyPublicDir: ssr,
240
241
  rollupOptions: {
241
242
  ...viteConfig.build?.rollupOptions,
242
243
  input: Array.from(input),
@@ -7,7 +7,7 @@ function mergeConfigRecursively(defaults, overrides, rootPath) {
7
7
  if (value == null) {
8
8
  continue;
9
9
  }
10
- const existing = merged[key];
10
+ let existing = merged[key];
11
11
  if (existing == null) {
12
12
  merged[key] = value;
13
13
  continue;
@@ -26,6 +26,11 @@ function mergeConfigRecursively(defaults, overrides, rootPath) {
26
26
  continue;
27
27
  }
28
28
  }
29
+ if (key === "data" && rootPath === "db") {
30
+ if (!Array.isArray(existing) && !Array.isArray(value)) {
31
+ existing = [existing];
32
+ }
33
+ }
29
34
  if (Array.isArray(existing) || Array.isArray(value)) {
30
35
  merged[key] = [...arraify(existing ?? []), ...arraify(value ?? [])];
31
36
  continue;
@@ -1,4 +1,4 @@
1
- const ASTRO_VERSION = "4.4.3";
1
+ const ASTRO_VERSION = "4.4.4";
2
2
  const REROUTE_DIRECTIVE_HEADER = "X-Astro-Reroute";
3
3
  const ROUTE_TYPE_HEADER = "X-Astro-Route-Type";
4
4
  const REROUTABLE_STATUS_CODES = [404, 500];
@@ -23,7 +23,7 @@ async function dev(inlineConfig) {
23
23
  base: restart.container.settings.config.base
24
24
  })
25
25
  );
26
- const currentVersion = "4.4.3";
26
+ const currentVersion = "4.4.4";
27
27
  if (currentVersion.includes("-")) {
28
28
  logger.warn("SKIP_FORMAT", msg.prerelease({ currentVersion }));
29
29
  }
@@ -36,7 +36,7 @@ function serverStart({
36
36
  host,
37
37
  base
38
38
  }) {
39
- const version = "4.4.3";
39
+ const version = "4.4.4";
40
40
  const localPrefix = `${dim("\u2503")} Local `;
41
41
  const networkPrefix = `${dim("\u2503")} Network `;
42
42
  const emptyPrefix = " ".repeat(11);
@@ -261,7 +261,7 @@ function printHelp({
261
261
  message.push(
262
262
  linebreak(),
263
263
  ` ${bgGreen(black(` ${commandName} `))} ${green(
264
- `v${"4.4.3"}`
264
+ `v${"4.4.4"}`
265
265
  )} ${headline}`
266
266
  );
267
267
  }
@@ -58,7 +58,8 @@ async function preview(inlineConfig) {
58
58
  host: getResolvedHostForHttpServer(settings.config.server.host),
59
59
  port: settings.config.server.port,
60
60
  base: settings.config.base,
61
- logger: new AstroIntegrationLogger(logger.options, settings.adapter.name)
61
+ logger: new AstroIntegrationLogger(logger.options, settings.adapter.name),
62
+ headers: settings.config.server.headers
62
63
  });
63
64
  return server;
64
65
  }
@@ -43,6 +43,9 @@ function reEncode(s) {
43
43
  return reEncodeInValidStart[result.codePointAt(0) ?? 0] ? "_" + result : result;
44
44
  }
45
45
  function renderTransition(result, hash, animationName, transitionName) {
46
+ if (typeof (transitionName ?? "") !== "string") {
47
+ throw new Error(`Invalid transition name {${transitionName}}`);
48
+ }
46
49
  if (!animationName)
47
50
  animationName = "fade";
48
51
  const scope = createTransitionScope(result, hash);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "astro",
3
- "version": "4.4.3",
3
+ "version": "4.4.4",
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",