@naanlang/naan 1.0.7 → 1.0.8
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 +3 -4
- package/README.md +20 -2
- package/bin/index.js +2 -2
- package/dist/env_web.js +86 -17
- package/dist/naan.min.js +7 -7
- package/frameworks/browser/browser.nlg +26 -2
- package/frameworks/browser/sworker.js +17 -17
- package/frameworks/browser/workers.nlg +7 -0
- package/frameworks/client/psm_client.nlg +1 -0
- package/frameworks/common/common.nlg +33 -5
- package/frameworks/node/filesystem.nlg +32 -26
- package/frameworks/node/gitter.nlg +9 -4
- package/frameworks/node/https_request.nlg +19 -14
- package/frameworks/project/build.nlg +177 -68
- package/frameworks/project/projects.nlg +1 -1
- package/frameworks/running/running.nlg +32 -10
- package/frameworks/storage/psm.nlg +20 -4
- package/lib/browser/env_web.js +90 -21
- package/lib/core/naanlib.js +7 -7
- package/package.json +1 -1
- package/plugins/serviceAws/aws/aws-sdk-node.min.js +1 -1
- package/plugins/serviceAws/aws/aws-sdk.min.js +1 -1
- package/plugins/serviceAws/aws/lambda_ws_init.nlg +2 -1
- package/plugins/serviceAws/aws_dynamo.nlg +27 -20
- package/plugins/serviceAws/aws_dynextra.nlg +110 -5
- package/plugins/serviceAws/aws_lambda.nlg +4 -8
- package/plugins/serviceAws/aws_sqs.nlg +113 -0
- package/plugins/serviceAws/serviceAws.nlg +1 -1
- package/plugins/serviceYC/generic_api.yaml +36 -0
- package/plugins/serviceYC/naanide-relay-index.js +148 -0
- package/plugins/serviceYC/serviceYC.nlg +59 -0
- package/plugins/serviceYC/yc_function.nlg +161 -0
- package/test/test_01_core.nlg +2 -2
- package/test/test_02_context.nlg +2 -2
- package/test/test_05_strings.nlg +11 -1
- package/test/test_06_lingoparse.nlg +43 -14
package/LICENSE.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Naan for NPM version 1.0.
|
|
1
|
+
**Naan for NPM** version **1.0.8+1** is released under the MIT License:
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2017-
|
|
3
|
+
Copyright (c) 2017-2023 Zulch Laboratories, Inc.
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
|
@@ -17,5 +17,4 @@ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
17
17
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
18
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
19
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
Naan is an async-first software platform for rapid development.
|
|
5
5
|
|
|
6
6
|
#### Release:
|
|
7
|
-
Naan for NPM version 1.0.
|
|
8
|
-
Copyright (c) 2017-
|
|
7
|
+
**Naan for NPM** version **1.0.8+1**
|
|
8
|
+
Copyright (c) 2017-2023 Zulch Laboratories, Inc.
|
|
9
9
|
|
|
10
10
|
#### Features
|
|
11
11
|
- **Naan** runs in NodeJS and web browsers using JavaScript
|
|
@@ -52,6 +52,24 @@ Naan prints the results of evaluating each expression with the REPL, but not
|
|
|
52
52
|
by default with an expression or source file. The interactive flag overrides
|
|
53
53
|
this to print the result of each expression in all cases.
|
|
54
54
|
|
|
55
|
+
##### Example shell commands
|
|
56
|
+
|
|
57
|
+
Define a function, call it, and return the length of the base-10 result. First recursive and then tail recursive:
|
|
58
|
+
|
|
59
|
+
```
|
|
60
|
+
% naan -e "function fact(x){if x>0 x*fact(x-1) else 1}(1000).length"
|
|
61
|
+
2568
|
|
62
|
+
% naan -e "function factr(x,a){if x>0 factr(x-1,x*a) else a}(10000,1).length"
|
|
63
|
+
35660
|
|
64
|
+
```
|
|
65
|
+
Fetch your public IP from a website (NodeJS version 18 or later):
|
|
66
|
+
|
|
67
|
+
```
|
|
68
|
+
% naan -e "new(await(await(js.g.fetch('http://ip.jsontest.com/')).1.json()).1)"
|
|
69
|
+
{ ip: "64.201.122.183" }
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
|
|
55
73
|
##### Shell scripting
|
|
56
74
|
|
|
57
75
|
When installed globally, Naan can be used for shell scripts with the [Shebang](https://en.wikipedia.org/wiki/Shebang_(Unix))
|
package/bin/index.js
CHANGED
|
@@ -58,11 +58,11 @@ process.argv.every((val, index) => {
|
|
|
58
58
|
return (true);
|
|
59
59
|
}
|
|
60
60
|
if (val == "--version") {
|
|
61
|
-
console.log("1.0.
|
|
61
|
+
console.log("1.0.8");
|
|
62
62
|
process.exit(0);
|
|
63
63
|
}
|
|
64
64
|
if (val == "--buildno") {
|
|
65
|
-
console.log("1.0.
|
|
65
|
+
console.log("1.0.8+1");
|
|
66
66
|
process.exit(0);
|
|
67
67
|
}
|
|
68
68
|
if (val.substring(0,1) == "-") {
|
package/dist/env_web.js
CHANGED
|
@@ -311,11 +311,73 @@ exports.NaanControllerWeb = function() {
|
|
|
311
311
|
this.VsiteRefresh = function VsiteRefresh(url_origin) {
|
|
312
312
|
if (vsiteName && window.location.href.startsWith(url_origin)) {
|
|
313
313
|
window.location.reload(); // we have changed underneath
|
|
314
|
+
window.scroll(0,0); // Chrome 106 had flood pants 🤓
|
|
314
315
|
return (true);
|
|
315
316
|
}
|
|
316
317
|
return (false);
|
|
317
318
|
};
|
|
318
319
|
|
|
320
|
+
//==========================================================================
|
|
321
|
+
// Browser Console Terminal
|
|
322
|
+
//--------------------------------------------------------------------------
|
|
323
|
+
|
|
324
|
+
// Commands:
|
|
325
|
+
// Naanlang.debug(<text>) -- command line text entry
|
|
326
|
+
// Naanlang.int() -- interrupt and enter debugger
|
|
327
|
+
// Naanlang.detach() -- close the console terminal
|
|
328
|
+
|
|
329
|
+
var conDebTerm;
|
|
330
|
+
|
|
331
|
+
//
|
|
332
|
+
// ConsoleDebugTerminal
|
|
333
|
+
//
|
|
334
|
+
function ConsoleDebugTerminal() {
|
|
335
|
+
var termSelf = this;
|
|
336
|
+
//
|
|
337
|
+
// OnMessageOut
|
|
338
|
+
//
|
|
339
|
+
this.OnMessage = function OnMessage(msg) {
|
|
340
|
+
if (msg.id == "debugtext")
|
|
341
|
+
console.log("dbug-" + msg.level + " " + msg.text);
|
|
342
|
+
else if (msg.id == "textout")
|
|
343
|
+
console.log(msg.text);
|
|
344
|
+
};
|
|
345
|
+
//
|
|
346
|
+
// cmd
|
|
347
|
+
//
|
|
348
|
+
this.cmd = function cmd(keys) {
|
|
349
|
+
keys = keys.trim();
|
|
350
|
+
contSelf.Return(keys + "\n", termSelf);
|
|
351
|
+
return (keys);
|
|
352
|
+
};
|
|
353
|
+
//
|
|
354
|
+
// int
|
|
355
|
+
//
|
|
356
|
+
this.int = function int() {
|
|
357
|
+
contSelf.Interrupt();
|
|
358
|
+
};
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
//
|
|
362
|
+
// debug
|
|
363
|
+
//
|
|
364
|
+
function debug(text) {
|
|
365
|
+
if (!conDebTerm) {
|
|
366
|
+
conDebTerm = new ConsoleDebugTerminal();
|
|
367
|
+
contSelf.Attach(conDebTerm);
|
|
368
|
+
}
|
|
369
|
+
exports.debug = conDebTerm.cmd;
|
|
370
|
+
exports.int = conDebTerm.int;
|
|
371
|
+
exports.detach = function() {
|
|
372
|
+
contSelf.Detach(conDebTerm);
|
|
373
|
+
exports.debug = debug;
|
|
374
|
+
exports.int = undefined;
|
|
375
|
+
exports.detach = undefined;
|
|
376
|
+
conDebTerm = false;
|
|
377
|
+
};
|
|
378
|
+
return (conDebTerm.cmd(text));
|
|
379
|
+
}
|
|
380
|
+
exports.debug = debug;
|
|
319
381
|
|
|
320
382
|
//==========================================================================
|
|
321
383
|
// Clone Debug Interface
|
|
@@ -528,27 +590,34 @@ exports.NaanControllerWeb = function() {
|
|
|
528
590
|
}
|
|
529
591
|
|
|
530
592
|
function virtualOpen() {
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
593
|
+
try {
|
|
594
|
+
if (window.opener && window.opener.Naanlang) {
|
|
595
|
+
vsiteName = window.document.title; // consistent name at open and close
|
|
596
|
+
window.opener.Naanlang.naancon.DispatchMessage({
|
|
597
|
+
op: "VsiteOpen",
|
|
598
|
+
name: vsiteName,
|
|
599
|
+
naancont: contSelf,
|
|
600
|
+
title: vsiteName + " $Version$"
|
|
601
|
+
});
|
|
602
|
+
}
|
|
603
|
+
} catch (e) {
|
|
604
|
+
}
|
|
539
605
|
}
|
|
540
606
|
|
|
541
607
|
function virtualClose() {
|
|
542
|
-
|
|
543
|
-
window.opener.Naanlang
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
608
|
+
try {
|
|
609
|
+
if (window.opener && window.opener.Naanlang) {
|
|
610
|
+
window.opener.Naanlang.naancon.DispatchMessage({
|
|
611
|
+
op: "VsiteClose",
|
|
612
|
+
name: vsiteName,
|
|
613
|
+
naancont: contSelf,
|
|
614
|
+
title: vsiteName + " $Version$"
|
|
615
|
+
});
|
|
616
|
+
termTextOut("\x1b[90m\x1b[3m".concat("\nwindow closed", "\x1b[0m\n"));
|
|
617
|
+
}
|
|
618
|
+
} catch (e) {
|
|
551
619
|
}
|
|
620
|
+
vsiteName = false; // window is going away
|
|
552
621
|
}
|
|
553
622
|
|
|
554
623
|
/*jshint sub:true */
|