@naanlang/naan 1.0.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 (98) hide show
  1. package/LICENSE.md +21 -0
  2. package/README.md +46 -0
  3. package/dist/env_web.js +431 -0
  4. package/dist/naan.min.js +73 -0
  5. package/frameworks/browser/browser.nlg +30 -0
  6. package/frameworks/browser/pouchdb/pouchdb.min.js +7 -0
  7. package/frameworks/browser/spark-md5/spark-md5.min.js +1 -0
  8. package/frameworks/browser/sworker.js +192 -0
  9. package/frameworks/browser/terminals.nlg +787 -0
  10. package/frameworks/browser/workers.nlg +386 -0
  11. package/frameworks/client/apiclient.nlg +183 -0
  12. package/frameworks/client/client.nlg +29 -0
  13. package/frameworks/client/psm_client.nlg +572 -0
  14. package/frameworks/common/common.nlg +464 -0
  15. package/frameworks/common/preferences.nlg +131 -0
  16. package/frameworks/common/repltools.nlg +100 -0
  17. package/frameworks/common/watching.nlg +97 -0
  18. package/frameworks/node/apiserver.nlg +399 -0
  19. package/frameworks/node/filesystem.nlg +1012 -0
  20. package/frameworks/node/gitter.nlg +234 -0
  21. package/frameworks/node/node.nlg +81 -0
  22. package/frameworks/node/psm_server.nlg +465 -0
  23. package/frameworks/node/worker.nlg +560 -0
  24. package/frameworks/project/build.nlg +1229 -0
  25. package/frameworks/project/jszip.js +30 -0
  26. package/frameworks/project/jszip.nlg +87 -0
  27. package/frameworks/project/proj_cliser.nlg +139 -0
  28. package/frameworks/project/proj_console.nlg +137 -0
  29. package/frameworks/project/proj_folder.nlg +143 -0
  30. package/frameworks/project/proj_lambda.nlg +137 -0
  31. package/frameworks/project/proj_static.nlg +138 -0
  32. package/frameworks/project/project.nlg +29 -0
  33. package/frameworks/project/projects.nlg +587 -0
  34. package/frameworks/project/uglifyjs.js +1 -0
  35. package/frameworks/project/uglifyjs.nlg +79 -0
  36. package/frameworks/running/debugcom.nlg +163 -0
  37. package/frameworks/running/debugnub.nlg +565 -0
  38. package/frameworks/running/debugutil.nlg +510 -0
  39. package/frameworks/running/executors.nlg +767 -0
  40. package/frameworks/running/running.nlg +151 -0
  41. package/frameworks/running/sourcecode.nlg +346 -0
  42. package/frameworks/running/taskexec.nlg +196 -0
  43. package/frameworks/storage/dbt_pouch.nlg +773 -0
  44. package/frameworks/storage/file_manager.nlg +772 -0
  45. package/frameworks/storage/psm.nlg +326 -0
  46. package/frameworks/storage/psm_dbtables.nlg +814 -0
  47. package/frameworks/storage/resources.nlg +445 -0
  48. package/frameworks/storage/storage.nlg +52 -0
  49. package/lib/browser/env_web.js +431 -0
  50. package/lib/browser/env_webworker.js +146 -0
  51. package/lib/browser/require.js +1653 -0
  52. package/lib/core/naanlib.js +73 -0
  53. package/lib/env_node.js +282 -0
  54. package/lib/env_nodeworker.js +165 -0
  55. package/lib/node_repl.js +25 -0
  56. package/lib/node_repl_init.nlg +52 -0
  57. package/package.json +13 -0
  58. package/plugins/gitClient/clientops.nlg +317 -0
  59. package/plugins/gitClient/gitClient.nlg +63 -0
  60. package/plugins/gitClient/gitutils.nlg +1331 -0
  61. package/plugins/gitClient/minimatch.js +945 -0
  62. package/plugins/gitClient/minimatch_license.txt +15 -0
  63. package/plugins/gitClient/minimatch_readme.md +208 -0
  64. package/plugins/nodeLib/nodeLib.nlg +26 -0
  65. package/plugins/nodeLib/node_cp.nlg +65 -0
  66. package/plugins/nodeLib/node_fs.nlg +137 -0
  67. package/plugins/nodeLib/node_https.nlg +172 -0
  68. package/plugins/nodeLib/node_util.nlg +180 -0
  69. package/plugins/serviceAws/aws/aws-sdk.min.js +88 -0
  70. package/plugins/serviceAws/aws/lambda_rest_index.js +122 -0
  71. package/plugins/serviceAws/aws/lambda_rest_init.nlg +58 -0
  72. package/plugins/serviceAws/aws/lambda_ws_index.js +498 -0
  73. package/plugins/serviceAws/aws/lambda_ws_init.nlg +49 -0
  74. package/plugins/serviceAws/aws_cloudwatchlogs.nlg +122 -0
  75. package/plugins/serviceAws/aws_cognito.nlg +76 -0
  76. package/plugins/serviceAws/aws_dynamo.nlg +509 -0
  77. package/plugins/serviceAws/aws_lambda.nlg +95 -0
  78. package/plugins/serviceAws/aws_s3.nlg +134 -0
  79. package/plugins/serviceAws/aws_utils.nlg +86 -0
  80. package/plugins/serviceAws/dbt_aws.nlg +769 -0
  81. package/plugins/serviceAws/lambda_naan_control.nlg +175 -0
  82. package/plugins/serviceAws/psm_aws.nlg +258 -0
  83. package/plugins/serviceAws/serviceAws.nlg +38 -0
  84. package/plugins/serviceGitHub/gitops.nlg +522 -0
  85. package/plugins/serviceGitHub/psm_github.nlg +205 -0
  86. package/plugins/serviceGitHub/serviceGitHub.nlg +65 -0
  87. package/plugins/serviceGitLab/gitops.nlg +528 -0
  88. package/plugins/serviceGitLab/psm_gitlab.nlg +205 -0
  89. package/plugins/serviceGitLab/serviceGitLab.nlg +65 -0
  90. package/test/harness.nlg +312 -0
  91. package/test/node_test.js +33 -0
  92. package/test/test_01_core.nlg +768 -0
  93. package/test/test_02_context.nlg +269 -0
  94. package/test/test_03_jsinterop.nlg +137 -0
  95. package/test/test_04_numerics.nlg +450 -0
  96. package/test/test_05_strings.nlg +63 -0
  97. package/test/test_06_lingoparse.nlg +500 -0
  98. package/test/test_07_lingo.nlg +623 -0
@@ -0,0 +1,143 @@
1
+ /*
2
+ * proj_folder.nlg
3
+ * Naanlib/frameworks/project/
4
+ *
5
+ * Controllers for generic folder projects.
6
+ *
7
+ * column positioning: // // !
8
+ *
9
+ * Copyright (c) 2019-2021 by Richard C. Zulch
10
+ *
11
+ */
12
+
13
+
14
+ /*
15
+ * proj_folderInstance
16
+ *
17
+ * Create an instance of the folder projects type. Folder projects are generic for any folder in
18
+ * a filesystem. Given a new instance you can either load (which fails of the project is not valid)
19
+ * or create (which fails if the project already exists.) Unless other noted the methods all return
20
+ * standard (error, data) tuples.
21
+ *
22
+ */
23
+
24
+ closure proj_folderInstance(projman, where, projID, local project) {
25
+ project = new(object, this)
26
+ project.name = where.name
27
+ project.where = where
28
+ project.projID = projID
29
+
30
+ // create
31
+ //
32
+ // Create the project with the specified name, and leave it loaded if no error.
33
+ project.create = function create() {
34
+ load()
35
+ }
36
+
37
+ // load
38
+ //
39
+ // Load the project, which fails if it does not already exist.
40
+ project.load = closure load(local error, info) {
41
+ if project.loaded
42
+ return (list(false, { ok: true }))
43
+ `(error, data) = projman.locate.connect(where.locationID, "NideFS", where.path)
44
+ if !data
45
+ return (list(Error("project load failed", error)))
46
+ project.fs = data
47
+ `(error, info) = project.fs.info("")
48
+ if info {
49
+ if info.type == "directory" {
50
+ project.fm = storageFileManager.FileManager(project.fs)
51
+ project.fm.load()
52
+ project.loaded = true }
53
+ else {
54
+ info = false
55
+ error = Error("project root must be directory", where.path)
56
+ }
57
+ }
58
+ list(error, info)
59
+ }
60
+
61
+ // run
62
+ //
63
+ // Run the project by building and then launching.
64
+ project.run = closure run(buildonly) {
65
+ debuglog("folder run project stub")
66
+ list(false, { ok: true })
67
+ }
68
+
69
+ // close
70
+ //
71
+ // Close the project, releasing resources.
72
+ project.close = function close() {
73
+ project.fm = false
74
+ project.loaded = false
75
+ }
76
+
77
+ // finis
78
+ project
79
+ };
80
+
81
+
82
+ /*
83
+ * proj_folderType
84
+ *
85
+ * Create a project type object for folder objects.
86
+ *
87
+ */
88
+
89
+ closure proj_folderType(projman, local folderProj) {
90
+ folderProj = new(object, this)
91
+ folderProj.classID = "folder"
92
+ folderProj.classLabel = "folder tree"
93
+ folderProj.connect = projConnector(projman, folderProj)
94
+
95
+ // testActiveLocation
96
+ //
97
+ // Test if we can handle a project at the specified location.
98
+
99
+ folderProj.testActiveLocation = function testActiveLocation(where, local error, fs, info) {
100
+ if !where.locationID || !where.path
101
+ return (false)
102
+ `(error, fs) = projman.locate.connect(where.locationID, "NideFS", where.path)
103
+ if fs
104
+ `(error, info) = fs.info("")
105
+ if info.type == "directory" {
106
+ where.name = fs.path.basename(where.path)
107
+ if where.name == ""
108
+ where.name = "root" // an empty name wouldn't be pretty
109
+ where.typeID = folderProj.classID // use this because there's no config to read
110
+ 100 // type of last resort
111
+ }
112
+ }
113
+
114
+ // instantiate
115
+ //
116
+ // Instantiate a project object for the specified where data.
117
+
118
+ folderProj.instantiate = function instantiate(where, projID) {
119
+ proj_folderInstance(projman, where, projID)
120
+ }
121
+
122
+ // finis
123
+ folderProj
124
+ };
125
+
126
+
127
+ /*
128
+ * proj_folderInit
129
+ *
130
+ * Initialize the module.
131
+ *
132
+ */
133
+
134
+ function proj_folderInit(local manifest) {
135
+
136
+ manifest = `(proj_folderInstance, proj_folderType, proj_folderInit)
137
+
138
+ Naan.module.build(module.id, "proj_folder", function(modobj, compobj) {
139
+ require("./project.nlg")
140
+ storageFileManager = require("../storage/file_manager.nlg")
141
+ compobj.manifest = manifest
142
+ })
143
+ }();
@@ -0,0 +1,137 @@
1
+ /*
2
+ * proj_lambda.nlg
3
+ * Naanlib/frameworks/project/
4
+ *
5
+ * Controllers for lambda-based projects.
6
+ *
7
+ * column positioning: // // !
8
+ *
9
+ * Copyright (c) 2021 by Richard C. Zulch
10
+ *
11
+ */
12
+
13
+
14
+ /*
15
+ * proj_lambdaInstance
16
+ *
17
+ * Create an instance of the lambda projects type. Lambda projects run on a clould platform that
18
+ * supports such functionality, which is initially AWS Lambda, and respond according to their cloud
19
+ * configuration.
20
+ * Given a new project instance you can either load an existing project or create a new one.
21
+ * Unless other noted the methods all return standard (error, data) tuples.
22
+ *
23
+ */
24
+
25
+ closure proj_lambdaInstance(projman, where, projID, local project) {
26
+ project = new(object, this)
27
+ project.name = where.name
28
+ project.where = where
29
+ project.projID = projID
30
+ project.config = projConfig(projman, where)
31
+ project.runPageDebug = true // switch to Debug page on run
32
+
33
+ // create
34
+ //
35
+ // Create the project with the specified name, and leave it loaded if no error.
36
+ project.create = function create(name, local result) {
37
+ result = project.config.create(name)
38
+ project.fs = project.config.fs
39
+ if project.fs {
40
+ project.fm = storageFileManager.FileManager(project.fs)
41
+ project.fm.load()
42
+ project.loaded }
43
+ result
44
+ }
45
+
46
+ // load
47
+ //
48
+ // Load the project, which fails if it does not already exist.
49
+ project.load = closure load(local error, info) {
50
+ if project.loaded
51
+ return (list(false, { ok: true }))
52
+ result = project.config.load()
53
+ project.fs = project.config.fs
54
+ if project.fs {
55
+ project.fm = storageFileManager.FileManager(project.fs)
56
+ project.fm.load()
57
+ project.loaded }
58
+ result
59
+ }
60
+
61
+ // run
62
+ //
63
+ // Run the project by building and then launching.
64
+ project.run = closure run(buildonly) {
65
+ project.config.run(buildonly)
66
+ }
67
+
68
+ // close
69
+ //
70
+ // Close the project, releasing resources.
71
+ project.close = function close() {
72
+ project.config.close()
73
+ project.fm = false
74
+ project.loaded = false
75
+ }
76
+
77
+ // finis
78
+ project
79
+ };
80
+
81
+
82
+ /*
83
+ * proj_lambdaType
84
+ *
85
+ * Create a project type object for folder objects.
86
+ *
87
+ */
88
+
89
+ closure proj_lambdaType(projman, local lambdaProj) {
90
+ lambdaProj = new(object, this)
91
+ lambdaProj.classID = "lambda"
92
+ lambdaProj.classLabel = "lambda"
93
+ lambdaProj.connect = projConnector(projman, lambdaProj)
94
+
95
+ // testActiveLocation
96
+ //
97
+ // Test if we can handle a project at the specified location.
98
+
99
+ lambdaProj.testActiveLocation = function testActiveLocation(where, local error, config, proj) {
100
+ if !where.locationID || !where.path
101
+ return (false)
102
+ config = projConfig(projman, where) // updates where.name and where.typeID
103
+ `(error, proj) = config.load()
104
+ if !error && proj["nide-type"] == lambdaProj.classID
105
+ 20
106
+ }
107
+
108
+ // instantiate
109
+ //
110
+ // Instantiate a project object for the specified where data.
111
+
112
+ lambdaProj.instantiate = function instantiate(where, projID) {
113
+ proj_lambdaInstance(projman, where, projID)
114
+ }
115
+
116
+ // finis
117
+ lambdaProj
118
+ };
119
+
120
+
121
+ /*
122
+ * proj_lambdaInit
123
+ *
124
+ * Initialize the module.
125
+ *
126
+ */
127
+
128
+ function proj_lambdaInit(local manifest) {
129
+
130
+ manifest = `(proj_lambdaInstance, proj_lambdaType, proj_lambdaInit)
131
+
132
+ Naan.module.build(module.id, "proj_lambda", function(modobj, compobj) {
133
+ require("./project.nlg")
134
+ storageFileManager = require("../storage/file_manager.nlg")
135
+ compobj.manifest = manifest
136
+ })
137
+ }();
@@ -0,0 +1,138 @@
1
+ /*
2
+ * proj_static.nlg
3
+ * Naanlib/frameworks/project/
4
+ *
5
+ * Controllers for static projects, where browser-resident Naan is served from static website.
6
+ *
7
+ * column positioning: // // !
8
+ *
9
+ * Copyright (c) 2021 by Richard C. Zulch
10
+ *
11
+ */
12
+
13
+
14
+ /*
15
+ * proj_staticInstance
16
+ *
17
+ * Create an instance of the static projects type. Static projects support a web browser front
18
+ * end and a static web server on the backend. Given a new instance you can either load (which fails
19
+ * if the project is not valid) or create (which fails if the project already exists.) Unless other-
20
+ * wise noted the methods all return standard (error, data) tuples.
21
+ *
22
+ */
23
+
24
+ closure proj_staticInstance(projman, where, projID, local project) {
25
+ project = new(object, this)
26
+ project.name = where.name
27
+ project.where = where
28
+ project.projID = projID
29
+ project.config = projConfig(projman, where)
30
+
31
+ // create
32
+ //
33
+ // Create the project with the specified name.
34
+ //
35
+ project.create = closure create(name, local result) {
36
+ result = project.config.create(name)
37
+ project.fs = project.config.fs
38
+ if project.fs {
39
+ project.fm = storageFileManager.FileManager(project.fs)
40
+ project.fm.load()
41
+ project.loaded }
42
+ result
43
+ }
44
+
45
+ // load
46
+ //
47
+ // Load the project.
48
+ //
49
+ project.load = closure load(local result) {
50
+ if project.loaded
51
+ return (list(false, { ok: true }))
52
+ result = project.config.load()
53
+ project.fs = project.config.fs
54
+ if project.fs {
55
+ project.fm = storageFileManager.FileManager(project.fs)
56
+ project.fm.load()
57
+ project.loaded }
58
+ result
59
+ }
60
+
61
+ // run
62
+ //
63
+ // Run the project by building and then launching.
64
+ //
65
+ project.run = closure run(buildonly) {
66
+ project.config.run(buildonly)
67
+ }
68
+
69
+ // close()
70
+ //
71
+ // Close the project.
72
+
73
+ project.close = function close() {
74
+ project.config.close()
75
+ project.fm = false
76
+ project.loaded = false
77
+ }
78
+
79
+ project
80
+ };
81
+
82
+
83
+ /*
84
+ * proj_staticType
85
+ *
86
+ * Create a project type object for folder objects.
87
+ *
88
+ */
89
+
90
+ closure proj_staticType(projman, local staticProj) {
91
+ staticProj = new(object, this)
92
+ staticProj.classID = "static"
93
+ staticProj.classLabel = "static"
94
+ staticProj.connect = projConnector(projman, staticProj)
95
+
96
+ // testActiveLocation
97
+ //
98
+ // Test if we can handle a project at the specified location.
99
+
100
+ staticProj.testActiveLocation = function testActiveLocation(where, local error, config, proj) {
101
+ if !where.locationID || !where.path
102
+ return (false)
103
+ config = projConfig(projman, where) // updates where.name and where.typeID
104
+ `(error, proj) = config.load()
105
+ if !error && proj["nide-type"] == staticProj.classID
106
+ 20
107
+ }
108
+
109
+ // instantiate
110
+ //
111
+ // Instantiate a project object for the specified where data.
112
+
113
+ staticProj.instantiate = function instantiate(where, projID) {
114
+ proj_staticInstance(projman, where, projID)
115
+ }
116
+
117
+ // finis
118
+ staticProj
119
+ };
120
+
121
+
122
+ /*
123
+ * proj_staticInit
124
+ *
125
+ * Initialize the module.
126
+ *
127
+ */
128
+
129
+ function proj_staticInit(local manifest) {
130
+
131
+ manifest = `(proj_staticInstance, proj_staticType, proj_staticInit)
132
+
133
+ Naan.module.build(module.id, "proj_static", function(modobj, compobj) {
134
+ require("./project.nlg")
135
+ storageFileManager = require("../storage/file_manager.nlg")
136
+ compobj.manifest = manifest
137
+ })
138
+ }();
@@ -0,0 +1,29 @@
1
+ /*
2
+ * project.nlg
3
+ * Naanlib/frameworks/project/
4
+ *
5
+ * Root component for Naanide projects.
6
+ *
7
+ * column positioning: // // !
8
+ *
9
+ * Copyright (c) 2020-2021 by Richard C. Zulch
10
+ *
11
+ */
12
+
13
+
14
+ /*
15
+ * prorInit
16
+ *
17
+ * Initialize the project module.
18
+ *
19
+ *
20
+ */
21
+
22
+ function prorInit(local manifest) {
23
+ manifest = `(prorInit)
24
+
25
+ Naan.module.build(module.id, "project", function(modobj, compobj) {
26
+ require("../common").LiveImport()
27
+ compobj.manifest = manifest
28
+ })
29
+ } ();