{"id":18523164,"url":"https://github.com/nrkn/goonpack","last_synced_at":"2025-07-04T17:02:35.115Z","repository":{"id":57252456,"uuid":"180480192","full_name":"nrkn/goonpack","owner":"nrkn","description":"A module bundler, like webpack or browserify, except extremely basic","archived":false,"fork":false,"pushed_at":"2019-04-11T03:17:13.000Z","size":22,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-03T20:08:36.410Z","etag":null,"topics":["bundle","bundler","javascript-modules","module","module-bundler","modules"],"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/nrkn.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":"2019-04-10T01:49:24.000Z","updated_at":"2019-04-11T03:17:15.000Z","dependencies_parsed_at":"2022-08-31T22:11:03.889Z","dependency_job_id":null,"html_url":"https://github.com/nrkn/goonpack","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/nrkn/goonpack","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nrkn%2Fgoonpack","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nrkn%2Fgoonpack/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nrkn%2Fgoonpack/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nrkn%2Fgoonpack/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nrkn","download_url":"https://codeload.github.com/nrkn/goonpack/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nrkn%2Fgoonpack/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260535390,"owners_count":23024147,"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":["bundle","bundler","javascript-modules","module","module-bundler","modules"],"created_at":"2024-11-06T17:34:27.900Z","updated_at":"2025-07-04T17:02:35.087Z","avatar_url":"https://github.com/nrkn.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# goonpack\n\nA module bundler, like [webpack](https://webpack.js.org/) or\n[browserify](http://browserify.org/), except *extremely* basic\n\n## install\n\n`npm install goonpack`\n\n## features\n\n- ✔️ basic af\n- ✔️ produces readable output\n- ✔️ TypeScript types\n- ✔️ 100% test coverage\n- ✔️ not horribly slow\n- ❌ single entry point\n- ❌ only supports ES modules\n- ❌ only supports very simple imports and exports\n- ❌ JSON imports? Nope.\n- ❌ no filesystem support, do that yourself\n- ❌ source maps? Ahahaha, no.\n\n## why would I use this, who is it for?\n\nNo sane or reasonable person, you should really use webpack or browserify or\nwhatever.\n\nThat aside, sometimes, not often, but sometimes I have a very simple little app\nwith no external dependencies, and I want to bundle it into a single file for\nthe browser or whatever. The output from webpack et al is pretty ugly, and I\nthought it would be fun to write something that produced a fairly clean and\nreadable output file.\n\nI'm lazy, so I limited the scope very heavily to make it easy to implement.\n\n## usage\n\n```js\nconst { pack } = require( 'goonpack' )\n// or import { pack } from 'goonpack'\n\n/*\n  yep, no filesystem support, if your modules are on disk, read them into a\n  structure like this\n*/\nconst map = {\n  \"index.js\": \"import { foo } from './foo'\\nconsole.log( foo )\",\n  \"foo/index.js\": \"export const foo = 'foo'\"\n}\n\n// just a string with the bundle source\nconst source = pack( map )\n```\n\nYou can also pass\n[escodegen options](https://github.com/estools/escodegen/wiki/API) to `pack` as\nthe second argument:\n\n```js\nconst source = pack( map, {\n  format: {\n    indent: '  '\n  },\n  semicolons: false\n})\n```\n\nThis will produce an output script something like this:\n\n```js\n// foo/index.js\nconst __foo_index = (()=\u003e{\n  const foo = 'foo'\n\n  return { foo }\n})()\n\n// index.js\nconst { foo } = __foo_index\nconsole.log( foo )\n```\n\n## is there an easy way to turn a folder into the map expected by pack?\n\n`npm install @mojule/files`\n\n```js\nconst { readPathBufferMap } = require( '@mojule/files' )\n\nconst readFolder = async ( path ) =\u003e {\n  const bufferMap = await readPathBufferMap( path )\n\n  const map = {}\n\n  Object.keys( bufferMap ).forEach( path =\u003e {\n    if ( !path.endsWith( '.js' ) ) return\n\n    map[ path ] = bufferMap[ path ].toString( 'utf8' )\n  } )\n\n  return map\n}\n```\n\n## support\n\n### exports\n\n- ✔️ `export { name1, name2, …, nameN };`\n- ❌ `export { variable1 as name1, variable2 as name2, …, nameN };`\n- ️✔️️️ `export let name1, name2, …, nameN; // also var, const`\n- ✔️ `export let name1 = …, name2 = …, …, nameN; // also var, const`\n- ✔️ ️`export function FunctionName(){...}`\n- ✔️ `export class ClassName {...}`\n- ❌ `export default expression;`\n- ❌ `export default function (…) { … } // also class, function*`\n- ❌ `export default function name1(…) { … } // also class, function*`\n- ❌ `export { name1 as default, … };`\n- ❌ `export * from …;`\n- ❌ `export { name1, name2, …, nameN } from …;`\n- ❌ `export { import1 as name1, import2 as name2, …, nameN } from …;`\n- ❌ `export { default } from …;`\n\n### imports\n\n- ❌ `import defaultExport from \"path\";`\n- ❌ `import * as name from \"path\";`\n- ️️️✔️ `import { export } from \"path\";`\n- ❌ `import { export as alias } from \"path\";`\n- ✔️ `import { export1 , export2 } from \"path\";`\n- ❌ `import { export1 , export2 as alias2 , [...] } from \"path\";`\n- ❌ `import defaultExport, { export [ , [...] ] } from \"path\";`\n- ❌ `import defaultExport, * as name from \"path\";`\n- ❌ `import \"path\";`\n\n## license\n\nMIT License\n\nCopyright (c) 2018 Nik Coughlin\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnrkn%2Fgoonpack","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnrkn%2Fgoonpack","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnrkn%2Fgoonpack/lists"}