{"_id":"@eslym/svelte-adapter-bun","_rev":"8-a469eb49e6cd161588874d1726799d2f","name":"@eslym/svelte-adapter-bun","dist-tags":{"latest":"0.5.9"},"versions":{"0.5.3":{"name":"@eslym/svelte-adapter-bun","version":"0.5.3","keywords":["svelte","sveltekit","sveltekit-adapter","bun"],"author":{"name":"Volodymyr Palamar","email":"@gornostay25"},"license":"MIT","_id":"@eslym/svelte-adapter-bun@0.5.3","maintainers":[{"name":"0nepeop1e","email":"engshun.lim@gmail.com"}],"homepage":"https://github.com/gornostay25/svelte-adapter-bun#readme","bugs":{"url":"https://github.com/gornostay25/svelte-adapter-bun/issues"},"dist":{"shasum":"5f910c79d9ad881e8a0b304efe89e9e66a209249","tarball":"https://registry.npmjs.org/@eslym/svelte-adapter-bun/-/svelte-adapter-bun-0.5.3.tgz","fileCount":8,"integrity":"sha512-6iNMTCnEcAFeF7jsluZ1y1k8enwkRLE1LNoPJgLVGiwRm/wFawsFMt+ZhzyHlKGUkchSzaIjcfZnJ8/eFBMHtQ==","signatures":[{"sig":"MEUCIAUPEBNpvm5CcpyZ8S+mJDeGaeU8wBvRxLe+GGon6zKRAiEAl0NCYgnMXGarGlBu64tcnbMr+6QSCPLZtm5lWgFulPQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":41944},"main":"index.js","type":"module","types":"index.d.ts","exports":{".":{"types":"./index.d.ts","import":"./index.js"},"./package.json":"./package.json"},"gitHead":"668211bb21bb9a1cf12e3833248c28188628570e","scripts":{"lint":"prettier --check .","build":"rm -fr files && bun run build.js","format":"prettier --write .","prepare":"bun run build"},"_npmUser":{"name":"0nepeop1e","email":"engshun.lim@gmail.com"},"repository":{"url":"git+https://github.com/gornostay25/svelte-adapter-bun.git","type":"git"},"_npmVersion":"10.2.4","description":"Adapter for SvelteKit apps that generates a standalone Bun.js server.","directories":{},"_nodeVersion":"20.11.0","dependencies":{"rollup":"^4.12.1","tiny-glob":"^0.2.9","@rollup/plugin-json":"^6.1.0","@rollup/plugin-commonjs":"^25.0.7","@rollup/plugin-node-resolve":"^15.2.3"},"_hasShrinkwrap":false,"devDependencies":{"mrmime":"^2.0.0","prettier":"^3.2.5","totalist":"^3.0.1","bun-types":"latest","@sveltejs/kit":"^1.30.4"},"_npmOperationalInternal":{"tmp":"tmp/svelte-adapter-bun_0.5.3_1709849618652_0.033408043693639033","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"0.5.4":{"name":"@eslym/svelte-adapter-bun","version":"0.5.4","keywords":["svelte","sveltekit","sveltekit-adapter","bun"],"author":{"name":"Volodymyr Palamar","email":"@gornostay25"},"license":"MIT","_id":"@eslym/svelte-adapter-bun@0.5.4","maintainers":[{"name":"0nepeop1e","email":"engshun.lim@gmail.com"}],"homepage":"https://github.com/gornostay25/svelte-adapter-bun#readme","bugs":{"url":"https://github.com/gornostay25/svelte-adapter-bun/issues"},"dist":{"shasum":"6bdca39c9e6c35e5b0a77d9c927db868793de460","tarball":"https://registry.npmjs.org/@eslym/svelte-adapter-bun/-/svelte-adapter-bun-0.5.4.tgz","fileCount":8,"integrity":"sha512-dDwG2X8/+oEmDrFpO7rVTGBW0NQt4f004MUfx2quaLY97LwzozLRr9UtucQ8Cg3OOU6YynQ6nXjEgorQJgdIfg==","signatures":[{"sig":"MEQCIEYC4kx0dCsC+eQ5+2+gzjaHkFtCnhTIRMHqnYYVm8D2AiAj4B/210xQJjysVH6TTfZK8ONgItEz274UIoXVUShjvA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":41758},"main":"index.js","type":"module","types":"index.d.ts","exports":{".":{"types":"./index.d.ts","import":"./index.js"},"./package.json":"./package.json"},"gitHead":"668211bb21bb9a1cf12e3833248c28188628570e","scripts":{"lint":"prettier --check .","build":"rm -fr files && bun run build.js","format":"prettier --write .","prepare":"bun run build"},"_npmUser":{"name":"0nepeop1e","email":"engshun.lim@gmail.com"},"repository":{"url":"git+https://github.com/gornostay25/svelte-adapter-bun.git","type":"git"},"_npmVersion":"10.2.4","description":"Adapter for SvelteKit apps that generates a standalone Bun.js server.","directories":{},"_nodeVersion":"20.11.0","dependencies":{"rollup":"^4.12.1","tiny-glob":"^0.2.9","@rollup/plugin-json":"^6.1.0","@rollup/plugin-commonjs":"^25.0.7","@rollup/plugin-node-resolve":"^15.2.3"},"_hasShrinkwrap":false,"devDependencies":{"mrmime":"^2.0.0","prettier":"^3.2.5","totalist":"^3.0.1","bun-types":"latest","@sveltejs/kit":"^1.30.4"},"_npmOperationalInternal":{"tmp":"tmp/svelte-adapter-bun_0.5.4_1709850798494_0.945359376794791","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"0.5.5":{"name":"@eslym/svelte-adapter-bun","version":"0.5.5","keywords":["svelte","sveltekit","sveltekit-adapter","bun"],"author":{"name":"Volodymyr Palamar","email":"@gornostay25"},"license":"MIT","_id":"@eslym/svelte-adapter-bun@0.5.5","maintainers":[{"name":"0nepeop1e","email":"engshun.lim@gmail.com"}],"homepage":"https://github.com/gornostay25/svelte-adapter-bun#readme","bugs":{"url":"https://github.com/gornostay25/svelte-adapter-bun/issues"},"dist":{"shasum":"f22960d1561501a4bd7c6721ee3f47a256312627","tarball":"https://registry.npmjs.org/@eslym/svelte-adapter-bun/-/svelte-adapter-bun-0.5.5.tgz","fileCount":8,"integrity":"sha512-13cAcRRbP856YcB50+fk0aikxmwzV4qly4wJjcirJIoPJJM3sYN/qjAjRZlhbBNdqFM4nsrYep9deLqdt7w8Jw==","signatures":[{"sig":"MEUCIE+ZooSQW/RIUBml4PzIekqhngnJz2G05Y407rWIvth4AiEAhkdMj2nl7h/EBWiQT6RLx/DwyH8sYqM5XFJsWRtMEEM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":42143},"main":"index.js","type":"module","types":"index.d.ts","exports":{".":{"types":"./index.d.ts","import":"./index.js"},"./package.json":"./package.json"},"gitHead":"79955544cb910ae25f8f14b090e8da7d30e40660","scripts":{"lint":"prettier --check .","build":"rm -fr files && bun run build.js","format":"prettier --write .","prepare":"bun run build"},"_npmUser":{"name":"0nepeop1e","email":"engshun.lim@gmail.com"},"repository":{"url":"git+https://github.com/gornostay25/svelte-adapter-bun.git","type":"git"},"_npmVersion":"10.2.4","description":"Adapter for SvelteKit apps that generates a standalone Bun.js server.","directories":{},"_nodeVersion":"20.11.0","dependencies":{"rollup":"^4.12.1","tiny-glob":"^0.2.9","@rollup/plugin-json":"^6.1.0","@rollup/plugin-commonjs":"^25.0.7","@rollup/plugin-node-resolve":"^15.2.3"},"_hasShrinkwrap":false,"devDependencies":{"mrmime":"^2.0.0","prettier":"^3.2.5","totalist":"^3.0.1","bun-types":"latest","@sveltejs/kit":"^1.30.4"},"_npmOperationalInternal":{"tmp":"tmp/svelte-adapter-bun_0.5.5_1709923957039_0.5461785890270476","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"0.5.6":{"name":"@eslym/svelte-adapter-bun","version":"0.5.6","keywords":["svelte","sveltekit","sveltekit-adapter","bun"],"author":{"name":"0nepeop1e","email":"@eslym"},"license":"MIT","_id":"@eslym/svelte-adapter-bun@0.5.6","maintainers":[{"name":"0nepeop1e","email":"engshun.lim@gmail.com"}],"homepage":"https://github.com/eslym/svelte-adapter-bun#readme","bugs":{"url":"https://github.com/eslym/svelte-adapter-bun/issues"},"dist":{"shasum":"83803248d40d035771dda44402a9376f8d773a6a","tarball":"https://registry.npmjs.org/@eslym/svelte-adapter-bun/-/svelte-adapter-bun-0.5.6.tgz","fileCount":8,"integrity":"sha512-9OURd6kyt0IkV5a7ur8OLrrD4PVaTR52wNSyam0OkIrx19Xj5OQDEGjxfhhNYqmGSddCHwgpw0D/KEBJaqmexA==","signatures":[{"sig":"MEUCIQCNmzrUooOk6jZ94pP8s1rJ/3D4VO4ObxE5kijiya9MkAIgPoVwF/BGIlpcdiZMGOpU3e62m6C9cZbN3kQhXMelNK4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":42074},"main":"index.js","type":"module","types":"index.d.ts","exports":{".":{"types":"./index.d.ts","import":"./index.js"},"./package.json":"./package.json"},"gitHead":"a0ffbf50a329aef6ad7e5ecc0c93de5228d0a8fc","scripts":{"lint":"prettier --check .","build":"rm -fr files && bun run build.js","format":"prettier --write .","prepare":"bun run build"},"_npmUser":{"name":"0nepeop1e","email":"engshun.lim@gmail.com"},"repository":{"url":"git+https://github.com/eslym/svelte-adapter-bun.git","type":"git"},"_npmVersion":"10.2.4","description":"Adapter for SvelteKit apps that generates a standalone Bun.js server.","directories":{},"_nodeVersion":"20.11.1","dependencies":{"rollup":"^4.12.1","tiny-glob":"^0.2.9","@rollup/plugin-json":"^6.1.0","@rollup/plugin-commonjs":"^25.0.7","@rollup/plugin-node-resolve":"^15.2.3"},"_hasShrinkwrap":false,"devDependencies":{"mrmime":"^2.0.0","prettier":"^3.2.5","totalist":"^3.0.1","bun-types":"latest","@sveltejs/kit":"^1.30.4"},"_npmOperationalInternal":{"tmp":"tmp/svelte-adapter-bun_0.5.6_1710014871651_0.46185065127576896","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"0.5.7":{"name":"@eslym/svelte-adapter-bun","version":"0.5.7","keywords":["svelte","sveltekit","sveltekit-adapter","bun"],"author":{"name":"0nepeop1e","email":"@eslym"},"license":"MIT","_id":"@eslym/svelte-adapter-bun@0.5.7","maintainers":[{"name":"0nepeop1e","email":"engshun.lim@gmail.com"}],"homepage":"https://github.com/eslym/svelte-adapter-bun#readme","bugs":{"url":"https://github.com/eslym/svelte-adapter-bun/issues"},"dist":{"shasum":"f3ad8aab7d02e5ef8db5418309607d14b3d076a5","tarball":"https://registry.npmjs.org/@eslym/svelte-adapter-bun/-/svelte-adapter-bun-0.5.7.tgz","fileCount":8,"integrity":"sha512-InuDmCCQSTm8PYwtVJah2VMlhMNCm05TCeWBSn0Q5GqHJBKWajMwpao77fCFTxk4vCd7yvxVg52QpCOhe8qp0g==","signatures":[{"sig":"MEUCIH6VlBcXtnfvcjg3qj2Z+D6WIK/9mqG4v0gcGkm8bR0FAiEA8jvk/7ySgpZ1j2WQ9YYUFs4B7J+gfNT9QNcZgOoM25A=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":42151},"main":"index.js","type":"module","types":"index.d.ts","exports":{".":{"types":"./index.d.ts","import":"./index.js"},"./package.json":"./package.json"},"gitHead":"9b8284982f1f128c6a7175bc70dc55e4b1074410","scripts":{"lint":"prettier --check .","build":"rm -fr files && bun run build.js","format":"prettier --write .","prepare":"bun run build"},"_npmUser":{"name":"0nepeop1e","email":"engshun.lim@gmail.com"},"repository":{"url":"git+https://github.com/eslym/svelte-adapter-bun.git","type":"git"},"_npmVersion":"10.2.4","description":"Adapter for SvelteKit apps that generates a standalone Bun.js server.","directories":{},"_nodeVersion":"20.11.1","dependencies":{"rollup":"^4.12.1","tiny-glob":"^0.2.9","@rollup/plugin-json":"^6.1.0","@rollup/plugin-commonjs":"^25.0.7","@rollup/plugin-node-resolve":"^15.2.3"},"_hasShrinkwrap":false,"devDependencies":{"mrmime":"^2.0.0","prettier":"^3.2.5","totalist":"^3.0.1","bun-types":"latest","@sveltejs/kit":"^1.30.4"},"_npmOperationalInternal":{"tmp":"tmp/svelte-adapter-bun_0.5.7_1711435552730_0.5126929373748048","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"0.5.8":{"name":"@eslym/svelte-adapter-bun","version":"0.5.8","keywords":["svelte","sveltekit","sveltekit-adapter","bun"],"author":{"name":"0nepeop1e","email":"@eslym"},"license":"MIT","_id":"@eslym/svelte-adapter-bun@0.5.8","maintainers":[{"name":"0nepeop1e","email":"engshun.lim@gmail.com"}],"homepage":"https://github.com/eslym/svelte-adapter-bun#readme","bugs":{"url":"https://github.com/eslym/svelte-adapter-bun/issues"},"dist":{"shasum":"02924d5e5a0490d7b6bfc10d861e1bd6a9a26451","tarball":"https://registry.npmjs.org/@eslym/svelte-adapter-bun/-/svelte-adapter-bun-0.5.8.tgz","fileCount":8,"integrity":"sha512-R43LzAUDaOmyCEyEX2Pyo454uQoPfZ/+Vm2WSllko9vMhM0SpbGgt5GD0hN2izrgjavczcDQ5yYxbNMMHFSqhQ==","signatures":[{"sig":"MEUCIQDUCTxN+aiZgM46ITIjX5ArS0ngSDsBX91rwwI1Fr7b5QIgfCtyK9DuxOtQsO0epOsMja/9aFHEaXBL6yiSNmJynbo=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":42390},"main":"index.js","type":"module","types":"index.d.ts","exports":{".":{"types":"./index.d.ts","import":"./index.js"},"./package.json":"./package.json"},"gitHead":"9b8284982f1f128c6a7175bc70dc55e4b1074410","scripts":{"lint":"prettier --check .","build":"rm -fr files && bun run build.js","format":"prettier --write .","prepare":"bun run build"},"_npmUser":{"name":"0nepeop1e","email":"engshun.lim@gmail.com"},"repository":{"url":"git+https://github.com/eslym/svelte-adapter-bun.git","type":"git"},"_npmVersion":"10.2.4","description":"Adapter for SvelteKit apps that generates a standalone Bun.js server.","directories":{},"_nodeVersion":"20.11.1","dependencies":{"rollup":"^4.12.1","tiny-glob":"^0.2.9","@rollup/plugin-json":"^6.1.0","@rollup/plugin-commonjs":"^25.0.7","@rollup/plugin-node-resolve":"^15.2.3"},"_hasShrinkwrap":false,"devDependencies":{"mrmime":"^2.0.0","prettier":"^3.2.5","totalist":"^3.0.1","bun-types":"latest","@sveltejs/kit":"^1.30.4"},"_npmOperationalInternal":{"tmp":"tmp/svelte-adapter-bun_0.5.8_1711711807898_0.30648146306010093","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"0.5.9":{"name":"@eslym/svelte-adapter-bun","version":"0.5.9","keywords":["svelte","sveltekit","sveltekit-adapter","bun"],"author":{"name":"0nepeop1e","email":"@eslym"},"license":"MIT","_id":"@eslym/svelte-adapter-bun@0.5.9","maintainers":[{"name":"0nepeop1e","email":"engshun.lim@gmail.com"}],"homepage":"https://github.com/eslym/svelte-adapter-bun#readme","bugs":{"url":"https://github.com/eslym/svelte-adapter-bun/issues"},"dist":{"shasum":"ca890e95cd1ace6c7c94fb7047a57d036a1cde9d","tarball":"https://registry.npmjs.org/@eslym/svelte-adapter-bun/-/svelte-adapter-bun-0.5.9.tgz","fileCount":8,"integrity":"sha512-d6SVPgoA17aPvNT4wutzPRJyAZJEMPdkCpBimZyW7Nc+666jPINK/eoAknCYiQe0hK0u7lWHUvZChRTlPU+2Kw==","signatures":[{"sig":"MEUCIHThDt4WMXm2iL11Yl0pWqFw1K7m2LHfsRrbqa+nqdb2AiEA1UZIl5/qRqiVhHBdvxHUtljMBFD0vgYrpWo6LepVXWU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":42834},"main":"index.js","type":"module","types":"index.d.ts","exports":{".":{"types":"./index.d.ts","import":"./index.js"},"./package.json":"./package.json"},"gitHead":"15e6c72e220fdf5a1f5f8b8ef68191fcdfb8bdd7","scripts":{"lint":"prettier --check .","build":"rm -fr files && bun run build.js","format":"prettier --write .","prepare":"bun run build"},"_npmUser":{"name":"0nepeop1e","email":"engshun.lim@gmail.com"},"repository":{"url":"git+https://github.com/eslym/svelte-adapter-bun.git","type":"git"},"_npmVersion":"10.2.4","description":"Adapter for SvelteKit apps that generates a standalone Bun.js server.","directories":{},"_nodeVersion":"20.11.1","dependencies":{"rollup":"^4.12.1","tiny-glob":"^0.2.9","@rollup/plugin-json":"^6.1.0","@rollup/plugin-commonjs":"^25.0.7","@rollup/plugin-node-resolve":"^15.2.3"},"_hasShrinkwrap":false,"devDependencies":{"mrmime":"^2.0.0","prettier":"^3.2.5","totalist":"^3.0.1","bun-types":"latest","@sveltejs/kit":"^1.30.4"},"_npmOperationalInternal":{"tmp":"tmp/svelte-adapter-bun_0.5.9_1715882275486_0.6267927719441719","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."}},"time":{"created":"2024-03-07T22:13:38.545Z","modified":"2026-06-19T14:37:49.572Z","0.5.3":"2024-03-07T22:13:38.811Z","0.5.4":"2024-03-07T22:33:18.692Z","0.5.5":"2024-03-08T18:52:37.190Z","0.5.6":"2024-03-09T20:07:51.799Z","0.5.7":"2024-03-26T06:45:52.921Z","0.5.8":"2024-03-29T11:30:08.066Z","0.5.9":"2024-05-16T17:57:55.657Z"},"bugs":{"url":"https://github.com/eslym/svelte-adapter-bun/issues"},"author":{"name":"0nepeop1e","email":"@eslym"},"license":"MIT","homepage":"https://github.com/eslym/svelte-adapter-bun#readme","keywords":["svelte","sveltekit","sveltekit-adapter","bun"],"repository":{"url":"git+https://github.com/eslym/svelte-adapter-bun.git","type":"git"},"description":"Adapter for SvelteKit apps that generates a standalone Bun.js server.","maintainers":[{"name":"0nepeop1e","email":"engshun.lim@gmail.com"}],"readme":"# @eslym/svelte-adapter-bun\n\nA fork from [svelte-adapter-bun](https://github.com/gornostay25/svelte-adapter-bun)\n\n[Adapter](https://kit.svelte.dev/docs/adapters) for SvelteKit apps that generates a standalone [Bun](https://github.com/oven-sh/bun) server.\n\n## :zap: Usage\n\nInstall with `bun add -d @eslym/svelte-adapter-bun`, then add the adapter to your `svelte.config.js`:\n\n```js\n// svelte.config.js\nimport adapter from \"@eslym/svelte-adapter-bun\";\n\nexport default {\n  kit: {\n    adapter: adapter(),\n  },\n};\n```\n\nAfter building the server (`vite build`), use the following command to start:\n\n```\n# go to build directory\ncd build/\n\n# run Bun\nbun run start\n```\n\n## :gear: Options\n\nThe adapter can be configured with various options:\n\n```js\n// svelte.config.js\nimport adapter from \"@eslym/svelte-adapter-bun\";\nexport default {\n  kit: {\n    adapter: adapter({\n      out: \"build\",\n      assets: true,\n      envPrefix: \"MY_CUSTOM_\",\n      development: true,\n      // precompress: true,\n      precompress: {\n        brotli: true,\n        gzip: true,\n        files: [\"htm\", \"html\"],\n      },\n      dynamic_origin: true,\n      xff_depth: 1,\n    }),\n  },\n};\n```\n\n### out\n\nThe directory to build the server to. It defaults to `build` — i.e. `bun run start` would start the server locally after it has been created.\n\n### assets\n\nBrowse a static assets. Default: `true`\n\n- [x] Support [HTTP range requests](https://developer.mozilla.org/en-US/docs/Web/HTTP/Range_requests)\n\n### precompress\n\nEnables precompressing using gzip and brotli for assets and prerendered pages. It defaults to `false`.\n\n#### brotli\n\nEnable brotli precompressing. It defaults to `false`.\n\n#### gzip\n\nEnable gzip precompressing. It defaults to `false`.\n\n#### files\n\nfile extensions to compress.It defaults to `['html','js','json','css','svg','xml','wasm']`.\n\n### envPrefix\n\nIf you need to change the name of the environment variables used to configure the deployment (for example, to deconflict with environment variables you don't control), you can specify a prefix:\n\n```js\nenvPrefix: \"MY_CUSTOM_\";\n```\n\n```\nMY_CUSTOM_HOST=127.0.0.1 \\\nMY_CUSTOM_PORT=4000 \\\nMY_CUSTOM_ORIGIN=https://my.site \\\nbun build/index.js\n```\n\n### development\n\nThis enables bun's error page. Default: `false`\n\n### dynamic_origin\n\nIf enabled use `PROTOCOL_HEADER` `HOST_HEADER` like origin. Default: `false`\n\n### xff_depth\n\nThe default value of XFF_DEPTH if environment is not set. Default: `1`\n\n## :spider_web: WebSocket Server\n\nhttps://bun.sh/docs/api/websockets\n\n```js\n// hooks.server.js\n\n/** @type {import(\"svelte-adapter-bun\").WebSocketHandler} */\nexport const handleWebsocket = {\n  open(ws) {\n    console.log(\"WebSocket opened\");\n    ws.send(\"Slava Ukraїni\");\n  },\n  /**\n   * @param {Request} request\n   * @param {Function} upgrade\n   */\n  upgrade(request, upgrade) {\n    const url = new URL(request.url);\n    if (url.pathname.startsWith(\"/ws\")) {\n      return upgrade(request);\n    }\n  },\n};\n```\n\n## Polyfills\n\nIf you need to use polyfills in your app, you can add them to the [`src/polyfills.js`](src/polyfills.js) file:\n\n```js\nclass Polifill {\n  constructor() {\n    ...\n  }\n}\n\nconst globals = {\n  Polifill,\n};\n```\n\n## :desktop_computer: Environment variables\n\n> Bun automatically reads configuration from `.env.local`, `.env.development` and `.env`\n\n### `PORT` and `HOST`\n\nBy default, the server will accept connections on `0.0.0.0` using port 3000. These can be customized with the `PORT` and `HOST` environment variables:\n\n```\nHOST=127.0.0.1 PORT=4000 bun build/index.js\n```\n\n### `ORIGIN`, `PROTOCOL_HEADER` and `HOST_HEADER`\n\nHTTP doesn't give SvelteKit a reliable way to know the URL that is currently being requested. The simplest way to tell SvelteKit where the app is being served is to set the `ORIGIN` environment variable:\n\n```\nORIGIN=https://my.site bun build/index.js\n```\n\nWith this, a request for the `/stuff` pathname will correctly resolve to `https://my.site/stuff`. Alternatively, you can specify headers that tell SvelteKit about the request protocol and host, from which it can construct the origin URL:\n\n```\nPROTOCOL_HEADER=x-forwarded-proto HOST_HEADER=x-forwarded-host bun build/index.js\n```\n\n> [`x-forwarded-proto`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-Proto) and [`x-forwarded-host`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-Host) are de facto standard headers that forward the original protocol and host if you're using a reverse proxy (think load balancers and CDNs). You should only set these variables if your server is behind a trusted reverse proxy; otherwise, it'd be possible for clients to spoof these headers.\n\n### `ADDRESS_HEADER` and `XFF_DEPTH`\n\nThe [RequestEvent](https://kit.svelte.dev/docs/types#additional-types-requestevent) object passed to hooks and endpoints includes an `event.clientAddress` property representing the client's IP address. If your server is behind one or more proxies (such as a load balancer), you can get an IP address from headers, so we need to specify an `ADDRESS_HEADER` to read the address from:\n\n```\nADDRESS_HEADER=True-Client-IP bun build/index.js\n```\n\n> Headers can easily be spoofed. As with `PROTOCOL_HEADER` and `HOST_HEADER`, you should [know what you're doing](https://adam-p.ca/blog/2022/03/x-forwarded-for/) before setting these.\n> If the `ADDRESS_HEADER` is `X-Forwarded-For`, the header value will contain a comma-separated list of IP addresses. The `XFF_DEPTH` environment variable should specify how many trusted proxies sit in front of your server. E.g. if there are three trusted proxies, proxy 3 will forward the addresses of the original connection and the first two proxies:\n\n```\n<client address>, <proxy 1 address>, <proxy 2 address>\n```\n\nSome guides will tell you to read the left-most address, but this leaves you [vulnerable to spoofing](https://adam-p.ca/blog/2022/03/x-forwarded-for/):\n\n```\n<spoofed address>, <client address>, <proxy 1 address>, <proxy 2 address>\n```\n\nInstead, we read from the _right_, accounting for the number of trusted proxies. In this case, we would use `XFF_DEPTH=3`.\n\n> If you need to read the left-most address instead (and don't care about spoofing) — for example, to offer a geolocation service, where it's more important for the IP address to be _real_ than _trusted_, you can do so by inspecting the `x-forwarded-for` header within your app.\n\n## License\n\n[MIT](LICENSE) © [0nepeop1e](https://github.com/eslym)\n","readmeFilename":"README.md"}