@naanlang/naan 1.4.3 → 1.4.4
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.md +1 -1
- package/README.md +1 -1
- package/bin/index.js +4 -3
- package/dist/naan.min.js +5 -5
- package/frameworks/browser/https_request.nlg +39 -10
- package/frameworks/browser/sworker.js +23 -23
- package/frameworks/browser/terminals.nlg +19 -16
- package/frameworks/node/http_request.nlg +103 -0
- package/frameworks/node/https_request.nlg +42 -9
- package/frameworks/node/node.nlg +1 -0
- package/frameworks/node/worker.nlg +1 -0
- package/frameworks/project/projects.nlg +1 -1
- package/frameworks/running/executors.nlg +26 -7
- package/frameworks/running/taskexec.nlg +48 -14
- package/lib/browser/env_web.js +7 -7
- package/lib/core/naanlib.js +5 -5
- package/lib/env_node.js +9 -3
- package/lib/node_repl_init.nlg +2 -2
- package/package.json +1 -1
- package/plugins/nodeLib/node_util.nlg +14 -7
- package/plugins/openSearch/os_dynamo.nlg +5 -5
- package/plugins/serviceAws/aws_dynamo.nlg +25 -8
- package/plugins/serviceAws/aws_vm.nlg +198 -0
- package/plugins/serviceGC/gc_api.nlg +1 -0
- package/plugins/serviceNexara/serviceNexara.nlg +32 -0
- package/plugins/serviceNexara/speechrec.nlg +160 -0
- package/plugins/serviceYC/serviceYC.nlg +2 -3
- package/plugins/serviceYC/yc_speechrec.nlg +4 -3
- package/plugins/serviceYC/yc_vm.nlg +44 -54
- package/test/test_01_core.nlg +42 -33
- package/test/test_03_jsinterop.nlg +3 -3
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*
|
|
6
6
|
* column positioning: // // !
|
|
7
7
|
*
|
|
8
|
-
* Copyright (c) 2021-
|
|
8
|
+
* Copyright (c) 2021-2025 by Richard C. Zulch
|
|
9
9
|
*
|
|
10
10
|
*/
|
|
11
11
|
|
|
@@ -19,27 +19,57 @@
|
|
|
19
19
|
*
|
|
20
20
|
*/
|
|
21
21
|
|
|
22
|
-
closure TaskDispatcher(replier, local contexts, gohome,
|
|
22
|
+
closure TaskDispatcher(replier, coder, local contexts, gohome, util) {
|
|
23
23
|
global()
|
|
24
24
|
contexts = { }
|
|
25
25
|
gohome = makeActivator()
|
|
26
|
-
coder = packageCoder(evalf)
|
|
27
26
|
util = modlist().Util.exports
|
|
28
|
-
|
|
29
|
-
//
|
|
27
|
+
|
|
28
|
+
// ContextCoder
|
|
30
29
|
//
|
|
31
|
-
//
|
|
30
|
+
// A context-specific coder allowing remote-initiated communication.
|
|
32
31
|
//
|
|
33
|
-
closure
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
closure ContextCoder(contextID, _guid, dynreply, local exec, error, context) {
|
|
33
|
+
contexts[contextID].coder = packageCoder(closure evalf(expr) {
|
|
34
|
+
if !exec {
|
|
35
|
+
exec = require("./executors.nlg").ExecutorBase(false, "reverser", "TD")
|
|
36
|
+
exec.PostMessage = closure(data) {
|
|
37
|
+
if data.xmsg == "xstart" { // report ready locally
|
|
38
|
+
data.xmsg = "xready"
|
|
39
|
+
exec.execReceived(data)
|
|
40
|
+
} else {
|
|
41
|
+
data.reverse = true
|
|
42
|
+
data._guid = _guid || undefined
|
|
43
|
+
dynreply(data)
|
|
44
|
+
}
|
|
45
|
+
list(false)
|
|
46
|
+
}
|
|
47
|
+
contexts[contextID].execReceived = exec.execReceived // needed for registered reply
|
|
48
|
+
`(error, context) = exec.context({
|
|
49
|
+
contextID: contextID
|
|
50
|
+
}, contexts[contextID].coder)
|
|
51
|
+
if error {
|
|
52
|
+
ErrorDebuglog("TaskDispatcher.ContextCoder failed:", error)
|
|
53
|
+
exec = false
|
|
54
|
+
return (list(error))
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
context.eval(expr)
|
|
58
|
+
})
|
|
36
59
|
}
|
|
37
60
|
|
|
38
61
|
// dispatcher
|
|
39
62
|
//
|
|
40
63
|
// Return a new task dispatcher.
|
|
41
64
|
//
|
|
42
|
-
closure dispatcher(data, local reply, restorens, context, expr, roots, proc, args, result) {
|
|
65
|
+
closure dispatcher(data, dynreply, local reply, restorens, context, expr, roots, proc, args, result) {
|
|
66
|
+
if data.reverse {
|
|
67
|
+
data.reverse = false
|
|
68
|
+
contexts[data.contextID].execReceived(data)
|
|
69
|
+
return
|
|
70
|
+
}
|
|
71
|
+
if !dynreply
|
|
72
|
+
dynreply = replier
|
|
43
73
|
reply = {
|
|
44
74
|
xmsg: "error"
|
|
45
75
|
xid: data.xid
|
|
@@ -62,6 +92,10 @@ closure TaskDispatcher(replier, local contexts, gohome, coder, util) {
|
|
|
62
92
|
namespace: nsactive()
|
|
63
93
|
activator: gohome
|
|
64
94
|
}
|
|
95
|
+
if coder
|
|
96
|
+
context.coder = coder
|
|
97
|
+
else
|
|
98
|
+
ContextCoder(data.contextID, data._guid, dynreply)
|
|
65
99
|
restorens()
|
|
66
100
|
reply.xmsg = "registered"
|
|
67
101
|
reply.contextID = data.contextID
|
|
@@ -85,11 +119,11 @@ closure TaskDispatcher(replier, local contexts, gohome, coder, util) {
|
|
|
85
119
|
intern: true // intern symbols
|
|
86
120
|
localroots: true // make roots local if needed to intern
|
|
87
121
|
execute: true // execute auto-running procedures
|
|
88
|
-
objectDecoder: coder.decodeObject
|
|
122
|
+
objectDecoder: context.coder.decodeObject
|
|
89
123
|
})
|
|
90
124
|
expr = caar(expr)
|
|
91
125
|
if expr.0 == `\.invoke\-method
|
|
92
|
-
expr = coder.invokeMethod(expr.1, expr.2)
|
|
126
|
+
expr = context.coder.invokeMethod(expr.1, expr.2) // object method, args
|
|
93
127
|
else
|
|
94
128
|
expr = evalactive(expr) // evaluate expression
|
|
95
129
|
reply.error = undefined
|
|
@@ -104,7 +138,7 @@ closure TaskDispatcher(replier, local contexts, gohome, coder, util) {
|
|
|
104
138
|
reply.result = util.pkgSave(`expr, roots, {
|
|
105
139
|
nsignore: true // don't report namespace errors
|
|
106
140
|
comments: true
|
|
107
|
-
objectEncoder: coder.encodeObject})
|
|
141
|
+
objectEncoder: context.coder.encodeObject}) // include comments
|
|
108
142
|
if context.namespace !== nsactive().0
|
|
109
143
|
{ // evaluation changed namespace
|
|
110
144
|
context.namespace = nsactive().0
|
|
@@ -154,7 +188,7 @@ closure TaskDispatcher(replier, local contexts, gohome, coder, util) {
|
|
|
154
188
|
} finally {
|
|
155
189
|
restorens()
|
|
156
190
|
}
|
|
157
|
-
|
|
191
|
+
dynreply(reply)
|
|
158
192
|
}
|
|
159
193
|
};
|
|
160
194
|
|
package/lib/browser/env_web.js
CHANGED
|
@@ -514,7 +514,7 @@ exports.NaanControllerWeb = function() {
|
|
|
514
514
|
statedoc.curversion = kStateCurrentVersion;
|
|
515
515
|
statedoc.firstver = kStateFirstVersion;
|
|
516
516
|
statedoc.licensee = "MIT-License";
|
|
517
|
-
statedoc.verstring = "1.4.
|
|
517
|
+
statedoc.verstring = "1.4.4+1";
|
|
518
518
|
statedoc.date = new Date().toISOString();
|
|
519
519
|
statedoc.prefs = prefs;
|
|
520
520
|
statedoc.naan = naanlib.saveState(false); // true to optimize, which is a bit slower
|
|
@@ -532,7 +532,7 @@ exports.NaanControllerWeb = function() {
|
|
|
532
532
|
|| statedoc.firstver > kStateCurrentVersion
|
|
533
533
|
|| statedoc.curversion < kStateFirstVersion
|
|
534
534
|
|| statedoc.licensee != "MIT-License"
|
|
535
|
-
|| statedoc.verstring != "1.4.
|
|
535
|
+
|| statedoc.verstring != "1.4.4+1"
|
|
536
536
|
|| !(naanstate = statedoc.naan))
|
|
537
537
|
{
|
|
538
538
|
localStorage.removeItem("NaanState_Hosted");
|
|
@@ -591,7 +591,7 @@ exports.NaanControllerWeb = function() {
|
|
|
591
591
|
op: "VsiteOpen",
|
|
592
592
|
name: vsiteName,
|
|
593
593
|
naancont: contSelf,
|
|
594
|
-
title: vsiteName + " 1.4.
|
|
594
|
+
title: vsiteName + " 1.4.4+1"
|
|
595
595
|
});
|
|
596
596
|
}
|
|
597
597
|
} catch (e) {
|
|
@@ -605,7 +605,7 @@ exports.NaanControllerWeb = function() {
|
|
|
605
605
|
op: "VsiteClose",
|
|
606
606
|
name: vsiteName,
|
|
607
607
|
naancont: contSelf,
|
|
608
|
-
title: vsiteName + " 1.4.
|
|
608
|
+
title: vsiteName + " 1.4.4+1"
|
|
609
609
|
});
|
|
610
610
|
termTextOut("\x1b[90m\x1b[3m".concat("\nwindow closed", "\x1b[0m\n"));
|
|
611
611
|
}
|
|
@@ -621,7 +621,7 @@ exports.NaanControllerWeb = function() {
|
|
|
621
621
|
op: "VsiteVisibilityChange",
|
|
622
622
|
name: vsiteName,
|
|
623
623
|
naancont: contSelf,
|
|
624
|
-
title: vsiteName + " 1.4.
|
|
624
|
+
title: vsiteName + " 1.4.4+1",
|
|
625
625
|
hidden: window.document.visibilityState == "hidden",
|
|
626
626
|
window: window
|
|
627
627
|
});
|
|
@@ -636,8 +636,8 @@ exports.NaanControllerWeb = function() {
|
|
|
636
636
|
naanlib.banner();
|
|
637
637
|
var hostpath = window.location.origin.concat(naanlib.js.r("path").dirname(window.location.pathname));
|
|
638
638
|
naanlib.start({
|
|
639
|
-
cmd: 'App.version = "1.4.
|
|
640
|
-
+ 'App.cache = "
|
|
639
|
+
cmd: 'App.version = "1.4.4+1";;\r\n'
|
|
640
|
+
+ 'App.cache = "c0da8251995ca3b0d26c3c5513b98f41";;\r\n'
|
|
641
641
|
+ 'Naan.module.requireQuery({ naanver: App.cache });;\r\n'
|
|
642
642
|
+ 'Naan.module.webparse("naan_init.nlg", "' + hostpath + '", { naanver: App.cache });;\r\n'
|
|
643
643
|
});
|