{"_id":"@carbontian/esbuild-wasm-compiler","_rev":"7-177c501e0bedba656ac66b85e6b61269","name":"@carbontian/esbuild-wasm-compiler","dist-tags":{"latest":"0.0.5"},"versions":{"0.0.1":{"name":"@carbontian/esbuild-wasm-compiler","version":"0.0.1","private":false,"description":"File Resolution for Esbuild running in the Browser","keywords":["esbuild","wasm","resolve","file-system"],"authors":"fewismuch","license":"MIT","module":"dist/esm/index.js","types":"dist/esm/index.d.ts","repository":{"type":"git","url":"git+https://github.com/fewismuch/esbuild-wasm-compiler.git"},"scripts":{"dev":"father dev","build":"father build","build:deps":"father prebundle","prepublishOnly":"father doctor && npm run build"},"publishConfig":{"access":"public"},"devDependencies":{"father":"^4.1.7"},"dependencies":{"esbuild-wasm":"^0.20.0"},"gitHead":"aec3247f8b91d560f39895cbb83dd34eabcfdef7","bugs":{"url":"https://github.com/fewismuch/esbuild-wasm-compiler/issues"},"homepage":"https://github.com/fewismuch/esbuild-wasm-compiler#readme","_id":"@carbontian/esbuild-wasm-compiler@0.0.1","_nodeVersion":"18.15.0","_npmVersion":"9.5.0","dist":{"integrity":"sha512-lAL0lF+y4yPW33RKpzwqdW/GMBQSXEJZDUkDpQfIhGMT5v+yKiNYdaKminyQ3IAUekC7wpzWaq2IpTVLbAMcJA==","shasum":"674a76b4053478675b9e733a56e4fb9d6fae068a","tarball":"https://registry.npmjs.org/@carbontian/esbuild-wasm-compiler/-/esbuild-wasm-compiler-0.0.1.tgz","fileCount":15,"unpackedSize":158749,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDcadtTgeCpp+Spd4btHHiMFJ5ZVPJ9LtS65lKhv605hQIgFGl7rTmaOQVbZgic8sFRRcIUaRjhfzpdovvFwttzZLo="}]},"_npmUser":{"name":"fewismuch","email":"15921977515@163.com"},"directories":{},"maintainers":[{"name":"fewismuch","email":"15921977515@163.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/esbuild-wasm-compiler_0.0.1_1707535386153_0.584394324733204"},"_hasShrinkwrap":false,"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"0.0.2":{"name":"@carbontian/esbuild-wasm-compiler","version":"0.0.2","private":false,"description":"File Resolution for Esbuild running in the Browser","keywords":["esbuild","wasm","resolve","file-system"],"authors":"fewismuch","license":"MIT","module":"dist/esm/index.js","types":"dist/esm/index.d.ts","repository":{"type":"git","url":"git+https://github.com/fewismuch/esbuild-wasm-compiler.git"},"scripts":{"dev":"father dev","build":"father build","build:deps":"father prebundle","prepublishOnly":"father doctor && npm run build"},"publishConfig":{"access":"public"},"devDependencies":{"father":"^4.1.7"},"dependencies":{"esbuild-wasm":"^0.20.0"},"gitHead":"11669b957717a3ae826ebb168fececd9c4affedc","bugs":{"url":"https://github.com/fewismuch/esbuild-wasm-compiler/issues"},"homepage":"https://github.com/fewismuch/esbuild-wasm-compiler#readme","_id":"@carbontian/esbuild-wasm-compiler@0.0.2","_nodeVersion":"18.15.0","_npmVersion":"9.5.0","dist":{"integrity":"sha512-y1m9LwUdJtBnKBrFx8g0duHuHY1qzPfER1QhTGT7s0w+9QHZftp24nEUHw/xtsY9i6emYTqYvo2ttYF6z++D+g==","shasum":"0e2162f1542e4fc26d1b5d10b4b06714f516d03b","tarball":"https://registry.npmjs.org/@carbontian/esbuild-wasm-compiler/-/esbuild-wasm-compiler-0.0.2.tgz","fileCount":15,"unpackedSize":161331,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCfMtTS7Wz5ZMHr8KkudWBu6dGwlaNvVUbCZ9fpCjaVVwIgW47c8ziNoW7gMNUzaDXHJv3Pu64D43vQv5wbiTxBfiw="}]},"_npmUser":{"name":"fewismuch","email":"15921977515@163.com"},"directories":{},"maintainers":[{"name":"fewismuch","email":"15921977515@163.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/esbuild-wasm-compiler_0.0.2_1707538027055_0.7433570064769359"},"_hasShrinkwrap":false,"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"0.0.3":{"name":"@carbontian/esbuild-wasm-compiler","version":"0.0.3","private":false,"description":"File Resolution for Esbuild running in the Browser","keywords":["esbuild","wasm","resolve","file-system"],"authors":"fewismuch","license":"MIT","module":"dist/esm/index.js","types":"dist/esm/index.d.ts","unpkg":"dist/esbuild-wasm-compiler.min.js","repository":{"type":"git","url":"git+https://github.com/fewismuch/esbuild-wasm-compiler.git"},"scripts":{"dev":"father dev","build":"father build","build:deps":"father prebundle","prepublishOnly":"father doctor && npm run build"},"publishConfig":{"access":"public"},"devDependencies":{"father":"^4.1.7"},"dependencies":{"esbuild-wasm":"^0.20.0"},"gitHead":"42d5de351c31ab2a802c9ad103ca556d5c4289e7","bugs":{"url":"https://github.com/fewismuch/esbuild-wasm-compiler/issues"},"homepage":"https://github.com/fewismuch/esbuild-wasm-compiler#readme","_id":"@carbontian/esbuild-wasm-compiler@0.0.3","_nodeVersion":"18.15.0","_npmVersion":"9.5.0","dist":{"integrity":"sha512-3NT8TWaRyqhQY1zSYxUGiMBd0yr3gVX/7+FesFRVDmQbscYa6FmMcmSQGny8OInS4lbLH/611MPALKJbsaxAQA==","shasum":"76e7c5760c5d28abd036a83931f7646e27fa9c45","tarball":"https://registry.npmjs.org/@carbontian/esbuild-wasm-compiler/-/esbuild-wasm-compiler-0.0.3.tgz","fileCount":15,"unpackedSize":161379,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDbNAOQgbWuBi5QeLi6HapAZpRMmHIrTrGYYXb+FB0FuwIhALNKM9VV3VDjp11849kr6wKn8AQw1Ag7rKO1wbAVwpg+"}]},"_npmUser":{"name":"fewismuch","email":"15921977515@163.com"},"directories":{},"maintainers":[{"name":"fewismuch","email":"15921977515@163.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/esbuild-wasm-compiler_0.0.3_1707538694195_0.3922915474209494"},"_hasShrinkwrap":false,"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"0.0.4":{"name":"@carbontian/esbuild-wasm-compiler","version":"0.0.4","private":false,"description":"File Resolution for Esbuild running in the Browser","keywords":["esbuild","wasm","resolve","file-system"],"authors":"fewismuch","license":"MIT","module":"dist/esm/index.js","types":"dist/esm/index.d.ts","main":"dist/esbuild-wasm-compiler.min.js","repository":{"type":"git","url":"git+https://github.com/fewismuch/esbuild-wasm-compiler.git"},"scripts":{"dev":"father dev","build":"father build","build:deps":"father prebundle","prepublishOnly":"father doctor && npm run build"},"publishConfig":{"access":"public"},"devDependencies":{"father":"^4.1.7"},"dependencies":{"esbuild-wasm":"^0.20.0"},"gitHead":"42d5de351c31ab2a802c9ad103ca556d5c4289e7","bugs":{"url":"https://github.com/fewismuch/esbuild-wasm-compiler/issues"},"homepage":"https://github.com/fewismuch/esbuild-wasm-compiler#readme","_id":"@carbontian/esbuild-wasm-compiler@0.0.4","_nodeVersion":"18.15.0","_npmVersion":"9.5.0","dist":{"integrity":"sha512-Jd6noThRl9LePH0z6qLsFRY0M+VHm/OTvAWLHwkaqFyadoRHh25x/gNDBNR0vStXvVYIK8Ms00Kuce5xRY1ubg==","shasum":"7cb161da73d0055363c475fe9a48507f2028e01d","tarball":"https://registry.npmjs.org/@carbontian/esbuild-wasm-compiler/-/esbuild-wasm-compiler-0.0.4.tgz","fileCount":15,"unpackedSize":161378,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAF+4hYSsmmBtEyFXEjOyw2fPxqkeyVeuDiVhy8n+9TjAiEAo0bbHqohdsmjxfFP1xkzbZBSGqnXB2FZeRnobWTrHK8="}]},"_npmUser":{"name":"fewismuch","email":"15921977515@163.com"},"directories":{},"maintainers":[{"name":"fewismuch","email":"15921977515@163.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/esbuild-wasm-compiler_0.0.4_1707539099499_0.32247244346555837"},"_hasShrinkwrap":false,"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"0.0.5":{"name":"@carbontian/esbuild-wasm-compiler","version":"0.0.5","private":false,"description":"File Resolution for Esbuild running in the Browser","keywords":["esbuild","wasm","resolve","file-system"],"authors":"fewismuch","license":"MIT","module":"dist/esm/index.js","types":"dist/esm/index.d.ts","main":"dist/esbuild-wasm-compiler.min.js","repository":{"type":"git","url":"git+https://github.com/fewismuch/esbuild-wasm-compiler.git"},"scripts":{"dev":"father dev","build":"father build","build:deps":"father prebundle","prepublishOnly":"father doctor && npm run build"},"publishConfig":{"access":"public"},"devDependencies":{"father":"^4.1.7"},"dependencies":{"esbuild-wasm":"^0.20.0"},"gitHead":"b41e0ce8ed3403b44d0fe76e9d08be8a3a3f90d3","bugs":{"url":"https://github.com/fewismuch/esbuild-wasm-compiler/issues"},"homepage":"https://github.com/fewismuch/esbuild-wasm-compiler#readme","_id":"@carbontian/esbuild-wasm-compiler@0.0.5","_nodeVersion":"18.15.0","_npmVersion":"9.5.0","dist":{"integrity":"sha512-kc8gOuNGwIyolLmMfjft9eWE25behRhwQteqjliwZsJwRgBKswm5YDgChB0yS/mmi39TkNSsdRJJ+Q/xgNYSug==","shasum":"db9020494416068d903f3e97d7fd0cf90061bfc9","tarball":"https://registry.npmjs.org/@carbontian/esbuild-wasm-compiler/-/esbuild-wasm-compiler-0.0.5.tgz","fileCount":16,"unpackedSize":163479,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIC63UmFi1T0J+zETCljtrzMqRgEBHM58ZFEjr/nqta3vAiEAx7kZgmwVQWEvXenWoANL8PSAH5RofTsdBd0prafxC4Y="}]},"_npmUser":{"name":"fewismuch","email":"15921977515@163.com"},"directories":{},"maintainers":[{"name":"fewismuch","email":"15921977515@163.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/esbuild-wasm-compiler_0.0.5_1707549151708_0.007817493260729114"},"_hasShrinkwrap":false,"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."}},"time":{"created":"2024-02-10T03:23:06.034Z","0.0.1":"2024-02-10T03:23:06.350Z","modified":"2024-02-16T10:27:46.372Z","0.0.2":"2024-02-10T04:07:07.235Z","0.0.3":"2024-02-10T04:18:14.356Z","0.0.4":"2024-02-10T04:24:59.672Z","0.0.5":"2024-02-10T07:12:31.874Z"},"maintainers":[{"email":"support@npmjs.com","name":"npm-support"}],"description":"File Resolution for Esbuild running in the Browser","homepage":"https://github.com/fewismuch/esbuild-wasm-compiler#readme","keywords":["esbuild","wasm","resolve","file-system"],"repository":{"type":"git","url":"git+https://github.com/fewismuch/esbuild-wasm-compiler.git"},"bugs":{"url":"https://github.com/fewismuch/esbuild-wasm-compiler/issues"},"license":"MIT","readme":"# esbuild-wasm-compiler\n\n![NPM version](https://img.shields.io/npm/v/@carbontian/esbuild-wasm-compiler.svg?style=flat)\n\n一个运行在浏览器中`esbuild-wasm`的文件解析器\n\n## 介绍\n\n`esbuild-wasm-compiler`是`esbuild-wasm`的文件解析器。由于Web浏览器不能直接访问文件系统，`esbuild-wasm-compiler`在编译过程中拦截esbuild发出的文件“读”请求，允许应用程序从外部解析文件。通过这种机制，esbuild可以解析来自IndexedDB、LocalStorage、Http或任何其他浏览器可访问的可读设备的文件。\n\n`esbuild-wasm-compiler`主要提供给编辑器使用。\n\n参考了 [sinclairzx81/esbuild-wasm-resolve](https://github.com/sinclairzx81/esbuild-wasm-resolve) ，在此基础上添加了第三方依赖包解析和css文件解析，以及一些工具函数。\n\n## 安装\n\n```bash\n$ npm install @carbontian/esbuild-wasm-compiler\n```\n\n## 使用\n\n### html中使用\n\n[example](https://)\n\n### 项目中使用\n\n```javascript\nimport {Compiler,kvFilesResolver} from '@carbontian/esbuild-wasm-compiler'\nimport {files} from './files'\n\nconst compiler = new Compiler({\n  filesResolver: path => {\n    return kvFilesResolver(files, path)\n  },\n},{\n  packageJson: JSON.parse(files[\"package.json\"]),\n})\n\nconst code = await compiler.compile('/App.tsx')\nconsole.log(code);\n\n\n```\n\n`./files`\n\n```javascript\nconst AppCode = `\nimport React from 'react'\nimport ReactDOM from 'react-dom/client'\n\nconst App = () => {\n  const [num, setNum] = React.useState<number>(1)\n  return <>\n    <button onClick={() => setNum(num + 1)}>click</button>\n    <span>{num}</span>\n  </>\n}\nReactDOM.render(<App/>, document.getElementById(\"root\"));\n`;\n\nconst packageJson = `\n{\n    \"name\": \"react-ts\",\n    \"version\": \"0.0.1\",\n    \"private\": true,\n    \"dependencies\": {\n        \"react\": \"^18.1.0\",\n        \"react-dom\": \"^18.1.0\"\n    },\n    \"scripts\": {\n        \"start\": \"react-scripts start\",\n        \"build\": \"react-scripts build\",\n        \"test\": \"react-scripts test --env=jsdom\",\n        \"eject\": \"react-scripts eject\"\n    },\n    \"devDependencies\": {\n        \"react-scripts\": \"latest\",\n        \"typescript\": \"latest\"\n    }\n}\n`\n\nexport const files = {\n  \"/App.tsx\": AppCode,\n  \"package.json\":packageJson\n};\n```\n\n## 配置项\n\n```typescript\nexport interface FilesResolver {\n  filesResolver(path: string): Promise<string> | string;\n}\nexport interface CompilerOptions extends esbuild.InitializeOptions {\n  /**\n   * package.json文件内容\n   */\n  packageJson?: Record<string, any>;\n  /**\n   * 是否替换第三方依赖包包名为importMap中的url，默认true\n   */\n  replaceImports?: boolean;\n}\n/**\n * files对象格式 文件解析器\n * @param files\n * @param path\n * @example const files = {\n *   \"/index.ts\": `\n *      import {count} from './count'\n *      const name = 'home'\n *   `,\n *   \"/count\":`export const count = 1`\n * }\n * @example kvFilesResolver(files,'/count')=>`export const count = 1`\n */\nexport declare const kvFilesResolver: (files: Record<string, string>, path: string) => string;\nexport declare class Compiler {\n  constructor(resolver: FilesResolver, options?: CompilerOptions | undefined);\n  compile(entryPoint: string, options?: esbuild.BuildOptions): Promise<string>;\n  /**\n   * 获取importmap script标签\n   */\n  getImportsScriptElement(): HTMLScriptElement;\n}\n\n// 默认esbuild-wasm url\nconst ESBUILD_WASM_URL = 'https://esm.sh/esbuild-wasm@0.20.0/esbuild.wasm'\n\n\n```\n\n## LICENSE\n\nMIT\n","readmeFilename":"README.md"}