astro 4.2.5 → 4.2.6

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.
@@ -28,7 +28,8 @@ async function collectPagesData(opts) {
28
28
  styles: [],
29
29
  propagatedStyles: /* @__PURE__ */ new Map(),
30
30
  propagatedScripts: /* @__PURE__ */ new Map(),
31
- hoistedScript: void 0
31
+ hoistedScript: void 0,
32
+ hasSharedModules: false
32
33
  };
33
34
  clearInterval(routeCollectionLogTimeout);
34
35
  if (settings.config.output === "static") {
@@ -49,7 +50,8 @@ async function collectPagesData(opts) {
49
50
  styles: [],
50
51
  propagatedStyles: /* @__PURE__ */ new Map(),
51
52
  propagatedScripts: /* @__PURE__ */ new Map(),
52
- hoistedScript: void 0
53
+ hoistedScript: void 0,
54
+ hasSharedModules: false
53
55
  };
54
56
  }
55
57
  clearInterval(dataCollectionLogTimeout);
@@ -11,8 +11,37 @@ function vitePluginPrerender(opts, internals) {
11
11
  return "astro";
12
12
  }
13
13
  const pageInfo = internals.pagesByViteID.get(id);
14
+ let hasSharedModules = false;
14
15
  if (pageInfo) {
15
16
  if (getPrerenderMetadata(meta.getModuleInfo(id))) {
17
+ const infoMeta = meta.getModuleInfo(id);
18
+ for (const moduleId of infoMeta.importedIds) {
19
+ const moduleMeta = meta.getModuleInfo(moduleId);
20
+ if (
21
+ // a shared modules should be inside the `src/` folder, at least
22
+ moduleMeta.id.startsWith(opts.settings.config.srcDir.pathname) && // and has at least two importers: the current page and something else
23
+ moduleMeta.importers.length > 1
24
+ ) {
25
+ for (const importer of moduleMeta.importedIds) {
26
+ if (importer !== id) {
27
+ const importerModuleMeta = meta.getModuleInfo(importer);
28
+ if (importerModuleMeta) {
29
+ if (importerModuleMeta.id.includes("/pages")) {
30
+ if (getPrerenderMetadata(importerModuleMeta) === false) {
31
+ hasSharedModules = true;
32
+ break;
33
+ }
34
+ } else if (importerModuleMeta.id.includes("/middleware")) {
35
+ hasSharedModules = true;
36
+ break;
37
+ }
38
+ }
39
+ }
40
+ }
41
+ }
42
+ }
43
+ opts.allPages;
44
+ pageInfo.hasSharedModules = hasSharedModules;
16
45
  pageInfo.route.prerender = true;
17
46
  return "prerender";
18
47
  }
@@ -279,7 +279,7 @@ async function runPostBuildHooks(container, ssrOutputs, clientOutputs) {
279
279
  async function cleanStaticOutput(opts, internals, ssrOutputChunkNames) {
280
280
  const allStaticFiles = /* @__PURE__ */ new Set();
281
281
  for (const pageData of eachPageData(internals)) {
282
- if (pageData.route.prerender) {
282
+ if (pageData.route.prerender && !pageData.hasSharedModules) {
283
283
  const { moduleSpecifier } = pageData;
284
284
  const pageBundleId = internals.pageToBundleMap.get(moduleSpecifier);
285
285
  const entryBundleId = internals.entrySpecifierToBundleMap.get(moduleSpecifier);
@@ -28,6 +28,7 @@ export interface PageBuildData {
28
28
  order: number;
29
29
  sheet: StylesheetAsset;
30
30
  }>;
31
+ hasSharedModules: boolean;
31
32
  }
32
33
  export type AllPagesData = Record<ComponentPath, PageBuildData>;
33
34
  /** Options for the static build */
@@ -1,4 +1,4 @@
1
- const ASTRO_VERSION = "4.2.5";
1
+ const ASTRO_VERSION = "4.2.6";
2
2
  const SUPPORTED_MARKDOWN_FILE_EXTENSIONS = [
3
3
  ".markdown",
4
4
  ".mdown",
@@ -23,7 +23,7 @@ async function dev(inlineConfig) {
23
23
  base: restart.container.settings.config.base
24
24
  })
25
25
  );
26
- const currentVersion = "4.2.5";
26
+ const currentVersion = "4.2.6";
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.2.5";
39
+ const version = "4.2.6";
40
40
  const localPrefix = `${dim("\u2503")} Local `;
41
41
  const networkPrefix = `${dim("\u2503")} Network `;
42
42
  const emptyPrefix = " ".repeat(11);
@@ -258,7 +258,7 @@ function printHelp({
258
258
  message.push(
259
259
  linebreak(),
260
260
  ` ${bgGreen(black(` ${commandName} `))} ${green(
261
- `v${"4.2.5"}`
261
+ `v${"4.2.6"}`
262
262
  )} ${headline}`
263
263
  );
264
264
  }
@@ -42,11 +42,8 @@ const aria_non_interactive_roles = [
42
42
  "application",
43
43
  "article",
44
44
  "banner",
45
- "button",
46
45
  "cell",
47
- "checkbox",
48
46
  "columnheader",
49
- "combobox",
50
47
  "complementary",
51
48
  "contentinfo",
52
49
  "definition",
@@ -56,55 +53,30 @@ const aria_non_interactive_roles = [
56
53
  "feed",
57
54
  "figure",
58
55
  "form",
59
- "grid",
60
- "gridcell",
61
56
  "group",
62
57
  "heading",
63
58
  "img",
64
- "link",
65
59
  "list",
66
- "listbox",
67
60
  "listitem",
68
61
  "log",
69
62
  "main",
70
63
  "marquee",
71
64
  "math",
72
- "menu",
73
- "menubar",
74
- "menuitem",
75
- "menuitemcheckbox",
76
65
  "menuitemradio",
77
66
  "navigation",
78
67
  "none",
79
68
  "note",
80
- "option",
81
69
  "presentation",
82
- "progressbar",
83
- "radio",
84
- "radiogroup",
85
70
  "region",
86
71
  "row",
87
72
  "rowgroup",
88
73
  "rowheader",
89
- "scrollbar",
90
74
  "search",
91
- "searchbox",
92
- "separator",
93
- "slider",
94
- "spinbutton",
95
75
  "status",
96
- "switch",
97
- "tab",
98
- "tablist",
99
- "tabpanel",
100
76
  "term",
101
- "textbox",
102
77
  "timer",
103
78
  "toolbar",
104
- "tooltip",
105
- "tree",
106
- "treegrid",
107
- "treeitem"
79
+ "tooltip"
108
80
  ];
109
81
  const a11y_required_content = [
110
82
  // anchor-has-content
@@ -52,12 +52,16 @@ ${args.error}`
52
52
  if (id === resolvedVirtualModuleId) {
53
53
  return `
54
54
  export const loadDevToolbarApps = async () => {
55
- return (await Promise.all([${settings.devToolbarApps.map((plugin) => `safeLoadPlugin(${JSON.stringify(plugin)})`).join(",")}])).filter(app => app);
55
+ return (await Promise.all([${settings.devToolbarApps.map(
56
+ (plugin) => `safeLoadPlugin(async () => (await import(${JSON.stringify(
57
+ plugin
58
+ )})).default, ${JSON.stringify(plugin)})`
59
+ ).join(",")}])).filter(app => app);
56
60
  };
57
61
 
58
- async function safeLoadPlugin(entrypoint) {
62
+ async function safeLoadPlugin(importEntrypoint, entrypoint) {
59
63
  try {
60
- const app = (await import(/* @vite-ignore */ entrypoint)).default;
64
+ const app = await importEntrypoint();
61
65
 
62
66
  if (typeof app !== 'object' || !app.id || !app.name) {
63
67
  throw new Error("Apps must default export an object with an id, and a name.");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "astro",
3
- "version": "4.2.5",
3
+ "version": "4.2.6",
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",