bpmn-moddle 9.0.1 → 9.0.3

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/dist/index.js CHANGED
@@ -2,94 +2,94 @@ import { isString, assign } from 'min-dash';
2
2
  import { Moddle } from 'moddle';
3
3
  import { Reader, Writer } from 'moddle-xml';
4
4
 
5
- /**
6
- * A sub class of {@link Moddle} with support for import and export of BPMN 2.0 xml files.
7
- *
8
- * @class BpmnModdle
9
- * @extends Moddle
10
- *
11
- * @param {Object|Array} packages to use for instantiating the model
12
- * @param {Object} [options] additional options to pass over
13
- */
14
- function BpmnModdle(packages, options) {
15
- Moddle.call(this, packages, options);
16
- }
17
-
18
- BpmnModdle.prototype = Object.create(Moddle.prototype);
19
-
20
- /**
21
- * The fromXML result.
22
- *
23
- * @typedef {Object} ParseResult
24
- *
25
- * @property {ModdleElement} rootElement
26
- * @property {Array<Object>} references
27
- * @property {Array<Error>} warnings
28
- * @property {Object} elementsById - a mapping containing each ID -> ModdleElement
29
- */
30
-
31
- /**
32
- * The fromXML error.
33
- *
34
- * @typedef {Error} ParseError
35
- *
36
- * @property {Array<Error>} warnings
37
- */
38
-
39
- /**
40
- * Instantiates a BPMN model tree from a given xml string.
41
- *
42
- * @param {String} xmlStr
43
- * @param {String} [typeName='bpmn:Definitions'] name of the root element
44
- * @param {Object} [options] options to pass to the underlying reader
45
- *
46
- * @returns {Promise<ParseResult, ParseError>}
47
- */
48
- BpmnModdle.prototype.fromXML = function(xmlStr, typeName, options) {
49
-
50
- if (!isString(typeName)) {
51
- options = typeName;
52
- typeName = 'bpmn:Definitions';
53
- }
54
-
55
- var reader = new Reader(assign({ model: this, lax: true }, options));
56
- var rootHandler = reader.handler(typeName);
57
-
58
- return reader.fromXML(xmlStr, rootHandler);
59
- };
60
-
61
-
62
- /**
63
- * The toXML result.
64
- *
65
- * @typedef {Object} SerializationResult
66
- *
67
- * @property {String} xml
68
- */
69
-
70
- /**
71
- * Serializes a BPMN 2.0 object tree to XML.
72
- *
73
- * @param {String} element the root element, typically an instance of `bpmn:Definitions`
74
- * @param {Object} [options] to pass to the underlying writer
75
- *
76
- * @returns {Promise<SerializationResult, Error>}
77
- */
78
- BpmnModdle.prototype.toXML = function(element, options) {
79
-
80
- var writer = new Writer(options);
81
-
82
- return new Promise(function(resolve, reject) {
83
- try {
84
- var result = writer.toXML(element);
85
-
86
- return resolve({
87
- xml: result
88
- });
89
- } catch (err) {
90
- return reject(err);
91
- }
92
- });
5
+ /**
6
+ * A sub class of {@link Moddle} with support for import and export of BPMN 2.0 xml files.
7
+ *
8
+ * @class BpmnModdle
9
+ * @extends Moddle
10
+ *
11
+ * @param {Object|Array} packages to use for instantiating the model
12
+ * @param {Object} [options] additional options to pass over
13
+ */
14
+ function BpmnModdle(packages, options) {
15
+ Moddle.call(this, packages, options);
16
+ }
17
+
18
+ BpmnModdle.prototype = Object.create(Moddle.prototype);
19
+
20
+ /**
21
+ * The fromXML result.
22
+ *
23
+ * @typedef {Object} ParseResult
24
+ *
25
+ * @property {ModdleElement} rootElement
26
+ * @property {Array<Object>} references
27
+ * @property {Array<Error>} warnings
28
+ * @property {Object} elementsById - a mapping containing each ID -> ModdleElement
29
+ */
30
+
31
+ /**
32
+ * The fromXML error.
33
+ *
34
+ * @typedef {Error} ParseError
35
+ *
36
+ * @property {Array<Error>} warnings
37
+ */
38
+
39
+ /**
40
+ * Instantiates a BPMN model tree from a given xml string.
41
+ *
42
+ * @param {String} xmlStr
43
+ * @param {String} [typeName='bpmn:Definitions'] name of the root element
44
+ * @param {Object} [options] options to pass to the underlying reader
45
+ *
46
+ * @returns {Promise<ParseResult, ParseError>}
47
+ */
48
+ BpmnModdle.prototype.fromXML = function(xmlStr, typeName, options) {
49
+
50
+ if (!isString(typeName)) {
51
+ options = typeName;
52
+ typeName = 'bpmn:Definitions';
53
+ }
54
+
55
+ var reader = new Reader(assign({ model: this, lax: true }, options));
56
+ var rootHandler = reader.handler(typeName);
57
+
58
+ return reader.fromXML(xmlStr, rootHandler);
59
+ };
60
+
61
+
62
+ /**
63
+ * The toXML result.
64
+ *
65
+ * @typedef {Object} SerializationResult
66
+ *
67
+ * @property {String} xml
68
+ */
69
+
70
+ /**
71
+ * Serializes a BPMN 2.0 object tree to XML.
72
+ *
73
+ * @param {String} element the root element, typically an instance of `bpmn:Definitions`
74
+ * @param {Object} [options] to pass to the underlying writer
75
+ *
76
+ * @returns {Promise<SerializationResult, Error>}
77
+ */
78
+ BpmnModdle.prototype.toXML = function(element, options) {
79
+
80
+ var writer = new Writer(options);
81
+
82
+ return new Promise(function(resolve, reject) {
83
+ try {
84
+ var result = writer.toXML(element);
85
+
86
+ return resolve({
87
+ xml: result
88
+ });
89
+ } catch (err) {
90
+ return reject(err);
91
+ }
92
+ });
93
93
  };
94
94
 
95
95
  var name$5 = "BPMN20";
@@ -942,7 +942,6 @@ var types$5 = [
942
942
  {
943
943
  name: "operationRef",
944
944
  type: "Operation",
945
- isAttr: true,
946
945
  isReference: true
947
946
  }
948
947
  ]
@@ -2694,7 +2693,6 @@ var types$5 = [
2694
2693
  },
2695
2694
  {
2696
2695
  name: "cancelRemainingInstances",
2697
- "default": true,
2698
2696
  isAttr: true,
2699
2697
  type: "Boolean"
2700
2698
  }
@@ -3728,19 +3726,19 @@ var BpmnInColorPackage = {
3728
3726
  associations: associations
3729
3727
  };
3730
3728
 
3731
- const packages = {
3732
- bpmn: BpmnPackage,
3733
- bpmndi: BpmnDiPackage,
3734
- dc: DcPackage,
3735
- di: DiPackage,
3736
- bioc: BiocPackage,
3737
- color: BpmnInColorPackage
3738
- };
3739
-
3740
- function SimpleBpmnModdle(additionalPackages, options) {
3741
- const pks = assign({}, packages, additionalPackages);
3742
-
3743
- return new BpmnModdle(pks, options);
3729
+ const packages = {
3730
+ bpmn: BpmnPackage,
3731
+ bpmndi: BpmnDiPackage,
3732
+ dc: DcPackage,
3733
+ di: DiPackage,
3734
+ bioc: BiocPackage,
3735
+ color: BpmnInColorPackage
3736
+ };
3737
+
3738
+ function SimpleBpmnModdle(additionalPackages, options) {
3739
+ const pks = assign({}, packages, additionalPackages);
3740
+
3741
+ return new BpmnModdle(pks, options);
3744
3742
  }
3745
3743
 
3746
3744
  export { SimpleBpmnModdle as default };
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../lib/bpmn-moddle.js","../lib/simple.js"],"sourcesContent":["import {\n isString,\n assign\n} from 'min-dash';\n\nimport {\n Moddle\n} from 'moddle';\n\nimport {\n Reader,\n Writer\n} from 'moddle-xml';\n\n\n/**\n * A sub class of {@link Moddle} with support for import and export of BPMN 2.0 xml files.\n *\n * @class BpmnModdle\n * @extends Moddle\n *\n * @param {Object|Array} packages to use for instantiating the model\n * @param {Object} [options] additional options to pass over\n */\nexport default function BpmnModdle(packages, options) {\n Moddle.call(this, packages, options);\n}\n\nBpmnModdle.prototype = Object.create(Moddle.prototype);\n\n/**\n * The fromXML result.\n *\n * @typedef {Object} ParseResult\n *\n * @property {ModdleElement} rootElement\n * @property {Array<Object>} references\n * @property {Array<Error>} warnings\n * @property {Object} elementsById - a mapping containing each ID -> ModdleElement\n */\n\n/**\n * The fromXML error.\n *\n * @typedef {Error} ParseError\n *\n * @property {Array<Error>} warnings\n */\n\n/**\n * Instantiates a BPMN model tree from a given xml string.\n *\n * @param {String} xmlStr\n * @param {String} [typeName='bpmn:Definitions'] name of the root element\n * @param {Object} [options] options to pass to the underlying reader\n *\n * @returns {Promise<ParseResult, ParseError>}\n */\nBpmnModdle.prototype.fromXML = function(xmlStr, typeName, options) {\n\n if (!isString(typeName)) {\n options = typeName;\n typeName = 'bpmn:Definitions';\n }\n\n var reader = new Reader(assign({ model: this, lax: true }, options));\n var rootHandler = reader.handler(typeName);\n\n return reader.fromXML(xmlStr, rootHandler);\n};\n\n\n/**\n * The toXML result.\n *\n * @typedef {Object} SerializationResult\n *\n * @property {String} xml\n */\n\n/**\n * Serializes a BPMN 2.0 object tree to XML.\n *\n * @param {String} element the root element, typically an instance of `bpmn:Definitions`\n * @param {Object} [options] to pass to the underlying writer\n *\n * @returns {Promise<SerializationResult, Error>}\n */\nBpmnModdle.prototype.toXML = function(element, options) {\n\n var writer = new Writer(options);\n\n return new Promise(function(resolve, reject) {\n try {\n var result = writer.toXML(element);\n\n return resolve({\n xml: result\n });\n } catch (err) {\n return reject(err);\n }\n });\n};\n","import {\n assign\n} from 'min-dash';\n\nimport BpmnModdle from './bpmn-moddle.js';\n\nimport BpmnPackage from '../resources/bpmn/json/bpmn.json' with { type: 'json' };\nimport BpmnDiPackage from '../resources/bpmn/json/bpmndi.json' with { type: 'json' };\nimport DcPackage from '../resources/bpmn/json/dc.json' with { type: 'json' };\nimport DiPackage from '../resources/bpmn/json/di.json' with { type: 'json' };\nimport BiocPackage from '../resources/bpmn-io/json/bioc.json' with { type: 'json' };\nimport BpmnInColorPackage from 'bpmn-in-color-moddle/resources/bpmn-in-color.json' with { type: 'json' };\n\nconst packages = {\n bpmn: BpmnPackage,\n bpmndi: BpmnDiPackage,\n dc: DcPackage,\n di: DiPackage,\n bioc: BiocPackage,\n color: BpmnInColorPackage\n};\n\nexport default function SimpleBpmnModdle(additionalPackages, options) {\n const pks = assign({}, packages, additionalPackages);\n\n return new BpmnModdle(pks, options);\n}\n"],"names":[],"mappings":";;;;AAeA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAAS,UAAU,CAAC,QAAQ,EAAE,OAAO,EAAE;AACtD,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;AACvC,CAAC;AACD;AACA,UAAU,CAAC,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC1FD,MAAM,QAAQ,GAAG;AACjB,EAAE,IAAI,EAAE,WAAW;AACnB,EAAE,MAAM,EAAE,aAAa;AACvB,EAAE,EAAE,EAAE,SAAS;AACf,EAAE,EAAE,EAAE,SAAS;AACf,EAAE,IAAI,EAAE,WAAW;AACnB,EAAE,KAAK,EAAE,kBAAkB;AAC3B,CAAC,CAAC;AACF;AACe,SAAS,gBAAgB,CAAC,kBAAkB,EAAE,OAAO,EAAE;AACtE,EAAE,MAAM,GAAG,GAAG,MAAM,CAAC,EAAE,EAAE,QAAQ,EAAE,kBAAkB,CAAC,CAAC;AACvD;AACA,EAAE,OAAO,IAAI,UAAU,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;AACtC;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../lib/bpmn-moddle.js","../lib/simple.js"],"sourcesContent":["import {\r\n isString,\r\n assign\r\n} from 'min-dash';\r\n\r\nimport {\r\n Moddle\r\n} from 'moddle';\r\n\r\nimport {\r\n Reader,\r\n Writer\r\n} from 'moddle-xml';\r\n\r\n\r\n/**\r\n * A sub class of {@link Moddle} with support for import and export of BPMN 2.0 xml files.\r\n *\r\n * @class BpmnModdle\r\n * @extends Moddle\r\n *\r\n * @param {Object|Array} packages to use for instantiating the model\r\n * @param {Object} [options] additional options to pass over\r\n */\r\nexport default function BpmnModdle(packages, options) {\r\n Moddle.call(this, packages, options);\r\n}\r\n\r\nBpmnModdle.prototype = Object.create(Moddle.prototype);\r\n\r\n/**\r\n * The fromXML result.\r\n *\r\n * @typedef {Object} ParseResult\r\n *\r\n * @property {ModdleElement} rootElement\r\n * @property {Array<Object>} references\r\n * @property {Array<Error>} warnings\r\n * @property {Object} elementsById - a mapping containing each ID -> ModdleElement\r\n */\r\n\r\n/**\r\n * The fromXML error.\r\n *\r\n * @typedef {Error} ParseError\r\n *\r\n * @property {Array<Error>} warnings\r\n */\r\n\r\n/**\r\n * Instantiates a BPMN model tree from a given xml string.\r\n *\r\n * @param {String} xmlStr\r\n * @param {String} [typeName='bpmn:Definitions'] name of the root element\r\n * @param {Object} [options] options to pass to the underlying reader\r\n *\r\n * @returns {Promise<ParseResult, ParseError>}\r\n */\r\nBpmnModdle.prototype.fromXML = function(xmlStr, typeName, options) {\r\n\r\n if (!isString(typeName)) {\r\n options = typeName;\r\n typeName = 'bpmn:Definitions';\r\n }\r\n\r\n var reader = new Reader(assign({ model: this, lax: true }, options));\r\n var rootHandler = reader.handler(typeName);\r\n\r\n return reader.fromXML(xmlStr, rootHandler);\r\n};\r\n\r\n\r\n/**\r\n * The toXML result.\r\n *\r\n * @typedef {Object} SerializationResult\r\n *\r\n * @property {String} xml\r\n */\r\n\r\n/**\r\n * Serializes a BPMN 2.0 object tree to XML.\r\n *\r\n * @param {String} element the root element, typically an instance of `bpmn:Definitions`\r\n * @param {Object} [options] to pass to the underlying writer\r\n *\r\n * @returns {Promise<SerializationResult, Error>}\r\n */\r\nBpmnModdle.prototype.toXML = function(element, options) {\r\n\r\n var writer = new Writer(options);\r\n\r\n return new Promise(function(resolve, reject) {\r\n try {\r\n var result = writer.toXML(element);\r\n\r\n return resolve({\r\n xml: result\r\n });\r\n } catch (err) {\r\n return reject(err);\r\n }\r\n });\r\n};\r\n","import {\r\n assign\r\n} from 'min-dash';\r\n\r\nimport BpmnModdle from './bpmn-moddle.js';\r\n\r\nimport BpmnPackage from '../resources/bpmn/json/bpmn.json' with { type: 'json' };\r\nimport BpmnDiPackage from '../resources/bpmn/json/bpmndi.json' with { type: 'json' };\r\nimport DcPackage from '../resources/bpmn/json/dc.json' with { type: 'json' };\r\nimport DiPackage from '../resources/bpmn/json/di.json' with { type: 'json' };\r\nimport BiocPackage from '../resources/bpmn-io/json/bioc.json' with { type: 'json' };\r\nimport BpmnInColorPackage from 'bpmn-in-color-moddle/resources/bpmn-in-color.json' with { type: 'json' };\r\n\r\nconst packages = {\r\n bpmn: BpmnPackage,\r\n bpmndi: BpmnDiPackage,\r\n dc: DcPackage,\r\n di: DiPackage,\r\n bioc: BiocPackage,\r\n color: BpmnInColorPackage\r\n};\r\n\r\nexport default function SimpleBpmnModdle(additionalPackages, options) {\r\n const pks = assign({}, packages, additionalPackages);\r\n\r\n return new BpmnModdle(pks, options);\r\n}\r\n"],"names":[],"mappings":";;;;AAeA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAAS,UAAU,CAAC,QAAQ,EAAE,OAAO,EAAE;AACtD,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;AACvC,CAAC;AACD;AACA,UAAU,CAAC,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU,CAAC,SAAS,CAAC,OAAO,GAAG,SAAS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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC1FD,MAAM,QAAQ,GAAG;AACjB,EAAE,IAAI,EAAE,WAAW;AACnB,EAAE,MAAM,EAAE,aAAa;AACvB,EAAE,EAAE,EAAE,SAAS;AACf,EAAE,EAAE,EAAE,SAAS;AACf,EAAE,IAAI,EAAE,WAAW;AACnB,EAAE,KAAK,EAAE,kBAAkB;AAC3B,CAAC,CAAC;AACF;AACe,SAAS,gBAAgB,CAAC,kBAAkB,EAAE,OAAO,EAAE;AACtE,EAAE,MAAM,GAAG,GAAG,MAAM,CAAC,EAAE,EAAE,QAAQ,EAAE,kBAAkB,CAAC,CAAC;AACvD;AACA,EAAE,OAAO,IAAI,UAAU,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;AACtC;;;;"}
package/package.json CHANGED
@@ -1,75 +1,75 @@
1
- {
2
- "name": "bpmn-moddle",
3
- "version": "9.0.1",
4
- "description": "A moddle wrapper for BPMN 2.0",
5
- "scripts": {
6
- "all": "run-s generate-schema lint test",
7
- "lint": "eslint .",
8
- "dev": "npm test -- --watch",
9
- "pretest": "run-s build",
10
- "test": "mocha --reporter=spec --recursive test",
11
- "distro": "run-s build test:build",
12
- "build": "rollup -c",
13
- "prepare": "run-s build",
14
- "generate-schema": "node tasks/generate-schema.cjs"
15
- },
16
- "type": "module",
17
- "repository": {
18
- "type": "git",
19
- "url": "https://github.com/bpmn-io/bpmn-moddle"
20
- },
21
- "exports": {
22
- ".": {
23
- "import": "./dist/index.js",
24
- "require": "./dist/index.cjs"
25
- },
26
- "./resources/*": "./resources/*",
27
- "./package.json": "./package.json"
28
- },
29
- "engines": {
30
- "node": ">= 18"
31
- },
32
- "keywords": [
33
- "bpmn",
34
- "moddle",
35
- "bpmn20",
36
- "meta-model"
37
- ],
38
- "author": {
39
- "name": "Nico Rehwaldt",
40
- "url": "https://github.com/nikku"
41
- },
42
- "contributors": [
43
- {
44
- "name": "bpmn.io contributors",
45
- "url": "https://github.com/bpmn-io"
46
- }
47
- ],
48
- "license": "MIT",
49
- "sideEffects": false,
50
- "devDependencies": {
51
- "@babel/eslint-parser": "^7.23.10",
52
- "@babel/plugin-syntax-import-attributes": "^7.23.3",
53
- "@rollup/plugin-json": "^6.1.0",
54
- "@rollup/plugin-node-resolve": "^15.2.3",
55
- "bpmn-in-color-moddle": "^0.1.0",
56
- "chai": "^4.4.1",
57
- "cmof-parser": "^0.5.2",
58
- "eslint": "^8.57.0",
59
- "eslint-plugin-bpmn-io": "^1.0.0",
60
- "mocha": "^10.3.0",
61
- "npm-run-all2": "^6.1.2",
62
- "rollup": "^4.12.1",
63
- "xsd-schema-validator": "^0.7.0"
64
- },
65
- "dependencies": {
66
- "min-dash": "^4.2.1",
67
- "moddle": "^7.0.0",
68
- "moddle-xml": "^11.0.0"
69
- },
70
- "files": [
71
- "dist",
72
- "resources",
73
- "!resources/bpmn/cmof"
74
- ]
75
- }
1
+ {
2
+ "name": "bpmn-moddle",
3
+ "version": "9.0.3",
4
+ "description": "A moddle wrapper for BPMN 2.0",
5
+ "scripts": {
6
+ "all": "run-s generate-schema lint test",
7
+ "lint": "eslint .",
8
+ "dev": "npm test -- --watch",
9
+ "pretest": "run-s build",
10
+ "test": "mocha --reporter=spec --recursive test",
11
+ "distro": "run-s build test:build",
12
+ "build": "rollup -c",
13
+ "prepare": "run-s build",
14
+ "generate-schema": "node tasks/generate-schema.cjs"
15
+ },
16
+ "type": "module",
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "https://github.com/bpmn-io/bpmn-moddle"
20
+ },
21
+ "exports": {
22
+ ".": {
23
+ "import": "./dist/index.js",
24
+ "require": "./dist/index.cjs"
25
+ },
26
+ "./resources/*": "./resources/*",
27
+ "./package.json": "./package.json"
28
+ },
29
+ "engines": {
30
+ "node": ">= 18"
31
+ },
32
+ "keywords": [
33
+ "bpmn",
34
+ "moddle",
35
+ "bpmn20",
36
+ "meta-model"
37
+ ],
38
+ "author": {
39
+ "name": "Nico Rehwaldt",
40
+ "url": "https://github.com/nikku"
41
+ },
42
+ "contributors": [
43
+ {
44
+ "name": "bpmn.io contributors",
45
+ "url": "https://github.com/bpmn-io"
46
+ }
47
+ ],
48
+ "license": "MIT",
49
+ "sideEffects": false,
50
+ "devDependencies": {
51
+ "@babel/eslint-parser": "^7.25.8",
52
+ "@babel/plugin-syntax-import-attributes": "^7.23.3",
53
+ "@rollup/plugin-json": "^6.1.0",
54
+ "@rollup/plugin-node-resolve": "^16.0.0",
55
+ "bpmn-in-color-moddle": "^0.1.0",
56
+ "chai": "^4.4.1",
57
+ "cmof-parser": "^0.5.2",
58
+ "eslint": "^9.12.0",
59
+ "eslint-plugin-bpmn-io": "^2.0.1",
60
+ "mocha": "^10.3.0",
61
+ "npm-run-all2": "^8.0.0",
62
+ "rollup": "^4.12.1",
63
+ "xsd-schema-validator": "^0.10.0"
64
+ },
65
+ "dependencies": {
66
+ "min-dash": "^4.2.1",
67
+ "moddle": "^7.0.0",
68
+ "moddle-xml": "^11.0.0"
69
+ },
70
+ "files": [
71
+ "dist",
72
+ "resources",
73
+ "!resources/bpmn/cmof"
74
+ ]
75
+ }