mambascript 0.5.5 → 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.
- package/CHANGELOG.md +326 -0
- package/README.md +509 -267
- package/bin/mamba +1 -258
- package/decision.js +1 -246
- package/docs/coverage.md +70 -0
- package/docs/features.md +3348 -0
- package/docs/perf.md +94 -0
- package/docs/reference.md +1295 -0
- package/docs/vs-coffeescript.md +1593 -0
- package/docs/vs-iced-coffeescript.md +626 -0
- package/docs/vs-typescript.md +107 -0
- package/esm.js +8 -0
- package/jest.js +33 -0
- package/lib/black.js +17 -13
- package/lib/browser.js +2 -4
- package/lib/cli.js +207 -136
- package/lib/compiler.js +1162 -93
- package/lib/decision.js +10 -10
- package/lib/diagnostics.js +219 -0
- package/lib/esm-hooks.js +60 -0
- package/lib/fast-parser.js +3469 -0
- package/lib/functional-helpers.js +26 -9
- package/lib/helpers.js +67 -50
- package/lib/js-nodes.js +151 -12
- package/lib/lexer.js +1499 -0
- package/lib/light-module.js +200 -63
- package/lib/mamba.js +372 -0
- package/lib/module.js +23 -172
- package/lib/nodes.js +84 -21
- package/lib/optimiser.js +29 -9
- package/lib/optparse.js +32 -15
- package/lib/parser.js +9433 -4840
- package/lib/preprocessor.js +3 -5
- package/lib/register.js +49 -56
- package/lib/repl.js +28 -9
- package/lib/reporter.js +106 -69
- package/lib/run.js +3 -5
- package/lib/string-scanner.js +94 -0
- package/lib/syntax-tables.js +480 -0
- package/lib/type-checker.js +258 -44
- package/lib/type-helpers.js +28 -10
- package/lib/type-resolver.js +256 -34
- package/lib/type-scope.js +10 -6
- package/lib/type-walker.js +664 -85
- package/lib/types.js +17 -7
- package/lib/underscore.js +170 -76
- package/lib/unicode-classes.js +122 -0
- package/mambaview.js +1 -0
- package/package.json +49 -46
- package/stdlib.js +1 -0
- package/vendor/README.md +40 -0
- package/vendor/escodegen/LICENSE.BSD +19 -0
- package/vendor/escodegen/escodegen.js +2289 -0
- package/vendor/estraverse/LICENSE.BSD +19 -0
- package/vendor/estraverse/estraverse.js +706 -0
- package/vendor/mambacodegen/LICENSE +24 -0
- package/vendor/mambacodegen/lib/mscodegen.js +620 -0
- package/vendor/patches/escodegen.diff +130 -0
- package/vendor/patches/estraverse.diff +51 -0
- package/vendor/patches/pegjs.diff +70 -0
- package/vendor/patches/source-map.diff +160 -0
- package/vendor/source-map/LICENSE +28 -0
- package/vendor/source-map/lib/source-map/array-set.js +92 -0
- package/vendor/source-map/lib/source-map/base64-vlq.js +140 -0
- package/vendor/source-map/lib/source-map/base64.js +38 -0
- package/vendor/source-map/lib/source-map/binary-search.js +77 -0
- package/vendor/source-map/lib/source-map/source-map-consumer.js +404 -0
- package/vendor/source-map/lib/source-map/source-map-generator.js +229 -0
- package/vendor/source-map/lib/source-map/source-node.js +201 -0
- package/vendor/source-map/lib/source-map/util.js +57 -0
- package/vendor/source-map/lib/source-map.js +8 -0
- package/bin/fix +0 -17
- package/bin/updateImports +0 -46
- package/build.js +0 -25
- package/lib/module-esm.js +0 -901
- package/lib/pegjs-kofu-plugin.js +0 -35
- package/lib/pegjs-mamba-plugin.js +0 -35
- package/lib/processor-esm.js +0 -507
- package/mamba +0 -259
- package/msast.js +0 -1
- package/utils/gulp-mamba.js +0 -29
- /package/{lib/esm.js → vendor/patches/mambacodegen.diff} +0 -0
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
--- /tmp/claude-1000/-home-bigpoppacode-code-obelisk-mambascript/7f5132ec-ad75-4b99-bc70-74e96114ff99/scratchpad/vendor-src/npm/escodegen-0.0.28/escodegen.js 2013-10-03 07:24:08.000000000 -0400
|
|
2
|
+
+++ vendor/escodegen/escodegen.js 2026-12-03 23:12:08.462146372 -0500
|
|
3
|
+
@@ -32,6 +32,11 @@
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/*global exports:true, generateStatement:true, generateExpression:true, require:true, global:true*/
|
|
7
|
+
+/*
|
|
8
|
+
+ * Vendored into MambaScript from escodegen 0.0.28 (BSD-2-Clause, see LICENSE.BSD).
|
|
9
|
+
+ * In-house changes are listed in ../README.md and ../patches/escodegen.diff:
|
|
10
|
+
+ * relative requires, AwaitExpression + async function printing, esprima path removed.
|
|
11
|
+
+ */
|
|
12
|
+
(function () {
|
|
13
|
+
'use strict';
|
|
14
|
+
|
|
15
|
+
@@ -61,13 +66,14 @@
|
|
16
|
+
FORMAT_MINIFY,
|
|
17
|
+
FORMAT_DEFAULTS;
|
|
18
|
+
|
|
19
|
+
- estraverse = require('estraverse');
|
|
20
|
+
+ estraverse = require('../estraverse/estraverse');
|
|
21
|
+
|
|
22
|
+
Syntax = {
|
|
23
|
+
AssignmentExpression: 'AssignmentExpression',
|
|
24
|
+
ArrayExpression: 'ArrayExpression',
|
|
25
|
+
ArrayPattern: 'ArrayPattern',
|
|
26
|
+
ArrowFunctionExpression: 'ArrowFunctionExpression',
|
|
27
|
+
+ AwaitExpression: 'AwaitExpression',
|
|
28
|
+
BlockStatement: 'BlockStatement',
|
|
29
|
+
BinaryExpression: 'BinaryExpression',
|
|
30
|
+
BreakStatement: 'BreakStatement',
|
|
31
|
+
@@ -130,6 +136,7 @@
|
|
32
|
+
Additive: 11,
|
|
33
|
+
Multiplicative: 12,
|
|
34
|
+
Unary: 13,
|
|
35
|
+
+ Await: 13,
|
|
36
|
+
Postfix: 14,
|
|
37
|
+
Call: 15,
|
|
38
|
+
New: 16,
|
|
39
|
+
@@ -1131,6 +1138,16 @@
|
|
40
|
+
result = parenthesize(result, Precedence.Unary, precedence);
|
|
41
|
+
break;
|
|
42
|
+
|
|
43
|
+
+ case Syntax.AwaitExpression:
|
|
44
|
+
+ // MambaScript: `waitForIt expr`. Same precedence as unary operators.
|
|
45
|
+
+ fragment = generateExpression(expr.argument, {
|
|
46
|
+
+ precedence: Precedence.Unary,
|
|
47
|
+
+ allowIn: true,
|
|
48
|
+
+ allowCall: true
|
|
49
|
+
+ });
|
|
50
|
+
+ result = parenthesize(join('await', fragment), Precedence.Await, precedence);
|
|
51
|
+
+ break;
|
|
52
|
+
+
|
|
53
|
+
case Syntax.YieldExpression:
|
|
54
|
+
if (expr.delegate) {
|
|
55
|
+
result = 'yield*';
|
|
56
|
+
@@ -1180,7 +1197,8 @@
|
|
57
|
+
break;
|
|
58
|
+
|
|
59
|
+
case Syntax.FunctionExpression:
|
|
60
|
+
- result = 'function';
|
|
61
|
+
+ // MambaScript: async functions (set by the compiler's asyncify pass)
|
|
62
|
+
+ result = expr.async ? 'async function' : 'function';
|
|
63
|
+
|
|
64
|
+
if (expr.id) {
|
|
65
|
+
result = [result, noEmptySpace(),
|
|
66
|
+
@@ -1247,6 +1265,9 @@
|
|
67
|
+
});
|
|
68
|
+
} else if (expr.method) {
|
|
69
|
+
result = [];
|
|
70
|
+
+ if (expr.value.async) {
|
|
71
|
+
+ result.push('async ');
|
|
72
|
+
+ }
|
|
73
|
+
if (expr.value.generator) {
|
|
74
|
+
result.push('*');
|
|
75
|
+
}
|
|
76
|
+
@@ -1598,7 +1619,8 @@
|
|
77
|
+
// 12.4 '{', 'function' is not allowed in this position.
|
|
78
|
+
// wrap expression with parentheses
|
|
79
|
+
fragment = toSourceNode(result).toString();
|
|
80
|
+
- if (fragment.charAt(0) === '{' || (fragment.slice(0, 8) === 'function' && ' ('.indexOf(fragment.charAt(8)) >= 0) || (directive && directiveContext && stmt.expression.type === Syntax.Literal && typeof stmt.expression.value === 'string')) {
|
|
81
|
+
+ // MambaScript: 'async function' is not allowed in this position either
|
|
82
|
+
+ if (fragment.charAt(0) === '{' || (fragment.slice(0, 8) === 'function' && ' ('.indexOf(fragment.charAt(8)) >= 0) || (fragment.slice(0, 14) === 'async function' && ' ('.indexOf(fragment.charAt(14)) >= 0) || (directive && directiveContext && stmt.expression.type === Syntax.Literal && typeof stmt.expression.value === 'string')) {
|
|
83
|
+
result = ['(', result, ')' + semicolon];
|
|
84
|
+
} else {
|
|
85
|
+
result.push(semicolon);
|
|
86
|
+
@@ -1892,7 +1914,7 @@
|
|
87
|
+
break;
|
|
88
|
+
|
|
89
|
+
case Syntax.FunctionDeclaration:
|
|
90
|
+
- result = [(stmt.generator && !extra.moz.starlessGenerator ? 'function* ' : 'function '),
|
|
91
|
+
+ result = [(stmt.async ? 'async ' : '') + (stmt.generator && !extra.moz.starlessGenerator ? 'function* ' : 'function '),
|
|
92
|
+
generateIdentifier(stmt.id),
|
|
93
|
+
generateFunctionBody(stmt)];
|
|
94
|
+
break;
|
|
95
|
+
@@ -2002,7 +2024,8 @@
|
|
96
|
+
semicolons = options.format.semicolons;
|
|
97
|
+
safeConcatenation = options.format.safeConcatenation;
|
|
98
|
+
directive = options.directive;
|
|
99
|
+
- parse = json ? null : options.parse;
|
|
100
|
+
+ // MambaScript: the esprima-based `options.parse` re-parsing path is removed (zero dependencies).
|
|
101
|
+
+ parse = null;
|
|
102
|
+
sourceMap = options.sourceMap;
|
|
103
|
+
extra = options;
|
|
104
|
+
|
|
105
|
+
@@ -2010,7 +2033,7 @@
|
|
106
|
+
if (!exports.browser) {
|
|
107
|
+
// We assume environment is node.js
|
|
108
|
+
// And prevent from including source-map by browserify
|
|
109
|
+
- SourceNode = require('source-map').SourceNode;
|
|
110
|
+
+ SourceNode = require('../source-map/lib/source-map').SourceNode;
|
|
111
|
+
} else {
|
|
112
|
+
SourceNode = global.sourceMap.SourceNode;
|
|
113
|
+
}
|
|
114
|
+
@@ -2049,6 +2072,7 @@
|
|
115
|
+
case Syntax.AssignmentExpression:
|
|
116
|
+
case Syntax.ArrayExpression:
|
|
117
|
+
case Syntax.ArrayPattern:
|
|
118
|
+
+ case Syntax.AwaitExpression:
|
|
119
|
+
case Syntax.BinaryExpression:
|
|
120
|
+
case Syntax.CallExpression:
|
|
121
|
+
case Syntax.ConditionalExpression:
|
|
122
|
+
@@ -2109,7 +2133,7 @@
|
|
123
|
+
|
|
124
|
+
FORMAT_DEFAULTS = getDefaultOptions().format;
|
|
125
|
+
|
|
126
|
+
- exports.version = require('./package.json').version;
|
|
127
|
+
+ exports.version = '0.0.28-mambascript';
|
|
128
|
+
exports.generate = generate;
|
|
129
|
+
exports.attachComments = estraverse.attachComments;
|
|
130
|
+
exports.browser = false;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
diff -ruN a/estraverse/estraverse.js b/estraverse/estraverse.js
|
|
2
|
+
--- a/estraverse/estraverse.js 2026-12-03 22:47:51.202416243 -0500
|
|
3
|
+
+++ b/estraverse/estraverse.js 2026-12-03 22:47:51.203260614 -0500
|
|
4
|
+
@@ -25,19 +25,11 @@
|
|
5
|
+
/*jslint vars:false, bitwise:true*/
|
|
6
|
+
/*jshint indent:4*/
|
|
7
|
+
/*global exports:true, define:true*/
|
|
8
|
+
-(function (root, factory) {
|
|
9
|
+
- 'use strict';
|
|
10
|
+
-
|
|
11
|
+
- // Universal Module Definition (UMD) to support AMD, CommonJS/Node.js,
|
|
12
|
+
- // and plain browser loading,
|
|
13
|
+
- if (typeof define === 'function' && define.amd) {
|
|
14
|
+
- define(['exports'], factory);
|
|
15
|
+
- } else if (typeof exports !== 'undefined') {
|
|
16
|
+
- factory(exports);
|
|
17
|
+
- } else {
|
|
18
|
+
- factory((root.estraverse = {}));
|
|
19
|
+
- }
|
|
20
|
+
-}(this, function (exports) {
|
|
21
|
+
+/*
|
|
22
|
+
+ * Vendored into MambaScript from estraverse 1.3.2 (BSD-2-Clause, see LICENSE.BSD).
|
|
23
|
+
+ * In-house changes: CommonJS only (UMD/AMD wrapper removed), AwaitExpression added.
|
|
24
|
+
+ */
|
|
25
|
+
+(function (exports) {
|
|
26
|
+
'use strict';
|
|
27
|
+
|
|
28
|
+
var Syntax,
|
|
29
|
+
@@ -89,6 +81,7 @@
|
|
30
|
+
ThrowStatement: 'ThrowStatement',
|
|
31
|
+
TryStatement: 'TryStatement',
|
|
32
|
+
UnaryExpression: 'UnaryExpression',
|
|
33
|
+
+ AwaitExpression: 'AwaitExpression',
|
|
34
|
+
UpdateExpression: 'UpdateExpression',
|
|
35
|
+
VariableDeclaration: 'VariableDeclaration',
|
|
36
|
+
VariableDeclarator: 'VariableDeclarator',
|
|
37
|
+
@@ -178,6 +171,7 @@
|
|
38
|
+
AssignmentExpression: ['left', 'right'],
|
|
39
|
+
ArrayExpression: ['elements'],
|
|
40
|
+
ArrowFunctionExpression: ['params', 'body'],
|
|
41
|
+
+ AwaitExpression: ['argument'],
|
|
42
|
+
BlockStatement: ['body'],
|
|
43
|
+
BinaryExpression: ['left', 'right'],
|
|
44
|
+
BreakStatement: ['label'],
|
|
45
|
+
@@ -680,5 +674,5 @@
|
|
46
|
+
exports.VisitorKeys = VisitorKeys;
|
|
47
|
+
exports.VisitorOption = VisitorOption;
|
|
48
|
+
exports.Controller = Controller;
|
|
49
|
+
-}));
|
|
50
|
+
+}(exports));
|
|
51
|
+
/* vim: set sw=4 ts=4 et tw=80 : */
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
diff -ruN a/pegjs/bin/pegjs b/pegjs/bin/pegjs
|
|
2
|
+
--- a/pegjs/bin/pegjs 2026-12-03 22:47:51.210152812 -0500
|
|
3
|
+
+++ b/pegjs/bin/pegjs 2026-12-03 22:47:51.211344213 -0500
|
|
4
|
+
@@ -1,4 +1,5 @@
|
|
5
|
+
#!/usr/bin/env node
|
|
6
|
+
+// Vendored into MambaScript (pegjs commit bea6b1fde74c8aebf802f9bcc3380c65b241e1b7, MIT). In-house change: util.puts/util.error replaced for modern Node.
|
|
7
|
+
|
|
8
|
+
var util = require("util");
|
|
9
|
+
var fs = require("fs");
|
|
10
|
+
@@ -7,30 +8,30 @@
|
|
11
|
+
/* Helpers */
|
|
12
|
+
|
|
13
|
+
function printVersion() {
|
|
14
|
+
- util.puts("PEG.js " + PEG.VERSION);
|
|
15
|
+
+ console.log("PEG.js " + PEG.VERSION);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function printHelp() {
|
|
19
|
+
- util.puts("Usage: pegjs [options] [--] [<input_file>] [<output_file>]");
|
|
20
|
+
- util.puts("");
|
|
21
|
+
- util.puts("Generates a parser from the PEG grammar specified in the <input_file> and");
|
|
22
|
+
- util.puts("writes it to the <output_file>.");
|
|
23
|
+
- util.puts("");
|
|
24
|
+
- util.puts("If the <output_file> is omitted, its name is generated by changing the");
|
|
25
|
+
- util.puts("<input_file> extension to \".js\". If both <input_file> and <output_file> are");
|
|
26
|
+
- util.puts("omitted, standard input and output are used.");
|
|
27
|
+
- util.puts("");
|
|
28
|
+
- util.puts("Options:");
|
|
29
|
+
- util.puts(" -e, --export-var <variable> name of the variable where the parser");
|
|
30
|
+
- util.puts(" object will be stored (default:");
|
|
31
|
+
- util.puts(" \"module.exports\")");
|
|
32
|
+
- util.puts(" --cache make generated parser cache results");
|
|
33
|
+
- util.puts(" --allowed-start-rules <rules> comma-separated list of rules the generated");
|
|
34
|
+
- util.puts(" parser will be allowed to start parsing");
|
|
35
|
+
- util.puts(" from (default: the first rule in the");
|
|
36
|
+
- util.puts(" grammar)");
|
|
37
|
+
- util.puts(" -v, --version print version information and exit");
|
|
38
|
+
- util.puts(" -h, --help print help and exit");
|
|
39
|
+
+ console.log("Usage: pegjs [options] [--] [<input_file>] [<output_file>]");
|
|
40
|
+
+ console.log("");
|
|
41
|
+
+ console.log("Generates a parser from the PEG grammar specified in the <input_file> and");
|
|
42
|
+
+ console.log("writes it to the <output_file>.");
|
|
43
|
+
+ console.log("");
|
|
44
|
+
+ console.log("If the <output_file> is omitted, its name is generated by changing the");
|
|
45
|
+
+ console.log("<input_file> extension to \".js\". If both <input_file> and <output_file> are");
|
|
46
|
+
+ console.log("omitted, standard input and output are used.");
|
|
47
|
+
+ console.log("");
|
|
48
|
+
+ console.log("Options:");
|
|
49
|
+
+ console.log(" -e, --export-var <variable> name of the variable where the parser");
|
|
50
|
+
+ console.log(" object will be stored (default:");
|
|
51
|
+
+ console.log(" \"module.exports\")");
|
|
52
|
+
+ console.log(" --cache make generated parser cache results");
|
|
53
|
+
+ console.log(" --allowed-start-rules <rules> comma-separated list of rules the generated");
|
|
54
|
+
+ console.log(" parser will be allowed to start parsing");
|
|
55
|
+
+ console.log(" from (default: the first rule in the");
|
|
56
|
+
+ console.log(" grammar)");
|
|
57
|
+
+ console.log(" -v, --version print version information and exit");
|
|
58
|
+
+ console.log(" -h, --help print help and exit");
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function exitSuccess() {
|
|
62
|
+
@@ -42,7 +43,7 @@
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function abort(message) {
|
|
66
|
+
- util.error(message);
|
|
67
|
+
+ console.error(message);
|
|
68
|
+
exitFailure();
|
|
69
|
+
}
|
|
70
|
+
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
diff -ruN a/source-map/lib/source-map/array-set.js b/source-map/lib/source-map/array-set.js
|
|
2
|
+
--- a/source-map/lib/source-map/array-set.js 2026-12-03 22:47:51.204869647 -0500
|
|
3
|
+
+++ b/source-map/lib/source-map/array-set.js 2026-12-03 22:47:51.205988784 -0500
|
|
4
|
+
@@ -4,10 +4,7 @@
|
|
5
|
+
* Licensed under the New BSD license. See LICENSE or:
|
|
6
|
+
* http://opensource.org/licenses/BSD-3-Clause
|
|
7
|
+
*/
|
|
8
|
+
-if (typeof define !== 'function') {
|
|
9
|
+
- var define = require('amdefine')(module);
|
|
10
|
+
-}
|
|
11
|
+
-define(function (require, exports, module) {
|
|
12
|
+
+// Vendored into MambaScript from source-map 0.1.11 (BSD-3-Clause, see ../../LICENSE); amdefine wrapper removed.
|
|
13
|
+
|
|
14
|
+
var util = require('./util');
|
|
15
|
+
|
|
16
|
+
@@ -93,4 +90,3 @@
|
|
17
|
+
|
|
18
|
+
exports.ArraySet = ArraySet;
|
|
19
|
+
|
|
20
|
+
-});
|
|
21
|
+
diff -ruN a/source-map/lib/source-map/base64.js b/source-map/lib/source-map/base64.js
|
|
22
|
+
--- a/source-map/lib/source-map/base64.js 2026-12-03 22:47:51.204904690 -0500
|
|
23
|
+
+++ b/source-map/lib/source-map/base64.js 2026-12-03 22:47:51.206020940 -0500
|
|
24
|
+
@@ -4,10 +4,7 @@
|
|
25
|
+
* Licensed under the New BSD license. See LICENSE or:
|
|
26
|
+
* http://opensource.org/licenses/BSD-3-Clause
|
|
27
|
+
*/
|
|
28
|
+
-if (typeof define !== 'function') {
|
|
29
|
+
- var define = require('amdefine')(module);
|
|
30
|
+
-}
|
|
31
|
+
-define(function (require, exports, module) {
|
|
32
|
+
+// Vendored into MambaScript from source-map 0.1.11 (BSD-3-Clause, see ../../LICENSE); amdefine wrapper removed.
|
|
33
|
+
|
|
34
|
+
var charToIntMap = {};
|
|
35
|
+
var intToCharMap = {};
|
|
36
|
+
@@ -39,4 +36,3 @@
|
|
37
|
+
throw new TypeError("Not a valid base 64 digit: " + aChar);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
-});
|
|
41
|
+
diff -ruN a/source-map/lib/source-map/base64-vlq.js b/source-map/lib/source-map/base64-vlq.js
|
|
42
|
+
--- a/source-map/lib/source-map/base64-vlq.js 2026-12-03 22:47:51.204891867 -0500
|
|
43
|
+
+++ b/source-map/lib/source-map/base64-vlq.js 2026-12-03 22:47:51.206041058 -0500
|
|
44
|
+
@@ -34,10 +34,7 @@
|
|
45
|
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
46
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
47
|
+
*/
|
|
48
|
+
-if (typeof define !== 'function') {
|
|
49
|
+
- var define = require('amdefine')(module);
|
|
50
|
+
-}
|
|
51
|
+
-define(function (require, exports, module) {
|
|
52
|
+
+// Vendored into MambaScript from source-map 0.1.11 (BSD-3-Clause, see ../../LICENSE); amdefine wrapper removed.
|
|
53
|
+
|
|
54
|
+
var base64 = require('./base64');
|
|
55
|
+
|
|
56
|
+
@@ -141,4 +138,3 @@
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
-});
|
|
61
|
+
diff -ruN a/source-map/lib/source-map/binary-search.js b/source-map/lib/source-map/binary-search.js
|
|
62
|
+
--- a/source-map/lib/source-map/binary-search.js 2026-12-03 22:47:51.204913333 -0500
|
|
63
|
+
+++ b/source-map/lib/source-map/binary-search.js 2026-12-03 22:47:51.206067926 -0500
|
|
64
|
+
@@ -4,10 +4,7 @@
|
|
65
|
+
* Licensed under the New BSD license. See LICENSE or:
|
|
66
|
+
* http://opensource.org/licenses/BSD-3-Clause
|
|
67
|
+
*/
|
|
68
|
+
-if (typeof define !== 'function') {
|
|
69
|
+
- var define = require('amdefine')(module);
|
|
70
|
+
-}
|
|
71
|
+
-define(function (require, exports, module) {
|
|
72
|
+
+// Vendored into MambaScript from source-map 0.1.11 (BSD-3-Clause, see ../../LICENSE); amdefine wrapper removed.
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Recursive implementation of binary search.
|
|
76
|
+
@@ -78,4 +75,3 @@
|
|
77
|
+
: null;
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
-});
|
|
81
|
+
diff -ruN a/source-map/lib/source-map/source-map-consumer.js b/source-map/lib/source-map/source-map-consumer.js
|
|
82
|
+
--- a/source-map/lib/source-map/source-map-consumer.js 2026-12-03 22:47:51.204924587 -0500
|
|
83
|
+
+++ b/source-map/lib/source-map/source-map-consumer.js 2026-12-03 22:47:51.206089282 -0500
|
|
84
|
+
@@ -4,10 +4,7 @@
|
|
85
|
+
* Licensed under the New BSD license. See LICENSE or:
|
|
86
|
+
* http://opensource.org/licenses/BSD-3-Clause
|
|
87
|
+
*/
|
|
88
|
+
-if (typeof define !== 'function') {
|
|
89
|
+
- var define = require('amdefine')(module);
|
|
90
|
+
-}
|
|
91
|
+
-define(function (require, exports, module) {
|
|
92
|
+
+// Vendored into MambaScript from source-map 0.1.11 (BSD-3-Clause, see ../../LICENSE); amdefine wrapper removed.
|
|
93
|
+
|
|
94
|
+
var util = require('./util');
|
|
95
|
+
var binarySearch = require('./binary-search');
|
|
96
|
+
@@ -405,4 +402,3 @@
|
|
97
|
+
|
|
98
|
+
exports.SourceMapConsumer = SourceMapConsumer;
|
|
99
|
+
|
|
100
|
+
-});
|
|
101
|
+
diff -ruN a/source-map/lib/source-map/source-map-generator.js b/source-map/lib/source-map/source-map-generator.js
|
|
102
|
+
--- a/source-map/lib/source-map/source-map-generator.js 2026-12-03 22:47:51.204936723 -0500
|
|
103
|
+
+++ b/source-map/lib/source-map/source-map-generator.js 2026-12-03 22:47:51.206124173 -0500
|
|
104
|
+
@@ -4,10 +4,7 @@
|
|
105
|
+
* Licensed under the New BSD license. See LICENSE or:
|
|
106
|
+
* http://opensource.org/licenses/BSD-3-Clause
|
|
107
|
+
*/
|
|
108
|
+
-if (typeof define !== 'function') {
|
|
109
|
+
- var define = require('amdefine')(module);
|
|
110
|
+
-}
|
|
111
|
+
-define(function (require, exports, module) {
|
|
112
|
+
+// Vendored into MambaScript from source-map 0.1.11 (BSD-3-Clause, see ../../LICENSE); amdefine wrapper removed.
|
|
113
|
+
|
|
114
|
+
var base64VLQ = require('./base64-vlq');
|
|
115
|
+
var util = require('./util');
|
|
116
|
+
@@ -230,4 +227,3 @@
|
|
117
|
+
|
|
118
|
+
exports.SourceMapGenerator = SourceMapGenerator;
|
|
119
|
+
|
|
120
|
+
-});
|
|
121
|
+
diff -ruN a/source-map/lib/source-map/source-node.js b/source-map/lib/source-map/source-node.js
|
|
122
|
+
--- a/source-map/lib/source-map/source-node.js 2026-12-03 22:47:51.204947166 -0500
|
|
123
|
+
+++ b/source-map/lib/source-map/source-node.js 2026-12-03 22:47:51.206143340 -0500
|
|
124
|
+
@@ -4,10 +4,7 @@
|
|
125
|
+
* Licensed under the New BSD license. See LICENSE or:
|
|
126
|
+
* http://opensource.org/licenses/BSD-3-Clause
|
|
127
|
+
*/
|
|
128
|
+
-if (typeof define !== 'function') {
|
|
129
|
+
- var define = require('amdefine')(module);
|
|
130
|
+
-}
|
|
131
|
+
-define(function (require, exports, module) {
|
|
132
|
+
+// Vendored into MambaScript from source-map 0.1.11 (BSD-3-Clause, see ../../LICENSE); amdefine wrapper removed.
|
|
133
|
+
|
|
134
|
+
var SourceMapGenerator = require('./source-map-generator').SourceMapGenerator;
|
|
135
|
+
|
|
136
|
+
@@ -202,4 +199,3 @@
|
|
137
|
+
|
|
138
|
+
exports.SourceNode = SourceNode;
|
|
139
|
+
|
|
140
|
+
-});
|
|
141
|
+
diff -ruN a/source-map/lib/source-map/util.js b/source-map/lib/source-map/util.js
|
|
142
|
+
--- a/source-map/lib/source-map/util.js 2026-12-03 22:47:51.204960332 -0500
|
|
143
|
+
+++ b/source-map/lib/source-map/util.js 2026-12-03 22:47:51.206161731 -0500
|
|
144
|
+
@@ -4,10 +4,7 @@
|
|
145
|
+
* Licensed under the New BSD license. See LICENSE or:
|
|
146
|
+
* http://opensource.org/licenses/BSD-3-Clause
|
|
147
|
+
*/
|
|
148
|
+
-if (typeof define !== 'function') {
|
|
149
|
+
- var define = require('amdefine')(module);
|
|
150
|
+
-}
|
|
151
|
+
-define(function (require, exports, module) {
|
|
152
|
+
+// Vendored into MambaScript from source-map 0.1.11 (BSD-3-Clause, see ../../LICENSE); amdefine wrapper removed.
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* This is a helper function for getting values from parameter/options
|
|
156
|
+
@@ -58,4 +55,3 @@
|
|
157
|
+
}
|
|
158
|
+
exports.relative = relative;
|
|
159
|
+
|
|
160
|
+
-});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
|
|
2
|
+
Copyright (c) 2009-2011, Mozilla Foundation and contributors
|
|
3
|
+
All rights reserved.
|
|
4
|
+
|
|
5
|
+
Redistribution and use in source and binary forms, with or without
|
|
6
|
+
modification, are permitted provided that the following conditions are met:
|
|
7
|
+
|
|
8
|
+
* Redistributions of source code must retain the above copyright notice, this
|
|
9
|
+
list of conditions and the following disclaimer.
|
|
10
|
+
|
|
11
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
|
12
|
+
this list of conditions and the following disclaimer in the documentation
|
|
13
|
+
and/or other materials provided with the distribution.
|
|
14
|
+
|
|
15
|
+
* Neither the names of the Mozilla Foundation nor the names of project
|
|
16
|
+
contributors may be used to endorse or promote products derived from this
|
|
17
|
+
software without specific prior written permission.
|
|
18
|
+
|
|
19
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
20
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
21
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
22
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
23
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
24
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
25
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
26
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
27
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
28
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/* -*- Mode: js; js-indent-level: 2; -*- */
|
|
2
|
+
/*
|
|
3
|
+
* Copyright 2011 Mozilla Foundation and contributors
|
|
4
|
+
* Licensed under the New BSD license. See LICENSE or:
|
|
5
|
+
* http://opensource.org/licenses/BSD-3-Clause
|
|
6
|
+
*/
|
|
7
|
+
// Vendored into MambaScript from source-map 0.1.11 (BSD-3-Clause, see ../../LICENSE); amdefine wrapper removed.
|
|
8
|
+
|
|
9
|
+
var util = require('./util');
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* A data structure which is a combination of an array and a set. Adding a new
|
|
13
|
+
* member is O(1), testing for membership is O(1), and finding the index of an
|
|
14
|
+
* element is O(1). Removing elements from the set is not supported. Only
|
|
15
|
+
* strings are supported for membership.
|
|
16
|
+
*/
|
|
17
|
+
function ArraySet() {
|
|
18
|
+
this._array = [];
|
|
19
|
+
this._set = {};
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Static method for creating ArraySet instances from an existing array.
|
|
24
|
+
*/
|
|
25
|
+
ArraySet.fromArray = function ArraySet_fromArray(aArray) {
|
|
26
|
+
var set = new ArraySet();
|
|
27
|
+
for (var i = 0, len = aArray.length; i < len; i++) {
|
|
28
|
+
set.add(aArray[i]);
|
|
29
|
+
}
|
|
30
|
+
return set;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Add the given string to this set.
|
|
35
|
+
*
|
|
36
|
+
* @param String aStr
|
|
37
|
+
*/
|
|
38
|
+
ArraySet.prototype.add = function ArraySet_add(aStr) {
|
|
39
|
+
if (this.has(aStr)) {
|
|
40
|
+
// Already a member; nothing to do.
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
var idx = this._array.length;
|
|
44
|
+
this._array.push(aStr);
|
|
45
|
+
this._set[util.toSetString(aStr)] = idx;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Is the given string a member of this set?
|
|
50
|
+
*
|
|
51
|
+
* @param String aStr
|
|
52
|
+
*/
|
|
53
|
+
ArraySet.prototype.has = function ArraySet_has(aStr) {
|
|
54
|
+
return Object.prototype.hasOwnProperty.call(this._set,
|
|
55
|
+
util.toSetString(aStr));
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* What is the index of the given string in the array?
|
|
60
|
+
*
|
|
61
|
+
* @param String aStr
|
|
62
|
+
*/
|
|
63
|
+
ArraySet.prototype.indexOf = function ArraySet_indexOf(aStr) {
|
|
64
|
+
if (this.has(aStr)) {
|
|
65
|
+
return this._set[util.toSetString(aStr)];
|
|
66
|
+
}
|
|
67
|
+
throw new Error('"' + aStr + '" is not in the set.');
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* What is the element at the given index?
|
|
72
|
+
*
|
|
73
|
+
* @param Number aIdx
|
|
74
|
+
*/
|
|
75
|
+
ArraySet.prototype.at = function ArraySet_at(aIdx) {
|
|
76
|
+
if (aIdx >= 0 && aIdx < this._array.length) {
|
|
77
|
+
return this._array[aIdx];
|
|
78
|
+
}
|
|
79
|
+
throw new Error('No element indexed by ' + aIdx);
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Returns the array representation of this set (which has the proper indices
|
|
84
|
+
* indicated by indexOf). Note that this is a copy of the internal array used
|
|
85
|
+
* for storing the members so that no one can mess with internal state.
|
|
86
|
+
*/
|
|
87
|
+
ArraySet.prototype.toArray = function ArraySet_toArray() {
|
|
88
|
+
return this._array.slice();
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
exports.ArraySet = ArraySet;
|
|
92
|
+
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/* -*- Mode: js; js-indent-level: 2; -*- */
|
|
2
|
+
/*
|
|
3
|
+
* Copyright 2011 Mozilla Foundation and contributors
|
|
4
|
+
* Licensed under the New BSD license. See LICENSE or:
|
|
5
|
+
* http://opensource.org/licenses/BSD-3-Clause
|
|
6
|
+
*
|
|
7
|
+
* Based on the Base 64 VLQ implementation in Closure Compiler:
|
|
8
|
+
* https://code.google.com/p/closure-compiler/source/browse/trunk/src/com/google/debugging/sourcemap/Base64VLQ.java
|
|
9
|
+
*
|
|
10
|
+
* Copyright 2011 The Closure Compiler Authors. All rights reserved.
|
|
11
|
+
* Redistribution and use in source and binary forms, with or without
|
|
12
|
+
* modification, are permitted provided that the following conditions are
|
|
13
|
+
* met:
|
|
14
|
+
*
|
|
15
|
+
* * Redistributions of source code must retain the above copyright
|
|
16
|
+
* notice, this list of conditions and the following disclaimer.
|
|
17
|
+
* * Redistributions in binary form must reproduce the above
|
|
18
|
+
* copyright notice, this list of conditions and the following
|
|
19
|
+
* disclaimer in the documentation and/or other materials provided
|
|
20
|
+
* with the distribution.
|
|
21
|
+
* * Neither the name of Google Inc. nor the names of its
|
|
22
|
+
* contributors may be used to endorse or promote products derived
|
|
23
|
+
* from this software without specific prior written permission.
|
|
24
|
+
*
|
|
25
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
26
|
+
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
27
|
+
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
28
|
+
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
29
|
+
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
30
|
+
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
31
|
+
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
32
|
+
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
33
|
+
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
34
|
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
35
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
36
|
+
*/
|
|
37
|
+
// Vendored into MambaScript from source-map 0.1.11 (BSD-3-Clause, see ../../LICENSE); amdefine wrapper removed.
|
|
38
|
+
|
|
39
|
+
var base64 = require('./base64');
|
|
40
|
+
|
|
41
|
+
// A single base 64 digit can contain 6 bits of data. For the base 64 variable
|
|
42
|
+
// length quantities we use in the source map spec, the first bit is the sign,
|
|
43
|
+
// the next four bits are the actual value, and the 6th bit is the
|
|
44
|
+
// continuation bit. The continuation bit tells us whether there are more
|
|
45
|
+
// digits in this value following this digit.
|
|
46
|
+
//
|
|
47
|
+
// Continuation
|
|
48
|
+
// | Sign
|
|
49
|
+
// | |
|
|
50
|
+
// V V
|
|
51
|
+
// 101011
|
|
52
|
+
|
|
53
|
+
var VLQ_BASE_SHIFT = 5;
|
|
54
|
+
|
|
55
|
+
// binary: 100000
|
|
56
|
+
var VLQ_BASE = 1 << VLQ_BASE_SHIFT;
|
|
57
|
+
|
|
58
|
+
// binary: 011111
|
|
59
|
+
var VLQ_BASE_MASK = VLQ_BASE - 1;
|
|
60
|
+
|
|
61
|
+
// binary: 100000
|
|
62
|
+
var VLQ_CONTINUATION_BIT = VLQ_BASE;
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Converts from a two-complement value to a value where the sign bit is
|
|
66
|
+
* is placed in the least significant bit. For example, as decimals:
|
|
67
|
+
* 1 becomes 2 (10 binary), -1 becomes 3 (11 binary)
|
|
68
|
+
* 2 becomes 4 (100 binary), -2 becomes 5 (101 binary)
|
|
69
|
+
*/
|
|
70
|
+
function toVLQSigned(aValue) {
|
|
71
|
+
return aValue < 0
|
|
72
|
+
? ((-aValue) << 1) + 1
|
|
73
|
+
: (aValue << 1) + 0;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Converts to a two-complement value from a value where the sign bit is
|
|
78
|
+
* is placed in the least significant bit. For example, as decimals:
|
|
79
|
+
* 2 (10 binary) becomes 1, 3 (11 binary) becomes -1
|
|
80
|
+
* 4 (100 binary) becomes 2, 5 (101 binary) becomes -2
|
|
81
|
+
*/
|
|
82
|
+
function fromVLQSigned(aValue) {
|
|
83
|
+
var isNegative = (aValue & 1) === 1;
|
|
84
|
+
var shifted = aValue >> 1;
|
|
85
|
+
return isNegative
|
|
86
|
+
? -shifted
|
|
87
|
+
: shifted;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Returns the base 64 VLQ encoded value.
|
|
92
|
+
*/
|
|
93
|
+
exports.encode = function base64VLQ_encode(aValue) {
|
|
94
|
+
var encoded = "";
|
|
95
|
+
var digit;
|
|
96
|
+
|
|
97
|
+
var vlq = toVLQSigned(aValue);
|
|
98
|
+
|
|
99
|
+
do {
|
|
100
|
+
digit = vlq & VLQ_BASE_MASK;
|
|
101
|
+
vlq >>>= VLQ_BASE_SHIFT;
|
|
102
|
+
if (vlq > 0) {
|
|
103
|
+
// There are still more digits in this value, so we must make sure the
|
|
104
|
+
// continuation bit is marked.
|
|
105
|
+
digit |= VLQ_CONTINUATION_BIT;
|
|
106
|
+
}
|
|
107
|
+
encoded += base64.encode(digit);
|
|
108
|
+
} while (vlq > 0);
|
|
109
|
+
|
|
110
|
+
return encoded;
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Decodes the next base 64 VLQ value from the given string and returns the
|
|
115
|
+
* value and the rest of the string.
|
|
116
|
+
*/
|
|
117
|
+
exports.decode = function base64VLQ_decode(aStr) {
|
|
118
|
+
var i = 0;
|
|
119
|
+
var strLen = aStr.length;
|
|
120
|
+
var result = 0;
|
|
121
|
+
var shift = 0;
|
|
122
|
+
var continuation, digit;
|
|
123
|
+
|
|
124
|
+
do {
|
|
125
|
+
if (i >= strLen) {
|
|
126
|
+
throw new Error("Expected more digits in base 64 VLQ value.");
|
|
127
|
+
}
|
|
128
|
+
digit = base64.decode(aStr.charAt(i++));
|
|
129
|
+
continuation = !!(digit & VLQ_CONTINUATION_BIT);
|
|
130
|
+
digit &= VLQ_BASE_MASK;
|
|
131
|
+
result = result + (digit << shift);
|
|
132
|
+
shift += VLQ_BASE_SHIFT;
|
|
133
|
+
} while (continuation);
|
|
134
|
+
|
|
135
|
+
return {
|
|
136
|
+
value: fromVLQSigned(result),
|
|
137
|
+
rest: aStr.slice(i)
|
|
138
|
+
};
|
|
139
|
+
};
|
|
140
|
+
|