source: imaps-frontend/node_modules/@babel/helper-plugin-utils/lib/index.js@ d565449

main
Last change on this file since d565449 was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 2.5 KB
Line 
1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.declare = declare;
7exports.declarePreset = void 0;
8const apiPolyfills = {
9 assertVersion: api => range => {
10 throwVersionError(range, api.version);
11 }
12};
13{
14 Object.assign(apiPolyfills, {
15 targets: () => () => {
16 return {};
17 },
18 assumption: () => () => {
19 return undefined;
20 }
21 });
22}
23function declare(builder) {
24 return (api, options, dirname) => {
25 var _clonedApi2;
26 let clonedApi;
27 for (const name of Object.keys(apiPolyfills)) {
28 var _clonedApi;
29 if (api[name]) continue;
30 (_clonedApi = clonedApi) != null ? _clonedApi : clonedApi = copyApiObject(api);
31 clonedApi[name] = apiPolyfills[name](clonedApi);
32 }
33 return builder((_clonedApi2 = clonedApi) != null ? _clonedApi2 : api, options || {}, dirname);
34 };
35}
36const declarePreset = exports.declarePreset = declare;
37function copyApiObject(api) {
38 let proto = null;
39 if (typeof api.version === "string" && /^7\./.test(api.version)) {
40 proto = Object.getPrototypeOf(api);
41 if (proto && (!hasOwnProperty.call(proto, "version") || !hasOwnProperty.call(proto, "transform") || !hasOwnProperty.call(proto, "template") || !hasOwnProperty.call(proto, "types"))) {
42 proto = null;
43 }
44 }
45 return Object.assign({}, proto, api);
46}
47function throwVersionError(range, version) {
48 if (typeof range === "number") {
49 if (!Number.isInteger(range)) {
50 throw new Error("Expected string or integer value.");
51 }
52 range = `^${range}.0.0-0`;
53 }
54 if (typeof range !== "string") {
55 throw new Error("Expected string or integer value.");
56 }
57 const limit = Error.stackTraceLimit;
58 if (typeof limit === "number" && limit < 25) {
59 Error.stackTraceLimit = 25;
60 }
61 let err;
62 if (version.slice(0, 2) === "7.") {
63 err = new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${version}". ` + `You'll need to update your @babel/core version.`);
64 } else {
65 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.`);
66 }
67 if (typeof limit === "number") {
68 Error.stackTraceLimit = limit;
69 }
70 throw Object.assign(err, {
71 code: "BABEL_VERSION_UNSUPPORTED",
72 version,
73 range
74 });
75}
76
77//# sourceMappingURL=index.js.map
Note: See TracBrowser for help on using the repository browser.