typeslayer 0.1.7 → 0.1.9

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/README.md CHANGED
@@ -28,22 +28,36 @@ in the root package you want to inspect (i.e. colocated to your package.json). T
28
28
  - will this support monorepos?
29
29
  - that's the hope. one step at a time.
30
30
  - why isn't this just a CLI tool?
31
- - A goal of the project is show intuitive/beautiful interactive visualizations like treemaps and force graphs, inherently not something a terminal can provide.
32
- - I don't like CLI tools. I view them as a last resort, at this point in engineering history. If you're someone that stays up late into the night staring at your dotfiles from neovim... I'm happy for you. Be happy for me too?
31
+ - a goal of the project is show intuitive/beautiful interactive visualizations like treemaps and force graphs, inherently not something a terminal can provide.
32
+ - I don't like CLI tools. I view them as a last resort, at this point in engineering history. if you're someone that stays up late into the night staring at your dotfiles from neovim... I'm happy for you. be happy for me too?
33
33
  - will this work with ts-go?
34
34
  - that's the hope but it ain't ready yet on the ts-go side
35
35
 
36
+ # Who needs this stupid thing, anyway?
37
+
38
+ TypeSlayer is one of those things that most developers don't need. others might just find it lulzy to play around with.
39
+
40
+ but then there's the power users. the library authors. the people attending SquiggleConf. you know the kind.
41
+
42
+ for the people pushing the boundaries of TypeScript (or at companies doing so intentionally or not), a tool like this is something we haven't seen before. there were ways to trash _hours_ messing with multi-hundred-megabyte JSON files. and that's not even counting the time required to learn how the TypeScript compiler works so you can understand the problem... it's a lot.
43
+
44
+ consider the fact that this can sometimes feel like an impossible task for a library author because the code that actually exercises the library isn't directly accessible - it's in the _library user_'s code (which is usually private).
45
+
46
+ I made TypeSlayer because I learned delulu-levels-of-detail about TypeScript performance tuning [while getting Doom to run in TypeScript types](https://youtu.be/0mCsluv5FXA), yet many of those techniques are still opaque to most people.
47
+
48
+ I wanted to make it easy for others to put up PRs at their companies all like "I increased type-checking perf on this file by 380,000x and shaved 23 seconds off every CI run" (real story btw lol). I took what I learned about how to debug type performance and wrapped it all up into this tool.
49
+
36
50
  ## Data / Security
37
51
 
38
52
  TypeSlayer supports Linux x64, macOS x64 (Intel), macOS ARM64 (Apple Silicon), and Windows x64. Please note that next year is the year of the Linux desktop.
39
53
 
40
- TypeSlayer currently does not collect any analytics - although it probably will try to collect "someone somewhere ran it at XYZ timestamp" data in the future. All data is stored:
54
+ TypeSlayer currently does not collect any analytics - although it probably will try to collect "someone somewhere ran it at XYZ timestamp" data in the future. all data is stored:
41
55
 
42
56
  - Linux: `~/.local/share/typeslayer/`
43
57
  - macOS: `~/Library/Application Support/typeslayer/`
44
58
  - Windows: `%APPDATA%\typeslayer\`
45
59
 
46
- This tool can read any file the running user can read and it can run package.json scripts (so treat it as you would your terminal).
60
+ TypeSlayer can read any file the running user can read and it can run package.json scripts (so treat it as you would your terminal).
47
61
 
48
62
  ## Contributing
49
63
 
@@ -52,4 +66,4 @@ This tool can read any file the running user can read and it can run package.jso
52
66
 
53
67
  ## Thank You
54
68
 
55
- This app is built with Tauri, TanStack, Vite, React, MUI, and of course, TypeScript.
69
+ this app is built with Tauri, TanStack, Vite, Biome, React, MUI, Rust, and of course, TypeScript.
package/bin/typeslayer.js CHANGED
@@ -14,68 +14,68 @@ const userCwd = process.cwd();
14
14
 
15
15
  // Get the binary path based on platform
16
16
  const getBinaryInfo = () => {
17
- const plat = platform();
18
- const architecture = arch();
17
+ const plat = platform();
18
+ const architecture = arch();
19
19
 
20
- let platformDir, binaryName;
20
+ let platformDir, binaryName;
21
21
 
22
- if (plat === "linux" && architecture === "x64") {
23
- platformDir = "linux-x64";
24
- binaryName = "typeslayer";
25
- } else if (plat === "darwin" && architecture === "arm64") {
26
- platformDir = "darwin-arm64";
27
- binaryName = "typeslayer";
28
- } else if (plat === "win32" && architecture === "x64") {
29
- platformDir = "win32-x64";
30
- binaryName = "typeslayer.exe";
31
- } else {
32
- throw new Error(`Unsupported platform: ${plat}-${architecture}`);
33
- }
22
+ if (plat === "linux" && architecture === "x64") {
23
+ platformDir = "linux-x64";
24
+ binaryName = "typeslayer";
25
+ } else if (plat === "darwin" && architecture === "arm64") {
26
+ platformDir = "darwin-arm64";
27
+ binaryName = "typeslayer";
28
+ } else if (plat === "win32" && architecture === "x64") {
29
+ platformDir = "win32-x64";
30
+ binaryName = "typeslayer.exe";
31
+ } else {
32
+ throw new Error(`Unsupported platform: ${plat}-${architecture}`);
33
+ }
34
34
 
35
- return {
36
- path: join(__dirname, "..", "binaries", platformDir, binaryName),
37
- platform: `${plat}-${architecture}`,
38
- };
35
+ return {
36
+ path: join(__dirname, "..", "binaries", platformDir, binaryName),
37
+ platform: `${plat}-${architecture}`,
38
+ };
39
39
  };
40
40
 
41
41
  try {
42
- const binaryInfo = getBinaryInfo();
42
+ const binaryInfo = getBinaryInfo();
43
43
 
44
- if (!existsSync(binaryInfo.path)) {
45
- console.error(
46
- `\n⚠️ Binary not found for ${binaryInfo.platform}. Attempting download...`,
47
- );
48
- const postinstallPath = join(__dirname, "..", "scripts", "postinstall.js");
49
- const res = spawnSync(process.execPath, [postinstallPath], {
50
- stdio: "inherit",
51
- env: process.env,
52
- });
53
- if (res.status !== 0) {
54
- console.error("\n❌ Failed to download platform binary.");
55
- }
56
- if (!existsSync(binaryInfo.path)) {
57
- console.error(
58
- `\n❌ Binary still unavailable at ${binaryInfo.path}. Please check the release assets or your network.`,
59
- );
60
- console.error(
61
- "You can manually download from: https://github.com/dimitropoulos/typeslayer/releases",
62
- );
63
- process.exit(1);
64
- }
65
- }
44
+ if (!existsSync(binaryInfo.path)) {
45
+ console.error(
46
+ `\n⚠️ Binary not found for ${binaryInfo.platform}. Attempting download...`,
47
+ );
48
+ const postinstallPath = join(__dirname, "..", "scripts", "postinstall.js");
49
+ const res = spawnSync(process.execPath, [postinstallPath], {
50
+ stdio: "inherit",
51
+ env: process.env,
52
+ });
53
+ if (res.status !== 0) {
54
+ console.error("\n❌ Failed to download platform binary.");
55
+ }
56
+ if (!existsSync(binaryInfo.path)) {
57
+ console.error(
58
+ `\n❌ Binary still unavailable at ${binaryInfo.path}. Please check the release assets or your network.`,
59
+ );
60
+ console.error(
61
+ "You can manually download from: https://github.com/dimitropoulos/typeslayer/releases",
62
+ );
63
+ process.exit(1);
64
+ }
65
+ }
66
66
 
67
- const proc = spawn(binaryInfo.path, [], {
68
- stdio: "inherit",
69
- env: {
70
- ...process.env,
71
- USER_CWD: userCwd,
72
- },
73
- });
67
+ const proc = spawn(binaryInfo.path, [], {
68
+ stdio: "inherit",
69
+ env: {
70
+ ...process.env,
71
+ USER_CWD: userCwd,
72
+ },
73
+ });
74
74
 
75
- proc.on("exit", (code) => {
76
- process.exit(code || 0);
77
- });
75
+ proc.on("exit", code => {
76
+ process.exit(code || 0);
77
+ });
78
78
  } catch (error) {
79
- console.error("Error:", error.message);
80
- process.exit(1);
79
+ console.error("Error:", error.message);
80
+ process.exit(1);
81
81
  }
package/package.json CHANGED
@@ -1,55 +1,53 @@
1
1
  {
2
- "name": "typeslayer",
3
- "version": "0.1.7",
4
- "description": "Slay your TypeScript types",
5
- "private": false,
6
- "type": "module",
7
- "keywords": [
8
- "typescript",
9
- "ts",
10
- "tauri",
11
- "desktop",
12
- "benchmarking",
13
- "performance"
14
- ],
15
- "author": "Dimitri Mitropoulos",
16
- "license": "MIT",
17
- "repository": {
18
- "type": "git",
19
- "url": "https://github.com/dimitropoulos/typeslayer.git",
20
- "directory": "packages/typeslayer"
21
- },
22
- "bugs": {
23
- "url": "https://github.com/dimitropoulos/typeslayer/issues"
24
- },
25
- "homepage": "https://github.com/dimitropoulos/typeslayer#readme",
26
- "bin": {
27
- "typeslayer": "bin/typeslayer.js"
28
- },
29
- "files": [
30
- "bin",
31
- "scripts"
32
- ],
33
- "os": [
34
- "linux",
35
- "darwin",
36
- "win32"
37
- ],
38
- "cpu": [
39
- "x64",
40
- "arm64"
41
- ],
42
- "engines": {
43
- "node": ">=24.0.0",
44
- "pnpm": ">=10.0.0"
45
- },
46
- "packageManager": "pnpm@10.6.5",
47
- "scripts": {
48
- "postinstall": "node scripts/postinstall.js"
49
- },
50
- "optionalDependencies": {
51
- "@typeslayer/linux-x64": "0.1.7",
52
- "@typeslayer/darwin-arm64": "0.1.7",
53
- "@typeslayer/win32-x64": "0.1.7"
54
- }
2
+ "name": "typeslayer",
3
+ "version": "0.1.9",
4
+ "description": "Slay your TypeScript types",
5
+ "private": false,
6
+ "type": "module",
7
+ "keywords": [
8
+ "typescript",
9
+ "ts",
10
+ "tauri",
11
+ "desktop",
12
+ "benchmarking",
13
+ "performance"
14
+ ],
15
+ "author": "Dimitri Mitropoulos",
16
+ "license": "MIT",
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "https://github.com/dimitropoulos/typeslayer.git",
20
+ "directory": "packages/typeslayer"
21
+ },
22
+ "bugs": {
23
+ "url": "https://github.com/dimitropoulos/typeslayer/issues"
24
+ },
25
+ "homepage": "https://github.com/dimitropoulos/typeslayer#readme",
26
+ "bin": {
27
+ "typeslayer": "bin/typeslayer.js"
28
+ },
29
+ "files": [
30
+ "bin",
31
+ "scripts"
32
+ ],
33
+ "os": [
34
+ "linux",
35
+ "darwin",
36
+ "win32"
37
+ ],
38
+ "cpu": [
39
+ "x64",
40
+ "arm64"
41
+ ],
42
+ "engines": {
43
+ "node": ">=24.0.0"
44
+ },
45
+ "scripts": {
46
+ "postinstall": "node scripts/postinstall.js"
47
+ },
48
+ "optionalDependencies": {
49
+ "@typeslayer/linux-x64": "0.1.9",
50
+ "@typeslayer/darwin-arm64": "0.1.9",
51
+ "@typeslayer/win32-x64": "0.1.9"
52
+ }
55
53
  }
@@ -15,116 +15,116 @@ const PACKAGE_VERSION = process.env.npm_package_version;
15
15
 
16
16
  // Allow CI or callers to skip binary download (release assets may not exist yet in same run)
17
17
  if (process.env.TYPESLAYER_SKIP_POSTINSTALL) {
18
- console.log(
19
- "⏭️ Skipping typeslayer binary download (TYPESLAYER_SKIP_POSTINSTALL set).",
20
- );
21
- process.exit(0);
18
+ console.log(
19
+ "⏭️ Skipping typeslayer binary download (TYPESLAYER_SKIP_POSTINSTALL set).",
20
+ );
21
+ process.exit(0);
22
22
  }
23
23
 
24
24
  const getBinaryInfo = () => {
25
- const plat = platform();
26
- const architecture = arch();
27
-
28
- let platformDir, binaryName, npmPackage;
29
-
30
- if (plat === "linux" && architecture === "x64") {
31
- platformDir = "linux-x64";
32
- binaryName = "typeslayer";
33
- npmPackage = "@typeslayer/linux-x64";
34
- } else if (plat === "darwin" && architecture === "arm64") {
35
- platformDir = "darwin-arm64";
36
- binaryName = "typeslayer";
37
- npmPackage = "@typeslayer/darwin-arm64";
38
- } else if (plat === "win32" && architecture === "x64") {
39
- platformDir = "win32-x64";
40
- binaryName = "typeslayer.exe";
41
- npmPackage = "@typeslayer/win32-x64";
42
- } else {
43
- console.warn(`⚠️ Platform ${plat}-${architecture} is not supported`);
44
- process.exit(0); // Don't fail the install, just skip
45
- }
46
-
47
- return { platformDir, binaryName, npmPackage };
25
+ const plat = platform();
26
+ const architecture = arch();
27
+
28
+ let platformDir, binaryName, npmPackage;
29
+
30
+ if (plat === "linux" && architecture === "x64") {
31
+ platformDir = "linux-x64";
32
+ binaryName = "typeslayer";
33
+ npmPackage = "@typeslayer/linux-x64";
34
+ } else if (plat === "darwin" && architecture === "arm64") {
35
+ platformDir = "darwin-arm64";
36
+ binaryName = "typeslayer";
37
+ npmPackage = "@typeslayer/darwin-arm64";
38
+ } else if (plat === "win32" && architecture === "x64") {
39
+ platformDir = "win32-x64";
40
+ binaryName = "typeslayer.exe";
41
+ npmPackage = "@typeslayer/win32-x64";
42
+ } else {
43
+ console.warn(`⚠️ Platform ${plat}-${architecture} is not supported`);
44
+ process.exit(0); // Don't fail the install, just skip
45
+ }
46
+
47
+ return { platformDir, binaryName, npmPackage };
48
48
  };
49
49
 
50
50
  (async () => {
51
- try {
52
- const { platformDir, binaryName, npmPackage } = getBinaryInfo();
53
- const binariesDir = join(__dirname, "..", "binaries", platformDir);
54
- const binaryPath = join(binariesDir, binaryName);
55
-
56
- // Skip if binary already exists
57
- if (existsSync(binaryPath)) {
58
- console.log("✅ Binary already present, skipping download");
59
- return;
60
- }
61
-
62
- // Create directory if it doesn't exist
63
- mkdirSync(binariesDir, { recursive: true });
64
-
65
- // First, try to use the optionalDependency (esbuild pattern)
66
- // This is the primary mechanism - npm installs the right platform package automatically
67
- let binaryFound = false;
68
- try {
69
- const optionalPkgPath = require.resolve(`${npmPackage}/package.json`);
70
- const optionalBinaryPath = join(dirname(optionalPkgPath), binaryName);
71
- if (existsSync(optionalBinaryPath)) {
72
- console.log(`📦 Using ${npmPackage} from optionalDependencies...`);
73
- const fs = await import("node:fs/promises");
74
- await fs.copyFile(optionalBinaryPath, binaryPath);
75
- if (process.platform !== "win32") {
76
- chmodSync(binaryPath, 0o755);
77
- }
78
- console.log("✅ Binary copied successfully");
79
- binaryFound = true;
80
- }
81
- } catch {
82
- // optionalDependency not available - fall back to downloading
83
- console.warn(
84
- `⚠️ ${npmPackage} not found in optionalDependencies (may have been installed with --no-optional flag)`,
85
- );
86
- }
87
-
88
- if (!binaryFound) {
89
- // Fallback: Install the platform-specific binary package from npm
90
- console.log(`📦 Downloading ${npmPackage}@${PACKAGE_VERSION}...`);
91
- execSync(`npm install --no-save "${npmPackage}@${PACKAGE_VERSION}"`, {
92
- stdio: "inherit",
93
- });
94
-
95
- // Copy the binary from node_modules to our binaries directory
96
- const nodeModulesBinaryPath = join(
97
- __dirname,
98
- "..",
99
- "..",
100
- "..",
101
- "node_modules",
102
- npmPackage.replace("@", "").replace("/", "-"),
103
- binaryName,
104
- );
105
-
106
- if (!existsSync(nodeModulesBinaryPath)) {
107
- throw new Error(
108
- `Binary not found at ${nodeModulesBinaryPath} after npm install`,
109
- );
110
- }
111
-
112
- // Copy and make executable
113
- const fs = await import("node:fs/promises");
114
- await fs.copyFile(nodeModulesBinaryPath, binaryPath);
115
-
116
- if (process.platform !== "win32") {
117
- chmodSync(binaryPath, 0o755);
118
- }
119
-
120
- console.log("✅ Binary installed successfully");
121
- }
122
- } catch (error) {
123
- console.error("❌ Failed to download binary:", error.message);
124
- console.error(
125
- "You can manually download the binary from: https://github.com/dimitropoulos/typeslayer/releases",
126
- );
127
- // Don't fail the install, just warn
128
- process.exit(0);
129
- }
51
+ try {
52
+ const { platformDir, binaryName, npmPackage } = getBinaryInfo();
53
+ const binariesDir = join(__dirname, "..", "binaries", platformDir);
54
+ const binaryPath = join(binariesDir, binaryName);
55
+
56
+ // Skip if binary already exists
57
+ if (existsSync(binaryPath)) {
58
+ console.log("✅ Binary already present, skipping download");
59
+ return;
60
+ }
61
+
62
+ // Create directory if it doesn't exist
63
+ mkdirSync(binariesDir, { recursive: true });
64
+
65
+ // First, try to use the optionalDependency (esbuild pattern)
66
+ // This is the primary mechanism - npm installs the right platform package automatically
67
+ let binaryFound = false;
68
+ try {
69
+ const optionalPkgPath = require.resolve(`${npmPackage}/package.json`);
70
+ const optionalBinaryPath = join(dirname(optionalPkgPath), binaryName);
71
+ if (existsSync(optionalBinaryPath)) {
72
+ console.log(`📦 Using ${npmPackage} from optionalDependencies...`);
73
+ const fs = await import("node:fs/promises");
74
+ await fs.copyFile(optionalBinaryPath, binaryPath);
75
+ if (process.platform !== "win32") {
76
+ chmodSync(binaryPath, 0o755);
77
+ }
78
+ console.log("✅ Binary copied successfully");
79
+ binaryFound = true;
80
+ }
81
+ } catch {
82
+ // optionalDependency not available - fall back to downloading
83
+ console.warn(
84
+ `⚠️ ${npmPackage} not found in optionalDependencies (may have been installed with --no-optional flag)`,
85
+ );
86
+ }
87
+
88
+ if (!binaryFound) {
89
+ // Fallback: Install the platform-specific binary package from npm
90
+ console.log(`📦 Downloading ${npmPackage}@${PACKAGE_VERSION}...`);
91
+ execSync(`npm install --no-save "${npmPackage}@${PACKAGE_VERSION}"`, {
92
+ stdio: "inherit",
93
+ });
94
+
95
+ // Copy the binary from node_modules to our binaries directory
96
+ const nodeModulesBinaryPath = join(
97
+ __dirname,
98
+ "..",
99
+ "..",
100
+ "..",
101
+ "node_modules",
102
+ npmPackage.replace("@", "").replace("/", "-"),
103
+ binaryName,
104
+ );
105
+
106
+ if (!existsSync(nodeModulesBinaryPath)) {
107
+ throw new Error(
108
+ `Binary not found at ${nodeModulesBinaryPath} after npm install`,
109
+ );
110
+ }
111
+
112
+ // Copy and make executable
113
+ const fs = await import("node:fs/promises");
114
+ await fs.copyFile(nodeModulesBinaryPath, binaryPath);
115
+
116
+ if (process.platform !== "win32") {
117
+ chmodSync(binaryPath, 0o755);
118
+ }
119
+
120
+ console.log("✅ Binary installed successfully");
121
+ }
122
+ } catch (error) {
123
+ console.error("❌ Failed to download binary:", error.message);
124
+ console.error(
125
+ "You can manually download the binary from: https://github.com/dimitropoulos/typeslayer/releases",
126
+ );
127
+ // Don't fail the install, just warn
128
+ process.exit(0);
129
+ }
130
130
  })();