From b181b1ea12123c994fb748d2f052ada3ad4d4ca6 Mon Sep 17 00:00:00 2001 From: Vitaliy Stoliarov Date: Sat, 28 Oct 2017 21:09:44 +0300 Subject: [PATCH] rollup.config & unit test --- .babelrc | 20 ++ package-lock.json | 471 +++++++++++++++++++++++++++++++++------------- package.json | 7 +- rollup.config.js | 20 +- test/test.js | 23 +++ 5 files changed, 394 insertions(+), 147 deletions(-) create mode 100644 .babelrc create mode 100644 test/test.js diff --git a/.babelrc b/.babelrc new file mode 100644 index 00000000..60aaee23 --- /dev/null +++ b/.babelrc @@ -0,0 +1,20 @@ +{ + "plugins": [ + "typecheck", + "syntax-flow", + "transform-flow-strip-types", + "transform-regenerator" + ], + "env": { + "development":{ + "presets": [ + "es2015-rollup" + ] + }, + "test": { + "presets": [ + "es2015" + ] + } + } +} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 4ebb03dc..d6fee489 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "d3-node-editor", - "version": "0.5.1", + "version": "0.5.3", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -353,27 +353,38 @@ } }, "babel-helper-regex": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-helper-regex/-/babel-helper-regex-6.24.1.tgz", - "integrity": "sha1-024i+rEAjXnYhkjjIRaGgShFbOg=", + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-helper-regex/-/babel-helper-regex-6.26.0.tgz", + "integrity": "sha1-MlxZ+QL4LyS3T6zu0DY5VPZJXnI=", "dev": true, "requires": { - "babel-runtime": "6.23.0", - "babel-types": "6.25.0", + "babel-runtime": "6.26.0", + "babel-types": "6.26.0", "lodash": "4.17.4" - } - }, - "babel-helper-remap-async-to-generator": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-helper-remap-async-to-generator/-/babel-helper-remap-async-to-generator-6.24.1.tgz", - "integrity": "sha1-XsWBgnrXI/7N04HxySg5BnbkVRs=", - "dev": true, - "requires": { - "babel-helper-function-name": "6.24.1", - "babel-runtime": "6.23.0", - "babel-template": "6.25.0", - "babel-traverse": "6.25.0", - "babel-types": "6.25.0" + }, + "dependencies": { + "babel-runtime": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz", + "integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=", + "dev": true, + "requires": { + "core-js": "2.4.1", + "regenerator-runtime": "0.11.0" + } + }, + "babel-types": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-types/-/babel-types-6.26.0.tgz", + "integrity": "sha1-o7Bz+Uq0nrb6Vc1lInozQ4BjJJc=", + "dev": true, + "requires": { + "babel-runtime": "6.26.0", + "esutils": "2.0.2", + "lodash": "4.17.4", + "to-fast-properties": "1.0.3" + } + } } }, "babel-helper-replace-supers": { @@ -427,35 +438,12 @@ "babel-runtime": "6.23.0" } }, - "babel-plugin-syntax-async-functions": { - "version": "6.13.0", - "resolved": "https://registry.npmjs.org/babel-plugin-syntax-async-functions/-/babel-plugin-syntax-async-functions-6.13.0.tgz", - "integrity": "sha1-ytnK0RkbWtY0vzCuCHI5HgZHvpU=", - "dev": true - }, "babel-plugin-syntax-flow": { "version": "6.18.0", "resolved": "https://registry.npmjs.org/babel-plugin-syntax-flow/-/babel-plugin-syntax-flow-6.18.0.tgz", "integrity": "sha1-TDqyCiryaqIM0lmVw5jE63AxDI0=", "dev": true }, - "babel-plugin-syntax-trailing-function-commas": { - "version": "6.22.0", - "resolved": "https://registry.npmjs.org/babel-plugin-syntax-trailing-function-commas/-/babel-plugin-syntax-trailing-function-commas-6.22.0.tgz", - "integrity": "sha1-ugNgk3+NBuQBgKQ/4NVhb/9TLPM=", - "dev": true - }, - "babel-plugin-transform-async-to-generator": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-async-to-generator/-/babel-plugin-transform-async-to-generator-6.24.1.tgz", - "integrity": "sha1-ZTbjeK/2yx1VF6wOQOs+n8jQh2E=", - "dev": true, - "requires": { - "babel-helper-remap-async-to-generator": "6.24.1", - "babel-plugin-syntax-async-functions": "6.13.0", - "babel-runtime": "6.23.0" - } - }, "babel-plugin-transform-es2015-arrow-functions": { "version": "6.22.0", "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-arrow-functions/-/babel-plugin-transform-es2015-arrow-functions-6.22.0.tgz", @@ -475,16 +463,93 @@ } }, "babel-plugin-transform-es2015-block-scoping": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-block-scoping/-/babel-plugin-transform-es2015-block-scoping-6.24.1.tgz", - "integrity": "sha1-dsKV3DpHQbFmWt/TFnIV3P8ypXY=", + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-block-scoping/-/babel-plugin-transform-es2015-block-scoping-6.26.0.tgz", + "integrity": "sha1-1w9SmcEwjQXBL0Y4E7CgnnOxiV8=", "dev": true, "requires": { - "babel-runtime": "6.23.0", - "babel-template": "6.25.0", - "babel-traverse": "6.25.0", - "babel-types": "6.25.0", + "babel-runtime": "6.26.0", + "babel-template": "6.26.0", + "babel-traverse": "6.26.0", + "babel-types": "6.26.0", "lodash": "4.17.4" + }, + "dependencies": { + "babel-code-frame": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz", + "integrity": "sha1-Y/1D99weO7fONZR9uP42mj9Yx0s=", + "dev": true, + "requires": { + "chalk": "1.1.3", + "esutils": "2.0.2", + "js-tokens": "3.0.2" + } + }, + "babel-runtime": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz", + "integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=", + "dev": true, + "requires": { + "core-js": "2.4.1", + "regenerator-runtime": "0.11.0" + } + }, + "babel-template": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-template/-/babel-template-6.26.0.tgz", + "integrity": "sha1-3gPi0WOWsGn0bdn/+FIfsaDjXgI=", + "dev": true, + "requires": { + "babel-runtime": "6.26.0", + "babel-traverse": "6.26.0", + "babel-types": "6.26.0", + "babylon": "6.18.0", + "lodash": "4.17.4" + } + }, + "babel-traverse": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-traverse/-/babel-traverse-6.26.0.tgz", + "integrity": "sha1-RqnL1+3MYsjlwGTi0tjQ9ANXZu4=", + "dev": true, + "requires": { + "babel-code-frame": "6.26.0", + "babel-messages": "6.23.0", + "babel-runtime": "6.26.0", + "babel-types": "6.26.0", + "babylon": "6.18.0", + "debug": "2.6.8", + "globals": "9.18.0", + "invariant": "2.2.2", + "lodash": "4.17.4" + } + }, + "babel-types": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-types/-/babel-types-6.26.0.tgz", + "integrity": "sha1-o7Bz+Uq0nrb6Vc1lInozQ4BjJJc=", + "dev": true, + "requires": { + "babel-runtime": "6.26.0", + "esutils": "2.0.2", + "lodash": "4.17.4", + "to-fast-properties": "1.0.3" + } + }, + "babylon": { + "version": "6.18.0", + "resolved": "https://registry.npmjs.org/babylon/-/babylon-6.18.0.tgz", + "integrity": "sha512-q/UEjfGJ2Cm3oKV71DJz9d25TPnq5rhBVL2Q4fA5wcC3jcrdn7+SssEybFIxwAvvP+YCsCYNKughoF33GxgycQ==", + "dev": true + }, + "js-tokens": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz", + "integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=", + "dev": true + } } }, "babel-plugin-transform-es2015-classes": { @@ -568,21 +633,98 @@ "integrity": "sha1-Oz5UAXI5hC1tGcMBHEvS8AoA0VQ=", "dev": true, "requires": { - "babel-plugin-transform-es2015-modules-commonjs": "6.24.1", + "babel-plugin-transform-es2015-modules-commonjs": "6.26.0", "babel-runtime": "6.23.0", "babel-template": "6.25.0" } }, "babel-plugin-transform-es2015-modules-commonjs": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-modules-commonjs/-/babel-plugin-transform-es2015-modules-commonjs-6.24.1.tgz", - "integrity": "sha1-0+MQtA72ZKNmIiAAl8bUQCmPK/4=", + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-modules-commonjs/-/babel-plugin-transform-es2015-modules-commonjs-6.26.0.tgz", + "integrity": "sha1-DYOUApt9xqvhqX7xgeAHWN0uXYo=", "dev": true, "requires": { "babel-plugin-transform-strict-mode": "6.24.1", - "babel-runtime": "6.23.0", - "babel-template": "6.25.0", - "babel-types": "6.25.0" + "babel-runtime": "6.26.0", + "babel-template": "6.26.0", + "babel-types": "6.26.0" + }, + "dependencies": { + "babel-code-frame": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz", + "integrity": "sha1-Y/1D99weO7fONZR9uP42mj9Yx0s=", + "dev": true, + "requires": { + "chalk": "1.1.3", + "esutils": "2.0.2", + "js-tokens": "3.0.2" + } + }, + "babel-runtime": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz", + "integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=", + "dev": true, + "requires": { + "core-js": "2.4.1", + "regenerator-runtime": "0.11.0" + } + }, + "babel-template": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-template/-/babel-template-6.26.0.tgz", + "integrity": "sha1-3gPi0WOWsGn0bdn/+FIfsaDjXgI=", + "dev": true, + "requires": { + "babel-runtime": "6.26.0", + "babel-traverse": "6.26.0", + "babel-types": "6.26.0", + "babylon": "6.18.0", + "lodash": "4.17.4" + } + }, + "babel-traverse": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-traverse/-/babel-traverse-6.26.0.tgz", + "integrity": "sha1-RqnL1+3MYsjlwGTi0tjQ9ANXZu4=", + "dev": true, + "requires": { + "babel-code-frame": "6.26.0", + "babel-messages": "6.23.0", + "babel-runtime": "6.26.0", + "babel-types": "6.26.0", + "babylon": "6.18.0", + "debug": "2.6.8", + "globals": "9.18.0", + "invariant": "2.2.2", + "lodash": "4.17.4" + } + }, + "babel-types": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-types/-/babel-types-6.26.0.tgz", + "integrity": "sha1-o7Bz+Uq0nrb6Vc1lInozQ4BjJJc=", + "dev": true, + "requires": { + "babel-runtime": "6.26.0", + "esutils": "2.0.2", + "lodash": "4.17.4", + "to-fast-properties": "1.0.3" + } + }, + "babylon": { + "version": "6.18.0", + "resolved": "https://registry.npmjs.org/babylon/-/babylon-6.18.0.tgz", + "integrity": "sha512-q/UEjfGJ2Cm3oKV71DJz9d25TPnq5rhBVL2Q4fA5wcC3jcrdn7+SssEybFIxwAvvP+YCsCYNKughoF33GxgycQ==", + "dev": true + }, + "js-tokens": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz", + "integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=", + "dev": true + } } }, "babel-plugin-transform-es2015-modules-systemjs": { @@ -656,7 +798,7 @@ "integrity": "sha1-AMHNsaynERLN8M9hJsLta0V8zbw=", "dev": true, "requires": { - "babel-helper-regex": "6.24.1", + "babel-helper-regex": "6.26.0", "babel-runtime": "6.23.0", "babel-types": "6.25.0" } @@ -685,7 +827,7 @@ "integrity": "sha1-04sS9C6nMj9yk4fxinxa4frrNek=", "dev": true, "requires": { - "babel-helper-regex": "6.24.1", + "babel-helper-regex": "6.26.0", "babel-runtime": "6.23.0", "regexpu-core": "2.0.0" } @@ -737,7 +879,7 @@ "babel-plugin-check-es2015-constants": "6.22.0", "babel-plugin-transform-es2015-arrow-functions": "6.22.0", "babel-plugin-transform-es2015-block-scoped-functions": "6.22.0", - "babel-plugin-transform-es2015-block-scoping": "6.24.1", + "babel-plugin-transform-es2015-block-scoping": "6.26.0", "babel-plugin-transform-es2015-classes": "6.24.1", "babel-plugin-transform-es2015-computed-properties": "6.24.1", "babel-plugin-transform-es2015-destructuring": "6.23.0", @@ -746,7 +888,7 @@ "babel-plugin-transform-es2015-function-name": "6.24.1", "babel-plugin-transform-es2015-literals": "6.22.0", "babel-plugin-transform-es2015-modules-amd": "6.24.1", - "babel-plugin-transform-es2015-modules-commonjs": "6.24.1", + "babel-plugin-transform-es2015-modules-commonjs": "6.26.0", "babel-plugin-transform-es2015-modules-systemjs": "6.24.1", "babel-plugin-transform-es2015-modules-umd": "6.24.1", "babel-plugin-transform-es2015-object-super": "6.24.1", @@ -771,16 +913,6 @@ "require-relative": "0.8.7" } }, - "babel-preset-es2017": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-preset-es2017/-/babel-preset-es2017-6.24.1.tgz", - "integrity": "sha1-WXvq37n38gi8/YoS6bKym4svFNE=", - "dev": true, - "requires": { - "babel-plugin-syntax-trailing-function-commas": "6.22.0", - "babel-plugin-transform-async-to-generator": "6.24.1" - } - }, "babel-register": { "version": "6.26.0", "resolved": "https://registry.npmjs.org/babel-register/-/babel-register-6.26.0.tgz", @@ -788,12 +920,30 @@ "dev": true, "requires": { "babel-core": "6.26.0", - "babel-runtime": "6.23.0", - "core-js": "2.4.1", + "babel-runtime": "6.26.0", + "core-js": "2.5.1", "home-or-tmp": "2.0.0", "lodash": "4.17.4", "mkdirp": "0.5.1", "source-map-support": "0.4.15" + }, + "dependencies": { + "babel-runtime": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz", + "integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=", + "dev": true, + "requires": { + "core-js": "2.5.1", + "regenerator-runtime": "0.11.0" + } + }, + "core-js": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.1.tgz", + "integrity": "sha1-rmh03GaTd4m4B1T/VCjfZoGcpQs=", + "dev": true + } } }, "babel-runtime": { @@ -912,6 +1062,12 @@ "concat-map": "0.0.1" } }, + "browser-stdout": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.0.tgz", + "integrity": "sha1-81HTKWnTL6XXpVZxVCY9korjvR8=", + "dev": true + }, "builtin-modules": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz", @@ -1187,23 +1343,23 @@ } }, "d3": { - "version": "4.10.2", - "resolved": "https://registry.npmjs.org/d3/-/d3-4.10.2.tgz", - "integrity": "sha512-0PxXZbD+Remq9x4wdes1gs6rYcGJKA3+e0xwbma0r4ricKOKBHUHfDWcxKQICS3ZZxhzwNYWl196pxDqcAgRpw==", + "version": "4.11.0", + "resolved": "https://registry.npmjs.org/d3/-/d3-4.11.0.tgz", + "integrity": "sha512-o048nfmydnbt0ciIvCUDTq9p62rZYOXzl8cKps0XVzk+5nHgeXmAS7jU4nh+3v82pUyH7t/GFm1bJRX4oIAlPw==", "requires": { - "d3-array": "1.2.0", + "d3-array": "1.2.1", "d3-axis": "1.0.8", "d3-brush": "1.0.4", "d3-chord": "1.0.4", "d3-collection": "1.0.4", "d3-color": "1.0.3", "d3-dispatch": "1.0.3", - "d3-drag": "1.1.1", + "d3-drag": "1.2.1", "d3-dsv": "1.0.7", "d3-ease": "1.0.3", - "d3-force": "1.0.6", + "d3-force": "1.1.0", "d3-format": "1.2.0", - "d3-geo": "1.6.4", + "d3-geo": "1.8.1", "d3-hierarchy": "1.1.5", "d3-interpolate": "1.1.5", "d3-path": "1.0.5", @@ -1220,7 +1376,54 @@ "d3-timer": "1.0.7", "d3-transition": "1.1.0", "d3-voronoi": "1.1.2", - "d3-zoom": "1.5.0" + "d3-zoom": "1.6.0" + }, + "dependencies": { + "d3-array": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/d3-array/-/d3-array-1.2.1.tgz", + "integrity": "sha512-CyINJQ0SOUHojDdFDH4JEM0552vCR1utGyLHegJHyYH0JyCpSeTPxi4OBqHMA2jJZq4NH782LtaJWBImqI/HBw==" + }, + "d3-drag": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/d3-drag/-/d3-drag-1.2.1.tgz", + "integrity": "sha512-Cg8/K2rTtzxzrb0fmnYOUeZHvwa4PHzwXOLZZPwtEs2SKLLKLXeYwZKBB+DlOxUvFmarOnmt//cU4+3US2lyyQ==", + "requires": { + "d3-dispatch": "1.0.3", + "d3-selection": "1.1.0" + } + }, + "d3-force": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/d3-force/-/d3-force-1.1.0.tgz", + "integrity": "sha512-2HVQz3/VCQs0QeRNZTYb7GxoUCeb6bOzMp/cGcLa87awY9ZsPvXOGeZm0iaGBjXic6I1ysKwMn+g+5jSAdzwcg==", + "requires": { + "d3-collection": "1.0.4", + "d3-dispatch": "1.0.3", + "d3-quadtree": "1.0.3", + "d3-timer": "1.0.7" + } + }, + "d3-geo": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/d3-geo/-/d3-geo-1.8.1.tgz", + "integrity": "sha512-PuvmWl1A1UXuaxcH55EGNhvMNAUBS0RQN2PAnxrZbDvDX56Xwkd+Yp1t1+ECkaJO3my+dnhxAyqAKMyyK+IFPQ==", + "requires": { + "d3-array": "1.2.1" + } + }, + "d3-zoom": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/d3-zoom/-/d3-zoom-1.6.0.tgz", + "integrity": "sha512-viq+6rXA9JQY1wD+gpDEdlOtCeJ6IfcsNT2aVr31VTjIAIhYlO0YurQ80yDRZeMJw5P/e6nVPhGJF9D9Ade5Og==", + "requires": { + "d3-dispatch": "1.0.3", + "d3-drag": "1.2.1", + "d3-interpolate": "1.1.5", + "d3-selection": "1.1.0", + "d3-transition": "1.1.0" + } + } } }, "d3-array": { @@ -1293,30 +1496,11 @@ "resolved": "https://registry.npmjs.org/d3-ease/-/d3-ease-1.0.3.tgz", "integrity": "sha1-aL+8NJM4o4DETYrMT7wzBKotjA4=" }, - "d3-force": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/d3-force/-/d3-force-1.0.6.tgz", - "integrity": "sha1-6n4bdzDiZkzTFPWU1nGMV8wTK3k=", - "requires": { - "d3-collection": "1.0.4", - "d3-dispatch": "1.0.3", - "d3-quadtree": "1.0.3", - "d3-timer": "1.0.7" - } - }, "d3-format": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/d3-format/-/d3-format-1.2.0.tgz", "integrity": "sha1-a0gLqohohdRlHcJIqPSsnaFtsHo=" }, - "d3-geo": { - "version": "1.6.4", - "resolved": "https://registry.npmjs.org/d3-geo/-/d3-geo-1.6.4.tgz", - "integrity": "sha1-8g4eRhyxhF9ai+Vatvh2VCp+MZk=", - "requires": { - "d3-array": "1.2.0" - } - }, "d3-hierarchy": { "version": "1.1.5", "resolved": "https://registry.npmjs.org/d3-hierarchy/-/d3-hierarchy-1.1.5.tgz", @@ -1429,18 +1613,6 @@ "resolved": "https://registry.npmjs.org/d3-voronoi/-/d3-voronoi-1.1.2.tgz", "integrity": "sha1-Fodmfo8TotFYyAwUgMWinLDYlzw=" }, - "d3-zoom": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/d3-zoom/-/d3-zoom-1.5.0.tgz", - "integrity": "sha512-tc/ONeSUVuwHczjjK4jQPd0T1iZ+lfsz8TbguAAceY5qs057hp4WLglkPWValkuVjCyeGpqiA2iTm8S++NJ84w==", - "requires": { - "d3-dispatch": "1.0.3", - "d3-drag": "1.1.1", - "d3-interpolate": "1.1.5", - "d3-selection": "1.1.0", - "d3-transition": "1.1.0" - } - }, "dashdash": { "version": "1.14.1", "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", @@ -1515,6 +1687,12 @@ "repeating": "2.0.1" } }, + "diff": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/diff/-/diff-3.3.1.tgz", + "integrity": "sha512-MKPHZDMB0o6yHyDryUOScqZibp914ksXwAMYMTHj6KO8UeKsRYNJD3oNCKjTqZon+V488P7N/HzXF8t7ZR95ww==", + "dev": true + }, "doctrine": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.0.0.tgz", @@ -1937,6 +2115,15 @@ "globule": "1.2.0" } }, + "gen-pug-source-map": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/gen-pug-source-map/-/gen-pug-source-map-0.1.2.tgz", + "integrity": "sha1-3nk4fo310BZ91UrC8pgxfx53IwQ=", + "dev": true, + "requires": { + "source-map": "0.5.6" + } + }, "generate-function": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/generate-function/-/generate-function-2.0.0.tgz", @@ -2059,6 +2246,12 @@ "resolved": "https://registry.npmjs.org/graceful-readlink/-/graceful-readlink-1.0.1.tgz", "integrity": "sha1-TK+tdrxi8C+gObL5Tpo906ORpyU=" }, + "growl": { + "version": "1.10.3", + "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.3.tgz", + "integrity": "sha512-hKlsbA5Vu3xsh1Cg3J7jSmX/WaW6A5oBeqzM88oNbCRQFz+zUaXm6yxS4RVytp1scBoJzSYl4YAEOQIt6O8V1Q==", + "dev": true + }, "har-schema": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-1.0.5.tgz", @@ -2120,6 +2313,12 @@ "sntp": "1.0.9" } }, + "he": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz", + "integrity": "sha1-k0EP0hsAlzUVH4howvJx80J+I/0=", + "dev": true + }, "hoek": { "version": "2.16.3", "resolved": "https://registry.npmjs.org/hoek/-/hoek-2.16.3.tgz", @@ -2776,6 +2975,24 @@ "minimist": "0.0.8" } }, + "mocha": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-4.0.1.tgz", + "integrity": "sha512-evDmhkoA+cBNiQQQdSKZa2b9+W2mpLoj50367lhy+Klnx9OV8XlCIhigUnn1gaTFLQCa0kdNhEGDr0hCXOQFDw==", + "dev": true, + "requires": { + "browser-stdout": "1.3.0", + "commander": "2.9.0", + "debug": "2.6.8", + "diff": "3.3.1", + "escape-string-regexp": "1.0.5", + "glob": "7.1.2", + "growl": "1.10.3", + "he": "1.1.1", + "mkdirp": "0.5.1", + "supports-color": "2.0.0" + } + }, "ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", @@ -3139,18 +3356,6 @@ "pug-runtime": "2.0.3" } }, - "pug-cli": { - "version": "1.0.0-alpha6", - "resolved": "https://registry.npmjs.org/pug-cli/-/pug-cli-1.0.0-alpha6.tgz", - "integrity": "sha1-HKU56krA67ac5KroSu7V1k/+ZQE=", - "dev": true, - "requires": { - "chalk": "1.1.3", - "commander": "2.9.0", - "mkdirp": "0.5.1", - "pug": "2.0.0-rc.4" - } - }, "pug-code-gen": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/pug-code-gen/-/pug-code-gen-2.0.0.tgz", @@ -3347,9 +3552,9 @@ } }, "regenerate": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.3.2.tgz", - "integrity": "sha1-0ZQcZ7rUN+G+dkM63Vs4X5WxkmA=", + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.3.3.tgz", + "integrity": "sha512-jVpo1GadrDAK59t/0jRx5VxYWQEDkkEKi6+HjE3joFVLfDOh9Xrdh0dF1eSq+BI/SwvTQ44gSscJ8N5zYL61sg==", "dev": true }, "regenerator-runtime": { @@ -3375,7 +3580,7 @@ "integrity": "sha1-SdA4g3uNz4v6W5pCE5k45uoq4kA=", "dev": true, "requires": { - "regenerate": "1.3.2", + "regenerate": "1.3.3", "regjsgen": "0.2.0", "regjsparser": "0.1.5" } @@ -3559,6 +3764,18 @@ "matched": "0.4.4" } }, + "rollup-plugin-pug": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/rollup-plugin-pug/-/rollup-plugin-pug-0.1.6.tgz", + "integrity": "sha1-xGydYo9T0mTywFYk28WRK0gbQC0=", + "dev": true, + "requires": { + "gen-pug-source-map": "0.1.2", + "pug": "2.0.0-rc.4", + "pug-runtime": "2.0.3", + "rollup-pluginutils": "1.5.2" + } + }, "rollup-pluginutils": { "version": "1.5.2", "resolved": "https://registry.npmjs.org/rollup-pluginutils/-/rollup-pluginutils-1.5.2.tgz", diff --git a/package.json b/package.json index 7f4d722d..332aa268 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,8 @@ "lint": "eslint src", "build": "rollup -c && npm-sass src/styles/index.sass > build/d3-node-editor.css", "minify-build": "uglifyjs build/d3-node-editor.js --support-ie8 --compress --output build/d3-node-editor.min.js", - "prepublish": "npm run lint && npm run build && npm run minify-build" + "prepublishOnly": "npm run lint && npm run build && npm run minify-build", + "test": "BABEL_ENV=test mocha --compilers js:babel-core/register" }, "repository": { "type": "git", @@ -32,9 +33,11 @@ "babel-plugin-transform-flow-strip-types": "^6.22.0", "babel-plugin-transform-regenerator": "^6.26.0", "babel-plugin-typecheck": "^3.9.0", + "babel-preset-es2015": "^6.24.1", "babel-preset-es2015-rollup": "^3.0.0", - "babel-preset-es2017": "^6.24.1", + "babel-register": "^6.26.0", "eslint": "^3.17.1", + "mocha": "^4.0.1", "npm-sass": "^2.0.0", "pug": "^2.0.0-rc.4", "regenerator-runtime": "^0.11.0", diff --git a/rollup.config.js b/rollup.config.js index 1e587135..d91db4da 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -2,21 +2,8 @@ import babel from 'rollup-plugin-babel'; import pug from 'rollup-plugin-pug'; import multiEntry from 'rollup-plugin-multi-entry'; -var entries = ['src/index.js']; -var babelPlugins = ['typecheck', 'syntax-flow', 'transform-flow-strip-types']; -var presets = []; - -if (process.env.npm_config_es2017) { - presets = ['es2017']; -} -else { - entries.push('node_modules/regenerator-runtime/runtime.js'); - babelPlugins.push('transform-regenerator'); - presets = ['es2015-rollup']; -} - export default { - entry: entries, + entry: ['src/index.js', 'node_modules/regenerator-runtime/runtime.js'], dest: 'build/d3-node-editor.js', sourceMap: true, plugins: [ @@ -24,10 +11,7 @@ export default { pug({ pugRuntime: false }), - babel({ - 'presets': presets, - 'plugins': babelPlugins - }) + babel() ], format: 'iife', moduleName: 'D3NE' diff --git a/test/test.js b/test/test.js new file mode 100644 index 00000000..5333ddd5 --- /dev/null +++ b/test/test.js @@ -0,0 +1,23 @@ +import { Utils } from '../src/utils'; +import assert from 'assert'; + +describe('Utils', () => { + it('validate id ', () => { + assert.ok(Utils.isValidId('demo@0.0.0')); + assert.ok(!Utils.isValidId('demo@0.0g.0')); + }); + + it('validate data', () => { + var data = {id: 'demo@0.0.0', nodes: null, goups: {} }; + + assert.ok(!Utils.isValidData(data)); + }); + + it('validate', () => { + var id = 'demo@0.1.0'; + var data = { id: 'demo@0.0.0', nodes: {}, goups: {} }; + + assert.ok(!Utils.validate(id, data).success); + }); +}); + \ No newline at end of file