[ci] format

This commit is contained in:
matthewp 2022-04-19 15:23:07 +00:00 committed by github-actions[bot]
parent 4cf54c60aa
commit 13b1bdd972
7 changed files with 38 additions and 42 deletions

View file

@ -1,8 +1,3 @@
export { export { netlifyFunctions, netlifyFunctions as default } from './integration-functions.js';
netlifyFunctions,
netlifyFunctions as default
} from './integration-functions.js';
export { export { netlifyEdgeFunctions } from './integration-edge-functions.js';
netlifyEdgeFunctions
} from './integration-edge-functions.js';

View file

@ -23,7 +23,9 @@ interface NetlifyEdgeFunctionManifestFunctionPattern {
pattern: string; pattern: string;
} }
type NetlifyEdgeFunctionManifestFunction = NetlifyEdgeFunctionManifestFunctionPath | NetlifyEdgeFunctionManifestFunctionPattern; type NetlifyEdgeFunctionManifestFunction =
| NetlifyEdgeFunctionManifestFunctionPath
| NetlifyEdgeFunctionManifestFunctionPattern;
interface NetlifyEdgeFunctionManifest { interface NetlifyEdgeFunctionManifest {
functions: NetlifyEdgeFunctionManifestFunction[]; functions: NetlifyEdgeFunctionManifestFunction[];
@ -36,19 +38,19 @@ async function createEdgeManifest(routes: RouteData[], entryFile: string, dir: U
if (route.pathname) { if (route.pathname) {
functions.push({ functions.push({
function: entryFile, function: entryFile,
path: route.pathname path: route.pathname,
}); });
} else { } else {
functions.push({ functions.push({
function: entryFile, function: entryFile,
pattern: route.pattern.source pattern: route.pattern.source,
}); });
} }
} }
const manifest: NetlifyEdgeFunctionManifest = { const manifest: NetlifyEdgeFunctionManifest = {
functions, functions,
version: 1 version: 1,
}; };
const manifestURL = new URL('./manifest.json', dir); const manifestURL = new URL('./manifest.json', dir);
@ -86,13 +88,10 @@ export function netlifyEdgeFunctions({ dist }: NetlifyEdgeFunctionsOptions = {})
} }
}, },
'astro:build:done': async ({ routes, dir }) => { 'astro:build:done': async ({ routes, dir }) => {
await createEdgeManifest(routes, entryFile, new URL('./edge-functions/', dir)); await createEdgeManifest(routes, entryFile, new URL('./edge-functions/', dir));
}, },
}, },
}; };
} }
export { export { netlifyEdgeFunctions as default };
netlifyEdgeFunctions as default
}

View file

@ -12,9 +12,9 @@ export function createExports(manifest: SSRManifest) {
return new Response(null, { return new Response(null, {
status: 404, status: 404,
statusText: 'Not found' statusText: 'Not found',
}); });
}; };
return { 'default': handler }; return { default: handler };
} }

View file

@ -8,7 +8,9 @@ Deno.test({
name: 'Edge Basics', name: 'Edge Basics',
async fn() { async fn() {
let close = await runBuild('./fixtures/edge-basic/'); let close = await runBuild('./fixtures/edge-basic/');
const { default: handler } = await import('./fixtures/edge-basic/dist/edge-functions/entry.mjs'); const { default: handler } = await import(
'./fixtures/edge-basic/dist/edge-functions/entry.mjs'
);
const response = await handler(new Request('http://example.com/')); const response = await handler(new Request('http://example.com/'));
assertEquals(response.status, 200); assertEquals(response.status, 200);
const html = await response.text(); const html = await response.text();

View file

@ -18,7 +18,7 @@ describe('Cookies', () => {
dist: new URL('./fixtures/cookies/dist/', import.meta.url), dist: new URL('./fixtures/cookies/dist/', import.meta.url),
}), }),
site: `http://example.com`, site: `http://example.com`,
integrations: [ testIntegration() ] integrations: [testIntegration()],
}); });
await fixture.build(); await fixture.build();
}); });

View file

@ -16,7 +16,7 @@ describe('Dynamic pages', () => {
dist: new URL('./fixtures/dynamic-route/dist/', import.meta.url), dist: new URL('./fixtures/dynamic-route/dist/', import.meta.url),
}), }),
site: `http://example.com`, site: `http://example.com`,
integrations: [ testIntegration() ] integrations: [testIntegration()],
}); });
await fixture.build(); await fixture.build();
}); });

View file

@ -23,7 +23,7 @@ export function testIntegration() {
}, },
}, },
}); });
} },
} },
}; };
} }