MCPcopy
hub / github.com/brunch/brunch / normMethods

Function normMethods

lib/utils/plugin-adapter.js:36–52  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34};
35
36const normMethods = plugin => {
37 const methods = {};
38 methods.lint = methods.getDependencies = [bind, promisify(false), thenify, warnIfLong];
39 methods.compile = methods.optimize = [bind, promisify(true), thenify, wrapStrings, warnIfLong];
40 methods.compileStatic = [bind, thenify, wrapStrings, warnIfLong];
41
42 Object.keys(methods).forEach(key => {
43 const fn = plugin[key];
44 if (typeof fn !== 'function') return;
45
46 const decorators = methods[key];
47 const compose = (fn, decorator) => decorator(fn, plugin, key);
48 const value = decorators.reduce(compose, fn);
49
50 Object.defineProperty(plugin, key, {value});
51 });
52};
53
54const bind = (fn, plugin) => fn.bind(plugin);
55const promisify = returnsFile => fn => {

Callers 1

plugin-adapter.jsFile · 0.85

Calls 1

promisifyFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…