From 24a40bee6358d6732e20dc0e131089f8a42b704d Mon Sep 17 00:00:00 2001 From: matthewp Date: Mon, 16 Aug 2021 20:44:46 +0000 Subject: [PATCH] [ci] yarn format --- docs/src/pages/reference/api-reference.md | 4 ++-- packages/astro/src/compiler/codegen/index.ts | 2 -- packages/astro/src/compiler/codegen/interfaces.ts | 2 +- packages/astro/src/compiler/codegen/utils.ts | 12 +++--------- packages/astro/test/astro-global-build.test.js | 6 +++--- packages/astro/test/astro-global.test.js | 2 +- 6 files changed, 10 insertions(+), 18 deletions(-) diff --git a/docs/src/pages/reference/api-reference.md b/docs/src/pages/reference/api-reference.md index 2f73cb30c..dfa52763a 100644 --- a/docs/src/pages/reference/api-reference.md +++ b/docs/src/pages/reference/api-reference.md @@ -76,13 +76,13 @@ const path = Astro.site.pathname; `Astro.resolve()` helps with creating URLs relative to the current Astro file, allowing you to reference files within your `src/` folder. -Astro *does not* resolve relative links within HTML, such as images: +Astro _does not_ resolve relative links within HTML, such as images: ```html ``` -The above will be sent to the browser as-is and the browser will resolve it relative to the current __page__. If you want it to be resolved relative to the .astro file you are working in, use `Astro.resolve`: +The above will be sent to the browser as-is and the browser will resolve it relative to the current **page**. If you want it to be resolved relative to the .astro file you are working in, use `Astro.resolve`: ```astro diff --git a/packages/astro/src/compiler/codegen/index.ts b/packages/astro/src/compiler/codegen/index.ts index 2557f8b54..bcdd4ef9d 100644 --- a/packages/astro/src/compiler/codegen/index.ts +++ b/packages/astro/src/compiler/codegen/index.ts @@ -59,8 +59,6 @@ function findHydrationAttributes(attrs: Record): HydrationAttrib return { method, value }; } - - /** Retrieve attributes from TemplateNode */ async function getAttributes(nodeName: string, attrs: Attribute[], state: CodegenState, compileOptions: CompileOptions): Promise> { let result: Record = {}; diff --git a/packages/astro/src/compiler/codegen/interfaces.ts b/packages/astro/src/compiler/codegen/interfaces.ts index a487b85e9..04667557d 100644 --- a/packages/astro/src/compiler/codegen/interfaces.ts +++ b/packages/astro/src/compiler/codegen/interfaces.ts @@ -7,4 +7,4 @@ export interface Attribute { name: string; value: TemplateNode[] | boolean; expression?: Expression; -} \ No newline at end of file +} diff --git a/packages/astro/src/compiler/codegen/utils.ts b/packages/astro/src/compiler/codegen/utils.ts index a4e66fbe8..9f7c8672e 100644 --- a/packages/astro/src/compiler/codegen/utils.ts +++ b/packages/astro/src/compiler/codegen/utils.ts @@ -22,20 +22,14 @@ export function isImportMetaDeclaration(declaration: VariableDeclarator, metaNam return true; } -const warnableRelativeValues = new Set([ - 'img+src', - 'a+href', - 'script+src', - 'link+href', - 'source+srcset' -]); +const warnableRelativeValues = new Set(['img+src', 'a+href', 'script+src', 'link+href', 'source+srcset']); const matchesRelative = /^(?![A-Za-z][+-.0-9A-Za-z]*:|\/)/; export function warnIfRelativeStringLiteral(logging: LogOptions, nodeName: string, attr: Attribute, value: string) { let key = nodeName + '+' + attr.name; - if(warnableRelativeValues.has(key) && matchesRelative.test(value)) { + if (warnableRelativeValues.has(key) && matchesRelative.test(value)) { let message = `This value will be resolved relative to the page: <${nodeName} ${attr.name}="${value}">`; warn(logging, 'relative-link', message); } -} \ No newline at end of file +} diff --git a/packages/astro/test/astro-global-build.test.js b/packages/astro/test/astro-global-build.test.js index 6acdfd428..88b59dbaf 100644 --- a/packages/astro/test/astro-global-build.test.js +++ b/packages/astro/test/astro-global-build.test.js @@ -7,8 +7,8 @@ const GlobalBuild = suite('Astro.* built'); setup(GlobalBuild, './fixtures/astro-global', { runtimeOptions: { - mode: 'production' - } + mode: 'production', + }, }); GlobalBuild('Astro.resolve in the build', async (context) => { @@ -20,4 +20,4 @@ GlobalBuild('Astro.resolve in the build', async (context) => { assert.equal($('img').attr('src'), '/blog/_astro/src/images/penguin.png'); }); -GlobalBuild.run(); \ No newline at end of file +GlobalBuild.run(); diff --git a/packages/astro/test/astro-global.test.js b/packages/astro/test/astro-global.test.js index 9a80973ae..5dbac151b 100644 --- a/packages/astro/test/astro-global.test.js +++ b/packages/astro/test/astro-global.test.js @@ -50,4 +50,4 @@ Global('Astro.resolve in development', async (context) => { assert.equal($('img').attr('src'), '/_astro/src/images/penguin.png'); }); -Global.run(); \ No newline at end of file +Global.run();