astro 6.0.0-beta.13 → 6.0.0-beta.14
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/bin/astro.mjs +1 -1
- package/components/Image.astro +2 -2
- package/dist/actions/runtime/client.js +2 -4
- package/dist/assets/fonts/infra/capsize-font-metrics-resolver.js +1 -1
- package/dist/assets/fonts/infra/levenshtein-string-matcher.js +1 -1
- package/dist/assets/index.d.ts +1 -1
- package/dist/assets/index.js +0 -1
- package/dist/assets/services/service.js +5 -5
- package/dist/assets/utils/queryParams.js +2 -2
- package/dist/cli/add/index.js +1 -1
- package/dist/cli/infra/build-time-astro-version-provider.js +1 -1
- package/dist/content/content-layer.js +3 -3
- package/dist/content/utils.js +2 -2
- package/dist/content/vite-plugin-content-virtual-mod.js +1 -0
- package/dist/core/app/entrypoints/virtual/dev.js +4 -0
- package/dist/core/app/validate-headers.js +3 -1
- package/dist/core/build/generate.js +1 -1
- package/dist/core/config/schemas/base.js +1 -1
- package/dist/core/constants.js +1 -1
- package/dist/core/create-vite.js +1 -1
- package/dist/core/dev/container.js +1 -1
- package/dist/core/dev/dev.js +1 -1
- package/dist/core/messages.js +2 -2
- package/dist/core/preview/vite-plugin-astro-preview.js +2 -2
- package/dist/core/render/paginate.js +1 -1
- package/dist/core/routing/rewrite.js +1 -1
- package/dist/env/validators.js +1 -1
- package/dist/events/session.js +1 -1
- package/dist/integrations/features-validation.js +1 -1
- package/dist/integrations/hooks.js +1 -1
- package/dist/manifest/virtual-module.js +1 -1
- package/dist/runtime/client/dev-toolbar/apps/audit/rules/perf.js +3 -3
- package/dist/runtime/client/dev-toolbar/apps/utils/icons.js +1 -1
- package/dist/runtime/server/astro-island.js +1 -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/jsx.js +1 -1
- package/dist/runtime/server/render/head.js +1 -1
- package/dist/runtime/server/render/util.js +1 -1
- package/dist/runtime/server/serialize.js +2 -2
- package/dist/vite-plugin-adapter-config/index.js +9 -4
- package/dist/vite-plugin-app/app.d.ts +5 -0
- package/dist/vite-plugin-app/app.js +7 -0
- package/dist/vite-plugin-app/createAstroServerApp.js +4 -0
- package/package.json +1 -1
package/bin/astro.mjs
CHANGED
|
@@ -19,7 +19,7 @@ const skipSemverCheckIfAbove = IS_STACKBLITZ ? 21 : 23;
|
|
|
19
19
|
async function main() {
|
|
20
20
|
const version = process.versions.node;
|
|
21
21
|
// Fast-path for higher Node.js versions
|
|
22
|
-
if ((parseInt(version) || 0) <= skipSemverCheckIfAbove) {
|
|
22
|
+
if ((Number.parseInt(version) || 0) <= skipSemverCheckIfAbove) {
|
|
23
23
|
const semver = await import('semver');
|
|
24
24
|
try {
|
|
25
25
|
if (!semver.satisfies(version, engines)) {
|
package/components/Image.astro
CHANGED
|
@@ -17,11 +17,11 @@ if (props.alt === undefined || props.alt === null) {
|
|
|
17
17
|
|
|
18
18
|
// As a convenience, allow width and height to be string with a number in them, to match HTML's native `img`.
|
|
19
19
|
if (typeof props.width === 'string') {
|
|
20
|
-
props.width = parseInt(props.width);
|
|
20
|
+
props.width = Number.parseInt(props.width);
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
if (typeof props.height === 'string') {
|
|
24
|
-
props.height = parseInt(props.height);
|
|
24
|
+
props.height = Number.parseInt(props.height);
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
const layout = props.layout ?? imageConfig.layout ?? 'none';
|
|
@@ -43,10 +43,8 @@ const codeToStatusMap = {
|
|
|
43
43
|
LOOP_DETECTED: 508,
|
|
44
44
|
NETWORK_AUTHENTICATION_REQUIRED: 511
|
|
45
45
|
};
|
|
46
|
-
const statusToCodeMap = Object.
|
|
47
|
-
|
|
48
|
-
(acc, [key, value]) => ({ ...acc, [value]: key }),
|
|
49
|
-
{}
|
|
46
|
+
const statusToCodeMap = Object.fromEntries(
|
|
47
|
+
Object.entries(codeToStatusMap).map(([key, value]) => [value, key])
|
|
50
48
|
);
|
|
51
49
|
class ActionError extends Error {
|
|
52
50
|
type = "AstroActionError";
|
|
@@ -125,7 +125,7 @@ class LevenshteinStringMatcher {
|
|
|
125
125
|
return this.#myers_x(a, b);
|
|
126
126
|
}
|
|
127
127
|
#closest(str, arr) {
|
|
128
|
-
let min_distance =
|
|
128
|
+
let min_distance = Number.POSITIVE_INFINITY;
|
|
129
129
|
let min_index = 0;
|
|
130
130
|
for (let i = 0; i < arr.length; i++) {
|
|
131
131
|
const dist = this.#distance(str, arr[i]);
|
package/dist/assets/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { getConfiguredImageService, getImage } from './internal.js';
|
|
2
2
|
export { baseService, isLocalService } from './services/service.js';
|
|
3
|
-
export {
|
|
3
|
+
export type { LocalImageProps, RemoteImageProps } from './types.js';
|
package/dist/assets/index.js
CHANGED
|
@@ -11,7 +11,7 @@ function isLocalService(service) {
|
|
|
11
11
|
return "transform" in service;
|
|
12
12
|
}
|
|
13
13
|
function parseQuality(quality) {
|
|
14
|
-
let result = parseInt(quality);
|
|
14
|
+
let result = Number.parseInt(quality);
|
|
15
15
|
if (Number.isNaN(result)) {
|
|
16
16
|
return quality;
|
|
17
17
|
}
|
|
@@ -124,7 +124,7 @@ const baseService = {
|
|
|
124
124
|
const targetFormat = options.format ?? DEFAULT_OUTPUT_FORMAT;
|
|
125
125
|
let transformedWidths = (widths ?? []).sort(sortNumeric);
|
|
126
126
|
let imageWidth = options.width;
|
|
127
|
-
let maxWidth =
|
|
127
|
+
let maxWidth = Number.POSITIVE_INFINITY;
|
|
128
128
|
if (isESMImportedImage(options.src)) {
|
|
129
129
|
imageWidth = options.src.width;
|
|
130
130
|
maxWidth = imageWidth;
|
|
@@ -145,7 +145,7 @@ const baseService = {
|
|
|
145
145
|
if (typeof density === "number") {
|
|
146
146
|
return density;
|
|
147
147
|
} else {
|
|
148
|
-
return parseFloat(density);
|
|
148
|
+
return Number.parseFloat(density);
|
|
149
149
|
}
|
|
150
150
|
});
|
|
151
151
|
const densityWidths = densityValues.sort(sortNumeric).map((density) => Math.round(targetWidth * density));
|
|
@@ -209,8 +209,8 @@ const baseService = {
|
|
|
209
209
|
}
|
|
210
210
|
const transform = {
|
|
211
211
|
src: params.get("href"),
|
|
212
|
-
width: params.has("w") ? parseInt(params.get("w")) : void 0,
|
|
213
|
-
height: params.has("h") ? parseInt(params.get("h")) : void 0,
|
|
212
|
+
width: params.has("w") ? Number.parseInt(params.get("w")) : void 0,
|
|
213
|
+
height: params.has("h") ? Number.parseInt(params.get("h")) : void 0,
|
|
214
214
|
format: params.get("f"),
|
|
215
215
|
quality: params.get("q"),
|
|
216
216
|
fit: params.get("fit"),
|
package/dist/cli/add/index.js
CHANGED
|
@@ -692,7 +692,7 @@ async function tryToInstallIntegrations({
|
|
|
692
692
|
logger.debug("add", `package manager: "${packageManager?.name}"`);
|
|
693
693
|
if (!packageManager) return 0 /* none */;
|
|
694
694
|
const inheritedFlags = Object.entries(flags).map(([flag]) => {
|
|
695
|
-
if (flag
|
|
695
|
+
if (flag === "_") return;
|
|
696
696
|
if (INHERITED_FLAGS.has(flag)) {
|
|
697
697
|
if (flag.length === 1) return `-${flag}`;
|
|
698
698
|
return `--${flag}`;
|
|
@@ -181,7 +181,7 @@ ${contentConfig.error.message}`
|
|
|
181
181
|
logger.info("Content config changed");
|
|
182
182
|
shouldClear = true;
|
|
183
183
|
}
|
|
184
|
-
if (previousAstroVersion && previousAstroVersion !== "6.0.0-beta.
|
|
184
|
+
if (previousAstroVersion && previousAstroVersion !== "6.0.0-beta.14") {
|
|
185
185
|
logger.info("Astro version changed");
|
|
186
186
|
shouldClear = true;
|
|
187
187
|
}
|
|
@@ -189,8 +189,8 @@ ${contentConfig.error.message}`
|
|
|
189
189
|
logger.info("Clearing content store");
|
|
190
190
|
this.#store.clearAll();
|
|
191
191
|
}
|
|
192
|
-
if ("6.0.0-beta.
|
|
193
|
-
await this.#store.metaStore().set("astro-version", "6.0.0-beta.
|
|
192
|
+
if ("6.0.0-beta.14") {
|
|
193
|
+
await this.#store.metaStore().set("astro-version", "6.0.0-beta.14");
|
|
194
194
|
}
|
|
195
195
|
if (currentConfigDigest) {
|
|
196
196
|
await this.#store.metaStore().set("content-config-digest", currentConfigDigest);
|
package/dist/content/utils.js
CHANGED
|
@@ -176,10 +176,10 @@ async function getEntryData(entry, collectionConfig, shouldEmitFile, pluginConte
|
|
|
176
176
|
return data;
|
|
177
177
|
}
|
|
178
178
|
function getContentEntryExts(settings) {
|
|
179
|
-
return settings.contentEntryTypes.
|
|
179
|
+
return settings.contentEntryTypes.flatMap((t) => t.extensions);
|
|
180
180
|
}
|
|
181
181
|
function getDataEntryExts(settings) {
|
|
182
|
-
return settings.dataEntryTypes.
|
|
182
|
+
return settings.dataEntryTypes.flatMap((t) => t.extensions);
|
|
183
183
|
}
|
|
184
184
|
function getEntryConfigByExtMap(entryTypes) {
|
|
185
185
|
const map = /* @__PURE__ */ new Map();
|
|
@@ -30,6 +30,7 @@ function invalidateDataStore(viteServer) {
|
|
|
30
30
|
const timestamp = Date.now();
|
|
31
31
|
environment.moduleGraph.invalidateModule(module, void 0, timestamp, true);
|
|
32
32
|
}
|
|
33
|
+
environment.hot.send("astro:content-changed", {});
|
|
33
34
|
viteServer.environments.client.hot.send({
|
|
34
35
|
type: "full-reload",
|
|
35
36
|
path: "*"
|
|
@@ -39,7 +39,9 @@ function validateForwardedHeaders(forwardedProtocol, forwardedHost, forwardedPor
|
|
|
39
39
|
if (hasProtocolPatterns) {
|
|
40
40
|
try {
|
|
41
41
|
const testUrl = new URL(`${forwardedProtocol}://example.com`);
|
|
42
|
-
const isAllowed = allowedDomains.some(
|
|
42
|
+
const isAllowed = allowedDomains.some(
|
|
43
|
+
(pattern) => matchPattern(testUrl, { protocol: pattern.protocol })
|
|
44
|
+
);
|
|
43
45
|
if (isAllowed) {
|
|
44
46
|
result.protocol = forwardedProtocol;
|
|
45
47
|
}
|
|
@@ -181,7 +181,7 @@ async function generatePathWithPrerenderer(prerenderer, pathname, route, options
|
|
|
181
181
|
if (routeData.pattern.test(pathname)) {
|
|
182
182
|
if (routeData.params && routeData.params.length !== 0) {
|
|
183
183
|
if (routeData.distURL && !routeData.distURL.find(
|
|
184
|
-
(url2) => url2.href.replace(config.outDir.toString(), "").replace(/(?:\/index\.html|\.html)$/, "")
|
|
184
|
+
(url2) => url2.href.replace(config.outDir.toString(), "").replace(/(?:\/index\.html|\.html)$/, "") === trimSlashes(pathname)
|
|
185
185
|
)) {
|
|
186
186
|
return false;
|
|
187
187
|
}
|
|
@@ -80,7 +80,7 @@ const AstroConfigSchema = z.object({
|
|
|
80
80
|
adapter: z.object({ name: z.string(), hooks: z.object({}).passthrough().default({}) }).optional(),
|
|
81
81
|
integrations: z.preprocess(
|
|
82
82
|
// preprocess
|
|
83
|
-
(val) => Array.isArray(val) ? val.flat(
|
|
83
|
+
(val) => Array.isArray(val) ? val.flat(Number.POSITIVE_INFINITY).filter(Boolean) : val,
|
|
84
84
|
// validate
|
|
85
85
|
z.array(z.object({ name: z.string(), hooks: z.object({}).passthrough().default({}) })).default(ASTRO_CONFIG_DEFAULTS.integrations)
|
|
86
86
|
),
|
package/dist/core/constants.js
CHANGED
package/dist/core/create-vite.js
CHANGED
|
@@ -208,7 +208,7 @@ async function createVite(commandConfig, { settings, logger, mode, command, fs =
|
|
|
208
208
|
{ ...settings.config.vite, mode },
|
|
209
209
|
{ command: command === "dev" ? "serve" : command, mode }
|
|
210
210
|
];
|
|
211
|
-
plugins = plugins.flat(
|
|
211
|
+
plugins = plugins.flat(Number.POSITIVE_INFINITY).filter((p) => {
|
|
212
212
|
if (!p || p?.apply === applyToFilter) {
|
|
213
213
|
return false;
|
|
214
214
|
}
|
|
@@ -27,7 +27,7 @@ async function createContainer({
|
|
|
27
27
|
base,
|
|
28
28
|
server: { host, headers, open: serverOpen, allowedHosts }
|
|
29
29
|
} = settings.config;
|
|
30
|
-
const isServerOpenURL = typeof serverOpen
|
|
30
|
+
const isServerOpenURL = typeof serverOpen === "string" && !isRestart;
|
|
31
31
|
const isServerOpenBoolean = serverOpen && !isRestart;
|
|
32
32
|
const open = isServerOpenURL ? serverOpen : isServerOpenBoolean ? base : false;
|
|
33
33
|
const rendererClientEntries = settings.renderers.map((r) => r.clientEntrypoint).filter(Boolean);
|
package/dist/core/dev/dev.js
CHANGED
|
@@ -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 = "6.0.0-beta.
|
|
25
|
+
const currentVersion = "6.0.0-beta.14";
|
|
26
26
|
const isPrerelease = currentVersion.includes("-");
|
|
27
27
|
if (!isPrerelease) {
|
|
28
28
|
try {
|
package/dist/core/messages.js
CHANGED
|
@@ -28,7 +28,7 @@ function serverStart({
|
|
|
28
28
|
host,
|
|
29
29
|
base
|
|
30
30
|
}) {
|
|
31
|
-
const version = "6.0.0-beta.
|
|
31
|
+
const version = "6.0.0-beta.14";
|
|
32
32
|
const localPrefix = `${dim("\u2503")} Local `;
|
|
33
33
|
const networkPrefix = `${dim("\u2503")} Network `;
|
|
34
34
|
const emptyPrefix = " ".repeat(11);
|
|
@@ -265,7 +265,7 @@ function printHelp({
|
|
|
265
265
|
message.push(
|
|
266
266
|
linebreak(),
|
|
267
267
|
` ${bgGreen(black(` ${commandName} `))} ${green(
|
|
268
|
-
`v${"6.0.0-beta.
|
|
268
|
+
`v${"6.0.0-beta.14"}`
|
|
269
269
|
)} ${headline}`
|
|
270
270
|
);
|
|
271
271
|
}
|
|
@@ -31,12 +31,12 @@ function vitePluginAstroPreview(settings) {
|
|
|
31
31
|
const isRoot = pathname === "/";
|
|
32
32
|
if (!isRoot) {
|
|
33
33
|
const hasTrailingSlash = pathname.endsWith("/");
|
|
34
|
-
if (hasTrailingSlash && trailingSlash
|
|
34
|
+
if (hasTrailingSlash && trailingSlash === "never") {
|
|
35
35
|
res.statusCode = 404;
|
|
36
36
|
res.end(notFoundTemplate(pathname, 'Not Found (trailingSlash is set to "never")'));
|
|
37
37
|
return;
|
|
38
38
|
}
|
|
39
|
-
if (!hasTrailingSlash && trailingSlash
|
|
39
|
+
if (!hasTrailingSlash && trailingSlash === "always" && !HAS_FILE_EXTENSION_REGEXP.test(pathname)) {
|
|
40
40
|
res.statusCode = 404;
|
|
41
41
|
res.end(notFoundTemplate(pathname, 'Not Found (trailingSlash is set to "always")'));
|
|
42
42
|
return;
|
|
@@ -23,7 +23,7 @@ function generatePaginateFunction(routeMatch, base, trailingSlash) {
|
|
|
23
23
|
const lastPage = Math.max(1, Math.ceil(data.length / pageSize));
|
|
24
24
|
const result = [...Array(lastPage).keys()].map((num) => {
|
|
25
25
|
const pageNum = num + 1;
|
|
26
|
-
const start = pageSize ===
|
|
26
|
+
const start = pageSize === Number.POSITIVE_INFINITY ? 0 : (pageNum - 1) * pageSize;
|
|
27
27
|
const end = Math.min(start + pageSize, data.length);
|
|
28
28
|
const params = {
|
|
29
29
|
...additionalParams,
|
|
@@ -58,7 +58,7 @@ function findRouteToRewrite({
|
|
|
58
58
|
if (route.pattern.test(decodedPathname)) {
|
|
59
59
|
if (route.params && route.params.length !== 0 && route.distURL && route.distURL.length !== 0) {
|
|
60
60
|
if (!route.distURL.find(
|
|
61
|
-
(url) => url.href.replace(outDir.toString(), "").replace(/(?:\/index\.html|\.html)$/, "")
|
|
61
|
+
(url) => url.href.replace(outDir.toString(), "").replace(/(?:\/index\.html|\.html)$/, "") === trimSlashes(pathname)
|
|
62
62
|
)) {
|
|
63
63
|
continue;
|
|
64
64
|
}
|
package/dist/env/validators.js
CHANGED
|
@@ -49,7 +49,7 @@ const stringValidator = ({ max, min, length, url, includes, startsWith, endsWith
|
|
|
49
49
|
};
|
|
50
50
|
};
|
|
51
51
|
const numberValidator = ({ gt, min, lt, max, int }) => (input) => {
|
|
52
|
-
const num = parseFloat(input ?? "");
|
|
52
|
+
const num = Number.parseFloat(input ?? "");
|
|
53
53
|
if (isNaN(num)) {
|
|
54
54
|
return {
|
|
55
55
|
ok: false,
|
package/dist/events/session.js
CHANGED
|
@@ -64,7 +64,7 @@ function createAnonymousConfigInfo(userConfig) {
|
|
|
64
64
|
return configInfo;
|
|
65
65
|
}
|
|
66
66
|
function eventCliSession(cliCommand, userConfig, flags) {
|
|
67
|
-
const cliFlags = flags ? Object.keys(flags).filter((name) => name
|
|
67
|
+
const cliFlags = flags ? Object.keys(flags).filter((name) => name !== "_") : void 0;
|
|
68
68
|
const payload = {
|
|
69
69
|
cliCommand,
|
|
70
70
|
config: createAnonymousConfigInfo(userConfig),
|
|
@@ -27,7 +27,7 @@ function validateSupportedFeatures(adapterName, featureMap, settings, logger) {
|
|
|
27
27
|
adapterName,
|
|
28
28
|
logger,
|
|
29
29
|
"hybridOutput",
|
|
30
|
-
() => settings.config.output
|
|
30
|
+
() => settings.config.output === "static" && settings.buildOutput === "server"
|
|
31
31
|
);
|
|
32
32
|
validationResult.serverOutput = validateSupportKind(
|
|
33
33
|
serverOutput,
|
|
@@ -220,7 +220,7 @@ async function runHookConfigSetup({
|
|
|
220
220
|
}
|
|
221
221
|
};
|
|
222
222
|
function addPageExtension(...input) {
|
|
223
|
-
const exts = input.flat(
|
|
223
|
+
const exts = input.flat(Number.POSITIVE_INFINITY).map(
|
|
224
224
|
(ext) => `.${ext.replace(/^\./, "")}`
|
|
225
225
|
);
|
|
226
226
|
updatedSettings.pageExtensions.push(...exts);
|
|
@@ -62,7 +62,7 @@ export { base, i18n, trailingSlash, site, compressHTML, build, image };
|
|
|
62
62
|
`;
|
|
63
63
|
return { code };
|
|
64
64
|
}
|
|
65
|
-
if (id
|
|
65
|
+
if (id === RESOLVED_VIRTUAL_SERVER_ID) {
|
|
66
66
|
if (this.environment.name === ASTRO_VITE_ENVIRONMENT_NAMES.client) {
|
|
67
67
|
throw new AstroError({
|
|
68
68
|
...AstroErrorData.ServerOnlyModule,
|
|
@@ -79,7 +79,7 @@ const perf = [
|
|
|
79
79
|
match(element) {
|
|
80
80
|
const serverRenderTime = element.getAttribute("server-render-time");
|
|
81
81
|
if (!serverRenderTime) return false;
|
|
82
|
-
const renderingTime = parseFloat(serverRenderTime);
|
|
82
|
+
const renderingTime = Number.parseFloat(serverRenderTime);
|
|
83
83
|
if (Number.isNaN(renderingTime)) return false;
|
|
84
84
|
return renderingTime > 500;
|
|
85
85
|
}
|
|
@@ -94,7 +94,7 @@ const perf = [
|
|
|
94
94
|
match(element) {
|
|
95
95
|
const clientRenderTime = element.getAttribute("client-render-time");
|
|
96
96
|
if (!clientRenderTime) return false;
|
|
97
|
-
const renderingTime = parseFloat(clientRenderTime);
|
|
97
|
+
const renderingTime = Number.parseFloat(clientRenderTime);
|
|
98
98
|
if (Number.isNaN(renderingTime)) return false;
|
|
99
99
|
return renderingTime > 500;
|
|
100
100
|
}
|
|
@@ -102,7 +102,7 @@ const perf = [
|
|
|
102
102
|
];
|
|
103
103
|
function getCleanRenderingTime(time) {
|
|
104
104
|
if (!time) return "unknown";
|
|
105
|
-
const renderingTime = parseFloat(time);
|
|
105
|
+
const renderingTime = Number.parseFloat(time);
|
|
106
106
|
if (Number.isNaN(renderingTime)) return "unknown";
|
|
107
107
|
return renderingTime.toFixed(2) + "s";
|
|
108
108
|
}
|
|
@@ -13,7 +13,7 @@ const categoryIcons = new Map(
|
|
|
13
13
|
})
|
|
14
14
|
);
|
|
15
15
|
function iconForIntegration(integration) {
|
|
16
|
-
const icons = integration.categories.filter((category) => categoryIcons.has(category)).
|
|
16
|
+
const icons = integration.categories.filter((category) => categoryIcons.has(category)).flatMap((category) => categoryIcons.get(category));
|
|
17
17
|
return randomFromArray(icons);
|
|
18
18
|
}
|
|
19
19
|
const iconColors = [
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
8: (value) => new Uint8Array(value),
|
|
12
12
|
9: (value) => new Uint16Array(value),
|
|
13
13
|
10: (value) => new Uint32Array(value),
|
|
14
|
-
11: (value) =>
|
|
14
|
+
11: (value) => Number.POSITIVE_INFINITY * value
|
|
15
15
|
};
|
|
16
16
|
const reviveTuple = (raw) => {
|
|
17
17
|
const [type, value] = raw;
|
|
@@ -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 g=(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)=>g(i,typeof o!=\"symbol\"?o+\"\":o,a);{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=>
|
|
6
|
+
declare const _default: "(()=>{var A=Object.defineProperty;var g=(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)=>g(i,typeof o!=\"symbol\"?o+\"\":o,a);{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,m=this.hydrator(this);d=performance.now(),await m(this.Component,u,n,{client:this.getAttribute(\"client\")}),d&&this.setAttribute(\"client-render-time\",(performance.now()-d).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),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[d];else{this.Component=p;for(let m of d.split(\".\"))this.Component=this.Component[m]}return this.hydrator=u,this.hydrate},e,this)}catch(n){console.error(`[astro-island] Error hydrating ${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 g=(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)=>g(i,typeof o!="symbol"?o+"":o,a);{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=>
|
|
1
|
+
var astro_island_prebuilt_dev_default = `(()=>{var A=Object.defineProperty;var g=(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)=>g(i,typeof o!="symbol"?o+"":o,a);{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,m=this.hydrator(this);d=performance.now(),await m(this.Component,u,n,{client:this.getAttribute("client")}),d&&this.setAttribute("client-render-time",(performance.now()-d).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),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[d];else{this.Component=p;for(let m of d.split("."))this.Component=this.Component[m]}return this.hydrator=u,this.hydrate},e,this)}catch(n){console.error(\`[astro-island] Error hydrating \${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 g=(i,o,a)=>o in i?A(i,o,{enumerable:!0,configurable:!0,writable:!0,value:a}):i[o]=a;var d=(i,o,a)=>g(i,typeof o!=\"symbol\"?o+\"\":o,a);{let i={0:t=>m(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=>
|
|
6
|
+
declare const _default: "(()=>{var A=Object.defineProperty;var g=(i,o,a)=>o in i?A(i,o,{enumerable:!0,configurable:!0,writable:!0,value:a}):i[o]=a;var d=(i,o,a)=>g(i,typeof o!=\"symbol\"?o+\"\":o,a);{let i={0:t=>m(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[l,e]=t;return l in i?i[l](e):void 0},a=t=>t.map(o),m=t=>typeof t!=\"object\"||t===null?t:Object.fromEntries(Object.entries(t).map(([l,e])=>[l,o(e)]));class y extends HTMLElement{constructor(){super(...arguments);d(this,\"Component\");d(this,\"hydrator\");d(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={},h=this.querySelectorAll(\"template[data-astro-template]\");for(let r of h){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 p;try{p=this.hasAttribute(\"props\")?m(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 u;await this.hydrator(this)(this.Component,p,n,{client:this.getAttribute(\"client\")}),this.removeAttribute(\"ssr\"),this.dispatchEvent(new CustomEvent(\"astro:hydrate\"))});d(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\"),[h,{default:p}]=await Promise.all([import(this.getAttribute(\"component-url\")),n?import(n):()=>()=>{}]),u=this.getAttribute(\"component-export\")||\"default\";if(!u.includes(\".\"))this.Component=h[u];else{this.Component=h;for(let f of u.split(\".\"))this.Component=this.Component[f]}return this.hydrator=p,this.hydrate},e,this)}catch(n){console.error(`[astro-island] Error hydrating ${this.getAttribute(\"component-url\")}`,n)}}attributeChangedCallback(){this.hydrate()}}d(y,\"observedAttributes\",[\"props\"]),customElements.get(\"astro-island\")||customElements.define(\"astro-island\",y)}})();";
|
|
7
7
|
export default _default;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var astro_island_prebuilt_default = `(()=>{var A=Object.defineProperty;var g=(i,o,a)=>o in i?A(i,o,{enumerable:!0,configurable:!0,writable:!0,value:a}):i[o]=a;var d=(i,o,a)=>g(i,typeof o!="symbol"?o+"":o,a);{let i={0:t=>m(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=>
|
|
1
|
+
var astro_island_prebuilt_default = `(()=>{var A=Object.defineProperty;var g=(i,o,a)=>o in i?A(i,o,{enumerable:!0,configurable:!0,writable:!0,value:a}):i[o]=a;var d=(i,o,a)=>g(i,typeof o!="symbol"?o+"":o,a);{let i={0:t=>m(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[l,e]=t;return l in i?i[l](e):void 0},a=t=>t.map(o),m=t=>typeof t!="object"||t===null?t:Object.fromEntries(Object.entries(t).map(([l,e])=>[l,o(e)]));class y extends HTMLElement{constructor(){super(...arguments);d(this,"Component");d(this,"hydrator");d(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={},h=this.querySelectorAll("template[data-astro-template]");for(let r of h){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 p;try{p=this.hasAttribute("props")?m(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 u;await this.hydrator(this)(this.Component,p,n,{client:this.getAttribute("client")}),this.removeAttribute("ssr"),this.dispatchEvent(new CustomEvent("astro:hydrate"))});d(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"),[h,{default:p}]=await Promise.all([import(this.getAttribute("component-url")),n?import(n):()=>()=>{}]),u=this.getAttribute("component-export")||"default";if(!u.includes("."))this.Component=h[u];else{this.Component=h;for(let f of u.split("."))this.Component=this.Component[f]}return this.hydrator=p,this.hydrate},e,this)}catch(n){console.error(\`[astro-island] Error hydrating \${this.getAttribute("component-url")}\`,n)}}attributeChangedCallback(){this.hydrate()}}d(y,"observedAttributes",["props"]),customElements.get("astro-island")||customElements.define("astro-island",y)}})();`;
|
|
2
2
|
export {
|
|
3
3
|
astro_island_prebuilt_default as default
|
|
4
4
|
};
|
|
@@ -160,7 +160,7 @@ Did you forget to import the component or is it possible there is a typo?`);
|
|
|
160
160
|
async function renderElement(result, tag, { children, ...props }) {
|
|
161
161
|
return markHTMLString(
|
|
162
162
|
`<${tag}${spreadAttributes(props)}${markHTMLString(
|
|
163
|
-
(children == null || children
|
|
163
|
+
(children == null || children === "") && voidElementNames.test(tag) ? `/>` : `>${children == null ? "" : await renderJSX(result, prerenderElementChildren(tag, children))}</${tag}>`
|
|
164
164
|
)}`
|
|
165
165
|
);
|
|
166
166
|
}
|
|
@@ -5,7 +5,7 @@ import { renderElement } from "./util.js";
|
|
|
5
5
|
const uniqueElements = (item, index, all) => {
|
|
6
6
|
const props = JSON.stringify(item.props);
|
|
7
7
|
const children = item.children;
|
|
8
|
-
return index === all.findIndex((i) => JSON.stringify(i.props) === props && i.children
|
|
8
|
+
return index === all.findIndex((i) => JSON.stringify(i.props) === props && i.children === children);
|
|
9
9
|
};
|
|
10
10
|
function renderAllHeadContent(result) {
|
|
11
11
|
result._metadata.hasRenderedHead = true;
|
|
@@ -111,7 +111,7 @@ function renderElement(name, { props: _props, children = "" }, shouldEscape = tr
|
|
|
111
111
|
children = defineScriptVars(defineVars) + "\n" + children;
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
|
-
if ((children == null || children
|
|
114
|
+
if ((children == null || children === "") && voidElementNames.test(name)) {
|
|
115
115
|
return `<${name}${internalSpreadAttributes(props, shouldEscape, name)}>`;
|
|
116
116
|
}
|
|
117
117
|
return `<${name}${internalSpreadAttributes(props, shouldEscape, name)}>${children}</${name}>`;
|
|
@@ -78,10 +78,10 @@ function convertToSerializedForm(value, metadata = {}, parents = /* @__PURE__ */
|
|
|
78
78
|
if (value !== null && typeof value === "object") {
|
|
79
79
|
return [PROP_TYPE.Value, serializeObject(value, metadata, parents)];
|
|
80
80
|
}
|
|
81
|
-
if (value ===
|
|
81
|
+
if (value === Number.POSITIVE_INFINITY) {
|
|
82
82
|
return [PROP_TYPE.Infinity, 1];
|
|
83
83
|
}
|
|
84
|
-
if (value ===
|
|
84
|
+
if (value === Number.NEGATIVE_INFINITY) {
|
|
85
85
|
return [PROP_TYPE.Infinity, -1];
|
|
86
86
|
}
|
|
87
87
|
if (value === void 0) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { isAstroServerEnvironment } from "../environments.js";
|
|
2
2
|
import { fileURLToPath } from "node:url";
|
|
3
|
+
import { ASTRO_VITE_ENVIRONMENT_NAMES } from "../core/constants.js";
|
|
3
4
|
const VIRTUAL_CLIENT_ID = "virtual:astro:adapter-config/client";
|
|
4
5
|
const RESOLVED_VIRTUAL_CLIENT_ID = "\0" + VIRTUAL_CLIENT_ID;
|
|
5
6
|
function vitePluginAdapterConfig(settings) {
|
|
@@ -9,10 +10,14 @@ function vitePluginAdapterConfig(settings) {
|
|
|
9
10
|
const { adapter } = settings;
|
|
10
11
|
if (adapter && adapter.entrypointResolution === "auto" && adapter.serverEntrypoint) {
|
|
11
12
|
return {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
environments: {
|
|
14
|
+
[ASTRO_VITE_ENVIRONMENT_NAMES.ssr]: {
|
|
15
|
+
build: {
|
|
16
|
+
rollupOptions: {
|
|
17
|
+
input: {
|
|
18
|
+
index: typeof adapter.serverEntrypoint === "string" ? adapter.serverEntrypoint : fileURLToPath(adapter.serverEntrypoint)
|
|
19
|
+
}
|
|
20
|
+
}
|
|
16
21
|
}
|
|
17
22
|
}
|
|
18
23
|
}
|
|
@@ -22,6 +22,11 @@ export declare class AstroServerApp extends BaseApp<RunnablePipeline> {
|
|
|
22
22
|
* Called via HMR when new pages are added/removed.
|
|
23
23
|
*/
|
|
24
24
|
updateRoutes(newRoutesList: RoutesList): void;
|
|
25
|
+
/**
|
|
26
|
+
* Clears the route cache so that getStaticPaths() is re-evaluated.
|
|
27
|
+
* Called via HMR when content collection data changes.
|
|
28
|
+
*/
|
|
29
|
+
clearRouteCache(): void;
|
|
25
30
|
devMatch(pathname: string): Promise<DevMatch | undefined>;
|
|
26
31
|
static create(manifest: SSRManifest, routesList: RoutesList, logger: Logger, loader: ModuleLoader, settings: AstroSettings, getDebugInfo: () => Promise<string>): Promise<AstroServerApp>;
|
|
27
32
|
createPipeline(_streaming: boolean, manifest: SSRManifest, settings: AstroSettings, logger: Logger, loader: ModuleLoader, manifestData: RoutesList, getDebugInfo: () => Promise<string>): RunnablePipeline;
|
|
@@ -41,6 +41,13 @@ class AstroServerApp extends BaseApp {
|
|
|
41
41
|
this.pipeline.setManifestData(newRoutesList);
|
|
42
42
|
ensure404Route(this.manifestData);
|
|
43
43
|
}
|
|
44
|
+
/**
|
|
45
|
+
* Clears the route cache so that getStaticPaths() is re-evaluated.
|
|
46
|
+
* Called via HMR when content collection data changes.
|
|
47
|
+
*/
|
|
48
|
+
clearRouteCache() {
|
|
49
|
+
this.pipeline.clearRouteCache();
|
|
50
|
+
}
|
|
44
51
|
async devMatch(pathname) {
|
|
45
52
|
const matchedRoute = await matchRoute(
|
|
46
53
|
pathname,
|
|
@@ -54,6 +54,10 @@ async function createAstroServerApp(controller, settings, loader, logger) {
|
|
|
54
54
|
${e}`);
|
|
55
55
|
}
|
|
56
56
|
});
|
|
57
|
+
import.meta.hot.on("astro:content-changed", () => {
|
|
58
|
+
app.clearRouteCache();
|
|
59
|
+
actualLogger.debug("router", "Route cache cleared due to content change");
|
|
60
|
+
});
|
|
57
61
|
}
|
|
58
62
|
return {
|
|
59
63
|
handler(incomingRequest, incomingResponse) {
|