Skip to content
This repository has been archived by the owner on Jul 29, 2019. It is now read-only.

Commit

Permalink
replacing all ES6 imports with CJS require calls (#3063)
Browse files Browse the repository at this point in the history
* replacing all ES6 imports with CJS require calls
resolves #2934
used the following regex to apply the changes in lib:
s/import\s+(\w+)\s+from\s+(.*);\s*$/var $1 = require($2).default;/
s/import\s+(\w+)\s+from\s+(.*)\s*$/var $1 = require($2).default;/

* cleaning up inconsistencies
  • Loading branch information
patsissons authored and yotamberk committed May 20, 2017
1 parent 9a56441 commit e25db74
Show file tree
Hide file tree
Showing 15 changed files with 67 additions and 67 deletions.
36 changes: 18 additions & 18 deletions lib/network/Network.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,24 @@ let gephiParser = require('./gephiParser');
let Activator = require('../shared/Activator');
let locales = require('./locales');

import Images from './Images';
import Groups from './modules/Groups';
import NodesHandler from './modules/NodesHandler';
import EdgesHandler from './modules/EdgesHandler';
import PhysicsEngine from './modules/PhysicsEngine';
import ClusterEngine from './modules/Clustering';
import CanvasRenderer from './modules/CanvasRenderer';
import Canvas from './modules/Canvas';
import View from './modules/View';
import InteractionHandler from './modules/InteractionHandler';
import SelectionHandler from "./modules/SelectionHandler";
import LayoutEngine from "./modules/LayoutEngine";
import ManipulationSystem from "./modules/ManipulationSystem";
import Configurator from "./../shared/Configurator";
import Validator from "./../shared/Validator";
import {printStyle} from "./../shared/Validator";
import {allOptions, configureOptions} from './options.js';
import KamadaKawai from "./modules/KamadaKawai.js"
var Images = require('./Images').default;
var Groups = require('./modules/Groups').default;
var NodesHandler = require('./modules/NodesHandler').default;
var EdgesHandler = require('./modules/EdgesHandler').default;
var PhysicsEngine = require('./modules/PhysicsEngine').default;
var ClusterEngine = require('./modules/Clustering').default;
var CanvasRenderer = require('./modules/CanvasRenderer').default;
var Canvas = require('./modules/Canvas').default;
var View = require('./modules/View').default;
var InteractionHandler = require('./modules/InteractionHandler').default;
var SelectionHandler = require("./modules/SelectionHandler").default;
var LayoutEngine = require("./modules/LayoutEngine").default;
var ManipulationSystem = require("./modules/ManipulationSystem").default;
var Configurator = require("./../shared/Configurator").default;
var Validator = require("./../shared/Validator").default;
var {printStyle} = require('./../shared/Validator');
var {allOptions, configureOptions} = require('./options.js');
var KamadaKawai = require("./modules/KamadaKawai.js").default;


/**
Expand Down
4 changes: 2 additions & 2 deletions lib/network/modules/Clustering.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
let util = require("../../util");
import NetworkUtil from '../NetworkUtil';
import Cluster from './components/nodes/Cluster'
var NetworkUtil = require('../NetworkUtil').default;
var Cluster = require('./components/nodes/Cluster').default;

class ClusterEngine {
constructor(body) {
Expand Down
4 changes: 2 additions & 2 deletions lib/network/modules/EdgesHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ var util = require("../../util");
var DataSet = require('../../DataSet');
var DataView = require('../../DataView');

import Edge from "./components/Edge"
import Label from "./components/shared/Label"
var Edge = require("./components/Edge").default;
var Label = require("./components/shared/Label").default;

class EdgesHandler {
constructor(body, images, groups) {
Expand Down
4 changes: 2 additions & 2 deletions lib/network/modules/InteractionHandler.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
let util = require('../../util');

import NavigationHandler from './components/NavigationHandler'
import Popup from './../../shared/Popup'
var NavigationHandler = require('./components/NavigationHandler').default;
var Popup = require('./../../shared/Popup').default;

class InteractionHandler {
constructor(body, canvas, selectionHandler) {
Expand Down
2 changes: 1 addition & 1 deletion lib/network/modules/LayoutEngine.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

let util = require('../../util');
import NetworkUtil from '../NetworkUtil';
var NetworkUtil = require('../NetworkUtil').default;


/**
Expand Down
4 changes: 2 additions & 2 deletions lib/network/modules/NodesHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ let util = require("../../util");
let DataSet = require('../../DataSet');
let DataView = require('../../DataView');

import Node from "./components/Node";
import Label from "./components/shared/Label";
var Node = require("./components/Node").default;
var Label = require("./components/shared/Label").default;

class NodesHandler {
constructor(body, images, groups, layoutEngine) {
Expand Down
16 changes: 8 additions & 8 deletions lib/network/modules/PhysicsEngine.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import BarnesHutSolver from './components/physics/BarnesHutSolver';
import Repulsion from './components/physics/RepulsionSolver';
import HierarchicalRepulsion from './components/physics/HierarchicalRepulsionSolver';
import SpringSolver from './components/physics/SpringSolver';
import HierarchicalSpringSolver from './components/physics/HierarchicalSpringSolver';
import CentralGravitySolver from './components/physics/CentralGravitySolver';
import ForceAtlas2BasedRepulsionSolver from './components/physics/FA2BasedRepulsionSolver';
import ForceAtlas2BasedCentralGravitySolver from './components/physics/FA2BasedCentralGravitySolver';
var BarnesHutSolver = require('./components/physics/BarnesHutSolver').default;
var Repulsion = require('./components/physics/RepulsionSolver').default;
var HierarchicalRepulsion = require('./components/physics/HierarchicalRepulsionSolver').default;
var SpringSolver = require('./components/physics/SpringSolver').default;
var HierarchicalSpringSolver = require('./components/physics/HierarchicalSpringSolver').default;
var CentralGravitySolver = require('./components/physics/CentralGravitySolver').default;
var ForceAtlas2BasedRepulsionSolver = require('./components/physics/FA2BasedRepulsionSolver').default;
var ForceAtlas2BasedCentralGravitySolver = require('./components/physics/FA2BasedCentralGravitySolver').default;

var util = require('../../util');

Expand Down
4 changes: 2 additions & 2 deletions lib/network/modules/SelectionHandler.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Node from './components/Node';
import Edge from './components/Edge';
var Node = require('./components/Node').default;
var Edge = require('./components/Edge').default;

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

Expand Down
2 changes: 1 addition & 1 deletion lib/network/modules/View.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
let util = require('../../util');

import NetworkUtil from '../NetworkUtil';
var NetworkUtil = require('../NetworkUtil').default;

class View {
constructor(body, canvas) {
Expand Down
10 changes: 5 additions & 5 deletions lib/network/modules/components/Edge.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
var util = require('../../../util');

import Label from './shared/Label'
import CubicBezierEdge from './edges/CubicBezierEdge'
import BezierEdgeDynamic from './edges/BezierEdgeDynamic'
import BezierEdgeStatic from './edges/BezierEdgeStatic'
import StraightEdge from './edges/StraightEdge'
var Label = require('./shared/Label').default;
var CubicBezierEdge = require('./edges/CubicBezierEdge').default;
var BezierEdgeDynamic = require('./edges/BezierEdgeDynamic').default;
var BezierEdgeStatic = require('./edges/BezierEdgeStatic').default;
var StraightEdge = require('./edges/StraightEdge').default;

/**
* @class Edge
Expand Down
36 changes: 18 additions & 18 deletions lib/network/modules/components/Node.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
var util = require('../../../util');

import Label from './shared/Label'

import Box from './nodes/shapes/Box'
import Circle from './nodes/shapes/Circle'
import CircularImage from './nodes/shapes/CircularImage'
import Database from './nodes/shapes/Database'
import Diamond from './nodes/shapes/Diamond'
import Dot from './nodes/shapes/Dot'
import Ellipse from './nodes/shapes/Ellipse'
import Icon from './nodes/shapes/Icon'
import Image from './nodes/shapes/Image'
import Square from './nodes/shapes/Square'
import Star from './nodes/shapes/Star'
import Text from './nodes/shapes/Text'
import Triangle from './nodes/shapes/Triangle'
import TriangleDown from './nodes/shapes/TriangleDown'
import Validator from "../../../shared/Validator";
import {printStyle} from "../../../shared/Validator";
var Label = require('./shared/Label').default;

var Box = require('./nodes/shapes/Box').default;
var Circle = require('./nodes/shapes/Circle').default;
var CircularImage = require('./nodes/shapes/CircularImage').default;
var Database = require('./nodes/shapes/Database').default;
var Diamond = require('./nodes/shapes/Diamond').default;
var Dot = require('./nodes/shapes/Dot').default;
var Ellipse = require('./nodes/shapes/Ellipse').default;
var Icon = require('./nodes/shapes/Icon').default;
var Image = require('./nodes/shapes/Image').default;
var Square = require('./nodes/shapes/Square').default;
var Star = require('./nodes/shapes/Star').default;
var Text = require('./nodes/shapes/Text').default;
var Triangle = require('./nodes/shapes/Triangle').default;
var TriangleDown = require('./nodes/shapes/TriangleDown').default;
var Validator = require("../../../shared/Validator").default;
var { printStyle } = require("../../../shared/Validator");


/**
Expand Down
2 changes: 1 addition & 1 deletion lib/shared/Configurator.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
var util = require('../util');

import ColorPicker from './ColorPicker'
var ColorPicker = require('./ColorPicker').default;

/**
* The way this works is for all properties of this.possible options, you can supply the property name in any form to list the options.
Expand Down
4 changes: 2 additions & 2 deletions lib/timeline/Graph2d.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ var printStyle = require('../shared/Validator').printStyle;
var allOptions = require('./optionsGraph2d').allOptions;
var configureOptions = require('./optionsGraph2d').configureOptions;

import Configurator from '../shared/Configurator';
import Validator from '../shared/Validator';
var Configurator = require('../shared/Configurator').default;
var Validator = require('../shared/Validator').default;

/**
* Create a timeline visualization
Expand Down
4 changes: 2 additions & 2 deletions lib/timeline/Timeline.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ var printStyle = require('../shared/Validator').printStyle;
var allOptions = require('./optionsTimeline').allOptions;
var configureOptions = require('./optionsTimeline').configureOptions;

import Configurator from '../shared/Configurator';
import Validator from '../shared/Validator';
var Configurator = require('../shared/Configurator').default;
var Validator = require('../shared/Validator').default;


/**
Expand Down
2 changes: 1 addition & 1 deletion lib/timeline/component/ItemSet.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ var BoxItem = require('./item/BoxItem');
var PointItem = require('./item/PointItem');
var RangeItem = require('./item/RangeItem');
var BackgroundItem = require('./item/BackgroundItem');
import Popup from '../../shared/Popup';
var Popup = require('../../shared/Popup').default;


var UNGROUPED = '__ungrouped__'; // reserved group id for ungrouped items
Expand Down

0 comments on commit e25db74

Please sign in to comment.