@plylang/plylang 1.0.26 → 1.0.27
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/README.md +5 -3
- package/bin/native.js +24 -7
- package/package.json +10 -13
- package/bin/plylang-ls.js +0 -4
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@ The compiler translates a module into JavaScript. There is no separate virtual m
|
|
|
6
6
|
|
|
7
7
|
This text walks through the language once, with a short example of each feature.
|
|
8
8
|
|
|
9
|
-
The repository contains the `plylang` compiler and the `plylang-ls` server. Words that work on ready-made values are not built into the compiler: they are imported. The neighboring package `@plylang/prelude` is one such place, and it has its own documentation. The import lines below name that package. They check in a package that depends on it.
|
|
9
|
+
The repository contains the `plylang` compiler and the `plylang-ls` server. They are separate npm packages. `@plylang/plylang` is the compiler. `@plylang/language-server` is the server. The server command remains `plylang-ls`. A library depends on the compiler. The server is installed by the editor. Words that work on ready-made values are not built into the compiler: they are imported. The neighboring package `@plylang/prelude` is one such place, and it has its own documentation. The import lines below name that package. They check in a package that depends on it.
|
|
10
10
|
|
|
11
11
|
## Stack
|
|
12
12
|
|
|
@@ -377,8 +377,10 @@ cargo build --release
|
|
|
377
377
|
|
|
378
378
|
`target/release/plylang` and `target/release/plylang-ls` are the compiler and the server. The server speaks LSP over stdio. In a package with a `ply` field it resolves imports the same way `plylang build` does.
|
|
379
379
|
|
|
380
|
-
|
|
380
|
+
`@plylang/plylang` installs the `plylang` command. `@plylang/language-server` installs `plylang-ls` and depends on the same version of the compiler. Publish the compiler and its six platform packages before the server package and its six platform packages. `.github/workflows/publish.yml` does that when a GitHub release is published. Version `1.x` is language `1`. A minor or a patch of the compiler does not change the language number. `PLYLANG_BIN` and `PLYLANG_LS_BIN` supply a binary of their own.
|
|
381
381
|
|
|
382
|
-
|
|
382
|
+
`node script/stage-native.js <platform> <binary-dir> <out-dir> plylang` writes one compiler platform package. The same command with `plylang-ls` writes `@plylang/language-server-<os>-<arch>`. Each archive holds one binary.
|
|
383
|
+
|
|
384
|
+
Highlighting is the [tree-sitter-ply](https://github.com/algosail/tree-sitter-ply) grammar. The Zed extension is the neighboring repository `zed-ply`. It installs `@plylang/language-server` for the editor. In this repository, `cargo build -p plylang-ls` is what the extension runs.
|
|
383
385
|
|
|
384
386
|
The license is MIT.
|
package/bin/native.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
// The npm commands
|
|
2
|
-
//
|
|
3
|
-
//
|
|
1
|
+
// The npm commands start here and run the Rust binary. `plylang` looks for
|
|
2
|
+
// `@plylang/plylang-<os>-<arch>`. `plylang-ls` looks for
|
|
3
|
+
// `@plylang/language-server-<os>-<arch>`. The command name and the package
|
|
4
|
+
// name differ on purpose. A caller can pass `resolvePackage` so the lookup
|
|
5
|
+
// starts from its own package. A checkout of this repository uses
|
|
6
|
+
// `target/release`, then `target/debug`.
|
|
4
7
|
|
|
5
8
|
import { spawnSync } from "node:child_process";
|
|
6
9
|
import { accessSync, constants, statSync } from "node:fs";
|
|
@@ -24,6 +27,20 @@ export function platformId(platform = process.platform, arch = process.arch) {
|
|
|
24
27
|
return PLATFORMS.has(id) ? id : null;
|
|
25
28
|
}
|
|
26
29
|
|
|
30
|
+
export function npmPackage(command) {
|
|
31
|
+
if (command === "plylang") {
|
|
32
|
+
return "@plylang/plylang";
|
|
33
|
+
}
|
|
34
|
+
if (command === "plylang-ls") {
|
|
35
|
+
return "@plylang/language-server";
|
|
36
|
+
}
|
|
37
|
+
throw new Error(`unknown command ${command}`);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export function platformPackage(command, id) {
|
|
41
|
+
return `${npmPackage(command)}-${id}`;
|
|
42
|
+
}
|
|
43
|
+
|
|
27
44
|
export function resolveBinary(command, options = {}) {
|
|
28
45
|
if (command !== "plylang" && command !== "plylang-ls") {
|
|
29
46
|
throw new Error(`unknown command ${command}`);
|
|
@@ -44,7 +61,7 @@ export function resolveBinary(command, options = {}) {
|
|
|
44
61
|
|
|
45
62
|
const id = platformId(platform, arch);
|
|
46
63
|
if (id) {
|
|
47
|
-
const pkgName =
|
|
64
|
+
const pkgName = platformPackage(command, id);
|
|
48
65
|
const pkgJson = resolvePackage(pkgName);
|
|
49
66
|
if (pkgJson) {
|
|
50
67
|
const name = fileName(command, platform);
|
|
@@ -70,7 +87,7 @@ function missing(command, id) {
|
|
|
70
87
|
throw new Error(
|
|
71
88
|
`${command} was not found for ${id}.\n` +
|
|
72
89
|
"From a checkout, run `cargo build --release -p plylang -p plylang-ls`.\n" +
|
|
73
|
-
`From npm, install the optional package
|
|
90
|
+
`From npm, install the optional package ${platformPackage(command, id)}.`,
|
|
74
91
|
);
|
|
75
92
|
}
|
|
76
93
|
|
|
@@ -97,10 +114,10 @@ function defaultResolvePackage(name) {
|
|
|
97
114
|
}
|
|
98
115
|
}
|
|
99
116
|
|
|
100
|
-
export function run(command) {
|
|
117
|
+
export function run(command, options = {}) {
|
|
101
118
|
let bin;
|
|
102
119
|
try {
|
|
103
|
-
bin = resolveBinary(command);
|
|
120
|
+
bin = resolveBinary(command, options);
|
|
104
121
|
} catch (error) {
|
|
105
122
|
console.error(error.message);
|
|
106
123
|
process.exit(1);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plylang/plylang",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "Ply compiler
|
|
3
|
+
"version": "1.0.27",
|
|
4
|
+
"description": "Ply compiler",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Algosail",
|
|
7
7
|
"type": "module",
|
|
@@ -14,8 +14,7 @@
|
|
|
14
14
|
"keywords": [
|
|
15
15
|
"ply",
|
|
16
16
|
"plylang",
|
|
17
|
-
"compiler"
|
|
18
|
-
"language-server"
|
|
17
|
+
"compiler"
|
|
19
18
|
],
|
|
20
19
|
"engines": {
|
|
21
20
|
"node": ">=24"
|
|
@@ -24,21 +23,19 @@
|
|
|
24
23
|
"access": "public"
|
|
25
24
|
},
|
|
26
25
|
"bin": {
|
|
27
|
-
"plylang": "bin/plylang.js"
|
|
28
|
-
"plylang-ls": "bin/plylang-ls.js"
|
|
26
|
+
"plylang": "bin/plylang.js"
|
|
29
27
|
},
|
|
30
28
|
"files": [
|
|
31
29
|
"bin/plylang.js",
|
|
32
|
-
"bin/plylang-ls.js",
|
|
33
30
|
"bin/native.js"
|
|
34
31
|
],
|
|
35
32
|
"optionalDependencies": {
|
|
36
|
-
"@plylang/plylang-darwin-arm64": "1.0.
|
|
37
|
-
"@plylang/plylang-darwin-x64": "1.0.
|
|
38
|
-
"@plylang/plylang-linux-arm64": "1.0.
|
|
39
|
-
"@plylang/plylang-linux-x64": "1.0.
|
|
40
|
-
"@plylang/plylang-win32-arm64": "1.0.
|
|
41
|
-
"@plylang/plylang-win32-x64": "1.0.
|
|
33
|
+
"@plylang/plylang-darwin-arm64": "1.0.27",
|
|
34
|
+
"@plylang/plylang-darwin-x64": "1.0.27",
|
|
35
|
+
"@plylang/plylang-linux-arm64": "1.0.27",
|
|
36
|
+
"@plylang/plylang-linux-x64": "1.0.27",
|
|
37
|
+
"@plylang/plylang-win32-arm64": "1.0.27",
|
|
38
|
+
"@plylang/plylang-win32-x64": "1.0.27"
|
|
42
39
|
},
|
|
43
40
|
"scripts": {
|
|
44
41
|
"build": "cargo build --release",
|
package/bin/plylang-ls.js
DELETED