[ci] yarn format

This commit is contained in:
natemoo-re 2021-05-27 14:56:28 +00:00 committed by GitHub Actions
parent 8ff79981db
commit 3dc141b868
2 changed files with 24 additions and 23 deletions

View file

@ -58,26 +58,27 @@ export default function (opts: TransformOptions): Transformer {
if (isHmrEnabled) { if (isHmrEnabled) {
const { hmrPort } = opts.compileOptions; const { hmrPort } = opts.compileOptions;
children.push({ children.push(
type: 'Element', {
name: 'script', type: 'Element',
attributes: [], name: 'script',
children: [ attributes: [],
{ type: 'Text', data: `window.HMR_WEBSOCKET_URL = 'ws://localhost:${hmrPort}'`, start: 0, end: 0 } children: [{ type: 'Text', data: `window.HMR_WEBSOCKET_URL = 'ws://localhost:${hmrPort}'`, start: 0, end: 0 }],
], start: 0,
start: 0, end: 0,
end: 0 },
}, { {
type: 'Element', type: 'Element',
name: 'script', name: 'script',
attributes: [ attributes: [
{ type: 'Attribute', name: 'type', value: [{ type: 'Text', data: 'module', start: 0, end: 0 }], start: 0, end: 0 }, { type: 'Attribute', name: 'type', value: [{ type: 'Text', data: 'module', start: 0, end: 0 }], start: 0, end: 0 },
{ type: 'Attribute', name: 'src', value: [{ type: 'Text', data: '/_snowpack/hmr-client.js', start: 0, end: 0 }], start: 0, end: 0 }, { type: 'Attribute', name: 'src', value: [{ type: 'Text', data: '/_snowpack/hmr-client.js', start: 0, end: 0 }], start: 0, end: 0 },
], ],
children: [], children: [],
start: 0, start: 0,
end: 0 end: 0,
}) }
);
} }
head.children = head.children ?? []; head.children = head.children ?? [];
head.children.push(...children); head.children.push(...children);

View file

@ -264,7 +264,7 @@ interface CreateSnowpackOptions {
env: Record<string, any>; env: Record<string, any>;
mode: RuntimeMode; mode: RuntimeMode;
resolvePackageUrl?: (pkgName: string) => Promise<string>; resolvePackageUrl?: (pkgName: string) => Promise<string>;
target: 'frontend'|'backend'; target: 'frontend' | 'backend';
} }
const DEFAULT_HMR_PORT = 12321; const DEFAULT_HMR_PORT = 12321;
@ -284,11 +284,11 @@ async function createSnowpack(astroConfig: AstroConfig, options: CreateSnowpackO
resolvePackageUrl?: (s: string) => Promise<string>; resolvePackageUrl?: (s: string) => Promise<string>;
renderers?: { name: string; client: string; server: string }[]; renderers?: { name: string; client: string; server: string }[];
astroConfig: AstroConfig; astroConfig: AstroConfig;
hmrPort?: number hmrPort?: number;
} = { } = {
astroConfig, astroConfig,
resolvePackageUrl, resolvePackageUrl,
hmrPort: isHmrEnabled ? DEFAULT_HMR_PORT : undefined hmrPort: isHmrEnabled ? DEFAULT_HMR_PORT : undefined,
}; };
const mountOptions = { const mountOptions = {