mirror of
https://github.com/withastro/astro.git
synced 2024-12-16 21:46:22 -05:00
[ci] format
This commit is contained in:
parent
4161a2a3d0
commit
d8fe43fa23
2 changed files with 5 additions and 6 deletions
|
@ -1,16 +1,17 @@
|
|||
import { mkdir, readFile, writeFile } from 'node:fs/promises';
|
||||
import type { Plugin as VitePlugin } from 'vite';
|
||||
import type { AstroIntegration } from '../@types/astro.js';
|
||||
import { ACTIONS_TYPES_FILE, RESOLVED_VIRTUAL_MODULE_ID, VIRTUAL_MODULE_ID } from './consts.js';
|
||||
import { viteID } from '../core/util.js';
|
||||
|
||||
import { ACTIONS_TYPES_FILE, RESOLVED_VIRTUAL_MODULE_ID, VIRTUAL_MODULE_ID } from './consts.js';
|
||||
|
||||
export default function astroActions(): AstroIntegration {
|
||||
return {
|
||||
name: VIRTUAL_MODULE_ID,
|
||||
hooks: {
|
||||
async 'astro:config:setup'(params) {
|
||||
const stringifiedActionsImport = JSON.stringify(viteID(new URL('./actions', params.config.srcDir)));
|
||||
const stringifiedActionsImport = JSON.stringify(
|
||||
viteID(new URL('./actions', params.config.srcDir))
|
||||
);
|
||||
params.updateConfig({
|
||||
vite: {
|
||||
define: {
|
||||
|
|
|
@ -81,9 +81,7 @@ export async function matchRoute(
|
|||
// Try without `.html` extensions or `index.html` in request URLs to mimic
|
||||
// routing behavior in production builds. This supports both file and directory
|
||||
// build formats, and is necessary based on how the manifest tracks build targets.
|
||||
const altPathname = pathname
|
||||
.replace(/\/index\.html$/, '/')
|
||||
.replace(/\.html$/, '');
|
||||
const altPathname = pathname.replace(/\/index\.html$/, '/').replace(/\.html$/, '');
|
||||
|
||||
if (altPathname !== pathname) {
|
||||
return await matchRoute(altPathname, manifestData, pipeline);
|
||||
|
|
Loading…
Reference in a new issue