aboutsummaryrefslogtreecommitdiff
path: root/node_modules/@babel/core/lib/config/helpers
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/@babel/core/lib/config/helpers')
-rw-r--r--node_modules/@babel/core/lib/config/helpers/config-api.js76
-rw-r--r--node_modules/@babel/core/lib/config/helpers/environment.js10
2 files changed, 86 insertions, 0 deletions
diff --git a/node_modules/@babel/core/lib/config/helpers/config-api.js b/node_modules/@babel/core/lib/config/helpers/config-api.js
new file mode 100644
index 00000000..78080a80
--- /dev/null
+++ b/node_modules/@babel/core/lib/config/helpers/config-api.js
@@ -0,0 +1,76 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.default = makeAPI;
+
+function _semver() {
+ const data = _interopRequireDefault(require("semver"));
+
+ _semver = function _semver() {
+ return data;
+ };
+
+ return data;
+}
+
+var _ = require("../../");
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+function makeAPI(cache) {
+ const env = value => cache.using(data => {
+ if (typeof value === "undefined") return data.envName;
+ if (typeof value === "function") return value(data.envName);
+ if (!Array.isArray(value)) value = [value];
+ return value.some(entry => {
+ if (typeof entry !== "string") {
+ throw new Error("Unexpected non-string value");
+ }
+
+ return entry === data.envName;
+ });
+ });
+
+ return {
+ version: _.version,
+ cache: cache.simple(),
+ env,
+ async: () => false,
+ assertVersion
+ };
+}
+
+function assertVersion(range) {
+ if (typeof range === "number") {
+ if (!Number.isInteger(range)) {
+ throw new Error("Expected string or integer value.");
+ }
+
+ range = `^${range}.0.0-0`;
+ }
+
+ if (typeof range !== "string") {
+ throw new Error("Expected string or integer value.");
+ }
+
+ if (_semver().default.satisfies(_.version, range)) return;
+ const limit = Error.stackTraceLimit;
+
+ if (typeof limit === "number" && limit < 25) {
+ Error.stackTraceLimit = 25;
+ }
+
+ const err = new Error(`Requires Babel "${range}", but was loaded with "${_.version}". ` + `If you are sure you have a compatible version of @babel/core, ` + `it is likely that something in your build process is loading the ` + `wrong version. Inspect the stack trace of this error to look for ` + `the first entry that doesn't mention "@babel/core" or "babel-core" ` + `to see what is calling Babel.`);
+
+ if (typeof limit === "number") {
+ Error.stackTraceLimit = limit;
+ }
+
+ throw Object.assign(err, {
+ code: "BABEL_VERSION_UNSUPPORTED",
+ version: _.version,
+ range
+ });
+} \ No newline at end of file
diff --git a/node_modules/@babel/core/lib/config/helpers/environment.js b/node_modules/@babel/core/lib/config/helpers/environment.js
new file mode 100644
index 00000000..e4bfdbc7
--- /dev/null
+++ b/node_modules/@babel/core/lib/config/helpers/environment.js
@@ -0,0 +1,10 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.getEnv = getEnv;
+
+function getEnv(defaultValue = "development") {
+ return process.env.BABEL_ENV || process.env.NODE_ENV || defaultValue;
+} \ No newline at end of file