{"id":13485150,"url":"https://github.com/manyuanrong/deno-plugin-prepare","last_synced_at":"2025-04-30T11:14:42.494Z","repository":{"id":61593619,"uuid":"244125244","full_name":"manyuanrong/deno-plugin-prepare","owner":"manyuanrong","description":"A library for managing deno native plugin dependencies","archived":false,"fork":false,"pushed_at":"2020-10-13T05:35:33.000Z","size":6869,"stargazers_count":47,"open_issues_count":0,"forks_count":11,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-19T01:31:39.765Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/manyuanrong.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":null,"security":null,"support":null}},"created_at":"2020-03-01T10:01:48.000Z","updated_at":"2023-10-05T17:18:37.000Z","dependencies_parsed_at":"2022-10-19T15:30:39.604Z","dependency_job_id":null,"html_url":"https://github.com/manyuanrong/deno-plugin-prepare","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manyuanrong%2Fdeno-plugin-prepare","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manyuanrong%2Fdeno-plugin-prepare/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manyuanrong%2Fdeno-plugin-prepare/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manyuanrong%2Fdeno-plugin-prepare/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/manyuanrong","download_url":"https://codeload.github.com/manyuanrong/deno-plugin-prepare/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251687336,"owners_count":21627566,"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-07-31T17:01:48.017Z","updated_at":"2025-04-30T11:14:42.463Z","avatar_url":"https://github.com/manyuanrong.png","language":"TypeScript","funding_links":[],"categories":["TypeScript","基础设施","Modules","Uncategorized"],"sub_categories":["JAM Stack/静态站点","Online Playgrounds","Utils","Uncategorized","Assistants"],"readme":"# deno-plugin-prepare\n\nA library for managing deno native plugin dependencies\n\n[![tag](https://img.shields.io/github/tag/manyuanrong/deno-plugin-prepare.svg)](https://github.com/manyuanrong/deno-plugin-prepare)\n[![Build Status](https://github.com/manyuanrong/deno-plugin-prepare/workflows/ci/badge.svg?branch=master)](https://github.com/manyuanrong/deno-plugin-prepare/actions)\n[![license](https://img.shields.io/github/license/manyuanrong/deno-plugin-prepare.svg)](https://github.com/manyuanrong/deno-plugin-prepare)\n[![tag](https://img.shields.io/badge/deno-v1.4.0-green.svg)](https://github.com/denoland/deno)\n\n### Why do you need this module?\n\nBecause Deno's plugin is not a first-class citizen, it cannot be loaded directly using `import` like `js`, `ts`, and `json`.\n\nDeno's plugin is compiled with other system-level languages, and cannot be compiled into one target result across multiple platforms, usually compiled into multiple platform target binaries. These binary files are usually much larger than scripts such as `js/ts`, so they should not be downloaded all, need to be dynamically loaded according to the platform.\n\n### API\n\n#### prepare\n\nThe API needs to provide some plug-in information, including the name of the plugin, and the remote url of the binary file for different platforms. It is similar to an asynchronous version of `Deno.openPlugin`, which will automatically download the corresponding binary file according to the platform and cache it in the `.deno_plugins` directory of the current working directory.\n\n### Usage\n\n```ts\nimport {\n  prepare,\n  PrepareOptions,\n} from \"https://deno.land/x/plugin_prepare@v0.8.0/mod.ts\";\n\nconst releaseUrl =\n  \"https://github.com/manyuanrong/deno-plugin-prepare/releases/download/plugin_bins\";\n\nconst pluginOptions: PrepareOptions = {\n  name: \"test_plugin\",\n\n  // Whether to output log. Optional, default is true\n  // printLog: true,\n\n  // Whether to use locally cached files. Optional, default is true\n  // checkCache: true,\n\n  // Support \"http://\", \"https://\", \"file://\"\n  urls: {\n    darwin: `${releaseUrl}/libtest_plugin.dylib`,\n    windows: `${releaseUrl}/test_plugin.dll`,\n    linux: `${releaseUrl}/libtest_plugin.so`,\n  },\n};\nconst rid = await prepare(pluginOptions);\n//@ts-ignore\nconst { testSync } = Deno.core.ops();\n//@ts-ignore\nconst response = Deno.core.dispatch(\n  testSync,\n  new Uint8Array([116, 101, 115, 116])\n)!;\n\nconsole.log(response);\nDeno.close(rid);\n```\n\n### Custom cache path\n\nBy default, binary files will be cached in the `.deno_plugins` directory. In some cases, we need to store in other locations, you can set the `DENO_PLUGIN_DIR` environment variable\n\n### TODOs\n\n- [x] Caching binary files with URL hash (multi-version coexistence)\n- [ ] Supports downloading and decompressing .GZ files\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmanyuanrong%2Fdeno-plugin-prepare","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmanyuanrong%2Fdeno-plugin-prepare","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmanyuanrong%2Fdeno-plugin-prepare/lists"}