-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix use of dynamic imports / Astro.glob with Deno Deploy (#3532)
* Fix use of dynamic imports / Astro.glob with Deno Deploy * Adds a changeset * Mark the markdown package as external
- Loading branch information
Showing
12 changed files
with
157 additions
and
9 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 @@ | ||
--- | ||
'@astrojs/deno': patch | ||
--- | ||
|
||
Fix for using Astro.glob when using the Deno Deploy adapter |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export * from 'https://deno.land/std@0.110.0/path/mod.ts'; | ||
export * from 'https://deno.land/std@0.132.0/testing/asserts.ts'; | ||
export * from 'https://deno.land/x/deno_dom/deno-dom-wasm.ts'; | ||
export * from 'https://deno.land/std@0.142.0/streams/conversion.ts'; |
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,21 @@ | ||
import { runBuildAndStartAppFromSubprocess } from './helpers.js'; | ||
import { assertEquals, assert, DOMParser } from './deps.js'; | ||
|
||
async function startApp(cb) { | ||
await runBuildAndStartAppFromSubprocess('./fixtures/dynimport/', cb); | ||
} | ||
|
||
Deno.test({ | ||
name: 'Dynamic import', | ||
async fn() { | ||
await startApp(async () => { | ||
const resp = await fetch('http://127.0.0.1:8085/'); | ||
assertEquals(resp.status, 200); | ||
const html = await resp.text(); | ||
assert(html); | ||
const doc = new DOMParser().parseFromString(html, `text/html`); | ||
const div = doc.querySelector('#thing'); | ||
assert(div, 'div exists'); | ||
}); | ||
}, | ||
}); |
9 changes: 9 additions & 0 deletions
9
packages/integrations/deno/test/fixtures/dynimport/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,9 @@ | ||
import { defineConfig } from 'astro/config'; | ||
import deno from '@astrojs/deno'; | ||
|
||
export default defineConfig({ | ||
adapter: deno(), | ||
experimental: { | ||
ssr: true | ||
} | ||
}) |
9 changes: 9 additions & 0 deletions
9
packages/integrations/deno/test/fixtures/dynimport/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,9 @@ | ||
{ | ||
"name": "@test/deno-astro-dynimport", | ||
"version": "0.0.0", | ||
"private": true, | ||
"dependencies": { | ||
"astro": "workspace:*", | ||
"@astrojs/deno": "workspace:*" | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
packages/integrations/deno/test/fixtures/dynimport/src/components/Thing.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,4 @@ | ||
--- | ||
--- | ||
<div id="thing">testing</div> |
11 changes: 11 additions & 0 deletions
11
packages/integrations/deno/test/fixtures/dynimport/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 @@ | ||
--- | ||
const { default: Thing } = await import('../components/Thing.astro'); | ||
--- | ||
<html> | ||
<head> | ||
<title>testing</title> | ||
</head> | ||
<body> | ||
<Thing /> | ||
</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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.