From 8243b0e9de034a381cb71a133e8473babf37682a Mon Sep 17 00:00:00 2001 From: Pat Sissons Date: Wed, 17 May 2017 13:40:34 -0700 Subject: [PATCH] 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;/ --- lib/network/Images.js | 2 +- lib/network/Network.js | 30 +++++++++---------- lib/network/modules/Clustering.js | 2 +- lib/network/modules/LayoutEngine.js | 2 +- lib/network/modules/NodesHandler.js | 4 +-- lib/network/modules/PhysicsEngine.js | 16 +++++----- lib/network/modules/SelectionHandler.js | 4 +-- lib/network/modules/View.js | 2 +- lib/network/modules/components/Node.js | 2 +- .../components/nodes/util/CircleImageBase.js | 4 +-- lib/timeline/Graph2d.js | 4 +-- lib/timeline/Timeline.js | 4 +-- lib/timeline/component/ItemSet.js | 2 +- 13 files changed, 39 insertions(+), 39 deletions(-) diff --git a/lib/network/Images.js b/lib/network/Images.js index e9d5833fe..a8a977422 100644 --- a/lib/network/Images.js +++ b/lib/network/Images.js @@ -1,4 +1,4 @@ -import CachedImage from './CachedImage'; +var CachedImage = require('./CachedImage').default; /** diff --git a/lib/network/Network.js b/lib/network/Network.js index 884c3352a..d86ab4125 100644 --- a/lib/network/Network.js +++ b/lib/network/Network.js @@ -10,21 +10,21 @@ 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"; +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; import {printStyle} from "./../shared/Validator"; import {allOptions, configureOptions} from './options.js'; import KamadaKawai from "./modules/KamadaKawai.js" diff --git a/lib/network/modules/Clustering.js b/lib/network/modules/Clustering.js index 3de5198ed..4223482a7 100644 --- a/lib/network/modules/Clustering.js +++ b/lib/network/modules/Clustering.js @@ -1,5 +1,5 @@ let util = require("../../util"); -import NetworkUtil from '../NetworkUtil'; +var NetworkUtil = require('../NetworkUtil').default; import Cluster from './components/nodes/Cluster' class ClusterEngine { diff --git a/lib/network/modules/LayoutEngine.js b/lib/network/modules/LayoutEngine.js index e2466792d..57b9e092c 100644 --- a/lib/network/modules/LayoutEngine.js +++ b/lib/network/modules/LayoutEngine.js @@ -1,7 +1,7 @@ 'use strict'; let util = require('../../util'); -import NetworkUtil from '../NetworkUtil'; +var NetworkUtil = require('../NetworkUtil').default; /** diff --git a/lib/network/modules/NodesHandler.js b/lib/network/modules/NodesHandler.js index 7c56f3d2b..83a289a40 100644 --- a/lib/network/modules/NodesHandler.js +++ b/lib/network/modules/NodesHandler.js @@ -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) { diff --git a/lib/network/modules/PhysicsEngine.js b/lib/network/modules/PhysicsEngine.js index 3555c2ffb..742e13d3c 100644 --- a/lib/network/modules/PhysicsEngine.js +++ b/lib/network/modules/PhysicsEngine.js @@ -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'); diff --git a/lib/network/modules/SelectionHandler.js b/lib/network/modules/SelectionHandler.js index 101b9f4a3..56768e29d 100644 --- a/lib/network/modules/SelectionHandler.js +++ b/lib/network/modules/SelectionHandler.js @@ -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'); diff --git a/lib/network/modules/View.js b/lib/network/modules/View.js index d1004c805..07029783e 100644 --- a/lib/network/modules/View.js +++ b/lib/network/modules/View.js @@ -1,6 +1,6 @@ let util = require('../../util'); -import NetworkUtil from '../NetworkUtil'; +var NetworkUtil = require('../NetworkUtil').default; class View { constructor(body, canvas) { diff --git a/lib/network/modules/components/Node.js b/lib/network/modules/components/Node.js index be4000ff6..a69b2d5df 100644 --- a/lib/network/modules/components/Node.js +++ b/lib/network/modules/components/Node.js @@ -16,7 +16,7 @@ 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"; +var Validator = require("../../../shared/Validator").default; import {printStyle} from "../../../shared/Validator"; diff --git a/lib/network/modules/components/nodes/util/CircleImageBase.js b/lib/network/modules/components/nodes/util/CircleImageBase.js index 86fd133ea..5ee52bebb 100644 --- a/lib/network/modules/components/nodes/util/CircleImageBase.js +++ b/lib/network/modules/components/nodes/util/CircleImageBase.js @@ -1,5 +1,5 @@ -import NodeBase from './NodeBase'; -import CachedImage from '../../../../CachedImage'; +var NodeBase = require('./NodeBase').default; +var CachedImage = require('../../../../CachedImage').default; /** diff --git a/lib/timeline/Graph2d.js b/lib/timeline/Graph2d.js index a222456e0..c5234c1d9 100644 --- a/lib/timeline/Graph2d.js +++ b/lib/timeline/Graph2d.js @@ -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 diff --git a/lib/timeline/Timeline.js b/lib/timeline/Timeline.js index 02d633a4a..1c0158a92 100644 --- a/lib/timeline/Timeline.js +++ b/lib/timeline/Timeline.js @@ -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; /** diff --git a/lib/timeline/component/ItemSet.js b/lib/timeline/component/ItemSet.js index 002f294a4..9149d1115 100644 --- a/lib/timeline/component/ItemSet.js +++ b/lib/timeline/component/ItemSet.js @@ -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