astro 4.8.6 → 4.9.0
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/astro-jsx.d.ts +1 -1
- package/dist/@types/astro.d.ts +43 -96
- package/dist/actions/runtime/middleware.d.ts +1 -0
- package/dist/actions/runtime/middleware.js +44 -12
- package/dist/actions/runtime/route.js +1 -2
- package/dist/actions/runtime/utils.d.ts +6 -1
- package/dist/actions/runtime/utils.js +2 -1
- package/dist/actions/runtime/virtual/server.d.ts +4 -2
- package/dist/actions/runtime/virtual/server.js +9 -11
- package/dist/actions/utils.d.ts +2 -0
- package/dist/actions/utils.js +2 -1
- package/dist/container/index.d.ts +162 -0
- package/dist/container/index.js +234 -0
- package/dist/container/pipeline.d.ts +11 -0
- package/dist/container/pipeline.js +96 -0
- package/dist/core/app/node.js +4 -1
- package/dist/core/build/consts.d.ts +1 -0
- package/dist/core/build/consts.js +3 -1
- package/dist/core/build/generate.js +3 -3
- package/dist/core/build/index.js +2 -2
- package/dist/core/build/plugins/plugin-content.d.ts +1 -1
- package/dist/core/build/plugins/plugin-content.js +13 -2
- package/dist/core/build/plugins/plugin-manifest.js +2 -2
- package/dist/core/build/static-build.d.ts +2 -1
- package/dist/core/build/static-build.js +7 -6
- package/dist/core/config/schema.d.ts +92 -120
- package/dist/core/config/schema.js +18 -23
- package/dist/core/constants.js +1 -1
- package/dist/core/dev/dev.js +1 -1
- package/dist/core/messages.js +2 -2
- package/dist/core/render-context.d.ts +1 -1
- package/dist/core/render-context.js +6 -3
- package/dist/core/routing/manifest/create.d.ts +4 -1
- package/dist/core/routing/manifest/create.js +10 -8
- package/dist/i18n/utils.d.ts +1 -1
- package/dist/integrations/features-validation.js +1 -1
- package/dist/runtime/client/dev-toolbar/apps/utils/highlight.js +2 -0
- package/dist/runtime/server/jsx.js +1 -0
- package/dist/vite-plugin-astro-server/plugin.d.ts +0 -1
- package/dist/vite-plugin-astro-server/plugin.js +1 -1
- package/package.json +7 -3
- package/templates/actions.mjs +37 -12
|
@@ -50,6 +50,8 @@ function attachTooltipToHighlight(highlight, tooltip, originalElement) {
|
|
|
50
50
|
}
|
|
51
51
|
if (dialogRect.right > document.documentElement.clientWidth) {
|
|
52
52
|
tooltip.style.right = "0px";
|
|
53
|
+
} else if (dialogRect.left < 0) {
|
|
54
|
+
tooltip.style.left = "0px";
|
|
53
55
|
}
|
|
54
56
|
});
|
|
55
57
|
});
|
|
@@ -84,6 +84,7 @@ Did you forget to import the component or is it possible there is a typo?`);
|
|
|
84
84
|
}
|
|
85
85
|
if (typeof vnode.type === "function") {
|
|
86
86
|
if (vnode.props[hasTriedRenderComponentSymbol]) {
|
|
87
|
+
delete vnode.props[hasTriedRenderComponentSymbol];
|
|
87
88
|
const output2 = await vnode.type(vnode.props ?? {});
|
|
88
89
|
if (output2?.[AstroJSX] || !output2) {
|
|
89
90
|
return await renderJSXVNode(result, output2);
|
|
@@ -14,6 +14,5 @@ export default function createVitePluginAstroServer({ settings, logger, fs: fsMo
|
|
|
14
14
|
*
|
|
15
15
|
* Renderers needs to be pulled out from the page module emitted during the build.
|
|
16
16
|
* @param settings
|
|
17
|
-
* @param renderers
|
|
18
17
|
*/
|
|
19
18
|
export declare function createDevelopmentManifest(settings: AstroSettings): SSRManifest;
|
|
@@ -113,7 +113,7 @@ function createDevelopmentManifest(settings) {
|
|
|
113
113
|
componentMetadata: /* @__PURE__ */ new Map(),
|
|
114
114
|
inlinedScripts: /* @__PURE__ */ new Map(),
|
|
115
115
|
i18n: i18nManifest,
|
|
116
|
-
checkOrigin: settings.config.
|
|
116
|
+
checkOrigin: settings.config.security?.checkOrigin ?? false,
|
|
117
117
|
rewritingEnabled: settings.config.experimental.rewriting,
|
|
118
118
|
middleware(_, next) {
|
|
119
119
|
return next();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "astro",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.9.0",
|
|
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",
|
|
@@ -48,6 +48,10 @@
|
|
|
48
48
|
"types": "./config.d.ts",
|
|
49
49
|
"default": "./config.mjs"
|
|
50
50
|
},
|
|
51
|
+
"./container": {
|
|
52
|
+
"types": "./dist/container/index.d.ts",
|
|
53
|
+
"default": "./dist/container/index.js"
|
|
54
|
+
},
|
|
51
55
|
"./app": "./dist/core/app/index.js",
|
|
52
56
|
"./app/node": "./dist/core/app/node.js",
|
|
53
57
|
"./client/*": "./dist/runtime/client/*",
|
|
@@ -166,8 +170,8 @@
|
|
|
166
170
|
"zod": "^3.23.8",
|
|
167
171
|
"zod-to-json-schema": "^3.23.0",
|
|
168
172
|
"@astrojs/internal-helpers": "0.4.0",
|
|
169
|
-
"@astrojs/
|
|
170
|
-
"@astrojs/
|
|
173
|
+
"@astrojs/telemetry": "3.1.0",
|
|
174
|
+
"@astrojs/markdown-remark": "5.1.0"
|
|
171
175
|
},
|
|
172
176
|
"optionalDependencies": {
|
|
173
177
|
"sharp": "^0.33.3"
|
package/templates/actions.mjs
CHANGED
|
@@ -7,11 +7,33 @@ function toActionProxy(actionCallback = {}, aggregatedPath = '/_actions/') {
|
|
|
7
7
|
return target[objKey];
|
|
8
8
|
}
|
|
9
9
|
const path = aggregatedPath + objKey.toString();
|
|
10
|
-
const action = (
|
|
10
|
+
const action = (param) => actionHandler(param, path);
|
|
11
11
|
action.toString = () => path;
|
|
12
12
|
action.safe = (input) => {
|
|
13
13
|
return callSafely(() => action(input));
|
|
14
14
|
};
|
|
15
|
+
action.safe.toString = () => path;
|
|
16
|
+
|
|
17
|
+
// Add progressive enhancement info for React.
|
|
18
|
+
action.$$FORM_ACTION = function () {
|
|
19
|
+
const data = new FormData();
|
|
20
|
+
data.set('_astroAction', action.toString());
|
|
21
|
+
return {
|
|
22
|
+
method: 'POST',
|
|
23
|
+
name: action.toString(),
|
|
24
|
+
data,
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
action.safe.$$FORM_ACTION = function () {
|
|
28
|
+
const data = new FormData();
|
|
29
|
+
data.set('_astroAction', action.toString());
|
|
30
|
+
data.set('_astroActionSafe', 'true');
|
|
31
|
+
return {
|
|
32
|
+
method: 'POST',
|
|
33
|
+
name: action.toString(),
|
|
34
|
+
data,
|
|
35
|
+
};
|
|
36
|
+
};
|
|
15
37
|
// recurse to construct queries for nested object paths
|
|
16
38
|
// ex. actions.user.admins.auth()
|
|
17
39
|
return toActionProxy(action, path + '.');
|
|
@@ -20,24 +42,27 @@ function toActionProxy(actionCallback = {}, aggregatedPath = '/_actions/') {
|
|
|
20
42
|
}
|
|
21
43
|
|
|
22
44
|
/**
|
|
23
|
-
* @param {*}
|
|
24
|
-
* @param {string} path Built path to call action
|
|
25
|
-
* Usage: `actions.[name](
|
|
45
|
+
* @param {*} param argument passed to the action when called server or client-side.
|
|
46
|
+
* @param {string} path Built path to call action by path name.
|
|
47
|
+
* Usage: `actions.[name](param)`.
|
|
26
48
|
*/
|
|
27
|
-
async function actionHandler(
|
|
49
|
+
async function actionHandler(param, path) {
|
|
50
|
+
// When running server-side, import the action and call it.
|
|
28
51
|
if (import.meta.env.SSR) {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
52
|
+
const { getAction } = await import('astro/actions/runtime/utils.js');
|
|
53
|
+
const action = await getAction(path);
|
|
54
|
+
if (!action) throw new Error(`Action not found: ${path}`);
|
|
55
|
+
|
|
56
|
+
return action(param);
|
|
34
57
|
}
|
|
58
|
+
|
|
59
|
+
// When running client-side, make a fetch request to the action path.
|
|
35
60
|
const headers = new Headers();
|
|
36
61
|
headers.set('Accept', 'application/json');
|
|
37
|
-
let body =
|
|
62
|
+
let body = param;
|
|
38
63
|
if (!(body instanceof FormData)) {
|
|
39
64
|
try {
|
|
40
|
-
body =
|
|
65
|
+
body = param ? JSON.stringify(param) : undefined;
|
|
41
66
|
} catch (e) {
|
|
42
67
|
throw new ActionError({
|
|
43
68
|
code: 'BAD_REQUEST',
|