profoundjs 6.2.0 → 6.4.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.
- package/htdocs/fusionchartsxt/js/maps/fusioncharts.india.js +2 -1
- package/htdocs/fusionchartsxt/js/maps/fusioncharts.jammuandkashmir.js +8 -2
- package/htdocs/fusionchartsxt/js/maps/fusioncharts.ladakh.js +238 -0
- package/htdocs/fusionchartsxt/js/pui-fusioncharts.js +368 -53
- package/htdocs/profoundui/proddata/css/logic.css +21 -2
- package/htdocs/profoundui/proddata/css/profoundui.css +16 -0
- package/htdocs/profoundui/proddata/js/designer.js +3862 -3846
- package/htdocs/profoundui/proddata/js/key_management.js +3 -3
- package/htdocs/profoundui/proddata/js/rich-display-react-component.js +5 -5
- package/htdocs/profoundui/proddata/js/rich-display-vue-component.js +3 -3
- package/htdocs/profoundui/proddata/js/runtime.js +1234 -1230
- package/htdocs/profoundui/proddata/js/soapclient.js +22 -22
- package/index.js +4 -4
- package/package.json +2 -1
- package/profound.jse +1 -1
- package/setup/call.js +1 -1
- package/setup/completeInstall.js +51 -56
- package/setup/convertStartJS.js +40 -30
- package/setup/encrypt_client_file.js +4 -0
- package/setup/install.js +1 -1
- package/setup/install_utils.js +44 -30
- package/setup/lic_client.js +1 -1
- package/setup/modules/papisamples/.noderun/settings.json +5 -0
- package/setup/modules/papisamples/APISample.api.json +313 -0
- package/setup/modules/papisamples/APISample.js +55 -0
- package/setup/modules/papisamples/APISample.json +751 -0
- package/setup/modules/papisamples/README.md +17 -0
- package/setup/modules/papisamples/hobbyshop.csv +6 -0
- package/setup/modules/papisamples/readCSVFile.js +136 -0
- package/setup/pjsdist.savf +0 -0
- package/setup/plugins/mathoperation.js +84 -0
- package/setup/removeExtraComponents.js +4 -6
- package/setup/setup.js +50 -14
package/setup/call.js
CHANGED
package/setup/completeInstall.js
CHANGED
|
@@ -22,7 +22,7 @@ const readline = require("readline");
|
|
|
22
22
|
const iutils = require("./install_utils.js");
|
|
23
23
|
/*
|
|
24
24
|
NOTE: install_info.json
|
|
25
|
-
|
|
25
|
+
|
|
26
26
|
This file contains instructions for completing the installation.
|
|
27
27
|
It tells the process what questions to ask and what commands to run.
|
|
28
28
|
This file is shared with the GUI installer.
|
|
@@ -34,9 +34,8 @@ const semver = require("semver");
|
|
|
34
34
|
|
|
35
35
|
const IBMi = iutils.isIBMi();
|
|
36
36
|
|
|
37
|
-
(async
|
|
37
|
+
(async() => {
|
|
38
38
|
try {
|
|
39
|
-
|
|
40
39
|
const argDefs = {
|
|
41
40
|
alias: {
|
|
42
41
|
"h": "help",
|
|
@@ -58,7 +57,7 @@ const IBMi = iutils.isIBMi();
|
|
|
58
57
|
|
|
59
58
|
// Show help and quit, if requested.
|
|
60
59
|
if (args["help"]) {
|
|
61
|
-
const HELP = `Usage: node complete_install.js [OPTION]
|
|
60
|
+
const HELP = `Usage: node complete_install.js [OPTION]
|
|
62
61
|
-h, --help Print this help and exit.
|
|
63
62
|
-c, --configure Update config.js, if present.
|
|
64
63
|
-s, --silent No interactive prompts.
|
|
@@ -94,7 +93,7 @@ Valid arguments for --silent mode:
|
|
|
94
93
|
argDefs.unknown = function(arg) {
|
|
95
94
|
console.error("complete_install.js: Unknown argument:", arg);
|
|
96
95
|
process.exit(1);
|
|
97
|
-
}
|
|
96
|
+
};
|
|
98
97
|
args = minimist(process.argv.slice(2), argDefs);
|
|
99
98
|
|
|
100
99
|
// Validate arguments.
|
|
@@ -113,7 +112,7 @@ Valid arguments for --silent mode:
|
|
|
113
112
|
}
|
|
114
113
|
}
|
|
115
114
|
|
|
116
|
-
const RED
|
|
115
|
+
const RED = args.silent === true ? "" : "\x1b[31m";
|
|
117
116
|
const RESET = args.silent === true ? "" : "\x1b[0m";
|
|
118
117
|
|
|
119
118
|
// Silent/validation mode.
|
|
@@ -154,7 +153,6 @@ Valid arguments for --silent mode:
|
|
|
154
153
|
|
|
155
154
|
// If config.js doesn't exist, or if --configure is passed, prompt and create/update config.js.
|
|
156
155
|
if (!fileExists(configPath) || args["configure"] === true) {
|
|
157
|
-
|
|
158
156
|
const warnings = getWarnings();
|
|
159
157
|
for (const warning of warnings) {
|
|
160
158
|
console.log("");
|
|
@@ -217,15 +215,14 @@ Valid arguments for --silent mode:
|
|
|
217
215
|
return args.silent === true ? true : answer;
|
|
218
216
|
});
|
|
219
217
|
if (IBMi) {
|
|
220
|
-
svrname
|
|
218
|
+
svrname = answers.strtcpsvr_svrname;
|
|
221
219
|
autostart = answers.strtcpsvr_autostart;
|
|
222
|
-
ccsid
|
|
223
|
-
nodePath
|
|
220
|
+
ccsid = answers.strtcpsvr_ccsid;
|
|
221
|
+
nodePath = answers.strtcpsvr_nodePath;
|
|
224
222
|
}
|
|
225
|
-
|
|
223
|
+
|
|
226
224
|
// Create/update configuration file.
|
|
227
225
|
if (fileExists(configPath)) {
|
|
228
|
-
|
|
229
226
|
config.port = answers.port;
|
|
230
227
|
if (answers.gitSupport === false) {
|
|
231
228
|
config.gitSupport = false;
|
|
@@ -263,10 +260,8 @@ Valid arguments for --silent mode:
|
|
|
263
260
|
console.log("");
|
|
264
261
|
console.log("config.js updated.");
|
|
265
262
|
console.log("");
|
|
266
|
-
|
|
267
263
|
}
|
|
268
264
|
else {
|
|
269
|
-
|
|
270
265
|
let content = fs.readFileSync(path.join(iutils.getSetupDir(), "config.js"), "utf8");
|
|
271
266
|
eval("config = " + content.substr(content.indexOf("{")));
|
|
272
267
|
config.port = answers.port;
|
|
@@ -288,7 +283,7 @@ Valid arguments for --silent mode:
|
|
|
288
283
|
}
|
|
289
284
|
// Check if this is a workspace (if so, default to mysql)
|
|
290
285
|
if (!IBMi && fileExists(path.join(deployDir, "modules", "app", ".noderun", "settings.json"))) {
|
|
291
|
-
if (config.databaseConnections) delete config.databaseConnections;
|
|
286
|
+
if (config.databaseConnections) delete config.databaseConnections; // remove property so that it's appended at the end when we set it
|
|
292
287
|
config.databaseConnections = [{
|
|
293
288
|
name: "default",
|
|
294
289
|
default: true,
|
|
@@ -308,9 +303,7 @@ Valid arguments for --silent mode:
|
|
|
308
303
|
console.log("");
|
|
309
304
|
console.log("config.js created.");
|
|
310
305
|
console.log("");
|
|
311
|
-
|
|
312
306
|
}
|
|
313
|
-
|
|
314
307
|
}
|
|
315
308
|
|
|
316
309
|
// Complete installation.
|
|
@@ -323,7 +316,7 @@ Valid arguments for --silent mode:
|
|
|
323
316
|
if (config.connectorLibrary !== undefined) {
|
|
324
317
|
setupArgs.push("--ibmi-connector-library");
|
|
325
318
|
}
|
|
326
|
-
if (svrname) {
|
|
319
|
+
if (svrname) {
|
|
327
320
|
setupArgs.push("--ibmi-instance=" + svrname);
|
|
328
321
|
if (autostart) {
|
|
329
322
|
setupArgs.push("--ibmi-instance-autostart");
|
|
@@ -360,7 +353,6 @@ Valid arguments for --silent mode:
|
|
|
360
353
|
catch {
|
|
361
354
|
process.exit(1);
|
|
362
355
|
}
|
|
363
|
-
|
|
364
356
|
}
|
|
365
357
|
catch (error) {
|
|
366
358
|
process.stdin.destroy();
|
|
@@ -370,7 +362,6 @@ Valid arguments for --silent mode:
|
|
|
370
362
|
})();
|
|
371
363
|
|
|
372
364
|
async function ask(questionParm, configs, recursive) {
|
|
373
|
-
|
|
374
365
|
let question = questionParm.prompt;
|
|
375
366
|
let defaultAnswer = getDefault(questionParm, configs);
|
|
376
367
|
if (questionParm.type === "boolean") {
|
|
@@ -379,10 +370,10 @@ async function ask(questionParm, configs, recursive) {
|
|
|
379
370
|
|
|
380
371
|
if (defaultAnswer == null) defaultAnswer = "";
|
|
381
372
|
if (typeof defaultAnswer !== "string") defaultAnswer = String(defaultAnswer);
|
|
382
|
-
|
|
373
|
+
|
|
383
374
|
if (defaultAnswer !== "") {
|
|
384
375
|
let lastChar = question.substr(question.length - 1, 1);
|
|
385
|
-
if (lastChar === ":" || lastChar === "?") {
|
|
376
|
+
if (lastChar === ":" || lastChar === "?") {
|
|
386
377
|
question = question.substr(0, question.length - 1) + " (" + defaultAnswer + ")" + lastChar;
|
|
387
378
|
}
|
|
388
379
|
else {
|
|
@@ -414,7 +405,6 @@ async function ask(questionParm, configs, recursive) {
|
|
|
414
405
|
answer = formatAnswer(questionParm, answer);
|
|
415
406
|
}
|
|
416
407
|
return answer;
|
|
417
|
-
|
|
418
408
|
}
|
|
419
409
|
|
|
420
410
|
function fileExists(file) {
|
|
@@ -430,23 +420,38 @@ function fileExists(file) {
|
|
|
430
420
|
}
|
|
431
421
|
|
|
432
422
|
function validateName(name) {
|
|
433
|
-
|
|
434
423
|
const error = iutils.validateIBMiName(name);
|
|
435
424
|
if (error) {
|
|
436
425
|
return error;
|
|
437
426
|
}
|
|
438
427
|
return true;
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
function validateLibrary(name) {
|
|
431
|
+
const err = validateName(name);
|
|
432
|
+
if (err === true) {
|
|
433
|
+
if (iutils.libraryExists(name)) return "Library " + name.toUpperCase() + " already exists. Please use a different name.";
|
|
434
|
+
}
|
|
435
|
+
else return err;
|
|
436
|
+
return true;
|
|
437
|
+
}
|
|
439
438
|
|
|
439
|
+
function validateServer(name) {
|
|
440
|
+
const err = validateName(name);
|
|
441
|
+
if (err === true) {
|
|
442
|
+
const exists = iutils.getIBMiInstances().some(el => el.name === name.toUpperCase());
|
|
443
|
+
if (exists) return "Server Instance " + name.toUpperCase() + " already exists. Please use a different name.";
|
|
444
|
+
}
|
|
445
|
+
else return err;
|
|
446
|
+
return true;
|
|
440
447
|
}
|
|
441
448
|
|
|
442
449
|
function validateIASP(name) {
|
|
443
|
-
|
|
444
450
|
const error = iutils.validateIBMiIASP(name);
|
|
445
451
|
if (error) {
|
|
446
452
|
return error;
|
|
447
453
|
}
|
|
448
454
|
return true;
|
|
449
|
-
|
|
450
455
|
}
|
|
451
456
|
|
|
452
457
|
function validatePort(port) {
|
|
@@ -457,22 +462,18 @@ function validatePort(port) {
|
|
|
457
462
|
}
|
|
458
463
|
|
|
459
464
|
function isValidNodePath(nodePath) {
|
|
460
|
-
|
|
461
465
|
if (!fileExists(nodePath)) {
|
|
462
466
|
return "Path " + nodePath + " does not exist. A valid path name must be entered.";
|
|
463
467
|
}
|
|
464
468
|
return true;
|
|
465
|
-
|
|
466
469
|
}
|
|
467
470
|
|
|
468
471
|
function isValidCcsid(ccsid) {
|
|
469
|
-
|
|
470
472
|
const error = iutils.validateIBMiCCSID(parseInt(ccsid, 10));
|
|
471
473
|
if (error) {
|
|
472
474
|
return error;
|
|
473
475
|
}
|
|
474
476
|
return true;
|
|
475
|
-
|
|
476
477
|
}
|
|
477
478
|
|
|
478
479
|
function validateYesNo(answer) {
|
|
@@ -483,34 +484,31 @@ function validateYesNo(answer) {
|
|
|
483
484
|
}
|
|
484
485
|
|
|
485
486
|
function stringifyConfig(config) {
|
|
486
|
-
|
|
487
487
|
// JavaScript functions (like connectorIPFilter) will be lost when doing JSON.stringify,
|
|
488
488
|
// so we need to do some magic to preserve them.
|
|
489
|
-
|
|
489
|
+
|
|
490
490
|
let funkz = [];
|
|
491
491
|
let configString = "\nmodule.exports = ";
|
|
492
492
|
|
|
493
493
|
configString += JSON.stringify(config, (key, val) => {
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
494
|
+
if (typeof val === "function") {
|
|
495
|
+
let n = funkz.length;
|
|
496
|
+
funkz.push(val.toString());
|
|
497
|
+
return `___function${n}___`;
|
|
498
|
+
}
|
|
499
|
+
return val;
|
|
500
500
|
}, " ");
|
|
501
|
-
|
|
501
|
+
|
|
502
502
|
configString += "\n";
|
|
503
503
|
|
|
504
|
-
for (var i=0; i<funkz.length; i++) {
|
|
504
|
+
for (var i = 0; i < funkz.length; i++) {
|
|
505
505
|
configString = configString.replace(`"___function${i}___"`, funkz[i]);
|
|
506
506
|
}
|
|
507
507
|
|
|
508
508
|
return configString;
|
|
509
|
-
|
|
510
509
|
}
|
|
511
510
|
|
|
512
511
|
function validatePUIInstance(name) {
|
|
513
|
-
|
|
514
512
|
name = name.toUpperCase();
|
|
515
513
|
const result = validateName(name);
|
|
516
514
|
if (result !== true) {
|
|
@@ -522,12 +520,10 @@ function validatePUIInstance(name) {
|
|
|
522
520
|
return data.error;
|
|
523
521
|
}
|
|
524
522
|
return true;
|
|
525
|
-
|
|
526
523
|
}
|
|
527
524
|
|
|
528
525
|
function getPUIInstanceData(name) {
|
|
529
|
-
|
|
530
|
-
// Read the instance DB record to determine the server root and config file paths.
|
|
526
|
+
// Read the instance DB record to determine the server root and config file paths.
|
|
531
527
|
const instanceMember = `/QSYS.LIB/QUSRSYS.LIB/QATMHINSTC.FILE/${name}.MBR`;
|
|
532
528
|
try {
|
|
533
529
|
fs.accessSync(instanceMember, fs.constants.R_OK);
|
|
@@ -565,8 +561,8 @@ function getPUIInstanceData(name) {
|
|
|
565
561
|
}
|
|
566
562
|
).toString();
|
|
567
563
|
const lines = conf.split("\n")
|
|
568
|
-
|
|
569
|
-
|
|
564
|
+
.map(line => line.replace(/\r$/, ""))
|
|
565
|
+
.filter(line => !line.includes("#"));
|
|
570
566
|
|
|
571
567
|
// Determine PUI library.
|
|
572
568
|
// First check for: Define PUI_LIBRARY
|
|
@@ -618,7 +614,6 @@ function getPUIInstanceData(name) {
|
|
|
618
614
|
|
|
619
615
|
// Gets a PUI variable define
|
|
620
616
|
function getPUIDefine(name) {
|
|
621
|
-
|
|
622
617
|
const re = new RegExp(`${name}\\s+(.+)`);
|
|
623
618
|
for (const line of lines) {
|
|
624
619
|
let match = line.match(/^\s*Define\s+(.+)/i);
|
|
@@ -631,7 +626,6 @@ function getPUIInstanceData(name) {
|
|
|
631
626
|
}
|
|
632
627
|
}
|
|
633
628
|
}
|
|
634
|
-
|
|
635
629
|
}
|
|
636
630
|
|
|
637
631
|
// Gets library name from ScriptAlias directive matching alias path name.
|
|
@@ -663,7 +657,6 @@ function getPUIInstanceData(name) {
|
|
|
663
657
|
}
|
|
664
658
|
}
|
|
665
659
|
}
|
|
666
|
-
|
|
667
660
|
}
|
|
668
661
|
|
|
669
662
|
function argDefined(argDefs, args, name) {
|
|
@@ -680,7 +673,6 @@ function argDefined(argDefs, args, name) {
|
|
|
680
673
|
}
|
|
681
674
|
|
|
682
675
|
async function buildArgHelp() {
|
|
683
|
-
|
|
684
676
|
const nameHeading = "Argument";
|
|
685
677
|
const labelHeading = "Description";
|
|
686
678
|
const dftHeading = "Default Value";
|
|
@@ -690,10 +682,10 @@ async function buildArgHelp() {
|
|
|
690
682
|
const pad = 3;
|
|
691
683
|
await forEachQuestion(question => {
|
|
692
684
|
if (question.id) {
|
|
693
|
-
const name = "--" + question.id
|
|
685
|
+
const name = "--" + question.id;
|
|
694
686
|
const label = question.label;
|
|
695
687
|
opts[name] = {
|
|
696
|
-
label
|
|
688
|
+
label,
|
|
697
689
|
default: question.required ? getDefault(question) : "** NONE **"
|
|
698
690
|
};
|
|
699
691
|
if (name.length > nameLen) {
|
|
@@ -716,7 +708,6 @@ async function buildArgHelp() {
|
|
|
716
708
|
argHelp += opts[name].default;
|
|
717
709
|
}
|
|
718
710
|
return argHelp;
|
|
719
|
-
|
|
720
711
|
}
|
|
721
712
|
|
|
722
713
|
function checkItem(item) {
|
|
@@ -806,7 +797,6 @@ function getWarnings() {
|
|
|
806
797
|
}
|
|
807
798
|
|
|
808
799
|
async function forEachQuestion(fn) {
|
|
809
|
-
|
|
810
800
|
await iter(install_info.questions);
|
|
811
801
|
|
|
812
802
|
async function iter(questions) {
|
|
@@ -820,7 +810,6 @@ async function forEachQuestion(fn) {
|
|
|
820
810
|
}
|
|
821
811
|
}
|
|
822
812
|
}
|
|
823
|
-
|
|
824
813
|
}
|
|
825
814
|
|
|
826
815
|
function validate(question, answer) {
|
|
@@ -834,9 +823,15 @@ function validate(question, answer) {
|
|
|
834
823
|
else if (question.id === "puiInstance") {
|
|
835
824
|
validator = validatePUIInstance;
|
|
836
825
|
}
|
|
826
|
+
else if (question.id === "connectorLibrary") {
|
|
827
|
+
validator = validateLibrary;
|
|
828
|
+
}
|
|
837
829
|
else if (question.id === "connectorIASP") {
|
|
838
830
|
validator = validateIASP;
|
|
839
831
|
}
|
|
832
|
+
else if (question.id === "strtcpsvr_svrname") {
|
|
833
|
+
validator = validateServer;
|
|
834
|
+
}
|
|
840
835
|
else if (question.type === "boolean") {
|
|
841
836
|
validator = validateYesNo;
|
|
842
837
|
}
|
package/setup/convertStartJS.js
CHANGED
|
@@ -8,7 +8,6 @@ const moment = require("moment");
|
|
|
8
8
|
const profound = require("profoundjs");
|
|
9
9
|
|
|
10
10
|
module.exports = function(file) {
|
|
11
|
-
|
|
12
11
|
let content = fs.readFileSync(file, "utf8");
|
|
13
12
|
const ast = acorn.parse(content, {
|
|
14
13
|
ecmaVersion: "latest",
|
|
@@ -42,21 +41,24 @@ module.exports = function(file) {
|
|
|
42
41
|
if (node.type === "Program" || isFunction(node) || (node.type === "BlockStatement" && !isFunction(parent))) {
|
|
43
42
|
// Set up new scope.
|
|
44
43
|
const scope = {
|
|
45
|
-
node
|
|
44
|
+
node,
|
|
46
45
|
objects: new Map(),
|
|
47
46
|
scopes: new Map()
|
|
48
47
|
};
|
|
49
48
|
// Keep track of contained scopes.
|
|
50
49
|
const containingScope = scopeMap.get(scopeStack[scopeStack.length - 1]);
|
|
51
|
-
if (containingScope)
|
|
50
|
+
if (containingScope) {
|
|
52
51
|
containingScope.scopes.set(node, scope);
|
|
52
|
+
}
|
|
53
53
|
// Add function parameter names to scope.
|
|
54
54
|
if (isFunction(node)) {
|
|
55
55
|
node.params.forEach(param => {
|
|
56
|
-
if (param.type === "AssignmentPattern")
|
|
56
|
+
if (param.type === "AssignmentPattern") {
|
|
57
57
|
param = param.left;
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
}
|
|
59
|
+
if (param.type === "Identifier") {
|
|
60
|
+
scope.objects.set(param.name, { scope });
|
|
61
|
+
}
|
|
60
62
|
});
|
|
61
63
|
}
|
|
62
64
|
scopeMap.set(node, scope);
|
|
@@ -75,8 +77,9 @@ module.exports = function(file) {
|
|
|
75
77
|
}
|
|
76
78
|
else {
|
|
77
79
|
useStrict = containingFnInfo.useStrict;
|
|
78
|
-
if (node.body.type === "BlockStatement" && node.body.body.length > 0 && node.body.body[0].directive === "use strict")
|
|
80
|
+
if (node.body.type === "BlockStatement" && node.body.body.length > 0 && node.body.body[0].directive === "use strict") {
|
|
79
81
|
useStrict = true;
|
|
82
|
+
}
|
|
80
83
|
}
|
|
81
84
|
}
|
|
82
85
|
fnMap.set(node, {
|
|
@@ -95,7 +98,7 @@ module.exports = function(file) {
|
|
|
95
98
|
node.declarations.forEach(variableDeclarator => {
|
|
96
99
|
if (variableDeclarator.id.type === "Identifier") {
|
|
97
100
|
const scope = node.kind === "var" ? scopeMap.get(fn) : scopeMap.get(scopeStack[scopeStack.length - 1]);
|
|
98
|
-
scope.objects.set(variableDeclarator.id.name, { scope
|
|
101
|
+
scope.objects.set(variableDeclarator.id.name, { scope });
|
|
99
102
|
}
|
|
100
103
|
});
|
|
101
104
|
}
|
|
@@ -113,8 +116,9 @@ module.exports = function(file) {
|
|
|
113
116
|
else if (parent.type === "AssignmentExpression" && parent.right === node) {
|
|
114
117
|
name = getQualifiedName(parent.left);
|
|
115
118
|
}
|
|
116
|
-
if (name)
|
|
119
|
+
if (name) {
|
|
117
120
|
pjsPrefix = name;
|
|
121
|
+
}
|
|
118
122
|
}
|
|
119
123
|
}
|
|
120
124
|
}
|
|
@@ -156,8 +160,9 @@ module.exports = function(file) {
|
|
|
156
160
|
const containingScope = scopeMap.get(scopeStack[scopeStack.length - 2]);
|
|
157
161
|
const containingFn = fnStack[fnStack.length - 2];
|
|
158
162
|
if (node.type === "FunctionDeclaration") {
|
|
159
|
-
if (node.id.name)
|
|
163
|
+
if (node.id.name) {
|
|
160
164
|
fnInfo.name = node.id.name;
|
|
165
|
+
}
|
|
161
166
|
const containingFnInfo = fnMap.get(containingFn);
|
|
162
167
|
fnInfo.scope = (containingFnInfo.useStrict && containingScope.node.type === "BlockStatement") ? containingScope.node : containingFn;
|
|
163
168
|
}
|
|
@@ -183,7 +188,7 @@ module.exports = function(file) {
|
|
|
183
188
|
else if (node.type === "CallExpression") {
|
|
184
189
|
callMap.set(node, {
|
|
185
190
|
containingFn: fn,
|
|
186
|
-
parent
|
|
191
|
+
parent
|
|
187
192
|
});
|
|
188
193
|
const callee = node.callee;
|
|
189
194
|
let calleeName = getQualifiedName(callee);
|
|
@@ -194,7 +199,7 @@ module.exports = function(file) {
|
|
|
194
199
|
eval("fn = " + internalName);
|
|
195
200
|
}
|
|
196
201
|
catch (error) {}
|
|
197
|
-
if (fn && typeof(fn) === "function" && fn.constructor.name === "AsyncFunction") {
|
|
202
|
+
if (fn && typeof (fn) === "function" && fn.constructor.name === "AsyncFunction") {
|
|
198
203
|
needsAwait.set(node, true);
|
|
199
204
|
}
|
|
200
205
|
}
|
|
@@ -238,8 +243,9 @@ module.exports = function(file) {
|
|
|
238
243
|
else if (!fn.async) {
|
|
239
244
|
const fnInfo = fnMap.get(fn);
|
|
240
245
|
const parent = fnInfo.parent;
|
|
241
|
-
if (parent && parent.type === "MethodDefinition" && (parent.kind !== "method" || !parent.key))
|
|
246
|
+
if (parent && parent.type === "MethodDefinition" && (parent.kind !== "method" || !parent.key)) {
|
|
242
247
|
return;
|
|
248
|
+
}
|
|
243
249
|
const start = parent.type === "MethodDefinition" ? parent.key.start : fn.start;
|
|
244
250
|
insertions.push({
|
|
245
251
|
pos: start,
|
|
@@ -248,11 +254,11 @@ module.exports = function(file) {
|
|
|
248
254
|
}
|
|
249
255
|
});
|
|
250
256
|
|
|
251
|
-
insertions.sort(function
|
|
257
|
+
insertions.sort(function(a, b) {
|
|
252
258
|
if (a.pos === b.pos) return (a.atEnd || 0) - (b.atEnd || 0);
|
|
253
259
|
return a.pos - b.pos;
|
|
254
260
|
});
|
|
255
|
-
|
|
261
|
+
|
|
256
262
|
const newCode = [];
|
|
257
263
|
if (insertions.length) {
|
|
258
264
|
// For performance -- Instead of string concat use an array to hold the parts and pieces -- then join them together
|
|
@@ -275,10 +281,12 @@ module.exports = function(file) {
|
|
|
275
281
|
if (match) {
|
|
276
282
|
const lfs = match.filter(el => el === "\n").length;
|
|
277
283
|
const crlfs = match.length - lfs;
|
|
278
|
-
if (lfs > crlfs)
|
|
284
|
+
if (lfs > crlfs) {
|
|
279
285
|
EOL = "\n";
|
|
280
|
-
|
|
286
|
+
}
|
|
287
|
+
else if (crlfs > lfs) {
|
|
281
288
|
EOL = "\r\n";
|
|
289
|
+
}
|
|
282
290
|
}
|
|
283
291
|
const lines = content.split(EOL);
|
|
284
292
|
let index = 0;
|
|
@@ -303,10 +311,12 @@ module.exports = function(file) {
|
|
|
303
311
|
return changed;
|
|
304
312
|
|
|
305
313
|
function getCallName(name) {
|
|
306
|
-
if (callAPIs.includes(name))
|
|
314
|
+
if (callAPIs.includes(name)) {
|
|
307
315
|
return name;
|
|
308
|
-
|
|
316
|
+
}
|
|
317
|
+
else {
|
|
309
318
|
return name.replace(/\.(call|apply)$/, "");
|
|
319
|
+
}
|
|
310
320
|
}
|
|
311
321
|
|
|
312
322
|
// Given a list of CallExpressions needing await (needsAwait):
|
|
@@ -314,7 +324,6 @@ module.exports = function(file) {
|
|
|
314
324
|
// Functions that contain await calls need to be made async, and any caller of the containing function needs to await the result.
|
|
315
325
|
// So then the caller of the containing function needs to be made aysnc, and so on...
|
|
316
326
|
function findAsyncCalls(needsAwait, needsAsync, callMap, fnMap) {
|
|
317
|
-
|
|
318
327
|
find(new Map(needsAwait));
|
|
319
328
|
|
|
320
329
|
function find(calls) {
|
|
@@ -322,8 +331,9 @@ module.exports = function(file) {
|
|
|
322
331
|
const callInfo = callMap.get(callExpression);
|
|
323
332
|
const containingFn = callInfo.containingFn;
|
|
324
333
|
needsAsync.set(containingFn, true);
|
|
325
|
-
if (containingFn.type === "Program")
|
|
334
|
+
if (containingFn.type === "Program") {
|
|
326
335
|
return;
|
|
336
|
+
}
|
|
327
337
|
const containingFnInfo = fnMap.get(containingFn);
|
|
328
338
|
if (containingFnInfo.scope && containingFnInfo.name && containingFnInfo.name !== "startPJS") {
|
|
329
339
|
const newCalls = new Map();
|
|
@@ -345,21 +355,20 @@ module.exports = function(file) {
|
|
|
345
355
|
}
|
|
346
356
|
});
|
|
347
357
|
}
|
|
348
|
-
|
|
349
358
|
}
|
|
350
|
-
|
|
351
|
-
}
|
|
359
|
+
};
|
|
352
360
|
|
|
353
361
|
// Given an Identifier or MemberExpression, tries to return a fully qualified name.
|
|
354
362
|
// Returns undefined if the name can't be determined due to dynamic parts.
|
|
355
363
|
function getQualifiedName(node) {
|
|
356
|
-
|
|
357
|
-
if (node.type !== "Identifier" && node.type !== "MemberExpression")
|
|
364
|
+
if (node.type !== "Identifier" && node.type !== "MemberExpression") {
|
|
358
365
|
return;
|
|
366
|
+
}
|
|
359
367
|
|
|
360
368
|
const parts = process(node);
|
|
361
|
-
if (parts.indexOf(undefined) === -1)
|
|
369
|
+
if (parts.indexOf(undefined) === -1) {
|
|
362
370
|
return parts.join(".");
|
|
371
|
+
}
|
|
363
372
|
|
|
364
373
|
function process(node) {
|
|
365
374
|
const parts = [];
|
|
@@ -371,17 +380,18 @@ function getQualifiedName(node) {
|
|
|
371
380
|
}
|
|
372
381
|
else if (node.type === "MemberExpression") {
|
|
373
382
|
parts.push(...process(node.object));
|
|
374
|
-
if (node.computed === true && node.property.type !== "Literal")
|
|
383
|
+
if (node.computed === true && node.property.type !== "Literal") {
|
|
375
384
|
parts.push("__COMPUTED__");
|
|
376
|
-
|
|
385
|
+
}
|
|
386
|
+
else {
|
|
377
387
|
parts.push(...process(node.property));
|
|
388
|
+
}
|
|
378
389
|
}
|
|
379
390
|
else {
|
|
380
391
|
parts.push(undefined);
|
|
381
392
|
}
|
|
382
393
|
return parts;
|
|
383
394
|
}
|
|
384
|
-
|
|
385
395
|
}
|
|
386
396
|
|
|
387
397
|
function copyScopeObjects(scope, objects) {
|
package/setup/install.js
CHANGED
|
@@ -23,7 +23,7 @@ const iutils = require("./install_utils.js");
|
|
|
23
23
|
const path = require("path");
|
|
24
24
|
/*
|
|
25
25
|
NOTE: install_info.json
|
|
26
|
-
|
|
26
|
+
|
|
27
27
|
This file contains instructions for completing the installation.
|
|
28
28
|
It tells the process what questions to ask and what commands to run.
|
|
29
29
|
This file is shared with the GUI installer.
|