{"id":13774234,"url":"https://github.com/extism/assemblyscript-pdk","last_synced_at":"2025-04-08T07:32:20.527Z","repository":{"id":59013166,"uuid":"530444183","full_name":"extism/assemblyscript-pdk","owner":"extism","description":"Extism Plug-in Development Kit (PDK) for AssemblyScript","archived":false,"fork":false,"pushed_at":"2024-10-22T19:31:17.000Z","size":40,"stargazers_count":11,"open_issues_count":2,"forks_count":3,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-18T14:19:48.423Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/extism.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-08-30T00:44:15.000Z","updated_at":"2025-02-13T02:57:30.000Z","dependencies_parsed_at":"2024-01-15T02:30:13.233Z","dependency_job_id":"0839354c-474a-4ad1-bdd6-1555347ddf86","html_url":"https://github.com/extism/assemblyscript-pdk","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/extism%2Fassemblyscript-pdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/extism%2Fassemblyscript-pdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/extism%2Fassemblyscript-pdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/extism%2Fassemblyscript-pdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/extism","download_url":"https://codeload.github.com/extism/assemblyscript-pdk/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247796291,"owners_count":20997545,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-03T17:01:24.875Z","updated_at":"2025-04-08T07:32:20.262Z","avatar_url":"https://github.com/extism.png","language":"TypeScript","funding_links":[],"categories":["\u003ca name=\"extism\"\u003e\u003c/a\u003e[Extism](https://github.com/extism/extism) \u003csup\u003e[top⇈](#contents)\u003c/sup\u003e"],"sub_categories":[],"readme":"# Extism AssemblyScript PDK\n\n### Installation\n\n```sh\nnpm install @extism/as-pdk@1.0.0 --save\n```\n\n### Compiling to WebAssembly\n\nUse the AssemblyScript compiler, `asc`:\n\n```sh\nnpx asc example.ts --outFile example.wasm --use abort=example/myAbort\n```\n\n### Example Usage\n\n```typescript title=example.ts\nimport { Host, Var, Config } from '@extism/as-pdk';\n\nfunction myAbort(\n  message: string | null,\n  fileName: string | null,\n  lineNumber: u32,\n  columnNumber: u32\n): void { }\n\n\nexport function count_vowels(): i32 {\n  let str = Host.inputString();\n  var count = 0;\n  for (var i = 0; i \u003c str.length; i++) {\n    let x: string = str[i];\n    if (x == 'a' || x == 'A' ||\n      x == 'e' || x == 'E' ||\n      x == 'i' || x == 'I' ||\n      x == 'o' || x == 'O' ||\n      x == 'u' || x == 'U') {\n      count += 1;\n    }\n  }\n\n  // Additional plug-in APIs:\n\n  // persistent variables (scoped to individual plugin)\n  var a = Uint8Array.wrap(String.UTF8.encode(\"this is var a\"))\n  Var.set('a', a);\n\n  let data = Var.get('a');\n  let var_a = (data == null) ? \"null\" : String.UTF8.decode(data.buffer);\n\n  // config, provided by the host\n  const thing = Config.get(\"thing\");\n\n  // write data back to host for use in program\n  var out = '{\"count\": ' + count.toString() + ', \"config\": \"' + (thing == null ? \"null\" : thing) + '\", \"a\": \"' + var_a + '\"}';\n  Host.outputString(out);\n  Var.remove('a');\n\n  return 0;\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fextism%2Fassemblyscript-pdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fextism%2Fassemblyscript-pdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fextism%2Fassemblyscript-pdk/lists"}