surrge 0.4.1 → 0.4.8

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/dist/cli.js CHANGED
@@ -2,8 +2,8 @@
2
2
 
3
3
  // src/cli.ts
4
4
  import { spawn, spawnSync } from "node:child_process";
5
- import { fileURLToPath } from "node:url";
6
5
  import { dirname, resolve } from "node:path";
6
+ import { fileURLToPath } from "node:url";
7
7
  var args = process.argv.slice(2);
8
8
  if (args.length === 0) {
9
9
  console.log("Usage: surrge [options] <script> [args...]");
@@ -1 +1 @@
1
- {"version":3,"file":"html.d.ts","sourceRoot":"","sources":["../../src/dashboard/html.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,IAAI,QAAO,MAAqkquB,CAAC"}
1
+ {"version":3,"file":"html.d.ts","sourceRoot":"","sources":["../../src/dashboard/html.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,IAAI,QAAO,MAAq/puB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../src/hooks.ts"],"names":[],"mappings":"AAyJA,eAAO,MAAM,OAAO,GAClB,WAAW,MAAM,EACjB,SAAS,OAAO,EAChB,aAAa,QAAQ,iBAGtB,CAAC;AAEF,eAAO,MAAM,IAAI,GACf,KAAK,MAAM,EACX,SAAS,OAAO,EAChB,UAAU,QAAQ,iBAGnB,CAAC"}
1
+ {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../src/hooks.ts"],"names":[],"mappings":"AA6KA,eAAO,MAAM,OAAO,GAClB,WAAW,MAAM,EACjB,SAAS,OAAO,EAChB,aAAa,QAAQ,iBAGtB,CAAC;AAEF,eAAO,MAAM,IAAI,GACf,KAAK,MAAM,EACX,SAAS,OAAO,EAChB,UAAU,QAAQ,iBAGnB,CAAC"}
package/dist/hooks.js CHANGED
@@ -57,7 +57,7 @@ var normalizeLevel = (level) => {
57
57
  return "info";
58
58
  };
59
59
  var captureOutput = (chunk) => {
60
- const text = typeof chunk === "string" ? chunk : chunk.toString();
60
+ const text = typeof chunk === "string" ? chunk : Buffer.isBuffer(chunk) ? chunk.toString() : new TextDecoder().decode(chunk);
61
61
  buffer += text;
62
62
  const lines = buffer.split(`
63
63
  `);
@@ -108,7 +108,7 @@ cjsFs.write = (fd, data, ...args) => {
108
108
  };
109
109
  var originalStdoutWrite = process.stdout.write.bind(process.stdout);
110
110
  process.stdout.write = (chunk, encodingOrCallback, callback) => {
111
- if (typeof chunk === "string" || Buffer.isBuffer(chunk)) {
111
+ if (typeof chunk === "string" || chunk instanceof Uint8Array) {
112
112
  captureOutput(chunk);
113
113
  }
114
114
  if (typeof encodingOrCallback === "function") {
@@ -122,12 +122,20 @@ if (Bun?.write) {
122
122
  const originalBunWrite = Bun.write;
123
123
  Bun.write = (dest, data, ...args) => {
124
124
  const isStdout = dest === STDOUT_FD || dest === process.stdout || dest === BunStdout;
125
- if (isStdout && (typeof data === "string" || Buffer.isBuffer(data))) {
125
+ if (isStdout && (typeof data === "string" || data instanceof Uint8Array)) {
126
126
  captureOutput(data);
127
127
  }
128
128
  return originalBunWrite(dest, data, ...args);
129
129
  };
130
130
  }
131
+ var bunStdout = BunStdout;
132
+ if (bunStdout?.write) {
133
+ const originalBunStdoutWrite = bunStdout.write.bind(bunStdout);
134
+ bunStdout.write = (data) => {
135
+ captureOutput(data);
136
+ return originalBunStdoutWrite(data);
137
+ };
138
+ }
131
139
  var resolve = async (specifier, context, nextResolve) => {
132
140
  return nextResolve(specifier, context);
133
141
  };