@savvy-web/tsdown-plugins 2.11.5 → 2.11.7

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.
@@ -1,7 +1,7 @@
1
1
  import { rmSync } from "node:fs";
2
2
  import { join, resolve } from "node:path";
3
- import { Result } from "effect";
4
3
  import { GlobPattern, GlobPatternOptions } from "@effected/glob";
4
+ import { Result } from "effect";
5
5
  import { descendSync } from "@effected/walker";
6
6
  import { nodeWalkerSyncOps } from "@effected/walker/node-sync";
7
7
 
@@ -2,8 +2,8 @@ import { findRelativeSpecifiers } from "../dts/relative-imports.js";
2
2
  import { ConfigValidationError } from "../errors.js";
3
3
  import { copyFileSync, existsSync, mkdirSync, readFileSync, statSync } from "node:fs";
4
4
  import { dirname, join, resolve } from "node:path";
5
- import { Result } from "effect";
6
5
  import { GlobPattern, GlobPatternOptions } from "@effected/glob";
6
+ import { Result } from "effect";
7
7
  import { descendSync } from "@effected/walker";
8
8
  import { nodeWalkerSyncOps } from "@effected/walker/node-sync";
9
9
 
@@ -2,7 +2,9 @@ import { tsconfigSyncOptions } from "../tsconfig/sync-options.js";
2
2
  import { existsSync, realpathSync, writeFileSync } from "node:fs";
3
3
  import { dirname, isAbsolute, join, resolve } from "node:path";
4
4
  import { tmpdir } from "node:os";
5
+ import { GlobPattern, GlobPatternOptions } from "@effected/glob";
5
6
  import { TsconfigLoaderSync } from "@effected/tsconfig-json";
7
+ import { Result } from "effect";
6
8
 
7
9
  // src/dts/resolved-tsconfig.ts
8
10
  /**
@@ -113,25 +115,33 @@ function absoluteFileSet(configPath, baseDir) {
113
115
  ...exclude !== void 0 ? { exclude } : {}
114
116
  };
115
117
  }
116
- const GLOB_CHARS = /[*?{[]/;
118
+ /**
119
+ * tsconfig globs have only `*`, `?` and `**`: an extglob's parentheses, or a leading `#` or `!`, are literal
120
+ * text in a directory name, so none of them may end the literal prefix.
121
+ */
122
+ const TSCONFIG_GLOB = GlobPatternOptions.make({
123
+ noext: true,
124
+ nocomment: true,
125
+ nonegate: true
126
+ });
117
127
  /**
118
128
  * Resolve symlinks in the literal directory prefix of an absolute path or glob (everything before the
119
- * first segment carrying a glob character), leaving the pattern tail untouched. A prefix that does not
120
- * exist is returned unchanged.
129
+ * first segment carrying a glob character), leaving the pattern tail untouched. A pattern the kit rejects,
130
+ * a prefix that does not exist, or one whose spelling the kit changed (an undone escape) is returned unchanged.
121
131
  */
122
132
  function canonicalGlob(absPath) {
123
- const segments = absPath.split("/");
124
- let firstGlob = segments.findIndex((seg) => GLOB_CHARS.test(seg));
125
- if (firstGlob === -1) firstGlob = segments.length;
126
- const prefix = segments.slice(0, firstGlob).join("/") || "/";
127
- const tail = segments.slice(firstGlob);
133
+ const compiled = GlobPattern.compileResult(absPath, TSCONFIG_GLOB);
134
+ if (Result.isFailure(compiled)) return absPath;
135
+ const prefix = compiled.success.literalPrefix;
136
+ if (!absPath.startsWith(prefix)) return absPath;
137
+ const tail = absPath.slice(prefix.length);
128
138
  let canonicalPrefix;
129
139
  try {
130
140
  canonicalPrefix = realpathSync.native(prefix);
131
141
  } catch {
132
142
  return absPath;
133
143
  }
134
- return tail.length === 0 ? canonicalPrefix : join(canonicalPrefix, ...tail);
144
+ return /^\/*$/.test(tail) ? canonicalPrefix : join(canonicalPrefix, tail);
135
145
  }
136
146
  /**
137
147
  * Write the resolved tsconfig to a temp file and return its absolute path.
@@ -1,7 +1,7 @@
1
1
  import { readFileSync, writeFileSync } from "node:fs";
2
2
  import { join, resolve } from "node:path";
3
- import { Result } from "effect";
4
3
  import { GlobPattern, GlobPatternOptions } from "@effected/glob";
4
+ import { Result } from "effect";
5
5
  import { descendSync } from "@effected/walker";
6
6
  import { nodeWalkerSyncOps } from "@effected/walker/node-sync";
7
7
  import { decode, encode } from "@jridgewell/sourcemap-codec";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@savvy-web/tsdown-plugins",
3
- "version": "2.11.5",
3
+ "version": "2.11.7",
4
4
  "private": false,
5
5
  "description": "Interface-only tsdown/rolldown plugin pack powering @savvy-web/bundler",
6
6
  "homepage": "https://github.com/savvy-web/systems/tree/main/packages/tsdown-plugins",
@@ -30,24 +30,23 @@
30
30
  },
31
31
  "dependencies": {
32
32
  "@changesets/get-release-plan": "^5.0.2",
33
- "@effect/platform-node": "~4.1.1",
34
- "@effected/env": "^0.9.0",
35
- "@effected/glob": "^0.17.0",
36
- "@effected/images": "^0.8.0",
37
- "@effected/jsonc": "^0.22.0",
38
- "@effected/npm": "^0.29.0",
39
- "@effected/package-json": "^0.28.0",
40
- "@effected/semver": "^0.20.0",
41
- "@effected/tsconfig-json": "^0.19.0",
42
- "@effected/walker": "^0.24.0",
43
- "@effected/workspaces": "^0.41.0",
33
+ "@effect/platform-node": "~4.1.2",
34
+ "@effected/env": "^0.11.0",
35
+ "@effected/glob": "^0.19.0",
36
+ "@effected/images": "^0.9.0",
37
+ "@effected/jsonc": "^0.24.0",
38
+ "@effected/npm": "^0.30.1",
39
+ "@effected/package-json": "^0.30.0",
40
+ "@effected/semver": "^0.22.0",
41
+ "@effected/tsconfig-json": "^0.20.1",
42
+ "@effected/walker": "^0.25.1",
43
+ "@effected/workspaces": "^0.43.0",
44
44
  "@jridgewell/sourcemap-codec": "^1.6.0",
45
45
  "@microsoft/api-extractor": "^7.60.1",
46
46
  "@microsoft/tsdoc": "~0.17.1",
47
47
  "@microsoft/tsdoc-config": "~0.18.3",
48
- "@tsdoctor/manifest": "^0.3.0",
49
- "effect": "~4.1.1",
50
- "picocolors": "^1.1.1",
48
+ "@tsdoctor/manifest": "^0.4.0",
49
+ "effect": "~4.1.2",
51
50
  "tsdown": "^0.23.4",
52
51
  "typescript": "7.1.0-beta"
53
52
  }
@@ -1,6 +1,6 @@
1
1
  import { formatTime } from "../timer.js";
2
2
  import { ciFatalCallout, ciFatalCountForPackage, suppressedSummary } from "./diagnostics.js";
3
- import pc from "picocolors";
3
+ import { Sgr } from "@effected/env";
4
4
 
5
5
  // src/report/formatters/terminal.ts
6
6
  const fmtBytes = (n) => n < 1024 ? `${n} B` : `${(n / 1024).toFixed(2)} kB`;
@@ -12,40 +12,41 @@ const diagLine = (d) => {
12
12
  const TerminalFormatter = {
13
13
  format: "terminal",
14
14
  render: (reports, ctx) => {
15
- const color = (fn, s) => ctx.noColor ? s : fn(s);
15
+ const level = ctx.noColor ? "none" : "basic";
16
+ const color = (style, s) => Sgr.paint(level, style, s);
16
17
  const lines = [];
17
18
  let totalMs = 0;
18
19
  for (const r of reports) {
19
- lines.push(color(pc.bold, r.package));
20
+ lines.push(color("bold", r.package));
20
21
  for (const g of r.targetGroups) {
21
- const status = g.errors.length ? color(pc.red, "✗") : color(pc.green, "✓");
22
+ const status = g.errors.length ? color("red", "✗") : color("green", "✓");
22
23
  lines.push(` ${status} ${g.id} ${fileCount(g)} files · ${formatTime(g.timings.totalMs)}`);
23
24
  totalMs += g.timings.totalMs;
24
25
  if (ctx.verbose) for (const p of g.passes) {
25
- lines.push(` ${color(pc.dim, `${p.id} (${formatTime(p.ms)})`)}`);
26
+ lines.push(` ${color("dim", `${p.id} (${formatTime(p.ms)})`)}`);
26
27
  for (const f of p.files) {
27
28
  const gz = f.gzip !== void 0 ? ` │ gzip ${fmtBytes(f.gzip)}` : "";
28
29
  lines.push(` ${f.path} ${fmtBytes(f.bytes)}${gz}`);
29
30
  }
30
31
  }
31
- for (const e of g.errors) lines.push(` ${color(pc.red, "error")} ${diagLine(e)}`);
32
+ for (const e of g.errors) lines.push(` ${color("red", "error")} ${diagLine(e)}`);
32
33
  for (const w of g.warnings) {
33
- const tag = w.ciFatal === true ? color(pc.red, " [fails CI]") : "";
34
- lines.push(` ${color(pc.yellow, "warn")} ${diagLine(w)}${tag}`);
34
+ const tag = w.ciFatal === true ? color("red", " [fails CI]") : "";
35
+ lines.push(` ${color("yellow", "warn")} ${diagLine(w)}${tag}`);
35
36
  }
36
37
  if (g.suppressed.length > 0) {
37
- if (ctx.verbose) for (const s of g.suppressed) lines.push(` ${color(pc.dim, `suppressed ${s.code ?? "?"}`)} ${diagLine(s)}`);
38
- else lines.push(` ${color(pc.dim, `suppressed ${g.suppressed.length}: ${suppressedSummary(g.suppressed)}`)}`);
38
+ if (ctx.verbose) for (const s of g.suppressed) lines.push(` ${color("dim", `suppressed ${s.code ?? "?"}`)} ${diagLine(s)}`);
39
+ else lines.push(` ${color("dim", `suppressed ${g.suppressed.length}: ${suppressedSummary(g.suppressed)}`)}`);
39
40
  }
40
41
  }
41
42
  const fatal = ciFatalCountForPackage(r);
42
- if (fatal > 0) lines.push(` ${color(pc.red, ciFatalCallout(fatal))}`);
43
+ if (fatal > 0) lines.push(` ${color("red", ciFatalCallout(fatal))}`);
43
44
  }
44
45
  const pkgs = reports.length;
45
46
  if (pkgs > 0) {
46
47
  const pkgLabel = `${pkgs} package${pkgs === 1 ? "" : "s"}`;
47
48
  const hasErrors = reports.some((r) => r.targetGroups.some((g) => g.errors.length > 0));
48
- lines.push(hasErrors ? `${color(pc.red, "✗")} build failed · ${pkgLabel} · ${formatTime(totalMs)}` : `${color(pc.green, "✔")} build complete · ${pkgLabel} · ${formatTime(totalMs)}`);
49
+ lines.push(hasErrors ? `${color("red", "✗")} build failed · ${pkgLabel} · ${formatTime(totalMs)}` : `${color("green", "✔")} build complete · ${pkgLabel} · ${formatTime(totalMs)}`);
49
50
  }
50
51
  const content = lines.join("\n");
51
52
  return content === "" ? [] : [{
@@ -1,6 +1,7 @@
1
+ import { Sgr } from "@effected/env";
2
+
1
3
  // src/report/tsdown-logger.ts
2
- const ANSI = new RegExp(`${String.fromCharCode(27)}\\[[0-9;]*m`, "g");
3
- const join = (args) => args.map((a) => String(a)).join(" ").replace(ANSI, "").trim();
4
+ const join = (args) => Sgr.strip(args.map((a) => String(a)).join(" ")).trim();
4
5
  /**
5
6
  * Warnings that are advisory noise for THIS builder and go to the `suppressed` bucket (recorded
6
7
  * for accounting, never surfaced). rolldown-plugin-dts announces its tsgo generator as experimental