-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(toolbar): Fix loading third-party apps using absolute paths (#9834)
* fix(toolbar): Fix loading third-party apps using absolute paths * chore: changeset * fix: pass entrypoint correctly * Update .changeset/real-lamps-design.md --------- Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com>
- Loading branch information
1 parent
e4370e9
commit 1885cea
Showing
6 changed files
with
70 additions
and
4 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 third-party dev toolbar apps not loading correctly when using absolute paths on Windows |
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,5 +1,6 @@ | ||
import preact from '@astrojs/preact'; | ||
import { myIntegration } from './custom-integration.js'; | ||
|
||
export default { | ||
integrations: [preact()], | ||
integrations: [preact(), myIntegration()], | ||
}; |
17 changes: 17 additions & 0 deletions
17
packages/astro/e2e/fixtures/dev-toolbar/custom-integration.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,17 @@ | ||
import { dirname, join } from 'node:path'; | ||
import { fileURLToPath } from 'node:url'; | ||
|
||
/** @type {() => import('astro').AstroIntegration} */ | ||
export function myIntegration() { | ||
return { | ||
name: 'my-integration', | ||
hooks: { | ||
'astro:config:setup': ({ addDevToolbarApp }) => { | ||
const importPath = dirname(fileURLToPath(import.meta.url)); | ||
const pluginPath = join(importPath, 'custom-plugin.js'); | ||
|
||
addDevToolbarApp(pluginPath); | ||
}, | ||
}, | ||
}; | ||
} |
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,20 @@ | ||
export default { | ||
id: 'my-plugin', | ||
name: 'My Plugin', | ||
icon: 'astro:logo', | ||
init(canvas) { | ||
const astroWindow = document.createElement('astro-dev-toolbar-window'); | ||
const myButton = document.createElement('astro-dev-toolbar-button'); | ||
myButton.size = 'medium'; | ||
myButton.buttonStyle = 'purple'; | ||
myButton.innerText = 'Click me!'; | ||
|
||
myButton.addEventListener('click', () => { | ||
console.log('Clicked!'); | ||
}); | ||
|
||
astroWindow.appendChild(myButton); | ||
|
||
canvas.appendChild(astroWindow); | ||
}, | ||
}; |
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