chore(import): reorganize import related functionality

This commit puts all import related stuff into the import module.

The core module remains as an entry point to require the basic modules
needed by bpmn-js. At the time this is { import, draw }.
This commit is contained in:
Nico Rehwaldt 2014-10-30 12:06:43 +01:00
parent 05b044e64d
commit c58532aeac
19 changed files with 34 additions and 48 deletions

View File

@ -258,7 +258,6 @@ Viewer.prototype.on = function(event, handler) {
// modules the viewer is composed of
Viewer.prototype._modules = [
require('./core'),
require('./draw'),
require('diagram-js/lib/features/selection'),
require('diagram-js/lib/features/overlays')
];

View File

@ -1,3 +1,6 @@
module.exports = {
bpmnImporter: [ 'type', require('./BpmnImporter') ]
__depends__: [
require('../draw'),
require('../import')
]
};

View File

@ -1,5 +1,4 @@
module.exports = {
__depends__: [ require('../core') ],
renderer: [ 'type', require('./BpmnRenderer') ],
pathMap: [ 'type', require('./PathMap') ]
};

View File

@ -1,6 +1,5 @@
module.exports = {
__depends__: [
require('../../core'),
require('diagram-js/lib/command'),
require('diagram-js/lib/features/change-support'),
require('diagram-js-direct-editing')

View File

@ -1,7 +1,6 @@
module.exports = {
__init__: [ 'modeling', 'bpmnUpdater', 'labelSupport' ],
__depends__: [
require('../../core'),
require('../label-editing'),
require('diagram-js/lib/command'),
require('diagram-js/lib/features/change-support')

3
lib/import/index.js Normal file
View File

@ -0,0 +1,3 @@
module.exports = {
bpmnImporter: [ 'type', require('./BpmnImporter') ]
};

View File

@ -9,7 +9,7 @@ var Matchers = require('../../../Matchers'),
var fs = require('fs');
var contextPadModule = require('../../../../lib/features/context-pad'),
bpmnModule = require('../../../../lib/draw');
bpmnModule = require('../../../../lib/core');
describe('features - context-pad', function() {

View File

@ -12,7 +12,7 @@ var $ = require('jquery');
var labelEditingModule = require('../../../../lib/features/label-editing'),
bpmnModule = require('../../../../lib/draw');
coreModule = require('../../../../lib/core');
var LabelUtil = require('../../../../lib/features/label-editing/LabelUtil');
@ -24,7 +24,7 @@ describe('features - label-editing', function() {
var diagramXML = fs.readFileSync('test/fixtures/bpmn/features/label-editing/labels.bpmn', 'utf-8');
var testModules = [ labelEditingModule, bpmnModule ];
var testModules = [ labelEditingModule, coreModule ];
beforeEach(bootstrapViewer(diagramXML, { modules: testModules }));

View File

@ -1,24 +1,16 @@
'use strict';
var Matchers = require('../../../Matchers'),
TestHelper = require('../../../TestHelper');
var TestHelper = require('../../../TestHelper');
/* global bootstrapViewer, inject */
var Modeler = require('../../../../lib/Modeler');
var fs = require('fs');
var Modeler = require('../../../../lib/Modeler');
var labelEditingModule = require('../../../../lib/features/label-editing'),
touchModule = require('diagram-js/lib/features/touch');
describe('direct editing - touch integration', function() {
beforeEach(Matchers.addDeepEquals);
var container;
beforeEach(function() {
@ -41,15 +33,9 @@ describe('direct editing - touch integration', function() {
});
describe('event integration', function() {
var diagramXML = fs.readFileSync('test/fixtures/bpmn/features/label-editing/labels.bpmn', 'utf-8');
var testModules = [ labelEditingModule, touchModule ];
beforeEach(bootstrapViewer(diagramXML, { modules: testModules }));
it('should work via dbltap (manual test)', function() { });
it('should edit labels via double tap (manual test)', function(done) {
var xml = fs.readFileSync('test/fixtures/bpmn/features/label-editing/labels.bpmn', 'utf8');
createModeler(xml, done);
});
});

View File

@ -10,7 +10,7 @@ var _ = require('lodash');
var fs = require('fs');
var modelingModule = require('../../../../lib/features/modeling'),
drawModule = require('../../../../lib/draw');
coreModule = require('../../../../lib/core');
var LabelUtil = require('../../../../lib/util/Label');
@ -23,7 +23,7 @@ describe('features/modeling - append shape', function() {
var diagramXML = fs.readFileSync('test/fixtures/bpmn/simple.bpmn', 'utf-8');
var testModules = [ drawModule, modelingModule ];
var testModules = [ coreModule, modelingModule ];
beforeEach(bootstrapModeler(diagramXML, { modules: testModules }));

View File

@ -8,7 +8,8 @@ var Matchers = require('../../../Matchers'),
var fs = require('fs');
var modelingModule = require('../../../../lib/features/modeling');
var modelingModule = require('../../../../lib/features/modeling'),
coreModule = require('../../../../lib/core');
describe('features - bpmn-factory', function() {
@ -18,7 +19,7 @@ describe('features - bpmn-factory', function() {
var diagramXML = fs.readFileSync('test/fixtures/bpmn/simple.bpmn', 'utf-8');
var testModules = [ modelingModule ];
var testModules = [ modelingModule, coreModule ];
beforeEach(bootstrapModeler(diagramXML, { modules: testModules }));

View File

@ -10,7 +10,7 @@ var _ = require('lodash');
var fs = require('fs');
var modelingModule = require('../../../../lib/features/modeling'),
drawModule = require('../../../../lib/draw');
coreModule = require('../../../../lib/core');
describe('features/modeling - create connection', function() {
@ -20,7 +20,7 @@ describe('features/modeling - create connection', function() {
var diagramXML = fs.readFileSync('test/fixtures/bpmn/sequence-flows.bpmn', 'utf-8');
var testModules = [ drawModule, modelingModule ];
var testModules = [ coreModule, modelingModule ];
beforeEach(bootstrapModeler(diagramXML, { modules: testModules }));

View File

@ -10,7 +10,7 @@ var _ = require('lodash');
var fs = require('fs');
var modelingModule = require('../../../../lib/features/modeling'),
drawModule = require('../../../../lib/draw');
coreModule = require('../../../../lib/core');
describe('features/modeling - #removeConnection', function() {
@ -20,7 +20,7 @@ describe('features/modeling - #removeConnection', function() {
var diagramXML = fs.readFileSync('test/fixtures/bpmn/sequence-flows.bpmn', 'utf-8');
var testModules = [ drawModule, modelingModule ];
var testModules = [ coreModule, modelingModule ];
beforeEach(bootstrapModeler(diagramXML, { modules: testModules }));

View File

@ -10,7 +10,7 @@ var _ = require('lodash');
var fs = require('fs');
var modelingModule = require('../../../../lib/features/modeling'),
drawModule = require('../../../../lib/draw');
coreModule = require('../../../../lib/core');
describe('features/modeling - #removeShape', function() {
@ -20,7 +20,7 @@ describe('features/modeling - #removeShape', function() {
var diagramXML = fs.readFileSync('test/fixtures/bpmn/sequence-flows.bpmn', 'utf-8');
var testModules = [ drawModule, modelingModule ];
var testModules = [ coreModule, modelingModule ];
beforeEach(bootstrapModeler(diagramXML, { modules: testModules }));

View File

@ -10,7 +10,7 @@ var _ = require('lodash');
var fs = require('fs');
var modelingModule = require('../../../../lib/features/modeling'),
drawModule = require('../../../../lib/draw');
coreModule = require('../../../../lib/core');
describe('features/modeling - layout connection', function() {
@ -20,7 +20,7 @@ describe('features/modeling - layout connection', function() {
var diagramXML = fs.readFileSync('test/fixtures/bpmn/sequence-flows.bpmn', 'utf-8');
var testModules = [ drawModule, modelingModule ];
var testModules = [ coreModule, modelingModule ];
beforeEach(bootstrapModeler(diagramXML, { modules: testModules }));

View File

@ -10,7 +10,7 @@ var _ = require('lodash');
var fs = require('fs');
var modelingModule = require('../../../../lib/features/modeling'),
drawModule = require('../../../../lib/draw');
coreModule = require('../../../../lib/core');
describe('features/modeling - move connection', function() {
@ -20,7 +20,7 @@ describe('features/modeling - move connection', function() {
var diagramXML = fs.readFileSync('test/fixtures/bpmn/sequence-flows.bpmn', 'utf-8');
var testModules = [ drawModule, modelingModule ];
var testModules = [ coreModule, modelingModule ];
beforeEach(bootstrapModeler(diagramXML, { modules: testModules }));

View File

@ -10,7 +10,7 @@ var _ = require('lodash');
var fs = require('fs');
var modelingModule = require('../../../../lib/features/modeling'),
drawModule = require('../../../../lib/draw');
coreModule = require('../../../../lib/core');
describe('features/modeling - move shape', function() {
@ -20,7 +20,7 @@ describe('features/modeling - move shape', function() {
var diagramXML = fs.readFileSync('test/fixtures/bpmn/simple.bpmn', 'utf-8');
var testModules = [ drawModule, modelingModule ];
var testModules = [ coreModule, modelingModule ];
beforeEach(bootstrapModeler(diagramXML, { modules: testModules }));

View File

@ -1,7 +1,6 @@
'use strict';
var Matchers = require('../../Matchers'),
TestHelper = require('../../TestHelper');
var TestHelper = require('../../TestHelper');
var fs = require('fs');
@ -20,8 +19,6 @@ describe('import - importer', function() {
return moddle.fromXML(xml, 'bpmn:Definitions', opts, callback);
}
beforeEach(Matchers.addDeepEquals);
var container;