@delance/runtime 2024.12.1 → 2024.12.100
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 +8 -105
- package/package.json +8 -8
package/dist/langserver.cjs
CHANGED
package/install.mjs
CHANGED
|
@@ -1,23 +1,17 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
import
|
|
3
|
+
// @ts-check
|
|
4
|
+
import assert from 'node:assert';
|
|
5
5
|
import fs from 'node:fs/promises';
|
|
6
6
|
import path from 'node:path';
|
|
7
7
|
import process from 'node:process';
|
|
8
8
|
import delance from '@delance/builder';
|
|
9
9
|
import {BlobReader, BlobWriter, TextWriter, ZipReader} from '@zip.js/zip.js';
|
|
10
|
-
import
|
|
11
|
-
import pRetry, {AbortError} from 'p-retry';
|
|
10
|
+
import map from 'p-map';
|
|
12
11
|
|
|
13
12
|
import pkg from './package.json' with {type: 'json'};
|
|
14
13
|
|
|
15
|
-
|
|
16
|
-
* @param {string} string
|
|
17
|
-
*/
|
|
18
|
-
function reverse(string) {
|
|
19
|
-
return [...string].reverse().join('');
|
|
20
|
-
}
|
|
14
|
+
import {getPkg} from './utils.mjs';
|
|
21
15
|
|
|
22
16
|
const output = path.resolve(`dist/v${pkg.version}-${pkg.delance.sha256}`);
|
|
23
17
|
|
|
@@ -34,104 +28,13 @@ if (processed) {
|
|
|
34
28
|
process.exit();
|
|
35
29
|
}
|
|
36
30
|
|
|
37
|
-
/** @type {
|
|
38
|
-
|
|
39
|
-
|
|
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('');
|
|
50
|
-
|
|
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;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
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
|
-
/** @type {RequestInit} */
|
|
73
|
-
const init = {
|
|
74
|
-
headers: {
|
|
75
|
-
'user-agent': 'Mozilla/5.0 (Delance) Gecko/20100101 Firefox/120.0',
|
|
76
|
-
},
|
|
77
|
-
credentials: 'include',
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
const {headers} = await fetch(items, init);
|
|
81
|
-
const cookie = headers
|
|
82
|
-
.getSetCookie()
|
|
83
|
-
.map((c) => c.split(';', 2)[0])
|
|
84
|
-
.join('; ');
|
|
85
|
-
|
|
86
|
-
vsix = await pRetry(async () => {
|
|
87
|
-
const response = await fetch(download, {
|
|
88
|
-
headers: {
|
|
89
|
-
cookie,
|
|
90
|
-
},
|
|
91
|
-
redirect: 'follow',
|
|
92
|
-
referrer: items.href,
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
if (response.status === 429) {
|
|
96
|
-
const delay = response.headers.get('retry-after');
|
|
97
|
-
if (delay) {
|
|
98
|
-
throw new Error('Rate limited');
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
if (!response.ok) {
|
|
103
|
-
throw new AbortError(response.statusText);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
const vsix = await response.blob();
|
|
107
|
-
|
|
108
|
-
const hash = Array.from(
|
|
109
|
-
new Uint8Array(
|
|
110
|
-
await subtle.digest('SHA-256', await vsix.arrayBuffer()),
|
|
111
|
-
),
|
|
112
|
-
)
|
|
113
|
-
.map((b) => b.toString(16).padStart(2, '0'))
|
|
114
|
-
.join('');
|
|
115
|
-
|
|
116
|
-
try {
|
|
117
|
-
assert.equal(hash, pkg.delance.sha256, 'sha256 mismatch');
|
|
118
|
-
} catch (error) {
|
|
119
|
-
if (error instanceof AssertionError) {
|
|
120
|
-
throw new AbortError(error);
|
|
121
|
-
}
|
|
122
|
-
throw error;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
return vsix;
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
const zip = new ZipReader(new BlobReader(vsix));
|
|
31
|
+
/** @type {ZipReader<BlobReader>} */
|
|
32
|
+
const zip = new ZipReader(new BlobReader(await getPkg()));
|
|
130
33
|
|
|
131
34
|
const prefix = path.normalize('extension/dist/');
|
|
132
35
|
|
|
133
|
-
await
|
|
134
|
-
|
|
36
|
+
await map(
|
|
37
|
+
zip.getEntriesGenerator(),
|
|
135
38
|
async (entry) => {
|
|
136
39
|
const filename = path.normalize(entry.filename);
|
|
137
40
|
if (!filename.startsWith(prefix)) {
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@delance/runtime",
|
|
3
|
-
"version": "2024.12.
|
|
3
|
+
"version": "2024.12.100",
|
|
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": "a040b24fa18f6de20de211e78d8a6467a3f88fb34493439e74909b437292ec98"
|
|
11
11
|
},
|
|
12
12
|
"files": ["langserver.cjs", "install.mjs"],
|
|
13
13
|
"scripts": {
|
|
@@ -15,15 +15,15 @@
|
|
|
15
15
|
"lint": "biome lint ."
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@delance/builder": "^0.
|
|
19
|
-
"@zip.js/zip.js": "^2.7.
|
|
20
|
-
"p-map": "^7.0.
|
|
21
|
-
"p-retry": "^6.2.
|
|
18
|
+
"@delance/builder": "^0.3.1",
|
|
19
|
+
"@zip.js/zip.js": "^2.7.54",
|
|
20
|
+
"p-map": "^7.0.3",
|
|
21
|
+
"p-retry": "^6.2.1"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@biomejs/biome": "^1.9.4",
|
|
25
|
-
"@types/node": "^
|
|
26
|
-
"typescript": "^5.
|
|
25
|
+
"@types/node": "^22.10.2",
|
|
26
|
+
"typescript": "^5.7.2"
|
|
27
27
|
},
|
|
28
28
|
"trustedDependencies": ["@biomejs/biome"]
|
|
29
29
|
}
|