[next] Upgrade compiler (#1619)

* [next] Upgrade compiler

* Upgrade to latest compiler

* Fix the path to global css

* Removed debugger
This commit is contained in:
Matthew Phillips 2021-10-21 12:58:53 -04:00 committed by Drew Powers
parent 5da14ca8ed
commit dfe23864e0
19 changed files with 166 additions and 164 deletions

View file

@ -18,7 +18,7 @@ const { title, description, image, type, next, prev, canonicalURL } = Astro.prop
<meta name="description" content={description}>
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Spectral:ital,wght@0,400;0,700;1,400;1,700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="/src/global.scss">
<link rel="stylesheet" href="/global.css">
<!-- Sitemap -->
<link rel="sitemap" href="/sitemap.xml">
<!-- RSS -->

View file

@ -53,7 +53,7 @@
"test": "mocha --parallel --timeout 15000"
},
"dependencies": {
"@astrojs/compiler": "^0.2.3",
"@astrojs/compiler": "^0.2.8",
"@astrojs/language-server": "^0.7.16",
"@astrojs/markdown-remark": "^0.3.1",
"@astrojs/markdown-support": "0.3.1",

View file

@ -2,14 +2,14 @@ import { expect } from 'chai';
import cheerio from 'cheerio';
import { loadFixture } from './test-utils.js';
let fixture;
before(async () => {
fixture = await loadFixture({ projectRoot: './fixtures/astro-attrs/' });
await fixture.build();
});
describe('Attributes', async () => {
let fixture;
before(async () => {
fixture = await loadFixture({ projectRoot: './fixtures/astro-attrs/' });
await fixture.build();
});
it('Passes attributes to elements as expected', async () => {
const html = await fixture.readFile('/index.html');
const $ = cheerio.load(html);

View file

@ -2,17 +2,17 @@ import { expect } from 'chai';
import cheerio from 'cheerio';
import { loadFixture } from './test-utils.js';
let fixture;
before(async () => {
fixture = await loadFixture({
projectRoot: './fixtures/astro-children/',
renderers: ['@astrojs/renderer-preact', '@astrojs/renderer-vue', '@astrojs/renderer-svelte'],
});
await fixture.build();
});
describe('Component children', () => {
let fixture;
before(async () => {
fixture = await loadFixture({
projectRoot: './fixtures/astro-children/',
renderers: ['@astrojs/renderer-preact', '@astrojs/renderer-vue', '@astrojs/renderer-svelte'],
});
await fixture.build();
});
it('Passes string children to framework components', async () => {
const html = await fixture.readFile('/strings/index.html');
const $ = cheerio.load(html);

View file

@ -2,14 +2,14 @@ import { expect } from 'chai';
import cheerio from 'cheerio';
import { loadFixture } from './test-utils.js';
let fixture;
before(async () => {
fixture = await loadFixture({ projectRoot: './fixtures/astro-dynamic/' });
await fixture.build();
});
describe('Dynamic components', () => {
let fixture;
before(async () => {
fixture = await loadFixture({ projectRoot: './fixtures/astro-dynamic/' });
await fixture.build();
});
it('Loads packages that only run code in client', async () => {
const html = await fixture.readFile('/index.html');

View file

@ -2,17 +2,17 @@ import { expect } from 'chai';
import cheerio from 'cheerio';
import { loadFixture } from './test-utils.js';
let fixture;
before(async () => {
fixture = await loadFixture({
projectRoot: './fixtures/astro-expr/',
renderers: ['@astrojs/renderer-preact'],
});
await fixture.build();
});
describe('Expressions', () => {
let fixture;
before(async () => {
fixture = await loadFixture({
projectRoot: './fixtures/astro-expr/',
renderers: ['@astrojs/renderer-preact'],
});
await fixture.build();
});
it('Can load page', async () => {
const html = await fixture.readFile('/index.html');
const $ = cheerio.load(html);

View file

@ -2,17 +2,17 @@ import { expect } from 'chai';
import cheerio from 'cheerio';
import { loadFixture } from './test-utils.js';
let fixture;
before(async () => {
fixture = await loadFixture({
projectRoot: './fixtures/astro-fallback',
renderers: ['@astrojs/renderer-preact'],
});
await fixture.build();
});
describe('Dynamic component fallback', () => {
let fixture;
before(async () => {
fixture = await loadFixture({
projectRoot: './fixtures/astro-fallback',
renderers: ['@astrojs/renderer-preact'],
});
await fixture.build();
});
it('Shows static content', async () => {
const html = await fixture.readFile('/index.html');
const $ = cheerio.load(html);

View file

@ -1,20 +1,20 @@
import { expect } from 'chai';
import { loadFixture } from './test-utils.js';
let fixture;
before(async () => {
fixture = await loadFixture({
projectRoot: './fixtures/astro-get-static-paths/',
buildOptions: {
site: 'https://mysite.dev/blog/',
sitemap: false,
},
});
await fixture.build();
});
describe('getStaticPaths()', () => {
let fixture;
before(async () => {
fixture = await loadFixture({
projectRoot: './fixtures/astro-get-static-paths/',
buildOptions: {
site: 'https://mysite.dev/blog/',
sitemap: false,
},
});
await fixture.build();
});
it('is only called once during build', () => {
// useless expect; if build() throws in setup then this test fails
expect(true).to.equal(true);

View file

@ -2,20 +2,20 @@ import { expect } from 'chai';
import cheerio from 'cheerio';
import { loadFixture } from './test-utils.js';
let fixture;
before(async () => {
fixture = await loadFixture({
projectRoot: './fixtures/astro-global/',
buildOptions: {
site: 'https://mysite.dev/blog/',
sitemap: false,
},
});
await fixture.build();
});
describe('Astro.*', () => {
let fixture;
before(async () => {
fixture = await loadFixture({
projectRoot: './fixtures/astro-global/',
buildOptions: {
site: 'https://mysite.dev/blog/',
sitemap: false,
},
});
await fixture.build();
});
it('Astro.request.url', async () => {
const html = await fixture.readFile('/index.html');
const $ = cheerio.load(html);

View file

@ -1,19 +1,19 @@
import { expect } from 'chai';
import { loadFixture } from './test-utils.js';
let fixture;
before(async () => {
fixture = await loadFixture({
projectRoot: './fixtures/astro-page-directory-url',
buildOptions: {
pageUrlFormat: 'file',
},
});
await fixture.build();
});
describe('pageUrlFormat', () => {
let fixture;
before(async () => {
fixture = await loadFixture({
projectRoot: './fixtures/astro-page-directory-url',
buildOptions: {
pageUrlFormat: 'file',
},
});
await fixture.build();
});
it('outputs', async () => {
expect(await fixture.readFile('/client/index.html')).to.be.ok;
expect(await fixture.readFile('/nested-md/index.html')).to.be.ok;

View file

@ -2,14 +2,14 @@ import { expect } from 'chai';
import cheerio from 'cheerio';
import { loadFixture } from './test-utils.js';
let fixture;
before(async () => {
fixture = await loadFixture({ projectRoot: './fixtures/astro-pages/' });
await fixture.build();
});
describe('Pages', () => {
let fixture;
before(async () => {
fixture = await loadFixture({ projectRoot: './fixtures/astro-pages/' });
await fixture.build();
});
it('Can find page with "index" at the end file name', async () => {
const html = await fixture.readFile('/posts/name-with-index/index.html');
const $ = cheerio.load(html);

View file

@ -1,14 +1,14 @@
import { expect } from 'chai';
import { loadFixture } from './test-utils.js';
let fixture;
before(async () => {
fixture = await loadFixture({ projectRoot: './fixtures/astro-public/' });
await fixture.build();
});
describe('Public', () => {
let fixture;
before(async () => {
fixture = await loadFixture({ projectRoot: './fixtures/astro-public/' });
await fixture.build();
});
it('css and js files do not get bundled', async () => {
let indexHtml = await fixture.readFile('/index.html');
expect(indexHtml).to.include('<script src="/example.js"></script>');

View file

@ -1,34 +1,36 @@
import { expect } from 'chai';
import { loadFixture } from './test-utils.js';
let fixture;
describe('Sitemaps', () => {
let fixture;
before(async () => {
fixture = await loadFixture({
projectRoot: './fixtures/astro-sitemap-rss/',
buildOptions: {
site: 'https://astro.build/',
sitemap: true,
},
before(async () => {
fixture = await loadFixture({
projectRoot: './fixtures/astro-sitemap-rss/',
buildOptions: {
site: 'https://astro.build/',
sitemap: true,
},
});
await fixture.build();
});
await fixture.build();
});
describe('RSS Generation', () => {
it('generates RSS correctly', async () => {
const rss = await fixture.readFile('/custom/feed.xml');
expect(rss).to.equal(
`<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title><![CDATA[MF Doomcast]]></title><description><![CDATA[The podcast about the things you find on a picnic, or at a picnic table]]></description><link>https://astro.build/custom/feed.xml</link><language>en-us</language><itunes:author>MF Doom</itunes:author><item><title><![CDATA[Rap Snitch Knishes (feat. Mr. Fantastik)]]></title><link>https://astro.build/episode/rap-snitch-knishes/</link><description><![CDATA[Complex named this song the “22nd funniest rap song of all time.”]]></description><pubDate>Tue, 16 Nov 2004 00:00:00 GMT</pubDate><itunes:episodeType>music</itunes:episodeType><itunes:duration>172</itunes:duration><itunes:explicit>true</itunes:explicit></item><item><title><![CDATA[Fazers]]></title><link>https://astro.build/episode/fazers/</link><description><![CDATA[Rhapsody ranked Take Me to Your Leader 17th on its list “Hip-Hops Best Albums of the Decade”]]></description><pubDate>Thu, 03 Jul 2003 00:00:00 GMT</pubDate><itunes:episodeType>music</itunes:episodeType><itunes:duration>197</itunes:duration><itunes:explicit>true</itunes:explicit></item><item><title><![CDATA[Rhymes Like Dimes (feat. Cucumber Slice)]]></title><link>https://astro.build/episode/rhymes-like-dimes/</link><description><![CDATA[Operation: Doomsday has been heralded as an underground classic that established MF Doom's rank within the underground hip-hop scene during the early to mid-2000s.
describe('RSS Generation', () => {
it('generates RSS correctly', async () => {
const rss = await fixture.readFile('/custom/feed.xml');
expect(rss).to.equal(
`<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title><![CDATA[MF Doomcast]]></title><description><![CDATA[The podcast about the things you find on a picnic, or at a picnic table]]></description><link>https://astro.build/custom/feed.xml</link><language>en-us</language><itunes:author>MF Doom</itunes:author><item><title><![CDATA[Rap Snitch Knishes (feat. Mr. Fantastik)]]></title><link>https://astro.build/episode/rap-snitch-knishes/</link><description><![CDATA[Complex named this song the “22nd funniest rap song of all time.”]]></description><pubDate>Tue, 16 Nov 2004 00:00:00 GMT</pubDate><itunes:episodeType>music</itunes:episodeType><itunes:duration>172</itunes:duration><itunes:explicit>true</itunes:explicit></item><item><title><![CDATA[Fazers]]></title><link>https://astro.build/episode/fazers/</link><description><![CDATA[Rhapsody ranked Take Me to Your Leader 17th on its list “Hip-Hops Best Albums of the Decade”]]></description><pubDate>Thu, 03 Jul 2003 00:00:00 GMT</pubDate><itunes:episodeType>music</itunes:episodeType><itunes:duration>197</itunes:duration><itunes:explicit>true</itunes:explicit></item><item><title><![CDATA[Rhymes Like Dimes (feat. Cucumber Slice)]]></title><link>https://astro.build/episode/rhymes-like-dimes/</link><description><![CDATA[Operation: Doomsday has been heralded as an underground classic that established MF Doom's rank within the underground hip-hop scene during the early to mid-2000s.
]]></description><pubDate>Tue, 19 Oct 1999 00:00:00 GMT</pubDate><itunes:episodeType>music</itunes:episodeType><itunes:duration>259</itunes:duration><itunes:explicit>true</itunes:explicit></item></channel></rss>`
);
);
});
});
});
describe('Sitemap Generation', () => {
it('Generates Sitemap correctly', async () => {
let sitemap = await fixture.readFile('/sitemap.xml');
expect(sitemap).to.equal(
`<?xml version="1.0" encoding="UTF-8"?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"><url><loc>https://astro.build/404/index.html</loc></url><url><loc>https://astro.build/episode/fazers/index.html</loc></url><url><loc>https://astro.build/episode/rap-snitch-knishes/index.html</loc></url><url><loc>https://astro.build/episode/rhymes-like-dimes/index.html</loc></url><url><loc>https://astro.build/episodes/index.html</loc></url></urlset>\n`
);
describe('Sitemap Generation', () => {
it('Generates Sitemap correctly', async () => {
let sitemap = await fixture.readFile('/sitemap.xml');
expect(sitemap).to.equal(
`<?xml version="1.0" encoding="UTF-8"?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"><url><loc>https://astro.build/404/index.html</loc></url><url><loc>https://astro.build/episode/fazers/index.html</loc></url><url><loc>https://astro.build/episode/rap-snitch-knishes/index.html</loc></url><url><loc>https://astro.build/episode/rhymes-like-dimes/index.html</loc></url><url><loc>https://astro.build/episodes/index.html</loc></url></urlset>\n`
);
});
});
});

View file

@ -2,14 +2,14 @@ import { expect } from 'chai';
import cheerio from 'cheerio';
import { loadFixture } from './test-utils.js';
let fixture;
before(async () => {
fixture = await loadFixture({ projectRoot: './fixtures/astro-slots/' });
await fixture.build();
});
describe('Slots', () => {
let fixture;
before(async () => {
fixture = await loadFixture({ projectRoot: './fixtures/astro-slots/' });
await fixture.build();
});
it('Basic named slots work', async () => {
const html = await fixture.readFile('/index.html');
const $ = cheerio.load(html);

View file

@ -1,14 +1,14 @@
import { expect } from 'chai';
import { devCLI, loadFixture } from './test-utils.js';
let hostnameFixture;
let portFixture;
before(async () => {
[hostnameFixture, portFixture] = await Promise.all([loadFixture({ projectRoot: './fixtures/config-hostname/' }), loadFixture({ projectRoot: './fixtures/config-port/' })]);
});
describe('config', () => {
let hostnameFixture;
let portFixture;
before(async () => {
[hostnameFixture, portFixture] = await Promise.all([loadFixture({ projectRoot: './fixtures/config-hostname/' }), loadFixture({ projectRoot: './fixtures/config-port/' })]);
});
describe('hostname', () => {
it('can be specified in astro.config.mjs', async () => {
expect(hostnameFixture.config.devOptions.hostname).to.equal('0.0.0.0');

View file

@ -3,17 +3,17 @@ import cheerio from 'cheerio';
import { loadFixture } from './test-utils.js';
import path from 'path';
let fixture;
before(async () => {
fixture = await loadFixture({
projectRoot: './fixtures/custom-elements/',
renderers: ['@astrojs/test-custom-element-renderer'],
});
await fixture.build();
});
describe('Custom Elements', () => {
let fixture;
before(async () => {
fixture = await loadFixture({
projectRoot: './fixtures/custom-elements/',
renderers: ['@astrojs/test-custom-element-renderer'],
});
await fixture.build();
});
it('Work as constructors', async () => {
const html = await fixture.readFile('/ctr/index.html');
const $ = cheerio.load(html);

View file

@ -2,14 +2,14 @@ import { expect } from 'chai';
import cheerio from 'cheerio';
import { loadFixture } from './test-utils.js';
let fixture;
before(async () => {
fixture = await loadFixture({ projectRoot: './fixtures/fetch/' });
await fixture.build();
});
describe('Global Fetch', () => {
let fixture;
before(async () => {
fixture = await loadFixture({ projectRoot: './fixtures/fetch/' });
await fixture.build();
});
it('Is available in Astro pages', async () => {
const html = await fixture.readFile('/index.html');
const $ = cheerio.load(html);

View file

@ -2,14 +2,14 @@ import { expect } from 'chai';
import cheerio from 'cheerio';
import { loadFixture } from './test-utils.js';
let fixture;
before(async () => {
fixture = await loadFixture({ projectRoot: './fixtures/vue-component/' });
await fixture.build();
});
describe('Vue component', () => {
let fixture;
before(async () => {
fixture = await loadFixture({ projectRoot: './fixtures/vue-component/' });
await fixture.build();
});
it('Can load Vue', async () => {
const html = await fixture.readFile('/index.html');
const $ = cheerio.load(html);

View file

@ -106,10 +106,10 @@
"@algolia/logger-common" "4.10.5"
"@algolia/requester-common" "4.10.5"
"@astrojs/compiler@^0.2.3":
version "0.2.3"
resolved "https://registry.yarnpkg.com/@astrojs/compiler/-/compiler-0.2.3.tgz#5e56444e999985f553de4a60e3838a918d4968e3"
integrity sha512-OBoiu3RxdpKPRV6ETJMWZH/EcxEtxswJA0iEqL490cMNkv9TqbOo0dc27jUVQz6CY6opIotZf+j9ajWUQJvX4g==
"@astrojs/compiler@^0.2.8":
version "0.2.8"
resolved "https://registry.yarnpkg.com/@astrojs/compiler/-/compiler-0.2.8.tgz#73ab99cfcbf5e56500a60058594decf7db9d99d0"
integrity sha512-RuvzJDhZZ5S3mPZhY0Y+4MBfTGqcs6Z9PpTviOy50Yb8GQ9wDaCqU3q95e9BH3p5j50xUpmyGMSOyuRFaFuCLw==
dependencies:
typescript "^4.3.5"