{"id":25426795,"url":"https://github.com/oazmi/esbuild-plugin-deno","last_synced_at":"2025-10-31T16:30:26.681Z","repository":{"id":274123169,"uuid":"918849946","full_name":"oazmi/esbuild-plugin-deno","owner":"oazmi","description":"[BETA] a portable and non-invasive clone of the official deno plugin for esbuild","archived":false,"fork":false,"pushed_at":"2025-02-16T02:14:01.000Z","size":13016,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-16T02:18:53.203Z","etag":null,"topics":["build-tool","bundler","deno","esbuild","esbuild-plugin","jsr","typescript"],"latest_commit_sha":null,"homepage":"https://oazmi.github.io/esbuild-plugin-deno/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/oazmi.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license.md","code_of_conduct":".github/code_of_conduct.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-01-19T02:47:02.000Z","updated_at":"2025-02-16T02:13:10.000Z","dependencies_parsed_at":"2025-01-25T03:34:22.147Z","dependency_job_id":null,"html_url":"https://github.com/oazmi/esbuild-plugin-deno","commit_stats":null,"previous_names":["oazmi/esbuild-plugin-deno"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oazmi%2Fesbuild-plugin-deno","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oazmi%2Fesbuild-plugin-deno/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oazmi%2Fesbuild-plugin-deno/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oazmi%2Fesbuild-plugin-deno/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oazmi","download_url":"https://codeload.github.com/oazmi/esbuild-plugin-deno/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239214047,"owners_count":19601077,"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":["build-tool","bundler","deno","esbuild","esbuild-plugin","jsr","typescript"],"created_at":"2025-02-17T00:22:10.014Z","updated_at":"2025-10-31T16:30:26.635Z","avatar_url":"https://github.com/oazmi.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @oazmi/esbuild-plugin-deno\n\nA suite of multi-purpose esbuild plugins for bundling libraries and web-apps with Deno or Node.\nIt is designed to be non-intrusive, so that it works seamlessly alongside esbuild's native resolver/loader and other plugins.\n\nMoreover, the plugins in this library do not rely on any javascript-runtime specific feature apart from `Deno.cwd()` (to query the current working directory).\nThis permits it portablility across any runtime environment (web, deno, node, bun, (cloudflare workers?)).\n\n## Upsides\n\n- Allows native esbuild resolvers and loaders to take over whenever possible.\n  This means that you can bundle css files and whatnot, even if deno itself cannot make sense of such imports.\n- Plays nicely with other plugins, by not snatching resource resolution and forcing it down a single namespace.\n  The way it works is what it \"unresolves\" its internal namespaces, and queries other plugins (and esbuild's native resolver) to try and resolve the path first, before trying to do so itself.\n- Uses web-compatible APIs only (with the exception of `Deno.cwd()`).\n\n## Downsides\n\n- Since this library does not utilize Deno's cache, nor does it take advantage of its semantic-versioning resolver (to figure out the best package version), bundling will probably likely take longer, and not speed up across successive builds.\n  (maybe I'll add a file caching mechanism in the future, but that'll require filesystem write access, which isn't practical for web-portability)\n- `npm:` specifier dependencies within a deno package are not supported right now, but will be in the future. (again, it comes down to filesystem write access, since [npmjs.org](http://registry.npmjs.org/) only distributes tarballs, instead of individual files, like the way [jsr.io](https://jsr.io/) does)\n\n## Plugins featured\n\n- {@link \"mod\"!importMapPlugin}: provides import-map alias path-resolving for entry-points and esbuild's native resolvers (i.e. when in the default namespace).\n- {@link \"mod\"!httpPlugin}: provides `http://` and `https://` path-resolving and resource-fetching loader.\n- {@link \"mod\"!jsrPlugin}: provides a `jsr:` specifier to `https://jsr.io/` path-resolver.\n- {@link \"mod\"!denoPlugins}: cumulation of the three plugins above, so that you can bundle code that deno natively understands.\n- (support for `npm:` specifiers within a deno package will be added in the future).\n\n## Documentation\n\n- see [https://oazmi.github.io/esbuild-plugin-deno](https://oazmi.github.io/esbuild-plugin-deno/) for documentation.\n\n## Installation\n\n- for deno: `deno add jsr:@oazmi/esbuild-plugin-deno`\n- for node: `npm install @oazmi/esbuild-plugin-deno --save-dev`\n\n## Example\n\nentry point 1:\n\n```ts\n// file: \"./file_uri_entry.ts\"\n\nimport { meshGrid } from \"2d-array-utils\" // this will be resolved by our `http_plugin`'s `globalImportMap` setting\nimport { transpose2D } from \"https://jsr.io/@oazmi/kitchensink/0.9.2/src/numericarray.ts\"\nimport \"https://raw.githubusercontent.com/jenil/chota/7d780731421fc987d8f7a1c8f66c730d8573684c/src/chota.css\"\nimport * as http from \"node:http\"\nimport * as https from \"node:https\"\nconsole.log(\"hello world\", transpose2D([[1], [2], [3]]))\nconsole.log(http.Agent)\nconsole.log(meshGrid([1, 2, 3], [0, -1, -2, -3, -4]))\nexport { http, https }\n```\n\nentry point 2:\n\n```ts\n// file: \"./local_path_entry.ts\"\n\nimport { meshGrid } from \"2d-array-utils\" // this will be resolved by our `importmap_plugin`'s `importMap` setting\nimport { transpose2D } from \"https://jsr.io/@oazmi/kitchensink/0.9.2/src/numericarray.ts\"\nimport { cumulativeSum } from \"jsr:@oazmi/kitchensink@~0.9.2/numericarray\"\nimport \"https://raw.githubusercontent.com/jenil/chota/7d780731421fc987d8f7a1c8f66c730d8573684c/src/chota.css\"\nimport * as http from \"node:http\"\nimport * as https from \"node:https\"\nconsole.log(\"skibidi gen-z rizzing toilet seat\", transpose2D([[1], [2], [3]]))\nconsole.log(http.Agent)\nconsole.log(meshGrid([1, 2, 3], [0, -1, -2, -3, -4]), cumulativeSum([1, 2, 3, 4]))\nexport { http, https }\n```\n\nentry points 3 to 7:\n\n```ts\n// jsr-file version range:  \"jsr:@oazmi/kitchensink@^0.9.2/array1d\"\n// fake-http-alias:         \"https://2d-lib\"\n// importmap-alias:         \"2d-array-utils\"\n// jsr-file latest version: \"jsr:@oazmi/kitchensink/struct\"\n// http-file:               \"https://raw.githubusercontent.com/jenil/chota/7d780731421fc987d8f7a1c8f66c730d8573684c/src/chota.css\"\n```\n\nyour bundle script:\n\n```ts\n// file: \"./bundle_script.ts\"\n\nimport esbuild from \"esbuild\"\nimport { denoPlugins } from \"@oazmi/esbuild-plugin-deno\"\n\nconst entry_points = [\n\t\"./local_path_entry.ts\", // this will be resolved and loaded by esbuild natively (although it will initially pass though the `importmap_plugin` resolver)\n\t\"file://\" + import.meta.dirname + \"/file_uri_entry.ts\", // this will be resolved and loaded by the `http_plugin`\n\t\"jsr:@oazmi/kitchensink@^0.9.2/array1d\", // this will be resolved by our `jsr_plugin`, and loaded by the `http_plugin`\n\t\"https://2d-lib\", // this will bundle via our `globalImportMap` setting inside of the `http_plugin`\n\t\"2d-array-utils\", // this will bundle via our `importMap` setting inside of our `importmap_plugin`\n\t\"jsr:@oazmi/kitchensink/struct\", // this will be resolved to the latest version of the package by our `jsr_plugin`\n\t\"https://raw.githubusercontent.com/jenil/chota/7d780731421fc987d8f7a1c8f66c730d8573684c/src/chota.css\", // `http_plugin` resolution and loading\n].map((path) =\u003e ({\n\tin: path,\n\tout: \"entry-\" + path.split(\"/\").at(-1)!.replace(/\\..*$/, \"\"),\n}))\n\nconst [importmap_plugin, http_plugin, jsr_plugin] = denoPlugins({\n\timportMap: {\n\t\t// notice that the different aliases point to the same resource.\n\t\t// however, in bundled code-splitting enabled output, there will be no duplication of this resource.\n\t\t\"2d-array-utils\": \"https://jsr.io/@oazmi/kitchensink/0.9.2/src/array2d.ts\",\n\t\t\"https://2d-lib\": \"https://jsr.io/@oazmi/kitchensink/0.9.2/src/array2d.ts\",\n\t},\n})\n\nconst result = await esbuild.build({\n\tabsWorkingDir: import.meta.dirname,\n\tentryPoints: entry_points,\n\toutdir: \"./dist/\",\n\tformat: \"esm\",\n\tplatform: \"node\", // needed due to dependency on \"node:http\" in two of the entry point files\n\tsplitting: true,\n\tbundle: true,\n\tminifySyntax: true,\n\ttreeShaking: true,\n\twrite: false,\n\tmetafile: true,\n\tplugins: [importmap_plugin, http_plugin, jsr_plugin],\n})\n\nconsole.log(\"bundled file list:\")\nconsole.log(result.outputFiles.map((v) =\u003e (v.path)))\nawait esbuild.stop()\n```\n\nexpected resulting bundled list of files:\n\n```txt\nbundled file list:\n[\n\t\"./dist/entry-local_path_entry.js\",\n\t\"./dist/entry-file_uri_entry.js\",\n\t\"./dist/chunk-VVE7K4TT.js\",\n\t\"./dist/entry-array1d.js\",\n\t\"./dist/entry-2d-lib.js\",\n\t\"./dist/entry-2d-array-utils.js\",\n\t\"./dist/chunk-33JDUUI4.js\",\n\t\"./dist/entry-struct.js\",\n\t\"./dist/chunk-NIK2SR5E.js\",\n\t\"./dist/chunk-EPXSTJPU.js\",\n\t\"./dist/entry-local_path_entry.css\",\n\t\"./dist/entry-file_uri_entry.css\",\n\t\"./dist/entry-chota.css\"\n]\n```\n\n## What is Deno?\n\n\u003cdiv style=\"max-width: min(100%, 384px);\"\u003e\n\n![deno2](./assets/deno2.svg)\n_**Figure A**: A historic sighting of Deno the Dino deprecating its former version._\n_Some believe Dino to be the [Lochness monster](https://en.wikipedia.org/wiki/Loch_Ness_Monster)._\n_Others think it is an alphabetically sorted occurrence of Node._\n\n\u003c/div\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foazmi%2Fesbuild-plugin-deno","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foazmi%2Fesbuild-plugin-deno","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foazmi%2Fesbuild-plugin-deno/lists"}