full site update
This commit is contained in:
38
node_modules/astro/dist/actions/plugins.js
generated
vendored
38
node_modules/astro/dist/actions/plugins.js
generated
vendored
@@ -1,8 +1,11 @@
|
||||
import { addRollupInput } from "../core/build/add-rollup-input.js";
|
||||
import { shouldAppendForwardSlash } from "../core/build/util.js";
|
||||
import { getServerOutputDirectory } from "../prerender/utils.js";
|
||||
import {
|
||||
ASTRO_ACTIONS_INTERNAL_MODULE_ID,
|
||||
NOOP_ACTIONS,
|
||||
RESOLVED_VIRTUAL_INTERNAL_MODULE_ID,
|
||||
RESOLVED_ASTRO_ACTIONS_INTERNAL_MODULE_ID,
|
||||
RESOLVED_VIRTUAL_MODULE_ID,
|
||||
VIRTUAL_INTERNAL_MODULE_ID,
|
||||
VIRTUAL_MODULE_ID
|
||||
} from "./consts.js";
|
||||
import { isActionsFilePresent } from "./utils.js";
|
||||
@@ -14,7 +17,7 @@ function vitePluginUserActions({ settings }) {
|
||||
if (id === NOOP_ACTIONS) {
|
||||
return NOOP_ACTIONS;
|
||||
}
|
||||
if (id === VIRTUAL_INTERNAL_MODULE_ID) {
|
||||
if (id === ASTRO_ACTIONS_INTERNAL_MODULE_ID) {
|
||||
const resolvedModule = await this.resolve(
|
||||
`${decodeURI(new URL("actions", settings.config.srcDir).pathname)}`
|
||||
);
|
||||
@@ -22,18 +25,34 @@ function vitePluginUserActions({ settings }) {
|
||||
return NOOP_ACTIONS;
|
||||
}
|
||||
resolvedActionsId = resolvedModule.id;
|
||||
return RESOLVED_VIRTUAL_INTERNAL_MODULE_ID;
|
||||
return RESOLVED_ASTRO_ACTIONS_INTERNAL_MODULE_ID;
|
||||
}
|
||||
},
|
||||
load(id) {
|
||||
if (id === NOOP_ACTIONS) {
|
||||
return "export const server = {}";
|
||||
} else if (id === RESOLVED_VIRTUAL_INTERNAL_MODULE_ID) {
|
||||
} else if (id === RESOLVED_ASTRO_ACTIONS_INTERNAL_MODULE_ID) {
|
||||
return `export { server } from '${resolvedActionsId}';`;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
function vitePluginActionsBuild(opts, internals) {
|
||||
return {
|
||||
name: "@astro/plugin-actions-build",
|
||||
options(options) {
|
||||
return addRollupInput(options, [ASTRO_ACTIONS_INTERNAL_MODULE_ID]);
|
||||
},
|
||||
writeBundle(_, bundle) {
|
||||
for (const [chunkName, chunk] of Object.entries(bundle)) {
|
||||
if (chunk.type !== "asset" && chunk.facadeModuleId === RESOLVED_ASTRO_ACTIONS_INTERNAL_MODULE_ID) {
|
||||
const outputDirectory = getServerOutputDirectory(opts.settings);
|
||||
internals.astroActionsEntryPoint = new URL(chunkName, outputDirectory);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
function vitePluginActions({
|
||||
fs,
|
||||
settings
|
||||
@@ -70,11 +89,18 @@ export * from 'astro/actions/runtime/virtual/server.js';`;
|
||||
code += `
|
||||
export * from 'astro/actions/runtime/virtual/client.js';`;
|
||||
}
|
||||
return code;
|
||||
code = code.replace(
|
||||
"'/** @TRAILING_SLASH@ **/'",
|
||||
JSON.stringify(
|
||||
shouldAppendForwardSlash(settings.config.trailingSlash, settings.config.build.format)
|
||||
)
|
||||
);
|
||||
return { code };
|
||||
}
|
||||
};
|
||||
}
|
||||
export {
|
||||
vitePluginActions,
|
||||
vitePluginActionsBuild,
|
||||
vitePluginUserActions
|
||||
};
|
||||
|
Reference in New Issue
Block a user