@eslym/sveltekit-adapter-bun 1.0.1 → 1.0.2

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.
Files changed (2) hide show
  1. package/dist/index.js +9 -3
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -29,6 +29,9 @@ import {dirname, join} from "path";
29
29
  import {EventEmitter} from "events";
30
30
  import {IncomingMessage, ServerResponse} from "http";
31
31
  async function patchSveltekit() {
32
+ if (!("Bun" in globalThis)) {
33
+ throw new Error("Please run with bun");
34
+ }
32
35
  if (Bun.semver.satisfies(Bun.version, "<1.1.15")) {
33
36
  throw new Error("bun patch requires Bun >= 1.1.15");
34
37
  }
@@ -56,6 +59,9 @@ async function startDevServer({
56
59
  host = "localhost",
57
60
  config
58
61
  } = {}) {
62
+ if (!("Bun" in globalThis)) {
63
+ throw new Error("Please run with bun");
64
+ }
59
65
  if (!config) {
60
66
  for (const cfg of [
61
67
  "vite.config.ts",
@@ -212,9 +218,6 @@ var exportSetupCLI = function(out) {
212
218
  writeFileSync(`${out}/index.js`, result, "utf8");
213
219
  };
214
220
  var files = fileURLToPath(new URL("./files", import.meta.url));
215
- if (!("Bun" in globalThis)) {
216
- throw new Error("Please run with bun");
217
- }
218
221
  function adapter(userOpts = {}) {
219
222
  const opts = {
220
223
  out: "./build",
@@ -227,6 +230,9 @@ function adapter(userOpts = {}) {
227
230
  return {
228
231
  name,
229
232
  async adapt(builder) {
233
+ if (!("Bun" in globalThis)) {
234
+ throw new Error("Please run with bun");
235
+ }
230
236
  if (Bun.semver.order(Bun.version, "1.1.8") < 0) {
231
237
  if (opts.precompress === true) {
232
238
  builder.log.warn(`Bun v${Bun.version} does not support brotli, please use newer version of bun or nodejs to build, otherwise brotli will be ignore.`);
package/package.json CHANGED
@@ -33,5 +33,5 @@
33
33
  "@rollup/plugin-node-resolve": "^15.2.3",
34
34
  "rollup": "^4.18.0"
35
35
  },
36
- "version": "1.0.1"
36
+ "version": "1.0.2"
37
37
  }