astro 3.0.3 → 3.0.5
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/components/ViewTransitions.astro +23 -1
- package/dist/cli/info/index.js +78 -26
- package/dist/core/build/plugins/plugin-ssr.js +4 -1
- package/dist/core/constants.js +1 -1
- package/dist/core/dev/dev.js +1 -1
- package/dist/core/messages.js +2 -2
- package/dist/integrations/index.js +9 -1
- package/package.json +1 -1
|
@@ -98,6 +98,17 @@ const { fallback = 'animate' } = Astro.props as Props;
|
|
|
98
98
|
return wait;
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
+
function isInfinite(animation: Animation) {
|
|
102
|
+
const effect = animation.effect;
|
|
103
|
+
if(
|
|
104
|
+
!effect ||
|
|
105
|
+
!(effect instanceof KeyframeEffect) ||
|
|
106
|
+
!effect.target
|
|
107
|
+
) return false;
|
|
108
|
+
const style = window.getComputedStyle(effect.target, effect.pseudoElement);
|
|
109
|
+
return style.animationIterationCount === "infinite";
|
|
110
|
+
}
|
|
111
|
+
|
|
101
112
|
const parser = new DOMParser();
|
|
102
113
|
|
|
103
114
|
async function updateDOM(html: string, state?: State, fallback?: Fallback) {
|
|
@@ -221,8 +232,10 @@ const { fallback = 'animate' } = Astro.props as Props;
|
|
|
221
232
|
|
|
222
233
|
if (fallback === 'animate') {
|
|
223
234
|
// Trigger the animations
|
|
235
|
+
const currentAnimations = document.getAnimations();
|
|
224
236
|
document.documentElement.dataset.astroTransitionFallback = 'old';
|
|
225
|
-
const
|
|
237
|
+
const newAnimations = document.getAnimations().filter(a => !currentAnimations.includes(a) && !isInfinite(a));
|
|
238
|
+
const finished = Promise.all(newAnimations.map(a => a.finished));
|
|
226
239
|
const fallbackSwap = () => {
|
|
227
240
|
swap();
|
|
228
241
|
document.documentElement.dataset.astroTransitionFallback = 'new';
|
|
@@ -347,9 +360,18 @@ const { fallback = 'animate' } = Astro.props as Props;
|
|
|
347
360
|
// Just ignore stateless entries.
|
|
348
361
|
// The browser will handle navigation fine without our help
|
|
349
362
|
if (ev.state === null) {
|
|
363
|
+
if (history.scrollRestoration) {
|
|
364
|
+
history.scrollRestoration = "auto";
|
|
365
|
+
}
|
|
350
366
|
return;
|
|
351
367
|
}
|
|
352
368
|
|
|
369
|
+
// With the default "auto", the browser will jump to the old scroll position
|
|
370
|
+
// before the ViewTransition is complete.
|
|
371
|
+
if (history.scrollRestoration) {
|
|
372
|
+
history.scrollRestoration = "manual";
|
|
373
|
+
}
|
|
374
|
+
|
|
353
375
|
const state: State | undefined = history.state;
|
|
354
376
|
const nextIndex = state?.index ?? currentHistoryIndex + 1;
|
|
355
377
|
const direction: Direction = nextIndex > currentHistoryIndex ? 'forward' : 'back';
|
package/dist/cli/info/index.js
CHANGED
|
@@ -1,41 +1,93 @@
|
|
|
1
1
|
import * as colors from "kleur/colors";
|
|
2
|
+
import { execSync } from "node:child_process";
|
|
2
3
|
import { arch, platform } from "node:os";
|
|
3
|
-
import
|
|
4
|
+
import prompts from "prompts";
|
|
4
5
|
import { resolveConfig } from "../../core/config/index.js";
|
|
5
6
|
import { ASTRO_VERSION } from "../../core/constants.js";
|
|
6
7
|
import { flagsToAstroInlineConfig } from "../flags.js";
|
|
7
8
|
async function printInfo({ flags }) {
|
|
9
|
+
const rows = [
|
|
10
|
+
["Astro", `v${ASTRO_VERSION}`],
|
|
11
|
+
["Node", process.version],
|
|
12
|
+
["System", getSystem()],
|
|
13
|
+
["Package Manager", getPackageManager()]
|
|
14
|
+
];
|
|
8
15
|
const inlineConfig = flagsToAstroInlineConfig(flags);
|
|
9
|
-
const packageManager = await whichPm(process.cwd());
|
|
10
|
-
let adapter = "Couldn't determine.";
|
|
11
|
-
let integrations = [];
|
|
12
|
-
const MAX_PADDING = 25;
|
|
13
|
-
function printRow(label, value) {
|
|
14
|
-
const padding = MAX_PADDING - label.length;
|
|
15
|
-
console.log(`${colors.bold(label)}` + " ".repeat(padding) + `${colors.green(value)}`);
|
|
16
|
-
}
|
|
17
16
|
try {
|
|
18
17
|
const { userConfig } = await resolveConfig(inlineConfig, "info");
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
18
|
+
rows.push(["Output", userConfig.output ?? "static"]);
|
|
19
|
+
rows.push(["Adapter", userConfig.adapter?.name ?? "none"]);
|
|
20
|
+
const integrations = (userConfig?.integrations ?? []).filter(Boolean).flat().map((i) => i?.name).filter(Boolean);
|
|
21
|
+
rows.push(["Integrations", integrations.length > 0 ? integrations : "none"]);
|
|
22
|
+
} catch {
|
|
23
|
+
}
|
|
24
|
+
let output = "";
|
|
25
|
+
for (const [label, value] of rows) {
|
|
26
|
+
output += printRow(label, value);
|
|
26
27
|
}
|
|
28
|
+
await copyToClipboard(output.trim());
|
|
29
|
+
}
|
|
30
|
+
const SUPPORTED_SYSTEM = /* @__PURE__ */ new Set(["darwin", "win32"]);
|
|
31
|
+
async function copyToClipboard(text) {
|
|
32
|
+
const system = platform();
|
|
33
|
+
if (!SUPPORTED_SYSTEM.has(system))
|
|
34
|
+
return;
|
|
27
35
|
console.log();
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
36
|
+
const { shouldCopy } = await prompts({
|
|
37
|
+
type: "confirm",
|
|
38
|
+
name: "shouldCopy",
|
|
39
|
+
message: "Copy to clipboard?",
|
|
40
|
+
initial: true
|
|
41
|
+
});
|
|
42
|
+
if (!shouldCopy)
|
|
43
|
+
return;
|
|
44
|
+
const command = system === "darwin" ? "pbcopy" : "clip";
|
|
45
|
+
try {
|
|
46
|
+
execSync(`echo ${JSON.stringify(text.trim())} | ${command}`, {
|
|
47
|
+
encoding: "utf8",
|
|
48
|
+
stdio: "ignore"
|
|
49
|
+
});
|
|
50
|
+
} catch (e) {
|
|
51
|
+
console.error(
|
|
52
|
+
colors.red(`
|
|
53
|
+
Sorry, something went wrong!`) + ` Please copy the text above manually.`
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
const PLATFORM_TO_OS = {
|
|
58
|
+
darwin: "macOS",
|
|
59
|
+
win32: "Windows",
|
|
60
|
+
linux: "Linux"
|
|
61
|
+
};
|
|
62
|
+
function getSystem() {
|
|
63
|
+
const system = PLATFORM_TO_OS[platform()] ?? platform();
|
|
64
|
+
return `${system} (${arch()})`;
|
|
65
|
+
}
|
|
66
|
+
function getPackageManager() {
|
|
67
|
+
if (!process.env.npm_config_user_agent) {
|
|
68
|
+
return "unknown";
|
|
69
|
+
}
|
|
70
|
+
const specifier = process.env.npm_config_user_agent.split(" ")[0];
|
|
71
|
+
const name = specifier.substring(0, specifier.lastIndexOf("/"));
|
|
72
|
+
return name === "npminstall" ? "cnpm" : name;
|
|
73
|
+
}
|
|
74
|
+
const MAX_PADDING = 25;
|
|
75
|
+
function printRow(label, value) {
|
|
76
|
+
const padding = MAX_PADDING - label.length;
|
|
77
|
+
const [first, ...rest] = Array.isArray(value) ? value : [value];
|
|
78
|
+
let plaintext = `${label}${" ".repeat(padding)}${first}`;
|
|
79
|
+
let richtext = `${colors.bold(label)}${" ".repeat(padding)}${colors.green(first)}`;
|
|
80
|
+
if (rest.length > 0) {
|
|
81
|
+
for (const entry of rest) {
|
|
82
|
+
plaintext += `
|
|
83
|
+
${" ".repeat(MAX_PADDING)}${entry}`;
|
|
84
|
+
richtext += `
|
|
85
|
+
${" ".repeat(MAX_PADDING)}${colors.green(entry)}`;
|
|
86
|
+
}
|
|
37
87
|
}
|
|
38
|
-
|
|
88
|
+
plaintext += "\n";
|
|
89
|
+
console.log(richtext);
|
|
90
|
+
return plaintext;
|
|
39
91
|
}
|
|
40
92
|
export {
|
|
41
93
|
printInfo
|
|
@@ -111,7 +111,10 @@ function vitePluginSSRSplit(internals, adapter, options) {
|
|
|
111
111
|
options(opts) {
|
|
112
112
|
if (options.settings.config.build.split || functionPerRouteEnabled) {
|
|
113
113
|
const inputs = /* @__PURE__ */ new Set();
|
|
114
|
-
for (const path of Object.
|
|
114
|
+
for (const [path, pageData] of Object.entries(options.allPages)) {
|
|
115
|
+
if (routeIsRedirect(pageData.route)) {
|
|
116
|
+
continue;
|
|
117
|
+
}
|
|
115
118
|
inputs.add(getVirtualModulePageNameFromPath(SPLIT_MODULE_ID, path));
|
|
116
119
|
}
|
|
117
120
|
return addRollupInput(opts, Array.from(inputs));
|
package/dist/core/constants.js
CHANGED
package/dist/core/dev/dev.js
CHANGED
|
@@ -20,7 +20,7 @@ async function dev(inlineConfig) {
|
|
|
20
20
|
base: restart.container.settings.config.base
|
|
21
21
|
})
|
|
22
22
|
);
|
|
23
|
-
const currentVersion = "3.0.
|
|
23
|
+
const currentVersion = "3.0.5";
|
|
24
24
|
if (currentVersion.includes("-")) {
|
|
25
25
|
logger.warn(null, msg.prerelease({ currentVersion }));
|
|
26
26
|
}
|
package/dist/core/messages.js
CHANGED
|
@@ -50,7 +50,7 @@ function serverStart({
|
|
|
50
50
|
base,
|
|
51
51
|
isRestart = false
|
|
52
52
|
}) {
|
|
53
|
-
const version = "3.0.
|
|
53
|
+
const version = "3.0.5";
|
|
54
54
|
const localPrefix = `${dim("\u2503")} Local `;
|
|
55
55
|
const networkPrefix = `${dim("\u2503")} Network `;
|
|
56
56
|
const emptyPrefix = " ".repeat(11);
|
|
@@ -235,7 +235,7 @@ function printHelp({
|
|
|
235
235
|
message.push(
|
|
236
236
|
linebreak(),
|
|
237
237
|
` ${bgGreen(black(` ${commandName} `))} ${green(
|
|
238
|
-
`v${"3.0.
|
|
238
|
+
`v${"3.0.5"}`
|
|
239
239
|
)} ${headline}`
|
|
240
240
|
);
|
|
241
241
|
}
|
|
@@ -40,6 +40,7 @@ async function runHookConfigSetup({
|
|
|
40
40
|
let updatedConfig = { ...settings.config };
|
|
41
41
|
let updatedSettings = { ...settings, config: updatedConfig };
|
|
42
42
|
let addedClientDirectives = /* @__PURE__ */ new Map();
|
|
43
|
+
let astroJSXRenderer = null;
|
|
43
44
|
for (const integration of settings.config.integrations) {
|
|
44
45
|
if (integration.hooks?.["astro:config:setup"]) {
|
|
45
46
|
let addPageExtension2 = function(...input) {
|
|
@@ -63,7 +64,11 @@ async function runHookConfigSetup({
|
|
|
63
64
|
if (!renderer.serverEntrypoint) {
|
|
64
65
|
throw new Error(`Renderer ${bold(renderer.name)} does not provide a serverEntrypoint.`);
|
|
65
66
|
}
|
|
66
|
-
|
|
67
|
+
if (renderer.name === "astro:jsx") {
|
|
68
|
+
astroJSXRenderer = renderer;
|
|
69
|
+
} else {
|
|
70
|
+
updatedSettings.renderers.push(renderer);
|
|
71
|
+
}
|
|
67
72
|
},
|
|
68
73
|
injectScript: (stage, content) => {
|
|
69
74
|
updatedSettings.scripts.push({ stage, content });
|
|
@@ -112,6 +117,9 @@ async function runHookConfigSetup({
|
|
|
112
117
|
}
|
|
113
118
|
}
|
|
114
119
|
}
|
|
120
|
+
if (astroJSXRenderer) {
|
|
121
|
+
updatedSettings.renderers.push(astroJSXRenderer);
|
|
122
|
+
}
|
|
115
123
|
updatedSettings.config = updatedConfig;
|
|
116
124
|
return updatedSettings;
|
|
117
125
|
}
|