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
992537e79f
commit
69ce70bb24
3 changed files with 10 additions and 8 deletions
|
@ -16,8 +16,8 @@ import {
|
||||||
mergeInlineCss,
|
mergeInlineCss,
|
||||||
} from './internal.js';
|
} from './internal.js';
|
||||||
import { ASTRO_PAGE_MODULE_ID, ASTRO_PAGE_RESOLVED_MODULE_ID } from './plugins/plugin-pages.js';
|
import { ASTRO_PAGE_MODULE_ID, ASTRO_PAGE_RESOLVED_MODULE_ID } from './plugins/plugin-pages.js';
|
||||||
import { getVirtualModulePageNameFromPath } from './plugins/util.js';
|
|
||||||
import { RESOLVED_SPLIT_MODULE_ID } from './plugins/plugin-ssr.js';
|
import { RESOLVED_SPLIT_MODULE_ID } from './plugins/plugin-ssr.js';
|
||||||
|
import { getVirtualModulePageNameFromPath } from './plugins/util.js';
|
||||||
import { ASTRO_PAGE_EXTENSION_POST_PATTERN } from './plugins/util.js';
|
import { ASTRO_PAGE_EXTENSION_POST_PATTERN } from './plugins/util.js';
|
||||||
import type { PageBuildData, StaticBuildOptions } from './types.js';
|
import type { PageBuildData, StaticBuildOptions } from './types.js';
|
||||||
import { i18nHasFallback } from './util.js';
|
import { i18nHasFallback } from './util.js';
|
||||||
|
|
|
@ -54,10 +54,12 @@ export const ASTRO_PAGE_EXTENSION_POST_PATTERN = '@_@';
|
||||||
*/
|
*/
|
||||||
export function getVirtualModulePageNameFromPath(virtualModulePrefix: string, path: string) {
|
export function getVirtualModulePageNameFromPath(virtualModulePrefix: string, path: string) {
|
||||||
const extension = extname(path);
|
const extension = extname(path);
|
||||||
return virtualModulePrefix +
|
return (
|
||||||
|
virtualModulePrefix +
|
||||||
(extension.startsWith('.')
|
(extension.startsWith('.')
|
||||||
? path.slice(0, -extension.length) + extension.replace('.', ASTRO_PAGE_EXTENSION_POST_PATTERN)
|
? path.slice(0, -extension.length) + extension.replace('.', ASTRO_PAGE_EXTENSION_POST_PATTERN)
|
||||||
: path);
|
: path)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import assert from 'node:assert/strict';
|
import assert from 'node:assert/strict';
|
||||||
|
import { mkdirSync, writeFileSync } from 'node:fs';
|
||||||
|
import { dirname } from 'node:path';
|
||||||
import { before, describe, it } from 'node:test';
|
import { before, describe, it } from 'node:test';
|
||||||
|
import { fileURLToPath } from 'node:url';
|
||||||
import { load as cheerioLoad } from 'cheerio';
|
import { load as cheerioLoad } from 'cheerio';
|
||||||
import testAdapter from './test-adapter.js';
|
import testAdapter from './test-adapter.js';
|
||||||
import { loadFixture } from './test-utils.js';
|
import { loadFixture } from './test-utils.js';
|
||||||
import { dirname } from 'node:path';
|
|
||||||
import { fileURLToPath } from 'node:url';
|
|
||||||
import { mkdirSync, writeFileSync } from 'node:fs';
|
|
||||||
|
|
||||||
describe('Dynamic pages in SSR', () => {
|
describe('Dynamic pages in SSR', () => {
|
||||||
/** @type {import('./test-utils').Fixture} */
|
/** @type {import('./test-utils').Fixture} */
|
||||||
|
@ -29,7 +29,7 @@ describe('Dynamic pages in SSR', () => {
|
||||||
const entrypoint = fileURLToPath(
|
const entrypoint = fileURLToPath(
|
||||||
new URL(`${root}.astro/test.astro`, import.meta.url)
|
new URL(`${root}.astro/test.astro`, import.meta.url)
|
||||||
);
|
);
|
||||||
console.log(entrypoint)
|
console.log(entrypoint);
|
||||||
mkdirSync(dirname(entrypoint), { recursive: true });
|
mkdirSync(dirname(entrypoint), { recursive: true });
|
||||||
writeFileSync(entrypoint, '<h1>Index</h1>');
|
writeFileSync(entrypoint, '<h1>Index</h1>');
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue