1tube 0.1.25 → 0.1.26

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "1tube",
3
- "version": "0.1.25",
3
+ "version": "0.1.26",
4
4
  "private": false,
5
5
  "description": "Self-hosted Supabase Edge Functions gateway for Deno, plus an ESLint plugin for consumers",
6
6
  "license": "MIT",
@@ -439,7 +439,24 @@ export function createRewriteCache(opts: RewriteCacheOptions): RewriteCache {
439
439
  }
440
440
  // external / unknown: leave specifier alone.
441
441
  if (replacement !== null) {
442
- replacements.push({ start: r.start, end: r.end, with: replacement });
442
+ // For static imports (`import x from "spec"`) the lexer
443
+ // reports [s, e) over just the specifier text (no quotes),
444
+ // so writing the bare URL is correct. For dynamic imports
445
+ // (`await import("spec")`) the slice covers the entire
446
+ // argument expression including the quotes, so we must
447
+ // re-quote the replacement or we'd produce
448
+ // `import(file:///...)` — a parse error. Same goes for
449
+ // template literals; we normalise to a plain string since
450
+ // the URL never contains characters that would need
451
+ // escaping in a JSON string. Detect by sniffing the first
452
+ // char of the slice.
453
+ const first = source.charAt(r.start);
454
+ const isQuoted = first === '"' || first === "'" || first === "`";
455
+ replacements.push({
456
+ start: r.start,
457
+ end: r.end,
458
+ with: isQuoted ? JSON.stringify(replacement) : replacement,
459
+ });
443
460
  }
444
461
  }
445
462
 
package/src/server.ts CHANGED
@@ -907,6 +907,13 @@ if (opts.backend === "workerd") {
907
907
  let started = false;
908
908
  const padTo = (n: number, width: number) =>
909
909
  String(n).padStart(width, " ");
910
+ // Workers spawn in parallel, so `p.index` (assigned at spawn-start
911
+ // time) doesn't match the order in which finish lines are printed
912
+ // — the result reads as a jumbled `[8/53] ... [4/53] ... [7/53]`.
913
+ // Track a separate "print order" counter so the output reads
914
+ // monotonically. We still get the correct total + per-fn name +
915
+ // duration; the only thing that changes is the column we display.
916
+ let printOrder = 0;
910
917
  const { loaded, errors } = await denoWorkerHost.start({
911
918
  onSpawnStart: (p) => {
912
919
  if (!started) {
@@ -919,8 +926,9 @@ if (opts.backend === "workerd") {
919
926
  const w = String(p.total).length;
920
927
  const status = p.ok ? "\x1b[32m✓\x1b[0m" : "\x1b[31m✗\x1b[0m";
921
928
  const tail = p.ok ? "" : ` — ${p.error ?? "error"}`;
929
+ const idx = ++printOrder;
922
930
  progress.onFinish(
923
- `[1tube] [${padTo(p.index, w)}/${p.total}] ${status} ${p.name} ` +
931
+ `[1tube] [${padTo(idx, w)}/${p.total}] ${status} ${p.name} ` +
924
932
  `\x1b[2m(${p.durationMs.toFixed(0)}ms)\x1b[0m${tail}`,
925
933
  p.name,
926
934
  );