Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/calm-bottles-bathe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'astro': patch
---

Fixes a regression that caused Actions to throw errors while loading
1 change: 1 addition & 0 deletions packages/astro/src/actions/consts.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export const ACTIONS_TYPES_FILE = 'actions.d.ts';

export const VIRTUAL_MODULE_ID = 'astro:actions';
export const RESOLVED_VIRTUAL_MODULE_ID = '\0' + VIRTUAL_MODULE_ID;

/** Used to expose shared utilities, with server or client specific implementations */
export const RUNTIME_VIRTUAL_MODULE_ID = 'virtual:astro:actions/runtime';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { shouldAppendTrailingSlash } from 'virtual:astro:actions/options';
import type { ActionClient, SafeResult } from '../actions/runtime/server.js';
import type { APIContext } from '../../types/public/context.js';
import type { ActionClient, SafeResult } from './server.js';
import {
ACTION_QUERY_PARAMS,
ActionError,
appendForwardSlash,
astroCalledServerError,
deserializeActionResult,
getActionQueryString,
} from '../actions/runtime/shared.js';
import type { APIContext } from '../types/public/context.js';
} from './shared.js';

export * from 'virtual:astro:actions/runtime';

Expand Down
7 changes: 6 additions & 1 deletion packages/astro/src/actions/vite-plugin-actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
RESOLVED_NOOP_ENTRYPOINT_VIRTUAL_MODULE_ID,
RESOLVED_OPTIONS_VIRTUAL_MODULE_ID,
RESOLVED_RUNTIME_VIRTUAL_MODULE_ID,
RESOLVED_VIRTUAL_MODULE_ID,
RUNTIME_VIRTUAL_MODULE_ID,
VIRTUAL_MODULE_ID,
} from './consts.js';
Expand Down Expand Up @@ -62,7 +63,7 @@ export function vitePluginActions({
enforce: 'pre',
async resolveId(id) {
if (id === VIRTUAL_MODULE_ID) {
return this.resolve('astro/virtual-modules/actions.js');
return RESOLVED_VIRTUAL_MODULE_ID
}

if (id === RUNTIME_VIRTUAL_MODULE_ID) {
Expand Down Expand Up @@ -99,6 +100,10 @@ export function vitePluginActions({
server.watcher.on('change', watcherCallback);
},
async load(id, opts) {
if (id === RESOLVED_VIRTUAL_MODULE_ID) {
return { code: `export * from 'astro/actions/runtime/virtual.js';` }
}

if (id === RESOLVED_NOOP_ENTRYPOINT_VIRTUAL_MODULE_ID) {
return { code: 'export const server = {}' };
}
Expand Down
Loading