[ci] format

This commit is contained in:
matthewp 2022-07-18 15:35:14 +00:00 committed by fredkbot
parent 3acb9ec264
commit b282cdb21f
6 changed files with 71 additions and 65 deletions

View file

@ -16,8 +16,8 @@ import { render as coreRender } from '../core.js';
import { RouteCache } from '../route-cache.js';
import { collectMdMetadata } from '../util.js';
import { getStylesForURL } from './css.js';
import { getScriptsForURL } from './scripts.js';
import { resolveClientDevPath } from './resolve.js';
import { getScriptsForURL } from './scripts.js';
export interface SSROptions {
/** an instance of the AstroConfig */

View file

@ -1,17 +1,17 @@
import type { AstroConfig, SSRElement } from '../../../@types/astro';
import type { ModuleInfo } from 'rollup';
import type { PluginMetadata as AstroPluginMetadata } from '../../../vite-plugin-astro/types';
import vite from 'vite';
import slash from 'slash';
import { fileURLToPath } from 'url';
import vite from 'vite';
import type { AstroConfig, SSRElement } from '../../../@types/astro';
import type { PluginMetadata as AstroPluginMetadata } from '../../../vite-plugin-astro/types';
import { viteID } from '../../util.js';
import { createModuleScriptElementWithSrc } from '../ssr-element.js';
import { crawlGraph } from './vite.js';
import { fileURLToPath } from 'url';
export async function getScriptsForURL(
filePath: URL,
astroConfig: AstroConfig,
viteServer: vite.ViteDevServer,
viteServer: vite.ViteDevServer
): Promise<Set<SSRElement>> {
const elements = new Set<SSRElement>();
const rootID = viteID(filePath);
@ -29,7 +29,11 @@ export async function getScriptsForURL(
return elements;
}
function addHoistedScripts(set: Set<SSRElement>, info: ModuleInfo | null, rootProjectFolder: string) {
function addHoistedScripts(
set: Set<SSRElement>,
info: ModuleInfo | null,
rootProjectFolder: string
) {
if (!info?.meta?.astro) {
return;
}

View file

@ -1,5 +1,5 @@
import vite from 'vite';
import npath from 'path';
import vite from 'vite';
import { unwrapId } from '../../util.js';
/**

View file

@ -135,10 +135,12 @@ describe('Scripts (hoisted and not)', () => {
let found = 0;
let moduleScripts = $('[type=module]');
moduleScripts.each((i, el) => {
if($(el).attr('src').includes('Glob/GlobComponent.astro?astro&type=script&index=0&lang.ts')) {
if (
$(el).attr('src').includes('Glob/GlobComponent.astro?astro&type=script&index=0&lang.ts')
) {
found++;
}
})
});
expect(found).to.equal(1);
});
});