-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add example plugin in Typescript #71
Conversation
export function config() { | ||
Host.outputString( | ||
JSON.stringify({ | ||
title: 'Twitter Profile', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if we move this config to config.json
at top level, would we be able to import the json here?
*/ | ||
async function generateBase64Icon() { | ||
const iconPath = path.join(__dirname, 'icon.png'); | ||
const outputPath = path.join(__dirname, 'src', 'iconBase64.ts'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you move icon.png
to assets/icon.png
and src/iconBase64.ts
to dist/assets/icon.ts
? No need to append Base64 at the end. we can just keep filename the same.
await generateBase64Icon(); | ||
|
||
try { | ||
await esbuild.build({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think we should use something like webpack since it's much more widely use. there are already webpack plugins for turning assets into base64
and importing json files as modules.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is based on the Extism template. I used what was there
* This uses the `redirect` host function (see index.d.ts) | ||
*/ | ||
function gotoTwitter() { | ||
const { redirect } = Host.getFunctions() as any; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there a way to import types for Host
, or create a type declaration file ourselves?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could not immediately find an easy solution. I'd hoped you knew 😄
+ various cleanups
No description provided.