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

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

Pred finalna verzija

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