Beispiel #1
0
 /**
  * adds all the external plugins that were passed through `options.plugins`
  * @method addExternalPlugins
  * @private
  * @param {Object} plugins the config object with all plugins
  */
 addExternalPlugins(plugins) {
   plugins = this.groupPluginsByType(plugins)
   var pluginName = function(plugin) { return plugin.prototype.name }
   if (plugins.playback) { this.playbackPlugins = uniqBy(plugins.playback.concat(this.playbackPlugins), pluginName) }
   if (plugins.container) { this.containerPlugins = uniqBy(plugins.container.concat(this.containerPlugins), pluginName) }
   if (plugins.core) { this.corePlugins = uniqBy(plugins.core.concat(this.corePlugins), pluginName) }
   PlayerInfo.getInstance(this.playerId).playbackPlugins = this.playbackPlugins
 }
        .then(({results}) => {
          const smartEmojis = flush(results.map(({text}) => {
            return getEmojiDetailsFromEmoji(text)
          }))

          const suggestions = uniqBy(smartEmojis.concat(filtered), 'short_name')
          const presentSuggestions = suggestions.filter(x => !!getEmoji(x.short_name))
          cb(presentSuggestions)
        })
Beispiel #3
0
function * all (heroku, app) {
  const uniqby = require('lodash.uniqby')

  let attachments = yield heroku.get(`/apps/${app}/addon-attachments`, {
    headers: {'Accept-Inclusion': 'addon:plan'}
  })
  let addons = attachments.map(a => a.addon)
  addons = addons.filter(a => a.plan.name.startsWith('heroku-postgresql'))
  addons = uniqby(addons, 'id')

  return addons
}
 css.walkRules(rule => {
     const resolvedDecls = [];
     rule.walkDecls(decl => {
         const { prop } = decl;
         resolvedDecls.push(postcss.decl({
             prop,
             value: resolveProp(rule, prop),
         }));
     });
     rule.removeAll();
     rule.append(uniqBy(resolvedDecls, 'prop'));
 });
Beispiel #5
0
	return text => {
		if (!isString(text)) {
			throw new TypeError('The issue text must be a String');
		}

		const results = parse(text, regexp, mentionRegexp, opts);

		Reflect.defineProperty(results, 'allRefs', {
			get() {
				return uniqBy(this.refs.concat(...Object.keys(this.actions).map(key => this.actions[key])), 'raw');
			},
		});
		return results;
	};
const readDataLocals = async () => {
  const localFilePaths = uniqBy(
    await fg(localFileExts.map((ext) => path.join(sharedLocalDir, `*${ext}`)), {
      absolute: true,
    }),
    (filePath) => path.parse(filePath).name,
  )
  const files = await parseFiles(await readFiles(localFilePaths))
  const dataLocals = files.reduce((memo, { key, value }) => {
    memo[key] = value
    return memo
  }, {})
  return dataLocals
}
Beispiel #7
0
export default function setupPlugins(identity, plugins) {
  let pluginCounter = 0;
  return uniqBy(
    plugins.map((pluginFn = defaultPluginFunction) => {
      if (typeof pluginFn === 'function') {
        return pluginFn(identity);
      }
      return {};
    }),
    plugin => {
      return (plugin && plugin.meta && plugin.meta.name) || pluginCounter++;
    }
  );
}
Beispiel #8
0
 return __generator(this, function (_a) {
     switch (_a.label) {
         case 0:
             commands = this.plugins.reduce(function (t, p) {
                 try {
                     return t.concat(p.commands
                         .filter(function (c) { return c.topic === topic; })
                         .map(function (c) { return p.findCommand(c.id); }));
                 }
                 catch (err) {
                     _this.out.warn(err, "error reading plugin " + p.name);
                     return t;
                 }
             }, []);
             return [4 /*yield*/, Promise.all(commands)];
         case 1:
             commands = _a.sent();
             return [2 /*return*/, uniqby(commands, 'id')];
     }
 });
Beispiel #9
0
 /**
  * delete all versions objects of the component from the filesystem.
  * if deepRemove is true, it deletes also the refs associated with the deleted versions.
  * finally, it deletes the component object itself
  *
  * @param {Repository} repo
  * @param {boolean} [deepRemove=false] - whether remove all the refs or only the version array
  * @returns {Promise}
  * @memberof Component
  */
 remove(repo: Repository, deepRemove: boolean = false): Promise<boolean[]> {
   logger.debug(`models.component.remove: removing a component ${this.id()} from a local scope`);
   const objectRefs = deepRemove ? this.collectExistingRefs(repo, false).filter(x => x) : this.versionArray;
   const uniqRefs = uniqBy(objectRefs, 'hash');
   return repo.removeMany(uniqRefs.concat([this.hash()]));
 }
Beispiel #10
0
function loadPlugins(plugins, pluginSearchDirs) {
  if (!plugins) {
    plugins = [];
  }

  if (!pluginSearchDirs) {
    pluginSearchDirs = [];
  }
  // unless pluginSearchDirs are provided, auto-load plugins from node_modules that are parent to Prettier
  if (!pluginSearchDirs.length) {
    const autoLoadDir = thirdParty.findParentDir(
      thirdParty.findParentDir(__dirname, "prettier"),
      "node_modules"
    );
    if (autoLoadDir) {
      pluginSearchDirs = [autoLoadDir];
    }
  }

  const internalPlugins = [
    require("../language-js"),
    require("../language-css"),
    require("../language-handlebars"),
    require("../language-graphql"),
    require("../language-markdown"),
    require("../language-html"),
    require("../language-vue")
  ];

  const externalManualLoadPluginInfos = plugins.map(pluginName => {
    let requirePath;
    try {
      // try local files
      requirePath = resolve.sync(path.resolve(process.cwd(), pluginName));
    } catch (e) {
      // try node modules
      requirePath = resolve.sync(pluginName, { basedir: process.cwd() });
    }
    return {
      name: pluginName,
      requirePath
    };
  });

  const externalAutoLoadPluginInfos = pluginSearchDirs
    .map(pluginSearchDir => {
      const resolvedPluginSearchDir = path.resolve(
        process.cwd(),
        pluginSearchDir
      );

      if (!isDirectory(resolvedPluginSearchDir)) {
        throw new Error(
          `${pluginSearchDir} does not exist or is not a directory`
        );
      }

      const nodeModulesDir = path.resolve(
        resolvedPluginSearchDir,
        "node_modules"
      );

      return findPluginsInNodeModules(nodeModulesDir).map(pluginName => ({
        name: pluginName,
        requirePath: resolve.sync(pluginName, {
          basedir: resolvedPluginSearchDir
        })
      }));
    })
    .reduce((a, b) => a.concat(b), []);

  const externalPlugins = uniqBy(
    externalManualLoadPluginInfos.concat(externalAutoLoadPluginInfos),
    "requirePath"
  ).map(externalPluginInfo =>
    Object.assign(
      { name: externalPluginInfo.name },
      eval("require")(externalPluginInfo.requirePath)
    )
  );

  return internalPlugins.concat(externalPlugins);
}
Beispiel #11
0
 .then(function(result) {
   return uniqBy(result, 'src');
 })
Beispiel #12
0
import gulp from 'gulp'
import loadPlugins from 'gulp-load-plugins'
import del from 'del'
import path from 'path'
import { Instrumenter } from 'isparta'
import webpackStream from 'webpack-stream'
import merge from 'merge-stream'
import uniqBy from 'lodash.uniqby'
import mochaGlobals from './test/setup/.globals'
import manifest from './package.json'

// Load all of our Gulp plugins
const $ = loadPlugins()

// Gather the library data from `package.json`
const file = uniqBy(manifest.lanetix, 'path').map(e => ({
  folder: path.dirname(e.path),
  name: path.basename(e.path, path.extname(e.path))
}))

function cleanDist (done) {
  del(uniqBy(file, 'folder').map(e => e.folder)).then(() => done())
}

function cleanTmp (done) {
  del(['tmp']).then(() => done())
}

function onError () {
  $.util.beep()
}
Beispiel #13
0
function cleanDist (done) {
  del(uniqBy(file, 'folder').map(e => e.folder)).then(() => done())
}
Beispiel #14
0
const filterOverlappingDrop = (xScale, dropDate) => d =>
    uniqBy(d.data, data => Math.round(xScale(dropDate(data))));
Beispiel #15
0
 .then(result => uniqBy(result, 'src'))
Beispiel #16
0
 get: function () {
     return uniqby(this.plugins.reduce(function (t, p) { return t.concat(p.topics); }, []), 'id');
 },
 .then(funcs => uniqBy(funcs, f => f.module))
 .then(functions => uniqBy(functions, func => func.module))
export async function getFunctionDefinitions(state) {
  const serverFunctions = getServerFunctions(state);
  return uniqBy(serverFunctions.concat(functionsRegistry.toArray()), 'name');
}
Beispiel #20
0
export default function search (state = initialState, action) {
  switch (action.type) {
    case RECEIVE_SEARCH_RESULT:
      const itemsToDisplay = uniqBy(union(state.items, action.items), (a) => {
        return a.id;
      });
      itemsToDisplay.forEach((item) => {
        if (state.ranking) {
          let id = item.id;
          if (item.type === 'package') {
            id = `hotel:ne.wvid.${item.id}`;
          }
          item.rank = parseFloat(state.ranking[id]) || 0;
        }
      });
      return {
        ...state,
        items: itemsToDisplay,
        loading: false,
        error: ''
      };
    case RECEIVE_RELATED_RESULT:
      return {
        ...state,
        relatedItems: state.relatedItems.concat(action.items)
      };
    case UPDATE_DISPLAYED_ITEMS:
      return {
        ...state,
        displayedItems: action.items,
        feedEnd: action.items.length >= state.items.length
      };
    case BUSY_SEARCHING:
      return {
        ...state,
        loading: action.isBusy,
        searchComplete: false
      };
    case SEARCH_ERROR:
      return {
        ...state,
        loading: false,
        error: action.error
      };
    case UPDATE_TILE_RANKING:
      state.items.forEach(item => {
        let id = item.id;
        if (item.type === 'package') {
          id = `hotel:ne.wvid.${item.id}`;
        }
        item.rank = parseFloat(action.ranking[id]) || 0;
      });
      return {
        ...state,
        ranking: action.ranking
      };
    // case TAG_ADD_TAGS:
    //   /*
    //   * use this action if there are an initial set of tags passed
    //   * through when the page is first loaded
    //   */
    //   return {
    //     ...state,
    //     tags: action.tags
    //   };
    case TAG_ADD_SINGLE_TAG:
      if (state.isInitialTag) {
        return {...state, tags: [action.tag], isInitialTag: false, autocompleteOptions: []};
      }
      return {
        ...state,
        tags: uniqBy([...state.tags, action.tag], 'displayName'),
        isInitialTag: action.isInitialTag,
        autocompleteOptions: []
      };
    case TAG_REMOVE_TAG:
      let newTags = state.tags.filter(tag => {
        return tag.displayName !== action.displayName;
      });
      let isInitialTag = false;
      if (newTags.length === 0) {
        newTags = [initialState.defaultTag];
        isInitialTag = true;
      }
      return {
        ...state,
        tags: newTags,
        error: '',
        isInitialTag
      };
    case RESET_TAGS:
      return {
        ...state,
        tags: [initialState.defaultTag],
        isInitialTag: true,
        autocompleteOptions: []
      };
    case SET_SEARCH_STRING:
      return {
        ...state,
        searchString: action.searchString
      };
    case CLEAR_SEARCH_STRING:
      return {
        ...state,
        searchString: '',
        autocompleteOptions: []
      };
    case SET_AUTOCOMPLETE_ERROR:
      return {
        ...state,
        autocompleteError: action.error,
        inAutoCompleteSearch: false
      };
    case SET_AUTOCOMPLETE_OPTIONS:
      return {
        ...state,
        autocompleteOptions: action.items,
        inAutoCompleteSearch: false
      };
    case SET_AUTOCOMPLETE_IN_SEARCH:
      return {
        ...state,
        inAutoCompleteSearch: true
      };
    case SAVE_SEARCH_RESULT_ID:
      return {
        ...state,
        resultId: action.id
      };
    case SAVE_BUCKET_ID:
      return {
        ...state,
        bucketId: action.id
      };
    case SAVE_SOCKET_CONNECTION_ID:
      return {
        ...state,
        socketConnectionId: action.id
      };
    case SET_FINGERPRINT:
      return {
        ...state,
        fingerprint: action.fingerprint
      };
    case CLEAR_FEED:
      return {
        ...state,
        displayedItems: [],
        items: [],
        ranking: {},
        providers: {},
        relatedItems: [],
        feedEnd: false
      };
    case TILES_REMOVE_TILE:
      const iterator = item => {
        return item.id !== action.id;
      };
      const displayed = state.displayedItems.filter(iterator);
      const backlog = state.items.filter(iterator);
      return {
        ...state,
        displayedItems: displayed,
        items: backlog
      };
    case REGISTER_PROVIDER:
      const providers = state.providers;
      providers[action.provider] = action.complete;
      const complete = every(providers, (done) => done);
      return {
        ...state,
        providers,
        searchComplete: complete,
        loading: !complete
      };
    default:
      return state;
  }
}