astro 6.1.7 → 6.1.9
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/content/content-layer.js +3 -3
- package/dist/core/app/base.js +5 -1
- package/dist/core/app/node.js +2 -1
- package/dist/core/base-pipeline.js +7 -0
- package/dist/core/build/plugins/plugin-chunk-imports.js +2 -1
- package/dist/core/build/static-build.js +12 -10
- package/dist/core/build/util.d.ts +6 -1
- package/dist/core/build/util.js +5 -1
- package/dist/core/cache/memory-provider.js +1 -1
- package/dist/core/constants.js +1 -1
- package/dist/core/create-vite.d.ts +5 -0
- package/dist/core/create-vite.js +48 -23
- package/dist/core/dev/dev.js +1 -1
- package/dist/core/dev/restart.d.ts +1 -1
- package/dist/core/dev/restart.js +2 -1
- package/dist/core/errors/errors.d.ts +1 -1
- package/dist/core/errors/overlay.js +7 -5
- package/dist/core/messages/runtime.js +1 -1
- package/dist/core/session/runtime.js +1 -1
- package/dist/manifest/serialized.js +1 -0
- package/dist/preferences/dlv.js +5 -1
- package/dist/runtime/server/astro-island.js +10 -1
- package/dist/runtime/server/astro-island.prebuilt-dev.d.ts +1 -1
- package/dist/runtime/server/astro-island.prebuilt-dev.js +1 -1
- package/dist/runtime/server/astro-island.prebuilt.d.ts +1 -1
- package/dist/runtime/server/astro-island.prebuilt.js +1 -1
- package/dist/runtime/server/serialize.d.ts +1 -1
- package/dist/transitions/swap-functions.d.ts +1 -0
- package/dist/transitions/swap-functions.js +22 -5
- package/dist/vite-plugin-markdown/index.js +1 -1
- package/package.json +10 -9
|
@@ -192,7 +192,7 @@ ${contentConfig.error.message}`
|
|
|
192
192
|
logger.info("Content config changed");
|
|
193
193
|
shouldClear = true;
|
|
194
194
|
}
|
|
195
|
-
if (previousAstroVersion && previousAstroVersion !== "6.1.
|
|
195
|
+
if (previousAstroVersion && previousAstroVersion !== "6.1.9") {
|
|
196
196
|
logger.info("Astro version changed");
|
|
197
197
|
shouldClear = true;
|
|
198
198
|
}
|
|
@@ -200,8 +200,8 @@ ${contentConfig.error.message}`
|
|
|
200
200
|
logger.info("Clearing content store");
|
|
201
201
|
this.#store.clearAll();
|
|
202
202
|
}
|
|
203
|
-
if ("6.1.
|
|
204
|
-
this.#store.metaStore().set("astro-version", "6.1.
|
|
203
|
+
if ("6.1.9") {
|
|
204
|
+
this.#store.metaStore().set("astro-version", "6.1.9");
|
|
205
205
|
}
|
|
206
206
|
if (currentConfigDigest) {
|
|
207
207
|
this.#store.metaStore().set("content-config-digest", currentConfigDigest);
|
package/dist/core/app/base.js
CHANGED
|
@@ -184,7 +184,11 @@ class BaseApp {
|
|
|
184
184
|
pathname = prependForwardSlash(
|
|
185
185
|
joinPaths(normalizeTheLocale(locale), this.removeBase(url.pathname))
|
|
186
186
|
);
|
|
187
|
-
if (
|
|
187
|
+
if (this.manifest.trailingSlash === "always") {
|
|
188
|
+
pathname = appendForwardSlash(pathname);
|
|
189
|
+
} else if (this.manifest.trailingSlash === "never") {
|
|
190
|
+
pathname = removeTrailingForwardSlash(pathname);
|
|
191
|
+
} else if (url.pathname.endsWith("/")) {
|
|
188
192
|
pathname = appendForwardSlash(pathname);
|
|
189
193
|
}
|
|
190
194
|
}
|
package/dist/core/app/node.js
CHANGED
|
@@ -122,7 +122,8 @@ async function writeResponse(source, destination) {
|
|
|
122
122
|
destination.on("close", () => {
|
|
123
123
|
reader.cancel().catch((err) => {
|
|
124
124
|
console.error(
|
|
125
|
-
|
|
125
|
+
"There was an uncaught error in the middle of the stream while rendering %s.",
|
|
126
|
+
destination.req.url,
|
|
126
127
|
err
|
|
127
128
|
);
|
|
128
129
|
});
|
|
@@ -10,6 +10,7 @@ import { RouteCache } from "./render/route-cache.js";
|
|
|
10
10
|
import { createDefaultRoutes } from "./routing/default.js";
|
|
11
11
|
import { NodePool } from "../runtime/server/render/queue/pool.js";
|
|
12
12
|
import { HTMLStringCache } from "../runtime/server/html-string-cache.js";
|
|
13
|
+
import { FORBIDDEN_PATH_KEYS } from "@astrojs/internal-helpers/object";
|
|
13
14
|
class Pipeline {
|
|
14
15
|
internalMiddleware;
|
|
15
16
|
resolvedMiddleware = void 0;
|
|
@@ -169,6 +170,12 @@ class Pipeline {
|
|
|
169
170
|
);
|
|
170
171
|
}
|
|
171
172
|
for (const key of pathKeys) {
|
|
173
|
+
if (FORBIDDEN_PATH_KEYS.has(key)) {
|
|
174
|
+
throw new AstroError({
|
|
175
|
+
...ActionNotFoundError,
|
|
176
|
+
message: ActionNotFoundError.message(pathKeys.join("."))
|
|
177
|
+
});
|
|
178
|
+
}
|
|
172
179
|
if (!Object.hasOwn(server, key)) {
|
|
173
180
|
throw new AstroError({
|
|
174
181
|
...ActionNotFoundError,
|
|
@@ -27,7 +27,8 @@ function pluginChunkImports(options) {
|
|
|
27
27
|
let rewritten = code;
|
|
28
28
|
for (let i = relativeImports.length - 1; i >= 0; i--) {
|
|
29
29
|
const imp = relativeImports[i];
|
|
30
|
-
|
|
30
|
+
const insertAt = imp.d > -1 ? imp.e - 1 : imp.e;
|
|
31
|
+
rewritten = rewritten.slice(0, insertAt) + "?" + queryString + rewritten.slice(insertAt);
|
|
31
32
|
}
|
|
32
33
|
return { code: rewritten, map: null };
|
|
33
34
|
}
|
|
@@ -30,7 +30,7 @@ import {
|
|
|
30
30
|
RESOLVED_LEGACY_SSR_ENTRY_VIRTUAL_MODULE
|
|
31
31
|
} from "./plugins/plugin-ssr.js";
|
|
32
32
|
import { ASTRO_PAGE_EXTENSION_POST_PATTERN } from "./plugins/util.js";
|
|
33
|
-
import {
|
|
33
|
+
import { cleanChunkName, getTimeStat, viteBuildReturnToRollupOutputs } from "./util.js";
|
|
34
34
|
import { NOOP_MODULE_ID } from "./plugins/plugin-noop.js";
|
|
35
35
|
import { ASTRO_VITE_ENVIRONMENT_NAMES } from "../constants.js";
|
|
36
36
|
import { getSSRAssets } from "./internal.js";
|
|
@@ -178,14 +178,13 @@ async function buildEnvironments(opts, internals) {
|
|
|
178
178
|
let suffix = "_[hash].mjs";
|
|
179
179
|
if (name.includes(ASTRO_PAGE_EXTENSION_POST_PATTERN)) {
|
|
180
180
|
const [sanitizedName] = name.split(ASTRO_PAGE_EXTENSION_POST_PATTERN);
|
|
181
|
-
return [prefix, sanitizedName, suffix].join("");
|
|
181
|
+
return [prefix, cleanChunkName(sanitizedName), suffix].join("");
|
|
182
182
|
}
|
|
183
183
|
if (name.startsWith("pages/")) {
|
|
184
184
|
const sanitizedName = name.split(".")[0];
|
|
185
|
-
return [prefix, sanitizedName, suffix].join("");
|
|
185
|
+
return [prefix, cleanChunkName(sanitizedName), suffix].join("");
|
|
186
186
|
}
|
|
187
|
-
|
|
188
|
-
return [prefix, encoded, suffix].join("");
|
|
187
|
+
return [prefix, cleanChunkName(name), suffix].join("");
|
|
189
188
|
},
|
|
190
189
|
assetFileNames: `${settings.config.build.assets}/[name].[hash][extname]`,
|
|
191
190
|
...viteConfig.build?.rollupOptions?.output,
|
|
@@ -244,9 +243,8 @@ async function buildEnvironments(opts, internals) {
|
|
|
244
243
|
if (!internals.clientInput.size) {
|
|
245
244
|
internals.clientInput.add(NOOP_MODULE_ID);
|
|
246
245
|
}
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
);
|
|
246
|
+
const sortedClientInput = Array.from(internals.clientInput).sort();
|
|
247
|
+
builder2.environments.client.config.build.rollupOptions.input = sortedClientInput;
|
|
250
248
|
settings.timer.start("Client build");
|
|
251
249
|
await builder2.build(builder2.environments.client);
|
|
252
250
|
settings.timer.end("Client build");
|
|
@@ -285,8 +283,12 @@ async function buildEnvironments(opts, internals) {
|
|
|
285
283
|
rollupOptions: {
|
|
286
284
|
preserveEntrySignatures: "exports-only",
|
|
287
285
|
output: {
|
|
288
|
-
entryFileNames
|
|
289
|
-
|
|
286
|
+
entryFileNames(chunkInfo) {
|
|
287
|
+
return `${settings.config.build.assets}/${cleanChunkName(chunkInfo.name)}.[hash].js`;
|
|
288
|
+
},
|
|
289
|
+
chunkFileNames(chunkInfo) {
|
|
290
|
+
return `${settings.config.build.assets}/${cleanChunkName(chunkInfo.name)}.[hash].js`;
|
|
291
|
+
},
|
|
290
292
|
assetFileNames: `${settings.config.build.assets}/[name].[hash][extname]`,
|
|
291
293
|
...viteConfig.environments?.client?.build?.rollupOptions?.output
|
|
292
294
|
}
|
|
@@ -6,5 +6,10 @@ export declare function getTimeStat(timeStart: number, timeEnd: number): string;
|
|
|
6
6
|
* Given the Astro configuration, it tells if a slash should be appended or not
|
|
7
7
|
*/
|
|
8
8
|
export declare function shouldAppendForwardSlash(trailingSlash: AstroConfig['trailingSlash'], buildFormat: AstroConfig['build']['format']): boolean;
|
|
9
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Replaces characters in a chunk name that are not safe for filesystem paths or URLs.
|
|
11
|
+
* Characters like `!` and `~` can leak from Vite module IDs into Rollup chunk names
|
|
12
|
+
* and break deploys on platforms like Netlify.
|
|
13
|
+
*/
|
|
14
|
+
export declare function cleanChunkName(name: string): string;
|
|
10
15
|
export declare function viteBuildReturnToRollupOutputs(viteBuildReturn: ViteBuildReturn): Rollup.RollupOutput[];
|
package/dist/core/build/util.js
CHANGED
|
@@ -19,6 +19,10 @@ function shouldAppendForwardSlash(trailingSlash, buildFormat) {
|
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
|
+
const UNSAFE_CHUNK_CHAR_RE = /[^\w.\-/]/g;
|
|
23
|
+
function cleanChunkName(name) {
|
|
24
|
+
return encodeName(name.replace(UNSAFE_CHUNK_CHAR_RE, "_"));
|
|
25
|
+
}
|
|
22
26
|
function encodeName(name) {
|
|
23
27
|
for (let i = 0; i < name.length; i++) {
|
|
24
28
|
if (name[i] === "%") {
|
|
@@ -40,7 +44,7 @@ function viteBuildReturnToRollupOutputs(viteBuildReturn) {
|
|
|
40
44
|
return result;
|
|
41
45
|
}
|
|
42
46
|
export {
|
|
43
|
-
|
|
47
|
+
cleanChunkName,
|
|
44
48
|
getTimeStat,
|
|
45
49
|
shouldAppendForwardSlash,
|
|
46
50
|
viteBuildReturnToRollupOutputs
|
|
@@ -96,7 +96,7 @@ function parseVaryHeader(response) {
|
|
|
96
96
|
return headers.length > 0 ? headers : void 0;
|
|
97
97
|
}
|
|
98
98
|
function getVaryValues(request, varyHeaders) {
|
|
99
|
-
const values =
|
|
99
|
+
const values = /* @__PURE__ */ Object.create(null);
|
|
100
100
|
for (const header of varyHeaders) {
|
|
101
101
|
values[header] = request.headers.get(header) ?? "";
|
|
102
102
|
}
|
package/dist/core/constants.js
CHANGED
|
@@ -14,6 +14,11 @@ type CreateViteOptions = {
|
|
|
14
14
|
} | {
|
|
15
15
|
command: 'build';
|
|
16
16
|
});
|
|
17
|
+
/**
|
|
18
|
+
* Clear the crawlFrameworkPkgs cache. Call this when node_modules may have
|
|
19
|
+
* changed (e.g. after a dev server restart triggered by config/lockfile change).
|
|
20
|
+
*/
|
|
21
|
+
export declare function clearCrawlCache(): void;
|
|
17
22
|
/** Return a base vite config as a common starting point for all Vite commands. */
|
|
18
23
|
export declare function createVite(commandConfig: vite.InlineConfig, { settings, logger, mode, command, fs, sync, routesList }: CreateViteOptions): Promise<vite.InlineConfig>;
|
|
19
24
|
export {};
|
package/dist/core/create-vite.js
CHANGED
|
@@ -52,31 +52,55 @@ import { vitePluginEnvironment } from "../vite-plugin-environment/index.js";
|
|
|
52
52
|
import { ASTRO_VITE_ENVIRONMENT_NAMES } from "./constants.js";
|
|
53
53
|
import { vitePluginChromedevtools } from "../vite-plugin-chromedevtools/index.js";
|
|
54
54
|
import { vitePluginAstroServerClient } from "../vite-plugin-overlay/index.js";
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
if (pkgJson?.astro?.external === true) {
|
|
62
|
-
return false;
|
|
63
|
-
}
|
|
64
|
-
return (
|
|
65
|
-
// Attempt: package relies on `astro`. ✅ Definitely an Astro package
|
|
66
|
-
pkgJson.peerDependencies?.astro || pkgJson.dependencies?.astro || // Attempt: package is tagged with `astro` or `astro-component`. ✅ Likely a community package
|
|
67
|
-
pkgJson.keywords?.includes("astro") || pkgJson.keywords?.includes("astro-component") || // Attempt: package is named `astro-something` or `@scope/astro-something`. ✅ Likely a community package
|
|
68
|
-
/^(?:@[^/]+\/)?astro-/.test(pkgJson.name)
|
|
69
|
-
);
|
|
55
|
+
const _crawlCache = /* @__PURE__ */ new Map();
|
|
56
|
+
function cloneCrawlResult(result) {
|
|
57
|
+
return {
|
|
58
|
+
optimizeDeps: {
|
|
59
|
+
include: [...result.optimizeDeps.include],
|
|
60
|
+
exclude: [...result.optimizeDeps.exclude]
|
|
70
61
|
},
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
return false;
|
|
75
|
-
} else {
|
|
76
|
-
return void 0;
|
|
77
|
-
}
|
|
62
|
+
ssr: {
|
|
63
|
+
noExternal: [...result.ssr.noExternal],
|
|
64
|
+
external: [...result.ssr.external]
|
|
78
65
|
}
|
|
79
|
-
}
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
function clearCrawlCache() {
|
|
69
|
+
_crawlCache.clear();
|
|
70
|
+
}
|
|
71
|
+
async function createVite(commandConfig, { settings, logger, mode, command, fs = nodeFs, sync, routesList }) {
|
|
72
|
+
const root = fileURLToPath(settings.config.root);
|
|
73
|
+
const isBuild = command === "build";
|
|
74
|
+
const crawlCacheKey = `${root}:${isBuild}`;
|
|
75
|
+
let astroPkgsConfig = _crawlCache.get(crawlCacheKey);
|
|
76
|
+
if (!astroPkgsConfig) {
|
|
77
|
+
astroPkgsConfig = await crawlFrameworkPkgs({
|
|
78
|
+
root,
|
|
79
|
+
isBuild,
|
|
80
|
+
viteUserConfig: settings.config.vite,
|
|
81
|
+
isFrameworkPkgByJson(pkgJson) {
|
|
82
|
+
if (pkgJson?.astro?.external === true) {
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
return (
|
|
86
|
+
// Attempt: package relies on `astro`. ✅ Definitely an Astro package
|
|
87
|
+
pkgJson.peerDependencies?.astro || pkgJson.dependencies?.astro || // Attempt: package is tagged with `astro` or `astro-component`. ✅ Likely a community package
|
|
88
|
+
pkgJson.keywords?.includes("astro") || pkgJson.keywords?.includes("astro-component") || // Attempt: package is named `astro-something` or `@scope/astro-something`. ✅ Likely a community package
|
|
89
|
+
/^(?:@[^/]+\/)?astro-/.test(pkgJson.name)
|
|
90
|
+
);
|
|
91
|
+
},
|
|
92
|
+
isFrameworkPkgByName(pkgName) {
|
|
93
|
+
const isNotAstroPkg = isCommonNotAstro(pkgName);
|
|
94
|
+
if (isNotAstroPkg) {
|
|
95
|
+
return false;
|
|
96
|
+
} else {
|
|
97
|
+
return void 0;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
_crawlCache.set(crawlCacheKey, astroPkgsConfig);
|
|
102
|
+
}
|
|
103
|
+
astroPkgsConfig = cloneCrawlResult(astroPkgsConfig);
|
|
80
104
|
const envLoader = createEnvLoader({
|
|
81
105
|
mode,
|
|
82
106
|
config: settings.config
|
|
@@ -278,5 +302,6 @@ function stringifyForDefine(value) {
|
|
|
278
302
|
return typeof value === "string" || isObject(value) ? JSON.stringify(value) : "undefined";
|
|
279
303
|
}
|
|
280
304
|
export {
|
|
305
|
+
clearCrawlCache,
|
|
281
306
|
createVite
|
|
282
307
|
};
|
package/dist/core/dev/dev.js
CHANGED
|
@@ -37,7 +37,7 @@ async function dev(inlineConfig) {
|
|
|
37
37
|
await telemetry.record([]);
|
|
38
38
|
const restart = await createContainerWithAutomaticRestart({ inlineConfig, fs });
|
|
39
39
|
const logger = restart.container.logger;
|
|
40
|
-
const currentVersion = "6.1.
|
|
40
|
+
const currentVersion = "6.1.9";
|
|
41
41
|
const isPrerelease = currentVersion.includes("-");
|
|
42
42
|
if (!isPrerelease) {
|
|
43
43
|
try {
|
|
@@ -3,7 +3,7 @@ import type { AstroInlineConfig } from '../../types/public/config.js';
|
|
|
3
3
|
import type { Container } from './container.js';
|
|
4
4
|
interface CreateContainerWithAutomaticRestart {
|
|
5
5
|
inlineConfig?: AstroInlineConfig;
|
|
6
|
-
fs
|
|
6
|
+
fs?: typeof nodeFs;
|
|
7
7
|
}
|
|
8
8
|
interface Restart {
|
|
9
9
|
container: Container;
|
package/dist/core/dev/restart.js
CHANGED
|
@@ -7,7 +7,7 @@ import { runHookConfigDone, runHookConfigSetup } from "../../integrations/hooks.
|
|
|
7
7
|
import { SETTINGS_FILE } from "../../preferences/constants.js";
|
|
8
8
|
import { getPrerenderDefault } from "../../prerender/utils.js";
|
|
9
9
|
import { createSettings, resolveConfig } from "../config/index.js";
|
|
10
|
-
import { createVite } from "../create-vite.js";
|
|
10
|
+
import { clearCrawlCache, createVite } from "../create-vite.js";
|
|
11
11
|
import { collectErrorMetadata } from "../errors/dev/utils.js";
|
|
12
12
|
import { isAstroConfigZodError } from "../errors/errors.js";
|
|
13
13
|
import { createSafeError } from "../errors/index.js";
|
|
@@ -42,6 +42,7 @@ function shouldRestartContainer({ settings, inlineConfig, restartInFlight }, cha
|
|
|
42
42
|
async function restartContainerInPlace(container) {
|
|
43
43
|
const { logger, settings: existingSettings, inlineConfig, fs } = container;
|
|
44
44
|
container.restartInFlight = true;
|
|
45
|
+
clearCrawlCache();
|
|
45
46
|
try {
|
|
46
47
|
const { astroConfig } = await resolveConfig(inlineConfig, "dev", fs);
|
|
47
48
|
warnIfCspWithShiki(astroConfig, logger);
|
|
@@ -683,11 +683,13 @@ class ErrorOverlay extends HTMLElement {
|
|
|
683
683
|
errorLine.parentElement.parentElement.scrollTop = errorLine.offsetTop - errorLine.parentElement.parentElement.offsetTop - 8;
|
|
684
684
|
}
|
|
685
685
|
if (err.loc?.column) {
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
686
|
+
const caretLine = document.createElement("span");
|
|
687
|
+
caretLine.className = "line error-caret";
|
|
688
|
+
const caret = document.createElement("span");
|
|
689
|
+
caret.style.paddingLeft = `${err.loc.column - 1}ch`;
|
|
690
|
+
caret.textContent = "^";
|
|
691
|
+
caretLine.append(caret);
|
|
692
|
+
errorLine.insertAdjacentElement("afterend", caretLine);
|
|
691
693
|
}
|
|
692
694
|
}
|
|
693
695
|
});
|
|
@@ -231,7 +231,7 @@ class AstroSession {
|
|
|
231
231
|
if (this.#toDestroy.size > 0) {
|
|
232
232
|
const cleanupPromises = [...this.#toDestroy].map(
|
|
233
233
|
(sessionId) => storage.removeItem(sessionId).catch((err) => {
|
|
234
|
-
console.error(
|
|
234
|
+
console.error("Failed to clean up session %s:", sessionId, err);
|
|
235
235
|
})
|
|
236
236
|
);
|
|
237
237
|
await Promise.all(cleanupPromises);
|
|
@@ -170,6 +170,7 @@ async function createSerializedManifest(settings, encodedKey) {
|
|
|
170
170
|
inlinedScripts: [],
|
|
171
171
|
i18n: i18nManifest,
|
|
172
172
|
checkOrigin: (settings.config.security?.checkOrigin && settings.buildOutput === "server") ?? false,
|
|
173
|
+
allowedDomains: settings.config.security?.allowedDomains,
|
|
173
174
|
actionBodySizeLimit: settings.config.security?.actionBodySizeLimit ? settings.config.security.actionBodySizeLimit : 1024 * 1024,
|
|
174
175
|
// 1mb default
|
|
175
176
|
serverIslandBodySizeLimit: settings.config.security?.serverIslandBodySizeLimit ? settings.config.security.serverIslandBodySizeLimit : 1024 * 1024,
|
package/dist/preferences/dlv.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
import { FORBIDDEN_PATH_KEYS } from "@astrojs/internal-helpers/object";
|
|
1
2
|
function dlv(obj, key) {
|
|
2
3
|
for (const k of key.split(".")) {
|
|
3
|
-
obj
|
|
4
|
+
if (FORBIDDEN_PATH_KEYS.has(k) || !obj || typeof obj !== "object" || !Object.hasOwn(obj, k)) {
|
|
5
|
+
return void 0;
|
|
6
|
+
}
|
|
7
|
+
obj = obj[k];
|
|
4
8
|
}
|
|
5
9
|
return obj;
|
|
6
10
|
}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
const FORBIDDEN_COMPONENT_EXPORT_KEYS = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype"]);
|
|
1
2
|
{
|
|
2
3
|
const propTypes = {
|
|
3
4
|
0: (value) => reviveObject(value),
|
|
4
5
|
1: (value) => reviveArray(value),
|
|
6
|
+
// nosemgrep: javascript.lang.security.audit.detect-non-literal-regexp.detect-non-literal-regexp
|
|
7
|
+
// Regex props are serialized by Astro and revived here on the client.
|
|
5
8
|
2: (value) => new RegExp(value),
|
|
6
9
|
3: (value) => new Date(value),
|
|
7
10
|
4: (value) => new Map(reviveArray(value)),
|
|
@@ -74,10 +77,16 @@
|
|
|
74
77
|
]);
|
|
75
78
|
const componentExport = this.getAttribute("component-export") || "default";
|
|
76
79
|
if (!componentExport.includes(".")) {
|
|
80
|
+
if (FORBIDDEN_COMPONENT_EXPORT_KEYS.has(componentExport)) {
|
|
81
|
+
throw new Error(`Invalid component export path: ${componentExport}`);
|
|
82
|
+
}
|
|
77
83
|
this.Component = componentModule[componentExport];
|
|
78
84
|
} else {
|
|
79
85
|
this.Component = componentModule;
|
|
80
86
|
for (const part of componentExport.split(".")) {
|
|
87
|
+
if (FORBIDDEN_COMPONENT_EXPORT_KEYS.has(part) || !this.Component || typeof this.Component !== "object" && typeof this.Component !== "function" || !Object.hasOwn(this.Component, part)) {
|
|
88
|
+
throw new Error(`Invalid component export path: ${componentExport}`);
|
|
89
|
+
}
|
|
81
90
|
this.Component = this.Component[part];
|
|
82
91
|
}
|
|
83
92
|
}
|
|
@@ -88,7 +97,7 @@
|
|
|
88
97
|
this
|
|
89
98
|
);
|
|
90
99
|
} catch (e) {
|
|
91
|
-
console.error(
|
|
100
|
+
console.error("[astro-island] Error hydrating %s", this.getAttribute("component-url"), e);
|
|
92
101
|
}
|
|
93
102
|
}
|
|
94
103
|
hydrate = async () => {
|
|
@@ -3,5 +3,5 @@
|
|
|
3
3
|
* Do not edit this directly, but instead edit that file and rerun the prebuild
|
|
4
4
|
* to generate this file.
|
|
5
5
|
*/
|
|
6
|
-
declare const _default: "(()=>{var A=Object.defineProperty;var
|
|
6
|
+
declare const _default: "(()=>{var A=Object.defineProperty;var C=(a,r,c)=>r in a?A(a,r,{enumerable:!0,configurable:!0,writable:!0,value:c}):a[r]=c;var l=(a,r,c)=>C(a,typeof r!=\"symbol\"?r+\"\":r,c);var E=new Set([\"__proto__\",\"constructor\",\"prototype\"]);{let a={0:t=>y(t),1:t=>c(t),2:t=>new RegExp(t),3:t=>new Date(t),4:t=>new Map(c(t)),5:t=>new Set(c(t)),6:t=>BigInt(t),7:t=>new URL(t),8:t=>new Uint8Array(t),9:t=>new Uint16Array(t),10:t=>new Uint32Array(t),11:t=>Number.POSITIVE_INFINITY*t},r=t=>{let[p,e]=t;return p in a?a[p](e):void 0},c=t=>t.map(r),y=t=>typeof t!=\"object\"||t===null?t:Object.fromEntries(Object.entries(t).map(([p,e])=>[p,r(e)]));class f extends HTMLElement{constructor(){super(...arguments);l(this,\"Component\");l(this,\"hydrator\");l(this,\"hydrate\",async()=>{var b;if(!this.hydrator||!this.isConnected)return;let e=(b=this.parentElement)==null?void 0:b.closest(\"astro-island[ssr]\");if(e){e.addEventListener(\"astro:hydrate\",this.hydrate,{once:!0});return}let d=this.querySelectorAll(\"astro-slot\"),n={},u=this.querySelectorAll(\"template[data-astro-template]\");for(let o of u){let i=o.closest(this.tagName);i!=null&&i.isSameNode(this)&&(n[o.getAttribute(\"data-astro-template\")||\"default\"]=o.innerHTML,o.remove())}for(let o of d){let i=o.closest(this.tagName);i!=null&&i.isSameNode(this)&&(n[o.getAttribute(\"name\")||\"default\"]=o.innerHTML)}let m;try{m=this.hasAttribute(\"props\")?y(JSON.parse(this.getAttribute(\"props\"))):{}}catch(o){let i=this.getAttribute(\"component-url\")||\"<unknown>\",v=this.getAttribute(\"component-export\");throw v&&(i+=` (export ${v})`),console.error(`[hydrate] Error parsing props for component ${i}`,this.getAttribute(\"props\"),o),o}let s,h=this.hydrator(this);s=performance.now(),await h(this.Component,m,n,{client:this.getAttribute(\"client\")}),s&&this.setAttribute(\"client-render-time\",(performance.now()-s).toString()),this.removeAttribute(\"ssr\"),this.dispatchEvent(new CustomEvent(\"astro:hydrate\"))});l(this,\"unmount\",()=>{this.isConnected||this.dispatchEvent(new CustomEvent(\"astro:unmount\"))})}disconnectedCallback(){document.removeEventListener(\"astro:after-swap\",this.unmount),document.addEventListener(\"astro:after-swap\",this.unmount,{once:!0})}connectedCallback(){if(!this.hasAttribute(\"await-children\")||document.readyState===\"interactive\"||document.readyState===\"complete\")this.childrenConnectedCallback();else{let e=()=>{document.removeEventListener(\"DOMContentLoaded\",e),d.disconnect(),this.childrenConnectedCallback()},d=new MutationObserver(()=>{var n;((n=this.lastChild)==null?void 0:n.nodeType)===Node.COMMENT_NODE&&this.lastChild.nodeValue===\"astro:end\"&&(this.lastChild.remove(),e())});d.observe(this,{childList:!0}),document.addEventListener(\"DOMContentLoaded\",e)}}async childrenConnectedCallback(){let e=this.getAttribute(\"before-hydration-url\");e&&await import(e),this.start()}async start(){let e=JSON.parse(this.getAttribute(\"opts\")),d=this.getAttribute(\"client\");if(Astro[d]===void 0){window.addEventListener(`astro:${d}`,()=>this.start(),{once:!0});return}try{await Astro[d](async()=>{let n=this.getAttribute(\"renderer-url\"),[u,{default:m}]=await Promise.all([import(this.getAttribute(\"component-url\")),n?import(n):()=>()=>{}]),s=this.getAttribute(\"component-export\")||\"default\";if(s.includes(\".\")){this.Component=u;for(let h of s.split(\".\")){if(E.has(h)||!this.Component||typeof this.Component!=\"object\"&&typeof this.Component!=\"function\"||!Object.hasOwn(this.Component,h))throw new Error(`Invalid component export path: ${s}`);this.Component=this.Component[h]}}else{if(E.has(s))throw new Error(`Invalid component export path: ${s}`);this.Component=u[s]}return this.hydrator=m,this.hydrate},e,this)}catch(n){console.error(\"[astro-island] Error hydrating %s\",this.getAttribute(\"component-url\"),n)}}attributeChangedCallback(){this.hydrate()}}l(f,\"observedAttributes\",[\"props\"]),customElements.get(\"astro-island\")||customElements.define(\"astro-island\",f)}})();";
|
|
7
7
|
export default _default;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var astro_island_prebuilt_dev_default = `(()=>{var A=Object.defineProperty;var
|
|
1
|
+
var astro_island_prebuilt_dev_default = `(()=>{var A=Object.defineProperty;var C=(a,r,c)=>r in a?A(a,r,{enumerable:!0,configurable:!0,writable:!0,value:c}):a[r]=c;var l=(a,r,c)=>C(a,typeof r!="symbol"?r+"":r,c);var E=new Set(["__proto__","constructor","prototype"]);{let a={0:t=>y(t),1:t=>c(t),2:t=>new RegExp(t),3:t=>new Date(t),4:t=>new Map(c(t)),5:t=>new Set(c(t)),6:t=>BigInt(t),7:t=>new URL(t),8:t=>new Uint8Array(t),9:t=>new Uint16Array(t),10:t=>new Uint32Array(t),11:t=>Number.POSITIVE_INFINITY*t},r=t=>{let[p,e]=t;return p in a?a[p](e):void 0},c=t=>t.map(r),y=t=>typeof t!="object"||t===null?t:Object.fromEntries(Object.entries(t).map(([p,e])=>[p,r(e)]));class f extends HTMLElement{constructor(){super(...arguments);l(this,"Component");l(this,"hydrator");l(this,"hydrate",async()=>{var b;if(!this.hydrator||!this.isConnected)return;let e=(b=this.parentElement)==null?void 0:b.closest("astro-island[ssr]");if(e){e.addEventListener("astro:hydrate",this.hydrate,{once:!0});return}let d=this.querySelectorAll("astro-slot"),n={},u=this.querySelectorAll("template[data-astro-template]");for(let o of u){let i=o.closest(this.tagName);i!=null&&i.isSameNode(this)&&(n[o.getAttribute("data-astro-template")||"default"]=o.innerHTML,o.remove())}for(let o of d){let i=o.closest(this.tagName);i!=null&&i.isSameNode(this)&&(n[o.getAttribute("name")||"default"]=o.innerHTML)}let m;try{m=this.hasAttribute("props")?y(JSON.parse(this.getAttribute("props"))):{}}catch(o){let i=this.getAttribute("component-url")||"<unknown>",v=this.getAttribute("component-export");throw v&&(i+=\` (export \${v})\`),console.error(\`[hydrate] Error parsing props for component \${i}\`,this.getAttribute("props"),o),o}let s,h=this.hydrator(this);s=performance.now(),await h(this.Component,m,n,{client:this.getAttribute("client")}),s&&this.setAttribute("client-render-time",(performance.now()-s).toString()),this.removeAttribute("ssr"),this.dispatchEvent(new CustomEvent("astro:hydrate"))});l(this,"unmount",()=>{this.isConnected||this.dispatchEvent(new CustomEvent("astro:unmount"))})}disconnectedCallback(){document.removeEventListener("astro:after-swap",this.unmount),document.addEventListener("astro:after-swap",this.unmount,{once:!0})}connectedCallback(){if(!this.hasAttribute("await-children")||document.readyState==="interactive"||document.readyState==="complete")this.childrenConnectedCallback();else{let e=()=>{document.removeEventListener("DOMContentLoaded",e),d.disconnect(),this.childrenConnectedCallback()},d=new MutationObserver(()=>{var n;((n=this.lastChild)==null?void 0:n.nodeType)===Node.COMMENT_NODE&&this.lastChild.nodeValue==="astro:end"&&(this.lastChild.remove(),e())});d.observe(this,{childList:!0}),document.addEventListener("DOMContentLoaded",e)}}async childrenConnectedCallback(){let e=this.getAttribute("before-hydration-url");e&&await import(e),this.start()}async start(){let e=JSON.parse(this.getAttribute("opts")),d=this.getAttribute("client");if(Astro[d]===void 0){window.addEventListener(\`astro:\${d}\`,()=>this.start(),{once:!0});return}try{await Astro[d](async()=>{let n=this.getAttribute("renderer-url"),[u,{default:m}]=await Promise.all([import(this.getAttribute("component-url")),n?import(n):()=>()=>{}]),s=this.getAttribute("component-export")||"default";if(s.includes(".")){this.Component=u;for(let h of s.split(".")){if(E.has(h)||!this.Component||typeof this.Component!="object"&&typeof this.Component!="function"||!Object.hasOwn(this.Component,h))throw new Error(\`Invalid component export path: \${s}\`);this.Component=this.Component[h]}}else{if(E.has(s))throw new Error(\`Invalid component export path: \${s}\`);this.Component=u[s]}return this.hydrator=m,this.hydrate},e,this)}catch(n){console.error("[astro-island] Error hydrating %s",this.getAttribute("component-url"),n)}}attributeChangedCallback(){this.hydrate()}}l(f,"observedAttributes",["props"]),customElements.get("astro-island")||customElements.define("astro-island",f)}})();`;
|
|
2
2
|
export {
|
|
3
3
|
astro_island_prebuilt_dev_default as default
|
|
4
4
|
};
|
|
@@ -3,5 +3,5 @@
|
|
|
3
3
|
* Do not edit this directly, but instead edit that file and rerun the prebuild
|
|
4
4
|
* to generate this file.
|
|
5
5
|
*/
|
|
6
|
-
declare const _default: "(()=>{var A=Object.defineProperty;var
|
|
6
|
+
declare const _default: "(()=>{var A=Object.defineProperty;var C=(i,o,a)=>o in i?A(i,o,{enumerable:!0,configurable:!0,writable:!0,value:a}):i[o]=a;var l=(i,o,a)=>C(i,typeof o!=\"symbol\"?o+\"\":o,a);var E=new Set([\"__proto__\",\"constructor\",\"prototype\"]);{let i={0:t=>y(t),1:t=>a(t),2:t=>new RegExp(t),3:t=>new Date(t),4:t=>new Map(a(t)),5:t=>new Set(a(t)),6:t=>BigInt(t),7:t=>new URL(t),8:t=>new Uint8Array(t),9:t=>new Uint16Array(t),10:t=>new Uint32Array(t),11:t=>Number.POSITIVE_INFINITY*t},o=t=>{let[h,e]=t;return h in i?i[h](e):void 0},a=t=>t.map(o),y=t=>typeof t!=\"object\"||t===null?t:Object.fromEntries(Object.entries(t).map(([h,e])=>[h,o(e)]));class f extends HTMLElement{constructor(){super(...arguments);l(this,\"Component\");l(this,\"hydrator\");l(this,\"hydrate\",async()=>{var b;if(!this.hydrator||!this.isConnected)return;let e=(b=this.parentElement)==null?void 0:b.closest(\"astro-island[ssr]\");if(e){e.addEventListener(\"astro:hydrate\",this.hydrate,{once:!0});return}let c=this.querySelectorAll(\"astro-slot\"),n={},p=this.querySelectorAll(\"template[data-astro-template]\");for(let r of p){let s=r.closest(this.tagName);s!=null&&s.isSameNode(this)&&(n[r.getAttribute(\"data-astro-template\")||\"default\"]=r.innerHTML,r.remove())}for(let r of c){let s=r.closest(this.tagName);s!=null&&s.isSameNode(this)&&(n[r.getAttribute(\"name\")||\"default\"]=r.innerHTML)}let u;try{u=this.hasAttribute(\"props\")?y(JSON.parse(this.getAttribute(\"props\"))):{}}catch(r){let s=this.getAttribute(\"component-url\")||\"<unknown>\",v=this.getAttribute(\"component-export\");throw v&&(s+=` (export ${v})`),console.error(`[hydrate] Error parsing props for component ${s}`,this.getAttribute(\"props\"),r),r}let d;await this.hydrator(this)(this.Component,u,n,{client:this.getAttribute(\"client\")}),this.removeAttribute(\"ssr\"),this.dispatchEvent(new CustomEvent(\"astro:hydrate\"))});l(this,\"unmount\",()=>{this.isConnected||this.dispatchEvent(new CustomEvent(\"astro:unmount\"))})}disconnectedCallback(){document.removeEventListener(\"astro:after-swap\",this.unmount),document.addEventListener(\"astro:after-swap\",this.unmount,{once:!0})}connectedCallback(){if(!this.hasAttribute(\"await-children\")||document.readyState===\"interactive\"||document.readyState===\"complete\")this.childrenConnectedCallback();else{let e=()=>{document.removeEventListener(\"DOMContentLoaded\",e),c.disconnect(),this.childrenConnectedCallback()},c=new MutationObserver(()=>{var n;((n=this.lastChild)==null?void 0:n.nodeType)===Node.COMMENT_NODE&&this.lastChild.nodeValue===\"astro:end\"&&(this.lastChild.remove(),e())});c.observe(this,{childList:!0}),document.addEventListener(\"DOMContentLoaded\",e)}}async childrenConnectedCallback(){let e=this.getAttribute(\"before-hydration-url\");e&&await import(e),this.start()}async start(){let e=JSON.parse(this.getAttribute(\"opts\")),c=this.getAttribute(\"client\");if(Astro[c]===void 0){window.addEventListener(`astro:${c}`,()=>this.start(),{once:!0});return}try{await Astro[c](async()=>{let n=this.getAttribute(\"renderer-url\"),[p,{default:u}]=await Promise.all([import(this.getAttribute(\"component-url\")),n?import(n):()=>()=>{}]),d=this.getAttribute(\"component-export\")||\"default\";if(d.includes(\".\")){this.Component=p;for(let m of d.split(\".\")){if(E.has(m)||!this.Component||typeof this.Component!=\"object\"&&typeof this.Component!=\"function\"||!Object.hasOwn(this.Component,m))throw new Error(`Invalid component export path: ${d}`);this.Component=this.Component[m]}}else{if(E.has(d))throw new Error(`Invalid component export path: ${d}`);this.Component=p[d]}return this.hydrator=u,this.hydrate},e,this)}catch(n){console.error(\"[astro-island] Error hydrating %s\",this.getAttribute(\"component-url\"),n)}}attributeChangedCallback(){this.hydrate()}}l(f,\"observedAttributes\",[\"props\"]),customElements.get(\"astro-island\")||customElements.define(\"astro-island\",f)}})();";
|
|
7
7
|
export default _default;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var astro_island_prebuilt_default = `(()=>{var A=Object.defineProperty;var
|
|
1
|
+
var astro_island_prebuilt_default = `(()=>{var A=Object.defineProperty;var C=(i,o,a)=>o in i?A(i,o,{enumerable:!0,configurable:!0,writable:!0,value:a}):i[o]=a;var l=(i,o,a)=>C(i,typeof o!="symbol"?o+"":o,a);var E=new Set(["__proto__","constructor","prototype"]);{let i={0:t=>y(t),1:t=>a(t),2:t=>new RegExp(t),3:t=>new Date(t),4:t=>new Map(a(t)),5:t=>new Set(a(t)),6:t=>BigInt(t),7:t=>new URL(t),8:t=>new Uint8Array(t),9:t=>new Uint16Array(t),10:t=>new Uint32Array(t),11:t=>Number.POSITIVE_INFINITY*t},o=t=>{let[h,e]=t;return h in i?i[h](e):void 0},a=t=>t.map(o),y=t=>typeof t!="object"||t===null?t:Object.fromEntries(Object.entries(t).map(([h,e])=>[h,o(e)]));class f extends HTMLElement{constructor(){super(...arguments);l(this,"Component");l(this,"hydrator");l(this,"hydrate",async()=>{var b;if(!this.hydrator||!this.isConnected)return;let e=(b=this.parentElement)==null?void 0:b.closest("astro-island[ssr]");if(e){e.addEventListener("astro:hydrate",this.hydrate,{once:!0});return}let c=this.querySelectorAll("astro-slot"),n={},p=this.querySelectorAll("template[data-astro-template]");for(let r of p){let s=r.closest(this.tagName);s!=null&&s.isSameNode(this)&&(n[r.getAttribute("data-astro-template")||"default"]=r.innerHTML,r.remove())}for(let r of c){let s=r.closest(this.tagName);s!=null&&s.isSameNode(this)&&(n[r.getAttribute("name")||"default"]=r.innerHTML)}let u;try{u=this.hasAttribute("props")?y(JSON.parse(this.getAttribute("props"))):{}}catch(r){let s=this.getAttribute("component-url")||"<unknown>",v=this.getAttribute("component-export");throw v&&(s+=\` (export \${v})\`),console.error(\`[hydrate] Error parsing props for component \${s}\`,this.getAttribute("props"),r),r}let d;await this.hydrator(this)(this.Component,u,n,{client:this.getAttribute("client")}),this.removeAttribute("ssr"),this.dispatchEvent(new CustomEvent("astro:hydrate"))});l(this,"unmount",()=>{this.isConnected||this.dispatchEvent(new CustomEvent("astro:unmount"))})}disconnectedCallback(){document.removeEventListener("astro:after-swap",this.unmount),document.addEventListener("astro:after-swap",this.unmount,{once:!0})}connectedCallback(){if(!this.hasAttribute("await-children")||document.readyState==="interactive"||document.readyState==="complete")this.childrenConnectedCallback();else{let e=()=>{document.removeEventListener("DOMContentLoaded",e),c.disconnect(),this.childrenConnectedCallback()},c=new MutationObserver(()=>{var n;((n=this.lastChild)==null?void 0:n.nodeType)===Node.COMMENT_NODE&&this.lastChild.nodeValue==="astro:end"&&(this.lastChild.remove(),e())});c.observe(this,{childList:!0}),document.addEventListener("DOMContentLoaded",e)}}async childrenConnectedCallback(){let e=this.getAttribute("before-hydration-url");e&&await import(e),this.start()}async start(){let e=JSON.parse(this.getAttribute("opts")),c=this.getAttribute("client");if(Astro[c]===void 0){window.addEventListener(\`astro:\${c}\`,()=>this.start(),{once:!0});return}try{await Astro[c](async()=>{let n=this.getAttribute("renderer-url"),[p,{default:u}]=await Promise.all([import(this.getAttribute("component-url")),n?import(n):()=>()=>{}]),d=this.getAttribute("component-export")||"default";if(d.includes(".")){this.Component=p;for(let m of d.split(".")){if(E.has(m)||!this.Component||typeof this.Component!="object"&&typeof this.Component!="function"||!Object.hasOwn(this.Component,m))throw new Error(\`Invalid component export path: \${d}\`);this.Component=this.Component[m]}}else{if(E.has(d))throw new Error(\`Invalid component export path: \${d}\`);this.Component=p[d]}return this.hydrator=u,this.hydrate},e,this)}catch(n){console.error("[astro-island] Error hydrating %s",this.getAttribute("component-url"),n)}}attributeChangedCallback(){this.hydrate()}}l(f,"observedAttributes",["props"]),customElements.get("astro-island")||customElements.define("astro-island",f)}})();`;
|
|
2
2
|
export {
|
|
3
3
|
astro_island_prebuilt_default as default
|
|
4
4
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { AstroComponentMetadata } from '../../types/public/internal.js';
|
|
2
|
-
export declare function serializeProps(props: any, metadata
|
|
2
|
+
export declare function serializeProps(props: any, metadata?: AstroComponentMetadata): string;
|
|
@@ -10,6 +10,7 @@ export declare function swapHeadElements(doc: Document): void;
|
|
|
10
10
|
export declare function swapBodyElement(newElement: Element, oldElement: Element): void;
|
|
11
11
|
export declare const saveFocus: () => (() => void);
|
|
12
12
|
export declare const restoreFocus: ({ activeElement, start, end }: SavedFocus) => void;
|
|
13
|
+
export declare const vueScopedStyleId: (el: HTMLStyleElement) => string;
|
|
13
14
|
export declare const swapFunctions: {
|
|
14
15
|
deselectScripts: typeof deselectScripts;
|
|
15
16
|
swapRootAttributes: typeof swapRootAttributes;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const PERSIST_ATTR = "data-astro-transition-persist";
|
|
2
2
|
const NON_OVERRIDABLE_ASTRO_ATTRS = ["data-astro-transition", "data-astro-transition-fallback"];
|
|
3
|
+
const knownVueScopedStyles = /* @__PURE__ */ new Map();
|
|
3
4
|
const scriptsAlreadyRan = /* @__PURE__ */ new Set();
|
|
4
5
|
function detectScriptExecuted(script) {
|
|
5
6
|
const key = script.src ? new URL(script.src, location.href).href : script.textContent;
|
|
@@ -33,10 +34,20 @@ function swapHeadElements(doc) {
|
|
|
33
34
|
if (newEl) {
|
|
34
35
|
newEl.remove();
|
|
35
36
|
} else {
|
|
37
|
+
if (import.meta.env.DEV && el instanceof HTMLStyleElement) {
|
|
38
|
+
const viteDevId = vueScopedStyleId(el);
|
|
39
|
+
viteDevId && knownVueScopedStyles.set(viteDevId, el);
|
|
40
|
+
}
|
|
36
41
|
el.remove();
|
|
37
42
|
}
|
|
38
43
|
}
|
|
39
|
-
|
|
44
|
+
if (import.meta.env.DEV) {
|
|
45
|
+
[...doc.head.children].forEach((child) => {
|
|
46
|
+
document.head.append(knownVueScopedStyles.get(child.dataset?.viteDevId) || child);
|
|
47
|
+
});
|
|
48
|
+
} else {
|
|
49
|
+
document.head.append(...doc.head.children);
|
|
50
|
+
}
|
|
40
51
|
}
|
|
41
52
|
function swapBodyElement(newElement, oldElement) {
|
|
42
53
|
const persistPairs = [];
|
|
@@ -106,6 +117,11 @@ const restoreFocus = ({ activeElement, start, end }) => {
|
|
|
106
117
|
}
|
|
107
118
|
}
|
|
108
119
|
};
|
|
120
|
+
const vueScopedStyleId = (el) => {
|
|
121
|
+
const viteDevId = el.dataset.viteDevId || "";
|
|
122
|
+
const url = new URL(viteDevId, location.href);
|
|
123
|
+
return url.searchParams.get("vue") !== null && url.searchParams.get("type") === "style" && url.searchParams.has("scoped") ? viteDevId : "";
|
|
124
|
+
};
|
|
109
125
|
const persistedHeadElement = (el, newDoc) => {
|
|
110
126
|
const id = el.getAttribute(PERSIST_ATTR);
|
|
111
127
|
const newEl = id && newDoc.head.querySelector(`[${PERSIST_ATTR}="${id}"]`);
|
|
@@ -116,9 +132,9 @@ const persistedHeadElement = (el, newDoc) => {
|
|
|
116
132
|
const href = el.getAttribute("href");
|
|
117
133
|
return newDoc.head.querySelector(`link[rel=stylesheet][href="${href}"]`);
|
|
118
134
|
}
|
|
119
|
-
if (import.meta.env.DEV && el
|
|
120
|
-
const viteDevId = el
|
|
121
|
-
if (
|
|
135
|
+
if (import.meta.env.DEV && el instanceof HTMLStyleElement) {
|
|
136
|
+
const viteDevId = vueScopedStyleId(el);
|
|
137
|
+
if (viteDevId) {
|
|
122
138
|
return newDoc.head.querySelector(`style[data-vite-dev-id="${viteDevId}"]`);
|
|
123
139
|
}
|
|
124
140
|
}
|
|
@@ -167,5 +183,6 @@ export {
|
|
|
167
183
|
swapBodyElement,
|
|
168
184
|
swapFunctions,
|
|
169
185
|
swapHeadElements,
|
|
170
|
-
swapRootAttributes
|
|
186
|
+
swapRootAttributes,
|
|
187
|
+
vueScopedStyleId
|
|
171
188
|
};
|
|
@@ -137,7 +137,7 @@ function markdown({ settings, logger }) {
|
|
|
137
137
|
'server:root': true,
|
|
138
138
|
}, {
|
|
139
139
|
'default': () => render\`\${unescapeHTML(html())}\`
|
|
140
|
-
})}\`;` : `render\`${charset}\${maybeRenderHead(
|
|
140
|
+
})}\`;` : `render\`${charset}\${maybeRenderHead()}\${unescapeHTML(html())}\`;`}
|
|
141
141
|
});
|
|
142
142
|
export default Content;
|
|
143
143
|
`;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "astro",
|
|
3
|
-
"version": "6.1.
|
|
3
|
+
"version": "6.1.9",
|
|
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",
|
|
@@ -132,7 +132,7 @@
|
|
|
132
132
|
"p-queue": "^9.1.0",
|
|
133
133
|
"package-manager-detector": "^1.6.0",
|
|
134
134
|
"piccolore": "^0.1.3",
|
|
135
|
-
"picomatch": "^4.0.
|
|
135
|
+
"picomatch": "^4.0.4",
|
|
136
136
|
"rehype": "^13.0.2",
|
|
137
137
|
"semver": "^7.7.4",
|
|
138
138
|
"shiki": "^4.0.2",
|
|
@@ -145,16 +145,16 @@
|
|
|
145
145
|
"ultrahtml": "^1.6.0",
|
|
146
146
|
"unifont": "~0.7.4",
|
|
147
147
|
"unist-util-visit": "^5.1.0",
|
|
148
|
-
"unstorage": "^1.17.
|
|
148
|
+
"unstorage": "^1.17.5",
|
|
149
149
|
"vfile": "^6.0.3",
|
|
150
|
-
"vite": "^7.3.
|
|
150
|
+
"vite": "^7.3.2",
|
|
151
151
|
"vitefu": "^1.1.2",
|
|
152
152
|
"xxhash-wasm": "^1.1.0",
|
|
153
153
|
"yargs-parser": "^22.0.0",
|
|
154
154
|
"zod": "^4.3.6",
|
|
155
|
-
"@astrojs/internal-helpers": "0.
|
|
156
|
-
"@astrojs/markdown-remark": "7.1.
|
|
157
|
-
"@astrojs/telemetry": "3.3.
|
|
155
|
+
"@astrojs/internal-helpers": "0.9.0",
|
|
156
|
+
"@astrojs/markdown-remark": "7.1.1",
|
|
157
|
+
"@astrojs/telemetry": "3.3.1"
|
|
158
158
|
},
|
|
159
159
|
"optionalDependencies": {
|
|
160
160
|
"sharp": "^0.34.0"
|
|
@@ -167,6 +167,7 @@
|
|
|
167
167
|
"@types/html-escaper": "3.0.4",
|
|
168
168
|
"@types/http-cache-semantics": "^4.2.0",
|
|
169
169
|
"@types/js-yaml": "^4.0.9",
|
|
170
|
+
"@types/parse-srcset": "^1.0.0",
|
|
170
171
|
"@types/picomatch": "^4.0.2",
|
|
171
172
|
"@types/semver": "^7.7.1",
|
|
172
173
|
"@types/yargs-parser": "^21.0.3",
|
|
@@ -215,8 +216,8 @@
|
|
|
215
216
|
"test:e2e:match": "playwright test -g",
|
|
216
217
|
"test:e2e:chrome": "playwright test",
|
|
217
218
|
"test:e2e:firefox": "playwright test --config playwright.firefox.config.js",
|
|
218
|
-
"test:types": "tsc --
|
|
219
|
-
"typecheck:tests": "tsc --
|
|
219
|
+
"test:types": "tsc --build test/types/tsconfig.json",
|
|
220
|
+
"typecheck:tests": "tsc --build tsconfig.test.json",
|
|
220
221
|
"test:unit": "astro-scripts test \"test/units/**/*.test.ts\" --strip-types --teardown ./test/units/teardown.ts",
|
|
221
222
|
"test:integration": "pnpm run test:integration:js && pnpm run test:integration:ts",
|
|
222
223
|
"test:integration:js": "astro-scripts test \"test/*.test.js\"",
|