bpmn-moddle 5.2.0 → 6.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,17 +1,25 @@
1
1
  {
2
2
  "name": "bpmn-moddle",
3
- "version": "5.2.0",
3
+ "version": "6.0.0",
4
4
  "description": "A moddle wrapper for BPMN 2.0",
5
5
  "scripts": {
6
- "all": "run-s lint test",
6
+ "all": "run-s lint test distro",
7
7
  "lint": "eslint .",
8
8
  "dev": "npm test -- --watch",
9
- "test": "mocha -r esm --reporter=spec --recursive test"
9
+ "test": "mocha -r esm --reporter=spec --recursive test/spec test/integration test/adapter",
10
+ "distro": "run-s build test:build",
11
+ "build": "rollup -c",
12
+ "test:build": "mocha --reporter=spec --recursive test/distro",
13
+ "prepublishOnly": "run-s distro"
10
14
  },
11
15
  "repository": {
12
16
  "type": "git",
13
17
  "url": "https://github.com/bpmn-io/bpmn-moddle"
14
18
  },
19
+ "main": "dist/index.js",
20
+ "module": "dist/index.esm.js",
21
+ "umd:main": "dist/bpmn-moddle.umd.js",
22
+ "source": "lib/index.js",
15
23
  "keywords": [
16
24
  "bpmn",
17
25
  "moddle",
@@ -38,11 +46,16 @@
38
46
  "esm": "^3.0.15",
39
47
  "mocha": "^4.0.1",
40
48
  "npm-run-all": "^4.1.5",
49
+ "rollup": "^1.17.0",
50
+ "rollup-plugin-commonjs": "^10.0.1",
51
+ "rollup-plugin-json": "^4.0.0",
52
+ "rollup-plugin-node-resolve": "^5.2.0",
53
+ "rollup-plugin-terser": "^5.1.1",
41
54
  "xsd-schema-validator": "^0.5.0"
42
55
  },
43
56
  "dependencies": {
44
57
  "min-dash": "^3.0.0",
45
- "moddle": "^4.1.0",
46
- "moddle-xml": "^7.5.0"
58
+ "moddle": "^5.0.1",
59
+ "moddle-xml": "^8.0.1"
47
60
  }
48
61
  }
package/index.js DELETED
@@ -1,3 +0,0 @@
1
- export {
2
- default
3
- } from './lib/simple';
@@ -1,86 +0,0 @@
1
- import {
2
- isString,
3
- isFunction,
4
- assign
5
- } from 'min-dash';
6
-
7
- import Moddle from 'moddle';
8
-
9
- import {
10
- Reader,
11
- Writer
12
- } from 'moddle-xml';
13
-
14
-
15
- /**
16
- * A sub class of {@link Moddle} with support for import and export of BPMN 2.0 xml files.
17
- *
18
- * @class BpmnModdle
19
- * @extends Moddle
20
- *
21
- * @param {Object|Array} packages to use for instantiating the model
22
- * @param {Object} [options] additional options to pass over
23
- */
24
- export default function BpmnModdle(packages, options) {
25
- Moddle.call(this, packages, options);
26
- }
27
-
28
- BpmnModdle.prototype = Object.create(Moddle.prototype);
29
-
30
-
31
- /**
32
- * Instantiates a BPMN model tree from a given xml string.
33
- *
34
- * @param {String} xmlStr
35
- * @param {String} [typeName='bpmn:Definitions'] name of the root element
36
- * @param {Object} [options] options to pass to the underlying reader
37
- * @param {Function} done callback that is invoked with (err, result, parseContext)
38
- * once the import completes
39
- */
40
- BpmnModdle.prototype.fromXML = function(xmlStr, typeName, options, done) {
41
-
42
- if (!isString(typeName)) {
43
- done = options;
44
- options = typeName;
45
- typeName = 'bpmn:Definitions';
46
- }
47
-
48
- if (isFunction(options)) {
49
- done = options;
50
- options = {};
51
- }
52
-
53
- var reader = new Reader(assign({ model: this, lax: true }, options));
54
- var rootHandler = reader.handler(typeName);
55
-
56
- reader.fromXML(xmlStr, rootHandler, done);
57
- };
58
-
59
-
60
- /**
61
- * Serializes a BPMN 2.0 object tree to XML.
62
- *
63
- * @param {String} element the root element, typically an instance of `bpmn:Definitions`
64
- * @param {Object} [options] to pass to the underlying writer
65
- * @param {Function} done callback invoked with (err, xmlStr) once the import completes
66
- */
67
- BpmnModdle.prototype.toXML = function(element, options, done) {
68
-
69
- if (isFunction(options)) {
70
- done = options;
71
- options = {};
72
- }
73
-
74
- var writer = new Writer(options);
75
-
76
- var result;
77
- var err;
78
-
79
- try {
80
- result = writer.toXML(element);
81
- } catch (e) {
82
- err = e;
83
- }
84
-
85
- return done(err, result);
86
- };
package/lib/simple.js DELETED
@@ -1,25 +0,0 @@
1
- import {
2
- assign
3
- } from 'min-dash';
4
-
5
- import BpmnModdle from './bpmn-moddle';
6
-
7
- import BpmnPackage from '../resources/bpmn/json/bpmn.json';
8
- import BpmnDiPackage from '../resources/bpmn/json/bpmndi.json';
9
- import DcPackage from '../resources/bpmn/json/dc.json';
10
- import DiPackage from '../resources/bpmn/json/di.json';
11
- import BiocPackage from '../resources/bpmn-io/json/bioc.json';
12
-
13
- var packages = {
14
- bpmn: BpmnPackage,
15
- bpmndi: BpmnDiPackage,
16
- dc: DcPackage,
17
- di: DiPackage,
18
- bioc: BiocPackage
19
- };
20
-
21
- export default function(additionalPackages, options) {
22
- var pks = assign({}, packages, additionalPackages);
23
-
24
- return new BpmnModdle(pks, options);
25
- }