Compare commits

..

203 Commits

Author SHA1 Message Date
Steve Manuel
ce67aecf61 ci: add multiple version test strategy for java sdk 2023-01-10 09:14:37 -07:00
dependabot[bot]
9f0e2413e3 chore(deps): Update base64 requirement from 0.20.0-alpha to 0.21.0 (#204)
Updates the requirements on
[base64](https://github.com/marshallpierce/rust-base64) to permit the
latest version.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/marshallpierce/rust-base64/blob/master/RELEASE-NOTES.md">base64's
changelog</a>.</em></p>
<blockquote>
<h1>0.21.0</h1>
<p>(not yet released)</p>
<h2>Migration</h2>
<h3>Functions</h3>
<table>
<thead>
<tr>
<th>&lt; 0.20 function</th>
<th>0.21 equivalent</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>encode()</code></td>
<td><code>engine::general_purpose::STANDARD.encode()</code> or
<code>prelude::BASE64_STANDARD.encode()</code></td>
</tr>
<tr>
<td><code>encode_config()</code></td>
<td><code>engine.encode()</code></td>
</tr>
<tr>
<td><code>encode_config_buf()</code></td>
<td><code>engine.encode_string()</code></td>
</tr>
<tr>
<td><code>encode_config_slice()</code></td>
<td><code>engine.encode_slice()</code></td>
</tr>
<tr>
<td><code>decode()</code></td>
<td><code>engine::general_purpose::STANDARD.decode()</code> or
<code>prelude::BASE64_STANDARD.decode()</code></td>
</tr>
<tr>
<td><code>decode_config()</code></td>
<td><code>engine.decode()</code></td>
</tr>
<tr>
<td><code>decode_config_buf()</code></td>
<td><code>engine.decode_vec()</code></td>
</tr>
<tr>
<td><code>decode_config_slice()</code></td>
<td><code>engine.decode_slice()</code></td>
</tr>
</tbody>
</table>
<p>The short-lived 0.20 functions were the 0.13 functions with
<code>config</code> replaced with <code>engine</code>.</p>
<h3>Padding</h3>
<p>If applicable, use the preset engines <code>engine::STANDARD</code>,
<code>engine::STANDARD_NO_PAD</code>, <code>engine::URL_SAFE</code>,
or <code>engine::URL_SAFE_NO_PAD</code>.
The <code>NO_PAD</code> ones require that padding is absent when
decoding, and the others require that
canonical padding is present .</p>
<p>If you need the &lt; 0.20 behavior that did not care about padding,
or want to recreate &lt; 0.20.0's predefined <code>Config</code>s
precisely, see the following table.</p>
<table>
<thead>
<tr>
<th>0.13.1 Config</th>
<th>0.20.0+ alphabet</th>
<th><code>encode_padding</code></th>
<th><code>decode_padding_mode</code></th>
</tr>
</thead>
<tbody>
<tr>
<td>STANDARD</td>
<td>STANDARD</td>
<td>true</td>
<td>Indifferent</td>
</tr>
<tr>
<td>STANDARD_NO_PAD</td>
<td>STANDARD</td>
<td>false</td>
<td>Indifferent</td>
</tr>
<tr>
<td>URL_SAFE</td>
<td>URL_SAFE</td>
<td>true</td>
<td>Indifferent</td>
</tr>
<tr>
<td>URL_SAFE_NO_PAD</td>
<td>URL_SAFE</td>
<td>false</td>
<td>Indifferent</td>
</tr>
</tbody>
</table>
<h1>0.21.0-rc.1</h1>
<ul>
<li>Restore the ability to decode into a slice of precisely the correct
length with <code>Engine.decode_slice_unchecked</code>.</li>
<li>Add <code>Engine</code> as a <code>pub use</code> in
<code>prelude</code>.</li>
</ul>
<h1>0.21.0-beta.2</h1>
<h2>Breaking changes</h2>
<ul>
<li>Re-exports of preconfigured engines in <code>engine</code> are
removed in favor of <code>base64::prelude::...</code> that are better
suited to those who wish to <code>use</code> the entire path to a
name.</li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="d7fb31c4ad"><code>d7fb31c</code></a>
v0.21.0</li>
<li><a
href="83503761e9"><code>8350376</code></a>
Merge pull request <a
href="https://github-redirect.dependabot.com/marshallpierce/rust-base64/issues/207">#207</a>
from marshallpierce/mp/api-rework</li>
<li><a
href="726f7841b7"><code>726f784</code></a>
v0.21.0-rc.1</li>
<li><a
href="b29ab0196d"><code>b29ab01</code></a>
Add <code>Engine</code> in <code>prelude</code></li>
<li><a
href="64bbcc02df"><code>64bbcc0</code></a>
Remove no longer needed test helpers</li>
<li><a
href="0f981bd04f"><code>0f981bd</code></a>
Add decode_slice_unchecked to restore ability to decode into a precisely
size...</li>
<li><a
href="a51e822ae9"><code>a51e822</code></a>
v0.21.0-beta.2</li>
<li><a
href="936569a658"><code>936569a</code></a>
Move re-exports from <code>engine</code> to <code>prelude</code></li>
<li><a
href="53e1091e1b"><code>53e1091</code></a>
Fix release notes typo</li>
<li><a
href="b03eb5a84d"><code>b03eb5a</code></a>
v0.21.0-beta.1</li>
<li>Additional commits viewable in <a
href="https://github.com/marshallpierce/rust-base64/compare/v0.20.0-alpha.1...v0.21.0">compare
view</a></li>
</ul>
</details>
<br />


Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-09 08:59:38 -06:00
dependabot[bot]
5b9e1c1ff6 chore(deps-dev): Bump prettier from 2.8.1 to 2.8.2 in /node (#205)
Bumps [prettier](https://github.com/prettier/prettier) from 2.8.1 to
2.8.2.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/prettier/prettier/releases">prettier's
releases</a>.</em></p>
<blockquote>
<h2>2.8.2</h2>
<p>🔗 <a
href="https://github.com/prettier/prettier/blob/main/CHANGELOG.md#282">Changelog</a></p>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/prettier/prettier/blob/main/CHANGELOG.md">prettier's
changelog</a>.</em></p>
<blockquote>
<h1>2.8.2</h1>
<p><a
href="https://github.com/prettier/prettier/compare/2.8.1...2.8.2">diff</a></p>
<h4>Don't lowercase link references (<a
href="https://github-redirect.dependabot.com/prettier/prettier/pull/13155">#13155</a>
by <a
href="https://github.com/DerekNonGeneric"><code>@​DerekNonGeneric</code></a>
&amp; <a
href="https://github.com/fisker"><code>@​fisker</code></a>)</h4>
<!-- raw HTML omitted -->
<pre lang="markdown"><code>&lt;!-- Input --&gt;
We now don't strictly follow the release notes format suggested by [Keep
a Changelog].
<p>&lt;!-- Prettier 2.8.1 --&gt;
We now don't strictly follow the release notes format suggested by <a
href="https://example.com/">Keep a Changelog</a>.</p>
<p>&lt;!--
^^^^^^^^^^^^^^^^^^ lowercased
--&gt;</p>
<p>&lt;!-- Prettier 2.8.2 --&gt;
&lt;Same as input&gt;
</code></pre></p>
<h4>Preserve self-closing tags (<a
href="https://github-redirect.dependabot.com/prettier/prettier/pull/13691">#13691</a>
by <a
href="https://github.com/dcyriller"><code>@​dcyriller</code></a>)</h4>
<!-- raw HTML omitted -->
<pre lang="hbs"><code>{{! Input }}
&lt;div /&gt;
&lt;div&gt;&lt;/div&gt;
&lt;custom-component /&gt;
&lt;custom-component&gt;&lt;/custom-component&gt;
&lt;i /&gt;
&lt;i&gt;&lt;/i&gt;
&lt;Component /&gt;
&lt;Component&gt;&lt;/Component&gt;
<p>{{! Prettier 2.8.1 }}
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;custom-component&gt;&lt;/custom-component&gt;
&lt;custom-component&gt;&lt;/custom-component&gt;
&lt;i&gt;&lt;/i&gt;
&lt;i&gt;&lt;/i&gt;
&lt;Component /&gt;
&lt;Component /&gt;</p>
<p>{{! Prettier 2.8.2 }}
&lt;/tr&gt;&lt;/table&gt;
</code></pre></p>
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="ac88438d65"><code>ac88438</code></a>
Release 2.8.2</li>
<li><a
href="aaf919014f"><code>aaf9190</code></a>
Fix comments after directive (<a
href="https://github-redirect.dependabot.com/prettier/prettier/issues/14081">#14081</a>)</li>
<li><a
href="9e09a78cf5"><code>9e09a78</code></a>
Stop inserting space in LESS property access (<a
href="https://github-redirect.dependabot.com/prettier/prettier/issues/14103">#14103</a>)</li>
<li><a
href="0c5d4f3458"><code>0c5d4f3</code></a>
Fix removing commas from function arguments in maps (<a
href="https://github-redirect.dependabot.com/prettier/prettier/issues/14089">#14089</a>)</li>
<li><a
href="b77d912c0c"><code>b77d912</code></a>
ember / glimmer: Preserve self-closing tags (<a
href="https://github-redirect.dependabot.com/prettier/prettier/issues/13691">#13691</a>)</li>
<li><a
href="cf36209a27"><code>cf36209</code></a>
Handlebars: Add tests for <code>{{! prettier-ignore}}</code> (<a
href="https://github-redirect.dependabot.com/prettier/prettier/issues/13693">#13693</a>)</li>
<li><a
href="f8e1ad806c"><code>f8e1ad8</code></a>
Add parens to head of <code>ExpressionStatement</code> instead of whole
statement (<a
href="https://github-redirect.dependabot.com/prettier/prettier/issues/14077">#14077</a>)</li>
<li><a
href="8034bada96"><code>8034bad</code></a>
Build(deps): Bump json5 from 2.2.0 to 2.2.3 in /scripts/release (<a
href="https://github-redirect.dependabot.com/prettier/prettier/issues/14104">#14104</a>)</li>
<li><a
href="31d40104f4"><code>31d4010</code></a>
Build(deps): Bump json5 from 2.2.1 to 2.2.3 in /website (<a
href="https://github-redirect.dependabot.com/prettier/prettier/issues/14101">#14101</a>)</li>
<li><a
href="41cee0636e"><code>41cee06</code></a>
Do not change case of property name if inside a variable declaration in
LESS ...</li>
<li>Additional commits viewable in <a
href="https://github.com/prettier/prettier/compare/2.8.1...2.8.2">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=prettier&package-manager=npm_and_yarn&previous-version=2.8.1&new-version=2.8.2)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-09 08:59:17 -06:00
dependabot[bot]
ef8004b38d chore(deps-dev): Bump typedoc from 0.23.22 to 0.23.24 in /node (#206)
Bumps [typedoc](https://github.com/TypeStrong/TypeDoc) from 0.23.22 to
0.23.24.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/TypeStrong/TypeDoc/releases">typedoc's
releases</a>.</em></p>
<blockquote>
<h2>v0.23.24</h2>
<h3>Bug Fixes</h3>
<ul>
<li>Fixed an issue where signature comments were preferred over property
comments for indirectly created function-properties, <a
href="https://github-redirect.dependabot.com/TypeStrong/TypeDoc/issues/2135">#2135</a>.</li>
<li>Fixed symlink handling when expanding entry points, <a
href="https://github-redirect.dependabot.com/TypeStrong/TypeDoc/issues/2130">#2130</a>.</li>
</ul>
<h3>Thanks!</h3>
<ul>
<li><a
href="https://github.com/boneskull"><code>@​boneskull</code></a></li>
</ul>
<h2>v0.23.23</h2>
<h3>Features</h3>
<ul>
<li>Added <code>ts.Signature</code> to emitted
<code>EVENT_CREATE_SIGNATURE</code> event, <a
href="https://github-redirect.dependabot.com/TypeStrong/TypeDoc/issues/2002">#2002</a>.</li>
</ul>
<h3>Bug Fixes</h3>
<ul>
<li>Links to members hidden by filter settings now temporarily override
the filter, <a
href="https://github-redirect.dependabot.com/TypeStrong/TypeDoc/issues/2092">#2092</a>.</li>
<li>If <code>src/</code> and <code>src/x</code> are specified as entry
points, <code>src/</code> will no longer be ignored, <a
href="https://github-redirect.dependabot.com/TypeStrong/TypeDoc/issues/2121">#2121</a>.</li>
</ul>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/TypeStrong/typedoc/blob/master/CHANGELOG.md">typedoc's
changelog</a>.</em></p>
<blockquote>
<h2>v0.23.24 (2023-01-07)</h2>
<h3>Bug Fixes</h3>
<ul>
<li>Fixed an issue where signature comments were preferred over property
comments for indirectly created function-properties, <a
href="https://github-redirect.dependabot.com/TypeStrong/TypeDoc/issues/2135">#2135</a>.</li>
<li>Fixed symlink handling when expanding entry points, <a
href="https://github-redirect.dependabot.com/TypeStrong/TypeDoc/issues/2130">#2130</a>.</li>
</ul>
<h3>Thanks!</h3>
<ul>
<li><a
href="https://github.com/boneskull"><code>@​boneskull</code></a></li>
</ul>
<h2>v0.23.23 (2022-12-18)</h2>
<h3>Features</h3>
<ul>
<li>Added <code>ts.Signature</code> to emitted
<code>EVENT_CREATE_SIGNATURE</code> event, <a
href="https://github-redirect.dependabot.com/TypeStrong/TypeDoc/issues/2002">#2002</a>.</li>
</ul>
<h3>Bug Fixes</h3>
<ul>
<li>Links to members hidden by filter settings now temporarily override
the filter, <a
href="https://github-redirect.dependabot.com/TypeStrong/TypeDoc/issues/2092">#2092</a>.</li>
<li>If <code>src/</code> and <code>src/x</code> are specified as entry
points, <code>src/</code> will no longer be ignored, <a
href="https://github-redirect.dependabot.com/TypeStrong/TypeDoc/issues/2121">#2121</a>.</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="0340ef4553"><code>0340ef4</code></a>
Update changelog for release</li>
<li><a
href="05e65f2bfe"><code>05e65f2</code></a>
Bump version to 0.23.24</li>
<li><a
href="0cb16a8b8c"><code>0cb16a8</code></a>
Shiki :/</li>
<li><a
href="7cf8b3cfd9"><code>7cf8b3c</code></a>
Upgrade deps</li>
<li><a
href="cc93e0996d"><code>cc93e09</code></a>
Update changelog</li>
<li><a
href="26480e7c19"><code>26480e7</code></a>
Merge pull request <a
href="https://github-redirect.dependabot.com/TypeStrong/TypeDoc/issues/2134">#2134</a>
from boneskull/boneskull/issue2130</li>
<li><a
href="6c1b4ac811"><code>6c1b4ac</code></a>
fix(test): glob root match test matches against platform-normalized
path</li>
<li><a
href="fd7a896be5"><code>fd7a896</code></a>
fix: allow traversal of symlinks in glob</li>
<li><a
href="81ccecfa4f"><code>81ccecf</code></a>
Fix <a
href="https://github-redirect.dependabot.com/TypeStrong/TypeDoc/issues/2135">#2135</a></li>
<li><a
href="2d60647225"><code>2d60647</code></a>
Merge pull request <a
href="https://github-redirect.dependabot.com/TypeStrong/TypeDoc/issues/2133">#2133</a>
from boneskull/boneskull/tooltweak</li>
<li>Additional commits viewable in <a
href="https://github.com/TypeStrong/TypeDoc/compare/v0.23.22...v0.23.24">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=typedoc&package-manager=npm_and_yarn&previous-version=0.23.22&new-version=0.23.24)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-09 08:59:07 -06:00
zach
9a6b4997dc feat: add EXTISM_DEBUG env variable to enable debug info (#201) 2023-01-06 14:06:11 -08:00
Benjamin Eckel
87a403b7f3 Fix: Fixes Runtime problem with ESM module (#199)
Takes new version of the wasi shim and ensures that both CJS and ESM
distributions can be built.


Already published as 0.2.2

Co-authored-by: Steve Manuel <steve@dylib.so>
2023-01-04 18:01:48 -06:00
Benjamin Eckel
908edf2918 feat: WASI support for browser runtime (#196)
closes #160

Goal is not to expose all the WASI functionality, but to just write
minimum code to allow PDK targets that require WASI (e.g. tinygo
compiled plugins) to work in the browser. We can follow up with allowing
the user more control over the WASI environment.
2023-01-04 14:42:18 -06:00
zach
7d34595dd7 feat(zig): import extism.h directly instead of hand-written bindings (#197) 2023-01-04 10:57:08 -08:00
dependabot[bot]
e3a427b0cc chore(deps-dev): Update minitest requirement from ~> 5.16.3 to ~> 5.17.0 in /ruby (#190)
Updates the requirements on
[minitest](https://github.com/seattlerb/minitest) to permit the latest
version.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/minitest/minitest/blob/master/History.rdoc">minitest's
changelog</a>.</em></p>
<blockquote>
<p>=== 5.17.0 / 2022-12-31</p>
<ul>
<li>
<p>1 minor enhancement:</p>
<ul>
<li>Refactor setup hooks into a SETUP_METHODS constant. (MSP-Greg)</li>
</ul>
</li>
<li>
<p>3 bug fixes:</p>
<ul>
<li>Fix kwargs for Mock calls to delegator. (blowmage)</li>
<li>Fix kwargs for expectations. (bobmazanec, blowmage)</li>
<li>Remove check for .b method. (tenderlove)</li>
</ul>
</li>
</ul>
<p>=== 5.16.3 / 2022-08-17</p>
<ul>
<li>
<p>2 bug fixes:</p>
<ul>
<li>Fixed exception sanitization by removing TypeError restriction on
rescue.</li>
<li>Use A instead of deprecated TESTOPTS in rake test:slow.
(davidstosik)</li>
</ul>
</li>
</ul>
<p>=== 5.16.2 / 2022-07-03</p>
<ul>
<li>
<p>4 bug fixes:</p>
<ul>
<li>Added MT_KWARGS_HACK kludge for stub to deal with ruby 2.7 kwargs
nastiness. (tsugimoto)</li>
<li>In #expect, pop Hash class from args if $MT_KWARGS_HACK.
(casperisfine)</li>
<li>In above scenario, set expected kwargs (as Objects) based on actual
kwargs.</li>
<li>Nuke ivars if exception fails to marshal twice (eg better_errors).
(irphilli)</li>
</ul>
</li>
</ul>
<p>=== 5.16.1 / 2022-06-20</p>
<ul>
<li>
<p>2 bug fixes:</p>
<ul>
<li>Apparently adding real kwarg support to mocks/stubs broke some code.
Fixed.
<ul>
<li>Use <code>MT_KWARGS_HACK=1</code> to activate the kludgy kwargs
support w/ caveats.</li>
</ul>
</li>
<li>Clarified some doco wrt the block on #stub.</li>
</ul>
</li>
</ul>
<p>=== 5.16.0 / 2022-06-14</p>
<ul>
<li>
<p>2 major enhancements:</p>
<ul>
<li>Added Minitest::TestTask.</li>
<li>Dropping ruby 2.2 - 2.5. 2.6 is DTM soon too.</li>
</ul>
</li>
<li>
<p>11 minor enhancements:</p>
<ul>
<li>Added --show-skips option to show skips at end of run but not
require --verbose. (MSP-Greg)</li>
<li>Added Minitest.seed, the random seed used by the run.</li>
<li>Calling <code>srand Minitest.seed</code> before all shuffles to
ensure determinism.</li>
<li>Extended #stub to handle kwargs for both block and call args.
(SampsonCrowley)</li>
<li>Extended Mock#__call to display kwargs.</li>
</ul>
</li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="abdde9d03b"><code>abdde9d</code></a>
prepped for release</li>
<li><a
href="c0be030603"><code>c0be030</code></a>
- Fix kwargs for Mock calls to delegator. (blowmage)</li>
<li><a
href="87604fca4d"><code>87604fc</code></a>
- Fix kwargs for expectations. (bobmazanec, blowmage)</li>
<li><a
href="0b816d303b"><code>0b816d3</code></a>
Add EOL date to rails matrix</li>
<li><a
href="2f7ed237f1"><code>2f7ed23</code></a>
cleaned up rails version</li>
<li><a
href="ae54abfb23"><code>ae54abf</code></a>
Updated README for rails/ruby compatibilty matrix</li>
<li><a
href="4f31487068"><code>4f31487</code></a>
Fixed race condition causing flaky tests. (XrXr)</li>
<li><a
href="dcdd882fbe"><code>dcdd882</code></a>
get rake dcov back to 100%</li>
<li><a
href="3a77687e8b"><code>3a77687</code></a>
+ Refactor setup hooks into a SETUP_METHODS constant. (MSP-Greg)</li>
<li><a
href="b5565c0c7a"><code>b5565c0</code></a>
- Remove check for .b method. (tenderlove)</li>
<li>See full diff in <a
href="https://github.com/seattlerb/minitest/compare/v5.16.3...v5.17.0">compare
view</a></li>
</ul>
</details>
<br />


Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-03 13:52:02 -06:00
dependabot[bot]
0782d79278 chore(deps-dev): Bump @types/node from 18.11.17 to 18.11.18 in /node (#191)
Bumps
[@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node)
from 18.11.17 to 18.11.18.
<details>
<summary>Commits</summary>
<ul>
<li>See full diff in <a
href="https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=@types/node&package-manager=npm_and_yarn&previous-version=18.11.17&new-version=18.11.18)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-03 13:51:49 -06:00
dependabot[bot]
472ad42048 chore(deps-dev): Bump @types/jest from 29.2.4 to 29.2.5 in /node (#192)
Bumps
[@types/jest](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/jest)
from 29.2.4 to 29.2.5.
<details>
<summary>Commits</summary>
<ul>
<li>See full diff in <a
href="https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/jest">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=@types/jest&package-manager=npm_and_yarn&previous-version=29.2.4&new-version=29.2.5)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-03 13:51:38 -06:00
Steve Manuel
ed6110e6ec chore: add zig to graphic and readme support 2023-01-02 17:25:48 -07:00
dependabot[bot]
527bcdfbcf chore(deps): Bump json5 from 2.2.1 to 2.2.3 in /node (#194)
Bumps [json5](https://github.com/json5/json5) from 2.2.1 to 2.2.3.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/json5/json5/releases">json5's
releases</a>.</em></p>
<blockquote>
<h2>v2.2.3</h2>
<ul>
<li>Fix: json5@2.2.3 is now the 'latest' release according to npm
instead of v1.0.2. (<a
href="https://github-redirect.dependabot.com/json5/json5/issues/299">#299</a>)</li>
</ul>
<h2>v2.2.2</h2>
<ul>
<li>Fix: Properties with the name <code>__proto__</code> are added to
objects and arrays.
(<a
href="https://github-redirect.dependabot.com/json5/json5/issues/199">#199</a>)
This also fixes a prototype pollution vulnerability reported by
Jonathan Gregson! (<a
href="https://github-redirect.dependabot.com/json5/json5/issues/295">#295</a>).</li>
</ul>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/json5/json5/blob/main/CHANGELOG.md">json5's
changelog</a>.</em></p>
<blockquote>
<h3>v2.2.3 [<a
href="https://github.com/json5/json5/tree/v2.2.3">code</a>, <a
href="https://github.com/json5/json5/compare/v2.2.2...v2.2.3">diff</a>]</h3>
<ul>
<li>Fix: json5@2.2.3 is now the 'latest' release according to npm
instead of
v1.0.2. (<a
href="https://github-redirect.dependabot.com/json5/json5/issues/299">#299</a>)</li>
</ul>
<h3>v2.2.2 [<a
href="https://github.com/json5/json5/tree/v2.2.2">code</a>, <a
href="https://github.com/json5/json5/compare/v2.2.1...v2.2.2">diff</a>]</h3>
<ul>
<li>Fix: Properties with the name <code>__proto__</code> are added to
objects and arrays.
(<a
href="https://github-redirect.dependabot.com/json5/json5/issues/199">#199</a>)
This also fixes a prototype pollution vulnerability reported by
Jonathan Gregson! (<a
href="https://github-redirect.dependabot.com/json5/json5/issues/295">#295</a>).</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="c3a7524277"><code>c3a7524</code></a>
2.2.3</li>
<li><a
href="94fd06d82e"><code>94fd06d</code></a>
docs: update CHANGELOG for v2.2.3</li>
<li><a
href="3b8cebf0c4"><code>3b8cebf</code></a>
docs(security): use GitHub security advisories</li>
<li><a
href="f0fd9e194d"><code>f0fd9e1</code></a>
docs: publish a security policy</li>
<li><a
href="6a91a05fff"><code>6a91a05</code></a>
docs(template): bug -&gt; bug report</li>
<li><a
href="14f8cb186e"><code>14f8cb1</code></a>
2.2.2</li>
<li><a
href="10cc7ca916"><code>10cc7ca</code></a>
docs: update CHANGELOG for v2.2.2</li>
<li><a
href="7774c10979"><code>7774c10</code></a>
fix: add <strong>proto</strong> to objects and arrays</li>
<li><a
href="edde30abd8"><code>edde30a</code></a>
Readme: slight tweak to intro</li>
<li><a
href="97286f8bd5"><code>97286f8</code></a>
Improve example in readme</li>
<li>Additional commits viewable in <a
href="https://github.com/json5/json5/compare/v2.2.1...v2.2.3">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=json5&package-manager=npm_and_yarn&previous-version=2.2.1&new-version=2.2.3)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
You can disable automated security fix PRs for this repo from the
[Security Alerts page](https://github.com/extism/extism/network/alerts).

</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-02 14:49:07 -08:00
dependabot[bot]
765a1c55d5 chore(deps): Bump json5 from 2.2.1 to 2.2.3 in /browser (#193)
Bumps [json5](https://github.com/json5/json5) from 2.2.1 to 2.2.3.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/json5/json5/releases">json5's
releases</a>.</em></p>
<blockquote>
<h2>v2.2.3</h2>
<ul>
<li>Fix: json5@2.2.3 is now the 'latest' release according to npm
instead of v1.0.2. (<a
href="https://github-redirect.dependabot.com/json5/json5/issues/299">#299</a>)</li>
</ul>
<h2>v2.2.2</h2>
<ul>
<li>Fix: Properties with the name <code>__proto__</code> are added to
objects and arrays.
(<a
href="https://github-redirect.dependabot.com/json5/json5/issues/199">#199</a>)
This also fixes a prototype pollution vulnerability reported by
Jonathan Gregson! (<a
href="https://github-redirect.dependabot.com/json5/json5/issues/295">#295</a>).</li>
</ul>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/json5/json5/blob/main/CHANGELOG.md">json5's
changelog</a>.</em></p>
<blockquote>
<h3>v2.2.3 [<a
href="https://github.com/json5/json5/tree/v2.2.3">code</a>, <a
href="https://github.com/json5/json5/compare/v2.2.2...v2.2.3">diff</a>]</h3>
<ul>
<li>Fix: json5@2.2.3 is now the 'latest' release according to npm
instead of
v1.0.2. (<a
href="https://github-redirect.dependabot.com/json5/json5/issues/299">#299</a>)</li>
</ul>
<h3>v2.2.2 [<a
href="https://github.com/json5/json5/tree/v2.2.2">code</a>, <a
href="https://github.com/json5/json5/compare/v2.2.1...v2.2.2">diff</a>]</h3>
<ul>
<li>Fix: Properties with the name <code>__proto__</code> are added to
objects and arrays.
(<a
href="https://github-redirect.dependabot.com/json5/json5/issues/199">#199</a>)
This also fixes a prototype pollution vulnerability reported by
Jonathan Gregson! (<a
href="https://github-redirect.dependabot.com/json5/json5/issues/295">#295</a>).</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="c3a7524277"><code>c3a7524</code></a>
2.2.3</li>
<li><a
href="94fd06d82e"><code>94fd06d</code></a>
docs: update CHANGELOG for v2.2.3</li>
<li><a
href="3b8cebf0c4"><code>3b8cebf</code></a>
docs(security): use GitHub security advisories</li>
<li><a
href="f0fd9e194d"><code>f0fd9e1</code></a>
docs: publish a security policy</li>
<li><a
href="6a91a05fff"><code>6a91a05</code></a>
docs(template): bug -&gt; bug report</li>
<li><a
href="14f8cb186e"><code>14f8cb1</code></a>
2.2.2</li>
<li><a
href="10cc7ca916"><code>10cc7ca</code></a>
docs: update CHANGELOG for v2.2.2</li>
<li><a
href="7774c10979"><code>7774c10</code></a>
fix: add <strong>proto</strong> to objects and arrays</li>
<li><a
href="edde30abd8"><code>edde30a</code></a>
Readme: slight tweak to intro</li>
<li><a
href="97286f8bd5"><code>97286f8</code></a>
Improve example in readme</li>
<li>Additional commits viewable in <a
href="https://github.com/json5/json5/compare/v2.2.1...v2.2.3">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=json5&package-manager=npm_and_yarn&previous-version=2.2.1&new-version=2.2.3)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
You can disable automated security fix PRs for this repo from the
[Security Alerts page](https://github.com/extism/extism/network/alerts).

</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-02 14:48:52 -08:00
Doğu Us
6f534336f3 feat(zig-sdk): Create Zig Host Sdk (#186) 2023-01-02 15:30:34 -07:00
zach
5c9aa4c90a fix(elixir): use local Rust extism package from extism_nif for local development (#180) 2022-12-28 11:40:17 -06:00
dependabot[bot]
a98b39a10f chore(deps-dev): Bump @types/node from 18.11.13 to 18.11.17 in /node (#174)
Bumps
[@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node)
from 18.11.13 to 18.11.17.
<details>
<summary>Commits</summary>
<ul>
<li>See full diff in <a
href="https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=@types/node&package-manager=npm_and_yarn&previous-version=18.11.13&new-version=18.11.17)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-12-24 23:07:01 -06:00
zach
8c2255eafa chore: update to wasmtime 4.0.0 (#181) 2022-12-22 10:43:49 -08:00
zach
094f51ba2b refactor(ocaml): Cleanup code, split out extism-manifest package, prepare to release with next runtime release (#182) 2022-12-22 10:43:24 -08:00
Steve Manuel
c2b1b78cc1 Update README.md 2022-12-20 14:35:53 -07:00
Thomas Darimont
322812ede2 refactor(java-sdk): Revise API usage (#177)
(cherry picked from commit 766090a1aa8340598c643ca01dded16b15c26ba5)
2022-12-19 17:48:45 -06:00
zach
9ccef562a9 ci: use glob for paths (#178) 2022-12-19 15:09:57 -08:00
Benjamin Eckel
bc2b044770 fix(java-sdk): Bad xml 2022-12-19 15:55:28 -06:00
Benjamin Eckel
374191f420 release(java-sdk): Bump version to 0.1.0 2022-12-19 15:39:12 -06:00
zach
ba69d9fcc8 chore: move each language to separate workflow (#176)
- Moves each language into a separate workflow
- Only runs CI for languages when they're changed (or when the runtime
is changed)
2022-12-19 12:38:50 -08:00
Benjamin Eckel
6cbde1acfc docs(java-sdk): Update readme (#175) 2022-12-19 11:42:08 -06:00
Benjamin Eckel
f34fa8bed2 feat(java-sdk): Create Java Host SDK (#122)
Closes #117

Signed-off-by: Thomas Darimont <thomas.darimont@googlemail.com>
Co-authored-by: Thomas Darimont <thomas.darimont@googlemail.com>
2022-12-19 10:55:40 -06:00
zach
dd0c5757da chore: update OCaml version to latest release (#171) 2022-12-16 11:19:19 -08:00
zach
34feb4b942 fix(haskell): update encoding of Extism.Manifest.HTTPRequest (#170) 2022-12-15 17:44:22 -08:00
zach
34b5942dd5 fix: use timeouts for language-specific runtime initialization/finalization calls (#169)
After adding the timer code plugins written in Haskell fail with a
timeout when trying to call `hs_init` - this PR fixes the runtime
initialization and updates those functions to respect the configured
timeout.
2022-12-15 16:43:19 -08:00
Benjamin Eckel
d681dcd9f1 chore(dotnet-sdk): Update Sample file, use the one from the docs (#164) 2022-12-15 14:52:53 -08:00
zach
4622f32a69 feat: add timeout_ms field to SDKs (#165) 2022-12-14 17:48:05 -08:00
zach
0c4b985ed7 feat: Add option to set timeout for plugin (#163)
- Adds `Manifest::timeout_ms` field to specify the plugin timeout in
milliseconds
- Sets a 30 second default timeout

Co-authored-by: Steve Manuel <steve@dylib.so>
2022-12-13 15:58:52 -08:00
Steve Manuel
5dfe7162b4 chore: include .net in readme list of sdk support 2022-12-13 12:35:28 -05:00
Steve Manuel
e0f8e54504 chore: update readme language support graphic 2022-12-13 12:33:21 -05:00
Benjamin Eckel
a236e59d3c docs: Add link to Haskell PDK instructions (#162) 2022-12-13 10:28:11 -06:00
dependabot[bot]
77c1d55791 chore(deps-dev): Bump @types/jest from 29.2.3 to 29.2.4 in /node (#155)
Bumps
[@types/jest](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/jest)
from 29.2.3 to 29.2.4.
<details>
<summary>Commits</summary>
<ul>
<li>See full diff in <a
href="https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/jest">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=@types/jest&package-manager=npm_and_yarn&previous-version=29.2.3&new-version=29.2.4)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-12-13 11:15:54 -05:00
Benjamin Eckel
ab36decbe7 fix(dotnet-sdk): Missed native version bump 2022-12-12 16:47:10 -06:00
Benjamin Eckel
0343bbbefe chore(dotnet-sdk): Release 0.2.0 (#161) 2022-12-12 16:42:53 -06:00
Benjamin Eckel
95ccafb02b ci(dotnet-sdk): Package dotnet lib with native dll (#152)
Fix release for native windows nuget package
2022-12-12 11:08:10 -06:00
Benjamin Eckel
c8308c3cdf docs(dotnet-sdk): RC-2 version to test 2022-12-12 11:06:54 -06:00
dependabot[bot]
aedb5b9c24 chore(deps-dev): Bump typedoc from 0.23.21 to 0.23.22 in /node (#156)
[//]: # (dependabot-start)
⚠️  **Dependabot is rebasing this PR** ⚠️ 

Rebasing might not happen immediately, so don't worry if this takes some
time.

Note: if you make any changes to this PR yourself, they will take
precedence over the rebase.

---

[//]: # (dependabot-end)

Bumps [typedoc](https://github.com/TypeStrong/TypeDoc) from 0.23.21 to
0.23.22.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/TypeStrong/TypeDoc/releases">typedoc's
releases</a>.</em></p>
<blockquote>
<h2>v0.23.22</h2>
<h3>Features</h3>
<ul>
<li>Add support for defining the kind sort order, <a
href="https://github-redirect.dependabot.com/TypeStrong/TypeDoc/issues/2109">#2109</a>.</li>
</ul>
<h3>Bug Fixes</h3>
<ul>
<li>Normalize all file paths on Windows, <a
href="https://github-redirect.dependabot.com/TypeStrong/TypeDoc/issues/2113">#2113</a>.</li>
<li>Fix <code>@link</code> tags within lists, <a
href="https://github-redirect.dependabot.com/TypeStrong/TypeDoc/issues/2103">#2103</a>.</li>
</ul>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/TypeStrong/typedoc/blob/master/CHANGELOG.md">typedoc's
changelog</a>.</em></p>
<blockquote>
<h2>v0.23.22 (2022-12-11)</h2>
<h3>Features</h3>
<ul>
<li>Add support for defining the kind sort order, <a
href="https://github-redirect.dependabot.com/TypeStrong/TypeDoc/issues/2109">#2109</a>.</li>
</ul>
<h3>Bug Fixes</h3>
<ul>
<li>Normalize all file paths on Windows, <a
href="https://github-redirect.dependabot.com/TypeStrong/TypeDoc/issues/2113">#2113</a>.</li>
<li>Fix <code>@link</code> tags within lists, <a
href="https://github-redirect.dependabot.com/TypeStrong/TypeDoc/issues/2103">#2103</a>.</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="ff5cb55a08"><code>ff5cb55</code></a>
Update changelog for release</li>
<li><a
href="678bf5e4dd"><code>678bf5e</code></a>
Bump version to 0.23.22</li>
<li><a
href="84c26e65d8"><code>84c26e6</code></a>
Fix <code>@link</code> tags within lists</li>
<li><a
href="5edf2290e7"><code>5edf229</code></a>
Add support for defining the kind sort order</li>
<li><a
href="36c95c0432"><code>36c95c0</code></a>
Normalize all paths on Windows</li>
<li>See full diff in <a
href="https://github.com/TypeStrong/TypeDoc/compare/v0.23.21...v0.23.22">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=typedoc&package-manager=npm_and_yarn&previous-version=0.23.21&new-version=0.23.22)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-12-12 10:38:07 -06:00
dependabot[bot]
f34cc8f6ca chore(deps-dev): Bump typescript from 4.9.3 to 4.9.4 in /node (#157)
Bumps [typescript](https://github.com/Microsoft/TypeScript) from 4.9.3
to 4.9.4.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/Microsoft/TypeScript/releases">typescript's
releases</a>.</em></p>
<blockquote>
<h2>TypeScript 4.9.4</h2>
<p>For release notes, check out the <a
href="https://devblogs.microsoft.com/typescript/announcing-typescript-4-9">release
announcement</a>.</p>
<p>For the complete list of fixed issues, check out the</p>
<ul>
<li><a
href="https://github.com/Microsoft/TypeScript/issues?utf8=%E2%9C%93&amp;q=is%3Aissue+milestone%3A%22TypeScript+4.9.4%22+is%3Aclosed+">fixed
issues query for Typescript v4.9.4</a>.</li>
</ul>
<p>Downloads are available on:</p>
<ul>
<li><a href="https://www.npmjs.com/package/typescript">npm</a></li>
<li><a
href="https://www.nuget.org/packages/Microsoft.TypeScript.MSBuild">NuGet
package</a></li>
</ul>
<h2>Changes:</h2>
<ul>
<li>e2868216f637e875a74c675845625eb15dcfe9a2 Bump version to 4.9.4 and
LKG.</li>
<li>eb5419fc8d980859b98553586dfb5f40d811a745 Cherry-pick <a
href="https://github-redirect.dependabot.com/Microsoft/TypeScript/issues/51704">#51704</a>
to release 4.9 (<a
href="https://github-redirect.dependabot.com/Microsoft/TypeScript/issues/51712">#51712</a>)</li>
<li>b4d382b9b12460adf2da4cc0d1429cf19f8dc8be Cherry-pick changes for
narrowing to tagged literal types.</li>
<li>e7a02f43fce47e1a39259ada5460bcc33c8e98b5 Port of <a
href="https://github-redirect.dependabot.com/Microsoft/TypeScript/issues/51626">#51626</a>
and <a
href="https://github-redirect.dependabot.com/Microsoft/TypeScript/issues/51689">#51689</a>
to release-4.9 (<a
href="https://github-redirect.dependabot.com/Microsoft/TypeScript/issues/51627">#51627</a>)</li>
<li>1727912f0437a7f367d90040fc4b0b4f3efd017a Cherry-pick fix around
<code>visitEachChild</code> to release-4.9. (<a
href="https://github-redirect.dependabot.com/Microsoft/TypeScript/issues/51544">#51544</a>)</li>
</ul>
<p>This list of changes was <a
href="https://typescript.visualstudio.com/cf7ac146-d525-443c-b23c-0d58337efebc/_release?releaseId=117&amp;_a=release-summary">auto
generated</a>.</p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="e2868216f6"><code>e286821</code></a>
Bump version to 4.9.4 and LKG.</li>
<li><a
href="eb5419fc8d"><code>eb5419f</code></a>
Cherry-pick <a
href="https://github-redirect.dependabot.com/Microsoft/TypeScript/issues/51704">#51704</a>
to release 4.9 (<a
href="https://github-redirect.dependabot.com/Microsoft/TypeScript/issues/51712">#51712</a>)</li>
<li><a
href="b4d382b9b1"><code>b4d382b</code></a>
Cherry-pick changes for narrowing to tagged literal types.</li>
<li><a
href="e7a02f43fc"><code>e7a02f4</code></a>
Port of <a
href="https://github-redirect.dependabot.com/Microsoft/TypeScript/issues/51626">#51626</a>
and <a
href="https://github-redirect.dependabot.com/Microsoft/TypeScript/issues/51689">#51689</a>
to release-4.9 (<a
href="https://github-redirect.dependabot.com/Microsoft/TypeScript/issues/51627">#51627</a>)</li>
<li><a
href="1727912f04"><code>1727912</code></a>
Cherry-pick fix around <code>visitEachChild</code> to release-4.9. (<a
href="https://github-redirect.dependabot.com/Microsoft/TypeScript/issues/51544">#51544</a>)</li>
<li>See full diff in <a
href="https://github.com/Microsoft/TypeScript/compare/v4.9.3...v4.9.4">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=typescript&package-manager=npm_and_yarn&previous-version=4.9.3&new-version=4.9.4)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-12-12 10:37:45 -06:00
dependabot[bot]
dc2d015573 chore(deps-dev): Bump @types/node from 18.11.10 to 18.11.13 in /node (#158)
[//]: # (dependabot-start)
⚠️  **Dependabot is rebasing this PR** ⚠️ 

Rebasing might not happen immediately, so don't worry if this takes some
time.

Note: if you make any changes to this PR yourself, they will take
precedence over the rebase.

---

[//]: # (dependabot-end)

Bumps
[@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node)
from 18.11.10 to 18.11.13.
<details>
<summary>Commits</summary>
<ul>
<li>See full diff in <a
href="https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=@types/node&package-manager=npm_and_yarn&previous-version=18.11.10&new-version=18.11.13)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-12-12 10:37:26 -06:00
dependabot[bot]
6a7b595c08 chore(deps-dev): Bump prettier from 2.8.0 to 2.8.1 in /node (#159)
Bumps [prettier](https://github.com/prettier/prettier) from 2.8.0 to
2.8.1.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/prettier/prettier/releases">prettier's
releases</a>.</em></p>
<blockquote>
<h2>2.8.1</h2>
<p>🔗 <a
href="https://github.com/prettier/prettier/blob/main/CHANGELOG.md#281">Changelog</a></p>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/prettier/prettier/blob/main/CHANGELOG.md">prettier's
changelog</a>.</em></p>
<blockquote>
<h1>2.8.1</h1>
<p><a
href="https://github.com/prettier/prettier/compare/2.8.0...2.8.1">diff</a></p>
<h4>Fix SCSS map in arguments (<a
href="https://github-redirect.dependabot.com/prettier/prettier/pull/9184">#9184</a>
by <a
href="https://github.com/agamkrbit"><code>@​agamkrbit</code></a>)</h4>
<!-- raw HTML omitted -->
<pre lang="scss"><code>// Input
$display-breakpoints: map-deep-merge(
  (
    &quot;print-only&quot;: &quot;only print&quot;,
    &quot;screen-only&quot;: &quot;only screen&quot;,
&quot;xs-only&quot;: &quot;only screen and (max-width:
#{map-get($grid-breakpoints, &quot;sm&quot;)-1})&quot;,
  ),
  $display-breakpoints
);
<p>// Prettier 2.8.0
$display-breakpoints: map-deep-merge(
(
&quot;print-only&quot;: &quot;only print&quot;,
&quot;screen-only&quot;: &quot;only screen&quot;,
&quot;xs-only&quot;: &quot;only screen and (max-width:
#{map-get($grid-breakpoints, &quot; sm
&quot;)-1})&quot;,
),
$display-breakpoints
);</p>
<p>// Prettier 2.8.1
$display-breakpoints: map-deep-merge(
(
&quot;print-only&quot;: &quot;only print&quot;,
&quot;screen-only&quot;: &quot;only screen&quot;,
&quot;xs-only&quot;: &quot;only screen and (max-width:
#{map-get($grid-breakpoints, &quot;sm&quot;)-1})&quot;,
),
$display-breakpoints
);
</code></pre></p>
<h4>Support auto accessors syntax (<a
href="https://github-redirect.dependabot.com/prettier/prettier/pull/13919">#13919</a>
by <a
href="https://github.com/sosukesuzuki"><code>@​sosukesuzuki</code></a>)</h4>
<p>Support for <a
href="https://devblogs.microsoft.com/typescript/announcing-typescript-4-9/#auto-accessors-in-classes">Auto
Accessors Syntax</a> landed in TypeScript 4.9.</p>
<p>(Doesn't work well with <code>babel-ts</code> parser)</p>
<!-- raw HTML omitted -->
<pre lang="tsx"><code>class Foo {
  accessor foo: number = 3;
&lt;/tr&gt;&lt;/table&gt; 
</code></pre>
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="cd1df1a184"><code>cd1df1a</code></a>
Release 2.8.1</li>
<li><a
href="5541a63d76"><code>5541a63</code></a>
Remove version validation</li>
<li><a
href="1cf760a184"><code>1cf760a</code></a>
Support decorator auto accessors syntax (<a
href="https://github-redirect.dependabot.com/prettier/prettier/issues/13919">#13919</a>)</li>
<li><a
href="aa34209820"><code>aa34209</code></a>
test: format instantiation expr in logical expr (<a
href="https://github-redirect.dependabot.com/prettier/prettier/issues/13897">#13897</a>)</li>
<li><a
href="957b4f20e8"><code>957b4f2</code></a>
Build(deps): Bump decode-uri-component from 0.2.0 to 0.2.2 in /website
(<a
href="https://github-redirect.dependabot.com/prettier/prettier/issues/13933">#13933</a>)</li>
<li><a
href="e4240aeaf0"><code>e4240ae</code></a>
Add tests for keyword class property (<a
href="https://github-redirect.dependabot.com/prettier/prettier/issues/13927">#13927</a>)</li>
<li><a
href="655a161d0f"><code>655a161</code></a>
Add tests for multiple comments (<a
href="https://github-redirect.dependabot.com/prettier/prettier/issues/13890">#13890</a>)</li>
<li><a
href="4a1e32a9de"><code>4a1e32a</code></a>
Fixed scss function arguments on different lines in maps <a
href="https://github-redirect.dependabot.com/prettier/prettier/issues/9128">#9128</a>
(<a
href="https://github-redirect.dependabot.com/prettier/prettier/issues/9184">#9184</a>)</li>
<li><a
href="38806fe666"><code>38806fe</code></a>
Migrate from probot/no-response to lee-dohm/no-response (<a
href="https://github-redirect.dependabot.com/prettier/prettier/issues/13891">#13891</a>)</li>
<li><a
href="a60bee2e2d"><code>a60bee2</code></a>
Add '--single-attribute-per-line' option to Playground (<a
href="https://github-redirect.dependabot.com/prettier/prettier/issues/13587">#13587</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/prettier/prettier/compare/2.8.0...2.8.1">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=prettier&package-manager=npm_and_yarn&previous-version=2.8.0&new-version=2.8.1)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-12-12 10:37:04 -06:00
zach
a68823e71c fix: remove old/duplicate Haskell runtime initialization code (#154) 2022-12-10 20:10:34 -08:00
zach
9a1d99a6e7 fix: order of arguments to Func::new 2022-12-09 19:39:15 -08:00
zach
f2a9851867 fix: order of arguments to Function::new 2022-12-09 19:35:15 -08:00
zach
124787127c feat: Add ability to register host functions with the runtime from the Rust SDK (#148)
- Adds the ability to initialize plugins with additional functions
created by the host (only supported by the Rust SDK right now)
- Adds `PluginBuilder` to the Rust SDK to make it easier to configure all the options

## Hello, world

The following example uses `println` from the host to print to stdout
from inside the plugin.

Host:
```rust
use extism::*;

fn main() -> Result<(), Error> {
    let context = Context::new();
    let manifest = Manifest::new([std::path::PathBuf::from("code.wasm")]);
    let say_hello = Function::new("say_hello", [ValType::I64], [], |caller, input, _out| {
        let internal = caller.data();
        let r = internal.memory().get_str(input[0].unwrap_i64() as usize)?;
        println!("Hello, {r}!");
        Ok(())
    });
    let mut plugin = PluginBuilder::new(manifest)
        .with_function(say_hello)
        .with_wasi(true)
        .build(&context)?;
    plugin.call("test", b"world").unwrap();
    Ok(())
}
```

Plugin:
```rust
use extism_pdk::*;

extern "C" {
    fn say_hello(offs: u64);
}

#[plugin_fn]
pub fn test(input: String) -> FnResult<()> {
    let memory = Memory::from_bytes(&input);
    unsafe {
        say_hello(memory.offset);
    }
    Ok(())
}

```
2022-12-09 16:08:50 -08:00
Muhammad Azeez
c3ffb25891 feat: Implement .NET Host SDK (#119)
I am working on a .NET host for extism. My plan is to do the following:
 - [x] Implement a proof of concept to make sure things are possible
- [x] Write docs for the C# API so that the users get a nice IDE
experience
 - [x] Create a github action to publish the NuGet packages
    - [x] Edit `ci.yml` to include .NET Sdk
- [x] Create `release-dotnet.yml` to release `Extism.Sdk` nuget package
- [x] Maybe Create `release-dotnet-native.yml` to release
`Extism.runtime.win` nuget package
 - [x] Test on Linux (Help needed)
 - [x] Test on Mac (Help needed)
 - [x] Expose all of the Extism functions
 - [x] Write automated tests
- [x] ~Edit README show that the there is a .NET SDK~. Probably we
should not do this until we have a docs page.
 - [x] ~Use the `Extism.runtime.win-x64` package in the sample project~

Out of scope for this PR:
 - Json Serialization/Desererialization support

Co-authored-by: Alistair Evans <alistairjevans@gmail.com>
Co-authored-by: Benjamin Eckel <bhelx@simst.im>
Co-authored-by: Benjamin Eckel <bhelx@users.noreply.github.com>
2022-12-08 12:42:27 -06:00
zach
e473d2cb7e refactor(haskell): cleanup haskell SDK to prepare for release (#138)
- Switches from `stack` to `cabal`
- Cleanup SDK code
- Adds release action (still waiting on Hackage upload approval)

Co-authored-by: Steve Manuel <steve@dylib.so>
2022-12-08 10:07:56 -08:00
zach
5a5b538855 fix(ci): don’t install Python dev dependencies on CI (#149) 2022-12-07 18:45:50 -08:00
zach
acb06b9898 feat: Add support for allowed_paths manifest key in SDKs (#144)
The Haskell SDK is updated here:
https://github.com/extism/extism/pull/138
2022-12-07 07:52:23 -08:00
zach
1973024816 fix: disallow all hosts if allowed_hosts is empty (#143) 2022-12-06 08:29:08 -08:00
zach
d4febd7228 fix: use Dir::open_ambient_dir instead of Dir::from_std_file (#140)
`Dir::from_std_file` works on Linux, but does not work as expected on
Windows
2022-12-06 08:28:51 -08:00
zach
bb2697193a feat: add allowed_paths to specify preopened directories in WASI (#137)
Adds ability to make local files available to plugins. Using the Rust
SDK:

```rust
let wasm = include_bytes!("code.wasm");
let mut context = Context::new();
let manifest = Manifest::new(vec![Wasm::data(wasm)]).with_allowed_path("/path/on/disk", "/plugin/path");
let plugin = Plugin::new_with_manifest(&mut context, &manifest, false)?;
...
```
2022-12-05 18:01:25 -08:00
zach
fee7348cee fix: Reinstantiate after call to _start (#135)
After a closer reading of:
https://github.com/WebAssembly/WASI/blob/main/legacy/application-abi.md
it looks likes `_start` is expected to be called at most once. This PR
automatically reinstantiates a plugin after a call to `_start` so it can
be used again.

CI caught a bug with the `extism_version` output which is fixed here:
https://github.com/extism/extism/pull/139
2022-12-05 16:18:30 -08:00
zach
9cf54d5f1f feat: Improve usability of manifest types (#124)
- Adds some helper functions for creating a manifest, mostly helpful for
the Rust SDK
- Renames `ManifestWasm` to `Wasm`
- Renames `ManifestMemory` to `MemoryOptions`
- `ManifestWasm` and `ManifestMemory` have been marked as deprecated
- Adds an alias from `MemoryOptions::max_pages` to `MemoryOptions::max`
in serde specification

Co-authored-by: Steve Manuel <steve@dylib.so>
2022-12-05 15:09:50 -08:00
zach
a3c6b9ee6a fix: add null byte to end of version string (#139) 2022-12-05 14:38:11 -08:00
dependabot[bot]
732b886fd5 chore(deps-dev): Bump @types/node from 18.11.9 to 18.11.10 in /node (#130)
Bumps
[@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node)
from 18.11.9 to 18.11.10.
<details>
<summary>Commits</summary>
<ul>
<li>See full diff in <a
href="https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=@types/node&package-manager=npm_and_yarn&previous-version=18.11.9&new-version=18.11.10)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-12-04 19:53:46 -06:00
dependabot[bot]
bd8ca71275 chore(deps-dev): Bump @types/ffi-napi from 4.0.6 to 4.0.7 in /node (#131)
Bumps
[@types/ffi-napi](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/ffi-napi)
from 4.0.6 to 4.0.7.
<details>
<summary>Commits</summary>
<ul>
<li>See full diff in <a
href="https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/ffi-napi">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=@types/ffi-napi&package-manager=npm_and_yarn&previous-version=4.0.6&new-version=4.0.7)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-12-04 19:53:36 -06:00
zach
37ee7d67b6 fix: update crate name to extism_runtime in logging registration function (#123)
This bug exists because we didn't change the crate name in the logging
registration function, so all of our logs from `extism_runtime` were
being filtered out.
2022-12-02 14:04:54 -08:00
Steve Manuel
6b5f7999b7 fix: removes the stdout print of extism.h in php sdk (#112) 2022-11-30 16:30:06 -08:00
Benjamin Eckel
de24fffc7c fix(elixir-sdk): remove compiled nif from package, update readme (#111) 2022-11-30 16:38:51 -06:00
Benjamin Eckel
37b8e5bd12 release: v0.1.0 (#110) 2022-11-30 14:52:46 -06:00
Benjamin Eckel
c6b8429c67 chore: Add Makefile for browser runtime (#103)
I accidentally published without building. this should help make sure
releases are valid
2022-11-30 13:20:23 -06:00
Benjamin Eckel
ad114f44d2 fix(ruby-sdk): Add FFI gem as dependency (#106) 2022-11-30 13:19:54 -06:00
Benjamin Eckel
45180ad473 docs(node-sdk): Fix example to use CJS imports (#107) 2022-11-30 13:19:45 -06:00
Benjamin Eckel
9546dac689 docs(elixir-sdk): Reduce elixir min version (#108)
I've tested it in at least as low as 1.12. It just prints out a warning
so should be fine if someone wants to use it on an older version.
2022-11-30 13:19:28 -06:00
zach
197e934258 Fix elixir bindings (#109) 2022-11-30 10:42:43 -08:00
Benjamin Eckel
339556597b chore(python-sdk): Put placeholder readme in python dir (#104) 2022-11-29 12:39:01 -06:00
Benjamin Eckel
64927d9bcd fix(rust-sdk): Fix dep versions (#102) 2022-11-29 12:17:49 -06:00
Benjamin Eckel
86f1117ad5 chore: Fix bad publish, bump to 0.0.2 2022-11-29 11:52:55 -06:00
Benjamin Eckel
34be80a7ad chore: Fix elixir release workflow (#77) 2022-11-29 11:47:30 -06:00
Benjamin Eckel
3e6a0071e9 fix: Fix the release action (#101) 2022-11-29 10:33:26 -06:00
Benjamin Eckel
d17b693c4b release: Bump to 0.0.1 (#97) 2022-11-29 09:48:40 -06:00
zach
18fceec8f8 Cleanup Haskell SDK, split out manifest sublibrary (#99) 2022-11-28 21:03:13 -08:00
Benjamin Eckel
f5cf4f184e chore: fix ruby release publish (#78) 2022-11-28 19:31:26 -06:00
Steve Manuel
821661d391 fix: resolve php sdk issues (#95) 2022-11-28 18:04:27 -07:00
zach
f28e01125e Updates for wasmtime/wasmtime-wasi/wasmtime-wasi-nn, basic support for calling _start functions (#94)
- Updates codebase to use the latest version of wasmtime, wasmtime-wasi
and wasmtime-wasi-nn
- Allows functions with no return values to be called, this provides
basic support for `_start` functions
- For now `_start` functions called by extism still need to use the
extism input/output functions instead of the command line arguments
2022-11-28 14:08:52 -08:00
dependabot[bot]
c0faa53df5 chore(deps-dev): bump prettier from 2.7.1 to 2.8.0 in /node (#90)
Bumps [prettier](https://github.com/prettier/prettier) from 2.7.1 to
2.8.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/prettier/prettier/releases">prettier's
releases</a>.</em></p>
<blockquote>
<h2>2.8.0</h2>
<p><a
href="https://github.com/prettier/prettier/compare/2.7.1...2.8.0">diff</a></p>
<p>🔗 <a href="https://prettier.io/blog/2022/11/23/2.8.0.html">Release
note</a></p>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/prettier/prettier/blob/main/CHANGELOG.md">prettier's
changelog</a>.</em></p>
<blockquote>
<h1>2.8.0</h1>
<p><a
href="https://github.com/prettier/prettier/compare/2.7.1...2.8.0">diff</a></p>
<p>🔗 <a href="https://prettier.io/blog/2022/11/23/2.8.0.html">Release
Notes</a></p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="dcc0623911"><code>dcc0623</code></a>
Release 2.8.0</li>
<li><a
href="7f7498109b"><code>7f74981</code></a>
Remove version validattion temp</li>
<li><a
href="876c297589"><code>876c297</code></a>
Update changelog for <code>satisfies</code> (<a
href="https://github-redirect.dependabot.com/prettier/prettier/issues/13879">#13879</a>)</li>
<li><a
href="fd376000e9"><code>fd37600</code></a>
Update <code>@typescript-eslint/typescript-estree</code> to support
<code>satisfies</code> (<a
href="https://github-redirect.dependabot.com/prettier/prettier/issues/13872">#13872</a>)</li>
<li><a
href="fac87619a4"><code>fac8761</code></a>
Build(deps): Bump minimatch from 3.0.4 to 3.1.2 in /scripts/release (<a
href="https://github-redirect.dependabot.com/prettier/prettier/issues/13854">#13854</a>)</li>
<li><a
href="68ea881498"><code>68ea881</code></a>
Update typescript to v4.9 (<a
href="https://github-redirect.dependabot.com/prettier/prettier/issues/13852">#13852</a>)</li>
<li><a
href="5e0b88329e"><code>5e0b883</code></a>
Fix generate truncate comment (backport <a
href="https://github-redirect.dependabot.com/prettier/prettier/issues/13437">#13437</a>)
(<a
href="https://github-redirect.dependabot.com/prettier/prettier/issues/13814">#13814</a>)</li>
<li><a
href="a980caa7db"><code>a980caa</code></a>
Add missing changelog for <a
href="https://github-redirect.dependabot.com/prettier/prettier/issues/13016">#13016</a>
(<a
href="https://github-redirect.dependabot.com/prettier/prettier/issues/13812">#13812</a>)</li>
<li><a
href="520dbcd36e"><code>520dbcd</code></a>
Add changelog for <a
href="https://github-redirect.dependabot.com/prettier/prettier/issues/13783">#13783</a>
(<a
href="https://github-redirect.dependabot.com/prettier/prettier/issues/13811">#13811</a>)</li>
<li><a
href="ae4d85ab3c"><code>ae4d85a</code></a>
Update description of <code>vueIndentScriptAndStyle</code> option (<a
href="https://github-redirect.dependabot.com/prettier/prettier/issues/13781">#13781</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/prettier/prettier/compare/2.7.1...2.8.0">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=prettier&package-manager=npm_and_yarn&previous-version=2.7.1&new-version=2.8.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-27 19:46:47 -06:00
dependabot[bot]
be7961bbf6 chore(deps-dev): bump ex_doc from 0.29.0 to 0.29.1 in /elixir (#89)
Bumps [ex_doc](https://github.com/elixir-lang/ex_doc) from 0.29.0 to
0.29.1.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/elixir-lang/ex_doc/blob/main/CHANGELOG.md">ex_doc's
changelog</a>.</em></p>
<blockquote>
<h2>v0.29.1 (2022-11-21)</h2>
<ul>
<li>
<p>Enhancements</p>
<ul>
<li>Add optional function annotations</li>
<li>Support media print on stylesheets</li>
<li>Add download ePub link to footer</li>
<li>Support extras for Erlang</li>
<li>Add tooltip to functions on sidebar</li>
<li>Disable spellcheck and autocorrect on search input</li>
</ul>
</li>
<li>
<p>Bug fix</p>
<ul>
<li>Special handle functions called <code>record/*</code> in Erlang</li>
</ul>
</li>
<li>
<p>Deprecations</p>
<ul>
<li>Rename <code>:groups_for_functions</code> to
<code>:groups_for_docs</code></li>
</ul>
</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="1439375934"><code>1439375</code></a>
Release v0.29.1</li>
<li><a
href="e4ae7ce037"><code>e4ae7ce</code></a>
Rename groups_for_functions as groups_for_docs</li>
<li><a
href="b17fcd278a"><code>b17fcd2</code></a>
Add optional function annotations (<a
href="https://github-redirect.dependabot.com/elixir-lang/ex_doc/issues/1627">#1627</a>)</li>
<li><a
href="69a74c029c"><code>69a74c0</code></a>
Firefox H2 print rendering fix (<a
href="https://github-redirect.dependabot.com/elixir-lang/ex_doc/issues/1630">#1630</a>)</li>
<li><a
href="623ac03fea"><code>623ac03</code></a>
mix format</li>
<li><a
href="a9284d50e3"><code>a9284d5</code></a>
Consistenly use <strong>doc</strong> for metadata</li>
<li><a
href="a4ea93cf26"><code>a4ea93c</code></a>
Rename internal nodes for consistency</li>
<li><a
href="5a0aa08550"><code>5a0aa08</code></a>
Simplify handling of empty nodes in module summary</li>
<li><a
href="148ad54a6d"><code>148ad54</code></a>
Use v1.13 formatting rules</li>
<li><a
href="4b05286003"><code>4b05286</code></a>
mix format</li>
<li>Additional commits viewable in <a
href="https://github.com/elixir-lang/ex_doc/compare/v0.29.0...v0.29.1">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=ex_doc&package-manager=hex&previous-version=0.29.0&new-version=0.29.1)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-27 19:46:38 -06:00
Benjamin Eckel
4af4f7c41a fix(php-sdk): fix the composer file (#88)
Need to include new Context file
2022-11-22 16:51:19 -06:00
Benjamin Eckel
0003246ff7 chore: release browser version rc.13 2022-11-21 16:04:21 -06:00
Benjamin Eckel
886e01b959 Merge branch 'main' of github.com:extism/extism 2022-11-21 16:03:05 -06:00
Benjamin Eckel
b30bcc3601 chore: release browser version rc.11 2022-11-21 16:02:25 -06:00
zach
b57d54e63e feat: add var/config functions, merge ExtismPlugin and ExtismPluginCall (#87)
This also only instantiates the module once and combines `ExtismPlugin`
with `ExtismPluginCall`, I can pull out just the new function
implementations if that's an issue.
2022-11-21 13:34:27 -08:00
dependabot[bot]
ba2516650d chore(deps-dev): bump typedoc from 0.23.20 to 0.23.21 in /node (#86)
Bumps [typedoc](https://github.com/TypeStrong/TypeDoc) from 0.23.20 to
0.23.21.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/TypeStrong/TypeDoc/releases">typedoc's
releases</a>.</em></p>
<blockquote>
<h2>v0.23.21</h2>
<h3>Features</h3>
<ul>
<li>Added support for a catch-all wildcard in
<code>externalSymbolLinkMappings</code>, <a
href="https://github-redirect.dependabot.com/TypeStrong/TypeDoc/issues/2102">#2102</a>.</li>
<li>Added support for TypeScript 4.9.</li>
</ul>
<h3>Thanks!</h3>
<ul>
<li><a
href="https://github.com/mistic100"><code>@​mistic100</code></a></li>
</ul>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/TypeStrong/typedoc/blob/master/CHANGELOG.md">typedoc's
changelog</a>.</em></p>
<blockquote>
<h2>v0.23.21 (2022-11-14)</h2>
<h3>Features</h3>
<ul>
<li>Added support for a catch-all wildcard in
<code>externalSymbolLinkMappings</code>, <a
href="https://github-redirect.dependabot.com/TypeStrong/TypeDoc/issues/2102">#2102</a>.</li>
<li>Added support for TypeScript 4.9.</li>
</ul>
<h3>Thanks!</h3>
<ul>
<li><a
href="https://github.com/mistic100"><code>@​mistic100</code></a></li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="8a3e195d38"><code>8a3e195</code></a>
Update changelog for release</li>
<li><a
href="530eab35be"><code>530eab3</code></a>
Bump version to 0.23.21</li>
<li><a
href="893c86c6a8"><code>893c86c</code></a>
Fix lint</li>
<li><a
href="38fe129856"><code>38fe129</code></a>
CI fix?</li>
<li><a
href="9b62e0ce6e"><code>9b62e0c</code></a>
Add support for TS 4.9</li>
<li><a
href="8e190487b1"><code>8e19048</code></a>
Tweak changelog notes</li>
<li><a
href="0ba5af5204"><code>0ba5af5</code></a>
Merge pull request <a
href="https://github-redirect.dependabot.com/TypeStrong/TypeDoc/issues/2102">#2102</a>
from mistic100/external-wildcard</li>
<li><a
href="4b0a9b0a90"><code>4b0a9b0</code></a>
Fix <a
href="https://github-redirect.dependabot.com/TypeStrong/TypeDoc/issues/2101">#2101</a>
support externalSymbolLinkMappings wildcard</li>
<li><a
href="1ab233b1cf"><code>1ab233b</code></a>
reg-suit begone! -300 dev dependencies</li>
<li><a
href="ab51894154"><code>ab51894</code></a>
Clean up some unnecessary any</li>
<li>Additional commits viewable in <a
href="https://github.com/TypeStrong/TypeDoc/compare/v0.23.20...v0.23.21">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=typedoc&package-manager=npm_and_yarn&previous-version=0.23.20&new-version=0.23.21)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-21 10:01:14 -06:00
dependabot[bot]
97b4582aa4 chore(deps-dev): bump typescript from 4.8.4 to 4.9.3 in /node (#85)
Bumps [typescript](https://github.com/Microsoft/TypeScript) from 4.8.4
to 4.9.3.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/Microsoft/TypeScript/releases">typescript's
releases</a>.</em></p>
<blockquote>
<h2>TypeScript 4.9</h2>
<p>For release notes, check out the <a
href="https://devblogs.microsoft.com/typescript/announcing-typescript-4-9/">release
announcement</a>.</p>
<p>Downloads are available on:</p>
<ul>
<li><a href="https://www.npmjs.com/package/typescript">npm</a></li>
<li><a
href="https://www.nuget.org/packages/Microsoft.TypeScript.MSBuild">NuGet
package</a></li>
</ul>
<h2>Changes:</h2>
<ul>
<li>93bd577458d55cd720b2677705feab5c91eb12ce Bump version to 4.9.3 and
LKG.</li>
<li>107f832b80df2dc97748021cb00af2b6813db75b Update LKG.</li>
<li>31bee5682df130a14ffdd5742f994dbe7313dd0e Cherry-pick PR <a
href="https://github-redirect.dependabot.com/Microsoft/TypeScript/issues/50977">#50977</a>
into release-4.9 (<a
href="https://github-redirect.dependabot.com/Microsoft/TypeScript/issues/51363">#51363</a>)
[ <a
href="https://github-redirect.dependabot.com/Microsoft/TypeScript/issues/50872">#50872</a>
]</li>
<li>1e2fa7ae15f8530910fef8b916ec8a4ed0b59c45 Update version to 4.9.2-rc
and LKG.</li>
<li>7ab89e5c6e401d161f31f28a6c555a3ba530910e Merge remote-tracking
branch 'origin/main' into release-4.9</li>
<li>e5cd686defb1a4cbdb36bd012357ba5bed28f371 Update
package-lock.json</li>
<li>8d40dc15d1b9945837e7860320fdccfe27c40cad Update
package-lock.json</li>
<li>5cfb3a2fe344a5350734305193e6cc99516285ca Only call return() for an
abrupt completion in user code (<a
href="https://github-redirect.dependabot.com/Microsoft/TypeScript/issues/51297">#51297</a>)</li>
<li>a7a9d158e817fcb0e94dc1c24e0a401b21be0cc9 Fix for broken baseline in
yieldInForInInDownlevelGenerator (<a
href="https://github-redirect.dependabot.com/Microsoft/TypeScript/issues/51345">#51345</a>)</li>
<li>7f8426f4df0d0a7dd8b72079dafc3e60164a23b1 fix for-in enumeration
containing yield in generator (<a
href="https://github-redirect.dependabot.com/Microsoft/TypeScript/issues/51295">#51295</a>)</li>
</ul>
<!-- raw HTML omitted -->
<ul>
<li>3d2b4017eb6b9a2b94bc673291e56ae95e8beddd Fix assertion functions
accessed via wildcard imports (<a
href="https://github-redirect.dependabot.com/Microsoft/TypeScript/issues/51324">#51324</a>)</li>
<li>64d0d5ae140b7b26a09e75114517b418d6bcaa9f fix(51301): Fixing an
unused import at the end of a line removes the newline (<a
href="https://github-redirect.dependabot.com/Microsoft/TypeScript/issues/51320">#51320</a>)</li>
<li>754eeb2986bde30d5926e0fa99c87dda9266d01b Update CodeQL workflow and
configuration, fix found bugs (<a
href="https://github-redirect.dependabot.com/Microsoft/TypeScript/issues/51263">#51263</a>)</li>
<li>d8aad262006ad2d2c91aa7a0e4449b4b83c57f7b Update
package-lock.json</li>
<li>d4f26c840b1db76c0b25a405c8e73830a2b45cbc fix(51245): Class with
parameter decorator in arrow function causes &quot;convert to default
export&quot; refactoring failure (<a
href="https://github-redirect.dependabot.com/Microsoft/TypeScript/issues/51256">#51256</a>)</li>
<li>16faf45682173ea437a50330feb4785578923d7f Update
package-lock.json</li>
<li>8b1ecdb701e2a2e19e9f8bcdd6b2beac087eabee fix(50654): &quot;Move to a
new file&quot; breaks the declaration of referenced variable (<a
href="https://github-redirect.dependabot.com/Microsoft/TypeScript/issues/50681">#50681</a>)</li>
<li>170a17fad57eae619c5ef2b7bdb3ac00d6c32c47 Dom update 2022-10-25 (<a
href="https://github-redirect.dependabot.com/Microsoft/TypeScript/issues/51300">#51300</a>)</li>
<li>9c4e14d75174432f6a4dc5967a09712a6784ab88 Remove &quot;No type
information for this code&quot; from baseline (<a
href="https://github-redirect.dependabot.com/Microsoft/TypeScript/issues/51311">#51311</a>)</li>
<li>88d25b4f232929df59729156dfda6b65277affec fix(50068): Refactors
trigger debug failure when JSX text has a ' and a tag on the same line.
(<a
href="https://github-redirect.dependabot.com/Microsoft/TypeScript/issues/51299">#51299</a>)</li>
<li>8bee69acf410d4986cb0cc102b949e2d133d5380 Update
package-lock.json</li>
<li>702de1eeaaef88a189e4d06e5a2aae287853790a Fix early call to
return/throw on generator (<a
href="https://github-redirect.dependabot.com/Microsoft/TypeScript/issues/51294">#51294</a>)</li>
<li>2c12b1499908ad7718e65d20e264561207c22375 Add a GH Action to file a
new issue if we go a week without seeing a typescript-error-deltas issue
(<a
href="https://github-redirect.dependabot.com/Microsoft/TypeScript/issues/51271">#51271</a>)</li>
<li>6af270dee09d62516f6dc02ec102a745ffebc037 Update
package-lock.json</li>
<li>2cc4c16a26672a7ba6c97ba16309fcf334db7cae Update
package-lock.json</li>
<li>60934915d9ccc4ca9c0fb2cd060d7ec81601942b Fix apparent typo in
getStringMappingType (<a
href="https://github-redirect.dependabot.com/Microsoft/TypeScript/issues/51248">#51248</a>)</li>
<li>61c26096e3373719ece686b84c698423890e9a5f Update
package-lock.json</li>
<li>ef69116c41cb6805f89e6592eacb0ccb7f02207d Generate shortest
<code>rootDirs</code> module specifier instead of first possible (<a
href="https://github-redirect.dependabot.com/Microsoft/TypeScript/issues/51244">#51244</a>)</li>
<li>bbb42f453dc684e03d977c5b70391124d57543a9 Fix typo in
canWatchDirectoryOrFile found by CodeQL (<a
href="https://github-redirect.dependabot.com/Microsoft/TypeScript/issues/51262">#51262</a>)</li>
<li>a56b254ad3c52b598bc5d44f83f3d0a1cf806068 Include 'this' type
parameter in isRelatedTo fast path (<a
href="https://github-redirect.dependabot.com/Microsoft/TypeScript/issues/51230">#51230</a>)</li>
<li>3abd351c0eea55758f27ee5558a4a1525b77f45b Fix super property
transform in async arrow in method (<a
href="https://github-redirect.dependabot.com/Microsoft/TypeScript/issues/51240">#51240</a>)</li>
<li>eed05112180e0d94f78aa02d676d49468f15dc31 Update
package-lock.json</li>
<li>2625c1feae25aede35465ca835440fc57bf13d52 Make the init config
category order predictable (<a
href="https://github-redirect.dependabot.com/Microsoft/TypeScript/issues/51247">#51247</a>)</li>
<li>1ca99b34029dafad2c18af7bdc0711f4abf7e522 fix(50551): Destructuring
assignment with var bypasses &quot;variable is used before being
assigned&quot; check (2454) (<a
href="https://github-redirect.dependabot.com/Microsoft/TypeScript/issues/50560">#50560</a>)</li>
<li>3f28fa12dfecb8dfd66ce4684bf26f64e1f092f1 Update
package-lock.json</li>
<li>906ebe49334a3a9c2dbd73cd3c902898bc712b66 Revert
structuredTypeRelatedTo change and fix isUnitLikeType (<a
href="https://github-redirect.dependabot.com/Microsoft/TypeScript/issues/51076">#51076</a>)</li>
<li>8ac465239f52de1da3ada8cdc4c3f107f4d62e45 change type (<a
href="https://github-redirect.dependabot.com/Microsoft/TypeScript/issues/51231">#51231</a>)</li>
<li>245a02cbed7ad50a21289730159abc8d19a66f40 fix(51222):
Go-to-definition on return statements should jump to the containing
function declaration (<a
href="https://github-redirect.dependabot.com/Microsoft/TypeScript/issues/51227">#51227</a>)</li>
<li>2dff34e8c4a91c0005ca9ccfb7e045e225b6f2e4 markAliasReferenced should
include ExportValue as well (<a
href="https://github-redirect.dependabot.com/Microsoft/TypeScript/issues/51219">#51219</a>)</li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="93bd577458"><code>93bd577</code></a>
Bump version to 4.9.3 and LKG.</li>
<li><a
href="107f832b80"><code>107f832</code></a>
Update LKG.</li>
<li><a
href="31bee5682d"><code>31bee56</code></a>
Cherry-pick PR <a
href="https://github-redirect.dependabot.com/Microsoft/TypeScript/issues/50977">#50977</a>
into release-4.9 (<a
href="https://github-redirect.dependabot.com/Microsoft/TypeScript/issues/51363">#51363</a>)</li>
<li><a
href="1e2fa7ae15"><code>1e2fa7a</code></a>
Update version to 4.9.2-rc and LKG.</li>
<li><a
href="7ab89e5c6e"><code>7ab89e5</code></a>
Merge remote-tracking branch 'origin/main' into release-4.9</li>
<li><a
href="e5cd686def"><code>e5cd686</code></a>
Update package-lock.json</li>
<li><a
href="8d40dc15d1"><code>8d40dc1</code></a>
Update package-lock.json</li>
<li><a
href="5cfb3a2fe3"><code>5cfb3a2</code></a>
Only call return() for an abrupt completion in user code (<a
href="https://github-redirect.dependabot.com/Microsoft/TypeScript/issues/51297">#51297</a>)</li>
<li><a
href="a7a9d158e8"><code>a7a9d15</code></a>
Fix for broken baseline in yieldInForInInDownlevelGenerator (<a
href="https://github-redirect.dependabot.com/Microsoft/TypeScript/issues/51345">#51345</a>)</li>
<li><a
href="7f8426f4df"><code>7f8426f</code></a>
fix for-in enumeration containing yield in generator (<a
href="https://github-redirect.dependabot.com/Microsoft/TypeScript/issues/51295">#51295</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/Microsoft/TypeScript/compare/v4.8.4...v4.9.3">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=typescript&package-manager=npm_and_yarn&previous-version=4.8.4&new-version=4.9.3)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-21 10:01:03 -06:00
dependabot[bot]
762feb1056 chore(deps-dev): bump jest from 29.2.2 to 29.3.1 in /node (#84)
Bumps [jest](https://github.com/facebook/jest/tree/HEAD/packages/jest)
from 29.2.2 to 29.3.1.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/facebook/jest/releases">jest's
releases</a>.</em></p>
<blockquote>
<h2>v29.3.1</h2>
<h2>Fixes</h2>
<ul>
<li><code>[jest-config]</code> Do not warn about <code>preset</code> in
<code>ProjectConfig</code> <a
href="https://github-redirect.dependabot.com/facebook/jest/pull/13583">#13583</a></li>
</ul>
<h2>Performance</h2>
<ul>
<li><code>[jest-transform]</code> Defer creation of cache directory <a
href="https://github-redirect.dependabot.com/facebook/jest/pull/13420">#13420</a></li>
</ul>
<h2>v29.3.0</h2>
<h2>Features</h2>
<ul>
<li><code>[jest-runtime]</code> Support WebAssembly (Wasm) imports in
ESM modules (<a
href="https://github-redirect.dependabot.com/facebook/jest/pull/13505">#13505</a>)</li>
</ul>
<h2>Fixes</h2>
<ul>
<li><code>[jest-config]</code> Add config validation for
<code>projects</code> option (<a
href="https://github-redirect.dependabot.com/facebook/jest/pull/13565">#13565</a>)</li>
<li><code>[jest-mock]</code> Treat cjs modules as objects so they can be
mocked (<a
href="https://github-redirect.dependabot.com/facebook/jest/pull/13513">#13513</a>)</li>
<li><code>[jest-worker]</code> Throw an error instead of hanging when
jest workers terminate unexpectedly (<a
href="https://github-redirect.dependabot.com/facebook/jest/pull/13566">#13566</a>)</li>
</ul>
<h2>Chore &amp; Maintenance</h2>
<ul>
<li><code>[@jest/transform]</code> Update
<code>convert-source-map</code> (<a
href="https://github-redirect.dependabot.com/facebook/jest/pull/13509">#13509</a>)</li>
<li><code>[docs]</code> Mention <code>toStrictEqual</code> in
UsingMatchers docs. (<a
href="https://github-redirect.dependabot.com/facebook/jest/pull/13560">#13560</a>)</li>
</ul>
<h2>New Contributors</h2>
<ul>
<li><a href="https://github.com/Tofandel"><code>@​Tofandel</code></a>
made their first contribution in <a
href="https://github-redirect.dependabot.com/facebook/jest/pull/13513">facebook/jest#13513</a></li>
<li><a
href="https://github.com/RyWilliams"><code>@​RyWilliams</code></a> made
their first contribution in <a
href="https://github-redirect.dependabot.com/facebook/jest/pull/13520">facebook/jest#13520</a></li>
<li><a href="https://github.com/waikoo"><code>@​waikoo</code></a> made
their first contribution in <a
href="https://github-redirect.dependabot.com/facebook/jest/pull/13447">facebook/jest#13447</a></li>
<li><a href="https://github.com/kachkaev"><code>@​kachkaev</code></a>
made their first contribution in <a
href="https://github-redirect.dependabot.com/facebook/jest/pull/13505">facebook/jest#13505</a></li>
<li><a href="https://github.com/ibuibu"><code>@​ibuibu</code></a> made
their first contribution in <a
href="https://github-redirect.dependabot.com/facebook/jest/pull/13565">facebook/jest#13565</a></li>
<li><a
href="https://github.com/necipallef"><code>@​necipallef</code></a> made
their first contribution in <a
href="https://github-redirect.dependabot.com/facebook/jest/pull/13560">facebook/jest#13560</a></li>
<li><a
href="https://github.com/ravshansbox"><code>@​ravshansbox</code></a>
made their first contribution in <a
href="https://github-redirect.dependabot.com/facebook/jest/pull/13533">facebook/jest#13533</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/facebook/jest/compare/v29.2.2...v29.3.0">https://github.com/facebook/jest/compare/v29.2.2...v29.3.0</a></p>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/facebook/jest/blob/main/CHANGELOG.md">jest's
changelog</a>.</em></p>
<blockquote>
<h2>29.3.1</h2>
<h3>Fixes</h3>
<ul>
<li><code>[jest-config]</code> Do not warn about <code>preset</code> in
<code>ProjectConfig</code> (<a
href="https://github-redirect.dependabot.com/facebook/jest/pull/13583">#13583</a>)</li>
</ul>
<h3>Performance</h3>
<ul>
<li><code>[jest-transform]</code> Defer creation of cache directory (<a
href="https://github-redirect.dependabot.com/facebook/jest/pull/13420">#13420</a>)</li>
</ul>
<h2>29.3.0</h2>
<h3>Features</h3>
<ul>
<li><code>[jest-runtime]</code> Support WebAssembly (Wasm) imports in
ESM modules (<a
href="https://github-redirect.dependabot.com/facebook/jest/pull/13505">#13505</a>)</li>
</ul>
<h3>Fixes</h3>
<ul>
<li><code>[jest-config]</code> Add config validation for
<code>projects</code> option (<a
href="https://github-redirect.dependabot.com/facebook/jest/pull/13565">#13565</a>)</li>
<li><code>[jest-mock]</code> Treat cjs modules as objects so they can be
mocked (<a
href="https://github-redirect.dependabot.com/facebook/jest/pull/13513">#13513</a>)</li>
<li><code>[jest-worker]</code> Throw an error instead of hanging when
jest workers terminate unexpectedly (<a
href="https://github-redirect.dependabot.com/facebook/jest/pull/13566">#13566</a>)</li>
</ul>
<h3>Chore &amp; Maintenance</h3>
<ul>
<li><code>[@jest/transform]</code> Update
<code>convert-source-map</code> (<a
href="https://github-redirect.dependabot.com/facebook/jest/pull/13509">#13509</a>)</li>
<li><code>[docs]</code> Mention <code>toStrictEqual</code> in
UsingMatchers docs. (<a
href="https://github-redirect.dependabot.com/facebook/jest/pull/13560">#13560</a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="05deb8393c"><code>05deb83</code></a>
v29.3.1</li>
<li><a
href="84b8de987b"><code>84b8de9</code></a>
v29.3.0</li>
<li>See full diff in <a
href="https://github.com/facebook/jest/commits/v29.3.1/packages/jest">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=jest&package-manager=npm_and_yarn&previous-version=29.2.2&new-version=29.3.1)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-21 10:00:53 -06:00
Benjamin Eckel
6267682266 fix(node-sdk): Properly calculate length of utf-8 inputs (#82)
Properly calculate the length of utf-8 inputs. I'll work on getting
unicode chars into our other tests as well and see if we need to fix any
other SDKs
2022-11-20 13:23:01 -06:00
Benjamin Eckel
b1ca2f398d test: Make sure we have unicode in the SDK tests (#83)
Related to https://github.com/extism/extism/pull/82

Ensures we have unicode inputs in our SDK tests. We should probably get
unicode in the output as well
2022-11-20 13:22:48 -06:00
zach
58ad4ce6e2 feat: add extism_http_status_code to get the status code of the last HTTP request + fixes for clippy (#81)
This is kind of hacky but until we have an established way of encoding
complex types in memory it seems good enough
2022-11-18 11:15:17 -08:00
zach
d0296de9a7 fix: python README path (#80) 2022-11-18 09:02:17 -08:00
zach
4db1303273 cleanup: remove extism_load_u32 and extism_store_u32 (#79) 2022-11-16 10:56:20 -08:00
Benjamin Eckel
28d16f2fa8 fix: Fix the python release workflow (#76) 2022-11-14 16:27:01 -06:00
Benjamin Eckel
e3dd34e59f feat(elixir): use result of set_log_file (#39)
We can merge this after we release `rc.6`
2022-11-14 13:58:29 -06:00
Benjamin Eckel
bb6026976c fix: fix test import syntax in browser runtime (#75) 2022-11-10 16:28:01 -06:00
Benjamin Eckel
33c0f8a4c8 chore: bump browser runtime to rc.10 and refactor (#74) 2022-11-10 15:57:38 -06:00
Benjamin Eckel
b57acde149 test(browser-runtime): Add a simple test and runner (#73) 2022-11-09 12:11:59 -06:00
Benjamin Eckel
7e8031fcdc feat: [Experimental] Extism browser runtime (#70)
Experimental browser runtime. Will allow you to load and run simple
Extism plugins in the browser.

Still a work-in-progress. I've currently implemented just enough to run
the `count_vowels` plugin. To try it out:

```
cd browser
npm install
npm run build
python3 -m http.server
```

Open http://localhost:8000

There is a small playground style app. Set the url, and the function
name. Paste in some input. Hit `Run`. The result of the plugin call
should appear on the right.

<img width="964" alt="Screen Shot 2022-11-05 at 2 01 24 PM"
src="https://user-images.githubusercontent.com/185919/200136657-80e90a77-0b79-4f9d-a5dc-f5e1f340d143.png">

Co-authored-by: zach <zachshipko@gmail.com>
2022-11-09 11:02:27 -06:00
zach
e6499cab72 Make Rust SDK depend directly on extism-runtime (#65) 2022-11-07 12:45:56 -08:00
dependabot[bot]
e44800f7f6 chore(deps-dev): bump typedoc from 0.23.19 to 0.23.20 in /node (#71)
Bumps [typedoc](https://github.com/TypeStrong/TypeDoc) from 0.23.19 to
0.23.20.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/TypeStrong/TypeDoc/releases">typedoc's
releases</a>.</em></p>
<blockquote>
<h2>v0.23.20</h2>
<h3>Bug Fixes</h3>
<ul>
<li>Fixed comment discovery for <code>@inheritDoc</code> if inheriting
from a function type alias, <a
href="https://github-redirect.dependabot.com/TypeStrong/TypeDoc/issues/2087">#2087</a>.</li>
</ul>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/TypeStrong/typedoc/blob/master/CHANGELOG.md">typedoc's
changelog</a>.</em></p>
<blockquote>
<h2>v0.23.20 (2022-11-03)</h2>
<h3>Bug Fixes</h3>
<ul>
<li>Fixed comment discovery for <code>@inheritDoc</code> if inheriting
from a function type alias, <a
href="https://github-redirect.dependabot.com/TypeStrong/TypeDoc/issues/2087">#2087</a>.</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="bfa9dbdf51"><code>bfa9dbd</code></a>
Update changelog for release</li>
<li><a
href="ea185d119a"><code>ea185d1</code></a>
Bump version to 0.23.20</li>
<li><a
href="b0012e577d"><code>b0012e5</code></a>
Doc comment</li>
<li><a
href="30555f1776"><code>30555f1</code></a>
Fix comment discovery for <code>@inheritDoc</code></li>
<li>See full diff in <a
href="https://github.com/TypeStrong/TypeDoc/compare/v0.23.19...v0.23.20">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=typedoc&package-manager=npm_and_yarn&previous-version=0.23.19&new-version=0.23.20)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-07 10:35:17 -06:00
dependabot[bot]
d6b403e112 chore(deps-dev): bump @types/jest from 29.2.1 to 29.2.2 in /node (#72)
Bumps
[@types/jest](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/jest)
from 29.2.1 to 29.2.2.
<details>
<summary>Commits</summary>
<ul>
<li>See full diff in <a
href="https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/jest">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=@types/jest&package-manager=npm_and_yarn&previous-version=29.2.1&new-version=29.2.2)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-07 10:34:55 -06:00
Benjamin Eckel
b45c04c13e ci: Workflow per SDK (#69) 2022-11-04 16:24:48 -05:00
Benjamin Eckel
33dbcafdb9 fix: Fix release workflow to use make (#68) 2022-11-04 15:46:25 -05:00
dependabot[bot]
c441ac703e chore(deps-dev): bump @types/node from 18.11.4 to 18.11.9 in /node (#62)
Bumps
[@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node)
from 18.11.4 to 18.11.9.
<details>
<summary>Commits</summary>
<ul>
<li>See full diff in <a
href="https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=@types/node&package-manager=npm_and_yarn&previous-version=18.11.4&new-version=18.11.9)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-04 14:41:43 -06:00
dependabot[bot]
3e3c97499c chore(deps-dev): bump @types/jest from 29.2.0 to 29.2.1 in /node (#63)
Bumps
[@types/jest](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/jest)
from 29.2.0 to 29.2.1.
<details>
<summary>Commits</summary>
<ul>
<li>See full diff in <a
href="https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/jest">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=@types/jest&package-manager=npm_and_yarn&previous-version=29.2.0&new-version=29.2.1)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-04 14:41:37 -06:00
dependabot[bot]
d131a344a3 chore(deps-dev): bump typedoc from 0.23.18 to 0.23.19 in /node (#64)
Bumps [typedoc](https://github.com/TypeStrong/TypeDoc) from 0.23.18 to
0.23.19.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/TypeStrong/TypeDoc/releases">typedoc's
releases</a>.</em></p>
<blockquote>
<h2>v0.23.19</h2>
<h3>Bug Fixes</h3>
<ul>
<li>Fixed title link if <code>titleLink</code> option was not specified,
<a
href="https://github-redirect.dependabot.com/TypeStrong/TypeDoc/issues/2085">#2085</a>.</li>
</ul>
<h3>Thanks!</h3>
<ul>
<li><a
href="https://github.com/krisztianb"><code>@​krisztianb</code></a></li>
</ul>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/TypeStrong/typedoc/blob/master/CHANGELOG.md">typedoc's
changelog</a>.</em></p>
<blockquote>
<h2>v0.23.19 (2022-10-28)</h2>
<h3>Bug Fixes</h3>
<ul>
<li>Fixed title link if <code>titleLink</code> option was not specified,
<a
href="https://github-redirect.dependabot.com/TypeStrong/TypeDoc/issues/2085">#2085</a>.</li>
</ul>
<h3>Thanks!</h3>
<ul>
<li><a
href="https://github.com/krisztianb"><code>@​krisztianb</code></a></li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="ef598e7427"><code>ef598e7</code></a>
Update changelog for release</li>
<li><a
href="9240b9262f"><code>9240b92</code></a>
Bump version</li>
<li><a
href="15e200b2c9"><code>15e200b</code></a>
Update changelog</li>
<li><a
href="a3cc365b40"><code>a3cc365</code></a>
Merge pull request <a
href="https://github-redirect.dependabot.com/TypeStrong/TypeDoc/issues/2086">#2086</a>
from krisztianb/bugfix/2085-invalid-title-link</li>
<li><a
href="ff8526c2c2"><code>ff8526c</code></a>
Fix wrong handling of missing/empty titleLink option value</li>
<li>See full diff in <a
href="https://github.com/TypeStrong/TypeDoc/compare/v0.23.18...v0.23.19">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=typedoc&package-manager=npm_and_yarn&previous-version=0.23.18&new-version=0.23.19)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-04 14:41:29 -06:00
Benjamin Eckel
71110117e4 feat: Add workflow_dispatch to the release workflow (#33) 2022-11-04 15:18:58 -05:00
Benjamin Eckel
5cfa2a0a5e Bump to version 0.0.1-rc.6 (#67)
Co-authored-by: zach <zach@dylib.so>
2022-11-04 14:48:19 -05:00
Benjamin Eckel
cb87a30fb3 docs: Link to the manifest concept doc (#66)
Co-authored-by: Steve Manuel <steve@dylib.so>
2022-11-04 14:04:10 -05:00
Steve Manuel
b85ee0f24c Update README.md 2022-11-04 11:53:06 -06:00
zach
ffc1a1af41 chore: update deps, add dependabot.yml (#61) 2022-11-02 10:51:42 -07:00
zach
a42a7eac5e organize: rename runtime/src/export.rs -> runtime/src/pdk.rs (#60)
This PR just renames `runtime/src/export.rs` to `runtime/src/pdk.rs` to
match `runtime/src/sdk.rs`
2022-11-01 10:21:26 -07:00
zach
08f5b84cd3 ci: fix ocaml build (#59) 2022-10-28 15:18:44 -07:00
Benjamin Eckel
1345921abd docs(python-sdk): Python docs, Makefile, code formatter (#57) 2022-10-28 10:52:31 -05:00
Steve Manuel
1bfc9cfc71 Update README.md 2022-10-27 22:00:43 -06:00
Benjamin Eckel
7fb41815e9 docs: Add elixir / erlang to the README (#56) 2022-10-27 18:38:36 -05:00
Benjamin Eckel
fe38395236 docs(node-sdk): Add docs, Makefile, format code (#55) 2022-10-27 17:22:05 -05:00
zach
fa338dc670 ci: create workflow for each language (#51)
Creates a new workflow for each language, allowing all languages to run
tests even when one fails

Also disables running on `push` (but once this is merged the workflow
can be manually triggered)
2022-10-27 14:27:10 -07:00
Benjamin Eckel
7e1f700ecd fix(node-sdk): Upgrade CI node version to 18 to get around FFI bug (#54)
Related to Issue #53
2022-10-27 13:00:09 -05:00
Benjamin Eckel
23fe3951a3 docs(ruby-sdk): Hygiene: docs, formatter, Makefile (#50)
Work in progress

* Adds some inline docs which generates a yarddoc site
* Adds linting and code formatting abilities using rufo
* Adds a Makefile with common operations

Co-authored-by: Steve Manuel <steve@dylib.so>
2022-10-27 12:20:44 -05:00
Benjamin Eckel
56e728a640 docs(elixir-sdk): Add inline docs and Makefile (#52) 2022-10-27 12:02:14 -05:00
Steve Manuel
05239cf2de Update README.md 2022-10-27 00:04:29 -06:00
zach
c76ff7c7b4 test(ocaml): Add inline unit tests and enable OCaml CI (#49)
We're using the OCaml 5.0 beta compiler on CI because we're bumping up
against this issue: https://github.com/ocaml/ocaml/issues/11489 and the
fix isn't released yet.
2022-10-25 19:21:37 -07:00
zach
cb6d51f64f test(haskell): Add unit tests (#48) 2022-10-25 19:21:22 -07:00
zach
83d3670f17 test(cpp): Add tests and missing functionality for C++ (#47) 2022-10-25 17:24:52 -07:00
Benjamin Eckel
77f13a6c10 test(go-sdk): Add some unit tests for the Go SDK (#45) 2022-10-25 18:13:22 -05:00
Benjamin Eckel
2fda372c50 test(node-sdk): Add basic unit tests and coverage (#44) 2022-10-25 18:11:37 -05:00
Benjamin Eckel
b8a22b3d37 refactor(node-sdk): Refactor Node SDK to Typescript (#43)
Closes issue #25
2022-10-25 10:42:32 -05:00
Benjamin Eckel
577debc82a fix(ruby-sdk): Fix bugs and add tests (#41) 2022-10-25 09:12:23 -05:00
Benjamin Eckel
6c8927cfea test(python-sdk): Add unit tests for python SDK and run in CI (#42) 2022-10-25 09:12:11 -05:00
Benjamin Eckel
8724de8667 docs(ruby): fix example.rb context usage (#40) 2022-10-24 15:00:26 -04:00
Benjamin Eckel
24bf0b7d2a docs: Some small doc changes in elixir readme (#37) 2022-10-24 13:08:08 -05:00
Benjamin Eckel
a78106035e feat: set_log_file should return bool in rust SDK (#38) 2022-10-24 12:43:43 -05:00
Benjamin Eckel
5db98004a8 feat: set_log_file returns bool 2022-10-24 10:38:41 -05:00
Benjamin Eckel
b0e041a54e docs: some small docs tweaks to elixir sdk 2022-10-24 10:23:39 -05:00
zach
928cf8a11c Fix bug in extism_plugin_config when wasi is disabled (#36)
I found this bug when trying to update the Rust PDK:
https://github.com/extism/rust-pdk/pull/3
2022-10-21 13:40:45 -07:00
zach
2f06c1ec9e fix: bug in extism_plugin_config to set config values when wasi is disabled 2022-10-21 12:04:57 -07:00
Benjamin Eckel
2f0c1ea5b7 Fix Elixir cargo dependency (#35)
I thought this would look for the local path then fallback to the
crates.io version. Ideally we want this to be conditional somehow.
2022-10-21 09:56:29 -05:00
Benjamin Eckel
384a50e360 Fix cargo dep 2022-10-20 18:08:21 -05:00
Benjamin Eckel
55faa55265 Fix elixir publish pipeline (#34) 2022-10-20 17:26:49 -05:00
Benjamin Eckel
7815d9aee6 Fix elixir publish pipeline 2022-10-20 17:04:26 -05:00
Benjamin Eckel
8ae09b036e Publish all Host SDKs (#32) 2022-10-20 13:21:21 -05:00
Benjamin Eckel
ec07d35ed2 dont check metadata 2022-10-20 12:59:29 -05:00
Benjamin Eckel
819aa81bfd remove composer.json 2022-10-20 12:37:47 -05:00
Benjamin Eckel
8d4b720eb6 add composer.json 2022-10-20 11:57:49 -05:00
Benjamin Eckel
c92a920584 add ruby gitignore 2022-10-20 11:47:00 -05:00
Benjamin Eckel
97a7c6607e Publish elixir and ruby sdks 2022-10-20 11:37:23 -05:00
zach
a285f1b0c1 fix: export extism package and fix opam file 2022-10-19 16:34:05 -07:00
zach
6115ed41db fix: expose extism_version 2022-10-19 16:28:56 -07:00
Benjamin Eckel
92ff5f0040 chore: bump to version v0.0.1-rc.5 (#31) 2022-10-19 15:23:21 -06:00
Benjamin Eckel
460e2a0d73 Implement Host SDK for Elixir (#18)
This implements the a basic Elixir / Erlang host SDK. I still have some
work to do on it this weekend.

## Testing

* Pull down this branch
* In a different folder create a new elixir project:
  `mix new extism_elixir_host && cd extism_elixir_host`
* Link to the local dependency by updating the `deps` in `mix.exs`:
```elixir
  defp deps do
    [
      {:extism, path: "/Users/ben/Code/extism/elixir"}
    ]
  end
```
* Run `mix deps.get`
* Run `mix deps.compile`, this should trigger the rust compilation in
the elixir lib depdency
* Run `iex -S mix` to start a REPL.
* Test happy path:
```elixir
iex(1)> manifest = %{ wasm: [ %{ path: "/Users/ben/code/extism/wasm/code.wasm" } ]}
%{wasm: [%{path: "/Users/ben/code/extism/wasm/code.wasm"}]}
iex(2)> {:ok, plugin} = Extism.Plugin.new(manifest)
{:ok,
 %Extism.Plugin{
   resource: 0,
   reference: #Reference<0.1101693245.999030787.163527>
 }}
iex(3)> {:ok, result} = Extism.Plugin.call(plugin, "count_vowels", "this is a test")
{:ok, "{\"count\": 4}"}
```
* Test the sad path:
```elixir
iex(1)> manifest = %{ wasm: [ %{ path: "/Users/ben/code/extism/wasm/code.wasmz" } ]}
%{wasm: [%{path: "/Users/ben/code/extism/wasm/code.wasmz"}]}
iex(2)> Extism.Plugin.new(manifest) 
{:error, "Could not load plugin"}
iex(3)> manifest = %{ wasm: [ %{ pathe: "/Users/ben/code/extism/wasm/code.wasm" } ]}
%{wasm: [%{pathe: "/Users/ben/code/extism/wasm/code.wasm"}]}
iex(4)> Extism.Plugin.new(manifest)                                                 
{:error, "Could not parse manifest"}
```
* Some other functions you can use:
```elixir
iex(8)> Extism.Plugin.set_log_file(plugin, "/tmp/mylog.log", "debug")  
:ok
iex(9)> Extism.Plugin.update(plugin, %{wasm: [%{path: "/Users/ben/Code/extism/wasm/code.wasm"}]}, true)
{:ok, true}
iex(10)> Extism.Plugin.has_function(plugin, "unknown")
false
iex(11)> Extism.Plugin.has_function(plugin, "count_vowels")
true
```

## Running unit tests

```
cd elixir/
mix do deps.get, deps.compile
mix test
```
2022-10-19 14:46:12 -05:00
Benjamin Eckel
1024bb6d12 Implement Elixir / Erlang Host SDK 2022-10-19 14:12:56 -05:00
Benjamin Eckel
6e97f62793 Add extism_version to Host SDK and all clients (#30)
Adds a new Host SDK call `extism_version` which returns the version
string.
2022-10-17 14:15:54 -05:00
Benjamin Eckel
0816e15a42 fix docstring comment 2022-10-17 13:46:59 -05:00
Benjamin Eckel
14e3c10b0a fix compile error 2022-10-17 13:38:19 -05:00
Benjamin Eckel
6c692cc5f4 fix haskell type 2022-10-17 13:25:22 -05:00
Benjamin Eckel
bffef2e7a7 fix haskell type 2022-10-17 12:48:45 -05:00
Benjamin Eckel
217c61373d print version 2022-10-17 12:39:36 -05:00
Benjamin Eckel
d27f430184 Change pointer type for go 2022-10-17 12:37:35 -05:00
Benjamin Eckel
b89745c519 Change header definition 2022-10-17 12:22:04 -05:00
Benjamin Eckel
d53e4aedf7 Haskell 2022-10-17 12:10:23 -05:00
Benjamin Eckel
b17659b218 cleanup whitespace 2022-10-17 09:28:31 -05:00
Benjamin Eckel
85b3aece6f Add version to Host SDK and all clients 2022-10-17 09:25:22 -05:00
Steve Manuel
e7c564a90a Update README.md 2022-10-12 11:23:42 -06:00
zach
880617c066 Add nn feature to enable wasi-nn for plugins that enable WASI (#29)
Also avoids instantiating a wasi context for plugins where wasi is
disabled.
2022-10-11 12:32:25 -07:00
zach
f10ace7c03 ci: run tests using --all-features 2022-10-11 12:01:43 -07:00
zach
09cf4451d3 cleanup: group wasi contexts 2022-10-10 20:48:33 -07:00
zach
51e6eb38c4 feat: link wasi-nn when wasi is enabled 2022-10-10 19:17:47 -07:00
Steve Manuel
b8d2f2d6b3 chore: bump versions for v0.0.1-rc.4 (#24) 2022-09-29 15:52:10 -07:00
zach
fe5f9eeb8b feat: add allowed_hosts configuration option (#23)
- Adds `allowed_hosts` to the manifest
- If there are any `allowed_hosts` then `extism_http_request` checks to
make sure a URL's host is listed before performing the reques
2022-09-28 16:40:09 -07:00
zach
64d9358ea9 Don't panic on invalid plugin id (#22) 2022-09-26 09:23:56 -07:00
zach
355d4cdc4f cleanup: rename get! macro to args! 2022-09-25 19:44:05 -07:00
zach
1897276ee8 cleanup(runtime): get rid of more unwraps/panics 2022-09-24 11:17:14 -07:00
zach
a23e4a8b88 cleanup(runtime): improve pdk memory access 2022-09-24 10:46:05 -07:00
zach
631eb14cca fix: more helpful error message for manifests 2022-09-24 10:43:50 -07:00
zach
460b477b87 fix: don't panic on invalid plugin id 2022-09-24 10:43:50 -07:00
zach
15cd047569 fix: invalid length in config_get, vars_get 2022-09-23 16:15:05 -07:00
zach
52200c90ad fix(python): missing argument 2022-09-23 15:36:57 -07:00
zach
6bad1c43eb fix(python): missing argument 2022-09-22 16:11:34 -07:00
zach
958e56ba6d fix: compilation error when building without http_request support 2022-09-22 15:44:06 -07:00
zach
a4921e2d73 cleanup(runtime): better handling of reclaimed IDs 2022-09-21 10:57:18 -07:00
Steve Manuel
cdc614b04b fix: broken link in readme to extism overview 2022-09-21 09:50:41 -06:00
Steve Manuel
d3248119f7 chore: add links to pdks in readme 2022-09-21 01:10:27 -06:00
Steve Manuel
02f15985e2 docs: update readme to current sdk support graphic 2022-09-21 01:08:42 -06:00
zach
77964c7724 Update to wasmtime 1.0 (#21) 2022-09-20 14:47:54 -07:00
zach
15b7d0fa1f chore: update wasmtime to 1.0 2022-09-20 14:05:02 -07:00
zach
87be73570d Add ExtismContext to SDK + better errors for failed register/update (#19)
- Adds `ExtismContext` instead of global `PLUGINS` registry
- Adds `extism_context_new`, `extism_context_free` and
`extism_context_reset`
- Requires updating nearly every SDK function to add context parameter
- Renames some SDK functions to follow better naming conventions
   - `extism_plugin_register` -> `extism_plugin_new`
   - `extism_output_get` -> `extism_plugin_output_data`
   - `extism_output_length` -> `extism_plugin_output_length`
   - `extism_call` -> `extism_plugin_call`
- Updates `extism_error` to return the context error when -1 issued for
the plug-in ID
- Adds `extism_plugin_free` to remove an existing plugin
- Updates SDKs to include these functions
- Updates SDK examples and comments

Co-authored-by: Steve Manuel <steve@dylib.so>
2022-09-20 14:53:15 -06:00
Steve Manuel
e12efbeadb docs: add discord badge to readme 2022-09-17 01:01:11 -06:00
zach
5f096161da fix: use correct search path 2022-09-16 06:04:37 -07:00
zach
f0490058f1 cleanup: remove duplicate file 2022-09-16 06:04:06 -07:00
Jhaines1988
b7d52a1320 feat: update node sdk to use async call (#17) 2022-09-15 22:00:39 -06:00
Steve Manuel
c298208e04 ci: finish pypi release step 2022-09-14 11:37:01 -06:00
Steve Manuel
4c8a6b0ecb Merge branch 'main' of github.com:extism/extism 2022-09-14 11:26:05 -06:00
zach
f473be9044 meta: add scripts directory with SDK coverage script (#16)
Adds a script to check which runtime API functions are not used in each host SDK. Provides a coverage report with percent of functions called in each SDK. 

Co-authored-by: Steve Manuel <steve@dylib.so>
2022-09-14 11:12:05 -06:00
Steve Manuel
6883a5b6ba ci: add delay in release workflow to wait for crates.io 2022-09-14 09:21:06 -06:00
Steve Manuel
f9e9ff28d9 chore: bump versions for release, minimize c sdk imports (#15)
Co-authored-by: zach <zachshipko@gmail.com>
2022-09-13 13:27:58 -06:00
Steve Manuel
c9ded15dd2 Merge branch 'main' of github.com:extism/extism 2022-09-13 11:18:16 -06:00
Steve Manuel
e39901be68 ci: add no-verify to runtime release, bump rust sdk version 2022-09-13 11:17:59 -06:00
zach
4a49408045 fix: handle large allocations (missing commits) (#14) 2022-09-13 00:17:05 -06:00
zach
ddde19b6f4 fix: handle large allocations (#13)
This PR fixes an issue where large allocations are currently causing
some arithmetic to wrap which caused a panic.

This was discovered by calling `http_get` on `youtube.com` from the http
example in the Rust PDK
2022-09-12 20:26:31 -06:00
236 changed files with 28046 additions and 2564 deletions

30
.github/actions/extism/action.yml vendored Normal file
View File

@@ -0,0 +1,30 @@
on: [workflow_call]
name: libextism
runs:
using: composite
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Cache Rust environment
uses: Swatinem/rust-cache@v1
- name: Cache libextism
id: cache-libextism
uses: actions/cache@v3
with:
path: target/**
key: ${{ runner.os }}-libextism-${{ hashFiles('runtime/**') }}-${{ hashFiles('manifest/**') }}-${{ hashFiles('libextism/**') }}
- name: Build
if: steps.cache-libextism.outputs.cache-hit != 'true'
shell: bash
run: cargo build --release -p libextism
- name: Install extism shared library
shell: bash
run: |
sudo make install

41
.github/dependabot.yml vendored Normal file
View File

@@ -0,0 +1,41 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
version: 2
updates:
- package-ecosystem: "cargo" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
- package-ecosystem: "pip"
directory: "python"
schedule:
interval: "weekly"
- package-ecosystem: "mix"
directory: "elixir"
schedule:
interval: "weekly"
- package-ecosystem: "npm"
directory: "node"
schedule:
interval: "weekly"
- package-ecosystem: "composer"
directory: "/"
schedule:
interval: "weekly"
- package-ecosystem: "bundler"
directory: "ruby"
schedule:
interval: "weekly"
- package-ecosystem: "gomod"
directory: "/"
schedule:
interval: "weekly"

36
.github/workflows/browser-ci.yml vendored Normal file
View File

@@ -0,0 +1,36 @@
on:
pull_request:
paths:
- .github/actions/extism/**
- .github/workflows/ci-node.yml
- manifest/**
- runtime/**
- libextism/**
- browser/**
workflow_dispatch:
name: Browser CI
jobs:
node:
name: Browser
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
rust:
- stable
steps:
- name: Checkout sources
uses: actions/checkout@v3
- uses: ./.github/actions/extism
- name: Setup Node env
uses: actions/setup-node@v3
with:
node-version: 18
- name: Test Browser Runtime
run: |
cd browser
npm i
npm run test

39
.github/workflows/ci-cpp.yml vendored Normal file
View File

@@ -0,0 +1,39 @@
on:
pull_request:
paths:
- .github/actions/extism/**
- .github/workflows/ci-cpp.yml
- manifest/**
- runtime/**
- libextism/**
- cpp/**
workflow_dispatch:
name: C++ CI
jobs:
cpp:
name: C++
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
rust:
- stable
steps:
- name: Checkout sources
uses: actions/checkout@v3
- uses: ./.github/actions/extism
- name: Install C++ SDK deps
if: ${{ matrix.os == 'macos-latest' }}
run: |
brew install jsoncpp googletest pkg-config
- name: Install C++ SDK deps
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
sudo apt-get install g++ libjsoncpp-dev libgtest-dev pkg-config
- name: Run C++ tests
run: |
cd cpp
LD_LIBRARY_PATH=/usr/local/lib make example
LD_LIBRARY_PATH=/usr/local/lib make test

34
.github/workflows/ci-dotnet.yml vendored Normal file
View File

@@ -0,0 +1,34 @@
on:
pull_request:
paths:
- .github/actions/extism/**
- .github/workflows/ci-dotnet.yml
- manifest/**
- runtime/**
- libextism/**
- dotnet/**
workflow_dispatch:
name: .NET CI
jobs:
dotnet:
name: .NET
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
rust:
- stable
steps:
- name: Checkout sources
uses: actions/checkout@v3
- uses: ./.github/actions/extism
- name: Setup .NET Core SDK
uses: actions/setup-dotnet@v3.0.3
with:
dotnet-version: 7.x
- name: Test .NET Sdk
run: |
cd dotnet
LD_LIBRARY_PATH=/usr/local/lib dotnet test ./Extism.sln

41
.github/workflows/ci-elixir.yml vendored Normal file
View File

@@ -0,0 +1,41 @@
on:
pull_request:
paths:
- .github/actions/extism/**
- .github/workflows/ci-elixir.yml
- manifest/**
- runtime/**
- rust/**
- elixir/**
workflow_dispatch:
name: Elixir CI
jobs:
elixir:
name: Elixir
runs-on: ${{ matrix.os }}
env:
MIX_ENV: test
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
rust:
- stable
steps:
- name: Checkout sources
uses: actions/checkout@v3
- uses: ./.github/actions/extism
- name: Setup Elixir Host SDK
if: ${{ runner.os != 'macOS' }}
uses: erlef/setup-beam@v1
with:
experimental-otp: true
otp-version: '25.0.4'
elixir-version: '1.14.0'
- name: Test Elixir Host SDK
if: ${{ runner.os != 'macOS' }}
run: |
cd elixir
LD_LIBRARY_PATH=/usr/local/lib mix do deps.get, test

39
.github/workflows/ci-go.yml vendored Normal file
View File

@@ -0,0 +1,39 @@
on:
pull_request:
paths:
- .github/actions/extism/**
- .github/workflows/ci-go.yml
- manifest/**
- runtime/**
- libextism/**
- extism.go
- extism_test.go
- go.mod
- libextism.pc
- go/**
workflow_dispatch:
name: Go CI
jobs:
go:
name: Go
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
rust:
- stable
steps:
- name: Checkout sources
uses: actions/checkout@v3
- uses: ./.github/actions/extism
- name: Setup Go env
uses: actions/setup-go@v3
- name: Test Go Host SDK
run: |
go version
cd go
LD_LIBRARY_PATH=/usr/local/lib go run main.go
LD_LIBRARY_PATH=/usr/local/lib go test

47
.github/workflows/ci-haskell.yml vendored Normal file
View File

@@ -0,0 +1,47 @@
on:
pull_request:
paths:
- .github/actions/extism/**
- .github/workflows/ci-haskell.yml
- manifest/**
- runtime/**
- libextism/**
- haskell/**
workflow_dispatch:
name: Haskell CI
jobs:
haskell:
name: Haskell
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
rust:
- stable
steps:
- name: Checkout sources
uses: actions/checkout@v3
- uses: ./.github/actions/extism
- name: Setup Haskell env
uses: haskell/actions/setup@v2
with:
enable-stack: false
- name: Cache Haskell
id: cache-haskell
uses: actions/cache@v3
with:
path: ./haskell/dist-newstyle
key: ${{ runner.os }}-haskell-${{ hashFiles('haskell/**') }}
- name: Build Haskell Host SDK
if: steps.cache-haskell.outputs.cache-hit != 'true'
run: |
cd haskell
cabal update
LD_LIBRARY_PATH=/usr/local/lib cabal build
- name: Test Haskell SDK
run: |
cd haskell
cabal update
LD_LIBRARY_PATH=/usr/local/lib cabal test

42
.github/workflows/ci-java.yml vendored Normal file
View File

@@ -0,0 +1,42 @@
on:
pull_request:
paths:
- .github/actions/extism/**
- .github/workflows/ci-java.yml
- manifest/**
- runtime/**
- libextism/**
- java/**
workflow_dispatch:
name: Java CI
jobs:
java:
name: Java
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
version: [8, 11, 17]
rust:
- stable
steps:
- name: Checkout sources
uses: actions/checkout@v3
- uses: ./.github/actions/extism
- name: Set up Java
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '${{ matrix.version }}'
- name: Test Java
run: |
cd java
cat pom.xml | sed 's/<java.version>17/<java.version>${{ matrix.version }}/' > updated.xml
mv updated.xml pom.xml
mvn --batch-mode -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn verify
#- name: Examine logs
# if: success() || failure()
# run: |
# cat /tmp/extism.log

38
.github/workflows/ci-node.yml vendored Normal file
View File

@@ -0,0 +1,38 @@
on:
pull_request:
paths:
- .github/actions/extism/**
- .github/workflows/ci-node.yml
- manifest/**
- runtime/**
- libextism/**
- node/**
workflow_dispatch:
name: Node CI
jobs:
node:
name: Node
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
rust:
- stable
steps:
- name: Checkout sources
uses: actions/checkout@v3
- uses: ./.github/actions/extism
- name: Setup Node env
uses: actions/setup-node@v3
with:
node-version: 18
- name: Test Node Host SDK
run: |
cd node
npm i
LD_LIBRARY_PATH=/usr/local/lib npm run build
LD_LIBRARY_PATH=/usr/local/lib npm run example
LD_LIBRARY_PATH=/usr/local/lib npm run test

50
.github/workflows/ci-ocaml.yml vendored Normal file
View File

@@ -0,0 +1,50 @@
on:
pull_request:
paths:
- .github/actions/extism/**
- .github/workflows/ci-ocaml.yml
- manifest/**
- runtime/**
- libextism/**
- ocaml/**
- dune-project
- extism.opam
workflow_dispatch:
name: OCaml CI
jobs:
ocaml:
name: OCaml
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
rust:
- stable
steps:
- name: Checkout sources
uses: actions/checkout@v3
- uses: ./.github/actions/extism
- name: Setup OCaml env
uses: ocaml/setup-ocaml@v2
with:
ocaml-compiler: ocaml-base-compiler.5.0.0
- name: Cache OCaml
id: cache-ocaml
uses: actions/cache@v3
with:
path: _build
key: ${{ runner.os }}-ocaml-${{ hashFiles('ocaml/**.ml') }}-${{ hashFiles('dune-project') }}
- name: Build OCaml Host SDK
if: steps.cache-ocaml.outputs.cache-hit != 'true'
run: |
opam install -y --deps-only .
cd ocaml
LD_LIBRARY_PATH=/usr/local/lib opam exec -- dune build
- name: Test OCaml Host SDK
run: |
opam install -y --deps-only .
cd ocaml
LD_LIBRARY_PATH=/usr/local/lib opam exec -- dune exec ./bin/main.exe ../wasm/code.wasm count_vowels -- --input "qwertyuiop"
LD_LIBRARY_PATH=/usr/local/lib opam exec -- dune runtest

42
.github/workflows/ci-php.yml vendored Normal file
View File

@@ -0,0 +1,42 @@
on:
pull_request:
paths:
- .github/actions/extism/**
- .github/workflows/ci-php.yml
- manifest/**
- runtime/**
- libextism/**
- php/**
- composer.json
- composer.lock
workflow_dispatch:
name: PHP CI
jobs:
php:
name: PHP
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
rust:
- stable
steps:
- name: Checkout sources
uses: actions/checkout@v3
- uses: ./.github/actions/extism
- name: Setup PHP env
uses: shivammathur/setup-php@v2
with:
php-version: "8.1"
extensions: ffi
tools: composer
env:
fail-fast: true
- name: Test PHP SDK
run: |
cd php/example
composer install
php index.php

40
.github/workflows/ci-python.yml vendored Normal file
View File

@@ -0,0 +1,40 @@
on:
pull_request:
paths:
- .github/actions/extism/**
- .github/workflows/ci-python.yml
- manifest/**
- runtime/**
- libextism/**
- python/**
workflow_dispatch:
name: Python CI
jobs:
python:
name: Python
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
rust:
- stable
steps:
- name: Checkout sources
uses: actions/checkout@v3
- uses: ./.github/actions/extism
- name: Setup Python env
uses: actions/setup-python@v4
with:
python-version: "3.9"
check-latest: true
- name: Install Poetry
uses: snok/install-poetry@v1
- name: Test Python Host SDK
run: |
cd python
cp ../README.md .
poetry install --no-dev
poetry run python example.py
poetry run python -m unittest discover

38
.github/workflows/ci-ruby.yml vendored Normal file
View File

@@ -0,0 +1,38 @@
on:
pull_request:
paths:
- .github/actions/extism/**
- .github/workflows/ci-ruby.yml
- manifest/**
- runtime/**
- libextism/**
- ruby/**
workflow_dispatch:
name: Ruby CI
jobs:
ruby:
name: Ruby
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
rust:
- stable
steps:
- name: Checkout sources
uses: actions/checkout@v3
- uses: ./.github/actions/extism
- name: Setup Ruby env
uses: ruby/setup-ruby@v1
with:
ruby-version: "3.0"
- name: Test Ruby Host SDK
run: |
cd ruby
bundle install
ruby example.rb
rake test

105
.github/workflows/ci-rust.yml vendored Normal file
View File

@@ -0,0 +1,105 @@
on:
pull_request:
paths:
- .github/actions/extism/**
- .github/workflows/ci-rust.yml
- manifest/**
- runtime/**
- rust/**
- libextism/**
workflow_dispatch:
name: Rust CI
env:
RUNTIME_CRATE: extism-runtime
LIBEXTISM_CRATE: libextism
RUST_SDK_CRATE: extism
jobs:
lib:
name: Extism runtime lib
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
rust:
- stable
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Cache Rust environment
uses: Swatinem/rust-cache@v1
- name: Cache libextism
id: cache-libextism
uses: actions/cache@v3
with:
path: target/release/libextism.*
key: ${{ runner.os }}-libextism-${{ hashFiles('runtime/**') }}-${{ hashFiles('manifest/**') }}
- name: Cache target
id: cache-target
uses: actions/cache@v3
with:
path: target/**
key: ${{ runner.os }}-target-${{ env.GITHUB_SHA }}
- name: Build
if: steps.cache-libextism.outputs.cache-hit != 'true'
shell: bash
run: cargo build --release -p ${{ env.LIBEXTISM_CRATE }}
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: libextism-${{ matrix.os }}
path: |
target/release/libextism.*
lint_and_test:
name: Extism runtime lint and test
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
rust:
- stable
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Cache Rust environment
uses: Swatinem/rust-cache@v1
- name: Cache target
id: cache-target
uses: actions/cache@v3
with:
path: target/**
key: ${{ runner.os }}-target-${{ env.GITHUB_SHA }}
- name: Format
run: cargo fmt --check -p ${{ env.RUNTIME_CRATE }}
- name: Lint
run: cargo clippy --release --all-features --no-deps -p ${{ env.RUNTIME_CRATE }}
- name: Test
run: cargo test --all-features --release -p ${{ env.RUNTIME_CRATE }}
rust:
name: Rust
needs: lib
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
rust:
- stable
steps:
- name: Checkout sources
uses: actions/checkout@v3
- uses: ./.github/actions/extism
- name: Test Rust Host SDK
run: LD_LIBRARY_PATH=/usr/local/lib cargo test --release -p ${{ env.RUST_SDK_CRATE }}

34
.github/workflows/ci-zig.yml vendored Normal file
View File

@@ -0,0 +1,34 @@
on:
pull_request:
paths:
- .github/actions/extism/**
- .github/workflows/ci-zig.yml
- manifest/**
- runtime/**
- libextism/**
- zig/**
workflow_dispatch:
name: Zig CI
jobs:
zig:
name: Zig
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
rust:
- stable
steps:
- name: Checkout sources
uses: actions/checkout@v3
- uses: ./.github/actions/extism
- name: Setup Zig env
uses: goto-bus-stop/setup-zig@v2
- name: Test Zig Host SDK
run: |
zig version
cd zig
LD_LIBRARY_PATH=/usr/local/lib zig build test

View File

@@ -1,129 +1,25 @@
on: [push, pull_request]
on: [pull_request, workflow_dispatch]
name: CI
env:
RUNTIME_MANIFEST: runtime/Cargo.toml
RUNTIME_CRATE: extism-runtime
RUST_SDK_CRATE: extism
jobs:
build_and_test:
name: Build & Test
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
rust:
- stable
sdk_api_coverage:
name: SDK API Coverage Report
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
override: true
- name: Cache Rust environment
uses: Swatinem/rust-cache@v1
- name: Format
run: cargo fmt --check -p ${{ env.RUNTIME_CRATE }}
- name: Build
run: cargo build --release -p ${{ env.RUNTIME_CRATE }}
- name: Lint
run: cargo clippy --release --no-deps -p ${{ env.RUNTIME_CRATE }}
- name: Test
run: cargo test --release -p ${{ env.RUNTIME_CRATE }}
- name: Install extism shared library
shell: bash
run: sudo make install
- name: Setup Go env
uses: actions/setup-go@v3
- name: Test Go Host SDK
run: |
go version
cd go && LD_LIBRARY_PATH=/usr/local/lib go run main.go
uses: actions/checkout@v3
- name: Setup Python env
uses: actions/setup-python@v4
with:
python-version: "3.9"
check-latest: true
- name: Install Poetry
uses: snok/install-poetry@v1
- name: Test Python Host SDK
- name: Install dependencies
run: |
cd python
poetry install
poetry run python example.py
- name: Setup Ruby env
uses: ruby/setup-ruby@v1
with:
ruby-version: "3.0"
- name: Test Ruby Host SDK
sudo apt-get install ripgrep
pip3 install pycparser
- name: Run coverage script
id: coverage
run: |
cd ruby
bundle install
ruby example.rb
python scripts/sdk_coverage.py
- name: Setup Node env
uses: actions/setup-node@v3
with:
node-version: 16
- name: Test Node Host SDK
run: |
cd node
npm i
LD_LIBRARY_PATH=/usr/local/lib node example.js
- name: Test Rust Host SDK
run: LD_LIBRARY_PATH=/usr/local/lib cargo test --release -p ${{ env.RUST_SDK_CRATE }}
# - name: Setup OCaml env
# uses: ocaml/setup-ocaml@v2
# - name: Test OCaml Host SDK
# run: |
# opam install -y .
# cd ocaml
# opam exec -- dune exec extism
- name: Setup Haskell env
uses: haskell/actions/setup@v2
with:
enable-stack: true
stack-version: "latest"
- name: Test Haskell SDK
run: |
cd haskell
LD_LIBRARY_PATH=/usr/local/lib stack test
- name: Setup PHP env
uses: shivammathur/setup-php@v2
with:
php-version: "8.1"
extensions: ffi
tools: composer
env:
fail-fast: true
- name: Test PHP SDK
run: |
cd php/example
composer install
php index.php

View File

@@ -0,0 +1,29 @@
on:
workflow_dispatch:
name: Release .NET Native NuGet Packages
jobs:
release-runtimes:
name: release-dotnet-native
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup .NET Core SDK
uses: actions/setup-dotnet@v3.0.3
with:
dotnet-version: 7.x
- uses: dawidd6/action-download-artifact@v2
with:
workflow: release.yml
name: release-artifacts
- name: Extract Archive
run: |
tar -xvzf libextism-x86_64-pc-windows-msvc-v*.tar.gz --directory dotnet/nuget/runtimes
mv dotnet/nuget/runtimes/extism.dll dotnet/nuget/runtimes/win-x64.dll
- name: Publish win-x64
run: |
cd dotnet/nuget
dotnet pack -o dist
dotnet nuget push --source https://api.nuget.org/v3/index.json ./dist/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }}

32
.github/workflows/release-dotnet.yaml vendored Normal file
View File

@@ -0,0 +1,32 @@
on:
workflow_dispatch:
name: Release .NET SDK
jobs:
release-sdks:
name: release-dotnet
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install extism shared library
shell: bash
run: |
mkdir -p /home/runner/.local/bin/
export PATH="/home/runner/.local/bin/:$PATH"
curl https://raw.githubusercontent.com/extism/cli/main/install.sh | sh
extism --sudo --prefix /usr/local install
- name: Setup .NET Core SDK
uses: actions/setup-dotnet@v3.0.3
with:
dotnet-version: 7.x
- name: Test .NET Sdk
run: |
cd dotnet
LD_LIBRARY_PATH=/usr/local/lib dotnet test ./Extism.sln
- name: Publish .NET Sdk
run: |
cd dotnet/src/Extism.Sdk/
dotnet pack -c Release
dotnet nuget push --source https://api.nuget.org/v3/index.json ./bin/Release/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }}

34
.github/workflows/release-elixir.yaml vendored Normal file
View File

@@ -0,0 +1,34 @@
on:
workflow_dispatch:
name: Release Elixir SDK
jobs:
release-sdks:
name: release-elixir
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install extism shared library
shell: bash
run: |
mkdir -p /home/runner/.local/bin/
export PATH="/home/runner/.local/bin/:$PATH"
curl https://raw.githubusercontent.com/extism/cli/main/install.sh | sh
extism --sudo --prefix /usr/local install
- name: Setup Elixir Host SDK
uses: erlef/setup-beam@v1
with:
experimental-otp: true
otp-version: '25.0.4'
elixir-version: '1.14.0'
- name: Publish Elixir Host SDK to hex.pm
env:
HEX_API_KEY: ${{ secrets.HEX_PM_API_TOKEN }}
run: |
cd elixir
cp ../LICENSE .
make publish

17
.github/workflows/release-haskell.yaml vendored Normal file
View File

@@ -0,0 +1,17 @@
on:
workflow_dispatch:
name: Release Rust SDK
jobs:
release-sdks:
name: release-rust
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: cachix/haskell-release-action@v1
with:
- hackage-token: "${{ secrets.HACKAGE_TOKEN }}"
- work-dir: ./haskell

22
.github/workflows/release-java.yml vendored Normal file
View File

@@ -0,0 +1,22 @@
name: Publish package to the Maven Central Repository
on:
workflow_dispatch:
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Java
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'adopt'
- name: Publish package
env:
JRELEASER_NEXUS2_USERNAME: ${{ secrets.JRELEASER_NEXUS2_USERNAME }}
JRELEASER_NEXUS2_PASSWORD: ${{ secrets.JRELEASER_NEXUS2_PASSWORD }}
JRELEASER_GPG_PASSPHRASE: ${{ secrets.JRELEASER_GPG_PASSPHRASE }}
JRELEASER_GPG_SECRET_KEY: ${{ secrets.JRELEASER_GPG_SECRET_KEY }}
JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.JRELEASER_GPG_PUBLIC_KEY }}
JRELEASER_GITHUB_TOKEN: "dummy"
run: mvn -Prelease clean jreleaser:prepare deploy jreleaser:deploy -DaltDeploymentRepository=local::default::file:./target/staging-deploy

30
.github/workflows/release-node.yaml vendored Normal file
View File

@@ -0,0 +1,30 @@
on:
workflow_dispatch:
name: Release Node SDK
jobs:
release-sdks:
name: release-node
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node env
uses: actions/setup-node@v3
with:
node-version: 16
registry-url: "https://registry.npmjs.org"
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_API_TOKEN }}
CI: true
- name: Release Node Host SDK
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_API_TOKEN }}
CI: true
run: |
cd node
make publish

36
.github/workflows/release-python.yaml vendored Normal file
View File

@@ -0,0 +1,36 @@
on:
workflow_dispatch:
name: Release Python SDK
jobs:
release-sdks:
name: release-python
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Python env
uses: actions/setup-python@v4
with:
python-version: "3.9"
check-latest: true
- name: Run image
uses: abatilo/actions-poetry@v2
- name: Build Python Host SDK
run: |
cd python
cp ../LICENSE .
make clean
poetry install --no-dev
poetry build
- name: Release Python Host SDK
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: ${{ secrets.PYPI_API_USER }}
password: ${{ secrets.PYPI_API_TOKEN }}
packages_dir: python/dist/

25
.github/workflows/release-ruby.yaml vendored Normal file
View File

@@ -0,0 +1,25 @@
on:
workflow_dispatch:
name: Release Ruby SDK
jobs:
release-sdks:
name: release-ruby
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Ruby
uses: actions/setup-ruby@v1
with:
ruby-version: '3.1' # Version range or exact version of a Ruby version to use, using semvers version range syntax.
- name: Publish Ruby Gem
env:
RUBYGEMS_API_KEY: ${{ secrets.RUBYGEMS_API_TOKEN }}
run: |
cd ruby
make publish RUBYGEMS_API_KEY=$RUBYGEMS_API_KEY

35
.github/workflows/release-rust.yaml vendored Normal file
View File

@@ -0,0 +1,35 @@
on:
workflow_dispatch:
name: Release Rust SDK
jobs:
release-sdks:
name: release-rust
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Rust env
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
target: ${{ matrix.target }}
- name: Release Rust Host SDK
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_API_TOKEN }}
run: |
# order of crate publication matter: manifest, runtime, rust
cargo publish --manifest-path manifest/Cargo.toml
# allow for crates.io to update so dependant crates can locate extism-manifest
sleep 5
cargo publish --manifest-path runtime/Cargo.toml --no-verify
cargo publish --manifest-path rust/Cargo.toml

View File

@@ -1,12 +1,13 @@
on:
release:
types: [created]
workflow_dispatch:
name: Release
env:
RUNTIME_MANIFEST: runtime/Cargo.toml
RUNTIME_CRATE: extism-runtime
RUNTIME_CRATE: libextism
RUSTFLAGS: -C target-feature=-crt-static
ARTIFACT_DIR: release-artifacts
@@ -213,65 +214,3 @@ jobs:
files: |
*.tar.gz
*.txt
release-sdks:
needs: [release-linux, release-macos] # release-windows
name: publish-sdks
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node env
uses: actions/setup-node@v3
with:
node-version: 16
registry-url: "https://registry.npmjs.org"
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_API_TOKEN }}
CI: true
- name: Release Node Host SDK
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_API_TOKEN }}
CI: true
run: |
cd node
npm publish
- name: Setup Rust env
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
target: ${{ matrix.target }}
- name: Release Rust Host SDK
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_API_TOKEN }}
run: |
# order of crate publication matter: manifest, runtime, rust
cargo publish --manifest-path manifest/Cargo.toml
cargo publish --manifest-path runtime/Cargo.toml
cargo publish --manifest-path rust/Cargo.toml
- name: Setup Python env
uses: actions/setup-python@v4
with:
python-version: "3.9"
check-latest: true
- name: Build Python Host SDK
run: |
pushd python
python3 -m pip install --upgrade build
python3 -m build
popd
- name: Release Python Host SDK
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: ${{ secrets.PYPI_API_USER }}
password: ${{ secrets.PYPI_API_TOKEN }}
packages_dir: python/dist/

12
.gitignore vendored
View File

@@ -13,6 +13,8 @@ __pycache__
python/dist
python/poetry.lock
c/main
cpp/test/test
cpp/example
go/main
ruby/.bundle/
ruby/.yardoc
@@ -23,12 +25,14 @@ ruby/pkg/
ruby/spec/reports/
ruby/tmp/
ruby/Gemfile.lock
cpp/example
rust/target
rust/test.log
ocaml/duniverse
ocaml/_build
duniverse
_build
php/Extism.php
dist-newstyle
.stack-work
vendor
vendor
zig/zig-*
zig/example-out/
zig/*.log

1
.ocamlformat Normal file
View File

@@ -0,0 +1 @@
version = 0.24.1

View File

@@ -3,4 +3,6 @@ members = [
"manifest",
"runtime",
"rust",
"libextism",
"elixir/native/extism_nif"
]

View File

@@ -25,7 +25,10 @@ lint:
cargo clippy --release --no-deps --manifest-path runtime/Cargo.toml
build:
cargo build --release $(FEATURE_FLAGS) --manifest-path runtime/Cargo.toml
cargo build --release $(FEATURE_FLAGS) --manifest-path libextism/Cargo.toml
debug:
RUSTFLAGS=-g $(MAKE) build
install:
install runtime/extism.h $(DEST)/include

View File

@@ -1,20 +1,30 @@
### _Welcome!_
**Please note:** this project still under active development. It's usable, but expect some rough edges while work is underway. If you're interested in working on or building with Extism, please join our [Discord](https://discord.gg/cx3usBCWnc) and let us know - we are happy to help get you started.
[![Discord](https://img.shields.io/discord/1011124058408112148?color=%23404eed&label=Community%20Chat&logo=Discord&logoColor=%23404eed)](https://discord.gg/cx3usBCWnc)
# [Extism](https://extism.org)
The universal plug-in system. Run WebAssembly extensions inside your app. Use idiomatic Host SDKs for [Go](https://extism.org/docs/integrate-into-your-codebase/go-host-sdk),
[Ruby](https://extism.org/docs/integrate-into-your-codebase/ruby-host-sdk), [Python](https://extism.org/docs/integrate-into-your-codebase/python-host-sdk),
[Node](https://extism.org/docs/integrate-into-your-codebase/node-host-sdk), [Rust](https://extism.org/docs/integrate-into-your-codebase/rust-host-sdk),
[C](https://extism.org/docs/integrate-into-your-codebase/c-host-sdk), [C++](https://extism.org/docs/integrate-into-your-codebase/cpp-host-sdk),
[OCaml](https://extism.org/docs/integrate-into-your-codebase/ocaml-host-sdk), [Haskell](https://extism.org/docs/integrate-into-your-codebase/haskell-host-sdk), [PHP](https://extism.org/docs/integrate-into-your-codebase/php-host-sdk) &amp; more (others coming soon).
[OCaml](https://extism.org/docs/integrate-into-your-codebase/ocaml-host-sdk),
[Haskell](https://extism.org/docs/integrate-into-your-codebase/haskell-host-sdk),
[PHP](https://extism.org/docs/integrate-into-your-codebase/php-host-sdk),
[Elixir/Erlang](https://extism.org/docs/integrate-into-your-codebase/elixir-or-erlang-host-sdk),
[.NET](https://extism.org/docs/integrate-into-your-codebase/dotnet-host-sdk),
[Java](https://extism.org/docs/integrate-into-your-codebase/java-host-sdk),
[Zig](https://extism.org/docs/integrate-into-your-codebase/zig-host-sdk) &amp; more (others coming soon).
Plug-in development kits (PDK) for plug-in authors supported in Rust, AssemblyScript, Go, C/C++.
Plug-in development kits (PDK) for plug-in authors supported in [Rust](https://github.com/extism/rust-pdk), [AssemblyScript](https://github.com/extism/assemblyscript-pdk), [Go](https://github.com/extism/go-pdk), [C/C++](https://github.com/extism/c-pdk), [Haskell](https://github.com/extism/haskell-pdk), and [Zig](https://github.com/extism/zig-pdk).
<p align="center">
<img src="https://user-images.githubusercontent.com/7517515/184472910-36d42d73-bd1e-49e2-9b4d-9b020959603d.png"/>
<img style="width: 70%;" src="https://user-images.githubusercontent.com/7517515/210286900-39b144fd-1b26-4dd0-b7a9-2b5755bc174d.png" alt="Extism embedded SDK language support"/>
</p>
Add a flexible, secure, and _bLaZiNg FaSt_ plug-in system to your project. Server, desktop, mobile, web, database -- you name it. Enable users to write and execute safe extensions to your software in **3 easy steps:**
### 1. Import
@@ -33,7 +43,7 @@ Load WebAssembly modules at any time in your app's lifetime and Extism will exec
## Usage
Head to the [project website](https://extism.org) for more information and docs. Also, consider reading an [overview](/docs/overview) of Extism and its goals & approach.
Head to the [project website](https://extism.org) for more information and docs. Also, consider reading an [overview](https://extism.org/docs/overview) of Extism and its goals & approach.
## Contribution
@@ -48,7 +58,9 @@ The easiest way to start would be to join the [Discord](https://discord.gg/cx3us
Extism is an open-source product from the team at:
<p align="left">
<a href="https://dylib.so" _target="blanks"><img width="200px" src="https://user-images.githubusercontent.com/7517515/189285820-e6e83ddf-ed60-4f76-a610-814b81a5a289.svg"/></a>
<a href="https://dylib.so" _target="blanks"><img width="200px" src="https://user-images.githubusercontent.com/7517515/198204119-5afdebb9-a5d8-4322-bd2a-46179c8d7b24.svg"/></a>
</p>
_Reach out and tell us what you're building! We'd love to help._

130
browser/.gitignore vendored Normal file
View File

@@ -0,0 +1,130 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
*.lcov
# nyc test coverage
.nyc_output
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# Snowpack dependency directory (https://snowpack.dev/)
web_modules/
# TypeScript cache
*.tsbuildinfo
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional stylelint cache
.stylelintcache
# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local
# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache
# Next.js build output
.next
out
# Nuxt.js build / generate output
.nuxt
dist
# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public
# vuepress build output
.vuepress/dist
# vuepress v2.x temp and cache directory
.temp
.cache
# Docusaurus cache and generated files
.docusaurus
# Serverless directories
.serverless/
# FuseBox cache
.fusebox/
# DynamoDB Local files
.dynamodb/
# TernJS port file
.tern-port
# Stores VSCode versions used for testing VSCode extensions
.vscode-test
# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*

5
browser/.prettierrc Normal file
View File

@@ -0,0 +1,5 @@
{
"printWidth": 120,
"trailingComma": "all",
"singleQuote": true
}

28
browser/Makefile Normal file
View File

@@ -0,0 +1,28 @@
.PHONY: test
prepare:
npm install
build:
npm run build
test: prepare
npm run test
clean:
echo "No clean implemented"
publish: clean prepare build
npm publish
format:
npx prettier --write src
lint:
npx prettier --check src
docs:
npx typedoc --out doc src
show-docs: docs
open doc/index.html

23
browser/build.js Normal file
View File

@@ -0,0 +1,23 @@
const { build } = require("esbuild");
const { peerDependencies } = require('./package.json')
const sharedConfig = {
entryPoints: ["src/index.ts"],
bundle: true,
minify: false,
drop: [], // preseve debugger statements
external: Object.keys(peerDependencies || {}),
};
build({
...sharedConfig,
platform: 'node', // for CJS
outfile: "dist/index.js",
});
build({
...sharedConfig,
outfile: "dist/index.esm.js",
platform: 'neutral', // for ESM
format: "esm",
});

BIN
browser/data/code.wasm Executable file

Binary file not shown.

238
browser/index.html Normal file
View File

@@ -0,0 +1,238 @@
<html>
<head>
<script src="https://unpkg.com/babel-standalone@6/babel.min.js"></script>
<script src="https://unpkg.com/react@18/umd/react.development.js" crossorigin></script>
<script src="https://unpkg.com/react-dom@18/umd/react-dom.development.js" crossorigin></script>
<style>
#main {
width: 100%;
}
.manifest {
display: flex; /* or inline-flex */
flex-direction: row;
flex-wrap: nowrap;
width: 100%;
}
.urlInput {
width: 600px;
}
.funcName {
width: 150px;
}
.textAreas {
display: flex; /* or inline-flex */
flex-direction: row;
flex-wrap: nowrap;
width: 100%;
height: 300px;
}
.inputBox {
width: 100%;
height: 100%;
}
.inputBox > textarea {
width: 100%;
height: 100%;
}
.outputBox {
width: 100%;
height: 100%;
}
.outputBox > textarea {
width: 100%;
height: 100%;
}
.space {
height: 80px;
}
.dragAreas {
display: flex; /* or inline-flex */
flex-direction: row;
flex-wrap: nowrap;
width: 100%;
height: 200px;
}
.dragInput {
width: 100%;
height: 100%;
border-style: dotted;
border-color: #000;
}
.dragOutput {
width: 100%;
height: 100%;
}
.dropZone {
width: 100%;
height: 100%;
}
.outputImage {
width: 100%;
height: 100%;
}
</style>
<script type="text/babel">
function getBase64(file, cb) {
var reader = new FileReader();
reader.readAsDataURL(file);
reader.onload = function () {
cb(reader.result)
};
reader.onerror = function (error) {
console.log("error")
};
}
function arrayTob64(buffer) {
var binary = '';
var bytes = [].slice.call(buffer);
bytes.forEach((b) => binary += String.fromCharCode(b));
return window.btoa(binary);
}
class App extends React.Component {
state = {
url: "https://raw.githubusercontent.com/extism/extism/main/wasm/code.wasm",
input: new Uint8Array(),
output: new Uint8Array(),
func_name: "count_vowels",
functions: []
}
async loadFunctions(url) {
let plugin = await this.extismContext.newPlugin({ "wasm": [ { "path": url } ] })
let functions = Object.keys(await plugin.getExports())
console.log("funcs ", functions)
this.setState({functions})
}
componentDidMount() {
this.loadFunctions(this.state.url)
}
constructor(props) {
super(props)
this.extismContext = props.extismContext
}
handleInputChange(e) {
e.preventDefault();
this.setState({ [e.target.name]: e.target.value })
if (e.target.name === "url") {
this.loadFunctions(e.target.value)
}
}
onInputKeyPress(e) {
if (e.keyCode == 13 && e.shiftKey == true) {
e.preventDefault()
this.handleOnRun()
}
}
async handleOnRun(e) {
e && e.preventDefault && e.preventDefault();
let plugin = await this.extismContext.newPlugin({ "wasm": [ { "path": this.state.url } ] })
let result = await plugin.call(this.state.func_name, this.state.input)
let output = result
this.setState({output})
}
nop = (e) => {
e.preventDefault();
e.stopPropagation();
};
handleDrop = e => {
e.preventDefault();
e.stopPropagation();
let files = [...e.dataTransfer.files];
if (files && files.length == 1) {
let file = files[0]
console.log(file)
file.arrayBuffer().then(b => {
this.setState({input: new Uint8Array(b)})
this.handleOnRun()
})
} else {
throw Error("Only one file please")
}
};
render() {
const funcOptions = this.state.functions.map(f => <option value={f}>{f}</option>)
let image = null
if (this.state.output) {
image = <img src={`data:image/png;base64,${arrayTob64(this.state.output)}`}/>
}
return <div className="app">
<div className="manifest">
<div>
<label>WASM Url: </label>
<input type="text" name="url" className="urlInput" value={this.state.url} onChange={this.handleInputChange.bind(this)} />
</div>
<div>
<label>Function: </label>
<select type="text" name="func_name" className="funcName" value={this.state.func_name} onChange={this.handleInputChange.bind(this)}>
{funcOptions}
</select>
</div>
<div>
<button onClick={this.handleOnRun.bind(this)}>Run</button>
</div>
</div>
<div className="textAreas">
<div className="inputBox">
<h3>Text Input</h3>
<textarea name="input" value={this.state.input} onChange={this.handleInputChange.bind(this)} onKeyDown={this.onInputKeyPress.bind(this)}></textarea>
</div>
<div className="outputBox">
<h3>Text Output</h3>
<textarea name="output" value={new TextDecoder().decode(this.state.output)} ></textarea>
</div>
</div>
<div className="space" />
<div className="dragAreas">
<div className="dragInput">
<h3>Image Input</h3>
<div className="dropZone"
onDrop={this.handleDrop.bind(this)}
onDragOver={this.nop.bind(this)}
onDragEnter={this.nop.bind(this)}
onDragLeave={this.nop.bind(this)}
>
</div>
</div>
<div className="dragOutput">
<h3>Image Output</h3>
<div className="outputImage">
{image}
</div>
</div>
</div>
</div>
}
}
window.App = App
</script>
<script type="module">
import {ExtismContext} from './dist/index.esm.js'
const e = React.createElement;
window.onload = () => {
const domContainer = document.getElementById('main');
console.log(domContainer)
const root = ReactDOM.createRoot(domContainer);
const extismContext = new ExtismContext()
root.render(e(App, {extismContext}));
}
</script>
</head>
<body>
<div id="main"></div>
</body>
</html>

5
browser/jest.config.js Normal file
View File

@@ -0,0 +1,5 @@
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
};

9567
browser/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

37
browser/package.json Normal file
View File

@@ -0,0 +1,37 @@
{
"name": "@extism/runtime-browser",
"version": "0.2.2",
"description": "Extism runtime in the browser",
"scripts": {
"build": "node build.js && tsc --emitDeclarationOnly --outDir dist",
"format": "prettier --write \"src/**/*.ts\"",
"lint": "tslint -p tsconfig.json",
"test": "jest --config jest.config.js"
},
"private": false,
"publishConfig": {
"access": "public"
},
"files": [
"dist/*"
],
"module": "dist/index.esm.js",
"main": "dist/index.js",
"typings": "dist/src/index.d.ts",
"author": "The Extism Authors <oss@extism.org>",
"license": "BSD-3-Clause",
"devDependencies": {
"@types/jest": "^29.2.2",
"esbuild": "^0.15.13",
"jest": "^29.2.2",
"prettier": "^2.7.1",
"ts-jest": "^29.0.3",
"tslint": "^6.1.3",
"tslint-config-prettier": "^1.18.0",
"typedoc": "^0.23.20",
"typescript": "^4.8.4"
},
"dependencies": {
"@bjorn3/browser_wasi_shim": "^0.2.1"
}
}

104
browser/src/allocator.ts Normal file
View File

@@ -0,0 +1,104 @@
type MemoryBlock = { offset: bigint; length: bigint };
export default class Allocator {
currentIndex: bigint;
active: Record<number, MemoryBlock>;
freed: MemoryBlock[];
memory: Uint8Array;
constructor(n: number) {
this.currentIndex = BigInt(1);
this.active = {};
this.freed = [];
this.memory = new Uint8Array(n);
}
reset() {
this.currentIndex = BigInt(1);
this.active = {};
this.freed = [];
}
alloc(length: bigint): bigint {
for (var i = 0; i < this.freed.length; i++) {
let block = this.freed[i];
if (block.length === length) {
this.active[Number(block.offset)] = block;
this.freed.splice(i, 1);
return block.offset;
} else if (block.length > length + BigInt(64)) {
const newBlock = { offset: block.offset, length };
block.offset += length;
block.length -= length;
return newBlock.offset;
}
}
// Resize memory if needed
// TODO: put a limit on the memory size
if (BigInt(this.memory.length) < this.currentIndex + length) {
const tmp = new Uint8Array(Number(this.currentIndex + length + BigInt(64)));
tmp.set(this.memory);
this.memory = tmp;
}
const offset = this.currentIndex;
this.currentIndex += length;
this.active[Number(offset)] = { offset, length };
return offset;
}
getBytes(offset: bigint): Uint8Array | null {
const block = this.active[Number(offset)];
if (!block) {
return null;
}
return new Uint8Array(this.memory.buffer, Number(offset), Number(block.length));
}
getString(offset: bigint): string | null {
const bytes = this.getBytes(offset);
if (bytes === null) {
return null;
}
return new TextDecoder().decode(bytes);
}
allocBytes(data: Uint8Array): bigint {
const offs = this.alloc(BigInt(data.length));
const bytes = this.getBytes(offs);
if (bytes === null) {
this.free(offs);
return BigInt(0);
}
bytes.set(data);
return offs;
}
allocString(data: string): bigint {
const bytes = new TextEncoder().encode(data);
return this.allocBytes(bytes);
}
getLength(offset: bigint): bigint {
const block = this.active[Number(offset)];
if (!block) {
return BigInt(0);
}
return block.length;
}
free(offset: bigint) {
const block = this.active[Number(offset)];
if (!block) {
return;
}
delete this.active[Number(offset)];
this.freed.push(block);
}
}

45
browser/src/context.ts Normal file
View File

@@ -0,0 +1,45 @@
import { Manifest, PluginConfig, ManifestWasmFile, ManifestWasmData } from './manifest';
import ExtismPlugin from './plugin';
/**
* Can be a {@link Manifest} or just the raw bytes of the WASM module as an ArrayBuffer.
* We recommend using {@link Manifest}
*/
type ManifestData = Manifest | ArrayBuffer;
/**
* A Context is needed to create plugins. The Context
* is where your plugins live. Freeing the context
* frees all of the plugins in its scope.
*/
export default class ExtismContext {
/**
* Create a plugin managed by this context
*
* @param manifest - The {@link ManifestData} describing the plugin code and config
* @param config - Config details for the plugin
* @returns A new Plugin scoped to this Context
*/
async newPlugin(manifest: ManifestData, config?: PluginConfig) {
let moduleData: ArrayBuffer | null = null;
if (manifest instanceof ArrayBuffer) {
moduleData = manifest;
} else if ((manifest as Manifest).wasm) {
const wasmData = (manifest as Manifest).wasm;
if (wasmData.length > 1) throw Error('This runtime only supports one module in Manifest.wasm');
const wasm = wasmData[0];
if ((wasm as ManifestWasmData).data) {
moduleData = (wasm as ManifestWasmData).data;
} else if ((wasm as ManifestWasmFile).path) {
const response = await fetch((wasm as ManifestWasmFile).path);
moduleData = await response.arrayBuffer();
console.dir(moduleData);
}
}
if (!moduleData) {
throw Error(`Unsure how to interpret manifest ${manifest}`);
}
return new ExtismPlugin(moduleData, config);
}
}

23
browser/src/index.test.ts Normal file
View File

@@ -0,0 +1,23 @@
import { ExtismContext } from './';
import fs from 'fs';
import path from 'path';
function parse(bytes: Uint8Array): any {
return JSON.parse(new TextDecoder().decode(bytes));
}
describe('', () => {
it('can load and call a plugin', async () => {
const data = fs.readFileSync(path.join(__dirname, '..', 'data', 'code.wasm'));
const ctx = new ExtismContext();
const plugin = await ctx.newPlugin({ wasm: [{ data: data }] });
const functions = await plugin.getExports();
expect(Object.keys(functions).filter((x) => !x.startsWith('__') && x !== 'memory')).toEqual(['count_vowels']);
let output = await plugin.call('count_vowels', 'this is a test');
expect(parse(output)).toEqual({ count: 4 });
output = await plugin.call('count_vowels', 'this is a test again');
expect(parse(output)).toEqual({ count: 7 });
output = await plugin.call('count_vowels', 'this is a test thrice');
expect(parse(output)).toEqual({ count: 6 });
});
});

3
browser/src/index.ts Normal file
View File

@@ -0,0 +1,3 @@
import ExtismContext from './context';
export { ExtismContext };

40
browser/src/manifest.ts Normal file
View File

@@ -0,0 +1,40 @@
/**
* Represents a path or url to a WASM module
*/
export type ManifestWasmFile = {
path: string;
name?: string;
hash?: string;
};
/**
* Represents the raw bytes of a WASM file loaded into memory
*/
export type ManifestWasmData = {
data: Uint8Array;
name?: string;
hash?: string;
};
/**
* {@link ExtismPlugin} Config
*/
export type PluginConfig = Map<string, string>;
/**
* The WASM to load as bytes or a path
*/
export type ManifestWasm = ManifestWasmFile | ManifestWasmData;
/**
* The manifest which describes the {@link ExtismPlugin} code and
* runtime constraints.
*
* @see [Extism > Concepts > Manifest](https://extism.org/docs/concepts/manifest)
*/
export type Manifest = {
wasm: Array<ManifestWasm>;
//memory?: ManifestMemory;
config?: PluginConfig;
allowed_hosts?: Array<string>;
};

184
browser/src/plugin.ts Normal file
View File

@@ -0,0 +1,184 @@
import Allocator from './allocator';
import { PluginConfig } from './manifest';
//@ts-ignore TODO add types to this library
import { WASI, File } from "@bjorn3/browser_wasi_shim";
export default class ExtismPlugin {
moduleData: ArrayBuffer;
allocator: Allocator;
config?: PluginConfig;
vars: Record<string, Uint8Array>;
input: Uint8Array;
output: Uint8Array;
module?: WebAssembly.WebAssemblyInstantiatedSource;
constructor(moduleData: ArrayBuffer, config?: PluginConfig) {
this.moduleData = moduleData;
this.allocator = new Allocator(1024 * 1024);
this.config = config;
this.vars = {};
this.input = new Uint8Array();
this.output = new Uint8Array();
}
async getExports(): Promise<WebAssembly.Exports> {
const module = await this._instantiateModule();
return module.instance.exports;
}
async getImports(): Promise<WebAssembly.ModuleImportDescriptor[]> {
const module = await this._instantiateModule();
return WebAssembly.Module.imports(module.module);
}
async getInstance(): Promise<WebAssembly.Instance> {
const module = await this._instantiateModule();
return module.instance;
}
async call(func_name: string, input: Uint8Array | string): Promise<Uint8Array> {
const module = await this._instantiateModule();
if (typeof input === 'string') {
this.input = new TextEncoder().encode(input);
} else if (input instanceof Uint8Array) {
this.input = input;
} else {
throw new Error('input should be string or Uint8Array');
}
this.allocator.reset();
let func = module.instance.exports[func_name];
if (!func) {
throw Error(`function does not exist ${func_name}`);
}
//@ts-ignore
func();
return this.output;
}
async _instantiateModule(): Promise<WebAssembly.WebAssemblyInstantiatedSource> {
if (this.module) {
return this.module;
}
const environment = this.makeEnv();
const args: Array<string> = [];
const envVars: Array<string> = [];
let fds = [
new File([]), // stdin
new File([]), // stdout
new File([]), // stderr
];
let wasi = new WASI(args, envVars, fds);
let env = {
wasi_snapshot_preview1: wasi.wasiImport,
env: environment
};
this.module = await WebAssembly.instantiate(this.moduleData, env);
return this.module;
}
makeEnv(): any {
const plugin = this;
return {
extism_alloc(n: bigint): bigint {
return plugin.allocator.alloc(n);
},
extism_free(n: bigint) {
plugin.allocator.free(n);
},
extism_load_u8(n: bigint): number {
return plugin.allocator.memory[Number(n)];
},
extism_load_u64(n: bigint): bigint {
let cast = new DataView(plugin.allocator.memory.buffer, Number(n));
return cast.getBigUint64(0, true);
},
extism_store_u8(offset: bigint, n: number) {
plugin.allocator.memory[Number(offset)] = Number(n);
},
extism_store_u64(offset: bigint, n: bigint) {
const tmp = new DataView(plugin.allocator.memory.buffer, Number(offset));
tmp.setBigUint64(0, n, true);
},
extism_input_length(): bigint {
return BigInt(plugin.input.length);
},
extism_input_load_u8(i: bigint): number {
return plugin.input[Number(i)];
},
extism_input_load_u64(idx: bigint): bigint {
let cast = new DataView(plugin.input.buffer, Number(idx));
return cast.getBigUint64(0, true);
},
extism_output_set(offset: bigint, length: bigint) {
const offs = Number(offset);
const len = Number(length);
plugin.output = plugin.allocator.memory.slice(offs, offs + len);
},
extism_error_set(i: bigint) {
throw plugin.allocator.getString(i);
},
extism_config_get(i: bigint): bigint {
if (typeof plugin.config === 'undefined') {
return BigInt(0);
}
const key = plugin.allocator.getString(i);
if (key === null) {
return BigInt(0);
}
const value = plugin.config.get(key);
if (typeof value === 'undefined') {
return BigInt(0);
}
return plugin.allocator.allocString(value);
},
extism_var_get(i: bigint): bigint {
const key = plugin.allocator.getString(i);
if (key === null) {
return BigInt(0);
}
const value = plugin.vars[key];
if (typeof value === 'undefined') {
return BigInt(0);
}
return plugin.allocator.allocBytes(value);
},
extism_var_set(n: bigint, i: bigint) {
const key = plugin.allocator.getString(n);
if (key === null) {
return;
}
const value = plugin.allocator.getBytes(i);
if (value === null) {
return;
}
plugin.vars[key] = value;
},
extism_http_request(n: bigint, i: bigint): number {
debugger;
return 0;
},
extism_length(i: bigint): bigint {
return plugin.allocator.getLength(i);
},
extism_log_warn(i: bigint) {
const s = plugin.allocator.getString(i);
console.warn(s);
},
extism_log_info(i: bigint) {
const s = plugin.allocator.getString(i);
console.log(s);
},
extism_log_debug(i: bigint) {
const s = plugin.allocator.getString(i);
console.debug(s);
},
extism_log_error(i: bigint) {
const s = plugin.allocator.getString(i);
console.error(s);
},
};
}
}

13
browser/tsconfig.json Normal file
View File

@@ -0,0 +1,13 @@
{
"compilerOptions": {
"target": "es2016",
"module": "commonjs",
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"declaration": true,
"strict": true,
"skipLibCheck": true,
"allowJs": true
},
"exclude": ["node_modules", "dist", "**/*.test.ts"]
}

6
browser/tslint.json Normal file
View File

@@ -0,0 +1,6 @@
{
"extends": [
"tslint:recommended",
"tslint-config-prettier"
]
}

View File

@@ -21,6 +21,7 @@ uint8_t *read_file(const char *filename, size_t *len) {
uint8_t *data = malloc(length);
if (data == NULL) {
fclose(fp);
return NULL;
}
@@ -36,20 +37,25 @@ int main(int argc, char *argv[]) {
fputs("Not enough arguments\n", stderr);
exit(1);
}
ExtismContext *ctx = extism_context_new();
size_t len = 0;
uint8_t *data = read_file("../wasm/code.wasm", &len);
ExtismPlugin plugin = extism_plugin_register(data, len, false);
ExtismPlugin plugin = extism_plugin_new(ctx, data, len, false);
free(data);
if (plugin < 0) {
exit(1);
}
assert(extism_call(plugin, "count_vowels", (uint8_t *)argv[1],
strlen(argv[1])) == 0);
ExtismSize out_len = extism_output_length(plugin);
const uint8_t *output = extism_output_get(plugin);
assert(extism_plugin_call(ctx, plugin, "count_vowels", (uint8_t *)argv[1],
strlen(argv[1])) == 0);
ExtismSize out_len = extism_plugin_output_length(ctx, plugin);
const uint8_t *output = extism_plugin_output_data(ctx, plugin);
write(STDOUT_FILENO, output, out_len);
write(STDOUT_FILENO, "\n", 1);
extism_plugin_free(ctx, plugin);
extism_context_free(ctx);
return 0;
}

View File

@@ -1,50 +1,49 @@
{
"name": "extism/extism",
"description": "Make your software programmable. Run WebAssembly extensions in your app using the first off-the-shelf, universal plug-in system.",
"license": "BSD-3-Clause",
"type": "library",
"keywords": [
"WebAssembly",
"plugin-system",
"runtime",
"plug-in"
],
"authors": [
{
"name": "The Extism Authors",
"email": "oss@extism.org",
"homepage": "https://extism.org"
},
{
"name": "Dylibso, Inc.",
"email": "oss@dylib.so",
"homepage": "https://dylib.so"
}
],
"require": {
"php": "^7.4 || ^8",
"ircmaxell/ffime": "dev-master"
"name": "extism/extism",
"description": "Make your software programmable. Run WebAssembly extensions in your app using the first off-the-shelf, universal plug-in system.",
"license": "BSD-3-Clause",
"type": "library",
"keywords": [
"WebAssembly",
"plugin-system",
"runtime",
"plug-in"
],
"authors": [
{
"name": "The Extism Authors",
"email": "oss@extism.org",
"homepage": "https://extism.org"
},
"suggest": {},
"minimum-stability": "dev",
"prefer-stable": true,
"autoload": {
"psr-4": {
"Extism\\": "php/src/"
},
"files": [
"php/src/Plugin.php",
"php/src/generate.php",
"php/src/extism.h"
]
{
"name": "Dylibso, Inc.",
"email": "oss@dylib.so",
"homepage": "https://dylib.so"
}
],
"require": {
"php": "^7.4 || ^8",
"ircmaxell/ffime": "dev-master"
},
"suggest": {},
"minimum-stability": "dev",
"prefer-stable": true,
"autoload": {
"psr-4": {
"Extism\\": "php/src/"
},
"autoload-dev": {
"psr-4": {}
},
"config": {
"sort-packages": true
},
"extra": {},
"scripts": {},
"scripts-descriptions": {}
"files": [
"php/src/Context.php",
"php/src/Plugin.php"
]
},
"autoload-dev": {
"psr-4": {}
},
"config": {
"sort-packages": true
},
"extra": {},
"scripts": {},
"scripts-descriptions": {}
}

View File

@@ -1,3 +1,15 @@
build:
clang++ -std=c++11 -o example example.cpp -lextism -L .
FLAGS=`pkg-config --cflags --libs jsoncpp gtest` -lextism -lpthread
build-example:
$(CXX) -std=c++11 -o example -I. example.cpp $(FLAGS)
.PHONY: example
example: build-example
./example
build-test:
$(CXX) -std=c++11 -o test/test -I. test/test.cpp $(FLAGS)
.PHONY: test
test: build-test
cd test && ./test

View File

@@ -1,3 +1,4 @@
#define EXTISM_NO_JSON
#include "extism.hpp"
#include <cstring>
@@ -14,17 +15,14 @@ std::vector<uint8_t> read(const char *filename) {
int main(int argc, char *argv[]) {
auto wasm = read("../wasm/code.wasm");
Plugin plugin(wasm);
Context context = Context();
if (argc < 2) {
std::cout << "Not enough arguments" << std::endl;
return 1;
}
Plugin plugin = context.plugin(wasm);
auto input = std::vector<uint8_t>((uint8_t *)argv[1],
(uint8_t *)argv[1] + strlen(argv[1]));
auto output = plugin.call("count_vowels", input);
std::string str(output.begin(), output.end());
std::cout << str << std::endl;
const char *input = argc > 1 ? argv[1] : "this is a test";
ExtismSize length = strlen(input);
extism::Buffer output = plugin.call("count_vowels", (uint8_t *)input, length);
std::cout << (char *)output.data << std::endl;
return 0;
}

View File

@@ -1 +0,0 @@
../core/extism.h

View File

@@ -1,13 +1,146 @@
#pragma once
#include <map>
#include <memory>
#include <string>
#include <vector>
#ifndef EXTISM_NO_JSON
#if __has_include(<jsoncpp/json/json.h>)
#include <jsoncpp/json/json.h>
#else
#include <json/json.h>
#endif
#endif // EXTISM_NO_JSON
extern "C" {
#include "extism.h"
#include <extism.h>
}
namespace extism {
typedef std::map<std::string, std::string> Config;
class Wasm {
public:
std::string path;
std::string url;
// TODO: add base64 encoded raw data
std::string hash;
#ifndef EXTISM_NO_JSON
Json::Value json() const {
Json::Value doc;
if (!this->path.empty()) {
doc["path"] = this->path;
}
if (!this->url.empty()) {
doc["url"] = this->url;
}
if (!this->hash.empty()) {
doc["hash"] = this->hash;
}
return doc;
}
#endif
};
class Manifest {
public:
Config config;
std::vector<Wasm> wasm;
std::vector<std::string> allowed_hosts;
std::map<std::string, std::string> allowed_paths;
uint64_t timeout_ms;
Manifest() : timeout_ms(30000) {}
static Manifest path(std::string s, std::string hash = std::string()) {
Manifest m;
m.add_wasm_path(s, hash);
return m;
}
static Manifest url(std::string s, std::string hash = std::string()) {
Manifest m;
m.add_wasm_url(s, hash);
return m;
}
#ifndef EXTISM_NO_JSON
std::string json() const {
Json::Value doc;
Json::Value wasm;
for (auto w : this->wasm) {
wasm.append(w.json());
}
doc["wasm"] = wasm;
if (!this->config.empty()) {
Json::Value conf;
for (auto k : this->config) {
conf[k.first] = k.second;
}
doc["config"] = conf;
}
if (!this->allowed_hosts.empty()) {
Json::Value h;
for (auto s : this->allowed_hosts) {
h.append(s);
}
doc["allowed_hosts"] = h;
}
if (!this->allowed_paths.empty()) {
Json::Value h;
for (auto k : this->allowed_paths) {
h[k.first] = k.second;
}
doc["allowed_paths"] = h;
}
doc["timeout_ms"] = Json::Value(this->timeout_ms);
Json::FastWriter writer;
return writer.write(doc);
}
#endif
void add_wasm_path(std::string s, std::string hash = std::string()) {
Wasm w;
w.path = s;
w.hash = hash;
this->wasm.push_back(w);
}
void add_wasm_url(std::string u, std::string hash = std::string()) {
Wasm w;
w.url = u;
w.hash = hash;
this->wasm.push_back(w);
}
void allow_host(std::string host) { this->allowed_hosts.push_back(host); }
void allow_path(std::string src, std::string dest = std::string()) {
if (dest.empty()) {
dest = src;
}
this->allowed_paths[src] = dest;
}
void set_timeout_ms(uint64_t ms) { this->timeout_ms = ms; }
void set_config(std::string k, std::string v) { this->config[k] = v; }
};
class Error : public std::exception {
private:
std::string message;
@@ -17,29 +150,113 @@ public:
const char *what() { return message.c_str(); }
};
class Buffer {
public:
Buffer(const uint8_t *ptr, ExtismSize len) : data(ptr), length(len) {}
const uint8_t *data;
ExtismSize length;
std::string string() { return (std::string)(*this); }
std::vector<uint8_t> vector() { return (std::vector<uint8_t>)(*this); }
operator std::string() { return std::string((const char *)data, length); }
operator std::vector<uint8_t>() {
return std::vector<uint8_t>(data, data + length);
}
};
class Plugin {
std::shared_ptr<ExtismContext> context;
ExtismPlugin plugin;
public:
Plugin(const uint8_t *wasm, size_t length, bool with_wasi = false) {
this->plugin = extism_plugin_register(wasm, length, with_wasi);
Plugin(std::shared_ptr<ExtismContext> ctx, const uint8_t *wasm,
ExtismSize length, bool with_wasi = false) {
this->plugin = extism_plugin_new(ctx.get(), wasm, length, with_wasi);
if (this->plugin < 0) {
throw Error("Unable to load plugin");
const char *err = extism_error(ctx.get(), -1);
throw Error(err == nullptr ? "Unable to load plugin" : err);
}
this->context = ctx;
}
#ifndef EXTISM_NO_JSON
Plugin(std::shared_ptr<ExtismContext> ctx, const Manifest &manifest,
bool with_wasi = false) {
auto buffer = manifest.json();
this->plugin = extism_plugin_new(ctx.get(), (const uint8_t *)buffer.c_str(),
buffer.size(), with_wasi);
if (this->plugin < 0) {
const char *err = extism_error(ctx.get(), -1);
throw Error(err == nullptr ? "Unable to load plugin from manifest" : err);
}
this->context = ctx;
}
#endif
~Plugin() {
extism_plugin_free(this->context.get(), this->plugin);
this->plugin = -1;
}
ExtismPlugin id() const { return this->plugin; }
ExtismContext *get_context() const { return this->context.get(); }
void update(const uint8_t *wasm, size_t length, bool with_wasi = false) {
bool b = extism_plugin_update(this->context.get(), this->plugin, wasm,
length, with_wasi);
if (!b) {
const char *err = extism_error(this->context.get(), -1);
throw Error(err == nullptr ? "Unable to update plugin" : err);
}
}
Plugin(const std::string &s, bool with_wasi = false)
: Plugin((const uint8_t *)s.c_str(), s.size(), with_wasi) {}
Plugin(const std::vector<uint8_t> &s, bool with_wasi = false)
: Plugin(s.data(), s.size(), with_wasi) {}
#ifndef EXTISM_NO_JSON
void update(const Manifest &manifest, bool with_wasi = false) {
auto buffer = manifest.json();
bool b = extism_plugin_update(this->context.get(), this->plugin,
(const uint8_t *)buffer.c_str(),
buffer.size(), with_wasi);
if (!b) {
const char *err = extism_error(this->context.get(), -1);
throw Error(err == nullptr ? "Unable to update plugin" : err);
}
}
std::vector<uint8_t> call(const std::string &func,
std::vector<uint8_t> input) {
void config(const Config &data) {
Json::Value conf;
int32_t rc =
extism_call(this->plugin, func.c_str(), input.data(), input.size());
for (auto k : data) {
conf[k.first] = k.second;
}
Json::FastWriter writer;
auto s = writer.write(conf);
this->config(s);
}
#endif
void config(const char *json, size_t length) {
bool b = extism_plugin_config(this->context.get(), this->plugin,
(const uint8_t *)json, length);
if (!b) {
const char *err = extism_error(this->context.get(), this->plugin);
throw Error(err == nullptr ? "Unable to update plugin config" : err);
}
}
void config(const std::string &json) {
this->config(json.c_str(), json.size());
}
Buffer call(const std::string &func, const uint8_t *input,
ExtismSize input_length) const {
int32_t rc = extism_plugin_call(this->context.get(), this->plugin,
func.c_str(), input, input_length);
if (rc != 0) {
const char *error = extism_error(this->plugin);
const char *error = extism_error(this->context.get(), this->plugin);
if (error == nullptr) {
throw Error("extism_call failed");
}
@@ -47,10 +264,64 @@ public:
throw Error(error);
}
ExtismSize length = extism_output_length(this->plugin);
const uint8_t *ptr = extism_output_get(this->plugin);
std::vector<uint8_t> out = std::vector<uint8_t>(ptr, ptr + length);
return out;
ExtismSize length =
extism_plugin_output_length(this->context.get(), this->plugin);
const uint8_t *ptr =
extism_plugin_output_data(this->context.get(), this->plugin);
return Buffer(ptr, length);
}
Buffer call(const std::string &func,
const std::vector<uint8_t> &input) const {
return this->call(func, input.data(), input.size());
}
Buffer call(const std::string &func, const std::string &input) const {
return this->call(func, (const uint8_t *)input.c_str(), input.size());
}
bool function_exists(const std::string &func) const {
return extism_plugin_function_exists(this->context.get(), this->plugin,
func.c_str());
}
};
class Context {
public:
std::shared_ptr<ExtismContext> pointer;
Context() {
this->pointer = std::shared_ptr<ExtismContext>(extism_context_new(),
extism_context_free);
}
Plugin plugin(const uint8_t *wasm, size_t length,
bool with_wasi = false) const {
return Plugin(this->pointer, wasm, length, with_wasi);
}
Plugin plugin(const std::string &str, bool with_wasi = false) const {
return Plugin(this->pointer, (const uint8_t *)str.c_str(), str.size(),
with_wasi);
}
Plugin plugin(const std::vector<uint8_t> &data,
bool with_wasi = false) const {
return Plugin(this->pointer, data.data(), data.size(), with_wasi);
}
#ifndef EXTISM_NO_JSON
Plugin plugin(const Manifest &manifest, bool with_wasi = false) const {
return Plugin(this->pointer, manifest, with_wasi);
}
#endif
void reset() { extism_context_reset(this->pointer.get()); }
};
inline bool set_log_file(const char *filename, const char *level) {
return extism_log_file(filename, level);
}
inline std::string version() { return std::string(extism_version()); }
} // namespace extism

BIN
cpp/test/code.wasm Executable file

Binary file not shown.

73
cpp/test/test.cpp Normal file
View File

@@ -0,0 +1,73 @@
#include "../extism.hpp"
#include <fstream>
#include <gtest/gtest.h>
std::vector<uint8_t> read(const char *filename) {
std::ifstream file(filename, std::ios::binary);
return std::vector<uint8_t>((std::istreambuf_iterator<char>(file)),
std::istreambuf_iterator<char>());
}
namespace {
using namespace extism;
TEST(Context, Basic) {
Context context;
ASSERT_NE(context.pointer, nullptr);
}
TEST(Plugin, Manifest) {
Context context;
Manifest manifest = Manifest::path("code.wasm");
manifest.set_config("a", "1");
ASSERT_NO_THROW(Plugin plugin = context.plugin(manifest));
Plugin plugin = context.plugin(manifest);
Buffer buf = plugin.call("count_vowels", "this is a test");
ASSERT_EQ((std::string)buf, "{\"count\": 4}");
}
TEST(Plugin, BadManifest) {
Context context;
Manifest manifest;
ASSERT_THROW(Plugin plugin = context.plugin(manifest), Error);
}
TEST(Plugin, Bytes) {
Context context;
auto wasm = read("code.wasm");
ASSERT_NO_THROW(Plugin plugin = context.plugin(wasm));
Plugin plugin = context.plugin(wasm);
Buffer buf = plugin.call("count_vowels", "this is another test");
ASSERT_EQ(buf.string(), "{\"count\": 6}");
}
TEST(Plugin, UpdateConfig) {
Context context;
auto wasm = read("code.wasm");
Plugin plugin = context.plugin(wasm);
Config config;
config["abc"] = "123";
ASSERT_NO_THROW(plugin.config(config));
}
TEST(Plugin, FunctionExists) {
Context context;
auto wasm = read("code.wasm");
Plugin plugin = context.plugin(wasm);
ASSERT_FALSE(plugin.function_exists("bad_function"));
ASSERT_TRUE(plugin.function_exists("count_vowels"));
}
}; // namespace
int main(int argc, char **argv) {
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}

479
dotnet/.gitignore vendored Normal file
View File

@@ -0,0 +1,479 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore
# User-specific files
*.rsuser
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Mono auto generated files
mono_crash.*
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
[Ww][Ii][Nn]32/
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
[Ll]ogs/
# Visual Studio 2015/2017 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# Visual Studio 2017 auto generated files
Generated\ Files/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUnit
*.VisualState.xml
TestResult.xml
nunit-*.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# Benchmark Results
BenchmarkDotNet.Artifacts/
# .NET
project.lock.json
project.fragment.lock.json
artifacts/
# Tye
.tye/
# ASP.NET Scaffolding
ScaffoldingReadMe.txt
# StyleCop
StyleCopReport.xml
# Files built by Visual Studio
*_i.c
*_p.c
*_h.h
*.ilk
*.meta
*.obj
*.iobj
*.pch
*.pdb
*.ipdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*_wpftmp.csproj
*.log
*.tlog
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# Visual Studio Trace Files
*.e2e
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# AxoCover is a Code Coverage Tool
.axoCover/*
!.axoCover/settings.json
# Coverlet is a free, cross platform Code Coverage Tool
coverage*.json
coverage*.xml
coverage*.info
# Visual Studio code coverage results
*.coverage
*.coveragexml
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# NuGet Symbol Packages
*.snupkg
# The packages folder can be ignored because of Package Restore
**/[Pp]ackages/*
# except build/, which is used as an MSBuild target.
!**/[Pp]ackages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/[Pp]ackages/repositories.config
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
*.appx
*.appxbundle
*.appxupload
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!?*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
orleans.codegen.cs
# Including strong name files can present a security risk
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
#*.snk
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
ServiceFabricBackup/
*.rptproj.bak
# SQL Server files
*.mdf
*.ldf
*.ndf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
*.rptproj.rsuser
*- [Bb]ackup.rdl
*- [Bb]ackup ([0-9]).rdl
*- [Bb]ackup ([0-9][0-9]).rdl
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw
# Visual Studio 6 auto-generated project file (contains which files were open etc.)
*.vbp
# Visual Studio 6 workspace and project file (working project files containing files to include in project)
*.dsw
*.dsp
# Visual Studio 6 technical files
*.ncb
*.aps
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# CodeRush personal settings
.cr/personal
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config
# Tabs Studio
*.tss
# Telerik's JustMock configuration file
*.jmconfig
# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs
# OpenCover UI analysis results
OpenCover/
# Azure Stream Analytics local run output
ASALocalRun/
# MSBuild Binary and Structured Log
*.binlog
# NVidia Nsight GPU debugger configuration file
*.nvuser
# MFractors (Xamarin productivity tool) working folder
.mfractor/
# Local History for Visual Studio
.localhistory/
# Visual Studio History (VSHistory) files
.vshistory/
# BeatPulse healthcheck temp database
healthchecksdb
# Backup folder for Package Reference Convert tool in Visual Studio 2017
MigrationBackup/
# Ionide (cross platform F# VS Code tools) working folder
.ionide/
# Fody - auto-generated XML schema
FodyWeavers.xsd
# VS Code files for those working on multiple tools
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
*.code-workspace
# Local History for Visual Studio Code
.history/
# Windows Installer files from build outputs
*.cab
*.msi
*.msix
*.msm
*.msp
# JetBrains Rider
*.sln.iml
##
## Visual studio for Mac
##
# globs
Makefile.in
*.userprefs
*.usertasks
config.make
config.status
aclocal.m4
install-sh
autom4te.cache/
*.tar.gz
tarballs/
test-results/
# Mac bundle stuff
*.dmg
*.app
# content below from: https://github.com/github/gitignore/blob/master/Global/macOS.gitignore
# General
.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
# content below from: https://github.com/github/gitignore/blob/master/Global/Windows.gitignore
# Windows thumbnail cache files
Thumbs.db
ehthumbs.db
ehthumbs_vista.db
# Dump file
*.stackdump
# Folder config file
[Dd]esktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp
# Windows shortcuts
*.lnk
nuget/runtimes/win-x64.dll

37
dotnet/Extism.sln Normal file
View File

@@ -0,0 +1,37 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.4.33110.190
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Extism.Sdk", "src\Extism.Sdk\Extism.Sdk.csproj", "{1FAA7B6E-249C-4E4C-AE7A-A493A9D24475}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Extism.Sdk.Tests", "test\Extism.Sdk\Extism.Sdk.Tests.csproj", "{DB440D61-C781-4C59-9223-9A79CC9FB4E7}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Extism.Sdk.Sample", "samples\Extism.Sdk.Sample\Extism.Sdk.Sample.csproj", "{2232E572-E8BA-46A1-AF31-E4168960DB75}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{1FAA7B6E-249C-4E4C-AE7A-A493A9D24475}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1FAA7B6E-249C-4E4C-AE7A-A493A9D24475}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1FAA7B6E-249C-4E4C-AE7A-A493A9D24475}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1FAA7B6E-249C-4E4C-AE7A-A493A9D24475}.Release|Any CPU.Build.0 = Release|Any CPU
{DB440D61-C781-4C59-9223-9A79CC9FB4E7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DB440D61-C781-4C59-9223-9A79CC9FB4E7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DB440D61-C781-4C59-9223-9A79CC9FB4E7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DB440D61-C781-4C59-9223-9A79CC9FB4E7}.Release|Any CPU.Build.0 = Release|Any CPU
{2232E572-E8BA-46A1-AF31-E4168960DB75}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2232E572-E8BA-46A1-AF31-E4168960DB75}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2232E572-E8BA-46A1-AF31-E4168960DB75}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2232E572-E8BA-46A1-AF31-E4168960DB75}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {2B6BF267-F2A5-4CB5-8DFD-F11CC8787E6B}
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,24 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1</TargetFrameworks>
<NoBuild>true</NoBuild>
<IncludeBuildOutput>false</IncludeBuildOutput>
</PropertyGroup>
<PropertyGroup>
<PackageId>Extism.runtime.win-x64</PackageId>
<Version>0.2.0</Version>
<Authors>Extism Contributors</Authors>
<Description>Internal implementation package for Extism to work on Windows x64</Description>
<Tags>extism, wasm, plugin</Tags>
<PackageLicenseExpression>BSD-3-Clause</PackageLicenseExpression>
</PropertyGroup>
<ItemGroup>
<Content Include="runtimes/win-x64.dll"
CopyToOutputDirectory="Always"
Pack="true"
PackagePath="runtimes\win-x64\native\extism.dll" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1 @@
win-x64.dll

View File

@@ -0,0 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<None Include="..\..\..\wasm\code.wasm" Link="code.wasm">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\Extism.Sdk\Extism.Sdk.csproj" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,11 @@
using Extism.Sdk.Native;
using System.Text;
var context = new Context();
var wasm = await File.ReadAllBytesAsync("./code.wasm");
using var plugin = context.CreatePlugin(wasm, withWasi: true);
var output = Encoding.UTF8.GetString(
plugin.CallFunction("count_vowels", Encoding.UTF8.GetBytes("Hello World!"))
);
Console.WriteLine(output); // prints {"count": 3}

View File

@@ -0,0 +1,5 @@
## Example 1
This example shows how you can use the library in the most basic way.
It loads up the sample wasm plugin and lets you to pass inputs to it and show the ouput.
**Please note that on Windows you have to manually copy the `extism.dll` file to the ouput directory.**

View File

@@ -0,0 +1,24 @@
<!-- Recommended practices for publishing nuget packages from: https://devblogs.microsoft.com/dotnet/producing-packages-with-source-link/ -->
<Project>
<PropertyGroup>
<!-- Publish the repository URL in the built .nupkg (in the NuSpec <Repository> element) -->
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<!-- Embed source files that are not tracked by the source control manager in the PDB -->
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<!-- Recommended: Embed symbols containing Source Link in the main file (exe/dll) -->
<DebugType>embedded</DebugType>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>
<PropertyGroup Condition="'$(GITHUB_ACTIONS)' == 'true'">
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,184 @@
using System.Diagnostics.CodeAnalysis;
using System.Runtime.InteropServices;
namespace Extism.Sdk.Native;
/// <summary>
/// Represents an Extism context through which you can load <see cref="Plugin"/>s.
/// </summary>
public class Context : IDisposable
{
private const int DisposedMarker = 1;
private int _disposed;
/// <summary>
/// Initialize a new Extism Context.
/// </summary>
public Context()
{
NativeHandle = LibExtism.extism_context_new();
}
/// <summary>
/// Native pointer to the Extism Context.
/// </summary>
internal IntPtr NativeHandle { get; }
/// <summary>
/// Loads an Extism <see cref="Plugin"/>.
/// </summary>
/// <param name="wasm">A WASM module (wat or wasm) or a JSON encoded manifest.</param>
/// <param name="withWasi">Enable/Disable WASI.</param>
public Plugin CreatePlugin(ReadOnlySpan<byte> wasm, bool withWasi)
{
CheckNotDisposed();
unsafe
{
fixed (byte* wasmPtr = wasm)
{
var plugin = LibExtism.extism_plugin_new(NativeHandle, wasmPtr, wasm.Length, withWasi);
return new Plugin(this, plugin);
}
}
}
/// <summary>
/// Remove all plugins from this <see cref="Context"/>'s registry.
/// </summary>
public void Reset()
{
CheckNotDisposed();
LibExtism.extism_context_reset(NativeHandle);
}
/// <summary>
/// Get this this <see cref="Context"/>'s last error.
/// </summary>
/// <returns></returns>
internal string? GetError()
{
CheckNotDisposed();
var result = LibExtism.extism_error(NativeHandle, -1);
return Marshal.PtrToStringUTF8(result);
}
/// <summary>
/// Frees all resources held by this Context.
/// </summary>
public void Dispose()
{
if (Interlocked.Exchange(ref _disposed, DisposedMarker) == DisposedMarker)
{
// Already disposed.
return;
}
Dispose(true);
GC.SuppressFinalize(this);
}
/// <summary>
/// Throw an appropriate exception if the plugin has been disposed.
/// </summary>
/// <exception cref="ObjectDisposedException"></exception>
protected void CheckNotDisposed()
{
Interlocked.MemoryBarrier();
if (_disposed == DisposedMarker)
{
ThrowDisposedException();
}
}
[DoesNotReturn]
private static void ThrowDisposedException()
{
throw new ObjectDisposedException(nameof(Context));
}
/// <summary>
/// Frees all resources held by this Context.
/// </summary>
protected virtual void Dispose(bool disposing)
{
if (disposing)
{
// Free up any managed resources here
}
// Free up unmanaged resources
LibExtism.extism_context_free(NativeHandle);
}
/// <summary>
/// Destructs the current Context and frees all resources used by it.
/// </summary>
~Context()
{
Dispose(false);
}
/// <summary>
/// Get the Extism version string.
/// </summary>
public static string GetExtismVersion()
{
var pointer = LibExtism.extism_version();
return Marshal.PtrToStringUTF8(pointer);
}
/// <summary>
/// Set Extism's log file and level. This is applied for all <see cref="Context"/>s.
/// </summary>
/// <param name="logPath">Log file; can be 'stdout' or 'stderr' to write logs to the console.</param>
/// <param name="level">The log level to write at.</param>
public static bool SetExtismLogFile(string logPath, LogLevel level)
{
var logLevel = level switch
{
LogLevel.Error => LibExtism.LogLevels.Error,
LogLevel.Warning => LibExtism.LogLevels.Warn,
LogLevel.Info => LibExtism.LogLevels.Info,
LogLevel.Debug => LibExtism.LogLevels.Debug,
LogLevel.Trace => LibExtism.LogLevels.Trace,
_ => throw new NotImplementedException(),
};
return LibExtism.extism_log_file(logPath, logLevel);
}
}
/// <summary>
/// Extism Log Levels
/// </summary>
public enum LogLevel
{
/// <summary>
/// Designates very serious errors.
/// </summary>
Error,
/// <summary>
/// Designates hazardous situations.
/// </summary>
Warning,
/// <summary>
/// Designates useful information.
/// </summary>
Info,
/// <summary>
/// Designates lower priority information.
/// </summary>
Debug,
/// <summary>
/// Designates very low priority, often extremely verbose, information.
/// </summary>
Trace
}

View File

@@ -0,0 +1,40 @@
namespace Extism.Sdk.Native;
using System;
/// <summary>
/// Represents errors that occur during calling Extism functions.
/// </summary>
public class ExtismException : Exception
{
/// <summary>
/// Initializes a new instance of the <see cref="ExtismException"/> class.
/// </summary>
public ExtismException()
{
}
/// <summary>
/// Initializes a new instance of the <see cref="ExtismException"/> class with a specified error message.
/// </summary>
/// <param name="message">The message that describes the error .</param>
public ExtismException(string message)
: base(message)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="ExtismException"/> class
/// with a specified error message and a reference to the inner exception
/// that is the cause of this exception.
/// </summary>
/// <param name="message">The message that describes the error .</param>
/// <param name="innerException">
/// The exception that is the cause of the current exception, or a null reference
/// (Nothing in Visual Basic) if no inner exception is specified.
/// </param>
public ExtismException(string message, Exception innerException)
: base(message, innerException)
{
}
}

View File

@@ -0,0 +1,28 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<LangVersion>10</LangVersion>
</PropertyGroup>
<PropertyGroup>
<PackageId>Extism.Sdk</PackageId>
<Version>0.2.0</Version>
<Authors>Extism Contributors</Authors>
<Description>Extism SDK that allows hosting Extism plugins in .NET apps.</Description>
<Tags>extism, wasm, plugin</Tags>
<PackageLicenseExpression>BSD-3-Clause</PackageLicenseExpression>
<PackageReadmeFile>README.md</PackageReadmeFile>
</PropertyGroup>
<ItemGroup>
<None Include="README.md" Pack="true" PackagePath="\"/>
</ItemGroup>
<ItemGroup>
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="6.0.0" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,170 @@
using System.Runtime.InteropServices;
namespace Extism.Sdk.Native;
/// <summary>
/// Functions exposed by the native Extism library.
/// </summary>
internal static class LibExtism
{
/// <summary>
/// Create a new context.
/// </summary>
/// <returns>A pointer to the newly created context.</returns>
[DllImport("extism")]
public static extern IntPtr extism_context_new();
/// <summary>
/// Remove a context from the registry and free associated memory.
/// </summary>
/// <param name="context"></param>
[DllImport("extism")]
public static extern void extism_context_free(IntPtr context);
/// <summary>
/// Load a WASM plugin.
/// </summary>
/// <param name="context">Pointer to the context the plugin will be associated with.</param>
/// <param name="wasm">A WASM module (wat or wasm) or a JSON encoded manifest.</param>
/// <param name="wasmSize">The length of the `wasm` parameter.</param>
/// <param name="withWasi">Enables/disables WASI.</param>
/// <returns></returns>
[DllImport("extism")]
unsafe public static extern IntPtr extism_plugin_new(IntPtr context, byte* wasm, int wasmSize, bool withWasi);
/// <summary>
/// Update a plugin, keeping the existing ID.
/// Similar to <see cref="extism_plugin_new"/> but takes an `plugin` argument to specify which plugin to update.
/// Memory for this plugin will be reset upon update.
/// </summary>
/// <param name="context">Pointer to the context the plugin is associated with.</param>
/// <param name="plugin">Pointer to the plugin you want to update.</param>
/// <param name="wasm">A WASM module (wat or wasm) or a JSON encoded manifest.</param>
/// <param name="wasmLength">The length of the `wasm` parameter.</param>
/// <param name="withWasi">Enables/disables WASI.</param>
/// <returns></returns>
[DllImport("extism")]
unsafe public static extern bool extism_plugin_update(IntPtr context, IntPtr plugin, byte* wasm, int wasmLength, bool withWasi);
/// <summary>
/// Remove a plugin from the registry and free associated memory.
/// </summary>
/// <param name="context">Pointer to the context the plugin is associated with.</param>
/// <param name="plugin">Pointer to the plugin you want to free.</param>
[DllImport("extism")]
public static extern void extism_plugin_free(IntPtr context, IntPtr plugin);
/// <summary>
/// Remove all plugins from the registry.
/// </summary>
/// <param name="context"></param>
[DllImport("extism")]
public static extern void extism_context_reset(IntPtr context);
/// <summary>
/// Update plugin config values, this will merge with the existing values.
/// </summary>
/// <param name="context">Pointer to the context the plugin is associated with.</param>
/// <param name="plugin">Pointer to the plugin you want to update the configurations for.</param>
/// <param name="json">The configuration JSON encoded in UTF8.</param>
/// <param name="jsonLength">The length of the `json` parameter.</param>
/// <returns></returns>
[DllImport("extism")]
unsafe public static extern bool extism_plugin_config(IntPtr context, IntPtr plugin, byte* json, int jsonLength);
/// <summary>
/// Returns true if funcName exists.
/// </summary>
/// <param name="context"></param>
/// <param name="plugin"></param>
/// <param name="funcName"></param>
/// <returns></returns>
[DllImport("extism")]
public static extern bool extism_plugin_function_exists(IntPtr context, IntPtr plugin, string funcName);
/// <summary>
/// Call a function.
/// </summary>
/// <param name="context"></param>
/// <param name="plugin"></param>
/// <param name="funcName">The function to call.</param>
/// <param name="data">Input data.</param>
/// <param name="dataLen">The length of the `data` parameter.</param>
/// <returns></returns>
[DllImport("extism")]
unsafe public static extern int extism_plugin_call(IntPtr context, IntPtr plugin, string funcName, byte* data, int dataLen);
/// <summary>
/// Get the error associated with a Context or Plugin, if plugin is -1 then the context error will be returned.
/// </summary>
/// <param name="context"></param>
/// <param name="plugin">A plugin pointer, or -1 for the context error.</param>
/// <returns></returns>
[DllImport("extism")]
public static extern IntPtr extism_error(IntPtr context, nint plugin);
/// <summary>
/// Get the length of a plugin's output data.
/// </summary>
/// <param name="context"></param>
/// <param name="plugin"></param>
/// <returns></returns>
[DllImport("extism")]
public static extern long extism_plugin_output_length(IntPtr context, IntPtr plugin);
/// <summary>
/// Get the plugin's output data.
/// </summary>
/// <param name="context"></param>
/// <param name="plugin"></param>
/// <returns></returns>
[DllImport("extism")]
public static extern IntPtr extism_plugin_output_data(IntPtr context, IntPtr plugin);
/// <summary>
/// Set log file and level.
/// </summary>
/// <param name="filename"></param>
/// <param name="logLevel"></param>
/// <returns></returns>
[DllImport("extism")]
public static extern bool extism_log_file(string filename, string logLevel);
/// <summary>
/// Get the Extism version string.
/// </summary>
/// <returns></returns>
[DllImport("extism", EntryPoint = "extism_version")]
public static extern IntPtr extism_version();
/// <summary>
/// Extism Log Levels
/// </summary>
public static class LogLevels
{
/// <summary>
/// Designates very serious errors.
/// </summary>
public const string Error = "Error";
/// <summary>
/// Designates hazardous situations.
/// </summary>
public const string Warn = "Warn";
/// <summary>
/// Designates useful information.
/// </summary>
public const string Info = "Info";
/// <summary>
/// Designates lower priority information.
/// </summary>
public const string Debug = "Debug";
/// <summary>
/// Designates very low priority, often extremely verbose, information.
/// </summary>
public const string Trace = "Trace";
}
}

View File

@@ -0,0 +1,189 @@
using System.Diagnostics.CodeAnalysis;
using System.Runtime.InteropServices;
namespace Extism.Sdk.Native;
/// <summary>
/// Represents a WASM Extism plugin.
/// </summary>
public class Plugin : IDisposable
{
private const int DisposedMarker = 1;
private readonly Context _context;
private int _disposed;
internal Plugin(Context context, IntPtr handle)
{
_context = context;
NativeHandle = handle;
}
/// <summary>
/// A pointer to the native Plugin struct.
/// </summary>
internal IntPtr NativeHandle { get; }
/// <summary>
/// Update a plugin, keeping the existing ID.
/// </summary>
/// <param name="wasm">The plugin WASM bytes.</param>
/// <param name="withWasi">Enable/Disable WASI.</param>
unsafe public bool Update(ReadOnlySpan<byte> wasm, bool withWasi)
{
CheckNotDisposed();
fixed (byte* wasmPtr = wasm)
{
return LibExtism.extism_plugin_update(_context.NativeHandle, NativeHandle, wasmPtr, wasm.Length, withWasi);
}
}
/// <summary>
/// Update plugin config values, this will merge with the existing values.
/// </summary>
/// <param name="json">The configuration JSON encoded in UTF8.</param>
unsafe public bool SetConfig(ReadOnlySpan<byte> json)
{
CheckNotDisposed();
fixed (byte* jsonPtr = json)
{
return LibExtism.extism_plugin_config(_context.NativeHandle, NativeHandle, jsonPtr, json.Length);
}
}
/// <summary>
/// Checks if a specific function exists in the current plugin.
/// </summary>
public bool FunctionExists(string name)
{
CheckNotDisposed();
return LibExtism.extism_plugin_function_exists(_context.NativeHandle, NativeHandle, name);
}
/// <summary>
/// Calls a function in the current plugin and returns a status.
/// If the status represents an error, call <see cref="GetError"/> to get the error.
/// Othewise, call <see cref="OutputData"/> to get the function's output data.
/// </summary>
/// <param name="functionName">Name of the function in the plugin to invoke.</param>
/// <param name="data">A buffer to provide as input to the function.</param>
/// <returns>The exit code of the function.</returns>
/// <exception cref="ExtismException"></exception>
unsafe public ReadOnlySpan<byte> CallFunction(string functionName, ReadOnlySpan<byte> data)
{
CheckNotDisposed();
fixed (byte* dataPtr = data)
{
int response = LibExtism.extism_plugin_call(_context.NativeHandle, NativeHandle, functionName, dataPtr, data.Length);
if (response == 0) {
return OutputData();
} else {
var errorMsg = GetError();
if (errorMsg != null) {
throw new ExtismException(errorMsg);
} else {
throw new ExtismException("Call to Extism failed");
}
}
}
}
/// <summary>
/// Get the length of a plugin's output data.
/// </summary>
/// <returns></returns>
internal int OutputLength()
{
CheckNotDisposed();
return (int)LibExtism.extism_plugin_output_length(_context.NativeHandle, NativeHandle);
}
/// <summary>
/// Get the plugin's output data.
/// </summary>
internal ReadOnlySpan<byte> OutputData()
{
CheckNotDisposed();
var length = OutputLength();
unsafe
{
var ptr = LibExtism.extism_plugin_output_data(_context.NativeHandle, NativeHandle).ToPointer();
return new Span<byte>(ptr, length);
}
}
/// <summary>
/// Get the error associated with the current plugin.
/// </summary>
/// <returns></returns>
internal string? GetError()
{
CheckNotDisposed();
var result = LibExtism.extism_error(_context.NativeHandle, NativeHandle);
return Marshal.PtrToStringUTF8(result);
}
/// <summary>
/// Frees all resources held by this Plugin.
/// </summary>
public void Dispose()
{
if (Interlocked.Exchange(ref _disposed, DisposedMarker) == DisposedMarker)
{
// Already disposed.
return;
}
Dispose(true);
GC.SuppressFinalize(this);
}
/// <summary>
/// Throw an appropriate exception if the plugin has been disposed.
/// </summary>
/// <exception cref="ObjectDisposedException"></exception>
protected void CheckNotDisposed()
{
Interlocked.MemoryBarrier();
if (_disposed == DisposedMarker)
{
ThrowDisposedException();
}
}
[DoesNotReturn]
private static void ThrowDisposedException()
{
throw new ObjectDisposedException(nameof(Plugin));
}
/// <summary>
/// Frees all resources held by this Plugin.
/// </summary>
protected virtual void Dispose(bool disposing)
{
if (disposing)
{
// Free up any managed resources here
}
// Free up unmanaged resources
LibExtism.extism_plugin_free(_context.NativeHandle, NativeHandle);
}
/// <summary>
/// Destructs the current Plugin and frees all resources used by it.
/// </summary>
~Plugin()
{
Dispose(false);
}
}

View File

@@ -0,0 +1,2 @@
## Extism.Sdk
Extism SDK that allows hosting Extism plugins in .NET apps.

View File

@@ -0,0 +1,24 @@
using Extism.Sdk.Native;
using System.Reflection;
using System.Text;
using Xunit;
namespace Extism.Sdk.Tests;
public class BasicTests
{
[Fact]
public void CountHelloWorldVowels()
{
using var context = new Context();
var binDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)!;
var wasm = File.ReadAllBytes(Path.Combine(binDirectory, "code.wasm"));
using var plugin = context.CreatePlugin(wasm, withWasi: true);
var response = plugin.CallFunction("count_vowels", Encoding.UTF8.GetBytes("Hello World"));
Assert.Equal("{\"count\": 3}", Encoding.UTF8.GetString(response));
}
}

View File

@@ -0,0 +1,35 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.2" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="3.1.2">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<None Include="..\..\..\wasm\code.wasm" Link="code.wasm">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\Extism.Sdk\Extism.Sdk.csproj" />
</ItemGroup>
</Project>

1
dune Normal file
View File

@@ -0,0 +1 @@
(dirs ocaml)

View File

@@ -11,7 +11,7 @@
(maintainers "Extism Authors <oss@extism.org>")
(license BSD-3)
(license BSD-3-Clause)
(documentation https://github.com/extism/extism)
@@ -19,6 +19,28 @@
(name extism)
(synopsis "Extism bindings")
(description "Bindings to Extism, the universal plugin system")
(depends ocaml dune ctypes-foreign bigstringaf ppx_yojson_conv base64)
(depends
(ocaml (>= 4.14.1))
(dune (>= 3.2))
(ctypes-foreign (>= 0.18.0))
(bigstringaf (>= 0.9.0))
(ppx_yojson_conv (>= 0.15.0))
extism-manifest
(ppx_inline_test (>= 0.15.0))
(cmdliner (>= 1.1.1))
)
(tags
(topics wasm plugin)))
(package
(name extism-manifest)
(synopsis "Extism manifest bindings")
(description "Bindings to Extism, the universal plugin system")
(depends
(ocaml (>= 4.14.1))
(dune (>= 3.2))
(ppx_yojson_conv (>= 0.15.0))
(base64 (>= 3.5.0))
)
(tags
(topics wasm plugin)))

4
elixir/.formatter.exs Normal file
View File

@@ -0,0 +1,4 @@
# Used by "mix format"
[
inputs: ["{mix,.formatter}.exs", "{config,lib,test}/**/*.{ex,exs}"]
]

28
elixir/.gitignore vendored Normal file
View File

@@ -0,0 +1,28 @@
# The directory Mix will write compiled artifacts to.
/_build/
# If you run "mix test --cover", coverage assets end up here.
/cover/
# The directory Mix downloads your dependencies sources to.
/deps/
# Where third-party dependencies like ExDoc output generated docs.
/doc/
# Ignore .fetch files in case you like to edit your project deps locally.
/.fetch
# If the VM crashes, it generates a dump, let's ignore it too.
erl_crash.dump
# Also ignore archive artifacts (built via "mix archive.build").
*.ez
# Ignore package tarball (built via "mix hex.build").
extism-*.tar
# Temporary files, for example, from tests.
/tmp/
/priv/

27
elixir/Makefile Normal file
View File

@@ -0,0 +1,27 @@
.PHONY: test
prepare:
mix deps.get
mix compile
test: prepare
mix test
clean:
mix clean
publish: clean prepare
mix hex.build
mix hex.publish --yes
format:
mix format
lint:
mix format --check-formatted
docs:
mix docs
show-docs: docs
open doc/index.html

73
elixir/README.md Normal file
View File

@@ -0,0 +1,73 @@
# Extism
Extism Host SDK for Elixir and Erlang
## Docs
Read the [docs on hexdocs.pm](https://hexdocs.pm/extism/).
## Installation
You can find this package on [hex.pm](https://hex.pm/packages/extism).
```elixir
def deps do
[
{:extism, "~> 0.1.0"}
]
end
```
## Getting Started
### Example
```elixir
# Create a context for which plugins can be allocated and cleaned
ctx = Extism.Context.new()
# point to some wasm code, this is the count_vowels example that ships with extism
manifest = %{ wasm: [ %{ path: "/Users/ben/code/extism/wasm/code.wasm" } ]}
{:ok, plugin} = Extism.Context.new_plugin(ctx, manifest, false)
# {:ok,
# %Extism.Plugin{
# resource: 0,
# reference: #Reference<0.520418104.1263009793.80956>
# }}
{:ok, output} = Extism.Plugin.call(plugin, "count_vowels", "this is a test")
# {:ok, "{\"count\": 4}"}
{:ok, result} = JSON.decode(output)
# {:ok, %{"count" => 4}}
# free up the context and any plugins we allocated
Extism.Context.free(ctx)
```
### Modules
The two primary modules you should learn are:
* [Extism.Context](Extism.Context.html)
* [Extism.Plugin](Extism.Plugin.html)
#### Context
The [Context](Extism.Context.html) can be thought of as a session. You need a context to interact with the Extism runtime. The context holds your plugins and when you free the context, it frees your plugins. It's important to free up your context and plugins when you are done with them.
```elixir
ctx = Extism.Context.new()
# frees all the plugins
Extism.Context.reset(ctx)
# frees the context and all its plugins
Extism.Context.free(ctx)
```
#### Plugin
The [Plugin](Extism.Plugin.html) represents an instance of your WASM program from the given manifest.
The key method to know here is [Extism.Plugin#call](Extism.Plugin.html#call/3) which takes a function name to invoke and some input data, and returns the results from the plugin.
```elixir
{:ok, plugin} = Extism.Context.new_plugin(ctx, manifest, false)
{:ok, output} = Extism.Plugin.call(plugin, "count_vowels", "this is a test")
```

5
elixir/lib/extism.ex Normal file
View File

@@ -0,0 +1,5 @@
defmodule Extism do
def set_log_file(filepath, level) do
Extism.Native.set_log_file(filepath, level)
end
end

View File

@@ -0,0 +1,64 @@
defmodule Extism.Context do
@moduledoc """
A Context is needed to create plugins. The Context is where your plugins
live. Freeing the context frees all of the plugins in its scope.
"""
defstruct [
# The actual NIF Resource. A pointer in this case
ptr: nil
]
def wrap_resource(ptr) do
%__MODULE__{
ptr: ptr
}
end
@doc """
Creates a new context.
"""
def new() do
ptr = Extism.Native.context_new()
Extism.Context.wrap_resource(ptr)
end
@doc """
Resets the context. This has the effect of freeing all the plugins created so far.
"""
def reset(ctx) do
Extism.Native.context_reset(ctx.ptr)
end
@doc """
Frees the context from memory and all of its plugins.
"""
def free(ctx) do
Extism.Native.context_free(ctx.ptr)
end
@doc """
Create a new plugin from a WASM module or manifest
## Examples:
iex> ctx = Extism.Context.new()
iex> manifest = %{ wasm: [ %{ path: "/Users/ben/code/extism/wasm/code.wasm" } ]}
iex> {:ok, plugin} = Extism.Context.new_plugin(ctx, manifest, false)
## Parameters
- ctx: The Context to manage this plugin
- manifest: The String or Map of the WASM module or [manifest](https://extism.org/docs/concepts/manifest)
- wasi: A bool you set to true if you want WASI support
"""
def new_plugin(ctx, manifest, wasi \\ false) do
{:ok, manifest_payload} = JSON.encode(manifest)
case Extism.Native.plugin_new_with_manifest(ctx.ptr, manifest_payload, wasi) do
{:error, err} -> {:error, err}
res -> {:ok, Extism.Plugin.wrap_resource(ctx, res)}
end
end
end

View File

@@ -0,0 +1,21 @@
defmodule Extism.Native do
@moduledoc """
This module represents the Native Extism runtime API and is for internal use.
Do not use or rely on this this module.
"""
use Rustler,
otp_app: :extism,
crate: :extism_nif
def context_new(), do: error()
def context_reset(_ctx), do: error()
def context_free(_ctx), do: error()
def plugin_new_with_manifest(_ctx, _manifest, _wasi), do: error()
def plugin_call(_ctx, _plugin_id, _name, _input), do: error()
def plugin_update_manifest(_ctx, _plugin_id, _manifest, _wasi), do: error()
def plugin_has_function(_ctx, _plugin_id, _function_name), do: error()
def plugin_free(_ctx, _plugin_id), do: error()
def set_log_file(_filename, _level), do: error()
defp error, do: :erlang.nif_error(:nif_not_loaded)
end

View File

@@ -0,0 +1,91 @@
defmodule Extism.Plugin do
@moduledoc """
A Plugin represents an instance of your WASM program from the given manifest.
"""
defstruct [
# The actual NIF Resource. PluginIndex and the context
plugin_id: nil,
ctx: nil
]
def wrap_resource(ctx, plugin_id) do
%__MODULE__{
ctx: ctx,
plugin_id: plugin_id
}
end
@doc """
Call a plugin's function by name
## Examples
iex> {:ok, plugin} = Extism.Context.new_plugin(ctx, manifest, false)
iex> {:ok, output} = Extism.Plugin.call(plugin, "count_vowels", "this is a test")
# {:ok, "{\"count\": 4}"}
## Parameters
- plugin: The plugin
- name: The name of the function as a string
- input: The input data as a string
## Returns
A string representation of the functions output
"""
def call(plugin, name, input) do
case Extism.Native.plugin_call(plugin.ctx.ptr, plugin.plugin_id, name, input) do
{:error, err} -> {:error, err}
res -> {:ok, res}
end
end
@doc """
Updates the manifest of the given plugin
## Parameters
- ctx: The Context to manage this plugin
- manifest: The String or Map of the WASM module or [manifest](https://extism.org/docs/concepts/manifest)
- wasi: A bool you set to true if you want WASI support
"""
def update(plugin, manifest, wasi) when is_map(manifest) do
{:ok, manifest_payload} = JSON.encode(manifest)
case Extism.Native.plugin_update_manifest(
plugin.ctx.ptr,
plugin.plugin_id,
manifest_payload,
wasi
) do
{:error, err} -> {:error, err}
_ -> :ok
end
end
@doc """
Frees the plugin
"""
def free(plugin) do
Extism.Native.plugin_free(plugin.ctx.ptr, plugin.plugin_id)
end
@doc """
Returns true if the given plugin responds to the given function name
"""
def has_function(plugin, function_name) do
Extism.Native.plugin_has_function(plugin.ctx.ptr, plugin.plugin_id, function_name)
end
end
defimpl Inspect, for: Extim.Plugin do
import Inspect.Algebra
def inspect(dict, opts) do
concat(["#Extism.Plugin<", to_doc(dict.plugin_id, opts), ">"])
end
end

BIN
elixir/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

59
elixir/mix.exs Normal file
View File

@@ -0,0 +1,59 @@
defmodule Extism.MixProject do
use Mix.Project
def project do
[
app: :extism,
version: "0.1.0",
elixir: "~> 1.12",
start_permanent: Mix.env() == :prod,
deps: deps(),
package: package(),
aliases: aliases(),
docs: docs()
]
end
# Run "mix help compile.app" to learn about applications.
def application do
[
extra_applications: [:logger]
]
end
defp deps do
[
{:rustler, "~> 0.26.0"},
{:json, "~> 1.4"},
{:ex_doc, "~> 0.21", only: :dev, runtime: false}
]
end
defp aliases do
[
fmt: [
"format",
"cmd cargo fmt --manifest-path native/io/Cargo.toml"
]
]
end
defp package do
[
licenses: ["BSD-3-Clause"],
description: "Extism Host SDK for Elixir and Erlang",
name: "extism",
files: ~w(lib native .formatter.exs mix.exs README.md LICENSE),
links: %{"GitHub" => "https://github.com/extism/extism"}
]
end
defp docs do
[
main: "Extism",
logo: "./logo.png",
main: "readme",
extras: ["README.md"]
]
end
end

12
elixir/mix.lock Normal file
View File

@@ -0,0 +1,12 @@
%{
"earmark_parser": {:hex, :earmark_parser, "1.4.29", "149d50dcb3a93d9f3d6f3ecf18c918fb5a2d3c001b5d3305c926cddfbd33355b", [:mix], [], "hexpm", "4902af1b3eb139016aed210888748db8070b8125c2342ce3dcae4f38dcc63503"},
"ex_doc": {:hex, :ex_doc, "0.29.1", "b1c652fa5f92ee9cf15c75271168027f92039b3877094290a75abcaac82a9f77", [:mix], [{:earmark_parser, "~> 1.4.19", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1", [hex: :makeup_erlang, repo: "hexpm", optional: false]}], "hexpm", "b7745fa6374a36daf484e2a2012274950e084815b936b1319aeebcf7809574f6"},
"jason": {:hex, :jason, "1.4.0", "e855647bc964a44e2f67df589ccf49105ae039d4179db7f6271dfd3843dc27e6", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "79a3791085b2a0f743ca04cec0f7be26443738779d09302e01318f97bdb82121"},
"json": {:hex, :json, "1.4.1", "8648f04a9439765ad449bc56a3ff7d8b11dd44ff08ffcdefc4329f7c93843dfa", [:mix], [], "hexpm", "9abf218dbe4ea4fcb875e087d5f904ef263d012ee5ed21d46e9dbca63f053d16"},
"makeup": {:hex, :makeup, "1.1.0", "6b67c8bc2882a6b6a445859952a602afc1a41c2e08379ca057c0f525366fc3ca", [:mix], [{:nimble_parsec, "~> 1.2.2 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "0a45ed501f4a8897f580eabf99a2e5234ea3e75a4373c8a52824f6e873be57a6"},
"makeup_elixir": {:hex, :makeup_elixir, "0.16.0", "f8c570a0d33f8039513fbccaf7108c5d750f47d8defd44088371191b76492b0b", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.2.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "28b2cbdc13960a46ae9a8858c4bebdec3c9a6d7b4b9e7f4ed1502f8159f338e7"},
"makeup_erlang": {:hex, :makeup_erlang, "0.1.1", "3fcb7f09eb9d98dc4d208f49cc955a34218fc41ff6b84df7c75b3e6e533cc65f", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "174d0809e98a4ef0b3309256cbf97101c6ec01c4ab0b23e926a9e17df2077cbb"},
"nimble_parsec": {:hex, :nimble_parsec, "1.2.3", "244836e6e3f1200c7f30cb56733fd808744eca61fd182f731eac4af635cc6d0b", [:mix], [], "hexpm", "c8d789e39b9131acf7b99291e93dae60ab48ef14a7ee9d58c6964f59efb570b0"},
"rustler": {:hex, :rustler, "0.26.0", "06a2773d453ee3e9109efda643cf2ae633dedea709e2455ac42b83637c9249bf", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}, {:toml, "~> 0.6", [hex: :toml, repo: "hexpm", optional: false]}], "hexpm", "42961e9d2083d004d5a53e111ad1f0c347efd9a05cb2eb2ffa1d037cdc74db91"},
"toml": {:hex, :toml, "0.6.2", "38f445df384a17e5d382befe30e3489112a48d3ba4c459e543f748c2f25dd4d1", [:mix], [], "hexpm", "d013e45126d74c0c26a38d31f5e8e9b83ea19fc752470feb9a86071ca5a672fa"},
}

View File

@@ -0,0 +1,15 @@
[target.'cfg(target_os = "macos")']
rustflags = [
"-C", "link-arg=-undefined",
"-C", "link-arg=dynamic_lookup",
]
# See https://github.com/rust-lang/rust/issues/59302
[target.x86_64-unknown-linux-musl]
rustflags = [
"-C", "target-feature=-crt-static"
]
# Provides a small build size, but takes more time to build.
[profile.release]
lto = true

View File

@@ -0,0 +1,15 @@
[package]
name = "extism_nif"
version = "0.1.0"
edition = "2021"
authors = ["Benjamin Eckel <bhelx@simst.im>"]
[lib]
name = "extism_nif"
path = "src/lib.rs"
crate-type = ["cdylib"]
[dependencies]
rustler = "0.26.0"
extism = { version = "0.1.0", path = "../../../rust" }
log = "0.4"

View File

@@ -0,0 +1,177 @@
use extism::{Context, Plugin};
use rustler::{Atom, Env, ResourceArc, Term};
use std::mem;
use std::path::Path;
use std::str;
use std::str::FromStr;
use std::sync::RwLock;
mod atoms {
rustler::atoms! {
ok,
error,
unknown // Other error
}
}
struct ExtismContext {
ctx: RwLock<Context>,
}
unsafe impl Sync for ExtismContext {}
unsafe impl Send for ExtismContext {}
fn load(env: Env, _: Term) -> bool {
rustler::resource!(ExtismContext, env);
true
}
fn to_rustler_error(extism_error: extism::Error) -> rustler::Error {
match extism_error {
extism::Error::UnableToLoadPlugin(msg) => rustler::Error::Term(Box::new(msg)),
extism::Error::Message(msg) => rustler::Error::Term(Box::new(msg)),
extism::Error::Json(json_err) => rustler::Error::Term(Box::new(json_err.to_string())),
extism::Error::Runtime(e) => rustler::Error::Term(Box::new(e.to_string())),
}
}
#[rustler::nif]
fn context_new() -> ResourceArc<ExtismContext> {
ResourceArc::new(ExtismContext {
ctx: RwLock::new(Context::new()),
})
}
#[rustler::nif]
fn context_reset(ctx: ResourceArc<ExtismContext>) {
let context = &mut ctx.ctx.write().unwrap();
context.reset()
}
#[rustler::nif]
fn context_free(ctx: ResourceArc<ExtismContext>) {
let context = &ctx.ctx.read().unwrap();
std::mem::drop(context)
}
#[rustler::nif]
fn plugin_new_with_manifest(
ctx: ResourceArc<ExtismContext>,
manifest_payload: String,
wasi: bool,
) -> Result<i32, rustler::Error> {
let context = &ctx.ctx.write().unwrap();
let result = match Plugin::new(context, manifest_payload, wasi) {
Err(e) => Err(to_rustler_error(e)),
Ok(plugin) => {
let plugin_id = plugin.as_i32();
// this forget should be safe because the context will clean up
// all it's plugins when it is dropped
mem::forget(plugin);
Ok(plugin_id)
}
};
result
}
#[rustler::nif]
fn plugin_call(
ctx: ResourceArc<ExtismContext>,
plugin_id: i32,
name: String,
input: String,
) -> Result<String, rustler::Error> {
let context = &ctx.ctx.read().unwrap();
let mut plugin = unsafe { Plugin::from_id(plugin_id, context) };
let result = match plugin.call(name, input) {
Err(e) => Err(to_rustler_error(e)),
Ok(result) => match str::from_utf8(&result) {
Ok(output) => Ok(output.to_string()),
Err(_e) => Err(rustler::Error::Term(Box::new(
"Could not read output from plugin",
))),
},
};
// this forget should be safe because the context will clean up
// all it's plugins when it is dropped
mem::forget(plugin);
result
}
#[rustler::nif]
fn plugin_update_manifest(
ctx: ResourceArc<ExtismContext>,
plugin_id: i32,
manifest_payload: String,
wasi: bool,
) -> Result<(), rustler::Error> {
let context = &ctx.ctx.read().unwrap();
let mut plugin = unsafe { Plugin::from_id(plugin_id, context) };
let result = match plugin.update(manifest_payload, wasi) {
Ok(()) => Ok(()),
Err(e) => Err(to_rustler_error(e)),
};
// this forget should be safe because the context will clean up
// all it's plugins when it is dropped
mem::forget(plugin);
result
}
#[rustler::nif]
fn plugin_free(ctx: ResourceArc<ExtismContext>, plugin_id: i32) -> Result<(), rustler::Error> {
let context = &ctx.ctx.read().unwrap();
let plugin = unsafe { Plugin::from_id(plugin_id, context) };
std::mem::drop(plugin);
Ok(())
}
#[rustler::nif]
fn set_log_file(filename: String, log_level: String) -> Result<Atom, rustler::Error> {
let path = Path::new(&filename);
match log::Level::from_str(&log_level) {
Err(_e) => Err(rustler::Error::Term(Box::new(format!(
"{} not a valid log level",
log_level
)))),
Ok(level) => {
if extism::set_log_file(path, Some(level)) {
Ok(atoms::ok())
} else {
Err(rustler::Error::Term(Box::new(
"Did not set log file, received false from the API.",
)))
}
}
}
}
#[rustler::nif]
fn plugin_has_function(
ctx: ResourceArc<ExtismContext>,
plugin_id: i32,
function_name: String,
) -> Result<bool, rustler::Error> {
let context = &ctx.ctx.read().unwrap();
let plugin = unsafe { Plugin::from_id(plugin_id, context) };
let has_function = plugin.has_function(function_name);
// this forget should be safe because the context will clean up
// all it's plugins when it is dropped
mem::forget(plugin);
Ok(has_function)
}
rustler::init!(
"Elixir.Extism.Native",
[
context_new,
context_reset,
context_free,
plugin_new_with_manifest,
plugin_call,
plugin_update_manifest,
plugin_has_function,
plugin_free,
set_log_file,
],
load = load
);

View File

@@ -0,0 +1,83 @@
defmodule ExtismTest do
use ExUnit.Case
doctest Extism
test "context create & reset" do
ctx = Extism.Context.new()
path = Path.join([__DIR__, "../../wasm/code.wasm"])
manifest = %{wasm: [%{path: path}]}
{:ok, plugin} = Extism.Context.new_plugin(ctx, manifest, false)
Extism.Context.reset(ctx)
# we should expect an error after resetting context
{:error, _err} = Extism.Plugin.call(plugin, "count_vowels", "this is a test")
end
defp new_plugin() do
ctx = Extism.Context.new()
path = Path.join([__DIR__, "../../wasm/code.wasm"])
manifest = %{wasm: [%{path: path}]}
{:ok, plugin} = Extism.Context.new_plugin(ctx, manifest, false)
{ctx, plugin}
end
test "counts vowels" do
{ctx, plugin} = new_plugin()
{:ok, output} = Extism.Plugin.call(plugin, "count_vowels", "this is a test")
assert JSON.decode(output) == {:ok, %{"count" => 4}}
Extism.Context.free(ctx)
end
test "can make multiple calls on a plugin" do
{ctx, plugin} = new_plugin()
{:ok, output} = Extism.Plugin.call(plugin, "count_vowels", "this is a test")
assert JSON.decode(output) == {:ok, %{"count" => 4}}
{:ok, output} = Extism.Plugin.call(plugin, "count_vowels", "this is a test again")
assert JSON.decode(output) == {:ok, %{"count" => 7}}
{:ok, output} = Extism.Plugin.call(plugin, "count_vowels", "this is a test thrice")
assert JSON.decode(output) == {:ok, %{"count" => 6}}
{:ok, output} = Extism.Plugin.call(plugin, "count_vowels", "🌎hello🌎world🌎")
assert JSON.decode(output) == {:ok, %{"count" => 3}}
Extism.Context.free(ctx)
end
test "can free a plugin" do
{ctx, plugin} = new_plugin()
{:ok, output} = Extism.Plugin.call(plugin, "count_vowels", "this is a test")
assert JSON.decode(output) == {:ok, %{"count" => 4}}
Extism.Plugin.free(plugin)
# Expect an error when calling a plugin that was freed
{:error, _err} = Extism.Plugin.call(plugin, "count_vowels", "this is a test")
Extism.Context.free(ctx)
end
test "can update manifest" do
{ctx, plugin} = new_plugin()
path = Path.join([__DIR__, "../../wasm/code.wasm"])
manifest = %{wasm: [%{path: path}]}
assert Extism.Plugin.update(plugin, manifest, true) == :ok
Extism.Context.free(ctx)
end
test "errors on bad manifest" do
ctx = Extism.Context.new()
{:error, _msg} = Extism.Context.new_plugin(ctx, %{"wasm" => 123}, false)
Extism.Context.free(ctx)
end
test "errors on unknown function" do
{ctx, plugin} = new_plugin()
{:error, _msg} = Extism.Plugin.call(plugin, "unknown", "this is a test")
Extism.Context.free(ctx)
end
test "set_log_file" do
Extism.set_log_file("/tmp/logfile.log", "debug")
end
test "has_function" do
{ctx, plugin} = new_plugin()
assert Extism.Plugin.has_function(plugin, "count_vowels")
assert !Extism.Plugin.has_function(plugin, "unknown")
Extism.Context.free(ctx)
end
end

View File

@@ -0,0 +1 @@
ExUnit.start()

33
extism-manifest.opam Normal file
View File

@@ -0,0 +1,33 @@
# This file is generated by dune, edit dune-project instead
opam-version: "2.0"
synopsis: "Extism manifest bindings"
description: "Bindings to Extism, the universal plugin system"
maintainer: ["Extism Authors <oss@extism.org>"]
authors: ["Extism Authors <oss@extism.org>"]
license: "BSD-3-Clause"
tags: ["topics" "wasm" "plugin"]
homepage: "https://github.com/extism/extism"
doc: "https://github.com/extism/extism"
bug-reports: "https://github.com/extism/extism/issues"
depends: [
"ocaml" {>= "4.14.1"}
"dune" {>= "3.2" & >= "3.2"}
"ppx_yojson_conv" {>= "0.15.0"}
"base64" {>= "3.5.0"}
"odoc" {with-doc}
]
build: [
["dune" "subst"] {dev}
[
"dune"
"build"
"-p"
name
"-j"
jobs
"@install"
"@runtest" {with-test}
"@doc" {with-doc}
]
]
dev-repo: "git+https://github.com/extism/extism.git"

143
extism.go
View File

@@ -11,11 +11,33 @@ import (
/*
#cgo pkg-config: libextism.pc
#include <extism.h>
#include <stdlib.h>
*/
import "C"
// Context is used to manage Plugins
type Context struct {
pointer *C.ExtismContext
}
// NewContext creates a new context, it should be freed using the `Free` method
func NewContext() Context {
p := C.extism_context_new()
return Context{
pointer: p,
}
}
// Free a context
func (ctx *Context) Free() {
C.extism_context_free(ctx.pointer)
ctx.pointer = nil
}
// Plugin is used to call WASM functions
type Plugin struct {
id int32
ctx *Context
id int32
}
type WasmData struct {
@@ -31,11 +53,11 @@ type WasmFile struct {
}
type WasmUrl struct {
Url string `json:"url"`
Hash string `json:"hash,omitempty"`
Header map[string]string `json:"header,omitempty"`
Name string `json:"name,omitempty"`
Method string `json:"method,omitempty"`
Url string `json:"url"`
Hash string `json:"hash,omitempty"`
Headers map[string]string `json:"headers,omitempty"`
Name string `json:"name,omitempty"`
Method string `json:"method,omitempty"`
}
type Wasm interface{}
@@ -43,9 +65,12 @@ type Wasm interface{}
type Manifest struct {
Wasm []Wasm `json:"wasm"`
Memory struct {
Max uint32 `json:"max,omitempty"`
MaxPages uint32 `json:"max_pages,omitempty"`
} `json:"memory,omitempty"`
Config map[string]string `json:"config,omitempty"`
Config map[string]string `json:"config,omitempty"`
AllowedHosts []string `json:"allowed_hosts,omitempty"`
AllowedPaths map[string]string `json:"allowed_paths,omitempty"`
Timeout uint `json:"timeout_ms,omitempty"`
}
func makePointer(data []byte) unsafe.Pointer {
@@ -56,6 +81,7 @@ func makePointer(data []byte) unsafe.Pointer {
return ptr
}
// SetLogFile sets the log file and level, this is a global setting
func SetLogFile(filename string, level string) bool {
name := C.CString(filename)
l := C.CString(level)
@@ -65,81 +91,125 @@ func SetLogFile(filename string, level string) bool {
return bool(r)
}
func register(data []byte, wasi bool) (Plugin, error) {
// ExtismVersion gets the Extism version string
func ExtismVersion() string {
return C.GoString(C.extism_version())
}
func register(ctx *Context, data []byte, wasi bool) (Plugin, error) {
ptr := makePointer(data)
plugin := C.extism_plugin_register(
plugin := C.extism_plugin_new(
ctx.pointer,
(*C.uchar)(ptr),
C.uint64_t(len(data)),
C._Bool(wasi),
)
if plugin < 0 {
return Plugin{id: -1}, errors.New("Unable to load plugin")
err := C.extism_error(ctx.pointer, C.int32_t(-1))
msg := "Unknown"
if err != nil {
msg = C.GoString(err)
}
return Plugin{id: -1}, errors.New(
fmt.Sprintf("Unable to load plugin: %s", msg),
)
}
return Plugin{id: int32(plugin)}, nil
return Plugin{id: int32(plugin), ctx: ctx}, nil
}
func update(plugin int32, data []byte, wasi bool) bool {
func update(ctx *Context, plugin int32, data []byte, wasi bool) error {
ptr := makePointer(data)
return bool(C.extism_plugin_update(
b := bool(C.extism_plugin_update(
ctx.pointer,
C.int32_t(plugin),
(*C.uchar)(ptr),
C.uint64_t(len(data)),
C._Bool(wasi),
))
if b {
return nil
}
err := C.extism_error(ctx.pointer, C.int32_t(-1))
msg := "Unknown"
if err != nil {
msg = C.GoString(err)
}
return errors.New(
fmt.Sprintf("Unable to load plugin: %s", msg),
)
}
func LoadManifest(manifest Manifest, wasi bool) (Plugin, error) {
// PluginFromManifest creates a plugin from a `Manifest`
func (ctx *Context) PluginFromManifest(manifest Manifest, wasi bool) (Plugin, error) {
data, err := json.Marshal(manifest)
if err != nil {
return Plugin{id: -1}, err
}
return register(data, wasi)
return register(ctx, data, wasi)
}
func LoadPlugin(module io.Reader, wasi bool) (Plugin, error) {
// Plugin creates a plugin from a WASM module
func (ctx *Context) Plugin(module io.Reader, wasi bool) (Plugin, error) {
wasm, err := io.ReadAll(module)
if err != nil {
return Plugin{id: -1}, err
}
return register(wasm, wasi)
return register(ctx, wasm, wasi)
}
func (p *Plugin) Update(module io.Reader, wasi bool) (bool, error) {
// Update a plugin with a new WASM module
func (p *Plugin) Update(module io.Reader, wasi bool) error {
wasm, err := io.ReadAll(module)
if err != nil {
return false, err
return err
}
return update(p.id, wasm, wasi), nil
return update(p.ctx, p.id, wasm, wasi)
}
func (p *Plugin) UpdateManifest(manifest Manifest, wasi bool) (bool, error) {
// Update a plugin with a new Manifest
func (p *Plugin) UpdateManifest(manifest Manifest, wasi bool) error {
data, err := json.Marshal(manifest)
if err != nil {
return false, err
return err
}
return update(p.id, data, wasi), nil
return update(p.ctx, p.id, data, wasi)
}
// Set configuration values
func (plugin Plugin) SetConfig(data map[string][]byte) error {
s, err := json.Marshal(data)
if err != nil {
return err
}
ptr := makePointer(s)
C.extism_plugin_config(C.int(plugin.id), (*C.uchar)(ptr), C.uint64_t(len(s)))
C.extism_plugin_config(plugin.ctx.pointer, C.int(plugin.id), (*C.uchar)(ptr), C.uint64_t(len(s)))
return nil
}
// FunctionExists returns true when the named function is present in the plugin
func (plugin Plugin) FunctionExists(functionName string) bool {
name := C.CString(functionName)
b := C.extism_plugin_function_exists(plugin.ctx.pointer, C.int(plugin.id), name)
C.free(unsafe.Pointer(name))
return bool(b)
}
// Call a function by name with the given input, returning the output
func (plugin Plugin) Call(functionName string, input []byte) ([]byte, error) {
ptr := makePointer(input)
name := C.CString(functionName)
rc := C.extism_call(
rc := C.extism_plugin_call(
plugin.ctx.pointer,
C.int32_t(plugin.id),
name,
(*C.uchar)(ptr),
@@ -148,7 +218,7 @@ func (plugin Plugin) Call(functionName string, input []byte) ([]byte, error) {
C.free(unsafe.Pointer(name))
if rc != 0 {
err := C.extism_error(C.int32_t(plugin.id))
err := C.extism_error(plugin.ctx.pointer, C.int32_t(plugin.id))
msg := "<unset by plugin>"
if err != nil {
msg = C.GoString(err)
@@ -159,14 +229,27 @@ func (plugin Plugin) Call(functionName string, input []byte) ([]byte, error) {
)
}
length := C.extism_output_length(C.int32_t(plugin.id))
length := C.extism_plugin_output_length(plugin.ctx.pointer, C.int32_t(plugin.id))
if length > 0 {
x := C.extism_output_get(C.int32_t(plugin.id))
x := C.extism_plugin_output_data(plugin.ctx.pointer, C.int32_t(plugin.id))
y := (*[]byte)(unsafe.Pointer(&x))
return []byte((*y)[0:length]), nil
}
return []byte{}, nil
}
// Free a plugin
func (plugin *Plugin) Free() {
if plugin.ctx.pointer == nil {
return
}
C.extism_plugin_free(plugin.ctx.pointer, C.int32_t(plugin.id))
plugin.id = -1
}
// Reset removes all registered plugins in a Context
func (ctx Context) Reset() {
C.extism_context_reset(ctx.pointer)
}

View File

@@ -4,18 +4,20 @@ synopsis: "Extism bindings"
description: "Bindings to Extism, the universal plugin system"
maintainer: ["Extism Authors <oss@extism.org>"]
authors: ["Extism Authors <oss@extism.org>"]
license: "BSD-3"
license: "BSD-3-Clause"
tags: ["topics" "wasm" "plugin"]
homepage: "https://github.com/extism/extism"
doc: "https://github.com/extism/extism"
bug-reports: "https://github.com/extism/extism/issues"
depends: [
"ocaml"
"dune" {>= "3.2"}
"ctypes-foreign"
"bigstringaf"
"ppx_yojson_conv"
"base64"
"ocaml" {>= "4.14.1"}
"dune" {>= "3.2" & >= "3.2"}
"ctypes-foreign" {>= "0.18.0"}
"bigstringaf" {>= "0.9.0"}
"ppx_yojson_conv" {>= "0.15.0"}
"extism-manifest"
"ppx_inline_test" {>= "0.15.0"}
"cmdliner" {>= "1.1.1"}
"odoc" {with-doc}
]
build: [

148
extism_test.go Normal file
View File

@@ -0,0 +1,148 @@
package extism
import (
"encoding/json"
"fmt"
"testing"
)
func manifest() Manifest {
return Manifest{
Wasm: []Wasm{
WasmFile{
Path: "./wasm/code.wasm",
},
},
}
}
func expectVowelCount(plugin Plugin, input string, count int) error {
out, err := plugin.Call("count_vowels", []byte(input))
if err != nil {
return err
}
var result map[string]int
json.Unmarshal(out, &result)
if result["count"] != count {
return fmt.Errorf("Got count %d but expected %d", result["count"], count)
}
return nil
}
func TestCreateAndFreeContext(t *testing.T) {
ctx := NewContext()
ctx.Free()
}
func TestCallPlugin(t *testing.T) {
ctx := NewContext()
defer ctx.Free()
plugin, err := ctx.PluginFromManifest(manifest(), false)
if err != nil {
t.Error(err)
}
if err := expectVowelCount(plugin, "this is a test", 4); err != nil {
t.Error(err)
}
if err := expectVowelCount(plugin, "this is a test again", 7); err != nil {
t.Error(err)
}
if err := expectVowelCount(plugin, "this is a test thrice", 6); err != nil {
t.Error(err)
}
}
func TestFreePlugin(t *testing.T) {
ctx := NewContext()
defer ctx.Free()
plugin, err := ctx.PluginFromManifest(manifest(), false)
if err != nil {
t.Error(err)
}
if err := expectVowelCount(plugin, "this is a test", 4); err != nil {
t.Error(err)
}
// free this specific plugin
plugin.Free()
if err := expectVowelCount(plugin, "this is a test", 4); err == nil {
t.Fatal("Expected an error after plugin was freed")
}
}
func TestContextReset(t *testing.T) {
ctx := NewContext()
defer ctx.Free()
plugin, err := ctx.PluginFromManifest(manifest(), false)
if err != nil {
t.Error(err)
}
if err := expectVowelCount(plugin, "this is a test", 4); err != nil {
t.Error(err)
}
// reset the context dropping all plugins
ctx.Reset()
if err := expectVowelCount(plugin, "this is a test", 4); err == nil {
t.Fatal("Expected an error after plugin was freed")
}
}
func TestCanUpdateAManifest(t *testing.T) {
ctx := NewContext()
defer ctx.Free()
plugin, err := ctx.PluginFromManifest(manifest(), false)
if err != nil {
t.Error(err)
}
if err := expectVowelCount(plugin, "this is a test", 4); err != nil {
t.Error(err)
}
plugin.UpdateManifest(manifest(), false)
// can still call the plugin
if err := expectVowelCount(plugin, "this is a test", 4); err != nil {
t.Error(err)
}
}
func TestFunctionExists(t *testing.T) {
ctx := NewContext()
defer ctx.Free()
plugin, err := ctx.PluginFromManifest(manifest(), false)
if err != nil {
t.Error(err)
}
if !plugin.FunctionExists("count_vowels") {
t.Fatal("Was expecting to find the function count_vowels")
}
if plugin.FunctionExists("i_dont_exist") {
t.Fatal("Was not expecting to find the function i_dont_exist")
}
}
func TestErrorsOnUnknownFunction(t *testing.T) {
ctx := NewContext()
defer ctx.Free()
plugin, err := ctx.PluginFromManifest(manifest(), false)
if err != nil {
t.Error(err)
}
_, err = plugin.Call("i_dont_exist", []byte("someinput"))
if err == nil {
t.Fatal("Was expecting call to unknown function to fail")
}
}

View File

@@ -9,6 +9,12 @@ import (
)
func main() {
version := extism.ExtismVersion()
fmt.Println("Extism Version: ", version)
ctx := extism.NewContext()
defer ctx.Free() // this will free the context and all associated plugins
// set some input data to provide to the plugin module
var data []byte
if len(os.Args) > 1 {
@@ -18,7 +24,7 @@ func main() {
}
manifest := extism.Manifest{Wasm: []extism.Wasm{extism.WasmFile{Path: "../wasm/code.wasm"}}}
plugin, err := extism.LoadManifest(manifest, false)
plugin, err := ctx.PluginFromManifest(manifest, false)
if err != nil {
fmt.Println(err)
os.Exit(1)

View File

@@ -1,17 +1,16 @@
module Main where
import System.Exit (exitFailure, exitSuccess)
import qualified Data.ByteString as B
import Extism
import Extism.Manifest
import Extism.Manifest(manifest, wasmFile)
unwrap (Right x) = x
unwrap (Left (ExtismError msg)) = do
error msg
main = do
plugin <- Extism.registerManifest (manifest [wasmFile "../wasm/code.wasm"]) False
res <- Extism.call plugin "count_vowels" (Extism.toByteString "this is a test")
case res of
Right (Error msg) -> do
_ <- putStrLn msg
exitFailure
Left bs -> do
_ <- putStrLn (Extism.fromByteString bs)
exitSuccess
let m = manifest [wasmFile "../wasm/code.wasm"]
context <- Extism.newContext
plugin <- unwrap <$> Extism.pluginFromManifest context m False
res <- unwrap <$> Extism.call plugin "count_vowels" (Extism.toByteString "this is a test")
putStrLn (Extism.fromByteString res)
Extism.free plugin

30
haskell/Makefile Normal file
View File

@@ -0,0 +1,30 @@
.PHONY: test
prepare:
cabal update
build: prepare
cabal build
test: prepare
cabal test
clean:
cabal clean
publish: clean prepare
cabal sdist
# TODO: upload
format:
# TODO
lint:
cabal check
hlint src manifest
docs:
# TODO
show-docs: docs
# TODO

1
haskell/cabal.project Normal file
View File

@@ -0,0 +1 @@
packages: extism.cabal manifest/extism-manifest.cabal

View File

@@ -1,47 +1,45 @@
cabal-version: 2.4
cabal-version: 3.0
name: extism
version: 0.0.1.0
-- A short (one-line) description of the package.
synopsis: Extism bindings
-- A longer description of the package.
description: Bindings to Extism, the universal plugin system
-- A URL where users can report bugs.
bug-reports: https://github.com/extism/extism
-- The license under which the package is released.
license: BSD-3-Clause
author: Extism authors
version: 0.0.1
license: BSD-3-Clause
maintainer: oss@extism.org
-- A copyright notice.
-- copyright:
category: Plugins
author: Extism authors
bug-reports: https://github.com/extism/extism
synopsis: Extism bindings
description: Bindings to Extism, the universal plugin system
category: Plugins, WebAssembly
extra-source-files: CHANGELOG.md
library
exposed-modules: Extism Extism.Manifest
exposed-modules: Extism
reexported-modules: Extism.Manifest
hs-source-dirs: src
other-modules: Extism.Bindings
default-language: Haskell2010
extra-libraries: extism
extra-lib-dirs: /usr/local/lib
build-depends:
base >= 4.16.1 && < 4.18.0,
bytestring >= 0.11.3 && < 0.12,
json >= 0.10 && < 0.11,
extism-manifest >= 0.0.0 && < 0.1.0
-- Modules included in this library but not exported.
other-modules:
test-suite extism-example
type: exitcode-stdio-1.0
main-is: Example.hs
default-language: Haskell2010
build-depends:
base,
extism,
bytestring
-- LANGUAGE extensions used by modules in this package.
-- other-extensions:
build-depends:
base ^>=4.16.1.0
, bytestring
, base64-bytestring
, json
hs-source-dirs: src
default-language: Haskell2010
extra-libraries: extism
extra-lib-dirs: /usr/local/lib
Test-Suite extism-example
type: exitcode-stdio-1.0
main-is: Example.hs
build-depends: base, extism, bytestring
test-suite extism-test
type: exitcode-stdio-1.0
main-is: Test.hs
hs-source-dirs: test
default-language: Haskell2010
build-depends:
base,
extism,
bytestring,
HUnit

Some files were not shown because too many files have changed in this diff Show More