@naanlang/naan 1.2.0 → 1.3.0

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.
Files changed (41) hide show
  1. package/LICENSE.md +1 -1
  2. package/README.md +1 -1
  3. package/bin/index.js +5 -2
  4. package/dist/env_web.js +11 -1
  5. package/dist/naan.min.js +5 -5
  6. package/frameworks/browser/https_request.nlg +2 -0
  7. package/frameworks/browser/sworker.js +23 -23
  8. package/frameworks/browser/terminals.nlg +132 -20
  9. package/frameworks/browser/workers.nlg +4 -1
  10. package/frameworks/browser/ws_client.nlg +9 -3
  11. package/frameworks/client/apiclient.nlg +8 -6
  12. package/frameworks/client/psm_client.nlg +4 -4
  13. package/frameworks/client/relaycon.nlg +5 -1
  14. package/frameworks/common/common.nlg +10 -4
  15. package/frameworks/node/apiserver.nlg +190 -4
  16. package/frameworks/node/worker.nlg +112 -10
  17. package/frameworks/node/ws_client.nlg +10 -3
  18. package/frameworks/project/build.nlg +13 -11
  19. package/frameworks/project/projects.nlg +7 -5
  20. package/frameworks/running/executors.nlg +124 -34
  21. package/frameworks/running/taskexec.nlg +5 -1
  22. package/lib/browser/env_web.js +17 -7
  23. package/lib/browser/env_webworker.js +22 -3
  24. package/lib/core/naanlib.js +5 -5
  25. package/lib/env_node.js +15 -4
  26. package/lib/env_nodeworker.js +21 -1
  27. package/package.json +8 -5
  28. package/plugins/serviceAws/aws/aws-sdk-node.min.js +2 -2
  29. package/plugins/serviceAws/aws/aws-sdk.min.js +3 -2
  30. package/plugins/serviceAws/aws_dynamo.nlg +19 -19
  31. package/plugins/serviceAws/dbt_aws.nlg +1 -1
  32. package/plugins/serviceYC/generic_api.yaml +36 -0
  33. package/plugins/serviceYC/naanide-relay-index.js +148 -0
  34. package/plugins/serviceYC/serviceYC.nlg +60 -0
  35. package/plugins/serviceYC/yc_apigateway.nlg +205 -0
  36. package/plugins/serviceYC/yc_function.nlg +163 -0
  37. package/plugins/serviceYC/yc_vm.nlg +207 -0
  38. package/test/test_02_context.nlg +1 -1
  39. package/test/test_03_jsinterop.nlg +2 -2
  40. package/test/test_05_strings.nlg +7 -4
  41. package/test/test_07_lingo.nlg +1 -1
package/lib/env_node.js CHANGED
@@ -55,6 +55,7 @@ exports.NaanNodeREPL = function NaanNodeREPL(options) {
55
55
  var naanlib = new Naan.Naanlib();
56
56
  var servSelf = this;
57
57
  naanlib.js.t = this; // allow us to be accessed from Naan
58
+ naanlib.js.k = require('worker_threads');
58
59
  var termops;
59
60
  var outEnable = !options.replDisable;
60
61
  var useConsoleOut = false;
@@ -109,8 +110,8 @@ exports.NaanNodeREPL = function NaanNodeREPL(options) {
109
110
  { // Node REPL does too much crap
110
111
  }
111
112
 
112
- if (!options.replDisable)
113
- {
113
+ if (process.stdin.isTTY && !options.replDisable)
114
+ { // must have TTY for local REPL
114
115
  replServer = repl.start({ prompt: '', eval: myEval});
115
116
 
116
117
  replServer.on('line', function(cmd) { // process raw command line
@@ -202,10 +203,20 @@ exports.NaanNodeREPL = function NaanNodeREPL(options) {
202
203
  //
203
204
  // Respond to a message. Note that this calls Naan via timeouts to handle the use case that the
204
205
  // messages are originating from the interpreter itself, so that it does not call itself back
205
- // recurxsively. That would be Very Bad™.
206
+ // recursively. That would be Very Bad™.
206
207
  //
207
-
208
+
209
+ var replyHook;
210
+ this.OnReplyHook = function OnReplyHook(proc) {
211
+ replyHook = proc;
212
+ return (proc);
213
+ };
214
+
208
215
  this.ReplyMessage = function ReplyMessage(data) {
216
+ if (replyHook)
217
+ setTimeout(function() {
218
+ replyHook(data);
219
+ }, 1);
209
220
  if (termops)
210
221
  {
211
222
  setTimeout(function () {
@@ -62,6 +62,7 @@ exports.NaanWorkerActivate = function NaanWorkerActivate(cbReady) {
62
62
  var workSelf = this;
63
63
  workSelf.anaan = naanlib.js.n;
64
64
  naanlib.js.t = workSelf;
65
+ naanlib.js.k = threads;
65
66
 
66
67
 
67
68
  //==========================================================================
@@ -127,7 +128,21 @@ exports.NaanWorkerActivate = function NaanWorkerActivate(cbReady) {
127
128
  workerListener = proc;
128
129
  return (proc);
129
130
  };
130
-
131
+
132
+ workSelf.DispatchMessage = function DispatchMessage(data) {
133
+ msgPort.postMessage({ // target is sending a message
134
+ id: "targetsend",
135
+ data: data
136
+ });
137
+ return (data);
138
+ };
139
+
140
+ var targetReceiver;
141
+ workSelf.OnReceive = function OnReceive(proc) {
142
+ targetReceiver = proc;
143
+ return (proc);
144
+ };
145
+
131
146
  workSelf.ReplyDebugger = function ReplyDebugger(data) {
132
147
  msgPort.postMessage({ // target is sending debug data
133
148
  id: "debugout",
@@ -175,6 +190,11 @@ exports.NaanWorkerActivate = function NaanWorkerActivate(cbReady) {
175
190
  if (debugListener)
176
191
  debugListener(msg.data); // target received a message
177
192
  }
193
+ else if (msg.id == "targetreceive")
194
+ {
195
+ if (targetReceiver)
196
+ targetReceiver(msg.data);
197
+ }
178
198
  });
179
199
 
180
200
  naanlib.banner();
package/package.json CHANGED
@@ -1,17 +1,20 @@
1
1
  {
2
2
  "name": "@naanlang/naan",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "author": "Richard C. Zulch",
5
5
  "description": "Naan™ software platform",
6
6
  "main": "./lib/core/naanlib.js",
7
7
  "browser": "./dist/naanlib.min.js",
8
- "license" : "MIT",
9
- "repository": "github:naanlang/naan",
8
+ "license": "MIT",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/naanlang/naan.git"
12
+ },
10
13
  "bin": {
11
- "naan": "./bin/index.js"
14
+ "naan": "bin/index.js"
12
15
  },
13
16
  "scripts": {
14
- "start": "node lib/node_repl.js",
17
+ "start": "node bin/index.js",
15
18
  "debug": "node --inspect-brk lib/node_repl.js",
16
19
  "test": "node test/node_test.js"
17
20
  }