astro 5.0.6 → 5.0.7

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.
@@ -114,7 +114,7 @@ class ContentLayer {
114
114
  logger.info("Content config changed");
115
115
  shouldClear = true;
116
116
  }
117
- if (previousAstroVersion !== "5.0.6") {
117
+ if (previousAstroVersion !== "5.0.7") {
118
118
  logger.info("Astro version changed");
119
119
  shouldClear = true;
120
120
  }
@@ -122,8 +122,8 @@ class ContentLayer {
122
122
  logger.info("Clearing content store");
123
123
  this.#store.clearAll();
124
124
  }
125
- if ("5.0.6") {
126
- await this.#store.metaStore().set("astro-version", "5.0.6");
125
+ if ("5.0.7") {
126
+ await this.#store.metaStore().set("astro-version", "5.0.7");
127
127
  }
128
128
  if (currentConfigDigest) {
129
129
  await this.#store.metaStore().set("config-digest", currentConfigDigest);
@@ -139,12 +139,12 @@ class AstroBuilder {
139
139
  viteConfig,
140
140
  key: keyPromise
141
141
  };
142
- const { internals, ssrOutputChunkNames, ssrOutputAssetNames, contentFileNames } = await viteBuild(opts);
142
+ const { internals, ssrOutputChunkNames, contentFileNames } = await viteBuild(opts);
143
143
  const hasServerIslands = this.settings.serverIslandNameMap.size > 0;
144
144
  if (hasServerIslands && this.settings.buildOutput !== "server") {
145
145
  throw new AstroError(AstroErrorData.NoAdapterInstalledServerIslands);
146
146
  }
147
- await staticBuild(opts, internals, ssrOutputChunkNames, ssrOutputAssetNames, contentFileNames);
147
+ await staticBuild(opts, internals, ssrOutputChunkNames, contentFileNames);
148
148
  this.timer.assetsStart = performance.now();
149
149
  Object.keys(assets).map((k) => {
150
150
  if (!assets[k]) return;
@@ -4,10 +4,9 @@ import type { StaticBuildOptions } from './types.js';
4
4
  export declare function viteBuild(opts: StaticBuildOptions): Promise<{
5
5
  internals: BuildInternals;
6
6
  ssrOutputChunkNames: string[];
7
- ssrOutputAssetNames: string[];
8
7
  contentFileNames: undefined;
9
8
  }>;
10
- export declare function staticBuild(opts: StaticBuildOptions, internals: BuildInternals, ssrOutputChunkNames: string[], ssrOutputAssetNames: string[], contentFileNames?: string[]): Promise<void>;
9
+ export declare function staticBuild(opts: StaticBuildOptions, internals: BuildInternals, ssrOutputChunkNames: string[], contentFileNames?: string[]): Promise<void>;
11
10
  export declare function copyFiles(fromFolder: URL, toFolder: URL, includeDotfiles?: boolean): Promise<void[] | undefined>;
12
11
  /**
13
12
  * This function takes the virtual module name of any page entrypoint and
@@ -69,20 +69,16 @@ async function viteBuild(opts) {
69
69
  teardown();
70
70
  }
71
71
  const ssrOutputChunkNames = [];
72
- const ssrOutputAssetNames = [];
73
72
  for (const output of ssrOutputs) {
74
73
  for (const chunk of output.output) {
75
74
  if (chunk.type === "chunk") {
76
75
  ssrOutputChunkNames.push(chunk.fileName);
77
76
  }
78
- if (chunk.type === "asset") {
79
- ssrOutputAssetNames.push(chunk.fileName);
80
- }
81
77
  }
82
78
  }
83
- return { internals, ssrOutputChunkNames, ssrOutputAssetNames, contentFileNames };
79
+ return { internals, ssrOutputChunkNames, contentFileNames };
84
80
  }
85
- async function staticBuild(opts, internals, ssrOutputChunkNames, ssrOutputAssetNames, contentFileNames) {
81
+ async function staticBuild(opts, internals, ssrOutputChunkNames, contentFileNames) {
86
82
  const { settings } = opts;
87
83
  if (settings.buildOutput === "static") {
88
84
  settings.timer.start("Static generate");
@@ -93,7 +89,7 @@ async function staticBuild(opts, internals, ssrOutputChunkNames, ssrOutputAssetN
93
89
  settings.timer.start("Server generate");
94
90
  await generatePages(opts, internals);
95
91
  await cleanStaticOutput(opts, internals);
96
- await ssrMoveAssets(opts, ssrOutputAssetNames);
92
+ await ssrMoveAssets(opts);
97
93
  settings.timer.end("Server generate");
98
94
  }
99
95
  }
@@ -309,15 +305,21 @@ async function copyFiles(fromFolder, toFolder, includeDotfiles = false) {
309
305
  })
310
306
  );
311
307
  }
312
- async function ssrMoveAssets(opts, ssrOutputAssetNames) {
308
+ async function ssrMoveAssets(opts) {
313
309
  opts.logger.info("build", "Rearranging server assets...");
314
310
  const serverRoot = opts.settings.buildOutput === "static" ? opts.settings.config.build.client : opts.settings.config.build.server;
315
311
  const clientRoot = opts.settings.config.build.client;
316
- if (ssrOutputAssetNames.length > 0) {
312
+ const assets = opts.settings.config.build.assets;
313
+ const serverAssets = new URL(`./${assets}/`, appendForwardSlash(serverRoot.toString()));
314
+ const clientAssets = new URL(`./${assets}/`, appendForwardSlash(clientRoot.toString()));
315
+ const files = await glob(`**/*`, {
316
+ cwd: fileURLToPath(serverAssets)
317
+ });
318
+ if (files.length > 0) {
317
319
  await Promise.all(
318
- ssrOutputAssetNames.map(async function moveAsset(filename) {
319
- const currentUrl = new URL(filename, appendForwardSlash(serverRoot.toString()));
320
- const clientUrl = new URL(filename, appendForwardSlash(clientRoot.toString()));
320
+ files.map(async function moveAsset(filename) {
321
+ const currentUrl = new URL(filename, appendForwardSlash(serverAssets.toString()));
322
+ const clientUrl = new URL(filename, appendForwardSlash(clientAssets.toString()));
321
323
  const dir = new URL(path.parse(clientUrl.href).dir);
322
324
  if (!fs.existsSync(dir)) await fs.promises.mkdir(dir, { recursive: true });
323
325
  return fs.promises.rename(currentUrl, clientUrl);
@@ -1,4 +1,4 @@
1
- const ASTRO_VERSION = "5.0.6";
1
+ const ASTRO_VERSION = "5.0.7";
2
2
  const REROUTE_DIRECTIVE_HEADER = "X-Astro-Reroute";
3
3
  const REWRITE_DIRECTIVE_HEADER_KEY = "X-Astro-Rewrite";
4
4
  const REWRITE_DIRECTIVE_HEADER_VALUE = "yes";
@@ -22,7 +22,7 @@ async function dev(inlineConfig) {
22
22
  await telemetry.record([]);
23
23
  const restart = await createContainerWithAutomaticRestart({ inlineConfig, fs });
24
24
  const logger = restart.container.logger;
25
- const currentVersion = "5.0.6";
25
+ const currentVersion = "5.0.7";
26
26
  const isPrerelease = currentVersion.includes("-");
27
27
  if (!isPrerelease) {
28
28
  try {
@@ -38,7 +38,7 @@ function serverStart({
38
38
  host,
39
39
  base
40
40
  }) {
41
- const version = "5.0.6";
41
+ const version = "5.0.7";
42
42
  const localPrefix = `${dim("\u2503")} Local `;
43
43
  const networkPrefix = `${dim("\u2503")} Network `;
44
44
  const emptyPrefix = " ".repeat(11);
@@ -276,7 +276,7 @@ function printHelp({
276
276
  message.push(
277
277
  linebreak(),
278
278
  ` ${bgGreen(black(` ${commandName} `))} ${green(
279
- `v${"5.0.6"}`
279
+ `v${"5.0.7"}`
280
280
  )} ${headline}`
281
281
  );
282
282
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "astro",
3
- "version": "5.0.6",
3
+ "version": "5.0.7",
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",
@@ -159,8 +159,8 @@
159
159
  "zod-to-json-schema": "^3.23.5",
160
160
  "zod-to-ts": "^1.2.0",
161
161
  "@astrojs/internal-helpers": "0.4.2",
162
- "@astrojs/telemetry": "3.2.0",
163
- "@astrojs/markdown-remark": "6.0.1"
162
+ "@astrojs/markdown-remark": "6.0.1",
163
+ "@astrojs/telemetry": "3.2.0"
164
164
  },
165
165
  "optionalDependencies": {
166
166
  "sharp": "^0.33.3"