@lgtm-hq/lintro 0.155.0 → 0.156.0

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/lib/resolve.js +38 -1
  2. package/package.json +4 -5
package/lib/resolve.js CHANGED
@@ -18,11 +18,29 @@
18
18
  */
19
19
  const PLATFORM_PACKAGES = Object.freeze({
20
20
  'darwin-arm64': '@lgtm-hq/lintro-darwin-arm64',
21
- 'darwin-x64': '@lgtm-hq/lintro-darwin-x64',
22
21
  'linux-arm64': '@lgtm-hq/lintro-linux-arm64',
23
22
  'linux-x64': '@lgtm-hq/lintro-linux-x64',
24
23
  });
25
24
 
25
+ /**
26
+ * Platforms that ship no npm binary but have a supported install route
27
+ * elsewhere. Intel macOS lost its prebuilt binary in #2579: the `cryptography`
28
+ * dependency the MCP bundle needs ships no Intel macOS wheel from 49.0.0 on.
29
+ * Homebrew is the recommended route there because the formula's `on_intel`
30
+ * branch owns the PyPI install; a bare `pip install` works too but compiles
31
+ * cryptography from source, which needs a Rust toolchain on the machine.
32
+ *
33
+ * @type {Readonly<Record<string, string>>}
34
+ */
35
+ const UNSUPPORTED_PLATFORM_HINTS = Object.freeze({
36
+ 'darwin-x64':
37
+ 'Intel Macs have no npm binary. Install with Homebrew ' +
38
+ '(`brew tap lgtm-hq/tap && brew install lintro`), which is the ' +
39
+ 'recommended route. Installing from PyPI (`pip install lintro` or ' +
40
+ '`uv tool install lintro`) also works, but on an Intel Mac it builds ' +
41
+ 'cryptography from source and needs a Rust toolchain.',
42
+ });
43
+
26
44
  /**
27
45
  * Resolve the scoped package name for a platform/arch pair.
28
46
  *
@@ -38,6 +56,21 @@ function packageForPlatform(platform, arch) {
38
56
  : null;
39
57
  }
40
58
 
59
+ /**
60
+ * Explain why a platform has no npm binary and where to install from.
61
+ *
62
+ * @param {string} platform - Value of `process.platform` (e.g. `"darwin"`).
63
+ * @param {string} arch - Value of `process.arch` (e.g. `"x64"`).
64
+ * @returns {string | null} A one-line pointer to another install route, or
65
+ * `null` when the platform has none documented.
66
+ */
67
+ function unsupportedPlatformHint(platform, arch) {
68
+ const key = `${platform}-${arch}`;
69
+ return Object.prototype.hasOwnProperty.call(UNSUPPORTED_PLATFORM_HINTS, key)
70
+ ? UNSUPPORTED_PLATFORM_HINTS[key]
71
+ : null;
72
+ }
73
+
41
74
  /**
42
75
  * List of platform keys supported by the current distribution.
43
76
  *
@@ -65,8 +98,10 @@ function resolveBinary(requireFn, platform, arch) {
65
98
  const pkg = packageForPlatform(plat, cpu);
66
99
 
67
100
  if (!pkg) {
101
+ const hint = unsupportedPlatformHint(plat, cpu);
68
102
  throw new Error(
69
103
  `lintro: unsupported platform ${plat}-${cpu}. ` +
104
+ (hint ? `${hint} ` : '') +
70
105
  `Supported platforms: ${supportedPlatforms().join(', ')}.`
71
106
  );
72
107
  }
@@ -98,7 +133,9 @@ function resolveBinary(requireFn, platform, arch) {
98
133
 
99
134
  module.exports = {
100
135
  PLATFORM_PACKAGES,
136
+ UNSUPPORTED_PLATFORM_HINTS,
101
137
  packageForPlatform,
138
+ unsupportedPlatformHint,
102
139
  supportedPlatforms,
103
140
  resolveBinary,
104
141
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lgtm-hq/lintro",
3
- "version": "0.155.0",
3
+ "version": "0.156.0",
4
4
  "description": "A unified CLI for code formatting, linting, and quality assurance. Ships self-contained platform binaries — no Python required.",
5
5
  "keywords": [
6
6
  "lint",
@@ -30,10 +30,9 @@
30
30
  "lib/resolve.js"
31
31
  ],
32
32
  "optionalDependencies": {
33
- "@lgtm-hq/lintro-darwin-arm64": "0.155.0",
34
- "@lgtm-hq/lintro-darwin-x64": "0.155.0",
35
- "@lgtm-hq/lintro-linux-arm64": "0.155.0",
36
- "@lgtm-hq/lintro-linux-x64": "0.155.0"
33
+ "@lgtm-hq/lintro-darwin-arm64": "0.156.0",
34
+ "@lgtm-hq/lintro-linux-arm64": "0.156.0",
35
+ "@lgtm-hq/lintro-linux-x64": "0.156.0"
37
36
  },
38
37
  "engines": {
39
38
  "node": ">=18"