@naanlang/naan 1.0.6 → 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 +91 -18
- package/dist/naan.min.js +7 -7
- package/frameworks/browser/browser.nlg +92 -3
- package/frameworks/browser/https_request.nlg +2 -2
- package/frameworks/browser/sworker.js +17 -17
- package/frameworks/browser/terminals.nlg +14 -12
- package/frameworks/browser/workers.nlg +13 -6
- package/frameworks/client/psm_client.nlg +1 -0
- package/frameworks/common/common.nlg +39 -8
- 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 +187 -74
- package/frameworks/project/projects.nlg +42 -17
- package/frameworks/running/running.nlg +33 -11
- package/frameworks/running/taskexec.nlg +1 -1
- package/frameworks/storage/file_manager.nlg +2 -1
- package/frameworks/storage/psm.nlg +20 -4
- package/frameworks/storage/psm_dbtables.nlg +13 -3
- package/lib/browser/env_web.js +93 -20
- package/lib/browser/env_webworker.js +10 -0
- package/lib/core/naanlib.js +7 -7
- package/package.json +2 -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 +45 -26
- package/plugins/serviceAws/aws_dynextra.nlg +157 -32
- package/plugins/serviceAws/aws_lambda.nlg +4 -8
- package/plugins/serviceAws/aws_s3.nlg +74 -28
- package/plugins/serviceAws/aws_sqs.nlg +113 -0
- package/plugins/serviceAws/dbt_aws.nlg +73 -24
- package/plugins/serviceAws/psm_aws.nlg +30 -11
- package/plugins/serviceAws/serviceAws.nlg +2 -4
- 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
|
@@ -296,7 +296,7 @@ closure projConnector(projman, projtype, local connector, watch) {
|
|
|
296
296
|
*
|
|
297
297
|
* Nide.proj/
|
|
298
298
|
* nide_cliser.cfg - JSON definition of the project (see below)
|
|
299
|
-
* NaanIDE_version.txt - [default] substitution file defining 1.0.
|
|
299
|
+
* NaanIDE_version.txt - [default] substitution file defining 1.0.8+1 etc.
|
|
300
300
|
* NaanIDE_version_builds.txt - [default] contains current build number as decimal string
|
|
301
301
|
* build/ - [optional] default build output location
|
|
302
302
|
* NaanIDE.lic - [optional] defines Zulch Laboratories, Inc. and other license info
|
|
@@ -408,7 +408,11 @@ closure projConfig(projman, where, projID, local procon, fs, configpath) {
|
|
|
408
408
|
if error
|
|
409
409
|
debuglog("projConfig.writeConfig cannot write local storage:", ErrorString(error))
|
|
410
410
|
}
|
|
411
|
-
|
|
411
|
+
if procon.configMD5 { // don't overwrite existing file
|
|
412
|
+
data = HashMD5(JSONstringify(procon.configDict)) // ### it messes up the formatting and
|
|
413
|
+
error = false // is manually maintained anyway
|
|
414
|
+
} else
|
|
415
|
+
`(error, data) = fs.writeFile(configpath, JSONstringify(procon.configDict))
|
|
412
416
|
if !error {
|
|
413
417
|
procon.configMD5 = data
|
|
414
418
|
`(error, info) = fs.info(configpath)
|
|
@@ -561,37 +565,44 @@ closure projConfig(projman, where, projID, local procon, fs, configpath) {
|
|
|
561
565
|
|
|
562
566
|
// buildrules
|
|
563
567
|
//
|
|
564
|
-
// Get the build rules for the named stage.
|
|
568
|
+
// Get the build rules for the named stage, reloading the project configuration if changed.
|
|
565
569
|
//
|
|
566
|
-
function buildrules(stage, local rules, common, rule, key) {
|
|
570
|
+
function buildrules(stage, local error, data, rules, common, rule, key) {
|
|
571
|
+
if !procon.loaded
|
|
572
|
+
return (list(Error("project not loaded")))
|
|
573
|
+
`(error, data) = procon.changed()
|
|
574
|
+
if error
|
|
575
|
+
return (list(error))
|
|
567
576
|
rules = procon.configDict."build-rules"[stage]
|
|
568
577
|
if !rules
|
|
569
578
|
rules = procon.configDict.build // fallback to old config structure
|
|
570
579
|
rules = new(rules)
|
|
571
|
-
|
|
580
|
+
if !rules["no-common"]
|
|
581
|
+
common = procon.configDict."build-common"
|
|
572
582
|
if common {
|
|
573
583
|
for rule in common
|
|
574
584
|
if !rules[rule]
|
|
575
585
|
rules[rule] = common[rule] // common rule was not overridden
|
|
576
|
-
else if array(common[rule], rules[rule])
|
|
586
|
+
else if array(common[rule], rules[rule]) // ### array only tests first argument 20220909 Rcz
|
|
577
587
|
rules[rule] = common[rule].concat(rules[rule]) // merge common array with rule
|
|
578
|
-
else if dictionary(common[rule], rules[rule]) {
|
|
588
|
+
else if dictionary(common[rule], rules[rule]) { // ### dictionary only tests first argument 20220909 Rcz
|
|
579
589
|
for key in common[rule] // merge common dictionary with rule
|
|
580
590
|
if !rules[rule][key]
|
|
581
591
|
rules[rule][key] = common[rule][key]
|
|
582
592
|
}
|
|
583
593
|
}
|
|
584
|
-
rules
|
|
594
|
+
list(false, rules)
|
|
585
595
|
}
|
|
586
596
|
|
|
587
597
|
// run
|
|
588
598
|
//
|
|
589
599
|
// Run the project by building and then launching.
|
|
590
600
|
//
|
|
591
|
-
procon.run = closure run(stage, buildonly,
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
601
|
+
procon.run = closure run(stage, buildonly,
|
|
602
|
+
local error, rules, builder, buildpath, error, buildnum) {
|
|
603
|
+
`(error, rules) = buildrules(stage)
|
|
604
|
+
if error
|
|
605
|
+
return (list(error))
|
|
595
606
|
if !rules || !rules.products
|
|
596
607
|
return (list(Error("build rules missing or incomplete")))
|
|
597
608
|
buildpath = fs.path.join(proj_configDataFolder, rules.products)
|
|
@@ -628,13 +639,27 @@ closure projConfig(projman, where, projID, local procon, fs, configpath) {
|
|
|
628
639
|
//
|
|
629
640
|
// Publish the project to its configured location.
|
|
630
641
|
//
|
|
631
|
-
|
|
632
|
-
|
|
642
|
+
// {
|
|
643
|
+
// input: "tutorApp/www/"
|
|
644
|
+
// sources: [""]
|
|
645
|
+
// output: ""
|
|
646
|
+
// cacheControl: "max-age=2592000"
|
|
647
|
+
// }
|
|
648
|
+
//
|
|
649
|
+
procon.publish = closure publish(stage,
|
|
650
|
+
local error, rules, where, publish, error, outOptions, outfs, inpath) {
|
|
651
|
+
`(error, rules) = buildrules(stage)
|
|
652
|
+
if error
|
|
653
|
+
return (list(error))
|
|
633
654
|
publish = rules.publish
|
|
634
655
|
where = procon.localDict.publish[stage].where
|
|
635
656
|
if !rules || !where
|
|
636
657
|
return (list(Error("no project publish location configured")))
|
|
637
|
-
|
|
658
|
+
if publish.cacheControl
|
|
659
|
+
outOptions = {
|
|
660
|
+
cacheControl: publish.cacheControl
|
|
661
|
+
}
|
|
662
|
+
`(error, outfs) = projman.locate.connect(where.locationID, "NideFS", where.path, outOptions)
|
|
638
663
|
if error
|
|
639
664
|
return (list(Error("can't access publishing filesystem", error)))
|
|
640
665
|
inpath = fs.path.join(proj_configDataFolder, rules.products, publish.input)
|
|
@@ -671,8 +696,8 @@ closure projConfig(projman, where, projID, local procon, fs, configpath) {
|
|
|
671
696
|
*/
|
|
672
697
|
|
|
673
698
|
function projInit(local manifest) {
|
|
674
|
-
|
|
675
|
-
|
|
699
|
+
manifest = `(ProjectManager, projTracker, projConnector, proj_configDataFolder,
|
|
700
|
+
proj_cliserConfigFile, projConfig, projInit)
|
|
676
701
|
|
|
677
702
|
Naan.module.build(module.id, "projects", function(modobj, compobj) {
|
|
678
703
|
require("./project.nlg")
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* column positioning: // // !
|
|
8
8
|
*
|
|
9
|
-
* Copyright (c) 2021 by Richard C. Zulch
|
|
9
|
+
* Copyright (c) 2021-2023 by Richard C. Zulch
|
|
10
10
|
*
|
|
11
11
|
*/
|
|
12
12
|
|
|
@@ -48,17 +48,26 @@ function baseproc(procdef) {
|
|
|
48
48
|
/*
|
|
49
49
|
* pathmatch
|
|
50
50
|
*
|
|
51
|
-
* Given a parent symbol and a tuple of child
|
|
52
|
-
*
|
|
51
|
+
* Given a parent symbol and a tuple of child procedures within it, return the child procedure
|
|
52
|
+
* named by the path in the tuple. Each element in the child procedures is either a symbol == to the
|
|
53
|
+
* procedure or, in the case of lambdas, a tuple comprising the procedure symbol and an integer
|
|
54
|
+
* specifying the nth matching child. This is necessary because a procedure can have any number of
|
|
55
|
+
* children named lambda, and we need to pick the right ones even though we don't have identical
|
|
56
|
+
* symbols.
|
|
53
57
|
*
|
|
54
58
|
*/
|
|
55
59
|
|
|
56
|
-
function pathmatch(parent, path, local segment) {
|
|
60
|
+
function pathmatch(parent, path, local segment, nth, child) {
|
|
57
61
|
if empty(path)
|
|
58
62
|
return (parent)
|
|
59
|
-
segment =
|
|
63
|
+
segment = pop(path)
|
|
64
|
+
if tuple(segment) { // select nth instance of matching symbol
|
|
65
|
+
nth = segment.1
|
|
66
|
+
segment = segment.0
|
|
67
|
+
} else
|
|
68
|
+
nth = 0
|
|
60
69
|
for child in parent@\.children
|
|
61
|
-
if
|
|
70
|
+
if child == segment && nth-- == 0
|
|
62
71
|
return (pathmatch(child, path))
|
|
63
72
|
false
|
|
64
73
|
};
|
|
@@ -68,14 +77,27 @@ function pathmatch(parent, path, local segment) {
|
|
|
68
77
|
* procpath
|
|
69
78
|
*
|
|
70
79
|
* Return a tuple of parent prcoedure symbols for the specified child procedure. Note that this
|
|
71
|
-
* path includes the parent but pathmatch above requires the parent as a separate argument.
|
|
80
|
+
* path includes the parent but pathmatch above requires the parent as a separate argument. As noted
|
|
81
|
+
* above, the segments of the path are either a procedure symbol, or a tuple of symbol and integer.
|
|
72
82
|
*
|
|
73
83
|
*/
|
|
74
84
|
|
|
75
|
-
function procpath(procdef, local path) {
|
|
85
|
+
function procpath(procdef, local path, segment, parent, peers, nth, peer) {
|
|
76
86
|
loop {
|
|
77
|
-
|
|
78
|
-
parent =
|
|
87
|
+
segment = procdef.1
|
|
88
|
+
parent = segment@\.parent
|
|
89
|
+
if segment == lambda && parent { // lambdas all have same name
|
|
90
|
+
peers = parent@\.children
|
|
91
|
+
nth = 0
|
|
92
|
+
for peer in peers {
|
|
93
|
+
if peer === segment
|
|
94
|
+
break
|
|
95
|
+
if peer == segment
|
|
96
|
+
++nth
|
|
97
|
+
}
|
|
98
|
+
push(list(segment, nth), path) // we are the nth of the matching ones
|
|
99
|
+
} else
|
|
100
|
+
push(segment, path)
|
|
79
101
|
if !parent
|
|
80
102
|
break
|
|
81
103
|
procdef = parent.proc
|
|
@@ -144,7 +166,7 @@ function procstring(procdef, options, local name, output, parm) {
|
|
|
144
166
|
function runnInit(local manifest) {
|
|
145
167
|
manifest = `(rootproc, baseproc, pathmatch, procpath, procname, procstring, runnInit)
|
|
146
168
|
|
|
147
|
-
build(module.id, "running", closure(modobj, compobj) {
|
|
169
|
+
Naan.module.build(module.id, "running", closure(modobj, compobj) {
|
|
148
170
|
require("../common").LiveImport()
|
|
149
171
|
compobj.manifest = manifest
|
|
150
172
|
})
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* column positioning: // // !
|
|
8
8
|
*
|
|
9
|
-
* Copyright (c) 2020-
|
|
9
|
+
* Copyright (c) 2020-2022 by Richard C. Zulch
|
|
10
10
|
*
|
|
11
11
|
*/
|
|
12
12
|
|
|
@@ -287,6 +287,7 @@ closure FileManager(fs, options, local files, watch, opqueue, willgit, hadgit) {
|
|
|
287
287
|
fixed: true
|
|
288
288
|
ignoreCase: true
|
|
289
289
|
returnText: true
|
|
290
|
+
excludeDirs: []
|
|
290
291
|
}
|
|
291
292
|
}
|
|
292
293
|
|
|
@@ -248,8 +248,8 @@ closure MakePSMutil(fs, local util) {
|
|
|
248
248
|
// erase: <boolean> -- remove extraneous files in destination folders
|
|
249
249
|
// force: <boolean> -- copy files even if older (default is only copy if new/newer)
|
|
250
250
|
// follow: <boolean> -- follow links instead of treating them as files
|
|
251
|
-
//
|
|
252
|
-
//
|
|
251
|
+
// idmode: <boolean> -- preserve id/mode where possible
|
|
252
|
+
// times: <boolean> -- preserve time where possible
|
|
253
253
|
// }
|
|
254
254
|
//
|
|
255
255
|
// Limitations:
|
|
@@ -336,7 +336,8 @@ closure MakePSMutil(fs, local util) {
|
|
|
336
336
|
//
|
|
337
337
|
// Pass 3 - copy files and links
|
|
338
338
|
//
|
|
339
|
-
asyncArray(copies, 10, closure cpfiles(entry, index, elements,
|
|
339
|
+
asyncArray(copies, 10, closure cpfiles(entry, index, elements,
|
|
340
|
+
local error, data, dest, instat, outstat) {
|
|
340
341
|
`(error, instat) = fs.info(entry.source, fsopt)
|
|
341
342
|
if !error {
|
|
342
343
|
`(error, outstat) = outfs.info(entry.dest)
|
|
@@ -348,6 +349,13 @@ closure MakePSMutil(fs, local util) {
|
|
|
348
349
|
error = Error("deepcopy: can't overwrite", entry.dest)
|
|
349
350
|
else if instat.type == "symlink" && !options.follow {
|
|
350
351
|
`(error, data) = fs.readlink(entry.source)
|
|
352
|
+
if !error {
|
|
353
|
+
`(error, dest) = outfs.readlink(entry.dest) // get destination to compare links
|
|
354
|
+
if dest == data
|
|
355
|
+
return // symlink unchanged
|
|
356
|
+
outfs.delete(entry.dest)
|
|
357
|
+
error = false // ignore any destination errors
|
|
358
|
+
}
|
|
351
359
|
if !error
|
|
352
360
|
`(error, data) = outfs.symlink(data, entry.dest)
|
|
353
361
|
}
|
|
@@ -355,8 +363,16 @@ closure MakePSMutil(fs, local util) {
|
|
|
355
363
|
`(error, data) = fs.readFile(entry.source, { encoding: "binary"})
|
|
356
364
|
if !error
|
|
357
365
|
`(error, data) = outfs.writeFile(entry.dest, data, { encoding: "binary"})
|
|
358
|
-
if !error && options.
|
|
366
|
+
if !error && (options.idmode || options.times) {
|
|
367
|
+
if !options.idmode
|
|
368
|
+
instat.mode = instat.uid = instat.gid = false
|
|
369
|
+
if !options.times {
|
|
370
|
+
instat.mtimeMs = instat.mtime = false
|
|
371
|
+
instat.nodejs_stat.mtimeMs = instat.nodejs_stat.mtime = false
|
|
372
|
+
instat.nodejs_stat.atimeMs = instat.nodejs_stat.atime = false
|
|
373
|
+
}
|
|
359
374
|
`(error) = outfs.setInfo(entry.dest, instat)
|
|
375
|
+
}
|
|
360
376
|
}
|
|
361
377
|
}
|
|
362
378
|
if error
|
|
@@ -465,14 +465,24 @@ closure FSview(table, rootpath, local view, error) {
|
|
|
465
465
|
if !callback
|
|
466
466
|
return (syncAdapter(info, path))
|
|
467
467
|
dbReadRecord(path, true, function(error, data, local finfo) {
|
|
468
|
-
if data {
|
|
468
|
+
if data { // try to glean the node info
|
|
469
469
|
finfo = new(data.finfo)
|
|
470
470
|
if !finfo
|
|
471
471
|
finfo = { }
|
|
472
472
|
if data._md5
|
|
473
473
|
finfo.md5 = data._md5
|
|
474
|
-
if data.
|
|
475
|
-
finfo.
|
|
474
|
+
if xobject(data.modified) {
|
|
475
|
+
finfo.mtimeMs = data.modified.getTime()
|
|
476
|
+
finfo.mtime = data.modified.toISOString()
|
|
477
|
+
}
|
|
478
|
+
if data.contentType
|
|
479
|
+
finfo.contentType = data.contentType
|
|
480
|
+
if data.length
|
|
481
|
+
finfo.length = data.length
|
|
482
|
+
else if data._length
|
|
483
|
+
finfo.length = data._length
|
|
484
|
+
if finfo.length
|
|
485
|
+
finfo.type = "file" }
|
|
476
486
|
else if path == "" {
|
|
477
487
|
error = false // we were asked for info on superoot
|
|
478
488
|
finfo = {
|
package/lib/browser/env_web.js
CHANGED
|
@@ -309,13 +309,75 @@ exports.NaanControllerWeb = function() {
|
|
|
309
309
|
//
|
|
310
310
|
|
|
311
311
|
this.VsiteRefresh = function VsiteRefresh(url_origin) {
|
|
312
|
-
if (window.location.href.startsWith(url_origin)) {
|
|
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
|
|
@@ -458,7 +520,7 @@ exports.NaanControllerWeb = function() {
|
|
|
458
520
|
statedoc.curversion = kStateCurrentVersion;
|
|
459
521
|
statedoc.firstver = kStateFirstVersion;
|
|
460
522
|
statedoc.licensee = "MIT-License";
|
|
461
|
-
statedoc.verstring = "1.0.
|
|
523
|
+
statedoc.verstring = "1.0.8+1";
|
|
462
524
|
statedoc.date = new Date().toISOString();
|
|
463
525
|
statedoc.prefs = prefs;
|
|
464
526
|
statedoc.naan = naanlib.saveState(false); // true to optimize, which is a bit slower
|
|
@@ -476,7 +538,7 @@ exports.NaanControllerWeb = function() {
|
|
|
476
538
|
|| statedoc.firstver > kStateCurrentVersion
|
|
477
539
|
|| statedoc.curversion < kStateFirstVersion
|
|
478
540
|
|| statedoc.licensee != "MIT-License"
|
|
479
|
-
|| statedoc.verstring != "1.0.
|
|
541
|
+
|| statedoc.verstring != "1.0.8+1")
|
|
480
542
|
{
|
|
481
543
|
localStorage.removeItem("NaanState_Hosted");
|
|
482
544
|
return (false);
|
|
@@ -528,26 +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 + " 1.0.8+1"
|
|
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
|
-
|
|
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 + " 1.0.8+1"
|
|
615
|
+
});
|
|
616
|
+
termTextOut("\x1b[90m\x1b[3m".concat("\nwindow closed", "\x1b[0m\n"));
|
|
617
|
+
}
|
|
618
|
+
} catch (e) {
|
|
550
619
|
}
|
|
620
|
+
vsiteName = false; // window is going away
|
|
551
621
|
}
|
|
552
622
|
|
|
553
623
|
/*jshint sub:true */
|
|
@@ -556,7 +626,10 @@ exports.NaanControllerWeb = function() {
|
|
|
556
626
|
naanlib.banner();
|
|
557
627
|
var hostpath = naanlib.js.r("path").dirname(window.location.href);
|
|
558
628
|
naanlib.start({
|
|
559
|
-
cmd: '
|
|
629
|
+
cmd: 'App.version = "1.0.8+1";;\r\n'
|
|
630
|
+
+ 'App.cache = "a7694c55ac4ee13a1946011bac913099";;\r\n'
|
|
631
|
+
+ 'Naan.module.requireQuery({ naanver: App.cache });;\r\n'
|
|
632
|
+
+ 'Naan.module.webparse("naan_init.nlg", "' + hostpath + '", { naanver: App.cache });;\r\n'
|
|
560
633
|
});
|
|
561
634
|
} else {
|
|
562
635
|
if (!replstate) { // saved state but never opened a terminal
|
|
@@ -104,6 +104,16 @@ exports.NaanControllerWebWorker = function NaanControllerWebWorker() {
|
|
|
104
104
|
return (proc);
|
|
105
105
|
};
|
|
106
106
|
|
|
107
|
+
targSelf.Download = function Download(bits, name, options) {
|
|
108
|
+
postMessage({ // tell browser host to download a file
|
|
109
|
+
id: "download",
|
|
110
|
+
bits: bits,
|
|
111
|
+
name: name,
|
|
112
|
+
options: options,
|
|
113
|
+
});
|
|
114
|
+
return (name);
|
|
115
|
+
};
|
|
116
|
+
|
|
107
117
|
onmessage = function(e) {
|
|
108
118
|
var msg = e.data;
|
|
109
119
|
if (msg.id == "interrupt")
|