plainscript-lang 1.0.3 → 1.0.35
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 +29 -0
- package/compiler/cli.js +1 -1
- package/compiler/dependency-detector.js +6 -2
- package/compiler/generator.js +422 -51
- package/compiler/parser.js +40 -2
- package/compiler/version.js +1 -1
- package/docs/CAPABILITY_GAP_AUDIT.md +9 -3
- package/docs/PLAINSCRIPT-SPEC.md +135 -3
- package/docs/index.html +27 -26
- package/docs/logo-pln.jpg +0 -0
- package/docs/visualization-example.svg +32 -0
- package/docs/website/script.js +130 -1
- package/docs/website/style.css +211 -47
- package/examples/ai-providers.pln +1 -1
- package/examples/arrays.pln +1 -1
- package/examples/async-errors.pln +1 -1
- package/examples/auth-api.pln +1 -1
- package/examples/auth-sessions.pln +1 -1
- package/examples/basics.pln +1 -1
- package/examples/bots.pln +1 -1
- package/examples/cache-and-jobs.pln +1 -1
- package/examples/cache-schedule.pln +1 -1
- package/examples/collections.pln +1 -1
- package/examples/concurrency.pln +1 -1
- package/examples/conditions.pln +1 -1
- package/examples/database.pln +1 -1
- package/examples/day2.pln +1 -1
- package/examples/day3.pln +1 -1
- package/examples/deployment.pln +1 -1
- package/examples/email-send.pln +1 -1
- package/examples/error-handling.pln +1 -1
- package/examples/expressions.pln +1 -1
- package/examples/file-uploads.pln +1 -1
- package/examples/files-and-config.pln +1 -1
- package/examples/files.pln +1 -1
- package/examples/football-backend/app.pln +1 -1
- package/examples/functions.pln +1 -1
- package/examples/hello.pln +1 -1
- package/examples/http-client.pln +1 -1
- package/examples/http.pln +1 -1
- package/examples/id-verification/app.pln +1 -1
- package/examples/json.pln +1 -1
- package/examples/loops.pln +1 -1
- package/examples/modules/app.pln +1 -1
- package/examples/modules/main.pln +1 -1
- package/examples/modules/math.pln +1 -1
- package/examples/mongo.pln +1 -1
- package/examples/objects.pln +1 -1
- package/examples/ocr.pln +1 -1
- package/examples/packages.pln +1 -1
- package/examples/record-kinds.pln +1 -1
- package/examples/records.pln +1 -1
- package/examples/rest-api-fetch.pln +1 -1
- package/examples/rest-api.pln +1 -1
- package/examples/scheduled-tasks.pln +1 -1
- package/examples/search-and-filter.pln +1 -1
- package/examples/server.pln +1 -1
- package/examples/sessions-and-cookies.pln +1 -1
- package/examples/sqlite.pln +1 -1
- package/examples/start.pln +1 -1
- package/examples/stdlib.pln +1 -1
- package/examples/string-verbs.pln +1 -1
- package/examples/telegram-ai-bot.pln +1 -1
- package/examples/telegram-bot.pln +1 -1
- package/examples/testing.pln +1 -1
- package/examples/visualization.pln +12 -0
- package/examples/web-api.pln +1 -1
- package/examples/web-app.pln +1 -1
- package/examples/websocket-server.pln +1 -1
- package/examples/websocket.pln +1 -1
- package/examples/whatsapp-bot/pairing.pln +24 -2
- package/examples/whatsapp-bot/qr.pln +18 -2
- package/package.json +2 -1
- package/docs/logo.jpg +0 -0
package/examples/server.pln
CHANGED
package/examples/sqlite.pln
CHANGED
package/examples/start.pln
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
// PlainScript 1.0.
|
|
1
|
+
// PlainScript 1.0.35: start command entry point.
|
|
2
2
|
show "PlainScript started"
|
package/examples/stdlib.pln
CHANGED
package/examples/testing.pln
CHANGED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// Create a dependency-free SVG visualization.
|
|
2
|
+
remember months as ["Jan", "Feb", "Mar", "Apr"]
|
|
3
|
+
remember signups as [12, 18, 27, 35]
|
|
4
|
+
|
|
5
|
+
remember chart as barChart("Monthly signups", months, signups, {
|
|
6
|
+
width: 720,
|
|
7
|
+
height: 420,
|
|
8
|
+
accent: "#40c463"
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
saveImage("dist/monthly-signups.svg", chart)
|
|
12
|
+
show "Saved dist/monthly-signups.svg"
|
package/examples/web-api.pln
CHANGED
package/examples/web-app.pln
CHANGED
package/examples/websocket.pln
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
// PlainScript 1.0.
|
|
1
|
+
// PlainScript 1.0.35: WhatsApp pairing login.
|
|
2
|
+
// Showcases `use baileys`, message.type branching, media downloads,
|
|
3
|
+
// and button/list reply handling.
|
|
2
4
|
|
|
3
5
|
whatsapp bot
|
|
4
6
|
auth "plain-script-whatsapp"
|
|
7
|
+
use baileys "@qwerty-xcv/baileys"
|
|
5
8
|
login pairing "2348012345678"
|
|
6
9
|
on message
|
|
7
10
|
log message
|
|
11
|
+
// Text commands.
|
|
8
12
|
if message.text is "/start"
|
|
9
13
|
reply "Welcome!"
|
|
10
14
|
done
|
|
@@ -12,5 +16,23 @@ whatsapp bot
|
|
|
12
16
|
reply `Available commands:
|
|
13
17
|
/start /help`
|
|
14
18
|
done
|
|
19
|
+
// Save any incoming image to disk.
|
|
20
|
+
if message.type is "image"
|
|
21
|
+
download "media/photo.jpg"
|
|
22
|
+
reply "Got your image, saved it to media/photo.jpg"
|
|
23
|
+
done
|
|
24
|
+
// Same for documents.
|
|
25
|
+
if message.type is "document"
|
|
26
|
+
download "media/file.bin"
|
|
27
|
+
reply "Got your document, saved it to media/file.bin"
|
|
28
|
+
done
|
|
29
|
+
// Button taps carry a buttonId we can reply with.
|
|
30
|
+
if message.type is "button"
|
|
31
|
+
reply "You chose: " + message.buttonId
|
|
32
|
+
done
|
|
33
|
+
// List replies carry the selected list item.
|
|
34
|
+
if message.type is "list"
|
|
35
|
+
reply "You picked: " + message.buttonId
|
|
36
|
+
done
|
|
15
37
|
done
|
|
16
|
-
done
|
|
38
|
+
done
|
|
@@ -1,12 +1,28 @@
|
|
|
1
|
-
// PlainScript 1.0.
|
|
1
|
+
// PlainScript 1.0.35: WhatsApp QR login.
|
|
2
|
+
// Showcases `use baileys`, message.type branching, media downloads,
|
|
3
|
+
// and button handling.
|
|
2
4
|
|
|
3
5
|
whatsapp bot
|
|
4
6
|
auth "plain-script-whatsapp"
|
|
7
|
+
use baileys "@qwerty-xcv/baileys"
|
|
5
8
|
login qr
|
|
6
9
|
on message
|
|
7
10
|
log message
|
|
8
11
|
if message.text is "/start"
|
|
9
12
|
reply "Welcome"
|
|
10
13
|
done
|
|
14
|
+
// Save incoming images automatically.
|
|
15
|
+
if message.type is "image"
|
|
16
|
+
download "media/photo.jpg"
|
|
17
|
+
reply "Saved your photo!"
|
|
18
|
+
done
|
|
19
|
+
if message.type is "document"
|
|
20
|
+
download "media/file.bin"
|
|
21
|
+
reply "Saved your document!"
|
|
22
|
+
done
|
|
23
|
+
// Button replies include the tapped button's id.
|
|
24
|
+
if message.type is "button"
|
|
25
|
+
reply "You chose: " + message.buttonId
|
|
26
|
+
done
|
|
11
27
|
done
|
|
12
|
-
done
|
|
28
|
+
done
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "plainscript-lang",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.35",
|
|
4
4
|
"description": "PlainScript — an Intent-Oriented Programming Language. When even a simple sentence can be code.",
|
|
5
5
|
"main": "compiler/cli.js",
|
|
6
6
|
"bin": {
|
|
@@ -42,6 +42,7 @@
|
|
|
42
42
|
"ws": "^8.21.3"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
+
"@qwerty-xcv/baileys": "^0.0.1",
|
|
45
46
|
"mongodb": "^7.6.0",
|
|
46
47
|
"tesseract.js": "^7.0.0"
|
|
47
48
|
}
|
package/docs/logo.jpg
DELETED
|
Binary file
|