/opt/canhelp/node_modules/next/dist/build/babel/plugins
NameSizeModeActions
amp-attributes.d.ts1220644editdlrm
amp-attributes.js10430644editdlrm
amp-attributes.js.map15330644editdlrm
commonjs.d.ts1350644editdlrm
commonjs.js14200644editdlrm
commonjs.js.map18600644editdlrm
jsx-pragma.d.ts2300644editdlrm
jsx-pragma.js37030644editdlrm
jsx-pragma.js.map64230644editdlrm
next-font-unsupported.d.ts1420644editdlrm
next-font-unsupported.js14420644editdlrm
next-font-unsupported.js.map17930644editdlrm
next-page-config.d.ts2340644editdlrm
next-page-config.js90390644editdlrm
next-page-config.js.map124580644editdlrm
next-page-disallow-re-export-all-exports.d.ts1420644editdlrm
next-page-disallow-re-export-all-exports.js11830644editdlrm
next-page-disallow-re-export-all-exports.js.map14930644editdlrm
next-ssg-transform.d.ts6340644editdlrm
next-ssg-transform.js167450644editdlrm
next-ssg-transform.js.map248630644editdlrm
optimize-hook-destructuring.d.ts2300644editdlrm
optimize-hook-destructuring.js24860644editdlrm
optimize-hook-destructuring.js.map46290644editdlrm
react-loadable-plugin.d.ts13270644editdlrm
react-loadable-plugin.js79640644editdlrm
react-loadable-plugin.js.map126500644editdlrm
Edit: /opt/canhelp/node_modules/next/dist/build/babel/plugins/optimize-hook-destructuring.js (2486B)
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "default", { enumerable: true, get: function() { return _default; } }); // matches any hook-like (the default) const isHook = /^use[A-Z]/; // matches only built-in hooks provided by React et al const isBuiltInHook = /^use(Callback|Context|DebugValue|Effect|ImperativeHandle|LayoutEffect|Memo|Reducer|Ref|State)$/; function _default({ types: t }) { const visitor = { CallExpression (path, state) { const onlyBuiltIns = state.opts.onlyBuiltIns; // if specified, options.lib is a list of libraries that provide hook functions const libs = state.opts.lib && (state.opts.lib === true ? [ 'react', 'preact/hooks' ] : [].concat(state.opts.lib)); // skip function calls that are not the init of a variable declaration: if (!t.isVariableDeclarator(path.parent)) return; // skip function calls where the return value is not Array-destructured: if (!t.isArrayPattern(path.parent.id)) return; // name of the (hook) function being called: const hookName = path.node.callee.name; if (libs) { const binding = path.scope.getBinding(hookName); // not an import if (!binding || binding.kind !== 'module') return; const specifier = binding.path.parent.source.value; // not a match if (!libs.some((lib)=>lib === specifier)) return; } // only match function calls with names that look like a hook if (!(onlyBuiltIns ? isBuiltInHook : isHook).test(hookName)) return; path.parent.id = t.objectPattern(path.parent.id.elements.reduce((patterns, element, i)=>{ if (element === null) { return patterns; } return patterns.concat(t.objectProperty(t.numericLiteral(i), // TODO: fix this element)); }, [])); } }; return { name: 'optimize-hook-destructuring', visitor: { // this is a workaround to run before preset-env destroys destructured assignments Program (path, state) { path.traverse(visitor, state); } } }; } //# sourceMappingURL=optimize-hook-destructuring.js.map