source: imaps-frontend/node_modules/@babel/plugin-transform-modules-commonjs/lib/hooks.js@ 79a0317

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

F4 Finalna Verzija

  • Property mode set to 100644
File size: 1.1 KB
Line 
1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.defineCommonJSHook = defineCommonJSHook;
7exports.makeInvokers = makeInvokers;
8const commonJSHooksKey = "@babel/plugin-transform-modules-commonjs/customWrapperPlugin";
9function defineCommonJSHook(file, hook) {
10 let hooks = file.get(commonJSHooksKey);
11 if (!hooks) file.set(commonJSHooksKey, hooks = []);
12 hooks.push(hook);
13}
14function findMap(arr, cb) {
15 if (arr) {
16 for (const el of arr) {
17 const res = cb(el);
18 if (res != null) return res;
19 }
20 }
21}
22function makeInvokers(file) {
23 const hooks = file.get(commonJSHooksKey);
24 return {
25 getWrapperPayload(...args) {
26 return findMap(hooks, hook => hook.getWrapperPayload == null ? void 0 : hook.getWrapperPayload(...args));
27 },
28 wrapReference(...args) {
29 return findMap(hooks, hook => hook.wrapReference == null ? void 0 : hook.wrapReference(...args));
30 },
31 buildRequireWrapper(...args) {
32 return findMap(hooks, hook => hook.buildRequireWrapper == null ? void 0 : hook.buildRequireWrapper(...args));
33 }
34 };
35}
36
37//# sourceMappingURL=hooks.js.map
Note: See TracBrowser for help on using the repository browser.