@delance/runtime 2023.12.101

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/LICENSE ADDED
@@ -0,0 +1,15 @@
1
+ BSD Zero Clause License
2
+
3
+ Copyright (c) 2023 Zephyr Lykos
4
+
5
+ Permission to use, copy, modify, and/or distribute this software for any
6
+ purpose with or without fee is hereby granted.
7
+
8
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
9
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
10
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
11
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
12
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
13
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
14
+ PERFORMANCE OF THIS SOFTWARE.
15
+
package/README.md ADDED
@@ -0,0 +1,82 @@
1
+ [![npm](https://img.shields.io/npm/v/%40delance%2Fruntime.svg)][npm]
2
+ [![license](https://img.shields.io/npm/l/%40delance%2Fruntime.svg)][license]
3
+ ![maintenance](https://img.shields.io/maintenance/yes/2024.svg)
4
+
5
+ @delance/runtime
6
+ ================
7
+ The language server runtime of [delance].
8
+
9
+ ## Usage
10
+
11
+ delance-langserver --stdio
12
+
13
+ ## Contributing
14
+
15
+ See [@delance/builder](https://git.sr.ht/~self/delance-builder#contributing).
16
+
17
+ Ensure linting and type checking passes,
18
+ and send your patches to <~self/delance-devel@lists.sr.ht>.
19
+
20
+ You shall sign off your contribution with a `Signed-off-by` tag appended to
21
+ the log message of the patch or the tip of a Git branch containing
22
+ your contribution.
23
+
24
+ By contributing, you agree to both the [license] and the terms below:
25
+
26
+ Developer's Certificate of Origin 1.1
27
+
28
+ By making a contribution to this project, I certify that:
29
+
30
+ (a) The contribution was created in whole or in part by me and I
31
+ have the right to submit it under the open source license
32
+ indicated in the file; or
33
+
34
+ (b) The contribution is based upon previous work that, to the best
35
+ of my knowledge, is covered under an appropriate open source
36
+ license and I have the right under that license to submit that
37
+ work with modifications, whether created in whole or in part
38
+ by me, under the same open source license (unless I am
39
+ permitted to submit under a different license), as indicated
40
+ in the file; or
41
+
42
+ (c) The contribution was provided directly to me by some other
43
+ person who certified (a), (b) or (c) and I have not modified
44
+ it.
45
+
46
+ (d) I understand and agree that this project and the contribution
47
+ are public and that a record of the contribution (including all
48
+ personal information I submit with it, including my sign-off) is
49
+ maintained indefinitely and may be redistributed consistent with
50
+ this project or the open source license(s) involved.
51
+
52
+ ## But wait…
53
+
54
+ > Isn't this against the original LICENSE?
55
+
56
+ **tl;dr: yes.** You choose to break the binding agreement of the original
57
+ software, but this repo itself does not violate any rights of its corresponding
58
+ copyright authors: it's a standalone piece of software that is not tied to,
59
+ nor redistributes any other particular project in the question.
60
+
61
+ ## License
62
+
63
+ SPDX-License-Identifier: 0BSD
64
+
65
+ BSD Zero Clause License
66
+
67
+ Copyright (c) 2023 Zephyr Lykos
68
+
69
+ Permission to use, copy, modify, and/or distribute this software for any
70
+ purpose with or without fee is hereby granted.
71
+
72
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
73
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
74
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
75
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
76
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
77
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
78
+ PERFORMANCE OF THIS SOFTWARE.
79
+
80
+ [delance]: https://sr.ht/~self/delance
81
+ [npm]: https://npm.im/@delance/runtime
82
+ [license]: ./LICENSE
package/install.mjs ADDED
@@ -0,0 +1,88 @@
1
+ #!/usr/bin/env node
2
+
3
+ import assert from 'node:assert';
4
+ import fs from 'node:fs/promises';
5
+ import path from 'node:path';
6
+ import delance from '@delance/builder';
7
+ import {BlobWriter, TextWriter, ZipReader} from '@zip.js/zip.js';
8
+
9
+ import pkg from './package.json' assert {type: 'json'};
10
+
11
+ /**
12
+ * @param {string} string
13
+ */
14
+ function reverse(string) {
15
+ return [...string].reverse().join('');
16
+ }
17
+
18
+ const baseURL = new URL(reverse('/moc.oidutslausiv.ecalptekram//:sptth'));
19
+ const publisher = reverse('nohtyp-sm');
20
+ const extension = reverse('ecnalyp-edocsv');
21
+
22
+ const items = new URL(`/items?itemName=${publisher}.${extension}`, baseURL);
23
+ const download = new URL(
24
+ `/_apis/public/gallery/publishers/${publisher}/vsextensions/${extension}/${pkg.version}/vspackage`,
25
+ baseURL,
26
+ );
27
+
28
+ await fetch(items);
29
+
30
+ const data = await fetch(download, {
31
+ headers: {
32
+ 'User-Agent': 'Mozilla/5.0 (Delance) Gecko/20100101 Firefox/120.0',
33
+ },
34
+ credentials: 'include',
35
+ redirect: 'follow',
36
+ referrer: items.href,
37
+ });
38
+
39
+ if (!data.ok || data.body == null) {
40
+ throw new Error(data.statusText);
41
+ }
42
+
43
+ const zip = new ZipReader(data.body);
44
+
45
+ const prefix = 'extension/dist/';
46
+ const output = path.resolve('out/');
47
+ await fs.mkdir(output);
48
+
49
+ for await (const entry of await zip.getEntries()) {
50
+ const filename = path.normalize(entry.filename);
51
+ if (!filename.startsWith(prefix)) {
52
+ continue;
53
+ }
54
+ console.log(filename);
55
+
56
+ const dest = filename.slice(prefix.length);
57
+
58
+ if (entry.directory) {
59
+ await fs.mkdir(path.join(output, dest), {recursive: true});
60
+ continue;
61
+ }
62
+
63
+ /** @type Blob */
64
+ let file;
65
+ if (dest.endsWith('.bundle.js')) {
66
+ if (dest.startsWith('browser.')) {
67
+ continue;
68
+ }
69
+ const writer = new TextWriter();
70
+ assert(entry.getData !== undefined);
71
+ await entry.getData(writer);
72
+
73
+ /** @type string */
74
+ const script = await delance(await writer.getData());
75
+ file = new Blob([script], {type: 'text/javascript', encoding: 'utf-8'});
76
+ } else {
77
+ const writer = new BlobWriter();
78
+ assert(entry.getData !== undefined);
79
+ await entry.getData(writer);
80
+ file = await writer.getData();
81
+ }
82
+
83
+ await fs.mkdir(path.join(output, path.dirname(dest)), {recursive: true});
84
+ await fs.writeFile(
85
+ path.join(output, dest),
86
+ Buffer.from(await file.arrayBuffer()),
87
+ );
88
+ }
package/langserver.cjs ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+
3
+ require('./out/server.bundle.js');
package/package.json ADDED
@@ -0,0 +1,25 @@
1
+ {
2
+ "name": "@delance/runtime",
3
+ "version": "2023.12.101",
4
+ "description": "Runtime and entrypoint for the lance",
5
+ "license": "0BSD",
6
+ "bin": {
7
+ "delance-langserver": "langserver.cjs"
8
+ },
9
+ "files": [
10
+ "langserver.cjs",
11
+ "install.mjs"
12
+ ],
13
+ "scripts": {
14
+ "postinstall": "node install.mjs"
15
+ },
16
+ "dependencies": {
17
+ "@delance/builder": "^0.2.4",
18
+ "@zip.js/zip.js": "^2.7.32"
19
+ },
20
+ "devDependencies": {
21
+ "@biomejs/biome": "^1.4",
22
+ "@types/node": "^20",
23
+ "typescript": "^5.3"
24
+ }
25
+ }