Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

es6 modules - property imports #6073

Merged
merged 1 commit into from
Feb 3, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/cli/Command.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import _ from 'lodash';
let Command = require('commander').Command;

let red = require('./color').red;
let yellow = require('./color').yellow;
import help from './help';
import { Command } from 'commander';
import { red } from './color';
import { yellow } from './color';

Command.prototype.error = function (err) {
if (err && err.message) err = err.message;
Expand Down
2 changes: 1 addition & 1 deletion src/cli/plugin/plugin_downloader.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import _ from 'lodash';
const urlParse = require('url').parse;
import downloadHttpFile from './downloaders/http';
import downloadLocalFile from './downloaders/file';
import { parse as urlParse } from 'url';

export default function createPluginDownloader(settings, logger) {
let archiveType;
Expand Down
2 changes: 1 addition & 1 deletion src/cli/plugin/plugin_installer.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import KbnServer from '../../server/KbnServer';
import readYamlConfig from '../serve/read_yaml_config';
const { statSync, renameSync } = require('fs');
import Promise from 'bluebird';
const rimrafSync = require('rimraf').sync;
import { sync as rimrafSync } from 'rimraf';
const mkdirp = Promise.promisify(require('mkdirp'));

export default {
Expand Down
2 changes: 1 addition & 1 deletion src/optimize/babelOptions.build.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var cloneDeep = require('lodash').cloneDeep;
import { cloneDeep } from 'lodash';
var fromRoot = require('path').resolve.bind(null, __dirname, '../../');

if (!process.env.BABEL_CACHE_PATH) {
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/elasticsearch/lib/create_kibana_index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import SetupError from './setup_error';
const format = require('util').format;
import { format } from 'util';
module.exports = function (server) {
const client = server.plugins.elasticsearch.client;
const index = server.config().get('kibana.index');
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/elasticsearch/lib/map_uri.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import querystring from 'querystring';
const resolve = require('url').resolve;
import { resolve } from 'url';
module.exports = function mapUri(server, prefix) {
const config = server.config();
return function (request, done) {
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/elasticsearch/lib/upgrade_config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Promise from 'bluebird';
import isUpgradeable from './is_upgradeable';
import _ from 'lodash';
const format = require('util').format;
import { format } from 'util';

const utils = require('requirefrom')('src/utils');

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { saveAs } from '@spalger/filesaver';
define(function (require) {
const _ = require('lodash');
const angular = require('angular');
const saveAs = require('@spalger/filesaver').saveAs;
const registry = require('plugins/kibana/settings/saved_object_registry');
const objectIndexHTML = require('plugins/kibana/settings/sections/objects/_objects.html');
const MAX_SIZE = Math.pow(2, 31) - 1;
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/kibana/server/lib/__tests__/handle_es_error.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import expect from 'expect.js';
import Boom from 'boom';
const esErrors = require('elasticsearch').errors;
import handleESError from '../handle_es_error';
import { errors as esErrors } from 'elasticsearch';

describe('handleESError', function () {

Expand Down
2 changes: 1 addition & 1 deletion src/plugins/kibana/server/lib/handle_es_error.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Boom from 'boom';
const esErrors = require('elasticsearch').errors;
import _ from 'lodash';
import { errors as esErrors } from 'elasticsearch';

module.exports = function handleESError(error) {
if (!(error instanceof Error)) {
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/spyModes/public/tableSpyMode.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { saveAs } from '@spalger/filesaver';
define(function (require) {
function VisSpyTableProvider(Notifier, $filter, $rootScope, config, Private) {
const _ = require('lodash');
const saveAs = require('@spalger/filesaver').saveAs;
const tabifyAggResponse = Private(require('ui/agg_response/tabify/tabify'));

const PER_PAGE_DEFAULT = 10;
Expand Down
4 changes: 2 additions & 2 deletions src/server/config/schema.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
let get = require('lodash').get;
import Joi from 'joi';
import fs from 'fs';
import path from 'path';
import { get } from 'lodash';
import { randomBytes } from 'crypto';

let utils = require('requirefrom')('src/utils');
let fromRoot = utils('fromRoot');
const randomBytes = require('crypto').randomBytes;

module.exports = () => Joi.object({
pkg: Joi.object({
Expand Down
4 changes: 2 additions & 2 deletions src/server/http/index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { parse } from 'url';
import { format } from 'url';
module.exports = async function (kbnServer, server, config) {
let _ = require('lodash');
let fs = require('fs');
let Boom = require('boom');
let Hapi = require('hapi');
let parse = require('url').parse;
let format = require('url').format;

let getDefaultRoute = require('./getDefaultRoute');

Expand Down
2 changes: 1 addition & 1 deletion src/server/logging/LogFormat.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import numeral from '@spalger/numeral';
import ansicolors from 'ansicolors';
import stringify from 'json-stringify-safe';
import querystring from 'querystring';
let inspect = require('util').inspect;
import applyFiltersToKeys from './applyFiltersToKeys';
import { inspect } from 'util';

function serializeError(err) {
return {
Expand Down
4 changes: 2 additions & 2 deletions src/server/logging/LogReporter.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import _ from 'lodash';
let Squeeze = require('good-squeeze').Squeeze;
let writeStr = require('fs').createWriteStream;

import LogFormatJson from './LogFormatJson';
import LogFormatString from './log_format_string';
import { Squeeze } from 'good-squeeze';
import { createWriteStream as writeStr } from 'fs';

module.exports = class KbnLogger {
constructor(events, config) {
Expand Down
2 changes: 1 addition & 1 deletion src/server/logging/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import _ from 'lodash';
let fromNode = require('bluebird').fromNode;
import { fromNode } from 'bluebird';

module.exports = function (kbnServer, server, config) {
// prevent relying on kbnServer so this can be used with other hapi servers
Expand Down
2 changes: 1 addition & 1 deletion src/server/pid/index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import _ from 'lodash';
import Boom from 'boom';
import Promise from 'bluebird';
import { unlinkSync as unlink } from 'fs';
var writeFile = Promise.promisify(require('fs').writeFile);
var unlink = require('fs').unlinkSync;

module.exports = Promise.method(function (kbnServer, server, config) {
var path = config.get('pid.file');
Expand Down
2 changes: 1 addition & 1 deletion src/server/plugins/PluginCollection.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
let { get, indexBy } = require('lodash');
let inspect = require('util').inspect;

import PluginApi from './PluginApi';
import { inspect } from 'util';
let Collection = require('requirefrom')('src')('utils/Collection');

let byIdCache = Symbol('byIdCache');
Expand Down
2 changes: 1 addition & 1 deletion src/server/status/Status.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import _ from 'lodash';
let EventEmitter = require('events').EventEmitter;
import states from './states';
import { EventEmitter } from 'events';

class Status extends EventEmitter {
constructor(name, server) {
Expand Down
4 changes: 2 additions & 2 deletions src/ui/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { format as formatUrl } from 'url';
import { readFileSync as readFile } from 'fs';
module.exports = async (kbnServer, server, config) => {
let { defaults } = require('lodash');
let Boom = require('boom');
let formatUrl = require('url').format;
let { resolve } = require('path');
let readFile = require('fs').readFileSync;

let fromRoot = require('../utils/fromRoot');
let UiExports = require('./ui_exports');
Expand Down
6 changes: 3 additions & 3 deletions src/ui/public/Binder/Binder.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
var $ = require('jquery');
import d3 from 'd3';
var callEach = require('lodash').callEach;
var bindKey = require('lodash').bindKey;
var rest = require('lodash').rest;
import { callEach } from 'lodash';
import { bindKey } from 'lodash';
import { rest } from 'lodash';

function Binder($scope) {
this.disposal = [];
Expand Down
4 changes: 2 additions & 2 deletions src/ui/public/StackTraceMapper/SourceMapReader.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import _ from 'lodash';
var SourceMapConsumer = require('source-map/lib/source-map/source-map-consumer').SourceMapConsumer;
var parse = require('url').parse;
import { SourceMapConsumer } from 'source-map/lib/source-map/source-map-consumer';
import { parse } from 'url';

function SourceMapReader(url, map) {
this.smc = new SourceMapConsumer(map);
Expand Down
2 changes: 1 addition & 1 deletion src/ui/public/StackTraceMapper/StackTraceMapper.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import _ from 'lodash';
var $ = require('jquery');
var resolve = require('bluebird').resolve;
import fetch from 'exports?window.fetch!imports?Promise=bluebird!whatwg-fetch';

import setErrorStack from './setErrorStack';
import translateStackLine from './translateStackLine';
import stackLineFormat from './stackLineFormat';
import SourceMapReader from './SourceMapReader';
import { resolve } from 'bluebird';

function StackTraceMapper() {
this.maps = [];
Expand Down
2 changes: 1 addition & 1 deletion src/ui/public/agg_types/__tests__/buckets/_range.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { values } from 'lodash';
describe('Range Agg', function () {
var _ = require('lodash');
var ngMock = require('ngMock');
var expect = require('expect.js');
var values = require('lodash').values;

var resp = require('fixtures/agg_resp/range');
var buckets = values(resp.aggregations[1].buckets);
Expand Down
2 changes: 1 addition & 1 deletion src/ui/public/agg_types/buckets/date_histogram.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { jstz as tzDetect } from 'jstimezonedetect';
define(function (require) {
return function DateHistogramAggType(timefilter, config, Private) {
var _ = require('lodash');
var moment = require('moment');
var tzDetect = require('jstimezonedetect').jstz;
var BucketAggType = Private(require('ui/agg_types/buckets/_bucket_agg_type'));
var TimeBuckets = Private(require('ui/time_buckets'));
var createFilter = Private(require('ui/agg_types/buckets/create_filter/date_histogram'));
Expand Down
2 changes: 1 addition & 1 deletion src/ui/public/agg_types/param_types/field.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { SavedObjectNotFound } from 'ui/errors';
define(function (require) {
return function FieldAggParamFactory(Private) {
var _ = require('lodash');

var editorHtml = require('ui/agg_types/controls/field.html');
var BaseAggParam = Private(require('ui/agg_types/param_types/base'));
var SavedObjectNotFound = require('ui/errors').SavedObjectNotFound;

_.class(FieldAggParam).inherits(BaseAggParam);
function FieldAggParam(config) {
Expand Down
2 changes: 1 addition & 1 deletion src/ui/public/chrome/Tab.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import _ from 'lodash';
const reEsc = require('lodash').escapeRegExp;
import { escapeRegExp as reEsc } from 'lodash';
const { parse, format } = require('url');

const urlJoin = (a, b) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ import sinon from 'auto-release-sinon';
import ngMock from 'ngMock';
var $ = require('jquery');
import expect from 'expect.js';
var constant = require('lodash').constant;
var set = require('lodash').set;
var cloneDeep = require('lodash').cloneDeep;
var indexBy = require('lodash').indexBy;

require('ui/chrome');
require('../app_switcher');
import DomLocationProvider from 'ui/domLocation';
import { constant } from 'lodash';
import { set } from 'lodash';
import { cloneDeep } from 'lodash';
import { indexBy } from 'lodash';

describe('appSwitcher directive', function () {
var env;
Expand Down
4 changes: 2 additions & 2 deletions src/ui/public/chrome/directives/app_switcher/app_switcher.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
var parse = require('url').parse;
var bindKey = require('lodash').bindKey;

require('../app_switcher/app_switcher.less');
import DomLocationProvider from 'ui/domLocation';
import { parse } from 'url';
import { bindKey } from 'lodash';

require('ui/modules')
.get('kibana')
Expand Down
6 changes: 3 additions & 3 deletions src/ui/public/courier/fetch/_call_response_handlers.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { SearchTimeout } from 'ui/errors';
import { RequestFailure } from 'ui/errors';
import { ShardFailure } from 'ui/errors';
define(function (require) {
return function CourierFetchCallResponseHandlers(Private, Promise) {
var ABORTED = Private(require('ui/courier/fetch/_req_status')).ABORTED;
var INCOMPLETE = Private(require('ui/courier/fetch/_req_status')).INCOMPLETE;
var notify = Private(require('ui/courier/fetch/_notifier'));

var SearchTimeout = require('ui/errors').SearchTimeout;
var RequestFailure = require('ui/errors').RequestFailure;
var ShardFailure = require('ui/errors').ShardFailure;

function callResponseHandlers(requests, responses) {
return Promise.map(requests, function (req, i) {
Expand Down
2 changes: 1 addition & 1 deletion src/ui/public/courier/fetch/request/segmented.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { isNumber } from 'lodash';
define(function (require) {
return function CourierSegmentedReqProvider(es, Private, Promise, Notifier, timefilter, config) {
var _ = require('lodash');
var isNumber = require('lodash').isNumber;
var SearchReq = Private(require('ui/courier/fetch/request/search'));
var SegmentedHandle = Private(require('ui/courier/fetch/request/_segmented_handle'));

Expand Down
2 changes: 1 addition & 1 deletion src/ui/public/courier/fetch/strategy/search.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { toJson } from 'ui/utils/aggressive_parse';
define(function (require) {
return function FetchStrategyForSearch(Private, Promise, timefilter) {
var _ = require('lodash');
var angular = require('angular');
var toJson = require('ui/utils/aggressive_parse').toJson;

return {
clientMethod: 'msearch',
Expand Down
2 changes: 1 addition & 1 deletion src/ui/public/directives/__tests__/config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import ngMock from 'ngMock';
var $ = require('jquery');
var assign = require('lodash').assign;
import expect from 'expect.js';
import { assign } from 'lodash';

describe('Config Directive', function () {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { pluck } from 'lodash';
describe('ui/index_patterns/_calculate_indices', () => {
const _ = require('lodash');
const pluck = require('lodash').pluck;
const sinon = require('auto-release-sinon');
const expect = require('expect.js');
const ngMock = require('ngMock');
Expand Down
2 changes: 1 addition & 1 deletion src/ui/public/index_patterns/__tests__/intervals.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
var pluck = require('lodash').pluck;
import moment from 'moment';
import { pluck } from 'lodash';

describe('Index Patterns', function () {
describe('interval.toIndexList()', function () {
Expand Down
2 changes: 1 addition & 1 deletion src/ui/public/index_patterns/_mapper.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { IndexPatternMissingIndices } from 'ui/errors';
define(function (require) {
return function MapperService(Private, Promise, es, config, kbnIndex) {
var _ = require('lodash');
var moment = require('moment');

var IndexPatternMissingIndices = require('ui/errors').IndexPatternMissingIndices;
var transformMappingIntoFields = Private(require('ui/index_patterns/_transform_mapping_into_fields'));
var intervals = Private(require('ui/index_patterns/_intervals'));
var patternToWildcard = Private(require('ui/index_patterns/_pattern_to_wildcard'));
Expand Down
2 changes: 1 addition & 1 deletion src/ui/public/routes/__tests__/_wrapRouteWithPrep.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import ngMock from 'ngMock';
import wrapRouteWithPrep from 'ui/routes/wrapRouteWithPrep';
import Promise from 'bluebird';
import _ from 'lodash';
var stub = require('auto-release-sinon').stub;
import { stub } from 'auto-release-sinon';

require('ui/private');

Expand Down
2 changes: 1 addition & 1 deletion src/ui/public/testHarness/testHarness.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import Nonsense from 'Nonsense';
import sinon from 'sinon';
var $ = require('jquery');
import _ from 'lodash';
var parse = require('url').parse;

import StackTraceMapper from 'ui/StackTraceMapper';
import { parse } from 'url';

/*** the vislib tests have certain style requirements, so lets make sure they are met ***/
$('body').attr('id', 'test-harness-body'); // so we can make high priority selectors
Expand Down
2 changes: 1 addition & 1 deletion src/ui/public/time_buckets/calc_auto_interval.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { duration as d } from 'moment';
define(function (require) {
return function DateIntervalRoundingRulesProvider() {
var moment = require('moment');
// these are the rounding rules used by roundInterval()
var d = require('moment').duration;

var roundingRules = [
[ d(500, 'ms'), d(100, 'ms') ],
Expand Down
Loading