astro 4.4.14 → 4.4.15

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.
@@ -34,10 +34,11 @@ const ALIASES = /* @__PURE__ */ new Map([
34
34
  ["solid", "solid-js"],
35
35
  ["tailwindcss", "tailwind"]
36
36
  ]);
37
- const ASTRO_CONFIG_STUB = `import { defineConfig } from 'astro/config';
38
-
39
- export default defineConfig({});`;
40
- const TAILWIND_CONFIG_STUB = `/** @type {import('tailwindcss').Config} */
37
+ const STUBS = {
38
+ ASTRO_CONFIG: `import { defineConfig } from 'astro/config';
39
+ // https://astro.build/config
40
+ export default defineConfig({});`,
41
+ TAILWIND_CONFIG: `/** @type {import('tailwindcss').Config} */
41
42
  export default {
42
43
  content: ['./src/**/*.{astro,html,js,jsx,md,mdx,svelte,ts,tsx,vue}'],
43
44
  theme: {
@@ -45,16 +46,31 @@ export default {
45
46
  },
46
47
  plugins: [],
47
48
  }
48
- `;
49
- const SVELTE_CONFIG_STUB = `import { vitePreprocess } from '@astrojs/svelte';
49
+ `,
50
+ SVELTE_CONFIG: `import { vitePreprocess } from '@astrojs/svelte';
50
51
 
51
52
  export default {
52
53
  preprocess: vitePreprocess(),
53
- };
54
- `;
55
- const LIT_NPMRC_STUB = `# Lit libraries are required to be hoisted due to dependency issues.
54
+ }
55
+ `,
56
+ LIT_NPMRC: `# Lit libraries are required to be hoisted due to dependency issues.
56
57
  public-hoist-pattern[]=*lit*
57
- `;
58
+ `,
59
+ DB_CONFIG: `import { defineDb } from 'astro:db';
60
+
61
+ // https://astro.build/db/config
62
+ export default defineDb({
63
+ tables: {}
64
+ });
65
+ `,
66
+ DB_SEED: `import { db } from 'astro:db';
67
+
68
+ // https://astro.build/db/seed
69
+ export default async function seed() {
70
+ // TODO
71
+ }
72
+ `
73
+ };
58
74
  const OFFICIAL_ADAPTER_TO_IMPORT_MAP = {
59
75
  netlify: "@astrojs/netlify",
60
76
  vercel: "@astrojs/vercel/serverless",
@@ -147,7 +163,7 @@ async function add(names, { flags }) {
147
163
  "./tailwind.config.js"
148
164
  ],
149
165
  defaultConfigFile: "./tailwind.config.mjs",
150
- defaultConfigContent: TAILWIND_CONFIG_STUB
166
+ defaultConfigContent: STUBS.TAILWIND_CONFIG
151
167
  });
152
168
  }
153
169
  if (integrations.find((integration) => integration.id === "svelte")) {
@@ -158,9 +174,38 @@ async function add(names, { flags }) {
158
174
  integrationName: "Svelte",
159
175
  possibleConfigFiles: ["./svelte.config.js", "./svelte.config.cjs", "./svelte.config.mjs"],
160
176
  defaultConfigFile: "./svelte.config.js",
161
- defaultConfigContent: SVELTE_CONFIG_STUB
177
+ defaultConfigContent: STUBS.SVELTE_CONFIG
162
178
  });
163
179
  }
180
+ if (integrations.find((integration) => integration.id === "db")) {
181
+ if (!existsSync(new URL("./db/", root))) {
182
+ logger.info(
183
+ "SKIP_FORMAT",
184
+ `
185
+ ${magenta(
186
+ `Astro will scaffold ${green("./db/config.ts")}${magenta(" and ")}${green(
187
+ "./db/seed.ts"
188
+ )}${magenta(" files.")}`
189
+ )}
190
+ `
191
+ );
192
+ if (await askToContinue({ flags })) {
193
+ await fs.mkdir(new URL("./db", root));
194
+ await Promise.all([
195
+ fs.writeFile(new URL("./db/config.ts", root), STUBS.DB_CONFIG, { encoding: "utf-8" }),
196
+ fs.writeFile(new URL("./db/seed.ts", root), STUBS.DB_SEED, { encoding: "utf-8" })
197
+ ]);
198
+ } else {
199
+ logger.info(
200
+ "SKIP_FORMAT",
201
+ `
202
+ Astro DB requires additional configuration. Please refer to https://astro.build/db/config`
203
+ );
204
+ }
205
+ } else {
206
+ logger.debug("add", `Using existing db configuration`);
207
+ }
208
+ }
164
209
  if (integrations.find((integration) => integration.id === "lit") && (await preferredPM(fileURLToPath(root)))?.name === "pnpm") {
165
210
  await setupIntegrationConfig({
166
211
  root,
@@ -169,14 +214,14 @@ async function add(names, { flags }) {
169
214
  integrationName: "Lit",
170
215
  possibleConfigFiles: ["./.npmrc"],
171
216
  defaultConfigFile: "./.npmrc",
172
- defaultConfigContent: LIT_NPMRC_STUB
217
+ defaultConfigContent: STUBS.LIT_NPMRC
173
218
  });
174
219
  }
175
220
  break;
176
221
  }
177
222
  case 2 /* cancelled */: {
178
223
  logger.info(
179
- null,
224
+ "SKIP_FORMAT",
180
225
  msg.cancelled(
181
226
  `Dependencies ${bold("NOT")} installed.`,
182
227
  `Be sure to install them manually before continuing!`
@@ -201,7 +246,7 @@ async function add(names, { flags }) {
201
246
  } else {
202
247
  logger.info("add", `Unable to locate a config file, generating one for you.`);
203
248
  configURL = new URL("./astro.config.mjs", root);
204
- await fs.writeFile(fileURLToPath(configURL), ASTRO_CONFIG_STUB, { encoding: "utf-8" });
249
+ await fs.writeFile(fileURLToPath(configURL), STUBS.ASTRO_CONFIG, { encoding: "utf-8" });
205
250
  }
206
251
  let ast = null;
207
252
  try {
@@ -224,7 +269,7 @@ async function add(names, { flags }) {
224
269
  await setAdapter(ast, integration, officialExportName);
225
270
  } else {
226
271
  logger.info(
227
- null,
272
+ "SKIP_FORMAT",
228
273
  `
229
274
  ${magenta(
230
275
  `Check our deployment docs for ${bold(
@@ -259,7 +304,10 @@ async function add(names, { flags }) {
259
304
  }
260
305
  switch (configResult) {
261
306
  case 2 /* cancelled */: {
262
- logger.info(null, msg.cancelled(`Your configuration has ${bold("NOT")} been updated.`));
307
+ logger.info(
308
+ "SKIP_FORMAT",
309
+ msg.cancelled(`Your configuration has ${bold("NOT")} been updated.`)
310
+ );
263
311
  break;
264
312
  }
265
313
  case 0 /* none */: {
@@ -271,17 +319,17 @@ async function add(names, { flags }) {
271
319
  (integration) => !deps.includes(integration.packageName)
272
320
  );
273
321
  if (missingDeps.length === 0) {
274
- logger.info(null, msg.success(`Configuration up-to-date.`));
322
+ logger.info("SKIP_FORMAT", msg.success(`Configuration up-to-date.`));
275
323
  break;
276
324
  }
277
325
  }
278
- logger.info(null, msg.success(`Configuration up-to-date.`));
326
+ logger.info("SKIP_FORMAT", msg.success(`Configuration up-to-date.`));
279
327
  break;
280
328
  }
281
329
  default: {
282
330
  const list = integrations.map((integration) => ` - ${integration.packageName}`).join("\n");
283
331
  logger.info(
284
- null,
332
+ "SKIP_FORMAT",
285
333
  msg.success(
286
334
  `Added the following integration${integrations.length === 1 ? "" : "s"} to your project:
287
335
  ${list}`
@@ -296,7 +344,7 @@ ${list}`
296
344
  }
297
345
  case 2 /* cancelled */: {
298
346
  logger.info(
299
- null,
347
+ "SKIP_FORMAT",
300
348
  msg.cancelled(`Your TypeScript configuration has ${bold("NOT")} been updated.`)
301
349
  );
302
350
  break;
@@ -307,7 +355,7 @@ ${list}`
307
355
  );
308
356
  }
309
357
  default:
310
- logger.info(null, msg.success(`Successfully updated TypeScript settings`));
358
+ logger.info("SKIP_FORMAT", msg.success(`Successfully updated TypeScript settings`));
311
359
  }
312
360
  }
313
361
  function isAdapter(integration) {
@@ -488,14 +536,14 @@ ${boxen(diff, {
488
536
  })}
489
537
  `;
490
538
  logger.info(
491
- null,
539
+ "SKIP_FORMAT",
492
540
  `
493
541
  ${magenta("Astro will make the following changes to your config file:")}
494
542
  ${message}`
495
543
  );
496
544
  if (logAdapterInstructions) {
497
545
  logger.info(
498
- null,
546
+ "SKIP_FORMAT",
499
547
  magenta(
500
548
  ` For complete deployment options, visit
501
549
  ${bold(
@@ -597,7 +645,7 @@ ${boxen(coloredOutput, {
597
645
  })}
598
646
  `;
599
647
  logger.info(
600
- null,
648
+ "SKIP_FORMAT",
601
649
  `
602
650
  ${magenta("Astro will run the following command:")}
603
651
  ${dim(
@@ -801,7 +849,7 @@ ${boxen(diff, {
801
849
  })}
802
850
  `;
803
851
  logger.info(
804
- null,
852
+ "SKIP_FORMAT",
805
853
  `
806
854
  ${magenta(`Astro will make the following changes to your ${configFileName}:`)}
807
855
  ${message}`
@@ -810,7 +858,7 @@ ${message}`
810
858
  const hasConflictingIntegrations = integrations.filter((integration) => presets.has(integration)).length > 1 && integrations.filter((integration) => conflictingIntegrations.includes(integration)).length > 0;
811
859
  if (hasConflictingIntegrations) {
812
860
  logger.info(
813
- null,
861
+ "SKIP_FORMAT",
814
862
  red(
815
863
  ` ${bold(
816
864
  "Caution:"
@@ -895,7 +943,7 @@ async function setupIntegrationConfig(opts) {
895
943
  }
896
944
  if (!alreadyConfigured) {
897
945
  logger.info(
898
- null,
946
+ "SKIP_FORMAT",
899
947
  `
900
948
  ${magenta(`Astro will generate a minimal ${bold(opts.defaultConfigFile)} file.`)}
901
949
  `
@@ -25,7 +25,7 @@ async function getPackage(packageName, logger, options, otherDeps = []) {
25
25
  return packageImport;
26
26
  } catch (e) {
27
27
  logger.info(
28
- null,
28
+ "SKIP_FORMAT",
29
29
  `To continue, Astro requires the following dependency to be installed: ${bold(packageName)}.`
30
30
  );
31
31
  const result = await installPackage([packageName, ...otherDeps], options, logger);
@@ -87,7 +87,7 @@ ${boxen(coloredOutput, {
87
87
  })}
88
88
  `;
89
89
  logger.info(
90
- null,
90
+ "SKIP_FORMAT",
91
91
  `
92
92
  ${magenta("Astro will run the following command:")}
93
93
  ${dim(
@@ -1,4 +1,4 @@
1
- const ASTRO_VERSION = "4.4.14";
1
+ const ASTRO_VERSION = "4.4.15";
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.14";
26
+ const currentVersion = "4.4.15";
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.14";
39
+ const version = "4.4.15";
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.14"}`
264
+ `v${"4.4.15"}`
265
265
  )} ${headline}`
266
266
  );
267
267
  }
@@ -49,7 +49,7 @@ function isHTMLComponent(Component) {
49
49
  }
50
50
  const ASTRO_SLOT_EXP = /<\/?astro-slot\b[^>]*>/g;
51
51
  const ASTRO_STATIC_SLOT_EXP = /<\/?astro-static-slot\b[^>]*>/g;
52
- function removeStaticAstroSlot(html, supportsAstroStaticSlot) {
52
+ function removeStaticAstroSlot(html, supportsAstroStaticSlot = true) {
53
53
  const exp = supportsAstroStaticSlot ? ASTRO_STATIC_SLOT_EXP : ASTRO_SLOT_EXP;
54
54
  return html.replace(exp, "");
55
55
  }
@@ -245,9 +245,7 @@ If you're still stuck, please open an issue on GitHub or join us at https://astr
245
245
  destination.write(html);
246
246
  } else if (html && html.length > 0) {
247
247
  destination.write(
248
- markHTMLString(
249
- removeStaticAstroSlot(html, renderer?.ssr?.supportsAstroStaticSlot ?? false)
250
- )
248
+ markHTMLString(removeStaticAstroSlot(html, renderer?.ssr?.supportsAstroStaticSlot))
251
249
  );
252
250
  }
253
251
  }
@@ -306,7 +304,8 @@ ${serializeProps(
306
304
  })
307
305
  );
308
306
  }
309
- destination.write(markHTMLString(renderElement("astro-island", island, false)));
307
+ const renderedElement = renderElement("astro-island", island, false);
308
+ destination.write(markHTMLString(renderedElement));
310
309
  }
311
310
  };
312
311
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "astro",
3
- "version": "4.4.14",
3
+ "version": "4.4.15",
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",
@@ -163,9 +163,9 @@
163
163
  "which-pm": "^2.1.1",
164
164
  "yargs-parser": "^21.1.1",
165
165
  "zod": "^3.22.4",
166
- "@astrojs/telemetry": "3.0.4",
167
166
  "@astrojs/internal-helpers": "0.2.1",
168
- "@astrojs/markdown-remark": "4.2.1"
167
+ "@astrojs/markdown-remark": "4.2.1",
168
+ "@astrojs/telemetry": "3.0.4"
169
169
  },
170
170
  "optionalDependencies": {
171
171
  "sharp": "^0.32.6"