mambascript 0.5.4 → 2.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 (82) hide show
  1. package/CHANGELOG.md +326 -0
  2. package/README.md +509 -267
  3. package/bin/mamba +1 -258
  4. package/decision.js +1 -246
  5. package/docs/coverage.md +70 -0
  6. package/docs/features.md +3348 -0
  7. package/docs/perf.md +94 -0
  8. package/docs/reference.md +1295 -0
  9. package/docs/vs-coffeescript.md +1593 -0
  10. package/docs/vs-iced-coffeescript.md +626 -0
  11. package/docs/vs-typescript.md +107 -0
  12. package/esm.js +8 -0
  13. package/jest.js +33 -0
  14. package/lib/black.js +17 -13
  15. package/lib/browser.js +2 -4
  16. package/lib/cli.js +207 -136
  17. package/lib/compiler.js +1162 -93
  18. package/lib/decision.js +10 -10
  19. package/lib/diagnostics.js +219 -0
  20. package/lib/esm-hooks.js +60 -0
  21. package/lib/fast-parser.js +3469 -0
  22. package/lib/functional-helpers.js +26 -9
  23. package/lib/helpers.js +67 -50
  24. package/lib/js-nodes.js +151 -12
  25. package/lib/lexer.js +1499 -0
  26. package/lib/light-module.js +200 -63
  27. package/lib/mamba.js +372 -0
  28. package/lib/module.js +23 -172
  29. package/lib/nodes.js +84 -21
  30. package/lib/optimiser.js +29 -9
  31. package/lib/optparse.js +32 -15
  32. package/lib/parser.js +9433 -4840
  33. package/lib/preprocessor.js +3 -5
  34. package/lib/register.js +49 -56
  35. package/lib/repl.js +28 -9
  36. package/lib/reporter.js +106 -69
  37. package/lib/run.js +3 -5
  38. package/lib/string-scanner.js +94 -0
  39. package/lib/syntax-tables.js +480 -0
  40. package/lib/type-checker.js +258 -44
  41. package/lib/type-helpers.js +28 -10
  42. package/lib/type-resolver.js +256 -34
  43. package/lib/type-scope.js +10 -6
  44. package/lib/type-walker.js +664 -85
  45. package/lib/types.js +17 -7
  46. package/lib/underscore.js +170 -76
  47. package/lib/unicode-classes.js +122 -0
  48. package/mambaview.js +1 -0
  49. package/package.json +49 -46
  50. package/stdlib.js +1 -0
  51. package/vendor/README.md +40 -0
  52. package/vendor/escodegen/LICENSE.BSD +19 -0
  53. package/vendor/escodegen/escodegen.js +2289 -0
  54. package/vendor/estraverse/LICENSE.BSD +19 -0
  55. package/vendor/estraverse/estraverse.js +706 -0
  56. package/vendor/mambacodegen/LICENSE +24 -0
  57. package/vendor/mambacodegen/lib/mscodegen.js +620 -0
  58. package/vendor/patches/escodegen.diff +130 -0
  59. package/vendor/patches/estraverse.diff +51 -0
  60. package/vendor/patches/pegjs.diff +70 -0
  61. package/vendor/patches/source-map.diff +160 -0
  62. package/vendor/source-map/LICENSE +28 -0
  63. package/vendor/source-map/lib/source-map/array-set.js +92 -0
  64. package/vendor/source-map/lib/source-map/base64-vlq.js +140 -0
  65. package/vendor/source-map/lib/source-map/base64.js +38 -0
  66. package/vendor/source-map/lib/source-map/binary-search.js +77 -0
  67. package/vendor/source-map/lib/source-map/source-map-consumer.js +404 -0
  68. package/vendor/source-map/lib/source-map/source-map-generator.js +229 -0
  69. package/vendor/source-map/lib/source-map/source-node.js +201 -0
  70. package/vendor/source-map/lib/source-map/util.js +57 -0
  71. package/vendor/source-map/lib/source-map.js +8 -0
  72. package/bin/fix +0 -17
  73. package/bin/updateImports +0 -46
  74. package/build.js +0 -25
  75. package/lib/module-esm.js +0 -901
  76. package/lib/pegjs-kofu-plugin.js +0 -35
  77. package/lib/pegjs-mamba-plugin.js +0 -35
  78. package/lib/processor-esm.js +0 -507
  79. package/mamba +0 -259
  80. package/msast.js +0 -1
  81. package/utils/gulp-mamba.js +0 -29
  82. /package/{lib/esm.js → vendor/patches/mambacodegen.diff} +0 -0
package/package.json CHANGED
@@ -1,18 +1,20 @@
1
1
  {
2
2
  "name": "mambascript",
3
3
  "author": "arthurbernierjr",
4
- "version": "0.5.4",
4
+ "version": "2.0.0",
5
5
  "homepage": "https://github.com/arthurbernierjr/mambascript",
6
6
  "bugs": "https://github.com/arthurbernierjr/mambascript/issues",
7
- "description": "MambaScript The Love Child Of Typescript and Python",
7
+ "description": "MambaScript: JavaScript that reads like a sentence. blueprint, forEvery, waitForIt, attempt/onFail, grab/share; a gradual type system that warns; zero runtime dependencies. Built from the CoffeeScript Redux lineage for people who struggle with syntax before they struggle with ideas.",
8
8
  "keywords": [
9
- "typedcoffeescript",
9
+ "mambascript",
10
10
  "coffeescript",
11
+ "typedcoffeescript",
11
12
  "javascript",
12
13
  "language",
13
14
  "compiler",
14
- "mambascript",
15
- "typescript"
15
+ "typescript",
16
+ "mambaview",
17
+ "decision"
16
18
  ],
17
19
  "main": "./lib/module",
18
20
  "bin": {
@@ -24,62 +26,63 @@
24
26
  "url": "git://github.com/arthurbernierjr/mambascript.git"
25
27
  },
26
28
  "scripts": {
27
- "buildfiles": "make -j build",
29
+ "build": "node scripts/build.js",
30
+ "build:check": "node scripts/build.js --no-swap",
31
+ "check:sync": "node scripts/check-sync.js",
32
+ "check:deps": "node scripts/check-deps.js",
33
+ "vendor:verify": "node scripts/vendor.js --verify",
34
+ "compat": "node scripts/compat.js",
28
35
  "test": "jest",
29
- "build": "node build.js",
30
36
  "start": "./bin/mamba",
31
- "mambaview": "./bin/mamba examples/mambaviewExample.mamba"
37
+ "bench": "node scripts/bench.js",
38
+ "compat:test": "node scripts/sister-tests.js",
39
+ "parity": "node scripts/parity.js",
40
+ "perf-gate": "node scripts/perf-gate.js",
41
+ "profile": "node scripts/profile.js",
42
+ "bench:ts": "node scripts/bench-ts.js",
43
+ "golden": "node scripts/golden.js",
44
+ "coverage": "node scripts/coverage-matrix.js"
32
45
  },
33
46
  "devDependencies": {
34
- "@babel/core": "^7.11.6",
35
- "@babel/preset-env": "^7.11.5",
36
- "babel-loader": "^8.1.0",
37
- "cluster": "~0.7.7",
38
- "grunt": "^1.3.0",
39
- "grunt-contrib-coffee": "^2.1.0",
40
- "gulp": "^4.0.2",
41
- "jest": "^26.4.2",
42
- "mocha": "^8.1.3",
43
- "pegjs": "git+https://github.com/dmajda/pegjs.git#bea6b1fde74c8aebf802f9bcc3380c65b241e1b7",
44
- "semver": "^7.3.2",
45
- "webpack": "^4.44.1"
46
- },
47
- "dependencies": {
48
- "arthur-pavlos-string-reversal": "^1.0.0",
49
- "coffeescript": "^2.5.1",
50
- "colors": "^0.6.2",
51
- "consola": "^2.12.1",
52
- "globby": "^11.0.1",
53
- "inquirer": "^7.0.1",
54
- "kofu-optimist": "^0.6.3",
55
- "lodash": "^4.17.19",
56
- "nopt": "~2.1.2",
57
- "pegjs-each-node": "^0.2.1",
58
- "StringScanner": "~0.0.3",
59
- "transform-imports": "^2.1.1"
60
- },
61
- "optionalDependencies": {
62
- "escodegen": "~0.0.24",
63
- "esmangle": "~0.0.8",
64
- "mambacodegen": "0.1.0",
65
- "prettyjson": "*",
66
- "source-map": "0.1.11"
47
+ "jest": "^29.7.0"
67
48
  },
68
49
  "engines": {
69
- "node": ">=14.8.x"
50
+ "node": ">=18"
70
51
  },
71
52
  "jest": {
53
+ "testEnvironment": "node",
72
54
  "moduleFileExtensions": [
73
55
  "mamba",
74
56
  "js"
75
57
  ],
76
- "transformIgnorePatterns": [],
77
58
  "transform": {
78
- ".*": "<rootDir>/tdd/testprocessor.js"
59
+ "\\.mamba$": "<rootDir>/tdd/testprocessor.js"
79
60
  },
80
61
  "testMatch": [
81
- "<rootDir>/**/*.spec.mamba"
62
+ "<rootDir>/tdd/**/*.spec.mamba"
82
63
  ]
83
64
  },
84
- "license": "MIT"
65
+ "license": "MIT",
66
+ "files": [
67
+ "lib",
68
+ "vendor",
69
+ "bin",
70
+ "utils/esm.js",
71
+ "esm.js",
72
+ "register.js",
73
+ "decision.js",
74
+ "stdlib.js",
75
+ "mambaview.js",
76
+ "LICENSE",
77
+ "README.md",
78
+ "CHANGELOG.md",
79
+ "docs/reference.md",
80
+ "docs/features.md",
81
+ "docs/coverage.md",
82
+ "docs/perf.md",
83
+ "docs/vs-coffeescript.md",
84
+ "docs/vs-iced-coffeescript.md",
85
+ "docs/vs-typescript.md",
86
+ "jest.js"
87
+ ]
85
88
  }
package/stdlib.js ADDED
@@ -0,0 +1 @@
1
+ module.exports = require('./lib/underscore');
@@ -0,0 +1,40 @@
1
+ # Vendored libraries
2
+
3
+ MambaScript 2.0 has **zero npm runtime dependencies**. The third-party code it needs at
4
+ run time lives here as plain JavaScript, pinned to the exact versions the project already
5
+ used (from the 0.5.x `package-lock.json`) and then maintained in-house. `tools/pegjs/` is
6
+ the parser generator (build time only, never required at run time).
7
+
8
+ `node scripts/vendor.js --verify` checks this table against the tree; `--fetch` also
9
+ re-downloads the originals and diffs them against `patches/`.
10
+
11
+ | Directory | Package | Version | Integrity (lockfile) | Source | Licence |
12
+ |---|---|---|---|---|---|
13
+ | `vendor/escodegen` | escodegen | 0.0.28 | `sha1-Dk/xcV8yh3XWyrUaxEpAbNer/9M=` | https://registry.npmjs.org/escodegen/-/escodegen-0.0.28.tgz | BSD-2-Clause |
14
+ | `vendor/estraverse` | estraverse | 1.3.2 | `sha1-N8K4k+8T1yPydth41g2FNRUqbEI=` | https://registry.npmjs.org/estraverse/-/estraverse-1.3.2.tgz | BSD-2-Clause |
15
+ | `vendor/source-map` | source-map | 0.1.11 | `sha1-Lu8v1lp0wXmICuXuaXXZnOIet7Q=` | https://registry.npmjs.org/source-map/-/source-map-0.1.11.tgz | BSD-3-Clause |
16
+ | `vendor/mambacodegen` | mambacodegen | 0.1.1 | `sha512-Z8J+VxgZh5NbDWLCoRuuDjfih+mt0yS7fhYLcqF3zXihe2CrZEEIO3kmwOhvwCXBZaURkxVdqt+qMk1gOmyoqA==` | https://registry.npmjs.org/mambacodegen/-/mambacodegen-0.1.1.tgz | BSD-3-Clause |
17
+ | `tools/pegjs` | pegjs | 0.7.0 (commit `bea6b1fde74c8aebf802f9bcc3380c65b241e1b7`) | git commit | https://codeload.github.com/pegjs/pegjs/tar.gz/bea6b1fde74c8aebf802f9bcc3380c65b241e1b7 | MIT |
18
+
19
+ pegjs now only generates the fallback parser (`lib/parser.js`, selected with `--parser peg`); the default parser is hand-written in `src/`. pegjs must stay on that exact commit: the grammar uses `$()`/`text()` (not in npm 0.7.0)
20
+ and the 5-argument `SyntaxError` constructor (changed in 0.8.0).
21
+
22
+ ## In-house patches (`patches/<name>.diff`, pristine → vendored)
23
+
24
+ - **escodegen**: `require('estraverse')` / `require('source-map')` made relative to this
25
+ directory; `AwaitExpression` added to `Syntax`/`Precedence` and printed as `await x`;
26
+ `FunctionExpression`, `FunctionDeclaration` and method properties print `async ` when
27
+ `node.async` is true; the esprima-based `options.parse` re-parsing path is removed;
28
+ `exports.version` is a literal instead of reading `package.json`; an expression
29
+ statement that starts with `async function` is parenthesised like one that starts
30
+ with `function` (top-level `waitForIt` wraps the program in an async IIFE).
31
+ - **estraverse**: UMD/AMD wrapper replaced by plain CommonJS; `AwaitExpression` added to
32
+ `Syntax` and `VisitorKeys`.
33
+ - **source-map**: the `amdefine` wrapper removed from every `lib/source-map/*.js`
34
+ (its only dependency); API unchanged, `SourceMapConsumer` stays synchronous.
35
+ - **mambacodegen**: unchanged. It cannot print the 2.0 `AwaitOp` node.
36
+ - **pegjs** (`bin/pegjs`): `util.puts`/`util.error` replaced with `console.log`/`console.error`
37
+ (removed from modern Node). `lib/` unchanged.
38
+
39
+ Only the files MambaScript needs were copied (no tests, build files or package manifests
40
+ except pegjs's `package.json`, kept for its version string).
@@ -0,0 +1,19 @@
1
+ Redistribution and use in source and binary forms, with or without
2
+ modification, are permitted provided that the following conditions are met:
3
+
4
+ * Redistributions of source code must retain the above copyright
5
+ notice, this list of conditions and the following disclaimer.
6
+ * Redistributions in binary form must reproduce the above copyright
7
+ notice, this list of conditions and the following disclaimer in the
8
+ documentation and/or other materials provided with the distribution.
9
+
10
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
11
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
12
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
13
+ ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
14
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
15
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
16
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
17
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
18
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
19
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.