@delance/runtime 2024.2.104 → 2024.2.106
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/dist/langserver.cjs +1 -1
- package/install.mjs +77 -46
- package/package.json +2 -2
package/dist/langserver.cjs
CHANGED
package/install.mjs
CHANGED
|
@@ -4,6 +4,7 @@ import assert, {AssertionError} from 'node:assert';
|
|
|
4
4
|
import {subtle} from 'node:crypto';
|
|
5
5
|
import fs from 'node:fs/promises';
|
|
6
6
|
import path from 'node:path';
|
|
7
|
+
import process from 'node:process';
|
|
7
8
|
import delance from '@delance/builder';
|
|
8
9
|
import {BlobReader, BlobWriter, TextWriter, ZipReader} from '@zip.js/zip.js';
|
|
9
10
|
import pMap from 'p-map';
|
|
@@ -33,60 +34,87 @@ if (processed) {
|
|
|
33
34
|
process.exit();
|
|
34
35
|
}
|
|
35
36
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
const extension = reverse('ecnalyp-edocsv');
|
|
37
|
+
/** @type {Blob?} */
|
|
38
|
+
let vsix = null;
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
headers: {
|
|
51
|
-
'User-Agent': 'Mozilla/5.0 (Delance) Gecko/20100101 Firefox/120.0',
|
|
52
|
-
},
|
|
53
|
-
credentials: 'include',
|
|
54
|
-
redirect: 'follow',
|
|
55
|
-
referrer: items.href,
|
|
56
|
-
});
|
|
40
|
+
if (process.env.DELANCE_VSIX) {
|
|
41
|
+
try {
|
|
42
|
+
vsix = new Blob([await fs.readFile(process.env.DELANCE_VSIX)]);
|
|
43
|
+
const hash = Array.from(
|
|
44
|
+
new Uint8Array(
|
|
45
|
+
await subtle.digest('SHA-256', await vsix.arrayBuffer()),
|
|
46
|
+
),
|
|
47
|
+
)
|
|
48
|
+
.map((b) => b.toString(16).padStart(2, '0'))
|
|
49
|
+
.join('');
|
|
57
50
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
if (
|
|
61
|
-
|
|
51
|
+
assert.equal(hash, pkg.delance.sha256, 'sha256 mismatch');
|
|
52
|
+
} catch (e) {
|
|
53
|
+
if (/** @type {Error & {syscall: string}} */ (e)?.syscall === 'open') {
|
|
54
|
+
console.error(e);
|
|
55
|
+
} else {
|
|
56
|
+
throw e;
|
|
62
57
|
}
|
|
63
58
|
}
|
|
59
|
+
}
|
|
64
60
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
61
|
+
if (!vsix) {
|
|
62
|
+
const baseURL = new URL(reverse('/moc.oidutslausiv.ecalptekram//:sptth'));
|
|
63
|
+
const publisher = reverse('nohtyp-sm');
|
|
64
|
+
const extension = reverse('ecnalyp-edocsv');
|
|
65
|
+
|
|
66
|
+
const items = new URL(`/items?itemName=${publisher}.${extension}`, baseURL);
|
|
67
|
+
const download = new URL(
|
|
68
|
+
`/_apis/public/gallery/publishers/${publisher}/vsextensions/${extension}/${pkg.version}/vspackage`,
|
|
69
|
+
baseURL,
|
|
70
|
+
);
|
|
71
|
+
|
|
72
|
+
await fetch(items);
|
|
73
|
+
|
|
74
|
+
vsix = await pRetry(async () => {
|
|
75
|
+
const response = await fetch(download, {
|
|
76
|
+
headers: {
|
|
77
|
+
'User-Agent':
|
|
78
|
+
'Mozilla/5.0 (Delance) Gecko/20100101 Firefox/120.0',
|
|
79
|
+
},
|
|
80
|
+
credentials: 'include',
|
|
81
|
+
redirect: 'follow',
|
|
82
|
+
referrer: items.href,
|
|
83
|
+
});
|
|
68
84
|
|
|
69
|
-
|
|
85
|
+
if (response.status === 429) {
|
|
86
|
+
const delay = response.headers.get('retry-after');
|
|
87
|
+
if (delay) {
|
|
88
|
+
throw new Error('Rate limited');
|
|
89
|
+
}
|
|
90
|
+
}
|
|
70
91
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
),
|
|
75
|
-
)
|
|
76
|
-
.map((b) => b.toString(16).padStart(2, '0'))
|
|
77
|
-
.join('');
|
|
92
|
+
if (!response.ok) {
|
|
93
|
+
throw new AbortError(response.statusText);
|
|
94
|
+
}
|
|
78
95
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
96
|
+
const vsix = await response.blob();
|
|
97
|
+
|
|
98
|
+
const hash = Array.from(
|
|
99
|
+
new Uint8Array(
|
|
100
|
+
await subtle.digest('SHA-256', await vsix.arrayBuffer()),
|
|
101
|
+
),
|
|
102
|
+
)
|
|
103
|
+
.map((b) => b.toString(16).padStart(2, '0'))
|
|
104
|
+
.join('');
|
|
105
|
+
|
|
106
|
+
try {
|
|
107
|
+
assert.equal(hash, pkg.delance.sha256, 'sha256 mismatch');
|
|
108
|
+
} catch (error) {
|
|
109
|
+
if (error instanceof AssertionError) {
|
|
110
|
+
throw new AbortError(error);
|
|
111
|
+
}
|
|
112
|
+
throw error;
|
|
84
113
|
}
|
|
85
|
-
throw error;
|
|
86
|
-
}
|
|
87
114
|
|
|
88
|
-
|
|
89
|
-
});
|
|
115
|
+
return vsix;
|
|
116
|
+
});
|
|
117
|
+
}
|
|
90
118
|
|
|
91
119
|
const zip = new ZipReader(new BlobReader(vsix));
|
|
92
120
|
|
|
@@ -138,6 +166,9 @@ await pMap(
|
|
|
138
166
|
{concurrency: 4},
|
|
139
167
|
);
|
|
140
168
|
|
|
141
|
-
await fs.writeFile(
|
|
169
|
+
await fs.writeFile(
|
|
170
|
+
'dist/langserver.cjs',
|
|
171
|
+
`#!/usr/bin/env node
|
|
142
172
|
|
|
143
|
-
require('./v${pkg.version}-${pkg.delance.sha256}/server.bundle.js')
|
|
173
|
+
require('./v${pkg.version}-${pkg.delance.sha256}/server.bundle.js');`,
|
|
174
|
+
);
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@delance/runtime",
|
|
3
|
-
"version": "2024.2.
|
|
3
|
+
"version": "2024.2.106",
|
|
4
4
|
"description": "Runtime and entrypoint for the lance",
|
|
5
5
|
"license": "0BSD",
|
|
6
6
|
"bin": {
|
|
7
7
|
"delance-langserver": "dist/langserver.cjs"
|
|
8
8
|
},
|
|
9
9
|
"delance": {
|
|
10
|
-
"sha256": "
|
|
10
|
+
"sha256": "3a5c1cd88677476aabc120c490ca9f7c3aa6392102a9972913358299fa19e3cf"
|
|
11
11
|
},
|
|
12
12
|
"files": [
|
|
13
13
|
"langserver.cjs",
|