astro 3.0.6 → 3.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.
@@ -1,6 +1,6 @@
1
- // The `ts-expect-error` comments here are necessary because we're importing this file inside the `astro:components`
1
+ // The `ts-ignore` comments here are necessary because we're importing this file inside the `astro:components`
2
2
  // virtual module's types, which means that `tsc` will try to resolve these imports. Don't mind the editor errors.
3
- // @ts-expect-error
3
+ // @ts-ignore
4
4
  export { default as Code } from './Code.astro';
5
- // @ts-expect-error
5
+ // @ts-ignore
6
6
  export { default as Debug } from './Debug.astro';
@@ -12,11 +12,8 @@ interface GenerationDataCached {
12
12
  }
13
13
  type GenerationData = GenerationDataUncached | GenerationDataCached;
14
14
  export declare function generateImage(pipeline: BuildPipeline, options: ImageTransform, filepath: string): Promise<GenerationData | undefined>;
15
- export declare function getStaticImageList(): Iterable<[
16
- string,
17
- {
18
- path: string;
19
- options: ImageTransform;
20
- }
21
- ]>;
15
+ export declare function getStaticImageList(): Map<string, {
16
+ path: string;
17
+ options: ImageTransform;
18
+ }>;
22
19
  export {};
@@ -105,9 +105,9 @@ async function generateImage(pipeline, options, filepath) {
105
105
  }
106
106
  function getStaticImageList() {
107
107
  if (!globalThis?.astroAsset?.staticImages) {
108
- return [];
108
+ return /* @__PURE__ */ new Map();
109
109
  }
110
- return globalThis.astroAsset.staticImages?.entries();
110
+ return globalThis.astroAsset.staticImages;
111
111
  }
112
112
  export {
113
113
  generateImage,
@@ -145,10 +145,20 @@ ${bgGreen(black(` ${verb} static routes `))}`);
145
145
  }
146
146
  }
147
147
  }
148
- logger.info(null, `
148
+ const staticImageList = getStaticImageList();
149
+ if (staticImageList.size)
150
+ logger.info(null, `
149
151
  ${bgGreen(black(` generating optimized images `))}`);
150
- for (const imageData of getStaticImageList()) {
151
- await generateImage(pipeline, imageData[1].options, imageData[1].path);
152
+ let count = 0;
153
+ for (const imageData of staticImageList.entries()) {
154
+ count++;
155
+ await generateImage(
156
+ pipeline,
157
+ imageData[1].options,
158
+ imageData[1].path,
159
+ count,
160
+ staticImageList.size
161
+ );
152
162
  }
153
163
  delete globalThis?.astroAsset?.addStaticImage;
154
164
  await runHookBuildGenerated({
@@ -158,7 +168,7 @@ ${bgGreen(black(` generating optimized images `))}`);
158
168
  logger.info(null, dim(`Completed in ${getTimeStat(timer, performance.now())}.
159
169
  `));
160
170
  }
161
- async function generateImage(pipeline, transform, path) {
171
+ async function generateImage(pipeline, transform, path, count, totalCount) {
162
172
  const logger = pipeline.getLogger();
163
173
  let timeStart = performance.now();
164
174
  const generationData = await generateImageInternal(pipeline, transform, path);
@@ -168,8 +178,12 @@ async function generateImage(pipeline, transform, path) {
168
178
  const timeEnd = performance.now();
169
179
  const timeChange = getTimeStat(timeStart, timeEnd);
170
180
  const timeIncrease = `(+${timeChange})`;
171
- const statsText = generationData.cached ? `(reused cache entry)` : `(before: ${generationData.weight.before}kb, after: ${generationData.weight.after}kb)`;
172
- logger.info(null, ` ${green("\u25B6")} ${path} ${dim(statsText)} ${dim(timeIncrease)}`);
181
+ const statsText = generationData.cached ? `(reused cache entry)` : `(before: ${generationData.weight.before}kB, after: ${generationData.weight.after}kB)`;
182
+ const counter = `(${count}/${totalCount})`;
183
+ logger.info(
184
+ null,
185
+ ` ${green("\u25B6")} ${path} ${dim(statsText)} ${dim(timeIncrease)} ${dim(counter)}}`
186
+ );
173
187
  }
174
188
  async function generatePage(pageData, ssrEntry, builtPaths, pipeline) {
175
189
  let timeStart = performance.now();
@@ -127,7 +127,18 @@ async function ssrBuild(opts, internals, input, container) {
127
127
  format: "esm",
128
128
  // Server chunks can't go in the assets (_astro) folder
129
129
  // We need to keep these separate
130
- chunkFileNames: `chunks/[name].[hash].mjs`,
130
+ chunkFileNames(chunkInfo) {
131
+ const { name } = chunkInfo;
132
+ if (name.includes(ASTRO_PAGE_EXTENSION_POST_PATTERN)) {
133
+ const [sanitizedName] = name.split(ASTRO_PAGE_EXTENSION_POST_PATTERN);
134
+ return `chunks/${sanitizedName}_[hash].mjs`;
135
+ }
136
+ if (name.startsWith("pages/")) {
137
+ const sanitizedName = name.split(".")[0];
138
+ return `chunks/${sanitizedName}_[hash].mjs`;
139
+ }
140
+ return `chunks/[name]_[hash].mjs`;
141
+ },
131
142
  assetFileNames: `${settings.config.build.assets}/[name].[hash][extname]`,
132
143
  ...viteConfig.build?.rollupOptions?.output,
133
144
  entryFileNames(chunkInfo) {
@@ -144,7 +155,7 @@ async function ssrBuild(opts, internals, input, container) {
144
155
  } else if (chunkInfo.facadeModuleId === RESOLVED_RENDERERS_MODULE_ID) {
145
156
  return "renderers.mjs";
146
157
  } else if (chunkInfo.facadeModuleId === RESOLVED_SSR_MANIFEST_VIRTUAL_MODULE_ID) {
147
- return "manifest.[hash].mjs";
158
+ return "manifest_[hash].mjs";
148
159
  } else {
149
160
  return "[name].mjs";
150
161
  }
@@ -1,4 +1,4 @@
1
- const ASTRO_VERSION = "3.0.6";
1
+ const ASTRO_VERSION = "3.0.7";
2
2
  const SUPPORTED_MARKDOWN_FILE_EXTENSIONS = [
3
3
  ".markdown",
4
4
  ".mdown",
@@ -20,7 +20,7 @@ async function dev(inlineConfig) {
20
20
  base: restart.container.settings.config.base
21
21
  })
22
22
  );
23
- const currentVersion = "3.0.6";
23
+ const currentVersion = "3.0.7";
24
24
  if (currentVersion.includes("-")) {
25
25
  logger.warn(null, msg.prerelease({ currentVersion }));
26
26
  }
@@ -50,7 +50,7 @@ function serverStart({
50
50
  base,
51
51
  isRestart = false
52
52
  }) {
53
- const version = "3.0.6";
53
+ const version = "3.0.7";
54
54
  const localPrefix = `${dim("\u2503")} Local `;
55
55
  const networkPrefix = `${dim("\u2503")} Network `;
56
56
  const emptyPrefix = " ".repeat(11);
@@ -235,7 +235,7 @@ function printHelp({
235
235
  message.push(
236
236
  linebreak(),
237
237
  ` ${bgGreen(black(` ${commandName} `))} ${green(
238
- `v${"3.0.6"}`
238
+ `v${"3.0.7"}`
239
239
  )} ${headline}`
240
240
  );
241
241
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "astro",
3
- "version": "3.0.6",
3
+ "version": "3.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",
@@ -161,7 +161,7 @@
161
161
  "zod": "3.21.1",
162
162
  "@astrojs/internal-helpers": "0.2.0",
163
163
  "@astrojs/markdown-remark": "3.0.0",
164
- "@astrojs/telemetry": "3.0.0"
164
+ "@astrojs/telemetry": "3.0.1"
165
165
  },
166
166
  "devDependencies": {
167
167
  "@astrojs/check": "^0.1.0",