Skip to content

Commit

Permalink
replacing all ES6 imports with CJS require calls
Browse files Browse the repository at this point in the history
resolves almende#2934
used the following regex to apply the changes in lib:
s/import\s+(\w+)\s+from\s+(.*);\s*$/var $1 = require($2).default;/
  • Loading branch information
Pat Sissons committed May 17, 2017
1 parent f67d16c commit 8243b0e
Show file tree
Hide file tree
Showing 13 changed files with 39 additions and 39 deletions.
2 changes: 1 addition & 1 deletion lib/network/Images.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import CachedImage from './CachedImage';
var CachedImage = require('./CachedImage').default;


/**
Expand Down
30 changes: 15 additions & 15 deletions lib/network/Network.js
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion lib/network/modules/Clustering.js
Original file line number Diff line number Diff line change
@@ -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 {
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
2 changes: 1 addition & 1 deletion lib/network/modules/components/Node.js
Original file line number Diff line number Diff line change
Expand Up @@ -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";


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


/**
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 8243b0e

Please sign in to comment.