-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into experimental-key-error
- Loading branch information
Showing
61 changed files
with
600 additions
and
178 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@astrojs/rss': patch | ||
--- | ||
|
||
Fix pubDate schema tranformation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@astrojs/vercel': patch | ||
--- | ||
|
||
Correctly handle analytics id where present |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'astro': patch | ||
--- | ||
|
||
Escape closing script tag with `define:vars` |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
123 changes: 123 additions & 0 deletions
123
packages/astro/test/alias-tsconfig-baseurl-only.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
import { expect } from 'chai'; | ||
import * as cheerio from 'cheerio'; | ||
import { loadFixture } from './test-utils.js'; | ||
|
||
describe('Aliases with tsconfig.json - baseUrl only', () => { | ||
let fixture; | ||
|
||
/** | ||
* @param {string} html | ||
* @returns {string[]} | ||
*/ | ||
function getLinks(html) { | ||
let $ = cheerio.load(html); | ||
let out = []; | ||
$('link[rel=stylesheet]').each((i, el) => { | ||
out.push($(el).attr('href')); | ||
}); | ||
return out; | ||
} | ||
|
||
/** | ||
* @param {string} href | ||
* @returns {Promise<{ href: string; css: string; }>} | ||
*/ | ||
async function getLinkContent(href, f = fixture) { | ||
const css = await f.readFile(href); | ||
return { href, css }; | ||
} | ||
|
||
before(async () => { | ||
fixture = await loadFixture({ | ||
root: './fixtures/alias-tsconfig-baseurl-only/', | ||
}); | ||
}); | ||
|
||
describe('dev', () => { | ||
let devServer; | ||
|
||
before(async () => { | ||
devServer = await fixture.startDevServer(); | ||
}); | ||
|
||
after(async () => { | ||
await devServer.stop(); | ||
}); | ||
|
||
it('can load client components', async () => { | ||
const html = await fixture.fetch('/').then((res) => res.text()); | ||
const $ = cheerio.load(html); | ||
|
||
// Should render aliased element | ||
expect($('#client').text()).to.equal('test'); | ||
|
||
const scripts = $('script').toArray(); | ||
expect(scripts.length).to.be.greaterThan(0); | ||
}); | ||
|
||
it('can load via baseUrl', async () => { | ||
const html = await fixture.fetch('/').then((res) => res.text()); | ||
const $ = cheerio.load(html); | ||
|
||
expect($('#foo').text()).to.equal('foo'); | ||
expect($('#constants-foo').text()).to.equal('foo'); | ||
expect($('#constants-index').text()).to.equal('index'); | ||
}); | ||
|
||
it('works in css @import', async () => { | ||
const html = await fixture.fetch('/').then((res) => res.text()); | ||
// imported css should be bundled | ||
expect(html).to.include('#style-red'); | ||
expect(html).to.include('#style-blue'); | ||
}); | ||
|
||
it('works in components', async () => { | ||
const html = await fixture.fetch('/').then((res) => res.text()); | ||
const $ = cheerio.load(html); | ||
|
||
expect($('#alias').text()).to.equal('foo'); | ||
}); | ||
}); | ||
|
||
describe('build', () => { | ||
before(async () => { | ||
await fixture.build(); | ||
}); | ||
|
||
it('can load client components', async () => { | ||
const html = await fixture.readFile('/index.html'); | ||
const $ = cheerio.load(html); | ||
|
||
// Should render aliased element | ||
expect($('#client').text()).to.equal('test'); | ||
|
||
const scripts = $('script').toArray(); | ||
expect(scripts.length).to.be.greaterThan(0); | ||
}); | ||
|
||
it('can load via baseUrl', async () => { | ||
const html = await fixture.readFile('/index.html'); | ||
const $ = cheerio.load(html); | ||
|
||
expect($('#foo').text()).to.equal('foo'); | ||
expect($('#constants-foo').text()).to.equal('foo'); | ||
expect($('#constants-index').text()).to.equal('index'); | ||
}); | ||
|
||
it('works in css @import', async () => { | ||
const html = await fixture.readFile('/index.html'); | ||
const content = await Promise.all(getLinks(html).map((href) => getLinkContent(href))); | ||
const [{ css }] = content; | ||
// imported css should be bundled | ||
expect(css).to.include('#style-red'); | ||
expect(css).to.include('#style-blue'); | ||
}); | ||
|
||
it('works in components', async () => { | ||
const html = await fixture.readFile('/index.html'); | ||
const $ = cheerio.load(html); | ||
|
||
expect($('#alias').text()).to.equal('foo'); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
packages/astro/test/fixtures/alias-tsconfig-baseurl-only/astro.config.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { defineConfig } from 'astro/config'; | ||
import svelte from '@astrojs/svelte'; | ||
|
||
// https://astro.build/config | ||
export default defineConfig({ | ||
integrations: [svelte()], | ||
}); |
10 changes: 10 additions & 0 deletions
10
packages/astro/test/fixtures/alias-tsconfig-baseurl-only/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"name": "@test/aliases-tsconfig-baseurl-only", | ||
"version": "0.0.0", | ||
"private": true, | ||
"dependencies": { | ||
"@astrojs/svelte": "workspace:*", | ||
"astro": "workspace:*", | ||
"svelte": "^3.48.0" | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
packages/astro/test/fixtures/alias-tsconfig-baseurl-only/src/components/Alias.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<script> | ||
import { foo } from 'utils/constants'; | ||
</script> | ||
<div id="alias">{foo}</div> |
Oops, something went wrong.