first commit

This commit is contained in:
s.golasch
2023-08-01 13:49:46 +02:00
commit 1fc239fd54
20238 changed files with 3112246 additions and 0 deletions

74
build/node_modules/prepack/lib/utils/parse.js generated vendored Normal file
View File

@@ -0,0 +1,74 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = function (realm, code, filename) {
var sourceType = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "script";
var startLine = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
try {
var plugins = [];
if (realm.react.enabled) {
plugins.push("jsx");
if (realm.react.flowRequired) {
plugins.push("flow");
}
}
var ast = (0, _babylon.parse)(code, { filename: filename, sourceType: sourceType, startLine: startLine, plugins: plugins });
(0, _traverseFast2.default)(ast, function (node) {
(0, _invariant2.default)(node.loc);
node.loc.source = filename;
return false;
});
return ast;
} catch (e) {
if (e instanceof SyntaxError) {
// Babel reports all errors as syntax errors, even if a ReferenceError should be thrown.
// What we do here is a totally robust way to address that issue.
var referenceErrors = ["Invalid left-hand side in postfix operation", "Invalid left-hand side in prefix operation", "Invalid left-hand side in assignment expression"];
var error = void 0;
if (referenceErrors.some(function (msg) {
return e.message.indexOf(msg) >= 0;
})) {
error = (0, _construct.Construct)(realm, realm.intrinsics.ReferenceError, [new _index.StringValue(realm, e.message)]);
} else {
error = (0, _construct.Construct)(realm, realm.intrinsics.SyntaxError, [new _index.StringValue(realm, e.message)]);
}
// These constructors are currently guaranteed to produce an object with
// built-in error data. Append location information about the syntax error
// and the source code to it so that we can use it to print nicer errors.
(0, _invariant2.default)(error.$ErrorData);
error.$ErrorData.locationData = {
filename: filename,
sourceCode: code,
loc: e.loc,
stackDecorated: false
};
throw new _completions.ThrowCompletion(error, e.loc);
} else {
throw e;
}
}
};
var _invariant = require("../invariant.js");
var _invariant2 = _interopRequireDefault(_invariant);
var _completions = require("../completions.js");
var _index = require("../values/index.js");
var _construct = require("../methods/construct.js");
var _traverseFast = require("../utils/traverse-fast.js");
var _traverseFast2 = _interopRequireDefault(_traverseFast);
var _babylon = require("babylon");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
//# sourceMappingURL=parse.js.map