@thiagodiogo/psjava 0.0.1-beta.0 → 0.0.1-beta.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.
- package/README.md +32 -23
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -1,43 +1,52 @@
|
|
|
1
1
|
# psjava
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/@thiagodiogo/psjava)
|
|
4
|
+
[](https://github.com/eipastel/psjava/actions/workflows/ci.yml)
|
|
5
|
+
[](./LICENSE)
|
|
6
|
+
|
|
7
|
+
Run `.psjava` files as scripts — plain Java on top of [JShell](https://docs.oracle.com/javase/9/jshell/), with zero ceremony.
|
|
8
|
+
|
|
9
|
+
There's no custom syntax and no transpilation: whatever is in the file is exactly what `jshell` runs. `psjava` only adds a small `print` helper to the session and strips the Windows BOM — nothing else touches your code.
|
|
10
|
+
|
|
11
|
+
## Install
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install -g @thiagodiogo/psjava@beta
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Requires a **JDK 11+** with `jshell` on your `PATH`. Verify your setup with `psjava doctor`.
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
4
20
|
|
|
5
21
|
```bash
|
|
6
|
-
psjava
|
|
7
|
-
psjava
|
|
8
|
-
psjava doctor
|
|
22
|
+
psjava example.psjava # run the file
|
|
23
|
+
psjava example.psjava --debug # run, and print the elapsed time at the end
|
|
24
|
+
psjava doctor # check that jshell is available
|
|
9
25
|
```
|
|
10
26
|
|
|
27
|
+
A `.psjava` file is just Java:
|
|
28
|
+
|
|
11
29
|
```java
|
|
12
|
-
var
|
|
13
|
-
print("
|
|
30
|
+
var name = "world";
|
|
31
|
+
print("hello, " + name);
|
|
14
32
|
```
|
|
15
33
|
|
|
16
|
-
##
|
|
34
|
+
## The `print` helper
|
|
17
35
|
|
|
18
|
-
|
|
19
|
-
arquivo continua intocado). Tem overload para `String`, `int[]` e `List`:
|
|
36
|
+
`psjava` defines a `print(...)` in the session before your code runs (still plain Java — your file stays untouched). It comes with overloads for `String`, `int[]`, and `List`:
|
|
20
37
|
|
|
21
38
|
```java
|
|
22
|
-
print("
|
|
39
|
+
print("text"); // text
|
|
23
40
|
print(new int[]{1, 2, 3}); // [1, 2, 3]
|
|
24
41
|
print(java.util.List.of("a", "b")); // [a, b]
|
|
25
42
|
```
|
|
26
43
|
|
|
27
|
-
`System.out.println(...)`
|
|
44
|
+
`System.out.println(...)` keeps working as usual.
|
|
28
45
|
|
|
29
|
-
##
|
|
46
|
+
## How it works
|
|
30
47
|
|
|
31
|
-
|
|
48
|
+
`psjava` reads your file, prepends the `print` overloads, and pipes the result straight into `jshell -s`. The only change made to your source is removing the Windows BOM, which `jshell` chokes on. That's it — plain Java into JShell.
|
|
32
49
|
|
|
33
|
-
##
|
|
34
|
-
|
|
35
|
-
```bash
|
|
36
|
-
npm install
|
|
37
|
-
npm test # unit + e2e
|
|
38
|
-
npm run test:unit # só lógica pura (sem JDK)
|
|
39
|
-
npm run test:e2e # builda e roda no jshell (precisa de JDK; pula sozinho sem ele)
|
|
40
|
-
```
|
|
50
|
+
## License
|
|
41
51
|
|
|
42
|
-
|
|
43
|
-
`jshell` não engole. Fora isso, é Java puro entrando no JShell.
|
|
52
|
+
[MIT](./LICENSE)
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thiagodiogo/psjava",
|
|
3
|
-
"version": "0.0.1-beta.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.0.1-beta.1",
|
|
4
|
+
"description": "Run .psjava files as scripts — plain Java, no ceremony, on top of JShell.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"psjava",
|
|
7
7
|
"java",
|
|
@@ -43,12 +43,12 @@
|
|
|
43
43
|
"prepublishOnly": "npm run build"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"chalk": "
|
|
47
|
-
"commander": "
|
|
46
|
+
"chalk": "5.6.2",
|
|
47
|
+
"commander": "14.0.3"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@types/node": "
|
|
51
|
-
"typescript": "
|
|
52
|
-
"vitest": "
|
|
50
|
+
"@types/node": "24.13.2",
|
|
51
|
+
"typescript": "5.9.3",
|
|
52
|
+
"vitest": "3.2.6"
|
|
53
53
|
}
|
|
54
54
|
}
|