[ci] format

This commit is contained in:
matthewp 2022-04-22 14:04:54 +00:00 committed by github-actions[bot]
parent bd76716c88
commit 738fb958c3
4 changed files with 12 additions and 11 deletions

View file

@ -74,12 +74,10 @@ if(_start in adapter) {
const manifest = buildManifest(buildOpts, internals, staticFiles); const manifest = buildManifest(buildOpts, internals, staticFiles);
for (const [_chunkName, chunk] of Object.entries(bundle)) { for (const [_chunkName, chunk] of Object.entries(bundle)) {
if (chunk.type === 'asset') { if (chunk.type === 'asset') {
continue; continue;
}; }
if (chunk.modules[resolvedVirtualModuleId]) { if (chunk.modules[resolvedVirtualModuleId]) {
const code = chunk.code; const code = chunk.code;
chunk.code = code.replace(replaceExp, () => { chunk.code = code.replace(replaceExp, () => {
@ -91,7 +89,11 @@ if(_start in adapter) {
}; };
} }
function buildManifest(opts: StaticBuildOptions, internals: BuildInternals, staticFiles: string[]): SerializedSSRManifest { function buildManifest(
opts: StaticBuildOptions,
internals: BuildInternals,
staticFiles: string[]
): SerializedSSRManifest {
const { astroConfig } = opts; const { astroConfig } = opts;
const routes: SerializedRouteInfo[] = []; const routes: SerializedRouteInfo[] = [];
@ -122,7 +124,7 @@ function buildManifest(opts: StaticBuildOptions, internals: BuildInternals, stat
pageMap: null as any, pageMap: null as any,
renderers: [], renderers: [],
entryModules, entryModules,
assets: staticFiles.map(s => '/' + s) assets: staticFiles.map((s) => '/' + s),
}; };
return ssrManifest; return ssrManifest;

View file

@ -10,7 +10,7 @@ export function createExports(manifest: SSRManifest) {
// If this matches a static asset, just return and Netlify will forward it // If this matches a static asset, just return and Netlify will forward it
// to its static asset handler. // to its static asset handler.
if(manifest.assets.has(url.pathname)) { if (manifest.assets.has(url.pathname)) {
return; return;
} }
if (app.match(request)) { if (app.match(request)) {

View file

@ -8,7 +8,9 @@ Deno.test({
name: 'Assets are preferred over HTML routes', name: 'Assets are preferred over HTML routes',
async fn() { async fn() {
let close = await runBuild('./fixtures/root-dynamic/'); let close = await runBuild('./fixtures/root-dynamic/');
const { default: handler } = await import('./fixtures/root-dynamic/dist/edge-functions/entry.js'); const { default: handler } = await import(
'./fixtures/root-dynamic/dist/edge-functions/entry.js'
);
const response = await handler(new Request('http://example.com/styles.css')); const response = await handler(new Request('http://example.com/styles.css'));
assertEquals(response, undefined, 'No response because this is an asset'); assertEquals(response, undefined, 'No response because this is an asset');
await close(); await close();

View file

@ -6,9 +6,6 @@
"module": "ES2020", "module": "ES2020",
"outDir": "./dist", "outDir": "./dist",
"target": "ES2020", "target": "ES2020",
"typeRoots": [ "typeRoots": ["node_modules/@types", "node_modules/@netlify"]
"node_modules/@types",
"node_modules/@netlify"
]
} }
} }