-
-
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.
fix(astro): prerendering issue when path contains underscore (#11243)
* fix(astro): prerendering issue when path contains underscore * chore: add missing files * Update .changeset/honest-ravens-double.md Co-authored-by: Emanuele Stoppa <my.burning@gmail.com> --------- Co-authored-by: Matthew Phillips <matthew@matthewphillips.info> Co-authored-by: Emanuele Stoppa <my.burning@gmail.com>
- Loading branch information
1 parent
6582811
commit ba2b14c
Showing
8 changed files
with
95 additions
and
2 deletions.
There are no files selected for viewing
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 | ||
--- | ||
|
||
Fixes a prerendering issue for libraries in `node_modules` when a folder with an underscore is in the path. |
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
8 changes: 8 additions & 0 deletions
8
packages/astro/test/fixtures/_underscore in folder name/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,8 @@ | ||
import { defineConfig } from 'astro/config'; | ||
import fakeIntegration from 'fake-astro-library'; | ||
|
||
export default defineConfig({ | ||
integrations: [ | ||
fakeIntegration(), | ||
], | ||
}); |
4 changes: 4 additions & 0 deletions
4
.../astro/test/fixtures/_underscore in folder name/node_modules/fake-astro-library/404.astro
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
16 changes: 16 additions & 0 deletions
16
...s/astro/test/fixtures/_underscore in folder name/node_modules/fake-astro-library/index.ts
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
12 changes: 12 additions & 0 deletions
12
...tro/test/fixtures/_underscore in folder name/node_modules/fake-astro-library/package.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
11 changes: 11 additions & 0 deletions
11
packages/astro/test/fixtures/_underscore in folder name/src/pages/index.astro
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,11 @@ | ||
<html> | ||
<head> | ||
<title>Project with underscore in the folder name</title> | ||
</head> | ||
<body> | ||
<h1>Testing</h1> | ||
<script> | ||
console.log('hi'); | ||
</script> | ||
</body> | ||
</html> |
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,25 @@ | ||
import assert from 'node:assert/strict'; | ||
import { before, describe, it } from 'node:test'; | ||
import { loadFixture } from './test-utils.js'; | ||
import testAdapter from './test-adapter.js'; | ||
|
||
describe('Projects with a underscore in the folder name', () => { | ||
let fixture; | ||
|
||
before(async () => { | ||
fixture = await loadFixture({ | ||
root: './fixtures/_underscore in folder name/', | ||
output: 'hybrid', | ||
adapter: testAdapter(), | ||
}); | ||
await fixture.build(); | ||
}); | ||
|
||
it('includes page from node_modules/fake-astro-library', async () => { | ||
const app = await fixture.loadTestAdapterApp(); | ||
/** @type {Set<string>} */ | ||
const assets = app.manifest.assets; | ||
assert.equal(assets.has('/index.html'), true); | ||
assert.equal(assets.has('/404.html'), true); | ||
}); | ||
}); |