[ci] format
This commit is contained in:
parent
ef5cea4dc5
commit
241c178354
5 changed files with 12 additions and 10 deletions
|
@ -62,12 +62,16 @@ export { _default as default };`;
|
||||||
: ''
|
: ''
|
||||||
}
|
}
|
||||||
export const adapter = _adapter
|
export const adapter = _adapter
|
||||||
${adapter.name !== '@astrojs/deno' ? `
|
${
|
||||||
|
adapter.name !== '@astrojs/deno'
|
||||||
|
? `
|
||||||
const _start = 'start';
|
const _start = 'start';
|
||||||
if(_start in _adapter) {
|
if(_start in _adapter) {
|
||||||
_adapter[_start](_manifest, _args);
|
_adapter[_start](_manifest, _args);
|
||||||
}`: ''}`;
|
}`
|
||||||
}
|
: ''
|
||||||
|
}`;
|
||||||
|
}
|
||||||
return void 0;
|
return void 0;
|
||||||
},
|
},
|
||||||
async generateBundle(_opts, bundle) {
|
async generateBundle(_opts, bundle) {
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
export const DEFAULTIMPORT = `import { Server } from "https://deno.land/std@0.167.0/http/server.ts"; \n import { fetch } from "https://deno.land/x/file_fetch/mod.ts";\nimport { fileExtension } from "https://deno.land/x/file_extension@v2.1.0/mod.ts";`
|
export const DEFAULTIMPORT = `import { Server } from "https://deno.land/std@0.167.0/http/server.ts"; \n import { fetch } from "https://deno.land/x/file_fetch/mod.ts";\nimport { fileExtension } from "https://deno.land/x/file_extension@v2.1.0/mod.ts";`;
|
||||||
export const DEFAULTSTART = `const _start = 'start'; \n if(_start in adapter) { \nadapter[_start](_manifest, _args);}`
|
export const DEFAULTSTART = `const _start = 'start'; \n if(_start in adapter) { \nadapter[_start](_manifest, _args);}`;
|
||||||
|
|
|
@ -3,7 +3,7 @@ import esbuild from 'esbuild';
|
||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
import * as npath from 'path';
|
import * as npath from 'path';
|
||||||
import { fileURLToPath } from 'url';
|
import { fileURLToPath } from 'url';
|
||||||
import * as CONSTANT from './code-constant'
|
import * as CONSTANT from './code-constant';
|
||||||
|
|
||||||
interface BuildConfig {
|
interface BuildConfig {
|
||||||
server: URL;
|
server: URL;
|
||||||
|
@ -71,7 +71,7 @@ export default function createIntegration(args?: Options): AstroIntegration {
|
||||||
'astro:build:done': async () => {
|
'astro:build:done': async () => {
|
||||||
const entryUrl = new URL(_buildConfig.serverEntry, _buildConfig.server);
|
const entryUrl = new URL(_buildConfig.serverEntry, _buildConfig.server);
|
||||||
const pth = fileURLToPath(entryUrl);
|
const pth = fileURLToPath(entryUrl);
|
||||||
const content = await fs.readFileSync(pth, 'utf8')
|
const content = await fs.readFileSync(pth, 'utf8');
|
||||||
await fs.writeFileSync(pth, `${CONSTANT.DEFAULTIMPORT}${content}${CONSTANT.DEFAULTSTART}`);
|
await fs.writeFileSync(pth, `${CONSTANT.DEFAULTIMPORT}${content}${CONSTANT.DEFAULTSTART}`);
|
||||||
await esbuild.build({
|
await esbuild.build({
|
||||||
target: 'es2020',
|
target: 'es2020',
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
import type { SSRManifest } from 'astro';
|
import type { SSRManifest } from 'astro';
|
||||||
import { App } from 'astro/app';
|
import { App } from 'astro/app';
|
||||||
|
|
||||||
|
|
||||||
interface Options {
|
interface Options {
|
||||||
port?: number;
|
port?: number;
|
||||||
hostname?: string;
|
hostname?: string;
|
||||||
|
@ -49,7 +48,7 @@ export function start(manifest: SSRManifest, options: Options) {
|
||||||
}`
|
}`
|
||||||
: stringLocalPath
|
: stringLocalPath
|
||||||
);
|
);
|
||||||
|
|
||||||
// If the static file can't be found
|
// If the static file can't be found
|
||||||
if (fileResp.status == 404) {
|
if (fileResp.status == 404) {
|
||||||
// Render the astro custom 404 page
|
// Render the astro custom 404 page
|
||||||
|
|
|
@ -152,7 +152,6 @@ Deno.test({
|
||||||
const resp = await fetch(new URL('perendering', baseUrl));
|
const resp = await fetch(new URL('perendering', baseUrl));
|
||||||
assertEquals(resp.status, 200);
|
assertEquals(resp.status, 200);
|
||||||
|
|
||||||
|
|
||||||
const html = await resp.text();
|
const html = await resp.text();
|
||||||
assert(html);
|
assert(html);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue