astro 7.1.4 → 7.1.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.
- package/dist/cli/infra/build-time-astro-version-provider.js +1 -1
- package/dist/container/index.js +1 -2
- package/dist/content/consts.d.ts +4 -0
- package/dist/content/consts.js +8 -0
- package/dist/content/content-layer.js +3 -3
- package/dist/content/data-store-writer.d.ts +1 -1
- package/dist/content/data-store-writer.js +4 -3
- package/dist/content/data-store.d.ts +3 -3
- package/dist/content/data-store.js +3 -3
- package/dist/content/mutable-data-store.d.ts +3 -3
- package/dist/content/mutable-data-store.js +5 -5
- package/dist/content/paths.d.ts +2 -1
- package/dist/content/paths.js +11 -0
- package/dist/content/vite-plugin-content-virtual-mod.js +41 -15
- package/dist/core/app/types.d.ts +0 -2
- package/dist/core/base-pipeline.js +9 -3
- package/dist/core/build/generate.js +58 -51
- package/dist/core/build/plugins/plugin-manifest.js +1 -6
- package/dist/core/config/schemas/base.d.ts +4 -4
- package/dist/core/config/schemas/base.js +8 -1
- package/dist/core/config/schemas/relative.d.ts +12 -6
- package/dist/core/constants.js +1 -1
- package/dist/core/create-vite.js +2 -0
- package/dist/core/dev/dev.js +5 -4
- package/dist/core/errors/default-handler.d.ts +1 -1
- package/dist/core/errors/default-handler.js +16 -0
- package/dist/core/errors/dev-handler.d.ts +1 -1
- package/dist/core/errors/dev-handler.js +10 -0
- package/dist/core/errors/handler.d.ts +14 -0
- package/dist/core/errors/handler.js +7 -0
- package/dist/core/logger/load.d.ts +4 -0
- package/dist/core/logger/load.js +25 -51
- package/dist/core/logger/utils.d.ts +21 -0
- package/dist/core/logger/utils.js +20 -0
- package/dist/core/logger/vite-plugin.d.ts +30 -0
- package/dist/core/logger/vite-plugin.js +79 -0
- package/dist/core/messages/runtime.js +1 -1
- package/dist/core/routing/handler.js +16 -2
- package/dist/core/sync/index.js +5 -4
- package/dist/manifest/serialized.js +4 -6
- package/dist/types/public/config.d.ts +17 -8
- package/dist/vite-plugin-hmr-reload/index.js +60 -18
- package/package.json +7 -7
|
@@ -3,15 +3,38 @@ import { VIRTUAL_PAGE_RESOLVED_MODULE_ID } from "../vite-plugin-pages/const.js";
|
|
|
3
3
|
import { RESOLVED_MODULE_DEV_CSS_PREFIX } from "../vite-plugin-css/const.js";
|
|
4
4
|
import { getDevCssModuleNameFromPageVirtualModuleName } from "../vite-plugin-css/util.js";
|
|
5
5
|
import { isAstroServerEnvironment } from "../environments.js";
|
|
6
|
-
const STYLE_EXT_REGEX = /\.(?:css|
|
|
6
|
+
const STYLE_EXT_REGEX = /\.(?:css|less|sass|scss|styl|stylus|pcss|postcss|sss)$/i;
|
|
7
|
+
const STYLE_COMPONENT_EXT_REGEX = /\.(astro|svelte|vue)$/i;
|
|
7
8
|
const RAW_QUERY_REGEX = /(?:\?|&)raw(?:&|$)/;
|
|
8
9
|
function hasStyleExtension(id) {
|
|
9
10
|
return STYLE_EXT_REGEX.test(id.split("?")[0]);
|
|
10
11
|
}
|
|
11
|
-
function
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
function isComponentStyleModule(id) {
|
|
13
|
+
const [filename, rawQuery] = id.split("?", 2);
|
|
14
|
+
const extensionMatch = STYLE_COMPONENT_EXT_REGEX.exec(filename);
|
|
15
|
+
if (!rawQuery || !extensionMatch) return false;
|
|
16
|
+
const query = new URLSearchParams(rawQuery);
|
|
17
|
+
return query.get("type") === "style" && query.has(extensionMatch[1].toLowerCase());
|
|
18
|
+
}
|
|
19
|
+
function getStyleModuleType(mod) {
|
|
20
|
+
if (mod.id && RAW_QUERY_REGEX.test(mod.id) && hasStyleExtension(mod.id)) return;
|
|
21
|
+
if (mod.id && isComponentStyleModule(mod.id)) return "component";
|
|
22
|
+
if (mod.file && hasStyleExtension(mod.file)) return "file";
|
|
23
|
+
return mod.id && hasStyleExtension(mod.id) ? "file" : void 0;
|
|
24
|
+
}
|
|
25
|
+
function hasClientStyleModuleByFile(moduleGraph, mod, styleType) {
|
|
26
|
+
if (mod.file == null || moduleGraph.getModulesByFile == null) return false;
|
|
27
|
+
const fileModules = moduleGraph.getModulesByFile(mod.file);
|
|
28
|
+
if (fileModules == null) return false;
|
|
29
|
+
for (const fileMod of fileModules) {
|
|
30
|
+
if (fileMod.id == null) continue;
|
|
31
|
+
if (styleType === "component") {
|
|
32
|
+
if (isComponentStyleModule(fileMod.id)) return true;
|
|
33
|
+
} else if (!RAW_QUERY_REGEX.test(fileMod.id) && hasStyleExtension(fileMod.id)) {
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return false;
|
|
15
38
|
}
|
|
16
39
|
function hmrReload() {
|
|
17
40
|
return {
|
|
@@ -22,19 +45,45 @@ function hmrReload() {
|
|
|
22
45
|
handler({ modules, server, timestamp, file }) {
|
|
23
46
|
if (!isAstroServerEnvironment(this.environment)) return;
|
|
24
47
|
let hasSsrOnlyModules = false;
|
|
48
|
+
let hasStyleModules = false;
|
|
25
49
|
let hasSkippedStyleModules = false;
|
|
26
50
|
const invalidatedModules = /* @__PURE__ */ new Set();
|
|
27
51
|
for (const mod of modules) {
|
|
28
52
|
if (mod.id == null) continue;
|
|
29
|
-
|
|
53
|
+
const styleType = getStyleModuleType(mod);
|
|
54
|
+
const clientModule = server.environments.client.moduleGraph.getModuleById(mod.id);
|
|
55
|
+
if (styleType) {
|
|
56
|
+
hasStyleModules = true;
|
|
57
|
+
if (clientModule == null && !hasClientStyleModuleByFile(server.environments.client.moduleGraph, mod, styleType)) {
|
|
58
|
+
this.environment.moduleGraph.invalidateModule(
|
|
59
|
+
mod,
|
|
60
|
+
invalidatedModules,
|
|
61
|
+
timestamp,
|
|
62
|
+
true
|
|
63
|
+
);
|
|
64
|
+
hasSsrOnlyModules = true;
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
30
67
|
hasSkippedStyleModules = true;
|
|
31
68
|
continue;
|
|
32
69
|
}
|
|
33
|
-
const clientModule = server.environments.client.moduleGraph.getModuleById(mod.id);
|
|
34
70
|
if (clientModule != null) continue;
|
|
35
71
|
this.environment.moduleGraph.invalidateModule(mod, invalidatedModules, timestamp, true);
|
|
36
72
|
hasSsrOnlyModules = true;
|
|
37
73
|
}
|
|
74
|
+
const invalidateDevCssModules = () => {
|
|
75
|
+
for (const [id, mod] of this.environment.moduleGraph.idToModuleMap) {
|
|
76
|
+
if (id.startsWith(RESOLVED_MODULE_DEV_CSS_PREFIX)) {
|
|
77
|
+
this.environment.moduleGraph.invalidateModule(mod, void 0, timestamp, true);
|
|
78
|
+
if (isRunnableDevEnvironment(this.environment)) {
|
|
79
|
+
const runnerMod = this.environment.runner.evaluatedModules.getModuleById(id);
|
|
80
|
+
if (runnerMod) {
|
|
81
|
+
this.environment.runner.evaluatedModules.invalidateModule(runnerMod);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
};
|
|
38
87
|
for (const invalidatedModule of invalidatedModules) {
|
|
39
88
|
if (invalidatedModule.id?.startsWith(VIRTUAL_PAGE_RESOLVED_MODULE_ID)) {
|
|
40
89
|
const cssMod = this.environment.moduleGraph.getModuleById(
|
|
@@ -45,6 +94,9 @@ function hmrReload() {
|
|
|
45
94
|
}
|
|
46
95
|
}
|
|
47
96
|
if (hasSsrOnlyModules) {
|
|
97
|
+
if (hasStyleModules) {
|
|
98
|
+
invalidateDevCssModules();
|
|
99
|
+
}
|
|
48
100
|
if (isRunnableDevEnvironment(this.environment)) {
|
|
49
101
|
for (const invalidated of invalidatedModules) {
|
|
50
102
|
if (invalidated.id == null) continue;
|
|
@@ -67,17 +119,7 @@ function hmrReload() {
|
|
|
67
119
|
return [];
|
|
68
120
|
}
|
|
69
121
|
if (hasSkippedStyleModules) {
|
|
70
|
-
|
|
71
|
-
if (id.startsWith(RESOLVED_MODULE_DEV_CSS_PREFIX)) {
|
|
72
|
-
this.environment.moduleGraph.invalidateModule(mod, void 0, timestamp, true);
|
|
73
|
-
if (isRunnableDevEnvironment(this.environment)) {
|
|
74
|
-
const runnerMod = this.environment.runner.evaluatedModules.getModuleById(id);
|
|
75
|
-
if (runnerMod) {
|
|
76
|
-
this.environment.runner.evaluatedModules.invalidateModule(runnerMod);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
122
|
+
invalidateDevCssModules();
|
|
81
123
|
return [];
|
|
82
124
|
}
|
|
83
125
|
if (modules.length > 0) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "astro",
|
|
3
|
-
"version": "7.1.
|
|
3
|
+
"version": "7.1.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",
|
|
@@ -96,7 +96,7 @@
|
|
|
96
96
|
"README.md"
|
|
97
97
|
],
|
|
98
98
|
"dependencies": {
|
|
99
|
-
"@astrojs/compiler-rs": "^0.3.
|
|
99
|
+
"@astrojs/compiler-rs": "^0.3.2",
|
|
100
100
|
"@capsizecss/unpack": "^4.0.0",
|
|
101
101
|
"@clack/prompts": "^1.1.0",
|
|
102
102
|
"@oslojs/encoding": "^1.1.0",
|
|
@@ -119,7 +119,7 @@
|
|
|
119
119
|
"github-slugger": "^2.0.0",
|
|
120
120
|
"html-escaper": "3.0.3",
|
|
121
121
|
"http-cache-semantics": "^4.2.0",
|
|
122
|
-
"js-yaml": "^4.
|
|
122
|
+
"js-yaml": "^4.3.0",
|
|
123
123
|
"jsonc-parser": "^3.3.1",
|
|
124
124
|
"magic-string": "^1.0.0",
|
|
125
125
|
"magicast": "^0.5.2",
|
|
@@ -146,15 +146,15 @@
|
|
|
146
146
|
"xxhash-wasm": "^1.1.0",
|
|
147
147
|
"yargs-parser": "^22.0.0",
|
|
148
148
|
"zod": "^4.3.6",
|
|
149
|
-
"@astrojs/internal-helpers": "0.10.
|
|
150
|
-
"@astrojs/markdown-satteri": "0.3.
|
|
149
|
+
"@astrojs/internal-helpers": "0.10.2",
|
|
150
|
+
"@astrojs/markdown-satteri": "0.3.5",
|
|
151
151
|
"@astrojs/telemetry": "3.3.3"
|
|
152
152
|
},
|
|
153
153
|
"optionalDependencies": {
|
|
154
154
|
"sharp": "^0.34.0 || ^0.35.0"
|
|
155
155
|
},
|
|
156
156
|
"peerDependencies": {
|
|
157
|
-
"@astrojs/markdown-remark": "7.2.
|
|
157
|
+
"@astrojs/markdown-remark": "7.2.2"
|
|
158
158
|
},
|
|
159
159
|
"peerDependenciesMeta": {
|
|
160
160
|
"@astrojs/markdown-remark": {
|
|
@@ -187,7 +187,7 @@
|
|
|
187
187
|
"undici": "^7.22.0",
|
|
188
188
|
"vitest": "^4.1.0",
|
|
189
189
|
"@astrojs/check": "0.9.10",
|
|
190
|
-
"@astrojs/markdown-remark": "7.2.
|
|
190
|
+
"@astrojs/markdown-remark": "7.2.2",
|
|
191
191
|
"astro-scripts": "0.0.14"
|
|
192
192
|
},
|
|
193
193
|
"engines": {
|