@foundry-rs/chisel 1.4.4-nightly.20251029.b1964f9 → 1.4.4-nightly.20251030.6d94888

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/bin.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { BINARY_NAME, colors, KNOWN_TOOLS, PLATFORM_SPECIFIC_PACKAGE_NAME, resolveTargetTool } from './postinstall.mjs'
1
+ import { BINARY_NAME, colors, KNOWN_TOOLS, PLATFORM_SPECIFIC_PACKAGE_NAME, resolveTargetTool } from '#const.mjs'
2
2
  import * as NodeChildProcess from 'node:child_process'
3
3
  import * as NodeFS from 'node:fs'
4
4
  import * as NodeModule from 'node:module'
@@ -6,7 +6,7 @@ import * as NodePath from 'node:path'
6
6
  import { fileURLToPath } from 'node:url'
7
7
 
8
8
  /**
9
- * @typedef {import('./postinstall.mjs').Tool} Tool
9
+ * @typedef {import('#const.mjs').Tool} Tool
10
10
  */
11
11
 
12
12
  const require = NodeModule.createRequire(import.meta.url)
package/const.mjs ADDED
@@ -0,0 +1,87 @@
1
+ import * as NodePath from 'node:path'
2
+
3
+ /**
4
+ * @typedef {'amd64' | 'arm64'} Arch
5
+ * @typedef {'linux' | 'darwin' | 'win32'} Platform
6
+ * @typedef {'forge' | 'cast' | 'anvil' | 'chisel'} Tool
7
+ * @typedef {'debug' | 'release' | 'maxperf'} Profile
8
+ */
9
+
10
+ /** @type {readonly Tool[]} */
11
+ export const KNOWN_TOOLS = Object.freeze(['forge', 'cast', 'anvil', 'chisel'])
12
+
13
+ const TOOL_SET = new Set(KNOWN_TOOLS)
14
+
15
+ /**
16
+ * @param {string | undefined} [raw]
17
+ * @returns {Tool}
18
+ *
19
+ * could be process.argv[2]
20
+ */
21
+ export function resolveTargetTool(raw = process.env.TARGET_TOOL || process.argv[2]) {
22
+ const value = typeof raw === 'string' ? raw.trim() : ''
23
+ if (!value)
24
+ throw new Error('TARGET_TOOL must be set to one of: ' + KNOWN_TOOLS.join(', '))
25
+ if (value !== NodePath.basename(value) || value.includes('..') || value.includes('/') || value.includes('\\'))
26
+ throw new Error('TARGET_TOOL contains invalid path segments')
27
+ // @ts-expect-error _
28
+ if (!TOOL_SET.has(value))
29
+ throw new Error(`TARGET_TOOL "${value}" is not supported. Expected: ${KNOWN_TOOLS.join(', ')}`)
30
+ return /** @type {Tool} */ (value)
31
+ }
32
+
33
+ export function getRegistryUrl() {
34
+ // Prefer npm's configured registry (works with Verdaccio and custom registries)
35
+ // Fallback to REGISTRY_URL for tests/dev, then npmjs
36
+ return (
37
+ process.env.npm_config_registry
38
+ || process.env.REGISTRY_URL
39
+ || 'https://registry.npmjs.org'
40
+ )
41
+ }
42
+
43
+ /**
44
+ * @param {Tool} tool
45
+ * @returns {Record<Platform, Record<string, string>>}
46
+ */
47
+ export const BINARY_DISTRIBUTION_PACKAGES = tool => ({
48
+ darwin: {
49
+ x64: `@foundry-rs/${tool}-darwin-amd64`,
50
+ arm64: `@foundry-rs/${tool}-darwin-arm64`
51
+ },
52
+ linux: {
53
+ x64: `@foundry-rs/${tool}-linux-amd64`,
54
+ arm64: `@foundry-rs/${tool}-linux-arm64`
55
+ },
56
+ win32: {
57
+ x64: `@foundry-rs/${tool}-win32-amd64`
58
+ }
59
+ })
60
+
61
+ /**
62
+ * @param {Tool} tool
63
+ * @returns {string}
64
+ */
65
+ export const BINARY_NAME = tool => process.platform === 'win32' ? `${tool}.exe` : tool
66
+
67
+ /**
68
+ * @param {Tool} tool
69
+ * @returns {string | undefined}
70
+ */
71
+ export const PLATFORM_SPECIFIC_PACKAGE_NAME = tool => {
72
+ // @ts-ignore
73
+ const platformPackages = BINARY_DISTRIBUTION_PACKAGES(tool)[process.platform]
74
+ if (!platformPackages) return undefined
75
+ return platformPackages?.[process.arch]
76
+ }
77
+
78
+ export const colors = {
79
+ red: '\x1b[31m',
80
+ green: '\x1b[32m',
81
+ yellow: '\x1b[33m',
82
+ blue: '\x1b[34m',
83
+ magenta: '\x1b[35m',
84
+ cyan: '\x1b[36m',
85
+ white: '\x1b[37m',
86
+ reset: '\x1b[0m'
87
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@foundry-rs/chisel",
3
- "version": "1.4.4-nightly.20251029.b1964f9",
3
+ "version": "1.4.4-nightly.20251030.6d94888",
4
4
  "type": "module",
5
5
  "homepage": "https://getfoundry.sh/chisel",
6
6
  "description": "Chisel is a fast, utilitarian, and verbose Solidity REPL",
@@ -9,17 +9,18 @@
9
9
  },
10
10
  "files": [
11
11
  "bin.mjs",
12
+ "const.mjs",
12
13
  "postinstall.mjs"
13
14
  ],
14
15
  "scripts": {
15
16
  "postinstall": "node ./postinstall.mjs"
16
17
  },
17
18
  "optionalDependencies": {
18
- "@foundry-rs/chisel-darwin-arm64": "1.4.4-nightly.20251029.b1964f9",
19
- "@foundry-rs/chisel-darwin-amd64": "1.4.4-nightly.20251029.b1964f9",
20
- "@foundry-rs/chisel-linux-arm64": "1.4.4-nightly.20251029.b1964f9",
21
- "@foundry-rs/chisel-linux-amd64": "1.4.4-nightly.20251029.b1964f9",
22
- "@foundry-rs/chisel-win32-amd64": "1.4.4-nightly.20251029.b1964f9"
19
+ "@foundry-rs/chisel-darwin-arm64": "1.4.4-nightly.20251030.6d94888",
20
+ "@foundry-rs/chisel-darwin-amd64": "1.4.4-nightly.20251030.6d94888",
21
+ "@foundry-rs/chisel-linux-arm64": "1.4.4-nightly.20251030.6d94888",
22
+ "@foundry-rs/chisel-linux-amd64": "1.4.4-nightly.20251030.6d94888",
23
+ "@foundry-rs/chisel-win32-amd64": "1.4.4-nightly.20251030.6d94888"
23
24
  },
24
25
  "publishConfig": {
25
26
  "access": "public",
@@ -32,6 +33,6 @@
32
33
  "url": "https://github.com/foundry-rs/foundry"
33
34
  },
34
35
  "imports": {
35
- "#const.mjs": "./postinstall.mjs"
36
+ "#const.mjs": "./const.mjs"
36
37
  }
37
38
  }
package/postinstall.mjs CHANGED
@@ -12,7 +12,7 @@ import * as NodeZlib from "node:zlib";
12
12
  import * as NodePath from "node:path";
13
13
  var KNOWN_TOOLS = Object.freeze(["forge", "cast", "anvil", "chisel"]);
14
14
  var TOOL_SET = new Set(KNOWN_TOOLS);
15
- function resolveTargetTool(raw = process.env.TARGET_TOOL) {
15
+ function resolveTargetTool(raw = process.env.TARGET_TOOL || process.argv[2]) {
16
16
  const value = typeof raw === "string" ? raw.trim() : "";
17
17
  if (!value)
18
18
  throw new Error("TARGET_TOOL must be set to one of: " + KNOWN_TOOLS.join(", "));