@eslym/sveltekit-adapter-bun 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,7 @@
1
+ Copyright 2024 0nepeop1e
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,11 @@
1
1
  # @eslym/sveltekit-adapter-bun
2
2
 
3
- Another sveltekit adapter for bun
3
+ Another sveltekit adapter for bun, an alternative to [svelte-adapter-bun](https://github.com/gornostay25/svelte-adapter-bun). This package support websocket in dev mode with few steps of setup.
4
+
5
+ ## Installation
6
+
7
+ ```shell
8
+ bun add -d @eslym/sveltekit-adapter-bun
9
+ ```
10
+
11
+ TODO: add documentation
@@ -897,7 +897,16 @@ import {get_hooks} from "SERVER";
897
897
  set_basepath(import.meta.dir);
898
898
  var hooks = await get_hooks();
899
899
  var cli = dist_default(CLI_NAME);
900
- cli.command("", "Serve the app").alias("serve").option("--port, -p <port>", "Port to listen on", { default: 3000 }).option("--host, -h <host>", "Host to listen on", { default: "localhost" }).option("--unix-socket, -u <unix-socket>", "Serve on a unix socket instead.").option("--protocol-header, -P <protocol-header>", "Protocol header to use").option("--override-origin, -O <override-origin>", "Override the origin").option("--host-header, -H <host-header>", "Host header to use").option("--ip-header, -i <ip-header>", "IP header to use").option("--xff-depth, -x <xff-depth>", "X-Forwarded-For depth", { default: 1 }).action(async (options) => {
900
+ var env = Bun.env;
901
+ cli.command("", "Serve the app").alias("serve").option("--port, -p <port>", "Port to listen on", { default: env.HTTP_PORT || 3000 }).option("--host, -h <host>", "Host to listen on", { default: env.HTTP_HOST || "localhost" }).option("--unix-socket, -u <unix-socket>", "Serve on a unix socket instead.", {
902
+ default: env.HTTP_SOCKET
903
+ }).option("--protocol-header, -P <protocol-header>", "Protocol header to use", {
904
+ default: env.HTTP_PROTOCOL
905
+ }).option("--override-origin, -O <override-origin>", "Override the origin", {
906
+ default: env.HTTP_OVERRIDE_ORIGIN
907
+ }).option("--host-header, -H <host-header>", "Host header to use", {
908
+ default: env.HTTP_HOST_HEADER
909
+ }).option("--ip-header, -i <ip-header>", "IP header to use", { default: env.HTTP_IP_HEADER }).option("--xff-depth, -x <xff-depth>", "X-Forwarded-For depth", { default: env.HTTP_XFF_DEPTH }).action(async (options) => {
901
910
  await hooks.beforeServe?.(options);
902
911
  const serverOptions = options.unixSocket ? {
903
912
  unix: options.unixSocket
package/dist/index.js CHANGED
@@ -51,9 +51,18 @@ async function patchSveltekit() {
51
51
  console.log("Patched @sveltejs/kit/node");
52
52
  await Bun.$`${bun} patch --commit 'node_modules/@sveltejs/kit'`;
53
53
  }
54
- async function startDevServer({ port = 5173, host = "localhost", config } = {}) {
54
+ async function startDevServer({
55
+ port = 5173,
56
+ host = "localhost",
57
+ config
58
+ } = {}) {
55
59
  if (!config) {
56
- for (const cfg of ["vite.config.ts", "vite.config.js", "vite.config.cjs", "vite.config.mjs"]) {
60
+ for (const cfg of [
61
+ "vite.config.ts",
62
+ "vite.config.js",
63
+ "vite.config.cjs",
64
+ "vite.config.mjs"
65
+ ]) {
57
66
  if (Bun.file(cfg).size) {
58
67
  config = cfg;
59
68
  break;
package/package.json CHANGED
@@ -1,7 +1,16 @@
1
1
  {
2
2
  "name": "@eslym/sveltekit-adapter-bun",
3
- "version": "1.0.0",
3
+ "description": "Another sveltekit adapter for bun.",
4
+ "keywords": [
5
+ "sveltekit",
6
+ "adapter",
7
+ "bun"
8
+ ],
4
9
  "type": "module",
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "https://github.com/eslym/sveltekit-adapter-bun.git"
13
+ },
5
14
  "files": [
6
15
  "dist/**/*"
7
16
  ],
@@ -23,5 +32,6 @@
23
32
  "@rollup/plugin-json": "^6.1.0",
24
33
  "@rollup/plugin-node-resolve": "^15.2.3",
25
34
  "rollup": "^4.18.0"
26
- }
27
- }
35
+ },
36
+ "version": "1.0.1"
37
+ }