lemmafit 0.2.3 → 0.3.1

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.
@@ -10,13 +10,15 @@ const path = require('path');
10
10
  const { execSync } = require('child_process');
11
11
  const os = require('os');
12
12
 
13
- const DAFNY2JS_VERSION = '0.9.5';
13
+ const DAFNY2JS_VERSION = '0.10.0';
14
14
 
15
15
  const PLATFORM_RIDS = {
16
16
  'darwin-arm64': 'osx-arm64',
17
17
  'darwin-x64': 'osx-x64',
18
18
  'linux-x64': 'linux-x64',
19
19
  'linux-arm64': 'linux-arm64',
20
+ 'win32-x64': 'win-x64',
21
+ 'win32-arm64': 'win-x64',
20
22
  };
21
23
 
22
24
  function getPlatformKey() {
@@ -24,7 +26,7 @@ function getPlatformKey() {
24
26
  }
25
27
 
26
28
  function guessRid(platformKey) {
27
- return PLATFORM_RIDS[platformKey] || (platformKey === 'win32-x64' ? 'win-x64' : platformKey);
29
+ return PLATFORM_RIDS[platformKey] || platformKey;
28
30
  }
29
31
 
30
32
  function printBuildInstructions(rid) {
@@ -35,8 +37,9 @@ function printBuildInstructions(rid) {
35
37
  console.error(' cd dafny2js');
36
38
  console.error(` dotnet publish -c Release -r ${rid} --self-contained /p:PublishSingleFile=true`);
37
39
  console.error('');
40
+ const binaryName = os.platform() === 'win32' ? 'dafny2js.exe' : 'dafny2js';
38
41
  console.error('Then copy the binary to:');
39
- console.error(` ${path.join(installDir, 'dafny2js')}`);
42
+ console.error(` ${path.join(installDir, binaryName)}`);
40
43
  }
41
44
 
42
45
  function download(url, dest) {
@@ -92,7 +95,8 @@ async function main() {
92
95
  }
93
96
 
94
97
  const installDir = path.join(os.homedir(), '.lemmafit', '.dafny2js');
95
- const binaryPath = path.join(installDir, 'dafny2js');
98
+ const binaryName = os.platform() === 'win32' ? 'dafny2js.exe' : 'dafny2js';
99
+ const binaryPath = path.join(installDir, binaryName);
96
100
  const versionFile = path.join(installDir, 'version');
97
101
 
98
102
  // Check if correct version is already installed
package/lib/daemon.js CHANGED
@@ -30,10 +30,11 @@ class Daemon {
30
30
 
31
31
  // Shared cache paths (~/.lemmafit), with fallback to package-local
32
32
  const cacheDir = path.join(os.homedir(), '.lemmafit');
33
- const cacheDafny2js = path.join(cacheDir, '.dafny2js', 'dafny2js');
33
+ const dafny2jsBinName = os.platform() === 'win32' ? 'dafny2js.exe' : 'dafny2js';
34
+ const cacheDafny2js = path.join(cacheDir, '.dafny2js', dafny2jsBinName);
34
35
  this.dafny2jsBin = fs.existsSync(cacheDafny2js)
35
36
  ? cacheDafny2js
36
- : path.join(__dirname, '..', '.dafny2js', 'dafny2js');
37
+ : path.join(__dirname, '..', '.dafny2js', dafny2jsBinName);
37
38
  this.kernelPath = path.join(__dirname, '..', 'kernels', 'Replay.dfy');
38
39
 
39
40
  // Load or create config
@@ -64,13 +65,14 @@ class Daemon {
64
65
  }
65
66
 
66
67
  findDafny() {
68
+ const dafnyBinName = os.platform() === 'win32' ? 'Dafny.exe' : 'dafny';
67
69
  // Check shared cache directory first (~/.lemmafit)
68
- const cacheDafny = path.join(os.homedir(), '.lemmafit', '.dafny', 'dafny', 'dafny');
70
+ const cacheDafny = path.join(os.homedir(), '.lemmafit', '.dafny', 'dafny', dafnyBinName);
69
71
  if (fs.existsSync(cacheDafny)) {
70
72
  return cacheDafny;
71
73
  }
72
74
  // Check lemmafit package directory (fallback)
73
- const lemmafitDafny = path.join(__dirname, '..', '.dafny', 'dafny', 'dafny');
75
+ const lemmafitDafny = path.join(__dirname, '..', '.dafny', 'dafny', dafnyBinName);
74
76
  if (fs.existsSync(lemmafitDafny)) {
75
77
  return lemmafitDafny;
76
78
  }
@@ -18,6 +18,7 @@ const PLATFORM_ASSETS = {
18
18
  'linux-x64': `dafny-${DAFNY_VERSION}-x64-ubuntu-22.04.zip`,
19
19
  'linux-arm64': `dafny-${DAFNY_VERSION}-arm64-ubuntu-22.04.zip`,
20
20
  'win32-x64': `dafny-${DAFNY_VERSION}-x64-windows-2019.zip`,
21
+ 'win32-arm64': `dafny-${DAFNY_VERSION}-x64-windows-2019.zip`,
21
22
  };
22
23
 
23
24
  function getPlatformKey() {
@@ -83,7 +84,8 @@ async function main() {
83
84
  const cacheDir = path.join(os.homedir(), '.lemmafit');
84
85
  const installDir = path.join(cacheDir, '.dafny');
85
86
  const dafnyDir = path.join(installDir, 'dafny');
86
- const dafnyBin = path.join(dafnyDir, 'dafny');
87
+ const dafnyBinName = os.platform() === 'win32' ? 'Dafny.exe' : 'dafny';
88
+ const dafnyBin = path.join(dafnyDir, dafnyBinName);
87
89
  const versionFile = path.join(installDir, 'version');
88
90
 
89
91
  // Check if correct version is already installed
@@ -109,7 +111,11 @@ async function main() {
109
111
 
110
112
  // Extract
111
113
  console.log('Extracting...');
112
- execSync(`unzip -q -o "${zipPath}" -d "${installDir}"`, { stdio: 'inherit' });
114
+ if (os.platform() === 'win32') {
115
+ execSync(`tar -xf "${zipPath}" -C "${installDir}"`, { stdio: 'inherit' });
116
+ } else {
117
+ execSync(`unzip -q -o "${zipPath}" -d "${installDir}"`, { stdio: 'inherit' });
118
+ }
113
119
 
114
120
  // Clean up zip
115
121
  fs.unlinkSync(zipPath);
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "verified",
16
16
  "proof"
17
17
  ],
18
- "version": "0.2.3",
18
+ "version": "0.3.1",
19
19
  "type": "commonjs",
20
20
  "files": [
21
21
  "cli/",