From c893cdb9f3879db16e957013bcb8cf8dc4c7b7a1 Mon Sep 17 00:00:00 2001 From: Chema Balsas Date: Thu, 9 Nov 2017 18:27:49 -0800 Subject: [PATCH 01/70] Adds guidelines dependencies and scripts --- .editorconfig | 12 - .eslintrc | 7 + .eslintrc.json | 35 - package-lock.json | 3764 +++++++++++++---- package.json | 11 +- packages/metal-assertions/package-lock.json | 40 +- packages/metal-component/package-lock.json | 40 +- packages/metal-dom/package-lock.json | 40 +- packages/metal-events/package-lock.json | 40 +- .../metal-incremental-dom/package-lock.json | 40 +- packages/metal-jsx/package-lock.json | 40 +- packages/metal-soy-bundle/package-lock.json | 72 +- packages/metal-soy/package-lock.json | 40 +- packages/metal-state/package-lock.json | 40 +- .../metal-web-component/package-lock.json | 62 +- packages/metal/package-lock.json | 40 +- 16 files changed, 3131 insertions(+), 1192 deletions(-) delete mode 100644 .editorconfig create mode 100644 .eslintrc delete mode 100644 .eslintrc.json diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index df7baccf..00000000 --- a/.editorconfig +++ /dev/null @@ -1,12 +0,0 @@ -# This file is for unifying the coding style for different editors and IDEs -# See editorconfig.org - -root = true - -[*] -indent_style = tab -indent_size = 2 -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true diff --git a/.eslintrc b/.eslintrc new file mode 100644 index 00000000..14f7560a --- /dev/null +++ b/.eslintrc @@ -0,0 +1,7 @@ +{ + "env": { + "browser": true, + "node": true + }, + "extends": "liferay" +} \ No newline at end of file diff --git a/.eslintrc.json b/.eslintrc.json deleted file mode 100644 index b892904d..00000000 --- a/.eslintrc.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "env": { - "browser": true, - "node": true - }, - "globals": {}, - "parserOptions": { - "ecmaVersion": 6, - "sourceType": "module", - "ecmaFeatures": { - "jsx": true - } - }, - "rules": { - "semi": 1, - "no-bitwise": 0, - "curly": 2, - "eqeqeq": 2, - "no-eval": 0, - "guard-for-in": 0, - "wrap-iife": [2, "any"], - "max-depth": 0, - "no-multi-str": 0, - "new-cap": 2, - "no-caller": 2, - "quotes": [ - 1, - "single", - { "allowTemplateLiterals": true } - ], - "strict": 0, - "no-undef": 2, - "no-unused-vars": 2 - } -} diff --git a/package-lock.json b/package-lock.json index 7ede5498..eed48dd9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2,6 +2,16 @@ "requires": true, "lockfileVersion": 1, "dependencies": { + "JSONStream": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-1.3.1.tgz", + "integrity": "sha1-cH92HgHa6eFvG8+TcDt4xwlmV5o=", + "dev": true, + "requires": { + "jsonparse": "1.3.1", + "through": "2.3.8" + } + }, "abab": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/abab/-/abab-1.0.4.tgz", @@ -69,32 +79,34 @@ "dev": true }, "ajv": { - "version": "4.11.8", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-4.11.8.tgz", - "integrity": "sha1-gv+wKynmYq5TvcIK8VlHcGc5xTY=", + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.3.0.tgz", + "integrity": "sha1-RBT/dKUIecII7l/cgm4ywwNUnto=", "dev": true, "requires": { "co": "4.6.0", - "json-stable-stringify": "1.0.1" - }, - "dependencies": { - "json-stable-stringify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz", - "integrity": "sha1-mnWdOcXy/1A/1TAGRu1EX4jE+a8=", - "dev": true, - "requires": { - "jsonify": "0.0.0" - } - } + "fast-deep-equal": "1.0.0", + "fast-json-stable-stringify": "2.0.0", + "json-schema-traverse": "0.3.1" } }, "ajv-keywords": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-1.5.1.tgz", - "integrity": "sha1-MU3QpLM2j609/NxU7eYXG4htrzw=", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-2.1.1.tgz", + "integrity": "sha1-YXmX/F9gV2iUxDX5QNgZ4TW4B2I=", "dev": true }, + "align-text": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/align-text/-/align-text-0.1.4.tgz", + "integrity": "sha1-DNkKVhCT810KmSVsIrcGlDP60Rc=", + "dev": true, + "requires": { + "kind-of": "3.2.2", + "longest": "1.0.1", + "repeat-string": "1.6.1" + } + }, "amdefine": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.1.tgz", @@ -102,9 +114,9 @@ "dev": true }, "ansi-escapes": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-1.4.0.tgz", - "integrity": "sha1-06ioOzGapneTZisT52HHkRQiMG4=", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.0.0.tgz", + "integrity": "sha512-O/klc27mWNUigtv0F8NJWbLF00OcegQalkqKURWdosW08YZKi4m6CnSUSvIZG1otNJbTWhN01Hhz389DW7mvDQ==", "dev": true }, "ansi-regex": { @@ -211,6 +223,16 @@ "integrity": "sha1-nlKHYrSpBmrRY6aWKjZEGOlibs4=", "dev": true }, + "array-includes": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.0.3.tgz", + "integrity": "sha1-GEtI9i2S10UrsxsyMWXH+L0CJm0=", + "dev": true, + "requires": { + "define-properties": "1.1.2", + "es-abstract": "1.9.0" + } + }, "array-map": { "version": "0.0.0", "resolved": "https://registry.npmjs.org/array-map/-/array-map-0.0.0.tgz", @@ -250,16 +272,6 @@ "integrity": "sha1-odl8yvy8JiXMcPrc6zalDFiwGlM=", "dev": true }, - "array.prototype.find": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/array.prototype.find/-/array.prototype.find-2.0.4.tgz", - "integrity": "sha1-VWpcU2LAhkgyPdrrnenRS8GGTJA=", - "dev": true, - "requires": { - "define-properties": "1.1.2", - "es-abstract": "1.9.0" - } - }, "arraybuffer.slice": { "version": "0.0.6", "resolved": "https://registry.npmjs.org/arraybuffer.slice/-/arraybuffer.slice-0.0.6.tgz", @@ -272,6 +284,12 @@ "integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=", "dev": true }, + "asap": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz", + "integrity": "sha1-5QNHYR1+aQlDIIu9r+vLwvuGbUY=", + "dev": true + }, "asn1": { "version": "0.2.3", "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.3.tgz", @@ -279,9 +297,9 @@ "dev": true }, "asn1.js": { - "version": "4.9.1", - "resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-4.9.1.tgz", - "integrity": "sha1-SLokC0WpKA6UdImQull9IWYX/UA=", + "version": "4.9.2", + "resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-4.9.2.tgz", + "integrity": "sha512-b/OsSjvWEo8Pi8H0zsDd2P6Uqo2TK2pH8gNLSJtNLM2Db0v2QaAZ0pBQJXVjAn4gBuugeVDr7s63ZogpUIwWDg==", "dev": true, "requires": { "bn.js": "4.11.8", @@ -344,7 +362,7 @@ "dev": true, "requires": { "browserslist": "1.7.7", - "caniuse-db": "1.0.30000746", + "caniuse-db": "1.0.30000760", "normalize-range": "0.1.2", "num2fraction": "1.2.2", "postcss": "5.2.18", @@ -357,8 +375,8 @@ "integrity": "sha1-C9dnBCWL6CmyOYu1Dkti0aFmsLk=", "dev": true, "requires": { - "caniuse-db": "1.0.30000746", - "electron-to-chromium": "1.3.25" + "caniuse-db": "1.0.30000760", + "electron-to-chromium": "1.3.27" } } } @@ -408,7 +426,7 @@ "lodash": "4.17.4", "minimatch": "3.0.4", "path-is-absolute": "1.0.1", - "private": "0.1.7", + "private": "0.1.8", "slash": "1.0.0", "source-map": "0.5.7" } @@ -601,7 +619,7 @@ "dev": true, "requires": { "find-up": "1.1.2", - "istanbul-lib-instrument": "1.8.0", + "istanbul-lib-instrument": "1.9.1", "test-exclude": "1.1.0" } }, @@ -905,9 +923,9 @@ } }, "babel-preset-env": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/babel-preset-env/-/babel-preset-env-1.6.0.tgz", - "integrity": "sha512-OVgtQRuOZKckrILgMA5rvctvFZPv72Gua9Rt006AiPoB0DJKGN07UmaQA+qRrYgK71MVct8fFhT0EyNWYorVew==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/babel-preset-env/-/babel-preset-env-1.6.1.tgz", + "integrity": "sha512-W6VIyA6Ch9ePMI7VptNn2wBM6dbG0eSz25HEiL40nQXCsXGTGZSTZu1Iap+cj3Q0S5a7T9+529l/5Bkvd+afNA==", "dev": true, "requires": { "babel-plugin-check-es2015-constants": "6.22.0", @@ -937,7 +955,7 @@ "babel-plugin-transform-es2015-unicode-regex": "6.24.1", "babel-plugin-transform-exponentiation-operator": "6.24.1", "babel-plugin-transform-regenerator": "6.26.0", - "browserslist": "2.5.1", + "browserslist": "2.8.0", "invariant": "2.2.2", "semver": "5.4.1" } @@ -1064,6 +1082,16 @@ "integrity": "sha1-R2iMuZu2gE8OBtPnY7HDLlfY5rY=", "dev": true }, + "bcrypt-pbkdf": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.1.tgz", + "integrity": "sha1-Y7xdy2EzG5K8Bf1SiVPDNGKgb40=", + "dev": true, + "optional": true, + "requires": { + "tweetnacl": "0.14.5" + } + }, "beeper": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/beeper/-/beeper-1.1.1.tgz", @@ -1125,16 +1153,14 @@ "qs": "6.5.1", "raw-body": "2.3.2", "type-is": "1.6.15" - }, - "dependencies": { - "iconv-lite": { - "version": "0.4.19", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.19.tgz", - "integrity": "sha512-oTZqweIP51xaGPI4uPa56/Pri/480R+mo7SeU+YETByQNhDG55ycFyNLIgta9vXhILrxXDmF7ZGhqZIcuN0gJQ==", - "dev": true - } } }, + "boolify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/boolify/-/boolify-1.0.1.tgz", + "integrity": "sha1-tcCeF8rNET0Rt7s+04TMASmU2Gs=", + "dev": true + }, "boom": { "version": "4.3.1", "resolved": "https://registry.npmjs.org/boom/-/boom-4.3.1.tgz", @@ -1177,9 +1203,9 @@ "integrity": "sha1-+GzWzvT1MAyOY+B6TVEvZfv/RTE=", "dev": true, "requires": { + "JSONStream": "1.3.1", "combine-source-map": "0.7.2", "defined": "1.0.0", - "JSONStream": "1.3.1", "through2": "2.0.3", "umd": "3.0.1" } @@ -1207,6 +1233,7 @@ "integrity": "sha1-tanJAgJD8McORnW+yCI7xifkFc4=", "dev": true, "requires": { + "JSONStream": "1.3.1", "assert": "1.4.1", "browser-pack": "6.0.2", "browser-resolve": "1.11.2", @@ -1216,7 +1243,7 @@ "concat-stream": "1.5.2", "console-browserify": "1.1.0", "constants-browserify": "1.0.0", - "crypto-browserify": "3.11.1", + "crypto-browserify": "3.12.0", "defined": "1.0.0", "deps-sort": "2.0.0", "domain-browser": "1.1.7", @@ -1228,7 +1255,6 @@ "https-browserify": "0.0.1", "inherits": "2.0.3", "insert-module-globals": "7.0.1", - "JSONStream": "1.3.1", "labeled-stream-splicer": "2.0.0", "module-deps": "4.1.1", "os-browserify": "0.1.2", @@ -1239,7 +1265,7 @@ "querystring-es3": "0.2.1", "read-only-stream": "2.0.0", "readable-stream": "2.3.3", - "resolve": "1.4.0", + "resolve": "1.5.0", "shasum": "1.0.2", "shell-quote": "1.6.1", "stream-browserify": "2.0.1", @@ -1257,9 +1283,9 @@ } }, "browserify-aes": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/browserify-aes/-/browserify-aes-1.0.8.tgz", - "integrity": "sha512-WYCMOT/PtGTlpOKFht0YJFYcPy6pLCR98CtWfzK13zoynLlBMvAdEMSRGmgnJCw2M2j/5qxBkinZQFobieM8dQ==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/browserify-aes/-/browserify-aes-1.1.1.tgz", + "integrity": "sha512-UGnTYAnB2a3YuYKIRy1/4FB2HdM866E0qC46JXvVTYKlBlZlnvfpSfY6OKfXZAkv70eJ2a1SqzpAo5CRhZGDFg==", "dev": true, "requires": { "buffer-xor": "1.0.3", @@ -1276,7 +1302,7 @@ "integrity": "sha1-mYgkSHS/XtTijalWZtzWasj8Njo=", "dev": true, "requires": { - "browserify-aes": "1.0.8", + "browserify-aes": "1.1.1", "browserify-des": "1.0.0", "evp_bytestokey": "1.0.3" } @@ -1327,13 +1353,13 @@ } }, "browserslist": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-2.5.1.tgz", - "integrity": "sha512-jAvM2ku7YDJ+leAq3bFH1DE0Ylw+F+EQDq4GkqZfgPEqpWYw9ofQH85uKSB9r3Tv7XDbfqVtE+sdvKJW7IlPJA==", + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-2.8.0.tgz", + "integrity": "sha512-iiWHM1Et6Q4TQpB7Ar6pxuM3TNMXasVJY4Y/oh3q38EwR3Z+IdZ9MyVf7PI4MJFB4xpwMcZgs9bEUnPG2E3TCA==", "dev": true, "requires": { - "caniuse-lite": "1.0.30000746", - "electron-to-chromium": "1.3.25" + "caniuse-lite": "1.0.30000760", + "electron-to-chromium": "1.3.27" } }, "buffer": { @@ -1421,15 +1447,21 @@ } }, "caniuse-db": { - "version": "1.0.30000746", - "resolved": "https://registry.npmjs.org/caniuse-db/-/caniuse-db-1.0.30000746.tgz", - "integrity": "sha1-UBCYxm9fu/Y0wC8lUIsF6ICZEPQ=", + "version": "1.0.30000760", + "resolved": "https://registry.npmjs.org/caniuse-db/-/caniuse-db-1.0.30000760.tgz", + "integrity": "sha1-PqKUc+t4psywny63Osnh3r/sUo0=", "dev": true }, "caniuse-lite": { - "version": "1.0.30000746", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000746.tgz", - "integrity": "sha1-xk+Vo5Jc/TAgejCO12wa6W6gnqA=", + "version": "1.0.30000760", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000760.tgz", + "integrity": "sha1-7HIDlXQvHH7IlH/W3SYE53qPmP8=", + "dev": true + }, + "capture-stack-trace": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/capture-stack-trace/-/capture-stack-trace-1.0.0.tgz", + "integrity": "sha1-Sm+gc5nCa7pH8LJJa00PtAjFVQ0=", "dev": true }, "caseless": { @@ -1438,6 +1470,17 @@ "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=", "dev": true }, + "center-align": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/center-align/-/center-align-0.1.3.tgz", + "integrity": "sha1-qg0yYptu6XIgBBHL1EYckHvCt60=", + "dev": true, + "optional": true, + "requires": { + "align-text": "0.1.4", + "lazy-cache": "1.0.4" + } + }, "chai": { "version": "3.5.0", "resolved": "https://registry.npmjs.org/chai/-/chai-3.5.0.tgz", @@ -1470,6 +1513,7 @@ "requires": { "anymatch": "1.3.2", "async-each": "1.0.1", + "fsevents": "1.1.2", "glob-parent": "2.0.0", "inherits": "2.0.3", "is-binary-path": "1.0.1", @@ -1501,12 +1545,12 @@ "dev": true }, "cli-cursor": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-1.0.2.tgz", - "integrity": "sha1-ZNo/fValRBLll5S9Ytw1KV6PKYc=", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-2.1.0.tgz", + "integrity": "sha1-s12sN2R5+sw+lHR9QdDQ9SOP/LU=", "dev": true, "requires": { - "restore-cursor": "1.0.1" + "restore-cursor": "2.0.0" } }, "cli-width": { @@ -1524,12 +1568,34 @@ "string-width": "1.0.2", "strip-ansi": "3.0.1", "wrap-ansi": "2.1.0" + }, + "dependencies": { + "is-fullwidth-code-point": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", + "dev": true, + "requires": { + "number-is-nan": "1.0.1" + } + }, + "string-width": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "dev": true, + "requires": { + "code-point-at": "1.1.0", + "is-fullwidth-code-point": "1.0.0", + "strip-ansi": "3.0.1" + } + } } }, "clone": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/clone/-/clone-1.0.2.tgz", - "integrity": "sha1-Jgt6meux7f4kdTgXX3gyQ8sZ0Uk=", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/clone/-/clone-1.0.3.tgz", + "integrity": "sha1-KY1+IjFmD0DAA8LtMUDezz9TCF8=", "dev": true }, "clone-stats": { @@ -1567,9 +1633,9 @@ "dev": true }, "color-convert": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.0.tgz", - "integrity": "sha1-Gsz5fdc5uYO/mU1W/sj5WFNkG3o=", + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.1.tgz", + "integrity": "sha512-mjGanIiwQJskCC18rPR6OmrZ6fm2Lc7PeGFYwCmy5J34wC6F1PzdGL6xeMfmgicfYcNLGuVFA3WzXtIDCQSZxQ==", "dev": true, "requires": { "color-name": "1.1.3" @@ -1647,6 +1713,15 @@ "integrity": "sha512-b0553uYA5YAEGgyYIGYROzKQ7X5RAqedkfjiZxwi0kL1g3bOaBNNZfYkzt/CL0umgD5wc9Jec2FbB98CjkMRvQ==", "dev": true }, + "common-tags": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/common-tags/-/common-tags-1.4.0.tgz", + "integrity": "sha1-EYe+Tz1M8MBCfUP3Tu8fc1AWFMA=", + "dev": true, + "requires": { + "babel-runtime": "6.26.0" + } + }, "compare-func": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/compare-func/-/compare-func-1.3.2.tgz", @@ -1748,9 +1823,9 @@ "dev": true }, "content-type-parser": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/content-type-parser/-/content-type-parser-1.0.1.tgz", - "integrity": "sha1-w+VpiMU8ZRJ/tG1AMqOpACRv3JQ=", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/content-type-parser/-/content-type-parser-1.0.2.tgz", + "integrity": "sha512-lM4l4CnMEwOLHAHr/P6MEZwZFPJFtAAKgL6pogbXmVZggIqXhdB6RbBtPOTsw2FcXwYhehRGERJmRrjOiIB8pQ==", "dev": true }, "conventional-changelog": { @@ -1778,7 +1853,7 @@ "dev": true, "requires": { "compare-func": "1.3.2", - "q": "1.5.0" + "q": "1.5.1" } }, "conventional-changelog-atom": { @@ -1787,7 +1862,7 @@ "integrity": "sha512-6Nlu/+MiD4gi7k3Z+N1vMJWpaPSdvFPWzPGnH4OXewHAxiAl0L/TT9CGgA01fosPxmYr4hMNtD7kyN0tkg8vIA==", "dev": true, "requires": { - "q": "1.5.0" + "q": "1.5.1" } }, "conventional-changelog-cli": { @@ -1809,7 +1884,7 @@ "integrity": "sha512-jUbY98JoKdAOR5k3pOBiKZ+Iz9t2F84hL7x4WjSRW6x7FdeCEUOjyfml+YClE2h/h62Tf3mwur5jSO8upxxc1g==", "dev": true, "requires": { - "q": "1.5.0" + "q": "1.5.1" } }, "conventional-changelog-core": { @@ -1827,7 +1902,7 @@ "git-semver-tags": "1.2.2", "lodash": "4.17.4", "normalize-package-data": "2.4.0", - "q": "1.5.0", + "q": "1.5.1", "read-pkg": "1.1.0", "read-pkg-up": "1.0.1", "through2": "2.0.3" @@ -1851,7 +1926,7 @@ "integrity": "sha512-smsh0o/S95n22lrQZrSHYjJrxIGoFl+OFHK+q2KGHA2zRFrW7QilYM7VUjgmB+emzwqFguPjrq+D2U8iPhMNJg==", "dev": true, "requires": { - "q": "1.5.0" + "q": "1.5.1" } }, "conventional-changelog-eslint": { @@ -1860,7 +1935,7 @@ "integrity": "sha512-WGKnC0bGPD6BHGiRBfYqNGfy6DZDn2jGs1yxPRT8I2796wYdGqsbDF4477o4fdsxUJvckoW2OFPqkmRMQaCHSA==", "dev": true, "requires": { - "q": "1.5.0" + "q": "1.5.1" } }, "conventional-changelog-express": { @@ -1869,7 +1944,7 @@ "integrity": "sha512-ujSEmbWfozC1iIjH5Pl7AKtREowvAl10whs1q6c7nZLnoNZK5CmdB2PQ/V42O6rCgUzaLX+ACRW2+g0A/Htqvw==", "dev": true, "requires": { - "q": "1.5.0" + "q": "1.5.1" } }, "conventional-changelog-jquery": { @@ -1878,7 +1953,7 @@ "integrity": "sha1-Agg5cWLjhGmG5xJztsecW1+A9RA=", "dev": true, "requires": { - "q": "1.5.0" + "q": "1.5.1" } }, "conventional-changelog-jscs": { @@ -1887,7 +1962,7 @@ "integrity": "sha1-BHnrRDzH1yxYvwvPDvHURKkvDlw=", "dev": true, "requires": { - "q": "1.5.0" + "q": "1.5.1" } }, "conventional-changelog-jshint": { @@ -1897,7 +1972,7 @@ "dev": true, "requires": { "compare-func": "1.3.2", - "q": "1.5.0" + "q": "1.5.1" } }, "conventional-changelog-writer": { @@ -1909,7 +1984,7 @@ "compare-func": "1.3.2", "conventional-commits-filter": "1.0.0", "dateformat": "1.0.12", - "handlebars": "4.0.10", + "handlebars": "4.0.11", "json-stringify-safe": "5.0.1", "lodash": "4.17.4", "meow": "3.7.0", @@ -1946,8 +2021,8 @@ "integrity": "sha512-8od6g684Fhi5Vpp4ABRv/RBsW1AY6wSHbJHEK6FGTv+8jvAAnlABniZu/FVmX9TcirkHepaEsa1QGkRvbg0CKw==", "dev": true, "requires": { - "is-text-path": "1.0.1", "JSONStream": "1.3.1", + "is-text-path": "1.0.1", "lodash": "4.17.4", "meow": "3.7.0", "split2": "2.2.0", @@ -2004,6 +2079,15 @@ "elliptic": "6.4.0" } }, + "create-error-class": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/create-error-class/-/create-error-class-3.0.2.tgz", + "integrity": "sha1-Br56vvlHo/FKMP1hBnHUAbyot7Y=", + "dev": true, + "requires": { + "capture-stack-trace": "1.0.0" + } + }, "create-hash": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/create-hash/-/create-hash-1.1.3.tgz", @@ -2039,18 +2123,6 @@ "lru-cache": "4.1.1", "shebang-command": "1.2.0", "which": "1.3.0" - }, - "dependencies": { - "lru-cache": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.1.tgz", - "integrity": "sha512-q4spe4KTfsAS1SUHLO0wz8Qiyf1+vMIAgpRYioFYDMNqKfHQbg+AVDH3i4fvpl71/P1L0dBl+fQi+P37UYf0ew==", - "dev": true, - "requires": { - "pseudomap": "1.0.2", - "yallist": "2.1.2" - } - } } }, "cryptiles": { @@ -2074,9 +2146,9 @@ } }, "crypto-browserify": { - "version": "3.11.1", - "resolved": "https://registry.npmjs.org/crypto-browserify/-/crypto-browserify-3.11.1.tgz", - "integrity": "sha512-Na7ZlwCOqoaW5RwUK1WpXws2kv8mNhWdTlzob0UXulk6G9BDbyiJaGTYBIX61Ozn9l1EPPJpICZb4DaOpT9NlQ==", + "version": "3.12.0", + "resolved": "https://registry.npmjs.org/crypto-browserify/-/crypto-browserify-3.12.0.tgz", + "integrity": "sha512-fz4spIh+znjO2VjL+IdhEpRJ3YN6sMzITSBijk6FK2UvTqruSQW+/cCZTSNsMiZNvUeq0CqurF+dAbyiGOY6Wg==", "dev": true, "requires": { "browserify-cipher": "1.0.0", @@ -2088,7 +2160,8 @@ "inherits": "2.0.3", "pbkdf2": "3.0.14", "public-encrypt": "4.0.0", - "randombytes": "2.0.5" + "randombytes": "2.0.5", + "randomfill": "1.0.3" } }, "cssom": { @@ -2127,7 +2200,7 @@ "integrity": "sha1-dUu1v+VUUdpppYuU1F9MWwRi1Y8=", "dev": true, "requires": { - "es5-ext": "0.10.31" + "es5-ext": "0.10.35" } }, "dargs": { @@ -2198,6 +2271,12 @@ } } }, + "deep-extend": { + "version": "0.4.2", + "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.4.2.tgz", + "integrity": "sha1-SLaZwn4zS/ifEIkr5DL25MfTSn8=", + "dev": true + }, "deep-is": { "version": "0.1.3", "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", @@ -2210,7 +2289,7 @@ "integrity": "sha1-xlYFHpgX2f8I7YgUd/P+QBnz730=", "dev": true, "requires": { - "clone": "1.0.2" + "clone": "1.0.3" } }, "define-properties": { @@ -2341,10 +2420,16 @@ "randombytes": "2.0.5" } }, + "dlv": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/dlv/-/dlv-1.1.0.tgz", + "integrity": "sha1-/uGnxD9jvnXz9nnoUmLaXxAnZKc=", + "dev": true + }, "doctrine": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-1.5.0.tgz", - "integrity": "sha1-N53Ocw9hZvds76TmcHoVmwLFpvo=", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.0.0.tgz", + "integrity": "sha1-xz2NKQnSIpHhoAejlYBNqLZl/mM=", "dev": true, "requires": { "esutils": "2.0.2", @@ -2393,6 +2478,12 @@ "readable-stream": "2.3.3" } }, + "duplexer3": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/duplexer3/-/duplexer3-0.1.4.tgz", + "integrity": "sha1-7gHdHKwO08vH/b6jfcCo8c4ALOI=", + "dev": true + }, "duplexify": { "version": "3.5.1", "resolved": "https://registry.npmjs.org/duplexify/-/duplexify-3.5.1.tgz", @@ -2416,6 +2507,16 @@ } } }, + "ecc-jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz", + "integrity": "sha1-D8c6ntXw1Tw4GTOYUj735UN3dQU=", + "dev": true, + "optional": true, + "requires": { + "jsbn": "0.1.1" + } + }, "ee-first": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", @@ -2423,9 +2524,9 @@ "dev": true }, "electron-to-chromium": { - "version": "1.3.25", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.25.tgz", - "integrity": "sha1-RTshAJg20Jl9hgNWAf9srkeRxGA=", + "version": "1.3.27", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.27.tgz", + "integrity": "sha1-eOy4o5kGYYe7N07t412ccFZagD0=", "dev": true }, "elliptic": { @@ -2449,6 +2550,15 @@ "integrity": "sha1-eePVhlU0aQn+bw9Fpd5oEDspTSA=", "dev": true }, + "encoding": { + "version": "0.1.12", + "resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.12.tgz", + "integrity": "sha1-U4tm8+5izRq1HsMjgp0flIDHS+s=", + "dev": true, + "requires": { + "iconv-lite": "0.4.19" + } + }, "end-of-stream": { "version": "0.1.5", "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-0.1.5.tgz", @@ -2597,23 +2707,23 @@ } }, "es5-ext": { - "version": "0.10.31", - "resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.31.tgz", - "integrity": "sha1-e7k4yVp/G59ygJLcCcQe3MOY7v4=", + "version": "0.10.35", + "resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.35.tgz", + "integrity": "sha1-GO6FjOajxFx9eekcFfzKnsVoSU8=", "dev": true, "requires": { - "es6-iterator": "2.0.1", + "es6-iterator": "2.0.3", "es6-symbol": "3.1.1" } }, "es6-iterator": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/es6-iterator/-/es6-iterator-2.0.1.tgz", - "integrity": "sha1-jjGcnwRTv1ddN0lAplWSDlnKVRI=", + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/es6-iterator/-/es6-iterator-2.0.3.tgz", + "integrity": "sha1-p96IkUGgWpSwhUQDstCg+/qY87c=", "dev": true, "requires": { "d": "1.0.0", - "es5-ext": "0.10.31", + "es5-ext": "0.10.35", "es6-symbol": "3.1.1" } }, @@ -2624,8 +2734,8 @@ "dev": true, "requires": { "d": "1.0.0", - "es5-ext": "0.10.31", - "es6-iterator": "2.0.1", + "es5-ext": "0.10.35", + "es6-iterator": "2.0.3", "es6-set": "0.1.5", "es6-symbol": "3.1.1", "event-emitter": "0.3.5" @@ -2643,176 +2753,120 @@ "lodash": "4.17.4", "posix-getopt": "1.2.0", "typhonjs-escomplex": "0.0.12" - } - }, - "es6-set": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/es6-set/-/es6-set-0.1.5.tgz", - "integrity": "sha1-0rPsXU2ADO2BjbU40ol02wpzzLE=", - "dev": true, - "requires": { - "d": "1.0.0", - "es5-ext": "0.10.31", - "es6-iterator": "2.0.1", - "es6-symbol": "3.1.1", - "event-emitter": "0.3.5" - } - }, - "es6-symbol": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/es6-symbol/-/es6-symbol-3.1.1.tgz", - "integrity": "sha1-vwDvT9q2uhtG7Le2KbTH7VcVzHc=", - "dev": true, - "requires": { - "d": "1.0.0", - "es5-ext": "0.10.31" - } - }, - "es6-weak-map": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/es6-weak-map/-/es6-weak-map-2.0.2.tgz", - "integrity": "sha1-XjqzIlH/0VOKH45f+hNXdy+S2W8=", - "dev": true, - "requires": { - "d": "1.0.0", - "es5-ext": "0.10.31", - "es6-iterator": "2.0.1", - "es6-symbol": "3.1.1" - } - }, - "escape-html": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", - "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=", - "dev": true - }, - "escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", - "dev": true - }, - "escodegen": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.9.0.tgz", - "integrity": "sha512-v0MYvNQ32bzwoG2OSFzWAkuahDQHK92JBN0pTAALJ4RIxEZe766QJPDR8Hqy7XNUy5K3fnVL76OqYAdc4TZEIw==", - "dev": true, - "requires": { - "esprima": "3.1.3", - "estraverse": "4.2.0", - "esutils": "2.0.2", - "optionator": "0.8.2", - "source-map": "0.5.7" }, "dependencies": { - "esprima": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-3.1.3.tgz", - "integrity": "sha1-/cpRzuYTOJXjyI1TXOSdv/YqRjM=", + "ajv": { + "version": "4.11.8", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-4.11.8.tgz", + "integrity": "sha1-gv+wKynmYq5TvcIK8VlHcGc5xTY=", + "dev": true, + "requires": { + "co": "4.6.0", + "json-stable-stringify": "1.0.1" + } + }, + "ajv-keywords": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-1.5.1.tgz", + "integrity": "sha1-MU3QpLM2j609/NxU7eYXG4htrzw=", "dev": true - } - } - }, - "escomplex-plugin-metrics-module": { - "version": "0.0.13", - "resolved": "https://registry.npmjs.org/escomplex-plugin-metrics-module/-/escomplex-plugin-metrics-module-0.0.13.tgz", - "integrity": "sha1-uj/ir5obBi3uDhMJO3HtOJodcWg=", - "dev": true, - "requires": { - "typhonjs-escomplex-commons": "0.0.16" - } - }, - "escomplex-plugin-metrics-project": { - "version": "0.0.13", - "resolved": "https://registry.npmjs.org/escomplex-plugin-metrics-project/-/escomplex-plugin-metrics-project-0.0.13.tgz", - "integrity": "sha1-cDSXc/DEsZPVjyHqEDLRN1vvD0U=", - "dev": true, - "requires": { - "typhonjs-escomplex-commons": "0.0.16" - } - }, - "escomplex-plugin-syntax-babylon": { - "version": "0.0.13", - "resolved": "https://registry.npmjs.org/escomplex-plugin-syntax-babylon/-/escomplex-plugin-syntax-babylon-0.0.13.tgz", - "integrity": "sha1-bh8pnyAR1IfdK0rOtxQ4SKC/23I=", - "dev": true, - "requires": { - "escomplex-plugin-syntax-estree": "0.0.13", - "typhonjs-escomplex-commons": "0.0.16" - } - }, - "escomplex-plugin-syntax-estree": { - "version": "0.0.13", - "resolved": "https://registry.npmjs.org/escomplex-plugin-syntax-estree/-/escomplex-plugin-syntax-estree-0.0.13.tgz", - "integrity": "sha1-/BKGZxuMpo8fC4Abc2SwNBgvIUU=", - "dev": true, - "requires": { - "typhonjs-escomplex-commons": "0.0.16" - } - }, - "escope": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/escope/-/escope-3.6.0.tgz", - "integrity": "sha1-4Bl16BJ4GhY6ba392AOY3GTIicM=", - "dev": true, - "requires": { - "es6-map": "0.1.5", - "es6-weak-map": "2.0.2", - "esrecurse": "4.2.0", - "estraverse": "4.2.0" - } - }, - "eslint": { - "version": "3.19.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-3.19.0.tgz", - "integrity": "sha1-yPxiAcf0DdCJQbh8CFdnOGpnmsw=", - "dev": true, - "requires": { - "babel-code-frame": "6.26.0", - "chalk": "1.1.3", - "concat-stream": "1.5.2", - "debug": "2.6.9", - "doctrine": "2.0.0", - "escope": "3.6.0", - "espree": "3.5.1", - "esquery": "1.0.0", - "estraverse": "4.2.0", - "esutils": "2.0.2", - "file-entry-cache": "2.0.0", - "glob": "7.1.2", - "globals": "9.18.0", - "ignore": "3.3.5", - "imurmurhash": "0.1.4", - "inquirer": "0.12.0", - "is-my-json-valid": "2.16.1", - "is-resolvable": "1.0.0", - "js-yaml": "3.10.0", - "json-stable-stringify": "1.0.1", - "levn": "0.3.0", - "lodash": "4.17.4", - "mkdirp": "0.5.1", - "natural-compare": "1.4.0", - "optionator": "0.8.2", - "path-is-inside": "1.0.2", - "pluralize": "1.2.1", - "progress": "1.1.8", - "require-uncached": "1.0.3", - "shelljs": "0.7.8", - "strip-bom": "3.0.0", - "strip-json-comments": "2.0.1", - "table": "3.8.3", - "text-table": "0.2.0", - "user-home": "2.0.0" - }, - "dependencies": { - "doctrine": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.0.0.tgz", - "integrity": "sha1-xz2NKQnSIpHhoAejlYBNqLZl/mM=", + }, + "ansi-escapes": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-1.4.0.tgz", + "integrity": "sha1-06ioOzGapneTZisT52HHkRQiMG4=", + "dev": true + }, + "cli-cursor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-1.0.2.tgz", + "integrity": "sha1-ZNo/fValRBLll5S9Ytw1KV6PKYc=", + "dev": true, + "requires": { + "restore-cursor": "1.0.1" + } + }, + "eslint": { + "version": "3.19.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-3.19.0.tgz", + "integrity": "sha1-yPxiAcf0DdCJQbh8CFdnOGpnmsw=", "dev": true, "requires": { + "babel-code-frame": "6.26.0", + "chalk": "1.1.3", + "concat-stream": "1.5.2", + "debug": "2.6.9", + "doctrine": "2.0.0", + "escope": "3.6.0", + "espree": "3.5.1", + "esquery": "1.0.0", + "estraverse": "4.2.0", "esutils": "2.0.2", - "isarray": "1.0.0" + "file-entry-cache": "2.0.0", + "glob": "7.1.2", + "globals": "9.18.0", + "ignore": "3.3.7", + "imurmurhash": "0.1.4", + "inquirer": "0.12.0", + "is-my-json-valid": "2.16.1", + "is-resolvable": "1.0.0", + "js-yaml": "3.10.0", + "json-stable-stringify": "1.0.1", + "levn": "0.3.0", + "lodash": "4.17.4", + "mkdirp": "0.5.1", + "natural-compare": "1.4.0", + "optionator": "0.8.2", + "path-is-inside": "1.0.2", + "pluralize": "1.2.1", + "progress": "1.1.8", + "require-uncached": "1.0.3", + "shelljs": "0.7.8", + "strip-bom": "3.0.0", + "strip-json-comments": "2.0.1", + "table": "3.8.3", + "text-table": "0.2.0", + "user-home": "2.0.0" + } + }, + "figures": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/figures/-/figures-1.7.0.tgz", + "integrity": "sha1-y+Hjr/zxzUS4DK3+0o3Hk6lwHS4=", + "dev": true, + "requires": { + "escape-string-regexp": "1.0.5", + "object-assign": "4.1.1" + } + }, + "inquirer": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-0.12.0.tgz", + "integrity": "sha1-HvK/1jUE3wvHV4X/+MLEHfEvB34=", + "dev": true, + "requires": { + "ansi-escapes": "1.4.0", + "ansi-regex": "2.1.1", + "chalk": "1.1.3", + "cli-cursor": "1.0.2", + "cli-width": "2.2.0", + "figures": "1.7.0", + "lodash": "4.17.4", + "readline2": "1.0.1", + "run-async": "0.1.0", + "rx-lite": "3.1.2", + "string-width": "1.0.2", + "strip-ansi": "3.0.1", + "through": "2.3.8" + } + }, + "is-fullwidth-code-point": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", + "dev": true, + "requires": { + "number-is-nan": "1.0.1" } }, "json-stable-stringify": { @@ -2824,12 +2878,119 @@ "jsonify": "0.0.0" } }, + "onetime": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-1.1.0.tgz", + "integrity": "sha1-ofeDj4MUxRbwXs78vEzP4EtO14k=", + "dev": true + }, + "pluralize": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/pluralize/-/pluralize-1.2.1.tgz", + "integrity": "sha1-0aIUg/0iu0HlihL6NCGCMUCJfEU=", + "dev": true + }, + "progress": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/progress/-/progress-1.1.8.tgz", + "integrity": "sha1-4mDHj2Fhzdmw5WzD4Khd4Xx6V74=", + "dev": true + }, + "restore-cursor": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-1.0.1.tgz", + "integrity": "sha1-NGYfRohjJ/7SmRR5FSJS35LapUE=", + "dev": true, + "requires": { + "exit-hook": "1.1.1", + "onetime": "1.1.0" + } + }, + "run-async": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/run-async/-/run-async-0.1.0.tgz", + "integrity": "sha1-yK1KXhEGYeQCp9IbUw4AnyX444k=", + "dev": true, + "requires": { + "once": "1.4.0" + } + }, + "rx-lite": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/rx-lite/-/rx-lite-3.1.2.tgz", + "integrity": "sha1-Gc5QLKVyZl87ZHsQk5+X/RYV8QI=", + "dev": true + }, + "slice-ansi": { + "version": "0.0.4", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-0.0.4.tgz", + "integrity": "sha1-7b+JA/ZvfOL46v1s7tZeJkyDGzU=", + "dev": true + }, + "string-width": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "dev": true, + "requires": { + "code-point-at": "1.1.0", + "is-fullwidth-code-point": "1.0.0", + "strip-ansi": "3.0.1" + } + }, "strip-bom": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", "dev": true }, + "table": { + "version": "3.8.3", + "resolved": "https://registry.npmjs.org/table/-/table-3.8.3.tgz", + "integrity": "sha1-K7xULw/amGGnVdOUf+/Ys/UThV8=", + "dev": true, + "requires": { + "ajv": "4.11.8", + "ajv-keywords": "1.5.1", + "chalk": "1.1.3", + "lodash": "4.17.4", + "slice-ansi": "0.0.4", + "string-width": "2.1.1" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + }, + "string-width": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "dev": true, + "requires": { + "is-fullwidth-code-point": "2.0.0", + "strip-ansi": "4.0.0" + } + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "3.0.0" + } + } + } + }, "user-home": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/user-home/-/user-home-2.0.0.tgz", @@ -2841,65 +3002,326 @@ } } }, - "eslint-plugin-react": { - "version": "6.10.3", - "resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-6.10.3.tgz", - "integrity": "sha1-xUNb6wZ3ThLH2y9qut3L+QDNP3g=", + "es6-set": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/es6-set/-/es6-set-0.1.5.tgz", + "integrity": "sha1-0rPsXU2ADO2BjbU40ol02wpzzLE=", "dev": true, "requires": { - "array.prototype.find": "2.0.4", - "doctrine": "1.5.0", - "has": "1.0.1", - "jsx-ast-utils": "1.4.1", - "object.assign": "4.0.4" + "d": "1.0.0", + "es5-ext": "0.10.35", + "es6-iterator": "2.0.3", + "es6-symbol": "3.1.1", + "event-emitter": "0.3.5" } }, - "espree": { - "version": "3.5.1", - "resolved": "https://registry.npmjs.org/espree/-/espree-3.5.1.tgz", - "integrity": "sha1-DJiLirRttTEAoZVK5LqZXd0n2H4=", + "es6-symbol": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/es6-symbol/-/es6-symbol-3.1.1.tgz", + "integrity": "sha1-vwDvT9q2uhtG7Le2KbTH7VcVzHc=", "dev": true, "requires": { - "acorn": "5.1.2", - "acorn-jsx": "3.0.1" - }, - "dependencies": { - "acorn": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.1.2.tgz", - "integrity": "sha512-o96FZLJBPY1lvTuJylGA9Bk3t/GKPPJG8H0ydQQl01crzwJgspa4AEIq/pVTXigmK0PHVQhiAtn8WMBLL9D2WA==", - "dev": true - } + "d": "1.0.0", + "es5-ext": "0.10.35" } }, - "esprima": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.0.tgz", - "integrity": "sha512-oftTcaMu/EGrEIu904mWteKIv8vMuOgGYo7EhVJJN00R/EED9DCua/xxHRdYnKtcECzVg7xOWhflvJMnqcFZjw==", - "dev": true - }, - "esquery": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.0.0.tgz", - "integrity": "sha1-z7qLV9f7qT8XKYqKAGoEzaE9gPo=", + "es6-weak-map": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/es6-weak-map/-/es6-weak-map-2.0.2.tgz", + "integrity": "sha1-XjqzIlH/0VOKH45f+hNXdy+S2W8=", "dev": true, "requires": { - "estraverse": "4.2.0" + "d": "1.0.0", + "es5-ext": "0.10.35", + "es6-iterator": "2.0.3", + "es6-symbol": "3.1.1" } }, - "esrecurse": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.2.0.tgz", - "integrity": "sha1-+pVo2Y04I/mkHZHpAtyrnqblsWM=", - "dev": true, - "requires": { - "estraverse": "4.2.0", - "object-assign": "4.1.1" - } + "escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=", + "dev": true }, - "estraverse": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.2.0.tgz", + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "dev": true + }, + "escodegen": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.9.0.tgz", + "integrity": "sha512-v0MYvNQ32bzwoG2OSFzWAkuahDQHK92JBN0pTAALJ4RIxEZe766QJPDR8Hqy7XNUy5K3fnVL76OqYAdc4TZEIw==", + "dev": true, + "requires": { + "esprima": "3.1.3", + "estraverse": "4.2.0", + "esutils": "2.0.2", + "optionator": "0.8.2", + "source-map": "0.5.7" + }, + "dependencies": { + "esprima": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-3.1.3.tgz", + "integrity": "sha1-/cpRzuYTOJXjyI1TXOSdv/YqRjM=", + "dev": true + } + } + }, + "escomplex-plugin-metrics-module": { + "version": "0.0.13", + "resolved": "https://registry.npmjs.org/escomplex-plugin-metrics-module/-/escomplex-plugin-metrics-module-0.0.13.tgz", + "integrity": "sha1-uj/ir5obBi3uDhMJO3HtOJodcWg=", + "dev": true, + "requires": { + "typhonjs-escomplex-commons": "0.0.16" + } + }, + "escomplex-plugin-metrics-project": { + "version": "0.0.13", + "resolved": "https://registry.npmjs.org/escomplex-plugin-metrics-project/-/escomplex-plugin-metrics-project-0.0.13.tgz", + "integrity": "sha1-cDSXc/DEsZPVjyHqEDLRN1vvD0U=", + "dev": true, + "requires": { + "typhonjs-escomplex-commons": "0.0.16" + } + }, + "escomplex-plugin-syntax-babylon": { + "version": "0.0.13", + "resolved": "https://registry.npmjs.org/escomplex-plugin-syntax-babylon/-/escomplex-plugin-syntax-babylon-0.0.13.tgz", + "integrity": "sha1-bh8pnyAR1IfdK0rOtxQ4SKC/23I=", + "dev": true, + "requires": { + "escomplex-plugin-syntax-estree": "0.0.13", + "typhonjs-escomplex-commons": "0.0.16" + } + }, + "escomplex-plugin-syntax-estree": { + "version": "0.0.13", + "resolved": "https://registry.npmjs.org/escomplex-plugin-syntax-estree/-/escomplex-plugin-syntax-estree-0.0.13.tgz", + "integrity": "sha1-/BKGZxuMpo8fC4Abc2SwNBgvIUU=", + "dev": true, + "requires": { + "typhonjs-escomplex-commons": "0.0.16" + } + }, + "escope": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/escope/-/escope-3.6.0.tgz", + "integrity": "sha1-4Bl16BJ4GhY6ba392AOY3GTIicM=", + "dev": true, + "requires": { + "es6-map": "0.1.5", + "es6-weak-map": "2.0.2", + "esrecurse": "4.2.0", + "estraverse": "4.2.0" + } + }, + "eslint": { + "version": "4.10.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-4.10.0.tgz", + "integrity": "sha512-MMVl8P/dYUFZEvolL8PYt7qc5LNdS2lwheq9BYa5Y07FblhcZqFyaUqlS8TW5QITGex21tV4Lk0a3fK8lsJIkA==", + "dev": true, + "requires": { + "ajv": "5.3.0", + "babel-code-frame": "6.26.0", + "chalk": "2.3.0", + "concat-stream": "1.6.0", + "cross-spawn": "5.1.0", + "debug": "3.1.0", + "doctrine": "2.0.0", + "eslint-scope": "3.7.1", + "espree": "3.5.1", + "esquery": "1.0.0", + "estraverse": "4.2.0", + "esutils": "2.0.2", + "file-entry-cache": "2.0.0", + "functional-red-black-tree": "1.0.1", + "glob": "7.1.2", + "globals": "9.18.0", + "ignore": "3.3.7", + "imurmurhash": "0.1.4", + "inquirer": "3.3.0", + "is-resolvable": "1.0.0", + "js-yaml": "3.10.0", + "json-stable-stringify": "1.0.1", + "levn": "0.3.0", + "lodash": "4.17.4", + "minimatch": "3.0.4", + "mkdirp": "0.5.1", + "natural-compare": "1.4.0", + "optionator": "0.8.2", + "path-is-inside": "1.0.2", + "pluralize": "7.0.0", + "progress": "2.0.0", + "require-uncached": "1.0.3", + "semver": "5.4.1", + "strip-ansi": "4.0.0", + "strip-json-comments": "2.0.1", + "table": "4.0.2", + "text-table": "0.2.0" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "ansi-styles": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", + "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", + "dev": true, + "requires": { + "color-convert": "1.9.1" + } + }, + "chalk": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.0.tgz", + "integrity": "sha512-Az5zJR2CBujap2rqXGaJKaPHyJ0IrUimvYNX+ncCy8PJP4ltOGTrHUIo097ZaL2zMeKYpiCdqDvS6zdrTFok3Q==", + "dev": true, + "requires": { + "ansi-styles": "3.2.0", + "escape-string-regexp": "1.0.5", + "supports-color": "4.5.0" + } + }, + "concat-stream": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.0.tgz", + "integrity": "sha1-CqxmL9Ur54lk1VMvaUeE5wEQrPc=", + "dev": true, + "requires": { + "inherits": "2.0.3", + "readable-stream": "2.3.3", + "typedarray": "0.0.6" + } + }, + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "json-stable-stringify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz", + "integrity": "sha1-mnWdOcXy/1A/1TAGRu1EX4jE+a8=", + "dev": true, + "requires": { + "jsonify": "0.0.0" + } + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "3.0.0" + } + }, + "supports-color": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz", + "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=", + "dev": true, + "requires": { + "has-flag": "2.0.0" + } + } + } + }, + "eslint-config-google": { + "version": "0.9.1", + "resolved": "https://registry.npmjs.org/eslint-config-google/-/eslint-config-google-0.9.1.tgz", + "integrity": "sha512-5A83D+lH0PA81QMESKbLJd/a3ic8tPZtwUmqNrxMRo54nfFaUvtt89q/+icQ+fd66c2xQHn0KyFkzJDoAUfpZA==", + "dev": true + }, + "eslint-config-liferay": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/eslint-config-liferay/-/eslint-config-liferay-2.0.7.tgz", + "integrity": "sha512-sOXz2t4XJ4QRjqElsGCb5cpPoYtFbsfYg7LBWXpuI7Xx5aVAK7Lr8xIWQxx8QEGmXkW28STP+WSmj7YEd3TxPw==", + "dev": true, + "requires": { + "eslint-config-google": "0.9.1" + } + }, + "eslint-plugin-react": { + "version": "7.4.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.4.0.tgz", + "integrity": "sha512-tvjU9u3VqmW2vVuYnE8Qptq+6ji4JltjOjJ9u7VAOxVYkUkyBZWRvNYKbDv5fN+L6wiA+4we9+qQahZ0m63XEA==", + "dev": true, + "requires": { + "doctrine": "2.0.0", + "has": "1.0.1", + "jsx-ast-utils": "2.0.1", + "prop-types": "15.6.0" + } + }, + "eslint-scope": { + "version": "3.7.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-3.7.1.tgz", + "integrity": "sha1-PWPD7f2gLgbgGkUq2IyqzHzctug=", + "dev": true, + "requires": { + "esrecurse": "4.2.0", + "estraverse": "4.2.0" + } + }, + "espree": { + "version": "3.5.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-3.5.1.tgz", + "integrity": "sha1-DJiLirRttTEAoZVK5LqZXd0n2H4=", + "dev": true, + "requires": { + "acorn": "5.2.1", + "acorn-jsx": "3.0.1" + }, + "dependencies": { + "acorn": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.2.1.tgz", + "integrity": "sha512-jG0u7c4Ly+3QkkW18V+NRDN+4bWHdln30NL1ZL2AvFZZmQe/BfopYCtghCKKVBUSetZ4QKcyA0pY6/4Gw8Pv8w==", + "dev": true + } + } + }, + "esprima": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.0.tgz", + "integrity": "sha512-oftTcaMu/EGrEIu904mWteKIv8vMuOgGYo7EhVJJN00R/EED9DCua/xxHRdYnKtcECzVg7xOWhflvJMnqcFZjw==", + "dev": true + }, + "esquery": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.0.0.tgz", + "integrity": "sha1-z7qLV9f7qT8XKYqKAGoEzaE9gPo=", + "dev": true, + "requires": { + "estraverse": "4.2.0" + } + }, + "esrecurse": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.2.0.tgz", + "integrity": "sha1-+pVo2Y04I/mkHZHpAtyrnqblsWM=", + "dev": true, + "requires": { + "estraverse": "4.2.0", + "object-assign": "4.1.1" + } + }, + "estraverse": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.2.0.tgz", "integrity": "sha1-De4/7TH81GlhjOc0IJn8GvoL2xM=", "dev": true }, @@ -2916,7 +3338,7 @@ "dev": true, "requires": { "d": "1.0.0", - "es5-ext": "0.10.31" + "es5-ext": "0.10.35" } }, "eventemitter3": { @@ -3061,25 +3483,8 @@ "dev": true, "requires": { "iconv-lite": "0.4.19", - "jschardet": "1.5.1", + "jschardet": "1.6.0", "tmp": "0.0.33" - }, - "dependencies": { - "iconv-lite": { - "version": "0.4.19", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.19.tgz", - "integrity": "sha512-oTZqweIP51xaGPI4uPa56/Pri/480R+mo7SeU+YETByQNhDG55ycFyNLIgta9vXhILrxXDmF7ZGhqZIcuN0gJQ==", - "dev": true - }, - "tmp": { - "version": "0.0.33", - "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", - "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", - "dev": true, - "requires": { - "os-tmpdir": "1.0.2" - } - } } }, "extglob": { @@ -3113,20 +3518,48 @@ "integrity": "sha1-liVqO8l1WV6zbYLpkp0GDYk0Of8=", "dev": true }, + "fast-json-stable-stringify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", + "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=", + "dev": true + }, "fast-levenshtein": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", "dev": true }, - "figures": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/figures/-/figures-1.7.0.tgz", - "integrity": "sha1-y+Hjr/zxzUS4DK3+0o3Hk6lwHS4=", + "fbjs": { + "version": "0.8.16", + "resolved": "https://registry.npmjs.org/fbjs/-/fbjs-0.8.16.tgz", + "integrity": "sha1-XmdDL1UNxBtXK/VYR7ispk5TN9s=", "dev": true, "requires": { - "escape-string-regexp": "1.0.5", - "object-assign": "4.1.1" + "core-js": "1.2.7", + "isomorphic-fetch": "2.2.1", + "loose-envify": "1.3.1", + "object-assign": "4.1.1", + "promise": "7.3.1", + "setimmediate": "1.0.5", + "ua-parser-js": "0.7.17" + }, + "dependencies": { + "core-js": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-1.2.7.tgz", + "integrity": "sha1-ZSKUwUZR2yj6k70tX/KYOk8IxjY=", + "dev": true + } + } + }, + "figures": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/figures/-/figures-2.0.0.tgz", + "integrity": "sha1-OrGi0qYsi/tDGgyUy3l6L84nyWI=", + "dev": true, + "requires": { + "escape-string-regexp": "1.0.5" } }, "file-entry-cache": { @@ -3171,6 +3604,14 @@ "parseurl": "1.3.2", "statuses": "1.3.1", "unpipe": "1.0.0" + }, + "dependencies": { + "statuses": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.3.1.tgz", + "integrity": "sha1-+vUbnrdKrvOzrPStX2Gr8ky3uT4=", + "dev": true + } } }, "find-index": { @@ -3220,125 +3661,1030 @@ "integrity": "sha1-l+gBqgUt8CRU3kawK/YhZCzchQI=", "dev": true, "requires": { - "homedir-polyfill": "1.0.1" + "homedir-polyfill": "1.0.1" + } + } + } + }, + "first-chunk-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/first-chunk-stream/-/first-chunk-stream-1.0.0.tgz", + "integrity": "sha1-Wb+1DNkF9g18OUzT2ayqtOatk04=", + "dev": true + }, + "flagged-respawn": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/flagged-respawn/-/flagged-respawn-0.3.2.tgz", + "integrity": "sha1-/xke3c1wiKZ1smEP/8l2vpuAdLU=", + "dev": true + }, + "flat-cache": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-1.3.0.tgz", + "integrity": "sha1-0wMLMrOBVPTjt+nHCfSQ9++XxIE=", + "dev": true, + "requires": { + "circular-json": "0.3.3", + "del": "2.2.2", + "graceful-fs": "4.1.11", + "write": "0.2.1" + } + }, + "for-in": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", + "integrity": "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=", + "dev": true + }, + "for-own": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/for-own/-/for-own-0.1.5.tgz", + "integrity": "sha1-UmXGgaTylNq78XyVCbZ2OqhFEM4=", + "dev": true, + "requires": { + "for-in": "1.0.2" + } + }, + "foreach": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/foreach/-/foreach-2.0.5.tgz", + "integrity": "sha1-C+4AUBiusmDQo6865ljdATbsG5k=", + "dev": true + }, + "forever-agent": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", + "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=", + "dev": true + }, + "fork-stream": { + "version": "0.0.4", + "resolved": "https://registry.npmjs.org/fork-stream/-/fork-stream-0.0.4.tgz", + "integrity": "sha1-24Sfznf2cIpfjzhq5TOgkHtUrnA=", + "dev": true + }, + "form-data": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.1.tgz", + "integrity": "sha1-b7lPvXGIUwbXPRXMSX/kzE7NRL8=", + "dev": true, + "requires": { + "asynckit": "0.4.0", + "combined-stream": "1.0.5", + "mime-types": "2.1.17" + } + }, + "formatio": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/formatio/-/formatio-1.1.1.tgz", + "integrity": "sha1-XtPM1jZVEJc4NGXZlhmRAOhhYek=", + "dev": true, + "requires": { + "samsam": "1.1.2" + } + }, + "fs-access": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/fs-access/-/fs-access-1.0.1.tgz", + "integrity": "sha1-1qh/JiJxzv6+wwxVNAf7mV2od3o=", + "dev": true, + "requires": { + "null-check": "1.0.0" + } + }, + "fs-exists-sync": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/fs-exists-sync/-/fs-exists-sync-0.1.0.tgz", + "integrity": "sha1-mC1ok6+RjnLQjeyehnP/K1qNat0=", + "dev": true + }, + "fs-extra": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-2.1.2.tgz", + "integrity": "sha1-BGxwFjzvmq1GsOSn+kZ/si1x3jU=", + "dev": true, + "requires": { + "graceful-fs": "4.1.11", + "jsonfile": "2.4.0" + } + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "dev": true + }, + "fsevents": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.1.2.tgz", + "integrity": "sha512-Sn44E5wQW4bTHXvQmvSHwqbuiXtduD6Rrjm2ZtUEGbyrig+nUH3t/QD4M4/ZXViY556TBpRgZkHLDx3JxPwxiw==", + "dev": true, + "optional": true, + "requires": { + "nan": "2.7.0", + "node-pre-gyp": "0.6.36" + }, + "dependencies": { + "abbrev": { + "version": "1.1.0", + "bundled": true, + "dev": true, + "optional": true + }, + "ajv": { + "version": "4.11.8", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "co": "4.6.0", + "json-stable-stringify": "1.0.1" + } + }, + "ansi-regex": { + "version": "2.1.1", + "bundled": true, + "dev": true + }, + "aproba": { + "version": "1.1.1", + "bundled": true, + "dev": true, + "optional": true + }, + "are-we-there-yet": { + "version": "1.1.4", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "delegates": "1.0.0", + "readable-stream": "2.2.9" + } + }, + "asn1": { + "version": "0.2.3", + "bundled": true, + "dev": true, + "optional": true + }, + "assert-plus": { + "version": "0.2.0", + "bundled": true, + "dev": true, + "optional": true + }, + "asynckit": { + "version": "0.4.0", + "bundled": true, + "dev": true, + "optional": true + }, + "aws-sign2": { + "version": "0.6.0", + "bundled": true, + "dev": true, + "optional": true + }, + "aws4": { + "version": "1.6.0", + "bundled": true, + "dev": true, + "optional": true + }, + "balanced-match": { + "version": "0.4.2", + "bundled": true, + "dev": true + }, + "bcrypt-pbkdf": { + "version": "1.0.1", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "tweetnacl": "0.14.5" + } + }, + "block-stream": { + "version": "0.0.9", + "bundled": true, + "dev": true, + "requires": { + "inherits": "2.0.3" + } + }, + "boom": { + "version": "2.10.1", + "bundled": true, + "dev": true, + "requires": { + "hoek": "2.16.3" + } + }, + "brace-expansion": { + "version": "1.1.7", + "bundled": true, + "dev": true, + "requires": { + "balanced-match": "0.4.2", + "concat-map": "0.0.1" + } + }, + "buffer-shims": { + "version": "1.0.0", + "bundled": true, + "dev": true + }, + "caseless": { + "version": "0.12.0", + "bundled": true, + "dev": true, + "optional": true + }, + "co": { + "version": "4.6.0", + "bundled": true, + "dev": true, + "optional": true + }, + "code-point-at": { + "version": "1.1.0", + "bundled": true, + "dev": true + }, + "combined-stream": { + "version": "1.0.5", + "bundled": true, + "dev": true, + "requires": { + "delayed-stream": "1.0.0" + } + }, + "concat-map": { + "version": "0.0.1", + "bundled": true, + "dev": true + }, + "console-control-strings": { + "version": "1.1.0", + "bundled": true, + "dev": true + }, + "core-util-is": { + "version": "1.0.2", + "bundled": true, + "dev": true + }, + "cryptiles": { + "version": "2.0.5", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "boom": "2.10.1" + } + }, + "dashdash": { + "version": "1.14.1", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "assert-plus": "1.0.0" + }, + "dependencies": { + "assert-plus": { + "version": "1.0.0", + "bundled": true, + "dev": true, + "optional": true + } + } + }, + "debug": { + "version": "2.6.8", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "ms": "2.0.0" + } + }, + "deep-extend": { + "version": "0.4.2", + "bundled": true, + "dev": true, + "optional": true + }, + "delayed-stream": { + "version": "1.0.0", + "bundled": true, + "dev": true + }, + "delegates": { + "version": "1.0.0", + "bundled": true, + "dev": true, + "optional": true + }, + "ecc-jsbn": { + "version": "0.1.1", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "jsbn": "0.1.1" + } + }, + "extend": { + "version": "3.0.1", + "bundled": true, + "dev": true, + "optional": true + }, + "extsprintf": { + "version": "1.0.2", + "bundled": true, + "dev": true + }, + "forever-agent": { + "version": "0.6.1", + "bundled": true, + "dev": true, + "optional": true + }, + "form-data": { + "version": "2.1.4", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "asynckit": "0.4.0", + "combined-stream": "1.0.5", + "mime-types": "2.1.15" + } + }, + "fs.realpath": { + "version": "1.0.0", + "bundled": true, + "dev": true + }, + "fstream": { + "version": "1.0.11", + "bundled": true, + "dev": true, + "requires": { + "graceful-fs": "4.1.11", + "inherits": "2.0.3", + "mkdirp": "0.5.1", + "rimraf": "2.6.1" + } + }, + "fstream-ignore": { + "version": "1.0.5", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "fstream": "1.0.11", + "inherits": "2.0.3", + "minimatch": "3.0.4" + } + }, + "gauge": { + "version": "2.7.4", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "aproba": "1.1.1", + "console-control-strings": "1.1.0", + "has-unicode": "2.0.1", + "object-assign": "4.1.1", + "signal-exit": "3.0.2", + "string-width": "1.0.2", + "strip-ansi": "3.0.1", + "wide-align": "1.1.2" + } + }, + "getpass": { + "version": "0.1.7", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "assert-plus": "1.0.0" + }, + "dependencies": { + "assert-plus": { + "version": "1.0.0", + "bundled": true, + "dev": true, + "optional": true + } + } + }, + "glob": { + "version": "7.1.2", + "bundled": true, + "dev": true, + "requires": { + "fs.realpath": "1.0.0", + "inflight": "1.0.6", + "inherits": "2.0.3", + "minimatch": "3.0.4", + "once": "1.4.0", + "path-is-absolute": "1.0.1" + } + }, + "graceful-fs": { + "version": "4.1.11", + "bundled": true, + "dev": true + }, + "har-schema": { + "version": "1.0.5", + "bundled": true, + "dev": true, + "optional": true + }, + "har-validator": { + "version": "4.2.1", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "ajv": "4.11.8", + "har-schema": "1.0.5" + } + }, + "has-unicode": { + "version": "2.0.1", + "bundled": true, + "dev": true, + "optional": true + }, + "hawk": { + "version": "3.1.3", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "boom": "2.10.1", + "cryptiles": "2.0.5", + "hoek": "2.16.3", + "sntp": "1.0.9" + } + }, + "hoek": { + "version": "2.16.3", + "bundled": true, + "dev": true + }, + "http-signature": { + "version": "1.1.1", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "assert-plus": "0.2.0", + "jsprim": "1.4.0", + "sshpk": "1.13.0" + } + }, + "inflight": { + "version": "1.0.6", + "bundled": true, + "dev": true, + "requires": { + "once": "1.4.0", + "wrappy": "1.0.2" + } + }, + "inherits": { + "version": "2.0.3", + "bundled": true, + "dev": true + }, + "ini": { + "version": "1.3.4", + "bundled": true, + "dev": true, + "optional": true + }, + "is-fullwidth-code-point": { + "version": "1.0.0", + "bundled": true, + "dev": true, + "requires": { + "number-is-nan": "1.0.1" + } + }, + "is-typedarray": { + "version": "1.0.0", + "bundled": true, + "dev": true, + "optional": true + }, + "isarray": { + "version": "1.0.0", + "bundled": true, + "dev": true + }, + "isstream": { + "version": "0.1.2", + "bundled": true, + "dev": true, + "optional": true + }, + "jodid25519": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "jsbn": "0.1.1" + } + }, + "jsbn": { + "version": "0.1.1", + "bundled": true, + "dev": true, + "optional": true + }, + "json-schema": { + "version": "0.2.3", + "bundled": true, + "dev": true, + "optional": true + }, + "json-stable-stringify": { + "version": "1.0.1", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "jsonify": "0.0.0" + } + }, + "json-stringify-safe": { + "version": "5.0.1", + "bundled": true, + "dev": true, + "optional": true + }, + "jsonify": { + "version": "0.0.0", + "bundled": true, + "dev": true, + "optional": true + }, + "jsprim": { + "version": "1.4.0", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "assert-plus": "1.0.0", + "extsprintf": "1.0.2", + "json-schema": "0.2.3", + "verror": "1.3.6" + }, + "dependencies": { + "assert-plus": { + "version": "1.0.0", + "bundled": true, + "dev": true, + "optional": true + } + } + }, + "mime-db": { + "version": "1.27.0", + "bundled": true, + "dev": true + }, + "mime-types": { + "version": "2.1.15", + "bundled": true, + "dev": true, + "requires": { + "mime-db": "1.27.0" + } + }, + "minimatch": { + "version": "3.0.4", + "bundled": true, + "dev": true, + "requires": { + "brace-expansion": "1.1.7" + } + }, + "minimist": { + "version": "0.0.8", + "bundled": true, + "dev": true + }, + "mkdirp": { + "version": "0.5.1", + "bundled": true, + "dev": true, + "requires": { + "minimist": "0.0.8" + } + }, + "ms": { + "version": "2.0.0", + "bundled": true, + "dev": true, + "optional": true + }, + "node-pre-gyp": { + "version": "0.6.36", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "mkdirp": "0.5.1", + "nopt": "4.0.1", + "npmlog": "4.1.0", + "rc": "1.2.1", + "request": "2.81.0", + "rimraf": "2.6.1", + "semver": "5.3.0", + "tar": "2.2.1", + "tar-pack": "3.4.0" + } + }, + "nopt": { + "version": "4.0.1", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "abbrev": "1.1.0", + "osenv": "0.1.4" + } + }, + "npmlog": { + "version": "4.1.0", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "are-we-there-yet": "1.1.4", + "console-control-strings": "1.1.0", + "gauge": "2.7.4", + "set-blocking": "2.0.0" + } + }, + "number-is-nan": { + "version": "1.0.1", + "bundled": true, + "dev": true + }, + "oauth-sign": { + "version": "0.8.2", + "bundled": true, + "dev": true, + "optional": true + }, + "object-assign": { + "version": "4.1.1", + "bundled": true, + "dev": true, + "optional": true + }, + "once": { + "version": "1.4.0", + "bundled": true, + "dev": true, + "requires": { + "wrappy": "1.0.2" + } + }, + "os-homedir": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "optional": true + }, + "os-tmpdir": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "optional": true + }, + "osenv": { + "version": "0.1.4", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "os-homedir": "1.0.2", + "os-tmpdir": "1.0.2" + } + }, + "path-is-absolute": { + "version": "1.0.1", + "bundled": true, + "dev": true + }, + "performance-now": { + "version": "0.2.0", + "bundled": true, + "dev": true, + "optional": true + }, + "process-nextick-args": { + "version": "1.0.7", + "bundled": true, + "dev": true + }, + "punycode": { + "version": "1.4.1", + "bundled": true, + "dev": true, + "optional": true + }, + "qs": { + "version": "6.4.0", + "bundled": true, + "dev": true, + "optional": true + }, + "rc": { + "version": "1.2.1", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "deep-extend": "0.4.2", + "ini": "1.3.4", + "minimist": "1.2.0", + "strip-json-comments": "2.0.1" + }, + "dependencies": { + "minimist": { + "version": "1.2.0", + "bundled": true, + "dev": true, + "optional": true + } + } + }, + "readable-stream": { + "version": "2.2.9", + "bundled": true, + "dev": true, + "requires": { + "buffer-shims": "1.0.0", + "core-util-is": "1.0.2", + "inherits": "2.0.3", + "isarray": "1.0.0", + "process-nextick-args": "1.0.7", + "string_decoder": "1.0.1", + "util-deprecate": "1.0.2" + } + }, + "request": { + "version": "2.81.0", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "aws-sign2": "0.6.0", + "aws4": "1.6.0", + "caseless": "0.12.0", + "combined-stream": "1.0.5", + "extend": "3.0.1", + "forever-agent": "0.6.1", + "form-data": "2.1.4", + "har-validator": "4.2.1", + "hawk": "3.1.3", + "http-signature": "1.1.1", + "is-typedarray": "1.0.0", + "isstream": "0.1.2", + "json-stringify-safe": "5.0.1", + "mime-types": "2.1.15", + "oauth-sign": "0.8.2", + "performance-now": "0.2.0", + "qs": "6.4.0", + "safe-buffer": "5.0.1", + "stringstream": "0.0.5", + "tough-cookie": "2.3.2", + "tunnel-agent": "0.6.0", + "uuid": "3.0.1" + } + }, + "rimraf": { + "version": "2.6.1", + "bundled": true, + "dev": true, + "requires": { + "glob": "7.1.2" + } + }, + "safe-buffer": { + "version": "5.0.1", + "bundled": true, + "dev": true + }, + "semver": { + "version": "5.3.0", + "bundled": true, + "dev": true, + "optional": true + }, + "set-blocking": { + "version": "2.0.0", + "bundled": true, + "dev": true, + "optional": true + }, + "signal-exit": { + "version": "3.0.2", + "bundled": true, + "dev": true, + "optional": true + }, + "sntp": { + "version": "1.0.9", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "hoek": "2.16.3" + } + }, + "sshpk": { + "version": "1.13.0", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "asn1": "0.2.3", + "assert-plus": "1.0.0", + "bcrypt-pbkdf": "1.0.1", + "dashdash": "1.14.1", + "ecc-jsbn": "0.1.1", + "getpass": "0.1.7", + "jodid25519": "1.0.2", + "jsbn": "0.1.1", + "tweetnacl": "0.14.5" + }, + "dependencies": { + "assert-plus": { + "version": "1.0.0", + "bundled": true, + "dev": true, + "optional": true + } + } + }, + "string-width": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "requires": { + "code-point-at": "1.1.0", + "is-fullwidth-code-point": "1.0.0", + "strip-ansi": "3.0.1" + } + }, + "string_decoder": { + "version": "1.0.1", + "bundled": true, + "dev": true, + "requires": { + "safe-buffer": "5.0.1" + } + }, + "stringstream": { + "version": "0.0.5", + "bundled": true, + "dev": true, + "optional": true + }, + "strip-ansi": { + "version": "3.0.1", + "bundled": true, + "dev": true, + "requires": { + "ansi-regex": "2.1.1" + } + }, + "strip-json-comments": { + "version": "2.0.1", + "bundled": true, + "dev": true, + "optional": true + }, + "tar": { + "version": "2.2.1", + "bundled": true, + "dev": true, + "requires": { + "block-stream": "0.0.9", + "fstream": "1.0.11", + "inherits": "2.0.3" + } + }, + "tar-pack": { + "version": "3.4.0", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "debug": "2.6.8", + "fstream": "1.0.11", + "fstream-ignore": "1.0.5", + "once": "1.4.0", + "readable-stream": "2.2.9", + "rimraf": "2.6.1", + "tar": "2.2.1", + "uid-number": "0.0.6" + } + }, + "tough-cookie": { + "version": "2.3.2", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "punycode": "1.4.1" + } + }, + "tunnel-agent": { + "version": "0.6.0", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "safe-buffer": "5.0.1" + } + }, + "tweetnacl": { + "version": "0.14.5", + "bundled": true, + "dev": true, + "optional": true + }, + "uid-number": { + "version": "0.0.6", + "bundled": true, + "dev": true, + "optional": true + }, + "util-deprecate": { + "version": "1.0.2", + "bundled": true, + "dev": true + }, + "uuid": { + "version": "3.0.1", + "bundled": true, + "dev": true, + "optional": true + }, + "verror": { + "version": "1.3.6", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "extsprintf": "1.0.2" + } + }, + "wide-align": { + "version": "1.1.2", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "string-width": "1.0.2" } + }, + "wrappy": { + "version": "1.0.2", + "bundled": true, + "dev": true } } }, - "first-chunk-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/first-chunk-stream/-/first-chunk-stream-1.0.0.tgz", - "integrity": "sha1-Wb+1DNkF9g18OUzT2ayqtOatk04=", - "dev": true - }, - "flagged-respawn": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/flagged-respawn/-/flagged-respawn-0.3.2.tgz", - "integrity": "sha1-/xke3c1wiKZ1smEP/8l2vpuAdLU=", - "dev": true - }, - "flat-cache": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-1.3.0.tgz", - "integrity": "sha1-0wMLMrOBVPTjt+nHCfSQ9++XxIE=", - "dev": true, - "requires": { - "circular-json": "0.3.3", - "del": "2.2.2", - "graceful-fs": "4.1.11", - "write": "0.2.1" - } - }, - "for-in": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", - "integrity": "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=", - "dev": true - }, - "for-own": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/for-own/-/for-own-0.1.5.tgz", - "integrity": "sha1-UmXGgaTylNq78XyVCbZ2OqhFEM4=", - "dev": true, - "requires": { - "for-in": "1.0.2" - } - }, - "foreach": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/foreach/-/foreach-2.0.5.tgz", - "integrity": "sha1-C+4AUBiusmDQo6865ljdATbsG5k=", - "dev": true - }, - "forever-agent": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", - "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=", - "dev": true - }, - "fork-stream": { - "version": "0.0.4", - "resolved": "https://registry.npmjs.org/fork-stream/-/fork-stream-0.0.4.tgz", - "integrity": "sha1-24Sfznf2cIpfjzhq5TOgkHtUrnA=", - "dev": true - }, - "form-data": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.1.tgz", - "integrity": "sha1-b7lPvXGIUwbXPRXMSX/kzE7NRL8=", - "dev": true, - "requires": { - "asynckit": "0.4.0", - "combined-stream": "1.0.5", - "mime-types": "2.1.17" - } - }, - "formatio": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/formatio/-/formatio-1.1.1.tgz", - "integrity": "sha1-XtPM1jZVEJc4NGXZlhmRAOhhYek=", - "dev": true, - "requires": { - "samsam": "1.1.2" - } - }, - "fs-access": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/fs-access/-/fs-access-1.0.1.tgz", - "integrity": "sha1-1qh/JiJxzv6+wwxVNAf7mV2od3o=", - "dev": true, - "requires": { - "null-check": "1.0.0" - } - }, - "fs-exists-sync": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/fs-exists-sync/-/fs-exists-sync-0.1.0.tgz", - "integrity": "sha1-mC1ok6+RjnLQjeyehnP/K1qNat0=", - "dev": true - }, - "fs-extra": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-2.1.2.tgz", - "integrity": "sha1-BGxwFjzvmq1GsOSn+kZ/si1x3jU=", - "dev": true, - "requires": { - "graceful-fs": "4.1.11", - "jsonfile": "2.4.0" - } - }, - "fs.realpath": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", - "dev": true - }, "function-bind": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", "dev": true }, + "functional-red-black-tree": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", + "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=", + "dev": true + }, "gauge": { "version": "2.7.4", "resolved": "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz", @@ -3353,6 +4699,28 @@ "string-width": "1.0.2", "strip-ansi": "3.0.1", "wide-align": "1.1.2" + }, + "dependencies": { + "is-fullwidth-code-point": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", + "dev": true, + "requires": { + "number-is-nan": "1.0.1" + } + }, + "string-width": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "dev": true, + "requires": { + "code-point-at": "1.1.0", + "is-fullwidth-code-point": "1.0.0", + "strip-ansi": "3.0.1" + } + } } }, "gaze": { @@ -3725,6 +5093,12 @@ "integrity": "sha1-j1dWDIO1n8JwvT1WG2kAQ0MOJVE=", "dev": true }, + "lru-cache": { + "version": "2.7.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-2.7.3.tgz", + "integrity": "sha1-bUUk6LlV+V1PW1iFHOId1y+06VI=", + "dev": true + }, "minimatch": { "version": "0.2.14", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-0.2.14.tgz", @@ -3746,6 +5120,25 @@ "sparkles": "1.0.0" } }, + "got": { + "version": "6.7.1", + "resolved": "https://registry.npmjs.org/got/-/got-6.7.1.tgz", + "integrity": "sha1-JAzQV4WpoY5WHcG0S0HHY+8ejbA=", + "dev": true, + "requires": { + "create-error-class": "3.0.2", + "duplexer3": "0.1.4", + "get-stream": "3.0.0", + "is-redirect": "1.0.0", + "is-retry-allowed": "1.1.0", + "is-stream": "1.1.0", + "lowercase-keys": "1.0.0", + "safe-buffer": "5.1.1", + "timed-out": "4.0.1", + "unzip-response": "2.0.1", + "url-parse-lax": "1.0.0" + } + }, "graceful-fs": { "version": "4.1.11", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", @@ -5020,6 +6413,7 @@ "requires": { "anymatch": "1.3.0", "async-each": "1.0.1", + "fsevents": "1.1.2", "glob-parent": "2.0.0", "inherits": "2.0.3", "is-binary-path": "1.0.1", @@ -5776,7 +7170,8 @@ "esprima": "2.7.3", "estraverse": "1.9.3", "esutils": "2.0.2", - "optionator": "0.8.2" + "optionator": "0.8.2", + "source-map": "0.2.0" }, "dependencies": { "esprima": { @@ -5788,6 +7183,16 @@ "version": "1.9.3", "bundled": true, "dev": true + }, + "source-map": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.2.0.tgz", + "integrity": "sha1-2rc/vPwrqBm03gO9b26qSBZLP50=", + "dev": true, + "optional": true, + "requires": { + "amdefine": "1.0.1" + } } } }, @@ -10097,8 +11502,12 @@ "requires": { "asn1": "0.2.3", "assert-plus": "1.0.0", + "bcrypt-pbkdf": "1.0.1", "dashdash": "1.14.1", - "getpass": "0.1.7" + "ecc-jsbn": "0.1.1", + "getpass": "0.1.7", + "jsbn": "0.1.1", + "tweetnacl": "0.14.5" }, "dependencies": { "assert-plus": { @@ -10137,14 +11546,6 @@ "bundled": true, "dev": true }, - "string_decoder": { - "version": "1.0.2", - "bundled": true, - "dev": true, - "requires": { - "safe-buffer": "5.0.1" - } - }, "string-length": { "version": "1.0.1", "bundled": true, @@ -10163,6 +11564,14 @@ "strip-ansi": "3.0.1" } }, + "string_decoder": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "requires": { + "safe-buffer": "5.0.1" + } + }, "stringstream": { "version": "0.0.5", "bundled": true, @@ -11052,7 +12461,7 @@ "integrity": "sha1-XIgDbPVl5d8FVYv8kR+GVt8hiIQ=", "dev": true, "requires": { - "clone": "1.0.2", + "clone": "1.0.3", "clone-stats": "0.0.1", "replace-ext": "0.0.1" } @@ -11149,14 +12558,15 @@ } }, "handlebars": { - "version": "4.0.10", - "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.0.10.tgz", - "integrity": "sha1-PTDHGLCaPZbyPqTMH0A8TTup/08=", + "version": "4.0.11", + "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.0.11.tgz", + "integrity": "sha1-Ywo13+ApS8KB7a5v/F0yn8eYLcw=", "dev": true, "requires": { "async": "1.5.2", "optimist": "0.6.1", - "source-map": "0.4.4" + "source-map": "0.4.4", + "uglify-js": "2.8.29" }, "dependencies": { "source-map": { @@ -11182,31 +12592,8 @@ "integrity": "sha1-ukAsJmGU8VlW7xXg/PJCmT9qff0=", "dev": true, "requires": { - "ajv": "5.2.3", + "ajv": "5.3.0", "har-schema": "2.0.0" - }, - "dependencies": { - "ajv": { - "version": "5.2.3", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.2.3.tgz", - "integrity": "sha1-wG9Zh3jETGsWGrr+NGa4GtGBTtI=", - "dev": true, - "requires": { - "co": "4.6.0", - "fast-deep-equal": "1.0.0", - "json-schema-traverse": "0.3.1", - "json-stable-stringify": "1.0.1" - } - }, - "json-stable-stringify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz", - "integrity": "sha1-mnWdOcXy/1A/1TAGRu1EX4jE+a8=", - "dev": true, - "requires": { - "jsonify": "0.0.0" - } - } } }, "has": { @@ -11251,9 +12638,9 @@ "dev": true }, "has-flag": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-1.0.0.tgz", - "integrity": "sha1-nZ55MWXOAXoA8AQYxD+UKnsdEfo=", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz", + "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=", "dev": true }, "has-gulplog": { @@ -11305,7 +12692,7 @@ "boom": "4.3.1", "cryptiles": "3.1.2", "hoek": "4.2.0", - "sntp": "2.0.2" + "sntp": "2.1.0" } }, "hmac-drbg": { @@ -11351,12 +12738,12 @@ "dev": true }, "html-encoding-sniffer": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-1.0.1.tgz", - "integrity": "sha1-eb96eF6klf5mFl5zQVPzY/9UN9o=", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-1.0.2.tgz", + "integrity": "sha512-71lZziiDnsuabfdYiUeWdCVyKuqwWi23L8YeIgV9jSSZHCtb6wB1BKWooH7L3tn4/FuZJMVWyNaIDr4RGmaSYw==", "dev": true, "requires": { - "whatwg-encoding": "1.0.1" + "whatwg-encoding": "1.0.3" } }, "htmlescape": { @@ -11374,7 +12761,7 @@ "depd": "1.1.1", "inherits": "2.0.3", "setprototypeof": "1.0.3", - "statuses": "1.3.1" + "statuses": "1.4.0" } }, "http-proxy": { @@ -11405,9 +12792,9 @@ "dev": true }, "iconv-lite": { - "version": "0.4.13", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.13.tgz", - "integrity": "sha1-H4irpKsLFQjoMSrMOTRfNumS4vI=", + "version": "0.4.19", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.19.tgz", + "integrity": "sha512-oTZqweIP51xaGPI4uPa56/Pri/480R+mo7SeU+YETByQNhDG55ycFyNLIgta9vXhILrxXDmF7ZGhqZIcuN0gJQ==", "dev": true }, "ieee754": { @@ -11417,9 +12804,9 @@ "dev": true }, "ignore": { - "version": "3.3.5", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-3.3.5.tgz", - "integrity": "sha512-JLH93mL8amZQhh/p6mfQgVBH3M6epNq3DfsXsTSuSrInVjwyYlFE1nv2AgfRCC8PoOhM0jwQ5v8s9LgbK7yGDw==", + "version": "3.3.7", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-3.3.7.tgz", + "integrity": "sha512-YGG3ejvBNHRqu0559EOxxNFihD0AjpvHlC/pdGKd3X3ofe+CoJkYazwNJYTNebqpPKN+VVQbh4ZFn1DivMNuHA==", "dev": true }, "imurmurhash": { @@ -11475,24 +12862,71 @@ } }, "inquirer": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-0.12.0.tgz", - "integrity": "sha1-HvK/1jUE3wvHV4X/+MLEHfEvB34=", + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-3.3.0.tgz", + "integrity": "sha512-h+xtnyk4EwKvFWHrUYsWErEVR+igKtLdchu+o0Z1RL7VU/jVMFbYir2bp6bAj8efFNxWqHX0dIss6fJQ+/+qeQ==", "dev": true, "requires": { - "ansi-escapes": "1.4.0", - "ansi-regex": "2.1.1", - "chalk": "1.1.3", - "cli-cursor": "1.0.2", + "ansi-escapes": "3.0.0", + "chalk": "2.3.0", + "cli-cursor": "2.1.0", "cli-width": "2.2.0", - "figures": "1.7.0", + "external-editor": "2.0.5", + "figures": "2.0.0", "lodash": "4.17.4", - "readline2": "1.0.1", - "run-async": "0.1.0", - "rx-lite": "3.1.2", - "string-width": "1.0.2", - "strip-ansi": "3.0.1", + "mute-stream": "0.0.7", + "run-async": "2.3.0", + "rx-lite": "4.0.8", + "rx-lite-aggregates": "4.0.8", + "string-width": "2.1.1", + "strip-ansi": "4.0.0", "through": "2.3.8" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "ansi-styles": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", + "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", + "dev": true, + "requires": { + "color-convert": "1.9.1" + } + }, + "chalk": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.0.tgz", + "integrity": "sha512-Az5zJR2CBujap2rqXGaJKaPHyJ0IrUimvYNX+ncCy8PJP4ltOGTrHUIo097ZaL2zMeKYpiCdqDvS6zdrTFok3Q==", + "dev": true, + "requires": { + "ansi-styles": "3.2.0", + "escape-string-regexp": "1.0.5", + "supports-color": "4.5.0" + } + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "3.0.0" + } + }, + "supports-color": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz", + "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=", + "dev": true, + "requires": { + "has-flag": "2.0.0" + } + } } }, "insert-module-globals": { @@ -11501,10 +12935,10 @@ "integrity": "sha1-wDv04BywhtW15azorQr+eInWOMM=", "dev": true, "requires": { + "JSONStream": "1.3.1", "combine-source-map": "0.7.2", "concat-stream": "1.5.2", - "is-buffer": "1.1.5", - "JSONStream": "1.3.1", + "is-buffer": "1.1.6", "lexical-scope": "1.2.0", "process": "0.11.10", "through2": "2.0.3", @@ -11558,9 +12992,9 @@ } }, "is-buffer": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.5.tgz", - "integrity": "sha1-Hzsm72E7IUuIy8ojzGwB2Hlh7sw=", + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", "dev": true }, "is-builtin-module": { @@ -11630,13 +13064,10 @@ } }, "is-fullwidth-code-point": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", - "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", - "dev": true, - "requires": { - "number-is-nan": "1.0.1" - } + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true }, "is-glob": { "version": "2.0.1", @@ -11745,6 +13176,12 @@ "integrity": "sha1-V/4cTkhHTt1lsJkR8msc1Ald2oQ=", "dev": true }, + "is-redirect": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-redirect/-/is-redirect-1.0.0.tgz", + "integrity": "sha1-HQPd7VO9jbDzDCbk+V02/HyH3CQ=", + "dev": true + }, "is-regex": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.4.tgz", @@ -11772,6 +13209,12 @@ "tryit": "1.0.3" } }, + "is-retry-allowed": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-retry-allowed/-/is-retry-allowed-1.1.0.tgz", + "integrity": "sha1-EaBgVotnM5REAz0BJaYaINVk+zQ=", + "dev": true + }, "is-stream": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", @@ -11859,6 +13302,16 @@ "isarray": "1.0.0" } }, + "isomorphic-fetch": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/isomorphic-fetch/-/isomorphic-fetch-2.2.1.tgz", + "integrity": "sha1-YRrhrPFPXoH3KVB0coGf6XM1WKk=", + "dev": true, + "requires": { + "node-fetch": "1.7.3", + "whatwg-fetch": "2.0.3" + } + }, "isstream": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", @@ -11876,7 +13329,7 @@ "escodegen": "1.8.1", "esprima": "2.7.3", "glob": "5.0.15", - "handlebars": "4.0.10", + "handlebars": "4.0.11", "js-yaml": "3.10.0", "mkdirp": "0.5.1", "nopt": "3.0.6", @@ -11896,7 +13349,8 @@ "esprima": "2.7.3", "estraverse": "1.9.3", "esutils": "2.0.2", - "optionator": "0.8.2" + "optionator": "0.8.2", + "source-map": "0.2.0" } }, "esprima": { @@ -11924,12 +13378,28 @@ "path-is-absolute": "1.0.1" } }, + "has-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-1.0.0.tgz", + "integrity": "sha1-nZ55MWXOAXoA8AQYxD+UKnsdEfo=", + "dev": true + }, "resolve": { "version": "1.1.7", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.1.7.tgz", "integrity": "sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs=", "dev": true }, + "source-map": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.2.0.tgz", + "integrity": "sha1-2rc/vPwrqBm03gO9b26qSBZLP50=", + "dev": true, + "optional": true, + "requires": { + "amdefine": "1.0.1" + } + }, "supports-color": { "version": "3.2.3", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-3.2.3.tgz", @@ -11948,9 +13418,9 @@ "dev": true }, "istanbul-lib-instrument": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-1.8.0.tgz", - "integrity": "sha1-ZvbJQhzJ7EcE928tsIS6kHiitTI=", + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-1.9.1.tgz", + "integrity": "sha512-RQmXeQ7sphar7k7O1wTNzVczF9igKpaeGQAG9qR2L+BS4DCJNTI9nytRmIVYevwO0bbq+2CXvJmYDuz0gMrywA==", "dev": true, "requires": { "babel-generator": "6.26.0", @@ -12024,10 +13494,17 @@ "esprima": "4.0.0" } }, + "jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", + "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", + "dev": true, + "optional": true + }, "jschardet": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/jschardet/-/jschardet-1.5.1.tgz", - "integrity": "sha512-vE2hT1D0HLZCLLclfBSfkfTTedhVj0fubHpJBHKwwUWX0nSbhPAfk+SG9rTX95BYNmau8rGFfCeaT6T5OW1C2A==", + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/jschardet/-/jschardet-1.6.0.tgz", + "integrity": "sha512-xYuhvQ7I9PDJIGBWev9xm0+SMSed3ZDBAmvVjbFR1ZRLAF+vlXcQu6cRI9uAlj81rzikElRVteehwV7DuX2ZmQ==", "dev": true }, "jsdom": { @@ -12040,19 +13517,19 @@ "acorn": "4.0.13", "acorn-globals": "3.1.0", "array-equal": "1.0.0", - "content-type-parser": "1.0.1", + "content-type-parser": "1.0.2", "cssom": "0.3.2", "cssstyle": "0.2.37", "escodegen": "1.9.0", - "html-encoding-sniffer": "1.0.1", - "nwmatcher": "1.4.2", + "html-encoding-sniffer": "1.0.2", + "nwmatcher": "1.4.3", "parse5": "1.5.1", "request": "2.83.0", "sax": "1.2.4", "symbol-tree": "3.2.2", "tough-cookie": "2.3.3", "webidl-conversions": "4.0.2", - "whatwg-encoding": "1.0.1", + "whatwg-encoding": "1.0.3", "whatwg-url": "4.8.0", "xml-name-validator": "2.0.1" } @@ -12135,16 +13612,6 @@ "integrity": "sha1-T9kss04OnbPInIYi7PUfm5eMbLk=", "dev": true }, - "JSONStream": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-1.3.1.tgz", - "integrity": "sha1-cH92HgHa6eFvG8+TcDt4xwlmV5o=", - "dev": true, - "requires": { - "jsonparse": "1.3.1", - "through": "2.3.8" - } - }, "jsprim": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", @@ -12158,10 +13625,13 @@ } }, "jsx-ast-utils": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-1.4.1.tgz", - "integrity": "sha1-OGchPo3Xm/Ho8jAMDPwe+xgsDfE=", - "dev": true + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-2.0.1.tgz", + "integrity": "sha1-6AGxs5mF4g//yHtA43SAgOLcrH8=", + "dev": true, + "requires": { + "array-includes": "3.0.3" + } }, "karma": { "version": "1.7.1", @@ -12203,6 +13673,15 @@ "resolved": "https://registry.npmjs.org/lodash/-/lodash-3.10.1.tgz", "integrity": "sha1-W/Rejkm6QYnhfUgnid/RW9FAt7Y=", "dev": true + }, + "tmp": { + "version": "0.0.31", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.31.tgz", + "integrity": "sha1-jzirlDjhcxXl29izZX6L+yd65Kc=", + "dev": true, + "requires": { + "os-tmpdir": "1.0.2" + } } } }, @@ -12313,7 +13792,7 @@ "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "dev": true, "requires": { - "is-buffer": "1.1.5" + "is-buffer": "1.1.6" } }, "labeled-stream-splicer": { @@ -12335,6 +13814,13 @@ } } }, + "lazy-cache": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/lazy-cache/-/lazy-cache-1.0.4.tgz", + "integrity": "sha1-odePw6UEdMuAhF07O24dpJpEbo4=", + "dev": true, + "optional": true + }, "lazystream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/lazystream/-/lazystream-1.0.0.tgz", @@ -12354,13 +13840,13 @@ } }, "lerna": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/lerna/-/lerna-2.4.0.tgz", - "integrity": "sha512-hpoIS0PuhIUpulMF4sQ/aWLUMoH8x7L5fSKF4cf1oNJhmC5FukTpR5fWe8EzmUszFo6Nj/bdJfN36OYDrEJAOA==", + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/lerna/-/lerna-2.5.1.tgz", + "integrity": "sha512-Qz2fajqCPtZf4SFQQpQ2R/Ml/RvGvTNuIHix/vAMMSAdbtnPe2QTw34vLD24Clfsfy8FEojy+tqsjejWKqkDFw==", "dev": true, "requires": { "async": "1.5.2", - "chalk": "2.1.0", + "chalk": "2.3.0", "cmd-shim": "2.0.2", "columnify": "1.5.4", "command-join": "2.0.0", @@ -12383,6 +13869,7 @@ "minimatch": "3.0.4", "npmlog": "4.1.2", "p-finally": "1.0.0", + "package-json": "4.0.1", "path-exists": "3.0.0", "read-cmd-shim": "1.0.1", "read-pkg": "2.0.0", @@ -12398,54 +13885,24 @@ "yargs": "8.0.2" }, "dependencies": { - "ansi-escapes": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.0.0.tgz", - "integrity": "sha512-O/klc27mWNUigtv0F8NJWbLF00OcegQalkqKURWdosW08YZKi4m6CnSUSvIZG1otNJbTWhN01Hhz389DW7mvDQ==", - "dev": true - }, - "ansi-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", - "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", - "dev": true - }, "ansi-styles": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", "dev": true, "requires": { - "color-convert": "1.9.0" + "color-convert": "1.9.1" } }, "chalk": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.1.0.tgz", - "integrity": "sha512-LUHGS/dge4ujbXMJrnihYMcL4AoOweGnw9Tp3kQuqy1Kx5c1qKjqvMJZ6nVJPMWJtKCTN72ZogH3oeSO9g9rXQ==", + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.0.tgz", + "integrity": "sha512-Az5zJR2CBujap2rqXGaJKaPHyJ0IrUimvYNX+ncCy8PJP4ltOGTrHUIo097ZaL2zMeKYpiCdqDvS6zdrTFok3Q==", "dev": true, "requires": { "ansi-styles": "3.2.0", "escape-string-regexp": "1.0.5", - "supports-color": "4.4.0" - } - }, - "cli-cursor": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-2.1.0.tgz", - "integrity": "sha1-s12sN2R5+sw+lHR9QdDQ9SOP/LU=", - "dev": true, - "requires": { - "restore-cursor": "2.0.0" - } - }, - "figures": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/figures/-/figures-2.0.0.tgz", - "integrity": "sha1-OrGi0qYsi/tDGgyUy3l6L84nyWI=", - "dev": true, - "requires": { - "escape-string-regexp": "1.0.5" + "supports-color": "4.5.0" } }, "find-up": { @@ -12491,46 +13948,12 @@ "pinkie-promise": "2.0.1" } }, - "has-flag": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz", - "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=", - "dev": true - }, - "inquirer": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-3.3.0.tgz", - "integrity": "sha512-h+xtnyk4EwKvFWHrUYsWErEVR+igKtLdchu+o0Z1RL7VU/jVMFbYir2bp6bAj8efFNxWqHX0dIss6fJQ+/+qeQ==", - "dev": true, - "requires": { - "ansi-escapes": "3.0.0", - "chalk": "2.1.0", - "cli-cursor": "2.1.0", - "cli-width": "2.2.0", - "external-editor": "2.0.5", - "figures": "2.0.0", - "lodash": "4.17.4", - "mute-stream": "0.0.7", - "run-async": "2.3.0", - "rx-lite": "4.0.8", - "rx-lite-aggregates": "4.0.8", - "string-width": "2.1.1", - "strip-ansi": "4.0.0", - "through": "2.3.8" - } - }, "is-extglob": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", "dev": true }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", - "dev": true - }, "is-glob": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-3.1.0.tgz", @@ -12561,21 +13984,6 @@ "strip-bom": "3.0.0" } }, - "mute-stream": { - "version": "0.0.7", - "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.7.tgz", - "integrity": "sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s=", - "dev": true - }, - "onetime": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/onetime/-/onetime-2.0.1.tgz", - "integrity": "sha1-BnQoIw/WdEOyeUsiu6UotoZ5YtQ=", - "dev": true, - "requires": { - "mimic-fn": "1.1.0" - } - }, "parse-json": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-3.0.0.tgz", @@ -12634,50 +14042,6 @@ } } }, - "restore-cursor": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-2.0.0.tgz", - "integrity": "sha1-n37ih/gv0ybU/RYpI9YhKe7g368=", - "dev": true, - "requires": { - "onetime": "2.0.1", - "signal-exit": "3.0.2" - } - }, - "run-async": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.3.0.tgz", - "integrity": "sha1-A3GrSuC91yDUFm19/aZP96RFpsA=", - "dev": true, - "requires": { - "is-promise": "2.1.0" - } - }, - "rx-lite": { - "version": "4.0.8", - "resolved": "https://registry.npmjs.org/rx-lite/-/rx-lite-4.0.8.tgz", - "integrity": "sha1-Cx4Rr4vESDbwSmQH6S2kJGe3lEQ=", - "dev": true - }, - "string-width": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", - "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", - "dev": true, - "requires": { - "is-fullwidth-code-point": "2.0.0", - "strip-ansi": "4.0.0" - } - }, - "strip-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", - "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", - "dev": true, - "requires": { - "ansi-regex": "3.0.0" - } - }, "strip-bom": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", @@ -12685,9 +14049,9 @@ "dev": true }, "supports-color": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.4.0.tgz", - "integrity": "sha512-rKC3+DyXWgK0ZLKwmRsrkyHVZAjNkfzeehuFWdGGcqGDTZFH73+RH6S/RDAAxl9GusSjZSUWYLmT9N5pzXFOXQ==", + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz", + "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=", "dev": true, "requires": { "has-flag": "2.0.0" @@ -12728,7 +14092,7 @@ "lodash.isstring": "4.0.1", "lodash.mapvalues": "4.6.0", "rechoir": "0.6.2", - "resolve": "1.4.0" + "resolve": "1.5.0" } }, "load-json-file": { @@ -12890,6 +14254,12 @@ "integrity": "sha1-LcvSwofLwKVcxCMovQxzYVDVPj8=", "dev": true }, + "lodash.merge": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.0.tgz", + "integrity": "sha1-aYhLoUSsM/5plzemCG3v+t0PicU=", + "dev": true + }, "lodash.restparam": { "version": "3.6.1", "resolved": "https://registry.npmjs.org/lodash.restparam/-/lodash.restparam-3.6.1.tgz", @@ -12923,6 +14293,12 @@ "lodash.escape": "3.2.0" } }, + "lodash.unescape": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/lodash.unescape/-/lodash.unescape-4.0.1.tgz", + "integrity": "sha1-vyJJiGzlFM2hEvrpIYzcBlIR/Jw=", + "dev": true + }, "log4js": { "version": "0.6.38", "resolved": "https://registry.npmjs.org/log4js/-/log4js-0.6.38.tgz", @@ -12959,12 +14335,34 @@ } } }, + "loglevel": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/loglevel/-/loglevel-1.5.1.tgz", + "integrity": "sha1-GJB4yUq5BT7iFaCs2/JCROoPZQI=", + "dev": true + }, + "loglevel-colored-level-prefix": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/loglevel-colored-level-prefix/-/loglevel-colored-level-prefix-1.0.0.tgz", + "integrity": "sha1-akAhj9x64V/HbD0PPmdsRlOIYD4=", + "dev": true, + "requires": { + "chalk": "1.1.3", + "loglevel": "1.5.1" + } + }, "lolex": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/lolex/-/lolex-1.3.2.tgz", "integrity": "sha1-fD2mL/yzDw9agKJWbKJORdigHzE=", "dev": true }, + "longest": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/longest/-/longest-1.0.1.tgz", + "integrity": "sha1-MKCy2jj3N3DoKUoNIuZiXtd9AJc=", + "dev": true + }, "loose-envify": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.3.1.tgz", @@ -12984,19 +14382,55 @@ "signal-exit": "3.0.2" } }, - "lru-cache": { - "version": "2.7.3", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-2.7.3.tgz", - "integrity": "sha1-bUUk6LlV+V1PW1iFHOId1y+06VI=", + "lowercase-keys": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.0.tgz", + "integrity": "sha1-TjNms55/VFfjXxMkvfb4jQv8cwY=", "dev": true }, + "lru-cache": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.1.tgz", + "integrity": "sha512-q4spe4KTfsAS1SUHLO0wz8Qiyf1+vMIAgpRYioFYDMNqKfHQbg+AVDH3i4fvpl71/P1L0dBl+fQi+P37UYf0ew==", + "dev": true, + "requires": { + "pseudomap": "1.0.2", + "yallist": "2.1.2" + } + }, "make-dir": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-1.0.0.tgz", - "integrity": "sha1-l6ARdR6R3YfPre9Ygy67BJNt6Xg=", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-1.1.0.tgz", + "integrity": "sha512-0Pkui4wLJ7rxvmfUvs87skoEaxmu0hCUApF8nonzpl7q//FWp9zu8W61Scz4sd/kUiqDxvUhtoam2efDyiBzcA==", "dev": true, "requires": { - "pify": "2.3.0" + "pify": "3.0.0" + }, + "dependencies": { + "pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", + "dev": true + } + } + }, + "make-plural": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/make-plural/-/make-plural-3.0.6.tgz", + "integrity": "sha1-IDOgO6wpC487uRJY9lud9+iwHKc=", + "dev": true, + "requires": { + "minimist": "1.2.0" + }, + "dependencies": { + "minimist": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", + "dev": true, + "optional": true + } } }, "map-cache": { @@ -13089,10 +14523,45 @@ "readable-stream": "2.3.3" } }, + "messageformat": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/messageformat/-/messageformat-1.0.2.tgz", + "integrity": "sha1-kI9GkfKf8o2uNcRUNqJM/5NAI4g=", + "dev": true, + "requires": { + "glob": "7.0.6", + "make-plural": "3.0.6", + "messageformat-parser": "1.1.0", + "nopt": "3.0.6", + "reserved-words": "0.1.2" + }, + "dependencies": { + "glob": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.0.6.tgz", + "integrity": "sha1-IRuvr0nlJbjNkyYNFKsTYVKz9Xo=", + "dev": true, + "requires": { + "fs.realpath": "1.0.0", + "inflight": "1.0.6", + "inherits": "2.0.3", + "minimatch": "3.0.4", + "once": "1.4.0", + "path-is-absolute": "1.0.1" + } + } + } + }, + "messageformat-parser": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/messageformat-parser/-/messageformat-parser-1.1.0.tgz", + "integrity": "sha512-Hwem6G3MsKDLS1FtBRGIs8T50P1Q00r3srS6QJePCFbad9fq0nYxwf3rnU2BreApRGhmpKMV7oZI06Sy1c9TPA==", + "dev": true + }, "metal": { - "version": "2.13.2", - "resolved": "https://registry.npmjs.org/metal/-/metal-2.13.2.tgz", - "integrity": "sha512-DqETxwvyW5I/3blSlxrr1eleLaLHItK1VJcGIL6hAVqSlUpYw0r+RXd8qWfIq6TMdjCU3/x/oGmWZyk+O4SZJw==", + "version": "2.14.0", + "resolved": "https://registry.npmjs.org/metal/-/metal-2.14.0.tgz", + "integrity": "sha512-dk4MUJZ5Rj+sB9RgZcATU8QRDxHKPn85ymVWC+PamDhcIEYsY5Fg+I6vOQ1Bo4J+54z/k9KF2K7fmUIRtoRb+w==", "dev": true }, "metal-tools-soy": { @@ -13235,7 +14704,7 @@ "integrity": "sha1-XIgDbPVl5d8FVYv8kR+GVt8hiIQ=", "dev": true, "requires": { - "clone": "1.0.2", + "clone": "1.0.3", "clone-stats": "0.0.1", "replace-ext": "0.0.1" } @@ -13273,7 +14742,7 @@ "integrity": "sha1-9Yfb1hPE18kFBjn1iXMSdThjcWk=", "dev": true, "requires": { - "metal": "2.13.2" + "metal": "2.14.0" } }, "micromatch": { @@ -13419,6 +14888,12 @@ "minimatch": "0.3.0" } }, + "lru-cache": { + "version": "2.7.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-2.7.3.tgz", + "integrity": "sha1-bUUk6LlV+V1PW1iFHOId1y+06VI=", + "dev": true + }, "minimatch": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-0.3.0.tgz", @@ -13455,6 +14930,7 @@ "integrity": "sha1-IyFYM/HaE/1gbMuAh7RIUty4If0=", "dev": true, "requires": { + "JSONStream": "1.3.1", "browser-resolve": "1.11.2", "cached-path-relative": "1.0.1", "concat-stream": "1.5.2", @@ -13462,10 +14938,9 @@ "detective": "4.5.0", "duplexer2": "0.1.4", "inherits": "2.0.3", - "JSONStream": "1.3.1", "parents": "1.0.1", "readable-stream": "2.3.3", - "resolve": "1.4.0", + "resolve": "1.5.0", "stream-combiner2": "1.1.1", "subarg": "1.0.0", "through2": "2.0.3", @@ -13473,9 +14948,9 @@ } }, "moment": { - "version": "2.19.0", - "resolved": "https://registry.npmjs.org/moment/-/moment-2.19.0.tgz", - "integrity": "sha1-RPZ172uUSUJ2JYGxwXn7Z55ZnWc=", + "version": "2.19.1", + "resolved": "https://registry.npmjs.org/moment/-/moment-2.19.1.tgz", + "integrity": "sha1-VtoaLRy/AdOLfhr8McELz6GSkWc=", "dev": true }, "mout": { @@ -13535,11 +15010,18 @@ } }, "mute-stream": { - "version": "0.0.5", - "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.5.tgz", - "integrity": "sha1-j7+rsKmKJT0xhDMfno3rc3L6xsA=", + "version": "0.0.7", + "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.7.tgz", + "integrity": "sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s=", "dev": true }, + "nan": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.7.0.tgz", + "integrity": "sha1-2Vv3IeyHfgjbJ27T/G63j5CDrUY=", + "dev": true, + "optional": true + }, "natives": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/natives/-/natives-1.1.0.tgz", @@ -13558,6 +15040,16 @@ "integrity": "sha1-KzJxhOiZIQEXeyhWP7XnECrNDKk=", "dev": true }, + "node-fetch": { + "version": "1.7.3", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-1.7.3.tgz", + "integrity": "sha512-NhZ4CsKx7cYm2vSrBAr2PvFOe6sWDf0UYLRqA6svUYg7+/TSfVAu49jYC4BvQ4Sms9SZgdqGBgroqfDhJdTyKQ==", + "dev": true, + "requires": { + "encoding": "0.1.12", + "is-stream": "1.1.0" + } + }, "nopt": { "version": "3.0.6", "resolved": "https://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz", @@ -13634,9 +15126,9 @@ "dev": true }, "nwmatcher": { - "version": "1.4.2", - "resolved": "https://registry.npmjs.org/nwmatcher/-/nwmatcher-1.4.2.tgz", - "integrity": "sha512-QMkCGQFYp5p+zwU3INntLmz1HMfSx9dMVJMYKmE1yuSf/22Wjo6VPFa405mCLUuQn9lbQvH2DZN9lt10ZNvtAg==", + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/nwmatcher/-/nwmatcher-1.4.3.tgz", + "integrity": "sha512-IKdSTiDWCarf2JTS5e9e2+5tPZGdkRJ79XjYV0pzK8Q9BpsFyBq1RGKxzs7Q8UBushGw7m6TzVKz6fcY99iSWw==", "dev": true }, "oauth-sign": { @@ -13663,17 +15155,6 @@ "integrity": "sha1-xUYBd4rVYPEULODgG8yotW0TQm0=", "dev": true }, - "object.assign": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.0.4.tgz", - "integrity": "sha1-scnMBE7xuf5jYG/BQau7MuFHMMw=", - "dev": true, - "requires": { - "define-properties": "1.1.2", - "function-bind": "1.1.1", - "object-keys": "1.0.11" - } - }, "object.defaults": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/object.defaults/-/object.defaults-1.1.0.tgz", @@ -13749,10 +15230,13 @@ } }, "onetime": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/onetime/-/onetime-1.1.0.tgz", - "integrity": "sha1-ofeDj4MUxRbwXs78vEzP4EtO14k=", - "dev": true + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-2.0.1.tgz", + "integrity": "sha1-BnQoIw/WdEOyeUsiu6UotoZ5YtQ=", + "dev": true, + "requires": { + "mimic-fn": "1.1.0" + } }, "optimist": { "version": "0.6.1", @@ -13891,6 +15375,18 @@ "p-limit": "1.1.0" } }, + "package-json": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/package-json/-/package-json-4.0.1.tgz", + "integrity": "sha1-iGmgQBJTZhxMTKPabCEh7VVfXu0=", + "dev": true, + "requires": { + "got": "6.7.1", + "registry-auth-token": "3.3.1", + "registry-url": "3.1.0", + "semver": "5.4.1" + } + }, "pako": { "version": "0.2.9", "resolved": "https://registry.npmjs.org/pako/-/pako-0.2.9.tgz", @@ -13912,8 +15408,8 @@ "integrity": "sha1-N8T5t+06tlx0gXtfJICTf7+XxxI=", "dev": true, "requires": { - "asn1.js": "4.9.1", - "browserify-aes": "1.0.8", + "asn1.js": "4.9.2", + "browserify-aes": "1.1.1", "create-hash": "1.1.3", "evp_bytestokey": "1.0.3", "pbkdf2": "3.0.14" @@ -14120,9 +15616,9 @@ } }, "pluralize": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/pluralize/-/pluralize-1.2.1.tgz", - "integrity": "sha1-0aIUg/0iu0HlihL6NCGCMUCJfEU=", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/pluralize/-/pluralize-7.0.0.tgz", + "integrity": "sha512-ARhBOdzS3e41FbkW/XWrTEtukqqLoK5+Z/4UeDaLuSW+39JPeFgs4gCGqsrJHVZX0fUrx//4OF0K1CUGwlIFow==", "dev": true }, "posix-getopt": { @@ -14143,6 +15639,12 @@ "supports-color": "3.2.3" }, "dependencies": { + "has-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-1.0.0.tgz", + "integrity": "sha1-nZ55MWXOAXoA8AQYxD+UKnsdEfo=", + "dev": true + }, "supports-color": { "version": "3.2.3", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-3.2.3.tgz", @@ -14166,12 +15668,179 @@ "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=", "dev": true }, + "prepend-http": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-1.0.4.tgz", + "integrity": "sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw=", + "dev": true + }, "preserve": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/preserve/-/preserve-0.2.0.tgz", "integrity": "sha1-gV7R9uvGWSb4ZbMQwHE7yzMVzks=", "dev": true }, + "prettier": { + "version": "1.8.2", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-1.8.2.tgz", + "integrity": "sha512-fHWjCwoRZgjP1rvLP7OGqOznq7xH1sHMQUFLX8qLRO79hI57+6xbc5vB904LxEkCfgFgyr3vv06JkafgCSzoZg==", + "dev": true + }, + "prettier-eslint": { + "version": "8.2.1", + "resolved": "https://registry.npmjs.org/prettier-eslint/-/prettier-eslint-8.2.1.tgz", + "integrity": "sha512-z19e81masHigXh4Uz2rKL344amyeW56LWjmALnOGUZMiHDxWwYswbv2ZriA7aTKitSH909eN4+h4GqQDXeZOvA==", + "dev": true, + "requires": { + "common-tags": "1.4.0", + "dlv": "1.1.0", + "eslint": "4.10.0", + "indent-string": "3.2.0", + "lodash.merge": "4.6.0", + "loglevel-colored-level-prefix": "1.0.0", + "prettier": "1.8.2", + "pretty-format": "20.0.3", + "require-relative": "0.8.7", + "typescript": "2.6.1", + "typescript-eslint-parser": "8.0.1" + }, + "dependencies": { + "indent-string": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-3.2.0.tgz", + "integrity": "sha1-Sl/W0nzDMvN+VBmlBNu4NxBckok=", + "dev": true + } + } + }, + "prettier-eslint-cli": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/prettier-eslint-cli/-/prettier-eslint-cli-4.4.0.tgz", + "integrity": "sha512-q7kAFt+JpUQJALs110mpaT0+NEMZ4tt1SgOmeNL1D+13rABH0nIMw8fy3NnaTMSmRH9Wfuct6jHSDyqdb9PpVQ==", + "dev": true, + "requires": { + "arrify": "1.0.1", + "babel-runtime": "6.26.0", + "boolify": "1.0.1", + "camelcase-keys": "4.1.0", + "chalk": "2.1.0", + "common-tags": "1.4.0", + "eslint": "4.10.0", + "find-up": "2.1.0", + "get-stdin": "5.0.1", + "glob": "7.1.2", + "ignore": "3.3.7", + "indent-string": "3.2.0", + "lodash.memoize": "4.1.2", + "loglevel-colored-level-prefix": "1.0.0", + "messageformat": "1.0.2", + "prettier-eslint": "8.2.1", + "rxjs": "5.5.2", + "yargs": "8.0.2" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", + "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", + "dev": true, + "requires": { + "color-convert": "1.9.1" + } + }, + "camelcase": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", + "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=", + "dev": true + }, + "camelcase-keys": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-4.1.0.tgz", + "integrity": "sha1-IU00jMVFfzkxaiwxzD43JGMl5z8=", + "dev": true, + "requires": { + "camelcase": "4.1.0", + "map-obj": "2.0.0", + "quick-lru": "1.1.0" + } + }, + "chalk": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.1.0.tgz", + "integrity": "sha512-LUHGS/dge4ujbXMJrnihYMcL4AoOweGnw9Tp3kQuqy1Kx5c1qKjqvMJZ6nVJPMWJtKCTN72ZogH3oeSO9g9rXQ==", + "dev": true, + "requires": { + "ansi-styles": "3.2.0", + "escape-string-regexp": "1.0.5", + "supports-color": "4.5.0" + } + }, + "find-up": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", + "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", + "dev": true, + "requires": { + "locate-path": "2.0.0" + } + }, + "get-stdin": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-5.0.1.tgz", + "integrity": "sha1-Ei4WFZHiH/TFJTAwVpPyDmOTo5g=", + "dev": true + }, + "indent-string": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-3.2.0.tgz", + "integrity": "sha1-Sl/W0nzDMvN+VBmlBNu4NxBckok=", + "dev": true + }, + "lodash.memoize": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz", + "integrity": "sha1-vMbEmkKihA7Zl/Mj6tpezRguC/4=", + "dev": true + }, + "map-obj": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-2.0.0.tgz", + "integrity": "sha1-plzSkIepJZi4eRJXpSPgISIqwfk=", + "dev": true + }, + "supports-color": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz", + "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=", + "dev": true, + "requires": { + "has-flag": "2.0.0" + } + } + } + }, + "pretty-format": { + "version": "20.0.3", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-20.0.3.tgz", + "integrity": "sha1-Ag41ClYKH+GpjcO+tsz/s4beixQ=", + "dev": true, + "requires": { + "ansi-regex": "2.1.1", + "ansi-styles": "3.2.0" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", + "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", + "dev": true, + "requires": { + "color-convert": "1.9.1" + } + } + } + }, "pretty-hrtime": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/pretty-hrtime/-/pretty-hrtime-1.0.3.tgz", @@ -14179,9 +15848,9 @@ "dev": true }, "private": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/private/-/private-0.1.7.tgz", - "integrity": "sha1-aM5eih7woju1cMwoU3tTMqumPvE=", + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/private/-/private-0.1.8.tgz", + "integrity": "sha512-VvivMrbvd2nKkiG38qjULzlc+4Vx4wm/whI9pQD35YrARNnhxeiRktSOhSukRLFNlzg6Br/cJPet5J/u19r/mg==", "dev": true }, "process": { @@ -14197,11 +15866,31 @@ "dev": true }, "progress": { - "version": "1.1.8", - "resolved": "https://registry.npmjs.org/progress/-/progress-1.1.8.tgz", - "integrity": "sha1-4mDHj2Fhzdmw5WzD4Khd4Xx6V74=", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.0.tgz", + "integrity": "sha1-ihvjZr+Pwj2yvSPxDG/pILQ4nR8=", "dev": true }, + "promise": { + "version": "7.3.1", + "resolved": "https://registry.npmjs.org/promise/-/promise-7.3.1.tgz", + "integrity": "sha512-nolQXZ/4L+bP/UGlkfaIujX9BKxGwmQ9OT4mOt5yvy8iK1h3wqTEJCijzGANTCCl9nWjY41juyAn2K3Q1hLLTg==", + "dev": true, + "requires": { + "asap": "2.0.6" + } + }, + "prop-types": { + "version": "15.6.0", + "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.6.0.tgz", + "integrity": "sha1-zq8IMCL8RrSjX2nhPvda7Q1jmFY=", + "dev": true, + "requires": { + "fbjs": "0.8.16", + "loose-envify": "1.3.1", + "object-assign": "4.1.1" + } + }, "pseudomap": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", @@ -14228,9 +15917,9 @@ "dev": true }, "q": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/q/-/q-1.5.0.tgz", - "integrity": "sha1-3QG6ydBtMObyGa7LglPunr3DCPE=", + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/q/-/q-1.5.1.tgz", + "integrity": "sha1-fjL3W0E4EpHQRhHxvxQQmsAGUdc=", "dev": true }, "qjobs": { @@ -14257,6 +15946,12 @@ "integrity": "sha1-nsYfeQSYdXB9aUFFlv2Qek1xHnM=", "dev": true }, + "quick-lru": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-1.1.0.tgz", + "integrity": "sha1-Q2CxfGETatOAeDl/8RQW4Ybc+7g=", + "dev": true + }, "randomatic": { "version": "1.1.7", "resolved": "https://registry.npmjs.org/randomatic/-/randomatic-1.1.7.tgz", @@ -14282,7 +15977,7 @@ "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "dev": true, "requires": { - "is-buffer": "1.1.5" + "is-buffer": "1.1.6" } } } @@ -14293,7 +15988,7 @@ "integrity": "sha1-IIE989cSkosgc3hpGkUGb65y3Vc=", "dev": true, "requires": { - "is-buffer": "1.1.5" + "is-buffer": "1.1.6" } } } @@ -14307,6 +16002,16 @@ "safe-buffer": "5.1.1" } }, + "randomfill": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/randomfill/-/randomfill-1.0.3.tgz", + "integrity": "sha512-YL6GrhrWoic0Eq8rXVbMptH7dAxCs0J+mh5Y0euNekPPYaxEmdVGim6GdoxoRzKW2yJoU8tueifS7mYxvcFDEQ==", + "dev": true, + "requires": { + "randombytes": "2.0.5", + "safe-buffer": "5.1.1" + } + }, "range-parser": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.0.tgz", @@ -14323,12 +16028,24 @@ "http-errors": "1.6.2", "iconv-lite": "0.4.19", "unpipe": "1.0.0" + } + }, + "rc": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.2.tgz", + "integrity": "sha1-2M6ctX6NZNnHut2YdsfDTL48cHc=", + "dev": true, + "requires": { + "deep-extend": "0.4.2", + "ini": "1.3.4", + "minimist": "1.2.0", + "strip-json-comments": "2.0.1" }, "dependencies": { - "iconv-lite": { - "version": "0.4.19", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.19.tgz", - "integrity": "sha512-oTZqweIP51xaGPI4uPa56/Pri/480R+mo7SeU+YETByQNhDG55ycFyNLIgta9vXhILrxXDmF7ZGhqZIcuN0gJQ==", + "minimist": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", "dev": true } } @@ -14419,6 +16136,23 @@ "code-point-at": "1.1.0", "is-fullwidth-code-point": "1.0.0", "mute-stream": "0.0.5" + }, + "dependencies": { + "is-fullwidth-code-point": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", + "dev": true, + "requires": { + "number-is-nan": "1.0.1" + } + }, + "mute-stream": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.5.tgz", + "integrity": "sha1-j7+rsKmKJT0xhDMfno3rc3L6xsA=", + "dev": true + } } }, "rechoir": { @@ -14427,7 +16161,7 @@ "integrity": "sha1-hSBLVNuoLVdC4oyWdW70OvUOM4Q=", "dev": true, "requires": { - "resolve": "1.4.0" + "resolve": "1.5.0" } }, "redent": { @@ -14460,7 +16194,7 @@ "requires": { "babel-runtime": "6.26.0", "babel-types": "6.26.0", - "private": "0.1.7" + "private": "0.1.8" } }, "regex-cache": { @@ -14483,6 +16217,25 @@ "regjsparser": "0.1.5" } }, + "registry-auth-token": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-3.3.1.tgz", + "integrity": "sha1-+w0yie4Nmtosu1KvXf5mywcNMAY=", + "dev": true, + "requires": { + "rc": "1.2.2", + "safe-buffer": "5.1.1" + } + }, + "registry-url": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/registry-url/-/registry-url-3.1.0.tgz", + "integrity": "sha1-PU74cPc93h138M+aOBQyRE4XSUI=", + "dev": true, + "requires": { + "rc": "1.2.2" + } + }, "regjsgen": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/regjsgen/-/regjsgen-0.2.0.tgz", @@ -14592,6 +16345,12 @@ "integrity": "sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE=", "dev": true }, + "require-relative": { + "version": "0.8.7", + "resolved": "https://registry.npmjs.org/require-relative/-/require-relative-0.8.7.tgz", + "integrity": "sha1-eZlTn8ngR6N5KPoZb44VY9q9Nt4=", + "dev": true + }, "require-uncached": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/require-uncached/-/require-uncached-1.0.3.tgz", @@ -14608,10 +16367,16 @@ "integrity": "sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8=", "dev": true }, + "reserved-words": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/reserved-words/-/reserved-words-0.1.2.tgz", + "integrity": "sha1-AKCUD5jNUBrqqsMWQR2a3FKzGrE=", + "dev": true + }, "resolve": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.4.0.tgz", - "integrity": "sha512-aW7sVKPufyHqOmyyLzg/J+8606v5nevBgaliIlV7nUpVMsDnoBGV/cbSLNjZAg9q0Cfd/+easKVKQ8vOu8fn1Q==", + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.5.0.tgz", + "integrity": "sha512-hgoSGrc3pjzAPHNBg+KnFcK2HwlHTs/YrAGUr6qgTVUZmXv1UEXXl0bZNBKMA9fud6lRYFdPGz0xXxycPzmmiw==", "dev": true, "requires": { "path-parse": "1.0.5" @@ -14634,13 +16399,23 @@ "dev": true }, "restore-cursor": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-1.0.1.tgz", - "integrity": "sha1-NGYfRohjJ/7SmRR5FSJS35LapUE=", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-2.0.0.tgz", + "integrity": "sha1-n37ih/gv0ybU/RYpI9YhKe7g368=", + "dev": true, + "requires": { + "onetime": "2.0.1", + "signal-exit": "3.0.2" + } + }, + "right-align": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/right-align/-/right-align-0.1.3.tgz", + "integrity": "sha1-YTObci/mo1FWiSENJOFMlhSGE+8=", "dev": true, + "optional": true, "requires": { - "exit-hook": "1.1.1", - "onetime": "1.1.0" + "align-text": "0.1.4" } }, "rimraf": { @@ -14663,18 +16438,18 @@ } }, "run-async": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/run-async/-/run-async-0.1.0.tgz", - "integrity": "sha1-yK1KXhEGYeQCp9IbUw4AnyX444k=", + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.3.0.tgz", + "integrity": "sha1-A3GrSuC91yDUFm19/aZP96RFpsA=", "dev": true, "requires": { - "once": "1.4.0" + "is-promise": "2.1.0" } }, "rx-lite": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/rx-lite/-/rx-lite-3.1.2.tgz", - "integrity": "sha1-Gc5QLKVyZl87ZHsQk5+X/RYV8QI=", + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/rx-lite/-/rx-lite-4.0.8.tgz", + "integrity": "sha1-Cx4Rr4vESDbwSmQH6S2kJGe3lEQ=", "dev": true }, "rx-lite-aggregates": { @@ -14683,7 +16458,16 @@ "integrity": "sha1-dTuHqJoRyVRnxKwWJsTvxOBcZ74=", "dev": true, "requires": { - "rx-lite": "3.1.2" + "rx-lite": "4.0.8" + } + }, + "rxjs": { + "version": "5.5.2", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-5.5.2.tgz", + "integrity": "sha512-oRYoIKWBU3Ic37fLA5VJu31VqQO4bWubRntcHSJ+cwaDQBwdnZ9x4zmhJfm/nFQ2E82/I4loSioHnACamrKGgA==", + "dev": true, + "requires": { + "symbol-observable": "1.0.4" } }, "safe-buffer": { @@ -14728,6 +16512,12 @@ "integrity": "sha1-SysbJ+uAip+NzEgaWOXlb1mfP2E=", "dev": true }, + "setimmediate": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz", + "integrity": "sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU=", + "dev": true + }, "setprototypeof": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.0.3.tgz", @@ -14823,15 +16613,18 @@ "dev": true }, "slice-ansi": { - "version": "0.0.4", - "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-0.0.4.tgz", - "integrity": "sha1-7b+JA/ZvfOL46v1s7tZeJkyDGzU=", - "dev": true + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-1.0.0.tgz", + "integrity": "sha512-POqxBK6Lb3q6s047D/XsDVNPnF9Dl8JSaqe9h9lURl0OdNqy/ujDrOiIHtsqXMGbWWTIomRzAMaTyawAU//Reg==", + "dev": true, + "requires": { + "is-fullwidth-code-point": "2.0.0" + } }, "sntp": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/sntp/-/sntp-2.0.2.tgz", - "integrity": "sha1-UGQRDwr4X3z9t9a2ekACjOUrSys=", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/sntp/-/sntp-2.1.0.tgz", + "integrity": "sha512-FL1b58BDrqS3A11lJ0zEdnJ3UOKqVxawAkF3k7F0CVN7VQ34aZrV+G8BZ1WC9ZL7NyrwsW0oviwsWDgRuVYtJg==", "dev": true, "requires": { "hoek": "4.2.0" @@ -15072,14 +16865,18 @@ "requires": { "asn1": "0.2.3", "assert-plus": "1.0.0", + "bcrypt-pbkdf": "1.0.1", "dashdash": "1.14.1", - "getpass": "0.1.7" + "ecc-jsbn": "0.1.1", + "getpass": "0.1.7", + "jsbn": "0.1.1", + "tweetnacl": "0.14.5" } }, "statuses": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.3.1.tgz", - "integrity": "sha1-+vUbnrdKrvOzrPStX2Gr8ky3uT4=", + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", + "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==", "dev": true }, "stream-browserify": { @@ -15147,23 +16944,39 @@ "readable-stream": "2.3.3" } }, + "string-width": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "dev": true, + "requires": { + "is-fullwidth-code-point": "2.0.0", + "strip-ansi": "4.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "3.0.0" + } + } + } + }, "string_decoder": { "version": "0.10.31", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=", "dev": true }, - "string-width": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", - "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", - "dev": true, - "requires": { - "code-point-at": "1.1.0", - "is-fullwidth-code-point": "1.0.0", - "strip-ansi": "3.0.1" - } - }, "stringstream": { "version": "0.0.5", "resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz", @@ -15228,7 +17041,7 @@ "byline": "5.0.0", "duplexer": "0.1.1", "minimist": "0.1.0", - "moment": "2.19.0", + "moment": "2.19.1", "through": "2.3.8" }, "dependencies": { @@ -15263,6 +17076,12 @@ "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", "dev": true }, + "symbol-observable": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/symbol-observable/-/symbol-observable-1.0.4.tgz", + "integrity": "sha1-Kb9hXUqnEhvdiYsi1LP5vE4qoD0=", + "dev": true + }, "symbol-tree": { "version": "3.2.2", "resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.2.tgz", @@ -15279,48 +17098,46 @@ } }, "table": { - "version": "3.8.3", - "resolved": "https://registry.npmjs.org/table/-/table-3.8.3.tgz", - "integrity": "sha1-K7xULw/amGGnVdOUf+/Ys/UThV8=", + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/table/-/table-4.0.2.tgz", + "integrity": "sha512-UUkEAPdSGxtRpiV9ozJ5cMTtYiqz7Ni1OGqLXRCynrvzdtR1p+cfOWe2RJLwvUG8hNanaSRjecIqwOjqeatDsA==", "dev": true, "requires": { - "ajv": "4.11.8", - "ajv-keywords": "1.5.1", - "chalk": "1.1.3", + "ajv": "5.3.0", + "ajv-keywords": "2.1.1", + "chalk": "2.3.0", "lodash": "4.17.4", - "slice-ansi": "0.0.4", + "slice-ansi": "1.0.0", "string-width": "2.1.1" }, "dependencies": { - "ansi-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", - "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", - "dev": true + "ansi-styles": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", + "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", + "dev": true, + "requires": { + "color-convert": "1.9.1" + } }, - "string-width": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", - "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "chalk": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.0.tgz", + "integrity": "sha512-Az5zJR2CBujap2rqXGaJKaPHyJ0IrUimvYNX+ncCy8PJP4ltOGTrHUIo097ZaL2zMeKYpiCdqDvS6zdrTFok3Q==", "dev": true, "requires": { - "is-fullwidth-code-point": "2.0.0", - "strip-ansi": "4.0.0" + "ansi-styles": "3.2.0", + "escape-string-regexp": "1.0.5", + "supports-color": "4.5.0" } }, - "strip-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", - "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "supports-color": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz", + "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=", "dev": true, "requires": { - "ansi-regex": "3.0.0" + "has-flag": "2.0.0" } } } @@ -15339,7 +17156,7 @@ "requires": { "graceful-fs": "4.1.11", "is-stream": "1.1.0", - "make-dir": "1.0.0", + "make-dir": "1.1.0", "pify": "2.3.0", "temp-dir": "1.0.0", "uuid": "3.1.0" @@ -15447,6 +17264,12 @@ "integrity": "sha1-dkpaEa9QVhkhsTPztE5hhofg9cM=", "dev": true }, + "timed-out": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/timed-out/-/timed-out-4.0.1.tgz", + "integrity": "sha1-8y6srFoXW+ol1/q1Zas+2HQe9W8=", + "dev": true + }, "timers-browserify": { "version": "1.4.2", "resolved": "https://registry.npmjs.org/timers-browserify/-/timers-browserify-1.4.2.tgz", @@ -15457,9 +17280,9 @@ } }, "tmp": { - "version": "0.0.31", - "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.31.tgz", - "integrity": "sha1-jzirlDjhcxXl29izZX6L+yd65Kc=", + "version": "0.0.33", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", + "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", "dev": true, "requires": { "os-tmpdir": "1.0.2" @@ -15562,6 +17385,13 @@ "safe-buffer": "5.1.1" } }, + "tweetnacl": { + "version": "0.14.5", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", + "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", + "dev": true, + "optional": true + }, "type-check": { "version": "0.3.2", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", @@ -15593,6 +17423,22 @@ "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=", "dev": true }, + "typescript": { + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.6.1.tgz", + "integrity": "sha1-7znN6ierrAtQAkLWcmq5DgyEZjE=", + "dev": true + }, + "typescript-eslint-parser": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/typescript-eslint-parser/-/typescript-eslint-parser-8.0.1.tgz", + "integrity": "sha1-6MrFN9mW4Ww9uw18TVCXmeZ6/gw=", + "dev": true, + "requires": { + "lodash.unescape": "4.0.1", + "semver": "5.4.1" + } + }, "typhonjs-ast-walker": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/typhonjs-ast-walker/-/typhonjs-ast-walker-0.1.1.tgz", @@ -15648,6 +17494,72 @@ "integrity": "sha1-hN1eHQG0QRm95JPqZW3O+JJVq4Q=", "dev": true }, + "ua-parser-js": { + "version": "0.7.17", + "resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-0.7.17.tgz", + "integrity": "sha512-uRdSdu1oA1rncCQL7sCj8vSyZkgtL7faaw9Tc9rZ3mGgraQ7+Pdx7w5mnOSF3gw9ZNG6oc+KXfkon3bKuROm0g==", + "dev": true + }, + "uglify-js": { + "version": "2.8.29", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-2.8.29.tgz", + "integrity": "sha1-KcVzMUgFe7Th913zW3qcty5qWd0=", + "dev": true, + "optional": true, + "requires": { + "source-map": "0.5.7", + "uglify-to-browserify": "1.0.2", + "yargs": "3.10.0" + }, + "dependencies": { + "camelcase": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-1.2.1.tgz", + "integrity": "sha1-m7UwTS4LVmmLLHWLCKPqqdqlijk=", + "dev": true, + "optional": true + }, + "cliui": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-2.1.0.tgz", + "integrity": "sha1-S0dXYP+AJkx2LDoXGQMukcf+oNE=", + "dev": true, + "optional": true, + "requires": { + "center-align": "0.1.3", + "right-align": "0.1.3", + "wordwrap": "0.0.2" + } + }, + "wordwrap": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.2.tgz", + "integrity": "sha1-t5Zpu0LstAn4PVg8rVLKF+qhZD8=", + "dev": true, + "optional": true + }, + "yargs": { + "version": "3.10.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-3.10.0.tgz", + "integrity": "sha1-9+572FfdfB0tOMDnTvvWgdFDH9E=", + "dev": true, + "optional": true, + "requires": { + "camelcase": "1.2.1", + "cliui": "2.1.0", + "decamelize": "1.2.0", + "window-size": "0.1.0" + } + } + } + }, + "uglify-to-browserify": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz", + "integrity": "sha1-bgkk1r2mta/jSeOabWMoUKD4grc=", + "dev": true, + "optional": true + }, "ultron": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/ultron/-/ultron-1.0.2.tgz", @@ -15684,6 +17596,12 @@ "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=", "dev": true }, + "unzip-response": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/unzip-response/-/unzip-response-2.0.1.tgz", + "integrity": "sha1-0vD3N9FrBhXnKmk17QQhRXLVb5c=", + "dev": true + }, "url": { "version": "0.11.0", "resolved": "https://registry.npmjs.org/url/-/url-0.11.0.tgz", @@ -15702,6 +17620,15 @@ } } }, + "url-parse-lax": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-1.0.0.tgz", + "integrity": "sha1-evjzA2Rem9eaJy56FKxovAYJ2nM=", + "dev": true, + "requires": { + "prepend-http": "1.0.4" + } + }, "user-home": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/user-home/-/user-home-1.1.1.tgz", @@ -15715,7 +17642,7 @@ "dev": true, "requires": { "lru-cache": "2.2.4", - "tmp": "0.0.31" + "tmp": "0.0.33" }, "dependencies": { "lru-cache": { @@ -15803,7 +17730,7 @@ "integrity": "sha1-sEVbOPxeDPMNQyUTLkYZcMIJHN4=", "dev": true, "requires": { - "clone": "1.0.2", + "clone": "1.0.3", "clone-stats": "0.0.1", "replace-ext": "0.0.1" } @@ -15920,7 +17847,7 @@ "dev": true, "requires": { "anymatch": "1.3.2", - "browserify": "14.4.0", + "browserify": "14.5.0", "chokidar": "1.7.0", "defined": "1.0.0", "outpipe": "1.1.1", @@ -15929,21 +17856,22 @@ }, "dependencies": { "browserify": { - "version": "14.4.0", - "resolved": "https://registry.npmjs.org/browserify/-/browserify-14.4.0.tgz", - "integrity": "sha1-CJo0Y69Y0OSNjNQHCz90ZU1avKk=", + "version": "14.5.0", + "resolved": "https://registry.npmjs.org/browserify/-/browserify-14.5.0.tgz", + "integrity": "sha512-gKfOsNQv/toWz+60nSPfYzuwSEdzvV2WdxrVPUbPD/qui44rAkB3t3muNtmmGYHqrG56FGwX9SUEQmzNLAeS7g==", "dev": true, "requires": { + "JSONStream": "1.3.1", "assert": "1.4.1", "browser-pack": "6.0.2", "browser-resolve": "1.11.2", - "browserify-zlib": "0.1.4", + "browserify-zlib": "0.2.0", "buffer": "5.0.8", "cached-path-relative": "1.0.1", "concat-stream": "1.5.2", "console-browserify": "1.1.0", "constants-browserify": "1.0.0", - "crypto-browserify": "3.11.1", + "crypto-browserify": "3.12.0", "defined": "1.0.0", "deps-sort": "2.0.0", "domain-browser": "1.1.7", @@ -15955,10 +17883,9 @@ "https-browserify": "1.0.0", "inherits": "2.0.3", "insert-module-globals": "7.0.1", - "JSONStream": "1.3.1", "labeled-stream-splicer": "2.0.0", "module-deps": "4.1.1", - "os-browserify": "0.1.2", + "os-browserify": "0.3.0", "parents": "1.0.1", "path-browserify": "0.0.0", "process": "0.11.10", @@ -15966,7 +17893,7 @@ "querystring-es3": "0.2.1", "read-only-stream": "2.0.0", "readable-stream": "2.3.3", - "resolve": "1.4.0", + "resolve": "1.5.0", "shasum": "1.0.2", "shell-quote": "1.6.1", "stream-browserify": "2.0.1", @@ -15983,6 +17910,15 @@ "xtend": "4.0.1" } }, + "browserify-zlib": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/browserify-zlib/-/browserify-zlib-0.2.0.tgz", + "integrity": "sha512-Z942RysHXmJrhqk88FmKBVq/v5tqmSkDz7p54G/MGyjMnCFFnC79XWNbg+Vta8W6Wb2qtSZTSxIGkJrRpCFEiA==", + "dev": true, + "requires": { + "pako": "1.0.6" + } + }, "buffer": { "version": "5.0.8", "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.0.8.tgz", @@ -15999,6 +17935,18 @@ "integrity": "sha1-7AbBDgo0wPL68Zn3/X/Hj//QPHM=", "dev": true }, + "os-browserify": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/os-browserify/-/os-browserify-0.3.0.tgz", + "integrity": "sha1-hUNzx/XCMVkU/Jv8a9gjj92h7Cc=", + "dev": true + }, + "pako": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.6.tgz", + "integrity": "sha512-lQe48YPsMJAig+yngZ87Lus+NF+3mtu7DVOBu6b/gHO1YpKwIj5AWjZ/TOS7i46HD/UixzWb1zeWDZfGZ3iYcg==", + "dev": true + }, "string_decoder": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", @@ -16026,14 +17974,20 @@ "dev": true }, "whatwg-encoding": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-1.0.1.tgz", - "integrity": "sha1-PGxFGhmO567FWx7GHQkgxngBpfQ=", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-1.0.3.tgz", + "integrity": "sha512-jLBwwKUhi8WtBfsMQlL4bUUcT8sMkAtQinscJAe/M4KHCkHuUJAF6vuB0tueNIw4c8ziO6AkRmgY+jL3a0iiPw==", "dev": true, "requires": { - "iconv-lite": "0.4.13" + "iconv-lite": "0.4.19" } }, + "whatwg-fetch": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-2.0.3.tgz", + "integrity": "sha1-nITsLc9oGH/wC8ZOEnS0QhduHIQ=", + "dev": true + }, "whatwg-url": { "version": "4.8.0", "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-4.8.0.tgz", @@ -16074,8 +18028,37 @@ "dev": true, "requires": { "string-width": "1.0.2" + }, + "dependencies": { + "is-fullwidth-code-point": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", + "dev": true, + "requires": { + "number-is-nan": "1.0.1" + } + }, + "string-width": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "dev": true, + "requires": { + "code-point-at": "1.1.0", + "is-fullwidth-code-point": "1.0.0", + "strip-ansi": "3.0.1" + } + } } }, + "window-size": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/window-size/-/window-size-0.1.0.tgz", + "integrity": "sha1-VDjNLqk7IC76Ohn+iIeu58lPnJ0=", + "dev": true, + "optional": true + }, "wordwrap": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", @@ -16090,6 +18073,28 @@ "requires": { "string-width": "1.0.2", "strip-ansi": "3.0.1" + }, + "dependencies": { + "is-fullwidth-code-point": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", + "dev": true, + "requires": { + "number-is-nan": "1.0.1" + } + }, + "string-width": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "dev": true, + "requires": { + "code-point-at": "1.1.0", + "is-fullwidth-code-point": "1.0.0", + "strip-ansi": "3.0.1" + } + } } }, "wrappy": { @@ -16126,7 +18131,7 @@ "requires": { "detect-indent": "5.0.0", "graceful-fs": "4.1.11", - "make-dir": "1.0.0", + "make-dir": "1.1.0", "pify": "3.0.0", "sort-keys": "2.0.0", "write-file-atomic": "2.3.0" @@ -16223,12 +18228,6 @@ "yargs-parser": "7.0.0" }, "dependencies": { - "ansi-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", - "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", - "dev": true - }, "camelcase": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", @@ -16244,12 +18243,6 @@ "locate-path": "2.0.0" } }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", - "dev": true - }, "load-json-file": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", @@ -16292,25 +18285,6 @@ "read-pkg": "2.0.0" } }, - "string-width": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", - "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", - "dev": true, - "requires": { - "is-fullwidth-code-point": "2.0.0", - "strip-ansi": "4.0.0" - } - }, - "strip-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", - "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", - "dev": true, - "requires": { - "ansi-regex": "3.0.0" - } - }, "strip-bom": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", diff --git a/package.json b/package.json index 37a34252..772dbb9d 100644 --- a/package.json +++ b/package.json @@ -1,10 +1,12 @@ { "private": true, "scripts": { + "checkFormat": "npm run prettier -- --list-different", "compile": "gulp build:cjs", - "format": "gulp format", + "format": "npm run prettier -- --write", "lerna": "lerna bootstrap -- --no-optional && npm install --no-optional", - "lint": "gulp lint", + "lint": "eslint 'packages/metal*/{src,test}/**/*.js'", + "prettier": "prettier-eslint 'packages/metal*/{src,test}/**/*.js'", "test": "gulp test && npm run test:isomorphic", "test:coverage": "gulp test:coverage", "test:coverage:open": "gulp test:coverage:open", @@ -19,7 +21,9 @@ "babelify": "^7.3.0", "browserify": "^13.0.1", "chai": "^3.5.0", - "eslint-plugin-react": "^6.8.0", + "eslint": "^4.10.0", + "eslint-config-liferay": "^2.0.7", + "eslint-plugin-react": "^7.4.0", "gulp": "^3.8.11", "gulp-babel": "^6.1.2", "gulp-metal": "^1.0.0", @@ -38,6 +42,7 @@ "metal-tools-soy": "^2.4.0", "metal-useragent": "^2.1.2", "mocha": "^2.5.3", + "prettier-eslint-cli": "^4.4.0", "sinon": "^1.17.4", "watchify": "^3.7.0" }, diff --git a/packages/metal-assertions/package-lock.json b/packages/metal-assertions/package-lock.json index f9c637f5..7e4c66d6 100644 --- a/packages/metal-assertions/package-lock.json +++ b/packages/metal-assertions/package-lock.json @@ -64,7 +64,7 @@ "lodash": "4.17.4", "minimatch": "3.0.4", "path-is-absolute": "1.0.1", - "private": "0.1.7", + "private": "0.1.8", "slash": "1.0.0", "source-map": "0.5.7" } @@ -507,9 +507,9 @@ } }, "babel-preset-env": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/babel-preset-env/-/babel-preset-env-1.6.0.tgz", - "integrity": "sha512-OVgtQRuOZKckrILgMA5rvctvFZPv72Gua9Rt006AiPoB0DJKGN07UmaQA+qRrYgK71MVct8fFhT0EyNWYorVew==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/babel-preset-env/-/babel-preset-env-1.6.1.tgz", + "integrity": "sha512-W6VIyA6Ch9ePMI7VptNn2wBM6dbG0eSz25HEiL40nQXCsXGTGZSTZu1Iap+cj3Q0S5a7T9+529l/5Bkvd+afNA==", "requires": { "babel-plugin-check-es2015-constants": "6.22.0", "babel-plugin-syntax-trailing-function-commas": "6.22.0", @@ -538,7 +538,7 @@ "babel-plugin-transform-es2015-unicode-regex": "6.24.1", "babel-plugin-transform-exponentiation-operator": "6.24.1", "babel-plugin-transform-regenerator": "6.26.0", - "browserslist": "2.5.1", + "browserslist": "2.8.0", "invariant": "2.2.2", "semver": "5.4.1" } @@ -625,18 +625,18 @@ } }, "browserslist": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-2.5.1.tgz", - "integrity": "sha512-jAvM2ku7YDJ+leAq3bFH1DE0Ylw+F+EQDq4GkqZfgPEqpWYw9ofQH85uKSB9r3Tv7XDbfqVtE+sdvKJW7IlPJA==", + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-2.8.0.tgz", + "integrity": "sha512-iiWHM1Et6Q4TQpB7Ar6pxuM3TNMXasVJY4Y/oh3q38EwR3Z+IdZ9MyVf7PI4MJFB4xpwMcZgs9bEUnPG2E3TCA==", "requires": { - "caniuse-lite": "1.0.30000746", - "electron-to-chromium": "1.3.25" + "caniuse-lite": "1.0.30000760", + "electron-to-chromium": "1.3.27" } }, "caniuse-lite": { - "version": "1.0.30000746", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000746.tgz", - "integrity": "sha1-xk+Vo5Jc/TAgejCO12wa6W6gnqA=" + "version": "1.0.30000760", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000760.tgz", + "integrity": "sha1-7HIDlXQvHH7IlH/W3SYE53qPmP8=" }, "chalk": { "version": "1.1.3", @@ -687,9 +687,9 @@ } }, "electron-to-chromium": { - "version": "1.3.25", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.25.tgz", - "integrity": "sha1-RTshAJg20Jl9hgNWAf9srkeRxGA=" + "version": "1.3.27", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.27.tgz", + "integrity": "sha1-eOy4o5kGYYe7N07t412ccFZagD0=" }, "escape-string-regexp": { "version": "1.0.5", @@ -879,9 +879,9 @@ "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" }, "private": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/private/-/private-0.1.7.tgz", - "integrity": "sha1-aM5eih7woju1cMwoU3tTMqumPvE=" + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/private/-/private-0.1.8.tgz", + "integrity": "sha512-VvivMrbvd2nKkiG38qjULzlc+4Vx4wm/whI9pQD35YrARNnhxeiRktSOhSukRLFNlzg6Br/cJPet5J/u19r/mg==" }, "regenerate": { "version": "1.3.3", @@ -900,7 +900,7 @@ "requires": { "babel-runtime": "6.26.0", "babel-types": "6.26.0", - "private": "0.1.7" + "private": "0.1.8" } }, "regexpu-core": { diff --git a/packages/metal-component/package-lock.json b/packages/metal-component/package-lock.json index f9c637f5..7e4c66d6 100644 --- a/packages/metal-component/package-lock.json +++ b/packages/metal-component/package-lock.json @@ -64,7 +64,7 @@ "lodash": "4.17.4", "minimatch": "3.0.4", "path-is-absolute": "1.0.1", - "private": "0.1.7", + "private": "0.1.8", "slash": "1.0.0", "source-map": "0.5.7" } @@ -507,9 +507,9 @@ } }, "babel-preset-env": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/babel-preset-env/-/babel-preset-env-1.6.0.tgz", - "integrity": "sha512-OVgtQRuOZKckrILgMA5rvctvFZPv72Gua9Rt006AiPoB0DJKGN07UmaQA+qRrYgK71MVct8fFhT0EyNWYorVew==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/babel-preset-env/-/babel-preset-env-1.6.1.tgz", + "integrity": "sha512-W6VIyA6Ch9ePMI7VptNn2wBM6dbG0eSz25HEiL40nQXCsXGTGZSTZu1Iap+cj3Q0S5a7T9+529l/5Bkvd+afNA==", "requires": { "babel-plugin-check-es2015-constants": "6.22.0", "babel-plugin-syntax-trailing-function-commas": "6.22.0", @@ -538,7 +538,7 @@ "babel-plugin-transform-es2015-unicode-regex": "6.24.1", "babel-plugin-transform-exponentiation-operator": "6.24.1", "babel-plugin-transform-regenerator": "6.26.0", - "browserslist": "2.5.1", + "browserslist": "2.8.0", "invariant": "2.2.2", "semver": "5.4.1" } @@ -625,18 +625,18 @@ } }, "browserslist": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-2.5.1.tgz", - "integrity": "sha512-jAvM2ku7YDJ+leAq3bFH1DE0Ylw+F+EQDq4GkqZfgPEqpWYw9ofQH85uKSB9r3Tv7XDbfqVtE+sdvKJW7IlPJA==", + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-2.8.0.tgz", + "integrity": "sha512-iiWHM1Et6Q4TQpB7Ar6pxuM3TNMXasVJY4Y/oh3q38EwR3Z+IdZ9MyVf7PI4MJFB4xpwMcZgs9bEUnPG2E3TCA==", "requires": { - "caniuse-lite": "1.0.30000746", - "electron-to-chromium": "1.3.25" + "caniuse-lite": "1.0.30000760", + "electron-to-chromium": "1.3.27" } }, "caniuse-lite": { - "version": "1.0.30000746", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000746.tgz", - "integrity": "sha1-xk+Vo5Jc/TAgejCO12wa6W6gnqA=" + "version": "1.0.30000760", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000760.tgz", + "integrity": "sha1-7HIDlXQvHH7IlH/W3SYE53qPmP8=" }, "chalk": { "version": "1.1.3", @@ -687,9 +687,9 @@ } }, "electron-to-chromium": { - "version": "1.3.25", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.25.tgz", - "integrity": "sha1-RTshAJg20Jl9hgNWAf9srkeRxGA=" + "version": "1.3.27", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.27.tgz", + "integrity": "sha1-eOy4o5kGYYe7N07t412ccFZagD0=" }, "escape-string-regexp": { "version": "1.0.5", @@ -879,9 +879,9 @@ "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" }, "private": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/private/-/private-0.1.7.tgz", - "integrity": "sha1-aM5eih7woju1cMwoU3tTMqumPvE=" + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/private/-/private-0.1.8.tgz", + "integrity": "sha512-VvivMrbvd2nKkiG38qjULzlc+4Vx4wm/whI9pQD35YrARNnhxeiRktSOhSukRLFNlzg6Br/cJPet5J/u19r/mg==" }, "regenerate": { "version": "1.3.3", @@ -900,7 +900,7 @@ "requires": { "babel-runtime": "6.26.0", "babel-types": "6.26.0", - "private": "0.1.7" + "private": "0.1.8" } }, "regexpu-core": { diff --git a/packages/metal-dom/package-lock.json b/packages/metal-dom/package-lock.json index f9c637f5..7e4c66d6 100644 --- a/packages/metal-dom/package-lock.json +++ b/packages/metal-dom/package-lock.json @@ -64,7 +64,7 @@ "lodash": "4.17.4", "minimatch": "3.0.4", "path-is-absolute": "1.0.1", - "private": "0.1.7", + "private": "0.1.8", "slash": "1.0.0", "source-map": "0.5.7" } @@ -507,9 +507,9 @@ } }, "babel-preset-env": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/babel-preset-env/-/babel-preset-env-1.6.0.tgz", - "integrity": "sha512-OVgtQRuOZKckrILgMA5rvctvFZPv72Gua9Rt006AiPoB0DJKGN07UmaQA+qRrYgK71MVct8fFhT0EyNWYorVew==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/babel-preset-env/-/babel-preset-env-1.6.1.tgz", + "integrity": "sha512-W6VIyA6Ch9ePMI7VptNn2wBM6dbG0eSz25HEiL40nQXCsXGTGZSTZu1Iap+cj3Q0S5a7T9+529l/5Bkvd+afNA==", "requires": { "babel-plugin-check-es2015-constants": "6.22.0", "babel-plugin-syntax-trailing-function-commas": "6.22.0", @@ -538,7 +538,7 @@ "babel-plugin-transform-es2015-unicode-regex": "6.24.1", "babel-plugin-transform-exponentiation-operator": "6.24.1", "babel-plugin-transform-regenerator": "6.26.0", - "browserslist": "2.5.1", + "browserslist": "2.8.0", "invariant": "2.2.2", "semver": "5.4.1" } @@ -625,18 +625,18 @@ } }, "browserslist": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-2.5.1.tgz", - "integrity": "sha512-jAvM2ku7YDJ+leAq3bFH1DE0Ylw+F+EQDq4GkqZfgPEqpWYw9ofQH85uKSB9r3Tv7XDbfqVtE+sdvKJW7IlPJA==", + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-2.8.0.tgz", + "integrity": "sha512-iiWHM1Et6Q4TQpB7Ar6pxuM3TNMXasVJY4Y/oh3q38EwR3Z+IdZ9MyVf7PI4MJFB4xpwMcZgs9bEUnPG2E3TCA==", "requires": { - "caniuse-lite": "1.0.30000746", - "electron-to-chromium": "1.3.25" + "caniuse-lite": "1.0.30000760", + "electron-to-chromium": "1.3.27" } }, "caniuse-lite": { - "version": "1.0.30000746", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000746.tgz", - "integrity": "sha1-xk+Vo5Jc/TAgejCO12wa6W6gnqA=" + "version": "1.0.30000760", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000760.tgz", + "integrity": "sha1-7HIDlXQvHH7IlH/W3SYE53qPmP8=" }, "chalk": { "version": "1.1.3", @@ -687,9 +687,9 @@ } }, "electron-to-chromium": { - "version": "1.3.25", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.25.tgz", - "integrity": "sha1-RTshAJg20Jl9hgNWAf9srkeRxGA=" + "version": "1.3.27", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.27.tgz", + "integrity": "sha1-eOy4o5kGYYe7N07t412ccFZagD0=" }, "escape-string-regexp": { "version": "1.0.5", @@ -879,9 +879,9 @@ "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" }, "private": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/private/-/private-0.1.7.tgz", - "integrity": "sha1-aM5eih7woju1cMwoU3tTMqumPvE=" + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/private/-/private-0.1.8.tgz", + "integrity": "sha512-VvivMrbvd2nKkiG38qjULzlc+4Vx4wm/whI9pQD35YrARNnhxeiRktSOhSukRLFNlzg6Br/cJPet5J/u19r/mg==" }, "regenerate": { "version": "1.3.3", @@ -900,7 +900,7 @@ "requires": { "babel-runtime": "6.26.0", "babel-types": "6.26.0", - "private": "0.1.7" + "private": "0.1.8" } }, "regexpu-core": { diff --git a/packages/metal-events/package-lock.json b/packages/metal-events/package-lock.json index f9c637f5..7e4c66d6 100644 --- a/packages/metal-events/package-lock.json +++ b/packages/metal-events/package-lock.json @@ -64,7 +64,7 @@ "lodash": "4.17.4", "minimatch": "3.0.4", "path-is-absolute": "1.0.1", - "private": "0.1.7", + "private": "0.1.8", "slash": "1.0.0", "source-map": "0.5.7" } @@ -507,9 +507,9 @@ } }, "babel-preset-env": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/babel-preset-env/-/babel-preset-env-1.6.0.tgz", - "integrity": "sha512-OVgtQRuOZKckrILgMA5rvctvFZPv72Gua9Rt006AiPoB0DJKGN07UmaQA+qRrYgK71MVct8fFhT0EyNWYorVew==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/babel-preset-env/-/babel-preset-env-1.6.1.tgz", + "integrity": "sha512-W6VIyA6Ch9ePMI7VptNn2wBM6dbG0eSz25HEiL40nQXCsXGTGZSTZu1Iap+cj3Q0S5a7T9+529l/5Bkvd+afNA==", "requires": { "babel-plugin-check-es2015-constants": "6.22.0", "babel-plugin-syntax-trailing-function-commas": "6.22.0", @@ -538,7 +538,7 @@ "babel-plugin-transform-es2015-unicode-regex": "6.24.1", "babel-plugin-transform-exponentiation-operator": "6.24.1", "babel-plugin-transform-regenerator": "6.26.0", - "browserslist": "2.5.1", + "browserslist": "2.8.0", "invariant": "2.2.2", "semver": "5.4.1" } @@ -625,18 +625,18 @@ } }, "browserslist": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-2.5.1.tgz", - "integrity": "sha512-jAvM2ku7YDJ+leAq3bFH1DE0Ylw+F+EQDq4GkqZfgPEqpWYw9ofQH85uKSB9r3Tv7XDbfqVtE+sdvKJW7IlPJA==", + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-2.8.0.tgz", + "integrity": "sha512-iiWHM1Et6Q4TQpB7Ar6pxuM3TNMXasVJY4Y/oh3q38EwR3Z+IdZ9MyVf7PI4MJFB4xpwMcZgs9bEUnPG2E3TCA==", "requires": { - "caniuse-lite": "1.0.30000746", - "electron-to-chromium": "1.3.25" + "caniuse-lite": "1.0.30000760", + "electron-to-chromium": "1.3.27" } }, "caniuse-lite": { - "version": "1.0.30000746", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000746.tgz", - "integrity": "sha1-xk+Vo5Jc/TAgejCO12wa6W6gnqA=" + "version": "1.0.30000760", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000760.tgz", + "integrity": "sha1-7HIDlXQvHH7IlH/W3SYE53qPmP8=" }, "chalk": { "version": "1.1.3", @@ -687,9 +687,9 @@ } }, "electron-to-chromium": { - "version": "1.3.25", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.25.tgz", - "integrity": "sha1-RTshAJg20Jl9hgNWAf9srkeRxGA=" + "version": "1.3.27", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.27.tgz", + "integrity": "sha1-eOy4o5kGYYe7N07t412ccFZagD0=" }, "escape-string-regexp": { "version": "1.0.5", @@ -879,9 +879,9 @@ "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" }, "private": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/private/-/private-0.1.7.tgz", - "integrity": "sha1-aM5eih7woju1cMwoU3tTMqumPvE=" + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/private/-/private-0.1.8.tgz", + "integrity": "sha512-VvivMrbvd2nKkiG38qjULzlc+4Vx4wm/whI9pQD35YrARNnhxeiRktSOhSukRLFNlzg6Br/cJPet5J/u19r/mg==" }, "regenerate": { "version": "1.3.3", @@ -900,7 +900,7 @@ "requires": { "babel-runtime": "6.26.0", "babel-types": "6.26.0", - "private": "0.1.7" + "private": "0.1.8" } }, "regexpu-core": { diff --git a/packages/metal-incremental-dom/package-lock.json b/packages/metal-incremental-dom/package-lock.json index fd905d11..84282c1e 100644 --- a/packages/metal-incremental-dom/package-lock.json +++ b/packages/metal-incremental-dom/package-lock.json @@ -64,7 +64,7 @@ "lodash": "4.17.4", "minimatch": "3.0.4", "path-is-absolute": "1.0.1", - "private": "0.1.7", + "private": "0.1.8", "slash": "1.0.0", "source-map": "0.5.7" } @@ -507,9 +507,9 @@ } }, "babel-preset-env": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/babel-preset-env/-/babel-preset-env-1.6.0.tgz", - "integrity": "sha512-OVgtQRuOZKckrILgMA5rvctvFZPv72Gua9Rt006AiPoB0DJKGN07UmaQA+qRrYgK71MVct8fFhT0EyNWYorVew==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/babel-preset-env/-/babel-preset-env-1.6.1.tgz", + "integrity": "sha512-W6VIyA6Ch9ePMI7VptNn2wBM6dbG0eSz25HEiL40nQXCsXGTGZSTZu1Iap+cj3Q0S5a7T9+529l/5Bkvd+afNA==", "requires": { "babel-plugin-check-es2015-constants": "6.22.0", "babel-plugin-syntax-trailing-function-commas": "6.22.0", @@ -538,7 +538,7 @@ "babel-plugin-transform-es2015-unicode-regex": "6.24.1", "babel-plugin-transform-exponentiation-operator": "6.24.1", "babel-plugin-transform-regenerator": "6.26.0", - "browserslist": "2.5.1", + "browserslist": "2.8.0", "invariant": "2.2.2", "semver": "5.4.1" } @@ -625,18 +625,18 @@ } }, "browserslist": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-2.5.1.tgz", - "integrity": "sha512-jAvM2ku7YDJ+leAq3bFH1DE0Ylw+F+EQDq4GkqZfgPEqpWYw9ofQH85uKSB9r3Tv7XDbfqVtE+sdvKJW7IlPJA==", + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-2.8.0.tgz", + "integrity": "sha512-iiWHM1Et6Q4TQpB7Ar6pxuM3TNMXasVJY4Y/oh3q38EwR3Z+IdZ9MyVf7PI4MJFB4xpwMcZgs9bEUnPG2E3TCA==", "requires": { - "caniuse-lite": "1.0.30000746", - "electron-to-chromium": "1.3.25" + "caniuse-lite": "1.0.30000760", + "electron-to-chromium": "1.3.27" } }, "caniuse-lite": { - "version": "1.0.30000746", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000746.tgz", - "integrity": "sha1-xk+Vo5Jc/TAgejCO12wa6W6gnqA=" + "version": "1.0.30000760", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000760.tgz", + "integrity": "sha1-7HIDlXQvHH7IlH/W3SYE53qPmP8=" }, "chalk": { "version": "1.1.3", @@ -687,9 +687,9 @@ } }, "electron-to-chromium": { - "version": "1.3.25", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.25.tgz", - "integrity": "sha1-RTshAJg20Jl9hgNWAf9srkeRxGA=" + "version": "1.3.27", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.27.tgz", + "integrity": "sha1-eOy4o5kGYYe7N07t412ccFZagD0=" }, "escape-string-regexp": { "version": "1.0.5", @@ -889,9 +889,9 @@ "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" }, "private": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/private/-/private-0.1.7.tgz", - "integrity": "sha1-aM5eih7woju1cMwoU3tTMqumPvE=" + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/private/-/private-0.1.8.tgz", + "integrity": "sha512-VvivMrbvd2nKkiG38qjULzlc+4Vx4wm/whI9pQD35YrARNnhxeiRktSOhSukRLFNlzg6Br/cJPet5J/u19r/mg==" }, "regenerate": { "version": "1.3.3", @@ -910,7 +910,7 @@ "requires": { "babel-runtime": "6.26.0", "babel-types": "6.26.0", - "private": "0.1.7" + "private": "0.1.8" } }, "regexpu-core": { diff --git a/packages/metal-jsx/package-lock.json b/packages/metal-jsx/package-lock.json index b45b5193..91563676 100644 --- a/packages/metal-jsx/package-lock.json +++ b/packages/metal-jsx/package-lock.json @@ -64,7 +64,7 @@ "lodash": "4.17.4", "minimatch": "3.0.4", "path-is-absolute": "1.0.1", - "private": "0.1.7", + "private": "0.1.8", "slash": "1.0.0", "source-map": "0.5.7" } @@ -521,9 +521,9 @@ } }, "babel-preset-env": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/babel-preset-env/-/babel-preset-env-1.6.0.tgz", - "integrity": "sha512-OVgtQRuOZKckrILgMA5rvctvFZPv72Gua9Rt006AiPoB0DJKGN07UmaQA+qRrYgK71MVct8fFhT0EyNWYorVew==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/babel-preset-env/-/babel-preset-env-1.6.1.tgz", + "integrity": "sha512-W6VIyA6Ch9ePMI7VptNn2wBM6dbG0eSz25HEiL40nQXCsXGTGZSTZu1Iap+cj3Q0S5a7T9+529l/5Bkvd+afNA==", "requires": { "babel-plugin-check-es2015-constants": "6.22.0", "babel-plugin-syntax-trailing-function-commas": "6.22.0", @@ -552,7 +552,7 @@ "babel-plugin-transform-es2015-unicode-regex": "6.24.1", "babel-plugin-transform-exponentiation-operator": "6.24.1", "babel-plugin-transform-regenerator": "6.26.0", - "browserslist": "2.5.1", + "browserslist": "2.8.0", "invariant": "2.2.2", "semver": "5.4.1" } @@ -647,18 +647,18 @@ } }, "browserslist": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-2.5.1.tgz", - "integrity": "sha512-jAvM2ku7YDJ+leAq3bFH1DE0Ylw+F+EQDq4GkqZfgPEqpWYw9ofQH85uKSB9r3Tv7XDbfqVtE+sdvKJW7IlPJA==", + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-2.8.0.tgz", + "integrity": "sha512-iiWHM1Et6Q4TQpB7Ar6pxuM3TNMXasVJY4Y/oh3q38EwR3Z+IdZ9MyVf7PI4MJFB4xpwMcZgs9bEUnPG2E3TCA==", "requires": { - "caniuse-lite": "1.0.30000746", - "electron-to-chromium": "1.3.25" + "caniuse-lite": "1.0.30000760", + "electron-to-chromium": "1.3.27" } }, "caniuse-lite": { - "version": "1.0.30000746", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000746.tgz", - "integrity": "sha1-xk+Vo5Jc/TAgejCO12wa6W6gnqA=" + "version": "1.0.30000760", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000760.tgz", + "integrity": "sha1-7HIDlXQvHH7IlH/W3SYE53qPmP8=" }, "chalk": { "version": "1.1.3", @@ -709,9 +709,9 @@ } }, "electron-to-chromium": { - "version": "1.3.25", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.25.tgz", - "integrity": "sha1-RTshAJg20Jl9hgNWAf9srkeRxGA=" + "version": "1.3.27", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.27.tgz", + "integrity": "sha1-eOy4o5kGYYe7N07t412ccFZagD0=" }, "escape-string-regexp": { "version": "1.0.5", @@ -901,9 +901,9 @@ "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" }, "private": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/private/-/private-0.1.7.tgz", - "integrity": "sha1-aM5eih7woju1cMwoU3tTMqumPvE=" + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/private/-/private-0.1.8.tgz", + "integrity": "sha512-VvivMrbvd2nKkiG38qjULzlc+4Vx4wm/whI9pQD35YrARNnhxeiRktSOhSukRLFNlzg6Br/cJPet5J/u19r/mg==" }, "regenerate": { "version": "1.3.3", @@ -922,7 +922,7 @@ "requires": { "babel-runtime": "6.26.0", "babel-types": "6.26.0", - "private": "0.1.7" + "private": "0.1.8" } }, "regexpu-core": { diff --git a/packages/metal-soy-bundle/package-lock.json b/packages/metal-soy-bundle/package-lock.json index 37f00daa..3fe583ac 100644 --- a/packages/metal-soy-bundle/package-lock.json +++ b/packages/metal-soy-bundle/package-lock.json @@ -107,7 +107,7 @@ "lodash": "4.17.4", "minimatch": "3.0.4", "path-is-absolute": "1.0.1", - "private": "0.1.7", + "private": "0.1.8", "slash": "1.0.0", "source-map": "0.5.7" } @@ -550,9 +550,9 @@ } }, "babel-preset-env": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/babel-preset-env/-/babel-preset-env-1.6.0.tgz", - "integrity": "sha512-OVgtQRuOZKckrILgMA5rvctvFZPv72Gua9Rt006AiPoB0DJKGN07UmaQA+qRrYgK71MVct8fFhT0EyNWYorVew==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/babel-preset-env/-/babel-preset-env-1.6.1.tgz", + "integrity": "sha512-W6VIyA6Ch9ePMI7VptNn2wBM6dbG0eSz25HEiL40nQXCsXGTGZSTZu1Iap+cj3Q0S5a7T9+529l/5Bkvd+afNA==", "requires": { "babel-plugin-check-es2015-constants": "6.22.0", "babel-plugin-syntax-trailing-function-commas": "6.22.0", @@ -581,7 +581,7 @@ "babel-plugin-transform-es2015-unicode-regex": "6.24.1", "babel-plugin-transform-exponentiation-operator": "6.24.1", "babel-plugin-transform-regenerator": "6.26.0", - "browserslist": "2.5.1", + "browserslist": "2.8.0", "invariant": "2.2.2", "semver": "5.4.1" } @@ -688,18 +688,18 @@ } }, "browserslist": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-2.5.1.tgz", - "integrity": "sha512-jAvM2ku7YDJ+leAq3bFH1DE0Ylw+F+EQDq4GkqZfgPEqpWYw9ofQH85uKSB9r3Tv7XDbfqVtE+sdvKJW7IlPJA==", + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-2.8.0.tgz", + "integrity": "sha512-iiWHM1Et6Q4TQpB7Ar6pxuM3TNMXasVJY4Y/oh3q38EwR3Z+IdZ9MyVf7PI4MJFB4xpwMcZgs9bEUnPG2E3TCA==", "requires": { - "caniuse-lite": "1.0.30000746", - "electron-to-chromium": "1.3.25" + "caniuse-lite": "1.0.30000760", + "electron-to-chromium": "1.3.27" } }, "caniuse-lite": { - "version": "1.0.30000746", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000746.tgz", - "integrity": "sha1-xk+Vo5Jc/TAgejCO12wa6W6gnqA=" + "version": "1.0.30000760", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000760.tgz", + "integrity": "sha1-7HIDlXQvHH7IlH/W3SYE53qPmP8=" }, "chalk": { "version": "1.1.3", @@ -723,9 +723,9 @@ } }, "clone": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/clone/-/clone-1.0.2.tgz", - "integrity": "sha1-Jgt6meux7f4kdTgXX3gyQ8sZ0Uk=" + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/clone/-/clone-1.0.3.tgz", + "integrity": "sha1-KY1+IjFmD0DAA8LtMUDezz9TCF8=" }, "clone-buffer": { "version": "1.0.0", @@ -811,7 +811,7 @@ "resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.3.tgz", "integrity": "sha1-xlYFHpgX2f8I7YgUd/P+QBnz730=", "requires": { - "clone": "1.0.2" + "clone": "1.0.3" } }, "deprecated": { @@ -892,9 +892,9 @@ } }, "electron-to-chromium": { - "version": "1.3.25", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.25.tgz", - "integrity": "sha1-RTshAJg20Jl9hgNWAf9srkeRxGA=" + "version": "1.3.27", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.27.tgz", + "integrity": "sha1-eOy4o5kGYYe7N07t412ccFZagD0=" }, "end-of-stream": { "version": "0.1.5", @@ -1548,9 +1548,9 @@ } }, "is-buffer": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.5.tgz", - "integrity": "sha1-Hzsm72E7IUuIy8ojzGwB2Hlh7sw=" + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==" }, "is-dotfile": { "version": "1.0.3", @@ -1726,7 +1726,7 @@ "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "requires": { - "is-buffer": "1.1.5" + "is-buffer": "1.1.6" } }, "liftoff": { @@ -1742,7 +1742,7 @@ "lodash.isstring": "4.0.1", "lodash.mapvalues": "4.6.0", "rechoir": "0.6.2", - "resolve": "1.4.0" + "resolve": "1.5.0" } }, "lodash": { @@ -2134,9 +2134,9 @@ "integrity": "sha1-t+PqQkNaTJsnWdmeDyAesZWALuE=" }, "private": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/private/-/private-0.1.7.tgz", - "integrity": "sha1-aM5eih7woju1cMwoU3tTMqumPvE=" + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/private/-/private-0.1.8.tgz", + "integrity": "sha512-VvivMrbvd2nKkiG38qjULzlc+4Vx4wm/whI9pQD35YrARNnhxeiRktSOhSukRLFNlzg6Br/cJPet5J/u19r/mg==" }, "process-nextick-args": { "version": "1.0.7", @@ -2165,7 +2165,7 @@ "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "requires": { - "is-buffer": "1.1.5" + "is-buffer": "1.1.6" } } } @@ -2175,7 +2175,7 @@ "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-4.0.0.tgz", "integrity": "sha1-IIE989cSkosgc3hpGkUGb65y3Vc=", "requires": { - "is-buffer": "1.1.5" + "is-buffer": "1.1.6" } } } @@ -2196,7 +2196,7 @@ "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz", "integrity": "sha1-hSBLVNuoLVdC4oyWdW70OvUOM4Q=", "requires": { - "resolve": "1.4.0" + "resolve": "1.5.0" } }, "regenerate": { @@ -2216,7 +2216,7 @@ "requires": { "babel-runtime": "6.26.0", "babel-types": "6.26.0", - "private": "0.1.7" + "private": "0.1.8" } }, "regex-cache": { @@ -2325,9 +2325,9 @@ } }, "resolve": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.4.0.tgz", - "integrity": "sha512-aW7sVKPufyHqOmyyLzg/J+8606v5nevBgaliIlV7nUpVMsDnoBGV/cbSLNjZAg9q0Cfd/+easKVKQ8vOu8fn1Q==", + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.5.0.tgz", + "integrity": "sha512-hgoSGrc3pjzAPHNBg+KnFcK2HwlHTs/YrAGUr6qgTVUZmXv1UEXXl0bZNBKMA9fud6lRYFdPGz0xXxycPzmmiw==", "requires": { "path-parse": "1.0.5" } @@ -2546,7 +2546,7 @@ "resolved": "https://registry.npmjs.org/vinyl/-/vinyl-0.5.3.tgz", "integrity": "sha1-sEVbOPxeDPMNQyUTLkYZcMIJHN4=", "requires": { - "clone": "1.0.2", + "clone": "1.0.3", "clone-stats": "0.0.1", "replace-ext": "0.0.1" } diff --git a/packages/metal-soy/package-lock.json b/packages/metal-soy/package-lock.json index f9c637f5..7e4c66d6 100644 --- a/packages/metal-soy/package-lock.json +++ b/packages/metal-soy/package-lock.json @@ -64,7 +64,7 @@ "lodash": "4.17.4", "minimatch": "3.0.4", "path-is-absolute": "1.0.1", - "private": "0.1.7", + "private": "0.1.8", "slash": "1.0.0", "source-map": "0.5.7" } @@ -507,9 +507,9 @@ } }, "babel-preset-env": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/babel-preset-env/-/babel-preset-env-1.6.0.tgz", - "integrity": "sha512-OVgtQRuOZKckrILgMA5rvctvFZPv72Gua9Rt006AiPoB0DJKGN07UmaQA+qRrYgK71MVct8fFhT0EyNWYorVew==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/babel-preset-env/-/babel-preset-env-1.6.1.tgz", + "integrity": "sha512-W6VIyA6Ch9ePMI7VptNn2wBM6dbG0eSz25HEiL40nQXCsXGTGZSTZu1Iap+cj3Q0S5a7T9+529l/5Bkvd+afNA==", "requires": { "babel-plugin-check-es2015-constants": "6.22.0", "babel-plugin-syntax-trailing-function-commas": "6.22.0", @@ -538,7 +538,7 @@ "babel-plugin-transform-es2015-unicode-regex": "6.24.1", "babel-plugin-transform-exponentiation-operator": "6.24.1", "babel-plugin-transform-regenerator": "6.26.0", - "browserslist": "2.5.1", + "browserslist": "2.8.0", "invariant": "2.2.2", "semver": "5.4.1" } @@ -625,18 +625,18 @@ } }, "browserslist": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-2.5.1.tgz", - "integrity": "sha512-jAvM2ku7YDJ+leAq3bFH1DE0Ylw+F+EQDq4GkqZfgPEqpWYw9ofQH85uKSB9r3Tv7XDbfqVtE+sdvKJW7IlPJA==", + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-2.8.0.tgz", + "integrity": "sha512-iiWHM1Et6Q4TQpB7Ar6pxuM3TNMXasVJY4Y/oh3q38EwR3Z+IdZ9MyVf7PI4MJFB4xpwMcZgs9bEUnPG2E3TCA==", "requires": { - "caniuse-lite": "1.0.30000746", - "electron-to-chromium": "1.3.25" + "caniuse-lite": "1.0.30000760", + "electron-to-chromium": "1.3.27" } }, "caniuse-lite": { - "version": "1.0.30000746", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000746.tgz", - "integrity": "sha1-xk+Vo5Jc/TAgejCO12wa6W6gnqA=" + "version": "1.0.30000760", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000760.tgz", + "integrity": "sha1-7HIDlXQvHH7IlH/W3SYE53qPmP8=" }, "chalk": { "version": "1.1.3", @@ -687,9 +687,9 @@ } }, "electron-to-chromium": { - "version": "1.3.25", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.25.tgz", - "integrity": "sha1-RTshAJg20Jl9hgNWAf9srkeRxGA=" + "version": "1.3.27", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.27.tgz", + "integrity": "sha1-eOy4o5kGYYe7N07t412ccFZagD0=" }, "escape-string-regexp": { "version": "1.0.5", @@ -879,9 +879,9 @@ "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" }, "private": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/private/-/private-0.1.7.tgz", - "integrity": "sha1-aM5eih7woju1cMwoU3tTMqumPvE=" + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/private/-/private-0.1.8.tgz", + "integrity": "sha512-VvivMrbvd2nKkiG38qjULzlc+4Vx4wm/whI9pQD35YrARNnhxeiRktSOhSukRLFNlzg6Br/cJPet5J/u19r/mg==" }, "regenerate": { "version": "1.3.3", @@ -900,7 +900,7 @@ "requires": { "babel-runtime": "6.26.0", "babel-types": "6.26.0", - "private": "0.1.7" + "private": "0.1.8" } }, "regexpu-core": { diff --git a/packages/metal-state/package-lock.json b/packages/metal-state/package-lock.json index f9c637f5..7e4c66d6 100644 --- a/packages/metal-state/package-lock.json +++ b/packages/metal-state/package-lock.json @@ -64,7 +64,7 @@ "lodash": "4.17.4", "minimatch": "3.0.4", "path-is-absolute": "1.0.1", - "private": "0.1.7", + "private": "0.1.8", "slash": "1.0.0", "source-map": "0.5.7" } @@ -507,9 +507,9 @@ } }, "babel-preset-env": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/babel-preset-env/-/babel-preset-env-1.6.0.tgz", - "integrity": "sha512-OVgtQRuOZKckrILgMA5rvctvFZPv72Gua9Rt006AiPoB0DJKGN07UmaQA+qRrYgK71MVct8fFhT0EyNWYorVew==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/babel-preset-env/-/babel-preset-env-1.6.1.tgz", + "integrity": "sha512-W6VIyA6Ch9ePMI7VptNn2wBM6dbG0eSz25HEiL40nQXCsXGTGZSTZu1Iap+cj3Q0S5a7T9+529l/5Bkvd+afNA==", "requires": { "babel-plugin-check-es2015-constants": "6.22.0", "babel-plugin-syntax-trailing-function-commas": "6.22.0", @@ -538,7 +538,7 @@ "babel-plugin-transform-es2015-unicode-regex": "6.24.1", "babel-plugin-transform-exponentiation-operator": "6.24.1", "babel-plugin-transform-regenerator": "6.26.0", - "browserslist": "2.5.1", + "browserslist": "2.8.0", "invariant": "2.2.2", "semver": "5.4.1" } @@ -625,18 +625,18 @@ } }, "browserslist": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-2.5.1.tgz", - "integrity": "sha512-jAvM2ku7YDJ+leAq3bFH1DE0Ylw+F+EQDq4GkqZfgPEqpWYw9ofQH85uKSB9r3Tv7XDbfqVtE+sdvKJW7IlPJA==", + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-2.8.0.tgz", + "integrity": "sha512-iiWHM1Et6Q4TQpB7Ar6pxuM3TNMXasVJY4Y/oh3q38EwR3Z+IdZ9MyVf7PI4MJFB4xpwMcZgs9bEUnPG2E3TCA==", "requires": { - "caniuse-lite": "1.0.30000746", - "electron-to-chromium": "1.3.25" + "caniuse-lite": "1.0.30000760", + "electron-to-chromium": "1.3.27" } }, "caniuse-lite": { - "version": "1.0.30000746", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000746.tgz", - "integrity": "sha1-xk+Vo5Jc/TAgejCO12wa6W6gnqA=" + "version": "1.0.30000760", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000760.tgz", + "integrity": "sha1-7HIDlXQvHH7IlH/W3SYE53qPmP8=" }, "chalk": { "version": "1.1.3", @@ -687,9 +687,9 @@ } }, "electron-to-chromium": { - "version": "1.3.25", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.25.tgz", - "integrity": "sha1-RTshAJg20Jl9hgNWAf9srkeRxGA=" + "version": "1.3.27", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.27.tgz", + "integrity": "sha1-eOy4o5kGYYe7N07t412ccFZagD0=" }, "escape-string-regexp": { "version": "1.0.5", @@ -879,9 +879,9 @@ "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" }, "private": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/private/-/private-0.1.7.tgz", - "integrity": "sha1-aM5eih7woju1cMwoU3tTMqumPvE=" + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/private/-/private-0.1.8.tgz", + "integrity": "sha512-VvivMrbvd2nKkiG38qjULzlc+4Vx4wm/whI9pQD35YrARNnhxeiRktSOhSukRLFNlzg6Br/cJPet5J/u19r/mg==" }, "regenerate": { "version": "1.3.3", @@ -900,7 +900,7 @@ "requires": { "babel-runtime": "6.26.0", "babel-types": "6.26.0", - "private": "0.1.7" + "private": "0.1.8" } }, "regexpu-core": { diff --git a/packages/metal-web-component/package-lock.json b/packages/metal-web-component/package-lock.json index 65ab2703..e9918c21 100644 --- a/packages/metal-web-component/package-lock.json +++ b/packages/metal-web-component/package-lock.json @@ -3,7 +3,7 @@ "lockfileVersion": 1, "dependencies": { "@webcomponents/webcomponentsjs": { - "version": "github:webcomponents/webcomponentsjs#eb9edd87fb7662ff56aef786b8cd5e229d3342fb" + "version": "github:webcomponents/webcomponentsjs#1913eb6cf975a598fc04cd8a4371f787b4a32088" }, "ansi-regex": { "version": "2.1.1", @@ -67,7 +67,7 @@ "lodash": "4.17.4", "minimatch": "3.0.4", "path-is-absolute": "1.0.1", - "private": "0.1.7", + "private": "0.1.8", "slash": "1.0.0", "source-map": "0.5.7" } @@ -510,9 +510,9 @@ } }, "babel-preset-env": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/babel-preset-env/-/babel-preset-env-1.6.0.tgz", - "integrity": "sha512-OVgtQRuOZKckrILgMA5rvctvFZPv72Gua9Rt006AiPoB0DJKGN07UmaQA+qRrYgK71MVct8fFhT0EyNWYorVew==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/babel-preset-env/-/babel-preset-env-1.6.1.tgz", + "integrity": "sha512-W6VIyA6Ch9ePMI7VptNn2wBM6dbG0eSz25HEiL40nQXCsXGTGZSTZu1Iap+cj3Q0S5a7T9+529l/5Bkvd+afNA==", "requires": { "babel-plugin-check-es2015-constants": "6.22.0", "babel-plugin-syntax-trailing-function-commas": "6.22.0", @@ -541,7 +541,7 @@ "babel-plugin-transform-es2015-unicode-regex": "6.24.1", "babel-plugin-transform-exponentiation-operator": "6.24.1", "babel-plugin-transform-regenerator": "6.26.0", - "browserslist": "2.5.1", + "browserslist": "2.8.0", "invariant": "2.2.2", "semver": "5.4.1" } @@ -628,18 +628,18 @@ } }, "browserslist": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-2.5.1.tgz", - "integrity": "sha512-jAvM2ku7YDJ+leAq3bFH1DE0Ylw+F+EQDq4GkqZfgPEqpWYw9ofQH85uKSB9r3Tv7XDbfqVtE+sdvKJW7IlPJA==", + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-2.8.0.tgz", + "integrity": "sha512-iiWHM1Et6Q4TQpB7Ar6pxuM3TNMXasVJY4Y/oh3q38EwR3Z+IdZ9MyVf7PI4MJFB4xpwMcZgs9bEUnPG2E3TCA==", "requires": { - "caniuse-lite": "1.0.30000746", - "electron-to-chromium": "1.3.25" + "caniuse-lite": "1.0.30000760", + "electron-to-chromium": "1.3.27" } }, "caniuse-lite": { - "version": "1.0.30000746", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000746.tgz", - "integrity": "sha1-xk+Vo5Jc/TAgejCO12wa6W6gnqA=" + "version": "1.0.30000760", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000760.tgz", + "integrity": "sha1-7HIDlXQvHH7IlH/W3SYE53qPmP8=" }, "chalk": { "version": "1.1.3", @@ -690,9 +690,9 @@ } }, "electron-to-chromium": { - "version": "1.3.25", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.25.tgz", - "integrity": "sha1-RTshAJg20Jl9hgNWAf9srkeRxGA=" + "version": "1.3.27", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.27.tgz", + "integrity": "sha1-eOy4o5kGYYe7N07t412ccFZagD0=" }, "escape-string-regexp": { "version": "1.0.5", @@ -813,16 +813,16 @@ } }, "metal": { - "version": "2.13.2", - "resolved": "https://registry.npmjs.org/metal/-/metal-2.13.2.tgz", - "integrity": "sha512-DqETxwvyW5I/3blSlxrr1eleLaLHItK1VJcGIL6hAVqSlUpYw0r+RXd8qWfIq6TMdjCU3/x/oGmWZyk+O4SZJw==" + "version": "2.14.0", + "resolved": "https://registry.npmjs.org/metal/-/metal-2.14.0.tgz", + "integrity": "sha512-dk4MUJZ5Rj+sB9RgZcATU8QRDxHKPn85ymVWC+PamDhcIEYsY5Fg+I6vOQ1Bo4J+54z/k9KF2K7fmUIRtoRb+w==" }, "metal-events": { - "version": "2.13.2", - "resolved": "https://registry.npmjs.org/metal-events/-/metal-events-2.13.2.tgz", - "integrity": "sha512-iEuqr5+T87Bq114wV/okNzwS25i/c4jqmIZ6IBLPFTD1Gxbk6qEiklnWf7Z2iVbqPYOz+2LgL130Nt2U4eb9tA==", + "version": "2.14.0", + "resolved": "https://registry.npmjs.org/metal-events/-/metal-events-2.14.0.tgz", + "integrity": "sha512-LKV9EOMRzM1Sb5BD4Hfcy7aaepCCRrDVbMOq9O48KuGXawKG4XTZcLhR6J1dFI3UzF+BeO11Kh1v+4DxUAH1CA==", "requires": { - "metal": "2.13.2" + "metal": "2.14.0" } }, "metal-state": { @@ -830,8 +830,8 @@ "resolved": "https://registry.npmjs.org/metal-state/-/metal-state-2.7.0.tgz", "integrity": "sha1-VWis04wc2O/Mr7kAiWDVCN9/olI=", "requires": { - "metal": "2.13.2", - "metal-events": "2.13.2" + "metal": "2.14.0", + "metal-events": "2.14.0" } }, "metal-useragent": { @@ -839,7 +839,7 @@ "resolved": "https://registry.npmjs.org/metal-useragent/-/metal-useragent-2.1.3.tgz", "integrity": "sha1-9Yfb1hPE18kFBjn1iXMSdThjcWk=", "requires": { - "metal": "2.13.2" + "metal": "2.14.0" } }, "minimatch": { @@ -912,9 +912,9 @@ "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" }, "private": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/private/-/private-0.1.7.tgz", - "integrity": "sha1-aM5eih7woju1cMwoU3tTMqumPvE=" + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/private/-/private-0.1.8.tgz", + "integrity": "sha512-VvivMrbvd2nKkiG38qjULzlc+4Vx4wm/whI9pQD35YrARNnhxeiRktSOhSukRLFNlzg6Br/cJPet5J/u19r/mg==" }, "regenerate": { "version": "1.3.3", @@ -933,7 +933,7 @@ "requires": { "babel-runtime": "6.26.0", "babel-types": "6.26.0", - "private": "0.1.7" + "private": "0.1.8" } }, "regexpu-core": { diff --git a/packages/metal/package-lock.json b/packages/metal/package-lock.json index f9c637f5..7e4c66d6 100644 --- a/packages/metal/package-lock.json +++ b/packages/metal/package-lock.json @@ -64,7 +64,7 @@ "lodash": "4.17.4", "minimatch": "3.0.4", "path-is-absolute": "1.0.1", - "private": "0.1.7", + "private": "0.1.8", "slash": "1.0.0", "source-map": "0.5.7" } @@ -507,9 +507,9 @@ } }, "babel-preset-env": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/babel-preset-env/-/babel-preset-env-1.6.0.tgz", - "integrity": "sha512-OVgtQRuOZKckrILgMA5rvctvFZPv72Gua9Rt006AiPoB0DJKGN07UmaQA+qRrYgK71MVct8fFhT0EyNWYorVew==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/babel-preset-env/-/babel-preset-env-1.6.1.tgz", + "integrity": "sha512-W6VIyA6Ch9ePMI7VptNn2wBM6dbG0eSz25HEiL40nQXCsXGTGZSTZu1Iap+cj3Q0S5a7T9+529l/5Bkvd+afNA==", "requires": { "babel-plugin-check-es2015-constants": "6.22.0", "babel-plugin-syntax-trailing-function-commas": "6.22.0", @@ -538,7 +538,7 @@ "babel-plugin-transform-es2015-unicode-regex": "6.24.1", "babel-plugin-transform-exponentiation-operator": "6.24.1", "babel-plugin-transform-regenerator": "6.26.0", - "browserslist": "2.5.1", + "browserslist": "2.8.0", "invariant": "2.2.2", "semver": "5.4.1" } @@ -625,18 +625,18 @@ } }, "browserslist": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-2.5.1.tgz", - "integrity": "sha512-jAvM2ku7YDJ+leAq3bFH1DE0Ylw+F+EQDq4GkqZfgPEqpWYw9ofQH85uKSB9r3Tv7XDbfqVtE+sdvKJW7IlPJA==", + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-2.8.0.tgz", + "integrity": "sha512-iiWHM1Et6Q4TQpB7Ar6pxuM3TNMXasVJY4Y/oh3q38EwR3Z+IdZ9MyVf7PI4MJFB4xpwMcZgs9bEUnPG2E3TCA==", "requires": { - "caniuse-lite": "1.0.30000746", - "electron-to-chromium": "1.3.25" + "caniuse-lite": "1.0.30000760", + "electron-to-chromium": "1.3.27" } }, "caniuse-lite": { - "version": "1.0.30000746", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000746.tgz", - "integrity": "sha1-xk+Vo5Jc/TAgejCO12wa6W6gnqA=" + "version": "1.0.30000760", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000760.tgz", + "integrity": "sha1-7HIDlXQvHH7IlH/W3SYE53qPmP8=" }, "chalk": { "version": "1.1.3", @@ -687,9 +687,9 @@ } }, "electron-to-chromium": { - "version": "1.3.25", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.25.tgz", - "integrity": "sha1-RTshAJg20Jl9hgNWAf9srkeRxGA=" + "version": "1.3.27", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.27.tgz", + "integrity": "sha1-eOy4o5kGYYe7N07t412ccFZagD0=" }, "escape-string-regexp": { "version": "1.0.5", @@ -879,9 +879,9 @@ "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" }, "private": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/private/-/private-0.1.7.tgz", - "integrity": "sha1-aM5eih7woju1cMwoU3tTMqumPvE=" + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/private/-/private-0.1.8.tgz", + "integrity": "sha512-VvivMrbvd2nKkiG38qjULzlc+4Vx4wm/whI9pQD35YrARNnhxeiRktSOhSukRLFNlzg6Br/cJPet5J/u19r/mg==" }, "regenerate": { "version": "1.3.3", @@ -900,7 +900,7 @@ "requires": { "babel-runtime": "6.26.0", "babel-types": "6.26.0", - "private": "0.1.7" + "private": "0.1.8" } }, "regexpu-core": { From b7fc707eaff40bd85181dea83849ff2c698e122e Mon Sep 17 00:00:00 2001 From: Chema Balsas Date: Thu, 9 Nov 2017 21:11:47 -0800 Subject: [PATCH 02/70] Formats files acording to guidelines (auto-generated) --- packages/metal-assertions/test/assertions.js | 1 - packages/metal-component/src/Component.js | 102 +- .../src/ComponentDataManager.js | 4 +- .../metal-component/src/ComponentRegistry.js | 2 +- .../metal-component/src/ComponentRenderer.js | 1 - packages/metal-component/src/all/component.js | 7 +- packages/metal-component/src/events/events.js | 7 +- packages/metal-component/src/sync/sync.js | 2 +- packages/metal-component/test/Component.js | 350 ++--- .../test/ComponentDataManager.js | 70 +- .../metal-component/test/ComponentRegistry.js | 48 +- .../metal-component/test/ComponentRenderer.js | 9 +- .../metal-component/test/events/events.js | 24 +- packages/metal-component/test/sync/sync.js | 28 +- .../metal-dom/src/DomDelegatedEventHandle.js | 8 +- .../metal-dom/src/DomEventEmitterProxy.js | 10 +- packages/metal-dom/src/DomEventHandle.js | 8 +- packages/metal-dom/src/all/dom.js | 9 +- packages/metal-dom/src/dom.js | 2 +- packages/metal-dom/src/domNamed.js | 61 +- packages/metal-dom/src/events.js | 12 +- packages/metal-dom/src/features.js | 25 +- packages/metal-dom/src/globalEval.js | 27 +- packages/metal-dom/src/globalEvalStyles.js | 4 +- .../metal-dom/test/DomDelegatedEventHandle.js | 30 +- .../metal-dom/test/DomEventEmitterProxy.js | 78 +- packages/metal-dom/test/DomEventHandle.js | 16 +- packages/metal-dom/test/dom.js | 547 +++---- packages/metal-dom/test/domData.js | 8 +- packages/metal-dom/test/events.js | 44 +- packages/metal-dom/test/features.js | 60 +- packages/metal-dom/test/globalEval.js | 86 +- packages/metal-dom/test/globalEvalStyles.js | 55 +- packages/metal-events/src/EventEmitter.js | 13 +- .../metal-events/src/EventEmitterProxy.js | 9 +- packages/metal-events/src/EventHandle.js | 2 +- packages/metal-events/src/EventHandler.js | 2 +- packages/metal-events/src/events.js | 2 +- packages/metal-events/test/EventEmitter.js | 126 +- .../metal-events/test/EventEmitterProxy.js | 105 +- packages/metal-events/test/EventHandle.js | 18 +- packages/metal-events/test/EventHandler.js | 16 +- .../src/IncrementalDomRenderer.js | 15 +- .../src/all/incremental-dom.js | 2 +- packages/metal-incremental-dom/src/changes.js | 2 +- .../src/children/children.js | 16 +- .../src/cleanup/unused.js | 2 +- .../src/html/HTML2IncDom.js | 18 +- .../src/html/HTMLParser.js | 115 +- .../src/html/unescape.js | 72 +- .../src/incremental-dom-aop.js | 6 +- .../src/incremental-dom.js | 9 +- .../metal-incremental-dom/src/intercept.js | 6 +- .../src/render/attributes.js | 10 +- .../metal-incremental-dom/src/render/patch.js | 8 +- .../src/render/render.js | 72 +- .../test/IncrementalDomRenderer.js | 995 +++++++----- .../metal-incremental-dom/test/callArgs.js | 23 +- .../metal-incremental-dom/test/changes.js | 25 +- .../test/children/children.js | 156 +- .../test/cleanup/unused.js | 20 +- packages/metal-incremental-dom/test/data.js | 2 +- .../test/html/HTML2IncDom.js | 29 +- .../test/incremental-dom-aop.js | 82 +- .../test/render/attributes.js | 35 +- .../test/fixtures/MyComponent.js | 9 +- .../test/fixtures/MyJSXComponent.js | 6 +- packages/metal-isomorphic/test/isomorphic.js | 6 +- packages/metal-jsx/src/DangerouslySetHTML.js | 30 +- packages/metal-jsx/src/JSXComponent.js | 112 +- packages/metal-jsx/src/JSXDataManager.js | 202 +-- packages/metal-jsx/src/JSXRenderer.js | 182 +-- packages/metal-jsx/src/all/jsx.js | 8 +- packages/metal-jsx/src/iDOMHelpers.js | 74 +- packages/metal-jsx/test/DangerouslySetHTML.js | 94 +- packages/metal-jsx/test/JSXComponent.js | 1339 +++++++++-------- packages/metal-jsx/test/JSXDataManager.js | 773 +++++----- packages/metal-jsx/test/JSXRenderer.js | 1097 +++++++------- packages/metal-soy/src/Soy.js | 36 +- packages/metal-soy/src/SoyAop.js | 10 +- packages/metal-soy/test/Soy.js | 181 ++- packages/metal-soy/test/SoyAop.js | 70 +- packages/metal-state/src/Config.js | 61 +- packages/metal-state/src/State.js | 109 +- packages/metal-state/src/all/state.js | 2 +- packages/metal-state/src/validators.js | 20 +- packages/metal-state/test/Config.js | 173 ++- packages/metal-state/test/State.js | 724 +++++---- packages/metal-state/test/validators.js | 122 +- .../src/define_web_component.js | 12 +- .../test/define_web_component.js | 60 +- packages/metal/src/array/array.js | 6 +- packages/metal/src/async/async.js | 32 +- packages/metal/src/core.js | 2 +- packages/metal/src/coreNamed.js | 13 +- packages/metal/src/metal.js | 2 +- packages/metal/src/string/string.js | 26 +- packages/metal/test/array/array.js | 28 +- packages/metal/test/core.js | 110 +- packages/metal/test/disposable/Disposable.js | 13 +- packages/metal/test/object/object.js | 58 +- packages/metal/test/string/string.js | 9 +- 102 files changed, 5147 insertions(+), 4422 deletions(-) diff --git a/packages/metal-assertions/test/assertions.js b/packages/metal-assertions/test/assertions.js index e215c059..6bda9e24 100644 --- a/packages/metal-assertions/test/assertions.js +++ b/packages/metal-assertions/test/assertions.js @@ -189,5 +189,4 @@ describe('assertions', () => { }); }); }); - }); diff --git a/packages/metal-component/src/Component.js b/packages/metal-component/src/Component.js index 9cc89901..9b7fbea5 100644 --- a/packages/metal-component/src/Component.js +++ b/packages/metal-component/src/Component.js @@ -1,12 +1,21 @@ 'use strict'; -import { addListenersFromObj } from './events/events'; -import { getStaticProperty, isBoolean, isDefAndNotNull, isElement, isObject, isServerSide, isString, object } from 'metal'; -import { syncState } from './sync/sync'; -import { DomEventEmitterProxy, toElement } from 'metal-dom'; +import {addListenersFromObj} from './events/events'; +import { + getStaticProperty, + isBoolean, + isDefAndNotNull, + isElement, + isObject, + isServerSide, + isString, + object, +} from 'metal'; +import {syncState} from './sync/sync'; +import {DomEventEmitterProxy, toElement} from 'metal-dom'; import ComponentDataManager from './ComponentDataManager'; import ComponentRenderer from './ComponentRenderer'; -import { EventEmitter, EventHandler } from 'metal-events'; +import {EventEmitter, EventHandler} from 'metal-events'; /** * Component collects common behaviors to be followed by UI components, such @@ -205,7 +214,7 @@ class Component extends EventEmitter { this.inDocument = true; this.attachData_ = { parent: opt_parentElement, - sibling: opt_siblingElement + sibling: opt_siblingElement, }; this.emit('attached', this.attachData_); this.attached(); @@ -234,7 +243,8 @@ class Component extends EventEmitter { attachElement(opt_parentElement, opt_siblingElement) { const element = this.element; if (element && (opt_siblingElement || !element.parentNode)) { - const parent = toElement(opt_parentElement) || this.DEFAULT_ELEMENT_PARENT; + const parent = + toElement(opt_parentElement) || this.DEFAULT_ELEMENT_PARENT; parent.insertBefore(element, toElement(opt_siblingElement)); } } @@ -321,7 +331,7 @@ class Component extends EventEmitter { this.forceUpdateCallback_ = opt_callback; this.updateRenderer_({ - forceUpdate: true + forceUpdate: true, }); } @@ -384,7 +394,7 @@ class Component extends EventEmitter { if (this.componentCreated_) { this.emit('elementChanged', { prevVal, - newVal + newVal, }); if (newVal && this.wasRendered) { this.syncVisible(this.dataManager_.get(this, 'visible')); @@ -415,8 +425,8 @@ class Component extends EventEmitter { handleComponentStateKeyChanged_(data) { this.updateRenderer_({ changes: { - [data.key]: data - } + [data.key]: data, + }, }); } @@ -530,35 +540,39 @@ class Component extends EventEmitter { static renderToString(Ctor, opt_config) { const rendererName = Ctor.RENDERER && Ctor.RENDERER.RENDERER_NAME; switch (rendererName) { - case 'jsx': - case 'soy': - case 'incremental-dom': { - if (typeof IncrementalDOM === 'undefined') { - throw new Error(`Error. Trying to render incremental dom ` + - `based component to string requires IncrementalDOM ` + - `implementation to be loaded.`); - } - // Incremental dom patches for components or nested components are - // isolated inside the component element. The following code intercepts - // incremental dom patches and collect results into temporary stack in - // order to successfully collect the final string of the outermost - // component after all nested components stack rendered. - const interceptedComponentStrings = []; - const patch = IncrementalDOM.patch; - const patchInterceptor = function() { - let currentElement = patch.apply(null, arguments); - interceptedComponentStrings.push(currentElement.innerHTML); - IncrementalDOM.patch = patch; - }; - IncrementalDOM.patch = patchInterceptor; - Component.render(Ctor, opt_config).dispose(); - return interceptedComponentStrings[0]; + case 'jsx': + case 'soy': + case 'incremental-dom': { + if (typeof IncrementalDOM === 'undefined') { + throw new Error( + `Error. Trying to render incremental dom ` + + `based component to string requires IncrementalDOM ` + + `implementation to be loaded.` + ); } - default: - throw new Error(`Error. Trying to render non incremental dom ` + - `based component to string.`); + // Incremental dom patches for components or nested components are + // isolated inside the component element. The following code intercepts + // incremental dom patches and collect results into temporary stack in + // order to successfully collect the final string of the outermost + // component after all nested components stack rendered. + const interceptedComponentStrings = []; + const patch = IncrementalDOM.patch; + const patchInterceptor = function() { + let currentElement = patch(...arguments); + interceptedComponentStrings.push(currentElement.innerHTML); + IncrementalDOM.patch = patch; + }; + IncrementalDOM.patch = patchInterceptor; + Component.render(Ctor, opt_config).dispose(); + return interceptedComponentStrings[0]; + } + default: + throw new Error( + `Error. Trying to render non incremental dom ` + + `based component to string.` + ); } - }; + } /** * Renders the component into the DOM via its `ComponentRenderer`. Stores the @@ -761,7 +775,7 @@ Component.DATA = { */ children: { validator: Array.isArray, - value: [] + value: [], }, /** @@ -771,7 +785,7 @@ Component.DATA = { elementClasses: { setter: 'setterElementClassesFn_', validator: isString, - value: '' + value: '', }, /** @@ -782,7 +796,7 @@ Component.DATA = { */ events: { validator: 'validatorEventsFn_', - value: null + value: null, }, /** @@ -791,8 +805,8 @@ Component.DATA = { */ visible: { validator: isBoolean, - value: true - } + value: true, + }, }; /** @@ -840,7 +854,7 @@ Component.prototype[Component.COMPONENT_FLAG] = true; const proxyBlackList_ = { eventsChanged: true, stateChanged: true, - stateKeyChanged: true + stateKeyChanged: true, }; export default Component; diff --git a/packages/metal-component/src/ComponentDataManager.js b/packages/metal-component/src/ComponentDataManager.js index 54c332fd..ac2ceea8 100644 --- a/packages/metal-component/src/ComponentDataManager.js +++ b/packages/metal-component/src/ComponentDataManager.js @@ -1,6 +1,6 @@ 'use strict'; -import { object } from 'metal'; +import {object} from 'metal'; import State from 'metal-state'; const BLACKLIST = { @@ -10,7 +10,7 @@ const BLACKLIST = { refs: true, state: true, stateKey: true, - wasRendered: true + wasRendered: true, }; const DATA_MANAGER_DATA = '__DATA_MANAGER_DATA__'; diff --git a/packages/metal-component/src/ComponentRegistry.js b/packages/metal-component/src/ComponentRegistry.js index bf942d8a..9fe923ff 100644 --- a/packages/metal-component/src/ComponentRegistry.js +++ b/packages/metal-component/src/ComponentRegistry.js @@ -1,6 +1,6 @@ 'use strict'; -import { getFunctionName } from 'metal'; +import {getFunctionName} from 'metal'; /** * The component registry is used to register components, so they can diff --git a/packages/metal-component/src/ComponentRenderer.js b/packages/metal-component/src/ComponentRenderer.js index 343fbb6c..d2c20164 100644 --- a/packages/metal-component/src/ComponentRenderer.js +++ b/packages/metal-component/src/ComponentRenderer.js @@ -5,7 +5,6 @@ * required methods all renderers should have. */ class ComponentRenderer { - /** * Disposes of any data specific to the given component. * @param {!Component} component diff --git a/packages/metal-component/src/all/component.js b/packages/metal-component/src/all/component.js index a16228a1..5735f850 100644 --- a/packages/metal-component/src/all/component.js +++ b/packages/metal-component/src/all/component.js @@ -6,5 +6,10 @@ import ComponentRegistry from '../ComponentRegistry'; import ComponentRenderer from '../ComponentRenderer'; export default Component; -export { Component, ComponentDataManager, ComponentRegistry, ComponentRenderer }; +export { + Component, + ComponentDataManager, + ComponentRegistry, + ComponentRenderer, +}; export * from '../events/events'; diff --git a/packages/metal-component/src/events/events.js b/packages/metal-component/src/events/events.js index bb36a65d..06218a2f 100644 --- a/packages/metal-component/src/events/events.js +++ b/packages/metal-component/src/events/events.js @@ -1,6 +1,6 @@ 'use strict'; -import { getFunctionName, isFunction, isObject, isString } from 'metal'; +import {getFunctionName, isFunction, isObject, isString} from 'metal'; /** * Adds the listeners specified in the given object. @@ -36,7 +36,7 @@ export function addListenersFromObj(component, events) { */ function extractListenerInfo_(component, value) { const info = { - fn: value + fn: value, }; if (isObject(value) && !isFunction(value)) { info.selector = value.selector; @@ -60,7 +60,6 @@ export function getComponentFn(component, fnName) { } else { console.error(`No function named ${fnName} was found in the component "${getFunctionName(component.constructor)}". Make sure that you specify - valid function names when adding inline listeners` - ); + valid function names when adding inline listeners`); } } diff --git a/packages/metal-component/src/sync/sync.js b/packages/metal-component/src/sync/sync.js index fe515e24..558063f7 100644 --- a/packages/metal-component/src/sync/sync.js +++ b/packages/metal-component/src/sync/sync.js @@ -1,6 +1,6 @@ 'use strict'; -import { isFunction } from 'metal'; +import {isFunction} from 'metal'; const SYNC_FNS_KEY = '__METAL_SYNC_FNS__'; diff --git a/packages/metal-component/test/Component.js b/packages/metal-component/test/Component.js index 4fc59a0a..07728a37 100644 --- a/packages/metal-component/test/Component.js +++ b/packages/metal-component/test/Component.js @@ -1,14 +1,14 @@ 'use strict'; -import { async, core } from 'metal'; -import { dom, features } from 'metal-dom'; -import { validators } from 'metal-state'; +import {async, core} from 'metal'; +import {dom, features} from 'metal-dom'; +import {validators} from 'metal-state'; import Component from '../src/Component'; import ComponentDataManager from '../src/ComponentDataManager'; import ComponentRenderer from '../src/ComponentRenderer'; describe('Component', function() { - var comp; + let comp; afterEach(function() { document.body.innerHTML = ''; @@ -37,7 +37,7 @@ describe('Component', function() { }); it('should run component render lifecycle', function() { - var renderListener = sinon.stub(); + let renderListener = sinon.stub(); class TestComponent extends Component { created() { this.on('render', renderListener); @@ -57,7 +57,7 @@ describe('Component', function() { }); it('should not run component render lifecycle if "false" is passed as second param', function() { - var renderListener = sinon.stub(); + let renderListener = sinon.stub(); class TestComponent extends Component { created() { this.on('render', renderListener); @@ -95,8 +95,7 @@ describe('Component', function() { }); it('should run "willAttach" lifecycle method when the component is about to attach', function() { - class TestComponent extends Component { - } + class TestComponent extends Component {} sinon.spy(TestComponent.prototype, 'willAttach'); comp = new TestComponent(); @@ -105,7 +104,7 @@ describe('Component', function() { }); it('should emit "willAttach" lifecycle event when the component is about to attach', function() { - var listener = sinon.stub(); + let listener = sinon.stub(); class TestComponent extends Component { created() { this.on('willAttach', listener); @@ -119,7 +118,7 @@ describe('Component', function() { it('should emit "attached" event when component is attached', function() { comp = new Component({}, false); - var listener = sinon.stub(); + let listener = sinon.stub(); comp.on('attached', listener); comp.attach('.parent', '.sibling'); assert.strictEqual(1, listener.callCount); @@ -130,15 +129,14 @@ describe('Component', function() { it('should return attach data via the `getAttachData` function', function() { comp = new Component({}, false); comp.attach('.parent', '.sibling'); - var attachData = comp.getAttachData(); + let attachData = comp.getAttachData(); assert.ok(attachData); assert.strictEqual('.parent', attachData.parent); assert.strictEqual('.sibling', attachData.sibling); }); it('should run "rendered" lifecycle method when the component is rendered', function() { - class TestComponent extends Component { - } + class TestComponent extends Component {} sinon.spy(TestComponent.prototype, 'rendered'); comp = new TestComponent(); @@ -147,7 +145,7 @@ describe('Component', function() { }); it('should emit "rendered" event when the component is rendered', function() { - var listener = sinon.stub(); + let listener = sinon.stub(); class TestComponent extends Component { created() { this.on('rendered', listener); @@ -166,8 +164,7 @@ describe('Component', function() { }); it('should run "willDetach" lifecycle method when the component is about to detach', function() { - class TestComponent extends Component { - } + class TestComponent extends Component {} sinon.spy(TestComponent.prototype, 'willDetach'); comp = new TestComponent(); @@ -180,7 +177,7 @@ describe('Component', function() { }); it('should emit "willDetach" lifecycle event when the component is about to detach', function() { - var listener = sinon.stub(); + let listener = sinon.stub(); class TestComponent extends Component { created() { this.on('willDetach', listener); @@ -200,7 +197,7 @@ describe('Component', function() { comp = new Component(); assert.ok(comp.element.parentNode); - var element = comp.element; + let element = comp.element; comp.dispose(); assert.ok(!element.parentNode); @@ -229,33 +226,33 @@ describe('Component', function() { }); it('should set component element', function() { - var element = document.createElement('div'); + let element = document.createElement('div'); document.body.appendChild(element); comp = new Component({ - element: element + element: element, }); assert.strictEqual(element, comp.element); }); it('should set component element from selector', function() { - var element = document.createElement('div'); + let element = document.createElement('div'); element.className = 'myClass'; document.body.appendChild(element); comp = new Component({ - element: '.myClass' + element: '.myClass', }); assert.strictEqual(element, comp.element); }); it('should keep previous element if selector doesn\'t match anything', function() { comp = new Component({ - element: '.myClass' + element: '.myClass', }); assert.ok(comp.element); - var element = document.createElement('div'); + let element = document.createElement('div'); comp.element = element; assert.strictEqual(element, comp.element); @@ -273,18 +270,18 @@ describe('Component', function() { describe('State', function() { it('should merge elementClasses with ELEMENT_CLASSES static hint', function() { - var CustomComponent = createCustomComponentClass(); + let CustomComponent = createCustomComponentClass(); CustomComponent.ELEMENT_CLASSES = 'static'; comp = new CustomComponent({ - elementClasses: 'class' + elementClasses: 'class', }); assert.strictEqual('class static', comp.elementClasses); }); it('should allow setting element to null', function() { comp = new Component(); - assert.doesNotThrow(() => comp.element = null); + assert.doesNotThrow(() => (comp.element = null)); assert.strictEqual(null, comp.element); }); @@ -295,7 +292,9 @@ describe('Component', function() { assert.ok(!comp.inDocument); }); - it('should update element display value according to visible state', function(done) { + it('should update element display value according to visible state', function( + done + ) { comp = new Component(); assert.ok(comp.visible); @@ -314,13 +313,15 @@ describe('Component', function() { it('should set display value on new element when changed', function() { comp = new Component({ - visible: false + visible: false, }); comp.element = document.createElement('div'); assert.strictEqual('none', comp.element.style.display); }); - it('should not throw error when trying to set display value before element is set', function(done) { + it('should not throw error when trying to set display value before element is set', function( + done + ) { comp = new Component({}, false); comp.visible = false; comp.once('stateSynced', function() { @@ -330,26 +331,26 @@ describe('Component', function() { }); it('should return initial config object received by the constructor', function() { - var config = {}; + let config = {}; comp = new Component(config); assert.strictEqual(config, comp.getInitialConfig()); }); it('should return an array with all state property names', function() { comp = new Component(); - var expected = ['children', 'elementClasses', 'events', 'visible']; + let expected = ['children', 'elementClasses', 'events', 'visible']; assert.deepEqual(expected, comp.getStateKeys().sort()); }); it('should return an object with all state properties', function() { comp = new Component({ - elementClasses: 'myClass' + elementClasses: 'myClass', }); - var expected = { + let expected = { children: [], elementClasses: 'myClass', events: null, - visible: true + visible: true, }; assert.deepEqual(expected, comp.getState()); }); @@ -358,7 +359,7 @@ describe('Component', function() { comp = new Component(); comp.setState({ elementClasses: 'myClass', - visible: false + visible: false, }); assert.strictEqual('myClass', comp.elementClasses); assert.ok(!comp.visible); @@ -366,15 +367,15 @@ describe('Component', function() { describe('events state key', function() { it('should attach events to specified functions', function() { - var CustomComponent = createCustomComponentClass(); + let CustomComponent = createCustomComponentClass(); CustomComponent.prototype.listener1 = sinon.stub(); const listener2 = sinon.stub(); comp = new CustomComponent({ events: { event1: 'listener1', - event2: listener2 - } + event2: listener2, + }, }); comp.emit('event1'); @@ -387,13 +388,13 @@ describe('Component', function() { }); it('should attach events when "events" state property value changes', function() { - var listener1 = sinon.stub(); - var listener2 = sinon.stub(); + let listener1 = sinon.stub(); + let listener2 = sinon.stub(); comp = new Component(); comp.events = { event1: listener1, - event2: listener2 + event2: listener2, }; comp.emit('event1'); @@ -406,17 +407,17 @@ describe('Component', function() { }); it('should detach unused events when value of the "events" state key is changed', function() { - var CustomComponent = createCustomComponentClass(); + let CustomComponent = createCustomComponentClass(); CustomComponent.prototype.listener1 = sinon.stub(); CustomComponent.prototype.listener2 = sinon.stub(); comp = new CustomComponent({ events: { - event1: 'listener1' - } + event1: 'listener1', + }, }); comp.events = { - event2: 'listener2' + event2: 'listener2', }; comp.emit('event1'); @@ -427,18 +428,20 @@ describe('Component', function() { }); }); - it('should synchronize state synchronously on render and asynchronously when state value changes', function(done) { - var CustomComponent = createCustomComponentClass(); + it('should synchronize state synchronously on render and asynchronously when state value changes', function( + done + ) { + let CustomComponent = createCustomComponentClass(); CustomComponent.STATE = { foo: { - value: 0 - } + value: 0, + }, }; CustomComponent.prototype.syncUnkown = sinon.spy(); CustomComponent.prototype.syncFoo = sinon.spy(); comp = new CustomComponent({ - foo: 10 + foo: 10, }); sinon.assert.notCalled(CustomComponent.prototype.syncUnkown); sinon.assert.callCount(CustomComponent.prototype.syncFoo, 1); @@ -460,21 +463,20 @@ describe('Component', function() { }); it('should fire sync methods for state keys defined by super classes as well', function() { - var CustomComponent = createCustomComponentClass(); + let CustomComponent = createCustomComponentClass(); CustomComponent.STATE = { foo: { - value: 0 - } + value: 0, + }, }; - class ChildComponent extends CustomComponent { - } + class ChildComponent extends CustomComponent {} ChildComponent.prototype.syncFoo = sinon.spy(); ChildComponent.prototype.syncBar = sinon.spy(); ChildComponent.STATE = { bar: { - value: 1 - } + value: 1, + }, }; comp = new ChildComponent(); @@ -482,16 +484,18 @@ describe('Component', function() { sinon.assert.callCount(comp.syncBar, 1); }); - it('should emit "stateSynced" event after state changes update the component', function(done) { - var CustomComponent = createCustomComponentClass(); + it('should emit "stateSynced" event after state changes update the component', function( + done + ) { + let CustomComponent = createCustomComponentClass(); CustomComponent.STATE = { foo: { - value: 0 - } + value: 0, + }, }; comp = new CustomComponent(); - var listener = sinon.stub(); + let listener = sinon.stub(); comp.on('stateSynced', listener); comp.foo = 1; comp.once('stateChanged', function(data) { @@ -501,19 +505,20 @@ describe('Component', function() { }); }); - it('should emit "rendered" event with "false" as the first arg when updated by the renderer', function(done) { + it('should emit "rendered" event with "false" as the first arg when updated by the renderer', function( + done + ) { class CustomRenderer extends ComponentRenderer.constructor { update(component) { component.informRendered(); } } - class TestComponent extends Component { - } + class TestComponent extends Component {} TestComponent.RENDERER = new CustomRenderer(); comp = new TestComponent(); - var listener = sinon.stub(); + let listener = sinon.stub(); comp.on('rendered', listener); comp.visible = false; @@ -525,9 +530,9 @@ describe('Component', function() { }); it('should not allow defining state key named components', function() { - var CustomComponent = createCustomComponentClass(); + let CustomComponent = createCustomComponentClass(); CustomComponent.STATE = { - components: {} + components: {}, }; assert.throws(function() { @@ -535,7 +540,9 @@ describe('Component', function() { }); }); - it('should allow changes to state in "willReceiveState" without triggering multiple renders', function(done) { + it('should allow changes to state in "willReceiveState" without triggering multiple renders', function( + done + ) { const renderStub = sinon.stub(); let count = 0; @@ -557,12 +564,12 @@ describe('Component', function() { } TestComponent.STATE = { bar: { - value: 'bar' + value: 'bar', }, foo: { - value: 'foo' - } + value: 'foo', + }, }; TestComponent.RENDERER = new CustomRenderer(); @@ -584,14 +591,15 @@ describe('Component', function() { }); }); - it('should pass changed state data to "willReceiveState" method', function(done) { - class TestComponent extends Component { - } + it('should pass changed state data to "willReceiveState" method', function( + done + ) { + class TestComponent extends Component {} TestComponent.prototype.willReceiveState = sinon.stub(); TestComponent.STATE = { foo: { - value: 'foo' - } + value: 'foo', + }, }; comp = new TestComponent(); @@ -604,8 +612,8 @@ describe('Component', function() { foo: { key: 'foo', newVal: 'foo2', - prevVal: 'foo' - } + prevVal: 'foo', + }, }); done(); @@ -615,13 +623,13 @@ describe('Component', function() { describe('Render', function() { it('should render component on body if no parent is specified', function() { - var CustomComponent = createCustomComponentClass(); + let CustomComponent = createCustomComponentClass(); comp = new CustomComponent(); assert.strictEqual(document.body, comp.element.parentNode); }); it('should render component on specified default parent if no parent is specified', function() { - var defaultParent = document.createElement('div'); + let defaultParent = document.createElement('div'); class CustomComponent extends Component { created() { @@ -633,20 +641,20 @@ describe('Component', function() { }); it('should render component on requested parent', function() { - var container = document.createElement('div'); + let container = document.createElement('div'); document.body.appendChild(container); - var CustomComponent = createCustomComponentClass(); + let CustomComponent = createCustomComponentClass(); comp = new CustomComponent({}, container); assert.strictEqual(container, comp.element.parentNode); }); it('should render component on requested parent selector', function() { - var container = document.createElement('div'); + let container = document.createElement('div'); container.className = 'myContainer'; document.body.appendChild(container); - var CustomComponent = createCustomComponentClass(); + let CustomComponent = createCustomComponentClass(); comp = new CustomComponent({}, '.myContainer'); assert.strictEqual(container, comp.element.parentNode); }); @@ -659,11 +667,11 @@ describe('Component', function() { } } - var container = document.createElement('div'); + let container = document.createElement('div'); comp = Component.render( CustomComponent, { - foo: 'fooValue' + foo: 'fooValue', }, container ); @@ -676,8 +684,7 @@ describe('Component', function() { }); it('should throw error when rendering non-incremental-dom component via Component.renderToString', function() { - class NotIncrementalDomComponent extends Component { - } + class NotIncrementalDomComponent extends Component {} assert.throws(function() { Component.renderToString(NotIncrementalDomComponent); }); @@ -691,11 +698,8 @@ describe('Component', function() { } } - var container = document.createElement('div'); - comp = Component.render( - CustomComponent, - container - ); + let container = document.createElement('div'); + comp = Component.render(CustomComponent, container); assert.ok(comp instanceof CustomComponent); assert.ok(comp.wasRendered); @@ -704,14 +708,14 @@ describe('Component', function() { }); it('should attach component on requested parent at specified position', function() { - var container = document.createElement('div'); - var sibling1 = document.createElement('div'); - var sibling2 = document.createElement('div'); + let container = document.createElement('div'); + let sibling1 = document.createElement('div'); + let sibling2 = document.createElement('div'); container.appendChild(sibling1); container.appendChild(sibling2); document.body.appendChild(container); - var CustomComponent = createCustomComponentClass(); + let CustomComponent = createCustomComponentClass(); comp = new CustomComponent(); comp.detach(); comp.attach(container, sibling2); @@ -722,15 +726,15 @@ describe('Component', function() { }); it('should attach component according to specified sibling selector', function() { - var container = document.createElement('div'); - var sibling1 = document.createElement('div'); - var sibling2 = document.createElement('div'); + let container = document.createElement('div'); + let sibling1 = document.createElement('div'); + let sibling2 = document.createElement('div'); sibling2.className = 'mySibling'; container.appendChild(sibling1); container.appendChild(sibling2); document.body.appendChild(container); - var CustomComponent = createCustomComponentClass(); + let CustomComponent = createCustomComponentClass(); comp = new CustomComponent(); comp.detach(); comp.attach(container, '.mySibling'); @@ -743,7 +747,7 @@ describe('Component', function() { describe('Updates', function() { it('should call renderer\'s update method if state changes', function(done) { - var CustomComponent = createCustomComponentClass(); + let CustomComponent = createCustomComponentClass(); comp = new CustomComponent(); const renderer = comp.getRenderer(); sinon.spy(renderer, 'update'); @@ -755,8 +759,10 @@ describe('Component', function() { }); }); - it('should not call renderer\'s update method if state changes before render', function(done) { - var CustomComponent = createCustomComponentClass(); + it('should not call renderer\'s update method if state changes before render', function( + done + ) { + let CustomComponent = createCustomComponentClass(); comp = new CustomComponent({}, false); const renderer = comp.getRenderer(); sinon.spy(renderer, 'update'); @@ -768,8 +774,10 @@ describe('Component', function() { }); }); - it('should not call renderer\'s update method if state changes while skipping updates', function(done) { - var CustomComponent = createCustomComponentClass(); + it('should not call renderer\'s update method if state changes while skipping updates', function( + done + ) { + let CustomComponent = createCustomComponentClass(); comp = new CustomComponent(); const renderer = comp.getRenderer(); sinon.spy(renderer, 'update'); @@ -802,15 +810,17 @@ describe('Component', function() { visible: { key: 'visible', prevVal: true, - newVal: false - } + newVal: false, + }, }; assert.strictEqual(1, renderer.update.callCount); assert.strictEqual(comp, renderer.update.args[0][0]); assert.deepEqual(expectedData, renderer.update.args[0][1].changes); }); - it('should not call the renderer\'s update method asynchronously if state changes', function(done) { + it('should not call the renderer\'s update method asynchronously if state changes', function( + done + ) { const CustomComponent = createCustomComponentClass(); CustomComponent.SYNC_UPDATES = true; @@ -839,10 +849,10 @@ describe('Component', function() { }); it('should invoke the "forceUpdate" callback argument after the rerender has completed', function() { - var CustomComponent = createCustomComponentClass(); + let CustomComponent = createCustomComponentClass(); comp = new CustomComponent(); - var listener = sinon.stub(); + let listener = sinon.stub(); comp.forceUpdate(listener); @@ -862,9 +872,9 @@ describe('Component', function() { it('should listen to events on the element through Component\'s "on" function', function() { comp = new Component(); - var element = comp.element; + let element = comp.element; element.onclick = null; - var listener = sinon.stub(); + let listener = sinon.stub(); comp.on('click', listener); dom.triggerEvent(element, 'click'); @@ -876,11 +886,13 @@ describe('Component', function() { }); it('should listen to delegate events on the element', function() { - var CustomComponent = createCustomComponentClass('
'); + let CustomComponent = createCustomComponentClass( + '
' + ); comp = new CustomComponent(); - var fooElement = comp.element.querySelector('.foo'); - var listener = sinon.stub(); + let fooElement = comp.element.querySelector('.foo'); + let listener = sinon.stub(); comp.delegate('click', '.foo', listener); dom.triggerEvent(fooElement, 'click'); @@ -892,23 +904,26 @@ describe('Component', function() { }); it('should listen to custom events on the element', function() { - var CustomComponent = createCustomComponentClass(); + let CustomComponent = createCustomComponentClass(); comp = new CustomComponent(); - var listener = sinon.stub(); + let listener = sinon.stub(); comp.on('transitionend', listener); - dom.triggerEvent(comp.element, features.checkAnimationEventName().transition); + dom.triggerEvent( + comp.element, + features.checkAnimationEventName().transition + ); assert.strictEqual(1, listener.callCount); }); it('should transfer events listened through "on" function to new element', function() { comp = new Component(); - var element = comp.element; - var listener = sinon.stub(); + let element = comp.element; + let listener = sinon.stub(); comp.on('click', listener); - var newElement = document.createElement('div'); + let newElement = document.createElement('div'); dom.enterDocument(newElement); comp.element = newElement; @@ -924,14 +939,16 @@ describe('Component', function() { }); it('should transfer delegate events listened on the component to the new element', function() { - var CustomComponent = createCustomComponentClass('
'); + let CustomComponent = createCustomComponentClass( + '
' + ); comp = new CustomComponent(); - var fooElement = comp.element.querySelector('.foo'); - var listener = sinon.stub(); + let fooElement = comp.element.querySelector('.foo'); + let listener = sinon.stub(); comp.delegate('click', '.foo', listener); - var newElement = document.createElement('div'); + let newElement = document.createElement('div'); dom.enterDocument(newElement); comp.element = newElement; dom.append(newElement, '
'); @@ -939,7 +956,7 @@ describe('Component', function() { dom.triggerEvent(fooElement, 'click'); assert.strictEqual(0, listener.callCount); - var newFooElement = newElement.querySelector('.foo'); + let newFooElement = newElement.querySelector('.foo'); dom.triggerEvent(newFooElement, 'click'); assert.strictEqual(1, listener.callCount); @@ -950,7 +967,7 @@ describe('Component', function() { it('should not reattach element listeners if its set to itself again', function() { comp = new Component(); - var listener = sinon.stub(); + let listener = sinon.stub(); comp.on('click', listener); comp.element.removeEventListener = sinon.stub(); @@ -961,10 +978,10 @@ describe('Component', function() { it('should listen to events on the element even before it\'s created', function() { comp = new Component({}, false); - var listener = sinon.stub(); + let listener = sinon.stub(); comp.on('click', listener); - var element = document.createElement('div'); + let element = document.createElement('div'); dom.enterDocument(element); comp.element = element; dom.triggerEvent(element, 'click'); @@ -973,10 +990,10 @@ describe('Component', function() { it('should listen to delegate events on the element even before it\'s created', function() { comp = new Component({}, false); - var listener = sinon.stub(); + let listener = sinon.stub(); comp.delegate('click', '.foo', listener); - var element = document.createElement('div'); + let element = document.createElement('div'); dom.enterDocument(element); dom.append(element, '
'); comp.element = element; @@ -987,11 +1004,11 @@ describe('Component', function() { it('should not reatach element listeners that were detached when element changes', function() { comp = new Component(); - var listener = sinon.stub(); - var handle = comp.on('click', listener); + let listener = sinon.stub(); + let handle = comp.on('click', listener); handle.removeListener(); - var newElement = document.createElement('div'); + let newElement = document.createElement('div'); comp.element = newElement; dom.triggerEvent(newElement, 'click'); @@ -999,14 +1016,16 @@ describe('Component', function() { }); it('should not reatach delegate listeners that were detached when element changes', function() { - var CustomComponent = createCustomComponentClass('
'); + let CustomComponent = createCustomComponentClass( + '
' + ); comp = new CustomComponent(); - var listener = sinon.stub(); - var handle = comp.delegate('click', '.foo', listener); + let listener = sinon.stub(); + let handle = comp.delegate('click', '.foo', listener); handle.removeListener(); - var newElement = document.createElement('div'); + let newElement = document.createElement('div'); comp.element = newElement; dom.append(newElement, '
'); @@ -1015,11 +1034,11 @@ describe('Component', function() { }); it('should be able to detach element listener that was attached before element changed', function() { - var comp = new Component(); - var listener = sinon.stub(); - var handle = comp.on('click', listener); + let comp = new Component(); + let listener = sinon.stub(); + let handle = comp.on('click', listener); - var newElement = document.createElement('div'); + let newElement = document.createElement('div'); comp.element = newElement; handle.removeListener(); @@ -1028,13 +1047,15 @@ describe('Component', function() { }); it('should be able to detach delegate listener that was attached before element changed', function() { - var CustomComponent = createCustomComponentClass('
'); + let CustomComponent = createCustomComponentClass( + '
' + ); comp = new CustomComponent(); - var listener = sinon.stub(); - var handle = comp.delegate('click', '.foo', listener); + let listener = sinon.stub(); + let handle = comp.delegate('click', '.foo', listener); - var newElement = document.createElement('div'); + let newElement = document.createElement('div'); comp.element = newElement; dom.append(newElement, '
'); @@ -1056,50 +1077,44 @@ describe('Component', function() { }); it('should warn if validator fails on initial value', function() { - class TestComponent extends Component { - } + class TestComponent extends Component {} TestComponent.STATE = { foo: { - validator: validators.string - } + validator: validators.string, + }, }; comp = new TestComponent({ - foo: 10 + foo: 10, }); assert.strictEqual(1, console.error.callCount); }); }); it('should get the renderer instance', function() { - class TestComponent extends Component { - } + class TestComponent extends Component {} comp = new TestComponent(); - var renderer = comp.getRenderer(); + let renderer = comp.getRenderer(); assert.ok(renderer instanceof ComponentRenderer.constructor); }); it('should get the data manager', function() { - class TestComponent extends Component { - } + class TestComponent extends Component {} comp = new TestComponent(); assert.strictEqual(ComponentDataManager, comp.getDataManager()); }); it('should check if the given function is a component constructor', function() { - class TestComponent extends Component { - } + class TestComponent extends Component {} assert.ok(Component.isComponentCtor(Component)); assert.ok(Component.isComponentCtor(TestComponent)); - assert.ok(!Component.isComponentCtor(() => { - })); - var fn = () => { - }; + assert.ok(!Component.isComponentCtor(() => {})); + let fn = () => {}; assert.ok(!Component.isComponentCtor(fn.bind(this))); }); it('should pass instance of component to __METAL_DEV_TOOLS_HOOK__ on first render', function() { - var hookStub = sinon.stub(); + let hookStub = sinon.stub(); window.__METAL_DEV_TOOLS_HOOK__ = hookStub; class CustomComponent extends Component { constructor(...args) { @@ -1123,8 +1138,7 @@ describe('Component', function() { }); function createCustomComponentClass(opt_rendererContentOrFn) { - class CustomComponent extends Component { - } + class CustomComponent extends Component {} CustomComponent.RENDERER = createCustomRenderer(opt_rendererContentOrFn); return CustomComponent; } diff --git a/packages/metal-component/test/ComponentDataManager.js b/packages/metal-component/test/ComponentDataManager.js index d770fcb4..76cd03c9 100644 --- a/packages/metal-component/test/ComponentDataManager.js +++ b/packages/metal-component/test/ComponentDataManager.js @@ -25,31 +25,30 @@ describe('ComponentDataManager', function() { it('should add the specified properties to the given component', function() { ComponentDataManager.setUp(component, { foo: { - value: 'fooValue' - } + value: 'fooValue', + }, }); assert.strictEqual('fooValue', component.foo); }); it('should use component\'s config as initial state values', function() { initialConfig = { - foo: 'initialFoo' + foo: 'initialFoo', }; ComponentDataManager.setUp(component, { - foo: { - } + foo: {}, }); assert.strictEqual('initialFoo', component.foo); }); it('should use default state value when "undefined" is passed as initial value', function() { initialConfig = { - foo: undefined + foo: undefined, }; ComponentDataManager.setUp(component, { foo: { - value: 'defaultFoo' - } + value: 'defaultFoo', + }, }); assert.strictEqual(component.foo, 'defaultFoo'); @@ -58,8 +57,7 @@ describe('ComponentDataManager', function() { it('should throw error if attempting to add state property named "element"', function() { assert.throws(() => { ComponentDataManager.setUp(component, { - element: { - } + element: {}, }); }); }); @@ -67,8 +65,8 @@ describe('ComponentDataManager', function() { it('should add the state properties defined in STATE to the given component', function() { component.constructor.STATE = { foo: { - value: 'fooValue' - } + value: 'fooValue', + }, }; ComponentDataManager.setUp(component, {}); assert.strictEqual('fooValue', component.foo); @@ -78,25 +76,25 @@ describe('ComponentDataManager', function() { component.constructor.STATE = { bar: { internal: true, - value: 'initialBar' + value: 'initialBar', }, foo: { - value: 'initialFoo' + value: 'initialFoo', }, foo2: { - value: 'initialFoo2' - } + value: 'initialFoo2', + }, }; initialConfig = { bar: 'bar', foo: 'foo', - foo2: 'foo2' + foo2: 'foo2', }; ComponentDataManager.setUp(component, {}); ComponentDataManager.replaceNonInternal(component, { - foo: 'newFoo' + foo: 'newFoo', }); assert.strictEqual('newFoo', component.foo); assert.strictEqual('initialFoo2', component.foo2); @@ -105,18 +103,20 @@ describe('ComponentDataManager', function() { it('should return state instance', function() { ComponentDataManager.setUp(component, {}); - assert.ok(ComponentDataManager.getStateInstance(component) instanceof State); + assert.ok( + ComponentDataManager.getStateInstance(component) instanceof State + ); }); it('should return an object with state properties', function() { ComponentDataManager.setUp(component, { foo: { - value: 'fooValue' - } + value: 'fooValue', + }, }); - var expected = { - foo: 'fooValue' + let expected = { + foo: 'fooValue', }; assert.deepEqual(expected, ComponentDataManager.getState(component)); }); @@ -124,8 +124,8 @@ describe('ComponentDataManager', function() { it('should return list of state keys', function() { ComponentDataManager.setUp(component, { foo: { - value: 'fooValue' - } + value: 'fooValue', + }, }); assert.deepEqual(['foo'], ComponentDataManager.getStateKeys(component)); }); @@ -133,8 +133,8 @@ describe('ComponentDataManager', function() { it('should return list of sync keys', function() { ComponentDataManager.setUp(component, { foo: { - value: 'fooValue' - } + value: 'fooValue', + }, }); assert.deepEqual(['foo'], ComponentDataManager.getSyncKeys(component)); }); @@ -142,8 +142,8 @@ describe('ComponentDataManager', function() { it('should get value from state key', function() { ComponentDataManager.setUp(component, { foo: { - value: 'fooValue' - } + value: 'fooValue', + }, }); assert.strictEqual('fooValue', ComponentDataManager.get(component, 'foo')); }); @@ -151,12 +151,12 @@ describe('ComponentDataManager', function() { it('should set value for state key', function() { ComponentDataManager.setUp(component, { foo: { - value: 'fooValue' - } + value: 'fooValue', + }, }); ComponentDataManager.setState(component, { - foo: 'fooValue2' + foo: 'fooValue2', }); assert.strictEqual('fooValue2', component.foo); }); @@ -164,11 +164,11 @@ describe('ComponentDataManager', function() { it('should emit events from state on component', function() { ComponentDataManager.setUp(component, { foo: { - value: 'fooValue' - } + value: 'fooValue', + }, }); - var listener = sinon.stub(); + let listener = sinon.stub(); component.on('fooChanged', listener); component.foo = 'fooValue2'; diff --git a/packages/metal-component/test/ComponentRegistry.js b/packages/metal-component/test/ComponentRegistry.js index b17646e9..b0b1caa4 100644 --- a/packages/metal-component/test/ComponentRegistry.js +++ b/packages/metal-component/test/ComponentRegistry.js @@ -3,7 +3,7 @@ import ComponentRegistry from '../src/ComponentRegistry'; describe('ComponentRegistry', function() { - var originalConsoleFn = console.error; + let originalConsoleFn = console.error; beforeEach(function() { console.error = sinon.stub(); @@ -23,52 +23,60 @@ describe('ComponentRegistry', function() { }); it('should return constructor of registered components', function() { - class MyComponent1 { - } - class MyComponent2 { - } + class MyComponent1 {} + class MyComponent2 {} ComponentRegistry.register(MyComponent1, 'MyComponent1'); ComponentRegistry.register(MyComponent2, 'MyComponent2'); - assert.strictEqual(MyComponent1, ComponentRegistry.getConstructor('MyComponent1')); - assert.strictEqual(MyComponent2, ComponentRegistry.getConstructor('MyComponent2')); + assert.strictEqual( + MyComponent1, + ComponentRegistry.getConstructor('MyComponent1') + ); + assert.strictEqual( + MyComponent2, + ComponentRegistry.getConstructor('MyComponent2') + ); }); it('should set NAME static property of registered components', function() { - class MyComponent { - } + class MyComponent {} ComponentRegistry.register(MyComponent, 'MyName'); assert.strictEqual('MyName', MyComponent.NAME); }); it('should use NAME static property if no name is passed to ComponentRegistry.register', function() { - class MyComponent { - } + class MyComponent {} MyComponent.NAME = 'StaticName'; ComponentRegistry.register(MyComponent); - assert.strictEqual(MyComponent, ComponentRegistry.getConstructor('StaticName')); + assert.strictEqual( + MyComponent, + ComponentRegistry.getConstructor('StaticName') + ); }); it('should use function name if no name is passed to ComponentRegistry.register', function() { - class MyComponent { - } + class MyComponent {} ComponentRegistry.register(MyComponent); assert.strictEqual('MyComponent', MyComponent.NAME); - assert.strictEqual(MyComponent, ComponentRegistry.getConstructor('MyComponent')); + assert.strictEqual( + MyComponent, + ComponentRegistry.getConstructor('MyComponent') + ); }); it('should use function name if NAME is only set on super class and no name is passed to ComponentRegistry.register', function() { - class SuperComponent { - } + class SuperComponent {} SuperComponent.NAME = 'SuperComponent'; - class MyComponent extends SuperComponent { - } + class MyComponent extends SuperComponent {} ComponentRegistry.register(MyComponent); assert.strictEqual('MyComponent', MyComponent.NAME); - assert.strictEqual(MyComponent, ComponentRegistry.getConstructor('MyComponent')); + assert.strictEqual( + MyComponent, + ComponentRegistry.getConstructor('MyComponent') + ); }); }); diff --git a/packages/metal-component/test/ComponentRenderer.js b/packages/metal-component/test/ComponentRenderer.js index e813fb08..06832bb6 100644 --- a/packages/metal-component/test/ComponentRenderer.js +++ b/packages/metal-component/test/ComponentRenderer.js @@ -1,6 +1,6 @@ 'use strict'; -import { isElement, isFunction } from 'metal'; +import {isElement, isFunction} from 'metal'; import ComponentRenderer from '../src/ComponentRenderer'; describe('ComponentRenderer', function() { @@ -8,7 +8,7 @@ describe('ComponentRenderer', function() { beforeEach(function() { componentStub = { - informRendered: sinon.stub() + informRendered: sinon.stub(), }; }); @@ -24,7 +24,10 @@ describe('ComponentRenderer', function() { }); it('should return nothing by default from getExtraDataConfig', function() { - assert.equal(undefined, ComponentRenderer.getExtraDataConfig(componentStub)); + assert.equal( + undefined, + ComponentRenderer.getExtraDataConfig(componentStub) + ); }); it('should have a function called "update"', function() { diff --git a/packages/metal-component/test/events/events.js b/packages/metal-component/test/events/events.js index b0d85e81..ff10e7cc 100644 --- a/packages/metal-component/test/events/events.js +++ b/packages/metal-component/test/events/events.js @@ -1,7 +1,7 @@ 'use strict'; -import { addListenersFromObj, getComponentFn } from '../../src/events/events'; -import { append, triggerEvent } from 'metal-dom'; +import {addListenersFromObj, getComponentFn} from '../../src/events/events'; +import {append, triggerEvent} from 'metal-dom'; import Component from '../../src/Component'; describe('events', function() { @@ -22,13 +22,13 @@ describe('events', function() { describe('addListenersFromObj', function() { it('should attach events to specified functions', function() { - var listener1 = sinon.stub(); - var listener2 = sinon.stub(); + let listener1 = sinon.stub(); + let listener2 = sinon.stub(); comp = new Component(); addListenersFromObj(comp, { event1: listener1, - event2: listener2 + event2: listener2, }); comp.emit('event1'); @@ -41,13 +41,12 @@ describe('events', function() { }); it('should attach events to specified function names', function() { - class CustomComponent extends Component { - } + class CustomComponent extends Component {} CustomComponent.prototype.listener = sinon.stub(); comp = new CustomComponent(); addListenersFromObj(comp, { - event1: 'listener' + event1: 'listener', }); comp.emit('event1'); @@ -57,15 +56,14 @@ describe('events', function() { it('should warn if trying to attach event to unexisting function name', function() { comp = new Component(); addListenersFromObj(comp, { - event1: 'listener' + event1: 'listener', }); assert.strictEqual(1, console.error.callCount); }); it('should attach delegate events with specified selector', function() { - class CustomComponent extends Component { - } + class CustomComponent extends Component {} CustomComponent.prototype.listener = sinon.stub(); comp = new CustomComponent(); @@ -73,8 +71,8 @@ describe('events', function() { addListenersFromObj(comp, { click: { fn: 'listener', - selector: '.testButton' - } + selector: '.testButton', + }, }); triggerEvent(comp.element, 'click'); diff --git a/packages/metal-component/test/sync/sync.js b/packages/metal-component/test/sync/sync.js index 34319012..2b81f8c4 100644 --- a/packages/metal-component/test/sync/sync.js +++ b/packages/metal-component/test/sync/sync.js @@ -1,7 +1,7 @@ 'use strict'; import Component from '../../src/Component'; -import { syncState } from '../../src/sync/sync'; +import {syncState} from '../../src/sync/sync'; describe('sync', function() { let comp; @@ -13,15 +13,14 @@ describe('sync', function() { }); it('should call all "sync" methods on component', function() { - class TestComponent extends Component { - } + class TestComponent extends Component {} TestComponent.STATE = { bar: { - value: 'bar' + value: 'bar', }, foo: { - value: 'foo' - } + value: 'foo', + }, }; TestComponent.prototype.syncBar = sinon.stub(); TestComponent.prototype.syncFoo = sinon.stub(); @@ -37,15 +36,14 @@ describe('sync', function() { }); it('should call "sync" method for properties defined in changes object', function() { - class TestComponent extends Component { - } + class TestComponent extends Component {} TestComponent.STATE = { bar: { - value: 'bar' + value: 'bar', }, foo: { - value: 'foo' - } + value: 'foo', + }, }; TestComponent.prototype.syncBar = sinon.stub(); TestComponent.prototype.syncFoo = sinon.stub(); @@ -54,8 +52,8 @@ describe('sync', function() { syncState(comp, { foo: { newVal: 'newFoo', - prevVal: 'prevFoo' - } + prevVal: 'prevFoo', + }, }); assert.equal(0, comp.syncBar.callCount); assert.equal(1, comp.syncFoo.callCount); @@ -71,8 +69,8 @@ describe('sync', function() { } TestComponent.STATE = { foo: { - value: 'foo' - } + value: 'foo', + }, }; comp = new TestComponent({}, false); diff --git a/packages/metal-dom/src/DomDelegatedEventHandle.js b/packages/metal-dom/src/DomDelegatedEventHandle.js index 563e8fde..947b4520 100644 --- a/packages/metal-dom/src/DomDelegatedEventHandle.js +++ b/packages/metal-dom/src/DomDelegatedEventHandle.js @@ -1,8 +1,8 @@ 'use strict'; -import { array, isString } from 'metal'; +import {array, isString} from 'metal'; import domData from './domData'; -import { EventHandle } from 'metal-events'; +import {EventHandle} from 'metal-events'; /** * This is a special EventHandle, that is responsible for dom delegated events @@ -31,7 +31,9 @@ class DomDelegatedEventHandle extends EventHandle { const delegating = domData.get(this.emitter_, 'delegating', {}); const listeners = domData.get(this.emitter_, 'listeners', {}); const selector = this.selector_; - const arr = isString(selector) ? delegating[this.event_].selectors : listeners; + const arr = isString(selector) + ? delegating[this.event_].selectors + : listeners; const key = isString(selector) ? selector : this.event_; array.remove(arr[key] || [], this.listener_); diff --git a/packages/metal-dom/src/DomEventEmitterProxy.js b/packages/metal-dom/src/DomEventEmitterProxy.js index 3fd44e9c..c27f2ea7 100644 --- a/packages/metal-dom/src/DomEventEmitterProxy.js +++ b/packages/metal-dom/src/DomEventEmitterProxy.js @@ -1,7 +1,7 @@ 'use strict'; -import { delegate, on, supportsEvent } from './dom'; -import { EventEmitterProxy } from 'metal-events'; +import {delegate, on, supportsEvent} from './dom'; +import {EventEmitterProxy} from 'metal-events'; /** * DomEventEmitterProxy utility. It extends `EventEmitterProxy` to also accept @@ -51,8 +51,10 @@ class DomEventEmitterProxy extends EventEmitterProxy { if (!this.originEmitter_ || !this.originEmitter_.addEventListener) { return true; } - return (this.isDelegateEvent_(event) && event.indexOf(':', 9) !== -1) || - supportsEvent(this.originEmitter_, event); + return ( + (this.isDelegateEvent_(event) && event.indexOf(':', 9) !== -1) || + supportsEvent(this.originEmitter_, event) + ); } /** diff --git a/packages/metal-dom/src/DomEventHandle.js b/packages/metal-dom/src/DomEventHandle.js index 6bc26939..2dd8eff3 100644 --- a/packages/metal-dom/src/DomEventHandle.js +++ b/packages/metal-dom/src/DomEventHandle.js @@ -1,6 +1,6 @@ 'use strict'; -import { EventHandle } from 'metal-events'; +import {EventHandle} from 'metal-events'; /** * This is a special EventHandle, that is responsible for dom events, instead @@ -26,7 +26,11 @@ class DomEventHandle extends EventHandle { * @inheritDoc */ removeListener() { - this.emitter_.removeEventListener(this.event_, this.listener_, this.capture_); + this.emitter_.removeEventListener( + this.event_, + this.listener_, + this.capture_ + ); } } diff --git a/packages/metal-dom/src/all/dom.js b/packages/metal-dom/src/all/dom.js index d6c6728f..bb3dd17e 100644 --- a/packages/metal-dom/src/all/dom.js +++ b/packages/metal-dom/src/all/dom.js @@ -10,5 +10,12 @@ import globalEvalStyles from '../globalEvalStyles'; import '../events'; export * from '../dom'; -export { domData, DomEventEmitterProxy, DomEventHandle, features, globalEval, globalEvalStyles }; +export { + domData, + DomEventEmitterProxy, + DomEventHandle, + features, + globalEval, + globalEvalStyles, +}; export default dom; diff --git a/packages/metal-dom/src/dom.js b/packages/metal-dom/src/dom.js index a16e4d21..b8949917 100644 --- a/packages/metal-dom/src/dom.js +++ b/packages/metal-dom/src/dom.js @@ -7,5 +7,5 @@ import * as dom from './domNamed'; export default dom; -export { dom }; +export {dom}; export * from './domNamed'; diff --git a/packages/metal-dom/src/domNamed.js b/packages/metal-dom/src/domNamed.js index 5e79d686..f51653cc 100644 --- a/packages/metal-dom/src/domNamed.js +++ b/packages/metal-dom/src/domNamed.js @@ -1,6 +1,15 @@ 'use strict'; -import { isDef, isDefAndNotNull, isDocument, isDocumentFragment, isElement, isObject, isString, object } from 'metal'; +import { + isDef, + isDefAndNotNull, + isDocument, + isDocumentFragment, + isElement, + isObject, + isString, + object, +} from 'metal'; import domData from './domData'; import DomDelegatedEventHandle from './DomDelegatedEventHandle'; import DomEventHandle from './DomEventHandle'; @@ -16,7 +25,7 @@ const USE_CAPTURE = { focus: true, invalid: true, load: true, - scroll: true + scroll: true, }; /** @@ -137,7 +146,7 @@ function attachDelegateEvent_(element, eventName) { handleDelegateEvent_, !!USE_CAPTURE[eventName] ), - selectors: {} + selectors: {}, }; } } @@ -227,7 +236,13 @@ export function contains(element1, element2) { * `preventDefault`. * @return {!EventHandle} Can be used to remove the listener. */ -export function delegate(element, eventName, selectorOrTarget, callback, opt_default) { +export function delegate( + element, + eventName, + selectorOrTarget, + callback, + opt_default +) { const customConfig = customEvents[eventName]; if (customConfig && customConfig.delegate) { eventName = customConfig.originalEvent; @@ -283,8 +298,11 @@ function isAbleToInteractWith_(node, eventName, opt_eventObj) { * @return {boolean} Whether variable is like a NodeList. */ export function isNodeListLike(val) { - return isDefAndNotNull(val) && typeof val.length === 'number' && - typeof val.item === 'function'; + return ( + isDefAndNotNull(val) && + typeof val.length === 'number' && + typeof val.item === 'function' + ); } /** @@ -350,8 +368,7 @@ export function hasClass(element, className) { * @private */ function hasClassWithNative_(element, className) { - return className.indexOf(' ') === -1 && - element.classList.contains(className); + return className.indexOf(' ') === -1 && element.classList.contains(className); } /** @@ -362,8 +379,10 @@ function hasClassWithNative_(element, className) { * @private */ function hasClassWithoutNative_(element, className) { - return (` ${element.className} `).indexOf(` ${className} `) >= 0 && - className.split(' ').length === 1; + return ( + ` ${element.className} `.indexOf(` ${className} `) >= 0 && + className.split(' ').length === 1 + ); } /** @@ -387,7 +406,12 @@ export function match(element, selector) { } const p = Element.prototype; - const m = p.matches || p.webkitMatchesSelector || p.mozMatchesSelector || p.msMatchesSelector || p.oMatchesSelector; + const m = + p.matches || + p.webkitMatchesSelector || + p.mozMatchesSelector || + p.msMatchesSelector || + p.oMatchesSelector; if (m) { return m.call(element, selector); } @@ -668,7 +692,12 @@ function triggerDelegatedListeners_(container, event, defaultFns) { if (isAbleToInteractWith_(currElement, event.type, event)) { event.delegateTarget = currElement; ret &= triggerElementListeners_(currElement, event, defaultFns); - ret &= triggerSelectorListeners_(container, currElement, event, defaultFns); + ret &= triggerSelectorListeners_( + container, + currElement, + event, + defaultFns + ); } currElement = currElement.parentNode; } @@ -684,7 +713,11 @@ function triggerDelegatedListeners_(container, event, defaultFns) { * @return {Element} The converted element, or null if none was found. */ export function toElement(selectorOrElement) { - if (isElement(selectorOrElement) || isDocument(selectorOrElement) || isDocumentFragment(selectorOrElement)) { + if ( + isElement(selectorOrElement) || + isDocument(selectorOrElement) || + isDocumentFragment(selectorOrElement) + ) { return selectorOrElement; } else if (isString(selectorOrElement)) { if (selectorOrElement[0] === '#' && selectorOrElement.indexOf(' ') === -1) { @@ -813,7 +846,7 @@ function triggerListeners_(listeners, event, element, defaultFns) { if (listeners[i].defaultListener_) { defaultFns.push({ element, - fn: listeners[i] + fn: listeners[i], }); } else { ret &= listeners[i](event); diff --git a/packages/metal-dom/src/events.js b/packages/metal-dom/src/events.js index 7d9cb148..11b524ed 100644 --- a/packages/metal-dom/src/events.js +++ b/packages/metal-dom/src/events.js @@ -1,7 +1,7 @@ 'use strict'; -import { isServerSide } from 'metal'; -import { registerCustomEvent, contains } from './dom'; +import {isServerSide} from 'metal'; +import {registerCustomEvent, contains} from './dom'; import features from './features'; /** @@ -12,7 +12,7 @@ function registerEvents() { mouseenter: 'mouseover', mouseleave: 'mouseout', pointerenter: 'pointerover', - pointerleave: 'pointerout' + pointerleave: 'pointerout', }; Object.keys(mouseEventMap).forEach(function(eventName) { registerCustomEvent(eventName, { @@ -25,13 +25,13 @@ function registerEvents() { return callback(event); } }, - originalEvent: mouseEventMap[eventName] + originalEvent: mouseEventMap[eventName], }); }); const animationEventMap = { animation: 'animationend', - transition: 'transitionend' + transition: 'transitionend', }; Object.keys(animationEventMap).forEach(function(eventType) { const eventName = animationEventMap[eventType]; @@ -42,7 +42,7 @@ function registerEvents() { event.customType = eventName; return callback(event); }, - originalEvent: features.checkAnimationEventName()[eventType] + originalEvent: features.checkAnimationEventName()[eventType], }); }); } diff --git a/packages/metal-dom/src/features.js b/packages/metal-dom/src/features.js index 75f5c2ee..6f1383d1 100644 --- a/packages/metal-dom/src/features.js +++ b/packages/metal-dom/src/features.js @@ -1,7 +1,7 @@ 'use strict'; -import { append } from './dom'; -import { string } from 'metal'; +import {append} from './dom'; +import {string} from 'metal'; /** * Class with static methods responsible for doing browser feature checks. @@ -17,7 +17,7 @@ class features { if (features.animationEventName_ === undefined) { features.animationEventName_ = { animation: features.checkAnimationEventName_('animation'), - transition: features.checkAnimationEventName_('transition') + transition: features.checkAnimationEventName_('transition'), }; } return features.animationEventName_; @@ -30,13 +30,26 @@ class features { */ static checkAnimationEventName_(type) { const prefixes = ['Webkit', 'MS', 'O', '']; - const typeTitleCase = string.replaceInterval(type, 0, 1, type.substring(0, 1).toUpperCase()); - const suffixes = [`${typeTitleCase}End`, `${typeTitleCase}End`, `${typeTitleCase}End`, `${type}end`]; + const typeTitleCase = string.replaceInterval( + type, + 0, + 1, + type.substring(0, 1).toUpperCase() + ); + const suffixes = [ + `${typeTitleCase}End`, + `${typeTitleCase}End`, + `${typeTitleCase}End`, + `${type}end`, + ]; if (!features.animationElement_) { features.animationElement_ = document.createElement('div'); } for (let i = 0; i < prefixes.length; i++) { - if (features.animationElement_.style[prefixes[i] + typeTitleCase] !== undefined) { + if ( + features.animationElement_.style[prefixes[i] + typeTitleCase] !== + undefined + ) { return prefixes[i].toLowerCase() + suffixes[i]; } } diff --git a/packages/metal-dom/src/globalEval.js b/packages/metal-dom/src/globalEval.js index 7c275515..7db860fd 100644 --- a/packages/metal-dom/src/globalEval.js +++ b/packages/metal-dom/src/globalEval.js @@ -1,7 +1,7 @@ 'use strict'; -import { async } from 'metal'; -import { exitDocument, once } from './dom'; +import {async} from 'metal'; +import {exitDocument, once} from './dom'; /** * Utility functions for running javascript code in the global scope. @@ -108,13 +108,22 @@ class globalEval { * into document. */ static runScriptsInOrder(scripts, index, opt_callback, opt_appendFn) { - globalEval.runScript(scripts.item(index), function() { - if (index < scripts.length - 1) { - globalEval.runScriptsInOrder(scripts, index + 1, opt_callback, opt_appendFn); - } else if (opt_callback) { - async.nextTick(opt_callback); - } - }, opt_appendFn); + globalEval.runScript( + scripts.item(index), + function() { + if (index < scripts.length - 1) { + globalEval.runScriptsInOrder( + scripts, + index + 1, + opt_callback, + opt_appendFn + ); + } else if (opt_callback) { + async.nextTick(opt_callback); + } + }, + opt_appendFn + ); } } diff --git a/packages/metal-dom/src/globalEvalStyles.js b/packages/metal-dom/src/globalEvalStyles.js index 27d6d902..ffdfa1d3 100644 --- a/packages/metal-dom/src/globalEvalStyles.js +++ b/packages/metal-dom/src/globalEvalStyles.js @@ -1,7 +1,7 @@ 'use strict'; -import { async } from 'metal'; -import { once } from './dom'; +import {async} from 'metal'; +import {once} from './dom'; /** * Utility functions for running styles. diff --git a/packages/metal-dom/test/DomDelegatedEventHandle.js b/packages/metal-dom/test/DomDelegatedEventHandle.js index 0fe87cd0..32dbfcfc 100644 --- a/packages/metal-dom/test/DomDelegatedEventHandle.js +++ b/packages/metal-dom/test/DomDelegatedEventHandle.js @@ -5,38 +5,30 @@ import DomDelegatedEventHandle from '../src/DomDelegatedEventHandle'; describe('DomDelegatedEventHandle', function() { it('should remove listener from the metal data listeners array', function() { - var element = document.createElement('div'); - var listeners = domData.get(element, 'listeners', {}); - listeners.click = [() => { - }, () => { - }, () => { - }]; - var fn = listeners.click[1]; + let element = document.createElement('div'); + let listeners = domData.get(element, 'listeners', {}); + listeners.click = [() => {}, () => {}, () => {}]; + let fn = listeners.click[1]; - var handle = new DomDelegatedEventHandle(element, 'click', fn); + let handle = new DomDelegatedEventHandle(element, 'click', fn); handle.removeListener(); assert.strictEqual(2, listeners.click.length); assert.strictEqual(-1, listeners.click.indexOf(fn)); }); it('should not throw error if trying to remove unexisting listener', function() { - var element = document.createElement('div'); - var listeners = domData.get(element, 'listeners', {}); - listeners.click = [() => { - }, () => { - }, () => { - }]; + let element = document.createElement('div'); + let listeners = domData.get(element, 'listeners', {}); + listeners.click = [() => {}, () => {}, () => {}]; - var handle = new DomDelegatedEventHandle(element, 'click', () => { - }); + let handle = new DomDelegatedEventHandle(element, 'click', () => {}); handle.removeListener(); assert.strictEqual(3, listeners.click.length); }); it('should not throw error if element has no listeners to be removed', function() { - var element = document.createElement('div'); - var handle = new DomDelegatedEventHandle(element, 'click', () => { - }); + let element = document.createElement('div'); + let handle = new DomDelegatedEventHandle(element, 'click', () => {}); assert.doesNotThrow(() => handle.removeListener()); }); }); diff --git a/packages/metal-dom/test/DomEventEmitterProxy.js b/packages/metal-dom/test/DomEventEmitterProxy.js index 13ea0602..abfe8226 100644 --- a/packages/metal-dom/test/DomEventEmitterProxy.js +++ b/packages/metal-dom/test/DomEventEmitterProxy.js @@ -3,7 +3,7 @@ import dom from '../src/dom'; import features from '../src/features'; import DomEventEmitterProxy from '../src/DomEventEmitterProxy'; -import { EventEmitter } from 'metal-events'; +import {EventEmitter} from 'metal-events'; describe('DomEventEmitterProxy', function() { afterEach(function() { @@ -11,11 +11,11 @@ describe('DomEventEmitterProxy', function() { }); it('should proxy event from event emitter origin to target', function() { - var origin = new EventEmitter(); - var target = new EventEmitter(); + let origin = new EventEmitter(); + let target = new EventEmitter(); new DomEventEmitterProxy(origin, target); - var listener = sinon.stub(); + let listener = sinon.stub(); target.on('event1', listener); origin.emit('event1', 1, 2); @@ -25,13 +25,13 @@ describe('DomEventEmitterProxy', function() { }); it('should proxy event from dom element origin to target', function() { - var origin = document.createElement('div'); + let origin = document.createElement('div'); document.body.appendChild(origin); - var target = new EventEmitter(); + let target = new EventEmitter(); new DomEventEmitterProxy(origin, target); - var listener = sinon.stub(); + let listener = sinon.stub(); target.on('click', listener); dom.triggerEvent(origin, 'click'); @@ -41,13 +41,13 @@ describe('DomEventEmitterProxy', function() { }); it('should proxy custom event from dom element origin to target', function() { - var origin = document.createElement('div'); + let origin = document.createElement('div'); document.body.appendChild(origin); - var target = new EventEmitter(); + let target = new EventEmitter(); new DomEventEmitterProxy(origin, target); - var listener = sinon.stub(); + let listener = sinon.stub(); target.on('transitionend', listener); dom.triggerEvent(origin, features.checkAnimationEventName().transition); @@ -55,10 +55,10 @@ describe('DomEventEmitterProxy', function() { }); it('should not proxy unsupported dom event from dom element', function() { - var origin = document.createElement('div'); + let origin = document.createElement('div'); origin.addEventListener = sinon.stub(); - var target = new EventEmitter(); + let target = new EventEmitter(); new DomEventEmitterProxy(origin, target); target.on('event1', sinon.stub()); @@ -66,10 +66,10 @@ describe('DomEventEmitterProxy', function() { }); it('should proxy event from document to target', function() { - var target = new EventEmitter(); + let target = new EventEmitter(); new DomEventEmitterProxy(document, target); - var listener = sinon.stub(); + let listener = sinon.stub(); target.on('click', listener); dom.triggerEvent(document, 'click'); @@ -77,16 +77,16 @@ describe('DomEventEmitterProxy', function() { }); it('should proxy delegate event from dom element origin to target', function() { - var origin = document.createElement('div'); + let origin = document.createElement('div'); dom.append(origin, ''); document.body.appendChild(origin); - var target = new EventEmitter(); + let target = new EventEmitter(); new DomEventEmitterProxy(origin, target); - var listener = sinon.stub(); + let listener = sinon.stub(); target.on('delegate:click:.testButton', listener); - var button = origin.querySelector('.testButton'); + let button = origin.querySelector('.testButton'); dom.triggerEvent(button, 'click'); assert.strictEqual(1, listener.callCount); @@ -95,16 +95,16 @@ describe('DomEventEmitterProxy', function() { }); it('should proxy delegate event that contains ":" in selector', function() { - var origin = document.createElement('div'); + let origin = document.createElement('div'); dom.append(origin, ''); document.body.appendChild(origin); - var target = new EventEmitter(); + let target = new EventEmitter(); new DomEventEmitterProxy(origin, target); - var listener = sinon.stub(); + let listener = sinon.stub(); target.on('delegate:click:[data-onclick="test:handleClick"]', listener); - var button = origin.querySelector('[data-onclick="test:handleClick"]'); + let button = origin.querySelector('[data-onclick="test:handleClick"]'); dom.triggerEvent(button, 'click'); assert.strictEqual(1, listener.callCount); @@ -112,10 +112,10 @@ describe('DomEventEmitterProxy', function() { }); it('should try to proxy event with "delegate:" prefix but no selector', function() { - var origin = document.createElement('div'); + let origin = document.createElement('div'); document.body.appendChild(origin); - var target = new EventEmitter(); + let target = new EventEmitter(); new DomEventEmitterProxy(origin, target); sinon.spy(dom, 'delegate'); @@ -127,16 +127,16 @@ describe('DomEventEmitterProxy', function() { }); it('should change the element that events are proxied from', function() { - var origin = document.createElement('div'); + let origin = document.createElement('div'); document.body.appendChild(origin); - var target = new EventEmitter(); - var proxy = new DomEventEmitterProxy(origin, target); + let target = new EventEmitter(); + let proxy = new DomEventEmitterProxy(origin, target); - var listener = sinon.stub(); + let listener = sinon.stub(); target.on('click', listener); - var origin2 = document.createElement('div'); + let origin2 = document.createElement('div'); document.body.appendChild(origin2); proxy.setOriginEmitter(origin2); @@ -151,11 +151,11 @@ describe('DomEventEmitterProxy', function() { }); it('should not proxy event emitter events after disposed', function() { - var origin = new EventEmitter(); - var target = new EventEmitter(); - var proxy = new DomEventEmitterProxy(origin, target); + let origin = new EventEmitter(); + let target = new EventEmitter(); + let proxy = new DomEventEmitterProxy(origin, target); - var listener = sinon.stub(); + let listener = sinon.stub(); target.on('event1', listener); proxy.dispose(); @@ -164,12 +164,12 @@ describe('DomEventEmitterProxy', function() { }); it('should not proxy dom events after disposed', function() { - var origin = document.createElement('div'); + let origin = document.createElement('div'); - var target = new EventEmitter(); - var proxy = new DomEventEmitterProxy(origin, target); + let target = new EventEmitter(); + let proxy = new DomEventEmitterProxy(origin, target); - var listener = sinon.stub(); + let listener = sinon.stub(); target.on('click', listener); proxy.dispose(); @@ -178,10 +178,10 @@ describe('DomEventEmitterProxy', function() { }); it('should not throw error if origin emitter is null', function() { - var target = new EventEmitter(); + let target = new EventEmitter(); new DomEventEmitterProxy(null, target); - var listener = sinon.stub(); + let listener = sinon.stub(); assert.doesNotThrow(() => target.on('click', listener)); }); }); diff --git a/packages/metal-dom/test/DomEventHandle.js b/packages/metal-dom/test/DomEventHandle.js index d075dc61..f4ac7577 100644 --- a/packages/metal-dom/test/DomEventHandle.js +++ b/packages/metal-dom/test/DomEventHandle.js @@ -4,11 +4,11 @@ import DomEventHandle from '../src/DomEventHandle'; describe('DomEventHandle', function() { it('should unsubscribe listener', function() { - var element = { - removeEventListener: sinon.stub() + let element = { + removeEventListener: sinon.stub(), }; - var listener = sinon.stub(); - var handle = new DomEventHandle(element, 'event', listener); + let listener = sinon.stub(); + let handle = new DomEventHandle(element, 'event', listener); handle.removeListener(); assert.strictEqual(1, element.removeEventListener.callCount); @@ -17,11 +17,11 @@ describe('DomEventHandle', function() { }); it('should unsubscribe listener attached on capture phase', function() { - var element = { - removeEventListener: sinon.stub() + let element = { + removeEventListener: sinon.stub(), }; - var listener = sinon.stub(); - var handle = new DomEventHandle(element, 'event', listener, true); + let listener = sinon.stub(); + let handle = new DomEventHandle(element, 'event', listener, true); handle.removeListener(); assert.strictEqual(1, element.removeEventListener.callCount); diff --git a/packages/metal-dom/test/dom.js b/packages/metal-dom/test/dom.js index 1700a72a..2d8a4e53 100644 --- a/packages/metal-dom/test/dom.js +++ b/packages/metal-dom/test/dom.js @@ -1,12 +1,11 @@ 'use strict'; import dom from '../src/all/dom'; -import { object } from 'metal'; +import {object} from 'metal'; import UA from 'metal-useragent'; import DomEventHandle from '../src/DomEventHandle'; describe('dom', function() { - afterEach(function() { document.body.innerHTML = ''; }); @@ -31,11 +30,11 @@ describe('dom', function() { assert.strictEqual('class2', getClassNames(element)[1]); } - var element1 = document.createElement('div'); - var element2 = document.createElement('div'); + let element1 = document.createElement('div'); + let element2 = document.createElement('div'); dom.append(document.body, element1); dom.append(document.body, element2); - var elements = document.querySelectorAll('div'); + let elements = document.querySelectorAll('div'); dom.addClasses(elements, 'class1 class2'); @@ -44,19 +43,19 @@ describe('dom', function() { }); it('should not throw error if addClasses is called with empty string', function() { - var element = document.createElement('div'); + let element = document.createElement('div'); assert.doesNotThrow(() => dom.addClasses(element, '')); }); it('should not add css classes twice to the same element', function() { - var element = document.createElement('div'); + let element = document.createElement('div'); dom.addClasses(element, 'class1 class2'); dom.addClasses(element, 'class1 class2'); assert.strictEqual('class1 class2', element.className.trim()); }); it('should check if an element has the requested css class', function() { - var element = document.createElement('div'); + let element = document.createElement('div'); dom.addClasses(element, 'class1 class2'); assert.ok(dom.hasClass(element, 'class1')); @@ -67,7 +66,7 @@ describe('dom', function() { }); it('should check if css classes are being removed', function() { - var element = document.createElement('div'); + let element = document.createElement('div'); dom.addClasses(element, 'class1 class2'); dom.removeClasses(element, 'class1'); @@ -81,11 +80,11 @@ describe('dom', function() { assert.ok(dom.hasClass(element, 'class2')); } - var element1 = document.createElement('div'); - var element2 = document.createElement('div'); + let element1 = document.createElement('div'); + let element2 = document.createElement('div'); dom.append(document.body, element1); dom.append(document.body, element2); - var elements = document.querySelectorAll('div'); + let elements = document.querySelectorAll('div'); dom.addClasses(elements, 'class1 class2'); dom.removeClasses(elements, 'class1'); @@ -95,12 +94,12 @@ describe('dom', function() { }); it('should not throw error if removeClasses is called with empty string', function() { - var element = document.createElement('div'); + let element = document.createElement('div'); assert.doesNotThrow(() => dom.removeClasses(element, '')); }); it('should do nothing if element or classes are not object and string in add/remove classes', function() { - var element = document.createElement('div'); + let element = document.createElement('div'); assert.doesNotThrow(function() { dom.addClasses(element); }); @@ -112,7 +111,7 @@ describe('dom', function() { }); it('should do nothing if element or classes are not object and string in toggle classes', function() { - var element = document.createElement('div'); + let element = document.createElement('div'); assert.doesNotThrow(function() { dom.toggleClasses(element); }); @@ -124,7 +123,7 @@ describe('dom', function() { }); it('should toggle classes in an element', function() { - var element = document.createElement('div'); + let element = document.createElement('div'); element.className = 'lorem'; dom.toggleClasses(element, 'lorem'); @@ -144,11 +143,17 @@ describe('dom', function() { element.className = 'lorem ipsum dolor sit amet'; dom.toggleClasses(element, 'lorem sit consectetur adipiscing elit'); - assert.strictEqual('ipsum dolor amet consectetur adipiscing elit', element.className); + assert.strictEqual( + 'ipsum dolor amet consectetur adipiscing elit', + element.className + ); element.className = 'lorem ipsum dolor sit amet'; dom.toggleClasses(element, 'adipiscing elit lorem sit consectetur'); - assert.strictEqual('ipsum dolor amet adipiscing elit consectetur', element.className); + assert.strictEqual( + 'ipsum dolor amet adipiscing elit consectetur', + element.className + ); }); it('should return false when checking if a classname with spaces exists', function() { @@ -164,9 +169,9 @@ describe('dom', function() { describe('contains', function() { it('should check if element contains another', function() { - var element1 = document.createElement('div'); - var element2 = document.createElement('div'); - var element3 = document.createElement('div'); + let element1 = document.createElement('div'); + let element2 = document.createElement('div'); + let element3 = document.createElement('div'); dom.append(element1, element2); dom.enterDocument(element3); @@ -182,8 +187,8 @@ describe('dom', function() { describe('manipulation', function() { it('should append html string to parent element', function() { - var parent = document.createElement('div'); - var childHtml = '
'; + let parent = document.createElement('div'); + let childHtml = '
'; dom.append(parent, childHtml); assert.strictEqual(childHtml, parent.innerHTML); @@ -191,16 +196,18 @@ describe('dom', function() { }); it('should append element to parent element', function() { - var parent = document.createElement('div'); - var child = document.createElement('div'); + let parent = document.createElement('div'); + let child = document.createElement('div'); dom.append(parent, child); assert.strictEqual(parent, child.parentNode); }); it('should append node list to parent element', function() { - var parent = document.createElement('div'); - var childFrag = dom.buildFragment('
'); + let parent = document.createElement('div'); + let childFrag = dom.buildFragment( + '
' + ); dom.append(parent, childFrag.childNodes); assert.strictEqual(2, parent.childNodes.length); @@ -209,8 +216,8 @@ describe('dom', function() { }); it('should replace an element with a requested element', function() { - var element1 = document.createElement('div'); - var element2 = document.createElement('div'); + let element1 = document.createElement('div'); + let element2 = document.createElement('div'); dom.append(document.body, element1); dom.replace(element1, element2); @@ -219,7 +226,7 @@ describe('dom', function() { }); it('should not remove element from parent if replacing it with itself', function() { - var element = document.createElement('div'); + let element = document.createElement('div'); dom.append(document.body, element); dom.replace(element, element); @@ -227,8 +234,8 @@ describe('dom', function() { }); it('should not throw error if trying to replace element that doesn\'t have a parent', function() { - var element1 = document.createElement('div'); - var element2 = document.createElement('div'); + let element1 = document.createElement('div'); + let element2 = document.createElement('div'); assert.doesNotThrow(function() { dom.replace(element1, element2); @@ -236,7 +243,7 @@ describe('dom', function() { }); it('should not throw error if null as passed as one of the elements for "replace"', function() { - var element = document.createElement('div'); + let element = document.createElement('div'); dom.append(document.body, element); assert.doesNotThrow(function() { @@ -254,14 +261,14 @@ describe('dom', function() { assert.ok(!dom.isNodeListLike(function() {})); assert.ok(!dom.isNodeListLike(null)); - var html = '
Hello World 1
Hello World 2
'; - var fragment = dom.buildFragment(html); + let html = '
Hello World 1
Hello World 2
'; + let fragment = dom.buildFragment(html); assert.ok(dom.isNodeListLike(fragment.childNodes)); }); it('should node enter document', function() { - var element = document.createElement('div'); + let element = document.createElement('div'); dom.enterDocument(element); assert.strictEqual(document.body, element.parentNode); }); @@ -273,14 +280,14 @@ describe('dom', function() { }); it('should node exit document', function() { - var element = document.createElement('div'); + let element = document.createElement('div'); dom.enterDocument(element); dom.exitDocument(element); assert.strictEqual(null, element.parentNode); }); it('should not throw error if "exitDocument" is called on element without parent', function() { - var element = document.createElement('div'); + let element = document.createElement('div'); assert.doesNotThrow(function() { dom.exitDocument(element); }); @@ -293,7 +300,7 @@ describe('dom', function() { }); it('should append string as document fragment to parent element', function() { - var parent = document.createElement('div'); + let parent = document.createElement('div'); sinon.stub(parent, 'appendChild'); dom.append(parent, '
'); @@ -305,8 +312,8 @@ describe('dom', function() { }); it('should create document fragment from string', function() { - var html = '
Hello World 1
Hello World 2
'; - var fragment = dom.buildFragment(html); + let html = '
Hello World 1
Hello World 2
'; + let fragment = dom.buildFragment(html); assert.ok(fragment); assert.strictEqual(11, fragment.nodeType); @@ -316,7 +323,7 @@ describe('dom', function() { }); it('should remove children from element', function() { - var element = document.createElement('div'); + let element = document.createElement('div'); element.innerHTML = '
0
1
'; dom.removeChildren(element); @@ -326,8 +333,8 @@ describe('dom', function() { describe('on', function() { it('should listen to event on requested element', function() { - var element = document.createElement('div'); - var listener = sinon.stub(); + let element = document.createElement('div'); + let listener = sinon.stub(); dom.on(element, 'myEvent', listener); assert.strictEqual(0, listener.callCount); @@ -336,10 +343,10 @@ describe('dom', function() { }); it('should be able to remove listener from return value of "on"', function() { - var element = document.createElement('div'); - var listener = sinon.stub(); + let element = document.createElement('div'); + let listener = sinon.stub(); - var handle = dom.on(element, 'myEvent', listener); + let handle = dom.on(element, 'myEvent', listener); assert.ok(handle instanceof DomEventHandle); handle.removeListener(); @@ -348,25 +355,25 @@ describe('dom', function() { }); it('should listen to event on document if selector is passed instead of element', function() { - var element = document.createElement('div'); + let element = document.createElement('div'); element.className = 'myClass'; dom.enterDocument(element); - var listener = sinon.stub(); + let listener = sinon.stub(); dom.on('.myClass', 'click', listener); dom.triggerEvent(element, 'click'); assert.strictEqual(1, listener.callCount); }); it('should listen to event on capture phase', function() { - var element = document.createElement('div'); - var parentElement = document.createElement('div'); + let element = document.createElement('div'); + let parentElement = document.createElement('div'); parentElement.appendChild(element); dom.enterDocument(parentElement); - var listener = sinon.stub(); + let listener = sinon.stub(); dom.on(element, 'click', listener); - var parentListener = sinon.stub(); + let parentListener = sinon.stub(); dom.on(parentElement, 'click', parentListener, true); dom.triggerEvent(element, 'click'); @@ -374,11 +381,11 @@ describe('dom', function() { }); it('should remove listener that was attached on capture phase', function() { - var element = document.createElement('div'); + let element = document.createElement('div'); dom.enterDocument(element); - var listener = sinon.stub(); - var handle = dom.on(element, 'click', listener, true); + let listener = sinon.stub(); + let handle = dom.on(element, 'click', listener, true); handle.removeListener(); dom.triggerEvent(element, 'click'); @@ -388,8 +395,8 @@ describe('dom', function() { describe('once', function() { it('should listen once to event on requested element', function() { - var element = document.createElement('div'); - var listener = sinon.stub(); + let element = document.createElement('div'); + let listener = sinon.stub(); dom.once(element, 'myEvent', listener); assert.strictEqual(0, listener.callCount); @@ -399,10 +406,10 @@ describe('dom', function() { }); it('should be able to remove listener from return value of "once"', function() { - var element = document.createElement('div'); - var listener = sinon.stub(); + let element = document.createElement('div'); + let listener = sinon.stub(); - var handle = dom.once(element, 'myEvent', listener); + let handle = dom.once(element, 'myEvent', listener); assert.ok(handle instanceof DomEventHandle); handle.removeListener(); @@ -413,8 +420,8 @@ describe('dom', function() { describe('triggerEvent', function() { it('should trigger dom event', function() { - var listener = sinon.stub(); - var element = document.createElement('div'); + let listener = sinon.stub(); + let element = document.createElement('div'); document.body.appendChild(element); element.addEventListener('click', listener); @@ -425,13 +432,13 @@ describe('dom', function() { }); it('should add specified payload keys to triggered event', function() { - var listener = sinon.stub(); - var element = document.createElement('div'); + let listener = sinon.stub(); + let element = document.createElement('div'); document.body.appendChild(element); element.addEventListener('click', listener); dom.triggerEvent(element, 'click', { - test: 'test' + test: 'test', }); assert.strictEqual(1, listener.callCount); assert.strictEqual('click', listener.args[0][0].type); @@ -440,10 +447,10 @@ describe('dom', function() { }); it('should not trigger dom click event for disabled elements', function() { - var input = document.createElement('input'); - var select = document.createElement('select'); - var button = document.createElement('button'); - var textarea = document.createElement('textarea'); + let input = document.createElement('input'); + let select = document.createElement('select'); + let button = document.createElement('button'); + let textarea = document.createElement('textarea'); input.disabled = true; select.disabled = true; button.disabled = true; @@ -453,10 +460,10 @@ describe('dom', function() { document.body.appendChild(button); document.body.appendChild(textarea); - var listener1 = sinon.stub(); - var listener2 = sinon.stub(); - var listener3 = sinon.stub(); - var listener4 = sinon.stub(); + let listener1 = sinon.stub(); + let listener2 = sinon.stub(); + let listener3 = sinon.stub(); + let listener4 = sinon.stub(); input.addEventListener('click', listener1); select.addEventListener('click', listener2); @@ -474,23 +481,23 @@ describe('dom', function() { }); it('should not trigger dom click event on a form control with a disabled fieldset parent', function() { - var parent = document.createElement('fieldset'); + let parent = document.createElement('fieldset'); parent.disabled = true; document.body.appendChild(parent); - var input = document.createElement('input'); - var select = document.createElement('select'); - var button = document.createElement('button'); - var textarea = document.createElement('textarea'); + let input = document.createElement('input'); + let select = document.createElement('select'); + let button = document.createElement('button'); + let textarea = document.createElement('textarea'); parent.appendChild(input); parent.appendChild(select); parent.appendChild(button); parent.appendChild(textarea); - var listener1 = sinon.stub(); - var listener2 = sinon.stub(); - var listener3 = sinon.stub(); - var listener4 = sinon.stub(); + let listener1 = sinon.stub(); + let listener2 = sinon.stub(); + let listener3 = sinon.stub(); + let listener4 = sinon.stub(); input.addEventListener('click', listener1); select.addEventListener('click', listener2); @@ -507,14 +514,14 @@ describe('dom', function() { }); it('should trigger click event listeners for non-disabled elements even with its parent being disabled', function() { - var element = document.createElement('fieldset'); + let element = document.createElement('fieldset'); element.innerHTML = ''; element.disabled = true; document.body.appendChild(element); - var target = element.querySelector('.match'); + let target = element.querySelector('.match'); - var listener = sinon.stub(); + let listener = sinon.stub(); target.addEventListener('click', listener); dom.triggerEvent(target, 'click'); @@ -523,20 +530,21 @@ describe('dom', function() { }); it('should keep bubling and triggering click event listeners for non-disabled elements', function() { - var element = document.createElement('div'); - element.innerHTML = '
' + + let element = document.createElement('div'); + element.innerHTML = + '
' + '
'; document.body.appendChild(element); - var span = element.querySelector('span'); + let span = element.querySelector('span'); - var listeners = sinon.stub(); + let listeners = sinon.stub(); dom.delegate(element, 'click', '.match', listeners); dom.triggerEvent(span, 'click'); // Firefox works in a diferent way. It stops bubbling events when it hits a // disabled element. - var spectedResult = UA.isFirefox ? 0 : 2; + let spectedResult = UA.isFirefox ? 0 : 2; assert.strictEqual(spectedResult, listeners.callCount); }); }); @@ -544,17 +552,18 @@ describe('dom', function() { describe('delegate', function() { describe('selector', function() { it('should trigger delegate listener for matched elements', function() { - var element = document.createElement('div'); - element.innerHTML = '
' + + let element = document.createElement('div'); + element.innerHTML = + '
' + '
' + '
' + '
' + '
'; document.body.appendChild(element); - var matchedElements = element.querySelectorAll('.match'); + let matchedElements = element.querySelectorAll('.match'); - var listenerTargets = []; - var listener = function(event) { + let listenerTargets = []; + let listener = function(event) { listenerTargets.push(event.delegateTarget); }; dom.delegate(element, 'click', '.match', listener); @@ -566,17 +575,18 @@ describe('dom', function() { }); it('should trigger delegate listener for "focus" event', function() { - var element = document.createElement('div'); - element.innerHTML = '
' + + let element = document.createElement('div'); + element.innerHTML = + '
' + '
' + '
' + '
' + '
'; document.body.appendChild(element); - var matchedElements = element.querySelectorAll('.match'); + let matchedElements = element.querySelectorAll('.match'); - var listenerTargets = []; - var listener = function(event) { + let listenerTargets = []; + let listener = function(event) { listenerTargets.push(event.delegateTarget); }; dom.delegate(element, 'focus', '.match', listener); @@ -588,17 +598,18 @@ describe('dom', function() { }); it('should only trigger delegate event starting from initial target', function() { - var element = document.createElement('div'); - element.innerHTML = '
' + + let element = document.createElement('div'); + element.innerHTML = + '
' + '
' + '
' + '
' + '
'; document.body.appendChild(element); - var matchedElements = element.querySelectorAll('.match'); + let matchedElements = element.querySelectorAll('.match'); - var listenerTargets = []; - var listener = function(event) { + let listenerTargets = []; + let listener = function(event) { listenerTargets.push(event.delegateTarget); }; dom.delegate(element, 'click', '.match', listener); @@ -609,7 +620,7 @@ describe('dom', function() { }); it('should trigger listener twice when two ancestors are delegating', function() { - var element = document.createElement('div'); + let element = document.createElement('div'); element.innerHTML = `
@@ -617,7 +628,7 @@ describe('dom', function() {
`; document.body.appendChild(element); - var listener = sinon.stub(); + let listener = sinon.stub(); dom.delegate(element, 'click', '.match', listener); dom.delegate(element.childNodes[0], 'click', '.match', listener); @@ -626,13 +637,13 @@ describe('dom', function() { }); it('should not trigger delegate event for parents of given element', function() { - var element = document.createElement('div'); + let element = document.createElement('div'); element.innerHTML = '
'; element.className = 'match'; document.body.appendChild(element); - var childElement = element.childNodes[0]; - var listener = sinon.stub(); + let childElement = element.childNodes[0]; + let listener = sinon.stub(); dom.delegate(childElement, 'click', '.match', listener); dom.triggerEvent(childElement, 'click'); @@ -640,17 +651,18 @@ describe('dom', function() { }); it('should stop triggering event if stopPropagation is called', function() { - var element = document.createElement('div'); - element.innerHTML = '
' + + let element = document.createElement('div'); + element.innerHTML = + '
' + '
' + '
' + '
' + '
'; document.body.appendChild(element); - var matchedElements = element.querySelectorAll('.match'); + let matchedElements = element.querySelectorAll('.match'); - var listenerTargets = []; - var listener = function(event) { + let listenerTargets = []; + let listener = function(event) { listenerTargets.push(event.delegateTarget); event.stopPropagation(); }; @@ -662,17 +674,18 @@ describe('dom', function() { }); it('should stop triggering event if stopImmediatePropagation is called', function() { - var element = document.createElement('div'); - element.innerHTML = '
' + + let element = document.createElement('div'); + element.innerHTML = + '
' + '
' + '
' + '
' + '
'; document.body.appendChild(element); - var matchedElements = element.querySelectorAll('.match'); + let matchedElements = element.querySelectorAll('.match'); - var listenerTargets = []; - var listener = function(event) { + let listenerTargets = []; + let listener = function(event) { listenerTargets.push(event.delegateTarget); event.stopImmediatePropagation(); }; @@ -684,13 +697,13 @@ describe('dom', function() { }); it('should run default listeners last', function() { - var element = document.createElement('div'); + let element = document.createElement('div'); element.innerHTML = '
'; document.body.appendChild(element); - var listener1 = sinon.stub(); - var listener2 = sinon.stub(); - var listener3 = sinon.stub(); + let listener1 = sinon.stub(); + let listener2 = sinon.stub(); + let listener3 = sinon.stub(); dom.delegate(element, 'click', '.match', listener1, true); dom.delegate(element, 'click', '.match', listener2); dom.delegate(element, 'click', '.root', listener3); @@ -705,12 +718,12 @@ describe('dom', function() { }); it('should pass correct delegateTarget to default listener', function() { - var element = document.createElement('div'); + let element = document.createElement('div'); element.innerHTML = '
'; document.body.appendChild(element); - var target; - var listener = function(event) { + let target; + let listener = function(event) { target = event.delegateTarget; }; dom.delegate(element, 'click', '.match', listener, true); @@ -721,30 +734,33 @@ describe('dom', function() { }); it('should not run default listener if event is prevented', function() { - var element = document.createElement('div'); + let element = document.createElement('div'); element.innerHTML = '
'; document.body.appendChild(element); - var listener = sinon.stub(); + let listener = sinon.stub(); dom.delegate(element, 'click', '.match', listener, true); - dom.delegate(element, 'click', '.match', event => event.preventDefault()); + dom.delegate(element, 'click', '.match', event => + event.preventDefault() + ); dom.triggerEvent(element.querySelector('.match'), 'click'); assert.strictEqual(0, listener.callCount); }); it('should cancel listener through returned handle', function() { - var element = document.createElement('div'); - element.innerHTML = '
' + + let element = document.createElement('div'); + element.innerHTML = + '
' + '
' + '
' + '
' + '
'; document.body.appendChild(element); - var matchedElements = element.querySelectorAll('.match'); + let matchedElements = element.querySelectorAll('.match'); - var listener1 = sinon.stub(); - var handle = dom.delegate(element, 'click', '.match', listener1); + let listener1 = sinon.stub(); + let handle = dom.delegate(element, 'click', '.match', listener1); handle.removeListener(); dom.triggerEvent(matchedElements[0], 'click'); @@ -752,16 +768,17 @@ describe('dom', function() { }); it('should clear delegateTarget from event object after event is done', function() { - var element = document.createElement('div'); - element.innerHTML = '
' + + let element = document.createElement('div'); + element.innerHTML = + '
' + '
' + '
' + '
' + '
'; document.body.appendChild(element); - var matchedElements = element.querySelectorAll('.match'); + let matchedElements = element.querySelectorAll('.match'); - var listener = sinon.stub(); + let listener = sinon.stub(); dom.delegate(element, 'click', '.match', listener); dom.triggerEvent(matchedElements[1], 'click'); @@ -769,13 +786,13 @@ describe('dom', function() { }); it('should not run click event listeners for disabled elements', function() { - var parent = document.createElement('div'); + let parent = document.createElement('div'); document.body.appendChild(parent); - var input = document.createElement('input'); - var select = document.createElement('select'); - var button = document.createElement('button'); - var textarea = document.createElement('textarea'); + let input = document.createElement('input'); + let select = document.createElement('select'); + let button = document.createElement('button'); + let textarea = document.createElement('textarea'); input.disabled = true; select.disabled = true; button.disabled = true; @@ -785,10 +802,10 @@ describe('dom', function() { parent.appendChild(button); parent.appendChild(textarea); - var listener1 = sinon.stub(); - var listener2 = sinon.stub(); - var listener3 = sinon.stub(); - var listener4 = sinon.stub(); + let listener1 = sinon.stub(); + let listener2 = sinon.stub(); + let listener3 = sinon.stub(); + let listener4 = sinon.stub(); dom.delegate(parent, 'click', input, listener1); dom.delegate(parent, 'click', select, listener2); @@ -806,23 +823,23 @@ describe('dom', function() { }); it('should not run click event listeners to an element with an disabled valid parent', function() { - var parent = document.createElement('fieldset'); + let parent = document.createElement('fieldset'); parent.disabled = true; document.body.appendChild(parent); - var input = document.createElement('input'); - var select = document.createElement('select'); - var button = document.createElement('button'); - var textarea = document.createElement('textarea'); + let input = document.createElement('input'); + let select = document.createElement('select'); + let button = document.createElement('button'); + let textarea = document.createElement('textarea'); parent.appendChild(input); parent.appendChild(select); parent.appendChild(button); parent.appendChild(textarea); - var listener1 = sinon.stub(); - var listener2 = sinon.stub(); - var listener3 = sinon.stub(); - var listener4 = sinon.stub(); + let listener1 = sinon.stub(); + let listener2 = sinon.stub(); + let listener3 = sinon.stub(); + let listener4 = sinon.stub(); dom.delegate(parent, 'click', input, listener1); dom.delegate(parent, 'click', select, listener2); @@ -840,37 +857,38 @@ describe('dom', function() { }); it('should run click event listeners to an element that have not the disabled attribute with a disabled parent using "dispatchEvent()"', function() { - var element = document.createElement('div'); - element.innerHTML = '
' + + let element = document.createElement('div'); + element.innerHTML = + '
' + '
'; document.body.appendChild(element); - var listener = sinon.stub(); + let listener = sinon.stub(); dom.delegate(element, 'click', '.match', listener); - var eventObj = document.createEvent('HTMLEvents'); + let eventObj = document.createEvent('HTMLEvents'); eventObj.initEvent('click', true, true); - var target = element.querySelector('.match'); + let target = element.querySelector('.match'); target.dispatchEvent(eventObj); // Firefox works in a diferent way. It stops bubbling events when it hits a // disabled element. - var expectedResult = UA.isFirefox ? 0 : 1; + let expectedResult = UA.isFirefox ? 0 : 1; assert.strictEqual(expectedResult, listener.callCount); }); }); describe('without selector', function() { it('should trigger delegate listener for specified element', function() { - var element = document.createElement('div'); + let element = document.createElement('div'); dom.enterDocument(element); - var child = document.createElement('div'); + let child = document.createElement('div'); dom.append(element, child); - var grandchild = document.createElement('div'); + let grandchild = document.createElement('div'); dom.append(child, grandchild); - var eventCopy; + let eventCopy; dom.delegate(element, 'click', child, function(event) { eventCopy = object.mixin({}, event); }); @@ -892,11 +910,11 @@ describe('dom', function() { }); it('should not add listener to container twice for the same event type', function() { - var element = document.createElement('div'); + let element = document.createElement('div'); dom.enterDocument(element); - var child1 = document.createElement('div'); + let child1 = document.createElement('div'); dom.append(element, child1); - var child2 = document.createElement('div'); + let child2 = document.createElement('div'); dom.append(element, child2); sinon.spy(element, 'addEventListener'); @@ -906,16 +924,16 @@ describe('dom', function() { }); it('should trigger all delegated listeners for right element', function() { - var element = document.createElement('div'); + let element = document.createElement('div'); dom.enterDocument(element); - var child1 = document.createElement('div'); + let child1 = document.createElement('div'); dom.append(element, child1); - var child2 = document.createElement('div'); + let child2 = document.createElement('div'); dom.append(element, child2); - var child1Listener1 = sinon.stub(); - var child1Listener2 = sinon.stub(); - var child2Listener = sinon.stub(); + let child1Listener1 = sinon.stub(); + let child1Listener2 = sinon.stub(); + let child2Listener = sinon.stub(); dom.delegate(element, 'click', child1, child1Listener1); dom.delegate(element, 'click', child1, child1Listener2); dom.delegate(element, 'click', child2, child2Listener); @@ -932,17 +950,17 @@ describe('dom', function() { }); it('should not trigger listener twice when two ancestors are delegating', function() { - var element = document.createElement('div'); + let element = document.createElement('div'); dom.enterDocument(element); - var child = document.createElement('div'); + let child = document.createElement('div'); dom.append(element, child); - var grandchild = document.createElement('div'); + let grandchild = document.createElement('div'); dom.append(child, grandchild); - var greatgrandchild = document.createElement('div'); + let greatgrandchild = document.createElement('div'); dom.append(grandchild, greatgrandchild); - var listener1 = sinon.stub(); - var listener2 = sinon.stub(); + let listener1 = sinon.stub(); + let listener2 = sinon.stub(); dom.delegate(grandchild, 'click', greatgrandchild, listener1); dom.delegate(element, 'click', child, listener2); @@ -952,15 +970,15 @@ describe('dom', function() { }); it('should not trigger listeners from ancestors when stopPropagation is called', function() { - var element = document.createElement('div'); + let element = document.createElement('div'); dom.enterDocument(element); - var child = document.createElement('div'); + let child = document.createElement('div'); dom.append(element, child); - var grandchild = document.createElement('div'); + let grandchild = document.createElement('div'); dom.append(child, grandchild); - var listener1 = sinon.stub(); - var listener2 = sinon.stub(); + let listener1 = sinon.stub(); + let listener2 = sinon.stub(); dom.delegate(element, 'click', grandchild, function(event) { event.stopPropagation(); }); @@ -973,15 +991,15 @@ describe('dom', function() { }); it('should not trigger any other listeners when stopImmediatePropagation is called', function() { - var element = document.createElement('div'); + let element = document.createElement('div'); dom.enterDocument(element); - var child = document.createElement('div'); + let child = document.createElement('div'); dom.append(element, child); - var grandchild = document.createElement('div'); + let grandchild = document.createElement('div'); dom.append(child, grandchild); - var listener1 = sinon.stub(); - var listener2 = sinon.stub(); + let listener1 = sinon.stub(); + let listener2 = sinon.stub(); dom.delegate(element, 'click', grandchild, function(event) { event.stopImmediatePropagation(); }); @@ -994,30 +1012,30 @@ describe('dom', function() { }); it('should not trigger delegate "click" listener for right clicks', function() { - var element = document.createElement('div'); + let element = document.createElement('div'); dom.enterDocument(element); - var child = document.createElement('div'); + let child = document.createElement('div'); dom.append(element, child); - var listener = sinon.stub(); + let listener = sinon.stub(); dom.delegate(element, 'click', child, listener); dom.triggerEvent(child, 'click', { - button: 2 + button: 2, }); assert.strictEqual(0, listener.callCount); }); it('should run default listeners last', function() { - var element = document.createElement('div'); + let element = document.createElement('div'); dom.enterDocument(element); - var child = document.createElement('div'); + let child = document.createElement('div'); dom.append(element, child); - var grandchild = document.createElement('div'); + let grandchild = document.createElement('div'); dom.append(child, grandchild); - var listener1 = sinon.stub(); - var listener2 = sinon.stub(); - var listener3 = sinon.stub(); + let listener1 = sinon.stub(); + let listener2 = sinon.stub(); + let listener3 = sinon.stub(); dom.delegate(element, 'click', grandchild, listener1, true); dom.delegate(element, 'click', grandchild, listener2); dom.delegate(element, 'click', child, listener3); @@ -1032,12 +1050,12 @@ describe('dom', function() { }); it('should not run default listener if event is prevented', function() { - var element = document.createElement('div'); + let element = document.createElement('div'); dom.enterDocument(element); - var child = document.createElement('div'); + let child = document.createElement('div'); dom.append(element, child); - var listener = sinon.stub(); + let listener = sinon.stub(); dom.delegate(element, 'click', child, listener, true); dom.delegate(element, 'click', child, event => event.preventDefault()); @@ -1046,14 +1064,14 @@ describe('dom', function() { }); it('should cancel listener through returned handle', function() { - var element = document.createElement('div'); + let element = document.createElement('div'); dom.enterDocument(element); - var child = document.createElement('div'); + let child = document.createElement('div'); dom.append(element, child); - var listener1 = sinon.stub(); - var listener2 = sinon.stub(); - var handle = dom.delegate(element, 'click', child, listener1); + let listener1 = sinon.stub(); + let listener2 = sinon.stub(); + let handle = dom.delegate(element, 'click', child, listener1); dom.delegate(element, 'click', child, listener2); handle.removeListener(); @@ -1063,13 +1081,13 @@ describe('dom', function() { }); it('should cancel default listener through returned handle', function() { - var element = document.createElement('div'); + let element = document.createElement('div'); dom.enterDocument(element); - var child = document.createElement('div'); + let child = document.createElement('div'); dom.append(element, child); - var listener = sinon.stub(); - var handle = dom.delegate(element, 'click', child, listener, true); + let listener = sinon.stub(); + let handle = dom.delegate(element, 'click', child, listener, true); handle.removeListener(); dom.triggerEvent(child, 'click'); @@ -1077,12 +1095,12 @@ describe('dom', function() { }); it('should clear delegateTarget from event object after event is done', function() { - var element = document.createElement('div'); + let element = document.createElement('div'); dom.enterDocument(element); - var child = document.createElement('div'); + let child = document.createElement('div'); dom.append(element, child); - var listener = sinon.stub(); + let listener = sinon.stub(); dom.delegate(element, 'click', child, listener); dom.triggerEvent(child, 'click'); @@ -1113,9 +1131,9 @@ describe('dom', function() { }); it('should use matches function when available', function() { - var matchedElement = document.createElement('div'); + let matchedElement = document.createElement('div'); Element.prototype.matches = sinon.stub().returns(matchedElement); - var element = document.createElement('div'); + let element = document.createElement('div'); assert.strictEqual(matchedElement, dom.match(element, '.selector')); assert.strictEqual(1, element.matches.callCount); @@ -1123,10 +1141,12 @@ describe('dom', function() { }); it('should use webkitMatchesSelector function when available', function() { - var matchedElement = document.createElement('div'); + let matchedElement = document.createElement('div'); Element.prototype.matches = null; - Element.prototype.webkitMatchesSelector = sinon.stub().returns(matchedElement); - var element = document.createElement('div'); + Element.prototype.webkitMatchesSelector = sinon + .stub() + .returns(matchedElement); + let element = document.createElement('div'); assert.strictEqual(matchedElement, dom.match(element, '.selector')); assert.strictEqual(1, element.webkitMatchesSelector.callCount); @@ -1134,11 +1154,13 @@ describe('dom', function() { }); it('should use mozMatchesSelector function when available', function() { - var matchedElement = document.createElement('div'); + let matchedElement = document.createElement('div'); Element.prototype.matches = null; Element.prototype.webkitMatchesSelector = null; - Element.prototype.mozMatchesSelector = sinon.stub().returns(matchedElement); - var element = document.createElement('div'); + Element.prototype.mozMatchesSelector = sinon + .stub() + .returns(matchedElement); + let element = document.createElement('div'); assert.strictEqual(matchedElement, dom.match(element, '.selector')); assert.strictEqual(1, element.mozMatchesSelector.callCount); @@ -1146,12 +1168,14 @@ describe('dom', function() { }); it('should use msMatchesSelector function when available', function() { - var matchedElement = document.createElement('div'); + let matchedElement = document.createElement('div'); Element.prototype.matches = null; Element.prototype.webkitMatchesSelector = null; Element.prototype.mozMatchesSelector = null; - Element.prototype.msMatchesSelector = sinon.stub().returns(matchedElement); - var element = document.createElement('div'); + Element.prototype.msMatchesSelector = sinon + .stub() + .returns(matchedElement); + let element = document.createElement('div'); assert.strictEqual(matchedElement, dom.match(element, '.selector')); assert.strictEqual(1, element.msMatchesSelector.callCount); @@ -1159,13 +1183,13 @@ describe('dom', function() { }); it('should use oMatchesSelector function when available', function() { - var matchedElement = document.createElement('div'); + let matchedElement = document.createElement('div'); Element.prototype.matches = null; Element.prototype.webkitMatchesSelector = null; Element.prototype.mozMatchesSelector = null; Element.prototype.msMatchesSelector = null; Element.prototype.oMatchesSelector = sinon.stub().returns(matchedElement); - var element = document.createElement('div'); + let element = document.createElement('div'); assert.strictEqual(matchedElement, dom.match(element, '.selector')); assert.strictEqual(1, element.oMatchesSelector.callCount); @@ -1175,16 +1199,16 @@ describe('dom', function() { it('should return false for invalid node type', function() { Element.prototype.matches = sinon.stub(); - var element = document.createDocumentFragment(); + let element = document.createDocumentFragment(); assert.ok(!dom.match(element, 'selector')); assert.strictEqual(0, Element.prototype.matches.callCount); }); it('should fall back to using querySelectorAll when no others are available', function() { - var element = document.createElement('div'); + let element = document.createElement('div'); element.className = 'class1'; document.body.appendChild(element); - var element2 = document.createElement('div'); + let element2 = document.createElement('div'); element2.className = 'class2'; document.body.appendChild(element2); @@ -1205,9 +1229,9 @@ describe('dom', function() { dom.enterDocument( '
' ); - var element = dom.toElement('.element'); - var parent2 = dom.toElement('.parent1'); - var parent3 = dom.toElement('.parent2'); + let element = dom.toElement('.element'); + let parent2 = dom.toElement('.parent1'); + let parent3 = dom.toElement('.parent2'); assert.strictEqual(null, dom.parent(element, '.element')); assert.strictEqual(parent2, dom.parent(element, '.parent1')); assert.strictEqual(parent3, dom.parent(element, '.parent2')); @@ -1220,9 +1244,9 @@ describe('dom', function() { dom.enterDocument( '
' ); - var element = dom.toElement('.element'); - var parent2 = dom.toElement('.parent1'); - var parent3 = dom.toElement('.parent2'); + let element = dom.toElement('.element'); + let parent2 = dom.toElement('.parent1'); + let parent3 = dom.toElement('.parent2'); assert.strictEqual(element, dom.closest(element, '.element')); assert.strictEqual(parent2, dom.closest(element, '.parent1')); assert.strictEqual(parent3, dom.closest(element, '.parent2')); @@ -1235,9 +1259,9 @@ describe('dom', function() { dom.enterDocument( '
' ); - var element = dom.toElement('.rootElement'); - var sibling1 = dom.toElement('.sibling1'); - var sibling2 = dom.toElement('.sibling2'); + let element = dom.toElement('.rootElement'); + let sibling1 = dom.toElement('.sibling1'); + let sibling2 = dom.toElement('.sibling2'); assert.strictEqual(sibling1, dom.next(element, '.sibling1')); assert.strictEqual(sibling2, dom.next(element, '.sibling2')); assert.strictEqual(null, dom.next(element, '.sibling3')); @@ -1246,14 +1270,14 @@ describe('dom', function() { describe('toElement', function() { it('should return the element itself if one is given for conversion', function() { - var element = document.createElement('div'); + let element = document.createElement('div'); assert.strictEqual(element, dom.toElement(element)); assert.strictEqual(document, dom.toElement(document)); }); it('should return matching element if selector is given', function() { - var element = document.createElement('div'); + let element = document.createElement('div'); element.className = 'mySelector'; document.body.appendChild(element); @@ -1261,7 +1285,7 @@ describe('dom', function() { }); it('should return matching element when selector is id', function() { - var element = document.createElement('div'); + let element = document.createElement('div'); element.id = 'myId'; document.body.appendChild(element); @@ -1269,10 +1293,10 @@ describe('dom', function() { }); it('should return matching element when selector is inside id', function() { - var element = document.createElement('div'); + let element = document.createElement('div'); element.id = 'myId'; document.body.appendChild(element); - var element2 = document.createElement('div'); + let element2 = document.createElement('div'); element2.className = 'myClass'; dom.append(element, element2); @@ -1286,21 +1310,21 @@ describe('dom', function() { assert.strictEqual(null, dom.toElement(null)); }); - it('should return matching element if selector is document fragment', function () { - var frag1 = document.createDocumentFragment(); + it('should return matching element if selector is document fragment', function() { + let frag1 = document.createDocumentFragment(); assert.strictEqual(frag1, dom.toElement(frag1)); - var frag2 = document.createDocumentFragment(); + let frag2 = document.createDocumentFragment(); assert.strictEqual(frag2, dom.toElement(frag2)); - var frag3 = '#document-fragment'; + let frag3 = '#document-fragment'; assert.notStrictEqual(frag3, dom.toElement(frag3)); }); }); describe('supportsEvent', function() { it('should check if element supports event', function() { - var element = document.createElement('div'); + let element = document.createElement('div'); assert.ok(!dom.supportsEvent(element, 'lalala')); assert.ok(dom.supportsEvent(element, 'click')); @@ -1324,13 +1348,13 @@ describe('dom', function() { return listener(event); } }, - originalEvent: 'click' + originalEvent: 'click', }); }); it('should handle registered custom events', function() { - var listener = sinon.stub(); - var element = document.createElement('div'); + let listener = sinon.stub(); + let element = document.createElement('div'); dom.append(document.body, element); dom.on(element, 'myClick', listener); @@ -1343,19 +1367,19 @@ describe('dom', function() { }); it('should handle delegate for registered custom events', function() { - var element = document.createElement('div'); + let element = document.createElement('div'); dom.addClasses(element, 'mine'); dom.append(document.body, element); - var myElement = document.createElement('div'); + let myElement = document.createElement('div'); dom.addClasses(myElement, 'mine foo'); dom.append(element, myElement); - var fooElement = document.createElement('div'); + let fooElement = document.createElement('div'); dom.addClasses(fooElement, 'foo'); dom.append(element, fooElement); - var listener = sinon.stub(); + let listener = sinon.stub(); dom.delegate(element, 'myClick', '.foo', listener); dom.triggerEvent(element, 'click'); @@ -1376,7 +1400,7 @@ describe('dom', function() { describe('Helpers', function() { it('should check if element is empty', function() { - var element = document.createElement('div'); + let element = document.createElement('div'); assert.ok(dom.isEmpty(element)); element.innerHTML = 'foo'; @@ -1387,5 +1411,4 @@ describe('dom', function() { function getClassNames(element) { return element.className.trim().split(' '); } - }); diff --git a/packages/metal-dom/test/domData.js b/packages/metal-dom/test/domData.js index e1efebe1..2886e41b 100644 --- a/packages/metal-dom/test/domData.js +++ b/packages/metal-dom/test/domData.js @@ -4,18 +4,18 @@ import domData from '../src/domData'; describe('domData', function() { it('should get data object from element', function() { - var data = domData.get(document.createElement('div')); + let data = domData.get(document.createElement('div')); assert.ok(data); }); it('should return same data object for the same element', function() { - var element = document.createElement('div'); + let element = document.createElement('div'); assert.strictEqual(domData.get(element), domData.get(element)); }); it('should return different data objects for the different elements', function() { - var element1 = document.createElement('div'); - var element2 = document.createElement('div'); + let element1 = document.createElement('div'); + let element2 = document.createElement('div'); assert.notStrictEqual(domData.get(element1), domData.get(element2)); }); }); diff --git a/packages/metal-dom/test/events.js b/packages/metal-dom/test/events.js index 783cac5c..6ab322af 100644 --- a/packages/metal-dom/test/events.js +++ b/packages/metal-dom/test/events.js @@ -6,12 +6,12 @@ import '../src/events'; describe('Custom Events', function() { beforeEach(function() { - var element1 = document.createElement('div'); + let element1 = document.createElement('div'); dom.append(document.body, element1); - var element2 = document.createElement('div'); + let element2 = document.createElement('div'); dom.addClasses(element2, 'inner'); dom.append(element1, element2); - var element3 = document.createElement('div'); + let element3 = document.createElement('div'); dom.append(element2, element3); this.element1 = element1; @@ -20,85 +20,91 @@ describe('Custom Events', function() { }); it('should delegate mouseenter event', function() { - var listener = sinon.stub(); + let listener = sinon.stub(); dom.delegate(this.element1, 'mouseenter', '.inner', listener); dom.triggerEvent(this.element1, 'mouseover'); assert.strictEqual(0, listener.callCount); dom.triggerEvent(this.element2, 'mouseover', { - relatedTarget: this.element1 + relatedTarget: this.element1, }); assert.strictEqual(1, listener.callCount); assert.strictEqual('mouseenter', listener.args[0][0].customType); dom.triggerEvent(this.element2, 'mouseover', { - relatedTarget: this.element3 + relatedTarget: this.element3, }); assert.strictEqual(1, listener.callCount); }); it('should delegate mouseleave event', function() { - var listener = sinon.stub(); + let listener = sinon.stub(); dom.delegate(this.element1, 'mouseleave', '.inner', listener); dom.triggerEvent(this.element1, 'mouseout'); assert.strictEqual(0, listener.callCount); dom.triggerEvent(this.element2, 'mouseout', { - relatedTarget: this.element1 + relatedTarget: this.element1, }); assert.strictEqual(1, listener.callCount); assert.strictEqual('mouseleave', listener.args[0][0].customType); dom.triggerEvent(this.element2, 'mouseout', { - relatedTarget: this.element3 + relatedTarget: this.element3, }); assert.strictEqual(1, listener.callCount); }); it('should delegate pointerenter event', function() { - var listener = sinon.stub(); + let listener = sinon.stub(); dom.delegate(this.element1, 'pointerenter', '.inner', listener); dom.triggerEvent(this.element1, 'pointerover'); assert.strictEqual(0, listener.callCount); dom.triggerEvent(this.element2, 'pointerover', { - relatedTarget: this.element1 + relatedTarget: this.element1, }); assert.strictEqual(1, listener.callCount); assert.strictEqual('pointerenter', listener.args[0][0].customType); dom.triggerEvent(this.element2, 'pointerover', { - relatedTarget: this.element3 + relatedTarget: this.element3, }); assert.strictEqual(1, listener.callCount); }); it('should delegate pointerleave event', function() { - var listener = sinon.stub(); + let listener = sinon.stub(); dom.delegate(this.element1, 'pointerleave', '.inner', listener); dom.triggerEvent(this.element1, 'pointerout'); assert.strictEqual(0, listener.callCount); dom.triggerEvent(this.element2, 'pointerout', { - relatedTarget: this.element1 + relatedTarget: this.element1, }); assert.strictEqual(1, listener.callCount); assert.strictEqual('pointerleave', listener.args[0][0].customType); dom.triggerEvent(this.element2, 'pointerout', { - relatedTarget: this.element3 + relatedTarget: this.element3, }); assert.strictEqual(1, listener.callCount); }); it('should handle transitionend event', function() { - var listener = sinon.stub(); + let listener = sinon.stub(); dom.on(this.element1, 'transitionend', listener); - dom.triggerEvent(this.element1, features.checkAnimationEventName().transition); + dom.triggerEvent( + this.element1, + features.checkAnimationEventName().transition + ); assert.strictEqual(1, listener.callCount); assert.strictEqual('transitionend', listener.args[0][0].customType); }); it('should handle animationend event', function() { - var listener = sinon.stub(); + let listener = sinon.stub(); dom.on(this.element1, 'animationend', listener); - dom.triggerEvent(this.element1, features.checkAnimationEventName().animation); + dom.triggerEvent( + this.element1, + features.checkAnimationEventName().animation + ); assert.strictEqual(1, listener.callCount); assert.strictEqual('animationend', listener.args[0][0].customType); }); diff --git a/packages/metal-dom/test/features.js b/packages/metal-dom/test/features.js index 832be00c..7b3eb6e7 100644 --- a/packages/metal-dom/test/features.js +++ b/packages/metal-dom/test/features.js @@ -17,11 +17,11 @@ describe('features', function() { describe('Method checkAttrOrderChange', function() { it('should check if current browser changes attribute order', function() { - var result = features.checkAttrOrderChange(); + let result = features.checkAttrOrderChange(); assert.strictEqual(1, dom.append.callCount); - var element = dom.append.args[0][0]; - var original = dom.append.args[0][1]; + let element = dom.append.args[0][0]; + let original = dom.append.args[0][1]; assert.strictEqual(result, original !== element.innerHTML); }); @@ -45,39 +45,69 @@ describe('features', function() { it('should output default event name', function() { features.animationElement_ = { - style: {} + style: {}, }; - assert.strictEqual('animationend', features.checkAnimationEventName().animation); - assert.strictEqual('transitionend', features.checkAnimationEventName().transition); + assert.strictEqual( + 'animationend', + features.checkAnimationEventName().animation + ); + assert.strictEqual( + 'transitionend', + features.checkAnimationEventName().transition + ); }); it('should check for native browser support', function() { mockAnimationElementStyles(''); - assert.strictEqual('animationend', features.checkAnimationEventName().animation); - assert.strictEqual('transitionend', features.checkAnimationEventName().transition); + assert.strictEqual( + 'animationend', + features.checkAnimationEventName().animation + ); + assert.strictEqual( + 'transitionend', + features.checkAnimationEventName().transition + ); }); it('should check for Webkit browsers', function() { mockAnimationElementStyles('Webkit'); - assert.strictEqual('webkitAnimationEnd', features.checkAnimationEventName().animation); - assert.strictEqual('webkitTransitionEnd', features.checkAnimationEventName().transition); + assert.strictEqual( + 'webkitAnimationEnd', + features.checkAnimationEventName().animation + ); + assert.strictEqual( + 'webkitTransitionEnd', + features.checkAnimationEventName().transition + ); }); it('should check for MS browsers', function() { mockAnimationElementStyles('MS'); - assert.strictEqual('msAnimationEnd', features.checkAnimationEventName().animation); - assert.strictEqual('msTransitionEnd', features.checkAnimationEventName().transition); + assert.strictEqual( + 'msAnimationEnd', + features.checkAnimationEventName().animation + ); + assert.strictEqual( + 'msTransitionEnd', + features.checkAnimationEventName().transition + ); }); it('should check for Opera browsers', function() { mockAnimationElementStyles('O'); - assert.strictEqual('oAnimationEnd', features.checkAnimationEventName().animation); - assert.strictEqual('oTransitionEnd', features.checkAnimationEventName().transition); + assert.strictEqual( + 'oAnimationEnd', + features.checkAnimationEventName().animation + ); + assert.strictEqual( + 'oTransitionEnd', + features.checkAnimationEventName().transition + ); }); function mockAnimationElementStyles(browserPrefix) { features.animationElement_ = { - style: {} + style: {}, }; features.animationElement_.style[browserPrefix + 'animation'] = true; features.animationElement_.style[browserPrefix + 'transition'] = true; diff --git a/packages/metal-dom/test/globalEval.js b/packages/metal-dom/test/globalEval.js index cd03fd06..91dd4989 100644 --- a/packages/metal-dom/test/globalEval.js +++ b/packages/metal-dom/test/globalEval.js @@ -1,6 +1,6 @@ 'use strict'; -import { async } from 'metal'; +import {async} from 'metal'; import * as dom from '../src/dom'; import globalEval from '../src/globalEval'; @@ -23,12 +23,12 @@ describe('globalEval', function() { }); it('should not leave created script tag in document after code is evaluated', function() { - var newScript = globalEval.run('var testScript = 2 + 2;'); + let newScript = globalEval.run('var testScript = 2 + 2;'); assert.ok(!newScript.parentNode); }); it('should evaluate script file in global scope', function(done) { - var newScript = globalEval.runFile('fixtures/script.js'); + let newScript = globalEval.runFile('fixtures/script.js'); dom.on(newScript, 'load', function() { assert.strictEqual(5, window.testScript); @@ -36,8 +36,10 @@ describe('globalEval', function() { }); }); - it('should remove created script tag after evaluated script file is loaded', function(done) { - var newScript = globalEval.runFile('fixtures/script.js'); + it('should remove created script tag after evaluated script file is loaded', function( + done + ) { + let newScript = globalEval.runFile('fixtures/script.js'); dom.on(newScript, 'load', function() { assert.ok(!newScript.parentNode); @@ -45,8 +47,10 @@ describe('globalEval', function() { }); }); - it('should remove created script tag after evaluated script file throws error', function(done) { - var newScript = globalEval.runFile('fixtures/unexistingScript.js'); + it('should remove created script tag after evaluated script file throws error', function( + done + ) { + let newScript = globalEval.runFile('fixtures/unexistingScript.js'); dom.on(newScript, 'error', function() { assert.ok(!newScript.parentNode); @@ -63,8 +67,8 @@ describe('globalEval', function() { }); it('should be able to overwrite append function', function() { - var appendFn = sinon.stub(); - var script = document.createElement('script'); + let appendFn = sinon.stub(); + let script = document.createElement('script'); globalEval.runScript(script, null, appendFn); assert.strictEqual(1, appendFn.callCount); script.src = 'fixtures/script.js'; @@ -73,7 +77,7 @@ describe('globalEval', function() { }); it('should run code inside script tag in global scope', function() { - var script = document.createElement('script'); + let script = document.createElement('script'); script.text = 'var testScript = "script with code";'; globalEval.runScript(script); @@ -81,7 +85,7 @@ describe('globalEval', function() { }); it('should remove script element from the document when it\'s evaluated', function() { - var script = document.createElement('script'); + let script = document.createElement('script'); script.text = 'var testScript = "script with code";'; dom.enterDocument(script); @@ -90,8 +94,10 @@ describe('globalEval', function() { assert.ok(!script.parentNode); }); - it('should not evaluate script element with type different from javascript', function(done) { - var script = document.createElement('script'); + it('should not evaluate script element with type different from javascript', function( + done + ) { + let script = document.createElement('script'); script.text = 'Regular text file'; script.type = 'text/plain'; dom.enterDocument(script); @@ -104,8 +110,10 @@ describe('globalEval', function() { }); }); - it('should call callback function after script tag with inline content is run', function(done) { - var script = document.createElement('script'); + it('should call callback function after script tag with inline content is run', function( + done + ) { + let script = document.createElement('script'); script.text = 'var testScript = "script with code";'; dom.enterDocument(script); @@ -116,20 +124,24 @@ describe('globalEval', function() { }); }); - it('should run file referenced by specified script element in global scope', function(done) { - var script = document.createElement('script'); + it('should run file referenced by specified script element in global scope', function( + done + ) { + let script = document.createElement('script'); script.src = 'fixtures/script.js'; dom.enterDocument(script); - var newScript = globalEval.runScript(script); + let newScript = globalEval.runScript(script); dom.on(newScript, 'load', function() { assert.strictEqual(5, window.testScript); done(); }); }); - it('should call callback function after script tag with file src is run', function(done) { - var script = document.createElement('script'); + it('should call callback function after script tag with file src is run', function( + done + ) { + let script = document.createElement('script'); script.src = 'fixtures/script.js'; dom.enterDocument(script); @@ -141,7 +153,7 @@ describe('globalEval', function() { }); it('should run all script tags inside given element', function(done) { - var element = dom.buildFragment( + let element = dom.buildFragment( '
' ); globalEval.runScriptsInElement(element, function() { @@ -153,7 +165,7 @@ describe('globalEval', function() { }); it('should run script tags inside given element in order', function(done) { - var element = dom.buildFragment( + let element = dom.buildFragment( '
' ); @@ -164,29 +176,37 @@ describe('globalEval', function() { }); }); - it('should be able to overwrite append function from element', function(done) { - var element = dom.buildFragment( + it('should be able to overwrite append function from element', function( + done + ) { + let element = dom.buildFragment( '
' ); - var appendFn = sinon.spy(function(script) { + let appendFn = sinon.spy(function(script) { document.head.appendChild(script); }); - globalEval.runScriptsInElement(element, function() { - assert.strictEqual(2, appendFn.callCount); - done(); - }, appendFn); + globalEval.runScriptsInElement( + element, + function() { + assert.strictEqual(2, appendFn.callCount); + done(); + }, + appendFn + ); }); it('should not throw errors if trying to run scripts on element without any scripts', function() { - var element = dom.buildFragment('
'); + let element = dom.buildFragment('
'); assert.doesNotThrow(function() { globalEval.runScriptsInElement(element); }); }); - it('should call given callback on nextTick if no script tags exist in received element', function(done) { - var element = dom.buildFragment('
'); - var callback = sinon.stub(); + it('should call given callback on nextTick if no script tags exist in received element', function( + done + ) { + let element = dom.buildFragment('
'); + let callback = sinon.stub(); globalEval.runScriptsInElement(element, callback); assert.strictEqual(0, callback.callCount); async.nextTick(function() { diff --git a/packages/metal-dom/test/globalEvalStyles.js b/packages/metal-dom/test/globalEvalStyles.js index 811f0dd9..72c79651 100644 --- a/packages/metal-dom/test/globalEvalStyles.js +++ b/packages/metal-dom/test/globalEvalStyles.js @@ -1,6 +1,6 @@ 'use strict'; -import { async } from 'metal'; +import {async} from 'metal'; import * as dom from '../src/dom'; import globalEvalStyles from '../src/globalEvalStyles'; @@ -15,13 +15,13 @@ describe('globalEvalStyles', function() { afterEach(function() {}); it('should evaluate style code', function() { - var style = globalEvalStyles.run('body{background-color:rgb(255, 0, 0);}'); + let style = globalEvalStyles.run('body{background-color:rgb(255, 0, 0);}'); assertComputedStyle('backgroundColor', 'rgb(255, 0, 0)'); dom.exitDocument(style); }); it('should leave created style tag in document after code is evaluated', function() { - var style = globalEvalStyles.run(''); + let style = globalEvalStyles.run(''); assert.ok(style.parentNode); dom.exitDocument(style); }); @@ -34,7 +34,9 @@ describe('globalEvalStyles', function() { }); }); - it('should leave created style file in document after code is evaluated', function(done) { + it('should leave created style file in document after code is evaluated', function( + done + ) { var style = globalEvalStyles.runFile('fixtures/style.css', function() { assert.ok(style.parentNode); dom.exitDocument(style); @@ -43,16 +45,18 @@ describe('globalEvalStyles', function() { }); it('should run code inside style tag in global scope', function() { - var style = document.createElement('style'); + let style = document.createElement('style'); style.innerHTML = 'body{background-color:rgb(255, 0, 0);}'; - var newStyle = globalEvalStyles.runStyle(style); + let newStyle = globalEvalStyles.runStyle(style); assertComputedStyle('backgroundColor', 'rgb(255, 0, 0)'); dom.exitDocument(newStyle); }); - it('should leave created style element in document after code is evaluated', function(done) { - var style = document.createElement('style'); + it('should leave created style element in document after code is evaluated', function( + done + ) { + let style = document.createElement('style'); style.innerHTML = 'body{background-color:rgb(255, 0, 0);}'; var newStyle = globalEvalStyles.runStyle(style, function() { @@ -62,8 +66,10 @@ describe('globalEvalStyles', function() { }); }); - it('should not evaluate style element with tel different from stylesheet', function(done) { - var link = document.createElement('link'); + it('should not evaluate style element with tel different from stylesheet', function( + done + ) { + let link = document.createElement('link'); link.innerHTML = 'body{background-color:rgb(255, 0, 0);}'; link.rel = 'unknown'; dom.enterDocument(link); @@ -77,7 +83,7 @@ describe('globalEvalStyles', function() { }); it('should run file referenced by specified style element', function(done) { - var link = document.createElement('link'); + let link = document.createElement('link'); link.href = 'fixtures/style.css'; link.rel = 'stylesheet'; @@ -89,9 +95,9 @@ describe('globalEvalStyles', function() { }); it('should be able to overwrite append function', function() { - var appendFn = sinon.stub(); - var style = document.createElement('style'); - var newStyle = globalEvalStyles.runStyle(style, null, appendFn); + let appendFn = sinon.stub(); + let style = document.createElement('style'); + let newStyle = globalEvalStyles.runStyle(style, null, appendFn); assert.strictEqual(1, appendFn.callCount); dom.exitDocument(newStyle); globalEvalStyles.run('', appendFn); @@ -99,7 +105,7 @@ describe('globalEvalStyles', function() { }); it('should run all styles tags inside given element', function(done) { - var element = dom.buildFragment( + let element = dom.buildFragment( '
' ); globalEvalStyles.runStylesInElement(element, function() { @@ -110,7 +116,7 @@ describe('globalEvalStyles', function() { }); it('should run styles tags inside given element in order', function(done) { - var element = dom.buildFragment( + let element = dom.buildFragment( '
' ); globalEvalStyles.runStylesInElement(element, function() { @@ -120,15 +126,17 @@ describe('globalEvalStyles', function() { }); it('should not throw errors if trying to run styles on element without any styles', function() { - var element = dom.buildFragment('
'); + let element = dom.buildFragment('
'); assert.doesNotThrow(function() { globalEvalStyles.runStylesInElement(element); }); }); - it('should call given callback on nextTick if no style tags exist in received element', function(done) { - var element = dom.buildFragment('
'); - var callback = sinon.stub(); + it('should call given callback on nextTick if no style tags exist in received element', function( + done + ) { + let element = dom.buildFragment('
'); + let callback = sinon.stub(); globalEvalStyles.runStylesInElement(element, callback); assert.strictEqual(0, callback.callCount); async.nextTick(function() { @@ -136,10 +144,11 @@ describe('globalEvalStyles', function() { done(); }); }); - }); - function assertComputedStyle(property, value) { - assert.strictEqual(value, window.getComputedStyle(document.body, null)[property]); + assert.strictEqual( + value, + window.getComputedStyle(document.body, null)[property] + ); } diff --git a/packages/metal-events/src/EventEmitter.js b/packages/metal-events/src/EventEmitter.js index 9c55a1b3..d5daf764 100644 --- a/packages/metal-events/src/EventEmitter.js +++ b/packages/metal-events/src/EventEmitter.js @@ -1,6 +1,6 @@ 'use strict'; -import { array, Disposable, isFunction, isString } from 'metal'; +import {array, Disposable, isFunction, isString} from 'metal'; import EventHandle from './EventHandle'; const singleArray_ = [0]; @@ -97,7 +97,7 @@ class EventEmitter extends Disposable { listener = { default: opt_default, fn: listener, - origin: opt_origin + origin: opt_origin, }; } this.events_ = this.events_ || {}; @@ -117,7 +117,7 @@ class EventEmitter extends Disposable { facade.preventedDefault = true; }, target: this, - type: event + type: event, }; return facade; } @@ -176,7 +176,7 @@ class EventEmitter extends Disposable { */ listeners(event) { return this.getRawListeners_(event).map( - listener => listener.fn ? listener.fn : listener + listener => (listener.fn ? listener.fn : listener) ); } @@ -236,8 +236,9 @@ class EventEmitter extends Disposable { */ matchesListener_(listenerObj, listener) { const fn = listenerObj.fn || listenerObj; - return fn === listener || - (listenerObj.origin && listenerObj.origin === listener); + return ( + fn === listener || (listenerObj.origin && listenerObj.origin === listener) + ); } /** diff --git a/packages/metal-events/src/EventEmitterProxy.js b/packages/metal-events/src/EventEmitterProxy.js index eb702a52..1723f802 100644 --- a/packages/metal-events/src/EventEmitterProxy.js +++ b/packages/metal-events/src/EventEmitterProxy.js @@ -1,6 +1,6 @@ 'use strict'; -import { Disposable } from 'metal'; +import {Disposable} from 'metal'; /** * EventEmitterProxy utility. It's responsible for linking two EventEmitter @@ -130,9 +130,10 @@ class EventEmitterProxy extends Disposable { * @param {!EventEmitter} originEmitter */ setOriginEmitter(originEmitter) { - const events = this.originEmitter_ && this.proxiedEvents_ ? - Object.keys(this.proxiedEvents_) : - this.pendingEvents_; + const events = + this.originEmitter_ && this.proxiedEvents_ + ? Object.keys(this.proxiedEvents_) + : this.pendingEvents_; this.originEmitter_ = originEmitter; if (events) { this.removeListeners_(); diff --git a/packages/metal-events/src/EventHandle.js b/packages/metal-events/src/EventHandle.js index 6c1a1c53..58082c56 100644 --- a/packages/metal-events/src/EventHandle.js +++ b/packages/metal-events/src/EventHandle.js @@ -1,6 +1,6 @@ 'use strict'; -import { Disposable } from 'metal'; +import {Disposable} from 'metal'; /** * EventHandle utility. Holds information about an event subscription, and diff --git a/packages/metal-events/src/EventHandler.js b/packages/metal-events/src/EventHandler.js index f76793e3..13629a85 100644 --- a/packages/metal-events/src/EventHandler.js +++ b/packages/metal-events/src/EventHandler.js @@ -1,6 +1,6 @@ 'use strict'; -import { Disposable } from 'metal'; +import {Disposable} from 'metal'; /** * EventHandler utility. It's useful for easily removing a group of diff --git a/packages/metal-events/src/events.js b/packages/metal-events/src/events.js index 4bb9487b..594a8a0a 100644 --- a/packages/metal-events/src/events.js +++ b/packages/metal-events/src/events.js @@ -6,4 +6,4 @@ import EventHandle from './EventHandle'; import EventHandler from './EventHandler'; export default EventEmitter; -export { EventEmitter, EventEmitterProxy, EventHandle, EventHandler }; +export {EventEmitter, EventEmitterProxy, EventHandle, EventHandler}; diff --git a/packages/metal-events/test/EventEmitter.js b/packages/metal-events/test/EventEmitter.js index 2e0762ca..5aacc0da 100644 --- a/packages/metal-events/test/EventEmitter.js +++ b/packages/metal-events/test/EventEmitter.js @@ -12,7 +12,7 @@ describe('EventEmitter', function() { }); it('should emit and listen to events', function() { - var listener = sinon.stub(); + let listener = sinon.stub(); this.emitter.emit('event'); assert.strictEqual(0, listener.callCount); @@ -24,7 +24,7 @@ describe('EventEmitter', function() { }); it('should listen to multiple events on the same call', function() { - var listener = sinon.stub(); + let listener = sinon.stub(); this.emitter.on(['event1', 'event2'], listener); @@ -36,7 +36,7 @@ describe('EventEmitter', function() { }); it('should listen to events through `addListener`', function() { - var listener = sinon.stub(); + let listener = sinon.stub(); this.emitter.addListener(['event1', 'event2'], listener); @@ -48,7 +48,7 @@ describe('EventEmitter', function() { }); it('should listen to event a single time through `once`', function() { - var listener = sinon.stub(); + let listener = sinon.stub(); this.emitter.once('event', listener); assert.strictEqual(0, listener.callCount); @@ -61,7 +61,7 @@ describe('EventEmitter', function() { }); it('should listen to multiple events on the same call to `once`', function() { - var listener = sinon.stub(); + let listener = sinon.stub(); this.emitter.once(['event', 'event2'], listener); assert.strictEqual(0, listener.callCount); @@ -80,7 +80,7 @@ describe('EventEmitter', function() { }); it('should listen to event a fixed number of times through `many`', function() { - var listener = sinon.stub(); + let listener = sinon.stub(); this.emitter.many('event', 2, listener); assert.strictEqual(0, listener.callCount); @@ -96,7 +96,7 @@ describe('EventEmitter', function() { }); it('should listen to multiple events on the same call to `many`', function() { - var listener = sinon.stub(); + let listener = sinon.stub(); this.emitter.many(['event', 'event2'], 2, listener); @@ -120,7 +120,7 @@ describe('EventEmitter', function() { }); it('should ignore calls to `many` with non positive number', function() { - var listener = sinon.stub(); + let listener = sinon.stub(); this.emitter.many('event', 0, listener); this.emitter.emit('event'); @@ -132,11 +132,11 @@ describe('EventEmitter', function() { }); it('should run listeners in the order they were added', function() { - var order = ''; - var listener1 = function() { + let order = ''; + let listener1 = function() { order += '1'; }; - var listener2 = function() { + let listener2 = function() { order += '2'; }; @@ -148,9 +148,9 @@ describe('EventEmitter', function() { }); it('should return all listeners for given event type', function() { - var listener1 = sinon.stub(); - var listener2 = sinon.stub(); - var listener3 = sinon.stub(); + let listener1 = sinon.stub(); + let listener2 = sinon.stub(); + let listener3 = sinon.stub(); this.emitter.on('event', listener1); this.emitter.on('anotherEvent', listener2); @@ -162,8 +162,8 @@ describe('EventEmitter', function() { }); it('should detach events', function() { - var listener = sinon.stub(); - var listener2 = sinon.stub(); + let listener = sinon.stub(); + let listener2 = sinon.stub(); this.emitter.on('event', listener); this.emitter.on('event', listener2); @@ -175,8 +175,8 @@ describe('EventEmitter', function() { }); it('should detach listeners subscribed multiple times to same event', function() { - var listener = sinon.stub(); - var listener2 = sinon.stub(); + let listener = sinon.stub(); + let listener2 = sinon.stub(); this.emitter.on('event', listener); this.emitter.on('event', listener); @@ -190,11 +190,11 @@ describe('EventEmitter', function() { }); it('should detach events via return value', function() { - var listener = sinon.stub(); - var listener2 = sinon.stub(); + let listener = sinon.stub(); + let listener2 = sinon.stub(); this.emitter.on('event', listener); - var handle = this.emitter.on('event', listener2); + let handle = this.emitter.on('event', listener2); handle.removeListener(); this.emitter.emit('event'); @@ -203,8 +203,8 @@ describe('EventEmitter', function() { }); it('should detach events that were listened together', function() { - var listener = sinon.stub(); - var listener2 = sinon.stub(); + let listener = sinon.stub(); + let listener2 = sinon.stub(); this.emitter.on(['event', 'event2'], listener); this.emitter.on(['event', 'event2'], listener2); @@ -220,8 +220,8 @@ describe('EventEmitter', function() { }); it('should detach multiple events with the same call', function() { - var listener = sinon.stub(); - var listener2 = sinon.stub(); + let listener = sinon.stub(); + let listener2 = sinon.stub(); this.emitter.on('event', listener); this.emitter.on('event2', listener); @@ -238,11 +238,11 @@ describe('EventEmitter', function() { }); it('should detach events that were listened together via return value', function() { - var listener = sinon.stub(); - var listener2 = sinon.stub(); + let listener = sinon.stub(); + let listener2 = sinon.stub(); this.emitter.on(['event', 'event2'], listener); - var handle = this.emitter.on(['event', 'event2'], listener2); + let handle = this.emitter.on(['event', 'event2'], listener2); handle.removeListener(); this.emitter.emit('event'); @@ -255,7 +255,7 @@ describe('EventEmitter', function() { }); it('should detach events listened through `once`', function() { - var listener = sinon.stub(); + let listener = sinon.stub(); this.emitter.once('event', listener); this.emitter.off('event', listener); @@ -265,9 +265,9 @@ describe('EventEmitter', function() { }); it('should detach events listened through `once` via return value', function() { - var listener = sinon.stub(); + let listener = sinon.stub(); - var handle = this.emitter.once('event', listener); + let handle = this.emitter.once('event', listener); handle.removeListener(); this.emitter.emit('event'); @@ -275,7 +275,7 @@ describe('EventEmitter', function() { }); it('should detach events listened through `many`', function() { - var listener = sinon.stub(); + let listener = sinon.stub(); this.emitter.many('event', 2, listener); this.emitter.off('event', listener); @@ -285,7 +285,7 @@ describe('EventEmitter', function() { }); it('should detach events listened together through `many`', function() { - var listener = sinon.stub(); + let listener = sinon.stub(); this.emitter.many(['event', 'event2'], 2, listener); this.emitter.off(['event', 'event2'], listener); @@ -296,9 +296,9 @@ describe('EventEmitter', function() { }); it('should detach events listened together through `many` via return value', function() { - var listener = sinon.stub(); + let listener = sinon.stub(); - var handle = this.emitter.many(['event', 'event2'], 2, listener); + let handle = this.emitter.many(['event', 'event2'], 2, listener); handle.removeListener(); this.emitter.emit('event'); @@ -307,9 +307,9 @@ describe('EventEmitter', function() { }); it('should detach events listened through `many` via return value', function() { - var listener = sinon.stub(); + let listener = sinon.stub(); - var handle = this.emitter.many('event', 2, listener); + let handle = this.emitter.many('event', 2, listener); handle.removeListener(); this.emitter.emit('event'); @@ -317,8 +317,8 @@ describe('EventEmitter', function() { }); it('should detach events through `removeListener`', function() { - var listener = sinon.stub(); - var listener2 = sinon.stub(); + let listener = sinon.stub(); + let listener2 = sinon.stub(); this.emitter.on('event', listener); this.emitter.on('event', listener2); @@ -330,15 +330,17 @@ describe('EventEmitter', function() { }); it('should not throw error when detaching event type that was never used before', function() { - var listener = sinon.stub(); - assert.doesNotThrow(function() { - this.emitter.off('event', listener); - }.bind(this)); + let listener = sinon.stub(); + assert.doesNotThrow( + function() { + this.emitter.off('event', listener); + }.bind(this) + ); }); it('should remove all listeners', function() { - var listener1 = sinon.stub(); - var listener2 = sinon.stub(); + let listener1 = sinon.stub(); + let listener2 = sinon.stub(); this.emitter.on('event1', listener1); this.emitter.on('event2', listener2); @@ -352,8 +354,8 @@ describe('EventEmitter', function() { }); it('should remove all listeners of the given type', function() { - var listener1 = sinon.stub(); - var listener2 = sinon.stub(); + let listener1 = sinon.stub(); + let listener2 = sinon.stub(); this.emitter.on('event1', listener1); this.emitter.on('event2', listener2); @@ -367,9 +369,9 @@ describe('EventEmitter', function() { }); it('should remove all listeners of the given types', function() { - var listener1 = sinon.stub(); - var listener2 = sinon.stub(); - var listener3 = sinon.stub(); + let listener1 = sinon.stub(); + let listener2 = sinon.stub(); + let listener3 = sinon.stub(); this.emitter.on('event1', listener1); this.emitter.on('event2', listener2); @@ -391,7 +393,7 @@ describe('EventEmitter', function() { }); it('should only allow functions as listeners', function() { - var self = this; + let self = this; assert.throws(function() { self.emitter.addListener('event', {}); @@ -403,7 +405,7 @@ describe('EventEmitter', function() { }); it('should pass requested arguments to listener on emit', function() { - var listener = sinon.stub(); + let listener = sinon.stub(); this.emitter.on('event', listener); this.emitter.emit('event', 'arg1', 2); @@ -412,7 +414,7 @@ describe('EventEmitter', function() { }); it('should pass facade as last argument when requested', function() { - var listener = sinon.stub(); + let listener = sinon.stub(); this.emitter.setShouldUseFacade(true); this.emitter.on('event', listener); @@ -425,13 +427,13 @@ describe('EventEmitter', function() { sinon.match({ preventDefault: sinon.match.func, target: this.emitter, - type: 'event' + type: 'event', }) ); }); it('should set preventedDefault flag to true on facade when preventDefault is called', function() { - var listener = sinon.stub(); + let listener = sinon.stub(); this.emitter.setShouldUseFacade(true); this.emitter.once('event', function(event) { @@ -446,9 +448,9 @@ describe('EventEmitter', function() { }); it('should emit listener marked as default last', function() { - var listener1 = sinon.stub(); - var listener2 = sinon.stub(); - var listenerDefault = sinon.spy(function() { + let listener1 = sinon.stub(); + let listener2 = sinon.stub(); + let listenerDefault = sinon.spy(function() { assert.strictEqual(1, listener1.callCount); assert.strictEqual(1, listener2.callCount); }); @@ -462,11 +464,11 @@ describe('EventEmitter', function() { }); it('should not call default listener if "preventDefault" is called', function() { - var listener1 = sinon.spy(function(event) { + let listener1 = sinon.spy(function(event) { event.preventDefault(); }); - var listener2 = sinon.stub(); - var listenerDefault = sinon.stub(); + let listener2 = sinon.stub(); + let listenerDefault = sinon.stub(); this.emitter.setShouldUseFacade(true); this.emitter.on('event', listenerDefault, true); @@ -494,7 +496,7 @@ describe('EventEmitter', function() { }); it('should remove all listeners on dispose', function() { - var listener = sinon.stub(); + let listener = sinon.stub(); this.emitter.on('event', listener); this.emitter.dispose(); diff --git a/packages/metal-events/test/EventEmitterProxy.js b/packages/metal-events/test/EventEmitterProxy.js index 232f7d7e..2099bd82 100644 --- a/packages/metal-events/test/EventEmitterProxy.js +++ b/packages/metal-events/test/EventEmitterProxy.js @@ -5,11 +5,11 @@ import EventEmitterProxy from '../src/EventEmitterProxy'; describe('EventEmitterProxy', function() { it('should proxy event from origin to target', function() { - var origin = new EventEmitter(); - var target = new EventEmitter(); + let origin = new EventEmitter(); + let target = new EventEmitter(); new EventEmitterProxy(origin, target); - var listener = sinon.stub(); + let listener = sinon.stub(); target.on('event1', listener); origin.emit('event1', 1, 2); @@ -19,13 +19,13 @@ describe('EventEmitterProxy', function() { }); it('should not proxy blacklisted event', function() { - var origin = new EventEmitter(); - var target = new EventEmitter(); + let origin = new EventEmitter(); + let target = new EventEmitter(); new EventEmitterProxy(origin, target, { - event1: true + event1: true, }); - var listener = sinon.stub(); + let listener = sinon.stub(); target.on('event1', listener); origin.emit('event1', 1, 2); @@ -33,13 +33,13 @@ describe('EventEmitterProxy', function() { }); it('should proxy only whitelisted events', function() { - var origin = new EventEmitter(); - var target = new EventEmitter(); + let origin = new EventEmitter(); + let target = new EventEmitter(); new EventEmitterProxy(origin, target, null, { - event1: true + event1: true, }); - var listener = sinon.stub(); + let listener = sinon.stub(); target.on('event1', listener); target.on('event2', listener); origin.emit('event1', 1, 2); @@ -49,15 +49,20 @@ describe('EventEmitterProxy', function() { }); it('should not proxy event that is both whitelisted and blacklisted', function() { - var origin = new EventEmitter(); - var target = new EventEmitter(); - new EventEmitterProxy(origin, target, { - event1: true - }, { - event1: true - }); - - var listener = sinon.stub(); + let origin = new EventEmitter(); + let target = new EventEmitter(); + new EventEmitterProxy( + origin, + target, + { + event1: true, + }, + { + event1: true, + } + ); + + let listener = sinon.stub(); target.on('event1', listener); target.on('event2', listener); origin.emit('event1', 1, 2); @@ -67,13 +72,13 @@ describe('EventEmitterProxy', function() { }); it('should only emit proxied event once per listener', function() { - var origin = new EventEmitter(); - var target = new EventEmitter(); + let origin = new EventEmitter(); + let target = new EventEmitter(); new EventEmitterProxy(origin, target); - var listener1 = sinon.stub(); + let listener1 = sinon.stub(); target.on('event1', listener1); - var listener2 = sinon.stub(); + let listener2 = sinon.stub(); target.on('event1', listener2); origin.emit('event1', 1, 2); @@ -82,14 +87,14 @@ describe('EventEmitterProxy', function() { }); it('should change the emitter that events are proxied from', function() { - var origin = new EventEmitter(); - var target = new EventEmitter(); - var proxy = new EventEmitterProxy(origin, target); + let origin = new EventEmitter(); + let target = new EventEmitter(); + let proxy = new EventEmitterProxy(origin, target); - var listener = sinon.stub(); + let listener = sinon.stub(); target.on('event1', listener); - var origin2 = new EventEmitter(); + let origin2 = new EventEmitter(); proxy.setOriginEmitter(origin2); origin.emit('event1', 1, 2); @@ -102,13 +107,13 @@ describe('EventEmitterProxy', function() { }); it('should remove listeners after changing the emitter that events were proxied from', function() { - var target = new EventEmitter(); - var proxy = new EventEmitterProxy(new EventEmitter(), target); + let target = new EventEmitter(); + let proxy = new EventEmitterProxy(new EventEmitter(), target); - var listener = sinon.stub(); + let listener = sinon.stub(); target.on('event1', listener); - var origin2 = new EventEmitter(); + let origin2 = new EventEmitter(); proxy.setOriginEmitter(origin2); proxy.dispose(); @@ -117,27 +122,27 @@ describe('EventEmitterProxy', function() { }); it('should not throw error if origin emitter is set to null', function() { - var origin = new EventEmitter(); - var target = new EventEmitter(); - var proxy = new EventEmitterProxy(origin, target); + let origin = new EventEmitter(); + let target = new EventEmitter(); + let proxy = new EventEmitterProxy(origin, target); - var listener = sinon.stub(); + let listener = sinon.stub(); target.on('event1', listener); assert.doesNotThrow(() => proxy.setOriginEmitter(null)); }); it('should pass proxied events to new origin emitters, even when no emitter exists for a while', function() { - var origin = new EventEmitter(); - var target = new EventEmitter(); - var proxy = new EventEmitterProxy(origin, target); + let origin = new EventEmitter(); + let target = new EventEmitter(); + let proxy = new EventEmitterProxy(origin, target); - var listener = sinon.stub(); + let listener = sinon.stub(); target.on('event1', listener); proxy.setOriginEmitter(null); - var origin2 = new EventEmitter(); + let origin2 = new EventEmitter(); proxy.setOriginEmitter(origin2); origin.emit('event1', 1, 2); @@ -150,13 +155,13 @@ describe('EventEmitterProxy', function() { }); it('should allow manually choosing events to be proxied', function() { - var origin = new EventEmitter(); - var target = new EventEmitter(); + let origin = new EventEmitter(); + let target = new EventEmitter(); - var listener = sinon.stub(); + let listener = sinon.stub(); target.on('event1', listener); - var proxy = new EventEmitterProxy(origin, target); + let proxy = new EventEmitterProxy(origin, target); proxy.proxyEvent('event1'); origin.emit('event1', 1, 2); @@ -166,11 +171,11 @@ describe('EventEmitterProxy', function() { }); it('should not proxy events after disposed', function() { - var origin = new EventEmitter(); - var target = new EventEmitter(); - var proxy = new EventEmitterProxy(origin, target); + let origin = new EventEmitter(); + let target = new EventEmitter(); + let proxy = new EventEmitterProxy(origin, target); - var listener = sinon.stub(); + let listener = sinon.stub(); target.on('event1', listener); proxy.dispose(); diff --git a/packages/metal-events/test/EventHandle.js b/packages/metal-events/test/EventHandle.js index 2eb84890..e6baccb3 100644 --- a/packages/metal-events/test/EventHandle.js +++ b/packages/metal-events/test/EventHandle.js @@ -5,9 +5,9 @@ import EventEmitter from '../src/EventEmitter'; describe('EventHandle', function() { it('should unsubscribe the listener', function() { - var emitter = new EventEmitter(); - var listener = sinon.stub(); - var handle = new EventHandle(emitter, 'event', listener); + let emitter = new EventEmitter(); + let listener = sinon.stub(); + let handle = new EventHandle(emitter, 'event', listener); emitter.on('event', listener); emitter.on('event2', listener); @@ -21,18 +21,18 @@ describe('EventHandle', function() { }); it('should not throw error when removing listener on disposed emitter', function() { - var emitter = new EventEmitter(); - var listener = sinon.stub(); - var handle = new EventHandle(emitter, 'event', listener); + let emitter = new EventEmitter(); + let listener = sinon.stub(); + let handle = new EventHandle(emitter, 'event', listener); emitter.dispose(); handle.removeListener(); }); it('should remove listeners when disposed', function() { - var emitter = new EventEmitter(); - var listener = sinon.stub(); - var handle = new EventHandle(emitter, 'event', listener); + let emitter = new EventEmitter(); + let listener = sinon.stub(); + let handle = new EventHandle(emitter, 'event', listener); emitter.on('event', listener); handle.dispose(); emitter.emit('event'); diff --git a/packages/metal-events/test/EventHandler.js b/packages/metal-events/test/EventHandler.js index 19a84e10..a7a7b893 100644 --- a/packages/metal-events/test/EventHandler.js +++ b/packages/metal-events/test/EventHandler.js @@ -5,11 +5,11 @@ import EventHandler from '../src/EventHandler'; describe('EventHandler', function() { it('should remove all added listeners', function() { - var emitter1 = new EventEmitter(); - var emitter2 = new EventEmitter(); - var handler = new EventHandler(); - var listener1 = sinon.stub(); - var listener2 = sinon.stub(); + let emitter1 = new EventEmitter(); + let emitter2 = new EventEmitter(); + let handler = new EventHandler(); + let listener1 = sinon.stub(); + let listener2 = sinon.stub(); handler.add( emitter1.on('event1', listener1), @@ -43,9 +43,9 @@ describe('EventHandler', function() { }); it('should clear listeners on dispose', function() { - var emitter = new EventEmitter(); - var handler = new EventHandler(); - var listener = sinon.stub(); + let emitter = new EventEmitter(); + let handler = new EventHandler(); + let listener = sinon.stub(); handler.add(emitter.on('event', listener)); handler.dispose(); diff --git a/packages/metal-incremental-dom/src/IncrementalDomRenderer.js b/packages/metal-incremental-dom/src/IncrementalDomRenderer.js index 969f26a4..984a78b9 100644 --- a/packages/metal-incremental-dom/src/IncrementalDomRenderer.js +++ b/packages/metal-incremental-dom/src/IncrementalDomRenderer.js @@ -1,12 +1,12 @@ 'use strict'; import './incremental-dom'; -import { getChanges, trackChanges } from './changes'; -import { clearData, getData } from './data'; -import { getOwner } from './children/children'; -import { getPatchingComponent, patch } from './render/patch'; -import { render, renderChild, renderFunction } from './render/render'; -import { Component, ComponentRenderer } from 'metal-component'; +import {getChanges, trackChanges} from './changes'; +import {clearData, getData} from './data'; +import {getOwner} from './children/children'; +import {getPatchingComponent, patch} from './render/patch'; +import {render, renderChild, renderFunction} from './render/render'; +import {Component, ComponentRenderer} from 'metal-component'; class IncrementalDomRenderer extends ComponentRenderer.constructor { /** @@ -156,7 +156,8 @@ class IncrementalDomRenderer extends ComponentRenderer.constructor { renderInsidePatch(component) { const changes = getChanges(component); - const shouldRender = !component.wasRendered || + const shouldRender = + !component.wasRendered || this.shouldUpdate(component, changes) || IncrementalDOM.currentPointer() !== component.element; if (shouldRender) { diff --git a/packages/metal-incremental-dom/src/all/incremental-dom.js b/packages/metal-incremental-dom/src/all/incremental-dom.js index 98b699d5..e2d8cc14 100644 --- a/packages/metal-incremental-dom/src/all/incremental-dom.js +++ b/packages/metal-incremental-dom/src/all/incremental-dom.js @@ -1,5 +1,5 @@ import HTML2IncDom from '../html/HTML2IncDom'; import IncrementalDomRenderer from '../IncrementalDomRenderer'; -export { HTML2IncDom }; +export {HTML2IncDom}; export default IncrementalDomRenderer; diff --git a/packages/metal-incremental-dom/src/changes.js b/packages/metal-incremental-dom/src/changes.js index d26b3ec7..829e6e5c 100644 --- a/packages/metal-incremental-dom/src/changes.js +++ b/packages/metal-incremental-dom/src/changes.js @@ -1,6 +1,6 @@ 'use strict'; -import { getData } from './data'; +import {getData} from './data'; /** * Clears the changes tracked so far. diff --git a/packages/metal-incremental-dom/src/children/children.js b/packages/metal-incremental-dom/src/children/children.js index 73420033..d6f0fcdd 100644 --- a/packages/metal-incremental-dom/src/children/children.js +++ b/packages/metal-incremental-dom/src/children/children.js @@ -1,8 +1,8 @@ 'use strict'; -import { buildCallFromConfig, buildConfigFromCall } from '../callArgs'; -import { isDef } from 'metal'; -import { startInterception, stopInterception } from '../incremental-dom-aop'; +import {buildCallFromConfig, buildConfigFromCall} from '../callArgs'; +import {isDef} from 'metal'; +import {startInterception, stopInterception} from '../incremental-dom-aop'; /** * Property identifying a specific object as a Metal.js child node, and @@ -24,8 +24,8 @@ export function captureChildren(component, callback, data) { callbackData_ = data; tree_ = { props: { - children: [] - } + children: [], + }, }; tree_.config = tree_.props; currentParent_ = tree_; @@ -33,7 +33,7 @@ export function captureChildren(component, callback, data) { startInterception({ elementClose: handleInterceptedCloseCall_, elementOpen: handleInterceptedOpenCall_, - text: handleInterceptedTextCall_ + text: handleInterceptedTextCall_, }); } @@ -81,7 +81,7 @@ export function renderChildTree(tree, opt_skipNode) { let args = buildCallFromConfig(tree.tag, tree.props); args[0] = { tag: args[0], - owner: getOwner(tree) + owner: getOwner(tree), }; IncrementalDOM.elementOpen.apply(null, args); if (tree.props.children) { @@ -110,7 +110,7 @@ let tree_; function addChildCallToTree_(args, opt_isText) { const child = { parent: currentParent_, - [CHILD_OWNER]: owner_ + [CHILD_OWNER]: owner_, }; if (opt_isText) { diff --git a/packages/metal-incremental-dom/src/cleanup/unused.js b/packages/metal-incremental-dom/src/cleanup/unused.js index ecb07801..6489a6d3 100644 --- a/packages/metal-incremental-dom/src/cleanup/unused.js +++ b/packages/metal-incremental-dom/src/cleanup/unused.js @@ -1,6 +1,6 @@ 'use strict'; -import { getData } from '../data'; +import {getData} from '../data'; let comps_ = []; let disposing_ = false; diff --git a/packages/metal-incremental-dom/src/html/HTML2IncDom.js b/packages/metal-incremental-dom/src/html/HTML2IncDom.js index 8b1004d3..0a39c081 100644 --- a/packages/metal-incremental-dom/src/html/HTML2IncDom.js +++ b/packages/metal-incremental-dom/src/html/HTML2IncDom.js @@ -3,7 +3,7 @@ import HTMLParser from './HTMLParser'; import unescape from './unescape'; -var parser_; +let parser_; class HTML2IncDom { /** @@ -32,16 +32,14 @@ class HTML2IncDom { static run(html) { HTML2IncDom.getParser()(html, { start: function(tag, attrs, unary) { - var fn = unary ? IncrementalDOM.elementVoid : IncrementalDOM.elementOpen; - var args = [ - tag, - null, - [] - ]; - for (var i = 0; i < attrs.length; i++) { + let fn = unary + ? IncrementalDOM.elementVoid + : IncrementalDOM.elementOpen; + let args = [tag, null, []]; + for (let i = 0; i < attrs.length; i++) { args.push(attrs[i].name, attrs[i].value); } - fn.apply(null, args); + fn(...args); }, end: function(tag) { @@ -50,7 +48,7 @@ class HTML2IncDom { chars: function(text) { IncrementalDOM.text(text, unescape); - } + }, }); } diff --git a/packages/metal-incremental-dom/src/html/HTMLParser.js b/packages/metal-incremental-dom/src/html/HTMLParser.js index 0cb0aeb5..bff74390 100644 --- a/packages/metal-incremental-dom/src/html/HTMLParser.js +++ b/packages/metal-incremental-dom/src/html/HTMLParser.js @@ -91,27 +91,39 @@ var startTag = /^<([-A-Za-z0-9_]+)((?:\s+[a-zA-Z_:][-a-zA-Z0-9_:.]*(?:\s*=\s*(?: attr = /([a-zA-Z_:][-a-zA-Z0-9_:.]*)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|([^>\s]+)))?/g; // Empty Elements - HTML 5 -var empty = makeMap("area,base,basefont,br,col,frame,hr,img,input,link,meta,param,embed,command,keygen,source,track,wbr"); +var empty = makeMap( + 'area,base,basefont,br,col,frame,hr,img,input,link,meta,param,embed,command,keygen,source,track,wbr' +); // Block Elements - HTML 5 -var block = makeMap("a,address,article,applet,aside,audio,blockquote,button,canvas,center,dd,del,dir,div,dl,dt,fieldset,figcaption,figure,footer,form,frameset,h1,h2,h3,h4,h5,h6,header,hgroup,hr,iframe,ins,isindex,li,map,menu,noframes,noscript,object,ol,output,p,pre,section,script,table,tbody,td,tfoot,th,thead,tr,ul,video"); +var block = makeMap( + 'a,address,article,applet,aside,audio,blockquote,button,canvas,center,dd,del,dir,div,dl,dt,fieldset,figcaption,figure,footer,form,frameset,h1,h2,h3,h4,h5,h6,header,hgroup,hr,iframe,ins,isindex,li,map,menu,noframes,noscript,object,ol,output,p,pre,section,script,table,tbody,td,tfoot,th,thead,tr,ul,video' +); // Inline Elements - HTML 5 -var inline = makeMap("abbr,acronym,applet,b,basefont,bdo,big,br,button,cite,code,del,dfn,em,font,i,iframe,img,input,ins,kbd,label,map,object,q,s,samp,script,select,small,span,strike,strong,sub,sup,textarea,tt,u,var"); +var inline = makeMap( + 'abbr,acronym,applet,b,basefont,bdo,big,br,button,cite,code,del,dfn,em,font,i,iframe,img,input,ins,kbd,label,map,object,q,s,samp,script,select,small,span,strike,strong,sub,sup,textarea,tt,u,var' +); // Elements that you can, intentionally, leave open // (and which close themselves) -var closeSelf = makeMap("colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr"); +var closeSelf = makeMap('colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr'); // Attributes that have their values filled in disabled="disabled" -var fillAttrs = makeMap("checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected"); +var fillAttrs = makeMap( + 'checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected' +); // Special Elements (can contain anything) -var special = makeMap("script,style"); +var special = makeMap('script,style'); -var HTMLParser = function (html, handler) { - var index, chars, match, stack = [], last = html; - stack.last = function () { +var HTMLParser = function(html, handler) { + var index, + chars, + match, + stack = [], + last = html; + stack.last = function() { return this[this.length - 1]; }; @@ -120,20 +132,18 @@ var HTMLParser = function (html, handler) { // Make sure we're not in a script or style element if (!stack.last() || !special[stack.last()]) { - // Comment - if (html.indexOf(""); + if (html.indexOf(''); if (index >= 0) { - if (handler.comment) - handler.comment(html.substring(4, index)); + if (handler.comment) handler.comment(html.substring(4, index)); html = html.substring(index + 3); chars = false; } // end tag - } else if (html.indexOf("]*>"), function (all, text) { - text = text.replace(/|/g, "$1$2"); - if (handler.chars) - handler.chars(text); - - return ""; - }); + html = html.replace( + new RegExp('([\\s\\S]*?)]*>'), + function(all, text) { + text = text.replace( + /|/g, + '$1$2' + ); + if (handler.chars) handler.chars(text); + + return ''; + } + ); - parseEndTag("", stack.last()); + parseEndTag('', stack.last()); } - if (html == last) - throw "Parse Error: " + html; + if (html == last) throw 'Parse Error: ' + html; last = html; } @@ -192,56 +204,51 @@ var HTMLParser = function (html, handler) { // Note: this exception for "span" was added manually (i.e. it's not // present in the original code). while (stack.last() && inline[stack.last()] && stack.last() !== 'span') { - parseEndTag("", stack.last()); + parseEndTag('', stack.last()); } } if (closeSelf[tagName] && stack.last() == tagName) { - parseEndTag("", tagName); + parseEndTag('', tagName); } unary = empty[tagName] || !!unary; - if (!unary) - stack.push(tagName); + if (!unary) stack.push(tagName); if (handler.start) { var attrs = []; - rest.replace(attr, function (match, name) { - var value = arguments[2] ? arguments[2] : - arguments[3] ? arguments[3] : - arguments[4] ? arguments[4] : - fillAttrs[name] ? name : ""; + rest.replace(attr, function(match, name) { + var value = arguments[2] + ? arguments[2] + : arguments[3] + ? arguments[3] + : arguments[4] ? arguments[4] : fillAttrs[name] ? name : ''; attrs.push({ name: name, value: value, - escaped: value.replace(/(^|[^\\])"/g, '$1\\\"') //" + escaped: value.replace(/(^|[^\\])"/g, '$1\\"') //" }); }); - if (handler.start) - handler.start(tagName, attrs, unary); + if (handler.start) handler.start(tagName, attrs, unary); } } function parseEndTag(tag, tagName) { // If no tag name is provided, clean shop - if (!tagName) - var pos = 0; - - // Find the closest opened tag of the same type + if (!tagName) var pos = 0; else + // Find the closest opened tag of the same type for (var pos = stack.length - 1; pos >= 0; pos--) - if (stack[pos] == tagName) - break; + if (stack[pos] == tagName) break; if (pos >= 0) { // Close all the open elements, up the stack for (var i = stack.length - 1; i >= pos; i--) - if (handler.end) - handler.end(stack[i]); + if (handler.end) handler.end(stack[i]); // Remove the open elements from the stack stack.length = pos; @@ -250,9 +257,9 @@ var HTMLParser = function (html, handler) { }; function makeMap(str) { - var obj = {}, items = str.split(","); - for (var i = 0; i < items.length; i++) - obj[items[i]] = true; + var obj = {}, + items = str.split(','); + for (var i = 0; i < items.length; i++) obj[items[i]] = true; return obj; } diff --git a/packages/metal-incremental-dom/src/html/unescape.js b/packages/metal-incremental-dom/src/html/unescape.js index 347eb9eb..bbf3f43b 100644 --- a/packages/metal-incremental-dom/src/html/unescape.js +++ b/packages/metal-incremental-dom/src/html/unescape.js @@ -21,43 +21,43 @@ * @param {string} str The string to unescape. * @return {string} The unescaped {@code str} string. */ - function unescape(str) { - /** @type {!Object} */ - var seen = {'&': '&', '<': '<', '>': '>', '"': '"'}; - var div = document.createElement('div'); +function unescape(str) { + /** @type {!Object} */ + let seen = {'&': '&', '<': '<', '>': '>', '"': '"'}; + let div = document.createElement('div'); - // Match as many valid entity characters as possible. If the actual entity - // happens to be shorter, it will still work as innerHTML will return the - // trailing characters unchanged. Since the entity characters do not include - // open angle bracket, there is no chance of XSS from the innerHTML use. - // Since no whitespace is passed to innerHTML, whitespace is preserved. - return str.replace(HTML_ENTITY_PATTERN_, function(s, entity) { - // Check for cached entity. - var value = seen[s]; - if (value) { - return value; - } - // Check for numeric entity. - if (entity.charAt(0) === '#') { - // Prefix with 0 so that hex entities (e.g. ) parse as hex numbers. - var n = Number('0' + entity.substr(1)); - if (!isNaN(n)) { - value = String.fromCharCode(n); - } - } - // Fall back to innerHTML otherwise. - if (!value) { - // Append a non-entity character to avoid a bug in Webkit that parses - // an invalid entity at the end of innerHTML text as the empty string. - div.innerHTML = s + ' '; - // Then remove the trailing character from the result. - value = div.firstChild.nodeValue.slice(0, -1); - } - // Cache and return. - seen[s] = value; - return value; - }); - } + // Match as many valid entity characters as possible. If the actual entity + // happens to be shorter, it will still work as innerHTML will return the + // trailing characters unchanged. Since the entity characters do not include + // open angle bracket, there is no chance of XSS from the innerHTML use. + // Since no whitespace is passed to innerHTML, whitespace is preserved. + return str.replace(HTML_ENTITY_PATTERN_, function(s, entity) { + // Check for cached entity. + let value = seen[s]; + if (value) { + return value; + } + // Check for numeric entity. + if (entity.charAt(0) === '#') { + // Prefix with 0 so that hex entities (e.g. ) parse as hex numbers. + let n = Number('0' + entity.substr(1)); + if (!isNaN(n)) { + value = String.fromCharCode(n); + } + } + // Fall back to innerHTML otherwise. + if (!value) { + // Append a non-entity character to avoid a bug in Webkit that parses + // an invalid entity at the end of innerHTML text as the empty string. + div.innerHTML = s + ' '; + // Then remove the trailing character from the result. + value = div.firstChild.nodeValue.slice(0, -1); + } + // Cache and return. + seen[s] = value; + return value; + }); +} export default unescape; diff --git a/packages/metal-incremental-dom/src/incremental-dom-aop.js b/packages/metal-incremental-dom/src/incremental-dom-aop.js index bed50f39..b01bf5c3 100644 --- a/packages/metal-incremental-dom/src/incremental-dom-aop.js +++ b/packages/metal-incremental-dom/src/incremental-dom-aop.js @@ -55,7 +55,7 @@ const originalFns = { elementOpenEnd: IncrementalDOM.elementOpenEnd, elementOpenStart: IncrementalDOM.elementOpenStart, elementVoid: IncrementalDOM.elementVoid, - text: IncrementalDOM.text + text: IncrementalDOM.text, }; const fnStack = []; @@ -85,7 +85,7 @@ function getStack() { function buildHandleCall(name) { const data = { - name + name, }; const fn = handleCall.bind(data); return fn; @@ -95,7 +95,7 @@ function handleCall() { const name = this.name; // eslint-disable-line const stack = getStack(); const fn = (stack && stack[name]) || originalFns[name]; - return fn.apply(null, arguments); + return fn(...arguments); } IncrementalDOM.attr = buildHandleCall('attr'); diff --git a/packages/metal-incremental-dom/src/incremental-dom.js b/packages/metal-incremental-dom/src/incremental-dom.js index f476f793..c8cc54d5 100644 --- a/packages/metal-incremental-dom/src/incremental-dom.js +++ b/packages/metal-incremental-dom/src/incremental-dom.js @@ -1,6 +1,6 @@ import * as IncrementalDOM from 'incremental-dom'; import * as IncrementalDOMString from 'incremental-dom-string'; -import { isServerSide } from 'metal'; +import {isServerSide} from 'metal'; if (isServerSide()) { // Overrides global.IncrementalDOM virtual elements with incremental dom @@ -9,7 +9,10 @@ if (isServerSide()) { // browser. global.IncrementalDOM = IncrementalDOMString; } else { - var scope = (typeof exports !== 'undefined' && typeof global !== 'undefined') ? global : window; + let scope = + typeof exports !== 'undefined' && typeof global !== 'undefined' + ? global + : window; - scope.IncrementalDOM = IncrementalDOM; + scope.IncrementalDOM = IncrementalDOM; } diff --git a/packages/metal-incremental-dom/src/intercept.js b/packages/metal-incremental-dom/src/intercept.js index cc8ebee9..b7bcc8a5 100644 --- a/packages/metal-incremental-dom/src/intercept.js +++ b/packages/metal-incremental-dom/src/intercept.js @@ -66,7 +66,7 @@ const originalFns = { elementOpenEnd: IncrementalDOM.elementOpenEnd, elementOpenStart: IncrementalDOM.elementOpenStart, elementVoid: IncrementalDOM.elementVoid, - text: IncrementalDOM.text + text: IncrementalDOM.text, }; const fnStack = []; @@ -96,7 +96,7 @@ function getStack() { function buildHandleCall(name) { const data = { - name + name, }; const fn = handleCall.bind(data); return fn; @@ -106,7 +106,7 @@ function handleCall() { const name = this.name; // eslint-disable-line const stack = getStack(); const fn = (stack && stack[name]) || originalFns[name]; - return fn.apply(null, arguments); + return fn(...arguments); } IncrementalDOM.attr = buildHandleCall('attr'); diff --git a/packages/metal-incremental-dom/src/render/attributes.js b/packages/metal-incremental-dom/src/render/attributes.js index c4c94a7e..cc78f14e 100644 --- a/packages/metal-incremental-dom/src/render/attributes.js +++ b/packages/metal-incremental-dom/src/render/attributes.js @@ -1,10 +1,10 @@ 'use strict'; -import { isServerSide } from 'metal'; -import { delegate } from 'metal-dom'; -import { getComponentFn } from 'metal-component'; -import { getOriginalFn } from '../incremental-dom-aop'; -import { isBoolean, isDefAndNotNull, isString } from 'metal'; +import {isServerSide} from 'metal'; +import {delegate} from 'metal-dom'; +import {getComponentFn} from 'metal-component'; +import {getOriginalFn} from '../incremental-dom-aop'; +import {isBoolean, isDefAndNotNull, isString} from 'metal'; const HANDLE_SUFFIX = '__handle__'; const LISTENER_REGEX = /^(?:on([A-Z].+))|(?:data-on(.+))$/; diff --git a/packages/metal-incremental-dom/src/render/patch.js b/packages/metal-incremental-dom/src/render/patch.js index 942e1557..8567ef1c 100644 --- a/packages/metal-incremental-dom/src/render/patch.js +++ b/packages/metal-incremental-dom/src/render/patch.js @@ -1,9 +1,9 @@ 'use strict'; -import { append, exitDocument } from 'metal-dom'; -import { getData } from '../data'; -import { isServerSide } from 'metal'; -import { render } from './render'; +import {append, exitDocument} from 'metal-dom'; +import {getData} from '../data'; +import {isServerSide} from 'metal'; +import {render} from './render'; const patchingComponents_ = []; diff --git a/packages/metal-incremental-dom/src/render/render.js b/packages/metal-incremental-dom/src/render/render.js index 3f86e097..d2b1f700 100644 --- a/packages/metal-incremental-dom/src/render/render.js +++ b/packages/metal-incremental-dom/src/render/render.js @@ -1,15 +1,32 @@ 'use strict'; -import { applyAttribute, convertListenerNamesToFns } from './attributes'; -import { buildConfigFromCall, buildCallFromConfig } from '../callArgs'; -import { captureChildren, getOwner, isChildTag, renderChildTree } from '../children/children'; -import { clearChanges } from '../changes'; -import { domData } from 'metal-dom'; -import { getData } from '../data'; -import { getCompatibilityModeData, getUid, isDef, isDefAndNotNull, isFunction, isString, object } from 'metal'; -import { disposeUnused, schedule } from '../cleanup/unused'; -import { getOriginalFn, startInterception, stopInterception } from '../incremental-dom-aop'; -import { Component, ComponentRegistry } from 'metal-component'; +import {applyAttribute, convertListenerNamesToFns} from './attributes'; +import {buildConfigFromCall, buildCallFromConfig} from '../callArgs'; +import { + captureChildren, + getOwner, + isChildTag, + renderChildTree, +} from '../children/children'; +import {clearChanges} from '../changes'; +import {domData} from 'metal-dom'; +import {getData} from '../data'; +import { + getCompatibilityModeData, + getUid, + isDef, + isDefAndNotNull, + isFunction, + isString, + object, +} from 'metal'; +import {disposeUnused, schedule} from '../cleanup/unused'; +import { + getOriginalFn, + startInterception, + stopInterception, +} from '../incremental-dom-aop'; +import {Component, ComponentRegistry} from 'metal-component'; const renderingComponents_ = []; const emptyChildren_ = []; @@ -131,7 +148,8 @@ function getRef_(owner, config) { if (compatData) { const ownerRenderer = owner.getRenderer(); const renderers = compatData.renderers; - const useKey = !renderers || + const useKey = + !renderers || renderers.indexOf(ownerRenderer) !== -1 || renderers.indexOf(ownerRenderer.RENDERER_NAME) !== -1; if (useKey && config.key && !config.ref) { @@ -171,7 +189,12 @@ function getSubComponent_(tagOrCtor, config, owner) { data.currCount[type] = data.currCount[type] || 0; key = `__METAL_IC__${type}_${data.currCount[type]++}`; } - comp = match_(data.prevComps ? data.prevComps[key] : null, Ctor, config, owner); + comp = match_( + data.prevComps ? data.prevComps[key] : null, + Ctor, + config, + owner + ); data.currComps = data.currComps || {}; data.currComps[key] = comp; } @@ -225,9 +248,9 @@ function handleInterceptedAttributesCall_(element, name, value) { */ function handleInterceptedOpenCall_(tag) { if (isComponentTag_(tag)) { - return handleSubComponentCall_.apply(null, arguments); + return handleSubComponentCall_(...arguments); } else { - return handleRegularCall_.apply(null, arguments); + return handleRegularCall_(...arguments); } } @@ -262,7 +285,7 @@ function handleRegularCall_(...args) { convertListenerNamesToFns(comp, config); const call = buildCallFromConfig(tag, config); - const node = getOriginalFn('elementOpen').apply(null, call); + const node = getOriginalFn('elementOpen')(...call); resetNodeData_(node); updateElementIfNotReached_(comp, node); @@ -283,7 +306,7 @@ function handleRegularCall_(...args) { function handleSubComponentCall_(...args) { captureChildren(getComponentBeingRendered(), handleChildrenCaptured_, { props: buildConfigFromCall(args), - tag: args[0] + tag: args[0], }); } @@ -297,7 +320,11 @@ function inheritElementClasses_(parent, config) { const parentData = getData(parent); const parentConfig = parentData.config; - if (!parentData.rootElementReached && parentConfig && isString(parentConfig.elementClasses)) { + if ( + !parentData.rootElementReached && + parentConfig && + isString(parentConfig.elementClasses) + ) { let currentClasses = ''; if (isString(config.elementClasses)) { currentClasses = `${config.elementClasses} `; @@ -377,7 +404,7 @@ function prepareRender_(component) { startInterception({ attributes: handleInterceptedAttributesCall_, - elementOpen: handleInterceptedOpenCall_ + elementOpen: handleInterceptedOpenCall_, }); } @@ -448,7 +475,12 @@ function renderFromTag_(tag, config, opt_owner) { * @param {Element=} opt_parent Optional parent for the rendered content. * @return {!Component} The rendered component's instance. */ -export function renderFunction(renderer, fnOrCtor, opt_dataOrElement, opt_parent) { +export function renderFunction( + renderer, + fnOrCtor, + opt_dataOrElement, + opt_parent +) { if (!Component.isComponentCtor(fnOrCtor)) { const fn = fnOrCtor; class TempComponent extends Component { @@ -484,7 +516,7 @@ function renderSubComponent_(tagOrCtor, config, opt_owner) { const parent = getComponentBeingRendered(); const owner = opt_owner || parent; - inheritElementClasses_(parent, config) + inheritElementClasses_(parent, config); const comp = getSubComponent_(tagOrCtor, config, owner); updateContext_(comp, parent); diff --git a/packages/metal-incremental-dom/test/IncrementalDomRenderer.js b/packages/metal-incremental-dom/test/IncrementalDomRenderer.js index a083a028..c624528b 100644 --- a/packages/metal-incremental-dom/test/IncrementalDomRenderer.js +++ b/packages/metal-incremental-dom/test/IncrementalDomRenderer.js @@ -1,17 +1,17 @@ 'use strict'; -import { async, core, object } from 'metal'; +import {async, core, object} from 'metal'; import dom from 'metal-dom'; -import { getData } from '../src/data'; -import { sunset } from '../../../test-utils'; -import { CHILD_OWNER } from '../src/children/children'; -import { Component, ComponentRegistry } from 'metal-component'; +import {getData} from '../src/data'; +import {sunset} from '../../../test-utils'; +import {CHILD_OWNER} from '../src/children/children'; +import {Component, ComponentRegistry} from 'metal-component'; import IncrementalDomRenderer from '../src/IncrementalDomRenderer'; -var IncDom = IncrementalDOM; +let IncDom = IncrementalDOM; describe('IncrementalDomRenderer', function() { - var component; + let component; afterEach(function() { if (component) { @@ -21,8 +21,7 @@ describe('IncrementalDomRenderer', function() { describe('Default render', function() { it('should render empty div element by default', function() { - class TestComponent extends Component { - } + class TestComponent extends Component {} TestComponent.RENDERER = IncrementalDomRenderer; component = new TestComponent(); @@ -41,8 +40,7 @@ describe('IncrementalDomRenderer', function() { } } - class TestComponent extends Component { - } + class TestComponent extends Component {} TestComponent.RENDERER = new TestRenderer(); component = new TestComponent(); @@ -77,7 +75,7 @@ describe('IncrementalDomRenderer', function() { } } TestComponent.STATE = { - attr: {} + attr: {}, }; TestComponent.RENDERER = IncrementalDomRenderer; @@ -95,9 +93,9 @@ describe('IncrementalDomRenderer', function() { } TestComponent.RENDERER = IncrementalDomRenderer; - var element = document.createElement('span'); + let element = document.createElement('span'); component = new TestComponent({ - element: element + element: element, }); assert.strictEqual(element, component.element); assert.strictEqual('foo', component.element.getAttribute('foo')); @@ -105,7 +103,7 @@ describe('IncrementalDomRenderer', function() { }); it('should run component\'s "rendered" lifecycle method on first render', function() { - var calledArgs = []; + let calledArgs = []; class TestComponent extends Component { render() { IncDom.elementOpen('span', null, null, 'foo', 'foo'); @@ -135,8 +133,8 @@ describe('IncrementalDomRenderer', function() { TestComponent.RENDERER = IncrementalDomRenderer; TestComponent.STATE = { foo: { - value: 'foo' - } + value: 'foo', + }, }; component = new TestComponent(); @@ -160,8 +158,8 @@ describe('IncrementalDomRenderer', function() { TestComponent.RENDERER = IncrementalDomRenderer; TestComponent.STATE = { foo: { - value: 'foo' - } + value: 'foo', + }, }; TestComponent.SYNC_UPDATES = true; @@ -188,8 +186,7 @@ describe('IncrementalDomRenderer', function() { } TestComponent.RENDERER = IncrementalDomRenderer; TestComponent.STATE = { - foo: { - } + foo: {}, }; TestComponent.SYNC_UPDATES = true; @@ -241,8 +238,10 @@ describe('IncrementalDomRenderer', function() { assert.equal(component.shouldUpdate.callCount, 0); }); - it('should run component\'s "rendered" lifecycle method on updates', function(done) { - var calledArgs = []; + it('should run component\'s "rendered" lifecycle method on updates', function( + done + ) { + let calledArgs = []; class TestComponent extends Component { render() { IncDom.elementOpen('div'); @@ -257,8 +256,8 @@ describe('IncrementalDomRenderer', function() { TestComponent.RENDERER = IncrementalDomRenderer; TestComponent.STATE = { foo: { - value: 'foo' - } + value: 'foo', + }, }; component = new TestComponent(); @@ -281,9 +280,9 @@ describe('IncrementalDomRenderer', function() { } TestComponent.RENDERER = IncrementalDomRenderer; - var element = document.createElement('div'); + let element = document.createElement('div'); component = new TestComponent({ - element: element + element: element, }); assert.notStrictEqual(element, component.element); assert.strictEqual('SPAN', component.element.tagName); @@ -297,11 +296,11 @@ describe('IncrementalDomRenderer', function() { } TestComponent.RENDERER = IncrementalDomRenderer; - var element = document.createElement('div'); - var parent = document.createElement('div'); + let element = document.createElement('div'); + let parent = document.createElement('div'); component = new TestComponent( { - element: element + element: element, }, parent ); @@ -319,7 +318,9 @@ describe('IncrementalDomRenderer', function() { assert.ok(!component.element); }); - it('should reposition component on requested parent when its content is back after an update', function(done) { + it('should reposition component on requested parent when its content is back after an update', function( + done + ) { class TestComponent extends Component { render() { if (!this.noElement) { @@ -329,16 +330,15 @@ describe('IncrementalDomRenderer', function() { } TestComponent.RENDERER = IncrementalDomRenderer; TestComponent.STATE = { - noElement: { - } + noElement: {}, }; - var parent = document.createElement('div'); + let parent = document.createElement('div'); component = new TestComponent({}, parent); assert.ok(component.element); assert.strictEqual(parent, component.element.parentNode); - var prevElement = component.element; + let prevElement = component.element; component.noElement = true; component.once('stateSynced', function() { assert.ok(!component.element); @@ -362,7 +362,7 @@ describe('IncrementalDomRenderer', function() { TestComponent.RENDERER = IncrementalDomRenderer; component = new TestComponent({ - elementClasses: 'test' + elementClasses: 'test', }); assert.ok(dom.hasClass(component.element, 'test')); @@ -374,22 +374,32 @@ describe('IncrementalDomRenderer', function() { }); }); - it('should add/remove css classes by using both "class" and "elementClasses"', function(done) { + it('should add/remove css classes by using both "class" and "elementClasses"', function( + done + ) { class TestComponent extends Component { render() { - var cssClass = this.foo ? 'foo' : 'bar'; - IncDom.elementVoid('button', null, [], 'foo', 'foo', 'class', cssClass); + let cssClass = this.foo ? 'foo' : 'bar'; + IncDom.elementVoid( + 'button', + null, + [], + 'foo', + 'foo', + 'class', + cssClass + ); } } TestComponent.RENDERER = IncrementalDomRenderer; TestComponent.STATE = { foo: { - value: true - } + value: true, + }, }; component = new TestComponent({ - elementClasses: 'test' + elementClasses: 'test', }); assert.ok(dom.hasClass(component.element, 'foo')); assert.ok(!dom.hasClass(component.element, 'bar')); @@ -413,9 +423,12 @@ describe('IncrementalDomRenderer', function() { TestComponent.RENDERER = IncrementalDomRenderer; component = new TestComponent({ - elementClasses: 'test2 test3' + elementClasses: 'test2 test3', }); - assert.strictEqual('test1 test2 test3', component.element.getAttribute('class')); + assert.strictEqual( + 'test1 test2 test3', + component.element.getAttribute('class') + ); }); it('should store references to node elements via "ref"', function() { @@ -431,8 +444,14 @@ describe('IncrementalDomRenderer', function() { component = new TestComponent(); assert.strictEqual(component.element, component.refs.root); - assert.strictEqual(component.element.childNodes[0], component.refs.child1); - assert.strictEqual(component.element.childNodes[1], component.refs.child2); + assert.strictEqual( + component.element.childNodes[0], + component.refs.child1 + ); + assert.strictEqual( + component.element.childNodes[1], + component.refs.child2 + ); }); }); @@ -449,15 +468,18 @@ describe('IncrementalDomRenderer', function() { } TestComponent.RENDERER = IncrementalDomRenderer; - var element = document.createElement('div'); + let element = document.createElement('div'); dom.append(element, '
foo
'); - var innerElement = element.querySelector('.inner'); + let innerElement = element.querySelector('.inner'); component = new TestComponent({ - element: element + element: element, }); assert.strictEqual(element, component.element); - assert.strictEqual(innerElement, component.element.querySelector('.inner')); + assert.strictEqual( + innerElement, + component.element.querySelector('.inner') + ); assert.strictEqual('foo', component.element.textContent); }); @@ -473,15 +495,18 @@ describe('IncrementalDomRenderer', function() { } TestComponent.RENDERER = IncrementalDomRenderer; - var element = document.createElement('div'); + let element = document.createElement('div'); dom.append(element, 'foo'); - var innerElement = element.querySelector('.inner'); + let innerElement = element.querySelector('.inner'); component = new TestComponent({ - element: element + element: element, }); assert.strictEqual(element, component.element); - assert.notStrictEqual(innerElement, component.element.querySelector('.inner')); + assert.notStrictEqual( + innerElement, + component.element.querySelector('.inner') + ); assert.strictEqual('foo', component.element.textContent); }); @@ -497,15 +522,18 @@ describe('IncrementalDomRenderer', function() { } TestComponent.RENDERER = IncrementalDomRenderer; - var element = document.createElement('div'); + let element = document.createElement('div'); dom.append(element, '
foo
'); - var innerElement = element.querySelector('.inner2'); + let innerElement = element.querySelector('.inner2'); component = new TestComponent({ - element: element + element: element, }); assert.strictEqual(element, component.element); - assert.strictEqual(innerElement, component.element.querySelector('.inner')); + assert.strictEqual( + innerElement, + component.element.querySelector('.inner') + ); assert.strictEqual('foo', component.element.textContent); assert.ok(dom.hasClass(innerElement, 'inner')); assert.ok(!dom.hasClass(innerElement, 'inner2')); @@ -580,12 +608,12 @@ describe('IncrementalDomRenderer', function() { TestComponent.RENDERER = IncrementalDomRenderer; TestComponent.prototype.handleClick = sinon.stub(); - var element = document.createElement('div'); + let element = document.createElement('div'); element.setAttribute('data-onclick', 'handleClick'); dom.enterDocument(element); component = new TestComponent({ - element: element + element: element, }); dom.triggerEvent(component.element, 'click'); @@ -628,11 +656,11 @@ describe('IncrementalDomRenderer', function() { TestComponent.RENDERER = IncrementalDomRenderer; TestComponent.prototype.handleClick = sinon.stub(); - var element = document.createElement('div'); + let element = document.createElement('div'); dom.append(element, '
'); - var innerElement = element.childNodes[0]; + let innerElement = element.childNodes[0]; component = new TestComponent({ - element: element + element: element, }); assert.strictEqual(innerElement, component.element.childNodes[0]); @@ -643,7 +671,13 @@ describe('IncrementalDomRenderer', function() { it('should provide delegateTarget as the element that the listener was attached to', function() { class TestComponent extends Component { render() { - IncDom.elementOpen('div', null, null, 'onClick', 'handleElementClick'); + IncDom.elementOpen( + 'div', + null, + null, + 'onClick', + 'handleElementClick' + ); IncDom.elementOpen('div', null, null, 'onClick', 'handleClick'); IncDom.elementVoid('div', null, null, 'class', 'inner'); IncDom.elementClose('div'); @@ -652,17 +686,17 @@ describe('IncrementalDomRenderer', function() { } TestComponent.RENDERER = IncrementalDomRenderer; - var event1; + let event1; TestComponent.prototype.handleElementClick = function(event) { event1 = object.mixin({}, event); }; - var event2; + let event2; TestComponent.prototype.handleClick = function(event) { event2 = object.mixin({}, event); }; component = new TestComponent(); - var innerElement = component.element.querySelector('.inner'); + let innerElement = component.element.querySelector('.inner'); dom.triggerEvent(innerElement, 'click'); assert.ok(event1); @@ -671,10 +705,15 @@ describe('IncrementalDomRenderer', function() { assert.ok(event2); assert.strictEqual(innerElement, event2.target); - assert.strictEqual(component.element.childNodes[0], event2.delegateTarget); + assert.strictEqual( + component.element.childNodes[0], + event2.delegateTarget + ); }); - it('should remove unused inline listeners when dom is updated', function(done) { + it('should remove unused inline listeners when dom is updated', function( + done + ) { class TestComponent extends Component { render() { IncDom.elementOpen('div'); @@ -690,8 +729,8 @@ describe('IncrementalDomRenderer', function() { TestComponent.RENDERER = IncrementalDomRenderer; TestComponent.STATE = { keydown: { - value: true - } + value: true, + }, }; TestComponent.prototype.handleClick = sinon.stub(); TestComponent.prototype.handleKeydown = sinon.stub(); @@ -712,14 +751,14 @@ describe('IncrementalDomRenderer', function() { class TestComponent extends Component { render() { IncDom.elementOpen('div'); - var fn = this.switch ? this.handleClick2 : this.handleClick; + let fn = this.switch ? this.handleClick2 : this.handleClick; IncDom.elementVoid('div', null, null, 'onClick', fn); IncDom.elementClose('div'); } } TestComponent.RENDERER = IncrementalDomRenderer; TestComponent.STATE = { - switch: {} + switch: {}, }; TestComponent.prototype.handleClick = sinon.stub(); TestComponent.prototype.handleClick2 = sinon.stub(); @@ -744,8 +783,7 @@ describe('IncrementalDomRenderer', function() { sinon.stub(this, 'handleClick'); } - handleClick() { - } + handleClick() {} render() { IncDom.elementVoid('div', null, null, 'data-onclick', 'handleClick'); @@ -759,7 +797,7 @@ describe('IncrementalDomRenderer', function() { component.dispose(); component = new TestComponent({ - element + element, }); dom.triggerEvent(element, 'click'); assert.equal(1, component.handleClick.callCount); @@ -767,7 +805,7 @@ describe('IncrementalDomRenderer', function() { }); describe('Nested Components', function() { - var ChildComponent; + let ChildComponent; beforeEach(function() { class ChildComponentClass extends Component { @@ -782,8 +820,8 @@ describe('IncrementalDomRenderer', function() { ChildComponent.RENDERER = IncrementalDomRenderer; ChildComponent.STATE = { foo: { - value: 'foo' - } + value: 'foo', + }, }; ChildComponent.prototype.handleClick = sinon.stub(); ComponentRegistry.register(ChildComponent, 'ChildComponent'); @@ -800,7 +838,7 @@ describe('IncrementalDomRenderer', function() { TestComponent.RENDERER = IncrementalDomRenderer; component = new TestComponent(); - var child = component.components.child; + let child = component.components.child; assert.ok(child); assert.ok(child instanceof ChildComponent); assert.strictEqual(child, component.refs.child); @@ -817,8 +855,11 @@ describe('IncrementalDomRenderer', function() { TestComponent.RENDERER = IncrementalDomRenderer; component = new TestComponent(); - var child = component.components.child; - assert.strictEqual(child.element, component.element.querySelector('child')); + let child = component.components.child; + assert.strictEqual( + child.element, + component.element.querySelector('child') + ); assert.strictEqual('foo', child.element.textContent); assert.ok(child.element.hasAttribute('data-child')); }); @@ -837,7 +878,7 @@ describe('IncrementalDomRenderer', function() { sinon.spy(ChildComponent.prototype, 'attached'); component = new TestComponent(); - var child = component.components.child; + let child = component.components.child; assert.strictEqual(1, child.rendered.callCount); assert.ok(child.rendered.args[0][0]); assert.strictEqual(1, child.attached.callCount); @@ -847,14 +888,22 @@ describe('IncrementalDomRenderer', function() { class TestComponent extends Component { render() { IncDom.elementOpen('div'); - IncDom.elementVoid('ChildComponent', null, null, 'ref', 'child', 'foo', 'bar'); + IncDom.elementVoid( + 'ChildComponent', + null, + null, + 'ref', + 'child', + 'foo', + 'bar' + ); IncDom.elementClose('div'); } } TestComponent.RENDERER = IncrementalDomRenderer; component = new TestComponent(); - var child = component.components.child; + let child = component.components.child; assert.strictEqual('bar', child.foo); assert.strictEqual('bar', child.element.textContent); }); @@ -863,40 +912,58 @@ describe('IncrementalDomRenderer', function() { class TestComponent extends Component { render() { IncDom.elementOpen('div'); - IncDom.elementVoid('ChildComponent', null, null, 'ref', 'child', 'foo', this.foo); + IncDom.elementVoid( + 'ChildComponent', + null, + null, + 'ref', + 'child', + 'foo', + this.foo + ); IncDom.elementClose('div'); } } TestComponent.RENDERER = IncrementalDomRenderer; TestComponent.STATE = { foo: { - value: 'foo' - } + value: 'foo', + }, }; component = new TestComponent(); component.foo = 'bar'; component.once('stateSynced', function() { - var child = component.components.child; + let child = component.components.child; assert.strictEqual('bar', child.foo); assert.strictEqual('bar', child.element.textContent); done(); }); }); - it('should run component\'s lifecycle methods when updated as sub component', function(done) { + it('should run component\'s lifecycle methods when updated as sub component', function( + done + ) { class TestComponent extends Component { render() { IncDom.elementOpen('div'); - IncDom.elementVoid('ChildComponent', null, null, 'ref', 'child', 'foo', this.foo); + IncDom.elementVoid( + 'ChildComponent', + null, + null, + 'ref', + 'child', + 'foo', + this.foo + ); IncDom.elementClose('div'); } } TestComponent.RENDERER = IncrementalDomRenderer; TestComponent.STATE = { foo: { - value: 'foo' - } + value: 'foo', + }, }; sinon.spy(ChildComponent.prototype, 'rendered'); @@ -905,7 +972,7 @@ describe('IncrementalDomRenderer', function() { component.foo = 'bar'; component.once('stateSynced', function() { - var child = component.components.child; + let child = component.components.child; assert.strictEqual(2, child.rendered.callCount); assert.ok(!child.rendered.args[1][0]); assert.strictEqual(1, child.attached.callCount); @@ -913,25 +980,35 @@ describe('IncrementalDomRenderer', function() { }); }); - it('should not try to rerender sub component later when state changes during parent rendering', function(done) { + it('should not try to rerender sub component later when state changes during parent rendering', function( + done + ) { class TestComponent extends Component { render() { IncDom.elementOpen('div'); - IncDom.elementVoid('ChildComponent', null, null, 'ref', 'child', 'foo', this.foo); + IncDom.elementVoid( + 'ChildComponent', + null, + null, + 'ref', + 'child', + 'foo', + this.foo + ); IncDom.elementClose('div'); } } TestComponent.RENDERER = IncrementalDomRenderer; TestComponent.STATE = { foo: { - value: 'foo' - } + value: 'foo', + }, }; component = new TestComponent(); component.foo = 'bar'; component.once('stateSynced', function() { - var child = component.components.child; + let child = component.components.child; sinon.spy(child, 'render'); child.once('stateSynced', function() { assert.strictEqual(0, child.render.callCount); @@ -940,25 +1017,35 @@ describe('IncrementalDomRenderer', function() { }); }); - it('should rerender sub component when state changes after parent rendering', function(done) { + it('should rerender sub component when state changes after parent rendering', function( + done + ) { class TestComponent extends Component { render() { IncDom.elementOpen('div'); - IncDom.elementVoid('ChildComponent', null, null, 'ref', 'child', 'foo', this.foo); + IncDom.elementVoid( + 'ChildComponent', + null, + null, + 'ref', + 'child', + 'foo', + this.foo + ); IncDom.elementClose('div'); } } TestComponent.RENDERER = IncrementalDomRenderer; TestComponent.STATE = { foo: { - value: 'foo' - } + value: 'foo', + }, }; component = new TestComponent(); component.foo = 'bar'; component.once('stateSynced', function() { - var child = component.components.child; + let child = component.components.child; child.foo = 'bar2'; sinon.spy(child, 'render'); child.once('stateSynced', function() { @@ -969,7 +1056,9 @@ describe('IncrementalDomRenderer', function() { }); }); - it('should not remove sub component key when this sub component updates itself', function(done) { + it('should not remove sub component key when this sub component updates itself', function( + done + ) { class TestComponent extends Component { render() { IncDom.elementOpen('div'); @@ -980,13 +1069,16 @@ describe('IncrementalDomRenderer', function() { TestComponent.RENDERER = IncrementalDomRenderer; component = new TestComponent(); - var child = component.components.child; + let child = component.components.child; assert.strictEqual('childKey', child.element.__incrementalDOMData.key); child.foo = 'bar'; child.once('stateSynced', function() { assert.strictEqual('childKey', child.element.__incrementalDOMData.key); - assert.strictEqual(child.element, component.element.querySelector('child')); + assert.strictEqual( + child.element, + component.element.querySelector('child') + ); assert.strictEqual('bar', child.element.textContent); done(); }); @@ -1026,16 +1118,18 @@ describe('IncrementalDomRenderer', function() { TestComponent.RENDERER = IncrementalDomRenderer; component = new TestComponent(); - var child = component.components.child; + let child = component.components.child; assert.strictEqual(0, child.handleClick.callCount); - var button = child.element.querySelector('button'); + let button = child.element.querySelector('button'); dom.triggerEvent(button, 'click'); assert.strictEqual(1, child.handleClick.callCount); }); - it('should detach unused sub component inline listeners after parent update', function(done) { + it('should detach unused sub component inline listeners after parent update', function( + done + ) { class TestChildComponent extends Component { render() { if (this.removeEvent) { @@ -1049,24 +1143,30 @@ describe('IncrementalDomRenderer', function() { TestChildComponent.prototype.handleClick = sinon.stub(); TestChildComponent.RENDERER = IncrementalDomRenderer; TestChildComponent.STATE = { - removeEvent: { - } + removeEvent: {}, }; class TestComponent extends Component { render() { IncDom.elementOpen('div'); - IncDom.elementVoid(TestChildComponent, null, null, 'ref', 'child', 'removeEvent', this.removeEvent); + IncDom.elementVoid( + TestChildComponent, + null, + null, + 'ref', + 'child', + 'removeEvent', + this.removeEvent + ); IncDom.elementClose('div'); } } TestComponent.RENDERER = IncrementalDomRenderer; TestComponent.STATE = { - removeEvent: { - } + removeEvent: {}, }; component = new TestComponent(); - var child = component.components.child; + let child = component.components.child; dom.triggerEvent(child.element, 'click'); assert.strictEqual(1, child.handleClick.callCount); @@ -1096,8 +1196,10 @@ describe('IncrementalDomRenderer', function() { assert.strictEqual('bar', component.element.childNodes[0].textContent); }); - it('should reuse sub component even when it receives no ref', function(done) { - var creationCount = 0; + it('should reuse sub component even when it receives no ref', function( + done + ) { + let creationCount = 0; class TestChildComponent extends Component { created() { creationCount++; @@ -1111,8 +1213,7 @@ describe('IncrementalDomRenderer', function() { } TestChildComponent.RENDERER = IncrementalDomRenderer; TestChildComponent.STATE = { - foo: { - } + foo: {}, }; class TestComponent extends Component { @@ -1125,8 +1226,8 @@ describe('IncrementalDomRenderer', function() { TestComponent.RENDERER = IncrementalDomRenderer; TestComponent.STATE = { foo: { - value: 'foo' - } + value: 'foo', + }, }; component = new TestComponent(); @@ -1164,11 +1265,10 @@ describe('IncrementalDomRenderer', function() { } TestComponent.RENDERER = IncrementalDomRenderer; TestComponent.STATE = { - add: { - } + add: {}, }; - var children = []; + let children = []; sinon.stub(ChildComponent.prototype, 'created', function() { children.push(this); }); @@ -1192,13 +1292,21 @@ describe('IncrementalDomRenderer', function() { assert.strictEqual('foo', component.element.childNodes[1].textContent); assert.strictEqual('CHILD', component.element.childNodes[2].tagName); assert.strictEqual('bar', component.element.childNodes[2].textContent); - assert.strictEqual(component.element.childNodes[1], children[0].element); - assert.strictEqual(component.element.childNodes[2], children[1].element); + assert.strictEqual( + component.element.childNodes[1], + children[0].element + ); + assert.strictEqual( + component.element.childNodes[2], + children[1].element + ); done(); }); }); - it('should reuse correct children according to their "key" after an update', function(done) { + it('should reuse correct children according to their "key" after an update', function( + done + ) { class TestComponent extends Component { render() { IncDom.elementOpen('div'); @@ -1214,11 +1322,10 @@ describe('IncrementalDomRenderer', function() { } TestComponent.RENDERER = IncrementalDomRenderer; TestComponent.STATE = { - switch: { - } + switch: {}, }; - var children = []; + let children = []; sinon.stub(ChildComponent.prototype, 'created', function() { children.push(this); }); @@ -1233,13 +1340,21 @@ describe('IncrementalDomRenderer', function() { component.once('stateSynced', function() { assert.strictEqual(2, component.element.childNodes.length); assert.strictEqual(2, children.length); - assert.strictEqual(component.element.childNodes[0], children[1].element); - assert.strictEqual(component.element.childNodes[1], children[0].element); + assert.strictEqual( + component.element.childNodes[0], + children[1].element + ); + assert.strictEqual( + component.element.childNodes[1], + children[0].element + ); done(); }); }); - it('should not reuse component that was created in another parent', function(done) { + it('should not reuse component that was created in another parent', function( + done + ) { const grandChildInstances = []; class GrandChildComponent extends Component { created() { @@ -1262,14 +1377,20 @@ describe('IncrementalDomRenderer', function() { class TestComponent extends Component { render() { - IncDom.elementVoid(TestChildComponent, null, null, 'ref', 'child' + this.number); + IncDom.elementVoid( + TestChildComponent, + null, + null, + 'ref', + 'child' + this.number + ); } } TestComponent.RENDERER = IncrementalDomRenderer; TestComponent.STATE = { number: { - value: 1 - } + value: 1, + }, }; component = new TestComponent(); @@ -1280,12 +1401,17 @@ describe('IncrementalDomRenderer', function() { assert.strictEqual(2, grandChildInstances.length); assert.ok(grandChildInstances[0].isDisposed()); assert.ok(!grandChildInstances[1].isDisposed()); - assert.strictEqual(grandChildInstances[1].element, component.element.querySelector('span')); + assert.strictEqual( + grandChildInstances[1].element, + component.element.querySelector('span') + ); done(); }); }); - it('should not throw error trying to reuse component that was disposed', function(done) { + it('should not throw error trying to reuse component that was disposed', function( + done + ) { const childInstances = []; class TestChildComponent extends Component { created() { @@ -1304,8 +1430,7 @@ describe('IncrementalDomRenderer', function() { } TestComponent.RENDERER = IncrementalDomRenderer; TestComponent.STATE = { - foo: { - } + foo: {}, }; component = new TestComponent(); @@ -1322,11 +1447,13 @@ describe('IncrementalDomRenderer', function() { }); }); - it('should reuse previous internal state data on sub component rerender', function(done) { + it('should reuse previous internal state data on sub component rerender', function( + done + ) { ChildComponent.STATE = { foo: { - internal: true - } + internal: true, + }, }; class TestComponent extends Component { @@ -1335,19 +1462,26 @@ describe('IncrementalDomRenderer', function() { if (this.noFoo) { IncDom.elementVoid(ChildComponent, null, null, 'ref', 'child'); } else { - IncDom.elementVoid(ChildComponent, null, null, 'ref', 'child', 'foo', 'foo'); + IncDom.elementVoid( + ChildComponent, + null, + null, + 'ref', + 'child', + 'foo', + 'foo' + ); } IncDom.elementClose('div'); } } TestComponent.RENDERER = IncrementalDomRenderer; TestComponent.STATE = { - noFoo: { - } + noFoo: {}, }; component = new TestComponent(); - var child = component.components.child; + let child = component.components.child; assert.strictEqual('foo', child.foo); component.noFoo = true; @@ -1357,11 +1491,13 @@ describe('IncrementalDomRenderer', function() { }); }); - it('should not reuse previous non internal state data on sub component rerender', function(done) { + it('should not reuse previous non internal state data on sub component rerender', function( + done + ) { ChildComponent.STATE = { foo: { - value: 'defaultFoo' - } + value: 'defaultFoo', + }, }; class TestComponent extends Component { @@ -1370,19 +1506,26 @@ describe('IncrementalDomRenderer', function() { if (this.noFoo) { IncDom.elementVoid(ChildComponent, null, null, 'ref', 'child'); } else { - IncDom.elementVoid(ChildComponent, null, null, 'ref', 'child', 'foo', 'foo'); + IncDom.elementVoid( + ChildComponent, + null, + null, + 'ref', + 'child', + 'foo', + 'foo' + ); } IncDom.elementClose('div'); } } TestComponent.RENDERER = IncrementalDomRenderer; TestComponent.STATE = { - noFoo: { - } + noFoo: {}, }; component = new TestComponent(); - var child = component.components.child; + let child = component.components.child; assert.strictEqual('foo', child.foo); component.noFoo = true; @@ -1423,8 +1566,11 @@ describe('IncrementalDomRenderer', function() { TestComponent.RENDERER = IncrementalDomRenderer; component = new TestComponent(); - var child = component.components.child; - assert.strictEqual(child.element, component.element.querySelector('child')); + let child = component.components.child; + assert.strictEqual( + child.element, + component.element.querySelector('child') + ); assert.strictEqual('foo', child.element.textContent); assert.ok(child.element.hasAttribute('data-child')); }); @@ -1444,9 +1590,12 @@ describe('IncrementalDomRenderer', function() { TestComponent.RENDERER = IncrementalDomRenderer; component = new TestComponent(); - var child = component.components.child; + let child = component.components.child; assert.strictEqual('bar', child.foo); - assert.strictEqual(child.element, component.element.querySelector('child')); + assert.strictEqual( + child.element, + component.element.querySelector('child') + ); assert.strictEqual('bar', child.element.textContent); assert.ok(child.element.hasAttribute('data-child')); }); @@ -1462,9 +1611,12 @@ describe('IncrementalDomRenderer', function() { TestComponent.RENDERER = IncrementalDomRenderer; component = new TestComponent(); - var child = component.components.child; + let child = component.components.child; assert.ok(child instanceof ChildComponent); - assert.strictEqual(child.element, component.element.querySelector('child')); + assert.strictEqual( + child.element, + component.element.querySelector('child') + ); assert.strictEqual('foo', child.element.textContent); assert.ok(child.element.hasAttribute('data-child')); }); @@ -1473,31 +1625,41 @@ describe('IncrementalDomRenderer', function() { class TestComponent extends Component { render() { IncDom.elementOpen('div'); - IncDom.elementVoid(ChildComponent, null, [], 'ref', 'child', 'foo', this.foo); + IncDom.elementVoid( + ChildComponent, + null, + [], + 'ref', + 'child', + 'foo', + this.foo + ); IncDom.elementClose('div'); } } TestComponent.RENDERER = IncrementalDomRenderer; TestComponent.STATE = { - foo: {} + foo: {}, }; component = new TestComponent({ - foo: 'foo' + foo: 'foo', }); - var child = component.components.child; + let child = component.components.child; assert.strictEqual('foo', child.foo); component.foo = 'bar'; component.once('stateSynced', function() { - var newChild = component.components.child; + let newChild = component.components.child; assert.strictEqual(child, newChild); assert.strictEqual('bar', child.foo); done(); }); }); - it('should not reuse component with same key if constructor is different"', function(done) { + it('should not reuse component with same key if constructor is different"', function( + done + ) { class TestChildComponent extends Component { render() { IncDom.elementVoid('div'); @@ -1518,19 +1680,18 @@ describe('IncrementalDomRenderer', function() { } TestComponent.RENDERER = IncrementalDomRenderer; TestComponent.STATE = { - switch: { - } + switch: {}, }; component = new TestComponent(); - var child = component.components.child; + let child = component.components.child; assert.ok(child instanceof ChildComponent); assert.strictEqual(child.element, component.element.childNodes[0]); assert.strictEqual('CHILD', child.element.tagName); component.switch = true; component.once('stateSynced', function() { - var newChild = component.components.child; + let newChild = component.components.child; assert.notStrictEqual(child, newChild); assert.ok(newChild instanceof TestChildComponent); assert.strictEqual(newChild.element, component.element.childNodes[0]); @@ -1541,7 +1702,9 @@ describe('IncrementalDomRenderer', function() { }); }); - it('should call "detached" lifecycle function and event when sub component is removed', function(done) { + it('should call "detached" lifecycle function and event when sub component is removed', function( + done + ) { class TestComponent extends Component { render() { IncDom.elementOpen('div'); @@ -1553,12 +1716,11 @@ describe('IncrementalDomRenderer', function() { } TestComponent.RENDERER = IncrementalDomRenderer; TestComponent.STATE = { - remove: { - } + remove: {}, }; component = new TestComponent(); - var child = component.components.child; + let child = component.components.child; assert.ok(!child.isDisposed()); sinon.spy(child, 'detached'); @@ -1611,11 +1773,13 @@ describe('IncrementalDomRenderer', function() { TestComponent.RENDERER = IncrementalDomRenderer; component = new TestComponent(); - var child = component.components.child; + let child = component.components.child; assert.strictEqual(child.element, component.element); }); - it('should position previously empty child component correctly inside parent', function(done) { + it('should position previously empty child component correctly inside parent', function( + done + ) { class TestChildComponent extends Component { render() { if (!this.empty) { @@ -1627,8 +1791,8 @@ describe('IncrementalDomRenderer', function() { TestChildComponent.STATE = { empty: { value: true, - internal: true - } + internal: true, + }, }; class TestComponent extends Component { @@ -1641,7 +1805,7 @@ describe('IncrementalDomRenderer', function() { TestComponent.RENDERER = IncrementalDomRenderer; component = new TestComponent(); - var child = component.components.child; + let child = component.components.child; assert.ok(!child.element); assert.strictEqual(0, component.element.childNodes.length); @@ -1654,25 +1818,35 @@ describe('IncrementalDomRenderer', function() { }); }); - it('should not render sub component with SYNC_UPDATES twice', function(done) { + it('should not render sub component with SYNC_UPDATES twice', function( + done + ) { ChildComponent.SYNC_UPDATES = true; class TestComponent extends Component { render() { IncDom.elementOpen('div'); - IncDom.elementVoid(ChildComponent, null, null, 'ref', 'child', 'foo', this.foo); + IncDom.elementVoid( + ChildComponent, + null, + null, + 'ref', + 'child', + 'foo', + this.foo + ); IncDom.elementClose('div'); } } TestComponent.RENDERER = IncrementalDomRenderer; TestComponent.STATE = { foo: { - value: 'foo' - } + value: 'foo', + }, }; component = new TestComponent(); - var child = component.components.child; + let child = component.components.child; sinon.spy(child, 'render'); component.foo = 'bar'; @@ -1684,8 +1858,7 @@ describe('IncrementalDomRenderer', function() { describe('Children data', function() { it('should pass tree of incremental dom calls as "children"', function() { - class TestChildComponent extends Component { - } + class TestChildComponent extends Component {} TestChildComponent.RENDERER = IncrementalDomRenderer; class TestComponent extends Component { @@ -1702,10 +1875,10 @@ describe('IncrementalDomRenderer', function() { TestComponent.RENDERER = IncrementalDomRenderer; component = new TestComponent(); - var child = component.components.child; + let child = component.components.child; assert.ok(child instanceof TestChildComponent); - var children = child.children; + let children = child.children; assert.ok(children); assert.strictEqual(1, children.length); @@ -1741,11 +1914,14 @@ describe('IncrementalDomRenderer', function() { TestComponent.RENDERER = IncrementalDomRenderer; component = new TestComponent(); - var child = component.components.child; + let child = component.components.child; assert.ok(child instanceof TestChildComponent); assert.strictEqual(1, child.element.childNodes.length); assert.strictEqual('SPAN', child.element.childNodes[0].tagName); - assert.strictEqual('Hello World', child.element.childNodes[0].textContent); + assert.strictEqual( + 'Hello World', + child.element.childNodes[0].textContent + ); }); it('should render empty string children', function() { @@ -1770,7 +1946,7 @@ describe('IncrementalDomRenderer', function() { TestComponent.RENDERER = IncrementalDomRenderer; component = new TestComponent(); - var child = component.components.child; + let child = component.components.child; assert.strictEqual('foo bar', child.element.textContent); }); @@ -1798,7 +1974,7 @@ describe('IncrementalDomRenderer', function() { TestComponent.RENDERER = IncrementalDomRenderer; component = new TestComponent(); - var child = component.components.child; + let child = component.components.child; assert.strictEqual(1, child.element.childNodes.length); assert.strictEqual('SPAN', child.element.childNodes[0].tagName); assert.ok(dom.hasClass(child.element.childNodes[0], 'second')); @@ -1816,7 +1992,13 @@ describe('IncrementalDomRenderer', function() { class TestNestedChildComponent extends Component { render() { - IncDom.elementOpen(TestChildComponent, null, null, 'ref', 'nestedChild1'); + IncDom.elementOpen( + TestChildComponent, + null, + null, + 'ref', + 'nestedChild1' + ); IncDom.elementOpen('div'); this.children.forEach(IncrementalDomRenderer.renderChild); IncDom.elementClose('div'); @@ -1828,7 +2010,13 @@ describe('IncrementalDomRenderer', function() { class TestComponent extends Component { render() { IncDom.elementOpen('div'); - IncDom.elementOpen(TestNestedChildComponent, null, null, 'ref', 'child1'); + IncDom.elementOpen( + TestNestedChildComponent, + null, + null, + 'ref', + 'child1' + ); IncDom.elementVoid(TestChildComponent, null, null, 'ref', 'child2'); IncDom.elementClose(TestNestedChildComponent); IncDom.elementClose('div'); @@ -1837,8 +2025,8 @@ describe('IncrementalDomRenderer', function() { TestComponent.RENDERER = IncrementalDomRenderer; component = new TestComponent(); - var child1 = component.components.child1; - var child2 = component.components.child2; + let child1 = component.components.child1; + let child2 = component.components.child2; assert.ok(child1 instanceof TestNestedChildComponent); assert.ok(child2 instanceof TestChildComponent); assert.ok(child1.components.nestedChild1 instanceof TestChildComponent); @@ -1846,7 +2034,10 @@ describe('IncrementalDomRenderer', function() { assert.ok(!child1.components.child2); assert.strictEqual(child1.element, component.element.childNodes[0]); - assert.strictEqual(child2.element, child1.element.childNodes[0].childNodes[0]); + assert.strictEqual( + child2.element, + child1.element.childNodes[0].childNodes[0] + ); }); it('should add dom element references to the component that requested them', function() { @@ -1882,7 +2073,7 @@ describe('IncrementalDomRenderer', function() { TestComponent.RENDERER = IncrementalDomRenderer; component = new TestComponent(); - var childEl = component.refs.childEl; + let childEl = component.refs.childEl; assert.ok(childEl); assert.ok(core.isElement(childEl)); assert.strictEqual('SPAN', childEl.tagName); @@ -1928,9 +2119,13 @@ describe('IncrementalDomRenderer', function() { render() { IncrementalDOM.elementOpen('child'); if (this.children.length) { - this.children[0].props = object.mixin({}, this.children[0].props, { - foo: 'changedFoo' - }); + this.children[0].props = object.mixin( + {}, + this.children[0].props, + { + foo: 'changedFoo', + } + ); this.children.forEach(IncrementalDomRenderer.renderChild); } if (this.foo) { @@ -1941,8 +2136,7 @@ describe('IncrementalDomRenderer', function() { } TestChildComponent.RENDERER = IncrementalDomRenderer; TestChildComponent.STATE = { - foo: { - } + foo: {}, }; class TestNestedChildComponent extends Component { @@ -1965,7 +2159,10 @@ describe('IncrementalDomRenderer', function() { component = new TestComponent(); assert.strictEqual(1, component.element.childNodes.length); - assert.strictEqual('changedFoo', component.element.childNodes[0].textContent); + assert.strictEqual( + 'changedFoo', + component.element.childNodes[0].textContent + ); }); it('should render correctly when recursive children are used', function() { @@ -1996,9 +2193,9 @@ describe('IncrementalDomRenderer', function() { TestComponent.RENDERER = IncrementalDomRenderer; component = new TestComponent(); - var child = component.components.child; - var child2 = component.components.child2; - var child3 = component.components.child3; + let child = component.components.child; + let child2 = component.components.child2; + let child3 = component.components.child3; assert.ok(child instanceof TestChildComponent); assert.ok(child2 instanceof TestChildComponent); assert.ok(child3 instanceof TestChildComponent); @@ -2011,27 +2208,40 @@ describe('IncrementalDomRenderer', function() { assert.strictEqual('CHILD', child2.element.childNodes[0].tagName); assert.strictEqual(child3.element, child2.element.childNodes[0]); assert.strictEqual(1, child3.element.childNodes.length); - assert.strictEqual('Hello World', child2.element.childNodes[0].textContent); + assert.strictEqual( + 'Hello World', + child2.element.childNodes[0].textContent + ); }); - it('should pass same children array when there are no children', function(done) { + it('should pass same children array when there are no children', function( + done + ) { class TestComponent extends Component { render() { IncDom.elementOpen('div'); - IncDom.elementVoid(ChildComponent, null, null, 'ref', 'child', 'foo', this.foo); + IncDom.elementVoid( + ChildComponent, + null, + null, + 'ref', + 'child', + 'foo', + this.foo + ); IncDom.elementClose('div'); } } TestComponent.RENDERER = IncrementalDomRenderer; TestComponent.STATE = { foo: { - value: 'foo' - } + value: 'foo', + }, }; component = new TestComponent(); - var child = component.components.child; - var children = child.children; + let child = component.components.child; + let children = child.children; assert.ok(children); component.foo = 'foo2'; @@ -2061,13 +2271,15 @@ describe('IncrementalDomRenderer', function() { TestComponent.RENDERER = IncrementalDomRenderer; component = new TestComponent(); - var child = component.components.child; - var child2 = component.components.child2; + let child = component.components.child; + let child2 = component.components.child2; assert.strictEqual(child.element, child2.element); assert.notStrictEqual(component.element, child.element); }); - it('should reuse children components when rerendered after update', function(done) { + it('should reuse children components when rerendered after update', function( + done + ) { class TestChildComponent extends Component { render() { IncrementalDOM.elementOpen('div'); @@ -2079,8 +2291,8 @@ describe('IncrementalDomRenderer', function() { TestChildComponent.RENDERER = IncrementalDomRenderer; TestChildComponent.STATE = { foo: { - value: 'foo' - } + value: 'foo', + }, }; class TestComponent extends Component { @@ -2117,7 +2329,7 @@ describe('IncrementalDomRenderer', function() { class TestChildComponent extends Component { getChildContext() { return { - bar: 'bar' + bar: 'bar', }; } @@ -2132,14 +2344,20 @@ describe('IncrementalDomRenderer', function() { class TestComponent extends Component { getChildContext() { return { - foo: 'foo' + foo: 'foo', }; } render() { IncDom.elementOpen('div'); IncDom.elementOpen(TestChildComponent, null, null, 'ref', 'child'); - IncDom.elementVoid(TestGrandChildComponent, null, null, 'ref', 'grandChild'); + IncDom.elementVoid( + TestGrandChildComponent, + null, + null, + 'ref', + 'grandChild' + ); IncDom.elementClose(TestChildComponent); IncDom.elementClose('div'); } @@ -2147,8 +2365,8 @@ describe('IncrementalDomRenderer', function() { TestComponent.RENDERER = IncrementalDomRenderer; component = new TestComponent(); - var child = component.components.child; - var grandChild = component.components.grandChild; + let child = component.components.child; + let grandChild = component.components.grandChild; assert.ok(child instanceof TestChildComponent); assert.ok(grandChild instanceof TestGrandChildComponent); assert.ok(!component.context.foo); @@ -2167,12 +2385,12 @@ describe('IncrementalDomRenderer', function() { } TestChildComponent.RENDERER = IncrementalDomRenderer; - var element = document.createElement('div'); - var tempComp; + let element = document.createElement('div'); + let tempComp; class TestComponent extends Component { getChildContext() { return { - foo: 'foo' + foo: 'foo', }; } @@ -2181,7 +2399,7 @@ describe('IncrementalDomRenderer', function() { } rendered() { - var fn = () => { + let fn = () => { IncDom.elementVoid(TestChildComponent, null, null, 'ref', 'child'); }; tempComp = IncrementalDomRenderer.render(fn, element); @@ -2190,7 +2408,7 @@ describe('IncrementalDomRenderer', function() { TestComponent.RENDERER = IncrementalDomRenderer; component = new TestComponent(); - var child = tempComp.components.child; + let child = tempComp.components.child; assert.ok(child instanceof TestChildComponent); assert.ok(!component.context.foo); assert.ok(!component.context.bar); @@ -2198,11 +2416,13 @@ describe('IncrementalDomRenderer', function() { }); describe('Dispose Unused Sub Components', function() { - it('should dispose sub components that are unused after an update', function(done) { + it('should dispose sub components that are unused after an update', function( + done + ) { class TestComponent extends Component { render() { IncDom.elementOpen('div'); - for (var i = 1; i <= this.count; i++) { + for (let i = 1; i <= this.count; i++) { IncDom.elementVoid('ChildComponent', null, ['ref', 'child' + i]); } IncDom.elementClose('div'); @@ -2211,11 +2431,11 @@ describe('IncrementalDomRenderer', function() { TestComponent.RENDERER = IncrementalDomRenderer; TestComponent.STATE = { count: { - value: 3 - } + value: 3, + }, }; component = new TestComponent(); - var subComps = object.mixin({}, component.components); + let subComps = object.mixin({}, component.components); assert.strictEqual(3, Object.keys(subComps).length); assert.ok(subComps.child1); assert.ok(subComps.child2); @@ -2235,7 +2455,9 @@ describe('IncrementalDomRenderer', function() { }); }); - it('should dispose unused sub component before triggering update rerender', function(done) { + it('should dispose unused sub component before triggering update rerender', function( + done + ) { class TestComponent extends Component { render() { IncDom.elementOpen('div'); @@ -2248,11 +2470,11 @@ describe('IncrementalDomRenderer', function() { TestComponent.RENDERER = IncrementalDomRenderer; TestComponent.STATE = { foo: { - value: 'foo' - } + value: 'foo', + }, }; component = new TestComponent(); - var child = component.components.child; + let child = component.components.child; sinon.spy(child, 'render'); component.foo = 'bar'; @@ -2264,7 +2486,9 @@ describe('IncrementalDomRenderer', function() { }); }); - it('should dispose sub components from "children" that are unused after an update', function(done) { + it('should dispose sub components from "children" that are unused after an update', function( + done + ) { class TestChildComponent extends Component { render() { IncDom.elementOpen('div'); @@ -2275,8 +2499,8 @@ describe('IncrementalDomRenderer', function() { TestChildComponent.RENDERER = IncrementalDomRenderer; TestChildComponent.STATE = { index: { - value: 0 - } + value: 0, + }, }; class TestComponent extends Component { @@ -2290,8 +2514,8 @@ describe('IncrementalDomRenderer', function() { TestComponent.RENDERER = IncrementalDomRenderer; component = new TestComponent(); - var child = component.components.child; - var item1 = component.components.item1; + let child = component.components.child; + let item1 = component.components.item1; assert.ok(item1); assert.ok(!component.components.item2); assert.ok(!item1.isDisposed()); @@ -2306,12 +2530,20 @@ describe('IncrementalDomRenderer', function() { }); }); - it('should dispose sub components from sub components that are unused after a parent update', function(done) { + it('should dispose sub components from sub components that are unused after a parent update', function( + done + ) { class TestChildComponent extends Component { render() { IncDom.elementOpen('div'); if (!this.remove) { - IncDom.elementOpen(ChildComponent, null, null, 'ref', 'innerChild'); + IncDom.elementOpen( + ChildComponent, + null, + null, + 'ref', + 'innerChild' + ); IncDom.elementClose(ChildComponent); } IncDom.elementClose('div'); @@ -2319,24 +2551,30 @@ describe('IncrementalDomRenderer', function() { } TestChildComponent.RENDERER = IncrementalDomRenderer; TestChildComponent.STATE = { - remove: { - } + remove: {}, }; class TestComponent extends Component { render() { - IncDom.elementVoid(TestChildComponent, null, null, 'ref', 'child', 'remove', this.remove); + IncDom.elementVoid( + TestChildComponent, + null, + null, + 'ref', + 'child', + 'remove', + this.remove + ); } } TestComponent.RENDERER = IncrementalDomRenderer; TestComponent.STATE = { - remove: { - } + remove: {}, }; component = new TestComponent(); - var child = component.components.child; - var innerChild = child.components.innerChild; + let child = component.components.child; + let innerChild = child.components.innerChild; assert.ok(innerChild); component.remove = true; @@ -2350,7 +2588,9 @@ describe('IncrementalDomRenderer', function() { }); }); - it('should not remove reusable element from disposed component', function(done) { + it('should not remove reusable element from disposed component', function( + done + ) { class TestChildComponent extends Component { render() { IncDom.elementOpen('child'); @@ -2360,37 +2600,53 @@ describe('IncrementalDomRenderer', function() { } TestChildComponent.STATE = { index: { - value: 0 - } + value: 0, + }, }; TestChildComponent.RENDERER = IncrementalDomRenderer; class TestComponent extends Component { render() { IncDom.elementOpen(TestChildComponent, null, null, 'ref', 'child'); - IncDom.elementVoid(ChildComponent, null, null, 'foo', 'foo1', 'ref', 'grandchild1'); - IncDom.elementVoid(ChildComponent, null, null, 'foo', 'foo2', 'ref', 'grandchild2'); + IncDom.elementVoid( + ChildComponent, + null, + null, + 'foo', + 'foo1', + 'ref', + 'grandchild1' + ); + IncDom.elementVoid( + ChildComponent, + null, + null, + 'foo', + 'foo2', + 'ref', + 'grandchild2' + ); IncDom.elementClose(TestChildComponent); } } TestComponent.RENDERER = IncrementalDomRenderer; component = new TestComponent(); - var child = component.components.child; - var child1 = component.components.grandchild1; + let child = component.components.child; + let child1 = component.components.grandchild1; assert.ok(child1); assert.strictEqual('foo1', child1.foo); assert.strictEqual(child1.element, child.element.childNodes[0]); assert.ok(!child1.isDisposed()); assert.ok(!component.components.foo2); - var child1Element = child1.element; + let child1Element = child1.element; child.index = 1; child.once('stateSynced', function() { assert.ok(!component.components.grandchild1); assert.ok(child1.isDisposed()); - var child2 = component.components.grandchild2; + let child2 = component.components.grandchild2; assert.ok(child2); assert.strictEqual('foo2', child2.foo); assert.strictEqual(child2.element, child.element.childNodes[0]); @@ -2400,7 +2656,9 @@ describe('IncrementalDomRenderer', function() { }); }); - it('should not remove reusable element from disposed component\'s sub components', function(done) { + it('should not remove reusable element from disposed component\'s sub components', function( + done + ) { class TestChildComponent extends Component { render() { IncDom.elementVoid(ChildComponent, null, null, 'ref', 'child'); @@ -2421,12 +2679,11 @@ describe('IncrementalDomRenderer', function() { } TestComponent.RENDERER = IncrementalDomRenderer; TestComponent.STATE = { - switch: { - } + switch: {}, }; component = new TestComponent(); - var child = component.components.child1; + let child = component.components.child1; assert.ok(child instanceof TestChildComponent); assert.strictEqual(child.element, component.element.childNodes[0]); @@ -2443,7 +2700,9 @@ describe('IncrementalDomRenderer', function() { }); }); - it('should not dispose new sub component with same ref as unused sub component', function(done) { + it('should not dispose new sub component with same ref as unused sub component', function( + done + ) { class TestChildComponent extends Component { render() { IncrementalDOM.elementVoid('child'); @@ -2464,16 +2723,15 @@ describe('IncrementalDomRenderer', function() { } TestComponent.RENDERER = IncrementalDomRenderer; TestComponent.STATE = { - switch: { - } + switch: {}, }; component = new TestComponent(); - var child = component.components.child; + let child = component.components.child; assert.ok(child instanceof ChildComponent); component.switch = true; component.once('stateSynced', function() { - var newChild = component.components.child; + let newChild = component.components.child; assert.ok(newChild instanceof TestChildComponent); assert.notStrictEqual(child, newChild); assert.ok(child.isDisposed()); @@ -2483,7 +2741,9 @@ describe('IncrementalDomRenderer', function() { }); }); - it('should not dispose unused sub component if "skipNextChildrenDisposal" is called', function(done) { + it('should not dispose unused sub component if "skipNextChildrenDisposal" is called', function( + done + ) { class TestComponent extends Component { render() { IncDom.elementOpen('div'); @@ -2496,11 +2756,11 @@ describe('IncrementalDomRenderer', function() { TestComponent.RENDERER = IncrementalDomRenderer; TestComponent.STATE = { foo: { - value: 'foo' - } + value: 'foo', + }, }; component = new TestComponent(); - var child = component.components.child; + let child = component.components.child; sinon.spy(child, 'render'); component.foo = 'bar'; @@ -2547,7 +2807,15 @@ describe('IncrementalDomRenderer', function() { core.enableCompatibilityMode(); class TestComponent extends Component { render() { - IncDom.elementVoid(ChildComponent, null, null, 'key', 'keyChild', 'ref', 'refChild'); + IncDom.elementVoid( + ChildComponent, + null, + null, + 'key', + 'keyChild', + 'ref', + 'refChild' + ); } } TestComponent.RENDERER = IncrementalDomRenderer; @@ -2559,11 +2827,10 @@ describe('IncrementalDomRenderer', function() { }); it('should store component references via "key" when renderer is enabled by compatibility mode', function() { - class TestRendererClass extends IncrementalDomRenderer.constructor { - } + class TestRendererClass extends IncrementalDomRenderer.constructor {} const TestRenderer = new TestRendererClass(); core.enableCompatibilityMode({ - renderers: [TestRenderer] + renderers: [TestRenderer], }); class TestComponent extends Component { @@ -2579,12 +2846,11 @@ describe('IncrementalDomRenderer', function() { }); it('should store component references via "key" when renderer is enabled by compatibility mode via its name', function() { - class TestRendererClass extends IncrementalDomRenderer.constructor { - } + class TestRendererClass extends IncrementalDomRenderer.constructor {} const TestRenderer = new TestRendererClass(); TestRenderer.RENDERER_NAME = 'test'; core.enableCompatibilityMode({ - renderers: ['test'] + renderers: ['test'], }); class TestComponent extends Component { @@ -2600,11 +2866,10 @@ describe('IncrementalDomRenderer', function() { }); it('should not store component references via "key" when renderer is not enabled by compatibility mode', function() { - class TestRendererClass extends IncrementalDomRenderer.constructor { - } + class TestRendererClass extends IncrementalDomRenderer.constructor {} const TestRenderer = new TestRendererClass(); core.enableCompatibilityMode({ - renderers: [TestRenderer] + renderers: [TestRenderer], }); class TestComponent extends Component { @@ -2618,40 +2883,45 @@ describe('IncrementalDomRenderer', function() { assert.ok(!component.components.child); }); - describe('Sunset Tests', sunset(function() { - it('should not store component references via "key" on compatibility mode after version 3.x', function() { - core.enableCompatibilityMode(); - class TestComponent extends Component { - render() { - IncDom.elementVoid(ChildComponent, null, null, 'key', 'child'); + describe( + 'Sunset Tests', + sunset(function() { + it('should not store component references via "key" on compatibility mode after version 3.x', function() { + core.enableCompatibilityMode(); + class TestComponent extends Component { + render() { + IncDom.elementVoid(ChildComponent, null, null, 'key', 'child'); + } } - } - TestComponent.RENDERER = IncrementalDomRenderer; + TestComponent.RENDERER = IncrementalDomRenderer; - component = new TestComponent(); - assert.ok(!component.components.child); - }); - })); + component = new TestComponent(); + assert.ok(!component.components.child); + }); + }) + ); }); }); describe('Function - shouldUpdate', function() { - it('should only rerender after state change if "shouldUpdate" returns true', function(done) { + it('should only rerender after state change if "shouldUpdate" returns true', function( + done + ) { class TestComponent extends Component { render() {} shouldUpdate(changes) { - return changes.foo && (changes.foo.prevVal !== changes.foo.newVal); + return changes.foo && changes.foo.prevVal !== changes.foo.newVal; } } TestComponent.RENDERER = IncrementalDomRenderer; TestComponent.STATE = { bar: { - value: 'bar' + value: 'bar', }, foo: { - value: 'foo' - } + value: 'foo', + }, }; component = new TestComponent(); @@ -2677,7 +2947,9 @@ describe('IncrementalDomRenderer', function() { IncrementalDOM.skipNode.restore(); }); - it('should not rerender child component if its "shouldUpdate" returns false', function(done) { + it('should not rerender child component if its "shouldUpdate" returns false', function( + done + ) { class TestChildComponent extends Component { render() { IncDom.elementOpen('span'); @@ -2702,17 +2974,20 @@ describe('IncrementalDomRenderer', function() { TestComponent.RENDERER = IncrementalDomRenderer; TestComponent.STATE = { foo: { - value: 'foo' - } + value: 'foo', + }, }; component = new TestComponent(); - var child = component.components.child; + let child = component.components.child; component.foo = 'foo2'; component.once('stateSynced', function() { assert.strictEqual(1, IncrementalDOM.skipNode.callCount); - assert.strictEqual('foo2', component.element.childNodes[0].textContent); + assert.strictEqual( + 'foo2', + component.element.childNodes[0].textContent + ); assert.strictEqual(child.element, component.element.childNodes[1]); assert.strictEqual('SPAN', child.element.tagName); assert.strictEqual('Child', child.element.textContent); @@ -2721,7 +2996,9 @@ describe('IncrementalDomRenderer', function() { }); }); - it('should correctly reposition child component even if its "shouldUpdate" returns false', function(done) { + it('should correctly reposition child component even if its "shouldUpdate" returns false', function( + done + ) { class TestChildComponent extends Component { render() { IncDom.elementOpen('span'); @@ -2750,12 +3027,11 @@ describe('IncrementalDomRenderer', function() { } TestComponent.RENDERER = IncrementalDomRenderer; TestComponent.STATE = { - wrap: { - } + wrap: {}, }; component = new TestComponent(); - var child = component.components.child; + let child = component.components.child; assert.strictEqual(1, component.element.childNodes.length); assert.strictEqual(child.element, component.element.childNodes[0]); assert.strictEqual('SPAN', child.element.tagName); @@ -2765,14 +3041,19 @@ describe('IncrementalDomRenderer', function() { component.once('stateSynced', function() { assert.strictEqual(1, component.element.childNodes.length); assert.ok(dom.hasClass(component.element.childNodes[0], 'wrapper')); - assert.strictEqual(child.element, component.element.childNodes[0].childNodes[0]); + assert.strictEqual( + child.element, + component.element.childNodes[0].childNodes[0] + ); assert.strictEqual('SPAN', child.element.tagName); assert.strictEqual('Child', child.element.textContent); done(); }); }); - it('should skip child update without error if it had no element before', function(done) { + it('should skip child update without error if it had no element before', function( + done + ) { class TestChildComponent extends Component { render() {} @@ -2793,12 +3074,12 @@ describe('IncrementalDomRenderer', function() { TestComponent.RENDERER = IncrementalDomRenderer; TestComponent.STATE = { foo: { - value: 'foo' - } + value: 'foo', + }, }; component = new TestComponent(); - var child = component.components.child; + let child = component.components.child; sinon.spy(child, 'render'); component.foo = 'foo2'; @@ -2813,7 +3094,9 @@ describe('IncrementalDomRenderer', function() { }); describe('Function - willUpdate', function() { - it('should run "willUpdate" lifecycle method when the component is about to render', function(done) { + it('should run "willUpdate" lifecycle method when the component is about to render', function( + done + ) { class TestComponent extends Component { render() {} } @@ -2821,8 +3104,8 @@ describe('IncrementalDomRenderer', function() { TestComponent.RENDERER = IncrementalDomRenderer; TestComponent.STATE = { foo: { - value: 'foo' - } + value: 'foo', + }, }; component = new TestComponent(); @@ -2836,8 +3119,8 @@ describe('IncrementalDomRenderer', function() { foo: { key: 'foo', newVal: 'foo2', - prevVal: 'foo' - } + prevVal: 'foo', + }, }); done(); @@ -2845,7 +3128,9 @@ describe('IncrementalDomRenderer', function() { }); }); - it('should run "willUpdate" lifecycle method of nested component when it is about to render', function(done) { + it('should run "willUpdate" lifecycle method of nested component when it is about to render', function( + done + ) { const listener = sinon.stub(); class TestChildComponent extends Component { render() {} @@ -2854,22 +3139,30 @@ describe('IncrementalDomRenderer', function() { TestChildComponent.RENDERER = IncrementalDomRenderer; TestChildComponent.STATE = { foo: { - value: 'foo' - } + value: 'foo', + }, }; class TestComponent extends Component { render() { IncDom.elementOpen('div'); - IncDom.elementVoid(TestChildComponent, null, null, 'ref', 'child', 'foo', this.foo); + IncDom.elementVoid( + TestChildComponent, + null, + null, + 'ref', + 'child', + 'foo', + this.foo + ); IncDom.elementClose('div'); } } TestComponent.RENDERER = IncrementalDomRenderer; TestComponent.STATE = { foo: { - value: 'foo' - } + value: 'foo', + }, }; component = new TestComponent(); @@ -2884,7 +3177,7 @@ describe('IncrementalDomRenderer', function() { assert.deepEqual(child.willUpdate.args[0][0].foo, { key: 'foo', newVal: 'foo2', - prevVal: 'foo' + prevVal: 'foo', }); done(); @@ -2895,7 +3188,7 @@ describe('IncrementalDomRenderer', function() { describe('Componentless function tags', function() { it('should render componentless function passed as incremental dom tag', function() { - var TestFunction = ({foo}) => { + let TestFunction = ({foo}) => { IncDom.elementOpen('span'); IncDom.text(foo); return IncDom.elementClose('span'); @@ -2918,7 +3211,7 @@ describe('IncrementalDomRenderer', function() { }); it('should render children from componentless function passed as incremental dom tag', function() { - var TestFunction = ({children}) => { + let TestFunction = ({children}) => { IncDom.elementOpen('span'); children.forEach(IncrementalDomRenderer.renderChild); return IncDom.elementClose('span'); @@ -2939,35 +3232,40 @@ describe('IncrementalDomRenderer', function() { assert.strictEqual(0, Object.keys(component.components).length); assert.strictEqual(1, component.element.childNodes.length); assert.strictEqual('SPAN', component.element.childNodes[0].tagName); - assert.strictEqual('children', component.element.childNodes[0].textContent); + assert.strictEqual( + 'children', + component.element.childNodes[0].textContent + ); }); it('should render componentless function via "IncrementalDomRenderer.render"', function() { - var fn = props => { + let fn = props => { IncDom.elementOpen('span', null, null, 'foo', props.foo); IncDom.text('bar'); IncDom.elementClose('span'); }; - var container = document.createElement('span'); + let container = document.createElement('span'); IncrementalDomRenderer.render( fn, { - foo: 'fooValue' + foo: 'fooValue', }, container ); assert.strictEqual(1, container.childNodes.length); - assert.strictEqual('fooValue', container.childNodes[0].getAttribute('foo')); + assert.strictEqual( + 'fooValue', + container.childNodes[0].getAttribute('foo') + ); assert.strictEqual('bar', container.childNodes[0].textContent); }); }); describe('Dispose', function() { it('should remove component with ref from owner', function() { - class Child extends Component { - } + class Child extends Component {} Child.RENDERER = IncrementalDomRenderer; class TestComponent extends Component { @@ -2978,7 +3276,7 @@ describe('IncrementalDomRenderer', function() { TestComponent.RENDERER = IncrementalDomRenderer; component = new TestComponent(); - var child = component.components.child; + let child = component.components.child; child.dispose(); assert.ok(child.isDisposed()); @@ -2986,8 +3284,7 @@ describe('IncrementalDomRenderer', function() { }); it('should not remove different component with same ref from owner', function() { - class Child extends Component { - } + class Child extends Component {} Child.RENDERER = IncrementalDomRenderer; class TestComponent extends Component { @@ -2998,7 +3295,7 @@ describe('IncrementalDomRenderer', function() { TestComponent.RENDERER = IncrementalDomRenderer; component = new TestComponent(); - var child = component.components.child; + let child = component.components.child; component.components.child = new Child(); child.dispose(); @@ -3011,12 +3308,16 @@ describe('IncrementalDomRenderer', function() { describe('IncrementalDomRenderer.isIncDomNode', function() { it('should check if given data is an incremental dom node', function() { assert.ok(!IncrementalDomRenderer.isIncDomNode({})); - assert.ok(!IncrementalDomRenderer.isIncDomNode({ - tag: 'span' - })); - assert.ok(IncrementalDomRenderer.isIncDomNode({ - [CHILD_OWNER]: true - })); + assert.ok( + !IncrementalDomRenderer.isIncDomNode({ + tag: 'span', + }) + ); + assert.ok( + IncrementalDomRenderer.isIncDomNode({ + [CHILD_OWNER]: true, + }) + ); }); }); diff --git a/packages/metal-incremental-dom/test/callArgs.js b/packages/metal-incremental-dom/test/callArgs.js index 8662689a..ce9b4549 100644 --- a/packages/metal-incremental-dom/test/callArgs.js +++ b/packages/metal-incremental-dom/test/callArgs.js @@ -1,29 +1,32 @@ 'use strict'; -import { buildCallFromConfig, buildConfigFromCall } from '../src/callArgs'; +import {buildCallFromConfig, buildConfigFromCall} from '../src/callArgs'; describe('callArgs', function() { it('should build configuration object from incremental dom call', function() { - var config = buildConfigFromCall([ + let config = buildConfigFromCall([ 'span', 'key', ['static1', 'staticVal1', 'static2', 'staticVal2'], 'attr1', - 'attrVal1' + 'attrVal1', ]); - assert.deepEqual({ - key: 'key', - static1: 'staticVal1', - static2: 'staticVal2', - attr1: 'attrVal1' - }, config); + assert.deepEqual( + { + key: 'key', + static1: 'staticVal1', + static2: 'staticVal2', + attr1: 'attrVal1', + }, + config + ); }); it('should build incremental dom call from configuration object', function() { const call = buildCallFromConfig('span', { key: 'key', attr1: 'attrVal1', - attr2: 'attrVal2' + attr2: 'attrVal2', }); assert.equal(7, call.length); diff --git a/packages/metal-incremental-dom/test/changes.js b/packages/metal-incremental-dom/test/changes.js index 1f903d8f..863d7881 100644 --- a/packages/metal-incremental-dom/test/changes.js +++ b/packages/metal-incremental-dom/test/changes.js @@ -1,7 +1,7 @@ 'use strict'; -import { clearChanges, getChanges, trackChanges } from '../src/changes'; -import { getData } from '../src/data'; +import {clearChanges, getChanges, trackChanges} from '../src/changes'; +import {getData} from '../src/data'; import Component from 'metal-component'; describe('changes', function() { @@ -19,15 +19,18 @@ describe('changes', function() { component.visible = false; const changes = getChanges(component); - assert.deepEqual({ - props: { - visible: { - key: 'visible', - newVal: false, - prevVal: true - } - } - }, changes); + assert.deepEqual( + { + props: { + visible: { + key: 'visible', + newVal: false, + prevVal: true, + }, + }, + }, + changes + ); }); it('should clear changes for a given component', function() { diff --git a/packages/metal-incremental-dom/test/children/children.js b/packages/metal-incremental-dom/test/children/children.js index edf24ce6..5ced2fd8 100644 --- a/packages/metal-incremental-dom/test/children/children.js +++ b/packages/metal-incremental-dom/test/children/children.js @@ -1,15 +1,20 @@ 'use strict'; import dom from 'metal-dom'; -import { sunset } from '../../../../test-utils'; -import { captureChildren, getOwner, renderChildTree, CHILD_OWNER } from '../../src/children/children'; +import {sunset} from '../../../../test-utils'; +import { + captureChildren, + getOwner, + renderChildTree, + CHILD_OWNER, +} from '../../src/children/children'; describe('children', function() { it('should capture children calls to incremental dom', function(done) { captureChildren({}, function(tree) { assert.strictEqual(1, tree.props.children.length); - var node = tree.props.children[0]; + let node = tree.props.children[0]; assert.ok(!node.text); assert.strictEqual('span', node.tag); assert.ok(node.props); @@ -32,10 +37,7 @@ describe('children', function() { it('should return the captured tree\'s given owner object', function(done) { const owner = {}; captureChildren(owner, function(tree) { - assert.strictEqual( - owner, - getOwner(tree.props.children[0]) - ); + assert.strictEqual(owner, getOwner(tree.props.children[0])); done(); }); @@ -43,18 +45,17 @@ describe('children', function() { IncrementalDOM.elementClose('div'); }); - it('should store args for text nodes when they contain more than just the text', function(done) { + it('should store args for text nodes when they contain more than just the text', function( + done + ) { captureChildren({}, function(tree) { - var node = tree.props.children[0]; + let node = tree.props.children[0]; assert.strictEqual('No args', node.text); assert.ok(!node.args); node = tree.props.children[1]; assert.strictEqual('With args', node.text); - assert.deepEqual([ - node.text, - formatFn - ], node.args); + assert.deepEqual([node.text, formatFn], node.args); done(); }); @@ -71,7 +72,7 @@ describe('children', function() { origElementOpen = IncrementalDOM.elementOpen; IncrementalDOM.elementOpen = function(...args) { args[0] = args[0].tag; - origElementOpen.apply(null, args); + origElementOpen(...args); }; }); @@ -80,7 +81,7 @@ describe('children', function() { }); it('should render captured children via incremental dom', function() { - var element = document.createElement('div'); + let element = document.createElement('div'); IncrementalDOM.patch(element, () => { renderChildTree({ @@ -89,19 +90,19 @@ describe('children', function() { children: [ { args: ['Hello World'], - text: 'Hello World' - } + text: 'Hello World', + }, ], class: 'test', foo: 'bar', - key: 'key' - } + key: 'key', + }, }); }); assert.strictEqual(1, element.childNodes.length); - var spanElement = element.childNodes[0]; + let spanElement = element.childNodes[0]; assert.strictEqual('SPAN', spanElement.tagName); assert.ok(dom.hasClass(spanElement, 'test')); assert.strictEqual('bar', spanElement.getAttribute('foo')); @@ -110,7 +111,7 @@ describe('children', function() { }); it('should skip rendering children node when skipNode function returns true', function() { - var element = document.createElement('div'); + let element = document.createElement('div'); function skipNode(node) { if (node.props && node.props.id === 'skip') { @@ -118,52 +119,60 @@ describe('children', function() { } } IncrementalDOM.patch(element, () => { - renderChildTree({ - tag: 'span', - props: { - children: [ - { - tag: 'span', - props: { - id: 'beforeSkip' - } - }, - { - tag: 'span', - props: { - id: 'skip' - } - }, - { - tag: 'span', - props: { - id: 'afterSkip' - } - } - ], - id: 'parent' - } - }, skipNode); + renderChildTree( + { + tag: 'span', + props: { + children: [ + { + tag: 'span', + props: { + id: 'beforeSkip', + }, + }, + { + tag: 'span', + props: { + id: 'skip', + }, + }, + { + tag: 'span', + props: { + id: 'afterSkip', + }, + }, + ], + id: 'parent', + }, + }, + skipNode + ); }); assert.strictEqual(1, element.childNodes.length); - var child = element.childNodes[0]; + let child = element.childNodes[0]; assert.strictEqual(2, child.childNodes.length); assert.strictEqual('beforeSkip', child.childNodes[0].id); assert.strictEqual('afterSkip', child.childNodes[1].id); }); - it('should render text nodes that have been changed after capture', function(done) { + it('should render text nodes that have been changed after capture', function( + done + ) { captureChildren({}, function(tree) { - var element = document.createElement('div'); + let element = document.createElement('div'); tree.props.children[0].text = 'New Text'; IncrementalDOM.patch(element, () => { renderChildTree(tree.props.children[0]); }); assert.strictEqual(1, element.childNodes.length); - assert.strictEqual('New Text Formatted', element.childNodes[0].textContent); + assert.strictEqual( + 'New Text Formatted', + element.childNodes[0].textContent + ); done(); }); @@ -172,12 +181,14 @@ describe('children', function() { }); }); - it('should keep original renderer for children that have been recaptured by another1', function(done) { - var renderer1 = {}; - var renderer2 = {}; + it('should keep original renderer for children that have been recaptured by another1', function( + done + ) { + let renderer1 = {}; + let renderer2 = {}; captureChildren(renderer2, function(tree) { - var element = tree.props.children[0]; + let element = tree.props.children[0]; assert.strictEqual('div', element.tag); assert.strictEqual(renderer2, getOwner(element)); assert.strictEqual(1, element.props.children.length); @@ -200,28 +211,33 @@ describe('children', function() { children: [ { text: 'Hello World', - [CHILD_OWNER]: renderer1 + [CHILD_OWNER]: renderer1, }, - ] + ], }, - [CHILD_OWNER]: renderer1 + [CHILD_OWNER]: renderer1, }); IncrementalDOM.elementClose('div'); IncrementalDOM.elementClose('div'); }); - describe('Sunset Tests', sunset(function() { - it('should not have "config" object inside each child after version 3.x', function(done) { - captureChildren({}, function(tree) { - assert.strictEqual(1, tree.props.children.length); + describe( + 'Sunset Tests', + sunset(function() { + it('should not have "config" object inside each child after version 3.x', function( + done + ) { + captureChildren({}, function(tree) { + assert.strictEqual(1, tree.props.children.length); + + let node = tree.props.children[0]; + assert.ok(!node.config, 'Remove "config" for version 3.x'); + done(); + }); - var node = tree.props.children[0]; - assert.ok(!node.config, 'Remove "config" for version 3.x'); - done(); + IncrementalDOM.elementVoid('span', null, null, 'foo', 'bar'); + IncrementalDOM.elementClose('div'); }); - - IncrementalDOM.elementVoid('span', null, null, 'foo', 'bar'); - IncrementalDOM.elementClose('div'); - }); - })); + }) + ); }); diff --git a/packages/metal-incremental-dom/test/cleanup/unused.js b/packages/metal-incremental-dom/test/cleanup/unused.js index db9ba3c3..82a03987 100644 --- a/packages/metal-incremental-dom/test/cleanup/unused.js +++ b/packages/metal-incremental-dom/test/cleanup/unused.js @@ -2,12 +2,12 @@ import Component from 'metal-component'; import IncrementalDomRenderer from '../../src/IncrementalDomRenderer'; -import { disposeUnused, schedule } from '../../src/cleanup/unused'; -import { getData } from '../../src/data'; +import {disposeUnused, schedule} from '../../src/cleanup/unused'; +import {getData} from '../../src/data'; describe('unused', function() { - var comp; - var grandchild; + let comp; + let grandchild; beforeEach(function() { class GrandChild extends Component { @@ -43,7 +43,7 @@ describe('unused', function() { }); it('should dispose scheduled components', function() { - var comps = [comp.components.child1, comp.components.child2]; + let comps = [comp.components.child1, comp.components.child2]; schedule(comps); disposeUnused(); @@ -52,7 +52,7 @@ describe('unused', function() { }); it('should not dispose scheduled components that have received a new parent', function() { - var comps = [comp.components.child1, comp.components.child2]; + let comps = [comp.components.child1, comp.components.child2]; schedule(comps); getData(comps[0]).parent = comp; disposeUnused(); @@ -62,7 +62,7 @@ describe('unused', function() { }); it('should not dispose scheduled components that have been disposed before scheduled', function() { - var comps = [comp.components.child1, comp.components.child2]; + let comps = [comp.components.child1, comp.components.child2]; comps[0].dispose(); schedule(comps); sinon.spy(comps[0], 'dispose'); @@ -74,7 +74,7 @@ describe('unused', function() { }); it('should not dispose scheduled components that have been disposed after scheduled', function() { - var comps = [comp.components.child1, comp.components.child2]; + let comps = [comp.components.child1, comp.components.child2]; schedule(comps); comps[0].dispose(); sinon.spy(comps[0], 'dispose'); @@ -90,7 +90,7 @@ describe('unused', function() { disposeUnused(); }); - var comps = [comp.components.child1]; + let comps = [comp.components.child1]; schedule(comps); assert.doesNotThrow(() => disposeUnused()); @@ -98,7 +98,7 @@ describe('unused', function() { }); it('should not throw error when disposing component that has an owner that was previously disposed', function() { - var comps = [comp.components.child2, grandchild]; + let comps = [comp.components.child2, grandchild]; schedule(comps); assert.doesNotThrow(() => disposeUnused()); }); diff --git a/packages/metal-incremental-dom/test/data.js b/packages/metal-incremental-dom/test/data.js index 7ab02534..2ca549bb 100644 --- a/packages/metal-incremental-dom/test/data.js +++ b/packages/metal-incremental-dom/test/data.js @@ -1,6 +1,6 @@ 'use strict'; -import { clearData, getData } from '../src/data'; +import {clearData, getData} from '../src/data'; describe('data', function() { it('should return an empty object on the first "getData" call for an object', function() { diff --git a/packages/metal-incremental-dom/test/html/HTML2IncDom.js b/packages/metal-incremental-dom/test/html/HTML2IncDom.js index 9ca88ce1..f58aa852 100644 --- a/packages/metal-incremental-dom/test/html/HTML2IncDom.js +++ b/packages/metal-incremental-dom/test/html/HTML2IncDom.js @@ -4,36 +4,36 @@ import HTML2IncDom from '../../src/html/HTML2IncDom'; describe('HTML2IncDom', function() { it('should render html inside element via incremental dom', function() { - var element = document.createElement('div'); - var htmlStr = '
Foo
'; + let element = document.createElement('div'); + let htmlStr = '
Foo
'; IncrementalDOM.patch(element, () => HTML2IncDom.run(htmlStr)); assert.strictEqual(htmlStr, element.innerHTML); }); it('should render link element inside its span parent via incremental dom', function() { - var element = document.createElement('div'); - var htmlStr = 'Foo'; + let element = document.createElement('div'); + let htmlStr = 'Foo'; IncrementalDOM.patch(element, () => HTML2IncDom.run(htmlStr)); assert.strictEqual(htmlStr, element.innerHTML); }); it('should render escaped html inside element via incremental dom', function() { - var element = document.createElement('div'); + let element = document.createElement('div'); IncrementalDOM.patch(element, () => HTML2IncDom.run(''Foo'')); assert.strictEqual('\'Foo\'', element.textContent); }); it('should render void elements from html via incremental dom', function() { - var element = document.createElement('div'); - var htmlStr = ''; + let element = document.createElement('div'); + let htmlStr = ''; IncrementalDOM.patch(element, () => HTML2IncDom.run(htmlStr)); assert.strictEqual(htmlStr, element.innerHTML); }); it('should build function for rendering html via incremental dom', function() { - var element = document.createElement('div'); - var htmlStr = '
Foo
'; - var fn = HTML2IncDom.buildFn(htmlStr); + let element = document.createElement('div'); + let htmlStr = '
Foo
'; + let fn = HTML2IncDom.buildFn(htmlStr); assert.strictEqual(0, element.childNodes.length); IncrementalDOM.patch(element, fn); @@ -52,10 +52,13 @@ describe('HTML2IncDom', function() { handlers.end('div'); }); - var element = document.createElement('div'); - var htmlStr = '
Foo
'; + let element = document.createElement('div'); + let htmlStr = '
Foo
'; IncrementalDOM.patch(element, () => HTML2IncDom.run(htmlStr)); - assert.strictEqual('
Foo-CustomParser
', element.innerHTML); + assert.strictEqual( + '
Foo-CustomParser
', + element.innerHTML + ); }); }); }); diff --git a/packages/metal-incremental-dom/test/incremental-dom-aop.js b/packages/metal-incremental-dom/test/incremental-dom-aop.js index adff6fad..27282653 100644 --- a/packages/metal-incremental-dom/test/incremental-dom-aop.js +++ b/packages/metal-incremental-dom/test/incremental-dom-aop.js @@ -2,10 +2,14 @@ import core from 'metal'; import dom from 'metal-dom'; -import { getOriginalFns, startInterception, stopInterception } from '../src/incremental-dom-aop'; +import { + getOriginalFns, + startInterception, + stopInterception, +} from '../src/incremental-dom-aop'; describe('incremental-dom-aop', function() { - var element; + let element; beforeEach(function() { element = document.createElement('div'); @@ -19,7 +23,7 @@ describe('incremental-dom-aop', function() { describe('Original Functions', function() { it('should return the original functions', function() { - var originalFns = getOriginalFns(); + let originalFns = getOriginalFns(); assert.ok(originalFns); assert.ok(originalFns.attr); assert.ok(originalFns.attributes); @@ -34,9 +38,9 @@ describe('incremental-dom-aop', function() { describe('elementOpen', function() { it('should intercept elementOpen calls with specified function', function() { - var fn = sinon.stub(); + let fn = sinon.stub(); startInterception({ - elementOpen: fn + elementOpen: fn, }); IncrementalDOM.elementOpen('div', 'key', 'statics', 'name', 'value'); @@ -49,9 +53,9 @@ describe('incremental-dom-aop', function() { }); it('should stop intercepting elementOpen calls', function() { - var fn = sinon.stub(); + let fn = sinon.stub(); startInterception({ - elementOpen: fn + elementOpen: fn, }); stopInterception(); @@ -66,11 +70,11 @@ describe('incremental-dom-aop', function() { describe('elementVoid', function() { it('should intercept elementOpen and elementClose from elementVoid calls with specified function', function() { - var openFn = sinon.stub(); - var closeFn = sinon.stub(); + let openFn = sinon.stub(); + let closeFn = sinon.stub(); startInterception({ elementClose: closeFn, - elementOpen: openFn + elementOpen: openFn, }); IncrementalDOM.elementVoid('div', 'key', 'statics', 'name', 'value'); @@ -84,9 +88,9 @@ describe('incremental-dom-aop', function() { }); it('should stop intercepting elementOpen from elementVoid calls', function() { - var fn = sinon.stub(); + let fn = sinon.stub(); startInterception({ - elementOpen: fn + elementOpen: fn, }); stopInterception(); @@ -97,9 +101,9 @@ describe('incremental-dom-aop', function() { describe('elementOpenStart/elementOpenEnd', function() { it('should intercept elementOpen from elementOpenEnd calls with specified function', function() { - var fn = sinon.stub(); + let fn = sinon.stub(); startInterception({ - elementOpen: fn + elementOpen: fn, }); IncrementalDOM.elementOpenStart('div', 'key', 'statics'); @@ -117,9 +121,9 @@ describe('incremental-dom-aop', function() { }); it('should stop intercepting elementOpen from elementOpenEnd calls', function() { - var fn = sinon.stub(); + let fn = sinon.stub(); startInterception({ - elementOpen: fn + elementOpen: fn, }); stopInterception(); @@ -134,9 +138,9 @@ describe('incremental-dom-aop', function() { describe('text', function() { it('should intercept "text" calls with specified function', function() { - var fn = sinon.stub(); + let fn = sinon.stub(); startInterception({ - text: fn + text: fn, }); IncrementalDOM.text('foo'); @@ -145,9 +149,9 @@ describe('incremental-dom-aop', function() { }); it('should stop intercepting "text" calls', function() { - var fn = sinon.stub(); + let fn = sinon.stub(); startInterception({ - text: fn + text: fn, }); stopInterception(); @@ -158,13 +162,17 @@ describe('incremental-dom-aop', function() { describe('attributes', function() { it('should intercept attribute calls with specified function', function() { - var fn = sinon.stub(); + let fn = sinon.stub(); startInterception({ - attributes: fn + attributes: fn, }); - var element = document.createElement('div'); - IncrementalDOM.attributes[IncrementalDOM.symbols.default](element, 'name', 'value'); + let element = document.createElement('div'); + IncrementalDOM.attributes[IncrementalDOM.symbols.default]( + element, + 'name', + 'value' + ); assert.strictEqual(1, fn.callCount); assert.ok(core.isElement(fn.args[0][0])); @@ -173,13 +181,17 @@ describe('incremental-dom-aop', function() { }); it('should stop intercepting attribute calls', function() { - var fn = sinon.stub(); + let fn = sinon.stub(); startInterception({ - attributes: fn + attributes: fn, }); stopInterception(); - IncrementalDOM.attributes[IncrementalDOM.symbols.default](element, 'name', 'value'); + IncrementalDOM.attributes[IncrementalDOM.symbols.default]( + element, + 'name', + 'value' + ); assert.strictEqual(0, fn.callCount); }); }); @@ -190,13 +202,13 @@ describe('incremental-dom-aop', function() { }); it('should use last registered function for intercepting', function() { - var fn = sinon.stub(); + let fn = sinon.stub(); startInterception({ - elementOpen: fn + elementOpen: fn, }); - var fn2 = sinon.stub(); + let fn2 = sinon.stub(); startInterception({ - elementOpen: fn2 + elementOpen: fn2, }); IncrementalDOM.elementOpen('div'); @@ -205,13 +217,13 @@ describe('incremental-dom-aop', function() { }); it('should revert to previous registered function when stopping interception', function() { - var fn = sinon.stub(); + let fn = sinon.stub(); startInterception({ - elementOpen: fn + elementOpen: fn, }); - var fn2 = sinon.stub(); + let fn2 = sinon.stub(); startInterception({ - elementOpen: fn2 + elementOpen: fn2, }); stopInterception(); diff --git a/packages/metal-incremental-dom/test/render/attributes.js b/packages/metal-incremental-dom/test/render/attributes.js index 7a7bc536..ca67ad53 100644 --- a/packages/metal-incremental-dom/test/render/attributes.js +++ b/packages/metal-incremental-dom/test/render/attributes.js @@ -1,7 +1,10 @@ 'use strict'; import {isFunction} from 'metal'; -import { applyAttribute, convertListenerNamesToFns } from '../../src/render/attributes'; +import { + applyAttribute, + convertListenerNamesToFns, +} from '../../src/render/attributes'; import dom from 'metal-dom'; import Component from 'metal-component'; @@ -52,13 +55,12 @@ describe('attributes', function() { describe('listeners', function() { it('should register the method name inside the listener', function() { - class TestComponent extends Component { - } + class TestComponent extends Component {} TestComponent.prototype.handleClick = function() {}; component = new TestComponent(); let config = { - 'data-onclick': 'handleClick' + 'data-onclick': 'handleClick', }; convertListenerNamesToFns(component, config); @@ -66,8 +68,7 @@ describe('attributes', function() { }); it('should attach listeners functions passed to "data-on" attributes', function() { - class TestComponent extends Component { - } + class TestComponent extends Component {} component = new TestComponent(); const element = document.createElement('div'); @@ -81,8 +82,7 @@ describe('attributes', function() { }); it('should attach listeners functions passed to "on" attributes', function() { - class TestComponent extends Component { - } + class TestComponent extends Component {} component = new TestComponent(); const element = document.createElement('div'); @@ -96,8 +96,7 @@ describe('attributes', function() { }); it('should not set attribute for listener references on elements', function() { - class TestComponent extends Component { - } + class TestComponent extends Component {} component = new TestComponent(); const element = document.createElement('div'); @@ -119,11 +118,10 @@ describe('attributes', function() { dom.registerCustomEvent('test-event', { delegate: true, handler: (callback, event) => callback(event), - originalEvent: 'click' + originalEvent: 'click', }); - class TestComponent extends Component { - } + class TestComponent extends Component {} component = new TestComponent(); const element = document.createElement('div'); @@ -139,11 +137,10 @@ describe('attributes', function() { dom.registerCustomEvent('test-event', { delegate: true, handler: (callback, event) => callback(event), - originalEvent: 'click' + originalEvent: 'click', }); - class TestComponent extends Component { - } + class TestComponent extends Component {} component = new TestComponent(); const element = document.createElement('div'); @@ -156,8 +153,7 @@ describe('attributes', function() { }); it('should remove unused inline listeners when attributes are removed', function() { - class TestComponent extends Component { - } + class TestComponent extends Component {} component = new TestComponent(); const element = document.createElement('div'); @@ -171,8 +167,7 @@ describe('attributes', function() { }); it('should replace inline listeners when attributes values change', function() { - class TestComponent extends Component { - } + class TestComponent extends Component {} TestComponent.prototype.handleClick = sinon.stub(); TestComponent.prototype.handleClick2 = sinon.stub(); component = new TestComponent(); diff --git a/packages/metal-isomorphic/test/fixtures/MyComponent.js b/packages/metal-isomorphic/test/fixtures/MyComponent.js index decce20d..e897c26f 100644 --- a/packages/metal-isomorphic/test/fixtures/MyComponent.js +++ b/packages/metal-isomorphic/test/fixtures/MyComponent.js @@ -3,15 +3,14 @@ import Soy from 'metal-soy'; import templates from './MyComponent.soy.js'; -class MyComponent extends Component { -} +class MyComponent extends Component {} MyComponent.STATE = { message: { - value: '' - } + value: '', + }, }; Soy.register(MyComponent, templates); -export default MyComponent; \ No newline at end of file +export default MyComponent; diff --git a/packages/metal-isomorphic/test/fixtures/MyJSXComponent.js b/packages/metal-isomorphic/test/fixtures/MyJSXComponent.js index 928702b2..28d13568 100644 --- a/packages/metal-isomorphic/test/fixtures/MyJSXComponent.js +++ b/packages/metal-isomorphic/test/fixtures/MyJSXComponent.js @@ -10,8 +10,8 @@ class MyJSXComponent extends JSXComponent { MyJSXComponent.PROPS = { message: { - value: '' - } + value: '', + }, }; -export default MyJSXComponent; \ No newline at end of file +export default MyJSXComponent; diff --git a/packages/metal-isomorphic/test/isomorphic.js b/packages/metal-isomorphic/test/isomorphic.js index 5ae3c923..23601213 100644 --- a/packages/metal-isomorphic/test/isomorphic.js +++ b/packages/metal-isomorphic/test/isomorphic.js @@ -1,12 +1,12 @@ import Component from 'metal-component'; import MyComponent from './fixtures/MyComponent'; import MyJSXComponent from './fixtures/MyJSXComponent'; -import { assert } from 'chai'; +import {assert} from 'chai'; describe('Isomorphic Rendering', () => { it('should render soy component to string', () => { const htmlString = Component.renderToString(MyComponent, { - message: 'Hello, Soy!' + message: 'Hello, Soy!', }); assert.equal(htmlString, '
Hello, Soy!
'); @@ -14,7 +14,7 @@ describe('Isomorphic Rendering', () => { it('should render jsx component to string', () => { const htmlString = Component.renderToString(MyJSXComponent, { - message: 'Hello, JSX!' + message: 'Hello, JSX!', }); assert.equal(htmlString, '
Hello, JSX!
'); diff --git a/packages/metal-jsx/src/DangerouslySetHTML.js b/packages/metal-jsx/src/DangerouslySetHTML.js index a29de329..f6836cd7 100644 --- a/packages/metal-jsx/src/DangerouslySetHTML.js +++ b/packages/metal-jsx/src/DangerouslySetHTML.js @@ -1,32 +1,32 @@ -'use strict'; +"use strict"; -import Component from './JSXComponent'; -import { Config } from 'metal-state'; +import Component from "./JSXComponent"; +import { Config } from "metal-state"; /** * JSXComponent that renders html passed in. * @class */ class DangerouslySetHTML extends Component { - /** - * @return {Component} - */ - render() { - const {content, tag} = this.props; + /** + * @return {Component} + */ + render() { + const { content, tag } = this.props; - IncrementalDOM.elementOpen(tag, null, null); + IncrementalDOM.elementOpen(tag, null, null); - const node = IncrementalDOM.elementClose(tag); + const node = IncrementalDOM.elementClose(tag); - node.innerHTML = content; + node.innerHTML = content; - return node; - } + return node; + } } DangerouslySetHTML.PROPS = { - content: Config.string(), - tag: Config.string().value('span'), + content: Config.string(), + tag: Config.string().value("span") }; export default DangerouslySetHTML; diff --git a/packages/metal-jsx/src/JSXComponent.js b/packages/metal-jsx/src/JSXComponent.js index 6c4cc840..1a2a7093 100644 --- a/packages/metal-jsx/src/JSXComponent.js +++ b/packages/metal-jsx/src/JSXComponent.js @@ -1,11 +1,11 @@ -'use strict'; +"use strict"; -import './iDOMHelpers'; -import { object } from 'metal'; -import Component from 'metal-component'; -import IncrementalDomRenderer from 'metal-incremental-dom'; -import JSXDataManager from './JSXDataManager'; -import JSXRenderer from './JSXRenderer'; +import "./iDOMHelpers"; +import { object } from "metal"; +import Component from "metal-component"; +import IncrementalDomRenderer from "metal-incremental-dom"; +import JSXDataManager from "./JSXDataManager"; +import JSXRenderer from "./JSXRenderer"; /** * A component that has built-in integration with JSX templates. Example: @@ -19,59 +19,65 @@ import JSXRenderer from './JSXRenderer'; * */ class JSXComponent extends Component { - /** - * Creates and renders the given function, which can either be a simple - * JSX function or a component constructor. - * @param {!function()} fnOrCtor Either be a simple jsx dom function or a - * component constructor. - * @param {Object=} opt_data Optional config data for the function. - * @param {Element=} opt_element Optional parent for the rendered content. - * @return {!Component} The rendered component's instance. - * @override - */ - static render(...args) { - return IncrementalDomRenderer.render(...args); - } + /** + * Creates and renders the given function, which can either be a simple + * JSX function or a component constructor. + * @param {!function()} fnOrCtor Either be a simple jsx dom function or a + * component constructor. + * @param {Object=} opt_data Optional config data for the function. + * @param {Element=} opt_element Optional parent for the rendered content. + * @return {!Component} The rendered component's instance. + * @override + */ + static render(...args) { + return IncrementalDomRenderer.render(...args); + } - /** - * Fires before state batch changes. Provides hook point for modifying - * state. - * @param {Event} event - * @protected - */ - handleStateWillChange_(event) { - if (event.type !== 'state') { - this.willReceiveProps(event.changes); - } - } + /** + * Fires before state batch changes. Provides hook point for modifying + * state. + * @param {Event} event + * @protected + */ + handleStateWillChange_(event) { + if (event.type !== "state") { + this.willReceiveProps(event.changes); + } + } - /** - * Returns props that are not used or declared in the component. - * @return {Object} Object containing props - */ - otherProps() { - const removeKeys = [...this.getDataManager().getPropsInstance(this).getStateKeys(), 'key', 'ref']; + /** + * Returns props that are not used or declared in the component. + * @return {Object} Object containing props + */ + otherProps() { + const removeKeys = [ + ...this.getDataManager() + .getPropsInstance(this) + .getStateKeys(), + "key", + "ref" + ]; - const retObj = object.mixin({}, this.props); + const retObj = object.mixin({}, this.props); - for (let i = 0; i < removeKeys.length; i++) { - const key = removeKeys[i]; + for (let i = 0; i < removeKeys.length; i++) { + const key = removeKeys[i]; - if (retObj.hasOwnProperty(key)) { - delete retObj[key]; - } - } + if (retObj.hasOwnProperty(key)) { + delete retObj[key]; + } + } - return retObj; - } + return retObj; + } - /** - * Lifecycle. Called when the component is about to receive new props. - * Provides a hook point for modifying state that can be used in the next - * rerender. - * @param {Object} changes Changes made to this.props - */ - willReceiveProps() {} + /** + * Lifecycle. Called when the component is about to receive new props. + * Provides a hook point for modifying state that can be used in the next + * rerender. + * @param {Object} changes Changes made to this.props + */ + willReceiveProps() {} } JSXComponent.DATA_MANAGER = JSXDataManager; diff --git a/packages/metal-jsx/src/JSXDataManager.js b/packages/metal-jsx/src/JSXDataManager.js index 2cdd1ef0..18be2f33 100644 --- a/packages/metal-jsx/src/JSXDataManager.js +++ b/packages/metal-jsx/src/JSXDataManager.js @@ -1,115 +1,117 @@ -'use strict'; +"use strict"; -import { getStaticProperty, object } from 'metal'; -import { ComponentDataManager } from 'metal-component'; -import State from 'metal-state'; +import { getStaticProperty, object } from "metal"; +import { ComponentDataManager } from "metal-component"; +import State from "metal-state"; class JSXDataManager extends ComponentDataManager.constructor { - /** - * Manually adds props that weren't configured via `PROPS`. - * @param {!Component} component - * @param {!State} props - * @param {!Object} data - * @protected - */ - addUnconfiguredProps_(component, props, data) { - let keys = Object.keys(data); - for (let i = 0; i < keys.length; i++) { - if (!props.hasStateKey(keys[i])) { - component.props[keys[i]] = data[keys[i]]; - } - } - } + /** + * Manually adds props that weren't configured via `PROPS`. + * @param {!Component} component + * @param {!State} props + * @param {!Object} data + * @protected + */ + addUnconfiguredProps_(component, props, data) { + let keys = Object.keys(data); + for (let i = 0; i < keys.length; i++) { + if (!props.hasStateKey(keys[i])) { + component.props[keys[i]] = data[keys[i]]; + } + } + } - /** - * Overrides the original method so that we can have two separate `State` - * instances: one responsible for `state` and another for `props`. - * @param {!Component} comp - * @param {!Object} config - * @protected - * @override - */ - createState_(comp, config) { - const ctor = comp.constructor; - comp.props = {}; - comp.state = {}; - const data = this.getManagerData(comp); + /** + * Overrides the original method so that we can have two separate `State` + * instances: one responsible for `state` and another for `props`. + * @param {!Component} comp + * @param {!Object} config + * @protected + * @override + */ + createState_(comp, config) { + const ctor = comp.constructor; + comp.props = {}; + comp.state = {}; + const data = this.getManagerData(comp); - data.props_ = new State(comp.getInitialConfig(), comp.props, comp); - data.props_.configState(object.mixin( - {}, - config, - getStaticProperty(ctor, 'PROPS', State.mergeState) - )); - this.addUnconfiguredProps_(comp, data.props_, comp.getInitialConfig()); + data.props_ = new State(comp.getInitialConfig(), comp.props, comp); + data.props_.configState( + object.mixin( + {}, + config, + getStaticProperty(ctor, "PROPS", State.mergeState) + ) + ); + this.addUnconfiguredProps_(comp, data.props_, comp.getInitialConfig()); - data.state_ = new State({}, comp.state, comp); - data.state_.setEventData({ - type: 'state' - }); - data.state_.configState(State.getStateStatic(ctor)); - } + data.state_ = new State({}, comp.state, comp); + data.state_.setEventData({ + type: "state" + }); + data.state_.configState(State.getStateStatic(ctor)); + } - /** - * @inheritDoc - */ - dispose(component) { - const data = this.getManagerData(component); - data.props_.dispose(); - ComponentDataManager.dispose.call(this, component); - } + /** + * @inheritDoc + */ + dispose(component) { + const data = this.getManagerData(component); + data.props_.dispose(); + ComponentDataManager.dispose.call(this, component); + } - /** - * Overrides the original method so we can get properties from `props` by - * default. - * @param {!Component} component - * @param {string} name - * @return {*} - * @override - */ - get(component, name) { - return this.getManagerData(component).props_.get(name); - } + /** + * Overrides the original method so we can get properties from `props` by + * default. + * @param {!Component} component + * @param {string} name + * @return {*} + * @override + */ + get(component, name) { + return this.getManagerData(component).props_.get(name); + } - /** - * Gets the `State` instance being used for "props". - * @param {!Component} component - * @return {!Object} - */ - getPropsInstance(component) { - return this.getManagerData(component).props_; - } + /** + * Gets the `State` instance being used for "props". + * @param {!Component} component + * @return {!Object} + */ + getPropsInstance(component) { + return this.getManagerData(component).props_; + } - /** - * Overrides the original method so we can enable "sync" methods just for - * `props`. - * @param {!Component} component - * @return {!Array} - * @override - */ - getSyncKeys(component) { - return this.getManagerData(component).props_.getStateKeys(); - } + /** + * Overrides the original method so we can enable "sync" methods just for + * `props`. + * @param {!Component} component + * @return {!Array} + * @override + */ + getSyncKeys(component) { + return this.getManagerData(component).props_.getStateKeys(); + } - /** - * Overrides the original method so we can replace values in `props`. - * @param {!Component} component - * @param {!Object} data - * @override - */ - replaceNonInternal(component, data) { - let prevProps; - if (component.propsChanged) { - prevProps = object.mixin({}, component.props); - } + /** + * Overrides the original method so we can replace values in `props`. + * @param {!Component} component + * @param {!Object} data + * @override + */ + replaceNonInternal(component, data) { + let prevProps; + if (component.propsChanged) { + prevProps = object.mixin({}, component.props); + } - const props = this.getManagerData(component).props_; - ComponentDataManager.replaceNonInternal.call(this, component, data, props); - this.addUnconfiguredProps_(component, props, data); - if (component.propsChanged) { - component.propsChanged(prevProps); - } - } + const props = this.getManagerData(component).props_; + ComponentDataManager.replaceNonInternal.call(this, component, data, props); + this.addUnconfiguredProps_(component, props, data); + if (component.propsChanged) { + component.propsChanged(prevProps); + } + } } export default new JSXDataManager(); diff --git a/packages/metal-jsx/src/JSXRenderer.js b/packages/metal-jsx/src/JSXRenderer.js index f3eb183b..19248b8f 100644 --- a/packages/metal-jsx/src/JSXRenderer.js +++ b/packages/metal-jsx/src/JSXRenderer.js @@ -1,110 +1,110 @@ -'use strict'; +"use strict"; -import { isDefAndNotNull } from 'metal'; -import IncrementalDomRenderer from 'metal-incremental-dom'; +import { isDefAndNotNull } from "metal"; +import IncrementalDomRenderer from "metal-incremental-dom"; -const COUNT_PROP = '__metalJsxCount'; -const INC_DOM_DATA = '__incrementalDOMData'; -const KEY_PREFIX = '_metal_jsx_'; +const COUNT_PROP = "__metalJsxCount"; +const INC_DOM_DATA = "__incrementalDOMData"; +const KEY_PREFIX = "_metal_jsx_"; /** * Renderer that handles JSX. */ class JSXRenderer extends IncrementalDomRenderer.constructor { - /** - * @inheritDoc - */ - buildShouldUpdateArgs(changes) { - return [changes.state, changes.props]; - } + /** + * @inheritDoc + */ + buildShouldUpdateArgs(changes) { + return [changes.state, changes.props]; + } - /** - * Called when generating a key for the next dom element to be created via - * incremental dom. Adds keys to elements that don't have one yet, according - * to their position in the parent. This helps use cases that use - * conditionally rendered elements, which is very common in JSX. - * @param {!Component} component - * @param {string} key - * @return {?string} - */ - generateKey(component, key) { - key = super.generateKey(component, key); - const comp = this.getPatchingComponent(); - const data = comp.getRenderer().getData(comp); - if (!isDefAndNotNull(key)) { - if (data.rootElementRendered) { - key = KEY_PREFIX + jsxRenderer_.incElementCount(); - } else if (comp.element && comp.element[INC_DOM_DATA]) { - key = comp.element[INC_DOM_DATA].key; - } - } - if (!data.rootElementRendered) { - data.rootElementRendered = true; - } - return key; - } + /** + * Called when generating a key for the next dom element to be created via + * incremental dom. Adds keys to elements that don't have one yet, according + * to their position in the parent. This helps use cases that use + * conditionally rendered elements, which is very common in JSX. + * @param {!Component} component + * @param {string} key + * @return {?string} + */ + generateKey(component, key) { + key = super.generateKey(component, key); + const comp = this.getPatchingComponent(); + const data = comp.getRenderer().getData(comp); + if (!isDefAndNotNull(key)) { + if (data.rootElementRendered) { + key = KEY_PREFIX + jsxRenderer_.incElementCount(); + } else if (comp.element && comp.element[INC_DOM_DATA]) { + key = comp.element[INC_DOM_DATA].key; + } + } + if (!data.rootElementRendered) { + data.rootElementRendered = true; + } + return key; + } - /** - * @inheritDoc - */ - handleNodeRendered(node) { - node[COUNT_PROP] = 0; - } + /** + * @inheritDoc + */ + handleNodeRendered(node) { + node[COUNT_PROP] = 0; + } - /** - * Increments the number of children in the current element. - */ - incElementCount() { - const node = IncrementalDOM.currentElement(); - node[COUNT_PROP] = (node[COUNT_PROP] || 0) + 1; - return node[COUNT_PROP]; - } + /** + * Increments the number of children in the current element. + */ + incElementCount() { + const node = IncrementalDOM.currentElement(); + node[COUNT_PROP] = (node[COUNT_PROP] || 0) + 1; + return node[COUNT_PROP]; + } - /** - * Overrides the original method from `IncrementalDomRenderer` so we can - * keep track of if the root element of the patched component has already - * been rendered or not. - * @param {!Component} component - * @override - */ - patch(component) { - this.getData(component).rootElementRendered = false; - super.patch(component); - } + /** + * Overrides the original method from `IncrementalDomRenderer` so we can + * keep track of if the root element of the patched component has already + * been rendered or not. + * @param {!Component} component + * @override + */ + patch(component) { + this.getData(component).rootElementRendered = false; + super.patch(component); + } - /** - * Overrides the original method from `IncrementalDomRenderer` to handle the - * case where developers return a child node directly from the "render" - * function. - * @param {!Component} component - * @override - */ - renderIncDom(component) { - if (component.render) { - iDOMHelpers.renderArbitrary(component.render()); - } else { - super.renderIncDom(component); - } - } + /** + * Overrides the original method from `IncrementalDomRenderer` to handle the + * case where developers return a child node directly from the "render" + * function. + * @param {!Component} component + * @override + */ + renderIncDom(component) { + if (component.render) { + iDOMHelpers.renderArbitrary(component.render()); + } else { + super.renderIncDom(component); + } + } - /** - * Skips the current child in the count (used when a conditional render - * decided not to render anything). - */ - skipChild() { - IncrementalDOM.elementVoid(jsxRenderer_.incElementCount); - } + /** + * Skips the current child in the count (used when a conditional render + * decided not to render anything). + */ + skipChild() { + IncrementalDOM.elementVoid(jsxRenderer_.incElementCount); + } - /** - * @inheritDoc - */ - skipRender() { - jsxRenderer_.skipChild(); - super.skipRender(); - } + /** + * @inheritDoc + */ + skipRender() { + jsxRenderer_.skipChild(); + super.skipRender(); + } } const jsxRenderer_ = new JSXRenderer(); -jsxRenderer_.RENDERER_NAME = 'jsx'; +jsxRenderer_.RENDERER_NAME = "jsx"; export default jsxRenderer_; diff --git a/packages/metal-jsx/src/all/jsx.js b/packages/metal-jsx/src/all/jsx.js index a267d2fb..f815b3df 100644 --- a/packages/metal-jsx/src/all/jsx.js +++ b/packages/metal-jsx/src/all/jsx.js @@ -1,8 +1,8 @@ -'use strict'; +"use strict"; -import { validators, Config } from 'metal-state'; -import DangerouslySetHTML from '../DangerouslySetHTML'; -import JSXComponent from '../JSXComponent'; +import { validators, Config } from "metal-state"; +import DangerouslySetHTML from "../DangerouslySetHTML"; +import JSXComponent from "../JSXComponent"; export default JSXComponent; export { DangerouslySetHTML, validators, Config, JSXComponent }; diff --git a/packages/metal-jsx/src/iDOMHelpers.js b/packages/metal-jsx/src/iDOMHelpers.js index f931e890..021ecba4 100644 --- a/packages/metal-jsx/src/iDOMHelpers.js +++ b/packages/metal-jsx/src/iDOMHelpers.js @@ -1,7 +1,7 @@ -'use strict'; +"use strict"; -import IncrementalDomRenderer from 'metal-incremental-dom'; -import JSXRenderer from './JSXRenderer'; +import IncrementalDomRenderer from "metal-incremental-dom"; +import JSXRenderer from "./JSXRenderer"; /** * These helpers are all from "babel-plugin-incremental-dom". See its README @@ -9,49 +9,57 @@ import JSXRenderer from './JSXRenderer'; * https://github.com/jridgewell/babel-plugin-incremental-dom#runtime */ -const scope = (typeof exports !== 'undefined' && typeof global !== 'undefined') ? global : window; +const scope = + typeof exports !== "undefined" && typeof global !== "undefined" + ? global + : window; scope.iDOMHelpers = scope.iDOMHelpers || {}; scope.iDOMHelpers.attr = function(value, attrName) { - IncrementalDOM.attr(attrName, value); + IncrementalDOM.attr(attrName, value); }; scope.iDOMHelpers.forOwn = function(object, iterator) { - const hasOwn = Object.prototype.hasOwnProperty; - for (let prop in object) { - if (hasOwn.call(object, prop)) { - iterator(object[prop], prop); - } - } + const hasOwn = Object.prototype.hasOwnProperty; + for (let prop in object) { + if (hasOwn.call(object, prop)) { + iterator(object[prop], prop); + } + } }; scope.iDOMHelpers.jsxWrapper = function(elementClosure, args) { - const wrapper = args ? function() { - return elementClosure.apply(this, args); - } : elementClosure; - wrapper.__jsxDOMWrapper = true; - return wrapper; + const wrapper = args + ? function() { + return elementClosure.apply(this, args); + } + : elementClosure; + wrapper.__jsxDOMWrapper = true; + return wrapper; }; scope.iDOMHelpers.renderArbitrary = function(child) { - const type = typeof child; - if (type === 'number' || (type === 'string' || child && child instanceof String)) { - IncrementalDOM.text(child); - } else if (type === 'function' && child.__jsxDOMWrapper) { - child(); - } else if (Array.isArray(child)) { - child.forEach(scope.iDOMHelpers.renderArbitrary); - } else if (String(child) === '[object Object]') { - // Renders special incremental dom nodes in a special way :) - if (IncrementalDomRenderer.isIncDomNode(child)) { - IncrementalDomRenderer.renderChild(child); - } else { - scope.iDOMHelpers.forOwn(child, scope.iDOMHelpers.renderArbitrary); - } - } else if (!child) { - JSXRenderer.skipChild(); - } + const type = typeof child; + if ( + type === "number" || + (type === "string" || (child && child instanceof String)) + ) { + IncrementalDOM.text(child); + } else if (type === "function" && child.__jsxDOMWrapper) { + child(); + } else if (Array.isArray(child)) { + child.forEach(scope.iDOMHelpers.renderArbitrary); + } else if (String(child) === "[object Object]") { + // Renders special incremental dom nodes in a special way :) + if (IncrementalDomRenderer.isIncDomNode(child)) { + IncrementalDomRenderer.renderChild(child); + } else { + scope.iDOMHelpers.forOwn(child, scope.iDOMHelpers.renderArbitrary); + } + } else if (!child) { + JSXRenderer.skipChild(); + } }; export default scope.iDOMHelpers; diff --git a/packages/metal-jsx/test/DangerouslySetHTML.js b/packages/metal-jsx/test/DangerouslySetHTML.js index 64d78f7e..38493932 100644 --- a/packages/metal-jsx/test/DangerouslySetHTML.js +++ b/packages/metal-jsx/test/DangerouslySetHTML.js @@ -1,48 +1,48 @@ -'use strict'; - -import DangerouslySetHTML from '../src/DangerouslySetHTML'; -import JSXComponent from '../src/JSXComponent'; - -describe('JSXComponent', function() { - var component; - - afterEach(function() { - if (component) { - component.dispose(); - } - }); - - it('should render', function() { - component = new DangerouslySetHTML(); - assert.strictEqual('SPAN', component.element.tagName); - }); - - it('should render with custom tag', function() { - component = new DangerouslySetHTML({tag: 'div'}); - assert.strictEqual('DIV', component.element.tagName); - }); - - it('should render with html content', function() { - var content = '

hello

world
'; - - component = new DangerouslySetHTML({content: content}); - assert.strictEqual(content, component.element.innerHTML); - }); - - it('should render inside of another component', function() { - var content = '

hello

world
'; - - class TestComponent extends JSXComponent { - render() { - return ( -
- -
- ); - } - } - - component = new TestComponent(); - assert.strictEqual(content, component.refs.inner.element.innerHTML); - }); +"use strict"; + +import DangerouslySetHTML from "../src/DangerouslySetHTML"; +import JSXComponent from "../src/JSXComponent"; + +describe("JSXComponent", function() { + var component; + + afterEach(function() { + if (component) { + component.dispose(); + } + }); + + it("should render", function() { + component = new DangerouslySetHTML(); + assert.strictEqual("SPAN", component.element.tagName); + }); + + it("should render with custom tag", function() { + component = new DangerouslySetHTML({ tag: "div" }); + assert.strictEqual("DIV", component.element.tagName); + }); + + it("should render with html content", function() { + var content = "

hello

world
"; + + component = new DangerouslySetHTML({ content: content }); + assert.strictEqual(content, component.element.innerHTML); + }); + + it("should render inside of another component", function() { + var content = "

hello

world
"; + + class TestComponent extends JSXComponent { + render() { + return ( +
+ +
+ ); + } + } + + component = new TestComponent(); + assert.strictEqual(content, component.refs.inner.element.innerHTML); + }); }); diff --git a/packages/metal-jsx/test/JSXComponent.js b/packages/metal-jsx/test/JSXComponent.js index 26ede454..7967b47a 100644 --- a/packages/metal-jsx/test/JSXComponent.js +++ b/packages/metal-jsx/test/JSXComponent.js @@ -1,661 +1,680 @@ -'use strict'; - -import { async } from 'metal'; -import dom from 'metal-dom'; -import JSXComponent from '../src/JSXComponent'; - -describe('JSXComponent', function() { - var component; - - afterEach(function() { - if (component) { - component.dispose(); - } - }); - - it('should render contents from component\'s "render" function', function() { - class TestComponent extends JSXComponent { - render() { - return
Hello World
; - } - } - - component = new TestComponent(); - assert.strictEqual('DIV', component.element.tagName); - assert.ok(dom.hasClass(component.element, 'test')); - assert.strictEqual('Hello World', component.element.textContent); - }); - - it('should not throw error if no jsx function is implemented', function() { - class TestComponent extends JSXComponent { - } - - component = new TestComponent(); - assert.strictEqual('DIV', component.element.tagName); - assert.strictEqual('', component.element.textContent); - }); - - it('should attach inline listeners', function() { - class TestComponent extends JSXComponent { - render() { - return
- -
; - } - } - TestComponent.prototype.handleClick = sinon.stub(); - - component = new TestComponent(); - dom.triggerEvent(component.element.childNodes[0], 'click'); - assert.strictEqual(1, component.handleClick.callCount); - }); - - it('should create and render sub components', function() { - class ChildComponent extends JSXComponent { - render() { - return
Child
; - } - } - - class TestComponent extends JSXComponent { - render() { - return
- -
; - } - } - - component = new TestComponent(); - var child = component.components.child; - assert.ok(child); - assert.strictEqual('DIV', child.element.tagName); - assert.ok(dom.hasClass(child.element, 'child')); - assert.strictEqual('Child', child.element.textContent); - assert.strictEqual(child.element, component.element.childNodes[0]); - }); - - it('should receive props from parent components', function() { - class ChildComponent extends JSXComponent { - render() { - return
{this.props.foo}
; - } - } - - class TestComponent extends JSXComponent { - render() { - return
- -
; - } - } - - component = new TestComponent(); - var child = component.components.child; - assert.strictEqual('Foo', child.element.textContent); - }); - - describe('Children', function() { - it('should be able to render children through props', function() { - class ChildComponent extends JSXComponent { - render() { - return
{this.props.children}
; - } - } - - class TestComponent extends JSXComponent { - render() { - return Hello World; - } - } - - component = new TestComponent(); - assert.ok(component.components.child); - assert.strictEqual(component.components.child.element, component.element); - assert.strictEqual('DIV', component.element.tagName); - assert.strictEqual('Hello World', component.element.textContent); - }); - - it('should not throw error if trying to render empty children', function() { - class TestComponent extends JSXComponent { - render() { - return
{this.props.children}
; - } - } - - component = new TestComponent(); - assert.strictEqual(0, component.element.childNodes.length); - assert.ok(component.props.children); - assert.strictEqual(0, component.props.children.length); - }); - - it('should be able to render only some of the received children', function() { - class ChildComponent extends JSXComponent { - render() { - return
- {this.props.children[1]} -
; - } - } - - class TestComponent extends JSXComponent { - render() { - return ( -
- - Children Test - Children Test 2 - Children Test 3 - -
- ); - } - } - - component = new TestComponent(); - var child = component.components.child; - assert.strictEqual(1, child.element.childNodes.length); - assert.strictEqual('SPAN', child.element.childNodes[0].tagName); - assert.strictEqual('Children Test 2', child.element.textContent); - }); - - it('should be able to get the data passed to children', function() { - class ChildComponent extends JSXComponent { - render() { - return
- {this.props.children[0].config.foo} - {this.props.children} -
; - } - } - - class TestComponent extends JSXComponent { - render() { - return ( -
- - Children Test - -
- ); - } - } - - component = new TestComponent(); - var child = component.components.child; - assert.strictEqual(2, child.element.childNodes.length); - assert.strictEqual('foo', child.element.childNodes[0].textContent); - assert.strictEqual('SPAN', child.element.childNodes[1].tagName); - assert.strictEqual('Children Test', child.element.childNodes[1].textContent); - }); - }); - - describe('JSXComponent.render', function() { - it('should create and render components via "JSXComponent.render"', function() { - class TestComponent extends JSXComponent { - render() { - return
{this.props.foo}
; - } - } - - var container = document.createElement('div'); - component = JSXComponent.render( - TestComponent, - { - foo: 'fooValue' - }, - container - ); - - assert.ok(component instanceof TestComponent); - assert.strictEqual(1, container.childNodes.length); - assert.strictEqual(component.element, container.childNodes[0]); - assert.strictEqual('DIV', component.element.tagName); - assert.ok(dom.hasClass(component.element, 'test')); - assert.strictEqual('fooValue', component.element.textContent); - }); - - it('should render componentless functions via "JSXComponent.render"', function() { - var fn = props => { - return
{props.foo}
; - }; - var container = document.createElement('div'); - JSXComponent.render( - fn, - { - foo: 'fooValue' - }, - container - ); - - assert.strictEqual(1, container.childNodes.length); - assert.strictEqual('DIV', container.childNodes[0].tagName); - assert.ok(dom.hasClass(container.childNodes[0], 'test')); - assert.strictEqual('fooValue', container.childNodes[0].textContent); - }); - - it('should render jsx element via "JSXComponent.render"', function() { - var container = document.createElement('div'); - JSXComponent.render( -
foo
, - container - ); - - assert.strictEqual(1, container.childNodes.length); - assert.strictEqual('DIV', container.childNodes[0].tagName); - assert.ok(dom.hasClass(container.childNodes[0], 'test')); - assert.strictEqual('foo', container.childNodes[0].textContent); - }); - }); - - describe('STATE and PROPS', function() { - it('should allow specifying configuration for props', function() { - class TestComponent extends JSXComponent { - } - TestComponent.PROPS = { - foo: { - value: 'defaultFoo' - } - }; - - component = new TestComponent(); - assert.strictEqual('defaultFoo', component.props.foo); - }); - - it('should allow specifying internal state', function() { - class TestComponent extends JSXComponent { - } - TestComponent.STATE = { - foo: { - value: 'defaultFoo' - } - }; - - component = new TestComponent(); - assert.strictEqual('defaultFoo', component.state.foo); - }); - - it('should call "propsChanged" when new props are passed', function(done) { - class ChildComponent extends JSXComponent { - render() { - return
{this.props.foo}
; - } - } - ChildComponent.prototype.propsChanged = sinon.stub(); - - class TestComponent extends JSXComponent { - render() { - return ; - } - } - TestComponent.STATE = { - foo: { - value: 'foo' - } - }; - - component = new TestComponent(); - var child = component.components.child; - - component.state.foo = 'foo2'; - component.once('rendered', function() { - assert.strictEqual('foo2', child.element.textContent); - assert.strictEqual(1, child.propsChanged.callCount); - - var prevProps = child.propsChanged.args[0][0]; - assert.strictEqual('foo', prevProps.foo); - assert.strictEqual('foo2', child.props.foo); - done(); - }); - }); - - it('should allow changes to state in "willReceiveProps" without triggering multiple renders', function(done) { - const renderStub = sinon.stub(); - let count = 0; - - class TestComponent extends JSXComponent { - render() { - renderStub(); - - return
{this.props.bar}:{this.state.foo}
; - } - - willReceiveProps(data) { - this.state.foo = 'foo' + count; - - count++; - } - } - TestComponent.STATE = { - foo: { - value: 'foo' - } - }; - TestComponent.PROPS = { - bar: { - value: 'bar' - } - }; - - component = new TestComponent(); - - component.props.bar = 'bar2'; - - component.once('rendered', function() { - assert.equal(component.element.innerHTML, 'bar2:foo0'); - - async.nextTick(function() { - component.props.bar = 'bar3'; - component.once('rendered', function() { - assert.equal(component.element.innerHTML, 'bar3:foo1'); - assert.equal(renderStub.callCount, 3); - - done(); - }); - }); - }); - }); - - it('should pass changed props data to "willReceiveProps" method', function(done) { - class TestComponent extends JSXComponent { - } - TestComponent.prototype.willReceiveProps = sinon.stub(); - TestComponent.PROPS = { - foo: { - value: 'foo' - } - }; - - component = new TestComponent(); - - component.props.foo = 'foo2'; - - async.nextTick(function() { - assert.equal(component.willReceiveProps.callCount, 1); - assert.deepEqual(component.willReceiveProps.args[0][0], { - foo: { - key: 'foo', - newVal: 'foo2', - prevVal: 'foo' - } - }); - - done(); - }); - }); - - it('component.element and child.element should be the same', function() { - class ChildComponent extends JSXComponent { - render() { - return
; - } - } - - class ParentComponent extends JSXComponent { - render() { - return ; - } - } - - component = new ParentComponent(); - var child = component.refs.child; - assert.strictEqual(component.element, child.element); - }); - - it('should receive elementClasses from parent component', function() { - class ChildComponent extends JSXComponent { - render() { - return
; - } - } - - class ParentComponent extends JSXComponent { - render() { - return ; - } - } - - component = new ParentComponent({elementClasses: 'foo'}); - assert.ok(dom.hasClass(component.element, 'child')); - assert.ok(dom.hasClass(component.element, 'foo')); - }); - - it('should not apply undefined class', function() { - class ChildComponent extends JSXComponent { - render() { - return
; - } - } - - class ParentComponent extends JSXComponent { - render() { - return ; - } - } - - component = new ParentComponent({elementClasses: undefined}); - assert.strictEqual(component.element.className, 'child'); - }); - - it('should not create duplicate classes', function() { - class ChildComponent extends JSXComponent { - render() { - return
; - } - } - - class ParentComponent extends JSXComponent { - render() { - return ; - } - } - - component = new ParentComponent({elementClasses: 'child'}); - assert.strictEqual(component.element.className, 'child'); - }); - - it('should pass elementClasses through higher order components', function() { - class GrandChildComponent extends JSXComponent { - render() { - return
; - } - } - - class ChildComponent extends JSXComponent { - render() { - return ; - } - } - - class ParentComponent extends JSXComponent { - render() { - return ; - } - } - - component = new ParentComponent({elementClasses: 'foo'}); - assert.ok(dom.hasClass(component.element, 'child')); - assert.ok(dom.hasClass(component.element, 'parent')); - assert.ok(dom.hasClass(component.element, 'grandchild')); - }); - }); - - describe('shouldUpdate', function() { - it('should not rerender after props change if shouldUpdate returns false', function(done) { - class TestComponent extends JSXComponent { - render() {} - - shouldUpdate() { - return false; - } - } - TestComponent.PROPS = { - foo: { - value: 'defaultFoo' - } - }; - component = new TestComponent(); - - sinon.stub(component, 'render'); - component.props.foo = 'foo'; - component.once('stateChanged', function() { - assert.strictEqual(0, component.render.callCount); - done(); - }); - }); - - it('should not rerender after state change if shouldUpdate returns false', function(done) { - class TestComponent extends JSXComponent { - render() {} - - shouldUpdate() { - return false; - } - } - TestComponent.STATE = { - foo: { - value: 'defaultFoo' - } - }; - component = new TestComponent(); - - sinon.stub(component, 'render'); - component.state.foo = 'foo'; - component.once('stateChanged', function() { - assert.strictEqual(0, component.render.callCount); - done(); - }); - }); - }); - - describe('SYNC_UPDATES', function() { - it('should update parent component with SYNC_UPDATES during child render', function(done) { - class ChildComponent extends JSXComponent { - attached() { - this.props.updateFoo('Child'); - } - - render() { - return
Child
; - } - } - - class TestComponent extends JSXComponent { - render() { - return
- {this.state.foo} - {this.state.show ? this.state.foo += newFoo} /> : null} -
; - } - } - TestComponent.STATE = { - foo: { - value: 'foo' - }, - show: { - } - }; - TestComponent.SYNC_UPDATES = true; - - component = new TestComponent(); - assert.equal('foo', component.element.textContent); - - component.state.show = true; - component.once('stateSynced', function() { - assert.equal('fooChild', component.element.childNodes[0].textContent); - done(); - }); - }); - - it('should update parent component with SYNC_UPDATES during root child render', function(done) { - class ChildComponent extends JSXComponent { - attached() { - this.props.updateFoo('Child'); - } - - render() { - return
{this.props.foo}
; - } - } - - class TestComponent extends JSXComponent { - render() { - return this.state.show ? - this.state.foo += newFoo} /> : - null; - } - } - TestComponent.STATE = { - foo: { - value: 'foo' - }, - show: { - } - }; - TestComponent.SYNC_UPDATES = true; - - component = new TestComponent(); - - component.state.show = true; - component.once('stateSynced', function() { - assert.equal('fooChild', component.element.childNodes[0].textContent); - done(); - }); - }); - }); - - describe('otherProps', function() { - var component; - - afterEach(function() { - if (component) { - component.dispose(); - } - }); - - it('should return object', function() { - class TestComponent extends JSXComponent { - render() { - return
; - } - } - - component = new TestComponent(); - - assert.deepEqual(component.otherProps(), {}); - }); - - it('should pass through unspecified props', function() { - class TestComponent extends JSXComponent { - render() { - return
; - } - } - - TestComponent.PROPS = { - foo: {}, - }; - - component = new TestComponent({baz: 'qux', foo: 'bar'}); - - assert.deepEqual( - component.otherProps(), - {baz: 'qux'} - ); - }); - - it('should ignore key and ref', function() { - class TestComponent extends JSXComponent { - render() { - return
; - } - } - - component = new TestComponent({key: 'bar', ref: 'qux'}); - - assert.deepEqual( - component.otherProps(), - {} - ); - }); - }); +"use strict"; + +import { async } from "metal"; +import dom from "metal-dom"; +import JSXComponent from "../src/JSXComponent"; + +describe("JSXComponent", function() { + var component; + + afterEach(function() { + if (component) { + component.dispose(); + } + }); + + it('should render contents from component\'s "render" function', function() { + class TestComponent extends JSXComponent { + render() { + return
Hello World
; + } + } + + component = new TestComponent(); + assert.strictEqual("DIV", component.element.tagName); + assert.ok(dom.hasClass(component.element, "test")); + assert.strictEqual("Hello World", component.element.textContent); + }); + + it("should not throw error if no jsx function is implemented", function() { + class TestComponent extends JSXComponent {} + + component = new TestComponent(); + assert.strictEqual("DIV", component.element.tagName); + assert.strictEqual("", component.element.textContent); + }); + + it("should attach inline listeners", function() { + class TestComponent extends JSXComponent { + render() { + return ( +
+
+ ); + } + } + TestComponent.prototype.handleClick = sinon.stub(); + + component = new TestComponent(); + dom.triggerEvent(component.element.childNodes[0], "click"); + assert.strictEqual(1, component.handleClick.callCount); + }); + + it("should create and render sub components", function() { + class ChildComponent extends JSXComponent { + render() { + return
Child
; + } + } + + class TestComponent extends JSXComponent { + render() { + return ( +
+ +
+ ); + } + } + + component = new TestComponent(); + var child = component.components.child; + assert.ok(child); + assert.strictEqual("DIV", child.element.tagName); + assert.ok(dom.hasClass(child.element, "child")); + assert.strictEqual("Child", child.element.textContent); + assert.strictEqual(child.element, component.element.childNodes[0]); + }); + + it("should receive props from parent components", function() { + class ChildComponent extends JSXComponent { + render() { + return
{this.props.foo}
; + } + } + + class TestComponent extends JSXComponent { + render() { + return ( +
+ +
+ ); + } + } + + component = new TestComponent(); + var child = component.components.child; + assert.strictEqual("Foo", child.element.textContent); + }); + + describe("Children", function() { + it("should be able to render children through props", function() { + class ChildComponent extends JSXComponent { + render() { + return
{this.props.children}
; + } + } + + class TestComponent extends JSXComponent { + render() { + return Hello World; + } + } + + component = new TestComponent(); + assert.ok(component.components.child); + assert.strictEqual(component.components.child.element, component.element); + assert.strictEqual("DIV", component.element.tagName); + assert.strictEqual("Hello World", component.element.textContent); + }); + + it("should not throw error if trying to render empty children", function() { + class TestComponent extends JSXComponent { + render() { + return
{this.props.children}
; + } + } + + component = new TestComponent(); + assert.strictEqual(0, component.element.childNodes.length); + assert.ok(component.props.children); + assert.strictEqual(0, component.props.children.length); + }); + + it("should be able to render only some of the received children", function() { + class ChildComponent extends JSXComponent { + render() { + return
{this.props.children[1]}
; + } + } + + class TestComponent extends JSXComponent { + render() { + return ( +
+ + Children Test + Children Test 2 + Children Test 3 + +
+ ); + } + } + + component = new TestComponent(); + var child = component.components.child; + assert.strictEqual(1, child.element.childNodes.length); + assert.strictEqual("SPAN", child.element.childNodes[0].tagName); + assert.strictEqual("Children Test 2", child.element.textContent); + }); + + it("should be able to get the data passed to children", function() { + class ChildComponent extends JSXComponent { + render() { + return ( +
+ {this.props.children[0].config.foo} + {this.props.children} +
+ ); + } + } + + class TestComponent extends JSXComponent { + render() { + return ( +
+ + Children Test + +
+ ); + } + } + + component = new TestComponent(); + var child = component.components.child; + assert.strictEqual(2, child.element.childNodes.length); + assert.strictEqual("foo", child.element.childNodes[0].textContent); + assert.strictEqual("SPAN", child.element.childNodes[1].tagName); + assert.strictEqual( + "Children Test", + child.element.childNodes[1].textContent + ); + }); + }); + + describe("JSXComponent.render", function() { + it('should create and render components via "JSXComponent.render"', function() { + class TestComponent extends JSXComponent { + render() { + return
{this.props.foo}
; + } + } + + var container = document.createElement("div"); + component = JSXComponent.render( + TestComponent, + { + foo: "fooValue" + }, + container + ); + + assert.ok(component instanceof TestComponent); + assert.strictEqual(1, container.childNodes.length); + assert.strictEqual(component.element, container.childNodes[0]); + assert.strictEqual("DIV", component.element.tagName); + assert.ok(dom.hasClass(component.element, "test")); + assert.strictEqual("fooValue", component.element.textContent); + }); + + it('should render componentless functions via "JSXComponent.render"', function() { + var fn = props => { + return
{props.foo}
; + }; + var container = document.createElement("div"); + JSXComponent.render( + fn, + { + foo: "fooValue" + }, + container + ); + + assert.strictEqual(1, container.childNodes.length); + assert.strictEqual("DIV", container.childNodes[0].tagName); + assert.ok(dom.hasClass(container.childNodes[0], "test")); + assert.strictEqual("fooValue", container.childNodes[0].textContent); + }); + + it('should render jsx element via "JSXComponent.render"', function() { + var container = document.createElement("div"); + JSXComponent.render(
foo
, container); + + assert.strictEqual(1, container.childNodes.length); + assert.strictEqual("DIV", container.childNodes[0].tagName); + assert.ok(dom.hasClass(container.childNodes[0], "test")); + assert.strictEqual("foo", container.childNodes[0].textContent); + }); + }); + + describe("STATE and PROPS", function() { + it("should allow specifying configuration for props", function() { + class TestComponent extends JSXComponent {} + TestComponent.PROPS = { + foo: { + value: "defaultFoo" + } + }; + + component = new TestComponent(); + assert.strictEqual("defaultFoo", component.props.foo); + }); + + it("should allow specifying internal state", function() { + class TestComponent extends JSXComponent {} + TestComponent.STATE = { + foo: { + value: "defaultFoo" + } + }; + + component = new TestComponent(); + assert.strictEqual("defaultFoo", component.state.foo); + }); + + it('should call "propsChanged" when new props are passed', function(done) { + class ChildComponent extends JSXComponent { + render() { + return
{this.props.foo}
; + } + } + ChildComponent.prototype.propsChanged = sinon.stub(); + + class TestComponent extends JSXComponent { + render() { + return ; + } + } + TestComponent.STATE = { + foo: { + value: "foo" + } + }; + + component = new TestComponent(); + var child = component.components.child; + + component.state.foo = "foo2"; + component.once("rendered", function() { + assert.strictEqual("foo2", child.element.textContent); + assert.strictEqual(1, child.propsChanged.callCount); + + var prevProps = child.propsChanged.args[0][0]; + assert.strictEqual("foo", prevProps.foo); + assert.strictEqual("foo2", child.props.foo); + done(); + }); + }); + + it('should allow changes to state in "willReceiveProps" without triggering multiple renders', function( + done + ) { + const renderStub = sinon.stub(); + let count = 0; + + class TestComponent extends JSXComponent { + render() { + renderStub(); + + return ( +
+ {this.props.bar}:{this.state.foo} +
+ ); + } + + willReceiveProps(data) { + this.state.foo = "foo" + count; + + count++; + } + } + TestComponent.STATE = { + foo: { + value: "foo" + } + }; + TestComponent.PROPS = { + bar: { + value: "bar" + } + }; + + component = new TestComponent(); + + component.props.bar = "bar2"; + + component.once("rendered", function() { + assert.equal(component.element.innerHTML, "bar2:foo0"); + + async.nextTick(function() { + component.props.bar = "bar3"; + component.once("rendered", function() { + assert.equal(component.element.innerHTML, "bar3:foo1"); + assert.equal(renderStub.callCount, 3); + + done(); + }); + }); + }); + }); + + it('should pass changed props data to "willReceiveProps" method', function( + done + ) { + class TestComponent extends JSXComponent {} + TestComponent.prototype.willReceiveProps = sinon.stub(); + TestComponent.PROPS = { + foo: { + value: "foo" + } + }; + + component = new TestComponent(); + + component.props.foo = "foo2"; + + async.nextTick(function() { + assert.equal(component.willReceiveProps.callCount, 1); + assert.deepEqual(component.willReceiveProps.args[0][0], { + foo: { + key: "foo", + newVal: "foo2", + prevVal: "foo" + } + }); + + done(); + }); + }); + + it("component.element and child.element should be the same", function() { + class ChildComponent extends JSXComponent { + render() { + return
; + } + } + + class ParentComponent extends JSXComponent { + render() { + return ; + } + } + + component = new ParentComponent(); + var child = component.refs.child; + assert.strictEqual(component.element, child.element); + }); + + it("should receive elementClasses from parent component", function() { + class ChildComponent extends JSXComponent { + render() { + return
; + } + } + + class ParentComponent extends JSXComponent { + render() { + return ; + } + } + + component = new ParentComponent({ elementClasses: "foo" }); + assert.ok(dom.hasClass(component.element, "child")); + assert.ok(dom.hasClass(component.element, "foo")); + }); + + it("should not apply undefined class", function() { + class ChildComponent extends JSXComponent { + render() { + return
; + } + } + + class ParentComponent extends JSXComponent { + render() { + return ; + } + } + + component = new ParentComponent({ elementClasses: undefined }); + assert.strictEqual(component.element.className, "child"); + }); + + it("should not create duplicate classes", function() { + class ChildComponent extends JSXComponent { + render() { + return
; + } + } + + class ParentComponent extends JSXComponent { + render() { + return ; + } + } + + component = new ParentComponent({ elementClasses: "child" }); + assert.strictEqual(component.element.className, "child"); + }); + + it("should pass elementClasses through higher order components", function() { + class GrandChildComponent extends JSXComponent { + render() { + return
; + } + } + + class ChildComponent extends JSXComponent { + render() { + return ; + } + } + + class ParentComponent extends JSXComponent { + render() { + return ; + } + } + + component = new ParentComponent({ elementClasses: "foo" }); + assert.ok(dom.hasClass(component.element, "child")); + assert.ok(dom.hasClass(component.element, "parent")); + assert.ok(dom.hasClass(component.element, "grandchild")); + }); + }); + + describe("shouldUpdate", function() { + it("should not rerender after props change if shouldUpdate returns false", function( + done + ) { + class TestComponent extends JSXComponent { + render() {} + + shouldUpdate() { + return false; + } + } + TestComponent.PROPS = { + foo: { + value: "defaultFoo" + } + }; + component = new TestComponent(); + + sinon.stub(component, "render"); + component.props.foo = "foo"; + component.once("stateChanged", function() { + assert.strictEqual(0, component.render.callCount); + done(); + }); + }); + + it("should not rerender after state change if shouldUpdate returns false", function( + done + ) { + class TestComponent extends JSXComponent { + render() {} + + shouldUpdate() { + return false; + } + } + TestComponent.STATE = { + foo: { + value: "defaultFoo" + } + }; + component = new TestComponent(); + + sinon.stub(component, "render"); + component.state.foo = "foo"; + component.once("stateChanged", function() { + assert.strictEqual(0, component.render.callCount); + done(); + }); + }); + }); + + describe("SYNC_UPDATES", function() { + it("should update parent component with SYNC_UPDATES during child render", function( + done + ) { + class ChildComponent extends JSXComponent { + attached() { + this.props.updateFoo("Child"); + } + + render() { + return
Child
; + } + } + + class TestComponent extends JSXComponent { + render() { + return ( +
+ {this.state.foo} + {this.state.show ? ( + (this.state.foo += newFoo)} + /> + ) : null} +
+ ); + } + } + TestComponent.STATE = { + foo: { + value: "foo" + }, + show: {} + }; + TestComponent.SYNC_UPDATES = true; + + component = new TestComponent(); + assert.equal("foo", component.element.textContent); + + component.state.show = true; + component.once("stateSynced", function() { + assert.equal("fooChild", component.element.childNodes[0].textContent); + done(); + }); + }); + + it("should update parent component with SYNC_UPDATES during root child render", function( + done + ) { + class ChildComponent extends JSXComponent { + attached() { + this.props.updateFoo("Child"); + } + + render() { + return
{this.props.foo}
; + } + } + + class TestComponent extends JSXComponent { + render() { + return this.state.show ? ( + (this.state.foo += newFoo)} + /> + ) : null; + } + } + TestComponent.STATE = { + foo: { + value: "foo" + }, + show: {} + }; + TestComponent.SYNC_UPDATES = true; + + component = new TestComponent(); + + component.state.show = true; + component.once("stateSynced", function() { + assert.equal("fooChild", component.element.childNodes[0].textContent); + done(); + }); + }); + }); + + describe("otherProps", function() { + var component; + + afterEach(function() { + if (component) { + component.dispose(); + } + }); + + it("should return object", function() { + class TestComponent extends JSXComponent { + render() { + return
; + } + } + + component = new TestComponent(); + + assert.deepEqual(component.otherProps(), {}); + }); + + it("should pass through unspecified props", function() { + class TestComponent extends JSXComponent { + render() { + return
; + } + } + + TestComponent.PROPS = { + foo: {} + }; + + component = new TestComponent({ baz: "qux", foo: "bar" }); + + assert.deepEqual(component.otherProps(), { baz: "qux" }); + }); + + it("should ignore key and ref", function() { + class TestComponent extends JSXComponent { + render() { + return
; + } + } + + component = new TestComponent({ key: "bar", ref: "qux" }); + + assert.deepEqual(component.otherProps(), {}); + }); + }); }); diff --git a/packages/metal-jsx/test/JSXDataManager.js b/packages/metal-jsx/test/JSXDataManager.js index d2b2465d..e780f5e0 100644 --- a/packages/metal-jsx/test/JSXDataManager.js +++ b/packages/metal-jsx/test/JSXDataManager.js @@ -1,394 +1,381 @@ -'use strict'; - -import Component from 'metal-component'; -import IncrementalDomRenderer from 'metal-incremental-dom'; -import JSXDataManager from '../src/JSXDataManager'; - -describe('JSXDataManager', function() { - var component; - var component2; - - afterEach(function() { - if (component) { - component.dispose(); - } - if (component2) { - component2.dispose(); - } - }); - - it('should create "props" and "state" objects in component', function() { - class TestComponent extends Component { - } - TestComponent.DATA_MANAGER = JSXDataManager; - - component = new TestComponent(); - assert.ok(component.state); - assert.ok(component.props); - }); - - describe('state', function() { - it('should add properties from STATE to `state` variable', function() { - class TestComponent extends Component { - } - TestComponent.DATA_MANAGER = JSXDataManager; - TestComponent.STATE = { - foo: { - value: 'defaultFoo' - } - }; - - component = new TestComponent(); - - assert.ok(!component.foo); - assert.ok(!component.props.foo); - assert.strictEqual('defaultFoo', component.state.foo); - }); - - it('should not use constructor values for properties in STATE', function() { - class TestComponent extends Component { - } - TestComponent.DATA_MANAGER = JSXDataManager; - TestComponent.STATE = { - foo: { - value: 'defaultFoo' - } - }; - - component = new TestComponent({ - foo: 'foo' - }); - assert.strictEqual('defaultFoo', component.state.foo); - }); - - it('should not include default component data in "state"', function() { - class TestComponent extends Component { - } - TestComponent.DATA_MANAGER = JSXDataManager; - - component = new TestComponent(); - assert.ok(!component.state.hasOwnProperty('elementClasses')); - assert.ok(!component.state.hasOwnProperty('events')); - assert.ok(!component.state.hasOwnProperty('visible')); - }); - - it('should keep state objects different between component instances', function() { - class TestComponent extends Component { - } - TestComponent.DATA_MANAGER = JSXDataManager; - TestComponent.STATE = { - foo: { - value: 'defaultFoo' - } - }; - - component = new TestComponent(); - component2 = new TestComponent(); - assert.notEqual(component.state, component2.state); - - component.state.foo = 'foo1'; - assert.equal('foo1', component.state.foo); - assert.equal('defaultFoo', component2.state.foo); - - component2.state.foo = 'foo2'; - assert.equal('foo1', component.state.foo); - assert.equal('foo2', component2.state.foo); - }); - - it('should run setState\'s callback after component is rerendered', function(done) { - class TestComponent extends Component { - render() {} - } - TestComponent.DATA_MANAGER = JSXDataManager; - TestComponent.RENDERER = IncrementalDomRenderer; - TestComponent.STATE = { - foo: { - value: 'defaultFoo' - } - }; - - component = new TestComponent(); - sinon.spy(component, 'render'); - - component.setState({ - foo: 'newFoo' - }, () => { - assert.strictEqual(1, component.render.callCount); - done(); - }); - }); - - it('should now allow changes to a component\'s props cause changes to another\s', function() { - class TestComponent extends Component { - render() {} - } - TestComponent.DATA_MANAGER = JSXDataManager; - TestComponent.RENDERER = IncrementalDomRenderer; - - component = new TestComponent(); - component2 = new TestComponent(); - - component.props.foo = 'foo'; - assert.equal('foo', component.props.foo); - assert.notEqual('foo', component2.props.foo); - }); - }); - - describe('props', function() { - it('should add properties from PROPS to `props` variable', function() { - class TestComponent extends Component { - } - TestComponent.DATA_MANAGER = JSXDataManager; - TestComponent.PROPS = { - foo: { - value: 'defaultFoo' - } - }; - - component = new TestComponent(); - - assert.ok(!component.foo); - assert.ok(!component.state.foo); - assert.strictEqual('defaultFoo', component.props.foo); - }); - - it('should use constructor values for properties in PROPS', function() { - class TestComponent extends Component { - } - TestComponent.DATA_MANAGER = JSXDataManager; - TestComponent.PROPS = { - foo: { - value: 'defaultFoo' - } - }; - - component = new TestComponent({ - foo: 'foo' - }); - assert.strictEqual('foo', component.props.foo); - }); - - it('should use default prop value when "undefined" is passed as initial value', function() { - class TestComponent extends Component { - } - TestComponent.DATA_MANAGER = JSXDataManager; - TestComponent.PROPS = { - foo: { - value: 'defaultFoo' - } - }; - - component = new TestComponent({ - foo: undefined - }); - assert.strictEqual('defaultFoo', component.props.foo); - }); - - it('should include default component data in "props"', function() { - class TestComponent extends Component { - } - TestComponent.DATA_MANAGER = JSXDataManager; - - component = new TestComponent(); - assert.ok(component.props.hasOwnProperty('elementClasses')); - assert.ok(component.props.hasOwnProperty('events')); - assert.ok(component.props.hasOwnProperty('visible')); - }); - - it('should keep prop objects different between component instances', function() { - class TestComponent extends Component { - } - TestComponent.DATA_MANAGER = JSXDataManager; - TestComponent.PROPS = { - foo: { - value: 'defaultFoo' - } - }; - - component = new TestComponent(); - component2 = new TestComponent(); - assert.notEqual(component.props, component2.props); - - component.props.foo = 'foo1'; - assert.equal('foo1', component.props.foo); - assert.equal('defaultFoo', component2.props.foo); - - component2.props.foo = 'foo2'; - assert.equal('foo1', component.props.foo); - assert.equal('foo2', component2.props.foo); - }); - - it('should return value from "props" when "get" is called', function() { - class TestComponent extends Component { - } - TestComponent.DATA_MANAGER = JSXDataManager; - TestComponent.PROPS = { - foo: { - value: 'defaultPropsFoo' - } - }; - TestComponent.STATE = { - foo: { - value: 'defaultStateFoo' - } - }; - - component = new TestComponent(); - assert.strictEqual('defaultPropsFoo', component.props.foo); - assert.strictEqual('defaultStateFoo', component.state.foo); - - var manager = component.getDataManager(); - assert.strictEqual('defaultPropsFoo', manager.get(component, 'foo')); - }); - - it('should return the "State" instance for props from "getPropsInstance"', function() { - class TestComponent extends Component { - } - TestComponent.DATA_MANAGER = JSXDataManager; - TestComponent.PROPS = { - foo: { - value: 'defaultPropsFoo' - } - }; - TestComponent.STATE = { - foo: { - value: 'defaultStateFoo' - } - }; - - component = new TestComponent(); - var propsInstance = component.getDataManager().getPropsInstance(component); - assert.ok(propsInstance); - assert.equal('defaultPropsFoo', propsInstance.get('foo')); - }); - - it('should return keys from "props" when "getSyncKeys" is called', function() { - class TestComponent extends Component { - } - TestComponent.DATA_MANAGER = JSXDataManager; - TestComponent.PROPS = { - foo: { - } - }; - TestComponent.STATE = { - bar: { - } - }; - - component = new TestComponent(); - var manager = component.getDataManager(); - var expected = ['children', 'elementClasses', 'events', 'foo', 'visible']; - assert.deepEqual(expected, manager.getSyncKeys(component).sort()); - }); - }); - - describe('replaceNonInternal', function() { - it('should replace props with given values', function() { - class TestComponent extends Component { - } - TestComponent.DATA_MANAGER = JSXDataManager; - TestComponent.PROPS = { - bar: { - value: 'defaultBar' - }, - foo: { - value: 'defaultFoo' - } - }; - - component = new TestComponent(); - var manager = component.getDataManager(); - manager.replaceNonInternal(component, { - bar: 'bar', - foo: 'foo' - }); - - assert.strictEqual('bar', component.props.bar); - assert.strictEqual('foo', component.props.foo); - }); - - it('should replace props with default values if no value is given', function() { - class TestComponent extends Component { - } - TestComponent.DATA_MANAGER = JSXDataManager; - TestComponent.PROPS = { - bar: { - value: 'defaultBar' - }, - foo: { - value: 'defaultFoo' - } - }; - - component = new TestComponent(); - var manager = component.getDataManager(); - manager.replaceNonInternal(component, { - bar: 'bar' - }); - - assert.strictEqual('bar', component.props.bar); - assert.strictEqual('defaultFoo', component.props.foo); - }); - - it('should not replace state values', function() { - class TestComponent extends Component { - } - TestComponent.DATA_MANAGER = JSXDataManager; - TestComponent.STATE = { - foo: { - value: 'defaultFoo' - } - }; - - component = new TestComponent(); - var manager = component.getDataManager(); - manager.replaceNonInternal(component, { - foo: 'foo' - }); - assert.strictEqual('defaultFoo', component.state.foo); - }); - - it('should manually set prop values not specified in PROPS', function() { - class TestComponent extends Component { - } - TestComponent.DATA_MANAGER = JSXDataManager; - TestComponent.PROPS = { - bar: { - value: 'defaultBar' - } - }; - - component = new TestComponent(); - var manager = component.getDataManager(); - manager.replaceNonInternal(component, { - bar: 'bar', - foo: 'foo' - }); - - assert.strictEqual('bar', component.props.bar); - assert.strictEqual('foo', component.props.foo); - }); - - it('should call "propsChanged" lifecycle method when props are replaced', function() { - class TestComponent extends Component { - } - TestComponent.prototype.propsChanged = sinon.stub(); - TestComponent.DATA_MANAGER = JSXDataManager; - TestComponent.PROPS = { - foo: { - value: 'defaultFoo' - } - }; - - component = new TestComponent(); - var manager = component.getDataManager(); - manager.replaceNonInternal(component, { - foo: 'foo' - }); - - assert.strictEqual(1, component.propsChanged.callCount); - assert.strictEqual('defaultFoo', component.propsChanged.args[0][0].foo); - assert.strictEqual('foo', component.props.foo); - }); - }); +"use strict"; + +import Component from "metal-component"; +import IncrementalDomRenderer from "metal-incremental-dom"; +import JSXDataManager from "../src/JSXDataManager"; + +describe("JSXDataManager", function() { + var component; + var component2; + + afterEach(function() { + if (component) { + component.dispose(); + } + if (component2) { + component2.dispose(); + } + }); + + it('should create "props" and "state" objects in component', function() { + class TestComponent extends Component {} + TestComponent.DATA_MANAGER = JSXDataManager; + + component = new TestComponent(); + assert.ok(component.state); + assert.ok(component.props); + }); + + describe("state", function() { + it("should add properties from STATE to `state` variable", function() { + class TestComponent extends Component {} + TestComponent.DATA_MANAGER = JSXDataManager; + TestComponent.STATE = { + foo: { + value: "defaultFoo" + } + }; + + component = new TestComponent(); + + assert.ok(!component.foo); + assert.ok(!component.props.foo); + assert.strictEqual("defaultFoo", component.state.foo); + }); + + it("should not use constructor values for properties in STATE", function() { + class TestComponent extends Component {} + TestComponent.DATA_MANAGER = JSXDataManager; + TestComponent.STATE = { + foo: { + value: "defaultFoo" + } + }; + + component = new TestComponent({ + foo: "foo" + }); + assert.strictEqual("defaultFoo", component.state.foo); + }); + + it('should not include default component data in "state"', function() { + class TestComponent extends Component {} + TestComponent.DATA_MANAGER = JSXDataManager; + + component = new TestComponent(); + assert.ok(!component.state.hasOwnProperty("elementClasses")); + assert.ok(!component.state.hasOwnProperty("events")); + assert.ok(!component.state.hasOwnProperty("visible")); + }); + + it("should keep state objects different between component instances", function() { + class TestComponent extends Component {} + TestComponent.DATA_MANAGER = JSXDataManager; + TestComponent.STATE = { + foo: { + value: "defaultFoo" + } + }; + + component = new TestComponent(); + component2 = new TestComponent(); + assert.notEqual(component.state, component2.state); + + component.state.foo = "foo1"; + assert.equal("foo1", component.state.foo); + assert.equal("defaultFoo", component2.state.foo); + + component2.state.foo = "foo2"; + assert.equal("foo1", component.state.foo); + assert.equal("foo2", component2.state.foo); + }); + + it("should run setState's callback after component is rerendered", function( + done + ) { + class TestComponent extends Component { + render() {} + } + TestComponent.DATA_MANAGER = JSXDataManager; + TestComponent.RENDERER = IncrementalDomRenderer; + TestComponent.STATE = { + foo: { + value: "defaultFoo" + } + }; + + component = new TestComponent(); + sinon.spy(component, "render"); + + component.setState( + { + foo: "newFoo" + }, + () => { + assert.strictEqual(1, component.render.callCount); + done(); + } + ); + }); + + it("should now allow changes to a component's props cause changes to anothers", function() { + class TestComponent extends Component { + render() {} + } + TestComponent.DATA_MANAGER = JSXDataManager; + TestComponent.RENDERER = IncrementalDomRenderer; + + component = new TestComponent(); + component2 = new TestComponent(); + + component.props.foo = "foo"; + assert.equal("foo", component.props.foo); + assert.notEqual("foo", component2.props.foo); + }); + }); + + describe("props", function() { + it("should add properties from PROPS to `props` variable", function() { + class TestComponent extends Component {} + TestComponent.DATA_MANAGER = JSXDataManager; + TestComponent.PROPS = { + foo: { + value: "defaultFoo" + } + }; + + component = new TestComponent(); + + assert.ok(!component.foo); + assert.ok(!component.state.foo); + assert.strictEqual("defaultFoo", component.props.foo); + }); + + it("should use constructor values for properties in PROPS", function() { + class TestComponent extends Component {} + TestComponent.DATA_MANAGER = JSXDataManager; + TestComponent.PROPS = { + foo: { + value: "defaultFoo" + } + }; + + component = new TestComponent({ + foo: "foo" + }); + assert.strictEqual("foo", component.props.foo); + }); + + it('should use default prop value when "undefined" is passed as initial value', function() { + class TestComponent extends Component {} + TestComponent.DATA_MANAGER = JSXDataManager; + TestComponent.PROPS = { + foo: { + value: "defaultFoo" + } + }; + + component = new TestComponent({ + foo: undefined + }); + assert.strictEqual("defaultFoo", component.props.foo); + }); + + it('should include default component data in "props"', function() { + class TestComponent extends Component {} + TestComponent.DATA_MANAGER = JSXDataManager; + + component = new TestComponent(); + assert.ok(component.props.hasOwnProperty("elementClasses")); + assert.ok(component.props.hasOwnProperty("events")); + assert.ok(component.props.hasOwnProperty("visible")); + }); + + it("should keep prop objects different between component instances", function() { + class TestComponent extends Component {} + TestComponent.DATA_MANAGER = JSXDataManager; + TestComponent.PROPS = { + foo: { + value: "defaultFoo" + } + }; + + component = new TestComponent(); + component2 = new TestComponent(); + assert.notEqual(component.props, component2.props); + + component.props.foo = "foo1"; + assert.equal("foo1", component.props.foo); + assert.equal("defaultFoo", component2.props.foo); + + component2.props.foo = "foo2"; + assert.equal("foo1", component.props.foo); + assert.equal("foo2", component2.props.foo); + }); + + it('should return value from "props" when "get" is called', function() { + class TestComponent extends Component {} + TestComponent.DATA_MANAGER = JSXDataManager; + TestComponent.PROPS = { + foo: { + value: "defaultPropsFoo" + } + }; + TestComponent.STATE = { + foo: { + value: "defaultStateFoo" + } + }; + + component = new TestComponent(); + assert.strictEqual("defaultPropsFoo", component.props.foo); + assert.strictEqual("defaultStateFoo", component.state.foo); + + var manager = component.getDataManager(); + assert.strictEqual("defaultPropsFoo", manager.get(component, "foo")); + }); + + it('should return the "State" instance for props from "getPropsInstance"', function() { + class TestComponent extends Component {} + TestComponent.DATA_MANAGER = JSXDataManager; + TestComponent.PROPS = { + foo: { + value: "defaultPropsFoo" + } + }; + TestComponent.STATE = { + foo: { + value: "defaultStateFoo" + } + }; + + component = new TestComponent(); + var propsInstance = component + .getDataManager() + .getPropsInstance(component); + assert.ok(propsInstance); + assert.equal("defaultPropsFoo", propsInstance.get("foo")); + }); + + it('should return keys from "props" when "getSyncKeys" is called', function() { + class TestComponent extends Component {} + TestComponent.DATA_MANAGER = JSXDataManager; + TestComponent.PROPS = { + foo: {} + }; + TestComponent.STATE = { + bar: {} + }; + + component = new TestComponent(); + var manager = component.getDataManager(); + var expected = ["children", "elementClasses", "events", "foo", "visible"]; + assert.deepEqual(expected, manager.getSyncKeys(component).sort()); + }); + }); + + describe("replaceNonInternal", function() { + it("should replace props with given values", function() { + class TestComponent extends Component {} + TestComponent.DATA_MANAGER = JSXDataManager; + TestComponent.PROPS = { + bar: { + value: "defaultBar" + }, + foo: { + value: "defaultFoo" + } + }; + + component = new TestComponent(); + var manager = component.getDataManager(); + manager.replaceNonInternal(component, { + bar: "bar", + foo: "foo" + }); + + assert.strictEqual("bar", component.props.bar); + assert.strictEqual("foo", component.props.foo); + }); + + it("should replace props with default values if no value is given", function() { + class TestComponent extends Component {} + TestComponent.DATA_MANAGER = JSXDataManager; + TestComponent.PROPS = { + bar: { + value: "defaultBar" + }, + foo: { + value: "defaultFoo" + } + }; + + component = new TestComponent(); + var manager = component.getDataManager(); + manager.replaceNonInternal(component, { + bar: "bar" + }); + + assert.strictEqual("bar", component.props.bar); + assert.strictEqual("defaultFoo", component.props.foo); + }); + + it("should not replace state values", function() { + class TestComponent extends Component {} + TestComponent.DATA_MANAGER = JSXDataManager; + TestComponent.STATE = { + foo: { + value: "defaultFoo" + } + }; + + component = new TestComponent(); + var manager = component.getDataManager(); + manager.replaceNonInternal(component, { + foo: "foo" + }); + assert.strictEqual("defaultFoo", component.state.foo); + }); + + it("should manually set prop values not specified in PROPS", function() { + class TestComponent extends Component {} + TestComponent.DATA_MANAGER = JSXDataManager; + TestComponent.PROPS = { + bar: { + value: "defaultBar" + } + }; + + component = new TestComponent(); + var manager = component.getDataManager(); + manager.replaceNonInternal(component, { + bar: "bar", + foo: "foo" + }); + + assert.strictEqual("bar", component.props.bar); + assert.strictEqual("foo", component.props.foo); + }); + + it('should call "propsChanged" lifecycle method when props are replaced', function() { + class TestComponent extends Component {} + TestComponent.prototype.propsChanged = sinon.stub(); + TestComponent.DATA_MANAGER = JSXDataManager; + TestComponent.PROPS = { + foo: { + value: "defaultFoo" + } + }; + + component = new TestComponent(); + var manager = component.getDataManager(); + manager.replaceNonInternal(component, { + foo: "foo" + }); + + assert.strictEqual(1, component.propsChanged.callCount); + assert.strictEqual("defaultFoo", component.propsChanged.args[0][0].foo); + assert.strictEqual("foo", component.props.foo); + }); + }); }); diff --git a/packages/metal-jsx/test/JSXRenderer.js b/packages/metal-jsx/test/JSXRenderer.js index b69dc9e3..1a0ba138 100644 --- a/packages/metal-jsx/test/JSXRenderer.js +++ b/packages/metal-jsx/test/JSXRenderer.js @@ -1,536 +1,563 @@ -'use strict'; - -import dom from 'metal-dom'; -import Component from 'metal-component'; -import JSXRenderer from '../src/JSXRenderer'; -import JSXDataManager from '../src/JSXDataManager'; - -describe('JSXRenderer', function() { - let component; - let createdComps; - let TestJSXComponent; - - beforeEach(function() { - createdComps = []; - class TestJSXComponentCtor extends Component { - created() { - createdComps.push(this); - } - } - TestJSXComponentCtor.DATA_MANAGER = JSXDataManager; - TestJSXComponentCtor.RENDERER = JSXRenderer; - TestJSXComponent = TestJSXComponentCtor; - }); - - afterEach(function() { - if (component) { - component.dispose(); - } - }); - - it('should render returned contents from variable in "render" function', function() { - class TestComponent extends TestJSXComponent { - render() { - var jsx =
Hello World
; - return jsx; - } - } - - component = new TestComponent(); - assert.strictEqual('DIV', component.element.tagName); - assert.ok(dom.hasClass(component.element, 'test')); - assert.strictEqual('Hello World', component.element.textContent); - }); - - it('should be able to render a child without wrapper element', function() { - class ChildComponent extends TestJSXComponent { - render() { - return this.props.children[1]; - } - } - - class TestComponent extends TestJSXComponent { - render() { - return ( -
- - Children Test - Children Test 2 - Children Test 3 - -
- ); - } - } - - component = new TestComponent(); - var child = component.components.child; - assert.strictEqual('SPAN', child.element.tagName); - assert.strictEqual(1, child.element.childNodes.length); - assert.strictEqual('Children Test 2', child.element.textContent); - }); - - it('should reuse child empty component when it renders content for the first time', function(done) { - class Wrapper extends TestJSXComponent { - render() { - return this.props.children; - } - } - - const childInstances = []; - class Child extends TestJSXComponent { - created() { - childInstances.push(this); - } - - render() { - return this.state.show ? Child : null; - } - } - Child.STATE = { - show: { - } - }; - - class TestComponent extends TestJSXComponent { - render() { - return -
- -
-
; - } - } - - const element = document.createElement('div'); - dom.enterDocument(element); - component = new TestComponent({ - element - }); - assert.strictEqual(1, childInstances.length); - const child = childInstances[0]; - - child.state.show = true; - child.once('stateSynced', function() { - assert.strictEqual(1, childInstances.length); - assert.ok(!child.isDisposed()); - assert.equal('Child', child.element.textContent); - assert.equal(child.element, component.element.childNodes[0]); - done(); - }); - }); - - it('should reuse child empty component when its parent makes it render content for the first time', function(done) { - class Wrapper extends TestJSXComponent { - render() { - return this.props.children; - } - } - - const childInstances = []; - class Child extends TestJSXComponent { - created() { - childInstances.push(this); - } - - render() { - return this.props.show ? Child : null; - } - } - - class TestComponent extends TestJSXComponent { - render() { - return -
- -
-
; - } - } - TestComponent.STATE = { - show: { - } - }; - - const element = document.createElement('div'); - dom.enterDocument(element); - component = new TestComponent({ - element - }); - assert.strictEqual(1, childInstances.length); - const child = childInstances[0]; - - component.state.show = true; - component.once('stateSynced', function() { - assert.strictEqual(1, childInstances.length); - assert.ok(!child.isDisposed()); - assert.equal('Child', child.element.textContent); - assert.equal(child.element, component.element.childNodes[0]); - done(); - }); - }); - - it('should update if props change', function(done) { - class TestComponent extends TestJSXComponent { - render() { - return
{this.props.foo}
; - } - } - TestComponent.PROPS = { - foo: { - value: 'defaultFoo' - } - }; - - component = new TestComponent(); - assert.strictEqual('defaultFoo', component.element.textContent); - - component.props.foo = 'foo'; - component.once('rendered', function() { - assert.strictEqual('foo', component.element.textContent); - done(); - }); - }); - - it('should update if state changes', function(done) { - class TestComponent extends TestJSXComponent { - render() { - return
{this.state.foo}
; - } - } - TestComponent.STATE = { - foo: { - value: 'defaultFoo' - } - }; - - component = new TestComponent(); - assert.strictEqual('defaultFoo', component.element.textContent); - - component.state.foo = 'foo'; - component.once('rendered', function() { - assert.strictEqual('foo', component.element.textContent); - done(); - }); - }); - - it('should pass both state and prop changes to shouldUpdate', function(done) { - class TestComponent extends TestJSXComponent { - shouldUpdate() {} - } - TestComponent.PROPS = { - bar: { - } - }; - TestComponent.STATE = { - foo: { - } - }; - - component = new TestComponent(); - sinon.stub(component, 'shouldUpdate'); - component.props.bar = 'bar'; - component.state.foo = 'foo'; - component.once('stateChanged', function() { - assert.strictEqual(1, component.shouldUpdate.callCount); - - const stateChanges = component.shouldUpdate.args[0][0]; - assert.ok(stateChanges.foo); - assert.strictEqual('foo', stateChanges.foo.newVal); - assert.strictEqual(undefined, stateChanges.foo.prevVal); - - const propChanges = component.shouldUpdate.args[0][1]; - assert.ok(propChanges.bar); - assert.strictEqual('bar', propChanges.bar.newVal); - assert.strictEqual(undefined, propChanges.bar.prevVal); - - done(); - }); - }); - - it('should pass both state and prop changes to willUpdate', function(done) { - class TestComponent extends TestJSXComponent { - willUpdate() {} - } - TestComponent.PROPS = { - bar: { - } - }; - TestComponent.STATE = { - foo: { - } - }; - - component = new TestComponent(); - sinon.stub(component, 'willUpdate'); - component.props.bar = 'bar'; - component.state.foo = 'foo'; - component.once('stateChanged', function() { - assert.strictEqual(1, component.willUpdate.callCount); - - const stateChanges = component.willUpdate.args[0][0]; - assert.ok(stateChanges.foo); - assert.strictEqual('foo', stateChanges.foo.newVal); - assert.strictEqual(undefined, stateChanges.foo.prevVal); - - const propChanges = component.willUpdate.args[0][1]; - assert.ok(propChanges.bar); - assert.strictEqual('bar', propChanges.bar.newVal); - assert.strictEqual(undefined, propChanges.bar.prevVal); - - done(); - }); - }); - - it('should reuse elements correctly when child skips update', function(done) { - class ChildComponent extends TestJSXComponent { - render() { - return Child; - } - - shouldUpdate() { - return false; - } - } - - class TestComponent extends TestJSXComponent { - render() { - return
- - {this.state.foo} -
; - } - } - TestComponent.STATE = { - foo: { - } - }; - - component = new TestComponent(); - var childNodes = component.element.childNodes; - assert.equal(2, childNodes.length); - - component.state.foo = 'foo'; - component.once('stateChanged', function() { - assert.equal(2, component.element.childNodes.length); - assert.equal(childNodes[0], component.element.childNodes[0]); - assert.equal(childNodes[1], component.element.childNodes[1]); - assert.equal('foo', childNodes[1].textContent); - done(); - }); - }); - - it('should reuse component rendered after a conditionally rendered component', function(done) { - class ChildComponent extends TestJSXComponent { - render() { - return Child; - } - } - - class ChildComponent2 extends ChildComponent { - } - - class TestComponent extends TestJSXComponent { - render() { - return
- {!this.props.hide &&
} -
-
; - } - } - TestComponent.PROPS = { - hide: { - } - }; - - class ParentComponent extends TestJSXComponent { - render() { - return
; - } - } - - component = new ParentComponent(); - assert.strictEqual(4, createdComps.length); - assert.ok(createdComps[0] instanceof ParentComponent); - assert.ok(createdComps[1] instanceof TestComponent); - assert.ok(createdComps[2] instanceof ChildComponent); - assert.ok(createdComps[3] instanceof ChildComponent2); - assert.ok(!createdComps[0].isDisposed()); - assert.ok(!createdComps[1].isDisposed()); - assert.ok(!createdComps[2].isDisposed()); - assert.ok(!createdComps[3].isDisposed()); - - createdComps[1].props.hide = true; - createdComps[1].once('stateSynced', function() { - assert.strictEqual(4, createdComps.length); - assert.ok(!createdComps[0].isDisposed()); - assert.ok(!createdComps[1].isDisposed()); - assert.ok(createdComps[2].isDisposed()); - assert.ok(!createdComps[3].isDisposed()); - done(); - }); - }); - - it('should reuse elements with keys after moving around', function(done) { - class TestComponent extends TestJSXComponent { - render() { - return
- - -
; - } - } - TestComponent.PROPS = { - switch: { - } - }; - - component = new TestComponent(); - const firstChild = component.element.childNodes[0]; - const secondChild = component.element.childNodes[1]; - - component.props.switch = true; - component.once('stateSynced', function() { - assert.strictEqual(secondChild, component.element.childNodes[0]); - assert.strictEqual(firstChild, component.element.childNodes[1]); - done(); - }); - }); - - it('should reuse components with keys after moving around', function(done) { - const childComps = []; - class ChildComponent extends TestJSXComponent { - created() { - childComps.push(this); - } - render() { - return
Child{this.props.key}
; - } - } - - class TestComponent extends TestJSXComponent { - render() { - return
- - -
; - } - } - TestComponent.PROPS = { - switch: { - } - }; - - component = new TestComponent(); - assert.equal(2, childComps.length); - const firstChild = component.element.childNodes[0]; - const secondChild = component.element.childNodes[1]; - assert.equal(firstChild, childComps[0].element); - assert.equal(secondChild, childComps[1].element); - - component.props.switch = true; - component.once('stateSynced', function() { - assert.equal(secondChild, component.element.childNodes[0]); - assert.equal(firstChild, component.element.childNodes[1]); - assert.equal(2, childComps.length); - assert.equal(firstChild, childComps[0].element); - assert.equal(secondChild, childComps[1].element); - done(); - }); - }); - - it('should rerender sub component correctly after an update', function(done) { - class ChildComponent extends TestJSXComponent { - render() { - return
{this.props.foo}
; - } - } - ChildComponent.PROPS = { - foo: { - value: 'initialFoo' - } - }; - - class TestComponent extends TestJSXComponent { - render() { - return
-
Test
- -
; - } - } - - component = new TestComponent(); - - component.components.child.props.foo = 'newFoo'; - component.components.child.once('stateSynced', function() { - assert.strictEqual('Test', component.element.childNodes[0].textContent); - assert.strictEqual('newFoo', component.element.childNodes[1].textContent); - done(); - }); - }); - - it('should reuse elements correctly after a child update', function(done) { - class ChildComponent extends TestJSXComponent { - render() { - return
{this.props.foo}
; - } - } - ChildComponent.PROPS = { - foo: { - value: 'initialFoo' - } - }; - - class TestComponent extends TestJSXComponent { - render() { - return ; - } - } - - component = new TestComponent(); - const child = component.refs.child; - var spanEl = child.element.childNodes[0]; - - component.refs.child.props.foo = 'newFoo'; - component.refs.child.once('stateSynced', function() { - assert.strictEqual(spanEl, child.element.childNodes[0]); - done(); - }); - }); - - it('should reuse elements correctly after update from previously empty child', function(done) { - let child; - class ChildComponent extends TestJSXComponent { - created() { - child = this; - } - - render() { - return this.state.first ? null :
Child
; - } - } - ChildComponent.STATE = { - first: { - value: true - } - }; - - class TestComponent extends TestJSXComponent { - render() { - return
-
First child element
- -
; - } - } - - component = new TestComponent(); - const firstEl = component.element.childNodes[0]; - child.state.first = false; - child.once('stateSynced', function() { - assert.strictEqual(firstEl, component.element.childNodes[0]); - done(); - }); - }); +"use strict"; + +import dom from "metal-dom"; +import Component from "metal-component"; +import JSXRenderer from "../src/JSXRenderer"; +import JSXDataManager from "../src/JSXDataManager"; + +describe("JSXRenderer", function() { + let component; + let createdComps; + let TestJSXComponent; + + beforeEach(function() { + createdComps = []; + class TestJSXComponentCtor extends Component { + created() { + createdComps.push(this); + } + } + TestJSXComponentCtor.DATA_MANAGER = JSXDataManager; + TestJSXComponentCtor.RENDERER = JSXRenderer; + TestJSXComponent = TestJSXComponentCtor; + }); + + afterEach(function() { + if (component) { + component.dispose(); + } + }); + + it('should render returned contents from variable in "render" function', function() { + class TestComponent extends TestJSXComponent { + render() { + var jsx =
Hello World
; + return jsx; + } + } + + component = new TestComponent(); + assert.strictEqual("DIV", component.element.tagName); + assert.ok(dom.hasClass(component.element, "test")); + assert.strictEqual("Hello World", component.element.textContent); + }); + + it("should be able to render a child without wrapper element", function() { + class ChildComponent extends TestJSXComponent { + render() { + return this.props.children[1]; + } + } + + class TestComponent extends TestJSXComponent { + render() { + return ( +
+ + Children Test + Children Test 2 + Children Test 3 + +
+ ); + } + } + + component = new TestComponent(); + var child = component.components.child; + assert.strictEqual("SPAN", child.element.tagName); + assert.strictEqual(1, child.element.childNodes.length); + assert.strictEqual("Children Test 2", child.element.textContent); + }); + + it("should reuse child empty component when it renders content for the first time", function( + done + ) { + class Wrapper extends TestJSXComponent { + render() { + return this.props.children; + } + } + + const childInstances = []; + class Child extends TestJSXComponent { + created() { + childInstances.push(this); + } + + render() { + return this.state.show ? Child : null; + } + } + Child.STATE = { + show: {} + }; + + class TestComponent extends TestJSXComponent { + render() { + return ( + +
+ +
+
+ ); + } + } + + const element = document.createElement("div"); + dom.enterDocument(element); + component = new TestComponent({ + element + }); + assert.strictEqual(1, childInstances.length); + const child = childInstances[0]; + + child.state.show = true; + child.once("stateSynced", function() { + assert.strictEqual(1, childInstances.length); + assert.ok(!child.isDisposed()); + assert.equal("Child", child.element.textContent); + assert.equal(child.element, component.element.childNodes[0]); + done(); + }); + }); + + it("should reuse child empty component when its parent makes it render content for the first time", function( + done + ) { + class Wrapper extends TestJSXComponent { + render() { + return this.props.children; + } + } + + const childInstances = []; + class Child extends TestJSXComponent { + created() { + childInstances.push(this); + } + + render() { + return this.props.show ? Child : null; + } + } + + class TestComponent extends TestJSXComponent { + render() { + return ( + +
+ +
+
+ ); + } + } + TestComponent.STATE = { + show: {} + }; + + const element = document.createElement("div"); + dom.enterDocument(element); + component = new TestComponent({ + element + }); + assert.strictEqual(1, childInstances.length); + const child = childInstances[0]; + + component.state.show = true; + component.once("stateSynced", function() { + assert.strictEqual(1, childInstances.length); + assert.ok(!child.isDisposed()); + assert.equal("Child", child.element.textContent); + assert.equal(child.element, component.element.childNodes[0]); + done(); + }); + }); + + it("should update if props change", function(done) { + class TestComponent extends TestJSXComponent { + render() { + return
{this.props.foo}
; + } + } + TestComponent.PROPS = { + foo: { + value: "defaultFoo" + } + }; + + component = new TestComponent(); + assert.strictEqual("defaultFoo", component.element.textContent); + + component.props.foo = "foo"; + component.once("rendered", function() { + assert.strictEqual("foo", component.element.textContent); + done(); + }); + }); + + it("should update if state changes", function(done) { + class TestComponent extends TestJSXComponent { + render() { + return
{this.state.foo}
; + } + } + TestComponent.STATE = { + foo: { + value: "defaultFoo" + } + }; + + component = new TestComponent(); + assert.strictEqual("defaultFoo", component.element.textContent); + + component.state.foo = "foo"; + component.once("rendered", function() { + assert.strictEqual("foo", component.element.textContent); + done(); + }); + }); + + it("should pass both state and prop changes to shouldUpdate", function(done) { + class TestComponent extends TestJSXComponent { + shouldUpdate() {} + } + TestComponent.PROPS = { + bar: {} + }; + TestComponent.STATE = { + foo: {} + }; + + component = new TestComponent(); + sinon.stub(component, "shouldUpdate"); + component.props.bar = "bar"; + component.state.foo = "foo"; + component.once("stateChanged", function() { + assert.strictEqual(1, component.shouldUpdate.callCount); + + const stateChanges = component.shouldUpdate.args[0][0]; + assert.ok(stateChanges.foo); + assert.strictEqual("foo", stateChanges.foo.newVal); + assert.strictEqual(undefined, stateChanges.foo.prevVal); + + const propChanges = component.shouldUpdate.args[0][1]; + assert.ok(propChanges.bar); + assert.strictEqual("bar", propChanges.bar.newVal); + assert.strictEqual(undefined, propChanges.bar.prevVal); + + done(); + }); + }); + + it("should pass both state and prop changes to willUpdate", function(done) { + class TestComponent extends TestJSXComponent { + willUpdate() {} + } + TestComponent.PROPS = { + bar: {} + }; + TestComponent.STATE = { + foo: {} + }; + + component = new TestComponent(); + sinon.stub(component, "willUpdate"); + component.props.bar = "bar"; + component.state.foo = "foo"; + component.once("stateChanged", function() { + assert.strictEqual(1, component.willUpdate.callCount); + + const stateChanges = component.willUpdate.args[0][0]; + assert.ok(stateChanges.foo); + assert.strictEqual("foo", stateChanges.foo.newVal); + assert.strictEqual(undefined, stateChanges.foo.prevVal); + + const propChanges = component.willUpdate.args[0][1]; + assert.ok(propChanges.bar); + assert.strictEqual("bar", propChanges.bar.newVal); + assert.strictEqual(undefined, propChanges.bar.prevVal); + + done(); + }); + }); + + it("should reuse elements correctly when child skips update", function(done) { + class ChildComponent extends TestJSXComponent { + render() { + return Child; + } + + shouldUpdate() { + return false; + } + } + + class TestComponent extends TestJSXComponent { + render() { + return ( +
+ + {this.state.foo} +
+ ); + } + } + TestComponent.STATE = { + foo: {} + }; + + component = new TestComponent(); + var childNodes = component.element.childNodes; + assert.equal(2, childNodes.length); + + component.state.foo = "foo"; + component.once("stateChanged", function() { + assert.equal(2, component.element.childNodes.length); + assert.equal(childNodes[0], component.element.childNodes[0]); + assert.equal(childNodes[1], component.element.childNodes[1]); + assert.equal("foo", childNodes[1].textContent); + done(); + }); + }); + + it("should reuse component rendered after a conditionally rendered component", function( + done + ) { + class ChildComponent extends TestJSXComponent { + render() { + return Child; + } + } + + class ChildComponent2 extends ChildComponent {} + + class TestComponent extends TestJSXComponent { + render() { + return ( +
+ {!this.props.hide && ( +
+ +
+ )} +
+ +
+
+ ); + } + } + TestComponent.PROPS = { + hide: {} + }; + + class ParentComponent extends TestJSXComponent { + render() { + return ( +
+ +
+ ); + } + } + + component = new ParentComponent(); + assert.strictEqual(4, createdComps.length); + assert.ok(createdComps[0] instanceof ParentComponent); + assert.ok(createdComps[1] instanceof TestComponent); + assert.ok(createdComps[2] instanceof ChildComponent); + assert.ok(createdComps[3] instanceof ChildComponent2); + assert.ok(!createdComps[0].isDisposed()); + assert.ok(!createdComps[1].isDisposed()); + assert.ok(!createdComps[2].isDisposed()); + assert.ok(!createdComps[3].isDisposed()); + + createdComps[1].props.hide = true; + createdComps[1].once("stateSynced", function() { + assert.strictEqual(4, createdComps.length); + assert.ok(!createdComps[0].isDisposed()); + assert.ok(!createdComps[1].isDisposed()); + assert.ok(createdComps[2].isDisposed()); + assert.ok(!createdComps[3].isDisposed()); + done(); + }); + }); + + it("should reuse elements with keys after moving around", function(done) { + class TestComponent extends TestJSXComponent { + render() { + return ( +
+ + +
+ ); + } + } + TestComponent.PROPS = { + switch: {} + }; + + component = new TestComponent(); + const firstChild = component.element.childNodes[0]; + const secondChild = component.element.childNodes[1]; + + component.props.switch = true; + component.once("stateSynced", function() { + assert.strictEqual(secondChild, component.element.childNodes[0]); + assert.strictEqual(firstChild, component.element.childNodes[1]); + done(); + }); + }); + + it("should reuse components with keys after moving around", function(done) { + const childComps = []; + class ChildComponent extends TestJSXComponent { + created() { + childComps.push(this); + } + render() { + return
Child{this.props.key}
; + } + } + + class TestComponent extends TestJSXComponent { + render() { + return ( +
+ + +
+ ); + } + } + TestComponent.PROPS = { + switch: {} + }; + + component = new TestComponent(); + assert.equal(2, childComps.length); + const firstChild = component.element.childNodes[0]; + const secondChild = component.element.childNodes[1]; + assert.equal(firstChild, childComps[0].element); + assert.equal(secondChild, childComps[1].element); + + component.props.switch = true; + component.once("stateSynced", function() { + assert.equal(secondChild, component.element.childNodes[0]); + assert.equal(firstChild, component.element.childNodes[1]); + assert.equal(2, childComps.length); + assert.equal(firstChild, childComps[0].element); + assert.equal(secondChild, childComps[1].element); + done(); + }); + }); + + it("should rerender sub component correctly after an update", function(done) { + class ChildComponent extends TestJSXComponent { + render() { + return
{this.props.foo}
; + } + } + ChildComponent.PROPS = { + foo: { + value: "initialFoo" + } + }; + + class TestComponent extends TestJSXComponent { + render() { + return ( +
+
Test
+ +
+ ); + } + } + + component = new TestComponent(); + + component.components.child.props.foo = "newFoo"; + component.components.child.once("stateSynced", function() { + assert.strictEqual("Test", component.element.childNodes[0].textContent); + assert.strictEqual("newFoo", component.element.childNodes[1].textContent); + done(); + }); + }); + + it("should reuse elements correctly after a child update", function(done) { + class ChildComponent extends TestJSXComponent { + render() { + return ( +
+ {this.props.foo} +
+ ); + } + } + ChildComponent.PROPS = { + foo: { + value: "initialFoo" + } + }; + + class TestComponent extends TestJSXComponent { + render() { + return ; + } + } + + component = new TestComponent(); + const child = component.refs.child; + var spanEl = child.element.childNodes[0]; + + component.refs.child.props.foo = "newFoo"; + component.refs.child.once("stateSynced", function() { + assert.strictEqual(spanEl, child.element.childNodes[0]); + done(); + }); + }); + + it("should reuse elements correctly after update from previously empty child", function( + done + ) { + let child; + class ChildComponent extends TestJSXComponent { + created() { + child = this; + } + + render() { + return this.state.first ? null :
Child
; + } + } + ChildComponent.STATE = { + first: { + value: true + } + }; + + class TestComponent extends TestJSXComponent { + render() { + return ( +
+
First child element
+ +
+ ); + } + } + + component = new TestComponent(); + const firstEl = component.element.childNodes[0]; + child.state.first = false; + child.once("stateSynced", function() { + assert.strictEqual(firstEl, component.element.childNodes[0]); + done(); + }); + }); }); diff --git a/packages/metal-soy/src/Soy.js b/packages/metal-soy/src/Soy.js index 9ab41d2e..ca0c31ec 100644 --- a/packages/metal-soy/src/Soy.js +++ b/packages/metal-soy/src/Soy.js @@ -1,10 +1,10 @@ 'use strict'; import 'metal-soy-bundle'; -import { ComponentRegistry } from 'metal-component'; -import { isFunction, isObject, isString, object } from 'metal'; -import { validators, Config } from 'metal-state'; -import IncrementalDomRenderer, { HTML2IncDom } from 'metal-incremental-dom'; +import {ComponentRegistry} from 'metal-component'; +import {isFunction, isObject, isString, object} from 'metal'; +import {validators, Config} from 'metal-state'; +import IncrementalDomRenderer, {HTML2IncDom} from 'metal-incremental-dom'; import SoyAop from './SoyAop'; // The injected data that will be passed to soy templates. @@ -85,7 +85,11 @@ class Soy extends IncrementalDomRenderer.constructor { `No template with namespace "${namespace}" has been loaded yet.` ); } - return goog.loadedModules_[namespace][templateName](opt_data, opt_ignored, opt_ijData); + return goog.loadedModules_[namespace][templateName]( + opt_data, + opt_ignored, + opt_ijData + ); }; } @@ -118,7 +122,9 @@ class Soy extends IncrementalDomRenderer.constructor { return true; } - const elementTemplate = SoyAop.getOriginalFn(component.constructor.TEMPLATE); + const elementTemplate = SoyAop.getOriginalFn( + component.constructor.TEMPLATE + ); const type = (elementTemplate.types || {})[name] || ''; return type.split('|').indexOf('html') !== -1; } @@ -152,7 +158,10 @@ class Soy extends IncrementalDomRenderer.constructor { if (isFunction(elementTemplate) && !component.render) { elementTemplate = SoyAop.getOriginalFn(elementTemplate); SoyAop.startInterception(this.handleInterceptedCall_); - const data = this.buildTemplateData_(component, elementTemplate.params || []); + const data = this.buildTemplateData_( + component, + elementTemplate.params || [] + ); elementTemplate(data, null, ijData); SoyAop.stopInterception(); } else { @@ -208,7 +217,11 @@ class Soy extends IncrementalDomRenderer.constructor { * @return {!function()} */ toIncDom(value) { - if (isObject(value) && isString(value.content) && (value.contentKind === 'HTML')) { + if ( + isObject(value) && + isString(value.content) && + value.contentKind === 'HTML' + ) { value = value.content; } if (isString(value)) { @@ -222,9 +235,4 @@ const soyRenderer_ = new Soy(); soyRenderer_.RENDERER_NAME = 'soy'; export default soyRenderer_; -export { - Config, - soyRenderer_ as Soy, - SoyAop, - validators -}; +export {Config, soyRenderer_ as Soy, SoyAop, validators}; diff --git a/packages/metal-soy/src/SoyAop.js b/packages/metal-soy/src/SoyAop.js index a59eb135..400f6fea 100644 --- a/packages/metal-soy/src/SoyAop.js +++ b/packages/metal-soy/src/SoyAop.js @@ -34,7 +34,13 @@ const SoyAop = { handleTemplateCall_: function(originalFn, opt_data, opt_ignored, opt_ijData) { const interceptFn = SoyAop.interceptFns_[SoyAop.interceptFns_.length - 1]; if (interceptFn) { - return interceptFn.call(null, originalFn, opt_data, opt_ignored, opt_ijData); + return interceptFn.call( + null, + originalFn, + opt_data, + opt_ignored, + opt_ijData + ); } else { return originalFn.call(null, opt_data, opt_ignored, opt_ijData); } @@ -75,7 +81,7 @@ const SoyAop = { */ stopInterception: function() { SoyAop.interceptFns_.pop(); - } + }, }; export default SoyAop; diff --git a/packages/metal-soy/test/Soy.js b/packages/metal-soy/test/Soy.js index bdd49444..63d118e8 100644 --- a/packages/metal-soy/test/Soy.js +++ b/packages/metal-soy/test/Soy.js @@ -2,25 +2,28 @@ import dom from 'metal-dom'; import Component from 'metal-component'; -import { Events as EventsComponent } from './assets/Events.soy.js'; -import { ComputedData as ComputedDataComponent } from './assets/ComputedData.soy.js'; -import { ExternalTemplate as ExternalTemplateComponent } from './assets/ExternalTemplate.soy.js'; -import { Functions as FunctionsComponent } from './assets/Functions.soy.js'; -import { HelloWorld as HelloWorldComponent, templates as helloWorldTemplates } from './assets/HelloWorld.soy.js'; -import { HigherOrder as HigherOrderComponent } from './assets/HigherOrder.soy.js'; -import { HtmlContent as HtmlContentComponent } from './assets/HtmlContent.soy.js'; -import { IJData as IJDataComponent } from './assets/IJData.soy.js'; -import { Nested as NestedComponent } from './assets/Nested.soy.js'; -import { NestedDataAll as NestedDataAllComponent } from './assets/NestedDataAll.soy.js'; -import { NestedLevels as NestedLevelsComponent } from './assets/NestedLevels.soy.js'; -import { NestedMultiple as NestedMultipleComponent } from './assets/NestedMultiple.soy.js'; -import { NestedNoData as NestedNoDataComponent } from './assets/NestedNoData.soy.js'; -import { TemplateData as TemplateDataComponent } from './assets/TemplateData.soy.js'; +import {Events as EventsComponent} from './assets/Events.soy.js'; +import {ComputedData as ComputedDataComponent} from './assets/ComputedData.soy.js'; +import {ExternalTemplate as ExternalTemplateComponent} from './assets/ExternalTemplate.soy.js'; +import {Functions as FunctionsComponent} from './assets/Functions.soy.js'; +import { + HelloWorld as HelloWorldComponent, + templates as helloWorldTemplates, +} from './assets/HelloWorld.soy.js'; +import {HigherOrder as HigherOrderComponent} from './assets/HigherOrder.soy.js'; +import {HtmlContent as HtmlContentComponent} from './assets/HtmlContent.soy.js'; +import {IJData as IJDataComponent} from './assets/IJData.soy.js'; +import {Nested as NestedComponent} from './assets/Nested.soy.js'; +import {NestedDataAll as NestedDataAllComponent} from './assets/NestedDataAll.soy.js'; +import {NestedLevels as NestedLevelsComponent} from './assets/NestedLevels.soy.js'; +import {NestedMultiple as NestedMultipleComponent} from './assets/NestedMultiple.soy.js'; +import {NestedNoData as NestedNoDataComponent} from './assets/NestedNoData.soy.js'; +import {TemplateData as TemplateDataComponent} from './assets/TemplateData.soy.js'; import Soy from '../src/Soy'; describe('Soy', function() { - var comp; + let comp; afterEach(function() { if (comp) { @@ -38,14 +41,14 @@ describe('Soy', function() { it('should add soy param as state keys automatically', function() { comp = new HelloWorldComponent({ - name: 'Foo' + name: 'Foo', }); assert.strictEqual('Foo', comp.name); }); it('should pass state values to "render template"', function() { comp = new HelloWorldComponent({ - name: 'Foo' + name: 'Foo', }); assert.strictEqual('SPAN', comp.element.tagName); assert.strictEqual('Hello Foo!', comp.element.textContent); @@ -53,7 +56,7 @@ describe('Soy', function() { it('should update content when state values change', function(done) { comp = new HelloWorldComponent({ - name: 'Foo' + name: 'Foo', }); comp.name = 'Bar'; @@ -79,7 +82,9 @@ describe('Soy', function() { delete HelloWorldComponent.prototype.shouldUpdate; }); - it('should not trigger update when changed state key is not used by template', function(done) { + it('should not trigger update when changed state key is not used by template', function( + done + ) { comp = new HelloWorldComponent(); comp.visible = false; comp.once('stateSynced', function() { @@ -88,7 +93,9 @@ describe('Soy', function() { }); }); - it('should not trigger update when shouldUpdate returns false', function(done) { + it('should not trigger update when shouldUpdate returns false', function( + done + ) { HelloWorldComponent.prototype.shouldUpdate = function() { return false; }; @@ -101,7 +108,9 @@ describe('Soy', function() { }); }); - it('should trigger update when state key is not used by template if component shouldUpdate returns true', function(done) { + it('should trigger update when state key is not used by template if component shouldUpdate returns true', function( + done + ) { HelloWorldComponent.prototype.shouldUpdate = function() { return true; }; @@ -115,16 +124,21 @@ describe('Soy', function() { }); }); - it('should pass state values to "prepareStateForRender" and use them in the template', function(done) { + it('should pass state values to "prepareStateForRender" and use them in the template', function( + done + ) { ComputedDataComponent.prototype.shouldUpdate = function() { return true; }; ComputedDataComponent.prototype.prepareStateForRender = function(data) { - data.name = data.name.split('').reverse().join(''); + data.name = data.name + .split('') + .reverse() + .join(''); }; - comp = new ComputedDataComponent({ name: 'Foo' }); + comp = new ComputedDataComponent({name: 'Foo'}); assert.strictEqual('ooF', comp.element.textContent); @@ -139,21 +153,20 @@ describe('Soy', function() { it('should not add sub template soy params as state keys', function() { comp = new TemplateDataComponent({ - foo: 'foo' + foo: 'foo', }); assert.ok(!comp.foo); }); it('should pass non state config data to sub templates', function() { comp = new TemplateDataComponent({ - foo: 'foo' + foo: 'foo', }); assert.strictEqual('foo', comp.element.textContent); }); it('should not throw error if rendering component with no templates', function() { - class NoTemplateComponent extends Component { - } + class NoTemplateComponent extends Component {} NoTemplateComponent.RENDERER = Soy; assert.doesNotThrow(function() { @@ -161,12 +174,12 @@ describe('Soy', function() { }); }); - it('should not throw error if updating component with no templates', function(done) { - class NoTemplateComponent extends Component { - } + it('should not throw error if updating component with no templates', function( + done + ) { + class NoTemplateComponent extends Component {} NoTemplateComponent.STATE = { - foo: { - } + foo: {}, }; NoTemplateComponent.RENDERER = Soy; @@ -189,7 +202,7 @@ describe('Soy', function() { it('should allow specifying injected data content', function() { Soy.setInjectedData({ - content: 'Foo' + content: 'Foo', }); comp = new IJDataComponent(); assert.strictEqual('DIV', comp.element.tagName); @@ -204,8 +217,7 @@ describe('Soy', function() { }); it('should allow registering template with any name for a component', function() { - class TestComponent extends Component { - } + class TestComponent extends Component {} Soy.register(TestComponent, helloWorldTemplates, 'content'); comp = new TestComponent(); @@ -215,12 +227,10 @@ describe('Soy', function() { }); it('should use last component registration for the same template', function() { - class TestComponent extends Component { - } + class TestComponent extends Component {} Soy.register(TestComponent, helloWorldTemplates, 'content'); - class TestComponent2 extends Component { - } + class TestComponent2 extends Component {} Soy.register(TestComponent2, helloWorldTemplates, 'content'); assert.strictEqual(TestComponent.TEMPLATE, TestComponent2.TEMPLATE); @@ -240,42 +250,44 @@ describe('Soy', function() { }); it('should not throw error if soy template doesn\'t have params/types info', function() { - class TestComponent extends Component { - } - Soy.register( - TestComponent, - { - render: () => IncrementalDOM.elementVoid('div') - } - ); - assert.doesNotThrow(() => comp = new TestComponent()); + class TestComponent extends Component {} + Soy.register(TestComponent, { + render: () => IncrementalDOM.elementVoid('div'), + }); + assert.doesNotThrow(() => (comp = new TestComponent())); }); }); describe('HTML attributes', function() { it('should render html string attributes correctly', function() { comp = new HtmlContentComponent({ - content: 'HTML Content' + content: 'HTML Content', }); assert.strictEqual(1, comp.element.childNodes.length); assert.strictEqual('SPAN', comp.element.childNodes[0].tagName); assert.ok(dom.hasClass(comp.element.childNodes[0], 'custom')); - assert.strictEqual('HTML Content', comp.element.childNodes[0].textContent); + assert.strictEqual( + 'HTML Content', + comp.element.childNodes[0].textContent + ); }); it('should render html sanitized object attributes correctly', function() { comp = new HtmlContentComponent({ content: { content: 'HTML Content', - contentKind: 'HTML' - } + contentKind: 'HTML', + }, }); assert.strictEqual(1, comp.element.childNodes.length); assert.strictEqual('SPAN', comp.element.childNodes[0].tagName); assert.ok(dom.hasClass(comp.element.childNodes[0], 'custom')); - assert.strictEqual('HTML Content', comp.element.childNodes[0].textContent); + assert.strictEqual( + 'HTML Content', + comp.element.childNodes[0].textContent + ); }); }); @@ -306,7 +318,7 @@ describe('Soy', function() { }); it('should bind function listeners to component', function() { - var context; + let context; FunctionsComponent.prototype.handleClick = function() { context = this; }; @@ -326,7 +338,7 @@ describe('Soy', function() { it('should render and instantiate nested components', function() { comp = new NestedComponent(); - var nested = comp.components.hello; + let nested = comp.components.hello; assert.ok(nested instanceof HelloWorldComponent); assert.strictEqual(nested.element, comp.element.childNodes[0]); assert.strictEqual('Hello World!', nested.element.textContent); @@ -334,10 +346,10 @@ describe('Soy', function() { it('should pass data to nested components', function() { comp = new NestedComponent({ - name: 'Foo' + name: 'Foo', }); - var nested = comp.components.hello; + let nested = comp.components.hello; assert.ok(nested instanceof HelloWorldComponent); assert.strictEqual(nested.element, comp.element.childNodes[0]); assert.strictEqual('Hello Foo!', nested.element.textContent); @@ -345,10 +357,10 @@ describe('Soy', function() { it('should pass data via `data="all"` to nested components', function() { comp = new NestedDataAllComponent({ - name: 'Foo' + name: 'Foo', }); - var nested = comp.components.hello; + let nested = comp.components.hello; assert.ok(nested instanceof HelloWorldComponent); assert.strictEqual(nested.element, comp.element.childNodes[0]); assert.strictEqual('Hello Foo!', nested.element.textContent); @@ -357,19 +369,22 @@ describe('Soy', function() { it('should render and instantiate nested components even without ref', function() { comp = new NestedNoDataComponent(); assert.strictEqual(1, comp.element.childNodes.length); - assert.strictEqual('Hello World!', comp.element.childNodes[0].textContent); + assert.strictEqual( + 'Hello World!', + comp.element.childNodes[0].textContent + ); }); it('should render and instantiate nested components inside nested components', function() { comp = new NestedLevelsComponent({ - name: 'Foo' + name: 'Foo', }); - var nested = comp.components.nested; + let nested = comp.components.nested; assert.ok(nested instanceof NestedComponent); assert.strictEqual(nested.element, comp.element.childNodes[0]); - var nested2 = nested.components.hello; + let nested2 = nested.components.hello; assert.ok(nested2 instanceof HelloWorldComponent); assert.strictEqual(nested2.element, nested.element.childNodes[0]); assert.strictEqual('Hello Foo!', nested2.element.textContent); @@ -377,15 +392,15 @@ describe('Soy', function() { it('should render and instantiate multiple nested components', function() { comp = new NestedMultipleComponent({ - count: 2 + count: 2, }); - var nested1 = comp.components.hello1; + let nested1 = comp.components.hello1; assert.ok(nested1 instanceof HelloWorldComponent); assert.strictEqual(nested1.element, comp.element.childNodes[0]); assert.strictEqual('Hello World!', nested1.element.textContent); - var nested2 = comp.components.hello2; + let nested2 = comp.components.hello2; assert.ok(nested2 instanceof HelloWorldComponent); assert.strictEqual(nested2.element, comp.element.childNodes[1]); assert.strictEqual('Hello World!', nested2.element.textContent); @@ -394,18 +409,20 @@ describe('Soy', function() { describe('Soy.getTemplate', function() { it('should not throw error if called for undeclared namespace', function() { - assert.doesNotThrow(() => Soy.getTemplate('Undeclared.incrementaldom', 'render')); + assert.doesNotThrow(() => + Soy.getTemplate('Undeclared.incrementaldom', 'render') + ); }); it('should throw error if returned function is called for undeclared namespace', function() { - var template = Soy.getTemplate('Undeclared.incrementaldom', 'render'); + let template = Soy.getTemplate('Undeclared.incrementaldom', 'render'); assert.throws(template); }); it('should not throw error if namespace is declared before returned function is called', function() { - var template = Soy.getTemplate('DeclaredLater.incrementaldom', 'render'); - var module = { - render: sinon.stub() + let template = Soy.getTemplate('DeclaredLater.incrementaldom', 'render'); + let module = { + render: sinon.stub(), }; goog.loadModule(function() { goog.module('DeclaredLater.incrementaldom'); @@ -418,40 +435,40 @@ describe('Soy', function() { describe('Soy.toHtmlString', function() { it('should convert given incremental dom function into an html string', function() { - var fn = function() { + let fn = function() { IncrementalDOM.elementOpen('div', null, [], 'class', 'toHtmlString'); IncrementalDOM.text('To Convert'); IncrementalDOM.elementClose('div'); }; - var str = Soy.toHtmlString(fn); + let str = Soy.toHtmlString(fn); assert.strictEqual('
To Convert
', str); }); }); describe('Soy.toIncDom', function() { it('should convert given html string into an incremental dom function', function() { - var str = '
To Convert
'; - var fn = Soy.toIncDom(str); + let str = '
To Convert
'; + let fn = Soy.toIncDom(str); - var element = document.createElement('div'); + let element = document.createElement('div'); IncrementalDOM.patch(element, fn); assert.strictEqual(str, element.innerHTML); }); it('should convert given sanitized html object into an incremental dom function', function() { - var str = '
To Convert
'; - var fn = Soy.toIncDom({ + let str = '
To Convert
'; + let fn = Soy.toIncDom({ content: str, - contentKind: 'HTML' + contentKind: 'HTML', }); - var element = document.createElement('div'); + let element = document.createElement('div'); IncrementalDOM.patch(element, fn); assert.strictEqual(str, element.innerHTML); }); it('should not try to convert param that is not a string or a sanitized html object', function() { - var fn = sinon.stub(); + let fn = sinon.stub(); assert.strictEqual(fn, Soy.toIncDom(fn)); }); }); diff --git a/packages/metal-soy/test/SoyAop.js b/packages/metal-soy/test/SoyAop.js index fe5886da..7ab6ffc9 100644 --- a/packages/metal-soy/test/SoyAop.js +++ b/packages/metal-soy/test/SoyAop.js @@ -1,6 +1,6 @@ 'use strict'; -import { object } from 'metal'; +import {object} from 'metal'; import SoyAop from '../src/SoyAop'; describe('SoyAop', function() { @@ -9,16 +9,16 @@ describe('SoyAop', function() { }); it('should intercept calls to template functions that were registered', function() { - var templates = { + let templates = { fn1: sinon.stub(), fn2: sinon.stub(), - fn3: sinon.stub() + fn3: sinon.stub(), }; - var originals = object.mixin({}, templates); + let originals = object.mixin({}, templates); SoyAop.registerForInterception(templates, 'fn1'); SoyAop.registerForInterception(templates, 'fn2'); - var interceptor = sinon.stub(); + let interceptor = sinon.stub(); SoyAop.startInterception(interceptor); templates.fn1(); @@ -35,15 +35,15 @@ describe('SoyAop', function() { }); it('should get original function', function() { - var templates = { + let templates = { fn1: sinon.stub(), - fn2: sinon.stub() + fn2: sinon.stub(), }; - var originals = object.mixin({}, templates); + let originals = object.mixin({}, templates); SoyAop.registerForInterception(templates, 'fn1'); SoyAop.registerForInterception(templates, 'fn2'); - var interceptor = sinon.stub(); + let interceptor = sinon.stub(); SoyAop.startInterception(interceptor); assert.notStrictEqual(originals.fn1, templates.fn1); @@ -56,36 +56,42 @@ describe('SoyAop', function() { }); it('should pass correct params to intercepted call', function() { - var templates = { + let templates = { fn1: sinon.stub(), - fn2: sinon.stub() + fn2: sinon.stub(), }; SoyAop.registerForInterception(templates, 'fn1'); SoyAop.registerForInterception(templates, 'fn2'); - var interceptor = sinon.stub(); + let interceptor = sinon.stub(); SoyAop.startInterception(interceptor); - var data = {}; - var ijData = {}; + let data = {}; + let ijData = {}; templates.fn1(data, null, ijData); - assert.strictEqual(SoyAop.getOriginalFn(templates.fn1), interceptor.args[0][0]); + assert.strictEqual( + SoyAop.getOriginalFn(templates.fn1), + interceptor.args[0][0] + ); assert.strictEqual(data, interceptor.args[0][1]); assert.strictEqual(ijData, interceptor.args[0][3]); templates.fn2(data, null, ijData); - assert.strictEqual(SoyAop.getOriginalFn(templates.fn2), interceptor.args[1][0]); + assert.strictEqual( + SoyAop.getOriginalFn(templates.fn2), + interceptor.args[1][0] + ); assert.strictEqual(data, interceptor.args[1][1]); assert.strictEqual(ijData, interceptor.args[1][3]); }); it('should stop intercepting calls to template functions', function() { - var templates = { - fn: sinon.stub() + let templates = { + fn: sinon.stub(), }; SoyAop.registerForInterception(templates, 'fn'); - var interceptor = sinon.stub(); + let interceptor = sinon.stub(); SoyAop.startInterception(interceptor); SoyAop.stopInterception(interceptor); @@ -95,12 +101,12 @@ describe('SoyAop', function() { }); it('should restart intercepting calls to template functions', function() { - var templates = { - fn: sinon.stub() + let templates = { + fn: sinon.stub(), }; SoyAop.registerForInterception(templates, 'fn'); - var interceptor = sinon.stub(); + let interceptor = sinon.stub(); SoyAop.startInterception(interceptor); SoyAop.stopInterception(interceptor); SoyAop.startInterception(interceptor); @@ -111,13 +117,13 @@ describe('SoyAop', function() { }); it('should go back to previous intercepting function when interception is stopped', function() { - var templates = { - fn: sinon.stub() + let templates = { + fn: sinon.stub(), }; SoyAop.registerForInterception(templates, 'fn'); - var interceptor1 = sinon.stub(); - var interceptor2 = sinon.stub(); + let interceptor1 = sinon.stub(); + let interceptor2 = sinon.stub(); SoyAop.startInterception(interceptor1); SoyAop.startInterception(interceptor2); @@ -141,11 +147,11 @@ describe('SoyAop', function() { }); it('should register templates after interception has already started', function() { - var interceptor = sinon.stub(); + let interceptor = sinon.stub(); SoyAop.startInterception(interceptor); - var templates = { - fn: sinon.stub() + let templates = { + fn: sinon.stub(), }; SoyAop.registerForInterception(templates, 'fn'); @@ -157,12 +163,12 @@ describe('SoyAop', function() { it('should not replace template function if it has already been replaced', function() { SoyAop.startInterception(sinon.stub()); - var templates = { - fn: sinon.stub() + let templates = { + fn: sinon.stub(), }; SoyAop.registerForInterception(templates, 'fn'); - var replacedFn = templates.fn; + let replacedFn = templates.fn; SoyAop.registerForInterception(templates, 'fn'); assert.strictEqual(replacedFn, templates.fn); }); diff --git a/packages/metal-state/src/Config.js b/packages/metal-state/src/Config.js index 2e3826cb..7e546c1e 100644 --- a/packages/metal-state/src/Config.js +++ b/packages/metal-state/src/Config.js @@ -1,6 +1,6 @@ 'use strict'; -import { object } from 'metal'; +import {object} from 'metal'; import validators from './validators'; /** @@ -28,9 +28,9 @@ import validators from './validators'; */ const Config = { /** - * An object that contains a validator function. - * @typedef {!Object} ConfigWithValidator - */ + * An object that contains a validator function. + * @typedef {!Object} ConfigWithValidator + */ /** * Function that creates `State` object with an `any` validator. @@ -132,7 +132,7 @@ const Config = { */ internal(internal = true) { return mergeConfig(this, { - internal + internal, }); }, @@ -143,7 +143,7 @@ const Config = { */ required(required = true) { return mergeConfig(this, { - required + required, }); }, @@ -154,7 +154,7 @@ const Config = { */ setter(setter) { return mergeConfig(this, { - setter + setter, }); }, @@ -165,7 +165,7 @@ const Config = { */ validator(validator) { return mergeConfig(this, { - validator + validator, }); }, @@ -176,7 +176,7 @@ const Config = { */ value(value) { return mergeConfig(this, { - value + value, }); }, @@ -187,7 +187,7 @@ const Config = { */ valueFn(valueFn) { return mergeConfig(this, { - valueFn + valueFn, }); }, @@ -198,9 +198,9 @@ const Config = { */ writeOnce(writeOnce = false) { return mergeConfig(this, { - writeOnce + writeOnce, }); - } + }, }; /** @@ -213,13 +213,14 @@ function destructShapeOfConfigs(shape) { const retShape = {}; - keys.forEach( - key => { - const value = shape[key]; + keys.forEach(key => { + const value = shape[key]; - retShape[key] = value.config && value.config.validator ? value.config.validator : destructShapeOfConfigs(value); - } - ); + retShape[key] = + value.config && value.config.validator + ? value.config.validator + : destructShapeOfConfigs(value); + }); return retShape; } @@ -241,10 +242,10 @@ function mergeConfig(context, config) { } /** -* Calls validators with provided argument. -* @param {string} name The name of the validator. -* @param {!function()} -*/ + * Calls validators with provided argument. + * @param {string} name The name of the validator. + * @param {!function()} + */ function setExplicitValueValidators(name) { return function(arg) { return this.validator(validators[name](arg)); @@ -252,10 +253,10 @@ function setExplicitValueValidators(name) { } /** -* Calls validators with a single nested config. -* @param {string} name The name of the validator. -* @return {!function()} -*/ + * Calls validators with a single nested config. + * @param {string} name The name of the validator. + * @return {!function()} + */ function setNestedValidators(name) { return function(arg) { return this.validator(validators[name](arg.config.validator)); @@ -263,10 +264,10 @@ function setNestedValidators(name) { } /** -* Adds primitive type validators to the config object. -* @param {string} name The name of the validator. -* @return {!function()} -*/ + * Adds primitive type validators to the config object. + * @param {string} name The name of the validator. + * @return {!function()} + */ function setPrimitiveValidators(name) { return function() { return this.validator(validators[name]); diff --git a/packages/metal-state/src/State.js b/packages/metal-state/src/State.js index 47bacb66..b8fe7384 100644 --- a/packages/metal-state/src/State.js +++ b/packages/metal-state/src/State.js @@ -1,7 +1,16 @@ 'use strict'; -import { async, getStaticProperty, isDef, isDefAndNotNull, isFunction, isObject, isString, object } from 'metal'; -import { EventEmitter } from 'metal-events'; +import { + async, + getStaticProperty, + isDef, + isDefAndNotNull, + isFunction, + isObject, + isString, + object, +} from 'metal'; +import {EventEmitter} from 'metal-events'; /** * State adds support for having object properties that can be watched for @@ -72,7 +81,7 @@ class State extends EventEmitter { Object.defineProperty(this.obj_, State.STATE_REF_KEY, { configurable: true, enumerable: false, - value: this + value: this, }); } @@ -85,11 +94,14 @@ class State extends EventEmitter { const config = this.stateConfigs_[name]; if (config.required) { const info = this.getStateInfo(name); - const value = info.state === State.KeyStates.INITIALIZED ? - this.get(name) : - this.initialValues_[name]; + const value = + info.state === State.KeyStates.INITIALIZED + ? this.get(name) + : this.initialValues_[name]; if (!isDefAndNotNull(value)) { - let errorMessage = `The property called "${name}" is required but didn't receive a value.`; + let errorMessage = `The property called "${ + name + }" is required but didn't receive a value.`; if (this.shouldThrowValidationError()) { throw new Error(errorMessage); } else { @@ -144,7 +156,7 @@ class State extends EventEmitter { }, set: function(val) { this[State.STATE_REF_KEY].setStateKeyValue_(name, val); - } + }, }; } @@ -192,10 +204,11 @@ class State extends EventEmitter { callValidator_(name, value) { const config = this.stateConfigs_[name]; if (config.validator) { - const validatorReturn = this.callFunction_( - config.validator, - [value, name, this.context_] - ); + const validatorReturn = this.callFunction_(config.validator, [ + value, + name, + this.context_, + ]); this.assertValidatorReturnInstanceOfError_(validatorReturn); return validatorReturn; } @@ -254,16 +267,15 @@ class State extends EventEmitter { this.assertValidStateKeyName_(name); props[name] = this.buildKeyPropertyDef_(name); } - Object.defineProperties( - opt_context || this.obj_, - props - ); + Object.defineProperties(opt_context || this.obj_, props); } this.stateConfigs_ = configs; for (let i = 0; i < names.length; i++) { const name = names[i]; - configs[name] = configs[name].config ? configs[name].config : configs[name]; + configs[name] = configs[name].config + ? configs[name].config + : configs[name]; this.assertGivenIfRequired_(names[i]); this.validateInitialValue_(names[i]); } @@ -282,8 +294,7 @@ class State extends EventEmitter { ctor[staticKey] = ctor[staticKey] || {}; - defineContext = ctor[staticKey][ctor.name] ? false : - ctor.prototype; + defineContext = ctor[staticKey][ctor.name] ? false : ctor.prototype; ctor[staticKey][ctor.name] = true; } this.configState(State.getStateStatic(ctor), defineContext); @@ -406,8 +417,9 @@ class State extends EventEmitter { */ hasBeenSet(name) { const info = this.getStateInfo(name); - return info.state === State.KeyStates.INITIALIZED || - this.hasInitialValue_(name); + return ( + info.state === State.KeyStates.INITIALIZED || this.hasInitialValue_(name) + ); } /** @@ -417,8 +429,10 @@ class State extends EventEmitter { * @protected */ hasInitialValue_(name) { - return this.initialValues_.hasOwnProperty(name) && - isDef(this.initialValues_[name]); + return ( + this.initialValues_.hasOwnProperty(name) && + isDef(this.initialValues_[name]) + ); } /** @@ -441,11 +455,14 @@ class State extends EventEmitter { */ informChange_(name, prevVal) { if (this.shouldInformChange_(name, prevVal)) { - const data = object.mixin({ - key: name, - newVal: this.get(name), - prevVal: prevVal - }, this.eventData_); + const data = object.mixin( + { + key: name, + newVal: this.get(name), + prevVal: prevVal, + }, + this.eventData_ + ); this.context_.emit(`${name}Changed`, data); this.context_.emit('stateKeyChanged', data); this.scheduleBatchEvent_(data); @@ -500,9 +517,12 @@ class State extends EventEmitter { scheduleBatchEvent_(changeData) { if (!this.scheduledBatchData_) { async.nextTick(this.emitBatchEvent_, this); - this.scheduledBatchData_ = object.mixin({ - changes: {} - }, this.eventData_); + this.scheduledBatchData_ = object.mixin( + { + changes: {}, + }, + this.eventData_ + ); } const name = changeData.key; @@ -596,9 +616,11 @@ class State extends EventEmitter { * @protected */ setStateKeyValue_(name, value) { - if (this.warnIfDisposed_(name) || + if ( + this.warnIfDisposed_(name) || !this.canSetState(name) || - !this.validateKeyValue_(name, value)) { + !this.validateKeyValue_(name, value) + ) { return; } @@ -624,8 +646,10 @@ class State extends EventEmitter { */ shouldInformChange_(name, prevVal) { const info = this.getStateInfo(name); - return (info.state === State.KeyStates.INITIALIZED) && - (isObject(prevVal) || prevVal !== this.get(name)); + return ( + info.state === State.KeyStates.INITIALIZED && + (isObject(prevVal) || prevVal !== this.get(name)) + ); } /** @@ -643,9 +667,10 @@ class State extends EventEmitter { * @protected */ validateInitialValue_(name) { - if (this.initialValues_.hasOwnProperty(name) && - !this.callValidator_(name, this.initialValues_[name])) { - + if ( + this.initialValues_.hasOwnProperty(name) && + !this.callValidator_(name, this.initialValues_[name]) + ) { delete this.initialValues_[name]; } } @@ -660,8 +685,10 @@ class State extends EventEmitter { */ validateKeyValue_(name, value) { const info = this.getStateInfo(name); - return info.state === State.KeyStates.INITIALIZING || - this.callValidator_(name, value); + return ( + info.state === State.KeyStates.INITIALIZING || + this.callValidator_(name, value) + ); } /** @@ -702,7 +729,7 @@ State.STATE_STATIC_HINT_CONFIGURED = '__METAL_STATE_STATIC_HINT_CONFIGURED__'; State.KeyStates = { UNINITIALIZED: undefined, INITIALIZING: 1, - INITIALIZED: 2 + INITIALIZED: 2, }; export default State; diff --git a/packages/metal-state/src/all/state.js b/packages/metal-state/src/all/state.js index d4694fea..ef616a46 100644 --- a/packages/metal-state/src/all/state.js +++ b/packages/metal-state/src/all/state.js @@ -5,4 +5,4 @@ import Config from '../Config'; import State from '../State'; export default State; -export { validators, Config, State }; +export {validators, Config, State}; diff --git a/packages/metal-state/src/validators.js b/packages/metal-state/src/validators.js index 7c57ce3a..a6307583 100644 --- a/packages/metal-state/src/validators.js +++ b/packages/metal-state/src/validators.js @@ -1,6 +1,6 @@ 'use strict'; -import { getFunctionName, isDefAndNotNull } from 'metal'; +import {getFunctionName, isDefAndNotNull} from 'metal'; const ERROR_ARRAY_OF_TYPE = 'Expected an array of single type.'; const ERROR_OBJECT_OF_TYPE = 'Expected object of one type.'; @@ -83,10 +83,9 @@ const validators = { if (isInvalid(result)) { return result; } - return arrayOfValues.indexOf(value) === -1 ? - composeError( - composeOneOfErrorMessage(arrayOfValues), name, context - ) : true; + return arrayOfValues.indexOf(value) === -1 + ? composeError(composeOneOfErrorMessage(arrayOfValues), name, context) + : true; }); }, @@ -133,14 +132,16 @@ const validators = { required = validator.config.required; validator = validator.config.validator; } - if ((required && !isDefAndNotNull(value[key])) || - isInvalid(validator(value[key]))) { + if ( + (required && !isDefAndNotNull(value[key])) || + isInvalid(validator(value[key])) + ) { return composeError(ERROR_SHAPE_OF, name, context); } } return true; }); - } + }, }; /** @@ -181,7 +182,7 @@ function composeError(error, name, context) { const location = parentName ? `Check render method of '${parentName}'.` : ''; return new Error( `Warning: Invalid state passed to '${name}'. ` + - `${error} Passed to '${compName}'. ${location}` + `${error} Passed to '${compName}'. ${location}` ); } @@ -225,7 +226,6 @@ function maybe(typeValidator) { }; } - /** * Checks if all the items of the given array pass the given validator. * @param {!function()} validator diff --git a/packages/metal-state/test/Config.js b/packages/metal-state/test/Config.js index 23c17dec..8186f8db 100644 --- a/packages/metal-state/test/Config.js +++ b/packages/metal-state/test/Config.js @@ -5,102 +5,121 @@ import Config from '../src/Config'; describe('Config', function() { it('should return config with "internal" flag set to true by default', function() { - var config = Config.internal(); + let config = Config.internal(); assert.ok(core.isObject(config)); - var expected = { - internal: true + let expected = { + internal: true, }; assert.deepEqual(expected, config.config); }); it('should return config with "internal" flag set to the given vaue', function() { - var internal = false; - var config = Config.internal(internal); + let internal = false; + let config = Config.internal(internal); assert.ok(core.isObject(config)); - assert.deepEqual({ - internal - }, config.config); + assert.deepEqual( + { + internal, + }, + config.config + ); }); it('should return config with "required" flag set to true by default', function() { - var config = Config.required(); + let config = Config.required(); assert.ok(core.isObject(config)); - var expected = { - required: true + let expected = { + required: true, }; assert.deepEqual(expected, config.config); }); it('should return config with "required" flag set to the given vaue', function() { - var required = false; - var config = Config.required(required); + let required = false; + let config = Config.required(required); assert.ok(core.isObject(config)); - assert.deepEqual({ - required - }, config.config); + assert.deepEqual( + { + required, + }, + config.config + ); }); it('should return config with specified "value"', function() { - var value = 10; - var config = Config.value(10); + let value = 10; + let config = Config.value(10); assert.ok(core.isObject(config)); - assert.deepEqual({ - value - }, config.config); + assert.deepEqual( + { + value, + }, + config.config + ); }); it('should return config with specified "valueFn"', function() { - var valueFn = () => {}; - var config = Config.valueFn(valueFn); + let valueFn = () => {}; + let config = Config.valueFn(valueFn); assert.ok(core.isObject(config)); - assert.deepEqual({ - valueFn - }, config.config); + assert.deepEqual( + { + valueFn, + }, + config.config + ); }); it('should return config with "writeOnce" flag set to false by default', function() { - var config = Config.writeOnce(); + let config = Config.writeOnce(); assert.ok(core.isObject(config)); - var expected = { - writeOnce: false + let expected = { + writeOnce: false, }; assert.deepEqual(expected, config.config); }); it('should return config with "writeOnce" flag set to the given vaue', function() { - var writeOnce = true; - var config = Config.writeOnce(writeOnce); + let writeOnce = true; + let config = Config.writeOnce(writeOnce); assert.ok(core.isObject(config)); - assert.deepEqual({ - writeOnce - }, config.config); + assert.deepEqual( + { + writeOnce, + }, + config.config + ); }); it('should return config with specified "setter"', function() { - var setter = () => { - }; - var config = Config.setter(setter); + let setter = () => {}; + let config = Config.setter(setter); assert.ok(core.isObject(config)); - assert.deepEqual({ - setter - }, config.config); + assert.deepEqual( + { + setter, + }, + config.config + ); }); it('should return config with specified "validator"', function() { - var validator = () => { - }; - var config = Config.validator(validator); + let validator = () => {}; + let config = Config.validator(validator); assert.ok(core.isObject(config)); - assert.deepEqual({ - validator - }, config.config); + assert.deepEqual( + { + validator, + }, + config.config + ); }); it('should return config with "any" validator from "validators"', function() { - var config = Config.any(); + let config = Config.any(); assert.ok(core.isObject(config)); assert.ok(core.isFunction(config.config.validator)); assert.ok(config.config.validator(10)); @@ -108,7 +127,7 @@ describe('Config', function() { }); it('should return config with "array" validator from "validators"', function() { - var config = Config.array(); + let config = Config.array(); assert.ok(core.isObject(config)); assert.ok(core.isFunction(config.config.validator)); assert.ok(config.config.validator(['one'])); @@ -116,7 +135,7 @@ describe('Config', function() { }); it('should return config with "arrayOf" validator from "validators"', function() { - var config = Config.arrayOf(Config.number()); + let config = Config.arrayOf(Config.number()); assert.ok(core.isObject(config)); assert.ok(core.isFunction(config.config.validator)); assert.ok(config.config.validator([1, 2])); @@ -125,7 +144,7 @@ describe('Config', function() { }); it('should return config with "bool" validator from "validators"', function() { - var config = Config.bool(); + let config = Config.bool(); assert.ok(core.isObject(config)); assert.ok(core.isFunction(config.config.validator)); assert.ok(config.config.validator(true)); @@ -133,7 +152,7 @@ describe('Config', function() { }); it('should return config with "func" validator from "validators"', function() { - var config = Config.func(); + let config = Config.func(); assert.ok(core.isObject(config)); assert.ok(core.isFunction(config.config.validator)); assert.ok(config.config.validator(function() {})); @@ -141,12 +160,10 @@ describe('Config', function() { }); it('should return config with "instanceOf" validator from "validators"', function() { - class TestClass { - } - class TestClass2 { - } + class TestClass {} + class TestClass2 {} - var config = Config.instanceOf(TestClass); + let config = Config.instanceOf(TestClass); assert.ok(core.isObject(config)); assert.ok(core.isFunction(config.config.validator)); assert.ok(config.config.validator(new TestClass())); @@ -154,7 +171,7 @@ describe('Config', function() { }); it('should return config with "number" validator from "validators"', function() { - var config = Config.number(); + let config = Config.number(); assert.ok(core.isObject(config)); assert.ok(core.isFunction(config.config.validator)); assert.ok(config.config.validator(10)); @@ -162,7 +179,7 @@ describe('Config', function() { }); it('should return config with "object" validator from "validators"', function() { - var config = Config.object(); + let config = Config.object(); assert.ok(core.isObject(config)); assert.ok(core.isFunction(config.config.validator)); assert.ok(config.config.validator({})); @@ -170,7 +187,7 @@ describe('Config', function() { }); it('should return config with "objectOf" validator from "validators"', function() { - var config = Config.objectOf(Config.number()); + let config = Config.objectOf(Config.number()); assert.ok(core.isObject(config)); assert.ok(core.isFunction(config.config.validator)); assert.ok(config.config.validator({foo: 1})); @@ -196,7 +213,7 @@ describe('Config', function() { }); it('should return config with "oneOfType" validator from "validators"', function() { - var config = Config.oneOfType([Config.string(), Config.number()]); + let config = Config.oneOfType([Config.string(), Config.number()]); assert.ok(core.isObject(config)); assert.ok(core.isFunction(config.config.validator)); assert.ok(config.config.validator(1)); @@ -206,37 +223,37 @@ describe('Config', function() { }); it('should return config with "shapeOf" validator from "validators"', function() { - var shape = { + let shape = { one: Config.string(), two: { three: { - four: Config.number() - } + four: Config.number(), + }, }, - five: Config.arrayOf(Config.string()) + five: Config.arrayOf(Config.string()), }; - var pass = { + let pass = { one: 'one', two: { three: { - four: 4 - } + four: 4, + }, }, - five: ['five'] + five: ['five'], }; - var fail = { + let fail = { one: 'one', two: { three: { - four: 'four' - } + four: 'four', + }, }, - five: 5 + five: 5, }; - var config = Config.arrayOf(Config.shapeOf(shape)); + let config = Config.arrayOf(Config.shapeOf(shape)); assert.ok(core.isObject(config)); assert.ok(core.isFunction(config.config.validator)); assert.ok(config.config.validator(pass)); @@ -244,7 +261,7 @@ describe('Config', function() { }); it('should return config with "string" validator from "validators"', function() { - var config = Config.string(); + let config = Config.string(); assert.ok(core.isObject(config)); assert.ok(core.isFunction(config.config.validator)); assert.ok(config.config.validator('test')); @@ -252,9 +269,11 @@ describe('Config', function() { }); it('should return config with data from multiple calls', function() { - var setter = () => { - }; - var config = Config.required(true).number().value(10).setter(setter); + let setter = () => {}; + let config = Config.required(true) + .number() + .value(10) + .setter(setter); assert.ok(core.isObject(config)); assert.strictEqual(4, Object.keys(config.config).length); diff --git a/packages/metal-state/test/State.js b/packages/metal-state/test/State.js index 2a1e5fdd..3216fdfd 100644 --- a/packages/metal-state/test/State.js +++ b/packages/metal-state/test/State.js @@ -1,90 +1,89 @@ 'use strict'; -import { async } from 'metal'; +import {async} from 'metal'; import EventEmitter from 'metal-events'; import State from '../src/State'; describe('State', function() { it('should add keys to the state', function() { - var state = new State(); + let state = new State(); state.configState({ key1: {}, - key2: {} + key2: {}, }); - var keys = Object.keys(state.getState()); + let keys = Object.keys(state.getState()); assert.strictEqual(2, keys.length); assert.strictEqual('key1', keys[0]); assert.strictEqual('key2', keys[1]); }); it('should make state keys enumerable', function() { - var state = new State(); + let state = new State(); state.configState({ key1: {}, - key2: {} + key2: {}, }); - var keys = Object.keys(state); + let keys = Object.keys(state); assert.notStrictEqual(-1, keys.indexOf('key1')); assert.notStrictEqual(-1, keys.indexOf('key2')); }); it('should not allow adding state key with name contained in key blacklist', function() { - class Test extends State { - } + class Test extends State {} - var test = new Test(); + let test = new Test(); test.setKeysBlacklist({ - invalid: true + invalid: true, }); assert.throws(function() { test.configState({ - invalid: {} + invalid: {}, }); }); }); it('should get a state key\'s config object', function() { - var state = new State(); + let state = new State(); state.configState({ key1: { - a: 2 - } + a: 2, + }, }); - var expected = { - a: 2 + let expected = { + a: 2, }; assert.deepEqual(expected, state.getStateKeyConfig('key1')); }); it('should use config object from "config" key', function() { - var state = new State(); + let state = new State(); state.configState({ key1: { config: { - a: 2 - } - } + a: 2, + }, + }, }); - var expected = { - a: 2 + let expected = { + a: 2, }; assert.deepEqual(expected, state.getStateKeyConfig('key1')); }); it('should return null if requesting config object of non existing key', function() { - var state = new State(); + let state = new State(); assert.strictEqual(undefined, state.getStateKeyConfig('key1')); }); it('should set and get state values', function() { - var state = new State(); + let state = new State(); state.configState({ key1: {}, - key2: {} + key2: {}, }); assert.strictEqual(undefined, state.key1); @@ -98,22 +97,22 @@ describe('State', function() { }); it('should get state key value through "get" method', function() { - var state = new State(); + let state = new State(); state.configState({ key1: { - value: 2 - } + value: 2, + }, }); assert.strictEqual(2, state.get('key1')); }); it('should set state key value through "set" method', function() { - var state = new State(); + let state = new State(); state.configState({ key1: { - value: 2 - } + value: 2, + }, }); state.set('key1', 3); @@ -121,97 +120,95 @@ describe('State', function() { }); it('should set default state key value', function() { - var state = createStateInstance(); + let state = createStateInstance(); assert.strictEqual(1, state.key1); assert.strictEqual(2, state.key2); }); it('should set default state key value with raw value', function() { - var state = new State(); + let state = new State(); state.configState({ key1: { - value: 1 - } + value: 1, + }, }); assert.strictEqual(1, state.key1); }); it('should set default state key value from function', function() { - var state = new State(); + let state = new State(); state.configState({ key1: { valueFn: function() { return 1; - } - } + }, + }, }); assert.strictEqual(1, state.key1); }); it('should set default state key value from function name', function() { - var state = new State(); + let state = new State(); state.returns1 = function() { return 1; }; state.configState({ key1: { - valueFn: 'returns1' - } + valueFn: 'returns1', + }, }); assert.strictEqual(1, state.key1); }); it('should ignore invalid valueFn function', function() { - var state = new State(); + let state = new State(); state.configState({ key1: { - valueFn: 1 - } + valueFn: 1, + }, }); assert.strictEqual(undefined, state.key1); }); it('should not use valueFn function if value is also defined', function() { - var state = new State(); + let state = new State(); state.configState({ key1: { value: '', valueFn: function() { return '1'; - } - } + }, + }, }); assert.strictEqual('', state.key1); }); it('should override default state key value', function() { - var state = new State({ + let state = new State({ key1: 10, - key2: 20 + key2: 20, + }); + state.configState({ + key1: { + value: 1, + }, + key2: { + value: 2, + }, }); - state.configState( - { - key1: { - value: 1 - }, - key2: { - value: 2 - } - } - ); assert.strictEqual(10, state.key1); assert.strictEqual(20, state.key2); }); it('should change initial state key value', function() { - var state = createStateInstance(); + let state = createStateInstance(); state.key1 = 10; @@ -219,12 +216,12 @@ describe('State', function() { }); it('should initialize state values lazily', function() { - var state = new State(); - var valueFn = sinon.stub().returns(2); + let state = new State(); + let valueFn = sinon.stub().returns(2); state.configState({ key1: { - valueFn: valueFn - } + valueFn: valueFn, + }, }); assert.strictEqual(0, valueFn.callCount); @@ -233,10 +230,12 @@ describe('State', function() { assert.strictEqual(1, valueFn.callCount); }); - it('should pass value, name and context args to validator function', function(done) { - var state = new State(); - var keyName = 'key1'; - var value = 2; + it('should pass value, name and context args to validator function', function( + done + ) { + let state = new State(); + let keyName = 'key1'; + let value = 2; state.configState({ [keyName]: { validator: function(val, name, context) { @@ -245,22 +244,22 @@ describe('State', function() { assert.strictEqual(state, context); done(); - } - } + }, + }, }); state[keyName] = value; }); it('should validate new state values', function() { - var state = new State(); + let state = new State(); state.configState({ key1: { validator: function(val) { return val > 0; }, - value: 1 - } + value: 1, + }, }); state.key1 = -1; @@ -271,15 +270,15 @@ describe('State', function() { }); it('should validate new state values through function name', function() { - var state = new State(); + let state = new State(); state.isPositive = function(val) { return val > 0; }; state.configState({ key1: { validator: 'isPositive', - value: 1 - } + value: 1, + }, }); state.key1 = -1; @@ -290,52 +289,48 @@ describe('State', function() { }); it('should validate initial state values', function() { - var state = new State({ - key1: -10 + let state = new State({ + key1: -10, + }); + state.configState({ + key1: { + validator: function(val) { + return val > 0; + }, + value: 1, + }, }); - state.configState( - { - key1: { - validator: function(val) { - return val > 0; - }, - value: 1 - } - } - ); assert.strictEqual(1, state.key1); }); it('should not overwrite default value with "undefined" initial value', function() { - var state = new State({ - key1: undefined + let state = new State({ + key1: undefined, }); state.configState({ key1: { - value: 'value1' - } + value: 'value1', + }, }); assert.equal(state.key1, 'value1'); }); it('should allow accessing other state properties in validator', function() { - var state = new State({ - key1: 1 + let state = new State({ + key1: 1, }); - state.configState( - { - key1: { - validator: function(val) { - return val < this.key2; - } + state.configState({ + key1: { + validator: function(val) { + return val < this.key2; }, - key2: { - value: 2 - } - } - ); + }, + key2: { + value: 2, + }, + }); assert.strictEqual(1, state.key1); state.key1 = 3; @@ -346,32 +341,30 @@ describe('State', function() { }); it('should not validate default state values', function() { - var state = new State(); + let state = new State(); state.configState({ key1: { validator: function(val) { return val > 0; }, - value: -1 - } + value: -1, + }, }); assert.strictEqual(-1, state.key1); }); it('should emit error if validator returns an Error', function() { - var originalConsoleFn = console.error; + let originalConsoleFn = console.error; console.error = sinon.stub(); - var state = new State(); - state.configState( - { - key1: { - validator: function(val) { - return val; - } - } - } - ); + let state = new State(); + state.configState({ + key1: { + validator: function(val) { + return val; + }, + }, + }); state.key1 = 1; assert.ok(!console.error.called); @@ -383,20 +376,19 @@ describe('State', function() { }); it('should emit validator error even for "undefined" initial values', function() { - var originalConsoleFn = console.error; + let originalConsoleFn = console.error; console.error = sinon.stub(); - class Test extends State { - } + class Test extends State {} Test.STATE = { key1: { validator: function() { return new Error(); - } - } + }, + }, }; new Test({ - key1: undefined + key1: undefined, }); assert.ok(console.error.called); @@ -409,18 +401,16 @@ describe('State', function() { return true; } } - var state = new Test(); - state.configState( - { - key1: { - validator: function() { - return new Error(); - } - } - } - ); + let state = new Test(); + state.configState({ + key1: { + validator: function() { + return new Error(); + }, + }, + }); - assert.throws(() => state.key1 = 1); + assert.throws(() => (state.key1 = 1)); }); it('should not throw error if validator returns an Error and shouldThrowValidationError is false', function() { @@ -429,28 +419,26 @@ describe('State', function() { return false; } } - var state = new Test(); - state.configState( - { - key1: { - validator: function() { - return new Error(); - } - } - } - ); + let state = new Test(); + state.configState({ + key1: { + validator: function() { + return new Error(); + }, + }, + }); - assert.doesNotThrow(() => state.key1 = 1); + assert.doesNotThrow(() => (state.key1 = 1)); assert.strictEqual(1, state.key1); }); it('should change state new value through setter', function() { - var state = new State(); + let state = new State(); state.configState({ key1: { setter: Math.abs, - value: -1 - } + value: -1, + }, }); assert.strictEqual(1, state.key1); @@ -463,13 +451,13 @@ describe('State', function() { }); it('should change state new value through setter name', function() { - var state = new State(); + let state = new State(); state.makePositive = Math.abs; state.configState({ key1: { setter: 'makePositive', - value: -1 - } + value: -1, + }, }); assert.strictEqual(1, state.key1); @@ -482,14 +470,14 @@ describe('State', function() { }); it('should pass the state key\'s current value to setter', function() { - var state = new State(); + let state = new State(); state.configState({ key1: { setter: (newValue, currentValue) => { return currentValue ? currentValue + ':' + newValue : newValue; }, - value: 'first' - } + value: 'first', + }, }); assert.strictEqual('first', state.key1); @@ -502,42 +490,39 @@ describe('State', function() { }); it('should allow setting a writeOnce with initial value', function() { - var state = new State({ - key1: 2 + let state = new State({ + key1: 2, + }); + state.configState({ + key1: { + value: 1, + writeOnce: true, + }, }); - state.configState( - { - key1: { - value: 1, - writeOnce: true - } - } - ); assert.strictEqual(2, state.key1); }); it('should allow setting a writeOnce state value before it has been written', function() { - var state = new State(); + let state = new State(); state.configState({ key1: { value: 1, - writeOnce: true - } + writeOnce: true, + }, }); state.key1 = 2; assert.strictEqual(2, state.key1); }); - it('should not allow changing a writeOnce state value after it has been written', function() { - var state = new State(); + let state = new State(); state.configState({ key1: { value: 1, - writeOnce: true - } + writeOnce: true, + }, }); assert.strictEqual(1, state.key1); @@ -558,40 +543,38 @@ describe('State', function() { }); it('should log error if required property gets no initial value via configState', function() { - var state = new State({ - key2: 'initialValue' + let state = new State({ + key2: 'initialValue', }); state.configState({ - key1: {} + key1: {}, }); assert.strictEqual(0, console.error.callCount); - state.configState( - { - key2: { - required: true - } - } - ); + state.configState({ + key2: { + required: true, + }, + }); assert.strictEqual(0, console.error.callCount); state.configState({ key3: { - required: true - } + required: true, + }, }); assert.strictEqual(1, console.error.callCount); }); it('should log error if required property is set to null or undefined', function() { - var state = new State({ - key: 'initialValue' + let state = new State({ + key: 'initialValue', }); state.configState({ key: { - required: true - } + required: true, + }, }); assert.strictEqual(0, console.error.callCount); @@ -611,31 +594,29 @@ describe('State', function() { return true; } } - var state = new Test({ - key2: 'initialValue' + let state = new Test({ + key2: 'initialValue', }); assert.doesNotThrow(() => { state.configState({ - key1: {} + key1: {}, }); }); assert.doesNotThrow(() => { - state.configState( - { - key2: { - required: true - } - } - ); + state.configState({ + key2: { + required: true, + }, + }); }); assert.throws(() => { state.configState({ key3: { - required: true - } + required: true, + }, }); }); }); @@ -646,15 +627,15 @@ describe('State', function() { return true; } } - var state = new Test({ - key: 'initialValue' + let state = new Test({ + key: 'initialValue', }); assert.doesNotThrow(() => { state.configState({ key: { - required: true - } + required: true, + }, }); }); @@ -679,8 +660,8 @@ describe('State', function() { } Test.STATE = { key: { - required: true - } + required: true, + }, }; assert.throws(() => { @@ -690,17 +671,17 @@ describe('State', function() { }); it('should emit event when a state key\'s value changes', function() { - var state = new State({ - key1: 10 + let state = new State({ + key1: 10, }); state.configState({ key1: { value: 1, - writeOnce: true - } + writeOnce: true, + }, }); - var listener = sinon.stub(); + let listener = sinon.stub(); state.on('key1Changed', listener); state.key1 = 2; @@ -713,17 +694,17 @@ describe('State', function() { }); it('should emit stateKeyChanged event when a state key\'s value changes', function() { - var state = new State({ - key1: 10 + let state = new State({ + key1: 10, }); state.configState({ key1: { value: 1, - writeOnce: true - } + writeOnce: true, + }, }); - var listener = sinon.stub(); + let listener = sinon.stub(); state.on('stateKeyChanged', listener); state.key1 = 2; @@ -736,8 +717,8 @@ describe('State', function() { }); it('should not emit events when state value doesn\'t change', function() { - var state = createStateInstance(); - var listener = sinon.stub(); + let state = createStateInstance(); + let listener = sinon.stub(); state.on('key1Changed', listener); state.key1 = state.key1; @@ -745,10 +726,10 @@ describe('State', function() { }); it('should emit events even when state value doesn\'t change if value is an object', function() { - var state = createStateInstance(); + let state = createStateInstance(); state.key1 = {}; - var listener = sinon.stub(); + let listener = sinon.stub(); state.on('key1Changed', listener); state.key1 = state.key1; @@ -756,10 +737,10 @@ describe('State', function() { }); it('should emit events even when state value doesn\'t change if value is an array', function() { - var state = createStateInstance(); + let state = createStateInstance(); state.key1 = []; - var listener = sinon.stub(); + let listener = sinon.stub(); state.on('key1Changed', listener); state.key1 = state.key1; @@ -767,18 +748,20 @@ describe('State', function() { }); it('should emit events even when state value doesn\'t change if value is a function', function() { - var state = createStateInstance(); + let state = createStateInstance(); state.key1 = function() {}; - var listener = sinon.stub(); + let listener = sinon.stub(); state.on('key1Changed', listener); state.key1 = state.key1; assert.strictEqual(1, listener.callCount); }); - it('should emit a preemptive batch event with all state changes for the cycle for providing a hook point', function(done) { - var state = createStateInstance(); + it('should emit a preemptive batch event with all state changes for the cycle for providing a hook point', function( + done + ) { + let state = createStateInstance(); state.on('stateWillChange', function(data) { state.key2 = 20; @@ -795,8 +778,10 @@ describe('State', function() { state.key1 = 10; }); - it('should emit a batch event with all state changes for the cycle', function(done) { - var state = createStateInstance(); + it('should emit a batch event with all state changes for the cycle', function( + done + ) { + let state = createStateInstance(); state.on('stateChanged', function(data, facade) { assert.strictEqual(2, Object.keys(data.changes).length); @@ -817,17 +802,17 @@ describe('State', function() { }); it('should pass given event data with change events', function() { - var state = new State({ - key1: 10 + let state = new State({ + key1: 10, }); state.configState({ - key1: {} + key1: {}, }); state.setEventData({ - foo: 'bar' + foo: 'bar', }); - var listener = sinon.stub(); + let listener = sinon.stub(); state.on('key1Changed', listener); state.key1 = 2; @@ -835,21 +820,23 @@ describe('State', function() { foo: 'bar', key: 'key1', newVal: 2, - prevVal: 10 + prevVal: 10, }; assert.strictEqual(1, listener.callCount); assert.deepEqual(expected, listener.args[0][0]); }); - it('should call callback function from setState asynchronously after the batch event is triggered', function(done) { - var state = createStateInstance(); + it('should call callback function from setState asynchronously after the batch event is triggered', function( + done + ) { + let state = createStateInstance(); - var listener = sinon.stub(); + let listener = sinon.stub(); state.on('stateChanged', listener); - var newState = { + let newState = { key1: 12, - key2: 21 + key2: 21, }; state.setState(newState, function() { assert.strictEqual(1, listener.callCount); @@ -858,31 +845,31 @@ describe('State', function() { }); it('should get all state values', function() { - var state = createStateInstance(); + let state = createStateInstance(); state.key1 = 10; - var stateObj = state.getState(); + let stateObj = state.getState(); assert.strictEqual(2, Object.keys(stateObj).length); assert.strictEqual(10, stateObj.key1); assert.strictEqual(2, stateObj.key2); }); it('should get values for the specified state keys', function() { - var state = createStateInstance(); + let state = createStateInstance(); state.key1 = 10; - var stateObj = state.getState(['key1']); + let stateObj = state.getState(['key1']); assert.strictEqual(1, Object.keys(stateObj).length); assert.strictEqual(10, stateObj.key1); }); it('should set all state values', function() { - var state = createStateInstance(); + let state = createStateInstance(); state.setState({ key1: 10, - key2: 20 + key2: 20, }); assert.strictEqual(10, state.key1); @@ -890,11 +877,11 @@ describe('State', function() { }); it('should not change properties that are not state keys via "setState"', function() { - var state = createStateInstance(); + let state = createStateInstance(); state.myVar = 1; state.setState({ key1: 10, - myVar: 2 + myVar: 2, }); assert.strictEqual(10, state.key1); @@ -902,12 +889,12 @@ describe('State', function() { }); it('should check if a state key\'s value has already been set', function() { - var state = new State({ - key1: 1 + let state = new State({ + key1: 1, }); state.configState({ key1: {}, - key2: {} + key2: {}, }); assert.ok(state.hasBeenSet('key1')); @@ -918,7 +905,7 @@ describe('State', function() { }); it('should not run setter, validator or events for removed state keys', function() { - var state = new State(); + let state = new State(); state.configState({ key1: { setter: function(val) { @@ -926,10 +913,10 @@ describe('State', function() { }, validator: function(val) { return val > 0; - } - } + }, + }, }); - var listener = sinon.stub(); + let listener = sinon.stub(); state.on('key1Changed', listener); state.removeStateKey('key1'); @@ -942,145 +929,141 @@ describe('State', function() { describe('Static STATE', function() { function createTestClass() { - class Test extends State { - } + class Test extends State {} return Test; } it('should automatically add state keys defined by STATE', function() { - var Test = createTestClass(); + let Test = createTestClass(); Test.STATE = { key1: { - value: 1 - } + value: 1, + }, }; - var test = new Test(); + let test = new Test(); assert.strictEqual(1, test.key1); }); it('should use config object from constructor to initialize state', function() { - var Test = createTestClass(); + let Test = createTestClass(); Test.STATE = { key1: { - value: 1 - } + value: 1, + }, }; - var test = new Test({ - key1: 2 + let test = new Test({ + key1: 2, }); assert.strictEqual(2, test.key1); }); it('should merge STATE from super class', function() { - var Test = createTestClass(); + let Test = createTestClass(); Test.STATE = { key1: { - value: 1 + value: 1, }, key2: { - value: 2 - } + value: 2, + }, }; - class ChildTest extends Test { - } + class ChildTest extends Test {} ChildTest.STATE = { key1: { - value: -1 + value: -1, }, key3: { - value: 3 - } + value: 3, + }, }; - var child = new ChildTest(); + let child = new ChildTest(); assert.strictEqual(-1, child.key1); assert.strictEqual(2, child.key2); assert.strictEqual(3, child.key3); - var test = new Test(); + let test = new Test(); assert.strictEqual(1, test.key1); assert.strictEqual(2, test.key2); assert.strictEqual(undefined, test.key3); }); it('should get STATE property value of given constructor', function() { - var Test = createTestClass(); + let Test = createTestClass(); Test.STATE = { key1: { - value: 1 + value: 1, }, key2: { - value: 2 - } + value: 2, + }, }; - class ChildTest extends Test { - } + class ChildTest extends Test {} ChildTest.STATE = { key1: { - value: -1 + value: -1, }, key3: { - value: 3 - } + value: 3, + }, }; - assert.deepEqual({ - key1: { - value: -1 - }, - key2: { - value: 2 + assert.deepEqual( + { + key1: { + value: -1, + }, + key2: { + value: 2, + }, + key3: { + value: 3, + }, }, - key3: { - value: 3 - } - }, State.getStateStatic(ChildTest)); + State.getStateStatic(ChildTest) + ); }); it('should conflict STATE properties from instance with previous instances', function() { - var Test = createTestClass(); + let Test = createTestClass(); Test.STATE = { - key1: { - } + key1: {}, }; - var test1 = new Test({ - key1: 'foo1' + let test1 = new Test({ + key1: 'foo1', }); assert.strictEqual('foo1', test1.key1); - var test2 = new Test({ - key1: 'foo2' + let test2 = new Test({ + key1: 'foo2', }); assert.strictEqual('foo2', test2.key1); assert.strictEqual('foo1', test1.key1); }); it('should configure static STATE with multiple levels of class inheritance', function() { - var Test = createTestClass(); + let Test = createTestClass(); Test.STATE = { - key1: { - } + key1: {}, }; - class Child extends Test { - } + class Child extends Test {} Child.STATE = { - key2: { - } + key2: {}, }; - var test = new Test({ - key1: 'foo1' + let test = new Test({ + key1: 'foo1', }); assert.strictEqual('foo1', test.key1); - var child = new Child({ - key2: 'foo2' + let child = new Child({ + key2: 'foo2', }); assert.strictEqual('foo1', test.key1); assert.strictEqual('foo2', child.key2); @@ -1089,28 +1072,27 @@ describe('State', function() { describe('Separate object', function() { it('should add state properties to given object', function() { - var obj = {}; - var state = new State({}, obj); + let obj = {}; + let state = new State({}, obj); state.configState({ key1: {}, - key2: {} + key2: {}, }); - var keys = Object.keys(obj); + let keys = Object.keys(obj); assert.strictEqual(2, keys.length); assert.deepEqual(['key1', 'key2'], keys.sort()); }); it('should add state properties from STATE static variable to object under given name', function() { - class Test extends State { - } + class Test extends State {} Test.STATE = { key1: { - value: 1 - } + value: 1, + }, }; - var obj = {}; + let obj = {}; new Test({}, obj); assert.strictEqual(1, obj.key1); }); @@ -1125,29 +1107,26 @@ describe('State', function() { Test.STATE = { key1: { setter: 'setFn', - value: 1 - } + value: 1, + }, }; - var obj = { + let obj = { setFn(val) { return 'obj:' + val; - } + }, }; new Test({}, obj, obj); assert.strictEqual('obj:1', obj.key1); }); it('should use given context object when emitting change events', function() { - class Test extends State { - } + class Test extends State {} Test.STATE = { - key1: { - } + key1: {}, }; - class Test2 extends EventEmitter { - } + class Test2 extends EventEmitter {} const obj = new Test2(); const listener = sinon.stub(); obj.on('key1Changed', listener); @@ -1161,27 +1140,30 @@ describe('State', function() { const expected = { key: 'key1', newVal: 2, - prevVal: undefined + prevVal: undefined, }; assert.deepEqual(expected, listener.args[0][0]); }); it('should pass given context object when calling validator', function() { - var validator = sinon.stub().returns(true); - class Test extends State { - } + let validator = sinon.stub().returns(true); + class Test extends State {} Test.STATE = { key1: { - validator - } + validator, + }, }; - var obj = {}; - var context = {}; - var key1 = 1; - new Test({ - key1 - }, obj, context); + let obj = {}; + let context = {}; + let key1 = 1; + new Test( + { + key1, + }, + obj, + context + ); assert.strictEqual(1, obj.key1); assert.strictEqual(1, validator.callCount); assert.strictEqual(1, validator.args[0][0]); @@ -1190,26 +1172,26 @@ describe('State', function() { }); it('should remove state properties from object under given name', function() { - var obj = {}; - var state = new State({}, obj); + let obj = {}; + let state = new State({}, obj); state.configState({ key1: {}, - key2: {} + key2: {}, }); state.removeStateKey('key1'); - var keys = Object.keys(obj); + let keys = Object.keys(obj); assert.strictEqual(1, keys.length); assert.deepEqual('key2', keys[0]); }); it('should create new object with same state properties when getState is called', function() { - var obj = {}; - var state = new State({}, obj); + let obj = {}; + let state = new State({}, obj); state.configState({ key1: {}, - key2: {} + key2: {}, }); assert.deepEqual(obj, state.getState()); @@ -1217,14 +1199,14 @@ describe('State', function() { }); it('should emit event when state property changes', function() { - var obj = {}; - var state = new State({}, obj); + let obj = {}; + let state = new State({}, obj); state.configState({ key1: {}, - key2: {} + key2: {}, }); - var listener = sinon.stub(); + let listener = sinon.stub(); state.on('key1Changed', listener); obj.key1 = 'newVal'; @@ -1252,8 +1234,10 @@ describe('State', function() { console.warn = originalWarnFn; }); - it('should not throw error when trying to emit scheduled stateChanged after disposed', function(done) { - var state = createStateInstance(); + it('should not throw error when trying to emit scheduled stateChanged after disposed', function( + done + ) { + let state = createStateInstance(); state.key1 = 10; state.dispose(); @@ -1263,38 +1247,38 @@ describe('State', function() { }); it('should warn if trying to get state property after disposed', function() { - var state = createStateInstance(); + let state = createStateInstance(); state.dispose(); assert.doesNotThrow(() => state.key1); assert.strictEqual(1, console.warn.callCount); }); it('should warn if trying to set state property after disposed', function() { - var state = createStateInstance(); + let state = createStateInstance(); state.dispose(); - assert.doesNotThrow(() => state.key1 = 'new'); + assert.doesNotThrow(() => (state.key1 = 'new')); assert.strictEqual(1, console.warn.callCount); }); it('should warn if trying to use "setState" after disposed', function() { - var state = createStateInstance(); + let state = createStateInstance(); state.dispose(); assert.doesNotThrow(() => { state.setState({ - key1: 'new' + key1: 'new', }); }); assert.strictEqual(1, console.warn.callCount); }); it('should not throw error if trying to use "getState" after disposed', function() { - var state = createStateInstance(); + let state = createStateInstance(); state.dispose(); assert.doesNotThrow(() => state.getState()); }); it('should not throw error if trying to use "getStateKeyConfig" after disposed', function() { - var state = createStateInstance(); + let state = createStateInstance(); state.dispose(); assert.doesNotThrow(() => state.getStateKeyConfig()); }); @@ -1302,14 +1286,14 @@ describe('State', function() { }); function createStateInstance() { - var state = new State(); + let state = new State(); state.configState({ key1: { - value: 1 + value: 1, }, key2: { - value: 2 - } + value: 2, + }, }); return state; diff --git a/packages/metal-state/test/validators.js b/packages/metal-state/test/validators.js index 7c8aec14..be251dca 100644 --- a/packages/metal-state/test/validators.js +++ b/packages/metal-state/test/validators.js @@ -66,10 +66,8 @@ describe('validators', function() { }); it('should validate an instance of a class', function() { - class TestClass { - } - class TestClass2 { - } + class TestClass {} + class TestClass2 {} const instanceOfFn = validators.instanceOf(TestClass); @@ -91,12 +89,7 @@ describe('validators', function() { }); it('should validate equality against an array of values', function() { - const validator = validators.oneOf( - [ - 'one', - 1 - ] - ); + const validator = validators.oneOf(['one', 1]); assert.isTrue(validator('one')); assert.isTrue(validator(1)); @@ -110,12 +103,10 @@ describe('validators', function() { }); it('should validate one of certain types', function() { - const oneOfType = validators.oneOfType( - [ - validators.string, - validators.number - ] - ); + const oneOfType = validators.oneOfType([ + validators.string, + validators.number, + ]); assert.isTrue(oneOfType('test')); @@ -125,11 +116,9 @@ describe('validators', function() { }); it('should fail if an array is not supplied to oneOfType', function() { - const validator = validators.oneOfType( - { - one: validators.string - } - ); + const validator = validators.oneOfType({ + one: validators.string, + }); assert.ok(validator({}) instanceof Error); }); @@ -137,32 +126,40 @@ describe('validators', function() { it('should validate an object with certain types of values', function() { const objectOf = validators.objectOf(validators.number); - assert.isTrue(objectOf({ - a: 1, - b: 2 - })); + assert.isTrue( + objectOf({ + a: 1, + b: 2, + }) + ); - assert.ok(objectOf({ + assert.ok( + objectOf({ a: '1', - b: '2' - }) instanceof Error); + b: '2', + }) instanceof Error + ); }); it('should validate a shape of an object', function() { const shape = validators.shapeOf({ a: validators.string, - b: validators.number + b: validators.number, }); - assert.isTrue(shape({ - a: '1', - b: 2 - })); + assert.isTrue( + shape({ + a: '1', + b: 2, + }) + ); - assert.ok(shape({ + assert.ok( + shape({ a: '1', - b: '2' - }) instanceof Error); + b: '2', + }) instanceof Error + ); }); it('should validate a shape nested within a shape', function() { @@ -171,31 +168,37 @@ describe('validators', function() { b: { config: { required: true, - validator: validators.string - } - } - }) + validator: validators.string, + }, + }, + }), }); - assert.isTrue(shape({ - a: { - b: 'test' - } - })); + assert.isTrue( + shape({ + a: { + b: 'test', + }, + }) + ); - assert.ok(shape({ + assert.ok( + shape({ a: { - b: 1 - } - }) instanceof Error); + b: 1, + }, + }) instanceof Error + ); - assert.ok(shape({ - a: 1 - }) instanceof Error); + assert.ok( + shape({ + a: 1, + }) instanceof Error + ); }); it('should return validator function instead of running it if no arg is passed to type validator', function() { - var validatorFn = validators.bool(); + let validatorFn = validators.bool(); assert.isTrue(core.isFunction(validatorFn)); assert.isTrue(validatorFn(true)); assert.ok(validatorFn('true') instanceof Error); @@ -211,7 +214,8 @@ describe('validators', function() { const NAME = 'name'; const PARENT_COMPONENT_NAME = 'parentComponent'; - const ERROR_MESSAGE = `Error: Warning: Invalid state passed to '${NAME}'. ` + + const ERROR_MESSAGE = + `Error: Warning: Invalid state passed to '${NAME}'. ` + `Expected type 'string', but received type 'number'. ` + `Passed to '${COMPONENT_NAME}'. Check render ` + `method of '${PARENT_COMPONENT_NAME}'.`; @@ -222,15 +226,15 @@ describe('validators', function() { getParent: () => { return { constructor: { - name: PARENT_COMPONENT_NAME - } + name: PARENT_COMPONENT_NAME, + }, }; - } + }, }; }, constructor: { - name: COMPONENT_NAME - } + name: COMPONENT_NAME, + }, }; const resultError = validators.string(1, NAME, context); diff --git a/packages/metal-web-component/src/define_web_component.js b/packages/metal-web-component/src/define_web_component.js index 1746724d..1aae7e91 100644 --- a/packages/metal-web-component/src/define_web_component.js +++ b/packages/metal-web-component/src/define_web_component.js @@ -1,5 +1,5 @@ -import State, { mergeState } from 'metal-state'; -import { getStaticProperty, isObject } from 'metal'; +import State, {mergeState} from 'metal-state'; +import {getStaticProperty, isObject} from 'metal'; /** * Register a custom element for a given Metal component. @@ -74,7 +74,7 @@ export function defineWebComponent(tagName, Ctor) { if (useShadowDOM) { element = this.attachShadow({ - mode: 'open' + mode: 'open', }); } @@ -128,13 +128,13 @@ export function defineWebComponent(tagName, Ctor) { emit: function(...data) { const eventData = data.pop(); const event = new CustomEvent(eventData.type, { - detail: data + detail: data, }); this.dispatchEvent(event); - } + }, }); window.customElements.define(tagName, CustomElement); -}; +} export default defineWebComponent; diff --git a/packages/metal-web-component/test/define_web_component.js b/packages/metal-web-component/test/define_web_component.js index 17e5c008..b1f9dce8 100644 --- a/packages/metal-web-component/test/define_web_component.js +++ b/packages/metal-web-component/test/define_web_component.js @@ -3,9 +3,9 @@ import Component from 'metal-component'; import Soy from 'metal-soy'; import UA from 'metal-useragent'; -import { JSXComponent } from 'metal-jsx'; +import {JSXComponent} from 'metal-jsx'; -import { defineWebComponent } from '../src/define_web_component'; +import {defineWebComponent} from '../src/define_web_component'; describe('Web components', function() { let el; @@ -81,7 +81,10 @@ describe('Web components', function() { document.body.appendChild(el); - assert.equal(el.shadowRoot.innerHTML, '
'); + assert.equal( + el.shadowRoot.innerHTML, + '
' + ); }); it('should render custom element via html', function() { @@ -91,19 +94,26 @@ describe('Web components', function() { document.body.innerHTML = innerHTML; - assert.equal(document.body.innerHTML, '
'); + assert.equal( + document.body.innerHTML, + '
' + ); }); it('should render custom element via html when useshadowdom is true', function() { const tagName = createWebComponent('custom-test-element-07'); - const innerHTML = '<' + tagName + ' useshadowdom="true">'; + const innerHTML = + '<' + tagName + ' useshadowdom="true">'; document.body.innerHTML = innerHTML; el = document.querySelector(tagName); - assert.equal(el.shadowRoot.innerHTML, '
'); + assert.equal( + el.shadowRoot.innerHTML, + '
' + ); }); it('should deserialize attribute if json is passed', function() { @@ -186,7 +196,10 @@ describe('Web components', function() { document.body.appendChild(el); - assert.equal(el.shadowRoot.innerHTML, '
'); + assert.equal( + el.shadowRoot.innerHTML, + '
' + ); }); it('should render custom element via html', function() { @@ -196,19 +209,26 @@ describe('Web components', function() { document.body.innerHTML = innerHTML; - assert.equal(document.body.innerHTML, '
'); + assert.equal( + document.body.innerHTML, + '
' + ); }); it('should render custom element via html when useshadowdom is true', function() { const tagName = createJSXWebComponent('custom-jsx-test-element-07'); - const innerHTML = '<' + tagName + ' useshadowdom="true">'; + const innerHTML = + '<' + tagName + ' useshadowdom="true">'; document.body.innerHTML = innerHTML; el = document.querySelector(tagName); - assert.equal(el.shadowRoot.innerHTML, '
'); + assert.equal( + el.shadowRoot.innerHTML, + '
' + ); }); it('should deserialize attribute if json is passed', function() { @@ -240,15 +260,16 @@ describe('Web components', function() { class WebComponent extends JSXComponent { render() { IncrementalDOM.elementVoid('div', null, [ - 'title', WebComponent.PROPS.title.value + 'title', + WebComponent.PROPS.title.value, ]); } } WebComponent.PROPS = { title: { - value: 'default title' - } + value: 'default title', + }, }; defineWebComponent(tagName, WebComponent); @@ -263,16 +284,17 @@ describe('Web components', function() { WebComponent.STATE = { title: { - value: 'default title' - } + value: 'default title', + }, }; Soy.register(WebComponent, { render: () => { IncrementalDOM.elementVoid('div', null, [ - 'title', WebComponent.STATE.title.value + 'title', + WebComponent.STATE.title.value, ]); - } + }, }); defineWebComponent(tagName, WebComponent); @@ -282,7 +304,7 @@ describe('Web components', function() { function isSafariVersion(version) { if (!UA.isSafari) return false; - const nav = window && window.navigator || {}; - return !!(new RegExp('Version\/' + version).exec(nav.userAgent)); + const nav = (window && window.navigator) || {}; + return !!new RegExp('Version/' + version).exec(nav.userAgent); } }); diff --git a/packages/metal/src/array/array.js b/packages/metal/src/array/array.js index 3ae0872c..b259b045 100644 --- a/packages/metal/src/array/array.js +++ b/packages/metal/src/array/array.js @@ -1,6 +1,6 @@ 'use strict'; -import { isDef } from '../core'; +import {isDef} from '../core'; class array { /** @@ -44,7 +44,7 @@ class array { * @return {Array.<*>} Flat array. */ static flatten(arr, opt_output) { - var output = opt_output || []; + let output = opt_output || []; for (let i = 0; i < arr.length; i++) { if (Array.isArray(arr[i])) { array.flatten(arr[i], output); @@ -65,7 +65,7 @@ class array { static remove(arr, obj) { const i = arr.indexOf(obj); let rv; - if ( (rv = i >= 0) ) { + if ((rv = i >= 0)) { array.removeAt(arr, i); } return rv; diff --git a/packages/metal/src/async/async.js b/packages/metal/src/async/async.js index 51cb48b2..ece309bc 100644 --- a/packages/metal/src/async/async.js +++ b/packages/metal/src/async/async.js @@ -1,4 +1,4 @@ -/*! +/* ! * Polyfill from Google's Closure Library. * Copyright 2013 The Closure Library Authors. All Rights Reserved. */ @@ -7,7 +7,6 @@ const async = {}; - /** * Throw an item without interrupting the current execution context. For * example, if processing a group of items in a loop, sometimes it is useful @@ -22,7 +21,6 @@ async.throwException = function(exception) { }); }; - /** * Fires the provided callback just before the current callstack unwinds, or as * soon as possible after the current JS execution context. @@ -38,15 +36,12 @@ async.run = function(callback, opt_context) { async.run.workQueueScheduled_ = true; } - async.run.workQueue_.push( - new async.run.WorkItem_(callback, opt_context)); + async.run.workQueue_.push(new async.run.WorkItem_(callback, opt_context)); }; - /** @private {boolean} */ async.run.workQueueScheduled_ = false; - /** @private {!Array.} */ async.run.workQueue_ = []; @@ -75,7 +70,6 @@ async.run.processWorkQueue = function() { async.run.workQueueScheduled_ = false; }; - /** * @constructor * @final @@ -92,7 +86,6 @@ async.run.WorkItem_ = function(fn, scope) { this.scope = scope; }; - /** * Fires the provided callbacks as soon as possible after the current JS * execution context. setTimeout(…, 0) always takes at least 5ms for legacy @@ -124,7 +117,6 @@ async.nextTick = function(callback, opt_context) { async.nextTick.setImmediate_(cb); }; - /** * Cache for the setImmediate implementation. * @type {function(function())} @@ -132,7 +124,6 @@ async.nextTick = function(callback, opt_context) { */ async.nextTick.setImmediate_ = null; - /** * Determines the best possible implementation to run a function as soon as * the JS event loop is idle. @@ -156,8 +147,12 @@ async.nextTick.getSetImmediateEmulator_ = function() { // an iframe based polyfill in browsers that have postMessage and // document.addEventListener. The latter excludes IE8 because it has a // synchronous postMessage implementation. - if (typeof Channel === 'undefined' && typeof window !== 'undefined' && - window.postMessage && window.addEventListener) { + if ( + typeof Channel === 'undefined' && + typeof window !== 'undefined' && + window.postMessage && + window.addEventListener + ) { /** @constructor */ Channel = function() { // Make an empty, invisible iframe. @@ -185,7 +180,7 @@ async.nextTick.getSetImmediateEmulator_ = function() { this.port2 = { postMessage: function() { win.postMessage(message, origin); - } + }, }; }; } @@ -202,7 +197,7 @@ async.nextTick.getSetImmediateEmulator_ = function() { }; return function(cb) { tail.next = { - cb: cb + cb: cb, }; tail = tail.next; channel.port2.postMessage(0); @@ -210,8 +205,10 @@ async.nextTick.getSetImmediateEmulator_ = function() { } // Implementation for IE6-8: Script elements fire an asynchronous // onreadystatechange event when inserted into the DOM. - if (typeof document !== 'undefined' && 'onreadystatechange' in - document.createElement('script')) { + if ( + typeof document !== 'undefined' && + 'onreadystatechange' in document.createElement('script') + ) { return function(cb) { let script = document.createElement('script'); script.onreadystatechange = function() { @@ -232,7 +229,6 @@ async.nextTick.getSetImmediateEmulator_ = function() { }; }; - /** * Helper function that is overrided to protect callbacks with entry point * monitor if the application monitors entry points. diff --git a/packages/metal/src/core.js b/packages/metal/src/core.js index 4ab49ecc..52118e70 100644 --- a/packages/metal/src/core.js +++ b/packages/metal/src/core.js @@ -7,5 +7,5 @@ import * as core from './coreNamed'; export default core; -export { core }; +export {core}; export * from './coreNamed'; diff --git a/packages/metal/src/coreNamed.js b/packages/metal/src/coreNamed.js index 34e94919..2a59c487 100644 --- a/packages/metal/src/coreNamed.js +++ b/packages/metal/src/coreNamed.js @@ -19,7 +19,7 @@ let uniqueIdCounter_ = 1; * @type {String} * @protected */ -export const UID_PROPERTY = `core_${((Math.random() * 1e9) >>> 0)}`; +export const UID_PROPERTY = `core_${(Math.random() * 1e9) >>> 0}`; /** * When defining a class Foo with an abstract method bar(), you can do: @@ -262,7 +262,7 @@ export function isWindow(val) { */ export function isObject(val) { const type = typeof val; - return type === 'object' && val !== null || type === 'function'; + return (type === 'object' && val !== null) || type === 'function'; } /** @@ -290,15 +290,16 @@ export function isString(val) { * @return {boolean} */ export function isServerSide() { - return typeof process !== 'undefined' && + return ( + typeof process !== 'undefined' && typeof process.env !== 'undefined' && process.env.NODE_ENV !== 'test' && - !process.browser; + !process.browser + ); } /** * Null function used for default values of callbacks, etc. * @return {void} Nothing. */ -export function nullFunction() { -} +export function nullFunction() {} diff --git a/packages/metal/src/metal.js b/packages/metal/src/metal.js index 89ce955b..795af88f 100644 --- a/packages/metal/src/metal.js +++ b/packages/metal/src/metal.js @@ -8,5 +8,5 @@ import object from './object/object'; import string from './string/string'; export * from './core'; -export { array, async, Disposable, object, string }; +export {array, async, Disposable, object, string}; export default core; diff --git a/packages/metal/src/string/string.js b/packages/metal/src/string/string.js index 27c806ec..f612a3af 100644 --- a/packages/metal/src/string/string.js +++ b/packages/metal/src/string/string.js @@ -29,15 +29,17 @@ class string { * @return {string} Copy of the string with normalized breaking spaces. */ static collapseBreakingSpaces(str) { - return str.replace(/[\t\r\n ]+/g, ' ').replace(/^[\t\r\n ]+|[\t\r\n ]+$/g, ''); + return str + .replace(/[\t\r\n ]+/g, ' ') + .replace(/^[\t\r\n ]+|[\t\r\n ]+$/g, ''); } /** - * Escapes characters in the string that are not safe to use in a RegExp. - * @param {*} str The string to escape. If not a string, it will be casted - * to one. - * @return {string} A RegExp safe, escaped copy of {@code s}. - */ + * Escapes characters in the string that are not safe to use in a RegExp. + * @param {*} str The string to escape. If not a string, it will be casted + * to one. + * @return {string} A RegExp safe, escaped copy of {@code s}. + */ static escapeRegex(str) { return String(str) .replace(/([-()\[\]{}+?*.$\^|,:# a + b); + let prop = core.getStaticProperty(Test3, 'FOO', (a, b) => a + b); assert.equal(prop, 6); }); it('should not recalculate static property after set for the first time', function() { - class Test1 { - } + class Test1 {} Test1.FOO = 1; - class Test2 extends Test1 { - } + class Test2 extends Test1 {} Test2.FOO = 2; - class Test3 extends Test2 { - } + class Test3 extends Test2 {} Test3.FOO = 3; const mergeFn = sinon.stub().returns(1); - var prop = core.getStaticProperty(Test3, 'FOO', mergeFn); + let prop = core.getStaticProperty(Test3, 'FOO', mergeFn); assert.equal(2, mergeFn.callCount); assert.equal(prop, core.getStaticProperty(Test3, 'FOO', mergeFn)); @@ -105,8 +94,8 @@ describe('core', function() { it('should return the first arg passed to identity function', function() { assert.strictEqual(1, core.identityFunction(1)); - var obj = { - a: 2 + let obj = { + a: 2, }; assert.strictEqual(obj, core.identityFunction(obj)); }); @@ -154,9 +143,11 @@ describe('core', function() { assert.ok(!core.isPromise(null)); assert.ok(!core.isPromise(undefined)); - assert.ok(core.isPromise({ - then: core.nullFunction - })); + assert.ok( + core.isPromise({ + then: core.nullFunction, + }) + ); }); it('should check if var is string', function() { @@ -187,27 +178,33 @@ describe('core', function() { }); it('should check if var is element', function() { - assert.ok(core.isElement({ - nodeType: 1 - })); + assert.ok( + core.isElement({ + nodeType: 1, + }) + ); assert.ok(!core.isElement({})); assert.ok(!core.isElement(null)); assert.ok(!core.isElement(true)); }); it('should check if var is document', function() { - assert.ok(core.isDocument({ - nodeType: 9 - })); - assert.ok(!core.isDocument({ - nodeType: 1 - })); + assert.ok( + core.isDocument({ + nodeType: 9, + }) + ); + assert.ok( + !core.isDocument({ + nodeType: 1, + }) + ); assert.ok(!core.isDocument({})); assert.ok(!core.isDocument(null)); assert.ok(!core.isDocument(true)); }); - it('should check if var is document fragment', function () { + it('should check if var is document fragment', function() { assert.ok(!core.isDocumentFragment(null)); assert.ok(!core.isDocumentFragment({nodeType: 0})); assert.ok(!core.isDocumentFragment({nodeType: 9})); @@ -220,12 +217,16 @@ describe('core', function() { return; } - assert.ok(!core.isWindow({ - nodeType: 9 - })); - assert.ok(!core.isWindow({ - nodeType: 1 - })); + assert.ok( + !core.isWindow({ + nodeType: 9, + }) + ); + assert.ok( + !core.isWindow({ + nodeType: 1, + }) + ); assert.ok(core.isWindow(window)); assert.ok(!core.isWindow(null)); assert.ok(!core.isWindow(true)); @@ -264,8 +265,7 @@ describe('core', function() { describe('getFunctionName', function() { it('should return the name of the given function', function() { - function myFunction() { - } + function myFunction() {} assert.strictEqual('myFunction', core.getFunctionName(myFunction)); }); }); diff --git a/packages/metal/test/disposable/Disposable.js b/packages/metal/test/disposable/Disposable.js index b4517d5a..8c98b61e 100644 --- a/packages/metal/test/disposable/Disposable.js +++ b/packages/metal/test/disposable/Disposable.js @@ -4,7 +4,7 @@ import Disposable from '../../src/disposable/Disposable'; describe('Disposable', function() { it('should correctly inform if the instance has been disposed', function() { - var disposable = new Disposable(); + let disposable = new Disposable(); assert.ok(!disposable.isDisposed()); @@ -13,28 +13,25 @@ describe('Disposable', function() { }); it('should call `disposeInternal` when running `dispose`', function() { - class TestDisposable extends Disposable { - } + class TestDisposable extends Disposable {} TestDisposable.prototype.disposeInternal = sinon.stub(); - var testDisposable = new TestDisposable(); + let testDisposable = new TestDisposable(); testDisposable.dispose(); assert.strictEqual(1, testDisposable.disposeInternal.callCount); }); it('should not dispose more than once', function() { - class TestDisposable extends Disposable { - } + class TestDisposable extends Disposable {} TestDisposable.prototype.disposeInternal = sinon.stub(); - var testDisposable = new TestDisposable(); + let testDisposable = new TestDisposable(); testDisposable.dispose(); testDisposable.dispose(); assert.strictEqual(1, testDisposable.disposeInternal.callCount); - }); }); diff --git a/packages/metal/test/object/object.js b/packages/metal/test/object/object.js index 9db26d8b..3a6468f7 100644 --- a/packages/metal/test/object/object.js +++ b/packages/metal/test/object/object.js @@ -4,15 +4,21 @@ import object from '../../src/object/object'; describe('object', function() { it('should mixin object arguments', function() { - var original = {}; + let original = {}; - var mixin = object.mixin(original, { - a: 1 - }, { - b: 1 - }, { - b: 2 - }, null); + let mixin = object.mixin( + original, + { + a: 1, + }, + { + b: 1, + }, + { + b: 2, + }, + null + ); assert.strictEqual(original, mixin); assert.strictEqual(1, mixin.a); @@ -21,9 +27,9 @@ describe('object', function() { }); it('should mixin array arguments', function() { - var original = []; + let original = []; - var mixin = object.mixin(original, [null, 2, 3], [1]); + let mixin = object.mixin(original, [null, 2, 3], [1]); assert.strictEqual(original, mixin); assert.deepEqual([1, 2, 3], mixin); @@ -35,52 +41,52 @@ describe('object', function() { return; } window.Foo = { - Bar: 1 + Bar: 1, }; assert.strictEqual(1, object.getObjectByName('Foo.Bar')); assert.strictEqual(undefined, object.getObjectByName('Foo.Bar.None')); }); it('should get object by name from object', function() { - var obj = { + let obj = { Foo: { - Bar: 1 - } + Bar: 1, + }, }; assert.strictEqual(1, object.getObjectByName('Foo.Bar', obj)); assert.strictEqual(undefined, object.getObjectByName('Foo.Bar.None', obj)); }); it('should map an object\'s content to a new object', function() { - var obj = { + let obj = { a: 1, - b: 2 + b: 2, }; - var mappedObj = object.map(obj, (key, value) => key + ':' + value); - var expectedObj = { + let mappedObj = object.map(obj, (key, value) => key + ':' + value); + let expectedObj = { a: 'a:1', - b: 'b:2' + b: 'b:2', }; assert.deepEqual(expectedObj, mappedObj); }); it('should check if two objects are shallowly equal', function() { - var obj1 = {}; + let obj1 = {}; assert.ok(object.shallowEqual(obj1, obj1)); - var obj2 = { - a: 1 + let obj2 = { + a: 1, }; assert.ok(!object.shallowEqual(obj1, obj2)); - var obj3 = { - a: 1 + let obj3 = { + a: 1, }; assert.ok(!object.shallowEqual(obj1, obj3)); assert.ok(object.shallowEqual(obj2, obj3)); - var obj4 = { - a: 2 + let obj4 = { + a: 2, }; assert.ok(!object.shallowEqual(obj1, obj4)); assert.ok(!object.shallowEqual(obj2, obj4)); diff --git a/packages/metal/test/string/string.js b/packages/metal/test/string/string.js index e27a4921..4309384c 100644 --- a/packages/metal/test/string/string.js +++ b/packages/metal/test/string/string.js @@ -15,7 +15,10 @@ describe('string', function() { }); it('should collapse breaking spaces', function() { - assert.strictEqual('foo bar', string.collapseBreakingSpaces(' foo bar ')); + assert.strictEqual( + 'foo bar', + string.collapseBreakingSpaces(' foo bar ') + ); }); it('should generate random strings', function() { @@ -27,8 +30,8 @@ describe('string', function() { }); it('should escape regex', function() { - var spec = '()[]{}+-?*.$^|,:# Date: Thu, 9 Nov 2017 22:04:58 -0800 Subject: [PATCH 03/70] Fixes lint errors in metal package --- packages/metal/src/array/array.js | 15 ++++---- packages/metal/src/async/async.js | 19 +++++----- packages/metal/src/coreNamed.js | 40 ++++++++++++--------- packages/metal/src/disposable/Disposable.js | 3 ++ packages/metal/src/object/object.js | 22 ++++++++---- packages/metal/src/string/string.js | 7 ++-- packages/metal/test/.eslintrc | 10 ++++++ packages/metal/test/.eslintrc.json | 11 ------ packages/metal/test/array/array.js | 4 +-- 9 files changed, 75 insertions(+), 56 deletions(-) create mode 100644 packages/metal/test/.eslintrc delete mode 100644 packages/metal/test/.eslintrc.json diff --git a/packages/metal/src/array/array.js b/packages/metal/src/array/array.js index b259b045..b12fdad9 100644 --- a/packages/metal/src/array/array.js +++ b/packages/metal/src/array/array.js @@ -1,7 +1,8 @@ 'use strict'; -import {isDef} from '../core'; - +/** + * Set of utilities for array operations + */ class array { /** * Checks if the given arrays have the same content. @@ -40,11 +41,10 @@ class array { /** * Transforms the input nested array to become flat. * @param {Array.<*|Array.<*>>} arr Nested array to flatten. - * @param {Array.<*>} opt_output Optional output array. + * @param {Array.<*>=} output Optional output array. * @return {Array.<*>} Flat array. */ - static flatten(arr, opt_output) { - let output = opt_output || []; + static flatten(arr, output = []) { for (let i = 0; i < arr.length; i++) { if (Array.isArray(arr[i])) { array.flatten(arr[i], output); @@ -86,14 +86,13 @@ class array { * is faster and working on all array-like objects (like arguments). * @param {!Object} arr Array-like object to slice. * @param {number} start The index that should start the slice. - * @param {number=} opt_end The index where the slice should end, not + * @param {number=} end The index where the slice should end, not * included in the final array. If not given, all elements after the * start index will be included. * @return {!Array} */ - static slice(arr, start, opt_end) { + static slice(arr, start, end = arr.length) { const sliced = []; - const end = isDef(opt_end) ? opt_end : arr.length; for (let i = start; i < end; i++) { sliced.push(arr[i]); } diff --git a/packages/metal/src/async/async.js b/packages/metal/src/async/async.js index ece309bc..dd006052 100644 --- a/packages/metal/src/async/async.js +++ b/packages/metal/src/async/async.js @@ -25,18 +25,18 @@ async.throwException = function(exception) { * Fires the provided callback just before the current callstack unwinds, or as * soon as possible after the current JS execution context. * @param {function(this:THIS)} callback - * @param {THIS=} opt_context Object to use as the "this value" when calling + * @param {THIS=} context Object to use as the "this value" when calling * the provided function. * @template THIS */ -async.run = function(callback, opt_context) { +async.run = function(callback, context) { if (!async.run.workQueueScheduled_) { // Nothing is currently scheduled, schedule it now. async.nextTick(async.run.processWorkQueue); async.run.workQueueScheduled_ = true; } - async.run.workQueue_.push(new async.run.WorkItem_(callback, opt_context)); + async.run.workQueue_.push(new async.run.WorkItem_(callback, context)); }; /** @private {boolean} */ @@ -92,13 +92,13 @@ async.run.WorkItem_ = function(fn, scope) { * reasons. * @param {function(this:SCOPE)} callback Callback function to fire as soon as * possible. - * @param {SCOPE=} opt_context Object in whose scope to call the listener. + * @param {SCOPE=} context Object in whose scope to call the listener. * @template SCOPE */ -async.nextTick = function(callback, opt_context) { +async.nextTick = function(callback, context) { let cb = callback; - if (opt_context) { - cb = callback.bind(opt_context); + if (context) { + cb = callback.bind(context); } cb = async.nextTick.wrapCallback_(cb); // Introduced and currently only supported by IE10. @@ -112,6 +112,7 @@ async.nextTick = function(callback, opt_context) { } // Look for and cache the custom fallback version of setImmediate. if (!async.nextTick.setImmediate_) { + // eslint-disable-next-line async.nextTick.setImmediate_ = async.nextTick.getSetImmediateEmulator_(); } async.nextTick.setImmediate_(cb); @@ -236,8 +237,8 @@ async.nextTick.getSetImmediateEmulator_ = function() { * @return {function()} The wrapped callback. * @private */ -async.nextTick.wrapCallback_ = function(opt_returnValue) { - return opt_returnValue; +async.nextTick.wrapCallback_ = function(callback) { + return callback; }; export default async; diff --git a/packages/metal/src/coreNamed.js b/packages/metal/src/coreNamed.js index 2a59c487..0dbfd127 100644 --- a/packages/metal/src/coreNamed.js +++ b/packages/metal/src/coreNamed.js @@ -50,7 +50,7 @@ export function disableCompatibilityMode() { * using "key" to keep working like before. NOTE: this may cause * problems, since "key" is meant to be used differently. Only use this * if it's not possible to upgrade the code to use "ref" instead. - * @param {Object=} opt_data Optional object with data to specify more + * @param {Object=} data Optional object with data to specify more * details, such as: * - renderers {Array} the template renderers that should be in * compatibility mode, either their constructors or strings @@ -58,8 +58,8 @@ export function disableCompatibilityMode() { * that extend from IncrementalDomRenderer. * @type {Object} */ -export function enableCompatibilityMode(opt_data = {}) { - compatibilityModeData_ = opt_data; +export function enableCompatibilityMode(data = {}) { + compatibilityModeData_ = data; } /** @@ -112,17 +112,22 @@ export function getFunctionName(fn) { * be recalculated even if this function is called multiple times. * @param {!function()} ctor Class constructor. * @param {string} propertyName Property name to be merged. - * @param {function(*, *):*=} opt_mergeFn Function that receives the merged + * @param {function(*, *):*=} mergeFn Function that receives the merged * value of the property so far and the next value to be merged to it. * Should return these two merged together. If not passed the final property * will be the first truthy value among ancestors. + * @return {Object} */ -export function getStaticProperty(ctor, propertyName, opt_mergeFn) { +export function getStaticProperty( + ctor, + propertyName, + mergeFn = getFirstTruthy_ +) { const mergedName = propertyName + '_MERGED'; if (!ctor.hasOwnProperty(mergedName)) { + // eslint-disable-next-line let merged = ctor.hasOwnProperty(propertyName) ? ctor[propertyName] : null; if (ctor.__proto__ && !ctor.__proto__.isPrototypeOf(Function)) { - const mergeFn = opt_mergeFn || getFirstTruthy_; merged = mergeFn( merged, getStaticProperty(ctor.__proto__, propertyName, mergeFn) @@ -134,34 +139,35 @@ export function getStaticProperty(ctor, propertyName, opt_mergeFn) { } /** - * Gets an unique id. If `opt_object` argument is passed, the object is + * Gets an unique id. If `object` argument is passed, the object is * mutated with an unique id. Consecutive calls with the same object * reference won't mutate the object again, instead the current object uid * returns. See {@link UID_PROPERTY}. - * @param {Object=} opt_object Optional object to be mutated with the uid. If + * @param {Object=} object Optional object to be mutated with the uid. If * not specified this method only returns the uid. - * @param {boolean=} opt_noInheritance Optional flag indicating if this + * @param {boolean=} noInheritance Optional flag indicating if this * object's uid property can be inherited from parents or not. * @throws {Error} when invoked to indicate the method should be overridden. + * @return {number} */ -export function getUid(opt_object, opt_noInheritance) { - if (opt_object) { - let id = opt_object[UID_PROPERTY]; - if (opt_noInheritance && !opt_object.hasOwnProperty(UID_PROPERTY)) { +export function getUid(object, noInheritance) { + if (object) { + let id = object[UID_PROPERTY]; + if (noInheritance && !object.hasOwnProperty(UID_PROPERTY)) { id = null; } - return id || (opt_object[UID_PROPERTY] = uniqueIdCounter_++); + return id || (object[UID_PROPERTY] = uniqueIdCounter_++); } return uniqueIdCounter_++; } /** * The identity function. Returns its first argument. - * @param {*=} opt_returnValue The single value that will be returned. + * @param {*=} returnValue The single value that will be returned. * @return {?} The first argument. */ -export function identityFunction(opt_returnValue) { - return opt_returnValue; +export function identityFunction(returnValue) { + return returnValue; } /** diff --git a/packages/metal/src/disposable/Disposable.js b/packages/metal/src/disposable/Disposable.js index f8788bd2..d92ea2f6 100644 --- a/packages/metal/src/disposable/Disposable.js +++ b/packages/metal/src/disposable/Disposable.js @@ -8,6 +8,9 @@ * @constructor */ class Disposable { + /** + * Disposable constructor + */ constructor() { /** * Flag indicating if this instance has already been disposed. diff --git a/packages/metal/src/object/object.js b/packages/metal/src/object/object.js index 7ab47767..71ba8dc5 100644 --- a/packages/metal/src/object/object.js +++ b/packages/metal/src/object/object.js @@ -1,5 +1,8 @@ 'use strict'; +/** + * Set of utilities for object operations + */ class object { /** * Copies all the members of a source object to a target object. @@ -7,10 +10,14 @@ class object { * @param {...Object} var_args The objects from which values will be copied. * @return {Object} Returns the target object reference. */ - static mixin(target) { - let key, source; - for (let i = 1; i < arguments.length; i++) { - source = arguments[i]; + static mixin(target, ...args) { + let key; + let source; + for (let i = 0; i < args.length; i++) { + source = args[i]; + // Possible prototype chain leak, breaks 1 metal-dom and + // 1 metal-incremental-dom test if guard-for-in rule is addressed + // eslint-disable-next-line for (key in source) { target[key] = source[key]; } @@ -21,12 +28,11 @@ class object { /** * Returns an object based on its fully qualified external name. * @param {string} name The fully qualified name. - * @param {object=} opt_obj The object within which to look; default is + * @param {object=} scope The object within which to look; default is * window. * @return {?} The value (object or primitive) or, if not found, undefined. */ - static getObjectByName(name, opt_obj) { - const scope = opt_obj || window; + static getObjectByName(name, scope = window) { const parts = name.split('.'); return parts.reduce((part, key) => part[key], scope); } @@ -50,6 +56,8 @@ class object { /** * Checks if the two given objects are equal. This is done via a shallow * check, including only the keys directly contained by the 2 objects. + * @param {Object} obj1 + * @param {Object} obj2 * @return {boolean} */ static shallowEqual(obj1, obj2) { diff --git a/packages/metal/src/string/string.js b/packages/metal/src/string/string.js index f612a3af..bf44dff1 100644 --- a/packages/metal/src/string/string.js +++ b/packages/metal/src/string/string.js @@ -1,5 +1,8 @@ 'use strict'; +/** + * Set of utilities for string operations + */ class string { /** * Compares the given strings without taking the case into account. @@ -42,8 +45,8 @@ class string { */ static escapeRegex(str) { return String(str) - .replace(/([-()\[\]{}+?*.$\^|,:# Date: Thu, 9 Nov 2017 22:07:30 -0800 Subject: [PATCH 04/70] Fixes lint errors in metal-assertions package --- .../metal-assertions/test/{.eslintrc.json => .eslintrc} | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) rename packages/metal-assertions/test/{.eslintrc.json => .eslintrc} (53%) diff --git a/packages/metal-assertions/test/.eslintrc.json b/packages/metal-assertions/test/.eslintrc similarity index 53% rename from packages/metal-assertions/test/.eslintrc.json rename to packages/metal-assertions/test/.eslintrc index 92b466f1..c6df3779 100644 --- a/packages/metal-assertions/test/.eslintrc.json +++ b/packages/metal-assertions/test/.eslintrc @@ -1,9 +1,10 @@ { - "env": { - "mocha": true - }, "globals": { "assert": true, "sinon": true + }, + "rules": { + "max-len": 0, + "require-jsdoc": 0 } -} +} \ No newline at end of file From 7ae6f60474d1f24726461d94ced5dba5e978c286 Mon Sep 17 00:00:00 2001 From: Chema Balsas Date: Thu, 9 Nov 2017 22:36:48 -0800 Subject: [PATCH 05/70] Fixes lint errors in metal-component package --- .../{.eslintrc.json => .eslintrc} | 0 packages/metal-component/src/Component.js | 83 ++++++++++--------- .../src/ComponentDataManager.js | 22 +++-- .../metal-component/src/ComponentRegistry.js | 5 +- .../metal-component/src/ComponentRenderer.js | 1 - packages/metal-component/src/events/events.js | 5 +- packages/metal-component/src/sync/sync.js | 8 +- .../test/{.eslintrc.json => .eslintrc} | 9 +- packages/metal-component/test/Component.js | 16 ++-- 9 files changed, 77 insertions(+), 72 deletions(-) rename packages/metal-component/{.eslintrc.json => .eslintrc} (100%) rename packages/metal-component/test/{.eslintrc.json => .eslintrc} (53%) diff --git a/packages/metal-component/.eslintrc.json b/packages/metal-component/.eslintrc similarity index 100% rename from packages/metal-component/.eslintrc.json rename to packages/metal-component/.eslintrc diff --git a/packages/metal-component/src/Component.js b/packages/metal-component/src/Component.js index 9b7fbea5..519178f8 100644 --- a/packages/metal-component/src/Component.js +++ b/packages/metal-component/src/Component.js @@ -82,15 +82,15 @@ import {EventEmitter, EventHandler} from 'metal-events'; class Component extends EventEmitter { /** * Constructor function for `Component`. - * @param {Object=} opt_config An object with the initial values for this + * @param {Object=} config An object with the initial values for this * component's state. - * @param {boolean|string|Element=} opt_parentElement The element where the + * @param {boolean|string|Element=} parentElement The element where the * component should be rendered. Can be given as a selector or an element. * If `false` is passed, the component won't be rendered automatically * after created. * @constructor */ - constructor(opt_config, opt_parentElement) { + constructor(config, parentElement) { super(); /** @@ -130,7 +130,7 @@ class Component extends EventEmitter { * @type {!Object} * @protected */ - this.initialConfig_ = opt_config || {}; + this.initialConfig_ = config || {}; /** * Whether the current environment is server side. @@ -167,8 +167,8 @@ class Component extends EventEmitter { this.created(); this.componentCreated_ = true; - if (opt_parentElement !== false) { - this.renderComponent(opt_parentElement); + if (parentElement !== false) { + this.renderComponent(parentElement); } } @@ -198,23 +198,24 @@ class Component extends EventEmitter { * appended to the DOM and any other action to be performed must be * implemented in this method, such as, binding DOM events. A component can * be re-attached multiple times. - * @param {(string|Element)=} opt_parentElement Optional parent element + * @param {(string|Element)=} parentElement Optional parent element * to render the component. - * @param {(string|Element)=} opt_siblingElement Optional sibling element + * @param {(string|Element)=} siblingElement Optional sibling element * to render the component before it. Relevant when the component needs * to be rendered before an existing element in the DOM. * @protected * @chainable + * @return {Component} */ - attach(opt_parentElement, opt_siblingElement) { + attach(parentElement, siblingElement) { if (!this.inDocument) { this.emit('willAttach'); this.willAttach(); - this.attachElement(opt_parentElement, opt_siblingElement); + this.attachElement(parentElement, siblingElement); this.inDocument = true; this.attachData_ = { - parent: opt_parentElement, - sibling: opt_siblingElement, + parent: parentElement, + sibling: siblingElement, }; this.emit('attached', this.attachData_); this.attached(); @@ -233,19 +234,18 @@ class Component extends EventEmitter { /** * Attaches the component element into the DOM. - * @param {(string|Element)=} opt_parentElement Optional parent element + * @param {(string|Element)=} parentElement Optional parent element * to render the component. - * @param {(string|Element)=} opt_siblingElement Optional sibling element + * @param {(string|Element)=} siblingElement Optional sibling element * to render the component before it. Relevant when the component needs * to be rendered before an existing element in the DOM, e.g. * `component.attach(null, existingElement)`. */ - attachElement(opt_parentElement, opt_siblingElement) { + attachElement(parentElement, siblingElement) { const element = this.element; - if (element && (opt_siblingElement || !element.parentNode)) { - const parent = - toElement(opt_parentElement) || this.DEFAULT_ELEMENT_PARENT; - parent.insertBefore(element, toElement(opt_siblingElement)); + if (element && (siblingElement || !element.parentNode)) { + const parent = toElement(parentElement) || this.DEFAULT_ELEMENT_PARENT; // eslint-disable-line + parent.insertBefore(element, toElement(siblingElement)); } } @@ -274,6 +274,7 @@ class Component extends EventEmitter { * implemented in this method, such as, unbinding DOM events. A component * can be detached multiple times. * @chainable + * @return {Component} */ detach() { if (this.inDocument) { @@ -326,9 +327,10 @@ class Component extends EventEmitter { /** * Forces an update that ignores the `shouldUpdate` lifecycle method for * components whose render depends on external variables. + * @param {function()} callback */ - forceUpdate(opt_callback) { - this.forceUpdateCallback_ = opt_callback; + forceUpdate(callback) { + this.forceUpdateCallback_ = callback; this.updateRenderer_({ forceUpdate: true, @@ -510,17 +512,16 @@ class Component extends EventEmitter { * will always make sure that the constructor runs without rendering the * component, having the `render` step happen only after it has finished. * @param {!function()} Ctor The component's constructor function. - * @param {Object|Element=} opt_configOrElement Optional config data or parent + * @param {Object|Element=} configOrElement Optional config data or parent * for the component. - * @param {Element=} opt_element Optional parent for the component. + * @param {Element=} element Optional parent for the component. * @return {!Component} The rendered component's instance. */ - static render(Ctor, opt_configOrElement, opt_element) { - let config = opt_configOrElement; - let element = opt_element; - if (isElement(opt_configOrElement)) { + static render(Ctor, configOrElement, element) { + let config = configOrElement; + if (isElement(configOrElement)) { config = null; - element = opt_configOrElement; + element = configOrElement; } const instance = new Ctor(config, false); instance.renderComponent(element); @@ -533,11 +534,11 @@ class Component extends EventEmitter { * rendering the component, having the `render` step happen only after it * has finished. * @param {!function()} Ctor The component's constructor function. - * @param {Object|Element=} opt_configOrElement Optional config data or + * @param {Object|Element=} configOrElement Optional config data or * parent for the component. * @return {!String} The rendered component's content as string. */ - static renderToString(Ctor, opt_config) { + static renderToString(Ctor, configOrElement) { const rendererName = Ctor.RENDERER && Ctor.RENDERER.RENDERER_NAME; switch (rendererName) { case 'jsx': @@ -557,13 +558,13 @@ class Component extends EventEmitter { // component after all nested components stack rendered. const interceptedComponentStrings = []; const patch = IncrementalDOM.patch; - const patchInterceptor = function() { - let currentElement = patch(...arguments); + const patchInterceptor = function(...args) { + let currentElement = patch(...args); interceptedComponentStrings.push(currentElement.innerHTML); IncrementalDOM.patch = patch; }; IncrementalDOM.patch = patchInterceptor; - Component.render(Ctor, opt_config).dispose(); + Component.render(Ctor, configOrElement).dispose(); return interceptedComponentStrings[0]; } default: @@ -577,12 +578,12 @@ class Component extends EventEmitter { /** * Renders the component into the DOM via its `ComponentRenderer`. Stores the * given parent element to be used when the renderer is done (`informRendered`). - * @param {(string|Element|boolean)=} opt_parentElement Optional parent element + * @param {(string|Element|boolean)=} parentElement Optional parent element * to render the component. If set to `false`, the element won't be * attached to any element after rendering. In this case, `attach` should * be called manually later to actually attach it to the dom. */ - renderComponent(opt_parentElement) { + renderComponent(parentElement) { if (!this.hasRendererRendered_) { if (!this.serverSide_ && window.__METAL_DEV_TOOLS_HOOK__) { window.__METAL_DEV_TOOLS_HOOK__(this); @@ -591,7 +592,7 @@ class Component extends EventEmitter { } this.emit('render'); syncState(this); - this.attach(opt_parentElement); + this.attach(parentElement); this.wasRendered = true; } @@ -617,13 +618,13 @@ class Component extends EventEmitter { /** * Sets the value of all the specified state keys. - * @param {!Object.} values A map of state keys to the values they + * @param {!Object.} state A map of state keys to the values they * should be set to. - * @param {function()=} opt_callback An optional function that will be run + * @param {function()=} callback An optional function that will be run * after the next batched update is triggered. */ - setState(state, opt_callback) { - this.dataManager_.setState(this, state, opt_callback); + setState(state, callback) { + this.dataManager_.setState(this, state, callback); } /** @@ -653,7 +654,7 @@ class Component extends EventEmitter { this.dataManager_ = getStaticProperty(this.constructor, 'DATA_MANAGER'); this.dataManager_.setUp( this, - object.mixin({}, this.renderer_.getExtraDataConfig(this), Component.DATA) + object.mixin({}, this.renderer_.getExtraDataConfig(this), Component.DATA) // eslint-disable-line ); } diff --git a/packages/metal-component/src/ComponentDataManager.js b/packages/metal-component/src/ComponentDataManager.js index ac2ceea8..afb91b5e 100644 --- a/packages/metal-component/src/ComponentDataManager.js +++ b/packages/metal-component/src/ComponentDataManager.js @@ -14,6 +14,9 @@ const BLACKLIST = { }; const DATA_MANAGER_DATA = '__DATA_MANAGER_DATA__'; +/** + * Class to handle Component Data + */ class ComponentDataManager { /** * Creates the `State` instance that will handle the main component data. @@ -22,7 +25,7 @@ class ComponentDataManager { * @protected */ createState_(component, data) { - const state = new State(component.getInitialConfig(), component, component); + const state = new State(component.getInitialConfig(), component, component); // eslint-disable-line state.setKeysBlacklist(BLACKLIST); state.configState( object.mixin({}, data, State.getStateStatic(component.constructor)) @@ -102,10 +105,13 @@ class ComponentDataManager { * value if none is given). * @param {!Component} component * @param {!Object} data - * @param {State=} opt_state + * @param {State=} state */ - replaceNonInternal(component, data, opt_state) { - const state = opt_state || this.getManagerData(component).state_; + replaceNonInternal( + component, + data, + state = this.getManagerData(component).state_ + ) { const keys = state.getStateKeys(); for (let i = 0; i < keys.length; i++) { const key = keys[i]; @@ -122,13 +128,13 @@ class ComponentDataManager { /** * Sets the value of all the specified state keys. * @param {!Component} component - * @param {!Object.} values A map of state keys to the values they + * @param {!Object.} state A map of state keys to the values they * should be set to. - * @param {function()=} opt_callback An optional function that will be run + * @param {function()=} callback An optional function that will be run * after the next batched update is triggered. */ - setState(component, state, opt_callback) { - this.getManagerData(component).state_.setState(state, opt_callback); + setState(component, state, callback) { + this.getManagerData(component).state_.setState(state, callback); } /** diff --git a/packages/metal-component/src/ComponentRegistry.js b/packages/metal-component/src/ComponentRegistry.js index 9fe923ff..959bed84 100644 --- a/packages/metal-component/src/ComponentRegistry.js +++ b/packages/metal-component/src/ComponentRegistry.js @@ -29,13 +29,12 @@ class ComponentRegistry { /** * Registers a component, so it can be found by its name. * @param {!Function} constructorFn The component's constructor function. - * @param {string=} opt_name Name of the registered component. If none is given + * @param {string=} name Name of the registered component. If none is given * the name defined by the NAME static variable will be used instead. If that * isn't set as well, the name of the constructor function will be used. * @static */ - static register(constructorFn, opt_name) { - let name = opt_name; + static register(constructorFn, name) { if (!name) { if (constructorFn.hasOwnProperty('NAME')) { name = constructorFn.NAME; diff --git a/packages/metal-component/src/ComponentRenderer.js b/packages/metal-component/src/ComponentRenderer.js index d2c20164..b2b07e0a 100644 --- a/packages/metal-component/src/ComponentRenderer.js +++ b/packages/metal-component/src/ComponentRenderer.js @@ -16,7 +16,6 @@ class ComponentRenderer { * Sub classes can override to return `State` config for properties that * should be added to the component. * @param {!Component} component - * @return {Object} */ getExtraDataConfig() {} diff --git a/packages/metal-component/src/events/events.js b/packages/metal-component/src/events/events.js index 06218a2f..7c3b351b 100644 --- a/packages/metal-component/src/events/events.js +++ b/packages/metal-component/src/events/events.js @@ -16,7 +16,7 @@ export function addListenersFromObj(component, events) { if (info.fn) { let handle; if (info.selector) { - handle = component.delegate(eventNames[i], info.selector, info.fn); + handle = component.delegate(eventNames[i], info.selector, info.fn); // eslint-disable-line } else { handle = component.on(eventNames[i], info.fn); } @@ -29,8 +29,7 @@ export function addListenersFromObj(component, events) { /** * Extracts listener info from the given value. * @param {!Component} component - * @param {!Component} component - * @param {function()|string|{selector:string,fn:function()|string}} value + * @param {function()|string|{selector:string,fn:function()}|string} value * @return {!{selector:string,fn:function()}} * @protected */ diff --git a/packages/metal-component/src/sync/sync.js b/packages/metal-component/src/sync/sync.js index 558063f7..f6fcccc6 100644 --- a/packages/metal-component/src/sync/sync.js +++ b/packages/metal-component/src/sync/sync.js @@ -41,16 +41,16 @@ function getSyncFns_(component) { /** * Calls "sync" functions for the given component's state. * @param {!Component} component - * @param {Object=} opt_changes When given, only the properties inside it will + * @param {Object=} changes When given, only the properties inside it will * be synced. Otherwise all state properties will be synced. */ -export function syncState(component, opt_changes) { +export function syncState(component, changes) { const syncFns = getSyncFns_(component); - const keys = Object.keys(opt_changes || syncFns); + const keys = Object.keys(changes || syncFns); for (let i = 0; i < keys.length; i++) { const fn = syncFns[keys[i]]; if (isFunction(fn)) { - const change = opt_changes && opt_changes[keys[i]]; + const change = changes && changes[keys[i]]; const manager = component.getDataManager(); fn.call( component, diff --git a/packages/metal-component/test/.eslintrc.json b/packages/metal-component/test/.eslintrc similarity index 53% rename from packages/metal-component/test/.eslintrc.json rename to packages/metal-component/test/.eslintrc index 92b466f1..c6df3779 100644 --- a/packages/metal-component/test/.eslintrc.json +++ b/packages/metal-component/test/.eslintrc @@ -1,9 +1,10 @@ { - "env": { - "mocha": true - }, "globals": { "assert": true, "sinon": true + }, + "rules": { + "max-len": 0, + "require-jsdoc": 0 } -} +} \ No newline at end of file diff --git a/packages/metal-component/test/Component.js b/packages/metal-component/test/Component.js index 07728a37..a94d2a69 100644 --- a/packages/metal-component/test/Component.js +++ b/packages/metal-component/test/Component.js @@ -556,7 +556,7 @@ describe('Component', function() { } class TestComponent extends Component { - willReceiveState(changes) { + willReceiveState() { this.foo = 'foo' + count; count++; @@ -1110,7 +1110,7 @@ describe('Component', function() { assert.ok(Component.isComponentCtor(TestComponent)); assert.ok(!Component.isComponentCtor(() => {})); let fn = () => {}; - assert.ok(!Component.isComponentCtor(fn.bind(this))); + assert.ok(!Component.isComponentCtor(fn.bind(this))); // eslint-disable-line }); it('should pass instance of component to __METAL_DEV_TOOLS_HOOK__ on first render', function() { @@ -1137,20 +1137,20 @@ describe('Component', function() { sinon.assert.calledWith(hookStub, comp); }); - function createCustomComponentClass(opt_rendererContentOrFn) { + function createCustomComponentClass(rendererContentOrFn) { class CustomComponent extends Component {} - CustomComponent.RENDERER = createCustomRenderer(opt_rendererContentOrFn); + CustomComponent.RENDERER = createCustomRenderer(rendererContentOrFn); return CustomComponent; } - function createCustomRenderer(opt_rendererContentOrFn) { + function createCustomRenderer(rendererContentOrFn) { class CustomRenderer extends ComponentRenderer.constructor { render(component) { super.render(component); - if (core.isFunction(opt_rendererContentOrFn)) { - opt_rendererContentOrFn(); + if (core.isFunction(rendererContentOrFn)) { + rendererContentOrFn(); } else { - component.element.innerHTML = opt_rendererContentOrFn; + component.element.innerHTML = rendererContentOrFn; } } } From fda278dfb7ae9e00157a81999b2397da41568e82 Mon Sep 17 00:00:00 2001 From: Chema Balsas Date: Thu, 9 Nov 2017 23:01:09 -0800 Subject: [PATCH 06/70] Fixes lint errors in metal-dom package --- .../metal-dom/src/DomDelegatedEventHandle.js | 6 +- .../metal-dom/src/DomEventEmitterProxy.js | 5 +- packages/metal-dom/src/DomEventHandle.js | 6 +- packages/metal-dom/src/domData.js | 17 ++--- packages/metal-dom/src/domNamed.js | 41 ++++++------ packages/metal-dom/src/events.js | 1 + packages/metal-dom/src/features.js | 2 +- packages/metal-dom/src/globalEval.js | 63 +++++++++---------- packages/metal-dom/src/globalEvalStyles.js | 44 ++++++------- packages/metal-dom/test/.eslintrc | 13 ++++ packages/metal-dom/test/.eslintrc.json | 9 --- packages/metal-dom/test/dom.js | 2 +- packages/metal-dom/test/globalEval.js | 4 +- packages/metal-dom/test/globalEvalStyles.js | 8 +-- 14 files changed, 114 insertions(+), 107 deletions(-) create mode 100644 packages/metal-dom/test/.eslintrc delete mode 100644 packages/metal-dom/test/.eslintrc.json diff --git a/packages/metal-dom/src/DomDelegatedEventHandle.js b/packages/metal-dom/src/DomDelegatedEventHandle.js index 947b4520..b95fb22e 100644 --- a/packages/metal-dom/src/DomDelegatedEventHandle.js +++ b/packages/metal-dom/src/DomDelegatedEventHandle.js @@ -15,13 +15,13 @@ class DomDelegatedEventHandle extends EventHandle { * @param {!Event} emitter Element the event was subscribed to. * @param {string} event The name of the event that was subscribed to. * @param {!Function} listener The listener subscribed to the event. - * @param {string=} opt_selector An optional selector used when delegating + * @param {string=} selector An optional selector used when delegating * the event. * @constructor */ - constructor(emitter, event, listener, opt_selector) { + constructor(emitter, event, listener, selector) { super(emitter, event, listener); - this.selector_ = opt_selector; + this.selector_ = selector; } /** diff --git a/packages/metal-dom/src/DomEventEmitterProxy.js b/packages/metal-dom/src/DomEventEmitterProxy.js index c27f2ea7..308cb8b5 100644 --- a/packages/metal-dom/src/DomEventEmitterProxy.js +++ b/packages/metal-dom/src/DomEventEmitterProxy.js @@ -23,7 +23,7 @@ class DomEventEmitterProxy extends EventEmitterProxy { const index = event.indexOf(':', 9); const eventName = event.substring(9, index); const selector = event.substring(index + 1); - return delegate(this.originEmitter_, eventName, selector, listener); + return delegate(this.originEmitter_, eventName, selector, listener); // eslint-disable-line } else { return on(this.originEmitter_, event, listener); } @@ -46,6 +46,7 @@ class DomEventEmitterProxy extends EventEmitterProxy { * Checks if the given event is supported by the origin element. * @param {string} event * @protected + * @return {boolean} */ isSupportedDomEvent_(event) { if (!this.originEmitter_ || !this.originEmitter_.addEventListener) { @@ -65,7 +66,7 @@ class DomEventEmitterProxy extends EventEmitterProxy { * @override */ shouldProxyEvent_(event) { - return super.shouldProxyEvent_(event) && this.isSupportedDomEvent_(event); + return super.shouldProxyEvent_(event) && this.isSupportedDomEvent_(event); // eslint-disable-line } } diff --git a/packages/metal-dom/src/DomEventHandle.js b/packages/metal-dom/src/DomEventHandle.js index 2dd8eff3..7a7da2a7 100644 --- a/packages/metal-dom/src/DomEventHandle.js +++ b/packages/metal-dom/src/DomEventHandle.js @@ -13,13 +13,13 @@ class DomEventHandle extends EventHandle { * @param {!EventEmitter} emitter Emitter the event was subscribed to. * @param {string} event The name of the event that was subscribed to. * @param {!Function} listener The listener subscribed to the event. - * @param {boolean} opt_capture Flag indicating if listener should be triggered + * @param {boolean} capture Flag indicating if listener should be triggered * during capture phase, instead of during the bubbling phase. Defaults to false. * @constructor */ - constructor(emitter, event, listener, opt_capture) { + constructor(emitter, event, listener, capture) { super(emitter, event, listener); - this.capture_ = opt_capture; + this.capture_ = capture; } /** diff --git a/packages/metal-dom/src/domData.js b/packages/metal-dom/src/domData.js index 34f2df43..f2cac29e 100644 --- a/packages/metal-dom/src/domData.js +++ b/packages/metal-dom/src/domData.js @@ -2,26 +2,29 @@ const METAL_DATA = '__metal_data__'; +/** + * Set of utilities for dom data operations + */ class domData { /** * Gets Metal.js's data for the given element. * @param {!Element} element - * @param {string=} opt_name Optional property from the data to be returned. - * @param {*} opt_initialVal Optinal value to the set the requested property + * @param {string=} name Optional property from the data to be returned. + * @param {*=} initialValue Optional value to the set the requested property * to if it doesn't exist yet in the data. * @return {!Object} */ - static get(element, opt_name, opt_initialVal) { + static get(element, name, initialValue) { if (!element[METAL_DATA]) { element[METAL_DATA] = {}; } - if (!opt_name) { + if (!name) { return element[METAL_DATA]; } - if (!element[METAL_DATA][opt_name] && opt_initialVal) { - element[METAL_DATA][opt_name] = opt_initialVal; + if (!element[METAL_DATA][name] && initialValue) { + element[METAL_DATA][name] = initialValue; } - return element[METAL_DATA][opt_name]; + return element[METAL_DATA][name]; } /** diff --git a/packages/metal-dom/src/domNamed.js b/packages/metal-dom/src/domNamed.js index f51653cc..4e10534b 100644 --- a/packages/metal-dom/src/domNamed.js +++ b/packages/metal-dom/src/domNamed.js @@ -230,7 +230,7 @@ export function contains(element1, element2) { * that should match the event for the listener to be triggered. * @param {!function(!Object)} callback Function to be called when the event * is triggered. It will receive the normalized event object. - * @param {boolean=} opt_default Optional flag indicating if this is a default + * @param {boolean=} defaultListener Optional flag indicating if this is a default * listener. That means that it would only be executed after all non * default listeners, and only if the event isn't prevented via * `preventDefault`. @@ -241,7 +241,7 @@ export function delegate( eventName, selectorOrTarget, callback, - opt_default + defaultListener ) { const customConfig = customEvents[eventName]; if (customConfig && customConfig.delegate) { @@ -249,7 +249,7 @@ export function delegate( callback = customConfig.handler.bind(customConfig, callback); } - if (opt_default) { + if (defaultListener) { // Wrap callback so we don't set property directly on it. callback = callback.bind(); callback.defaultListener_ = true; @@ -275,10 +275,12 @@ export function delegate( * simulating browsers behaviour, avoiding event listeners to be called by triggerEvent method. * @param {Element} node Element to be checked. * @param {string} eventName The event name. + * @param {Object=} eventObj * @private + * @return {boolean} */ -function isAbleToInteractWith_(node, eventName, opt_eventObj) { - if (opt_eventObj && eventName === 'click' && opt_eventObj.button === 2) { +function isAbleToInteractWith_(node, eventName, eventObj) { + if (eventObj && eventName === 'click' && eventObj.button === 2) { // Firefox triggers "click" events on the document for right clicks. This // causes our delegate logic to trigger it for regular elements too, which // shouldn't happen. Ignoring them here. @@ -442,6 +444,7 @@ function matchFallback_(element, selector) { * selector, or null if there is none. * @param {!Element} element * @param {?string} selector + * @return {Element|null} */ export function next(element, selector) { do { @@ -472,11 +475,11 @@ function normalizeDelegateEvent_(event) { * @param {string} eventName The name of the event to listen to. * @param {!function(!Object)} callback Function to be called when the event is * triggered. It will receive the normalized event object. - * @param {boolean} opt_capture Flag indicating if listener should be triggered + * @param {boolean} capture Flag indicating if listener should be triggered * during capture phase, instead of during the bubbling phase. Defaults to false. * @return {!DomEventHandle} Can be used to remove the listener. */ -export function on(element, eventName, callback, opt_capture) { +export function on(element, eventName, callback, capture) { if (isString(element)) { return delegate(document, eventName, element, callback); } @@ -485,8 +488,8 @@ export function on(element, eventName, callback, opt_capture) { eventName = customConfig.originalEvent; callback = customConfig.handler.bind(customConfig, callback); } - element.addEventListener(eventName, callback, opt_capture); - return new DomEventHandle(element, eventName, callback, opt_capture); + element.addEventListener(eventName, callback, capture); + return new DomEventHandle(element, eventName, callback, capture); } /** @@ -502,7 +505,7 @@ export function on(element, eventName, callback, opt_capture) { export function once(element, eventName, callback) { const domEventHandle = on(element, eventName, function() { domEventHandle.removeListener(); - return callback.apply(this, arguments); + return callback.apply(this, arguments); // eslint-disable-line }); return domEventHandle; } @@ -655,7 +658,7 @@ export function supportsEvent(element, eventName) { /** * This triggers all default matched delegated listeners of a given event type. - * @param {!Array} defaultFns Array to collect default listeners in, instead + * @param {!Array} defFns Array to collect default listeners in, instead * @param {!Event} event * @return {boolean} False if at least one of the triggered callbacks returns * false, or true otherwise. @@ -783,7 +786,7 @@ function toggleClassesWithoutNative_(element, classes) { elementClassName = `${elementClassName}${classes[i]} `; } else { const before = elementClassName.substring(0, classIndex); - const after = elementClassName.substring(classIndex + className.length); + const after = elementClassName.substring(classIndex + className.length); // eslint-disable-line elementClassName = `${before} ${after}`; } } @@ -816,15 +819,15 @@ function triggerElementListeners_(element, event, defaultFns) { * NOTE: This should mostly be used for testing, not on real code. * @param {!Element} element The node that should trigger the event. * @param {string} eventName The name of the event to be triggred. - * @param {Object=} opt_eventObj An object with data that should be on the + * @param {Object=} eventObj An object with data that should be on the * triggered event's payload. */ -export function triggerEvent(element, eventName, opt_eventObj) { - if (isAbleToInteractWith_(element, eventName, opt_eventObj)) { - const eventObj = document.createEvent('HTMLEvents'); - eventObj.initEvent(eventName, true, true); - object.mixin(eventObj, opt_eventObj); - element.dispatchEvent(eventObj); +export function triggerEvent(element, eventName, eventObj) { + if (isAbleToInteractWith_(element, eventName, eventObj)) { + const payload = document.createEvent('HTMLEvents'); + payload.initEvent(eventName, true, true); + object.mixin(payload, eventObj); + element.dispatchEvent(payload); } } diff --git a/packages/metal-dom/src/events.js b/packages/metal-dom/src/events.js index 11b524ed..b3c97705 100644 --- a/packages/metal-dom/src/events.js +++ b/packages/metal-dom/src/events.js @@ -20,6 +20,7 @@ function registerEvents() { handler: function(callback, event) { const related = event.relatedTarget; const target = event.delegateTarget; + // eslint-disable-next-line if (!related || (related !== target && !contains(target, related))) { event.customType = eventName; return callback(event); diff --git a/packages/metal-dom/src/features.js b/packages/metal-dom/src/features.js index 6f1383d1..35781545 100644 --- a/packages/metal-dom/src/features.js +++ b/packages/metal-dom/src/features.js @@ -47,7 +47,7 @@ class features { } for (let i = 0; i < prefixes.length; i++) { if ( - features.animationElement_.style[prefixes[i] + typeTitleCase] !== + features.animationElement_.style[prefixes[i] + typeTitleCase] !== // eslint-disable-line undefined ) { return prefixes[i].toLowerCase() + suffixes[i]; diff --git a/packages/metal-dom/src/globalEval.js b/packages/metal-dom/src/globalEval.js index 7db860fd..d186049f 100644 --- a/packages/metal-dom/src/globalEval.js +++ b/packages/metal-dom/src/globalEval.js @@ -10,15 +10,15 @@ class globalEval { /** * Evaluates the given string in the global scope. * @param {string} text - * @param {function()=} opt_appendFn Optional function to append the node + * @param {function()=} appendFn Optional function to append the node * into document. * @return {Element} script */ - static run(text, opt_appendFn) { + static run(text, appendFn) { const script = document.createElement('script'); script.text = text; - if (opt_appendFn) { - opt_appendFn(script); + if (appendFn) { + appendFn(script); } else { document.head.appendChild(script); } @@ -29,25 +29,25 @@ class globalEval { /** * Evaluates the given javascript file in the global scope. * @param {string} src The file's path. - * @param {function()=} opt_callback Optional function to be called + * @param {function()=} defaultFn Optional function to be called * when the script has been run. - * @param {function()=} opt_appendFn Optional function to append the node + * @param {function()=} appendFn Optional function to append the node * into document. * @return {Element} script */ - static runFile(src, opt_callback, opt_appendFn) { + static runFile(src, defaultFn, appendFn) { const script = document.createElement('script'); script.src = src; const callback = function() { exitDocument(script); - opt_callback && opt_callback(); + defaultFn && defaultFn(); }; once(script, 'load', callback); once(script, 'error', callback); - if (opt_appendFn) { - opt_appendFn(script); + if (appendFn) { + appendFn(script); } else { document.head.appendChild(script); } @@ -58,15 +58,15 @@ class globalEval { /** * Evaluates the code referenced by the given script element. * @param {!Element} script - * @param {function()=} opt_callback Optional function to be called + * @param {function()=} defaultFn Optional function to be called * when the script has been run. - * @param {function()=} opt_appendFn Optional function to append the node + * @param {function()=} appendFn Optional function to append the node * into document. * @return {Element} script */ - static runScript(script, opt_callback, opt_appendFn) { + static runScript(script, defaultFn, appendFn) { const callback = function() { - opt_callback && opt_callback(); + defaultFn && defaultFn(); }; if (script.type && script.type !== 'text/javascript') { async.nextTick(callback); @@ -74,27 +74,27 @@ class globalEval { } exitDocument(script); if (script.src) { - return globalEval.runFile(script.src, opt_callback, opt_appendFn); + return globalEval.runFile(script.src, defaultFn, appendFn); } else { async.nextTick(callback); - return globalEval.run(script.text, opt_appendFn); + return globalEval.run(script.text, appendFn); } } /** * Evaluates any script tags present in the given element. * @param {!Element} element - * @param {function()=} opt_callback Optional function to be called + * @param {function()=} defaultFn Optional function to be called * when the script has been run. - * @param {function()=} opt_appendFn Optional function to append the node + * @param {function()=} appendFn Optional function to append the node * into document. */ - static runScriptsInElement(element, opt_callback, opt_appendFn) { + static runScriptsInElement(element, defaultFn, appendFn) { const scripts = element.querySelectorAll('script'); if (scripts.length) { - globalEval.runScriptsInOrder(scripts, 0, opt_callback, opt_appendFn); - } else if (opt_callback) { - async.nextTick(opt_callback); + globalEval.runScriptsInOrder(scripts, 0, defaultFn, appendFn); + } else if (defaultFn) { + async.nextTick(defaultFn); } } @@ -102,27 +102,22 @@ class globalEval { * Runs the given scripts elements in the order that they appear. * @param {!NodeList} scripts * @param {number} index - * @param {function()=} opt_callback Optional function to be called + * @param {function()=} defaultFn Optional function to be called * when the script has been run. - * @param {function()=} opt_appendFn Optional function to append the node + * @param {function()=} appendFn Optional function to append the node * into document. */ - static runScriptsInOrder(scripts, index, opt_callback, opt_appendFn) { + static runScriptsInOrder(scripts, index, defaultFn, appendFn) { globalEval.runScript( scripts.item(index), function() { if (index < scripts.length - 1) { - globalEval.runScriptsInOrder( - scripts, - index + 1, - opt_callback, - opt_appendFn - ); - } else if (opt_callback) { - async.nextTick(opt_callback); + globalEval.runScriptsInOrder(scripts, index + 1, defaultFn, appendFn); // eslint-disable-line + } else if (defaultFn) { + async.nextTick(defaultFn); } }, - opt_appendFn + appendFn ); } } diff --git a/packages/metal-dom/src/globalEvalStyles.js b/packages/metal-dom/src/globalEvalStyles.js index ffdfa1d3..a4094f46 100644 --- a/packages/metal-dom/src/globalEvalStyles.js +++ b/packages/metal-dom/src/globalEvalStyles.js @@ -10,15 +10,15 @@ class globalEvalStyles { /** * Evaluates the given style. * @param {string} text - * @param {function()=} opt_appendFn Optional function to append the node + * @param {function()=} appendFn Optional function to append the node * into document. * @return {Element} style */ - static run(text, opt_appendFn) { + static run(text, appendFn) { const style = document.createElement('style'); style.innerHTML = text; - if (opt_appendFn) { - opt_appendFn(style); + if (appendFn) { + appendFn(style); } else { document.head.appendChild(style); } @@ -28,32 +28,32 @@ class globalEvalStyles { /** * Evaluates the given style file. * @param {string} href The file's path. - * @param {function()=} opt_callback Optional function to be called + * @param {function()=} defaultFn Optional function to be called * when the styles has been run. - * @param {function()=} opt_appendFn Optional function to append the node + * @param {function()=} appendFn Optional function to append the node * into document. * @return {Element} style */ - static runFile(href, opt_callback, opt_appendFn) { + static runFile(href, defaultFn, appendFn) { const link = document.createElement('link'); link.rel = 'stylesheet'; link.href = href; - globalEvalStyles.runStyle(link, opt_callback, opt_appendFn); + globalEvalStyles.runStyle(link, defaultFn, appendFn); return link; } /** * Evaluates the code referenced by the given style/link element. * @param {!Element} style - * @param {function()=} opt_callback Optional function to be called + * @param {function()=} defaultFn Optional function to be called * when the script has been run. - * @param {function()=} opt_appendFn Optional function to append the node + * @param {function()=} appendFn Optional function to append the node * into document. * @return {Element} style */ - static runStyle(style, opt_callback, opt_appendFn) { + static runStyle(style, defaultFn, appendFn) { const callback = function() { - opt_callback && opt_callback(); + defaultFn && defaultFn(); }; if (style.rel && style.rel !== 'stylesheet') { async.nextTick(callback); @@ -67,8 +67,8 @@ class globalEvalStyles { once(style, 'error', callback); } - if (opt_appendFn) { - opt_appendFn(style); + if (appendFn) { + appendFn(style); } else { document.head.appendChild(style); } @@ -79,26 +79,26 @@ class globalEvalStyles { /** * Evaluates any style present in the given element. * @param {!Element} element - * @param {function()=} opt_callback Optional function to be called when the + * @param {function()=} defaultFn Optional function to be called when the * style has been run. - * @param {function()=} opt_appendFn Optional function to append the node + * @param {function()=} appendFn Optional function to append the node * into document. */ - static runStylesInElement(element, opt_callback, opt_appendFn) { + static runStylesInElement(element, defaultFn, appendFn) { const styles = element.querySelectorAll('style,link'); - if (styles.length === 0 && opt_callback) { - async.nextTick(opt_callback); + if (styles.length === 0 && defaultFn) { + async.nextTick(defaultFn); return; } let loadCount = 0; const callback = function() { - if (opt_callback && ++loadCount === styles.length) { - async.nextTick(opt_callback); + if (defaultFn && ++loadCount === styles.length) { + async.nextTick(defaultFn); } }; for (let i = 0; i < styles.length; i++) { - globalEvalStyles.runStyle(styles[i], callback, opt_appendFn); + globalEvalStyles.runStyle(styles[i], callback, appendFn); } } } diff --git a/packages/metal-dom/test/.eslintrc b/packages/metal-dom/test/.eslintrc new file mode 100644 index 00000000..06bcb576 --- /dev/null +++ b/packages/metal-dom/test/.eslintrc @@ -0,0 +1,13 @@ +{ + "globals": { + "after": true, + "assert": true, + "before": true, + "sinon": true + }, + "rules": { + "max-len": 0, + "no-invalid-this": 0, + "require-jsdoc": 0 + } +} \ No newline at end of file diff --git a/packages/metal-dom/test/.eslintrc.json b/packages/metal-dom/test/.eslintrc.json deleted file mode 100644 index 92b466f1..00000000 --- a/packages/metal-dom/test/.eslintrc.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "env": { - "mocha": true - }, - "globals": { - "assert": true, - "sinon": true - } -} diff --git a/packages/metal-dom/test/dom.js b/packages/metal-dom/test/dom.js index 2d8a4e53..3d98ae8d 100644 --- a/packages/metal-dom/test/dom.js +++ b/packages/metal-dom/test/dom.js @@ -18,7 +18,7 @@ describe('dom', function() { assert.strictEqual('class2', getClassNames(element)[1]); } - var element = document.createElement('div'); + const element = document.createElement('div'); dom.addClasses(element, 'class1 class2'); assertClassesAdded(); }); diff --git a/packages/metal-dom/test/globalEval.js b/packages/metal-dom/test/globalEval.js index 91dd4989..c764033b 100644 --- a/packages/metal-dom/test/globalEval.js +++ b/packages/metal-dom/test/globalEval.js @@ -59,7 +59,7 @@ describe('globalEval', function() { }); it('should call callback function after script file is run', function(done) { - var newScript = globalEval.runFile('fixtures/script.js', function() { + const newScript = globalEval.runFile('fixtures/script.js', function() { assert.strictEqual(5, window.testScript); assert.ok(!newScript.parentNode); done(); @@ -145,7 +145,7 @@ describe('globalEval', function() { script.src = 'fixtures/script.js'; dom.enterDocument(script); - var newScript = globalEval.runScript(script, function() { + const newScript = globalEval.runScript(script, function() { assert.strictEqual(5, window.testScript); assert.ok(!newScript.parentNode); done(); diff --git a/packages/metal-dom/test/globalEvalStyles.js b/packages/metal-dom/test/globalEvalStyles.js index 72c79651..d4cbe7a8 100644 --- a/packages/metal-dom/test/globalEvalStyles.js +++ b/packages/metal-dom/test/globalEvalStyles.js @@ -27,7 +27,7 @@ describe('globalEvalStyles', function() { }); it('should evaluate style file', function(done) { - var style = globalEvalStyles.runFile('fixtures/style.css', function() { + const style = globalEvalStyles.runFile('fixtures/style.css', function() { assertComputedStyle('backgroundColor', 'rgb(0, 255, 0)'); dom.exitDocument(style); done(); @@ -37,7 +37,7 @@ describe('globalEvalStyles', function() { it('should leave created style file in document after code is evaluated', function( done ) { - var style = globalEvalStyles.runFile('fixtures/style.css', function() { + const style = globalEvalStyles.runFile('fixtures/style.css', function() { assert.ok(style.parentNode); dom.exitDocument(style); done(); @@ -59,7 +59,7 @@ describe('globalEvalStyles', function() { let style = document.createElement('style'); style.innerHTML = 'body{background-color:rgb(255, 0, 0);}'; - var newStyle = globalEvalStyles.runStyle(style, function() { + const newStyle = globalEvalStyles.runStyle(style, function() { assert.ok(newStyle.parentNode); dom.exitDocument(newStyle); done(); @@ -87,7 +87,7 @@ describe('globalEvalStyles', function() { link.href = 'fixtures/style.css'; link.rel = 'stylesheet'; - var newStyle = globalEvalStyles.runStyle(link, function() { + const newStyle = globalEvalStyles.runStyle(link, function() { assertComputedStyle('backgroundColor', 'rgb(0, 255, 0)'); dom.exitDocument(newStyle); done(); From 0fa37ce39023dd857903f1fc5b924c80dd2d09fb Mon Sep 17 00:00:00 2001 From: Chema Balsas Date: Thu, 9 Nov 2017 23:19:51 -0800 Subject: [PATCH 07/70] Fixes lint errors in metal-events package --- packages/metal-events/src/EventEmitter.js | 57 +++++++++++-------- .../metal-events/src/EventEmitterProxy.js | 26 +++++---- packages/metal-events/src/EventHandle.js | 10 ++-- packages/metal-events/src/EventHandler.js | 8 ++- packages/metal-events/test/.eslintrc | 11 ++++ packages/metal-events/test/.eslintrc.json | 9 --- 6 files changed, 69 insertions(+), 52 deletions(-) create mode 100644 packages/metal-events/test/.eslintrc delete mode 100644 packages/metal-events/test/.eslintrc.json diff --git a/packages/metal-events/src/EventEmitter.js b/packages/metal-events/src/EventEmitter.js index d5daf764..2410e7c1 100644 --- a/packages/metal-events/src/EventEmitter.js +++ b/packages/metal-events/src/EventEmitter.js @@ -7,10 +7,12 @@ const singleArray_ = [0]; /** * EventEmitter utility. - * @constructor * @extends {Disposable} */ class EventEmitter extends Disposable { + /** + * EventEmitter constructor + */ constructor() { super(); @@ -63,17 +65,17 @@ class EventEmitter extends Disposable { * Adds a listener to the end of the listeners array for the specified events. * @param {!(Array|string)} event * @param {!Function} listener - * @param {boolean} opt_default Flag indicating if this listener is a default + * @param {boolean} defaultListener Flag indicating if this listener is a default * action for this event. Default actions are run last, and only if no previous * listener call `preventDefault()` on the received event facade. * @return {!EventHandle} Can be used to remove the listener. */ - addListener(event, listener, opt_default) { + addListener(event, listener, defaultListener) { this.validateListener_(listener); const events = this.toEventsArray_(event); for (let i = 0; i < events.length; i++) { - this.addSingleListener_(events[i], listener, opt_default); + this.addSingleListener_(events[i], listener, defaultListener); } return new EventHandle(this, event, listener); @@ -83,21 +85,20 @@ class EventEmitter extends Disposable { * Adds a listener to the end of the listeners array for a single event. * @param {string} event * @param {!Function} listener - * @param {boolean} opt_default Flag indicating if this listener is a default + * @param {boolean} defaultListener Flag indicating if this listener is a default * action for this event. Default actions are run last, and only if no previous * listener call `preventDefault()` on the received event facade. - * @return {!EventHandle} Can be used to remove the listener. - * @param {Function=} opt_origin The original function that was added as a + * @param {Function=} origin The original function that was added as a * listener, if there is any. * @protected */ - addSingleListener_(event, listener, opt_default, opt_origin) { + addSingleListener_(event, listener, defaultListener, origin) { this.runListenerHandlers_(event); - if (opt_default || opt_origin) { + if (defaultListener || origin) { listener = { - default: opt_default, + default: defaultListener, fn: listener, - origin: opt_origin, + origin: origin, }; } this.events_ = this.events_ || {}; @@ -143,7 +144,7 @@ class EventEmitter extends Disposable { return false; } - const args = array.slice(arguments, 1); + const args = array.slice(arguments, 1); // eslint-disable-line this.runListeners_(listeners, args, this.buildFacade_(event)); return true; } @@ -216,11 +217,14 @@ class EventEmitter extends Disposable { return; } + /** + * + */ function handlerInternal() { if (--amount === 0) { self.removeListener(event, handlerInternal); } - listener.apply(self, arguments); + listener.apply(self, arguments); // eslint-disable-line } self.addSingleListener_(event, handlerInternal, false, listener); @@ -237,14 +241,14 @@ class EventEmitter extends Disposable { matchesListener_(listenerObj, listener) { const fn = listenerObj.fn || listenerObj; return ( - fn === listener || (listenerObj.origin && listenerObj.origin === listener) + fn === listener || (listenerObj.origin && listenerObj.origin === listener) // eslint-disable-line ); } /** * Removes a listener for the specified events. * Caution: changes array indices in the listener array behind the listener. - * @param {!(Array|string)} events + * @param {!(Array|string)} event * @param {!Function} listener * @return {!Object} Returns emitter, so calls can be chained. */ @@ -272,16 +276,16 @@ class EventEmitter extends Disposable { * @return {!EventHandle} Can be used to remove the listener. */ on() { - return this.addListener.apply(this, arguments); + return this.addListener.apply(this, arguments); // eslint-disable-line } /** * Adds handler that gets triggered when an event is listened to on this * instance. - * @param {!function()} + * @param {!function()} handler */ onListener(handler) { - this.listenerHandlers_ = this.addHandler_(this.listenerHandlers_, handler); + this.listenerHandlers_ = this.addHandler_(this.listenerHandlers_, handler); // eslint-disable-line } /** @@ -299,13 +303,13 @@ class EventEmitter extends Disposable { * Removes all listeners, or those of the specified events. It's not a good * idea to remove listeners that were added elsewhere in the code, * especially when it's on an emitter that you didn't create. - * @param {(Array|string)=} opt_events + * @param {(Array|string)=} event * @return {!Object} Returns emitter, so calls can be chained. */ - removeAllListeners(opt_events) { + removeAllListeners(event) { if (this.events_) { - if (opt_events) { - const events = this.toEventsArray_(opt_events); + if (event) { + const events = this.toEventsArray_(event); for (let i = 0; i < events.length; i++) { this.events_[events[i]] = null; } @@ -342,7 +346,7 @@ class EventEmitter extends Disposable { * @return {!Object} Returns emitter, so calls can be chained. */ removeListener() { - return this.off.apply(this, arguments); + return this.off.apply(this, arguments); // eslint-disable-line } /** @@ -364,7 +368,7 @@ class EventEmitter extends Disposable { * Runs the given listeners. * @param {!Array} listeners * @param {!Array} args - * @param (Object) facade + * @param {Object} facade * @protected */ runListeners_(listeners, args, facade) { @@ -428,6 +432,11 @@ class EventEmitter extends Disposable { } } +/** + * Converts to an array + * @param {Object} val + * @return {Array} + */ function toArray(val) { val = val || []; return Array.isArray(val) ? val : [val]; diff --git a/packages/metal-events/src/EventEmitterProxy.js b/packages/metal-events/src/EventEmitterProxy.js index 1723f802..314348f6 100644 --- a/packages/metal-events/src/EventEmitterProxy.js +++ b/packages/metal-events/src/EventEmitterProxy.js @@ -7,17 +7,19 @@ import {Disposable} from 'metal'; * instances together, emitting events from the first emitter through the * second one. That means that listening to a supported event on the target * emitter will mean listening to it on the origin emitter as well. - * @param {EventEmitter} originEmitter Events originated on this emitter - * will be fired for the target emitter's listeners as well. - * @param {EventEmitter} targetEmitter Event listeners attached to this emitter - * will also be triggered when the event is fired by the origin emitter. - * @param {Object} opt_blacklist Optional blacklist of events that should not be - * proxied. - * @constructor * @extends {Disposable} */ class EventEmitterProxy extends Disposable { - constructor(originEmitter, targetEmitter, opt_blacklist, opt_whitelist) { + /** + * @param {EventEmitter} originEmitter Events originated on this emitter + * will be fired for the target emitter's listeners as well. + * @param {EventEmitter} targetEmitter Event listeners attached to this emitter + * will also be triggered when the event is fired by the origin emitter. + * @param {Object} blacklist Optional blacklist of events that should not be + * proxied. + * @param {Object} whitelist + */ + constructor(originEmitter, targetEmitter, blacklist, whitelist) { super(); /** @@ -25,7 +27,7 @@ class EventEmitterProxy extends Disposable { * @type {Object} * @protected */ - this.blacklist_ = opt_blacklist; + this.blacklist_ = blacklist; /** * The origin emitter. This emitter's events will be proxied through the @@ -64,7 +66,7 @@ class EventEmitterProxy extends Disposable { * @type {Object} * @protected */ - this.whitelist_ = opt_whitelist; + this.whitelist_ = whitelist; this.startProxy_(); } @@ -94,8 +96,8 @@ class EventEmitterProxy extends Disposable { * Emits the specified event type on the target emitter. * @protected */ - emitOnTarget_() { - this.targetEmitter_.emit.apply(this.targetEmitter_, arguments); + emitOnTarget_(...args) { + this.targetEmitter_.emit(...args); } /** diff --git a/packages/metal-events/src/EventHandle.js b/packages/metal-events/src/EventHandle.js index 58082c56..fc992798 100644 --- a/packages/metal-events/src/EventHandle.js +++ b/packages/metal-events/src/EventHandle.js @@ -8,13 +8,15 @@ import {Disposable} from 'metal'; * EventHandle is a Disposable, but it's important to note that the * EventEmitter that created it is not the one responsible for disposing it. * That responsibility is for the code that holds a reference to it. - * @param {!EventEmitter} emitter Emitter the event was subscribed to. - * @param {string} event The name of the event that was subscribed to. - * @param {!Function} listener The listener subscribed to the event. - * @constructor * @extends {Disposable} */ class EventHandle extends Disposable { + /** + * EventHandle constructor + * @param {!EventEmitter} emitter Emitter the event was subscribed to. + * @param {string} event The name of the event that was subscribed to. + * @param {!Function} listener The listener subscribed to the event. + */ constructor(emitter, event, listener) { super(); diff --git a/packages/metal-events/src/EventHandler.js b/packages/metal-events/src/EventHandler.js index 13629a85..665c7824 100644 --- a/packages/metal-events/src/EventHandler.js +++ b/packages/metal-events/src/EventHandler.js @@ -5,10 +5,12 @@ import {Disposable} from 'metal'; /** * EventHandler utility. It's useful for easily removing a group of * listeners from different EventEmitter instances. - * @constructor * @extends {Disposable} */ class EventHandler extends Disposable { + /** + * EventHandler constructor + */ constructor() { super(); @@ -26,9 +28,9 @@ class EventHandler extends Disposable { * method. * @param {...(!EventHandle)} var_args */ - add() { + add(...args) { for (let i = 0; i < arguments.length; i++) { - this.eventHandles_.push(arguments[i]); + this.eventHandles_.push(args[i]); } } diff --git a/packages/metal-events/test/.eslintrc b/packages/metal-events/test/.eslintrc new file mode 100644 index 00000000..61f47403 --- /dev/null +++ b/packages/metal-events/test/.eslintrc @@ -0,0 +1,11 @@ +{ + "globals": { + "assert": true, + "sinon": true + }, + "rules": { + "max-len": 0, + "no-invalid-this": 0, + "require-jsdoc": 0 + } +} \ No newline at end of file diff --git a/packages/metal-events/test/.eslintrc.json b/packages/metal-events/test/.eslintrc.json deleted file mode 100644 index 92b466f1..00000000 --- a/packages/metal-events/test/.eslintrc.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "env": { - "mocha": true - }, - "globals": { - "assert": true, - "sinon": true - } -} From 9d44c3977bd361ec6d4249579c6607920217d9c4 Mon Sep 17 00:00:00 2001 From: Chema Balsas Date: Thu, 9 Nov 2017 23:33:44 -0800 Subject: [PATCH 08/70] Fixes lint errors in metal-incrementla-dom package --- packages/metal-incremental-dom/.eslintrc | 9 +++++ packages/metal-incremental-dom/.eslintrc.json | 5 --- .../src/IncrementalDomRenderer.js | 11 +++---- .../src/children/children.js | 18 +++++----- .../src/html/HTML2IncDom.js | 2 +- .../src/html/unescape.js | 2 +- .../metal-incremental-dom/src/render/patch.js | 7 ++-- .../src/render/render.js | 33 +++++++++---------- packages/metal-incremental-dom/test/.eslintrc | 13 ++++++++ .../metal-incremental-dom/test/.eslintrc.json | 10 ------ .../test/IncrementalDomRenderer.js | 1 - .../test/children/children.js | 2 +- 12 files changed, 60 insertions(+), 53 deletions(-) create mode 100644 packages/metal-incremental-dom/.eslintrc delete mode 100644 packages/metal-incremental-dom/.eslintrc.json create mode 100644 packages/metal-incremental-dom/test/.eslintrc delete mode 100644 packages/metal-incremental-dom/test/.eslintrc.json diff --git a/packages/metal-incremental-dom/.eslintrc b/packages/metal-incremental-dom/.eslintrc new file mode 100644 index 00000000..8ea512bf --- /dev/null +++ b/packages/metal-incremental-dom/.eslintrc @@ -0,0 +1,9 @@ +{ + "globals": { + "IncrementalDOM": true + }, + "rules": { + "prefer-rest-params": 0, + "require-jsdoc": 0 + } +} diff --git a/packages/metal-incremental-dom/.eslintrc.json b/packages/metal-incremental-dom/.eslintrc.json deleted file mode 100644 index 6b06731d..00000000 --- a/packages/metal-incremental-dom/.eslintrc.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "globals": { - "IncrementalDOM": true - } -} diff --git a/packages/metal-incremental-dom/src/IncrementalDomRenderer.js b/packages/metal-incremental-dom/src/IncrementalDomRenderer.js index 984a78b9..7f11b85a 100644 --- a/packages/metal-incremental-dom/src/IncrementalDomRenderer.js +++ b/packages/metal-incremental-dom/src/IncrementalDomRenderer.js @@ -110,19 +110,18 @@ class IncrementalDomRenderer extends ComponentRenderer.constructor { * through incremental dom function calls. If the first arg is a function * instead of a component instance, creates and renders this function, which * can either be a simple incremental dom function or a component constructor. - * @param {!Component} component * @param {!Component|function()} component Can be a component instance, a * simple incremental dom function or a component constructor. - * @param {Object|Element=} opt_dataOrElement Optional config data for the + * @param {Object|Element=} dataOrElement Optional config data for the * function, or parent for the rendered content. - * @param {Element=} opt_parent Optional parent for the rendered content. + * @param {Element=} parent Optional parent for the rendered content. * @return {!Component} The rendered component's instance. */ - render(component, opt_dataOrElement, opt_parent) { + render(component, dataOrElement, parent) { if (component instanceof Component) { this.patch(component); } else { - return renderFunction(this, component, opt_dataOrElement, opt_parent); + return renderFunction(this, component, dataOrElement, parent); } } @@ -194,7 +193,7 @@ class IncrementalDomRenderer extends ComponentRenderer.constructor { return false; } if (component.shouldUpdate) { - return component.shouldUpdate(...this.buildShouldUpdateArgs(changes)); + return component.shouldUpdate(...this.buildShouldUpdateArgs(changes)); // eslint-disable-line } return true; } diff --git a/packages/metal-incremental-dom/src/children/children.js b/packages/metal-incremental-dom/src/children/children.js index d6f0fcdd..8369a5fa 100644 --- a/packages/metal-incremental-dom/src/children/children.js +++ b/packages/metal-incremental-dom/src/children/children.js @@ -57,19 +57,19 @@ export function getOwner(node) { /** * Renders a children tree through incremental dom. - * @param {!{args: Array, children: !Array, isText: ?boolean}} - * @param {function()=} opt_skipNode Optional function that is called for + * @param {!{args: Array, children: !Array, isText: ?boolean}} tree + * @param {function()=} skipNode Optional function that is called for * each node to be rendered. If it returns true, the node will be skipped. * @protected */ -export function renderChildTree(tree, opt_skipNode) { +export function renderChildTree(tree, skipNode) { if (isCapturing_) { // If capturing, just add the node directly to the captured tree. addChildToTree(tree); return; } - if (opt_skipNode && opt_skipNode.call(null, tree)) { + if (skipNode && skipNode.call(null, tree)) { return; } @@ -86,7 +86,7 @@ export function renderChildTree(tree, opt_skipNode) { IncrementalDOM.elementOpen.apply(null, args); if (tree.props.children) { for (let i = 0; i < tree.props.children.length; i++) { - renderChildTree(tree.props.children[i], opt_skipNode); + renderChildTree(tree.props.children[i], skipNode); } } IncrementalDOM.elementClose(tree.tag); @@ -103,17 +103,18 @@ let tree_; /** * Adds a child element to the tree. * @param {!Array} args The arguments passed to the incremental dom call. - * @param {boolean=} opt_isText Optional flag indicating if the child is a + * @param {boolean=} isText Optional flag indicating if the child is a * text element. * @protected + * @return {Object} */ -function addChildCallToTree_(args, opt_isText) { +function addChildCallToTree_(args, isText = false) { const child = { parent: currentParent_, [CHILD_OWNER]: owner_, }; - if (opt_isText) { + if (isText) { child.text = args[0]; if (args.length > 1) { child.args = args; @@ -137,6 +138,7 @@ function addChildToTree(child) { * Handles an intercepted call to the `elementClose` function from incremental * dom. * @protected + * @return {Element | boolean} */ function handleInterceptedCloseCall_() { if (currentParent_ === tree_) { diff --git a/packages/metal-incremental-dom/src/html/HTML2IncDom.js b/packages/metal-incremental-dom/src/html/HTML2IncDom.js index 0a39c081..e478db5e 100644 --- a/packages/metal-incremental-dom/src/html/HTML2IncDom.js +++ b/packages/metal-incremental-dom/src/html/HTML2IncDom.js @@ -59,7 +59,7 @@ class HTML2IncDom { * any function that follows that same api, basically accepting the html * string and an object with `start`, `end` and `chars` functions to be called * during the parsing. - * @param {!function(string, !Object} newParser + * @param {!function(string, !Object)} newParser */ static setParser(newParser) { parser_ = newParser; diff --git a/packages/metal-incremental-dom/src/html/unescape.js b/packages/metal-incremental-dom/src/html/unescape.js index bbf3f43b..1bc28b61 100644 --- a/packages/metal-incremental-dom/src/html/unescape.js +++ b/packages/metal-incremental-dom/src/html/unescape.js @@ -65,4 +65,4 @@ export default unescape; * Regular expression that matches an HTML entity. * @type {!RegExp} */ -var HTML_ENTITY_PATTERN_ = /&([^;\s<&]+);?/g; +const HTML_ENTITY_PATTERN_ = /&([^;\s<&]+);?/g; diff --git a/packages/metal-incremental-dom/src/render/patch.js b/packages/metal-incremental-dom/src/render/patch.js index 8567ef1c..806837f6 100644 --- a/packages/metal-incremental-dom/src/render/patch.js +++ b/packages/metal-incremental-dom/src/render/patch.js @@ -11,6 +11,7 @@ const patchingComponents_ = []; * Guarantees that the component's element has a parent. That's necessary * when calling incremental dom's `patchOuter` for now, as otherwise it will * throw an error if the element needs to be replaced. + * @param {Element} element * @return {Element} The parent, in case it was added. * @private */ @@ -31,11 +32,11 @@ function buildParentIfNecessary_(element) { * Calls incremental dom's patch function. * @param {!Component} component The component to patch. * @param {!Element} element The element the component should be patched on. - * @param {boolean=} opt_outer Flag indicating if `patchOuter` should be used + * @param {boolean=} outer Flag indicating if `patchOuter` should be used * instead of `patch`. * @private */ -function callPatch_(component, element, opt_outer) { +function callPatch_(component, element, outer) { patchingComponents_.push(component); const data = getData(component); @@ -44,7 +45,7 @@ function callPatch_(component, element, opt_outer) { data.render = render.bind(null, component); } - const patchFn = opt_outer ? IncrementalDOM.patchOuter : IncrementalDOM.patch; + const patchFn = outer ? IncrementalDOM.patchOuter : IncrementalDOM.patch; patchFn(element, data.render); patchingComponents_.pop(); diff --git a/packages/metal-incremental-dom/src/render/render.js b/packages/metal-incremental-dom/src/render/render.js index d2b1f700..0fd3edec 100644 --- a/packages/metal-incremental-dom/src/render/render.js +++ b/packages/metal-incremental-dom/src/render/render.js @@ -206,6 +206,7 @@ function getSubComponent_(tagOrCtor, config, owner) { * Handles the event of children having finished being captured. * @param {!Object} tree The captured children in tree format. * @private + * @return {Object} */ function handleChildrenCaptured_(tree, {props, tag}) { props.children = buildChildren_(tree.props.children); @@ -245,6 +246,7 @@ function handleInterceptedAttributesCall_(element, name, value) { * dom. * @param {string} tag * @private + * @return {Object} */ function handleInterceptedOpenCall_(tag) { if (isComponentTag_(tag)) { @@ -341,7 +343,7 @@ function inheritElementClasses_(parent, config) { * @private */ export function isComponentTag_(tag) { - return isFunction(tag) || (isString(tag) && tag[0] === tag[0].toUpperCase()); + return isFunction(tag) || (isString(tag) && tag[0] === tag[0].toUpperCase()); // eslint-disable-line } /** @@ -451,12 +453,13 @@ export function renderChild(child) { * Renders the contents for the given tag. * @param {!function()|string} tag * @param {!Object} config - * @param {Component=} opt_owner + * @param {Component=} owner * @private + * @return {Object} */ -function renderFromTag_(tag, config, opt_owner) { +function renderFromTag_(tag, config, owner) { if (isString(tag) || tag.prototype.getRenderer) { - const comp = renderSubComponent_(tag, config, opt_owner); + const comp = renderSubComponent_(tag, config, owner); updateElementIfNotReached_(getComponentBeingRendered(), comp.element); return comp.element; } else { @@ -470,17 +473,12 @@ function renderFromTag_(tag, config, opt_owner) { * @param {!IncrementalDomRenderer} renderer * @param {!function()} fnOrCtor Either a simple incremental dom function or a * component constructor. - * @param {Object|Element=} opt_dataOrElement Optional config data for the + * @param {Object|Element=} dataOrElement Optional config data for the * function or parent for the rendered content. - * @param {Element=} opt_parent Optional parent for the rendered content. + * @param {Element=} parent Optional parent for the rendered content. * @return {!Component} The rendered component's instance. */ -export function renderFunction( - renderer, - fnOrCtor, - opt_dataOrElement, - opt_parent -) { +export function renderFunction(renderer, fnOrCtor, dataOrElement, parent) { if (!Component.isComponentCtor(fnOrCtor)) { const fn = fnOrCtor; class TempComponent extends Component { @@ -498,7 +496,7 @@ export function renderFunction( TempComponent.RENDERER = renderer; fnOrCtor = TempComponent; } - return Component.render(fnOrCtor, opt_dataOrElement, opt_parent); + return Component.render(fnOrCtor, dataOrElement, parent); } /** @@ -508,13 +506,13 @@ export function renderFunction( * updated instead. * @param {string|!function()} tagOrCtor The tag name or constructor function. * @param {!Object} config The config object for the sub component. - * @param {ComponentRenderer=} opt_owner + * @param {ComponentRenderer=} owner * @return {!Component} The updated sub component. * @private */ -function renderSubComponent_(tagOrCtor, config, opt_owner) { +function renderSubComponent_(tagOrCtor, config, owner) { const parent = getComponentBeingRendered(); - const owner = opt_owner || parent; + owner = owner || parent; inheritElementClasses_(parent, config); @@ -565,11 +563,12 @@ function resetNodeData_(node) { * Updates the given component's context according to the data from the * component that is currently being rendered. * @param {!Component} comp + * @param {!Component} parent * @protected */ function updateContext_(comp, parent) { const context = comp.context; - const childContext = parent.getChildContext ? parent.getChildContext() : null; + const childContext = parent.getChildContext ? parent.getChildContext() : null; // eslint-disable-line object.mixin(context, parent.context, childContext); comp.context = context; } diff --git a/packages/metal-incremental-dom/test/.eslintrc b/packages/metal-incremental-dom/test/.eslintrc new file mode 100644 index 00000000..06bcb576 --- /dev/null +++ b/packages/metal-incremental-dom/test/.eslintrc @@ -0,0 +1,13 @@ +{ + "globals": { + "after": true, + "assert": true, + "before": true, + "sinon": true + }, + "rules": { + "max-len": 0, + "no-invalid-this": 0, + "require-jsdoc": 0 + } +} \ No newline at end of file diff --git a/packages/metal-incremental-dom/test/.eslintrc.json b/packages/metal-incremental-dom/test/.eslintrc.json deleted file mode 100644 index be351a25..00000000 --- a/packages/metal-incremental-dom/test/.eslintrc.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "env": { - "mocha": true - }, - "globals": { - "assert": true, - "sinon": true, - "METAL_VERSION": true - } -} diff --git a/packages/metal-incremental-dom/test/IncrementalDomRenderer.js b/packages/metal-incremental-dom/test/IncrementalDomRenderer.js index c624528b..5687f07d 100644 --- a/packages/metal-incremental-dom/test/IncrementalDomRenderer.js +++ b/packages/metal-incremental-dom/test/IncrementalDomRenderer.js @@ -3131,7 +3131,6 @@ describe('IncrementalDomRenderer', function() { it('should run "willUpdate" lifecycle method of nested component when it is about to render', function( done ) { - const listener = sinon.stub(); class TestChildComponent extends Component { render() {} } diff --git a/packages/metal-incremental-dom/test/children/children.js b/packages/metal-incremental-dom/test/children/children.js index 5ced2fd8..6afff046 100644 --- a/packages/metal-incremental-dom/test/children/children.js +++ b/packages/metal-incremental-dom/test/children/children.js @@ -59,7 +59,7 @@ describe('children', function() { done(); }); - var formatFn = val => val; + const formatFn = val => val; IncrementalDOM.text('No args'); IncrementalDOM.text('With args', formatFn); IncrementalDOM.elementClose('div'); From 02e902124ba019dfeaf6c10af2d5a4d80dc35c65 Mon Sep 17 00:00:00 2001 From: Chema Balsas Date: Thu, 9 Nov 2017 23:40:37 -0800 Subject: [PATCH 09/70] Fixes lint errors in metal-isomorphic package --- .eslintignore | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.eslintignore b/.eslintignore index 921f7b49..ebf56065 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1 +1,3 @@ -packages/metal-soy-bundle/src/**/*.js +*.soy.js +packages/metal-isomorphic/**/*.js +packages/metal-soy-bundle/**/*.js \ No newline at end of file From f5a3ada395b787d80096465b249c09e2bfedb3a8 Mon Sep 17 00:00:00 2001 From: Chema Balsas Date: Thu, 9 Nov 2017 23:53:43 -0800 Subject: [PATCH 10/70] Fixes lint errors in metal-jsx package --- .../metal-jsx/{.eslintrc.json => .eslintrc} | 5 +- packages/metal-jsx/src/DangerouslySetHTML.js | 30 +- packages/metal-jsx/src/JSXComponent.js | 118 +- packages/metal-jsx/src/JSXDataManager.js | 207 +-- packages/metal-jsx/src/JSXRenderer.js | 183 +-- packages/metal-jsx/src/all/jsx.js | 10 +- packages/metal-jsx/src/iDOMHelpers.js | 80 +- packages/metal-jsx/test/.eslintrc | 20 + packages/metal-jsx/test/.eslintrc.json | 9 - packages/metal-jsx/test/DangerouslySetHTML.js | 94 +- packages/metal-jsx/test/JSXComponent.js | 1358 ++++++++--------- packages/metal-jsx/test/JSXDataManager.js | 760 ++++----- packages/metal-jsx/test/JSXRenderer.js | 1124 +++++++------- 13 files changed, 2005 insertions(+), 1993 deletions(-) rename packages/metal-jsx/{.eslintrc.json => .eslintrc} (66%) create mode 100644 packages/metal-jsx/test/.eslintrc delete mode 100644 packages/metal-jsx/test/.eslintrc.json diff --git a/packages/metal-jsx/.eslintrc.json b/packages/metal-jsx/.eslintrc similarity index 66% rename from packages/metal-jsx/.eslintrc.json rename to packages/metal-jsx/.eslintrc index 81c52662..5f83befd 100644 --- a/packages/metal-jsx/.eslintrc.json +++ b/packages/metal-jsx/.eslintrc @@ -5,8 +5,5 @@ }, "plugins": [ "react" - ], - "rules": { - "react/jsx-uses-vars": [2] - } + ] } diff --git a/packages/metal-jsx/src/DangerouslySetHTML.js b/packages/metal-jsx/src/DangerouslySetHTML.js index f6836cd7..eb5531a8 100644 --- a/packages/metal-jsx/src/DangerouslySetHTML.js +++ b/packages/metal-jsx/src/DangerouslySetHTML.js @@ -1,32 +1,32 @@ -"use strict"; +'use strict'; -import Component from "./JSXComponent"; -import { Config } from "metal-state"; +import Component from './JSXComponent'; +import {Config} from 'metal-state'; /** * JSXComponent that renders html passed in. * @class */ class DangerouslySetHTML extends Component { - /** - * @return {Component} - */ - render() { - const { content, tag } = this.props; + /** + * @return {Component} + */ + render() { + const {content, tag} = this.props; - IncrementalDOM.elementOpen(tag, null, null); + IncrementalDOM.elementOpen(tag, null, null); - const node = IncrementalDOM.elementClose(tag); + const node = IncrementalDOM.elementClose(tag); - node.innerHTML = content; + node.innerHTML = content; - return node; - } + return node; + } } DangerouslySetHTML.PROPS = { - content: Config.string(), - tag: Config.string().value("span") + content: Config.string(), + tag: Config.string().value('span'), }; export default DangerouslySetHTML; diff --git a/packages/metal-jsx/src/JSXComponent.js b/packages/metal-jsx/src/JSXComponent.js index 1a2a7093..6bbef471 100644 --- a/packages/metal-jsx/src/JSXComponent.js +++ b/packages/metal-jsx/src/JSXComponent.js @@ -1,11 +1,11 @@ -"use strict"; +'use strict'; -import "./iDOMHelpers"; -import { object } from "metal"; -import Component from "metal-component"; -import IncrementalDomRenderer from "metal-incremental-dom"; -import JSXDataManager from "./JSXDataManager"; -import JSXRenderer from "./JSXRenderer"; +import './iDOMHelpers'; +import {object} from 'metal'; +import Component from 'metal-component'; +import IncrementalDomRenderer from 'metal-incremental-dom'; +import JSXDataManager from './JSXDataManager'; +import JSXRenderer from './JSXRenderer'; /** * A component that has built-in integration with JSX templates. Example: @@ -19,65 +19,65 @@ import JSXRenderer from "./JSXRenderer"; * */ class JSXComponent extends Component { - /** - * Creates and renders the given function, which can either be a simple - * JSX function or a component constructor. - * @param {!function()} fnOrCtor Either be a simple jsx dom function or a - * component constructor. - * @param {Object=} opt_data Optional config data for the function. - * @param {Element=} opt_element Optional parent for the rendered content. - * @return {!Component} The rendered component's instance. - * @override - */ - static render(...args) { - return IncrementalDomRenderer.render(...args); - } + /** + * Creates and renders the given function, which can either be a simple + * JSX function or a component constructor. + * @param {!function()} fnOrCtor Either be a simple jsx dom function or a + * component constructor. + * @param {Object=} opt_data Optional config data for the function. + * @param {Element=} opt_element Optional parent for the rendered content. + * @return {!Component} The rendered component's instance. + * @override + */ + static render(...args) { + return IncrementalDomRenderer.render(...args); + } - /** - * Fires before state batch changes. Provides hook point for modifying - * state. - * @param {Event} event - * @protected - */ - handleStateWillChange_(event) { - if (event.type !== "state") { - this.willReceiveProps(event.changes); - } - } + /** + * Fires before state batch changes. Provides hook point for modifying + * state. + * @param {Event} event + * @protected + */ + handleStateWillChange_(event) { + if (event.type !== 'state') { + this.willReceiveProps(event.changes); + } + } - /** - * Returns props that are not used or declared in the component. - * @return {Object} Object containing props - */ - otherProps() { - const removeKeys = [ - ...this.getDataManager() - .getPropsInstance(this) - .getStateKeys(), - "key", - "ref" - ]; + /** + * Returns props that are not used or declared in the component. + * @return {Object} Object containing props + */ + otherProps() { + const removeKeys = [ + ...this.getDataManager() + .getPropsInstance(this) + .getStateKeys(), + 'key', + 'ref', + ]; - const retObj = object.mixin({}, this.props); + const retObj = object.mixin({}, this.props); - for (let i = 0; i < removeKeys.length; i++) { - const key = removeKeys[i]; + for (let i = 0; i < removeKeys.length; i++) { + const key = removeKeys[i]; - if (retObj.hasOwnProperty(key)) { - delete retObj[key]; - } - } + if (retObj.hasOwnProperty(key)) { + delete retObj[key]; + } + } - return retObj; - } + return retObj; + } - /** - * Lifecycle. Called when the component is about to receive new props. - * Provides a hook point for modifying state that can be used in the next - * rerender. - * @param {Object} changes Changes made to this.props - */ - willReceiveProps() {} + /** + * Lifecycle. Called when the component is about to receive new props. + * Provides a hook point for modifying state that can be used in the next + * rerender. + * @param {Object} changes Changes made to this.props + */ + willReceiveProps() {} } JSXComponent.DATA_MANAGER = JSXDataManager; diff --git a/packages/metal-jsx/src/JSXDataManager.js b/packages/metal-jsx/src/JSXDataManager.js index 18be2f33..087abdc7 100644 --- a/packages/metal-jsx/src/JSXDataManager.js +++ b/packages/metal-jsx/src/JSXDataManager.js @@ -1,117 +1,120 @@ -"use strict"; +'use strict'; -import { getStaticProperty, object } from "metal"; -import { ComponentDataManager } from "metal-component"; -import State from "metal-state"; +import {getStaticProperty, object} from 'metal'; +import {ComponentDataManager} from 'metal-component'; +import State from 'metal-state'; +/** + * DataManager for JSX + */ class JSXDataManager extends ComponentDataManager.constructor { - /** - * Manually adds props that weren't configured via `PROPS`. - * @param {!Component} component - * @param {!State} props - * @param {!Object} data - * @protected - */ - addUnconfiguredProps_(component, props, data) { - let keys = Object.keys(data); - for (let i = 0; i < keys.length; i++) { - if (!props.hasStateKey(keys[i])) { - component.props[keys[i]] = data[keys[i]]; - } - } - } + /** + * Manually adds props that weren't configured via `PROPS`. + * @param {!Component} component + * @param {!State} props + * @param {!Object} data + * @protected + */ + addUnconfiguredProps_(component, props, data) { + let keys = Object.keys(data); + for (let i = 0; i < keys.length; i++) { + if (!props.hasStateKey(keys[i])) { + component.props[keys[i]] = data[keys[i]]; + } + } + } - /** - * Overrides the original method so that we can have two separate `State` - * instances: one responsible for `state` and another for `props`. - * @param {!Component} comp - * @param {!Object} config - * @protected - * @override - */ - createState_(comp, config) { - const ctor = comp.constructor; - comp.props = {}; - comp.state = {}; - const data = this.getManagerData(comp); + /** + * Overrides the original method so that we can have two separate `State` + * instances: one responsible for `state` and another for `props`. + * @param {!Component} comp + * @param {!Object} config + * @protected + * @override + */ + createState_(comp, config) { + const ctor = comp.constructor; + comp.props = {}; + comp.state = {}; + const data = this.getManagerData(comp); - data.props_ = new State(comp.getInitialConfig(), comp.props, comp); - data.props_.configState( - object.mixin( - {}, - config, - getStaticProperty(ctor, "PROPS", State.mergeState) - ) - ); - this.addUnconfiguredProps_(comp, data.props_, comp.getInitialConfig()); + data.props_ = new State(comp.getInitialConfig(), comp.props, comp); + data.props_.configState( + object.mixin( + {}, + config, + getStaticProperty(ctor, 'PROPS', State.mergeState) + ) + ); + this.addUnconfiguredProps_(comp, data.props_, comp.getInitialConfig()); - data.state_ = new State({}, comp.state, comp); - data.state_.setEventData({ - type: "state" - }); - data.state_.configState(State.getStateStatic(ctor)); - } + data.state_ = new State({}, comp.state, comp); + data.state_.setEventData({ + type: 'state', + }); + data.state_.configState(State.getStateStatic(ctor)); + } - /** - * @inheritDoc - */ - dispose(component) { - const data = this.getManagerData(component); - data.props_.dispose(); - ComponentDataManager.dispose.call(this, component); - } + /** + * @inheritDoc + */ + dispose(component) { + const data = this.getManagerData(component); + data.props_.dispose(); + ComponentDataManager.dispose.call(this, component); + } - /** - * Overrides the original method so we can get properties from `props` by - * default. - * @param {!Component} component - * @param {string} name - * @return {*} - * @override - */ - get(component, name) { - return this.getManagerData(component).props_.get(name); - } + /** + * Overrides the original method so we can get properties from `props` by + * default. + * @param {!Component} component + * @param {string} name + * @return {*} + * @override + */ + get(component, name) { + return this.getManagerData(component).props_.get(name); + } - /** - * Gets the `State` instance being used for "props". - * @param {!Component} component - * @return {!Object} - */ - getPropsInstance(component) { - return this.getManagerData(component).props_; - } + /** + * Gets the `State` instance being used for "props". + * @param {!Component} component + * @return {!Object} + */ + getPropsInstance(component) { + return this.getManagerData(component).props_; + } - /** - * Overrides the original method so we can enable "sync" methods just for - * `props`. - * @param {!Component} component - * @return {!Array} - * @override - */ - getSyncKeys(component) { - return this.getManagerData(component).props_.getStateKeys(); - } + /** + * Overrides the original method so we can enable "sync" methods just for + * `props`. + * @param {!Component} component + * @return {!Array} + * @override + */ + getSyncKeys(component) { + return this.getManagerData(component).props_.getStateKeys(); + } - /** - * Overrides the original method so we can replace values in `props`. - * @param {!Component} component - * @param {!Object} data - * @override - */ - replaceNonInternal(component, data) { - let prevProps; - if (component.propsChanged) { - prevProps = object.mixin({}, component.props); - } + /** + * Overrides the original method so we can replace values in `props`. + * @param {!Component} component + * @param {!Object} data + * @override + */ + replaceNonInternal(component, data) { + let prevProps; + if (component.propsChanged) { + prevProps = object.mixin({}, component.props); + } - const props = this.getManagerData(component).props_; - ComponentDataManager.replaceNonInternal.call(this, component, data, props); - this.addUnconfiguredProps_(component, props, data); - if (component.propsChanged) { - component.propsChanged(prevProps); - } - } + const props = this.getManagerData(component).props_; + ComponentDataManager.replaceNonInternal.call(this, component, data, props); // eslint-disable-line + this.addUnconfiguredProps_(component, props, data); + if (component.propsChanged) { + component.propsChanged(prevProps); + } + } } export default new JSXDataManager(); diff --git a/packages/metal-jsx/src/JSXRenderer.js b/packages/metal-jsx/src/JSXRenderer.js index 19248b8f..d54b71dd 100644 --- a/packages/metal-jsx/src/JSXRenderer.js +++ b/packages/metal-jsx/src/JSXRenderer.js @@ -1,110 +1,111 @@ -"use strict"; +'use strict'; -import { isDefAndNotNull } from "metal"; -import IncrementalDomRenderer from "metal-incremental-dom"; +import {isDefAndNotNull} from 'metal'; +import IncrementalDomRenderer from 'metal-incremental-dom'; -const COUNT_PROP = "__metalJsxCount"; -const INC_DOM_DATA = "__incrementalDOMData"; -const KEY_PREFIX = "_metal_jsx_"; +const COUNT_PROP = '__metalJsxCount'; +const INC_DOM_DATA = '__incrementalDOMData'; +const KEY_PREFIX = '_metal_jsx_'; /** * Renderer that handles JSX. */ class JSXRenderer extends IncrementalDomRenderer.constructor { - /** - * @inheritDoc - */ - buildShouldUpdateArgs(changes) { - return [changes.state, changes.props]; - } + /** + * @inheritDoc + */ + buildShouldUpdateArgs(changes) { + return [changes.state, changes.props]; + } - /** - * Called when generating a key for the next dom element to be created via - * incremental dom. Adds keys to elements that don't have one yet, according - * to their position in the parent. This helps use cases that use - * conditionally rendered elements, which is very common in JSX. - * @param {!Component} component - * @param {string} key - * @return {?string} - */ - generateKey(component, key) { - key = super.generateKey(component, key); - const comp = this.getPatchingComponent(); - const data = comp.getRenderer().getData(comp); - if (!isDefAndNotNull(key)) { - if (data.rootElementRendered) { - key = KEY_PREFIX + jsxRenderer_.incElementCount(); - } else if (comp.element && comp.element[INC_DOM_DATA]) { - key = comp.element[INC_DOM_DATA].key; - } - } - if (!data.rootElementRendered) { - data.rootElementRendered = true; - } - return key; - } + /** + * Called when generating a key for the next dom element to be created via + * incremental dom. Adds keys to elements that don't have one yet, according + * to their position in the parent. This helps use cases that use + * conditionally rendered elements, which is very common in JSX. + * @param {!Component} component + * @param {string} key + * @return {?string} + */ + generateKey(component, key) { + key = super.generateKey(component, key); + const comp = this.getPatchingComponent(); + const data = comp.getRenderer().getData(comp); + if (!isDefAndNotNull(key)) { + if (data.rootElementRendered) { + key = KEY_PREFIX + jsxRenderer_.incElementCount(); + } else if (comp.element && comp.element[INC_DOM_DATA]) { + key = comp.element[INC_DOM_DATA].key; + } + } + if (!data.rootElementRendered) { + data.rootElementRendered = true; + } + return key; + } - /** - * @inheritDoc - */ - handleNodeRendered(node) { - node[COUNT_PROP] = 0; - } + /** + * @inheritDoc + */ + handleNodeRendered(node) { + node[COUNT_PROP] = 0; + } - /** - * Increments the number of children in the current element. - */ - incElementCount() { - const node = IncrementalDOM.currentElement(); - node[COUNT_PROP] = (node[COUNT_PROP] || 0) + 1; - return node[COUNT_PROP]; - } + /** + * Increments the number of children in the current element. + * @return {number} + */ + incElementCount() { + const node = IncrementalDOM.currentElement(); + node[COUNT_PROP] = (node[COUNT_PROP] || 0) + 1; + return node[COUNT_PROP]; + } - /** - * Overrides the original method from `IncrementalDomRenderer` so we can - * keep track of if the root element of the patched component has already - * been rendered or not. - * @param {!Component} component - * @override - */ - patch(component) { - this.getData(component).rootElementRendered = false; - super.patch(component); - } + /** + * Overrides the original method from `IncrementalDomRenderer` so we can + * keep track of if the root element of the patched component has already + * been rendered or not. + * @param {!Component} component + * @override + */ + patch(component) { + this.getData(component).rootElementRendered = false; + super.patch(component); + } - /** - * Overrides the original method from `IncrementalDomRenderer` to handle the - * case where developers return a child node directly from the "render" - * function. - * @param {!Component} component - * @override - */ - renderIncDom(component) { - if (component.render) { - iDOMHelpers.renderArbitrary(component.render()); - } else { - super.renderIncDom(component); - } - } + /** + * Overrides the original method from `IncrementalDomRenderer` to handle the + * case where developers return a child node directly from the "render" + * function. + * @param {!Component} component + * @override + */ + renderIncDom(component) { + if (component.render) { + iDOMHelpers.renderArbitrary(component.render()); + } else { + super.renderIncDom(component); + } + } - /** - * Skips the current child in the count (used when a conditional render - * decided not to render anything). - */ - skipChild() { - IncrementalDOM.elementVoid(jsxRenderer_.incElementCount); - } + /** + * Skips the current child in the count (used when a conditional render + * decided not to render anything). + */ + skipChild() { + IncrementalDOM.elementVoid(jsxRenderer_.incElementCount); + } - /** - * @inheritDoc - */ - skipRender() { - jsxRenderer_.skipChild(); - super.skipRender(); - } + /** + * @inheritDoc + */ + skipRender() { + jsxRenderer_.skipChild(); + super.skipRender(); + } } const jsxRenderer_ = new JSXRenderer(); -jsxRenderer_.RENDERER_NAME = "jsx"; +jsxRenderer_.RENDERER_NAME = 'jsx'; export default jsxRenderer_; diff --git a/packages/metal-jsx/src/all/jsx.js b/packages/metal-jsx/src/all/jsx.js index f815b3df..141b5c58 100644 --- a/packages/metal-jsx/src/all/jsx.js +++ b/packages/metal-jsx/src/all/jsx.js @@ -1,8 +1,8 @@ -"use strict"; +'use strict'; -import { validators, Config } from "metal-state"; -import DangerouslySetHTML from "../DangerouslySetHTML"; -import JSXComponent from "../JSXComponent"; +import {validators, Config} from 'metal-state'; +import DangerouslySetHTML from '../DangerouslySetHTML'; +import JSXComponent from '../JSXComponent'; export default JSXComponent; -export { DangerouslySetHTML, validators, Config, JSXComponent }; +export {DangerouslySetHTML, validators, Config, JSXComponent}; diff --git a/packages/metal-jsx/src/iDOMHelpers.js b/packages/metal-jsx/src/iDOMHelpers.js index 021ecba4..1dd7756b 100644 --- a/packages/metal-jsx/src/iDOMHelpers.js +++ b/packages/metal-jsx/src/iDOMHelpers.js @@ -1,7 +1,7 @@ -"use strict"; +'use strict'; -import IncrementalDomRenderer from "metal-incremental-dom"; -import JSXRenderer from "./JSXRenderer"; +import IncrementalDomRenderer from 'metal-incremental-dom'; +import JSXRenderer from './JSXRenderer'; /** * These helpers are all from "babel-plugin-incremental-dom". See its README @@ -10,56 +10,56 @@ import JSXRenderer from "./JSXRenderer"; */ const scope = - typeof exports !== "undefined" && typeof global !== "undefined" - ? global - : window; + typeof exports !== 'undefined' && typeof global !== 'undefined' + ? global + : window; scope.iDOMHelpers = scope.iDOMHelpers || {}; scope.iDOMHelpers.attr = function(value, attrName) { - IncrementalDOM.attr(attrName, value); + IncrementalDOM.attr(attrName, value); }; scope.iDOMHelpers.forOwn = function(object, iterator) { - const hasOwn = Object.prototype.hasOwnProperty; - for (let prop in object) { - if (hasOwn.call(object, prop)) { - iterator(object[prop], prop); - } - } + const hasOwn = Object.prototype.hasOwnProperty; + for (let prop in object) { + if (hasOwn.call(object, prop)) { + iterator(object[prop], prop); + } + } }; scope.iDOMHelpers.jsxWrapper = function(elementClosure, args) { - const wrapper = args - ? function() { - return elementClosure.apply(this, args); - } - : elementClosure; - wrapper.__jsxDOMWrapper = true; - return wrapper; + const wrapper = args + ? function() { + return elementClosure.apply(this, args); // eslint-disable-line + } + : elementClosure; + wrapper.__jsxDOMWrapper = true; + return wrapper; }; scope.iDOMHelpers.renderArbitrary = function(child) { - const type = typeof child; - if ( - type === "number" || - (type === "string" || (child && child instanceof String)) - ) { - IncrementalDOM.text(child); - } else if (type === "function" && child.__jsxDOMWrapper) { - child(); - } else if (Array.isArray(child)) { - child.forEach(scope.iDOMHelpers.renderArbitrary); - } else if (String(child) === "[object Object]") { - // Renders special incremental dom nodes in a special way :) - if (IncrementalDomRenderer.isIncDomNode(child)) { - IncrementalDomRenderer.renderChild(child); - } else { - scope.iDOMHelpers.forOwn(child, scope.iDOMHelpers.renderArbitrary); - } - } else if (!child) { - JSXRenderer.skipChild(); - } + const type = typeof child; + if ( + type === 'number' || + (type === 'string' || (child && child instanceof String)) + ) { + IncrementalDOM.text(child); + } else if (type === 'function' && child.__jsxDOMWrapper) { + child(); + } else if (Array.isArray(child)) { + child.forEach(scope.iDOMHelpers.renderArbitrary); + } else if (String(child) === '[object Object]') { + // Renders special incremental dom nodes in a special way :) + if (IncrementalDomRenderer.isIncDomNode(child)) { + IncrementalDomRenderer.renderChild(child); + } else { + scope.iDOMHelpers.forOwn(child, scope.iDOMHelpers.renderArbitrary); + } + } else if (!child) { + JSXRenderer.skipChild(); + } }; export default scope.iDOMHelpers; diff --git a/packages/metal-jsx/test/.eslintrc b/packages/metal-jsx/test/.eslintrc new file mode 100644 index 00000000..69753977 --- /dev/null +++ b/packages/metal-jsx/test/.eslintrc @@ -0,0 +1,20 @@ +{ + "globals": { + "assert": true, + "sinon": true + }, + "parserOptions": { + "ecmaFeatures": { + "jsx": true + } + }, + "plugins": [ + "react" + ], + "rules": { + "max-len": 0, + "no-invalid-this": 0, + "no-unused-vars": 0, + "require-jsdoc": 0 + } +} \ No newline at end of file diff --git a/packages/metal-jsx/test/.eslintrc.json b/packages/metal-jsx/test/.eslintrc.json deleted file mode 100644 index 92b466f1..00000000 --- a/packages/metal-jsx/test/.eslintrc.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "env": { - "mocha": true - }, - "globals": { - "assert": true, - "sinon": true - } -} diff --git a/packages/metal-jsx/test/DangerouslySetHTML.js b/packages/metal-jsx/test/DangerouslySetHTML.js index 38493932..755f8b76 100644 --- a/packages/metal-jsx/test/DangerouslySetHTML.js +++ b/packages/metal-jsx/test/DangerouslySetHTML.js @@ -1,48 +1,48 @@ -"use strict"; - -import DangerouslySetHTML from "../src/DangerouslySetHTML"; -import JSXComponent from "../src/JSXComponent"; - -describe("JSXComponent", function() { - var component; - - afterEach(function() { - if (component) { - component.dispose(); - } - }); - - it("should render", function() { - component = new DangerouslySetHTML(); - assert.strictEqual("SPAN", component.element.tagName); - }); - - it("should render with custom tag", function() { - component = new DangerouslySetHTML({ tag: "div" }); - assert.strictEqual("DIV", component.element.tagName); - }); - - it("should render with html content", function() { - var content = "

hello

world
"; - - component = new DangerouslySetHTML({ content: content }); - assert.strictEqual(content, component.element.innerHTML); - }); - - it("should render inside of another component", function() { - var content = "

hello

world
"; - - class TestComponent extends JSXComponent { - render() { - return ( -
- -
- ); - } - } - - component = new TestComponent(); - assert.strictEqual(content, component.refs.inner.element.innerHTML); - }); +'use strict'; + +import DangerouslySetHTML from '../src/DangerouslySetHTML'; +import JSXComponent from '../src/JSXComponent'; + +describe('JSXComponent', function() { + let component; + + afterEach(function() { + if (component) { + component.dispose(); + } + }); + + it('should render', function() { + component = new DangerouslySetHTML(); + assert.strictEqual('SPAN', component.element.tagName); + }); + + it('should render with custom tag', function() { + component = new DangerouslySetHTML({tag: 'div'}); + assert.strictEqual('DIV', component.element.tagName); + }); + + it('should render with html content', function() { + let content = '

hello

world
'; + + component = new DangerouslySetHTML({content: content}); + assert.strictEqual(content, component.element.innerHTML); + }); + + it('should render inside of another component', function() { + let content = '

hello

world
'; + + class TestComponent extends JSXComponent { + render() { + return ( +
+ +
+ ); + } + } + + component = new TestComponent(); + assert.strictEqual(content, component.refs.inner.element.innerHTML); + }); }); diff --git a/packages/metal-jsx/test/JSXComponent.js b/packages/metal-jsx/test/JSXComponent.js index 7967b47a..fce3e10f 100644 --- a/packages/metal-jsx/test/JSXComponent.js +++ b/packages/metal-jsx/test/JSXComponent.js @@ -1,680 +1,680 @@ -"use strict"; - -import { async } from "metal"; -import dom from "metal-dom"; -import JSXComponent from "../src/JSXComponent"; - -describe("JSXComponent", function() { - var component; - - afterEach(function() { - if (component) { - component.dispose(); - } - }); - - it('should render contents from component\'s "render" function', function() { - class TestComponent extends JSXComponent { - render() { - return
Hello World
; - } - } - - component = new TestComponent(); - assert.strictEqual("DIV", component.element.tagName); - assert.ok(dom.hasClass(component.element, "test")); - assert.strictEqual("Hello World", component.element.textContent); - }); - - it("should not throw error if no jsx function is implemented", function() { - class TestComponent extends JSXComponent {} - - component = new TestComponent(); - assert.strictEqual("DIV", component.element.tagName); - assert.strictEqual("", component.element.textContent); - }); - - it("should attach inline listeners", function() { - class TestComponent extends JSXComponent { - render() { - return ( -
-
- ); - } - } - TestComponent.prototype.handleClick = sinon.stub(); - - component = new TestComponent(); - dom.triggerEvent(component.element.childNodes[0], "click"); - assert.strictEqual(1, component.handleClick.callCount); - }); - - it("should create and render sub components", function() { - class ChildComponent extends JSXComponent { - render() { - return
Child
; - } - } - - class TestComponent extends JSXComponent { - render() { - return ( -
- -
- ); - } - } - - component = new TestComponent(); - var child = component.components.child; - assert.ok(child); - assert.strictEqual("DIV", child.element.tagName); - assert.ok(dom.hasClass(child.element, "child")); - assert.strictEqual("Child", child.element.textContent); - assert.strictEqual(child.element, component.element.childNodes[0]); - }); - - it("should receive props from parent components", function() { - class ChildComponent extends JSXComponent { - render() { - return
{this.props.foo}
; - } - } - - class TestComponent extends JSXComponent { - render() { - return ( -
- -
- ); - } - } - - component = new TestComponent(); - var child = component.components.child; - assert.strictEqual("Foo", child.element.textContent); - }); - - describe("Children", function() { - it("should be able to render children through props", function() { - class ChildComponent extends JSXComponent { - render() { - return
{this.props.children}
; - } - } - - class TestComponent extends JSXComponent { - render() { - return Hello World; - } - } - - component = new TestComponent(); - assert.ok(component.components.child); - assert.strictEqual(component.components.child.element, component.element); - assert.strictEqual("DIV", component.element.tagName); - assert.strictEqual("Hello World", component.element.textContent); - }); - - it("should not throw error if trying to render empty children", function() { - class TestComponent extends JSXComponent { - render() { - return
{this.props.children}
; - } - } - - component = new TestComponent(); - assert.strictEqual(0, component.element.childNodes.length); - assert.ok(component.props.children); - assert.strictEqual(0, component.props.children.length); - }); - - it("should be able to render only some of the received children", function() { - class ChildComponent extends JSXComponent { - render() { - return
{this.props.children[1]}
; - } - } - - class TestComponent extends JSXComponent { - render() { - return ( -
- - Children Test - Children Test 2 - Children Test 3 - -
- ); - } - } - - component = new TestComponent(); - var child = component.components.child; - assert.strictEqual(1, child.element.childNodes.length); - assert.strictEqual("SPAN", child.element.childNodes[0].tagName); - assert.strictEqual("Children Test 2", child.element.textContent); - }); - - it("should be able to get the data passed to children", function() { - class ChildComponent extends JSXComponent { - render() { - return ( -
- {this.props.children[0].config.foo} - {this.props.children} -
- ); - } - } - - class TestComponent extends JSXComponent { - render() { - return ( -
- - Children Test - -
- ); - } - } - - component = new TestComponent(); - var child = component.components.child; - assert.strictEqual(2, child.element.childNodes.length); - assert.strictEqual("foo", child.element.childNodes[0].textContent); - assert.strictEqual("SPAN", child.element.childNodes[1].tagName); - assert.strictEqual( - "Children Test", - child.element.childNodes[1].textContent - ); - }); - }); - - describe("JSXComponent.render", function() { - it('should create and render components via "JSXComponent.render"', function() { - class TestComponent extends JSXComponent { - render() { - return
{this.props.foo}
; - } - } - - var container = document.createElement("div"); - component = JSXComponent.render( - TestComponent, - { - foo: "fooValue" - }, - container - ); - - assert.ok(component instanceof TestComponent); - assert.strictEqual(1, container.childNodes.length); - assert.strictEqual(component.element, container.childNodes[0]); - assert.strictEqual("DIV", component.element.tagName); - assert.ok(dom.hasClass(component.element, "test")); - assert.strictEqual("fooValue", component.element.textContent); - }); - - it('should render componentless functions via "JSXComponent.render"', function() { - var fn = props => { - return
{props.foo}
; - }; - var container = document.createElement("div"); - JSXComponent.render( - fn, - { - foo: "fooValue" - }, - container - ); - - assert.strictEqual(1, container.childNodes.length); - assert.strictEqual("DIV", container.childNodes[0].tagName); - assert.ok(dom.hasClass(container.childNodes[0], "test")); - assert.strictEqual("fooValue", container.childNodes[0].textContent); - }); - - it('should render jsx element via "JSXComponent.render"', function() { - var container = document.createElement("div"); - JSXComponent.render(
foo
, container); - - assert.strictEqual(1, container.childNodes.length); - assert.strictEqual("DIV", container.childNodes[0].tagName); - assert.ok(dom.hasClass(container.childNodes[0], "test")); - assert.strictEqual("foo", container.childNodes[0].textContent); - }); - }); - - describe("STATE and PROPS", function() { - it("should allow specifying configuration for props", function() { - class TestComponent extends JSXComponent {} - TestComponent.PROPS = { - foo: { - value: "defaultFoo" - } - }; - - component = new TestComponent(); - assert.strictEqual("defaultFoo", component.props.foo); - }); - - it("should allow specifying internal state", function() { - class TestComponent extends JSXComponent {} - TestComponent.STATE = { - foo: { - value: "defaultFoo" - } - }; - - component = new TestComponent(); - assert.strictEqual("defaultFoo", component.state.foo); - }); - - it('should call "propsChanged" when new props are passed', function(done) { - class ChildComponent extends JSXComponent { - render() { - return
{this.props.foo}
; - } - } - ChildComponent.prototype.propsChanged = sinon.stub(); - - class TestComponent extends JSXComponent { - render() { - return ; - } - } - TestComponent.STATE = { - foo: { - value: "foo" - } - }; - - component = new TestComponent(); - var child = component.components.child; - - component.state.foo = "foo2"; - component.once("rendered", function() { - assert.strictEqual("foo2", child.element.textContent); - assert.strictEqual(1, child.propsChanged.callCount); - - var prevProps = child.propsChanged.args[0][0]; - assert.strictEqual("foo", prevProps.foo); - assert.strictEqual("foo2", child.props.foo); - done(); - }); - }); - - it('should allow changes to state in "willReceiveProps" without triggering multiple renders', function( - done - ) { - const renderStub = sinon.stub(); - let count = 0; - - class TestComponent extends JSXComponent { - render() { - renderStub(); - - return ( -
- {this.props.bar}:{this.state.foo} -
- ); - } - - willReceiveProps(data) { - this.state.foo = "foo" + count; - - count++; - } - } - TestComponent.STATE = { - foo: { - value: "foo" - } - }; - TestComponent.PROPS = { - bar: { - value: "bar" - } - }; - - component = new TestComponent(); - - component.props.bar = "bar2"; - - component.once("rendered", function() { - assert.equal(component.element.innerHTML, "bar2:foo0"); - - async.nextTick(function() { - component.props.bar = "bar3"; - component.once("rendered", function() { - assert.equal(component.element.innerHTML, "bar3:foo1"); - assert.equal(renderStub.callCount, 3); - - done(); - }); - }); - }); - }); - - it('should pass changed props data to "willReceiveProps" method', function( - done - ) { - class TestComponent extends JSXComponent {} - TestComponent.prototype.willReceiveProps = sinon.stub(); - TestComponent.PROPS = { - foo: { - value: "foo" - } - }; - - component = new TestComponent(); - - component.props.foo = "foo2"; - - async.nextTick(function() { - assert.equal(component.willReceiveProps.callCount, 1); - assert.deepEqual(component.willReceiveProps.args[0][0], { - foo: { - key: "foo", - newVal: "foo2", - prevVal: "foo" - } - }); - - done(); - }); - }); - - it("component.element and child.element should be the same", function() { - class ChildComponent extends JSXComponent { - render() { - return
; - } - } - - class ParentComponent extends JSXComponent { - render() { - return ; - } - } - - component = new ParentComponent(); - var child = component.refs.child; - assert.strictEqual(component.element, child.element); - }); - - it("should receive elementClasses from parent component", function() { - class ChildComponent extends JSXComponent { - render() { - return
; - } - } - - class ParentComponent extends JSXComponent { - render() { - return ; - } - } - - component = new ParentComponent({ elementClasses: "foo" }); - assert.ok(dom.hasClass(component.element, "child")); - assert.ok(dom.hasClass(component.element, "foo")); - }); - - it("should not apply undefined class", function() { - class ChildComponent extends JSXComponent { - render() { - return
; - } - } - - class ParentComponent extends JSXComponent { - render() { - return ; - } - } - - component = new ParentComponent({ elementClasses: undefined }); - assert.strictEqual(component.element.className, "child"); - }); - - it("should not create duplicate classes", function() { - class ChildComponent extends JSXComponent { - render() { - return
; - } - } - - class ParentComponent extends JSXComponent { - render() { - return ; - } - } - - component = new ParentComponent({ elementClasses: "child" }); - assert.strictEqual(component.element.className, "child"); - }); - - it("should pass elementClasses through higher order components", function() { - class GrandChildComponent extends JSXComponent { - render() { - return
; - } - } - - class ChildComponent extends JSXComponent { - render() { - return ; - } - } - - class ParentComponent extends JSXComponent { - render() { - return ; - } - } - - component = new ParentComponent({ elementClasses: "foo" }); - assert.ok(dom.hasClass(component.element, "child")); - assert.ok(dom.hasClass(component.element, "parent")); - assert.ok(dom.hasClass(component.element, "grandchild")); - }); - }); - - describe("shouldUpdate", function() { - it("should not rerender after props change if shouldUpdate returns false", function( - done - ) { - class TestComponent extends JSXComponent { - render() {} - - shouldUpdate() { - return false; - } - } - TestComponent.PROPS = { - foo: { - value: "defaultFoo" - } - }; - component = new TestComponent(); - - sinon.stub(component, "render"); - component.props.foo = "foo"; - component.once("stateChanged", function() { - assert.strictEqual(0, component.render.callCount); - done(); - }); - }); - - it("should not rerender after state change if shouldUpdate returns false", function( - done - ) { - class TestComponent extends JSXComponent { - render() {} - - shouldUpdate() { - return false; - } - } - TestComponent.STATE = { - foo: { - value: "defaultFoo" - } - }; - component = new TestComponent(); - - sinon.stub(component, "render"); - component.state.foo = "foo"; - component.once("stateChanged", function() { - assert.strictEqual(0, component.render.callCount); - done(); - }); - }); - }); - - describe("SYNC_UPDATES", function() { - it("should update parent component with SYNC_UPDATES during child render", function( - done - ) { - class ChildComponent extends JSXComponent { - attached() { - this.props.updateFoo("Child"); - } - - render() { - return
Child
; - } - } - - class TestComponent extends JSXComponent { - render() { - return ( -
- {this.state.foo} - {this.state.show ? ( - (this.state.foo += newFoo)} - /> - ) : null} -
- ); - } - } - TestComponent.STATE = { - foo: { - value: "foo" - }, - show: {} - }; - TestComponent.SYNC_UPDATES = true; - - component = new TestComponent(); - assert.equal("foo", component.element.textContent); - - component.state.show = true; - component.once("stateSynced", function() { - assert.equal("fooChild", component.element.childNodes[0].textContent); - done(); - }); - }); - - it("should update parent component with SYNC_UPDATES during root child render", function( - done - ) { - class ChildComponent extends JSXComponent { - attached() { - this.props.updateFoo("Child"); - } - - render() { - return
{this.props.foo}
; - } - } - - class TestComponent extends JSXComponent { - render() { - return this.state.show ? ( - (this.state.foo += newFoo)} - /> - ) : null; - } - } - TestComponent.STATE = { - foo: { - value: "foo" - }, - show: {} - }; - TestComponent.SYNC_UPDATES = true; - - component = new TestComponent(); - - component.state.show = true; - component.once("stateSynced", function() { - assert.equal("fooChild", component.element.childNodes[0].textContent); - done(); - }); - }); - }); - - describe("otherProps", function() { - var component; - - afterEach(function() { - if (component) { - component.dispose(); - } - }); - - it("should return object", function() { - class TestComponent extends JSXComponent { - render() { - return
; - } - } - - component = new TestComponent(); - - assert.deepEqual(component.otherProps(), {}); - }); - - it("should pass through unspecified props", function() { - class TestComponent extends JSXComponent { - render() { - return
; - } - } - - TestComponent.PROPS = { - foo: {} - }; - - component = new TestComponent({ baz: "qux", foo: "bar" }); - - assert.deepEqual(component.otherProps(), { baz: "qux" }); - }); - - it("should ignore key and ref", function() { - class TestComponent extends JSXComponent { - render() { - return
; - } - } - - component = new TestComponent({ key: "bar", ref: "qux" }); - - assert.deepEqual(component.otherProps(), {}); - }); - }); +'use strict'; + +import {async} from 'metal'; +import dom from 'metal-dom'; +import JSXComponent from '../src/JSXComponent'; + +describe('JSXComponent', function() { + let component; + + afterEach(function() { + if (component) { + component.dispose(); + } + }); + + it('should render contents from component\'s "render" function', function() { + class TestComponent extends JSXComponent { + render() { + return
Hello World
; + } + } + + component = new TestComponent(); + assert.strictEqual('DIV', component.element.tagName); + assert.ok(dom.hasClass(component.element, 'test')); + assert.strictEqual('Hello World', component.element.textContent); + }); + + it('should not throw error if no jsx function is implemented', function() { + class TestComponent extends JSXComponent {} + + component = new TestComponent(); + assert.strictEqual('DIV', component.element.tagName); + assert.strictEqual('', component.element.textContent); + }); + + it('should attach inline listeners', function() { + class TestComponent extends JSXComponent { + render() { + return ( +
+
+ ); + } + } + TestComponent.prototype.handleClick = sinon.stub(); + + component = new TestComponent(); + dom.triggerEvent(component.element.childNodes[0], 'click'); + assert.strictEqual(1, component.handleClick.callCount); + }); + + it('should create and render sub components', function() { + class ChildComponent extends JSXComponent { + render() { + return
Child
; + } + } + + class TestComponent extends JSXComponent { + render() { + return ( +
+ +
+ ); + } + } + + component = new TestComponent(); + let child = component.components.child; + assert.ok(child); + assert.strictEqual('DIV', child.element.tagName); + assert.ok(dom.hasClass(child.element, 'child')); + assert.strictEqual('Child', child.element.textContent); + assert.strictEqual(child.element, component.element.childNodes[0]); + }); + + it('should receive props from parent components', function() { + class ChildComponent extends JSXComponent { + render() { + return
{this.props.foo}
; + } + } + + class TestComponent extends JSXComponent { + render() { + return ( +
+ +
+ ); + } + } + + component = new TestComponent(); + let child = component.components.child; + assert.strictEqual('Foo', child.element.textContent); + }); + + describe('Children', function() { + it('should be able to render children through props', function() { + class ChildComponent extends JSXComponent { + render() { + return
{this.props.children}
; + } + } + + class TestComponent extends JSXComponent { + render() { + return Hello World; + } + } + + component = new TestComponent(); + assert.ok(component.components.child); + assert.strictEqual(component.components.child.element, component.element); + assert.strictEqual('DIV', component.element.tagName); + assert.strictEqual('Hello World', component.element.textContent); + }); + + it('should not throw error if trying to render empty children', function() { + class TestComponent extends JSXComponent { + render() { + return
{this.props.children}
; + } + } + + component = new TestComponent(); + assert.strictEqual(0, component.element.childNodes.length); + assert.ok(component.props.children); + assert.strictEqual(0, component.props.children.length); + }); + + it('should be able to render only some of the received children', function() { + class ChildComponent extends JSXComponent { + render() { + return
{this.props.children[1]}
; + } + } + + class TestComponent extends JSXComponent { + render() { + return ( +
+ + Children Test + Children Test 2 + Children Test 3 + +
+ ); + } + } + + component = new TestComponent(); + let child = component.components.child; + assert.strictEqual(1, child.element.childNodes.length); + assert.strictEqual('SPAN', child.element.childNodes[0].tagName); + assert.strictEqual('Children Test 2', child.element.textContent); + }); + + it('should be able to get the data passed to children', function() { + class ChildComponent extends JSXComponent { + render() { + return ( +
+ {this.props.children[0].config.foo} + {this.props.children} +
+ ); + } + } + + class TestComponent extends JSXComponent { + render() { + return ( +
+ + Children Test + +
+ ); + } + } + + component = new TestComponent(); + let child = component.components.child; + assert.strictEqual(2, child.element.childNodes.length); + assert.strictEqual('foo', child.element.childNodes[0].textContent); + assert.strictEqual('SPAN', child.element.childNodes[1].tagName); + assert.strictEqual( + 'Children Test', + child.element.childNodes[1].textContent + ); + }); + }); + + describe('JSXComponent.render', function() { + it('should create and render components via "JSXComponent.render"', function() { + class TestComponent extends JSXComponent { + render() { + return
{this.props.foo}
; + } + } + + let container = document.createElement('div'); + component = JSXComponent.render( + TestComponent, + { + foo: 'fooValue', + }, + container + ); + + assert.ok(component instanceof TestComponent); + assert.strictEqual(1, container.childNodes.length); + assert.strictEqual(component.element, container.childNodes[0]); + assert.strictEqual('DIV', component.element.tagName); + assert.ok(dom.hasClass(component.element, 'test')); + assert.strictEqual('fooValue', component.element.textContent); + }); + + it('should render componentless functions via "JSXComponent.render"', function() { + let fn = props => { + return
{props.foo}
; + }; + let container = document.createElement('div'); + JSXComponent.render( + fn, + { + foo: 'fooValue', + }, + container + ); + + assert.strictEqual(1, container.childNodes.length); + assert.strictEqual('DIV', container.childNodes[0].tagName); + assert.ok(dom.hasClass(container.childNodes[0], 'test')); + assert.strictEqual('fooValue', container.childNodes[0].textContent); + }); + + it('should render jsx element via "JSXComponent.render"', function() { + let container = document.createElement('div'); + JSXComponent.render(
foo
, container); + + assert.strictEqual(1, container.childNodes.length); + assert.strictEqual('DIV', container.childNodes[0].tagName); + assert.ok(dom.hasClass(container.childNodes[0], 'test')); + assert.strictEqual('foo', container.childNodes[0].textContent); + }); + }); + + describe('STATE and PROPS', function() { + it('should allow specifying configuration for props', function() { + class TestComponent extends JSXComponent {} + TestComponent.PROPS = { + foo: { + value: 'defaultFoo', + }, + }; + + component = new TestComponent(); + assert.strictEqual('defaultFoo', component.props.foo); + }); + + it('should allow specifying internal state', function() { + class TestComponent extends JSXComponent {} + TestComponent.STATE = { + foo: { + value: 'defaultFoo', + }, + }; + + component = new TestComponent(); + assert.strictEqual('defaultFoo', component.state.foo); + }); + + it('should call "propsChanged" when new props are passed', function(done) { + class ChildComponent extends JSXComponent { + render() { + return
{this.props.foo}
; + } + } + ChildComponent.prototype.propsChanged = sinon.stub(); + + class TestComponent extends JSXComponent { + render() { + return ; + } + } + TestComponent.STATE = { + foo: { + value: 'foo', + }, + }; + + component = new TestComponent(); + let child = component.components.child; + + component.state.foo = 'foo2'; + component.once('rendered', function() { + assert.strictEqual('foo2', child.element.textContent); + assert.strictEqual(1, child.propsChanged.callCount); + + let prevProps = child.propsChanged.args[0][0]; + assert.strictEqual('foo', prevProps.foo); + assert.strictEqual('foo2', child.props.foo); + done(); + }); + }); + + it('should allow changes to state in "willReceiveProps" without triggering multiple renders', function( + done + ) { + const renderStub = sinon.stub(); + let count = 0; + + class TestComponent extends JSXComponent { + render() { + renderStub(); + + return ( +
+ {this.props.bar}:{this.state.foo} +
+ ); + } + + willReceiveProps(data) { + this.state.foo = 'foo' + count; + + count++; + } + } + TestComponent.STATE = { + foo: { + value: 'foo', + }, + }; + TestComponent.PROPS = { + bar: { + value: 'bar', + }, + }; + + component = new TestComponent(); + + component.props.bar = 'bar2'; + + component.once('rendered', function() { + assert.equal(component.element.innerHTML, 'bar2:foo0'); + + async.nextTick(function() { + component.props.bar = 'bar3'; + component.once('rendered', function() { + assert.equal(component.element.innerHTML, 'bar3:foo1'); + assert.equal(renderStub.callCount, 3); + + done(); + }); + }); + }); + }); + + it('should pass changed props data to "willReceiveProps" method', function( + done + ) { + class TestComponent extends JSXComponent {} + TestComponent.prototype.willReceiveProps = sinon.stub(); + TestComponent.PROPS = { + foo: { + value: 'foo', + }, + }; + + component = new TestComponent(); + + component.props.foo = 'foo2'; + + async.nextTick(function() { + assert.equal(component.willReceiveProps.callCount, 1); + assert.deepEqual(component.willReceiveProps.args[0][0], { + foo: { + key: 'foo', + newVal: 'foo2', + prevVal: 'foo', + }, + }); + + done(); + }); + }); + + it('component.element and child.element should be the same', function() { + class ChildComponent extends JSXComponent { + render() { + return
; + } + } + + class ParentComponent extends JSXComponent { + render() { + return ; + } + } + + component = new ParentComponent(); + let child = component.refs.child; + assert.strictEqual(component.element, child.element); + }); + + it('should receive elementClasses from parent component', function() { + class ChildComponent extends JSXComponent { + render() { + return
; + } + } + + class ParentComponent extends JSXComponent { + render() { + return ; + } + } + + component = new ParentComponent({elementClasses: 'foo'}); + assert.ok(dom.hasClass(component.element, 'child')); + assert.ok(dom.hasClass(component.element, 'foo')); + }); + + it('should not apply undefined class', function() { + class ChildComponent extends JSXComponent { + render() { + return
; + } + } + + class ParentComponent extends JSXComponent { + render() { + return ; + } + } + + component = new ParentComponent({elementClasses: undefined}); + assert.strictEqual(component.element.className, 'child'); + }); + + it('should not create duplicate classes', function() { + class ChildComponent extends JSXComponent { + render() { + return
; + } + } + + class ParentComponent extends JSXComponent { + render() { + return ; + } + } + + component = new ParentComponent({elementClasses: 'child'}); + assert.strictEqual(component.element.className, 'child'); + }); + + it('should pass elementClasses through higher order components', function() { + class GrandChildComponent extends JSXComponent { + render() { + return
; + } + } + + class ChildComponent extends JSXComponent { + render() { + return ; + } + } + + class ParentComponent extends JSXComponent { + render() { + return ; + } + } + + component = new ParentComponent({elementClasses: 'foo'}); + assert.ok(dom.hasClass(component.element, 'child')); + assert.ok(dom.hasClass(component.element, 'parent')); + assert.ok(dom.hasClass(component.element, 'grandchild')); + }); + }); + + describe('shouldUpdate', function() { + it('should not rerender after props change if shouldUpdate returns false', function( + done + ) { + class TestComponent extends JSXComponent { + render() {} + + shouldUpdate() { + return false; + } + } + TestComponent.PROPS = { + foo: { + value: 'defaultFoo', + }, + }; + component = new TestComponent(); + + sinon.stub(component, 'render'); + component.props.foo = 'foo'; + component.once('stateChanged', function() { + assert.strictEqual(0, component.render.callCount); + done(); + }); + }); + + it('should not rerender after state change if shouldUpdate returns false', function( + done + ) { + class TestComponent extends JSXComponent { + render() {} + + shouldUpdate() { + return false; + } + } + TestComponent.STATE = { + foo: { + value: 'defaultFoo', + }, + }; + component = new TestComponent(); + + sinon.stub(component, 'render'); + component.state.foo = 'foo'; + component.once('stateChanged', function() { + assert.strictEqual(0, component.render.callCount); + done(); + }); + }); + }); + + describe('SYNC_UPDATES', function() { + it('should update parent component with SYNC_UPDATES during child render', function( + done + ) { + class ChildComponent extends JSXComponent { + attached() { + this.props.updateFoo('Child'); + } + + render() { + return
Child
; + } + } + + class TestComponent extends JSXComponent { + render() { + return ( +
+ {this.state.foo} + {this.state.show ? ( + (this.state.foo += newFoo)} + /> + ) : null} +
+ ); + } + } + TestComponent.STATE = { + foo: { + value: 'foo', + }, + show: {}, + }; + TestComponent.SYNC_UPDATES = true; + + component = new TestComponent(); + assert.equal('foo', component.element.textContent); + + component.state.show = true; + component.once('stateSynced', function() { + assert.equal('fooChild', component.element.childNodes[0].textContent); + done(); + }); + }); + + it('should update parent component with SYNC_UPDATES during root child render', function( + done + ) { + class ChildComponent extends JSXComponent { + attached() { + this.props.updateFoo('Child'); + } + + render() { + return
{this.props.foo}
; + } + } + + class TestComponent extends JSXComponent { + render() { + return this.state.show ? ( + (this.state.foo += newFoo)} + /> + ) : null; + } + } + TestComponent.STATE = { + foo: { + value: 'foo', + }, + show: {}, + }; + TestComponent.SYNC_UPDATES = true; + + component = new TestComponent(); + + component.state.show = true; + component.once('stateSynced', function() { + assert.equal('fooChild', component.element.childNodes[0].textContent); + done(); + }); + }); + }); + + describe('otherProps', function() { + let component; + + afterEach(function() { + if (component) { + component.dispose(); + } + }); + + it('should return object', function() { + class TestComponent extends JSXComponent { + render() { + return
; + } + } + + component = new TestComponent(); + + assert.deepEqual(component.otherProps(), {}); + }); + + it('should pass through unspecified props', function() { + class TestComponent extends JSXComponent { + render() { + return
; + } + } + + TestComponent.PROPS = { + foo: {}, + }; + + component = new TestComponent({baz: 'qux', foo: 'bar'}); + + assert.deepEqual(component.otherProps(), {baz: 'qux'}); + }); + + it('should ignore key and ref', function() { + class TestComponent extends JSXComponent { + render() { + return
; + } + } + + component = new TestComponent({key: 'bar', ref: 'qux'}); + + assert.deepEqual(component.otherProps(), {}); + }); + }); }); diff --git a/packages/metal-jsx/test/JSXDataManager.js b/packages/metal-jsx/test/JSXDataManager.js index e780f5e0..9b3fd9fc 100644 --- a/packages/metal-jsx/test/JSXDataManager.js +++ b/packages/metal-jsx/test/JSXDataManager.js @@ -1,381 +1,381 @@ -"use strict"; - -import Component from "metal-component"; -import IncrementalDomRenderer from "metal-incremental-dom"; -import JSXDataManager from "../src/JSXDataManager"; - -describe("JSXDataManager", function() { - var component; - var component2; - - afterEach(function() { - if (component) { - component.dispose(); - } - if (component2) { - component2.dispose(); - } - }); - - it('should create "props" and "state" objects in component', function() { - class TestComponent extends Component {} - TestComponent.DATA_MANAGER = JSXDataManager; - - component = new TestComponent(); - assert.ok(component.state); - assert.ok(component.props); - }); - - describe("state", function() { - it("should add properties from STATE to `state` variable", function() { - class TestComponent extends Component {} - TestComponent.DATA_MANAGER = JSXDataManager; - TestComponent.STATE = { - foo: { - value: "defaultFoo" - } - }; - - component = new TestComponent(); - - assert.ok(!component.foo); - assert.ok(!component.props.foo); - assert.strictEqual("defaultFoo", component.state.foo); - }); - - it("should not use constructor values for properties in STATE", function() { - class TestComponent extends Component {} - TestComponent.DATA_MANAGER = JSXDataManager; - TestComponent.STATE = { - foo: { - value: "defaultFoo" - } - }; - - component = new TestComponent({ - foo: "foo" - }); - assert.strictEqual("defaultFoo", component.state.foo); - }); - - it('should not include default component data in "state"', function() { - class TestComponent extends Component {} - TestComponent.DATA_MANAGER = JSXDataManager; - - component = new TestComponent(); - assert.ok(!component.state.hasOwnProperty("elementClasses")); - assert.ok(!component.state.hasOwnProperty("events")); - assert.ok(!component.state.hasOwnProperty("visible")); - }); - - it("should keep state objects different between component instances", function() { - class TestComponent extends Component {} - TestComponent.DATA_MANAGER = JSXDataManager; - TestComponent.STATE = { - foo: { - value: "defaultFoo" - } - }; - - component = new TestComponent(); - component2 = new TestComponent(); - assert.notEqual(component.state, component2.state); - - component.state.foo = "foo1"; - assert.equal("foo1", component.state.foo); - assert.equal("defaultFoo", component2.state.foo); - - component2.state.foo = "foo2"; - assert.equal("foo1", component.state.foo); - assert.equal("foo2", component2.state.foo); - }); - - it("should run setState's callback after component is rerendered", function( - done - ) { - class TestComponent extends Component { - render() {} - } - TestComponent.DATA_MANAGER = JSXDataManager; - TestComponent.RENDERER = IncrementalDomRenderer; - TestComponent.STATE = { - foo: { - value: "defaultFoo" - } - }; - - component = new TestComponent(); - sinon.spy(component, "render"); - - component.setState( - { - foo: "newFoo" - }, - () => { - assert.strictEqual(1, component.render.callCount); - done(); - } - ); - }); - - it("should now allow changes to a component's props cause changes to anothers", function() { - class TestComponent extends Component { - render() {} - } - TestComponent.DATA_MANAGER = JSXDataManager; - TestComponent.RENDERER = IncrementalDomRenderer; - - component = new TestComponent(); - component2 = new TestComponent(); - - component.props.foo = "foo"; - assert.equal("foo", component.props.foo); - assert.notEqual("foo", component2.props.foo); - }); - }); - - describe("props", function() { - it("should add properties from PROPS to `props` variable", function() { - class TestComponent extends Component {} - TestComponent.DATA_MANAGER = JSXDataManager; - TestComponent.PROPS = { - foo: { - value: "defaultFoo" - } - }; - - component = new TestComponent(); - - assert.ok(!component.foo); - assert.ok(!component.state.foo); - assert.strictEqual("defaultFoo", component.props.foo); - }); - - it("should use constructor values for properties in PROPS", function() { - class TestComponent extends Component {} - TestComponent.DATA_MANAGER = JSXDataManager; - TestComponent.PROPS = { - foo: { - value: "defaultFoo" - } - }; - - component = new TestComponent({ - foo: "foo" - }); - assert.strictEqual("foo", component.props.foo); - }); - - it('should use default prop value when "undefined" is passed as initial value', function() { - class TestComponent extends Component {} - TestComponent.DATA_MANAGER = JSXDataManager; - TestComponent.PROPS = { - foo: { - value: "defaultFoo" - } - }; - - component = new TestComponent({ - foo: undefined - }); - assert.strictEqual("defaultFoo", component.props.foo); - }); - - it('should include default component data in "props"', function() { - class TestComponent extends Component {} - TestComponent.DATA_MANAGER = JSXDataManager; - - component = new TestComponent(); - assert.ok(component.props.hasOwnProperty("elementClasses")); - assert.ok(component.props.hasOwnProperty("events")); - assert.ok(component.props.hasOwnProperty("visible")); - }); - - it("should keep prop objects different between component instances", function() { - class TestComponent extends Component {} - TestComponent.DATA_MANAGER = JSXDataManager; - TestComponent.PROPS = { - foo: { - value: "defaultFoo" - } - }; - - component = new TestComponent(); - component2 = new TestComponent(); - assert.notEqual(component.props, component2.props); - - component.props.foo = "foo1"; - assert.equal("foo1", component.props.foo); - assert.equal("defaultFoo", component2.props.foo); - - component2.props.foo = "foo2"; - assert.equal("foo1", component.props.foo); - assert.equal("foo2", component2.props.foo); - }); - - it('should return value from "props" when "get" is called', function() { - class TestComponent extends Component {} - TestComponent.DATA_MANAGER = JSXDataManager; - TestComponent.PROPS = { - foo: { - value: "defaultPropsFoo" - } - }; - TestComponent.STATE = { - foo: { - value: "defaultStateFoo" - } - }; - - component = new TestComponent(); - assert.strictEqual("defaultPropsFoo", component.props.foo); - assert.strictEqual("defaultStateFoo", component.state.foo); - - var manager = component.getDataManager(); - assert.strictEqual("defaultPropsFoo", manager.get(component, "foo")); - }); - - it('should return the "State" instance for props from "getPropsInstance"', function() { - class TestComponent extends Component {} - TestComponent.DATA_MANAGER = JSXDataManager; - TestComponent.PROPS = { - foo: { - value: "defaultPropsFoo" - } - }; - TestComponent.STATE = { - foo: { - value: "defaultStateFoo" - } - }; - - component = new TestComponent(); - var propsInstance = component - .getDataManager() - .getPropsInstance(component); - assert.ok(propsInstance); - assert.equal("defaultPropsFoo", propsInstance.get("foo")); - }); - - it('should return keys from "props" when "getSyncKeys" is called', function() { - class TestComponent extends Component {} - TestComponent.DATA_MANAGER = JSXDataManager; - TestComponent.PROPS = { - foo: {} - }; - TestComponent.STATE = { - bar: {} - }; - - component = new TestComponent(); - var manager = component.getDataManager(); - var expected = ["children", "elementClasses", "events", "foo", "visible"]; - assert.deepEqual(expected, manager.getSyncKeys(component).sort()); - }); - }); - - describe("replaceNonInternal", function() { - it("should replace props with given values", function() { - class TestComponent extends Component {} - TestComponent.DATA_MANAGER = JSXDataManager; - TestComponent.PROPS = { - bar: { - value: "defaultBar" - }, - foo: { - value: "defaultFoo" - } - }; - - component = new TestComponent(); - var manager = component.getDataManager(); - manager.replaceNonInternal(component, { - bar: "bar", - foo: "foo" - }); - - assert.strictEqual("bar", component.props.bar); - assert.strictEqual("foo", component.props.foo); - }); - - it("should replace props with default values if no value is given", function() { - class TestComponent extends Component {} - TestComponent.DATA_MANAGER = JSXDataManager; - TestComponent.PROPS = { - bar: { - value: "defaultBar" - }, - foo: { - value: "defaultFoo" - } - }; - - component = new TestComponent(); - var manager = component.getDataManager(); - manager.replaceNonInternal(component, { - bar: "bar" - }); - - assert.strictEqual("bar", component.props.bar); - assert.strictEqual("defaultFoo", component.props.foo); - }); - - it("should not replace state values", function() { - class TestComponent extends Component {} - TestComponent.DATA_MANAGER = JSXDataManager; - TestComponent.STATE = { - foo: { - value: "defaultFoo" - } - }; - - component = new TestComponent(); - var manager = component.getDataManager(); - manager.replaceNonInternal(component, { - foo: "foo" - }); - assert.strictEqual("defaultFoo", component.state.foo); - }); - - it("should manually set prop values not specified in PROPS", function() { - class TestComponent extends Component {} - TestComponent.DATA_MANAGER = JSXDataManager; - TestComponent.PROPS = { - bar: { - value: "defaultBar" - } - }; - - component = new TestComponent(); - var manager = component.getDataManager(); - manager.replaceNonInternal(component, { - bar: "bar", - foo: "foo" - }); - - assert.strictEqual("bar", component.props.bar); - assert.strictEqual("foo", component.props.foo); - }); - - it('should call "propsChanged" lifecycle method when props are replaced', function() { - class TestComponent extends Component {} - TestComponent.prototype.propsChanged = sinon.stub(); - TestComponent.DATA_MANAGER = JSXDataManager; - TestComponent.PROPS = { - foo: { - value: "defaultFoo" - } - }; - - component = new TestComponent(); - var manager = component.getDataManager(); - manager.replaceNonInternal(component, { - foo: "foo" - }); - - assert.strictEqual(1, component.propsChanged.callCount); - assert.strictEqual("defaultFoo", component.propsChanged.args[0][0].foo); - assert.strictEqual("foo", component.props.foo); - }); - }); +'use strict'; + +import Component from 'metal-component'; +import IncrementalDomRenderer from 'metal-incremental-dom'; +import JSXDataManager from '../src/JSXDataManager'; + +describe('JSXDataManager', function() { + let component; + let component2; + + afterEach(function() { + if (component) { + component.dispose(); + } + if (component2) { + component2.dispose(); + } + }); + + it('should create "props" and "state" objects in component', function() { + class TestComponent extends Component {} + TestComponent.DATA_MANAGER = JSXDataManager; + + component = new TestComponent(); + assert.ok(component.state); + assert.ok(component.props); + }); + + describe('state', function() { + it('should add properties from STATE to `state` variable', function() { + class TestComponent extends Component {} + TestComponent.DATA_MANAGER = JSXDataManager; + TestComponent.STATE = { + foo: { + value: 'defaultFoo', + }, + }; + + component = new TestComponent(); + + assert.ok(!component.foo); + assert.ok(!component.props.foo); + assert.strictEqual('defaultFoo', component.state.foo); + }); + + it('should not use constructor values for properties in STATE', function() { + class TestComponent extends Component {} + TestComponent.DATA_MANAGER = JSXDataManager; + TestComponent.STATE = { + foo: { + value: 'defaultFoo', + }, + }; + + component = new TestComponent({ + foo: 'foo', + }); + assert.strictEqual('defaultFoo', component.state.foo); + }); + + it('should not include default component data in "state"', function() { + class TestComponent extends Component {} + TestComponent.DATA_MANAGER = JSXDataManager; + + component = new TestComponent(); + assert.ok(!component.state.hasOwnProperty('elementClasses')); + assert.ok(!component.state.hasOwnProperty('events')); + assert.ok(!component.state.hasOwnProperty('visible')); + }); + + it('should keep state objects different between component instances', function() { + class TestComponent extends Component {} + TestComponent.DATA_MANAGER = JSXDataManager; + TestComponent.STATE = { + foo: { + value: 'defaultFoo', + }, + }; + + component = new TestComponent(); + component2 = new TestComponent(); + assert.notEqual(component.state, component2.state); + + component.state.foo = 'foo1'; + assert.equal('foo1', component.state.foo); + assert.equal('defaultFoo', component2.state.foo); + + component2.state.foo = 'foo2'; + assert.equal('foo1', component.state.foo); + assert.equal('foo2', component2.state.foo); + }); + + it('should run setState\'s callback after component is rerendered', function( + done + ) { + class TestComponent extends Component { + render() {} + } + TestComponent.DATA_MANAGER = JSXDataManager; + TestComponent.RENDERER = IncrementalDomRenderer; + TestComponent.STATE = { + foo: { + value: 'defaultFoo', + }, + }; + + component = new TestComponent(); + sinon.spy(component, 'render'); + + component.setState( + { + foo: 'newFoo', + }, + () => { + assert.strictEqual(1, component.render.callCount); + done(); + } + ); + }); + + it('should now allow changes to a component\'s props cause changes to anothers', function() { + class TestComponent extends Component { + render() {} + } + TestComponent.DATA_MANAGER = JSXDataManager; + TestComponent.RENDERER = IncrementalDomRenderer; + + component = new TestComponent(); + component2 = new TestComponent(); + + component.props.foo = 'foo'; + assert.equal('foo', component.props.foo); + assert.notEqual('foo', component2.props.foo); + }); + }); + + describe('props', function() { + it('should add properties from PROPS to `props` variable', function() { + class TestComponent extends Component {} + TestComponent.DATA_MANAGER = JSXDataManager; + TestComponent.PROPS = { + foo: { + value: 'defaultFoo', + }, + }; + + component = new TestComponent(); + + assert.ok(!component.foo); + assert.ok(!component.state.foo); + assert.strictEqual('defaultFoo', component.props.foo); + }); + + it('should use constructor values for properties in PROPS', function() { + class TestComponent extends Component {} + TestComponent.DATA_MANAGER = JSXDataManager; + TestComponent.PROPS = { + foo: { + value: 'defaultFoo', + }, + }; + + component = new TestComponent({ + foo: 'foo', + }); + assert.strictEqual('foo', component.props.foo); + }); + + it('should use default prop value when "undefined" is passed as initial value', function() { + class TestComponent extends Component {} + TestComponent.DATA_MANAGER = JSXDataManager; + TestComponent.PROPS = { + foo: { + value: 'defaultFoo', + }, + }; + + component = new TestComponent({ + foo: undefined, + }); + assert.strictEqual('defaultFoo', component.props.foo); + }); + + it('should include default component data in "props"', function() { + class TestComponent extends Component {} + TestComponent.DATA_MANAGER = JSXDataManager; + + component = new TestComponent(); + assert.ok(component.props.hasOwnProperty('elementClasses')); + assert.ok(component.props.hasOwnProperty('events')); + assert.ok(component.props.hasOwnProperty('visible')); + }); + + it('should keep prop objects different between component instances', function() { + class TestComponent extends Component {} + TestComponent.DATA_MANAGER = JSXDataManager; + TestComponent.PROPS = { + foo: { + value: 'defaultFoo', + }, + }; + + component = new TestComponent(); + component2 = new TestComponent(); + assert.notEqual(component.props, component2.props); + + component.props.foo = 'foo1'; + assert.equal('foo1', component.props.foo); + assert.equal('defaultFoo', component2.props.foo); + + component2.props.foo = 'foo2'; + assert.equal('foo1', component.props.foo); + assert.equal('foo2', component2.props.foo); + }); + + it('should return value from "props" when "get" is called', function() { + class TestComponent extends Component {} + TestComponent.DATA_MANAGER = JSXDataManager; + TestComponent.PROPS = { + foo: { + value: 'defaultPropsFoo', + }, + }; + TestComponent.STATE = { + foo: { + value: 'defaultStateFoo', + }, + }; + + component = new TestComponent(); + assert.strictEqual('defaultPropsFoo', component.props.foo); + assert.strictEqual('defaultStateFoo', component.state.foo); + + let manager = component.getDataManager(); + assert.strictEqual('defaultPropsFoo', manager.get(component, 'foo')); + }); + + it('should return the "State" instance for props from "getPropsInstance"', function() { + class TestComponent extends Component {} + TestComponent.DATA_MANAGER = JSXDataManager; + TestComponent.PROPS = { + foo: { + value: 'defaultPropsFoo', + }, + }; + TestComponent.STATE = { + foo: { + value: 'defaultStateFoo', + }, + }; + + component = new TestComponent(); + let propsInstance = component + .getDataManager() + .getPropsInstance(component); + assert.ok(propsInstance); + assert.equal('defaultPropsFoo', propsInstance.get('foo')); + }); + + it('should return keys from "props" when "getSyncKeys" is called', function() { + class TestComponent extends Component {} + TestComponent.DATA_MANAGER = JSXDataManager; + TestComponent.PROPS = { + foo: {}, + }; + TestComponent.STATE = { + bar: {}, + }; + + component = new TestComponent(); + let manager = component.getDataManager(); + let expected = ['children', 'elementClasses', 'events', 'foo', 'visible']; + assert.deepEqual(expected, manager.getSyncKeys(component).sort()); + }); + }); + + describe('replaceNonInternal', function() { + it('should replace props with given values', function() { + class TestComponent extends Component {} + TestComponent.DATA_MANAGER = JSXDataManager; + TestComponent.PROPS = { + bar: { + value: 'defaultBar', + }, + foo: { + value: 'defaultFoo', + }, + }; + + component = new TestComponent(); + let manager = component.getDataManager(); + manager.replaceNonInternal(component, { + bar: 'bar', + foo: 'foo', + }); + + assert.strictEqual('bar', component.props.bar); + assert.strictEqual('foo', component.props.foo); + }); + + it('should replace props with default values if no value is given', function() { + class TestComponent extends Component {} + TestComponent.DATA_MANAGER = JSXDataManager; + TestComponent.PROPS = { + bar: { + value: 'defaultBar', + }, + foo: { + value: 'defaultFoo', + }, + }; + + component = new TestComponent(); + let manager = component.getDataManager(); + manager.replaceNonInternal(component, { + bar: 'bar', + }); + + assert.strictEqual('bar', component.props.bar); + assert.strictEqual('defaultFoo', component.props.foo); + }); + + it('should not replace state values', function() { + class TestComponent extends Component {} + TestComponent.DATA_MANAGER = JSXDataManager; + TestComponent.STATE = { + foo: { + value: 'defaultFoo', + }, + }; + + component = new TestComponent(); + let manager = component.getDataManager(); + manager.replaceNonInternal(component, { + foo: 'foo', + }); + assert.strictEqual('defaultFoo', component.state.foo); + }); + + it('should manually set prop values not specified in PROPS', function() { + class TestComponent extends Component {} + TestComponent.DATA_MANAGER = JSXDataManager; + TestComponent.PROPS = { + bar: { + value: 'defaultBar', + }, + }; + + component = new TestComponent(); + let manager = component.getDataManager(); + manager.replaceNonInternal(component, { + bar: 'bar', + foo: 'foo', + }); + + assert.strictEqual('bar', component.props.bar); + assert.strictEqual('foo', component.props.foo); + }); + + it('should call "propsChanged" lifecycle method when props are replaced', function() { + class TestComponent extends Component {} + TestComponent.prototype.propsChanged = sinon.stub(); + TestComponent.DATA_MANAGER = JSXDataManager; + TestComponent.PROPS = { + foo: { + value: 'defaultFoo', + }, + }; + + component = new TestComponent(); + let manager = component.getDataManager(); + manager.replaceNonInternal(component, { + foo: 'foo', + }); + + assert.strictEqual(1, component.propsChanged.callCount); + assert.strictEqual('defaultFoo', component.propsChanged.args[0][0].foo); + assert.strictEqual('foo', component.props.foo); + }); + }); }); diff --git a/packages/metal-jsx/test/JSXRenderer.js b/packages/metal-jsx/test/JSXRenderer.js index 1a0ba138..a36f44a6 100644 --- a/packages/metal-jsx/test/JSXRenderer.js +++ b/packages/metal-jsx/test/JSXRenderer.js @@ -1,563 +1,563 @@ -"use strict"; - -import dom from "metal-dom"; -import Component from "metal-component"; -import JSXRenderer from "../src/JSXRenderer"; -import JSXDataManager from "../src/JSXDataManager"; - -describe("JSXRenderer", function() { - let component; - let createdComps; - let TestJSXComponent; - - beforeEach(function() { - createdComps = []; - class TestJSXComponentCtor extends Component { - created() { - createdComps.push(this); - } - } - TestJSXComponentCtor.DATA_MANAGER = JSXDataManager; - TestJSXComponentCtor.RENDERER = JSXRenderer; - TestJSXComponent = TestJSXComponentCtor; - }); - - afterEach(function() { - if (component) { - component.dispose(); - } - }); - - it('should render returned contents from variable in "render" function', function() { - class TestComponent extends TestJSXComponent { - render() { - var jsx =
Hello World
; - return jsx; - } - } - - component = new TestComponent(); - assert.strictEqual("DIV", component.element.tagName); - assert.ok(dom.hasClass(component.element, "test")); - assert.strictEqual("Hello World", component.element.textContent); - }); - - it("should be able to render a child without wrapper element", function() { - class ChildComponent extends TestJSXComponent { - render() { - return this.props.children[1]; - } - } - - class TestComponent extends TestJSXComponent { - render() { - return ( -
- - Children Test - Children Test 2 - Children Test 3 - -
- ); - } - } - - component = new TestComponent(); - var child = component.components.child; - assert.strictEqual("SPAN", child.element.tagName); - assert.strictEqual(1, child.element.childNodes.length); - assert.strictEqual("Children Test 2", child.element.textContent); - }); - - it("should reuse child empty component when it renders content for the first time", function( - done - ) { - class Wrapper extends TestJSXComponent { - render() { - return this.props.children; - } - } - - const childInstances = []; - class Child extends TestJSXComponent { - created() { - childInstances.push(this); - } - - render() { - return this.state.show ? Child : null; - } - } - Child.STATE = { - show: {} - }; - - class TestComponent extends TestJSXComponent { - render() { - return ( - -
- -
-
- ); - } - } - - const element = document.createElement("div"); - dom.enterDocument(element); - component = new TestComponent({ - element - }); - assert.strictEqual(1, childInstances.length); - const child = childInstances[0]; - - child.state.show = true; - child.once("stateSynced", function() { - assert.strictEqual(1, childInstances.length); - assert.ok(!child.isDisposed()); - assert.equal("Child", child.element.textContent); - assert.equal(child.element, component.element.childNodes[0]); - done(); - }); - }); - - it("should reuse child empty component when its parent makes it render content for the first time", function( - done - ) { - class Wrapper extends TestJSXComponent { - render() { - return this.props.children; - } - } - - const childInstances = []; - class Child extends TestJSXComponent { - created() { - childInstances.push(this); - } - - render() { - return this.props.show ? Child : null; - } - } - - class TestComponent extends TestJSXComponent { - render() { - return ( - -
- -
-
- ); - } - } - TestComponent.STATE = { - show: {} - }; - - const element = document.createElement("div"); - dom.enterDocument(element); - component = new TestComponent({ - element - }); - assert.strictEqual(1, childInstances.length); - const child = childInstances[0]; - - component.state.show = true; - component.once("stateSynced", function() { - assert.strictEqual(1, childInstances.length); - assert.ok(!child.isDisposed()); - assert.equal("Child", child.element.textContent); - assert.equal(child.element, component.element.childNodes[0]); - done(); - }); - }); - - it("should update if props change", function(done) { - class TestComponent extends TestJSXComponent { - render() { - return
{this.props.foo}
; - } - } - TestComponent.PROPS = { - foo: { - value: "defaultFoo" - } - }; - - component = new TestComponent(); - assert.strictEqual("defaultFoo", component.element.textContent); - - component.props.foo = "foo"; - component.once("rendered", function() { - assert.strictEqual("foo", component.element.textContent); - done(); - }); - }); - - it("should update if state changes", function(done) { - class TestComponent extends TestJSXComponent { - render() { - return
{this.state.foo}
; - } - } - TestComponent.STATE = { - foo: { - value: "defaultFoo" - } - }; - - component = new TestComponent(); - assert.strictEqual("defaultFoo", component.element.textContent); - - component.state.foo = "foo"; - component.once("rendered", function() { - assert.strictEqual("foo", component.element.textContent); - done(); - }); - }); - - it("should pass both state and prop changes to shouldUpdate", function(done) { - class TestComponent extends TestJSXComponent { - shouldUpdate() {} - } - TestComponent.PROPS = { - bar: {} - }; - TestComponent.STATE = { - foo: {} - }; - - component = new TestComponent(); - sinon.stub(component, "shouldUpdate"); - component.props.bar = "bar"; - component.state.foo = "foo"; - component.once("stateChanged", function() { - assert.strictEqual(1, component.shouldUpdate.callCount); - - const stateChanges = component.shouldUpdate.args[0][0]; - assert.ok(stateChanges.foo); - assert.strictEqual("foo", stateChanges.foo.newVal); - assert.strictEqual(undefined, stateChanges.foo.prevVal); - - const propChanges = component.shouldUpdate.args[0][1]; - assert.ok(propChanges.bar); - assert.strictEqual("bar", propChanges.bar.newVal); - assert.strictEqual(undefined, propChanges.bar.prevVal); - - done(); - }); - }); - - it("should pass both state and prop changes to willUpdate", function(done) { - class TestComponent extends TestJSXComponent { - willUpdate() {} - } - TestComponent.PROPS = { - bar: {} - }; - TestComponent.STATE = { - foo: {} - }; - - component = new TestComponent(); - sinon.stub(component, "willUpdate"); - component.props.bar = "bar"; - component.state.foo = "foo"; - component.once("stateChanged", function() { - assert.strictEqual(1, component.willUpdate.callCount); - - const stateChanges = component.willUpdate.args[0][0]; - assert.ok(stateChanges.foo); - assert.strictEqual("foo", stateChanges.foo.newVal); - assert.strictEqual(undefined, stateChanges.foo.prevVal); - - const propChanges = component.willUpdate.args[0][1]; - assert.ok(propChanges.bar); - assert.strictEqual("bar", propChanges.bar.newVal); - assert.strictEqual(undefined, propChanges.bar.prevVal); - - done(); - }); - }); - - it("should reuse elements correctly when child skips update", function(done) { - class ChildComponent extends TestJSXComponent { - render() { - return Child; - } - - shouldUpdate() { - return false; - } - } - - class TestComponent extends TestJSXComponent { - render() { - return ( -
- - {this.state.foo} -
- ); - } - } - TestComponent.STATE = { - foo: {} - }; - - component = new TestComponent(); - var childNodes = component.element.childNodes; - assert.equal(2, childNodes.length); - - component.state.foo = "foo"; - component.once("stateChanged", function() { - assert.equal(2, component.element.childNodes.length); - assert.equal(childNodes[0], component.element.childNodes[0]); - assert.equal(childNodes[1], component.element.childNodes[1]); - assert.equal("foo", childNodes[1].textContent); - done(); - }); - }); - - it("should reuse component rendered after a conditionally rendered component", function( - done - ) { - class ChildComponent extends TestJSXComponent { - render() { - return Child; - } - } - - class ChildComponent2 extends ChildComponent {} - - class TestComponent extends TestJSXComponent { - render() { - return ( -
- {!this.props.hide && ( -
- -
- )} -
- -
-
- ); - } - } - TestComponent.PROPS = { - hide: {} - }; - - class ParentComponent extends TestJSXComponent { - render() { - return ( -
- -
- ); - } - } - - component = new ParentComponent(); - assert.strictEqual(4, createdComps.length); - assert.ok(createdComps[0] instanceof ParentComponent); - assert.ok(createdComps[1] instanceof TestComponent); - assert.ok(createdComps[2] instanceof ChildComponent); - assert.ok(createdComps[3] instanceof ChildComponent2); - assert.ok(!createdComps[0].isDisposed()); - assert.ok(!createdComps[1].isDisposed()); - assert.ok(!createdComps[2].isDisposed()); - assert.ok(!createdComps[3].isDisposed()); - - createdComps[1].props.hide = true; - createdComps[1].once("stateSynced", function() { - assert.strictEqual(4, createdComps.length); - assert.ok(!createdComps[0].isDisposed()); - assert.ok(!createdComps[1].isDisposed()); - assert.ok(createdComps[2].isDisposed()); - assert.ok(!createdComps[3].isDisposed()); - done(); - }); - }); - - it("should reuse elements with keys after moving around", function(done) { - class TestComponent extends TestJSXComponent { - render() { - return ( -
- - -
- ); - } - } - TestComponent.PROPS = { - switch: {} - }; - - component = new TestComponent(); - const firstChild = component.element.childNodes[0]; - const secondChild = component.element.childNodes[1]; - - component.props.switch = true; - component.once("stateSynced", function() { - assert.strictEqual(secondChild, component.element.childNodes[0]); - assert.strictEqual(firstChild, component.element.childNodes[1]); - done(); - }); - }); - - it("should reuse components with keys after moving around", function(done) { - const childComps = []; - class ChildComponent extends TestJSXComponent { - created() { - childComps.push(this); - } - render() { - return
Child{this.props.key}
; - } - } - - class TestComponent extends TestJSXComponent { - render() { - return ( -
- - -
- ); - } - } - TestComponent.PROPS = { - switch: {} - }; - - component = new TestComponent(); - assert.equal(2, childComps.length); - const firstChild = component.element.childNodes[0]; - const secondChild = component.element.childNodes[1]; - assert.equal(firstChild, childComps[0].element); - assert.equal(secondChild, childComps[1].element); - - component.props.switch = true; - component.once("stateSynced", function() { - assert.equal(secondChild, component.element.childNodes[0]); - assert.equal(firstChild, component.element.childNodes[1]); - assert.equal(2, childComps.length); - assert.equal(firstChild, childComps[0].element); - assert.equal(secondChild, childComps[1].element); - done(); - }); - }); - - it("should rerender sub component correctly after an update", function(done) { - class ChildComponent extends TestJSXComponent { - render() { - return
{this.props.foo}
; - } - } - ChildComponent.PROPS = { - foo: { - value: "initialFoo" - } - }; - - class TestComponent extends TestJSXComponent { - render() { - return ( -
-
Test
- -
- ); - } - } - - component = new TestComponent(); - - component.components.child.props.foo = "newFoo"; - component.components.child.once("stateSynced", function() { - assert.strictEqual("Test", component.element.childNodes[0].textContent); - assert.strictEqual("newFoo", component.element.childNodes[1].textContent); - done(); - }); - }); - - it("should reuse elements correctly after a child update", function(done) { - class ChildComponent extends TestJSXComponent { - render() { - return ( -
- {this.props.foo} -
- ); - } - } - ChildComponent.PROPS = { - foo: { - value: "initialFoo" - } - }; - - class TestComponent extends TestJSXComponent { - render() { - return ; - } - } - - component = new TestComponent(); - const child = component.refs.child; - var spanEl = child.element.childNodes[0]; - - component.refs.child.props.foo = "newFoo"; - component.refs.child.once("stateSynced", function() { - assert.strictEqual(spanEl, child.element.childNodes[0]); - done(); - }); - }); - - it("should reuse elements correctly after update from previously empty child", function( - done - ) { - let child; - class ChildComponent extends TestJSXComponent { - created() { - child = this; - } - - render() { - return this.state.first ? null :
Child
; - } - } - ChildComponent.STATE = { - first: { - value: true - } - }; - - class TestComponent extends TestJSXComponent { - render() { - return ( -
-
First child element
- -
- ); - } - } - - component = new TestComponent(); - const firstEl = component.element.childNodes[0]; - child.state.first = false; - child.once("stateSynced", function() { - assert.strictEqual(firstEl, component.element.childNodes[0]); - done(); - }); - }); +'use strict'; + +import dom from 'metal-dom'; +import Component from 'metal-component'; +import JSXRenderer from '../src/JSXRenderer'; +import JSXDataManager from '../src/JSXDataManager'; + +describe('JSXRenderer', function() { + let component; + let createdComps; + let TestJSXComponent; + + beforeEach(function() { + createdComps = []; + class TestJSXComponentCtor extends Component { + created() { + createdComps.push(this); + } + } + TestJSXComponentCtor.DATA_MANAGER = JSXDataManager; + TestJSXComponentCtor.RENDERER = JSXRenderer; + TestJSXComponent = TestJSXComponentCtor; + }); + + afterEach(function() { + if (component) { + component.dispose(); + } + }); + + it('should render returned contents from variable in "render" function', function() { + class TestComponent extends TestJSXComponent { + render() { + let jsx =
Hello World
; + return jsx; + } + } + + component = new TestComponent(); + assert.strictEqual('DIV', component.element.tagName); + assert.ok(dom.hasClass(component.element, 'test')); + assert.strictEqual('Hello World', component.element.textContent); + }); + + it('should be able to render a child without wrapper element', function() { + class ChildComponent extends TestJSXComponent { + render() { + return this.props.children[1]; + } + } + + class TestComponent extends TestJSXComponent { + render() { + return ( +
+ + Children Test + Children Test 2 + Children Test 3 + +
+ ); + } + } + + component = new TestComponent(); + let child = component.components.child; + assert.strictEqual('SPAN', child.element.tagName); + assert.strictEqual(1, child.element.childNodes.length); + assert.strictEqual('Children Test 2', child.element.textContent); + }); + + it('should reuse child empty component when it renders content for the first time', function( + done + ) { + class Wrapper extends TestJSXComponent { + render() { + return this.props.children; + } + } + + const childInstances = []; + class Child extends TestJSXComponent { + created() { + childInstances.push(this); + } + + render() { + return this.state.show ? Child : null; + } + } + Child.STATE = { + show: {}, + }; + + class TestComponent extends TestJSXComponent { + render() { + return ( + +
+ +
+
+ ); + } + } + + const element = document.createElement('div'); + dom.enterDocument(element); + component = new TestComponent({ + element, + }); + assert.strictEqual(1, childInstances.length); + const child = childInstances[0]; + + child.state.show = true; + child.once('stateSynced', function() { + assert.strictEqual(1, childInstances.length); + assert.ok(!child.isDisposed()); + assert.equal('Child', child.element.textContent); + assert.equal(child.element, component.element.childNodes[0]); + done(); + }); + }); + + it('should reuse child empty component when its parent makes it render content for the first time', function( + done + ) { + class Wrapper extends TestJSXComponent { + render() { + return this.props.children; + } + } + + const childInstances = []; + class Child extends TestJSXComponent { + created() { + childInstances.push(this); + } + + render() { + return this.props.show ? Child : null; + } + } + + class TestComponent extends TestJSXComponent { + render() { + return ( + +
+ +
+
+ ); + } + } + TestComponent.STATE = { + show: {}, + }; + + const element = document.createElement('div'); + dom.enterDocument(element); + component = new TestComponent({ + element, + }); + assert.strictEqual(1, childInstances.length); + const child = childInstances[0]; + + component.state.show = true; + component.once('stateSynced', function() { + assert.strictEqual(1, childInstances.length); + assert.ok(!child.isDisposed()); + assert.equal('Child', child.element.textContent); + assert.equal(child.element, component.element.childNodes[0]); + done(); + }); + }); + + it('should update if props change', function(done) { + class TestComponent extends TestJSXComponent { + render() { + return
{this.props.foo}
; + } + } + TestComponent.PROPS = { + foo: { + value: 'defaultFoo', + }, + }; + + component = new TestComponent(); + assert.strictEqual('defaultFoo', component.element.textContent); + + component.props.foo = 'foo'; + component.once('rendered', function() { + assert.strictEqual('foo', component.element.textContent); + done(); + }); + }); + + it('should update if state changes', function(done) { + class TestComponent extends TestJSXComponent { + render() { + return
{this.state.foo}
; + } + } + TestComponent.STATE = { + foo: { + value: 'defaultFoo', + }, + }; + + component = new TestComponent(); + assert.strictEqual('defaultFoo', component.element.textContent); + + component.state.foo = 'foo'; + component.once('rendered', function() { + assert.strictEqual('foo', component.element.textContent); + done(); + }); + }); + + it('should pass both state and prop changes to shouldUpdate', function(done) { + class TestComponent extends TestJSXComponent { + shouldUpdate() {} + } + TestComponent.PROPS = { + bar: {}, + }; + TestComponent.STATE = { + foo: {}, + }; + + component = new TestComponent(); + sinon.stub(component, 'shouldUpdate'); + component.props.bar = 'bar'; + component.state.foo = 'foo'; + component.once('stateChanged', function() { + assert.strictEqual(1, component.shouldUpdate.callCount); + + const stateChanges = component.shouldUpdate.args[0][0]; + assert.ok(stateChanges.foo); + assert.strictEqual('foo', stateChanges.foo.newVal); + assert.strictEqual(undefined, stateChanges.foo.prevVal); + + const propChanges = component.shouldUpdate.args[0][1]; + assert.ok(propChanges.bar); + assert.strictEqual('bar', propChanges.bar.newVal); + assert.strictEqual(undefined, propChanges.bar.prevVal); + + done(); + }); + }); + + it('should pass both state and prop changes to willUpdate', function(done) { + class TestComponent extends TestJSXComponent { + willUpdate() {} + } + TestComponent.PROPS = { + bar: {}, + }; + TestComponent.STATE = { + foo: {}, + }; + + component = new TestComponent(); + sinon.stub(component, 'willUpdate'); + component.props.bar = 'bar'; + component.state.foo = 'foo'; + component.once('stateChanged', function() { + assert.strictEqual(1, component.willUpdate.callCount); + + const stateChanges = component.willUpdate.args[0][0]; + assert.ok(stateChanges.foo); + assert.strictEqual('foo', stateChanges.foo.newVal); + assert.strictEqual(undefined, stateChanges.foo.prevVal); + + const propChanges = component.willUpdate.args[0][1]; + assert.ok(propChanges.bar); + assert.strictEqual('bar', propChanges.bar.newVal); + assert.strictEqual(undefined, propChanges.bar.prevVal); + + done(); + }); + }); + + it('should reuse elements correctly when child skips update', function(done) { + class ChildComponent extends TestJSXComponent { + render() { + return Child; + } + + shouldUpdate() { + return false; + } + } + + class TestComponent extends TestJSXComponent { + render() { + return ( +
+ + {this.state.foo} +
+ ); + } + } + TestComponent.STATE = { + foo: {}, + }; + + component = new TestComponent(); + let childNodes = component.element.childNodes; + assert.equal(2, childNodes.length); + + component.state.foo = 'foo'; + component.once('stateChanged', function() { + assert.equal(2, component.element.childNodes.length); + assert.equal(childNodes[0], component.element.childNodes[0]); + assert.equal(childNodes[1], component.element.childNodes[1]); + assert.equal('foo', childNodes[1].textContent); + done(); + }); + }); + + it('should reuse component rendered after a conditionally rendered component', function( + done + ) { + class ChildComponent extends TestJSXComponent { + render() { + return Child; + } + } + + class ChildComponent2 extends ChildComponent {} + + class TestComponent extends TestJSXComponent { + render() { + return ( +
+ {!this.props.hide && ( +
+ +
+ )} +
+ +
+
+ ); + } + } + TestComponent.PROPS = { + hide: {}, + }; + + class ParentComponent extends TestJSXComponent { + render() { + return ( +
+ +
+ ); + } + } + + component = new ParentComponent(); + assert.strictEqual(4, createdComps.length); + assert.ok(createdComps[0] instanceof ParentComponent); + assert.ok(createdComps[1] instanceof TestComponent); + assert.ok(createdComps[2] instanceof ChildComponent); + assert.ok(createdComps[3] instanceof ChildComponent2); + assert.ok(!createdComps[0].isDisposed()); + assert.ok(!createdComps[1].isDisposed()); + assert.ok(!createdComps[2].isDisposed()); + assert.ok(!createdComps[3].isDisposed()); + + createdComps[1].props.hide = true; + createdComps[1].once('stateSynced', function() { + assert.strictEqual(4, createdComps.length); + assert.ok(!createdComps[0].isDisposed()); + assert.ok(!createdComps[1].isDisposed()); + assert.ok(createdComps[2].isDisposed()); + assert.ok(!createdComps[3].isDisposed()); + done(); + }); + }); + + it('should reuse elements with keys after moving around', function(done) { + class TestComponent extends TestJSXComponent { + render() { + return ( +
+ + +
+ ); + } + } + TestComponent.PROPS = { + switch: {}, + }; + + component = new TestComponent(); + const firstChild = component.element.childNodes[0]; + const secondChild = component.element.childNodes[1]; + + component.props.switch = true; + component.once('stateSynced', function() { + assert.strictEqual(secondChild, component.element.childNodes[0]); + assert.strictEqual(firstChild, component.element.childNodes[1]); + done(); + }); + }); + + it('should reuse components with keys after moving around', function(done) { + const childComps = []; + class ChildComponent extends TestJSXComponent { + created() { + childComps.push(this); + } + render() { + return
Child{this.props.key}
; + } + } + + class TestComponent extends TestJSXComponent { + render() { + return ( +
+ + +
+ ); + } + } + TestComponent.PROPS = { + switch: {}, + }; + + component = new TestComponent(); + assert.equal(2, childComps.length); + const firstChild = component.element.childNodes[0]; + const secondChild = component.element.childNodes[1]; + assert.equal(firstChild, childComps[0].element); + assert.equal(secondChild, childComps[1].element); + + component.props.switch = true; + component.once('stateSynced', function() { + assert.equal(secondChild, component.element.childNodes[0]); + assert.equal(firstChild, component.element.childNodes[1]); + assert.equal(2, childComps.length); + assert.equal(firstChild, childComps[0].element); + assert.equal(secondChild, childComps[1].element); + done(); + }); + }); + + it('should rerender sub component correctly after an update', function(done) { + class ChildComponent extends TestJSXComponent { + render() { + return
{this.props.foo}
; + } + } + ChildComponent.PROPS = { + foo: { + value: 'initialFoo', + }, + }; + + class TestComponent extends TestJSXComponent { + render() { + return ( +
+
Test
+ +
+ ); + } + } + + component = new TestComponent(); + + component.components.child.props.foo = 'newFoo'; + component.components.child.once('stateSynced', function() { + assert.strictEqual('Test', component.element.childNodes[0].textContent); + assert.strictEqual('newFoo', component.element.childNodes[1].textContent); + done(); + }); + }); + + it('should reuse elements correctly after a child update', function(done) { + class ChildComponent extends TestJSXComponent { + render() { + return ( +
+ {this.props.foo} +
+ ); + } + } + ChildComponent.PROPS = { + foo: { + value: 'initialFoo', + }, + }; + + class TestComponent extends TestJSXComponent { + render() { + return ; + } + } + + component = new TestComponent(); + const child = component.refs.child; + let spanEl = child.element.childNodes[0]; + + component.refs.child.props.foo = 'newFoo'; + component.refs.child.once('stateSynced', function() { + assert.strictEqual(spanEl, child.element.childNodes[0]); + done(); + }); + }); + + it('should reuse elements correctly after update from previously empty child', function( + done + ) { + let child; + class ChildComponent extends TestJSXComponent { + created() { + child = this; + } + + render() { + return this.state.first ? null :
Child
; + } + } + ChildComponent.STATE = { + first: { + value: true, + }, + }; + + class TestComponent extends TestJSXComponent { + render() { + return ( +
+
First child element
+ +
+ ); + } + } + + component = new TestComponent(); + const firstEl = component.element.childNodes[0]; + child.state.first = false; + child.once('stateSynced', function() { + assert.strictEqual(firstEl, component.element.childNodes[0]); + done(); + }); + }); }); From c1f04114711ec015f29bd2e7ca9fa8c72e190018 Mon Sep 17 00:00:00 2001 From: Chema Balsas Date: Fri, 10 Nov 2017 00:01:08 -0800 Subject: [PATCH 11/70] Fixes lint errors in metal-soy package --- packages/metal-soy/.eslintrc | 6 ++++++ packages/metal-soy/.eslintrc.json | 8 -------- packages/metal-soy/src/Soy.js | 20 +++++++++++++------- packages/metal-soy/src/SoyAop.js | 20 +++++++------------- packages/metal-soy/test/.eslintrc | 11 +++++++++++ packages/metal-soy/test/.eslintrc.json | 9 --------- 6 files changed, 37 insertions(+), 37 deletions(-) create mode 100644 packages/metal-soy/.eslintrc delete mode 100644 packages/metal-soy/.eslintrc.json create mode 100644 packages/metal-soy/test/.eslintrc delete mode 100644 packages/metal-soy/test/.eslintrc.json diff --git a/packages/metal-soy/.eslintrc b/packages/metal-soy/.eslintrc new file mode 100644 index 00000000..4376a325 --- /dev/null +++ b/packages/metal-soy/.eslintrc @@ -0,0 +1,6 @@ +{ + "globals": { + "goog": true, + "IncrementalDOM": true + } +} \ No newline at end of file diff --git a/packages/metal-soy/.eslintrc.json b/packages/metal-soy/.eslintrc.json deleted file mode 100644 index bea5b805..00000000 --- a/packages/metal-soy/.eslintrc.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "globals": { - "goog": true, - "IncrementalDOM": true, - "soy": true, - "soydata": true - } -} diff --git a/packages/metal-soy/src/Soy.js b/packages/metal-soy/src/Soy.js index ca0c31ec..866e9b63 100644 --- a/packages/metal-soy/src/Soy.js +++ b/packages/metal-soy/src/Soy.js @@ -10,6 +10,9 @@ import SoyAop from './SoyAop'; // The injected data that will be passed to soy templates. let ijData = {}; +/** + * Soy Renderer + */ class Soy extends IncrementalDomRenderer.constructor { /** * Adds the template params to the component's state, if they don't exist yet. @@ -79,16 +82,16 @@ class Soy extends IncrementalDomRenderer.constructor { * @return {!function()} */ getTemplate(namespace, templateName) { - return function(opt_data, opt_ignored, opt_ijData) { + return function(data, ignored, ijData) { if (!goog.loadedModules_[namespace]) { throw new Error( `No template with namespace "${namespace}" has been loaded yet.` ); } return goog.loadedModules_[namespace][templateName]( - opt_data, - opt_ignored, - opt_ijData + data, + ignored, + ijData ); }; } @@ -102,10 +105,12 @@ class Soy extends IncrementalDomRenderer.constructor { * @param {Object} data The data the template was called with. * @protected */ - handleInterceptedCall_(originalFn, opt_data = {}) { + handleInterceptedCall_(originalFn, data = {}) { const args = [originalFn.componentCtor, null, []]; - for (let key in opt_data) { - args.push(key, opt_data[key]); + for (let key in data) { + if (Object.prototype.hasOwnProperty.call(data, key)) { + args.push(key, data[key]); + } } IncrementalDOM.elementVoid.apply(null, args); } @@ -115,6 +120,7 @@ class Soy extends IncrementalDomRenderer.constructor { * @param {!Component} component * @param {string} name * @protected + * @return {boolean} */ isHtmlParam_(component, name) { const state = component.getDataManager().getStateInstance(component); diff --git a/packages/metal-soy/src/SoyAop.js b/packages/metal-soy/src/SoyAop.js index 400f6fea..f3c516ec 100644 --- a/packages/metal-soy/src/SoyAop.js +++ b/packages/metal-soy/src/SoyAop.js @@ -25,24 +25,18 @@ const SoyAop = { * is set, or otherwise just calling the original function instead. * @param {!function()} originalFn The original template function that was * intercepted. - * @param {Object} opt_data Template data object. - * @param {*} opt_ignored - * @param {Object} opt_ijData Template injected data object. + * @param {Object=} data Template data object. + * @param {*=} ignored + * @param {Object=} ijData Template injected data object. * @return {*} The return value of the function that is called to handle this * interception. */ - handleTemplateCall_: function(originalFn, opt_data, opt_ignored, opt_ijData) { - const interceptFn = SoyAop.interceptFns_[SoyAop.interceptFns_.length - 1]; + handleTemplateCall_: function(originalFn, data, ignored, ijData) { + const interceptFn = SoyAop.interceptFns_[SoyAop.interceptFns_.length - 1]; // eslint-disable-line if (interceptFn) { - return interceptFn.call( - null, - originalFn, - opt_data, - opt_ignored, - opt_ijData - ); + return interceptFn.call(null, originalFn, data, ignored, ijData); } else { - return originalFn.call(null, opt_data, opt_ignored, opt_ijData); + return originalFn.call(null, data, ignored, ijData); } }, diff --git a/packages/metal-soy/test/.eslintrc b/packages/metal-soy/test/.eslintrc new file mode 100644 index 00000000..61f47403 --- /dev/null +++ b/packages/metal-soy/test/.eslintrc @@ -0,0 +1,11 @@ +{ + "globals": { + "assert": true, + "sinon": true + }, + "rules": { + "max-len": 0, + "no-invalid-this": 0, + "require-jsdoc": 0 + } +} \ No newline at end of file diff --git a/packages/metal-soy/test/.eslintrc.json b/packages/metal-soy/test/.eslintrc.json deleted file mode 100644 index 92b466f1..00000000 --- a/packages/metal-soy/test/.eslintrc.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "env": { - "mocha": true - }, - "globals": { - "assert": true, - "sinon": true - } -} From 308f3171deb07f2d057817c964aff7454cbc7dbe Mon Sep 17 00:00:00 2001 From: Chema Balsas Date: Fri, 10 Nov 2017 00:14:15 -0800 Subject: [PATCH 12/70] Fixes lint errors in metal-state package --- packages/metal-state/.eslintrc | 5 +++ packages/metal-state/src/Config.js | 4 +- packages/metal-state/src/State.js | 50 +++++++++++------------- packages/metal-state/src/validators.js | 31 ++++++++------- packages/metal-state/test/.eslintrc | 11 ++++++ packages/metal-state/test/.eslintrc.json | 9 ----- packages/metal-state/test/Config.js | 30 +++++++------- packages/metal-state/test/State.js | 4 +- 8 files changed, 75 insertions(+), 69 deletions(-) create mode 100644 packages/metal-state/.eslintrc create mode 100644 packages/metal-state/test/.eslintrc delete mode 100644 packages/metal-state/test/.eslintrc.json diff --git a/packages/metal-state/.eslintrc b/packages/metal-state/.eslintrc new file mode 100644 index 00000000..d4cadde2 --- /dev/null +++ b/packages/metal-state/.eslintrc @@ -0,0 +1,5 @@ +{ + "rules": { + "no-invalid-this": 0 + } +} \ No newline at end of file diff --git a/packages/metal-state/src/Config.js b/packages/metal-state/src/Config.js index 7e546c1e..2e460902 100644 --- a/packages/metal-state/src/Config.js +++ b/packages/metal-state/src/Config.js @@ -127,7 +127,7 @@ const Config = { /** * Adds the `internal` flag to the `State` configuration. - * @param {boolean} required Flag to set "internal" to. True by default. + * @param {boolean} internal Flag to set "internal" to. True by default. * @return {!Object} `State` configuration object. */ internal(internal = true) { @@ -244,7 +244,7 @@ function mergeConfig(context, config) { /** * Calls validators with provided argument. * @param {string} name The name of the validator. - * @param {!function()} + * @return {function()} */ function setExplicitValueValidators(name) { return function(arg) { diff --git a/packages/metal-state/src/State.js b/packages/metal-state/src/State.js index b8fe7384..795b8ce4 100644 --- a/packages/metal-state/src/State.js +++ b/packages/metal-state/src/State.js @@ -22,15 +22,15 @@ import {EventEmitter} from 'metal-events'; class State extends EventEmitter { /** * Constructor function for `State`. - * @param {Object=} opt_config Optional config object with initial values to + * @param {Object=} config Optional config object with initial values to * set state properties to. - * @param {Object=} opt_obj Optional object that should hold the state + * @param {Object=} obj Optional object that should hold the state * properties. If none is given, they will be added directly to `this` * instead. - * @param {Object=} opt_context Optional context to call functions (like + * @param {Object=} context Optional context to call functions (like * validators and setters) on. Defaults to `this`. */ - constructor(opt_config, opt_obj, opt_context) { + constructor(config, obj, context) { super(); /** @@ -38,7 +38,7 @@ class State extends EventEmitter { * @type {!Object} * @protected */ - this.context_ = opt_context || this; + this.context_ = context || this; /** * Map of keys that can not be used as state keys. @@ -52,7 +52,7 @@ class State extends EventEmitter { * @type {!Object} * @protected */ - this.obj_ = opt_obj || this; + this.obj_ = obj || this; this.eventData_ = null; @@ -73,7 +73,7 @@ class State extends EventEmitter { this.stateConfigs_ = {}; - this.initialValues_ = object.mixin({}, opt_config); + this.initialValues_ = object.mixin({}, config); this.setShouldUseFacade(true); this.configStateFromStaticHint_(); @@ -164,14 +164,14 @@ class State extends EventEmitter { * Calls the requested function, running the appropriate code for when it's * passed as an actual function object or just the function's name. * @param {!Function|string} fn Function, or name of the function to run. - * @param {!Array} An optional array of parameters to be passed to the + * @param {!Array} args optional array of parameters to be passed to the * function that will be called. * @return {*} The return value of the called function. * @protected */ callFunction_(fn, args) { if (isString(fn)) { - return this.context_[fn].apply(this.context_, args); + return this.context_[fn].apply(this.context_, args); // eslint-disable-line } else if (isFunction(fn)) { return fn.apply(this.context_, args); } @@ -250,24 +250,24 @@ class State extends EventEmitter { * first time. * @param {!Object.|string} configs An object that maps * configuration options for keys to be added to the state. - * @param {boolean|Object|*=} opt_context The context where the added state + * @param {boolean|Object|*=} context The context where the added state * keys will be defined (defaults to `this`), or false if they shouldn't * be defined at all. */ - configState(configs, opt_context) { + configState(configs, context) { const names = Object.keys(configs); if (names.length === 0) { return; } - if (opt_context !== false) { + if (context !== false) { const props = {}; for (let i = 0; i < names.length; i++) { const name = names[i]; this.assertValidStateKeyName_(name); props[name] = this.buildKeyPropertyDef_(name); } - Object.defineProperties(opt_context || this.obj_, props); + Object.defineProperties(context || this.obj_, props); } this.stateConfigs_ = configs; @@ -294,7 +294,7 @@ class State extends EventEmitter { ctor[staticKey] = ctor[staticKey] || {}; - defineContext = ctor[staticKey][ctor.name] ? false : ctor.prototype; + defineContext = ctor[staticKey][ctor.name] ? false : ctor.prototype; // eslint-disable-line ctor[staticKey][ctor.name] = true; } this.configState(State.getStateStatic(ctor), defineContext); @@ -340,13 +340,12 @@ class State extends EventEmitter { /** * Returns an object that maps state keys to their values. - * @param {Array=} opt_names A list of names of the keys that should + * @param {Array=} names A list of names of the keys that should * be returned. If none is given, the whole state will be returned. * @return {Object.} */ - getState(opt_names) { + getState(names = this.getStateKeys()) { const state = {}; - const names = opt_names || this.getStateKeys(); for (let i = 0; i < names.length; i++) { state[names[i]] = this.get(names[i]); @@ -418,7 +417,7 @@ class State extends EventEmitter { hasBeenSet(name) { const info = this.getStateInfo(name); return ( - info.state === State.KeyStates.INITIALIZED || this.hasInitialValue_(name) + info.state === State.KeyStates.INITIALIZED || this.hasInitialValue_(name) // eslint-disable-line ); } @@ -541,7 +540,6 @@ class State extends EventEmitter { * actually needed. * @param {string} name * @param {*} value - * @return {*} */ set(name, value) { if (this.hasStateKey(name)) { @@ -552,7 +550,6 @@ class State extends EventEmitter { /** * Sets the default value of the requested state key. * @param {string} name The name of the key. - * @return {*} */ setDefaultValue(name) { const config = this.stateConfigs_[name]; @@ -566,7 +563,7 @@ class State extends EventEmitter { /** * Sets data to be sent with all events emitted from this instance. - * @param {Object} + * @param {Object} data */ setEventData(data) { this.eventData_ = data; @@ -575,7 +572,6 @@ class State extends EventEmitter { /** * Sets the initial value of the requested state key. * @param {string} name The name of the key. - * @return {*} * @protected */ setInitialValue_(name) { @@ -587,7 +583,7 @@ class State extends EventEmitter { /** * Sets a map of keys that are not valid state keys. - * @param {!Object} + * @param {!Object} blacklist */ setKeysBlacklist(blacklist) { this.keysBlacklist_ = blacklist; @@ -597,13 +593,13 @@ class State extends EventEmitter { * Sets the value of all the specified state keys. * @param {!Object.} values A map of state keys to the values they * should be set to. - * @param {function()=} opt_callback An optional function that will be run + * @param {function()=} callback An optional function that will be run * after the next batched update is triggered. */ - setState(values, opt_callback) { + setState(values, callback) { Object.keys(values).forEach(name => this.set(name, values[name])); - if (opt_callback && this.scheduledBatchData_) { - this.context_.once('stateChanged', opt_callback); + if (callback && this.scheduledBatchData_) { + this.context_.once('stateChanged', callback); } } diff --git a/packages/metal-state/src/validators.js b/packages/metal-state/src/validators.js index a6307583..677ea57a 100644 --- a/packages/metal-state/src/validators.js +++ b/packages/metal-state/src/validators.js @@ -84,7 +84,7 @@ const validators = { return result; } return arrayOfValues.indexOf(value) === -1 - ? composeError(composeOneOfErrorMessage(arrayOfValues), name, context) + ? composeError(composeOneOfErrorMessage(arrayOfValues), name, context) // eslint-disable-line : true; }); }, @@ -98,12 +98,13 @@ const validators = { */ oneOfType: function(arrayOfTypeValidators) { return maybe((value, name, context) => { - const result = validators.array(arrayOfTypeValidators, name, context); + const result = validators.array(arrayOfTypeValidators, name, context); // eslint-disable-line if (isInvalid(result)) { return result; } for (let i = 0; i < arrayOfTypeValidators.length; i++) { + // eslint-disable-next-line if (!isInvalid(arrayOfTypeValidators[i](value, name, context))) { return true; } @@ -126,17 +127,19 @@ const validators = { } for (let key in shape) { - let validator = shape[key]; - let required = false; - if (validator.config) { - required = validator.config.required; - validator = validator.config.validator; - } - if ( - (required && !isDefAndNotNull(value[key])) || - isInvalid(validator(value[key])) - ) { - return composeError(ERROR_SHAPE_OF, name, context); + if (Object.prototype.hasOwnProperty.call(shape, key)) { + let validator = shape[key]; + let required = false; + if (validator.config) { + required = validator.config.required; + validator = validator.config.validator; + } + if ( + (required && !isDefAndNotNull(value[key])) || + isInvalid(validator(value[key])) + ) { + return composeError(ERROR_SHAPE_OF, name, context); + } } } return true; @@ -222,7 +225,7 @@ function isInvalid(result) { */ function maybe(typeValidator) { return (value, name, context) => { - return isDefAndNotNull(value) ? typeValidator(value, name, context) : true; + return isDefAndNotNull(value) ? typeValidator(value, name, context) : true; // eslint-disable-line }; } diff --git a/packages/metal-state/test/.eslintrc b/packages/metal-state/test/.eslintrc new file mode 100644 index 00000000..61f47403 --- /dev/null +++ b/packages/metal-state/test/.eslintrc @@ -0,0 +1,11 @@ +{ + "globals": { + "assert": true, + "sinon": true + }, + "rules": { + "max-len": 0, + "no-invalid-this": 0, + "require-jsdoc": 0 + } +} \ No newline at end of file diff --git a/packages/metal-state/test/.eslintrc.json b/packages/metal-state/test/.eslintrc.json deleted file mode 100644 index 92b466f1..00000000 --- a/packages/metal-state/test/.eslintrc.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "env": { - "mocha": true - }, - "globals": { - "assert": true, - "sinon": true - } -} diff --git a/packages/metal-state/test/Config.js b/packages/metal-state/test/Config.js index 8186f8db..3e3dcea0 100644 --- a/packages/metal-state/test/Config.js +++ b/packages/metal-state/test/Config.js @@ -195,21 +195,21 @@ describe('Config', function() { }); it('should return config with "oneOf" validator from "validators"', function() { - var config = Config.oneOf([1, 'one']); - assert.ok(core.isObject(config)); - assert.ok(core.isFunction(config.config.validator)); - assert.ok(config.config.validator(1)); - assert.ok(config.config.validator('one')); - assert.ok(config.config.validator(2) instanceof Error); - assert.ok(config.config.validator(false) instanceof Error); - - var config = Config.oneOf([1, 'one']).required(); - assert.ok(core.isObject(config)); - assert.ok(core.isFunction(config.config.validator)); - assert.ok(config.config.validator(1)); - assert.ok(config.config.validator('one')); - assert.ok(config.config.validator(2) instanceof Error); - assert.ok(config.config.validator(false) instanceof Error); + const config1 = Config.oneOf([1, 'one']); + assert.ok(core.isObject(config1)); + assert.ok(core.isFunction(config1.config.validator)); + assert.ok(config1.config.validator(1)); + assert.ok(config1.config.validator('one')); + assert.ok(config1.config.validator(2) instanceof Error); + assert.ok(config1.config.validator(false) instanceof Error); + + const config2 = Config.oneOf([1, 'one']).required(); + assert.ok(core.isObject(config2)); + assert.ok(core.isFunction(config2.config.validator)); + assert.ok(config2.config.validator(1)); + assert.ok(config2.config.validator('one')); + assert.ok(config2.config.validator(2) instanceof Error); + assert.ok(config2.config.validator(false) instanceof Error); }); it('should return config with "oneOfType" validator from "validators"', function() { diff --git a/packages/metal-state/test/State.js b/packages/metal-state/test/State.js index 3216fdfd..1ff6eb43 100644 --- a/packages/metal-state/test/State.js +++ b/packages/metal-state/test/State.js @@ -763,11 +763,11 @@ describe('State', function() { ) { let state = createStateInstance(); - state.on('stateWillChange', function(data) { + state.on('stateWillChange', function() { state.key2 = 20; }); - state.on('stateChanged', function(data, facade) { + state.on('stateChanged', function(data) { assert.strictEqual(1, data.changes.key1.prevVal); assert.strictEqual(10, data.changes.key1.newVal); assert.strictEqual(2, data.changes.key2.prevVal); From 45172ed0a4b03fb8c76e6fc0e5a510d15af4bc40 Mon Sep 17 00:00:00 2001 From: Chema Balsas Date: Fri, 10 Nov 2017 00:16:29 -0800 Subject: [PATCH 13/70] Fixes lint errors in metal-web-component package --- .../metal-web-component/src/define_web_component.js | 1 + packages/metal-web-component/test/.eslintrc | 13 +++++++++++++ packages/metal-web-component/test/.eslintrc.json | 10 ---------- .../metal-web-component/webcomponents_polyfill.js | 4 ++-- 4 files changed, 16 insertions(+), 12 deletions(-) create mode 100644 packages/metal-web-component/test/.eslintrc delete mode 100644 packages/metal-web-component/test/.eslintrc.json diff --git a/packages/metal-web-component/src/define_web_component.js b/packages/metal-web-component/src/define_web_component.js index 1aae7e91..93bf10c3 100644 --- a/packages/metal-web-component/src/define_web_component.js +++ b/packages/metal-web-component/src/define_web_component.js @@ -96,6 +96,7 @@ export function defineWebComponent(tagName, Ctor) { * * @memberof CustomElement * @param {?} value attribute value that should be parsed. + * @return {Object} */ deserializeValue_: function(value) { let retVal; diff --git a/packages/metal-web-component/test/.eslintrc b/packages/metal-web-component/test/.eslintrc new file mode 100644 index 00000000..075c2903 --- /dev/null +++ b/packages/metal-web-component/test/.eslintrc @@ -0,0 +1,13 @@ +{ + "globals": { + "assert": true, + "before": true, + "IncrementalDOM": true, + "sinon": true + }, + "rules": { + "max-len": 0, + "no-invalid-this": 0, + "require-jsdoc": 0 + } +} \ No newline at end of file diff --git a/packages/metal-web-component/test/.eslintrc.json b/packages/metal-web-component/test/.eslintrc.json deleted file mode 100644 index f361917d..00000000 --- a/packages/metal-web-component/test/.eslintrc.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "env": { - "mocha": true - }, - "globals": { - "assert": true, - "sinon": true, - "IncrementalDOM": true - } -} diff --git a/packages/metal-web-component/webcomponents_polyfill.js b/packages/metal-web-component/webcomponents_polyfill.js index bd913f72..6ab5a83d 100644 --- a/packages/metal-web-component/webcomponents_polyfill.js +++ b/packages/metal-web-component/webcomponents_polyfill.js @@ -1,9 +1,9 @@ if (window.navigator.userAgent.indexOf('MSIE') === -1) { - var script = document.createElement('script'); + const script = document.createElement('script'); script.crossOrigin = 'anonymous'; script.src = '/base/packages/metal-web-component/node_modules/@webcomponents/webcomponentsjs/webcomponents-lite.js'; script.type = 'text/javascript'; document.body.appendChild(script); -} \ No newline at end of file +} From 665fd671de44940d4bbd9be0a7eeabc1cec8e0aa Mon Sep 17 00:00:00 2001 From: Chema Balsas Date: Fri, 10 Nov 2017 00:18:38 -0800 Subject: [PATCH 14/70] Adds checkFormat and lint to the CI --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index c2b92efa..88da49f8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,5 +19,7 @@ jdk: language: java script: + - npm run checkFormat + - npm run lint - gulp test:saucelabs - npm run test:isomorphic From f6446e45f45a53d82a3d6e2300526b409d618c1c Mon Sep 17 00:00:00 2001 From: Chema Balsas Date: Fri, 10 Nov 2017 00:20:55 -0800 Subject: [PATCH 15/70] Adds lint-staged configuration --- package-lock.json | 583 ++++++++++++++++++++++++++++++++++++++++++++++ package.json | 9 + 2 files changed, 592 insertions(+) diff --git a/package-lock.json b/package-lock.json index eed48dd9..b0a28255 100644 --- a/package-lock.json +++ b/package-lock.json @@ -141,6 +141,12 @@ "normalize-path": "2.1.1" } }, + "app-root-path": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/app-root-path/-/app-root-path-2.0.1.tgz", + "integrity": "sha1-zWLc+OT9WkF+/GZNLlsQZTxlG0Y=", + "dev": true + }, "aproba": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz", @@ -1553,6 +1559,50 @@ "restore-cursor": "2.0.0" } }, + "cli-spinners": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-0.1.2.tgz", + "integrity": "sha1-u3ZNiOGF+54eaiofGXcjGPYF4xw=", + "dev": true + }, + "cli-truncate": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/cli-truncate/-/cli-truncate-0.2.1.tgz", + "integrity": "sha1-nxXPuwcFAFNpIWxiasfQWrkN1XQ=", + "dev": true, + "requires": { + "slice-ansi": "0.0.4", + "string-width": "1.0.2" + }, + "dependencies": { + "is-fullwidth-code-point": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", + "dev": true, + "requires": { + "number-is-nan": "1.0.1" + } + }, + "slice-ansi": { + "version": "0.0.4", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-0.0.4.tgz", + "integrity": "sha1-7b+JA/ZvfOL46v1s7tZeJkyDGzU=", + "dev": true + }, + "string-width": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "dev": true, + "requires": { + "code-point-at": "1.1.0", + "is-fullwidth-code-point": "1.0.0", + "strip-ansi": "3.0.1" + } + } + } + }, "cli-width": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-2.2.0.tgz", @@ -2069,6 +2119,30 @@ "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", "dev": true }, + "cosmiconfig": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-1.1.0.tgz", + "integrity": "sha1-DeoPmATv37kp+7GxiOJVU+oFPTc=", + "dev": true, + "requires": { + "graceful-fs": "4.1.11", + "js-yaml": "3.10.0", + "minimist": "1.2.0", + "object-assign": "4.1.1", + "os-homedir": "1.0.2", + "parse-json": "2.2.0", + "pinkie-promise": "2.0.1", + "require-from-string": "1.2.1" + }, + "dependencies": { + "minimist": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", + "dev": true + } + } + }, "create-ecdh": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/create-ecdh/-/create-ecdh-4.0.0.tgz", @@ -2221,6 +2295,12 @@ "assert-plus": "1.0.0" } }, + "date-fns": { + "version": "1.29.0", + "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-1.29.0.tgz", + "integrity": "sha512-lbTXWZ6M20cWH8N9S6afb0SBm6tMk+uUg6z3MqHPKE9atmsY3kJkTm8vKe93izJ2B2+q5MV990sM2CHgtAZaOw==", + "dev": true + }, "date-now": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/date-now/-/date-now-0.1.4.tgz", @@ -2529,6 +2609,12 @@ "integrity": "sha1-eOy4o5kGYYe7N07t412ccFZagD0=", "dev": true }, + "elegant-spinner": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/elegant-spinner/-/elegant-spinner-1.0.1.tgz", + "integrity": "sha1-2wQ1IcldfjA/2PNFvtwzSc+wcp4=", + "dev": true + }, "elliptic": { "version": "6.4.0", "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.4.0.tgz", @@ -4753,6 +4839,12 @@ "integrity": "sha1-9wLmMSfn4jHBYKgMFVSstw1QR+U=", "dev": true }, + "get-own-enumerable-property-symbols": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/get-own-enumerable-property-symbols/-/get-own-enumerable-property-symbols-2.0.1.tgz", + "integrity": "sha512-TtY/sbOemiMKPRUDDanGCSgBYe7Mf0vbRsWnBZ+9yghpZ1MvcpSpuZFjHdEeY/LZjZy0vdLjS77L6HosisFiug==", + "dev": true + }, "get-pkg-repo": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/get-pkg-repo/-/get-pkg-repo-1.4.0.tgz", @@ -12791,6 +12883,31 @@ "integrity": "sha1-P5E2XKvmC3ftDruiS0VOPgnZWoI=", "dev": true }, + "husky": { + "version": "0.14.3", + "resolved": "https://registry.npmjs.org/husky/-/husky-0.14.3.tgz", + "integrity": "sha512-e21wivqHpstpoiWA/Yi8eFti8E+sQDSS53cpJsPptPs295QTOQR0ZwnHo2TXy1XOpZFD9rPOd3NpmqTK6uMLJA==", + "dev": true, + "requires": { + "is-ci": "1.0.10", + "normalize-path": "1.0.0", + "strip-indent": "2.0.0" + }, + "dependencies": { + "normalize-path": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-1.0.0.tgz", + "integrity": "sha1-MtDkcvkf80VwHBWoMRAY07CpA3k=", + "dev": true + }, + "strip-indent": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-2.0.0.tgz", + "integrity": "sha1-XvjbKV0B5u1sv3qrlpmNeCJSe2g=", + "dev": true + } + } + }, "iconv-lite": { "version": "0.4.19", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.19.tgz", @@ -13191,6 +13308,12 @@ "has": "1.0.1" } }, + "is-regexp": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-regexp/-/is-regexp-1.0.0.tgz", + "integrity": "sha1-/S2INUXEa6xaYz57mgnof6LLUGk=", + "dev": true + }, "is-relative": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/is-relative/-/is-relative-0.2.1.tgz", @@ -13466,6 +13589,71 @@ } } }, + "jest-get-type": { + "version": "21.2.0", + "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-21.2.0.tgz", + "integrity": "sha512-y2fFw3C+D0yjNSDp7ab1kcd6NUYfy3waPTlD8yWkAtiocJdBRQqNoRqVfMNxgj+IjT0V5cBIHJO0z9vuSSZ43Q==", + "dev": true + }, + "jest-validate": { + "version": "21.2.1", + "resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-21.2.1.tgz", + "integrity": "sha512-k4HLI1rZQjlU+EC682RlQ6oZvLrE5SCh3brseQc24vbZTxzT/k/3urar5QMCVgjadmSO7lECeGdc6YxnM3yEGg==", + "dev": true, + "requires": { + "chalk": "2.3.0", + "jest-get-type": "21.2.0", + "leven": "2.1.0", + "pretty-format": "21.2.1" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "ansi-styles": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", + "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", + "dev": true, + "requires": { + "color-convert": "1.9.1" + } + }, + "chalk": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.0.tgz", + "integrity": "sha512-Az5zJR2CBujap2rqXGaJKaPHyJ0IrUimvYNX+ncCy8PJP4ltOGTrHUIo097ZaL2zMeKYpiCdqDvS6zdrTFok3Q==", + "dev": true, + "requires": { + "ansi-styles": "3.2.0", + "escape-string-regexp": "1.0.5", + "supports-color": "4.5.0" + } + }, + "pretty-format": { + "version": "21.2.1", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-21.2.1.tgz", + "integrity": "sha512-ZdWPGYAnYfcVP8yKA3zFjCn8s4/17TeYH28MXuC8vTp0o21eXjbFGcOAXZEaDaOFJjc3h2qa7HQNHNshhvoh2A==", + "dev": true, + "requires": { + "ansi-regex": "3.0.0", + "ansi-styles": "3.2.0" + } + }, + "supports-color": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz", + "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=", + "dev": true, + "requires": { + "has-flag": "2.0.0" + } + } + } + }, "js-base64": { "version": "2.3.2", "resolved": "https://registry.npmjs.org/js-base64/-/js-base64-2.3.2.tgz", @@ -14059,6 +14247,12 @@ } } }, + "leven": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/leven/-/leven-2.1.0.tgz", + "integrity": "sha1-wuep93IJTe6dNCAq6KzORoeHVYA=", + "dev": true + }, "levn": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", @@ -14095,6 +14289,218 @@ "resolve": "1.5.0" } }, + "lint-staged": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-4.3.0.tgz", + "integrity": "sha512-C/Zxslg0VRbsxwmCu977iIs+QyrmW2cyRCPUV5NDFYOH/jtRFHH8ch7ua2fH0voI/nVC3Tpg7DykfgMZySliKw==", + "dev": true, + "requires": { + "app-root-path": "2.0.1", + "chalk": "2.3.0", + "commander": "2.11.0", + "cosmiconfig": "1.1.0", + "execa": "0.8.0", + "is-glob": "4.0.0", + "jest-validate": "21.2.1", + "listr": "0.12.0", + "lodash": "4.17.4", + "log-symbols": "2.1.0", + "minimatch": "3.0.4", + "npm-which": "3.0.1", + "p-map": "1.2.0", + "staged-git-files": "0.0.4", + "stringify-object": "3.2.1" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", + "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", + "dev": true, + "requires": { + "color-convert": "1.9.1" + } + }, + "chalk": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.0.tgz", + "integrity": "sha512-Az5zJR2CBujap2rqXGaJKaPHyJ0IrUimvYNX+ncCy8PJP4ltOGTrHUIo097ZaL2zMeKYpiCdqDvS6zdrTFok3Q==", + "dev": true, + "requires": { + "ansi-styles": "3.2.0", + "escape-string-regexp": "1.0.5", + "supports-color": "4.5.0" + } + }, + "is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", + "dev": true + }, + "is-glob": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.0.tgz", + "integrity": "sha1-lSHHaEXMJhCoUgPd8ICpWML/q8A=", + "dev": true, + "requires": { + "is-extglob": "2.1.1" + } + }, + "supports-color": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz", + "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=", + "dev": true, + "requires": { + "has-flag": "2.0.0" + } + } + } + }, + "listr": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/listr/-/listr-0.12.0.tgz", + "integrity": "sha1-a84sD1YD+klYDqF81qAMwOX6RRo=", + "dev": true, + "requires": { + "chalk": "1.1.3", + "cli-truncate": "0.2.1", + "figures": "1.7.0", + "indent-string": "2.1.0", + "is-promise": "2.1.0", + "is-stream": "1.1.0", + "listr-silent-renderer": "1.1.1", + "listr-update-renderer": "0.2.0", + "listr-verbose-renderer": "0.4.1", + "log-symbols": "1.0.2", + "log-update": "1.0.2", + "ora": "0.2.3", + "p-map": "1.2.0", + "rxjs": "5.5.2", + "stream-to-observable": "0.1.0", + "strip-ansi": "3.0.1" + }, + "dependencies": { + "figures": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/figures/-/figures-1.7.0.tgz", + "integrity": "sha1-y+Hjr/zxzUS4DK3+0o3Hk6lwHS4=", + "dev": true, + "requires": { + "escape-string-regexp": "1.0.5", + "object-assign": "4.1.1" + } + }, + "log-symbols": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-1.0.2.tgz", + "integrity": "sha1-N2/3tY6jCGoPCfrMdGF+ylAeGhg=", + "dev": true, + "requires": { + "chalk": "1.1.3" + } + } + } + }, + "listr-silent-renderer": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/listr-silent-renderer/-/listr-silent-renderer-1.1.1.tgz", + "integrity": "sha1-kktaN1cVN3C/Go4/v3S4u/P5JC4=", + "dev": true + }, + "listr-update-renderer": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/listr-update-renderer/-/listr-update-renderer-0.2.0.tgz", + "integrity": "sha1-yoDhd5tOcCZoB+ju0a1qvjmFUPk=", + "dev": true, + "requires": { + "chalk": "1.1.3", + "cli-truncate": "0.2.1", + "elegant-spinner": "1.0.1", + "figures": "1.7.0", + "indent-string": "3.2.0", + "log-symbols": "1.0.2", + "log-update": "1.0.2", + "strip-ansi": "3.0.1" + }, + "dependencies": { + "figures": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/figures/-/figures-1.7.0.tgz", + "integrity": "sha1-y+Hjr/zxzUS4DK3+0o3Hk6lwHS4=", + "dev": true, + "requires": { + "escape-string-regexp": "1.0.5", + "object-assign": "4.1.1" + } + }, + "indent-string": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-3.2.0.tgz", + "integrity": "sha1-Sl/W0nzDMvN+VBmlBNu4NxBckok=", + "dev": true + }, + "log-symbols": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-1.0.2.tgz", + "integrity": "sha1-N2/3tY6jCGoPCfrMdGF+ylAeGhg=", + "dev": true, + "requires": { + "chalk": "1.1.3" + } + } + } + }, + "listr-verbose-renderer": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/listr-verbose-renderer/-/listr-verbose-renderer-0.4.1.tgz", + "integrity": "sha1-ggb0z21S3cWCfl/RSYng6WWTOjU=", + "dev": true, + "requires": { + "chalk": "1.1.3", + "cli-cursor": "1.0.2", + "date-fns": "1.29.0", + "figures": "1.7.0" + }, + "dependencies": { + "cli-cursor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-1.0.2.tgz", + "integrity": "sha1-ZNo/fValRBLll5S9Ytw1KV6PKYc=", + "dev": true, + "requires": { + "restore-cursor": "1.0.1" + } + }, + "figures": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/figures/-/figures-1.7.0.tgz", + "integrity": "sha1-y+Hjr/zxzUS4DK3+0o3Hk6lwHS4=", + "dev": true, + "requires": { + "escape-string-regexp": "1.0.5", + "object-assign": "4.1.1" + } + }, + "onetime": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-1.1.0.tgz", + "integrity": "sha1-ofeDj4MUxRbwXs78vEzP4EtO14k=", + "dev": true + }, + "restore-cursor": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-1.0.1.tgz", + "integrity": "sha1-NGYfRohjJ/7SmRR5FSJS35LapUE=", + "dev": true, + "requires": { + "exit-hook": "1.1.1", + "onetime": "1.1.0" + } + } + } + }, "load-json-file": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", @@ -14299,6 +14705,89 @@ "integrity": "sha1-vyJJiGzlFM2hEvrpIYzcBlIR/Jw=", "dev": true }, + "log-symbols": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-2.1.0.tgz", + "integrity": "sha512-zLeLrzMA1A2vRF1e/0Mo+LNINzi6jzBylHj5WqvQ/WK/5WCZt8si9SyN4p9llr/HRYvVR1AoXHRHl4WTHyQAzQ==", + "dev": true, + "requires": { + "chalk": "2.3.0" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", + "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", + "dev": true, + "requires": { + "color-convert": "1.9.1" + } + }, + "chalk": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.0.tgz", + "integrity": "sha512-Az5zJR2CBujap2rqXGaJKaPHyJ0IrUimvYNX+ncCy8PJP4ltOGTrHUIo097ZaL2zMeKYpiCdqDvS6zdrTFok3Q==", + "dev": true, + "requires": { + "ansi-styles": "3.2.0", + "escape-string-regexp": "1.0.5", + "supports-color": "4.5.0" + } + }, + "supports-color": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz", + "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=", + "dev": true, + "requires": { + "has-flag": "2.0.0" + } + } + } + }, + "log-update": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/log-update/-/log-update-1.0.2.tgz", + "integrity": "sha1-GZKfZMQJPS0ucHWh2tivWcKWuNE=", + "dev": true, + "requires": { + "ansi-escapes": "1.4.0", + "cli-cursor": "1.0.2" + }, + "dependencies": { + "ansi-escapes": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-1.4.0.tgz", + "integrity": "sha1-06ioOzGapneTZisT52HHkRQiMG4=", + "dev": true + }, + "cli-cursor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-1.0.2.tgz", + "integrity": "sha1-ZNo/fValRBLll5S9Ytw1KV6PKYc=", + "dev": true, + "requires": { + "restore-cursor": "1.0.1" + } + }, + "onetime": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-1.1.0.tgz", + "integrity": "sha1-ofeDj4MUxRbwXs78vEzP4EtO14k=", + "dev": true + }, + "restore-cursor": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-1.0.1.tgz", + "integrity": "sha1-NGYfRohjJ/7SmRR5FSJS35LapUE=", + "dev": true, + "requires": { + "exit-hook": "1.1.1", + "onetime": "1.1.0" + } + } + } + }, "log4js": { "version": "0.6.38", "resolved": "https://registry.npmjs.org/log4js/-/log4js-0.6.38.tgz", @@ -15086,6 +15575,15 @@ "integrity": "sha1-LRDAa9/TEuqXd2laTShDlFa3WUI=", "dev": true }, + "npm-path": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/npm-path/-/npm-path-2.0.3.tgz", + "integrity": "sha1-Fc/04ciaONp39W9gVbJPl137K74=", + "dev": true, + "requires": { + "which": "1.3.0" + } + }, "npm-run-path": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", @@ -15095,6 +15593,17 @@ "path-key": "2.0.1" } }, + "npm-which": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/npm-which/-/npm-which-3.0.1.tgz", + "integrity": "sha1-kiXybsOihcIJyuZ8OxGmtKtxQKo=", + "dev": true, + "requires": { + "commander": "2.11.0", + "npm-path": "2.0.3", + "which": "1.3.0" + } + }, "npmlog": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-4.1.2.tgz", @@ -15276,6 +15785,45 @@ "integrity": "sha1-7CLTEoBrtT5zF3Pnza788cZDEo8=", "dev": true }, + "ora": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/ora/-/ora-0.2.3.tgz", + "integrity": "sha1-N1J9Igrc1Tw5tzVx11QVbV22V6Q=", + "dev": true, + "requires": { + "chalk": "1.1.3", + "cli-cursor": "1.0.2", + "cli-spinners": "0.1.2", + "object-assign": "4.1.1" + }, + "dependencies": { + "cli-cursor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-1.0.2.tgz", + "integrity": "sha1-ZNo/fValRBLll5S9Ytw1KV6PKYc=", + "dev": true, + "requires": { + "restore-cursor": "1.0.1" + } + }, + "onetime": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-1.1.0.tgz", + "integrity": "sha1-ofeDj4MUxRbwXs78vEzP4EtO14k=", + "dev": true + }, + "restore-cursor": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-1.0.1.tgz", + "integrity": "sha1-NGYfRohjJ/7SmRR5FSJS35LapUE=", + "dev": true, + "requires": { + "exit-hook": "1.1.1", + "onetime": "1.1.0" + } + } + } + }, "orchestrator": { "version": "0.3.8", "resolved": "https://registry.npmjs.org/orchestrator/-/orchestrator-0.3.8.tgz", @@ -15375,6 +15923,12 @@ "p-limit": "1.1.0" } }, + "p-map": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/p-map/-/p-map-1.2.0.tgz", + "integrity": "sha512-r6zKACMNhjPJMTl8KcFH4li//gkrXWfbD6feV8l6doRHlzljFWGJ2AP6iKaCJXyZmAUMOPtvbW7EXkbWO/pLEA==", + "dev": true + }, "package-json": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/package-json/-/package-json-4.0.1.tgz", @@ -16339,6 +16893,12 @@ "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", "dev": true }, + "require-from-string": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-1.2.1.tgz", + "integrity": "sha1-UpyczvJzgK3+yaL5ZbZJu+5jZBg=", + "dev": true + }, "require-main-filename": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-1.0.1.tgz", @@ -16873,6 +17433,12 @@ "tweetnacl": "0.14.5" } }, + "staged-git-files": { + "version": "0.0.4", + "resolved": "https://registry.npmjs.org/staged-git-files/-/staged-git-files-0.0.4.tgz", + "integrity": "sha1-15fhtVHKemOd7AI33G60u5vhfTU=", + "dev": true + }, "statuses": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", @@ -16944,6 +17510,12 @@ "readable-stream": "2.3.3" } }, + "stream-to-observable": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/stream-to-observable/-/stream-to-observable-0.1.0.tgz", + "integrity": "sha1-Rb8dny19wJvtgfHDB8Qw5ouEz/4=", + "dev": true + }, "string-width": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", @@ -16977,6 +17549,17 @@ "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=", "dev": true }, + "stringify-object": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/stringify-object/-/stringify-object-3.2.1.tgz", + "integrity": "sha512-jPcQYw/52HUPP8uOE4kkjxl5bB9LfHkKCTptIk3qw7ozP5XMIMlHMLjt00GGSwW6DJAf/njY5EU6Vpwl4LlBKQ==", + "dev": true, + "requires": { + "get-own-enumerable-property-symbols": "2.0.1", + "is-obj": "1.0.1", + "is-regexp": "1.0.0" + } + }, "stringstream": { "version": "0.0.5", "resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz", diff --git a/package.json b/package.json index 772dbb9d..4f78400d 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,7 @@ "format": "npm run prettier -- --write", "lerna": "lerna bootstrap -- --no-optional && npm install --no-optional", "lint": "eslint 'packages/metal*/{src,test}/**/*.js'", + "precommit": "lint-staged", "prettier": "prettier-eslint 'packages/metal*/{src,test}/**/*.js'", "test": "gulp test && npm run test:isomorphic", "test:coverage": "gulp test:coverage", @@ -28,6 +29,7 @@ "gulp-babel": "^6.1.2", "gulp-metal": "^1.0.0", "gulp-replace": "^0.5.4", + "husky": "^0.14.3", "jsdom": "^9.9.1", "jsdom-global": "^2.1.1", "karma": "^1.1.0", @@ -39,6 +41,7 @@ "karma-sinon": "^1.0.5", "karma-source-map-support": "^1.1.0", "lerna": "^2.2.0", + "lint-staged": "^4.3.0", "metal-tools-soy": "^2.4.0", "metal-useragent": "^2.1.2", "mocha": "^2.5.3", @@ -46,6 +49,12 @@ "sinon": "^1.17.4", "watchify": "^3.7.0" }, + "lint-staged": { + "*.js": [ + "prettier-eslint --write", + "git add" + ] + }, "nyc": { "exclude": [ "packages/metal-incremental-dom/src/incremental-dom.js", From 49b33c122e8d7ca33f7b52e8d0f1aaa7357b82bb Mon Sep 17 00:00:00 2001 From: Chema Balsas Date: Fri, 10 Nov 2017 10:55:15 -0800 Subject: [PATCH 16/70] Updates eslint-config-liferay to 2.0.9 --- package-lock.json | 6 +++--- package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index b0a28255..3a1ceb5d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3332,9 +3332,9 @@ "dev": true }, "eslint-config-liferay": { - "version": "2.0.7", - "resolved": "https://registry.npmjs.org/eslint-config-liferay/-/eslint-config-liferay-2.0.7.tgz", - "integrity": "sha512-sOXz2t4XJ4QRjqElsGCb5cpPoYtFbsfYg7LBWXpuI7Xx5aVAK7Lr8xIWQxx8QEGmXkW28STP+WSmj7YEd3TxPw==", + "version": "2.0.9", + "resolved": "https://registry.npmjs.org/eslint-config-liferay/-/eslint-config-liferay-2.0.9.tgz", + "integrity": "sha512-SgAioMe/7JurwuSH6eiEXdnD/tzaPHtTotbQvzAXrPsXTOFYVE4gc6ZyuW6DootqDZrH+TCz+9UJmnCgSqxarA==", "dev": true, "requires": { "eslint-config-google": "0.9.1" diff --git a/package.json b/package.json index 4f78400d..1266d630 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ "browserify": "^13.0.1", "chai": "^3.5.0", "eslint": "^4.10.0", - "eslint-config-liferay": "^2.0.7", + "eslint-config-liferay": "^2.0.9", "eslint-plugin-react": "^7.4.0", "gulp": "^3.8.11", "gulp-babel": "^6.1.2", From 27ce28a99cea9c9711009cba836c27972cda903a Mon Sep 17 00:00:00 2001 From: Chema Balsas Date: Fri, 10 Nov 2017 11:31:22 -0800 Subject: [PATCH 17/70] Adds mocha and browser envs to overridden eslintrc file --- packages/metal-assertions/test/.eslintrc | 3 +++ packages/metal-component/test/.eslintrc | 3 +++ packages/metal-dom/test/.eslintrc | 3 +++ packages/metal-events/test/.eslintrc | 3 +++ packages/metal-incremental-dom/test/.eslintrc | 3 +++ packages/metal-jsx/test/.eslintrc | 3 +++ packages/metal-soy/test/.eslintrc | 3 +++ packages/metal-state/test/.eslintrc | 3 +++ packages/metal-web-component/test/.eslintrc | 3 +++ packages/metal/test/.eslintrc | 3 +++ 10 files changed, 30 insertions(+) diff --git a/packages/metal-assertions/test/.eslintrc b/packages/metal-assertions/test/.eslintrc index c6df3779..902156c0 100644 --- a/packages/metal-assertions/test/.eslintrc +++ b/packages/metal-assertions/test/.eslintrc @@ -1,4 +1,7 @@ { + "env": { + "mocha": true + }, "globals": { "assert": true, "sinon": true diff --git a/packages/metal-component/test/.eslintrc b/packages/metal-component/test/.eslintrc index c6df3779..902156c0 100644 --- a/packages/metal-component/test/.eslintrc +++ b/packages/metal-component/test/.eslintrc @@ -1,4 +1,7 @@ { + "env": { + "mocha": true + }, "globals": { "assert": true, "sinon": true diff --git a/packages/metal-dom/test/.eslintrc b/packages/metal-dom/test/.eslintrc index 06bcb576..790a71ae 100644 --- a/packages/metal-dom/test/.eslintrc +++ b/packages/metal-dom/test/.eslintrc @@ -1,4 +1,7 @@ { + "env": { + "mocha": true + }, "globals": { "after": true, "assert": true, diff --git a/packages/metal-events/test/.eslintrc b/packages/metal-events/test/.eslintrc index 61f47403..f6269b7a 100644 --- a/packages/metal-events/test/.eslintrc +++ b/packages/metal-events/test/.eslintrc @@ -1,4 +1,7 @@ { + "env": { + "mocha": true + }, "globals": { "assert": true, "sinon": true diff --git a/packages/metal-incremental-dom/test/.eslintrc b/packages/metal-incremental-dom/test/.eslintrc index 06bcb576..790a71ae 100644 --- a/packages/metal-incremental-dom/test/.eslintrc +++ b/packages/metal-incremental-dom/test/.eslintrc @@ -1,4 +1,7 @@ { + "env": { + "mocha": true + }, "globals": { "after": true, "assert": true, diff --git a/packages/metal-jsx/test/.eslintrc b/packages/metal-jsx/test/.eslintrc index 69753977..28b22103 100644 --- a/packages/metal-jsx/test/.eslintrc +++ b/packages/metal-jsx/test/.eslintrc @@ -1,4 +1,7 @@ { + "env": { + "mocha": true + }, "globals": { "assert": true, "sinon": true diff --git a/packages/metal-soy/test/.eslintrc b/packages/metal-soy/test/.eslintrc index 61f47403..f6269b7a 100644 --- a/packages/metal-soy/test/.eslintrc +++ b/packages/metal-soy/test/.eslintrc @@ -1,4 +1,7 @@ { + "env": { + "mocha": true + }, "globals": { "assert": true, "sinon": true diff --git a/packages/metal-state/test/.eslintrc b/packages/metal-state/test/.eslintrc index 61f47403..f6269b7a 100644 --- a/packages/metal-state/test/.eslintrc +++ b/packages/metal-state/test/.eslintrc @@ -1,4 +1,7 @@ { + "env": { + "mocha": true + }, "globals": { "assert": true, "sinon": true diff --git a/packages/metal-web-component/test/.eslintrc b/packages/metal-web-component/test/.eslintrc index 075c2903..1547409b 100644 --- a/packages/metal-web-component/test/.eslintrc +++ b/packages/metal-web-component/test/.eslintrc @@ -1,4 +1,7 @@ { + "env": { + "mocha": true + }, "globals": { "assert": true, "before": true, diff --git a/packages/metal/test/.eslintrc b/packages/metal/test/.eslintrc index c6df3779..902156c0 100644 --- a/packages/metal/test/.eslintrc +++ b/packages/metal/test/.eslintrc @@ -1,4 +1,7 @@ { + "env": { + "mocha": true + }, "globals": { "assert": true, "sinon": true From 04ce2c1523007f507553d36d1cbcadc230dd64eb Mon Sep 17 00:00:00 2001 From: Chema Balsas Date: Fri, 10 Nov 2017 15:20:07 -0800 Subject: [PATCH 18/70] Updates test environment to node 8 (LTS) --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 88da49f8..cca5a048 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,7 @@ addons: secure: rV35O/fLO1NHiINBspiMzvWWtJPBdetUb3bB4mBB2Qrqf0WMRMGJ4Pgkaxl0p9JqAgPMQ/HSQTKLPNKaATc5g6GO46H7N1ykWBLrhsi7YSgopbNwUw95RebaZc42iyfgbnYG1hU8YEmes01UwXLsVup6qNt7X64I+M/KcfM6Cb8= before_install: - - nvm install 7 + - nvm install 8 - npm install -g gulp - npm install -g lerna@2.2.0 From 61d0f4fc1cb5ac4b4c5c90e891892bcc1e49bea8 Mon Sep 17 00:00:00 2001 From: Chema Balsas Date: Fri, 10 Nov 2017 15:27:19 -0800 Subject: [PATCH 19/70] Uses var since polyfill does not get transpiled --- packages/metal-web-component/webcomponents_polyfill.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/metal-web-component/webcomponents_polyfill.js b/packages/metal-web-component/webcomponents_polyfill.js index 6ab5a83d..da674a5e 100644 --- a/packages/metal-web-component/webcomponents_polyfill.js +++ b/packages/metal-web-component/webcomponents_polyfill.js @@ -1,8 +1,10 @@ +/* eslint no-var: 0 */ if (window.navigator.userAgent.indexOf('MSIE') === -1) { - const script = document.createElement('script'); + var script = document.createElement('script'); script.crossOrigin = 'anonymous'; - script.src = '/base/packages/metal-web-component/node_modules/@webcomponents/webcomponentsjs/webcomponents-lite.js'; + script.src = + '/base/packages/metal-web-component/node_modules/@webcomponents/webcomponentsjs/webcomponents-lite.js'; script.type = 'text/javascript'; document.body.appendChild(script); From 172fb1819fe01639861935f5768b98151ae83493 Mon Sep 17 00:00:00 2001 From: Pablo Molina Date: Fri, 17 Nov 2017 09:23:38 +0100 Subject: [PATCH 20/70] Add feature test "dispose should emit a disposed event" --- packages/metal-component/test/Component.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/packages/metal-component/test/Component.js b/packages/metal-component/test/Component.js index 4fc59a0a..d6598d72 100644 --- a/packages/metal-component/test/Component.js +++ b/packages/metal-component/test/Component.js @@ -215,6 +215,21 @@ describe('Component', function() { comp.dispose(); assert.strictEqual(1, comp.disposed.callCount); }); + + it('should emit "disposed" event when component is disposed', function () { + var listener = sinon.stub(); + + comp = new Component({ + events: { + disposed: listener + } + }); + + assert.strictEqual(0, listener.callCount); + + comp.dispose(); + assert.strictEqual(1, listener.callCount); + }); }); describe('Element', function() { From c9fc8a00ce2bc534002e848c5b0adda4fa4570f2 Mon Sep 17 00:00:00 2001 From: Pablo Molina Date: Fri, 17 Nov 2017 09:19:42 +0100 Subject: [PATCH 21/70] Add emit disposed event on Component dispose --- packages/metal-component/src/Component.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/metal-component/src/Component.js b/packages/metal-component/src/Component.js index 9d1c61ea..5b6da34c 100644 --- a/packages/metal-component/src/Component.js +++ b/packages/metal-component/src/Component.js @@ -294,6 +294,7 @@ class Component extends EventEmitter { disposeInternal() { this.detach(); this.disposed(); + this.emit('disposed'); this.elementEventProxy_.dispose(); this.elementEventProxy_ = null; From 7759bba153d0a1e46ee57e09f9ca8e910bfd80e2 Mon Sep 17 00:00:00 2001 From: Robert-Frampton Date: Fri, 17 Nov 2017 08:35:15 -0800 Subject: [PATCH 22/70] Update contributing guidelines --- CONTRIBUTING.md | 123 ++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 103 insertions(+), 20 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0ee93c1d..46ac8967 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -24,49 +24,132 @@ repo. It's perfect for this use case and it's been used by The repo is divided into packages, which are: * [metal](http://npmjs.com/package/metal) +* [metal-assertions](http://npmjs.com/package/metal-assertions) * [metal-component](http://npmjs.com/package/metal-component) * [metal-dom](http://npmjs.com/package/metal-dom) * [metal-events](http://npmjs.com/package/metal-events) * [metal-incremental-dom](http://npmjs.com/package/metal-incremental-dom) * [metal-jsx](http://npmjs.com/package/metal-jsx) * [metal-soy](http://npmjs.com/package/metal-soy) +* [metal-soy-bundle](http://npmjs.com/package/metal-soy-bundle) * [metal-state](http://npmjs.com/package/metal-state) +* [metal-web-component](http://npmjs.com/package/metal-web-component) Each package has its own package.json and is set up so that it provides two types of entry points: one for commonjs usage (**main**) and another for ES6 modules (**jsnext:main**). Check out metal-dom's [package.json](packages/metal-dom/package.json#L11) file as an example. -## Contributing requirements +## Pull requests & Github issues -### Tests +* All pull requests should be sent to the `develop` branch, as the `master` +branch should always reflect the most recent release. +* Any merged changes will remain in the `develop` branch until the next +scheduled release. +* The only exception to this rule is for emergency hot fixes, in which case the +pull request can be sent to the `master` branch. +* A Github issue should also be created for any bug fix or feature, this helps +when generating the CHANGELOG.md file. + +## Tests Any change (be it an improvement, a new feature or a bug fix) needs to include a test, and all tests from the repo need to be passing. To run the tests you -can use our gulp tasks: +can use our npm script: + +``` +npm test +``` + +## Formatting + +Run the format script to automatically format any changes: -* `gulp test` Runs all tests once -* `gulp test:coverage` Runs all tests once and shows a summary coverage -report. -* `gulp test:coverage:open` Runs all tests once and opens a detailed coverage -report in the browser. -* `gulp test:watch` Runs all tests and listens for changes, rerunning them -automatically. +``` +npm run format +``` -### Lint +Once it's done formatting, run the lint script: -Lint errors need to be fixed. To lint the code just run: `gulp lint`. +``` +npm run lint +``` -### JS Docs +If there are any linting errors at this point, they must be addressed manually. + +If you would like to see a list of our formatting standards check +out [our docs](https://hosting-liferayfrontendguidelines.wedeploy.io/). + +## JS Docs All methods should be documented, following [google's format](https://github.com/google/closure-compiler/wiki/Annotating-JavaScript-for-the-Closure-Compiler). -## Publishing Metal.js +# Releasing + +Collaborators with publish permissions should follow these steps. + +There are two different workflows for publishing this project, one for scheduled +releases, and one for emergency hot fixes. + +## Scheduled release + +1. Create a release branch from the updated `develop` branch + +``` +git checkout develop +git pull upstream develop +git checkout -b release/vX.X.X +``` + +2. Send release PR to `master` + +3. Wait to see that all tests pass and then merge with merge commit + +4. Checkout and pull `master` locally + +``` +git checkout master && git pull upstream master +``` + +5. Publish npm modules and push release tags + +``` +lerna publish (major/minor/patch accordingly) +``` + +6. Generate changelog + +github_changelog_generator (https://github.com/skywinder/github-changelog-generator) + +7. Commit changelog and push to `master` + +``` +git add CHANGELOG.md +git commit -m "Updates CHANGELOG for vX.X.X" +git push +``` + +8. Sync `develop` with `master` + +``` +git checkout develop +git merge master +``` + +9. Do GitHub release using the pushed vX.X.X tag and the appropriate portion of +CHANGELOG.md + +## Hot fix + +1. Create a feature branch from `master` (assuming hot fix has already been +merged) + +``` +git checkout master +git pull upstream master +git checkout -b feature/fix_foo +``` -Collaborators with publish permissions should follow the following steps: +2. Send a fix PR to `master` -1. Make sure that the [CI tests](https://travis-ci.org/metal/metal.js/builds) -are passing. -2. Run `lerna publish`. -3. Edit the release in [github](https://github.com/metal/metal.js/releases) with -details about what has changed. +3. Follow steps 3-9 of a scheduled release From b35811bbe657a88962ede042b4b57df63e9e5654 Mon Sep 17 00:00:00 2001 From: Robert-Frampton Date: Tue, 21 Nov 2017 10:10:39 -0800 Subject: [PATCH 23/70] Replace gulp-metal with karma --- gulpfile.js | 153 +---------- karma-coverage.conf.js | 105 ++----- karma-sauce.conf.js | 104 ------- karma-saucelabs.conf.js | 108 ++++++++ karma.conf.js | 115 +++++++- package-lock.json | 589 +++++++++++++++++++++++++++++++++++++--- package.json | 20 +- 7 files changed, 797 insertions(+), 397 deletions(-) delete mode 100644 karma-sauce.conf.js create mode 100644 karma-saucelabs.conf.js diff --git a/gulpfile.js b/gulpfile.js index c7cb73a0..e4f42644 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -1,107 +1,12 @@ 'use strict'; -var babel = require('gulp-babel'); -var compileSoy = require('metal-tools-soy/lib/pipelines/compileSoy'); -var gulp = require('gulp'); -var karma = require('karma'); -var metal = require('gulp-metal'); -var path = require('path'); -var replace = require('gulp-replace'); - -var codeGlobs = [ - 'packages/metal*/src/**/*.js', - 'packages/metal*/test/**/*.js', - '!packages/metal*/**/*.soy.js', - '!packages/metal-incremental-dom/**/incremental-dom.js', - 'gulpfile.js', - 'karma.conf.js', - 'karma-coverage.conf.js' -]; - -metal.registerTasks({ - bundleFileName: 'metal.js', - formatGlobs: codeGlobs, - karma: require('karma'), - lintGlobs: codeGlobs, - testDepTasks: ['build:cjs'], - testNodeSrc: [ - // Since all files will be added, we need to ensure manually that these - // will be added first. - 'packages/metal-incremental-dom/lib/incremental-dom.js', - - // Test files - 'env/test/node.js', - 'packages/metal/test/**/*.js', - 'packages/metal-component/test/**/*.js', - 'packages/metal-dom/test/**/*.js', - 'packages/metal-events/test/**/*.js', - 'packages/metal-incremental-dom/test/**/*.js', - 'packages/metal-jsx/test/**/*.js', - 'packages/metal-soy/test/**/*.js', - 'packages/metal-state/test/**/*.js' - ], - testSaucelabsBrowsers: { - sl_chrome: { - base: 'SauceLabs', - browserName: 'chrome' - }, - sl_safari_8: { - base: 'SauceLabs', - browserName: 'safari', - platform: 'OS X 10.10' - }, - sl_safari_10: { - base: 'SauceLabs', - browserName: 'safari', - platform: 'OS X 10.12', - version: '10' - }, - sl_firefox: { - base: 'SauceLabs', - browserName: 'firefox' - }, - sl_ie_9: { - base: 'SauceLabs', - browserName: 'internet explorer', - platform: 'Windows 7', - version: '9' - }, - sl_ie_10: { - base: 'SauceLabs', - browserName: 'internet explorer', - platform: 'Windows 7', - version: '10' - }, - sl_ie_11: { - base: 'SauceLabs', - browserName: 'internet explorer', - platform: 'Windows 8.1', - version: '11' - }, - sl_edge_15: { - base: 'SauceLabs', - browserName: 'microsoftedge', - platform: 'Windows 10', - version: '15' - }, - sl_android_4: { - base: 'SauceLabs', - browserName: 'android', - platform: 'Linux', - version: '4.4' - }, - sl_android_5: { - base: 'SauceLabs', - browserName: 'android', - platform: 'Linux', - version: '5.0' - } - }, - useEslint: true -}); +let compileSoy = require('metal-tools-soy/lib/pipelines/compileSoy'); +let gulp = require('gulp'); +let replace = require('gulp-replace'); gulp.task('soy', function() { - return gulp.src('packages/metal-soy/test/**/*.soy') + return gulp + .src('packages/metal-soy/test/**/*.soy') .pipe(compileSoy()) .pipe(replace('metal-soy', '../..')) .pipe(replace('metal-component/src/Component', 'metal-component')) @@ -109,52 +14,8 @@ gulp.task('soy', function() { }); gulp.task('soy:isomorphic', function() { - return gulp.src('packages/metal-isomorphic/test/**/*.soy') + return gulp + .src('packages/metal-isomorphic/test/**/*.soy') .pipe(compileSoy()) .pipe(gulp.dest('packages/metal-isomorphic/test')); }); - -gulp.task('build:cjs', ['soy'], function() { - return compileToLib('packages/metal*/src/**/*.js'); -}); - -var changedJsSrc; -gulp.task('compile', function() { - return compileToLib(changedJsSrc); -}); - -// We need to override gulp-metal's default test:watch task so that it will -// update lib files when the related src files change. -gulp.task('test:watch', ['build:cjs'], function(done) { // eslint-disable-line - gulp.watch('packages/metal-soy/test/**/*.soy', ['soy']); - var jsWatcher = gulp.watch('packages/metal*/src/**/*.js', ['compile']); - jsWatcher.on('change', function(event) { - changedJsSrc = event.path; - }); - - new karma.Server( - { - configFile: path.resolve('karma.conf.js') - } - ).start(); -}); - -function calcDestDir(file) { - var relative = path.relative(path.resolve('packages'), file.path); - var index = relative.indexOf(path.sep); - file.base = path.dirname(file.path); - return path.dirname(path.join( - path.resolve('packages'), - relative.substr(0, index), - 'lib', - relative.substr(index + 5) - )); -} - -function compileToLib(src) { - return gulp.src(src) - .pipe(babel({ - presets: ['env'] - })) - .pipe(gulp.dest(calcDestDir)); -} diff --git a/karma-coverage.conf.js b/karma-coverage.conf.js index 327cc067..793ce707 100644 --- a/karma-coverage.conf.js +++ b/karma-coverage.conf.js @@ -1,115 +1,42 @@ -'use strict'; - -var lernaJson = require('./lerna.json'); +const karmaConfig = require('./karma.conf.js'); +const lernaJson = require('./lerna.json'); module.exports = function(config) { - config.set({ - frameworks: ['browserify', 'mocha', 'chai', 'sinon', 'source-map-support'], - - files: [ - // Since all files will be added, we need to ensure manually that these - // will be added first. - { - pattern: 'packages/metal-incremental-dom/src/incremental-dom.js', - watched: false, - included: true, - served: true - }, - { - pattern: 'packages/metal-incremental-dom/lib/incremental-dom.js', - watched: false, - included: true, - served: true - }, - { - pattern: 'packages/metal-soy-bundle/lib/bundle.js', - watched: false, - included: true, - served: true - }, - { - pattern: 'packages/metal-web-component/node_modules/babel-polyfill/dist/polyfill.min.js', - watched: false, - included: true, - served: true - }, - { - pattern: 'packages/metal-web-component/node_modules/@webcomponents/webcomponentsjs/webcomponents-lite.js', - watched: false, - included: false, - served: true - }, - { - pattern: 'packages/metal-web-component/webcomponents_polyfill.js', - watched: false, - included: true, - served: true - }, - { - pattern: 'packages/metal*/test/**/*.js', - watched: false, - included: true, - served: true - }, - { - pattern: 'packages/metal-dom/fixtures/*', - watched: true, - included: false, - served: true - } - ], - - exclude: ['packages/metal-isomorphic/**/*.js'], + karmaConfig(config); - preprocessors: { - 'packages/metal-incremental-dom/src/incremental-dom.js': ['browserify'], - 'packages/metal-incremental-dom/lib/incremental-dom.js': ['browserify'], - 'packages/metal-soy-bundle/lib/bundle.js': ['browserify'], - 'packages/metal*/test/**/*.js': ['browserify'] - }, - - browsers: ['Chrome'], + config.plugins.push('karma-coverage'); + config.set({ browserify: { debug: true, transform: [ [ 'babelify', { - plugins: [ - 'istanbul' - ], - presets: [ - 'env' - ] - } - ] + plugins: ['istanbul'], + presets: ['env'], + }, + ], ], insertGlobalVars: { METAL_VERSION: function() { return '\'' + lernaJson.version + '\''; - } - } + }, + }, }, - reporters: ['coverage', 'progress'], - coverageReporter: { reporters: [ { type: 'lcov', - subdir: 'lcov' + subdir: 'lcov', }, { - type: 'text-summary' - } - ] + type: 'text-summary', + }, + ], }, - autoWatch: true, - - proxies: { - '/fixtures/': '/base/packages/metal-dom/fixtures/' - } + reporters: ['coverage', 'progress'], }); }; diff --git a/karma-sauce.conf.js b/karma-sauce.conf.js deleted file mode 100644 index 6615fb81..00000000 --- a/karma-sauce.conf.js +++ /dev/null @@ -1,104 +0,0 @@ -'use strict'; - -var lernaJson = require('./lerna.json'); - -module.exports = function(config) { - config.set({ - frameworks: ['browserify', 'mocha', 'chai', 'sinon'], - - files: [ - // Since all files will be added, we need to ensure manually that these - // will be added first. - { - pattern: 'packages/metal-incremental-dom/src/incremental-dom.js', - watched: false, - included: true, - served: true - }, - { - pattern: 'packages/metal-incremental-dom/lib/incremental-dom.js', - watched: false, - included: true, - served: true - }, - { - pattern: 'packages/metal-soy/node_modules/metal-soy-bundle/lib/bundle.js', - watched: false, - included: true, - served: true - }, - { - pattern: 'packages/metal-web-component/node_modules/babel-polyfill/dist/polyfill.min.js', - watched: false, - included: true, - served: true - }, - { - pattern: 'packages/metal-web-component/node_modules/@webcomponents/webcomponentsjs/webcomponents-lite.js', - watched: false, - included: false, - served: true - }, - { - pattern: 'packages/metal-web-component/webcomponents_polyfill.js', - watched: false, - included: true, - served: true - }, - { - pattern: 'packages/metal*/test/**/*.js', - watched: false, - included: true, - served: true - }, - { - pattern: 'packages/metal-dom/fixtures/*', - watched: true, - included: false, - served: true - } - ], - - exclude: ['packages/metal-isomorphic/**/*.js'], - - preprocessors: { - 'packages/metal-incremental-dom/src/incremental-dom.js': ['browserify'], - 'packages/metal-incremental-dom/lib/incremental-dom.js': ['browserify'], - 'packages/metal-soy/node_modules/metal-soy-bundle/lib/bundle.js': ['browserify'], - 'packages/metal*/test/**/*.js': ['browserify'] - }, - - browsers: ['Chrome'], - - browserify: { - debug: true, - transform: [ - [ - 'babelify', - { - presets: [ - 'env' - ] - } - ] - ], - insertGlobalVars: { - METAL_VERSION: function() { - return '\'' + lernaJson.version + '\''; - } - } - }, - - client: { - mocha: { - timeout: 4000 - } - }, - - autoWatch: true, - - proxies: { - '/fixtures/': '/base/packages/metal-dom/fixtures/' - } - }); -}; diff --git a/karma-saucelabs.conf.js b/karma-saucelabs.conf.js new file mode 100644 index 00000000..8a7620d8 --- /dev/null +++ b/karma-saucelabs.conf.js @@ -0,0 +1,108 @@ +'use strict'; + +const karmaSauceLauncher = require('karma-sauce-launcher'); + +const karmaConfig = require('./karma.conf.js'); + +module.exports = function(config) { + karmaConfig(config); + + const launchers = { + sl_chrome: { + base: 'SauceLabs', + browserName: 'chrome', + }, + sl_safari_8: { + base: 'SauceLabs', + browserName: 'safari', + platform: 'OS X 10.10', + }, + sl_safari_10: { + base: 'SauceLabs', + browserName: 'safari', + platform: 'OS X 10.12', + version: '10', + }, + sl_firefox: { + base: 'SauceLabs', + browserName: 'firefox', + }, + sl_ie_9: { + base: 'SauceLabs', + browserName: 'internet explorer', + platform: 'Windows 7', + version: '9', + }, + sl_ie_10: { + base: 'SauceLabs', + browserName: 'internet explorer', + platform: 'Windows 7', + version: '10', + }, + sl_ie_11: { + base: 'SauceLabs', + browserName: 'internet explorer', + platform: 'Windows 8.1', + version: '11', + }, + sl_edge_15: { + base: 'SauceLabs', + browserName: 'microsoftedge', + platform: 'Windows 10', + version: '15', + }, + sl_android_4: { + base: 'SauceLabs', + browserName: 'android', + platform: 'Linux', + version: '4.4', + }, + sl_android_5: { + base: 'SauceLabs', + browserName: 'android', + platform: 'Linux', + version: '5.0', + }, + }; + + let sauceLabsAccessKey = process.env.SAUCE_ACCESS_KEY; + if (!sauceLabsAccessKey) { + sauceLabsAccessKey = process.env.SAUCE_ACCESS_KEY_ENC; + if (sauceLabsAccessKey) { + sauceLabsAccessKey = new Buffer( + sauceLabsAccessKey, + 'base64' + ).toString('binary'); + } + } + + config.plugins.push(karmaSauceLauncher); + + config.set({ + browsers: Object.keys(launchers), + + browserDisconnectTimeout: 10000, + browserDisconnectTolerance: 2, + browserNoActivityTimeout: 240000, + + captureTimeout: 240000, + + customLaunchers: launchers, + + reporters: ['dots', 'saucelabs'], + + sauceLabs: { + accessKey: sauceLabsAccessKey, + connectOptions: { + port: 4445, + logfile: 'sauce_connect.log', + }, + recordScreenshots: false, + recordVideo: false, + startConnect: false, + testName: 'metal-drag-drop tests', + tunnelIdentifier: process.env.TRAVIS_JOB_NUMBER, + username: process.env.SAUCE_USERNAME, + }, + }); +}; diff --git a/karma.conf.js b/karma.conf.js index 65001c00..080fce0c 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -1,8 +1,117 @@ 'use strict'; -var karmaConf = require('./karma-sauce.conf'); +const lernaJson = require('./lerna.json'); module.exports = function(config) { - karmaConf(config); - config.frameworks.push('source-map-support'); + config.set({ + browserify: { + debug: true, + transform: [ + [ + 'babelify', + { + presets: ['env'], + }, + ], + ], + insertGlobalVars: { + METAL_VERSION: function() { + return '\'' + lernaJson.version + '\''; + }, + }, + }, + + browsers: ['Chrome'], + + client: { + mocha: { + timeout: 4000, + }, + }, + + exclude: ['packages/metal-isomorphic/**/*.js'], + + files: [ + // Since all files will be added, we need to ensure manually that these + // will be added first. + { + pattern: 'packages/metal-incremental-dom/src/incremental-dom.js', + watched: false, + included: true, + served: true, + }, + { + pattern: 'packages/metal-incremental-dom/lib/incremental-dom.js', + watched: false, + included: true, + served: true, + }, + { + pattern: + 'packages/metal-soy/node_modules/metal-soy-bundle/lib/bundle.js', + watched: false, + included: true, + served: true, + }, + { + pattern: + 'packages/metal-web-component/node_modules/babel-polyfill/dist/polyfill.min.js', + watched: false, + included: true, + served: true, + }, + { + pattern: + 'packages/metal-web-component/node_modules/@webcomponents/webcomponentsjs/webcomponents-lite.js', + watched: false, + included: false, + served: true, + }, + { + pattern: 'packages/metal-web-component/webcomponents_polyfill.js', + watched: false, + included: true, + served: true, + }, + { + pattern: 'packages/metal*/test/**/*.js', + watched: false, + included: true, + served: true, + }, + { + pattern: 'packages/metal-dom/fixtures/*', + watched: true, + included: false, + served: true, + }, + ], + + frameworks: ['browserify', 'mocha', 'chai', 'sinon', 'source-map-support'], + + plugins: [ + 'karma-browserify', + 'karma-chai', + 'karma-chrome-launcher', + 'karma-mocha', + 'karma-mocha', + 'karma-sinon', + 'karma-source-map-support', + ], + + preprocessors: { + 'packages/metal-incremental-dom/src/incremental-dom.js': ['browserify'], + 'packages/metal-incremental-dom/lib/incremental-dom.js': ['browserify'], + 'packages/metal-soy/node_modules/metal-soy-bundle/lib/bundle.js': [ + 'browserify', + ], + 'packages/metal*/test/**/*.js': ['browserify'], + }, + + proxies: { + '/fixtures/': '/base/packages/metal-dom/fixtures/', + }, + + singleRun: true, + }); }; diff --git a/package-lock.json b/package-lock.json index 3a1ceb5d..8090108a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2,16 +2,6 @@ "requires": true, "lockfileVersion": 1, "dependencies": { - "JSONStream": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-1.3.1.tgz", - "integrity": "sha1-cH92HgHa6eFvG8+TcDt4xwlmV5o=", - "dev": true, - "requires": { - "jsonparse": "1.3.1", - "through": "2.3.8" - } - }, "abab": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/abab/-/abab-1.0.4.tgz", @@ -72,12 +62,36 @@ "integrity": "sha1-anmQQ3ynNtXhKI25K9MmbV9csqo=", "dev": true }, + "adm-zip": { + "version": "0.4.7", + "resolved": "https://registry.npmjs.org/adm-zip/-/adm-zip-0.4.7.tgz", + "integrity": "sha1-hgbCy/HEJs6MjsABdER/1Jtur8E=", + "dev": true + }, "after": { "version": "0.8.2", "resolved": "https://registry.npmjs.org/after/-/after-0.8.2.tgz", "integrity": "sha1-/ts5T58OAqqXaOcCvaI7UF+ufh8=", "dev": true }, + "agent-base": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-2.1.1.tgz", + "integrity": "sha1-1t4Q1a9hMtW9aSQn1G/FOFOQlMc=", + "dev": true, + "requires": { + "extend": "3.0.1", + "semver": "5.0.3" + }, + "dependencies": { + "semver": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.0.3.tgz", + "integrity": "sha1-d0Zt5YnNXTyV8TiqeLxWmjy10no=", + "dev": true + } + } + }, "ajv": { "version": "5.3.0", "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.3.0.tgz", @@ -153,6 +167,48 @@ "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==", "dev": true }, + "archiver": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/archiver/-/archiver-1.3.0.tgz", + "integrity": "sha1-TyGU1tj5nfP1MeaIHxTxXVX6ryI=", + "dev": true, + "requires": { + "archiver-utils": "1.3.0", + "async": "2.6.0", + "buffer-crc32": "0.2.13", + "glob": "7.1.2", + "lodash": "4.17.4", + "readable-stream": "2.3.3", + "tar-stream": "1.5.5", + "walkdir": "0.0.11", + "zip-stream": "1.2.0" + }, + "dependencies": { + "async": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/async/-/async-2.6.0.tgz", + "integrity": "sha512-xAfGg1/NTLBBKlHFmnd7PlmUW9KhVQIUuSrYem9xzFUZy13ScvtyGGejaae9iAVRiRq9+Cx7DPFaAAhCpyxyPw==", + "dev": true, + "requires": { + "lodash": "4.17.4" + } + } + } + }, + "archiver-utils": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/archiver-utils/-/archiver-utils-1.3.0.tgz", + "integrity": "sha1-5QtMCccL89aA4y/xt5lOn52JUXQ=", + "dev": true, + "requires": { + "glob": "7.1.2", + "graceful-fs": "4.1.11", + "lazystream": "1.0.0", + "lodash": "4.17.4", + "normalize-path": "2.1.1", + "readable-stream": "2.3.3" + } + }, "archy": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/archy/-/archy-1.0.0.tgz", @@ -1125,6 +1181,15 @@ "integrity": "sha1-HmN0iLNbWL2l9HdL+WpSEqjJB1U=", "dev": true }, + "bl": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/bl/-/bl-1.2.1.tgz", + "integrity": "sha1-ysMo977kVzDUBLaSID/LWQ4XLV4=", + "dev": true, + "requires": { + "readable-stream": "2.3.3" + } + }, "blob": { "version": "0.0.4", "resolved": "https://registry.npmjs.org/blob/-/blob-0.0.4.tgz", @@ -1209,9 +1274,9 @@ "integrity": "sha1-+GzWzvT1MAyOY+B6TVEvZfv/RTE=", "dev": true, "requires": { - "JSONStream": "1.3.1", "combine-source-map": "0.7.2", "defined": "1.0.0", + "JSONStream": "1.3.1", "through2": "2.0.3", "umd": "3.0.1" } @@ -1239,7 +1304,6 @@ "integrity": "sha1-tanJAgJD8McORnW+yCI7xifkFc4=", "dev": true, "requires": { - "JSONStream": "1.3.1", "assert": "1.4.1", "browser-pack": "6.0.2", "browser-resolve": "1.11.2", @@ -1261,6 +1325,7 @@ "https-browserify": "0.0.1", "inherits": "2.0.3", "insert-module-globals": "7.0.1", + "JSONStream": "1.3.1", "labeled-stream-splicer": "2.0.0", "module-deps": "4.1.1", "os-browserify": "0.1.2", @@ -1379,6 +1444,12 @@ "isarray": "1.0.0" } }, + "buffer-crc32": { + "version": "0.2.13", + "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz", + "integrity": "sha1-DTM+PwDqxQqhRUq9MO+MKl2ackI=", + "dev": true + }, "buffer-xor": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/buffer-xor/-/buffer-xor-1.0.3.tgz", @@ -1800,6 +1871,18 @@ "integrity": "sha1-ZF/ErfWLcrZJ1crmUTVhnbJv8UM=", "dev": true }, + "compress-commons": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/compress-commons/-/compress-commons-1.2.2.tgz", + "integrity": "sha1-UkqfEJA/OoEzibAiXSfEi7dRiQ8=", + "dev": true, + "requires": { + "buffer-crc32": "0.2.13", + "crc32-stream": "2.0.0", + "normalize-path": "2.1.1", + "readable-stream": "2.3.3" + } + }, "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", @@ -2071,8 +2154,8 @@ "integrity": "sha512-8od6g684Fhi5Vpp4ABRv/RBsW1AY6wSHbJHEK6FGTv+8jvAAnlABniZu/FVmX9TcirkHepaEsa1QGkRvbg0CKw==", "dev": true, "requires": { - "JSONStream": "1.3.1", "is-text-path": "1.0.1", + "JSONStream": "1.3.1", "lodash": "4.17.4", "meow": "3.7.0", "split2": "2.2.0", @@ -2143,6 +2226,22 @@ } } }, + "crc": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/crc/-/crc-3.5.0.tgz", + "integrity": "sha1-mLi6fUiWZbo5efWbITgTdBAaGWQ=", + "dev": true + }, + "crc32-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/crc32-stream/-/crc32-stream-2.0.0.tgz", + "integrity": "sha1-483TtN8xaN10494/u8t7KX/pCPQ=", + "dev": true, + "requires": { + "crc": "3.5.0", + "readable-stream": "2.3.3" + } + }, "create-ecdh": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/create-ecdh/-/create-ecdh-4.0.0.tgz", @@ -4629,22 +4728,22 @@ } } }, - "string-width": { - "version": "1.0.2", + "string_decoder": { + "version": "1.0.1", "bundled": true, "dev": true, "requires": { - "code-point-at": "1.1.0", - "is-fullwidth-code-point": "1.0.0", - "strip-ansi": "3.0.1" + "safe-buffer": "5.0.1" } }, - "string_decoder": { - "version": "1.0.1", + "string-width": { + "version": "1.0.2", "bundled": true, "dev": true, "requires": { - "safe-buffer": "5.0.1" + "code-point-at": "1.1.0", + "is-fullwidth-code-point": "1.0.0", + "strip-ansi": "3.0.1" } }, "stringstream": { @@ -11638,6 +11737,14 @@ "bundled": true, "dev": true }, + "string_decoder": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "requires": { + "safe-buffer": "5.0.1" + } + }, "string-length": { "version": "1.0.1", "bundled": true, @@ -11656,14 +11763,6 @@ "strip-ansi": "3.0.1" } }, - "string_decoder": { - "version": "1.0.2", - "bundled": true, - "dev": true, - "requires": { - "safe-buffer": "5.0.1" - } - }, "stringstream": { "version": "0.0.5", "bundled": true, @@ -12723,6 +12822,12 @@ } } }, + "has-color": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/has-color/-/has-color-0.1.7.tgz", + "integrity": "sha1-ZxRKUmDDT8PMpnfQQdr1L+e3iy8=", + "dev": true + }, "has-cors": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/has-cors/-/has-cors-1.1.0.tgz", @@ -12883,6 +12988,17 @@ "integrity": "sha1-P5E2XKvmC3ftDruiS0VOPgnZWoI=", "dev": true }, + "https-proxy-agent": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-1.0.0.tgz", + "integrity": "sha1-NffabEjOTdv6JkiRrFk+5f+GceY=", + "dev": true, + "requires": { + "agent-base": "2.1.1", + "debug": "2.6.9", + "extend": "3.0.1" + } + }, "husky": { "version": "0.14.3", "resolved": "https://registry.npmjs.org/husky/-/husky-0.14.3.tgz", @@ -13052,10 +13168,10 @@ "integrity": "sha1-wDv04BywhtW15azorQr+eInWOMM=", "dev": true, "requires": { - "JSONStream": "1.3.1", "combine-source-map": "0.7.2", "concat-stream": "1.5.2", "is-buffer": "1.1.6", + "JSONStream": "1.3.1", "lexical-scope": "1.2.0", "process": "0.11.10", "through2": "2.0.3", @@ -13435,6 +13551,31 @@ "whatwg-fetch": "2.0.3" } }, + "isparta": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/isparta/-/isparta-4.0.0.tgz", + "integrity": "sha1-HekZlvSAsi3LGsqFECVbrhV0RG4=", + "dev": true, + "requires": { + "babel-core": "6.26.0", + "escodegen": "1.9.0", + "esprima": "2.7.3", + "istanbul": "0.4.5", + "mkdirp": "0.5.1", + "nomnomnomnom": "2.0.1", + "object-assign": "4.1.1", + "source-map": "0.5.7", + "which": "1.3.0" + }, + "dependencies": { + "esprima": { + "version": "2.7.3", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-2.7.3.tgz", + "integrity": "sha1-luO3DVd59q1JzQMmc9HDEnZ7pYE=", + "dev": true + } + } + }, "isstream": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", @@ -13800,6 +13941,16 @@ "integrity": "sha1-T9kss04OnbPInIYi7PUfm5eMbLk=", "dev": true }, + "JSONStream": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-1.3.1.tgz", + "integrity": "sha1-cH92HgHa6eFvG8+TcDt4xwlmV5o=", + "dev": true, + "requires": { + "jsonparse": "1.3.1", + "through": "2.3.8" + } + }, "jsprim": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", @@ -13873,10 +14024,16 @@ } } }, + "karma-babel-preprocessor": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/karma-babel-preprocessor/-/karma-babel-preprocessor-7.0.0.tgz", + "integrity": "sha512-k8YUot8ZAAYhAeUxOsOGUEXW7AlB6SkoIVGfavEBCAdGHzWuraOBoR2wCxxdePUCvcItIxSUyQnOj6DuZdEJYA==", + "dev": true + }, "karma-browserify": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/karma-browserify/-/karma-browserify-5.1.1.tgz", - "integrity": "sha1-9kLXDXdtmrO3NSbFcyq8/qJAAxk=", + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/karma-browserify/-/karma-browserify-5.1.2.tgz", + "integrity": "sha1-SAFjWdciMSo1MKodu6t2Y+Ai13k=", "dev": true, "requires": { "convert-source-map": "1.5.0", @@ -13902,9 +14059,9 @@ "dev": true }, "karma-chrome-launcher": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/karma-chrome-launcher/-/karma-chrome-launcher-1.0.1.tgz", - "integrity": "sha1-vlrnxCZPmgouIuPZhL6zJa2SyMs=", + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/karma-chrome-launcher/-/karma-chrome-launcher-2.2.0.tgz", + "integrity": "sha512-uf/ZVpAabDBPvdPdveyk1EPgbnloPvFFGgmRhYLTDH7gEB4nZdSBk8yTU47w1g/drLSx5uMOkjKk7IWKfWg/+w==", "dev": true, "requires": { "fs-access": "1.0.1", @@ -13959,6 +14116,18 @@ } } }, + "karma-sauce-launcher": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/karma-sauce-launcher/-/karma-sauce-launcher-1.1.0.tgz", + "integrity": "sha1-PQg89WWdZzarl7zuXYrNhq1SIhI=", + "dev": true, + "requires": { + "q": "1.5.1", + "sauce-connect-launcher": "0.17.0", + "saucelabs": "1.4.0", + "wd": "1.4.1" + } + }, "karma-sinon": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/karma-sinon/-/karma-sinon-1.0.5.tgz", @@ -15419,7 +15588,6 @@ "integrity": "sha1-IyFYM/HaE/1gbMuAh7RIUty4If0=", "dev": true, "requires": { - "JSONStream": "1.3.1", "browser-resolve": "1.11.2", "cached-path-relative": "1.0.1", "concat-stream": "1.5.2", @@ -15427,6 +15595,7 @@ "detective": "4.5.0", "duplexer2": "0.1.4", "inherits": "2.0.3", + "JSONStream": "1.3.1", "parents": "1.0.1", "readable-stream": "2.3.3", "resolve": "1.5.0", @@ -15539,6 +15708,41 @@ "is-stream": "1.1.0" } }, + "nomnomnomnom": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/nomnomnomnom/-/nomnomnomnom-2.0.1.tgz", + "integrity": "sha1-siOfAxyNBNpn4yg24eMZnhL3qOI=", + "dev": true, + "requires": { + "chalk": "0.4.0", + "underscore": "1.6.0" + }, + "dependencies": { + "ansi-styles": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-1.0.0.tgz", + "integrity": "sha1-yxAt8cVvUSPquLZ817mAJ6AnkXg=", + "dev": true + }, + "chalk": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-0.4.0.tgz", + "integrity": "sha1-UZmj3c0MHv4jvAjBsCewYXbgxk8=", + "dev": true, + "requires": { + "ansi-styles": "1.0.0", + "has-color": "0.1.7", + "strip-ansi": "0.1.1" + } + }, + "strip-ansi": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-0.1.1.tgz", + "integrity": "sha1-OeipjQRNFQZgq+SmgIrPcLt7yZE=", + "dev": true + } + } + }, "nopt": { "version": "3.0.6", "resolved": "https://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz", @@ -17042,6 +17246,64 @@ "integrity": "sha1-vsEf3IOp/aBjQBIQ5AF2wwJNFWc=", "dev": true }, + "sauce-connect-launcher": { + "version": "0.17.0", + "resolved": "https://registry.npmjs.org/sauce-connect-launcher/-/sauce-connect-launcher-0.17.0.tgz", + "integrity": "sha1-kI2TEeyvF92bRkehQ1/UogcugM4=", + "dev": true, + "requires": { + "adm-zip": "0.4.7", + "async": "1.4.0", + "https-proxy-agent": "1.0.0", + "lodash": "3.10.1", + "rimraf": "2.4.3" + }, + "dependencies": { + "async": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/async/-/async-1.4.0.tgz", + "integrity": "sha1-Nfhvg8WeBCHQmc2akdgnj7V4wA0=", + "dev": true + }, + "glob": { + "version": "5.0.15", + "resolved": "https://registry.npmjs.org/glob/-/glob-5.0.15.tgz", + "integrity": "sha1-G8k2ueAvSmA/zCIuz3Yz0wuLk7E=", + "dev": true, + "requires": { + "inflight": "1.0.6", + "inherits": "2.0.3", + "minimatch": "3.0.4", + "once": "1.4.0", + "path-is-absolute": "1.0.1" + } + }, + "lodash": { + "version": "3.10.1", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-3.10.1.tgz", + "integrity": "sha1-W/Rejkm6QYnhfUgnid/RW9FAt7Y=", + "dev": true + }, + "rimraf": { + "version": "2.4.3", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.4.3.tgz", + "integrity": "sha1-5bUclDekxYKtuVXp8oz42UXicq8=", + "dev": true, + "requires": { + "glob": "5.0.15" + } + } + } + }, + "saucelabs": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/saucelabs/-/saucelabs-1.4.0.tgz", + "integrity": "sha1-uTSpr52ih0s/QKrh/N5QpEZvXzg=", + "dev": true, + "requires": { + "https-proxy-agent": "1.0.0" + } + }, "sax": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", @@ -17516,6 +17778,12 @@ "integrity": "sha1-Rb8dny19wJvtgfHDB8Qw5ouEz/4=", "dev": true }, + "string_decoder": { + "version": "0.10.31", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=", + "dev": true + }, "string-width": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", @@ -17543,12 +17811,6 @@ } } }, - "string_decoder": { - "version": "0.10.31", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", - "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=", - "dev": true - }, "stringify-object": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/stringify-object/-/stringify-object-3.2.1.tgz", @@ -17725,6 +17987,29 @@ } } }, + "tar-stream": { + "version": "1.5.5", + "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-1.5.5.tgz", + "integrity": "sha512-mQdgLPc/Vjfr3VWqWbfxW8yQNiJCbAZ+Gf6GDu1Cy0bdb33ofyiNGBtAY96jHFhDuivCwgW1H9DgTON+INiXgg==", + "dev": true, + "requires": { + "bl": "1.2.1", + "end-of-stream": "1.4.0", + "readable-stream": "2.3.3", + "xtend": "4.0.1" + }, + "dependencies": { + "end-of-stream": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.0.tgz", + "integrity": "sha1-epDYM+/abPpurA9JSduw+tOmMgY=", + "dev": true, + "requires": { + "once": "1.4.0" + } + } + } + }, "temp-dir": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/temp-dir/-/temp-dir-1.0.0.tgz", @@ -18161,6 +18446,22 @@ "integrity": "sha1-5z3T17DXxe2G+6xrCufYxqadUPo=", "dev": true }, + "underscore": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.6.0.tgz", + "integrity": "sha1-izixDKze9jM3uLJOT/htRa6lKag=", + "dev": true + }, + "underscore.string": { + "version": "3.3.4", + "resolved": "https://registry.npmjs.org/underscore.string/-/underscore.string-3.3.4.tgz", + "integrity": "sha1-LCo/n4PmR2L9xF5s6sZRQoZCE9s=", + "dev": true, + "requires": { + "sprintf-js": "1.0.3", + "util-deprecate": "1.0.2" + } + }, "unique-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/unique-stream/-/unique-stream-1.0.0.tgz", @@ -18296,6 +18597,12 @@ "spdx-expression-parse": "1.0.4" } }, + "vargs": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/vargs/-/vargs-0.1.0.tgz", + "integrity": "sha1-a2GE2mUgzDIEzhtAfKwm2SYJ6/8=", + "dev": true + }, "verror": { "version": "1.10.0", "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", @@ -18423,6 +18730,12 @@ "integrity": "sha1-wGavtYK7HLQSjWDqkjkulNXp2+w=", "dev": true }, + "walkdir": { + "version": "0.0.11", + "resolved": "https://registry.npmjs.org/walkdir/-/walkdir-0.0.11.tgz", + "integrity": "sha1-oW0CXrkxvQO1LzCMrtD0D86+lTI=", + "dev": true + }, "watchify": { "version": "3.9.0", "resolved": "https://registry.npmjs.org/watchify/-/watchify-3.9.0.tgz", @@ -18444,7 +18757,6 @@ "integrity": "sha512-gKfOsNQv/toWz+60nSPfYzuwSEdzvV2WdxrVPUbPD/qui44rAkB3t3muNtmmGYHqrG56FGwX9SUEQmzNLAeS7g==", "dev": true, "requires": { - "JSONStream": "1.3.1", "assert": "1.4.1", "browser-pack": "6.0.2", "browser-resolve": "1.11.2", @@ -18466,6 +18778,7 @@ "https-browserify": "1.0.0", "inherits": "2.0.3", "insert-module-globals": "7.0.1", + "JSONStream": "1.3.1", "labeled-stream-splicer": "2.0.0", "module-deps": "4.1.1", "os-browserify": "0.3.0", @@ -18550,6 +18863,182 @@ "defaults": "1.0.3" } }, + "wd": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/wd/-/wd-1.4.1.tgz", + "integrity": "sha512-C0wWd2X4SWWcyx5qxaixiZE4Vb07sl0yDfWHPeml8lDHSbmI9erE9BmTHIqOGoDxGgJ3/hkFmODQ7ZLKiF8+8Q==", + "dev": true, + "requires": { + "archiver": "1.3.0", + "async": "2.0.1", + "lodash": "4.16.2", + "mkdirp": "0.5.1", + "q": "1.4.1", + "request": "2.79.0", + "underscore.string": "3.3.4", + "vargs": "0.1.0" + }, + "dependencies": { + "assert-plus": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-0.2.0.tgz", + "integrity": "sha1-104bh+ev/A24qttwIfP+SBAasjQ=", + "dev": true + }, + "async": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/async/-/async-2.0.1.tgz", + "integrity": "sha1-twnMAoCpw28J9FNr6CPIOKkEniU=", + "dev": true, + "requires": { + "lodash": "4.16.2" + } + }, + "aws-sign2": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.6.0.tgz", + "integrity": "sha1-FDQt0428yU0OW4fXY81jYSwOeU8=", + "dev": true + }, + "boom": { + "version": "2.10.1", + "resolved": "https://registry.npmjs.org/boom/-/boom-2.10.1.tgz", + "integrity": "sha1-OciRjO/1eZ+D+UkqhI9iWt0Mdm8=", + "dev": true, + "requires": { + "hoek": "2.16.3" + } + }, + "caseless": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.11.0.tgz", + "integrity": "sha1-cVuW6phBWTzDMGeSP17GDr2k99c=", + "dev": true + }, + "cryptiles": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-2.0.5.tgz", + "integrity": "sha1-O9/s3GCBR8HGcgL6KR59ylnqo7g=", + "dev": true, + "requires": { + "boom": "2.10.1" + } + }, + "form-data": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.1.4.tgz", + "integrity": "sha1-M8GDrPGTJ27KqYFDpp6Uv+4XUNE=", + "dev": true, + "requires": { + "asynckit": "0.4.0", + "combined-stream": "1.0.5", + "mime-types": "2.1.17" + } + }, + "har-validator": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-2.0.6.tgz", + "integrity": "sha1-zcvAgYgmWtEZtqWnyKtw7s+10n0=", + "dev": true, + "requires": { + "chalk": "1.1.3", + "commander": "2.11.0", + "is-my-json-valid": "2.16.1", + "pinkie-promise": "2.0.1" + } + }, + "hawk": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/hawk/-/hawk-3.1.3.tgz", + "integrity": "sha1-B4REvXwWQLD+VA0sm3PVlnjo4cQ=", + "dev": true, + "requires": { + "boom": "2.10.1", + "cryptiles": "2.0.5", + "hoek": "2.16.3", + "sntp": "1.0.9" + } + }, + "hoek": { + "version": "2.16.3", + "resolved": "https://registry.npmjs.org/hoek/-/hoek-2.16.3.tgz", + "integrity": "sha1-ILt0A9POo5jpHcRxCo/xuCdKJe0=", + "dev": true + }, + "http-signature": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.1.1.tgz", + "integrity": "sha1-33LiZwZs0Kxn+3at+OE0qPvPkb8=", + "dev": true, + "requires": { + "assert-plus": "0.2.0", + "jsprim": "1.4.1", + "sshpk": "1.13.1" + } + }, + "lodash": { + "version": "4.16.2", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.16.2.tgz", + "integrity": "sha1-PmJtuCcEimmSgaihJSJjJs/A5lI=", + "dev": true + }, + "q": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/q/-/q-1.4.1.tgz", + "integrity": "sha1-VXBbzZPF82c1MMLCy8DCs63cKG4=", + "dev": true + }, + "qs": { + "version": "6.3.2", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.3.2.tgz", + "integrity": "sha1-51vV9uJoEioqDgvaYwslUMFmUCw=", + "dev": true + }, + "request": { + "version": "2.79.0", + "resolved": "https://registry.npmjs.org/request/-/request-2.79.0.tgz", + "integrity": "sha1-Tf5b9r6LjNw3/Pk+BLZVd3InEN4=", + "dev": true, + "requires": { + "aws-sign2": "0.6.0", + "aws4": "1.6.0", + "caseless": "0.11.0", + "combined-stream": "1.0.5", + "extend": "3.0.1", + "forever-agent": "0.6.1", + "form-data": "2.1.4", + "har-validator": "2.0.6", + "hawk": "3.1.3", + "http-signature": "1.1.1", + "is-typedarray": "1.0.0", + "isstream": "0.1.2", + "json-stringify-safe": "5.0.1", + "mime-types": "2.1.17", + "oauth-sign": "0.8.2", + "qs": "6.3.2", + "stringstream": "0.0.5", + "tough-cookie": "2.3.3", + "tunnel-agent": "0.4.3", + "uuid": "3.1.0" + } + }, + "sntp": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/sntp/-/sntp-1.0.9.tgz", + "integrity": "sha1-ZUEYTMkK7qbG57NeJlkIJEPGYZg=", + "dev": true, + "requires": { + "hoek": "2.16.3" + } + }, + "tunnel-agent": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.4.3.tgz", + "integrity": "sha1-Y3PbdpCf5XDgjXNYM2Xtgop07us=", + "dev": true + } + } + }, "webidl-conversions": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-4.0.2.tgz", @@ -18898,6 +19387,18 @@ "resolved": "https://registry.npmjs.org/yeast/-/yeast-0.1.2.tgz", "integrity": "sha1-AI4G2AlDIMNy28L47XagymyKxBk=", "dev": true + }, + "zip-stream": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/zip-stream/-/zip-stream-1.2.0.tgz", + "integrity": "sha1-qLxF9MG0lpnGuQGYuqyqzbzUugQ=", + "dev": true, + "requires": { + "archiver-utils": "1.3.0", + "compress-commons": "1.2.2", + "lodash": "4.17.4", + "readable-stream": "2.3.3" + } } } } diff --git a/package.json b/package.json index 1266d630..02374e11 100644 --- a/package.json +++ b/package.json @@ -2,17 +2,15 @@ "private": true, "scripts": { "checkFormat": "npm run prettier -- --list-different", - "compile": "gulp build:cjs", + "compile": "lerna run compile", "format": "npm run prettier -- --write", "lerna": "lerna bootstrap -- --no-optional && npm install --no-optional", "lint": "eslint 'packages/metal*/{src,test}/**/*.js'", "precommit": "lint-staged", "prettier": "prettier-eslint 'packages/metal*/{src,test}/**/*.js'", - "test": "gulp test && npm run test:isomorphic", - "test:coverage": "gulp test:coverage", - "test:coverage:open": "gulp test:coverage:open", - "test:isomorphic": "gulp soy:isomorphic && mocha packages/metal-isomorphic/test/isomorphic.js --compilers js:babel-core/register", - "test:watch": "gulp test:watch" + "test": "gulp soy && karma start && npm run test:isomorphic", + "test:coverage": "karma start karma-coverage.conf.js", + "test:isomorphic": "gulp soy:isomorphic && mocha packages/metal-isomorphic/test/isomorphic.js --compilers js:babel-core/register" }, "devDependencies": { "babel-core": "^6.26.0", @@ -26,18 +24,18 @@ "eslint-config-liferay": "^2.0.9", "eslint-plugin-react": "^7.4.0", "gulp": "^3.8.11", - "gulp-babel": "^6.1.2", - "gulp-metal": "^1.0.0", "gulp-replace": "^0.5.4", "husky": "^0.14.3", "jsdom": "^9.9.1", "jsdom-global": "^2.1.1", "karma": "^1.1.0", - "karma-browserify": "^5.0.5", + "karma-babel-preprocessor": "^7.0.0", + "karma-browserify": "^5.1.2", "karma-chai": "^0.1.0", "karma-chrome-launcher": "^1.0.1", - "karma-coverage": "^1.1.0", - "karma-mocha": "^1.0.1", + "karma-coverage": "^1.1.1", + "karma-mocha": "^1.3.0", + "karma-sauce-launcher": "~1.1.0", "karma-sinon": "^1.0.5", "karma-source-map-support": "^1.1.0", "lerna": "^2.2.0", From b56b4c79beb58f193e0bbef33da0a58746234c3e Mon Sep 17 00:00:00 2001 From: Robert-Frampton Date: Tue, 21 Nov 2017 10:41:34 -0800 Subject: [PATCH 24/70] Regen package-lock.json --- package-lock.json | 8594 ++------------------------------------------- 1 file changed, 362 insertions(+), 8232 deletions(-) diff --git a/package-lock.json b/package-lock.json index 8090108a..8e756c40 100644 --- a/package-lock.json +++ b/package-lock.json @@ -93,9 +93,9 @@ } }, "ajv": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.3.0.tgz", - "integrity": "sha1-RBT/dKUIecII7l/cgm4ywwNUnto=", + "version": "5.4.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.4.0.tgz", + "integrity": "sha1-MtHPCNvIDEMvQm8S4QslEfa0ZHQ=", "dev": true, "requires": { "co": "4.6.0", @@ -417,32 +417,6 @@ "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", "dev": true }, - "autoprefixer": { - "version": "6.7.7", - "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-6.7.7.tgz", - "integrity": "sha1-Hb0cg1ZY41zj+ZhAmdsAWFx4IBQ=", - "dev": true, - "requires": { - "browserslist": "1.7.7", - "caniuse-db": "1.0.30000760", - "normalize-range": "0.1.2", - "num2fraction": "1.2.2", - "postcss": "5.2.18", - "postcss-value-parser": "3.3.0" - }, - "dependencies": { - "browserslist": { - "version": "1.7.7", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-1.7.7.tgz", - "integrity": "sha1-C9dnBCWL6CmyOYu1Dkti0aFmsLk=", - "dev": true, - "requires": { - "caniuse-db": "1.0.30000760", - "electron-to-chromium": "1.3.27" - } - } - } - }, "aws-sign2": { "version": "0.7.0", "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", @@ -1017,7 +991,7 @@ "babel-plugin-transform-es2015-unicode-regex": "6.24.1", "babel-plugin-transform-exponentiation-operator": "6.24.1", "babel-plugin-transform-regenerator": "6.26.0", - "browserslist": "2.8.0", + "browserslist": "2.9.0", "invariant": "2.2.2", "semver": "5.4.1" } @@ -1170,9 +1144,9 @@ } }, "binary-extensions": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-1.10.0.tgz", - "integrity": "sha1-muuabF6IY4qtFx4Wf1kAq+JINdA=", + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-1.11.0.tgz", + "integrity": "sha1-RqoXUftqL5PuXmibsQh9SxTGwgU=", "dev": true }, "binaryextensions": { @@ -1424,12 +1398,12 @@ } }, "browserslist": { - "version": "2.8.0", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-2.8.0.tgz", - "integrity": "sha512-iiWHM1Et6Q4TQpB7Ar6pxuM3TNMXasVJY4Y/oh3q38EwR3Z+IdZ9MyVf7PI4MJFB4xpwMcZgs9bEUnPG2E3TCA==", + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-2.9.0.tgz", + "integrity": "sha512-vJEBcDTANoDhSHL46NeOEW5hvQw7It9uCqzeFPQhpawXfnOwnpvW5C97vn1eGJ7iCkSg8wWU0nYObE7d/N95Iw==", "dev": true, "requires": { - "caniuse-lite": "1.0.30000760", + "caniuse-lite": "1.0.30000769", "electron-to-chromium": "1.3.27" } }, @@ -1523,16 +1497,10 @@ "map-obj": "1.0.1" } }, - "caniuse-db": { - "version": "1.0.30000760", - "resolved": "https://registry.npmjs.org/caniuse-db/-/caniuse-db-1.0.30000760.tgz", - "integrity": "sha1-PqKUc+t4psywny63Osnh3r/sUo0=", - "dev": true - }, "caniuse-lite": { - "version": "1.0.30000760", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000760.tgz", - "integrity": "sha1-7HIDlXQvHH7IlH/W3SYE53qPmP8=", + "version": "1.0.30000769", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000769.tgz", + "integrity": "sha1-1oxaoHcuo+rGyX1C4jnJtNMmG5M=", "dev": true }, "capture-stack-trace": { @@ -1582,6 +1550,12 @@ "supports-color": "2.0.0" } }, + "chardet": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.4.0.tgz", + "integrity": "sha1-C74TVaxE16PtSpJXB8TvcPgZD2w=", + "dev": true + }, "chokidar": { "version": "1.7.0", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-1.7.0.tgz", @@ -1590,7 +1564,7 @@ "requires": { "anymatch": "1.3.2", "async-each": "1.0.1", - "fsevents": "1.1.2", + "fsevents": "1.1.3", "glob-parent": "2.0.0", "inherits": "2.0.3", "is-binary-path": "1.0.1", @@ -1600,9 +1574,9 @@ } }, "ci-info": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-1.1.1.tgz", - "integrity": "sha512-vHDDF/bP9RYpTWtUhpJRhCFdvvp3iDWvEbuDbWgvjUrNGV1MXJrE0MPcwGtEled04m61iwdBLUIHZtDgzWS4ZQ==", + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-1.1.2.tgz", + "integrity": "sha512-uTGIPNx/nSpBdsF6xnseRXLLtfr9VLqkz8ZqHXr3Y7b6SftyRxBGjwMtJj1OhNbmlc1wZzLNAlAcvyIiE8a6ZA==", "dev": true }, "cipher-base": { @@ -1962,27 +1936,27 @@ "dev": true }, "conventional-changelog": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/conventional-changelog/-/conventional-changelog-1.1.6.tgz", - "integrity": "sha512-AaQRALJYQVbfMs0UYJ3jf5yIAJwGnm/E7ETwzZMwF/3JDMyDaa4agLQomz94pcYiGH7zcrxFcwHApSODOYnunA==", + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/conventional-changelog/-/conventional-changelog-1.1.7.tgz", + "integrity": "sha1-kVGmKx2O2y2CcR2r9bfPcQQfgrE=", "dev": true, "requires": { - "conventional-changelog-angular": "1.5.1", - "conventional-changelog-atom": "0.1.1", - "conventional-changelog-codemirror": "0.2.0", - "conventional-changelog-core": "1.9.2", - "conventional-changelog-ember": "0.2.8", - "conventional-changelog-eslint": "0.2.0", - "conventional-changelog-express": "0.2.0", + "conventional-changelog-angular": "1.5.2", + "conventional-changelog-atom": "0.1.2", + "conventional-changelog-codemirror": "0.2.1", + "conventional-changelog-core": "1.9.3", + "conventional-changelog-ember": "0.2.9", + "conventional-changelog-eslint": "0.2.1", + "conventional-changelog-express": "0.2.1", "conventional-changelog-jquery": "0.1.0", "conventional-changelog-jscs": "0.1.0", - "conventional-changelog-jshint": "0.2.0" + "conventional-changelog-jshint": "0.2.1" } }, "conventional-changelog-angular": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/conventional-changelog-angular/-/conventional-changelog-angular-1.5.1.tgz", - "integrity": "sha512-AnjnPyqHp8yR2IOWsXYOCv6Ly0WC2rLRK04fgAS/5QoA3ovYLSoz9PKB5pcSG3M9lAf40IqZwU3R3G6Hy7XCSA==", + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/conventional-changelog-angular/-/conventional-changelog-angular-1.5.2.tgz", + "integrity": "sha1-Kzj2Zf6cWSCvGi+C9Uf0ur5t5Xw=", "dev": true, "requires": { "compare-func": "1.3.2", @@ -1990,49 +1964,49 @@ } }, "conventional-changelog-atom": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/conventional-changelog-atom/-/conventional-changelog-atom-0.1.1.tgz", - "integrity": "sha512-6Nlu/+MiD4gi7k3Z+N1vMJWpaPSdvFPWzPGnH4OXewHAxiAl0L/TT9CGgA01fosPxmYr4hMNtD7kyN0tkg8vIA==", + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/conventional-changelog-atom/-/conventional-changelog-atom-0.1.2.tgz", + "integrity": "sha1-Ella1SZ6aTfDTPkAKBscZRmKTGM=", "dev": true, "requires": { "q": "1.5.1" } }, "conventional-changelog-cli": { - "version": "1.3.4", - "resolved": "https://registry.npmjs.org/conventional-changelog-cli/-/conventional-changelog-cli-1.3.4.tgz", - "integrity": "sha512-b8B1i01df+Lq5t16L3g8uoEGdzViChIKmIo7TComL4DqqrjrtasRaT+/4OPGcApEgX86JkBqb4KVt85ytQinUw==", + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/conventional-changelog-cli/-/conventional-changelog-cli-1.3.5.tgz", + "integrity": "sha1-RsUUliFrdAZYiIPe+m+sWJ6bsx4=", "dev": true, "requires": { "add-stream": "1.0.0", - "conventional-changelog": "1.1.6", + "conventional-changelog": "1.1.7", "lodash": "4.17.4", "meow": "3.7.0", "tempfile": "1.1.1" } }, "conventional-changelog-codemirror": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/conventional-changelog-codemirror/-/conventional-changelog-codemirror-0.2.0.tgz", - "integrity": "sha512-jUbY98JoKdAOR5k3pOBiKZ+Iz9t2F84hL7x4WjSRW6x7FdeCEUOjyfml+YClE2h/h62Tf3mwur5jSO8upxxc1g==", + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/conventional-changelog-codemirror/-/conventional-changelog-codemirror-0.2.1.tgz", + "integrity": "sha1-KZpPcUe681DmyBWPxUlUopHFzAk=", "dev": true, "requires": { "q": "1.5.1" } }, "conventional-changelog-core": { - "version": "1.9.2", - "resolved": "https://registry.npmjs.org/conventional-changelog-core/-/conventional-changelog-core-1.9.2.tgz", - "integrity": "sha512-L/boGKXaKWrlCU8bHa1QM36Pb/JopCPmekj5SFqqAuBfjya860xX2fAC5Ggelse++Bw39AZ2NrHwBnJrdwLlLw==", + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/conventional-changelog-core/-/conventional-changelog-core-1.9.3.tgz", + "integrity": "sha1-KJn+d5OJoynw7EsnRsNt3vuY2i0=", "dev": true, "requires": { - "conventional-changelog-writer": "2.0.1", - "conventional-commits-parser": "2.0.0", + "conventional-changelog-writer": "2.0.2", + "conventional-commits-parser": "2.0.1", "dateformat": "1.0.12", "get-pkg-repo": "1.4.0", - "git-raw-commits": "1.2.0", + "git-raw-commits": "1.3.0", "git-remote-origin-url": "2.0.0", - "git-semver-tags": "1.2.2", + "git-semver-tags": "1.2.3", "lodash": "4.17.4", "normalize-package-data": "2.4.0", "q": "1.5.1", @@ -2054,27 +2028,27 @@ } }, "conventional-changelog-ember": { - "version": "0.2.8", - "resolved": "https://registry.npmjs.org/conventional-changelog-ember/-/conventional-changelog-ember-0.2.8.tgz", - "integrity": "sha512-smsh0o/S95n22lrQZrSHYjJrxIGoFl+OFHK+q2KGHA2zRFrW7QilYM7VUjgmB+emzwqFguPjrq+D2U8iPhMNJg==", + "version": "0.2.9", + "resolved": "https://registry.npmjs.org/conventional-changelog-ember/-/conventional-changelog-ember-0.2.9.tgz", + "integrity": "sha1-jsc8wFTjqwZGZ/sf61L+jvGxZDg=", "dev": true, "requires": { "q": "1.5.1" } }, "conventional-changelog-eslint": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/conventional-changelog-eslint/-/conventional-changelog-eslint-0.2.0.tgz", - "integrity": "sha512-WGKnC0bGPD6BHGiRBfYqNGfy6DZDn2jGs1yxPRT8I2796wYdGqsbDF4477o4fdsxUJvckoW2OFPqkmRMQaCHSA==", + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/conventional-changelog-eslint/-/conventional-changelog-eslint-0.2.1.tgz", + "integrity": "sha1-LCoRvrIW+AZJunKDQYApO2h8BmI=", "dev": true, "requires": { "q": "1.5.1" } }, "conventional-changelog-express": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/conventional-changelog-express/-/conventional-changelog-express-0.2.0.tgz", - "integrity": "sha512-ujSEmbWfozC1iIjH5Pl7AKtREowvAl10whs1q6c7nZLnoNZK5CmdB2PQ/V42O6rCgUzaLX+ACRW2+g0A/Htqvw==", + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/conventional-changelog-express/-/conventional-changelog-express-0.2.1.tgz", + "integrity": "sha1-g42eHmyQmXA7FQucGaoteBdCvWw=", "dev": true, "requires": { "q": "1.5.1" @@ -2099,9 +2073,9 @@ } }, "conventional-changelog-jshint": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/conventional-changelog-jshint/-/conventional-changelog-jshint-0.2.0.tgz", - "integrity": "sha512-uUP4c0et6F2teapl+YY2JHFAHD401U5CkgI+P8PyU0y1zS8BdBy6EnhqgZEXhFOp9fPzUdic+Wv/9alOqw3agQ==", + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/conventional-changelog-jshint/-/conventional-changelog-jshint-0.2.1.tgz", + "integrity": "sha1-hhObs6yZiZ8rF36WF+CbN9mbzzo=", "dev": true, "requires": { "compare-func": "1.3.2", @@ -2109,13 +2083,13 @@ } }, "conventional-changelog-writer": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/conventional-changelog-writer/-/conventional-changelog-writer-2.0.1.tgz", - "integrity": "sha512-X4qC758celQOKw0iUPAsH5sJX6fH6N5dboFc3elXb1/SIKhsYMukhhaxWmxRdtVUSqGt9rZg8giwBQG5B2GeKg==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/conventional-changelog-writer/-/conventional-changelog-writer-2.0.2.tgz", + "integrity": "sha1-tYV97RsAHa+aeLnNQJJvRcE0lJs=", "dev": true, "requires": { "compare-func": "1.3.2", - "conventional-commits-filter": "1.0.0", + "conventional-commits-filter": "1.1.0", "dateformat": "1.0.12", "handlebars": "4.0.11", "json-stringify-safe": "5.0.1", @@ -2139,9 +2113,9 @@ } }, "conventional-commits-filter": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/conventional-commits-filter/-/conventional-commits-filter-1.0.0.tgz", - "integrity": "sha1-b8KmWTcrw/IznPn//34bA0S5MDk=", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/conventional-commits-filter/-/conventional-commits-filter-1.1.0.tgz", + "integrity": "sha1-H8Ka8wte2rdvVOIpxBGwxmPQ+es=", "dev": true, "requires": { "is-subset": "0.1.1", @@ -2149,9 +2123,9 @@ } }, "conventional-commits-parser": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/conventional-commits-parser/-/conventional-commits-parser-2.0.0.tgz", - "integrity": "sha512-8od6g684Fhi5Vpp4ABRv/RBsW1AY6wSHbJHEK6FGTv+8jvAAnlABniZu/FVmX9TcirkHepaEsa1QGkRvbg0CKw==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/conventional-commits-parser/-/conventional-commits-parser-2.0.1.tgz", + "integrity": "sha1-HxXOa4RPfKQUlcgZDAgzwwuLFpM=", "dev": true, "requires": { "is-text-path": "1.0.1", @@ -2164,16 +2138,16 @@ } }, "conventional-recommended-bump": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/conventional-recommended-bump/-/conventional-recommended-bump-1.0.2.tgz", - "integrity": "sha512-kC4EvXsc+flKpmD0Aa98qVGG7qGqLsVswVT0ijicXiNPBkGQAOMPYg+JoFjBXAWYWw4Y6RsiEDL+JKLrp0RqXQ==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/conventional-recommended-bump/-/conventional-recommended-bump-1.0.3.tgz", + "integrity": "sha1-RytpsbjwnFxO1A/iikHmPMBL1zY=", "dev": true, "requires": { "concat-stream": "1.5.2", - "conventional-commits-filter": "1.0.0", - "conventional-commits-parser": "2.0.0", - "git-raw-commits": "1.2.0", - "git-semver-tags": "1.2.2", + "conventional-commits-filter": "1.1.0", + "conventional-commits-parser": "2.0.1", + "git-raw-commits": "1.3.0", + "git-semver-tags": "1.2.3", "meow": "3.7.0", "object-assign": "4.1.1" } @@ -2367,15 +2341,6 @@ "integrity": "sha1-XQKkaFCt8bSjF5RqOSj8y1v9BCU=", "dev": true }, - "d": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/d/-/d-1.0.0.tgz", - "integrity": "sha1-dUu1v+VUUdpppYuU1F9MWwRi1Y8=", - "dev": true, - "requires": { - "es5-ext": "0.10.35" - } - }, "dargs": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/dargs/-/dargs-4.1.0.tgz", @@ -2891,535 +2856,146 @@ "is-symbol": "1.0.1" } }, - "es5-ext": { - "version": "0.10.35", - "resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.35.tgz", - "integrity": "sha1-GO6FjOajxFx9eekcFfzKnsVoSU8=", - "dev": true, - "requires": { - "es6-iterator": "2.0.3", - "es6-symbol": "3.1.1" - } + "escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=", + "dev": true }, - "es6-iterator": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/es6-iterator/-/es6-iterator-2.0.3.tgz", - "integrity": "sha1-p96IkUGgWpSwhUQDstCg+/qY87c=", - "dev": true, - "requires": { - "d": "1.0.0", - "es5-ext": "0.10.35", - "es6-symbol": "3.1.1" - } + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "dev": true }, - "es6-map": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/es6-map/-/es6-map-0.1.5.tgz", - "integrity": "sha1-kTbgUD3MBqMBaQ8LsU/042TpSfA=", + "escodegen": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.9.0.tgz", + "integrity": "sha512-v0MYvNQ32bzwoG2OSFzWAkuahDQHK92JBN0pTAALJ4RIxEZe766QJPDR8Hqy7XNUy5K3fnVL76OqYAdc4TZEIw==", "dev": true, "requires": { - "d": "1.0.0", - "es5-ext": "0.10.35", - "es6-iterator": "2.0.3", - "es6-set": "0.1.5", - "es6-symbol": "3.1.1", - "event-emitter": "0.3.5" + "esprima": "3.1.3", + "estraverse": "4.2.0", + "esutils": "2.0.2", + "optionator": "0.8.2", + "source-map": "0.5.7" + }, + "dependencies": { + "esprima": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-3.1.3.tgz", + "integrity": "sha1-/cpRzuYTOJXjyI1TXOSdv/YqRjM=", + "dev": true + } } }, - "es6-plato": { - "version": "1.0.14", - "resolved": "https://registry.npmjs.org/es6-plato/-/es6-plato-1.0.14.tgz", - "integrity": "sha1-CSfhXORiC9+OEfBaTVwd3GveW3s=", + "eslint": { + "version": "4.11.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-4.11.0.tgz", + "integrity": "sha512-UWbhQpaKlm8h5x/VLwm0S1kheMrDj8jPwhnBMjr/Dlo3qqT7MvcN/UfKAR3E1N4lr4YNtOvS4m3hwsrVc/ky7g==", "dev": true, "requires": { - "eslint": "3.19.0", - "fs-extra": "2.1.2", + "ajv": "5.4.0", + "babel-code-frame": "6.26.0", + "chalk": "2.3.0", + "concat-stream": "1.6.0", + "cross-spawn": "5.1.0", + "debug": "3.1.0", + "doctrine": "2.0.0", + "eslint-scope": "3.7.1", + "espree": "3.5.2", + "esquery": "1.0.0", + "estraverse": "4.2.0", + "esutils": "2.0.2", + "file-entry-cache": "2.0.0", + "functional-red-black-tree": "1.0.1", "glob": "7.1.2", + "globals": "9.18.0", + "ignore": "3.3.7", + "imurmurhash": "0.1.4", + "inquirer": "3.3.0", + "is-resolvable": "1.0.0", + "js-yaml": "3.10.0", + "json-stable-stringify-without-jsonify": "1.0.1", + "levn": "0.3.0", "lodash": "4.17.4", - "posix-getopt": "1.2.0", - "typhonjs-escomplex": "0.0.12" + "minimatch": "3.0.4", + "mkdirp": "0.5.1", + "natural-compare": "1.4.0", + "optionator": "0.8.2", + "path-is-inside": "1.0.2", + "pluralize": "7.0.0", + "progress": "2.0.0", + "require-uncached": "1.0.3", + "semver": "5.4.1", + "strip-ansi": "4.0.0", + "strip-json-comments": "2.0.1", + "table": "4.0.2", + "text-table": "0.2.0" }, "dependencies": { - "ajv": { - "version": "4.11.8", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-4.11.8.tgz", - "integrity": "sha1-gv+wKynmYq5TvcIK8VlHcGc5xTY=", - "dev": true, - "requires": { - "co": "4.6.0", - "json-stable-stringify": "1.0.1" - } - }, - "ajv-keywords": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-1.5.1.tgz", - "integrity": "sha1-MU3QpLM2j609/NxU7eYXG4htrzw=", - "dev": true - }, - "ansi-escapes": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-1.4.0.tgz", - "integrity": "sha1-06ioOzGapneTZisT52HHkRQiMG4=", + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", "dev": true }, - "cli-cursor": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-1.0.2.tgz", - "integrity": "sha1-ZNo/fValRBLll5S9Ytw1KV6PKYc=", - "dev": true, - "requires": { - "restore-cursor": "1.0.1" - } - }, - "eslint": { - "version": "3.19.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-3.19.0.tgz", - "integrity": "sha1-yPxiAcf0DdCJQbh8CFdnOGpnmsw=", + "ansi-styles": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", + "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", "dev": true, "requires": { - "babel-code-frame": "6.26.0", - "chalk": "1.1.3", - "concat-stream": "1.5.2", - "debug": "2.6.9", - "doctrine": "2.0.0", - "escope": "3.6.0", - "espree": "3.5.1", - "esquery": "1.0.0", - "estraverse": "4.2.0", - "esutils": "2.0.2", - "file-entry-cache": "2.0.0", - "glob": "7.1.2", - "globals": "9.18.0", - "ignore": "3.3.7", - "imurmurhash": "0.1.4", - "inquirer": "0.12.0", - "is-my-json-valid": "2.16.1", - "is-resolvable": "1.0.0", - "js-yaml": "3.10.0", - "json-stable-stringify": "1.0.1", - "levn": "0.3.0", - "lodash": "4.17.4", - "mkdirp": "0.5.1", - "natural-compare": "1.4.0", - "optionator": "0.8.2", - "path-is-inside": "1.0.2", - "pluralize": "1.2.1", - "progress": "1.1.8", - "require-uncached": "1.0.3", - "shelljs": "0.7.8", - "strip-bom": "3.0.0", - "strip-json-comments": "2.0.1", - "table": "3.8.3", - "text-table": "0.2.0", - "user-home": "2.0.0" + "color-convert": "1.9.1" } }, - "figures": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/figures/-/figures-1.7.0.tgz", - "integrity": "sha1-y+Hjr/zxzUS4DK3+0o3Hk6lwHS4=", + "chalk": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.0.tgz", + "integrity": "sha512-Az5zJR2CBujap2rqXGaJKaPHyJ0IrUimvYNX+ncCy8PJP4ltOGTrHUIo097ZaL2zMeKYpiCdqDvS6zdrTFok3Q==", "dev": true, "requires": { + "ansi-styles": "3.2.0", "escape-string-regexp": "1.0.5", - "object-assign": "4.1.1" - } - }, - "inquirer": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-0.12.0.tgz", - "integrity": "sha1-HvK/1jUE3wvHV4X/+MLEHfEvB34=", - "dev": true, - "requires": { - "ansi-escapes": "1.4.0", - "ansi-regex": "2.1.1", - "chalk": "1.1.3", - "cli-cursor": "1.0.2", - "cli-width": "2.2.0", - "figures": "1.7.0", - "lodash": "4.17.4", - "readline2": "1.0.1", - "run-async": "0.1.0", - "rx-lite": "3.1.2", - "string-width": "1.0.2", - "strip-ansi": "3.0.1", - "through": "2.3.8" - } - }, - "is-fullwidth-code-point": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", - "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", - "dev": true, - "requires": { - "number-is-nan": "1.0.1" + "supports-color": "4.5.0" } }, - "json-stable-stringify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz", - "integrity": "sha1-mnWdOcXy/1A/1TAGRu1EX4jE+a8=", + "concat-stream": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.0.tgz", + "integrity": "sha1-CqxmL9Ur54lk1VMvaUeE5wEQrPc=", "dev": true, "requires": { - "jsonify": "0.0.0" + "inherits": "2.0.3", + "readable-stream": "2.3.3", + "typedarray": "0.0.6" } }, - "onetime": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/onetime/-/onetime-1.1.0.tgz", - "integrity": "sha1-ofeDj4MUxRbwXs78vEzP4EtO14k=", - "dev": true - }, - "pluralize": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/pluralize/-/pluralize-1.2.1.tgz", - "integrity": "sha1-0aIUg/0iu0HlihL6NCGCMUCJfEU=", - "dev": true - }, - "progress": { - "version": "1.1.8", - "resolved": "https://registry.npmjs.org/progress/-/progress-1.1.8.tgz", - "integrity": "sha1-4mDHj2Fhzdmw5WzD4Khd4Xx6V74=", - "dev": true - }, - "restore-cursor": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-1.0.1.tgz", - "integrity": "sha1-NGYfRohjJ/7SmRR5FSJS35LapUE=", + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", "dev": true, "requires": { - "exit-hook": "1.1.1", - "onetime": "1.1.0" + "ms": "2.0.0" } }, - "run-async": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/run-async/-/run-async-0.1.0.tgz", - "integrity": "sha1-yK1KXhEGYeQCp9IbUw4AnyX444k=", + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", "dev": true, "requires": { - "once": "1.4.0" + "ansi-regex": "3.0.0" } }, - "rx-lite": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/rx-lite/-/rx-lite-3.1.2.tgz", - "integrity": "sha1-Gc5QLKVyZl87ZHsQk5+X/RYV8QI=", - "dev": true - }, - "slice-ansi": { - "version": "0.0.4", - "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-0.0.4.tgz", - "integrity": "sha1-7b+JA/ZvfOL46v1s7tZeJkyDGzU=", - "dev": true - }, - "string-width": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", - "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "supports-color": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz", + "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=", "dev": true, "requires": { - "code-point-at": "1.1.0", - "is-fullwidth-code-point": "1.0.0", - "strip-ansi": "3.0.1" - } - }, - "strip-bom": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", - "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", - "dev": true - }, - "table": { - "version": "3.8.3", - "resolved": "https://registry.npmjs.org/table/-/table-3.8.3.tgz", - "integrity": "sha1-K7xULw/amGGnVdOUf+/Ys/UThV8=", - "dev": true, - "requires": { - "ajv": "4.11.8", - "ajv-keywords": "1.5.1", - "chalk": "1.1.3", - "lodash": "4.17.4", - "slice-ansi": "0.0.4", - "string-width": "2.1.1" - }, - "dependencies": { - "ansi-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", - "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", - "dev": true - }, - "string-width": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", - "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", - "dev": true, - "requires": { - "is-fullwidth-code-point": "2.0.0", - "strip-ansi": "4.0.0" - } - }, - "strip-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", - "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", - "dev": true, - "requires": { - "ansi-regex": "3.0.0" - } - } - } - }, - "user-home": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/user-home/-/user-home-2.0.0.tgz", - "integrity": "sha1-nHC/2Babwdy/SGBODwS4tJzenp8=", - "dev": true, - "requires": { - "os-homedir": "1.0.2" - } - } - } - }, - "es6-set": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/es6-set/-/es6-set-0.1.5.tgz", - "integrity": "sha1-0rPsXU2ADO2BjbU40ol02wpzzLE=", - "dev": true, - "requires": { - "d": "1.0.0", - "es5-ext": "0.10.35", - "es6-iterator": "2.0.3", - "es6-symbol": "3.1.1", - "event-emitter": "0.3.5" - } - }, - "es6-symbol": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/es6-symbol/-/es6-symbol-3.1.1.tgz", - "integrity": "sha1-vwDvT9q2uhtG7Le2KbTH7VcVzHc=", - "dev": true, - "requires": { - "d": "1.0.0", - "es5-ext": "0.10.35" - } - }, - "es6-weak-map": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/es6-weak-map/-/es6-weak-map-2.0.2.tgz", - "integrity": "sha1-XjqzIlH/0VOKH45f+hNXdy+S2W8=", - "dev": true, - "requires": { - "d": "1.0.0", - "es5-ext": "0.10.35", - "es6-iterator": "2.0.3", - "es6-symbol": "3.1.1" - } - }, - "escape-html": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", - "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=", - "dev": true - }, - "escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", - "dev": true - }, - "escodegen": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.9.0.tgz", - "integrity": "sha512-v0MYvNQ32bzwoG2OSFzWAkuahDQHK92JBN0pTAALJ4RIxEZe766QJPDR8Hqy7XNUy5K3fnVL76OqYAdc4TZEIw==", - "dev": true, - "requires": { - "esprima": "3.1.3", - "estraverse": "4.2.0", - "esutils": "2.0.2", - "optionator": "0.8.2", - "source-map": "0.5.7" - }, - "dependencies": { - "esprima": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-3.1.3.tgz", - "integrity": "sha1-/cpRzuYTOJXjyI1TXOSdv/YqRjM=", - "dev": true - } - } - }, - "escomplex-plugin-metrics-module": { - "version": "0.0.13", - "resolved": "https://registry.npmjs.org/escomplex-plugin-metrics-module/-/escomplex-plugin-metrics-module-0.0.13.tgz", - "integrity": "sha1-uj/ir5obBi3uDhMJO3HtOJodcWg=", - "dev": true, - "requires": { - "typhonjs-escomplex-commons": "0.0.16" - } - }, - "escomplex-plugin-metrics-project": { - "version": "0.0.13", - "resolved": "https://registry.npmjs.org/escomplex-plugin-metrics-project/-/escomplex-plugin-metrics-project-0.0.13.tgz", - "integrity": "sha1-cDSXc/DEsZPVjyHqEDLRN1vvD0U=", - "dev": true, - "requires": { - "typhonjs-escomplex-commons": "0.0.16" - } - }, - "escomplex-plugin-syntax-babylon": { - "version": "0.0.13", - "resolved": "https://registry.npmjs.org/escomplex-plugin-syntax-babylon/-/escomplex-plugin-syntax-babylon-0.0.13.tgz", - "integrity": "sha1-bh8pnyAR1IfdK0rOtxQ4SKC/23I=", - "dev": true, - "requires": { - "escomplex-plugin-syntax-estree": "0.0.13", - "typhonjs-escomplex-commons": "0.0.16" - } - }, - "escomplex-plugin-syntax-estree": { - "version": "0.0.13", - "resolved": "https://registry.npmjs.org/escomplex-plugin-syntax-estree/-/escomplex-plugin-syntax-estree-0.0.13.tgz", - "integrity": "sha1-/BKGZxuMpo8fC4Abc2SwNBgvIUU=", - "dev": true, - "requires": { - "typhonjs-escomplex-commons": "0.0.16" - } - }, - "escope": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/escope/-/escope-3.6.0.tgz", - "integrity": "sha1-4Bl16BJ4GhY6ba392AOY3GTIicM=", - "dev": true, - "requires": { - "es6-map": "0.1.5", - "es6-weak-map": "2.0.2", - "esrecurse": "4.2.0", - "estraverse": "4.2.0" - } - }, - "eslint": { - "version": "4.10.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-4.10.0.tgz", - "integrity": "sha512-MMVl8P/dYUFZEvolL8PYt7qc5LNdS2lwheq9BYa5Y07FblhcZqFyaUqlS8TW5QITGex21tV4Lk0a3fK8lsJIkA==", - "dev": true, - "requires": { - "ajv": "5.3.0", - "babel-code-frame": "6.26.0", - "chalk": "2.3.0", - "concat-stream": "1.6.0", - "cross-spawn": "5.1.0", - "debug": "3.1.0", - "doctrine": "2.0.0", - "eslint-scope": "3.7.1", - "espree": "3.5.1", - "esquery": "1.0.0", - "estraverse": "4.2.0", - "esutils": "2.0.2", - "file-entry-cache": "2.0.0", - "functional-red-black-tree": "1.0.1", - "glob": "7.1.2", - "globals": "9.18.0", - "ignore": "3.3.7", - "imurmurhash": "0.1.4", - "inquirer": "3.3.0", - "is-resolvable": "1.0.0", - "js-yaml": "3.10.0", - "json-stable-stringify": "1.0.1", - "levn": "0.3.0", - "lodash": "4.17.4", - "minimatch": "3.0.4", - "mkdirp": "0.5.1", - "natural-compare": "1.4.0", - "optionator": "0.8.2", - "path-is-inside": "1.0.2", - "pluralize": "7.0.0", - "progress": "2.0.0", - "require-uncached": "1.0.3", - "semver": "5.4.1", - "strip-ansi": "4.0.0", - "strip-json-comments": "2.0.1", - "table": "4.0.2", - "text-table": "0.2.0" - }, - "dependencies": { - "ansi-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", - "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", - "dev": true - }, - "ansi-styles": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", - "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", - "dev": true, - "requires": { - "color-convert": "1.9.1" - } - }, - "chalk": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.0.tgz", - "integrity": "sha512-Az5zJR2CBujap2rqXGaJKaPHyJ0IrUimvYNX+ncCy8PJP4ltOGTrHUIo097ZaL2zMeKYpiCdqDvS6zdrTFok3Q==", - "dev": true, - "requires": { - "ansi-styles": "3.2.0", - "escape-string-regexp": "1.0.5", - "supports-color": "4.5.0" - } - }, - "concat-stream": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.0.tgz", - "integrity": "sha1-CqxmL9Ur54lk1VMvaUeE5wEQrPc=", - "dev": true, - "requires": { - "inherits": "2.0.3", - "readable-stream": "2.3.3", - "typedarray": "0.0.6" - } - }, - "debug": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", - "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, - "json-stable-stringify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz", - "integrity": "sha1-mnWdOcXy/1A/1TAGRu1EX4jE+a8=", - "dev": true, - "requires": { - "jsonify": "0.0.0" - } - }, - "strip-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", - "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", - "dev": true, - "requires": { - "ansi-regex": "3.0.0" - } - }, - "supports-color": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz", - "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=", - "dev": true, - "requires": { - "has-flag": "2.0.0" + "has-flag": "2.0.0" } } } @@ -3431,18 +3007,28 @@ "dev": true }, "eslint-config-liferay": { - "version": "2.0.9", - "resolved": "https://registry.npmjs.org/eslint-config-liferay/-/eslint-config-liferay-2.0.9.tgz", - "integrity": "sha512-SgAioMe/7JurwuSH6eiEXdnD/tzaPHtTotbQvzAXrPsXTOFYVE4gc6ZyuW6DootqDZrH+TCz+9UJmnCgSqxarA==", + "version": "2.0.16", + "resolved": "https://registry.npmjs.org/eslint-config-liferay/-/eslint-config-liferay-2.0.16.tgz", + "integrity": "sha512-ToBCKv7qVu9F3px/jXR2dUnUCJlvEdlgJoHFs+0ESzfwkJ1zx5c8Sydn86YI5jTJLzvmUWKiwk6JCwUMGme61A==", + "dev": true, + "requires": { + "eslint-config-google": "0.9.1", + "eslint-plugin-liferayportal": "1.0.1" + } + }, + "eslint-plugin-liferayportal": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-liferayportal/-/eslint-plugin-liferayportal-1.0.1.tgz", + "integrity": "sha512-YOqhDwqtj/K4BSH6ToMMTONHX7VASQoVv2iwPIsetD0aV5DywdTpdj0ZOA8eY9jmhfl+aFbbUjy6jD0YqE2suw==", "dev": true, "requires": { - "eslint-config-google": "0.9.1" + "requireindex": "1.1.0" } }, "eslint-plugin-react": { - "version": "7.4.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.4.0.tgz", - "integrity": "sha512-tvjU9u3VqmW2vVuYnE8Qptq+6ji4JltjOjJ9u7VAOxVYkUkyBZWRvNYKbDv5fN+L6wiA+4we9+qQahZ0m63XEA==", + "version": "7.5.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.5.1.tgz", + "integrity": "sha512-YGSjB9Qu6QbVTroUZi66pYky3DfoIPLdHQ/wmrBGyBRnwxQsBXAov9j2rpXt/55i8nyMv6IRWJv2s4d4YnduzQ==", "dev": true, "requires": { "doctrine": "2.0.0", @@ -3462,9 +3048,9 @@ } }, "espree": { - "version": "3.5.1", - "resolved": "https://registry.npmjs.org/espree/-/espree-3.5.1.tgz", - "integrity": "sha1-DJiLirRttTEAoZVK5LqZXd0n2H4=", + "version": "3.5.2", + "resolved": "https://registry.npmjs.org/espree/-/espree-3.5.2.tgz", + "integrity": "sha512-sadKeYwaR/aJ3stC2CdvgXu1T16TdYN+qwCpcWbMnGJ8s0zNWemzrvb2GbD4OhmJ/fwpJjudThAlLobGbWZbCQ==", "dev": true, "requires": { "acorn": "5.2.1", @@ -3516,16 +3102,6 @@ "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=", "dev": true }, - "event-emitter": { - "version": "0.3.5", - "resolved": "https://registry.npmjs.org/event-emitter/-/event-emitter-0.3.5.tgz", - "integrity": "sha1-34xp7vFkeSPHFXuc6DhAYQsCzDk=", - "dev": true, - "requires": { - "d": "1.0.0", - "es5-ext": "0.10.35" - } - }, "eventemitter3": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-1.2.0.tgz", @@ -3662,13 +3238,13 @@ } }, "external-editor": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-2.0.5.tgz", - "integrity": "sha512-Msjo64WT5W+NhOpQXh0nOHm+n0RfU1QUwDnKYvJ8dEJ8zlwLrqXNTv5mSUTJpepf41PDJGyhueTw2vNZW+Fr/w==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-2.1.0.tgz", + "integrity": "sha512-E44iT5QVOUJBKij4IIV3uvxuNlbKS38Tw1HiupxEIHPv9qtC2PrDYohbXV5U+1jnfIXttny8gUhj+oZvflFlzA==", "dev": true, "requires": { + "chardet": "0.4.0", "iconv-lite": "0.4.19", - "jschardet": "1.6.0", "tmp": "0.0.33" } }, @@ -3944,13 +3520,14 @@ "dev": true }, "fs-extra": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-2.1.2.tgz", - "integrity": "sha1-BGxwFjzvmq1GsOSn+kZ/si1x3jU=", + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-4.0.2.tgz", + "integrity": "sha1-+RcExT0bRh+JNFKwwwfZmXZHq2s=", "dev": true, "requires": { "graceful-fs": "4.1.11", - "jsonfile": "2.4.0" + "jsonfile": "4.0.0", + "universalify": "0.1.1" } }, "fs.realpath": { @@ -3960,14 +3537,14 @@ "dev": true }, "fsevents": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.1.2.tgz", - "integrity": "sha512-Sn44E5wQW4bTHXvQmvSHwqbuiXtduD6Rrjm2ZtUEGbyrig+nUH3t/QD4M4/ZXViY556TBpRgZkHLDx3JxPwxiw==", + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.1.3.tgz", + "integrity": "sha512-WIr7iDkdmdbxu/Gh6eKEZJL6KPE74/5MEsf2whTOFNxbIoIixogroLdKYqB6FDav4Wavh/lZdzzd3b2KxIXC5Q==", "dev": true, "optional": true, "requires": { - "nan": "2.7.0", - "node-pre-gyp": "0.6.36" + "nan": "2.8.0", + "node-pre-gyp": "0.6.39" }, "dependencies": { "abbrev": { @@ -4125,7 +3702,6 @@ "version": "2.0.5", "bundled": true, "dev": true, - "optional": true, "requires": { "boom": "2.10.1" } @@ -4173,6 +3749,12 @@ "dev": true, "optional": true }, + "detect-libc": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "optional": true + }, "ecc-jsbn": { "version": "0.1.1", "bundled": true, @@ -4314,7 +3896,6 @@ "version": "3.1.3", "bundled": true, "dev": true, - "optional": true, "requires": { "boom": "2.10.1", "cryptiles": "2.0.5", @@ -4486,11 +4067,13 @@ "optional": true }, "node-pre-gyp": { - "version": "0.6.36", + "version": "0.6.39", "bundled": true, "dev": true, "optional": true, "requires": { + "detect-libc": "1.0.2", + "hawk": "3.1.3", "mkdirp": "0.5.1", "nopt": "4.0.1", "npmlog": "4.1.0", @@ -4698,7 +4281,6 @@ "version": "1.0.9", "bundled": true, "dev": true, - "optional": true, "requires": { "hoek": "2.16.3" } @@ -4985,9 +4567,9 @@ } }, "git-raw-commits": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/git-raw-commits/-/git-raw-commits-1.2.0.tgz", - "integrity": "sha1-DzqL/ZmuDy2LkiTViJKXXppS0Dw=", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/git-raw-commits/-/git-raw-commits-1.3.0.tgz", + "integrity": "sha1-C8hZbpDV/+c29/VUa9LRL3OrqsY=", "dev": true, "requires": { "dargs": "4.1.0", @@ -5029,9 +4611,9 @@ } }, "git-semver-tags": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/git-semver-tags/-/git-semver-tags-1.2.2.tgz", - "integrity": "sha512-fhINopzKBQ8m6YlQt7gPf6T6hFnTF84O7U+8kYJmfjjKk7gbmKGj+BLcKNWi+japPbBwCeXXnfKwThpJpR9ZnQ==", + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/git-semver-tags/-/git-semver-tags-1.2.3.tgz", + "integrity": "sha1-GItFOIK/nXojr9Mbq6U32rc4jV0=", "dev": true, "requires": { "meow": "3.7.0", @@ -5377,7249 +4959,34 @@ } } }, - "gulp-autoprefixer": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/gulp-autoprefixer/-/gulp-autoprefixer-3.1.1.tgz", - "integrity": "sha1-dSMAUc0NFxND14O36bXREg7u+bA=", - "dev": true, - "requires": { - "autoprefixer": "6.7.7", - "gulp-util": "3.0.8", - "postcss": "5.2.18", - "through2": "2.0.3", - "vinyl-sourcemaps-apply": "0.2.1" - } - }, - "gulp-babel": { - "version": "6.1.2", - "resolved": "https://registry.npmjs.org/gulp-babel/-/gulp-babel-6.1.2.tgz", - "integrity": "sha1-fAF25Lo/JExgWIoMSzIKRdGt784=", - "dev": true, - "requires": { - "babel-core": "6.26.0", - "gulp-util": "3.0.8", - "object-assign": "4.1.1", - "replace-ext": "0.0.1", - "through2": "2.0.3", - "vinyl-sourcemaps-apply": "0.2.1" - } - }, - "gulp-if": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/gulp-if/-/gulp-if-2.0.2.tgz", - "integrity": "sha1-pJe351cwBQQcqivIt92jyARE1ik=", - "dev": true, - "requires": { - "gulp-match": "1.0.3", - "ternary-stream": "2.0.1", - "through2": "2.0.3" - } - }, - "gulp-ignore": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/gulp-ignore/-/gulp-ignore-2.0.2.tgz", - "integrity": "sha1-XC6ioKRALgq0orzRLv2SlTRNePI=", - "dev": true, - "requires": { - "gulp-match": "1.0.3", - "through2": "2.0.3" - } - }, - "gulp-match": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/gulp-match/-/gulp-match-1.0.3.tgz", - "integrity": "sha1-kcfA1/Kb7NZgbVfYCn+Hdqh6uo4=", - "dev": true, - "requires": { - "minimatch": "3.0.4" - } - }, - "gulp-metal": { - "version": "1.12.2", - "resolved": "https://registry.npmjs.org/gulp-metal/-/gulp-metal-1.12.2.tgz", - "integrity": "sha512-SfD7B/3gdc+go261GWql9i/08yq24ZKnTVSzdRpBvdn5n9yZXcWBghxW0zzAQxhgHGBNh1dKakT6i6NUtzcu9Q==", - "dev": true, - "requires": { - "babel-preset-es2015": "6.24.1", - "babel-register": "6.24.1", - "del": "2.2.2", - "es6-plato": "1.0.14", - "eslint": "3.19.0", - "glob-expand": "0.1.0", - "gulp": "3.9.1", - "gulp-autoprefixer": "3.1.1", - "gulp-concat": "2.6.1", - "gulp-esformatter": "5.0.0", - "gulp-eslint": "3.0.1", - "gulp-jshint": "2.0.4", - "gulp-mocha": "2.2.0", - "gulp-rename": "1.2.2", - "gulp-sass": "2.3.2", - "gulp-uglify": "1.5.4", - "gulp-util": "3.0.8", - "jsdoc": "3.4.3", - "jshint": "2.9.4", - "jshint-stylish": "2.2.1", - "karma": "1.7.0", - "karma-firefox-launcher": "0.1.7", - "karma-ievms": "0.1.0", - "karma-safari-launcher": "0.1.1", - "karma-sauce-launcher": "0.3.1", - "merge": "1.2.0", - "metal-karma-config": "2.3.1", - "metal-tools-build-amd": "3.0.3", - "metal-tools-build-globals": "2.0.2", - "metal-tools-build-jquery": "2.0.2", - "metal-tools-soy": "3.1.0", - "open": "0.0.5", - "run-sequence": "1.2.2", - "typhonjs-escomplex": "0.0.12" - }, - "dependencies": { - "abbrev": { - "version": "1.1.0", - "bundled": true, - "dev": true - }, - "accepts": { - "version": "1.3.3", - "bundled": true, - "dev": true, - "requires": { - "mime-types": "2.1.15", - "negotiator": "0.6.1" - } - }, - "acorn": { - "version": "5.0.3", - "bundled": true, - "dev": true - }, - "acorn-jsx": { - "version": "3.0.1", - "bundled": true, - "dev": true, - "requires": { - "acorn": "3.3.0" - }, - "dependencies": { - "acorn": { - "version": "3.3.0", - "bundled": true, - "dev": true - } - } - }, - "adm-zip": { - "version": "0.4.7", - "bundled": true, - "dev": true - }, - "after": { - "version": "0.8.2", - "bundled": true, - "dev": true - }, - "agent-base": { - "version": "2.1.1", - "bundled": true, - "dev": true, - "requires": { - "extend": "3.0.1", - "semver": "5.0.3" - }, - "dependencies": { - "semver": { - "version": "5.0.3", - "bundled": true, - "dev": true - } - } - }, - "ajv": { - "version": "4.11.8", - "bundled": true, - "dev": true, - "requires": { - "co": "4.6.0", - "json-stable-stringify": "1.0.1" - } - }, - "ajv-keywords": { - "version": "1.5.1", - "bundled": true, - "dev": true - }, - "align-text": { - "version": "0.1.4", - "bundled": true, - "dev": true, - "requires": { - "kind-of": "3.2.2", - "longest": "1.0.1", - "repeat-string": "1.6.1" - } - }, - "amdefine": { - "version": "1.0.1", - "bundled": true, - "dev": true - }, - "ansi-escapes": { - "version": "1.4.0", - "bundled": true, - "dev": true - }, - "ansi-regex": { - "version": "2.1.1", - "bundled": true, - "dev": true - }, - "ansi-styles": { - "version": "2.2.1", - "bundled": true, - "dev": true - }, - "anymatch": { - "version": "1.3.0", - "bundled": true, - "dev": true, - "requires": { - "arrify": "1.0.1", - "micromatch": "2.3.11" - } - }, - "aproba": { - "version": "1.1.2", - "bundled": true, - "dev": true - }, - "archiver": { - "version": "0.14.4", - "bundled": true, - "dev": true, - "requires": { - "async": "0.9.2", - "buffer-crc32": "0.2.13", - "glob": "4.3.5", - "lazystream": "0.1.0", - "lodash": "3.2.0", - "readable-stream": "1.0.34", - "tar-stream": "1.1.5", - "zip-stream": "0.5.2" - }, - "dependencies": { - "async": { - "version": "0.9.2", - "bundled": true, - "dev": true - }, - "glob": { - "version": "4.3.5", - "bundled": true, - "dev": true, - "requires": { - "inflight": "1.0.6", - "inherits": "2.0.3", - "minimatch": "2.0.10", - "once": "1.4.0" - } - }, - "isarray": { - "version": "0.0.1", - "bundled": true, - "dev": true - }, - "lodash": { - "version": "3.2.0", - "bundled": true, - "dev": true - }, - "minimatch": { - "version": "2.0.10", - "bundled": true, - "dev": true, - "requires": { - "brace-expansion": "1.1.8" - } - }, - "readable-stream": { - "version": "1.0.34", - "bundled": true, - "dev": true, - "requires": { - "core-util-is": "1.0.2", - "inherits": "2.0.3", - "isarray": "0.0.1", - "string_decoder": "0.10.31" - } - }, - "string_decoder": { - "version": "0.10.31", - "bundled": true, - "dev": true - } - } - }, - "are-we-there-yet": { - "version": "1.1.4", - "bundled": true, - "dev": true, - "requires": { - "delegates": "1.0.0", - "readable-stream": "2.2.11" - } - }, - "argparse": { - "version": "1.0.9", - "bundled": true, - "dev": true, - "requires": { - "sprintf-js": "1.0.3" - } - }, - "arr-diff": { - "version": "2.0.0", - "bundled": true, - "dev": true, - "requires": { - "arr-flatten": "1.0.3" - } - }, - "arr-flatten": { - "version": "1.0.3", - "bundled": true, - "dev": true - }, - "array-differ": { - "version": "1.0.0", - "bundled": true, - "dev": true - }, - "array-find-index": { - "version": "1.0.2", - "bundled": true, - "dev": true - }, - "array-slice": { - "version": "0.2.3", - "bundled": true, - "dev": true - }, - "array-union": { - "version": "1.0.2", - "bundled": true, - "dev": true, - "requires": { - "array-uniq": "1.0.3" - } - }, - "array-uniq": { - "version": "1.0.3", - "bundled": true, - "dev": true - }, - "array-unique": { - "version": "0.2.1", - "bundled": true, - "dev": true - }, - "arraybuffer.slice": { - "version": "0.0.6", - "bundled": true, - "dev": true - }, - "arrify": { - "version": "1.0.1", - "bundled": true, - "dev": true - }, - "asn1": { - "version": "0.2.3", - "bundled": true, - "dev": true - }, - "assert-plus": { - "version": "0.2.0", - "bundled": true, - "dev": true - }, - "assertion-error": { - "version": "1.0.0", - "bundled": true, - "dev": true - }, - "async": { - "version": "0.2.10", - "bundled": true, - "dev": true - }, - "async-each": { - "version": "1.0.1", - "bundled": true, - "dev": true - }, - "async-foreach": { - "version": "0.1.3", - "bundled": true, - "dev": true - }, - "asynckit": { - "version": "0.4.0", - "bundled": true, - "dev": true - }, - "aws-sign2": { - "version": "0.6.0", - "bundled": true, - "dev": true - }, - "aws4": { - "version": "1.6.0", - "bundled": true, - "dev": true - }, - "babel-code-frame": { - "version": "6.22.0", - "bundled": true, - "dev": true, - "requires": { - "chalk": "1.1.3", - "esutils": "2.0.2", - "js-tokens": "3.0.1" - } - }, - "babel-core": { - "version": "6.25.0", - "bundled": true, - "dev": true, - "requires": { - "babel-code-frame": "6.22.0", - "babel-generator": "6.25.0", - "babel-helpers": "6.24.1", - "babel-messages": "6.23.0", - "babel-register": "6.24.1", - "babel-runtime": "6.23.0", - "babel-template": "6.25.0", - "babel-traverse": "6.25.0", - "babel-types": "6.25.0", - "babylon": "6.17.3", - "convert-source-map": "1.5.0", - "debug": "2.6.8", - "json5": "0.5.1", - "lodash": "4.17.4", - "minimatch": "3.0.4", - "path-is-absolute": "1.0.1", - "private": "0.1.7", - "slash": "1.0.0", - "source-map": "0.5.6" - } - }, - "babel-deps": { - "version": "2.1.0", - "bundled": true, - "dev": true, - "requires": { - "babel-core": "6.25.0", - "merge": "1.2.0" - } - }, - "babel-generator": { - "version": "6.25.0", - "bundled": true, - "dev": true, - "requires": { - "babel-messages": "6.23.0", - "babel-runtime": "6.23.0", - "babel-types": "6.25.0", - "detect-indent": "4.0.0", - "jsesc": "1.3.0", - "lodash": "4.17.4", - "source-map": "0.5.6", - "trim-right": "1.0.1" - }, - "dependencies": { - "jsesc": { - "version": "1.3.0", - "bundled": true, - "dev": true - } - } - }, - "babel-globals": { - "version": "2.0.1", - "bundled": true, - "dev": true, - "requires": { - "babel-core": "6.25.0", - "babel-deps": "2.1.0", - "babel-plugin-external-helpers-2": "6.3.13", - "babel-plugin-globals": "2.0.1", - "concat-with-sourcemaps": "1.0.4" - } - }, - "babel-helper-call-delegate": { - "version": "6.24.1", - "bundled": true, - "dev": true, - "requires": { - "babel-helper-hoist-variables": "6.24.1", - "babel-runtime": "6.23.0", - "babel-traverse": "6.25.0", - "babel-types": "6.25.0" - } - }, - "babel-helper-define-map": { - "version": "6.24.1", - "bundled": true, - "dev": true, - "requires": { - "babel-helper-function-name": "6.24.1", - "babel-runtime": "6.23.0", - "babel-types": "6.25.0", - "lodash": "4.17.4" - } - }, - "babel-helper-function-name": { - "version": "6.24.1", - "bundled": true, - "dev": true, - "requires": { - "babel-helper-get-function-arity": "6.24.1", - "babel-runtime": "6.23.0", - "babel-template": "6.25.0", - "babel-traverse": "6.25.0", - "babel-types": "6.25.0" - } - }, - "babel-helper-get-function-arity": { - "version": "6.24.1", - "bundled": true, - "dev": true, - "requires": { - "babel-runtime": "6.23.0", - "babel-types": "6.25.0" - } - }, - "babel-helper-hoist-variables": { - "version": "6.24.1", - "bundled": true, - "dev": true, - "requires": { - "babel-runtime": "6.23.0", - "babel-types": "6.25.0" - } - }, - "babel-helper-optimise-call-expression": { - "version": "6.24.1", - "bundled": true, - "dev": true, - "requires": { - "babel-runtime": "6.23.0", - "babel-types": "6.25.0" - } - }, - "babel-helper-regex": { - "version": "6.24.1", - "bundled": true, - "dev": true, - "requires": { - "babel-runtime": "6.23.0", - "babel-types": "6.25.0", - "lodash": "4.17.4" - } - }, - "babel-helper-replace-supers": { - "version": "6.24.1", - "bundled": true, - "dev": true, - "requires": { - "babel-helper-optimise-call-expression": "6.24.1", - "babel-messages": "6.23.0", - "babel-runtime": "6.23.0", - "babel-template": "6.25.0", - "babel-traverse": "6.25.0", - "babel-types": "6.25.0" - } - }, - "babel-helpers": { - "version": "6.24.1", - "bundled": true, - "dev": true, - "requires": { - "babel-runtime": "6.23.0", - "babel-template": "6.25.0" - } - }, - "babel-messages": { - "version": "6.23.0", - "bundled": true, - "dev": true, - "requires": { - "babel-runtime": "6.23.0" - } - }, - "babel-plugin-check-es2015-constants": { - "version": "6.22.0", - "bundled": true, - "dev": true, - "requires": { - "babel-runtime": "6.23.0" - } - }, - "babel-plugin-external-helpers-2": { - "version": "6.3.13", - "bundled": true, - "dev": true, - "requires": { - "babel-runtime": "5.8.38" - }, - "dependencies": { - "babel-runtime": { - "version": "5.8.38", - "bundled": true, - "dev": true, - "requires": { - "core-js": "1.2.7" - } - }, - "core-js": { - "version": "1.2.7", - "bundled": true, - "dev": true - } - } - }, - "babel-plugin-globals": { - "version": "2.0.1", - "bundled": true, - "dev": true, - "requires": { - "babel-core": "6.25.0" - } - }, - "babel-plugin-transform-es2015-arrow-functions": { - "version": "6.22.0", - "bundled": true, - "dev": true, - "requires": { - "babel-runtime": "6.23.0" - } - }, - "babel-plugin-transform-es2015-block-scoped-functions": { - "version": "6.22.0", - "bundled": true, - "dev": true, - "requires": { - "babel-runtime": "6.23.0" - } - }, - "babel-plugin-transform-es2015-block-scoping": { - "version": "6.24.1", - "bundled": true, - "dev": true, - "requires": { - "babel-runtime": "6.23.0", - "babel-template": "6.25.0", - "babel-traverse": "6.25.0", - "babel-types": "6.25.0", - "lodash": "4.17.4" - } - }, - "babel-plugin-transform-es2015-classes": { - "version": "6.24.1", - "bundled": true, - "dev": true, - "requires": { - "babel-helper-define-map": "6.24.1", - "babel-helper-function-name": "6.24.1", - "babel-helper-optimise-call-expression": "6.24.1", - "babel-helper-replace-supers": "6.24.1", - "babel-messages": "6.23.0", - "babel-runtime": "6.23.0", - "babel-template": "6.25.0", - "babel-traverse": "6.25.0", - "babel-types": "6.25.0" - } - }, - "babel-plugin-transform-es2015-computed-properties": { - "version": "6.24.1", - "bundled": true, - "dev": true, - "requires": { - "babel-runtime": "6.23.0", - "babel-template": "6.25.0" - } - }, - "babel-plugin-transform-es2015-destructuring": { - "version": "6.23.0", - "bundled": true, - "dev": true, - "requires": { - "babel-runtime": "6.23.0" - } - }, - "babel-plugin-transform-es2015-duplicate-keys": { - "version": "6.24.1", - "bundled": true, - "dev": true, - "requires": { - "babel-runtime": "6.23.0", - "babel-types": "6.25.0" - } - }, - "babel-plugin-transform-es2015-for-of": { - "version": "6.23.0", - "bundled": true, - "dev": true, - "requires": { - "babel-runtime": "6.23.0" - } - }, - "babel-plugin-transform-es2015-function-name": { - "version": "6.24.1", - "bundled": true, - "dev": true, - "requires": { - "babel-helper-function-name": "6.24.1", - "babel-runtime": "6.23.0", - "babel-types": "6.25.0" - } - }, - "babel-plugin-transform-es2015-literals": { - "version": "6.22.0", - "bundled": true, - "dev": true, - "requires": { - "babel-runtime": "6.23.0" - } - }, - "babel-plugin-transform-es2015-modules-amd": { - "version": "6.24.1", - "bundled": true, - "dev": true, - "requires": { - "babel-plugin-transform-es2015-modules-commonjs": "6.24.1", - "babel-runtime": "6.23.0", - "babel-template": "6.25.0" - } - }, - "babel-plugin-transform-es2015-modules-commonjs": { - "version": "6.24.1", - "bundled": true, - "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-plugin-transform-es2015-modules-systemjs": { - "version": "6.24.1", - "bundled": true, - "dev": true, - "requires": { - "babel-helper-hoist-variables": "6.24.1", - "babel-runtime": "6.23.0", - "babel-template": "6.25.0" - } - }, - "babel-plugin-transform-es2015-modules-umd": { - "version": "6.24.1", - "bundled": true, - "dev": true, - "requires": { - "babel-plugin-transform-es2015-modules-amd": "6.24.1", - "babel-runtime": "6.23.0", - "babel-template": "6.25.0" - } - }, - "babel-plugin-transform-es2015-object-super": { - "version": "6.24.1", - "bundled": true, - "dev": true, - "requires": { - "babel-helper-replace-supers": "6.24.1", - "babel-runtime": "6.23.0" - } - }, - "babel-plugin-transform-es2015-parameters": { - "version": "6.24.1", - "bundled": true, - "dev": true, - "requires": { - "babel-helper-call-delegate": "6.24.1", - "babel-helper-get-function-arity": "6.24.1", - "babel-runtime": "6.23.0", - "babel-template": "6.25.0", - "babel-traverse": "6.25.0", - "babel-types": "6.25.0" - } - }, - "babel-plugin-transform-es2015-shorthand-properties": { - "version": "6.24.1", - "bundled": true, - "dev": true, - "requires": { - "babel-runtime": "6.23.0", - "babel-types": "6.25.0" - } - }, - "babel-plugin-transform-es2015-spread": { - "version": "6.22.0", - "bundled": true, - "dev": true, - "requires": { - "babel-runtime": "6.23.0" - } - }, - "babel-plugin-transform-es2015-sticky-regex": { - "version": "6.24.1", - "bundled": true, - "dev": true, - "requires": { - "babel-helper-regex": "6.24.1", - "babel-runtime": "6.23.0", - "babel-types": "6.25.0" - } - }, - "babel-plugin-transform-es2015-template-literals": { - "version": "6.22.0", - "bundled": true, - "dev": true, - "requires": { - "babel-runtime": "6.23.0" - } - }, - "babel-plugin-transform-es2015-typeof-symbol": { - "version": "6.23.0", - "bundled": true, - "dev": true, - "requires": { - "babel-runtime": "6.23.0" - } - }, - "babel-plugin-transform-es2015-unicode-regex": { - "version": "6.24.1", - "bundled": true, - "dev": true, - "requires": { - "babel-helper-regex": "6.24.1", - "babel-runtime": "6.23.0", - "regexpu-core": "2.0.0" - } - }, - "babel-plugin-transform-node-env-inline": { - "version": "0.1.1", - "bundled": true, - "dev": true - }, - "babel-plugin-transform-regenerator": { - "version": "6.24.1", - "bundled": true, - "dev": true, - "requires": { - "regenerator-transform": "0.9.11" - } - }, - "babel-plugin-transform-strict-mode": { - "version": "6.24.1", - "bundled": true, - "dev": true, - "requires": { - "babel-runtime": "6.23.0", - "babel-types": "6.25.0" - } - }, - "babel-preset-es2015": { - "version": "6.24.1", - "bundled": true, - "dev": true, - "requires": { - "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-classes": "6.24.1", - "babel-plugin-transform-es2015-computed-properties": "6.24.1", - "babel-plugin-transform-es2015-destructuring": "6.23.0", - "babel-plugin-transform-es2015-duplicate-keys": "6.24.1", - "babel-plugin-transform-es2015-for-of": "6.23.0", - "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-systemjs": "6.24.1", - "babel-plugin-transform-es2015-modules-umd": "6.24.1", - "babel-plugin-transform-es2015-object-super": "6.24.1", - "babel-plugin-transform-es2015-parameters": "6.24.1", - "babel-plugin-transform-es2015-shorthand-properties": "6.24.1", - "babel-plugin-transform-es2015-spread": "6.22.0", - "babel-plugin-transform-es2015-sticky-regex": "6.24.1", - "babel-plugin-transform-es2015-template-literals": "6.22.0", - "babel-plugin-transform-es2015-typeof-symbol": "6.23.0", - "babel-plugin-transform-es2015-unicode-regex": "6.24.1", - "babel-plugin-transform-regenerator": "6.24.1" - } - }, - "babel-preset-metal": { - "version": "3.1.0", - "bundled": true, - "dev": true, - "requires": { - "babel-plugin-transform-es2015-classes": "6.24.1", - "babel-preset-es2015": "6.24.1", - "resolve": "1.3.3" - } - }, - "babel-preset-metal-resolve-source": { - "version": "1.0.2", - "bundled": true, - "dev": true, - "requires": { - "resolve": "1.3.3" - } - }, - "babel-register": { - "version": "6.24.1", - "bundled": true, - "dev": true, - "requires": { - "babel-core": "6.25.0", - "babel-runtime": "6.23.0", - "core-js": "2.4.1", - "home-or-tmp": "2.0.0", - "lodash": "4.17.4", - "mkdirp": "0.5.1", - "source-map-support": "0.4.15" - } - }, - "babel-runtime": { - "version": "6.23.0", - "bundled": true, - "dev": true, - "requires": { - "core-js": "2.4.1", - "regenerator-runtime": "0.10.5" - } - }, - "babel-template": { - "version": "6.25.0", - "bundled": true, - "dev": true, - "requires": { - "babel-runtime": "6.23.0", - "babel-traverse": "6.25.0", - "babel-types": "6.25.0", - "babylon": "6.17.3", - "lodash": "4.17.4" - } - }, - "babel-traverse": { - "version": "6.25.0", - "bundled": true, - "dev": true, - "requires": { - "babel-code-frame": "6.22.0", - "babel-messages": "6.23.0", - "babel-runtime": "6.23.0", - "babel-types": "6.25.0", - "babylon": "6.17.3", - "debug": "2.6.8", - "globals": "9.18.0", - "invariant": "2.2.2", - "lodash": "4.17.4" - } - }, - "babel-types": { - "version": "6.25.0", - "bundled": true, - "dev": true, - "requires": { - "babel-runtime": "6.23.0", - "esutils": "2.0.2", - "lodash": "4.17.4", - "to-fast-properties": "1.0.3" - } - }, - "babylon": { - "version": "6.17.3", - "bundled": true, - "dev": true - }, - "backo2": { - "version": "1.0.2", - "bundled": true, - "dev": true - }, - "balanced-match": { - "version": "1.0.0", - "bundled": true, - "dev": true - }, - "base64-arraybuffer": { - "version": "0.1.5", - "bundled": true, - "dev": true - }, - "base64id": { - "version": "1.0.0", - "bundled": true, - "dev": true - }, - "beeper": { - "version": "1.1.1", - "bundled": true, - "dev": true - }, - "better-assert": { - "version": "1.0.2", - "bundled": true, - "dev": true, - "requires": { - "callsite": "1.0.0" - } - }, - "binary-extensions": { - "version": "1.8.0", - "bundled": true, - "dev": true - }, - "binaryextensions": { - "version": "1.0.1", - "bundled": true, - "dev": true - }, - "bl": { - "version": "0.9.5", - "bundled": true, - "dev": true, - "requires": { - "readable-stream": "1.0.34" - }, - "dependencies": { - "isarray": { - "version": "0.0.1", - "bundled": true, - "dev": true - }, - "readable-stream": { - "version": "1.0.34", - "bundled": true, - "dev": true, - "requires": { - "core-util-is": "1.0.2", - "inherits": "2.0.3", - "isarray": "0.0.1", - "string_decoder": "0.10.31" - } - }, - "string_decoder": { - "version": "0.10.31", - "bundled": true, - "dev": true - } - } - }, - "blob": { - "version": "0.0.4", - "bundled": true, - "dev": true - }, - "block-stream": { - "version": "0.0.9", - "bundled": true, - "dev": true, - "requires": { - "inherits": "2.0.3" - } - }, - "bluebird": { - "version": "3.4.7", - "bundled": true, - "dev": true - }, - "body-parser": { - "version": "1.17.2", - "bundled": true, - "dev": true, - "requires": { - "bytes": "2.4.0", - "content-type": "1.0.2", - "debug": "2.6.7", - "depd": "1.1.0", - "http-errors": "1.6.1", - "iconv-lite": "0.4.15", - "on-finished": "2.3.0", - "qs": "6.4.0", - "raw-body": "2.2.0", - "type-is": "1.6.15" - }, - "dependencies": { - "debug": { - "version": "2.6.7", - "bundled": true, - "dev": true, - "requires": { - "ms": "2.0.0" - } - } - } - }, - "boom": { - "version": "2.10.1", - "bundled": true, - "dev": true, - "requires": { - "hoek": "2.16.3" - } - }, - "bower": { - "version": "1.8.0", - "bundled": true, - "dev": true - }, - "brace-expansion": { - "version": "1.1.8", - "bundled": true, - "dev": true, - "requires": { - "balanced-match": "1.0.0", - "concat-map": "0.0.1" - } - }, - "braces": { - "version": "1.8.5", - "bundled": true, - "dev": true, - "requires": { - "expand-range": "1.8.2", - "preserve": "0.2.0", - "repeat-element": "1.1.2" - } - }, - "buffer-crc32": { - "version": "0.2.13", - "bundled": true, - "dev": true - }, - "bufferstreams": { - "version": "1.1.1", - "bundled": true, - "dev": true, - "requires": { - "readable-stream": "2.2.11" - } - }, - "builtin-modules": { - "version": "1.1.1", - "bundled": true, - "dev": true - }, - "bytes": { - "version": "2.4.0", - "bundled": true, - "dev": true - }, - "caller-path": { - "version": "0.1.0", - "bundled": true, - "dev": true, - "requires": { - "callsites": "0.2.0" - } - }, - "callsite": { - "version": "1.0.0", - "bundled": true, - "dev": true - }, - "callsites": { - "version": "0.2.0", - "bundled": true, - "dev": true - }, - "camelcase": { - "version": "2.1.1", - "bundled": true, - "dev": true - }, - "camelcase-keys": { - "version": "2.1.0", - "bundled": true, - "dev": true, - "requires": { - "camelcase": "2.1.1", - "map-obj": "1.0.1" - } - }, - "caseless": { - "version": "0.12.0", - "bundled": true, - "dev": true - }, - "catharsis": { - "version": "0.8.8", - "bundled": true, - "dev": true, - "requires": { - "underscore-contrib": "0.3.0" - } - }, - "center-align": { - "version": "0.1.3", - "bundled": true, - "dev": true, - "requires": { - "align-text": "0.1.4", - "lazy-cache": "1.0.4" - } - }, - "chai": { - "version": "2.3.0", - "bundled": true, - "dev": true, - "requires": { - "assertion-error": "1.0.0", - "deep-eql": "0.1.3" - } - }, - "chalk": { - "version": "1.1.3", - "bundled": true, - "dev": true, - "requires": { - "ansi-styles": "2.2.1", - "escape-string-regexp": "1.0.5", - "has-ansi": "2.0.0", - "strip-ansi": "3.0.1", - "supports-color": "2.0.0" - } - }, - "chokidar": { - "version": "1.7.0", - "bundled": true, - "dev": true, - "requires": { - "anymatch": "1.3.0", - "async-each": "1.0.1", - "fsevents": "1.1.2", - "glob-parent": "2.0.0", - "inherits": "2.0.3", - "is-binary-path": "1.0.1", - "is-glob": "2.0.1", - "path-is-absolute": "1.0.1", - "readdirp": "2.1.0" - } - }, - "circular-json": { - "version": "0.3.1", - "bundled": true, - "dev": true - }, - "cli": { - "version": "1.0.1", - "bundled": true, - "dev": true, - "requires": { - "exit": "0.1.2", - "glob": "7.1.2" - } - }, - "cli-cursor": { - "version": "1.0.2", - "bundled": true, - "dev": true, - "requires": { - "restore-cursor": "1.0.1" - } - }, - "cli-width": { - "version": "2.1.0", - "bundled": true, - "dev": true - }, - "cliui": { - "version": "3.2.0", - "bundled": true, - "dev": true, - "requires": { - "string-width": "1.0.2", - "strip-ansi": "3.0.1", - "wrap-ansi": "2.1.0" - } - }, - "clone": { - "version": "1.0.2", - "bundled": true, - "dev": true - }, - "clone-buffer": { - "version": "1.0.0", - "bundled": true, - "dev": true - }, - "clone-stats": { - "version": "0.0.1", - "bundled": true, - "dev": true - }, - "cloneable-readable": { - "version": "1.0.0", - "bundled": true, - "dev": true, - "requires": { - "inherits": "2.0.3", - "process-nextick-args": "1.0.7", - "through2": "2.0.3" - } - }, - "co": { - "version": "4.6.0", - "bundled": true, - "dev": true - }, - "code-point-at": { - "version": "1.1.0", - "bundled": true, - "dev": true - }, - "colors": { - "version": "1.1.2", - "bundled": true, - "dev": true - }, - "combine-lists": { - "version": "1.0.1", - "bundled": true, - "dev": true, - "requires": { - "lodash": "4.17.4" - } - }, - "combined-stream": { - "version": "1.0.5", - "bundled": true, - "dev": true, - "requires": { - "delayed-stream": "1.0.0" - } - }, - "commander": { - "version": "2.9.0", - "bundled": true, - "dev": true, - "requires": { - "graceful-readlink": "1.0.1" - } - }, - "component-bind": { - "version": "1.0.0", - "bundled": true, - "dev": true - }, - "component-emitter": { - "version": "1.1.2", - "bundled": true, - "dev": true - }, - "component-inherit": { - "version": "0.0.3", - "bundled": true, - "dev": true - }, - "compress-commons": { - "version": "0.2.9", - "bundled": true, - "dev": true, - "requires": { - "buffer-crc32": "0.2.13", - "crc32-stream": "0.3.4", - "node-int64": "0.3.3", - "readable-stream": "1.0.34" - }, - "dependencies": { - "isarray": { - "version": "0.0.1", - "bundled": true, - "dev": true - }, - "readable-stream": { - "version": "1.0.34", - "bundled": true, - "dev": true, - "requires": { - "core-util-is": "1.0.2", - "inherits": "2.0.3", - "isarray": "0.0.1", - "string_decoder": "0.10.31" - } - }, - "string_decoder": { - "version": "0.10.31", - "bundled": true, - "dev": true - } - } - }, - "concat-map": { - "version": "0.0.1", - "bundled": true, - "dev": true - }, - "concat-stream": { - "version": "1.6.0", - "bundled": true, - "dev": true, - "requires": { - "inherits": "2.0.3", - "readable-stream": "2.2.11", - "typedarray": "0.0.6" - } - }, - "concat-with-sourcemaps": { - "version": "1.0.4", - "bundled": true, - "dev": true, - "requires": { - "source-map": "0.5.6" - } - }, - "connect": { - "version": "3.6.2", - "bundled": true, - "dev": true, - "requires": { - "debug": "2.6.7", - "finalhandler": "1.0.3", - "parseurl": "1.3.1", - "utils-merge": "1.0.0" - }, - "dependencies": { - "debug": { - "version": "2.6.7", - "bundled": true, - "dev": true, - "requires": { - "ms": "2.0.0" - } - } - } - }, - "console-browserify": { - "version": "1.1.0", - "bundled": true, - "dev": true, - "requires": { - "date-now": "0.1.4" - } - }, - "console-control-strings": { - "version": "1.1.0", - "bundled": true, - "dev": true - }, - "content-type": { - "version": "1.0.2", - "bundled": true, - "dev": true - }, - "convert-source-map": { - "version": "1.5.0", - "bundled": true, - "dev": true - }, - "cookie": { - "version": "0.3.1", - "bundled": true, - "dev": true - }, - "core-js": { - "version": "2.4.1", - "bundled": true, - "dev": true - }, - "core-util-is": { - "version": "1.0.2", - "bundled": true, - "dev": true - }, - "crc32-stream": { - "version": "0.3.4", - "bundled": true, - "dev": true, - "requires": { - "buffer-crc32": "0.2.13", - "readable-stream": "1.0.34" - }, - "dependencies": { - "isarray": { - "version": "0.0.1", - "bundled": true, - "dev": true - }, - "readable-stream": { - "version": "1.0.34", - "bundled": true, - "dev": true, - "requires": { - "core-util-is": "1.0.2", - "inherits": "2.0.3", - "isarray": "0.0.1", - "string_decoder": "0.10.31" - } - }, - "string_decoder": { - "version": "0.10.31", - "bundled": true, - "dev": true - } - } - }, - "cross-spawn": { - "version": "3.0.1", - "bundled": true, - "dev": true, - "requires": { - "lru-cache": "4.1.1", - "which": "1.2.14" - }, - "dependencies": { - "lru-cache": { - "version": "4.1.1", - "bundled": true, - "dev": true, - "requires": { - "pseudomap": "1.0.2", - "yallist": "2.1.2" - } - } - } - }, - "cryptiles": { - "version": "2.0.5", - "bundled": true, - "dev": true, - "requires": { - "boom": "2.10.1" - } - }, - "ctype": { - "version": "0.5.3", - "bundled": true, - "dev": true - }, - "currently-unhandled": { - "version": "0.4.1", - "bundled": true, - "dev": true, - "requires": { - "array-find-index": "1.0.2" - } - }, - "custom-event": { - "version": "1.0.1", - "bundled": true, - "dev": true - }, - "d": { - "version": "1.0.0", - "bundled": true, - "dev": true, - "requires": { - "es5-ext": "0.10.23" - } - }, - "dashdash": { - "version": "1.14.1", - "bundled": true, - "dev": true, - "requires": { - "assert-plus": "1.0.0" - }, - "dependencies": { - "assert-plus": { - "version": "1.0.0", - "bundled": true, - "dev": true - } - } - }, - "date-now": { - "version": "0.1.4", - "bundled": true, - "dev": true - }, - "dateformat": { - "version": "2.0.0", - "bundled": true, - "dev": true - }, - "deap": { - "version": "1.0.0", - "bundled": true, - "dev": true - }, - "debug": { - "version": "2.6.8", - "bundled": true, - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, - "decamelize": { - "version": "1.2.0", - "bundled": true, - "dev": true - }, - "deep-eql": { - "version": "0.1.3", - "bundled": true, - "dev": true, - "requires": { - "type-detect": "0.1.1" - } - }, - "deep-is": { - "version": "0.1.3", - "bundled": true, - "dev": true - }, - "del": { - "version": "2.2.2", - "bundled": true, - "dev": true, - "requires": { - "globby": "5.0.0", - "is-path-cwd": "1.0.0", - "is-path-in-cwd": "1.0.0", - "object-assign": "4.1.1", - "pify": "2.3.0", - "pinkie-promise": "2.0.1", - "rimraf": "2.6.1" - } - }, - "delayed-stream": { - "version": "1.0.0", - "bundled": true, - "dev": true - }, - "delegates": { - "version": "1.0.0", - "bundled": true, - "dev": true - }, - "depd": { - "version": "1.1.0", - "bundled": true, - "dev": true - }, - "detect-indent": { - "version": "4.0.0", - "bundled": true, - "dev": true, - "requires": { - "repeating": "2.0.1" - } - }, - "di": { - "version": "0.0.1", - "bundled": true, - "dev": true - }, - "diff": { - "version": "1.4.0", - "bundled": true, - "dev": true - }, - "disparity": { - "version": "2.0.0", - "bundled": true, - "dev": true, - "requires": { - "ansi-styles": "2.2.1", - "diff": "1.4.0" - } - }, - "doctrine": { - "version": "2.0.0", - "bundled": true, - "dev": true, - "requires": { - "esutils": "2.0.2", - "isarray": "1.0.0" - } - }, - "dom-serialize": { - "version": "2.2.1", - "bundled": true, - "dev": true, - "requires": { - "custom-event": "1.0.1", - "ent": "2.2.0", - "extend": "3.0.1", - "void-elements": "2.0.1" - } - }, - "dom-serializer": { - "version": "0.1.0", - "bundled": true, - "dev": true, - "requires": { - "domelementtype": "1.1.3", - "entities": "1.1.1" - }, - "dependencies": { - "domelementtype": { - "version": "1.1.3", - "bundled": true, - "dev": true - }, - "entities": { - "version": "1.1.1", - "bundled": true, - "dev": true - } - } - }, - "domelementtype": { - "version": "1.3.0", - "bundled": true, - "dev": true - }, - "domhandler": { - "version": "2.3.0", - "bundled": true, - "dev": true, - "requires": { - "domelementtype": "1.3.0" - } - }, - "domutils": { - "version": "1.5.1", - "bundled": true, - "dev": true, - "requires": { - "dom-serializer": "0.1.0", - "domelementtype": "1.3.0" - } - }, - "duplexer": { - "version": "0.1.1", - "bundled": true, - "dev": true - }, - "duplexer2": { - "version": "0.0.2", - "bundled": true, - "dev": true, - "requires": { - "readable-stream": "1.1.14" - }, - "dependencies": { - "isarray": { - "version": "0.0.1", - "bundled": true, - "dev": true - }, - "readable-stream": { - "version": "1.1.14", - "bundled": true, - "dev": true, - "requires": { - "core-util-is": "1.0.2", - "inherits": "2.0.3", - "isarray": "0.0.1", - "string_decoder": "0.10.31" - } - }, - "string_decoder": { - "version": "0.10.31", - "bundled": true, - "dev": true - } - } - }, - "duplexify": { - "version": "3.5.0", - "bundled": true, - "dev": true, - "requires": { - "end-of-stream": "1.0.0", - "inherits": "2.0.3", - "readable-stream": "2.2.11", - "stream-shift": "1.0.0" - }, - "dependencies": { - "end-of-stream": { - "version": "1.0.0", - "bundled": true, - "dev": true, - "requires": { - "once": "1.3.3" - } - }, - "once": { - "version": "1.3.3", - "bundled": true, - "dev": true, - "requires": { - "wrappy": "1.0.2" - } - } - } - }, - "ee-first": { - "version": "1.1.1", - "bundled": true, - "dev": true - }, - "encodeurl": { - "version": "1.0.1", - "bundled": true, - "dev": true - }, - "engine.io": { - "version": "1.8.3", - "bundled": true, - "dev": true, - "requires": { - "accepts": "1.3.3", - "base64id": "1.0.0", - "cookie": "0.3.1", - "debug": "2.3.3", - "engine.io-parser": "1.3.2", - "ws": "1.1.2" - }, - "dependencies": { - "debug": { - "version": "2.3.3", - "bundled": true, - "dev": true, - "requires": { - "ms": "0.7.2" - } - }, - "ms": { - "version": "0.7.2", - "bundled": true, - "dev": true - } - } - }, - "engine.io-client": { - "version": "1.8.3", - "bundled": true, - "dev": true, - "requires": { - "component-emitter": "1.2.1", - "component-inherit": "0.0.3", - "debug": "2.3.3", - "engine.io-parser": "1.3.2", - "has-cors": "1.1.0", - "indexof": "0.0.1", - "parsejson": "0.0.3", - "parseqs": "0.0.5", - "parseuri": "0.0.5", - "ws": "1.1.2", - "xmlhttprequest-ssl": "1.5.3", - "yeast": "0.1.2" - }, - "dependencies": { - "component-emitter": { - "version": "1.2.1", - "bundled": true, - "dev": true - }, - "debug": { - "version": "2.3.3", - "bundled": true, - "dev": true, - "requires": { - "ms": "0.7.2" - } - }, - "ms": { - "version": "0.7.2", - "bundled": true, - "dev": true - } - } - }, - "engine.io-parser": { - "version": "1.3.2", - "bundled": true, - "dev": true, - "requires": { - "after": "0.8.2", - "arraybuffer.slice": "0.0.6", - "base64-arraybuffer": "0.1.5", - "blob": "0.0.4", - "has-binary": "0.1.7", - "wtf-8": "1.0.0" - } - }, - "ent": { - "version": "2.2.0", - "bundled": true, - "dev": true - }, - "entities": { - "version": "1.0.0", - "bundled": true, - "dev": true - }, - "error-ex": { - "version": "1.3.1", - "bundled": true, - "dev": true, - "requires": { - "is-arrayish": "0.2.1" - } - }, - "es5-ext": { - "version": "0.10.23", - "bundled": true, - "dev": true, - "requires": { - "es6-iterator": "2.0.1", - "es6-symbol": "3.1.1" - } - }, - "es6-iterator": { - "version": "2.0.1", - "bundled": true, - "dev": true, - "requires": { - "d": "1.0.0", - "es5-ext": "0.10.23", - "es6-symbol": "3.1.1" - } - }, - "es6-map": { - "version": "0.1.5", - "bundled": true, - "dev": true, - "requires": { - "d": "1.0.0", - "es5-ext": "0.10.23", - "es6-iterator": "2.0.1", - "es6-set": "0.1.5", - "es6-symbol": "3.1.1", - "event-emitter": "0.3.5" - } - }, - "es6-set": { - "version": "0.1.5", - "bundled": true, - "dev": true, - "requires": { - "d": "1.0.0", - "es5-ext": "0.10.23", - "es6-iterator": "2.0.1", - "es6-symbol": "3.1.1", - "event-emitter": "0.3.5" - } - }, - "es6-symbol": { - "version": "3.1.1", - "bundled": true, - "dev": true, - "requires": { - "d": "1.0.0", - "es5-ext": "0.10.23" - } - }, - "es6-weak-map": { - "version": "2.0.2", - "bundled": true, - "dev": true, - "requires": { - "d": "1.0.0", - "es5-ext": "0.10.23", - "es6-iterator": "2.0.1", - "es6-symbol": "3.1.1" - } - }, - "escape-html": { - "version": "1.0.3", - "bundled": true, - "dev": true - }, - "escape-string-regexp": { - "version": "1.0.5", - "bundled": true, - "dev": true - }, - "escodegen": { - "version": "1.8.1", - "bundled": true, - "dev": true, - "requires": { - "esprima": "2.7.3", - "estraverse": "1.9.3", - "esutils": "2.0.2", - "optionator": "0.8.2", - "source-map": "0.2.0" - }, - "dependencies": { - "esprima": { - "version": "2.7.3", - "bundled": true, - "dev": true - }, - "estraverse": { - "version": "1.9.3", - "bundled": true, - "dev": true - }, - "source-map": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.2.0.tgz", - "integrity": "sha1-2rc/vPwrqBm03gO9b26qSBZLP50=", - "dev": true, - "optional": true, - "requires": { - "amdefine": "1.0.1" - } - } - } - }, - "escope": { - "version": "3.6.0", - "bundled": true, - "dev": true, - "requires": { - "es6-map": "0.1.5", - "es6-weak-map": "2.0.2", - "esrecurse": "4.1.0", - "estraverse": "4.2.0" - } - }, - "esformatter": { - "version": "0.8.2", - "bundled": true, - "dev": true, - "requires": { - "debug": "0.7.4", - "disparity": "2.0.0", - "espree": "2.2.5", - "glob": "5.0.15", - "minimist": "1.2.0", - "mout": "1.0.0", - "npm-run": "2.0.0", - "resolve": "1.3.3", - "rocambole": "0.7.0", - "rocambole-indent": "2.0.4", - "rocambole-linebreak": "1.0.2", - "rocambole-node": "1.0.0", - "rocambole-token": "1.2.1", - "rocambole-whitespace": "1.0.0", - "stdin": "0.0.1", - "strip-json-comments": "0.1.3", - "supports-color": "1.3.1", - "user-home": "2.0.0" - }, - "dependencies": { - "debug": { - "version": "0.7.4", - "bundled": true, - "dev": true - }, - "espree": { - "version": "2.2.5", - "bundled": true, - "dev": true - }, - "glob": { - "version": "5.0.15", - "bundled": true, - "dev": true, - "requires": { - "inflight": "1.0.6", - "inherits": "2.0.3", - "minimatch": "3.0.4", - "once": "1.4.0", - "path-is-absolute": "1.0.1" - } - }, - "minimist": { - "version": "1.2.0", - "bundled": true, - "dev": true - }, - "strip-json-comments": { - "version": "0.1.3", - "bundled": true, - "dev": true - }, - "supports-color": { - "version": "1.3.1", - "bundled": true, - "dev": true - } - } - }, - "eslint": { - "version": "3.19.0", - "bundled": true, - "dev": true, - "requires": { - "babel-code-frame": "6.22.0", - "chalk": "1.1.3", - "concat-stream": "1.6.0", - "debug": "2.6.8", - "doctrine": "2.0.0", - "escope": "3.6.0", - "espree": "3.4.3", - "esquery": "1.0.0", - "estraverse": "4.2.0", - "esutils": "2.0.2", - "file-entry-cache": "2.0.0", - "glob": "7.1.2", - "globals": "9.18.0", - "ignore": "3.3.3", - "imurmurhash": "0.1.4", - "inquirer": "0.12.0", - "is-my-json-valid": "2.16.0", - "is-resolvable": "1.0.0", - "js-yaml": "3.8.4", - "json-stable-stringify": "1.0.1", - "levn": "0.3.0", - "lodash": "4.17.4", - "mkdirp": "0.5.1", - "natural-compare": "1.4.0", - "optionator": "0.8.2", - "path-is-inside": "1.0.2", - "pluralize": "1.2.1", - "progress": "1.1.8", - "require-uncached": "1.0.3", - "shelljs": "0.7.8", - "strip-bom": "3.0.0", - "strip-json-comments": "2.0.1", - "table": "3.8.3", - "text-table": "0.2.0", - "user-home": "2.0.0" - } - }, - "espree": { - "version": "3.4.3", - "bundled": true, - "dev": true, - "requires": { - "acorn": "5.0.3", - "acorn-jsx": "3.0.1" - } - }, - "esprima": { - "version": "3.1.3", - "bundled": true, - "dev": true - }, - "esquery": { - "version": "1.0.0", - "bundled": true, - "dev": true, - "requires": { - "estraverse": "4.2.0" - } - }, - "esrecurse": { - "version": "4.1.0", - "bundled": true, - "dev": true, - "requires": { - "estraverse": "4.1.1", - "object-assign": "4.1.1" - }, - "dependencies": { - "estraverse": { - "version": "4.1.1", - "bundled": true, - "dev": true - } - } - }, - "estraverse": { - "version": "4.2.0", - "bundled": true, - "dev": true - }, - "esutils": { - "version": "2.0.2", - "bundled": true, - "dev": true - }, - "event-emitter": { - "version": "0.3.5", - "bundled": true, - "dev": true, - "requires": { - "d": "1.0.0", - "es5-ext": "0.10.23" - } - }, - "eventemitter3": { - "version": "1.2.0", - "bundled": true, - "dev": true - }, - "exit": { - "version": "0.1.2", - "bundled": true, - "dev": true - }, - "exit-hook": { - "version": "1.1.1", - "bundled": true, - "dev": true - }, - "expand-braces": { - "version": "0.1.2", - "bundled": true, - "dev": true, - "requires": { - "array-slice": "0.2.3", - "array-unique": "0.2.1", - "braces": "0.1.5" - }, - "dependencies": { - "braces": { - "version": "0.1.5", - "bundled": true, - "dev": true, - "requires": { - "expand-range": "0.1.1" - } - }, - "expand-range": { - "version": "0.1.1", - "bundled": true, - "dev": true, - "requires": { - "is-number": "0.1.1", - "repeat-string": "0.2.2" - } - }, - "is-number": { - "version": "0.1.1", - "bundled": true, - "dev": true - }, - "repeat-string": { - "version": "0.2.2", - "bundled": true, - "dev": true - } - } - }, - "expand-brackets": { - "version": "0.1.5", - "bundled": true, - "dev": true, - "requires": { - "is-posix-bracket": "0.1.1" - } - }, - "expand-range": { - "version": "1.8.2", - "bundled": true, - "dev": true, - "requires": { - "fill-range": "2.2.3" - } - }, - "extend": { - "version": "3.0.1", - "bundled": true, - "dev": true - }, - "extend-shallow": { - "version": "2.0.1", - "bundled": true, - "dev": true, - "requires": { - "is-extendable": "0.1.1" - } - }, - "extglob": { - "version": "0.3.2", - "bundled": true, - "dev": true, - "requires": { - "is-extglob": "1.0.0" - } - }, - "extsprintf": { - "version": "1.0.2", - "bundled": true, - "dev": true - }, - "fancy-log": { - "version": "1.3.0", - "bundled": true, - "dev": true, - "requires": { - "chalk": "1.1.3", - "time-stamp": "1.1.0" - } - }, - "fast-levenshtein": { - "version": "2.0.6", - "bundled": true, - "dev": true - }, - "figures": { - "version": "1.7.0", - "bundled": true, - "dev": true, - "requires": { - "escape-string-regexp": "1.0.5", - "object-assign": "4.1.1" - } - }, - "file-entry-cache": { - "version": "2.0.0", - "bundled": true, - "dev": true, - "requires": { - "flat-cache": "1.2.2", - "object-assign": "4.1.1" - } - }, - "filename-regex": { - "version": "2.0.1", - "bundled": true, - "dev": true - }, - "fill-range": { - "version": "2.2.3", - "bundled": true, - "dev": true, - "requires": { - "is-number": "2.1.0", - "isobject": "2.1.0", - "randomatic": "1.1.7", - "repeat-element": "1.1.2", - "repeat-string": "1.6.1" - } - }, - "finalhandler": { - "version": "1.0.3", - "bundled": true, - "dev": true, - "requires": { - "debug": "2.6.7", - "encodeurl": "1.0.1", - "escape-html": "1.0.3", - "on-finished": "2.3.0", - "parseurl": "1.3.1", - "statuses": "1.3.1", - "unpipe": "1.0.0" - }, - "dependencies": { - "debug": { - "version": "2.6.7", - "bundled": true, - "dev": true, - "requires": { - "ms": "2.0.0" - } - } - } - }, - "find-up": { - "version": "1.1.2", - "bundled": true, - "dev": true, - "requires": { - "path-exists": "2.1.0", - "pinkie-promise": "2.0.1" - } - }, - "first-chunk-stream": { - "version": "1.0.0", - "bundled": true, - "dev": true - }, - "flat-cache": { - "version": "1.2.2", - "bundled": true, - "dev": true, - "requires": { - "circular-json": "0.3.1", - "del": "2.2.2", - "graceful-fs": "4.1.11", - "write": "0.2.1" - } - }, - "for-in": { - "version": "1.0.2", - "bundled": true, - "dev": true - }, - "for-own": { - "version": "0.1.5", - "bundled": true, - "dev": true, - "requires": { - "for-in": "1.0.2" - } - }, - "forever-agent": { - "version": "0.6.1", - "bundled": true, - "dev": true - }, - "fork-stream": { - "version": "0.0.4", - "bundled": true, - "dev": true - }, - "form-data": { - "version": "2.1.4", - "bundled": true, - "dev": true, - "requires": { - "asynckit": "0.4.0", - "combined-stream": "1.0.5", - "mime-types": "2.1.15" - } - }, - "formatio": { - "version": "1.1.1", - "bundled": true, - "dev": true, - "requires": { - "samsam": "1.1.2" - } - }, - "fs-access": { - "version": "1.0.1", - "bundled": true, - "dev": true, - "requires": { - "null-check": "1.0.0" - } - }, - "fs.realpath": { - "version": "1.0.0", - "bundled": true, - "dev": true - }, - "fstream": { - "version": "1.0.11", - "bundled": true, - "dev": true, - "requires": { - "graceful-fs": "4.1.11", - "inherits": "2.0.3", - "mkdirp": "0.5.1", - "rimraf": "2.6.1" - } - }, - "gauge": { - "version": "2.7.4", - "bundled": true, - "dev": true, - "requires": { - "aproba": "1.1.2", - "console-control-strings": "1.1.0", - "has-unicode": "2.0.1", - "object-assign": "4.1.1", - "signal-exit": "3.0.2", - "string-width": "1.0.2", - "strip-ansi": "3.0.1", - "wide-align": "1.1.2" - } - }, - "generate-function": { - "version": "2.0.0", - "bundled": true, - "dev": true - }, - "generate-object-property": { - "version": "1.2.0", - "bundled": true, - "dev": true, - "requires": { - "is-property": "1.0.2" - } - }, - "get-caller-file": { - "version": "1.0.2", - "bundled": true, - "dev": true - }, - "get-stdin": { - "version": "4.0.1", - "bundled": true, - "dev": true - }, - "getpass": { - "version": "0.1.7", - "bundled": true, - "dev": true, - "requires": { - "assert-plus": "1.0.0" - }, - "dependencies": { - "assert-plus": { - "version": "1.0.0", - "bundled": true, - "dev": true - } - } - }, - "glob": { - "version": "7.1.2", - "bundled": true, - "dev": true, - "requires": { - "fs.realpath": "1.0.0", - "inflight": "1.0.6", - "inherits": "2.0.3", - "minimatch": "3.0.4", - "once": "1.4.0", - "path-is-absolute": "1.0.1" - } - }, - "glob-base": { - "version": "0.3.0", - "bundled": true, - "dev": true, - "requires": { - "glob-parent": "2.0.0", - "is-glob": "2.0.1" - } - }, - "glob-expand": { - "version": "0.1.0", - "bundled": true, - "dev": true, - "requires": { - "glob": "4.4.2", - "lodash": "1.2.1" - }, - "dependencies": { - "glob": { - "version": "4.4.2", - "bundled": true, - "dev": true, - "requires": { - "inflight": "1.0.6", - "inherits": "2.0.3", - "minimatch": "2.0.10", - "once": "1.4.0" - } - }, - "lodash": { - "version": "1.2.1", - "bundled": true, - "dev": true - }, - "minimatch": { - "version": "2.0.10", - "bundled": true, - "dev": true, - "requires": { - "brace-expansion": "1.1.8" - } - } - } - }, - "glob-parent": { - "version": "2.0.0", - "bundled": true, - "dev": true, - "requires": { - "is-glob": "2.0.1" - } - }, - "globals": { - "version": "9.18.0", - "bundled": true, - "dev": true - }, - "globby": { - "version": "5.0.0", - "bundled": true, - "dev": true, - "requires": { - "array-union": "1.0.2", - "arrify": "1.0.1", - "glob": "7.1.2", - "object-assign": "4.1.1", - "pify": "2.3.0", - "pinkie-promise": "2.0.1" - } - }, - "glogg": { - "version": "1.0.0", - "bundled": true, - "dev": true, - "requires": { - "sparkles": "1.0.0" - } - }, - "graceful-fs": { - "version": "4.1.11", - "bundled": true, - "dev": true - }, - "graceful-readlink": { - "version": "1.0.1", - "bundled": true, - "dev": true - }, - "growl": { - "version": "1.9.2", - "bundled": true, - "dev": true - }, - "gulp-babel-deps": { - "version": "2.0.1", - "bundled": true, - "dev": true, - "requires": { - "babel-deps": "2.1.0", - "gulp-util": "3.0.8", - "through2": "2.0.3", - "vinyl-sourcemaps-apply": "0.2.1" - } - }, - "gulp-babel-globals": { - "version": "2.0.0", - "bundled": true, - "dev": true, - "requires": { - "babel-globals": "2.0.1", - "gulp-util": "3.0.8", - "through2": "2.0.3", - "vinyl-sourcemaps-apply": "0.2.1" - } - }, - "gulp-concat": { - "version": "2.6.1", - "bundled": true, - "dev": true, - "requires": { - "concat-with-sourcemaps": "1.0.4", - "through2": "2.0.3", - "vinyl": "2.0.2" - }, - "dependencies": { - "clone-stats": { - "version": "1.0.0", - "bundled": true, - "dev": true - }, - "replace-ext": { - "version": "1.0.0", - "bundled": true, - "dev": true - }, - "vinyl": { - "version": "2.0.2", - "bundled": true, - "dev": true, - "requires": { - "clone": "1.0.2", - "clone-buffer": "1.0.0", - "clone-stats": "1.0.0", - "cloneable-readable": "1.0.0", - "is-stream": "1.1.0", - "remove-trailing-separator": "1.0.2", - "replace-ext": "1.0.0" - } - } - } - }, - "gulp-esformatter": { - "version": "5.0.0", - "bundled": true, - "dev": true, - "requires": { - "esformatter": "0.8.2", - "gulp-util": "3.0.8", - "through2": "2.0.3" - } - }, - "gulp-eslint": { - "version": "3.0.1", - "bundled": true, - "dev": true, - "requires": { - "bufferstreams": "1.1.1", - "eslint": "3.19.0", - "gulp-util": "3.0.8" - } - }, - "gulp-if": { - "version": "2.0.2", - "bundled": true, - "dev": true, - "requires": { - "gulp-match": "1.0.3", - "ternary-stream": "2.0.1", - "through2": "2.0.3" - } - }, - "gulp-ignore": { - "version": "2.0.2", - "bundled": true, - "dev": true, - "requires": { - "gulp-match": "1.0.3", - "through2": "2.0.3" - } - }, - "gulp-jshint": { - "version": "2.0.4", - "bundled": true, - "dev": true, - "requires": { - "gulp-util": "3.0.8", - "lodash": "4.17.4", - "minimatch": "3.0.4", - "rcloader": "0.2.2", - "through2": "2.0.3" - } - }, - "gulp-match": { - "version": "1.0.3", - "bundled": true, - "dev": true, - "requires": { - "minimatch": "3.0.4" - } - }, - "gulp-mocha": { - "version": "2.2.0", - "bundled": true, - "dev": true, - "requires": { - "gulp-util": "3.0.8", - "mocha": "2.5.3", - "plur": "2.1.2", - "resolve-from": "1.0.1", - "temp": "0.8.3", - "through": "2.3.8" - } - }, - "gulp-rename": { - "version": "1.2.2", - "bundled": true, - "dev": true - }, - "gulp-replace": { - "version": "0.5.4", - "bundled": true, - "dev": true, - "requires": { - "istextorbinary": "1.0.2", - "readable-stream": "2.2.11", - "replacestream": "4.0.2" - } - }, - "gulp-sass": { - "version": "2.3.2", - "bundled": true, - "dev": true, - "requires": { - "gulp-util": "3.0.8", - "lodash.clonedeep": "4.5.0", - "node-sass": "3.13.1", - "through2": "2.0.3", - "vinyl-sourcemaps-apply": "0.2.1" - } - }, - "gulp-sourcemaps": { - "version": "1.6.0", - "bundled": true, - "dev": true, - "requires": { - "convert-source-map": "1.5.0", - "graceful-fs": "4.1.11", - "strip-bom": "2.0.0", - "through2": "2.0.3", - "vinyl": "1.2.0" - }, - "dependencies": { - "strip-bom": { - "version": "2.0.0", - "bundled": true, - "dev": true, - "requires": { - "is-utf8": "0.2.1" - } - }, - "vinyl": { - "version": "1.2.0", - "bundled": true, - "dev": true, - "requires": { - "clone": "1.0.2", - "clone-stats": "0.0.1", - "replace-ext": "0.0.1" - } - } - } - }, - "gulp-uglify": { - "version": "1.5.4", - "bundled": true, - "dev": true, - "requires": { - "deap": "1.0.0", - "fancy-log": "1.3.0", - "gulp-util": "3.0.8", - "isobject": "2.1.0", - "through2": "2.0.3", - "uglify-js": "2.6.4", - "uglify-save-license": "0.4.1", - "vinyl-sourcemaps-apply": "0.2.1" - } - }, - "gulp-util": { - "version": "3.0.8", - "bundled": true, - "dev": true, - "requires": { - "array-differ": "1.0.0", - "array-uniq": "1.0.3", - "beeper": "1.1.1", - "chalk": "1.1.3", - "dateformat": "2.0.0", - "fancy-log": "1.3.0", - "gulplog": "1.0.0", - "has-gulplog": "0.1.0", - "lodash._reescape": "3.0.0", - "lodash._reevaluate": "3.0.0", - "lodash._reinterpolate": "3.0.0", - "lodash.template": "3.6.2", - "minimist": "1.2.0", - "multipipe": "0.1.2", - "object-assign": "3.0.0", - "replace-ext": "0.0.1", - "through2": "2.0.3", - "vinyl": "0.5.3" - }, - "dependencies": { - "minimist": { - "version": "1.2.0", - "bundled": true, - "dev": true - }, - "object-assign": { - "version": "3.0.0", - "bundled": true, - "dev": true - } - } - }, - "gulp-wrapper": { - "version": "1.0.0", - "bundled": true, - "dev": true, - "requires": { - "gulp-util": "3.0.8", - "through2": "0.6.5" - }, - "dependencies": { - "isarray": { - "version": "0.0.1", - "bundled": true, - "dev": true - }, - "readable-stream": { - "version": "1.0.34", - "bundled": true, - "dev": true, - "requires": { - "core-util-is": "1.0.2", - "inherits": "2.0.3", - "isarray": "0.0.1", - "string_decoder": "0.10.31" - } - }, - "string_decoder": { - "version": "0.10.31", - "bundled": true, - "dev": true - }, - "through2": { - "version": "0.6.5", - "bundled": true, - "dev": true, - "requires": { - "readable-stream": "1.0.34", - "xtend": "4.0.1" - } - } - } - }, - "gulplog": { - "version": "1.0.0", - "bundled": true, - "dev": true, - "requires": { - "glogg": "1.0.0" - } - }, - "handlebars": { - "version": "4.0.10", - "bundled": true, - "dev": true, - "requires": { - "async": "1.5.2", - "optimist": "0.6.1", - "source-map": "0.4.4", - "uglify-js": "2.6.4" - }, - "dependencies": { - "async": { - "version": "1.5.2", - "bundled": true, - "dev": true - }, - "source-map": { - "version": "0.4.4", - "bundled": true, - "dev": true, - "requires": { - "amdefine": "1.0.1" - } - } - } - }, - "har-schema": { - "version": "1.0.5", - "bundled": true, - "dev": true - }, - "har-validator": { - "version": "4.2.1", - "bundled": true, - "dev": true, - "requires": { - "ajv": "4.11.8", - "har-schema": "1.0.5" - } - }, - "has-ansi": { - "version": "2.0.0", - "bundled": true, - "dev": true, - "requires": { - "ansi-regex": "2.1.1" - } - }, - "has-binary": { - "version": "0.1.7", - "bundled": true, - "dev": true, - "requires": { - "isarray": "0.0.1" - }, - "dependencies": { - "isarray": { - "version": "0.0.1", - "bundled": true, - "dev": true - } - } - }, - "has-color": { - "version": "0.1.7", - "bundled": true, - "dev": true - }, - "has-cors": { - "version": "1.1.0", - "bundled": true, - "dev": true - }, - "has-flag": { - "version": "1.0.0", - "bundled": true, - "dev": true - }, - "has-gulplog": { - "version": "0.1.0", - "bundled": true, - "dev": true, - "requires": { - "sparkles": "1.0.0" - } - }, - "has-unicode": { - "version": "2.0.1", - "bundled": true, - "dev": true - }, - "hawk": { - "version": "3.1.3", - "bundled": true, - "dev": true, - "requires": { - "boom": "2.10.1", - "cryptiles": "2.0.5", - "hoek": "2.16.3", - "sntp": "1.0.9" - } - }, - "hoek": { - "version": "2.16.3", - "bundled": true, - "dev": true - }, - "home-or-tmp": { - "version": "2.0.0", - "bundled": true, - "dev": true, - "requires": { - "os-homedir": "1.0.2", - "os-tmpdir": "1.0.2" - } - }, - "hosted-git-info": { - "version": "2.4.2", - "bundled": true, - "dev": true - }, - "htmlparser2": { - "version": "3.8.3", - "bundled": true, - "dev": true, - "requires": { - "domelementtype": "1.3.0", - "domhandler": "2.3.0", - "domutils": "1.5.1", - "entities": "1.0.0", - "readable-stream": "1.1.14" - }, - "dependencies": { - "isarray": { - "version": "0.0.1", - "bundled": true, - "dev": true - }, - "readable-stream": { - "version": "1.1.14", - "bundled": true, - "dev": true, - "requires": { - "core-util-is": "1.0.2", - "inherits": "2.0.3", - "isarray": "0.0.1", - "string_decoder": "0.10.31" - } - }, - "string_decoder": { - "version": "0.10.31", - "bundled": true, - "dev": true - } - } - }, - "http-errors": { - "version": "1.6.1", - "bundled": true, - "dev": true, - "requires": { - "depd": "1.1.0", - "inherits": "2.0.3", - "setprototypeof": "1.0.3", - "statuses": "1.3.1" - } - }, - "http-proxy": { - "version": "1.16.2", - "bundled": true, - "dev": true, - "requires": { - "eventemitter3": "1.2.0", - "requires-port": "1.0.0" - } - }, - "http-signature": { - "version": "1.1.1", - "bundled": true, - "dev": true, - "requires": { - "assert-plus": "0.2.0", - "jsprim": "1.4.0", - "sshpk": "1.13.1" - } - }, - "https-proxy-agent": { - "version": "1.0.0", - "bundled": true, - "dev": true, - "requires": { - "agent-base": "2.1.1", - "debug": "2.6.8", - "extend": "3.0.1" - } - }, - "iconv-lite": { - "version": "0.4.15", - "bundled": true, - "dev": true - }, - "iectrl": { - "version": "0.1.2", - "bundled": true, - "dev": true, - "requires": { - "colors": "0.6.2", - "commander": "1.2.0", - "debug": "0.7.4", - "moment": "2.0.0", - "q": "0.9.7" - }, - "dependencies": { - "colors": { - "version": "0.6.2", - "bundled": true, - "dev": true - }, - "commander": { - "version": "1.2.0", - "bundled": true, - "dev": true, - "requires": { - "keypress": "0.1.0" - } - }, - "debug": { - "version": "0.7.4", - "bundled": true, - "dev": true - } - } - }, - "ignore": { - "version": "3.3.3", - "bundled": true, - "dev": true - }, - "imurmurhash": { - "version": "0.1.4", - "bundled": true, - "dev": true - }, - "in-publish": { - "version": "2.0.0", - "bundled": true, - "dev": true - }, - "indent-string": { - "version": "2.1.0", - "bundled": true, - "dev": true, - "requires": { - "repeating": "2.0.1" - } - }, - "indexof": { - "version": "0.0.1", - "bundled": true, - "dev": true - }, - "inflight": { - "version": "1.0.6", - "bundled": true, - "dev": true, - "requires": { - "once": "1.4.0", - "wrappy": "1.0.2" - } - }, - "inherits": { - "version": "2.0.3", - "bundled": true, - "dev": true - }, - "inquirer": { - "version": "0.12.0", - "bundled": true, - "dev": true, - "requires": { - "ansi-escapes": "1.4.0", - "ansi-regex": "2.1.1", - "chalk": "1.1.3", - "cli-cursor": "1.0.2", - "cli-width": "2.1.0", - "figures": "1.7.0", - "lodash": "4.17.4", - "readline2": "1.0.1", - "run-async": "0.1.0", - "rx-lite": "3.1.2", - "string-width": "1.0.2", - "strip-ansi": "3.0.1", - "through": "2.3.8" - } - }, - "interpret": { - "version": "1.0.3", - "bundled": true, - "dev": true - }, - "invariant": { - "version": "2.2.2", - "bundled": true, - "dev": true, - "requires": { - "loose-envify": "1.3.1" - } - }, - "invert-kv": { - "version": "1.0.0", - "bundled": true, - "dev": true - }, - "irregular-plurals": { - "version": "1.2.0", - "bundled": true, - "dev": true - }, - "is-arrayish": { - "version": "0.2.1", - "bundled": true, - "dev": true - }, - "is-binary-path": { - "version": "1.0.1", - "bundled": true, - "dev": true, - "requires": { - "binary-extensions": "1.8.0" - } - }, - "is-buffer": { - "version": "1.1.5", - "bundled": true, - "dev": true - }, - "is-builtin-module": { - "version": "1.0.0", - "bundled": true, - "dev": true, - "requires": { - "builtin-modules": "1.1.1" - } - }, - "is-dotfile": { - "version": "1.0.3", - "bundled": true, - "dev": true - }, - "is-equal-shallow": { - "version": "0.1.3", - "bundled": true, - "dev": true, - "requires": { - "is-primitive": "2.0.0" - } - }, - "is-extendable": { - "version": "0.1.1", - "bundled": true, - "dev": true - }, - "is-extglob": { - "version": "1.0.0", - "bundled": true, - "dev": true - }, - "is-finite": { - "version": "1.0.2", - "bundled": true, - "dev": true, - "requires": { - "number-is-nan": "1.0.1" - } - }, - "is-fullwidth-code-point": { - "version": "1.0.0", - "bundled": true, - "dev": true, - "requires": { - "number-is-nan": "1.0.1" - } - }, - "is-glob": { - "version": "2.0.1", - "bundled": true, - "dev": true, - "requires": { - "is-extglob": "1.0.0" - } - }, - "is-my-json-valid": { - "version": "2.16.0", - "bundled": true, - "dev": true, - "requires": { - "generate-function": "2.0.0", - "generate-object-property": "1.2.0", - "jsonpointer": "4.0.1", - "xtend": "4.0.1" - } - }, - "is-number": { - "version": "2.1.0", - "bundled": true, - "dev": true, - "requires": { - "kind-of": "3.2.2" - } - }, - "is-path-cwd": { - "version": "1.0.0", - "bundled": true, - "dev": true - }, - "is-path-in-cwd": { - "version": "1.0.0", - "bundled": true, - "dev": true, - "requires": { - "is-path-inside": "1.0.0" - } - }, - "is-path-inside": { - "version": "1.0.0", - "bundled": true, - "dev": true, - "requires": { - "path-is-inside": "1.0.2" - } - }, - "is-posix-bracket": { - "version": "0.1.1", - "bundled": true, - "dev": true - }, - "is-primitive": { - "version": "2.0.0", - "bundled": true, - "dev": true - }, - "is-property": { - "version": "1.0.2", - "bundled": true, - "dev": true - }, - "is-resolvable": { - "version": "1.0.0", - "bundled": true, - "dev": true, - "requires": { - "tryit": "1.0.3" - } - }, - "is-stream": { - "version": "1.1.0", - "bundled": true, - "dev": true - }, - "is-typedarray": { - "version": "1.0.0", - "bundled": true, - "dev": true - }, - "is-utf8": { - "version": "0.2.1", - "bundled": true, - "dev": true - }, - "is-valid-glob": { - "version": "0.3.0", - "bundled": true, - "dev": true - }, - "isarray": { - "version": "1.0.0", - "bundled": true, - "dev": true - }, - "isbinaryfile": { - "version": "3.0.2", - "bundled": true, - "dev": true - }, - "isexe": { - "version": "2.0.0", - "bundled": true, - "dev": true - }, - "isobject": { - "version": "2.1.0", - "bundled": true, - "dev": true, - "requires": { - "isarray": "1.0.0" - } - }, - "isparta": { - "version": "4.0.0", - "bundled": true, - "dev": true, - "requires": { - "babel-core": "6.25.0", - "escodegen": "1.8.1", - "esprima": "2.7.3", - "istanbul": "0.4.5", - "mkdirp": "0.5.1", - "nomnomnomnom": "2.0.1", - "object-assign": "4.1.1", - "source-map": "0.5.6", - "which": "1.2.14" - }, - "dependencies": { - "esprima": { - "version": "2.7.3", - "bundled": true, - "dev": true - } - } - }, - "isstream": { - "version": "0.1.2", - "bundled": true, - "dev": true - }, - "istanbul": { - "version": "0.4.5", - "bundled": true, - "dev": true, - "requires": { - "abbrev": "1.0.9", - "async": "1.5.2", - "escodegen": "1.8.1", - "esprima": "2.7.3", - "glob": "5.0.15", - "handlebars": "4.0.10", - "js-yaml": "3.8.4", - "mkdirp": "0.5.1", - "nopt": "3.0.6", - "once": "1.4.0", - "resolve": "1.1.7", - "supports-color": "3.2.3", - "which": "1.2.14", - "wordwrap": "1.0.0" - }, - "dependencies": { - "abbrev": { - "version": "1.0.9", - "bundled": true, - "dev": true - }, - "async": { - "version": "1.5.2", - "bundled": true, - "dev": true - }, - "esprima": { - "version": "2.7.3", - "bundled": true, - "dev": true - }, - "glob": { - "version": "5.0.15", - "bundled": true, - "dev": true, - "requires": { - "inflight": "1.0.6", - "inherits": "2.0.3", - "minimatch": "3.0.4", - "once": "1.4.0", - "path-is-absolute": "1.0.1" - } - }, - "resolve": { - "version": "1.1.7", - "bundled": true, - "dev": true - }, - "supports-color": { - "version": "3.2.3", - "bundled": true, - "dev": true, - "requires": { - "has-flag": "1.0.0" - } - } - } - }, - "istextorbinary": { - "version": "1.0.2", - "bundled": true, - "dev": true, - "requires": { - "binaryextensions": "1.0.1", - "textextensions": "1.0.2" - } - }, - "jade": { - "version": "0.26.3", - "bundled": true, - "dev": true, - "requires": { - "commander": "0.6.1", - "mkdirp": "0.3.0" - }, - "dependencies": { - "commander": { - "version": "0.6.1", - "bundled": true, - "dev": true - }, - "mkdirp": { - "version": "0.3.0", - "bundled": true, - "dev": true - } - } - }, - "js-base64": { - "version": "2.1.9", - "bundled": true, - "dev": true - }, - "js-tokens": { - "version": "3.0.1", - "bundled": true, - "dev": true - }, - "js-yaml": { - "version": "3.8.4", - "bundled": true, - "dev": true, - "requires": { - "argparse": "1.0.9", - "esprima": "3.1.3" - } - }, - "js2xmlparser": { - "version": "1.0.0", - "bundled": true, - "dev": true - }, - "jsdoc": { - "version": "3.4.3", - "bundled": true, - "dev": true, - "requires": { - "bluebird": "3.4.7", - "catharsis": "0.8.8", - "escape-string-regexp": "1.0.5", - "espree": "3.1.7", - "js2xmlparser": "1.0.0", - "klaw": "1.3.1", - "marked": "0.3.6", - "mkdirp": "0.5.1", - "requizzle": "0.2.1", - "strip-json-comments": "2.0.1", - "taffydb": "2.6.2", - "underscore": "1.8.3" - }, - "dependencies": { - "acorn": { - "version": "3.3.0", - "bundled": true, - "dev": true - }, - "espree": { - "version": "3.1.7", - "bundled": true, - "dev": true, - "requires": { - "acorn": "3.3.0", - "acorn-jsx": "3.0.1" - } - } - } - }, - "jsesc": { - "version": "0.5.0", - "bundled": true, - "dev": true - }, - "jshint": { - "version": "2.9.4", - "bundled": true, - "dev": true, - "requires": { - "cli": "1.0.1", - "console-browserify": "1.1.0", - "exit": "0.1.2", - "htmlparser2": "3.8.3", - "lodash": "3.7.0", - "minimatch": "3.0.4", - "shelljs": "0.3.0", - "strip-json-comments": "1.0.4" - }, - "dependencies": { - "lodash": { - "version": "3.7.0", - "bundled": true, - "dev": true - }, - "shelljs": { - "version": "0.3.0", - "bundled": true, - "dev": true - }, - "strip-json-comments": { - "version": "1.0.4", - "bundled": true, - "dev": true - } - } - }, - "jshint-stylish": { - "version": "2.2.1", - "bundled": true, - "dev": true, - "requires": { - "beeper": "1.1.1", - "chalk": "1.1.3", - "log-symbols": "1.0.2", - "plur": "2.1.2", - "string-length": "1.0.1", - "text-table": "0.2.0" - } - }, - "json-schema": { - "version": "0.2.3", - "bundled": true, - "dev": true - }, - "json-stable-stringify": { - "version": "1.0.1", - "bundled": true, - "dev": true, - "requires": { - "jsonify": "0.0.0" - } - }, - "json-stringify-safe": { - "version": "5.0.1", - "bundled": true, - "dev": true - }, - "json3": { - "version": "3.3.2", - "bundled": true, - "dev": true - }, - "json5": { - "version": "0.5.1", - "bundled": true, - "dev": true - }, - "jsonify": { - "version": "0.0.0", - "bundled": true, - "dev": true - }, - "jsonpointer": { - "version": "4.0.1", - "bundled": true, - "dev": true - }, - "jsprim": { - "version": "1.4.0", - "bundled": true, - "dev": true, - "requires": { - "assert-plus": "1.0.0", - "extsprintf": "1.0.2", - "json-schema": "0.2.3", - "verror": "1.3.6" - }, - "dependencies": { - "assert-plus": { - "version": "1.0.0", - "bundled": true, - "dev": true - } - } - }, - "karma": { - "version": "1.7.0", - "bundled": true, - "dev": true, - "requires": { - "bluebird": "3.4.7", - "body-parser": "1.17.2", - "chokidar": "1.7.0", - "colors": "1.1.2", - "combine-lists": "1.0.1", - "connect": "3.6.2", - "core-js": "2.4.1", - "di": "0.0.1", - "dom-serialize": "2.2.1", - "expand-braces": "0.1.2", - "glob": "7.1.2", - "graceful-fs": "4.1.11", - "http-proxy": "1.16.2", - "isbinaryfile": "3.0.2", - "lodash": "3.10.1", - "log4js": "0.6.38", - "mime": "1.3.6", - "minimatch": "3.0.4", - "optimist": "0.6.1", - "qjobs": "1.1.5", - "range-parser": "1.2.0", - "rimraf": "2.6.1", - "safe-buffer": "5.0.1", - "socket.io": "1.7.3", - "source-map": "0.5.6", - "tmp": "0.0.31", - "useragent": "2.1.13" - }, - "dependencies": { - "lodash": { - "version": "3.10.1", - "bundled": true, - "dev": true - } - } - }, - "karma-babel-preprocessor": { - "version": "6.0.1", - "bundled": true, - "dev": true, - "requires": { - "babel-core": "6.25.0" - } - }, - "karma-chai": { - "version": "0.1.0", - "bundled": true, - "dev": true - }, - "karma-chrome-launcher": { - "version": "0.2.3", - "bundled": true, - "dev": true, - "requires": { - "fs-access": "1.0.1", - "which": "1.2.14" - } - }, - "karma-commonjs": { - "version": "1.0.0", - "bundled": true, - "dev": true - }, - "karma-coverage": { - "version": "0.5.5", - "bundled": true, - "dev": true, - "requires": { - "dateformat": "1.0.12", - "istanbul": "0.4.5", - "minimatch": "3.0.4", - "source-map": "0.5.6" - }, - "dependencies": { - "dateformat": { - "version": "1.0.12", - "bundled": true, - "dev": true, - "requires": { - "get-stdin": "4.0.1", - "meow": "3.7.0" - } - } - } - }, - "karma-firefox-launcher": { - "version": "0.1.7", - "bundled": true, - "dev": true - }, - "karma-ievms": { - "version": "0.1.0", - "bundled": true, - "dev": true, - "requires": { - "iectrl": "0.1.2" - } - }, - "karma-mocha": { - "version": "0.2.2", - "bundled": true, - "dev": true - }, - "karma-safari-launcher": { - "version": "0.1.1", - "bundled": true, - "dev": true - }, - "karma-sauce-launcher": { - "version": "0.3.1", - "bundled": true, - "dev": true, - "requires": { - "q": "1.5.0", - "sauce-connect-launcher": "0.13.0", - "saucelabs": "1.4.0", - "wd": "0.3.12" - }, - "dependencies": { - "q": { - "version": "1.5.0", - "bundled": true, - "dev": true - } - } - }, - "karma-sinon": { - "version": "1.0.5", - "bundled": true, - "dev": true - }, - "karma-source-map-support": { - "version": "1.2.0", - "bundled": true, - "dev": true, - "requires": { - "source-map-support": "0.4.15" - } - }, - "keypress": { - "version": "0.1.0", - "bundled": true, - "dev": true - }, - "kind-of": { - "version": "3.2.2", - "bundled": true, - "dev": true, - "requires": { - "is-buffer": "1.1.5" - } - }, - "klaw": { - "version": "1.3.1", - "bundled": true, - "dev": true, - "requires": { - "graceful-fs": "4.1.11" - } - }, - "lazy-cache": { - "version": "1.0.4", - "bundled": true, - "dev": true - }, - "lazystream": { - "version": "0.1.0", - "bundled": true, - "dev": true, - "requires": { - "readable-stream": "1.0.34" - }, - "dependencies": { - "isarray": { - "version": "0.0.1", - "bundled": true, - "dev": true - }, - "readable-stream": { - "version": "1.0.34", - "bundled": true, - "dev": true, - "requires": { - "core-util-is": "1.0.2", - "inherits": "2.0.3", - "isarray": "0.0.1", - "string_decoder": "0.10.31" - } - }, - "string_decoder": { - "version": "0.10.31", - "bundled": true, - "dev": true - } - } - }, - "lcid": { - "version": "1.0.0", - "bundled": true, - "dev": true, - "requires": { - "invert-kv": "1.0.0" - } - }, - "levn": { - "version": "0.3.0", - "bundled": true, - "dev": true, - "requires": { - "prelude-ls": "1.1.2", - "type-check": "0.3.2" - } - }, - "load-json-file": { - "version": "1.1.0", - "bundled": true, - "dev": true, - "requires": { - "graceful-fs": "4.1.11", - "parse-json": "2.2.0", - "pify": "2.3.0", - "pinkie-promise": "2.0.1", - "strip-bom": "2.0.0" - }, - "dependencies": { - "strip-bom": { - "version": "2.0.0", - "bundled": true, - "dev": true, - "requires": { - "is-utf8": "0.2.1" - } - } - } - }, - "lodash": { - "version": "4.17.4", - "bundled": true, - "dev": true - }, - "lodash._basecopy": { - "version": "3.0.1", - "bundled": true, - "dev": true - }, - "lodash._basetostring": { - "version": "3.0.1", - "bundled": true, - "dev": true - }, - "lodash._basevalues": { - "version": "3.0.0", - "bundled": true, - "dev": true - }, - "lodash._getnative": { - "version": "3.9.1", - "bundled": true, - "dev": true - }, - "lodash._isiterateecall": { - "version": "3.0.9", - "bundled": true, - "dev": true - }, - "lodash._reescape": { - "version": "3.0.0", - "bundled": true, - "dev": true - }, - "lodash._reevaluate": { - "version": "3.0.0", - "bundled": true, - "dev": true - }, - "lodash._reinterpolate": { - "version": "3.0.0", - "bundled": true, - "dev": true - }, - "lodash._root": { - "version": "3.0.1", - "bundled": true, - "dev": true - }, - "lodash.assign": { - "version": "4.2.0", - "bundled": true, - "dev": true - }, - "lodash.clonedeep": { - "version": "4.5.0", - "bundled": true, - "dev": true - }, - "lodash.escape": { - "version": "3.2.0", - "bundled": true, - "dev": true, - "requires": { - "lodash._root": "3.0.1" - } - }, - "lodash.isarguments": { - "version": "3.1.0", - "bundled": true, - "dev": true - }, - "lodash.isarray": { - "version": "3.0.4", - "bundled": true, - "dev": true - }, - "lodash.isequal": { - "version": "4.5.0", - "bundled": true, - "dev": true - }, - "lodash.isobject": { - "version": "3.0.2", - "bundled": true, - "dev": true - }, - "lodash.keys": { - "version": "3.1.2", - "bundled": true, - "dev": true, - "requires": { - "lodash._getnative": "3.9.1", - "lodash.isarguments": "3.1.0", - "lodash.isarray": "3.0.4" - } - }, - "lodash.merge": { - "version": "4.6.0", - "bundled": true, - "dev": true - }, - "lodash.restparam": { - "version": "3.6.1", - "bundled": true, - "dev": true - }, - "lodash.template": { - "version": "3.6.2", - "bundled": true, - "dev": true, - "requires": { - "lodash._basecopy": "3.0.1", - "lodash._basetostring": "3.0.1", - "lodash._basevalues": "3.0.0", - "lodash._isiterateecall": "3.0.9", - "lodash._reinterpolate": "3.0.0", - "lodash.escape": "3.2.0", - "lodash.keys": "3.1.2", - "lodash.restparam": "3.6.1", - "lodash.templatesettings": "3.1.1" - } - }, - "lodash.templatesettings": { - "version": "3.1.1", - "bundled": true, - "dev": true, - "requires": { - "lodash._reinterpolate": "3.0.0", - "lodash.escape": "3.2.0" - } - }, - "log-symbols": { - "version": "1.0.2", - "bundled": true, - "dev": true, - "requires": { - "chalk": "1.1.3" - } - }, - "log4js": { - "version": "0.6.38", - "bundled": true, - "dev": true, - "requires": { - "readable-stream": "1.0.34", - "semver": "4.3.6" - }, - "dependencies": { - "isarray": { - "version": "0.0.1", - "bundled": true, - "dev": true - }, - "readable-stream": { - "version": "1.0.34", - "bundled": true, - "dev": true, - "requires": { - "core-util-is": "1.0.2", - "inherits": "2.0.3", - "isarray": "0.0.1", - "string_decoder": "0.10.31" - } - }, - "string_decoder": { - "version": "0.10.31", - "bundled": true, - "dev": true - } - } - }, - "lolex": { - "version": "1.3.2", - "bundled": true, - "dev": true - }, - "longest": { - "version": "1.0.1", - "bundled": true, - "dev": true - }, - "loose-envify": { - "version": "1.3.1", - "bundled": true, - "dev": true, - "requires": { - "js-tokens": "3.0.1" - } - }, - "loud-rejection": { - "version": "1.6.0", - "bundled": true, - "dev": true, - "requires": { - "currently-unhandled": "0.4.1", - "signal-exit": "3.0.2" - } - }, - "lru-cache": { - "version": "2.7.3", - "bundled": true, - "dev": true - }, - "map-obj": { - "version": "1.0.1", - "bundled": true, - "dev": true - }, - "marked": { - "version": "0.3.6", - "bundled": true, - "dev": true - }, - "media-typer": { - "version": "0.3.0", - "bundled": true, - "dev": true - }, - "meow": { - "version": "3.7.0", - "bundled": true, - "dev": true, - "requires": { - "camelcase-keys": "2.1.0", - "decamelize": "1.2.0", - "loud-rejection": "1.6.0", - "map-obj": "1.0.1", - "minimist": "1.2.0", - "normalize-package-data": "2.3.8", - "object-assign": "4.1.1", - "read-pkg-up": "1.0.1", - "redent": "1.0.0", - "trim-newlines": "1.0.0" - }, - "dependencies": { - "minimist": { - "version": "1.2.0", - "bundled": true, - "dev": true - } - } - }, - "merge": { - "version": "1.2.0", - "bundled": true, - "dev": true - }, - "merge-stream": { - "version": "1.0.1", - "bundled": true, - "dev": true, - "requires": { - "readable-stream": "2.2.11" - } - }, - "metal-jquery-adapter": { - "version": "1.0.0", - "bundled": true, - "dev": true - }, - "metal-karma-config": { - "version": "2.3.1", - "bundled": true, - "dev": true, - "requires": { - "babel-plugin-transform-node-env-inline": "0.1.1", - "babel-preset-metal": "3.1.0", - "chai": "2.3.0", - "isparta": "4.0.0", - "karma-babel-preprocessor": "6.0.1", - "karma-chai": "0.1.0", - "karma-chrome-launcher": "0.2.3", - "karma-commonjs": "1.0.0", - "karma-coverage": "0.5.5", - "karma-mocha": "0.2.2", - "karma-sinon": "1.0.5", - "karma-source-map-support": "1.2.0", - "mocha": "2.5.3", - "sinon": "1.17.7" - } - }, - "metal-tools-build-amd": { - "version": "3.0.3", - "bundled": true, - "dev": true, - "requires": { - "babel-plugin-transform-es2015-modules-amd": "6.24.1", - "babel-preset-es2015": "6.24.1", - "babel-preset-metal-resolve-source": "1.0.2", - "bower": "1.8.0", - "gulp-babel-deps": "2.0.1", - "gulp-if": "2.0.2", - "gulp-sourcemaps": "1.6.0", - "merge": "1.2.0", - "stream-combiner": "0.2.2", - "stream-consume": "0.1.0", - "through2": "2.0.3", - "vinyl-fs": "2.4.4" - }, - "dependencies": { - "glob": { - "version": "5.0.15", - "bundled": true, - "dev": true, - "requires": { - "inflight": "1.0.6", - "inherits": "2.0.3", - "minimatch": "3.0.4", - "once": "1.4.0", - "path-is-absolute": "1.0.1" - } - }, - "glob-parent": { - "version": "3.1.0", - "bundled": true, - "dev": true, - "requires": { - "is-glob": "3.1.0", - "path-dirname": "1.0.2" - } - }, - "glob-stream": { - "version": "5.3.5", - "bundled": true, - "dev": true, - "requires": { - "extend": "3.0.1", - "glob": "5.0.15", - "glob-parent": "3.1.0", - "micromatch": "2.3.11", - "ordered-read-streams": "0.3.0", - "through2": "0.6.5", - "to-absolute-glob": "0.1.1", - "unique-stream": "2.2.1" - }, - "dependencies": { - "readable-stream": { - "version": "1.0.34", - "bundled": true, - "dev": true, - "requires": { - "core-util-is": "1.0.2", - "inherits": "2.0.3", - "isarray": "0.0.1", - "string_decoder": "0.10.31" - } - }, - "through2": { - "version": "0.6.5", - "bundled": true, - "dev": true, - "requires": { - "readable-stream": "1.0.34", - "xtend": "4.0.1" - } - } - } - }, - "is-extglob": { - "version": "2.1.1", - "bundled": true, - "dev": true - }, - "is-glob": { - "version": "3.1.0", - "bundled": true, - "dev": true, - "requires": { - "is-extglob": "2.1.1" - } - }, - "isarray": { - "version": "0.0.1", - "bundled": true, - "dev": true - }, - "lazystream": { - "version": "1.0.0", - "bundled": true, - "dev": true, - "requires": { - "readable-stream": "2.2.11" - } - }, - "ordered-read-streams": { - "version": "0.3.0", - "bundled": true, - "dev": true, - "requires": { - "is-stream": "1.1.0", - "readable-stream": "2.2.11" - } - }, - "string_decoder": { - "version": "0.10.31", - "bundled": true, - "dev": true - }, - "strip-bom": { - "version": "2.0.0", - "bundled": true, - "dev": true, - "requires": { - "is-utf8": "0.2.1" - } - }, - "unique-stream": { - "version": "2.2.1", - "bundled": true, - "dev": true, - "requires": { - "json-stable-stringify": "1.0.1", - "through2-filter": "2.0.0" - } - }, - "vinyl": { - "version": "1.2.0", - "bundled": true, - "dev": true, - "requires": { - "clone": "1.0.2", - "clone-stats": "0.0.1", - "replace-ext": "0.0.1" - } - }, - "vinyl-fs": { - "version": "2.4.4", - "bundled": true, - "dev": true, - "requires": { - "duplexify": "3.5.0", - "glob-stream": "5.3.5", - "graceful-fs": "4.1.11", - "gulp-sourcemaps": "1.6.0", - "is-valid-glob": "0.3.0", - "lazystream": "1.0.0", - "lodash.isequal": "4.5.0", - "merge-stream": "1.0.1", - "mkdirp": "0.5.1", - "object-assign": "4.1.1", - "readable-stream": "2.2.11", - "strip-bom": "2.0.0", - "strip-bom-stream": "1.0.0", - "through2": "2.0.3", - "through2-filter": "2.0.0", - "vali-date": "1.0.0", - "vinyl": "1.2.0" - } - } - } - }, - "metal-tools-build-globals": { - "version": "2.0.2", - "bundled": true, - "dev": true, - "requires": { - "babel-preset-es2015": "6.24.1", - "babel-preset-metal-resolve-source": "1.0.2", - "gulp-babel-globals": "2.0.0", - "gulp-if": "2.0.2", - "gulp-sourcemaps": "1.6.0", - "merge": "1.2.0", - "stream-combiner": "0.2.2", - "stream-consume": "0.1.0", - "vinyl-fs": "2.4.4" - }, - "dependencies": { - "glob": { - "version": "5.0.15", - "bundled": true, - "dev": true, - "requires": { - "inflight": "1.0.6", - "inherits": "2.0.3", - "minimatch": "3.0.4", - "once": "1.4.0", - "path-is-absolute": "1.0.1" - } - }, - "glob-parent": { - "version": "3.1.0", - "bundled": true, - "dev": true, - "requires": { - "is-glob": "3.1.0", - "path-dirname": "1.0.2" - } - }, - "glob-stream": { - "version": "5.3.5", - "bundled": true, - "dev": true, - "requires": { - "extend": "3.0.1", - "glob": "5.0.15", - "glob-parent": "3.1.0", - "micromatch": "2.3.11", - "ordered-read-streams": "0.3.0", - "through2": "0.6.5", - "to-absolute-glob": "0.1.1", - "unique-stream": "2.2.1" - }, - "dependencies": { - "readable-stream": { - "version": "1.0.34", - "bundled": true, - "dev": true, - "requires": { - "core-util-is": "1.0.2", - "inherits": "2.0.3", - "isarray": "0.0.1", - "string_decoder": "0.10.31" - } - }, - "through2": { - "version": "0.6.5", - "bundled": true, - "dev": true, - "requires": { - "readable-stream": "1.0.34", - "xtend": "4.0.1" - } - } - } - }, - "is-extglob": { - "version": "2.1.1", - "bundled": true, - "dev": true - }, - "is-glob": { - "version": "3.1.0", - "bundled": true, - "dev": true, - "requires": { - "is-extglob": "2.1.1" - } - }, - "isarray": { - "version": "0.0.1", - "bundled": true, - "dev": true - }, - "lazystream": { - "version": "1.0.0", - "bundled": true, - "dev": true, - "requires": { - "readable-stream": "2.2.11" - } - }, - "ordered-read-streams": { - "version": "0.3.0", - "bundled": true, - "dev": true, - "requires": { - "is-stream": "1.1.0", - "readable-stream": "2.2.11" - } - }, - "string_decoder": { - "version": "0.10.31", - "bundled": true, - "dev": true - }, - "strip-bom": { - "version": "2.0.0", - "bundled": true, - "dev": true, - "requires": { - "is-utf8": "0.2.1" - } - }, - "unique-stream": { - "version": "2.2.1", - "bundled": true, - "dev": true, - "requires": { - "json-stable-stringify": "1.0.1", - "through2-filter": "2.0.0" - } - }, - "vinyl": { - "version": "1.2.0", - "bundled": true, - "dev": true, - "requires": { - "clone": "1.0.2", - "clone-stats": "0.0.1", - "replace-ext": "0.0.1" - } - }, - "vinyl-fs": { - "version": "2.4.4", - "bundled": true, - "dev": true, - "requires": { - "duplexify": "3.5.0", - "glob-stream": "5.3.5", - "graceful-fs": "4.1.11", - "gulp-sourcemaps": "1.6.0", - "is-valid-glob": "0.3.0", - "lazystream": "1.0.0", - "lodash.isequal": "4.5.0", - "merge-stream": "1.0.1", - "mkdirp": "0.5.1", - "object-assign": "4.1.1", - "readable-stream": "2.2.11", - "strip-bom": "2.0.0", - "strip-bom-stream": "1.0.0", - "through2": "2.0.3", - "through2-filter": "2.0.0", - "vali-date": "1.0.0", - "vinyl": "1.2.0" - } - } - } - }, - "metal-tools-build-jquery": { - "version": "2.0.2", - "bundled": true, - "dev": true, - "requires": { - "gulp-if": "2.0.2", - "gulp-sourcemaps": "1.6.0", - "gulp-wrapper": "1.0.0", - "metal-jquery-adapter": "1.0.0", - "metal-tools-build-globals": "2.0.2", - "stream-combiner": "0.2.2", - "stream-consume": "0.1.0", - "vinyl-fs": "2.4.4" - }, - "dependencies": { - "glob": { - "version": "5.0.15", - "bundled": true, - "dev": true, - "requires": { - "inflight": "1.0.6", - "inherits": "2.0.3", - "minimatch": "3.0.4", - "once": "1.4.0", - "path-is-absolute": "1.0.1" - } - }, - "glob-parent": { - "version": "3.1.0", - "bundled": true, - "dev": true, - "requires": { - "is-glob": "3.1.0", - "path-dirname": "1.0.2" - } - }, - "glob-stream": { - "version": "5.3.5", - "bundled": true, - "dev": true, - "requires": { - "extend": "3.0.1", - "glob": "5.0.15", - "glob-parent": "3.1.0", - "micromatch": "2.3.11", - "ordered-read-streams": "0.3.0", - "through2": "0.6.5", - "to-absolute-glob": "0.1.1", - "unique-stream": "2.2.1" - }, - "dependencies": { - "readable-stream": { - "version": "1.0.34", - "bundled": true, - "dev": true, - "requires": { - "core-util-is": "1.0.2", - "inherits": "2.0.3", - "isarray": "0.0.1", - "string_decoder": "0.10.31" - } - }, - "through2": { - "version": "0.6.5", - "bundled": true, - "dev": true, - "requires": { - "readable-stream": "1.0.34", - "xtend": "4.0.1" - } - } - } - }, - "is-extglob": { - "version": "2.1.1", - "bundled": true, - "dev": true - }, - "is-glob": { - "version": "3.1.0", - "bundled": true, - "dev": true, - "requires": { - "is-extglob": "2.1.1" - } - }, - "isarray": { - "version": "0.0.1", - "bundled": true, - "dev": true - }, - "lazystream": { - "version": "1.0.0", - "bundled": true, - "dev": true, - "requires": { - "readable-stream": "2.2.11" - } - }, - "ordered-read-streams": { - "version": "0.3.0", - "bundled": true, - "dev": true, - "requires": { - "is-stream": "1.1.0", - "readable-stream": "2.2.11" - } - }, - "string_decoder": { - "version": "0.10.31", - "bundled": true, - "dev": true - }, - "strip-bom": { - "version": "2.0.0", - "bundled": true, - "dev": true, - "requires": { - "is-utf8": "0.2.1" - } - }, - "unique-stream": { - "version": "2.2.1", - "bundled": true, - "dev": true, - "requires": { - "json-stable-stringify": "1.0.1", - "through2-filter": "2.0.0" - } - }, - "vinyl": { - "version": "1.2.0", - "bundled": true, - "dev": true, - "requires": { - "clone": "1.0.2", - "clone-stats": "0.0.1", - "replace-ext": "0.0.1" - } - }, - "vinyl-fs": { - "version": "2.4.4", - "bundled": true, - "dev": true, - "requires": { - "duplexify": "3.5.0", - "glob-stream": "5.3.5", - "graceful-fs": "4.1.11", - "gulp-sourcemaps": "1.6.0", - "is-valid-glob": "0.3.0", - "lazystream": "1.0.0", - "lodash.isequal": "4.5.0", - "merge-stream": "1.0.1", - "mkdirp": "0.5.1", - "object-assign": "4.1.1", - "readable-stream": "2.2.11", - "strip-bom": "2.0.0", - "strip-bom-stream": "1.0.0", - "through2": "2.0.3", - "through2-filter": "2.0.0", - "vali-date": "1.0.0", - "vinyl": "1.2.0" - } - } - } - }, - "metal-tools-soy": { - "version": "3.1.0", - "bundled": true, - "dev": true, - "requires": { - "glob-expand": "0.1.0", - "gulp-if": "2.0.2", - "gulp-ignore": "2.0.2", - "gulp-replace": "0.5.4", - "gulp-util": "3.0.8", - "gulp-wrapper": "1.0.0", - "merge": "1.2.0", - "soyparser": "0.2.5", - "stream-combiner": "0.2.2", - "stream-consume": "0.1.0", - "through2": "2.0.3", - "vinyl-fs": "2.4.4" - }, - "dependencies": { - "glob": { - "version": "5.0.15", - "bundled": true, - "dev": true, - "requires": { - "inflight": "1.0.6", - "inherits": "2.0.3", - "minimatch": "3.0.4", - "once": "1.4.0", - "path-is-absolute": "1.0.1" - } - }, - "glob-parent": { - "version": "3.1.0", - "bundled": true, - "dev": true, - "requires": { - "is-glob": "3.1.0", - "path-dirname": "1.0.2" - } - }, - "glob-stream": { - "version": "5.3.5", - "bundled": true, - "dev": true, - "requires": { - "extend": "3.0.1", - "glob": "5.0.15", - "glob-parent": "3.1.0", - "micromatch": "2.3.11", - "ordered-read-streams": "0.3.0", - "through2": "0.6.5", - "to-absolute-glob": "0.1.1", - "unique-stream": "2.2.1" - }, - "dependencies": { - "readable-stream": { - "version": "1.0.34", - "bundled": true, - "dev": true, - "requires": { - "core-util-is": "1.0.2", - "inherits": "2.0.3", - "isarray": "0.0.1", - "string_decoder": "0.10.31" - } - }, - "through2": { - "version": "0.6.5", - "bundled": true, - "dev": true, - "requires": { - "readable-stream": "1.0.34", - "xtend": "4.0.1" - } - } - } - }, - "is-extglob": { - "version": "2.1.1", - "bundled": true, - "dev": true - }, - "is-glob": { - "version": "3.1.0", - "bundled": true, - "dev": true, - "requires": { - "is-extglob": "2.1.1" - } - }, - "isarray": { - "version": "0.0.1", - "bundled": true, - "dev": true - }, - "lazystream": { - "version": "1.0.0", - "bundled": true, - "dev": true, - "requires": { - "readable-stream": "2.2.11" - } - }, - "ordered-read-streams": { - "version": "0.3.0", - "bundled": true, - "dev": true, - "requires": { - "is-stream": "1.1.0", - "readable-stream": "2.2.11" - } - }, - "string_decoder": { - "version": "0.10.31", - "bundled": true, - "dev": true - }, - "strip-bom": { - "version": "2.0.0", - "bundled": true, - "dev": true, - "requires": { - "is-utf8": "0.2.1" - } - }, - "unique-stream": { - "version": "2.2.1", - "bundled": true, - "dev": true, - "requires": { - "json-stable-stringify": "1.0.1", - "through2-filter": "2.0.0" - } - }, - "vinyl": { - "version": "1.2.0", - "bundled": true, - "dev": true, - "requires": { - "clone": "1.0.2", - "clone-stats": "0.0.1", - "replace-ext": "0.0.1" - } - }, - "vinyl-fs": { - "version": "2.4.4", - "bundled": true, - "dev": true, - "requires": { - "duplexify": "3.5.0", - "glob-stream": "5.3.5", - "graceful-fs": "4.1.11", - "gulp-sourcemaps": "1.6.0", - "is-valid-glob": "0.3.0", - "lazystream": "1.0.0", - "lodash.isequal": "4.5.0", - "merge-stream": "1.0.1", - "mkdirp": "0.5.1", - "object-assign": "4.1.1", - "readable-stream": "2.2.11", - "strip-bom": "2.0.0", - "strip-bom-stream": "1.0.0", - "through2": "2.0.3", - "through2-filter": "2.0.0", - "vali-date": "1.0.0", - "vinyl": "1.2.0" - } - } - } - }, - "micromatch": { - "version": "2.3.11", - "bundled": true, - "dev": true, - "requires": { - "arr-diff": "2.0.0", - "array-unique": "0.2.1", - "braces": "1.8.5", - "expand-brackets": "0.1.5", - "extglob": "0.3.2", - "filename-regex": "2.0.1", - "is-extglob": "1.0.0", - "is-glob": "2.0.1", - "kind-of": "3.2.2", - "normalize-path": "2.1.1", - "object.omit": "2.0.1", - "parse-glob": "3.0.4", - "regex-cache": "0.4.3" - } - }, - "mime": { - "version": "1.3.6", - "bundled": true, - "dev": true - }, - "mime-db": { - "version": "1.27.0", - "bundled": true, - "dev": true - }, - "mime-types": { - "version": "2.1.15", - "bundled": true, - "dev": true, - "requires": { - "mime-db": "1.27.0" - } - }, - "minimatch": { - "version": "3.0.4", - "bundled": true, - "dev": true, - "requires": { - "brace-expansion": "1.1.8" - } - }, - "minimist": { - "version": "0.0.8", - "bundled": true, - "dev": true - }, - "mkdirp": { - "version": "0.5.1", - "bundled": true, - "dev": true, - "requires": { - "minimist": "0.0.8" - } - }, - "mocha": { - "version": "2.5.3", - "bundled": true, - "dev": true, - "requires": { - "commander": "2.3.0", - "debug": "2.2.0", - "diff": "1.4.0", - "escape-string-regexp": "1.0.2", - "glob": "3.2.11", - "growl": "1.9.2", - "jade": "0.26.3", - "mkdirp": "0.5.1", - "supports-color": "1.2.0", - "to-iso-string": "0.0.2" - }, - "dependencies": { - "commander": { - "version": "2.3.0", - "bundled": true, - "dev": true - }, - "debug": { - "version": "2.2.0", - "bundled": true, - "dev": true, - "requires": { - "ms": "0.7.1" - } - }, - "escape-string-regexp": { - "version": "1.0.2", - "bundled": true, - "dev": true - }, - "glob": { - "version": "3.2.11", - "bundled": true, - "dev": true, - "requires": { - "inherits": "2.0.3", - "minimatch": "0.3.0" - } - }, - "minimatch": { - "version": "0.3.0", - "bundled": true, - "dev": true, - "requires": { - "lru-cache": "2.7.3", - "sigmund": "1.0.1" - } - }, - "ms": { - "version": "0.7.1", - "bundled": true, - "dev": true - }, - "supports-color": { - "version": "1.2.0", - "bundled": true, - "dev": true - } - } - }, - "moment": { - "version": "2.0.0", - "bundled": true, - "dev": true - }, - "mout": { - "version": "1.0.0", - "bundled": true, - "dev": true - }, - "ms": { - "version": "2.0.0", - "bundled": true, - "dev": true - }, - "mtil": { - "version": "0.1.3", - "bundled": true, - "dev": true - }, - "multipipe": { - "version": "0.1.2", - "bundled": true, - "dev": true, - "requires": { - "duplexer2": "0.0.2" - } - }, - "mute-stream": { - "version": "0.0.5", - "bundled": true, - "dev": true - }, - "nan": { - "version": "2.6.2", - "bundled": true, - "dev": true - }, - "natural-compare": { - "version": "1.4.0", - "bundled": true, - "dev": true - }, - "negotiator": { - "version": "0.6.1", - "bundled": true, - "dev": true - }, - "node-gyp": { - "version": "3.6.2", - "bundled": true, - "dev": true, - "requires": { - "fstream": "1.0.11", - "glob": "7.1.2", - "graceful-fs": "4.1.11", - "minimatch": "3.0.4", - "mkdirp": "0.5.1", - "nopt": "3.0.6", - "npmlog": "4.1.0", - "osenv": "0.1.4", - "request": "2.81.0", - "rimraf": "2.6.1", - "semver": "5.3.0", - "tar": "2.2.1", - "which": "1.2.14" - }, - "dependencies": { - "semver": { - "version": "5.3.0", - "bundled": true, - "dev": true - } - } - }, - "node-int64": { - "version": "0.3.3", - "bundled": true, - "dev": true - }, - "node-sass": { - "version": "3.13.1", - "bundled": true, - "dev": true, - "requires": { - "async-foreach": "0.1.3", - "chalk": "1.1.3", - "cross-spawn": "3.0.1", - "gaze": "1.1.2", - "get-stdin": "4.0.1", - "glob": "7.1.2", - "in-publish": "2.0.0", - "lodash.assign": "4.2.0", - "lodash.clonedeep": "4.5.0", - "meow": "3.7.0", - "mkdirp": "0.5.1", - "nan": "2.6.2", - "node-gyp": "3.6.2", - "npmlog": "4.1.0", - "request": "2.81.0", - "sass-graph": "2.2.4" - }, - "dependencies": { - "gaze": { - "version": "1.1.2", - "bundled": true, - "dev": true, - "requires": { - "globule": "1.2.0" - } - }, - "globule": { - "version": "1.2.0", - "bundled": true, - "dev": true, - "requires": { - "glob": "7.1.2", - "lodash": "4.17.4", - "minimatch": "3.0.4" - } - } - } - }, - "nomnomnomnom": { - "version": "2.0.1", - "bundled": true, - "dev": true, - "requires": { - "chalk": "0.4.0", - "underscore": "1.6.0" - }, - "dependencies": { - "ansi-styles": { - "version": "1.0.0", - "bundled": true, - "dev": true - }, - "chalk": { - "version": "0.4.0", - "bundled": true, - "dev": true, - "requires": { - "ansi-styles": "1.0.0", - "has-color": "0.1.7", - "strip-ansi": "0.1.1" - } - }, - "strip-ansi": { - "version": "0.1.1", - "bundled": true, - "dev": true - }, - "underscore": { - "version": "1.6.0", - "bundled": true, - "dev": true - } - } - }, - "nopt": { - "version": "3.0.6", - "bundled": true, - "dev": true, - "requires": { - "abbrev": "1.1.0" - } - }, - "normalize-package-data": { - "version": "2.3.8", - "bundled": true, - "dev": true, - "requires": { - "hosted-git-info": "2.4.2", - "is-builtin-module": "1.0.0", - "semver": "4.3.6", - "validate-npm-package-license": "3.0.1" - } - }, - "normalize-path": { - "version": "2.1.1", - "bundled": true, - "dev": true, - "requires": { - "remove-trailing-separator": "1.0.2" - } - }, - "npm-path": { - "version": "1.1.0", - "bundled": true, - "dev": true, - "requires": { - "which": "1.2.14" - } - }, - "npm-run": { - "version": "2.0.0", - "bundled": true, - "dev": true, - "requires": { - "minimist": "1.2.0", - "npm-path": "1.1.0", - "npm-which": "2.0.0", - "serializerr": "1.0.3", - "spawn-sync": "1.0.15", - "sync-exec": "0.5.0" - }, - "dependencies": { - "minimist": { - "version": "1.2.0", - "bundled": true, - "dev": true - } - } - }, - "npm-which": { - "version": "2.0.0", - "bundled": true, - "dev": true, - "requires": { - "commander": "2.9.0", - "npm-path": "1.1.0", - "which": "1.2.14" - } - }, - "npmlog": { - "version": "4.1.0", - "bundled": true, - "dev": true, - "requires": { - "are-we-there-yet": "1.1.4", - "console-control-strings": "1.1.0", - "gauge": "2.7.4", - "set-blocking": "2.0.0" - } - }, - "null-check": { - "version": "1.0.0", - "bundled": true, - "dev": true - }, - "number-is-nan": { - "version": "1.0.1", - "bundled": true, - "dev": true - }, - "oauth-sign": { - "version": "0.8.2", - "bundled": true, - "dev": true - }, - "object-assign": { - "version": "4.1.1", - "bundled": true, - "dev": true - }, - "object-component": { - "version": "0.0.3", - "bundled": true, - "dev": true - }, - "object.omit": { - "version": "2.0.1", - "bundled": true, - "dev": true, - "requires": { - "for-own": "0.1.5", - "is-extendable": "0.1.1" - } - }, - "on-finished": { - "version": "2.3.0", - "bundled": true, - "dev": true, - "requires": { - "ee-first": "1.1.1" - } - }, - "once": { - "version": "1.4.0", - "bundled": true, - "dev": true, - "requires": { - "wrappy": "1.0.2" - } - }, - "onetime": { - "version": "1.1.0", - "bundled": true, - "dev": true - }, - "open": { - "version": "0.0.5", - "bundled": true, - "dev": true - }, - "optimist": { - "version": "0.6.1", - "bundled": true, - "dev": true, - "requires": { - "minimist": "0.0.8", - "wordwrap": "0.0.3" - }, - "dependencies": { - "wordwrap": { - "version": "0.0.3", - "bundled": true, - "dev": true - } - } - }, - "optionator": { - "version": "0.8.2", - "bundled": true, - "dev": true, - "requires": { - "deep-is": "0.1.3", - "fast-levenshtein": "2.0.6", - "levn": "0.3.0", - "prelude-ls": "1.1.2", - "type-check": "0.3.2", - "wordwrap": "1.0.0" - } - }, - "options": { - "version": "0.0.6", - "bundled": true, - "dev": true - }, - "os-homedir": { - "version": "1.0.2", - "bundled": true, - "dev": true - }, - "os-locale": { - "version": "1.4.0", - "bundled": true, - "dev": true, - "requires": { - "lcid": "1.0.0" - } - }, - "os-shim": { - "version": "0.1.3", - "bundled": true, - "dev": true - }, - "os-tmpdir": { - "version": "1.0.2", - "bundled": true, - "dev": true - }, - "osenv": { - "version": "0.1.4", - "bundled": true, - "dev": true, - "requires": { - "os-homedir": "1.0.2", - "os-tmpdir": "1.0.2" - } - }, - "parse-glob": { - "version": "3.0.4", - "bundled": true, - "dev": true, - "requires": { - "glob-base": "0.3.0", - "is-dotfile": "1.0.3", - "is-extglob": "1.0.0", - "is-glob": "2.0.1" - } - }, - "parse-json": { - "version": "2.2.0", - "bundled": true, - "dev": true, - "requires": { - "error-ex": "1.3.1" - } - }, - "parsejson": { - "version": "0.0.3", - "bundled": true, - "dev": true, - "requires": { - "better-assert": "1.0.2" - } - }, - "parseqs": { - "version": "0.0.5", - "bundled": true, - "dev": true, - "requires": { - "better-assert": "1.0.2" - } - }, - "parseuri": { - "version": "0.0.5", - "bundled": true, - "dev": true, - "requires": { - "better-assert": "1.0.2" - } - }, - "parseurl": { - "version": "1.3.1", - "bundled": true, - "dev": true - }, - "path-dirname": { - "version": "1.0.2", - "bundled": true, - "dev": true - }, - "path-exists": { - "version": "2.1.0", - "bundled": true, - "dev": true, - "requires": { - "pinkie-promise": "2.0.1" - } - }, - "path-is-absolute": { - "version": "1.0.1", - "bundled": true, - "dev": true - }, - "path-is-inside": { - "version": "1.0.2", - "bundled": true, - "dev": true - }, - "path-parse": { - "version": "1.0.5", - "bundled": true, - "dev": true - }, - "path-type": { - "version": "1.1.0", - "bundled": true, - "dev": true, - "requires": { - "graceful-fs": "4.1.11", - "pify": "2.3.0", - "pinkie-promise": "2.0.1" - } - }, - "performance-now": { - "version": "0.2.0", - "bundled": true, - "dev": true - }, - "pify": { - "version": "2.3.0", - "bundled": true, - "dev": true - }, - "pinkie": { - "version": "2.0.4", - "bundled": true, - "dev": true - }, - "pinkie-promise": { - "version": "2.0.1", - "bundled": true, - "dev": true, - "requires": { - "pinkie": "2.0.4" - } - }, - "plur": { - "version": "2.1.2", - "bundled": true, - "dev": true, - "requires": { - "irregular-plurals": "1.2.0" - } - }, - "pluralize": { - "version": "1.2.1", - "bundled": true, - "dev": true - }, - "prelude-ls": { - "version": "1.1.2", - "bundled": true, - "dev": true - }, - "preserve": { - "version": "0.2.0", - "bundled": true, - "dev": true - }, - "private": { - "version": "0.1.7", - "bundled": true, - "dev": true - }, - "process-nextick-args": { - "version": "1.0.7", - "bundled": true, - "dev": true - }, - "progress": { - "version": "1.1.8", - "bundled": true, - "dev": true - }, - "protochain": { - "version": "1.0.5", - "bundled": true, - "dev": true - }, - "pseudomap": { - "version": "1.0.2", - "bundled": true, - "dev": true - }, - "punycode": { - "version": "1.4.1", - "bundled": true, - "dev": true - }, - "q": { - "version": "0.9.7", - "bundled": true, - "dev": true - }, - "qjobs": { - "version": "1.1.5", - "bundled": true, - "dev": true - }, - "qs": { - "version": "6.4.0", - "bundled": true, - "dev": true - }, - "randomatic": { - "version": "1.1.7", - "bundled": true, - "dev": true, - "requires": { - "is-number": "3.0.0", - "kind-of": "4.0.0" - }, - "dependencies": { - "is-number": { - "version": "3.0.0", - "bundled": true, - "dev": true, - "requires": { - "kind-of": "3.2.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "bundled": true, - "dev": true, - "requires": { - "is-buffer": "1.1.5" - } - } - } - }, - "kind-of": { - "version": "4.0.0", - "bundled": true, - "dev": true, - "requires": { - "is-buffer": "1.1.5" - } - } - } - }, - "range-parser": { - "version": "1.2.0", - "bundled": true, - "dev": true - }, - "raw-body": { - "version": "2.2.0", - "bundled": true, - "dev": true, - "requires": { - "bytes": "2.4.0", - "iconv-lite": "0.4.15", - "unpipe": "1.0.0" - } - }, - "rcfinder": { - "version": "0.1.9", - "bundled": true, - "dev": true, - "requires": { - "lodash.clonedeep": "4.5.0" - } - }, - "rcloader": { - "version": "0.2.2", - "bundled": true, - "dev": true, - "requires": { - "lodash.assign": "4.2.0", - "lodash.isobject": "3.0.2", - "lodash.merge": "4.6.0", - "rcfinder": "0.1.9" - } - }, - "read-pkg": { - "version": "1.1.0", - "bundled": true, - "dev": true, - "requires": { - "load-json-file": "1.1.0", - "normalize-package-data": "2.3.8", - "path-type": "1.1.0" - } - }, - "read-pkg-up": { - "version": "1.0.1", - "bundled": true, - "dev": true, - "requires": { - "find-up": "1.1.2", - "read-pkg": "1.1.0" - } - }, - "readable-stream": { - "version": "2.2.11", - "bundled": true, - "dev": true, - "requires": { - "core-util-is": "1.0.2", - "inherits": "2.0.3", - "isarray": "1.0.0", - "process-nextick-args": "1.0.7", - "safe-buffer": "5.0.1", - "string_decoder": "1.0.2", - "util-deprecate": "1.0.2" - } - }, - "readdirp": { - "version": "2.1.0", - "bundled": true, - "dev": true, - "requires": { - "graceful-fs": "4.1.11", - "minimatch": "3.0.4", - "readable-stream": "2.2.11", - "set-immediate-shim": "1.0.1" - } - }, - "readline2": { - "version": "1.0.1", - "bundled": true, - "dev": true, - "requires": { - "code-point-at": "1.1.0", - "is-fullwidth-code-point": "1.0.0", - "mute-stream": "0.0.5" - } - }, - "rechoir": { - "version": "0.6.2", - "bundled": true, - "dev": true, - "requires": { - "resolve": "1.3.3" - } - }, - "redent": { - "version": "1.0.0", - "bundled": true, - "dev": true, - "requires": { - "indent-string": "2.1.0", - "strip-indent": "1.0.1" - } - }, - "regenerate": { - "version": "1.3.2", - "bundled": true, - "dev": true - }, - "regenerator-runtime": { - "version": "0.10.5", - "bundled": true, - "dev": true - }, - "regenerator-transform": { - "version": "0.9.11", - "bundled": true, - "dev": true, - "requires": { - "babel-runtime": "6.23.0", - "babel-types": "6.25.0", - "private": "0.1.7" - } - }, - "regex-cache": { - "version": "0.4.3", - "bundled": true, - "dev": true, - "requires": { - "is-equal-shallow": "0.1.3", - "is-primitive": "2.0.0" - } - }, - "regexpu-core": { - "version": "2.0.0", - "bundled": true, - "dev": true, - "requires": { - "regenerate": "1.3.2", - "regjsgen": "0.2.0", - "regjsparser": "0.1.5" - } - }, - "regjsgen": { - "version": "0.2.0", - "bundled": true, - "dev": true - }, - "regjsparser": { - "version": "0.1.5", - "bundled": true, - "dev": true, - "requires": { - "jsesc": "0.5.0" - } - }, - "remove-trailing-separator": { - "version": "1.0.2", - "bundled": true, - "dev": true - }, - "repeat-element": { - "version": "1.1.2", - "bundled": true, - "dev": true - }, - "repeat-string": { - "version": "1.6.1", - "bundled": true, - "dev": true - }, - "repeating": { - "version": "2.0.1", - "bundled": true, - "dev": true, - "requires": { - "is-finite": "1.0.2" - } - }, - "replace-ext": { - "version": "0.0.1", - "bundled": true, - "dev": true - }, - "replacestream": { - "version": "4.0.2", - "bundled": true, - "dev": true, - "requires": { - "escape-string-regexp": "1.0.5", - "object-assign": "4.1.1", - "readable-stream": "2.2.11" - } - }, - "request": { - "version": "2.81.0", - "bundled": true, - "dev": true, - "requires": { - "aws-sign2": "0.6.0", - "aws4": "1.6.0", - "caseless": "0.12.0", - "combined-stream": "1.0.5", - "extend": "3.0.1", - "forever-agent": "0.6.1", - "form-data": "2.1.4", - "har-validator": "4.2.1", - "hawk": "3.1.3", - "http-signature": "1.1.1", - "is-typedarray": "1.0.0", - "isstream": "0.1.2", - "json-stringify-safe": "5.0.1", - "mime-types": "2.1.15", - "oauth-sign": "0.8.2", - "performance-now": "0.2.0", - "qs": "6.4.0", - "safe-buffer": "5.0.1", - "stringstream": "0.0.5", - "tough-cookie": "2.3.2", - "tunnel-agent": "0.6.0", - "uuid": "3.0.1" - } - }, - "require-directory": { - "version": "2.1.1", - "bundled": true, - "dev": true - }, - "require-main-filename": { - "version": "1.0.1", - "bundled": true, - "dev": true - }, - "require-uncached": { - "version": "1.0.3", - "bundled": true, - "dev": true, - "requires": { - "caller-path": "0.1.0", - "resolve-from": "1.0.1" - } - }, - "requires-port": { - "version": "1.0.0", - "bundled": true, - "dev": true - }, - "requizzle": { - "version": "0.2.1", - "bundled": true, - "dev": true, - "requires": { - "underscore": "1.6.0" - }, - "dependencies": { - "underscore": { - "version": "1.6.0", - "bundled": true, - "dev": true - } - } - }, - "resolve": { - "version": "1.3.3", - "bundled": true, - "dev": true, - "requires": { - "path-parse": "1.0.5" - } - }, - "resolve-from": { - "version": "1.0.1", - "bundled": true, - "dev": true - }, - "restore-cursor": { - "version": "1.0.1", - "bundled": true, - "dev": true, - "requires": { - "exit-hook": "1.1.1", - "onetime": "1.1.0" - } - }, - "right-align": { - "version": "0.1.3", - "bundled": true, - "dev": true, - "requires": { - "align-text": "0.1.4" - } - }, - "rimraf": { - "version": "2.6.1", - "bundled": true, - "dev": true, - "requires": { - "glob": "7.1.2" - } - }, - "rocambole": { - "version": "0.7.0", - "bundled": true, - "dev": true, - "requires": { - "esprima": "2.7.3" - }, - "dependencies": { - "esprima": { - "version": "2.7.3", - "bundled": true, - "dev": true - } - } - }, - "rocambole-indent": { - "version": "2.0.4", - "bundled": true, - "dev": true, - "requires": { - "debug": "2.6.8", - "mout": "0.11.1", - "rocambole-token": "1.2.1" - }, - "dependencies": { - "mout": { - "version": "0.11.1", - "bundled": true, - "dev": true - } - } - }, - "rocambole-linebreak": { - "version": "1.0.2", - "bundled": true, - "dev": true, - "requires": { - "debug": "2.6.8", - "rocambole-token": "1.2.1", - "semver": "4.3.6" - } - }, - "rocambole-node": { - "version": "1.0.0", - "bundled": true, - "dev": true - }, - "rocambole-token": { - "version": "1.2.1", - "bundled": true, - "dev": true - }, - "rocambole-whitespace": { - "version": "1.0.0", - "bundled": true, - "dev": true, - "requires": { - "debug": "2.6.8", - "repeat-string": "1.6.1", - "rocambole-token": "1.2.1" - } - }, - "run-async": { - "version": "0.1.0", - "bundled": true, - "dev": true, - "requires": { - "once": "1.4.0" - } - }, - "run-sequence": { - "version": "1.2.2", - "bundled": true, - "dev": true, - "requires": { - "chalk": "1.1.3", - "gulp-util": "3.0.8" - } - }, - "rx-lite": { - "version": "3.1.2", - "bundled": true, - "dev": true - }, - "safe-buffer": { - "version": "5.0.1", - "bundled": true, - "dev": true - }, - "samsam": { - "version": "1.1.2", - "bundled": true, - "dev": true - }, - "sass-graph": { - "version": "2.2.4", - "bundled": true, - "dev": true, - "requires": { - "glob": "7.1.2", - "lodash": "4.17.4", - "scss-tokenizer": "0.2.3", - "yargs": "7.1.0" - } - }, - "sauce-connect-launcher": { - "version": "0.13.0", - "bundled": true, - "dev": true, - "requires": { - "adm-zip": "0.4.7", - "async": "1.4.0", - "lodash": "3.10.1", - "rimraf": "2.4.3" - }, - "dependencies": { - "async": { - "version": "1.4.0", - "bundled": true, - "dev": true - }, - "glob": { - "version": "5.0.15", - "bundled": true, - "dev": true, - "requires": { - "inflight": "1.0.6", - "inherits": "2.0.3", - "minimatch": "3.0.4", - "once": "1.4.0", - "path-is-absolute": "1.0.1" - } - }, - "lodash": { - "version": "3.10.1", - "bundled": true, - "dev": true - }, - "rimraf": { - "version": "2.4.3", - "bundled": true, - "dev": true, - "requires": { - "glob": "5.0.15" - } - } - } - }, - "saucelabs": { - "version": "1.4.0", - "bundled": true, - "dev": true, - "requires": { - "https-proxy-agent": "1.0.0" - } - }, - "scss-tokenizer": { - "version": "0.2.3", - "bundled": true, - "dev": true, - "requires": { - "js-base64": "2.1.9", - "source-map": "0.4.4" - }, - "dependencies": { - "source-map": { - "version": "0.4.4", - "bundled": true, - "dev": true, - "requires": { - "amdefine": "1.0.1" - } - } - } - }, - "semver": { - "version": "4.3.6", - "bundled": true, - "dev": true - }, - "serializerr": { - "version": "1.0.3", - "bundled": true, - "dev": true, - "requires": { - "protochain": "1.0.5" - } - }, - "set-blocking": { - "version": "2.0.0", - "bundled": true, - "dev": true - }, - "set-immediate-shim": { - "version": "1.0.1", - "bundled": true, - "dev": true - }, - "setprototypeof": { - "version": "1.0.3", - "bundled": true, - "dev": true - }, - "shelljs": { - "version": "0.7.8", - "bundled": true, - "dev": true, - "requires": { - "glob": "7.1.2", - "interpret": "1.0.3", - "rechoir": "0.6.2" - } - }, - "sigmund": { - "version": "1.0.1", - "bundled": true, - "dev": true - }, - "signal-exit": { - "version": "3.0.2", - "bundled": true, - "dev": true - }, - "sinon": { - "version": "1.17.7", - "bundled": true, - "dev": true, - "requires": { - "formatio": "1.1.1", - "lolex": "1.3.2", - "samsam": "1.1.2", - "util": "0.10.3" - } - }, - "slash": { - "version": "1.0.0", - "bundled": true, - "dev": true - }, - "slice-ansi": { - "version": "0.0.4", - "bundled": true, - "dev": true - }, - "sntp": { - "version": "1.0.9", - "bundled": true, - "dev": true, - "requires": { - "hoek": "2.16.3" - } - }, - "socket.io": { - "version": "1.7.3", - "bundled": true, - "dev": true, - "requires": { - "debug": "2.3.3", - "engine.io": "1.8.3", - "has-binary": "0.1.7", - "object-assign": "4.1.0", - "socket.io-adapter": "0.5.0", - "socket.io-client": "1.7.3", - "socket.io-parser": "2.3.1" - }, - "dependencies": { - "debug": { - "version": "2.3.3", - "bundled": true, - "dev": true, - "requires": { - "ms": "0.7.2" - } - }, - "ms": { - "version": "0.7.2", - "bundled": true, - "dev": true - }, - "object-assign": { - "version": "4.1.0", - "bundled": true, - "dev": true - } - } - }, - "socket.io-adapter": { - "version": "0.5.0", - "bundled": true, - "dev": true, - "requires": { - "debug": "2.3.3", - "socket.io-parser": "2.3.1" - }, - "dependencies": { - "debug": { - "version": "2.3.3", - "bundled": true, - "dev": true, - "requires": { - "ms": "0.7.2" - } - }, - "ms": { - "version": "0.7.2", - "bundled": true, - "dev": true - } - } - }, - "socket.io-client": { - "version": "1.7.3", - "bundled": true, - "dev": true, - "requires": { - "backo2": "1.0.2", - "component-bind": "1.0.0", - "component-emitter": "1.2.1", - "debug": "2.3.3", - "engine.io-client": "1.8.3", - "has-binary": "0.1.7", - "indexof": "0.0.1", - "object-component": "0.0.3", - "parseuri": "0.0.5", - "socket.io-parser": "2.3.1", - "to-array": "0.1.4" - }, - "dependencies": { - "component-emitter": { - "version": "1.2.1", - "bundled": true, - "dev": true - }, - "debug": { - "version": "2.3.3", - "bundled": true, - "dev": true, - "requires": { - "ms": "0.7.2" - } - }, - "ms": { - "version": "0.7.2", - "bundled": true, - "dev": true - } - } - }, - "socket.io-parser": { - "version": "2.3.1", - "bundled": true, - "dev": true, - "requires": { - "component-emitter": "1.1.2", - "debug": "2.2.0", - "isarray": "0.0.1", - "json3": "3.3.2" - }, - "dependencies": { - "debug": { - "version": "2.2.0", - "bundled": true, - "dev": true, - "requires": { - "ms": "0.7.1" - } - }, - "isarray": { - "version": "0.0.1", - "bundled": true, - "dev": true - }, - "ms": { - "version": "0.7.1", - "bundled": true, - "dev": true - } - } - }, - "source-map": { - "version": "0.5.6", - "bundled": true, - "dev": true - }, - "source-map-support": { - "version": "0.4.15", - "bundled": true, - "dev": true, - "requires": { - "source-map": "0.5.6" - } - }, - "soyparser": { - "version": "0.2.5", - "bundled": true, - "dev": true, - "requires": { - "merge": "1.2.0", - "tunic": "1.0.0" - } - }, - "sparkles": { - "version": "1.0.0", - "bundled": true, - "dev": true - }, - "spawn-sync": { - "version": "1.0.15", - "bundled": true, - "dev": true, - "requires": { - "concat-stream": "1.6.0", - "os-shim": "0.1.3" - } - }, - "spdx-correct": { - "version": "1.0.2", - "bundled": true, - "dev": true, - "requires": { - "spdx-license-ids": "1.2.2" - } - }, - "spdx-expression-parse": { - "version": "1.0.4", - "bundled": true, - "dev": true - }, - "spdx-license-ids": { - "version": "1.2.2", - "bundled": true, - "dev": true - }, - "sprintf-js": { - "version": "1.0.3", - "bundled": true, - "dev": true - }, - "sshpk": { - "version": "1.13.1", - "bundled": true, - "dev": true, - "requires": { - "asn1": "0.2.3", - "assert-plus": "1.0.0", - "bcrypt-pbkdf": "1.0.1", - "dashdash": "1.14.1", - "ecc-jsbn": "0.1.1", - "getpass": "0.1.7", - "jsbn": "0.1.1", - "tweetnacl": "0.14.5" - }, - "dependencies": { - "assert-plus": { - "version": "1.0.0", - "bundled": true, - "dev": true - } - } - }, - "statuses": { - "version": "1.3.1", - "bundled": true, - "dev": true - }, - "stdin": { - "version": "0.0.1", - "bundled": true, - "dev": true - }, - "stream-combiner": { - "version": "0.2.2", - "bundled": true, - "dev": true, - "requires": { - "duplexer": "0.1.1", - "through": "2.3.8" - } - }, - "stream-consume": { - "version": "0.1.0", - "bundled": true, - "dev": true - }, - "stream-shift": { - "version": "1.0.0", - "bundled": true, - "dev": true - }, - "string_decoder": { - "version": "1.0.2", - "bundled": true, - "dev": true, - "requires": { - "safe-buffer": "5.0.1" - } - }, - "string-length": { - "version": "1.0.1", - "bundled": true, - "dev": true, - "requires": { - "strip-ansi": "3.0.1" - } - }, - "string-width": { - "version": "1.0.2", - "bundled": true, - "dev": true, - "requires": { - "code-point-at": "1.1.0", - "is-fullwidth-code-point": "1.0.0", - "strip-ansi": "3.0.1" - } - }, - "stringstream": { - "version": "0.0.5", - "bundled": true, - "dev": true - }, - "strip-ansi": { - "version": "3.0.1", - "bundled": true, - "dev": true, - "requires": { - "ansi-regex": "2.1.1" - } - }, - "strip-bom": { - "version": "3.0.0", - "bundled": true, - "dev": true - }, - "strip-bom-stream": { - "version": "1.0.0", - "bundled": true, - "dev": true, - "requires": { - "first-chunk-stream": "1.0.0", - "strip-bom": "2.0.0" - }, - "dependencies": { - "strip-bom": { - "version": "2.0.0", - "bundled": true, - "dev": true, - "requires": { - "is-utf8": "0.2.1" - } - } - } - }, - "strip-indent": { - "version": "1.0.1", - "bundled": true, - "dev": true, - "requires": { - "get-stdin": "4.0.1" - } - }, - "strip-json-comments": { - "version": "2.0.1", - "bundled": true, - "dev": true - }, - "supports-color": { - "version": "2.0.0", - "bundled": true, - "dev": true - }, - "sync-exec": { - "version": "0.5.0", - "bundled": true, - "dev": true - }, - "table": { - "version": "3.8.3", - "bundled": true, - "dev": true, - "requires": { - "ajv": "4.11.8", - "ajv-keywords": "1.5.1", - "chalk": "1.1.3", - "lodash": "4.17.4", - "slice-ansi": "0.0.4", - "string-width": "2.0.0" - }, - "dependencies": { - "is-fullwidth-code-point": { - "version": "2.0.0", - "bundled": true, - "dev": true - }, - "string-width": { - "version": "2.0.0", - "bundled": true, - "dev": true, - "requires": { - "is-fullwidth-code-point": "2.0.0", - "strip-ansi": "3.0.1" - } - } - } - }, - "taffydb": { - "version": "2.6.2", - "bundled": true, - "dev": true - }, - "tar": { - "version": "2.2.1", - "bundled": true, - "dev": true, - "requires": { - "block-stream": "0.0.9", - "fstream": "1.0.11", - "inherits": "2.0.3" - } - }, - "tar-stream": { - "version": "1.1.5", - "bundled": true, - "dev": true, - "requires": { - "bl": "0.9.5", - "end-of-stream": "1.4.0", - "readable-stream": "1.0.34", - "xtend": "4.0.1" - }, - "dependencies": { - "end-of-stream": { - "version": "1.4.0", - "bundled": true, - "dev": true, - "requires": { - "once": "1.4.0" - } - }, - "isarray": { - "version": "0.0.1", - "bundled": true, - "dev": true - }, - "readable-stream": { - "version": "1.0.34", - "bundled": true, - "dev": true, - "requires": { - "core-util-is": "1.0.2", - "inherits": "2.0.3", - "isarray": "0.0.1", - "string_decoder": "0.10.31" - } - }, - "string_decoder": { - "version": "0.10.31", - "bundled": true, - "dev": true - } - } - }, - "temp": { - "version": "0.8.3", - "bundled": true, - "dev": true, - "requires": { - "os-tmpdir": "1.0.2", - "rimraf": "2.2.8" - }, - "dependencies": { - "rimraf": { - "version": "2.2.8", - "bundled": true, - "dev": true - } - } - }, - "ternary-stream": { - "version": "2.0.1", - "bundled": true, - "dev": true, - "requires": { - "duplexify": "3.5.0", - "fork-stream": "0.0.4", - "merge-stream": "1.0.1", - "through2": "2.0.3" - } - }, - "text-table": { - "version": "0.2.0", - "bundled": true, - "dev": true - }, - "textextensions": { - "version": "1.0.2", - "bundled": true, - "dev": true - }, - "through": { - "version": "2.3.8", - "bundled": true, - "dev": true - }, - "through2": { - "version": "2.0.3", - "bundled": true, - "dev": true, - "requires": { - "readable-stream": "2.2.11", - "xtend": "4.0.1" - } - }, - "through2-filter": { - "version": "2.0.0", - "bundled": true, - "dev": true, - "requires": { - "through2": "2.0.3", - "xtend": "4.0.1" - } - }, - "time-stamp": { - "version": "1.1.0", - "bundled": true, - "dev": true - }, - "tmp": { - "version": "0.0.31", - "bundled": true, - "dev": true, - "requires": { - "os-tmpdir": "1.0.2" - } - }, - "to-absolute-glob": { - "version": "0.1.1", - "bundled": true, - "dev": true, - "requires": { - "extend-shallow": "2.0.1" - } - }, - "to-array": { - "version": "0.1.4", - "bundled": true, - "dev": true - }, - "to-fast-properties": { - "version": "1.0.3", - "bundled": true, - "dev": true - }, - "to-iso-string": { - "version": "0.0.2", - "bundled": true, - "dev": true - }, - "tough-cookie": { - "version": "2.3.2", - "bundled": true, - "dev": true, - "requires": { - "punycode": "1.4.1" - } - }, - "trim-newlines": { - "version": "1.0.0", - "bundled": true, - "dev": true - }, - "trim-right": { - "version": "1.0.1", - "bundled": true, - "dev": true - }, - "tryit": { - "version": "1.0.3", - "bundled": true, - "dev": true - }, - "tunic": { - "version": "1.0.0", - "bundled": true, - "dev": true, - "requires": { - "mout": "0.11.1", - "mtil": "0.1.3" - }, - "dependencies": { - "mout": { - "version": "0.11.1", - "bundled": true, - "dev": true - } - } - }, - "tunnel-agent": { - "version": "0.6.0", - "bundled": true, - "dev": true, - "requires": { - "safe-buffer": "5.0.1" - } - }, - "type-check": { - "version": "0.3.2", - "bundled": true, - "dev": true, - "requires": { - "prelude-ls": "1.1.2" - } - }, - "type-detect": { - "version": "0.1.1", - "bundled": true, - "dev": true - }, - "type-is": { - "version": "1.6.15", - "bundled": true, - "dev": true, - "requires": { - "media-typer": "0.3.0", - "mime-types": "2.1.15" - } - }, - "typedarray": { - "version": "0.0.6", - "bundled": true, - "dev": true - }, - "uglify-js": { - "version": "2.6.4", - "bundled": true, - "dev": true, - "requires": { - "async": "0.2.10", - "source-map": "0.5.6", - "uglify-to-browserify": "1.0.2", - "yargs": "3.10.0" - }, - "dependencies": { - "camelcase": { - "version": "1.2.1", - "bundled": true, - "dev": true - }, - "cliui": { - "version": "2.1.0", - "bundled": true, - "dev": true, - "requires": { - "center-align": "0.1.3", - "right-align": "0.1.3", - "wordwrap": "0.0.2" - } - }, - "wordwrap": { - "version": "0.0.2", - "bundled": true, - "dev": true - }, - "yargs": { - "version": "3.10.0", - "bundled": true, - "dev": true, - "requires": { - "camelcase": "1.2.1", - "cliui": "2.1.0", - "decamelize": "1.2.0", - "window-size": "0.1.0" - } - } - } - }, - "uglify-save-license": { - "version": "0.4.1", - "bundled": true, - "dev": true - }, - "uglify-to-browserify": { - "version": "1.0.2", - "bundled": true, - "dev": true - }, - "ultron": { - "version": "1.0.2", - "bundled": true, - "dev": true - }, - "underscore": { - "version": "1.8.3", - "bundled": true, - "dev": true - }, - "underscore-contrib": { - "version": "0.3.0", - "bundled": true, - "dev": true, - "requires": { - "underscore": "1.6.0" - }, - "dependencies": { - "underscore": { - "version": "1.6.0", - "bundled": true, - "dev": true - } - } - }, - "underscore.string": { - "version": "3.0.3", - "bundled": true, - "dev": true - }, - "unpipe": { - "version": "1.0.0", - "bundled": true, - "dev": true - }, - "user-home": { - "version": "2.0.0", - "bundled": true, - "dev": true, - "requires": { - "os-homedir": "1.0.2" - } - }, - "useragent": { - "version": "2.1.13", - "bundled": true, - "dev": true, - "requires": { - "lru-cache": "2.2.4", - "tmp": "0.0.31" - }, - "dependencies": { - "lru-cache": { - "version": "2.2.4", - "bundled": true, - "dev": true - } - } - }, - "util": { - "version": "0.10.3", - "bundled": true, - "dev": true, - "requires": { - "inherits": "2.0.1" - }, - "dependencies": { - "inherits": { - "version": "2.0.1", - "bundled": true, - "dev": true - } - } - }, - "util-deprecate": { - "version": "1.0.2", - "bundled": true, - "dev": true - }, - "utils-merge": { - "version": "1.0.0", - "bundled": true, - "dev": true - }, - "uuid": { - "version": "3.0.1", - "bundled": true, - "dev": true - }, - "vali-date": { - "version": "1.0.0", - "bundled": true, - "dev": true - }, - "validate-npm-package-license": { - "version": "3.0.1", - "bundled": true, - "dev": true, - "requires": { - "spdx-correct": "1.0.2", - "spdx-expression-parse": "1.0.4" - } - }, - "vargs": { - "version": "0.1.0", - "bundled": true, - "dev": true - }, - "verror": { - "version": "1.3.6", - "bundled": true, - "dev": true, - "requires": { - "extsprintf": "1.0.2" - } - }, - "vinyl": { - "version": "0.5.3", - "bundled": true, - "dev": true, - "requires": { - "clone": "1.0.2", - "clone-stats": "0.0.1", - "replace-ext": "0.0.1" - } - }, - "vinyl-sourcemaps-apply": { - "version": "0.2.1", - "bundled": true, - "dev": true, - "requires": { - "source-map": "0.5.6" - } - }, - "void-elements": { - "version": "2.0.1", - "bundled": true, - "dev": true - }, - "wd": { - "version": "0.3.12", - "bundled": true, - "dev": true, - "requires": { - "archiver": "0.14.4", - "async": "1.0.0", - "lodash": "3.9.3", - "q": "1.4.1", - "request": "2.55.0", - "underscore.string": "3.0.3", - "vargs": "0.1.0" - }, - "dependencies": { - "asn1": { - "version": "0.1.11", - "bundled": true, - "dev": true - }, - "assert-plus": { - "version": "0.1.5", - "bundled": true, - "dev": true - }, - "async": { - "version": "1.0.0", - "bundled": true, - "dev": true - }, - "aws-sign2": { - "version": "0.5.0", - "bundled": true, - "dev": true - }, - "bluebird": { - "version": "2.11.0", - "bundled": true, - "dev": true - }, - "caseless": { - "version": "0.9.0", - "bundled": true, - "dev": true - }, - "combined-stream": { - "version": "0.0.7", - "bundled": true, - "dev": true, - "requires": { - "delayed-stream": "0.0.5" - } - }, - "delayed-stream": { - "version": "0.0.5", - "bundled": true, - "dev": true - }, - "form-data": { - "version": "0.2.0", - "bundled": true, - "dev": true, - "requires": { - "async": "0.9.2", - "combined-stream": "0.0.7", - "mime-types": "2.0.14" - }, - "dependencies": { - "async": { - "version": "0.9.2", - "bundled": true, - "dev": true - } - } - }, - "har-validator": { - "version": "1.8.0", - "bundled": true, - "dev": true, - "requires": { - "bluebird": "2.11.0", - "chalk": "1.1.3", - "commander": "2.9.0", - "is-my-json-valid": "2.16.0" - } - }, - "hawk": { - "version": "2.3.1", - "bundled": true, - "dev": true, - "requires": { - "boom": "2.10.1", - "cryptiles": "2.0.5", - "hoek": "2.16.3", - "sntp": "1.0.9" - } - }, - "http-signature": { - "version": "0.10.1", - "bundled": true, - "dev": true, - "requires": { - "asn1": "0.1.11", - "assert-plus": "0.1.5", - "ctype": "0.5.3" - } - }, - "lodash": { - "version": "3.9.3", - "bundled": true, - "dev": true - }, - "mime-db": { - "version": "1.12.0", - "bundled": true, - "dev": true - }, - "mime-types": { - "version": "2.0.14", - "bundled": true, - "dev": true, - "requires": { - "mime-db": "1.12.0" - } - }, - "node-uuid": { - "version": "1.4.8", - "bundled": true, - "dev": true - }, - "oauth-sign": { - "version": "0.6.0", - "bundled": true, - "dev": true - }, - "q": { - "version": "1.4.1", - "bundled": true, - "dev": true - }, - "qs": { - "version": "2.4.2", - "bundled": true, - "dev": true - }, - "request": { - "version": "2.55.0", - "bundled": true, - "dev": true, - "requires": { - "aws-sign2": "0.5.0", - "bl": "0.9.5", - "caseless": "0.9.0", - "combined-stream": "0.0.7", - "forever-agent": "0.6.1", - "form-data": "0.2.0", - "har-validator": "1.8.0", - "hawk": "2.3.1", - "http-signature": "0.10.1", - "isstream": "0.1.2", - "json-stringify-safe": "5.0.1", - "mime-types": "2.0.14", - "node-uuid": "1.4.8", - "oauth-sign": "0.6.0", - "qs": "2.4.2", - "stringstream": "0.0.5", - "tough-cookie": "2.3.2", - "tunnel-agent": "0.4.3" - } - }, - "tunnel-agent": { - "version": "0.4.3", - "bundled": true, - "dev": true - } - } - }, - "which": { - "version": "1.2.14", - "bundled": true, - "dev": true, - "requires": { - "isexe": "2.0.0" - } - }, - "which-module": { - "version": "1.0.0", - "bundled": true, - "dev": true - }, - "wide-align": { - "version": "1.1.2", - "bundled": true, - "dev": true, - "requires": { - "string-width": "1.0.2" - } - }, - "window-size": { - "version": "0.1.0", - "bundled": true, - "dev": true - }, - "wordwrap": { - "version": "1.0.0", - "bundled": true, - "dev": true - }, - "wrap-ansi": { - "version": "2.1.0", - "bundled": true, - "dev": true, - "requires": { - "string-width": "1.0.2", - "strip-ansi": "3.0.1" - } - }, - "wrappy": { - "version": "1.0.2", - "bundled": true, - "dev": true - }, - "write": { - "version": "0.2.1", - "bundled": true, - "dev": true, - "requires": { - "mkdirp": "0.5.1" - } - }, - "ws": { - "version": "1.1.2", - "bundled": true, - "dev": true, - "requires": { - "options": "0.0.6", - "ultron": "1.0.2" - } - }, - "wtf-8": { - "version": "1.0.0", - "bundled": true, - "dev": true - }, - "xmlhttprequest-ssl": { - "version": "1.5.3", - "bundled": true, - "dev": true - }, - "xtend": { - "version": "4.0.1", - "bundled": true, - "dev": true - }, - "y18n": { - "version": "3.2.1", - "bundled": true, - "dev": true - }, - "yallist": { - "version": "2.1.2", - "bundled": true, - "dev": true - }, - "yargs": { - "version": "7.1.0", - "bundled": true, - "dev": true, - "requires": { - "camelcase": "3.0.0", - "cliui": "3.2.0", - "decamelize": "1.2.0", - "get-caller-file": "1.0.2", - "os-locale": "1.4.0", - "read-pkg-up": "1.0.1", - "require-directory": "2.1.1", - "require-main-filename": "1.0.1", - "set-blocking": "2.0.0", - "string-width": "1.0.2", - "which-module": "1.0.0", - "y18n": "3.2.1", - "yargs-parser": "5.0.0" - }, - "dependencies": { - "camelcase": { - "version": "3.0.0", - "bundled": true, - "dev": true - } - } - }, - "yargs-parser": { - "version": "5.0.0", - "bundled": true, - "dev": true, - "requires": { - "camelcase": "3.0.0" - }, - "dependencies": { - "camelcase": { - "version": "3.0.0", - "bundled": true, - "dev": true - } - } - }, - "yeast": { - "version": "0.1.2", - "bundled": true, - "dev": true - }, - "zip-stream": { - "version": "0.5.2", - "bundled": true, - "dev": true, - "requires": { - "compress-commons": "0.2.9", - "lodash": "3.2.0", - "readable-stream": "1.0.34" - }, - "dependencies": { - "isarray": { - "version": "0.0.1", - "bundled": true, - "dev": true - }, - "lodash": { - "version": "3.2.0", - "bundled": true, - "dev": true - }, - "readable-stream": { - "version": "1.0.34", - "bundled": true, - "dev": true, - "requires": { - "core-util-is": "1.0.2", - "inherits": "2.0.3", - "isarray": "0.0.1", - "string_decoder": "0.10.31" - } - }, - "string_decoder": { - "version": "0.10.31", - "bundled": true, - "dev": true - } - } - } + "gulp-if": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/gulp-if/-/gulp-if-2.0.2.tgz", + "integrity": "sha1-pJe351cwBQQcqivIt92jyARE1ik=", + "dev": true, + "requires": { + "gulp-match": "1.0.3", + "ternary-stream": "2.0.1", + "through2": "2.0.3" + } + }, + "gulp-ignore": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/gulp-ignore/-/gulp-ignore-2.0.2.tgz", + "integrity": "sha1-XC6ioKRALgq0orzRLv2SlTRNePI=", + "dev": true, + "requires": { + "gulp-match": "1.0.3", + "through2": "2.0.3" + } + }, + "gulp-match": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/gulp-match/-/gulp-match-1.0.3.tgz", + "integrity": "sha1-kcfA1/Kb7NZgbVfYCn+Hdqh6uo4=", + "dev": true, + "requires": { + "minimatch": "3.0.4" } }, "gulp-replace": { @@ -12783,7 +5150,7 @@ "integrity": "sha1-ukAsJmGU8VlW7xXg/PJCmT9qff0=", "dev": true, "requires": { - "ajv": "5.3.0", + "ajv": "5.4.0", "har-schema": "2.0.0" } }, @@ -12822,12 +5189,6 @@ } } }, - "has-color": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/has-color/-/has-color-0.1.7.tgz", - "integrity": "sha1-ZxRKUmDDT8PMpnfQQdr1L+e3iy8=", - "dev": true - }, "has-cors": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/has-cors/-/has-cors-1.1.0.tgz", @@ -13015,12 +5376,6 @@ "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-1.0.0.tgz", "integrity": "sha1-MtDkcvkf80VwHBWoMRAY07CpA3k=", "dev": true - }, - "strip-indent": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-2.0.0.tgz", - "integrity": "sha1-XvjbKV0B5u1sv3qrlpmNeCJSe2g=", - "dev": true } } }, @@ -13104,7 +5459,7 @@ "chalk": "2.3.0", "cli-cursor": "2.1.0", "cli-width": "2.2.0", - "external-editor": "2.0.5", + "external-editor": "2.1.0", "figures": "2.0.0", "lodash": "4.17.4", "mute-stream": "0.0.7", @@ -13221,7 +5576,7 @@ "integrity": "sha1-dfFmQrSA8YenEcgUFh/TpKdlWJg=", "dev": true, "requires": { - "binary-extensions": "1.10.0" + "binary-extensions": "1.11.0" } }, "is-buffer": { @@ -13251,7 +5606,7 @@ "integrity": "sha1-9zkzayYyNlBhqdSCcM1WrjNpMY4=", "dev": true, "requires": { - "ci-info": "1.1.1" + "ci-info": "1.1.2" } }, "is-date-object": { @@ -13551,31 +5906,6 @@ "whatwg-fetch": "2.0.3" } }, - "isparta": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/isparta/-/isparta-4.0.0.tgz", - "integrity": "sha1-HekZlvSAsi3LGsqFECVbrhV0RG4=", - "dev": true, - "requires": { - "babel-core": "6.26.0", - "escodegen": "1.9.0", - "esprima": "2.7.3", - "istanbul": "0.4.5", - "mkdirp": "0.5.1", - "nomnomnomnom": "2.0.1", - "object-assign": "4.1.1", - "source-map": "0.5.7", - "which": "1.3.0" - }, - "dependencies": { - "esprima": { - "version": "2.7.3", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-2.7.3.tgz", - "integrity": "sha1-luO3DVd59q1JzQMmc9HDEnZ7pYE=", - "dev": true - } - } - }, "isstream": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", @@ -13748,12 +6078,6 @@ "pretty-format": "21.2.1" }, "dependencies": { - "ansi-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", - "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", - "dev": true - }, "ansi-styles": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", @@ -13774,16 +6098,6 @@ "supports-color": "4.5.0" } }, - "pretty-format": { - "version": "21.2.1", - "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-21.2.1.tgz", - "integrity": "sha512-ZdWPGYAnYfcVP8yKA3zFjCn8s4/17TeYH28MXuC8vTp0o21eXjbFGcOAXZEaDaOFJjc3h2qa7HQNHNshhvoh2A==", - "dev": true, - "requires": { - "ansi-regex": "3.0.0", - "ansi-styles": "3.2.0" - } - }, "supports-color": { "version": "4.5.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz", @@ -13795,12 +6109,6 @@ } } }, - "js-base64": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/js-base64/-/js-base64-2.3.2.tgz", - "integrity": "sha512-Y2/+DnfJJXT1/FCwUebUhLWb3QihxiSC42+ctHLGogmW2jPY6LCapMdFZXRvVP2z6qyKW7s6qncE/9gSqZiArw==", - "dev": true - }, "js-string-escape": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/js-string-escape/-/js-string-escape-1.0.1.tgz", @@ -13830,12 +6138,6 @@ "dev": true, "optional": true }, - "jschardet": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/jschardet/-/jschardet-1.6.0.tgz", - "integrity": "sha512-xYuhvQ7I9PDJIGBWev9xm0+SMSed3ZDBAmvVjbFR1ZRLAF+vlXcQu6cRI9uAlj81rzikElRVteehwV7DuX2ZmQ==", - "dev": true - }, "jsdom": { "version": "9.12.0", "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-9.12.0.tgz", @@ -13896,6 +6198,12 @@ "jsonify": "0.0.0" } }, + "json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=", + "dev": true + }, "json-stringify-safe": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", @@ -13915,9 +6223,9 @@ "dev": true }, "jsonfile": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-2.4.0.tgz", - "integrity": "sha1-NzaitCi4e72gzIO1P6PWM6NcKug=", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", + "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=", "dev": true, "requires": { "graceful-fs": "4.1.11" @@ -14059,9 +6367,9 @@ "dev": true }, "karma-chrome-launcher": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/karma-chrome-launcher/-/karma-chrome-launcher-2.2.0.tgz", - "integrity": "sha512-uf/ZVpAabDBPvdPdveyk1EPgbnloPvFFGgmRhYLTDH7gEB4nZdSBk8yTU47w1g/drLSx5uMOkjKk7IWKfWg/+w==", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/karma-chrome-launcher/-/karma-chrome-launcher-1.0.1.tgz", + "integrity": "sha1-vlrnxCZPmgouIuPZhL6zJa2SyMs=", "dev": true, "requires": { "fs-access": "1.0.1", @@ -14207,8 +6515,8 @@ "cmd-shim": "2.0.2", "columnify": "1.5.4", "command-join": "2.0.0", - "conventional-changelog-cli": "1.3.4", - "conventional-recommended-bump": "1.0.2", + "conventional-changelog-cli": "1.3.5", + "conventional-recommended-bump": "1.0.3", "dedent": "0.7.0", "execa": "0.8.0", "find-up": "2.1.0", @@ -14271,17 +6579,6 @@ "locate-path": "2.0.0" } }, - "fs-extra": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-4.0.2.tgz", - "integrity": "sha1-+RcExT0bRh+JNFKwwwfZmXZHq2s=", - "dev": true, - "requires": { - "graceful-fs": "4.1.11", - "jsonfile": "4.0.0", - "universalify": "0.1.1" - } - }, "glob-parent": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-3.1.0.tgz", @@ -14320,15 +6617,6 @@ "is-extglob": "2.1.1" } }, - "jsonfile": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", - "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=", - "dev": true, - "requires": { - "graceful-fs": "4.1.11" - } - }, "load-json-file": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-3.0.0.tgz", @@ -14994,9 +7282,9 @@ } }, "loglevel": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/loglevel/-/loglevel-1.5.1.tgz", - "integrity": "sha1-GJB4yUq5BT7iFaCs2/JCROoPZQI=", + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/loglevel/-/loglevel-1.6.0.tgz", + "integrity": "sha1-rgyqVhERSYxboTcj1vtjHSQAOTQ=", "dev": true }, "loglevel-colored-level-prefix": { @@ -15006,7 +7294,7 @@ "dev": true, "requires": { "chalk": "1.1.3", - "loglevel": "1.5.1" + "loglevel": "1.6.0" } }, "lolex": { @@ -15074,9 +7362,9 @@ } }, "make-plural": { - "version": "3.0.6", - "resolved": "https://registry.npmjs.org/make-plural/-/make-plural-3.0.6.tgz", - "integrity": "sha1-IDOgO6wpC487uRJY9lud9+iwHKc=", + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/make-plural/-/make-plural-4.1.1.tgz", + "integrity": "sha512-triaMVDDYiB+OU1Mz6ht74+z0Bb/bzNESeMwRboSprI3GRWbOvfxEnpWI0eDixQtMPrC2C0revd4wmuck5GcoQ==", "dev": true, "requires": { "minimist": "1.2.0" @@ -15182,13 +7470,13 @@ } }, "messageformat": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/messageformat/-/messageformat-1.0.2.tgz", - "integrity": "sha1-kI9GkfKf8o2uNcRUNqJM/5NAI4g=", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/messageformat/-/messageformat-1.1.0.tgz", + "integrity": "sha512-0Pw6VMOzuWTorRwGXyY0oeosd6zlTykYYHMNJtK4bOwc/1G7yqr3mSg1fd822nKpBcN6J3YvdTKC4TRWsl/fqw==", "dev": true, "requires": { "glob": "7.0.6", - "make-plural": "3.0.6", + "make-plural": "4.1.1", "messageformat-parser": "1.1.0", "nopt": "3.0.6", "reserved-words": "0.1.2" @@ -15606,9 +7894,9 @@ } }, "moment": { - "version": "2.19.1", - "resolved": "https://registry.npmjs.org/moment/-/moment-2.19.1.tgz", - "integrity": "sha1-VtoaLRy/AdOLfhr8McELz6GSkWc=", + "version": "2.19.2", + "resolved": "https://registry.npmjs.org/moment/-/moment-2.19.2.tgz", + "integrity": "sha512-Rf6jiHPEfxp9+dlzxPTmRHbvoFXsh2L/U8hOupUMpnuecHQmI6cF6lUbJl3QqKPko1u6ujO+FxtcajLVfLpAtA==", "dev": true }, "mout": { @@ -15674,9 +7962,9 @@ "dev": true }, "nan": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.7.0.tgz", - "integrity": "sha1-2Vv3IeyHfgjbJ27T/G63j5CDrUY=", + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.8.0.tgz", + "integrity": "sha1-7XFfP+neArV6XmJS2QqWZ14fCFo=", "dev": true, "optional": true }, @@ -15708,41 +7996,6 @@ "is-stream": "1.1.0" } }, - "nomnomnomnom": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/nomnomnomnom/-/nomnomnomnom-2.0.1.tgz", - "integrity": "sha1-siOfAxyNBNpn4yg24eMZnhL3qOI=", - "dev": true, - "requires": { - "chalk": "0.4.0", - "underscore": "1.6.0" - }, - "dependencies": { - "ansi-styles": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-1.0.0.tgz", - "integrity": "sha1-yxAt8cVvUSPquLZ817mAJ6AnkXg=", - "dev": true - }, - "chalk": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-0.4.0.tgz", - "integrity": "sha1-UZmj3c0MHv4jvAjBsCewYXbgxk8=", - "dev": true, - "requires": { - "ansi-styles": "1.0.0", - "has-color": "0.1.7", - "strip-ansi": "0.1.1" - } - }, - "strip-ansi": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-0.1.1.tgz", - "integrity": "sha1-OeipjQRNFQZgq+SmgIrPcLt7yZE=", - "dev": true - } - } - }, "nopt": { "version": "3.0.6", "resolved": "https://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz", @@ -15773,12 +8026,6 @@ "remove-trailing-separator": "1.1.0" } }, - "normalize-range": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/normalize-range/-/normalize-range-0.1.2.tgz", - "integrity": "sha1-LRDAa9/TEuqXd2laTShDlFa3WUI=", - "dev": true - }, "npm-path": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/npm-path/-/npm-path-2.0.3.tgz", @@ -15826,12 +8073,6 @@ "integrity": "sha1-l33/1xdgErnsMNKjnbXPcqBDnt0=", "dev": true }, - "num2fraction": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/num2fraction/-/num2fraction-1.2.2.tgz", - "integrity": "sha1-b2gragJ6Tp3fpFZM0lidHU5mnt4=", - "dev": true - }, "number-is-nan": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", @@ -16379,47 +8620,6 @@ "integrity": "sha512-ARhBOdzS3e41FbkW/XWrTEtukqqLoK5+Z/4UeDaLuSW+39JPeFgs4gCGqsrJHVZX0fUrx//4OF0K1CUGwlIFow==", "dev": true }, - "posix-getopt": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/posix-getopt/-/posix-getopt-1.2.0.tgz", - "integrity": "sha1-Su7rfa3mb8qKk2XdqfawBXQctiE=", - "dev": true - }, - "postcss": { - "version": "5.2.18", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-5.2.18.tgz", - "integrity": "sha512-zrUjRRe1bpXKsX1qAJNJjqZViErVuyEkMTRrwu4ud4sbTtIBRmtaYDrHmcGgmrbsW3MHfmtIf+vJumgQn+PrXg==", - "dev": true, - "requires": { - "chalk": "1.1.3", - "js-base64": "2.3.2", - "source-map": "0.5.7", - "supports-color": "3.2.3" - }, - "dependencies": { - "has-flag": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-1.0.0.tgz", - "integrity": "sha1-nZ55MWXOAXoA8AQYxD+UKnsdEfo=", - "dev": true - }, - "supports-color": { - "version": "3.2.3", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-3.2.3.tgz", - "integrity": "sha1-ZawFBLOVQXHYpklGsq48u4pfVPY=", - "dev": true, - "requires": { - "has-flag": "1.0.0" - } - } - } - }, - "postcss-value-parser": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-3.3.0.tgz", - "integrity": "sha1-h/OPnxj3dKSrTIojL1xc6IcqnRU=", - "dev": true - }, "prelude-ls": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", @@ -16445,14 +8645,14 @@ "dev": true }, "prettier-eslint": { - "version": "8.2.1", - "resolved": "https://registry.npmjs.org/prettier-eslint/-/prettier-eslint-8.2.1.tgz", - "integrity": "sha512-z19e81masHigXh4Uz2rKL344amyeW56LWjmALnOGUZMiHDxWwYswbv2ZriA7aTKitSH909eN4+h4GqQDXeZOvA==", + "version": "8.2.2", + "resolved": "https://registry.npmjs.org/prettier-eslint/-/prettier-eslint-8.2.2.tgz", + "integrity": "sha512-zeR/ZfoENuKupTd+l49aUSCKGAheIPIpZFErK2xJhPfqubg2iJy2velL72AnGkgXsXiyLwAthxoXHoL2HASctw==", "dev": true, "requires": { "common-tags": "1.4.0", "dlv": "1.1.0", - "eslint": "4.10.0", + "eslint": "4.11.0", "indent-string": "3.2.0", "lodash.merge": "4.6.0", "loglevel-colored-level-prefix": "1.0.0", @@ -16463,11 +8663,30 @@ "typescript-eslint-parser": "8.0.1" }, "dependencies": { + "ansi-styles": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", + "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", + "dev": true, + "requires": { + "color-convert": "1.9.1" + } + }, "indent-string": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-3.2.0.tgz", "integrity": "sha1-Sl/W0nzDMvN+VBmlBNu4NxBckok=", "dev": true + }, + "pretty-format": { + "version": "20.0.3", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-20.0.3.tgz", + "integrity": "sha1-Ag41ClYKH+GpjcO+tsz/s4beixQ=", + "dev": true, + "requires": { + "ansi-regex": "2.1.1", + "ansi-styles": "3.2.0" + } } } }, @@ -16480,10 +8699,10 @@ "arrify": "1.0.1", "babel-runtime": "6.26.0", "boolify": "1.0.1", - "camelcase-keys": "4.1.0", + "camelcase-keys": "4.2.0", "chalk": "2.1.0", "common-tags": "1.4.0", - "eslint": "4.10.0", + "eslint": "4.11.0", "find-up": "2.1.0", "get-stdin": "5.0.1", "glob": "7.1.2", @@ -16491,8 +8710,8 @@ "indent-string": "3.2.0", "lodash.memoize": "4.1.2", "loglevel-colored-level-prefix": "1.0.0", - "messageformat": "1.0.2", - "prettier-eslint": "8.2.1", + "messageformat": "1.1.0", + "prettier-eslint": "8.2.2", "rxjs": "5.5.2", "yargs": "8.0.2" }, @@ -16513,9 +8732,9 @@ "dev": true }, "camelcase-keys": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-4.1.0.tgz", - "integrity": "sha1-IU00jMVFfzkxaiwxzD43JGMl5z8=", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-4.2.0.tgz", + "integrity": "sha1-oqpfsa9oh1glnDLBQUJteJI7m3c=", "dev": true, "requires": { "camelcase": "4.1.0", @@ -16579,15 +8798,21 @@ } }, "pretty-format": { - "version": "20.0.3", - "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-20.0.3.tgz", - "integrity": "sha1-Ag41ClYKH+GpjcO+tsz/s4beixQ=", + "version": "21.2.1", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-21.2.1.tgz", + "integrity": "sha512-ZdWPGYAnYfcVP8yKA3zFjCn8s4/17TeYH28MXuC8vTp0o21eXjbFGcOAXZEaDaOFJjc3h2qa7HQNHNshhvoh2A==", "dev": true, "requires": { - "ansi-regex": "2.1.1", + "ansi-regex": "3.0.0", "ansi-styles": "3.2.0" }, "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, "ansi-styles": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", @@ -16885,34 +9110,6 @@ "set-immediate-shim": "1.0.1" } }, - "readline2": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/readline2/-/readline2-1.0.1.tgz", - "integrity": "sha1-QQWWCP/BVHV7cV2ZidGZ/783LjU=", - "dev": true, - "requires": { - "code-point-at": "1.1.0", - "is-fullwidth-code-point": "1.0.0", - "mute-stream": "0.0.5" - }, - "dependencies": { - "is-fullwidth-code-point": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", - "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", - "dev": true, - "requires": { - "number-is-nan": "1.0.1" - } - }, - "mute-stream": { - "version": "0.0.5", - "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.5.tgz", - "integrity": "sha1-j7+rsKmKJT0xhDMfno3rc3L6xsA=", - "dev": true - } - } - }, "rechoir": { "version": "0.6.2", "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz", @@ -16930,6 +9127,17 @@ "requires": { "indent-string": "2.1.0", "strip-indent": "1.0.1" + }, + "dependencies": { + "strip-indent": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-1.0.1.tgz", + "integrity": "sha1-DHlipq3vp7vUrDZkYKY4VSrhoKI=", + "dev": true, + "requires": { + "get-stdin": "4.0.1" + } + } } }, "regenerate": { @@ -17125,6 +9333,12 @@ "resolve-from": "1.0.1" } }, + "requireindex": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/requireindex/-/requireindex-1.1.0.tgz", + "integrity": "sha1-5UBLgVV+91225JxacgBIk/4D4WI=", + "dev": true + }, "requires-port": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", @@ -17393,17 +9607,6 @@ "jsonify": "0.0.0" } }, - "shelljs": { - "version": "0.7.8", - "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.7.8.tgz", - "integrity": "sha1-3svPh0sNHl+3LhSxZKloMEjprLM=", - "dev": true, - "requires": { - "glob": "7.1.2", - "interpret": "1.0.4", - "rechoir": "0.6.2" - } - }, "sigmund": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/sigmund/-/sigmund-1.0.1.tgz", @@ -17863,13 +10066,10 @@ "dev": true }, "strip-indent": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-1.0.1.tgz", - "integrity": "sha1-DHlipq3vp7vUrDZkYKY4VSrhoKI=", - "dev": true, - "requires": { - "get-stdin": "4.0.1" - } + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-2.0.0.tgz", + "integrity": "sha1-XvjbKV0B5u1sv3qrlpmNeCJSe2g=", + "dev": true }, "strip-json-comments": { "version": "2.0.1", @@ -17886,7 +10086,7 @@ "byline": "5.0.0", "duplexer": "0.1.1", "minimist": "0.1.0", - "moment": "2.19.1", + "moment": "2.19.2", "through": "2.3.8" }, "dependencies": { @@ -17948,7 +10148,7 @@ "integrity": "sha512-UUkEAPdSGxtRpiV9ozJ5cMTtYiqz7Ni1OGqLXRCynrvzdtR1p+cfOWe2RJLwvUG8hNanaSRjecIqwOjqeatDsA==", "dev": true, "requires": { - "ajv": "5.3.0", + "ajv": "5.4.0", "ajv-keywords": "2.1.1", "chalk": "2.3.0", "lodash": "4.17.4", @@ -18307,61 +10507,6 @@ "semver": "5.4.1" } }, - "typhonjs-ast-walker": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/typhonjs-ast-walker/-/typhonjs-ast-walker-0.1.1.tgz", - "integrity": "sha1-gUVUptrSnhyyy2K8io6GwXTBaOM=", - "dev": true - }, - "typhonjs-escomplex": { - "version": "0.0.12", - "resolved": "https://registry.npmjs.org/typhonjs-escomplex/-/typhonjs-escomplex-0.0.12.tgz", - "integrity": "sha1-wrDlpzOdeG3d03R7FT5/ZDPx/iA=", - "dev": true, - "requires": { - "babylon": "6.18.0", - "commander": "2.11.0", - "typhonjs-escomplex-module": "0.0.12", - "typhonjs-escomplex-project": "0.0.12" - } - }, - "typhonjs-escomplex-commons": { - "version": "0.0.16", - "resolved": "https://registry.npmjs.org/typhonjs-escomplex-commons/-/typhonjs-escomplex-commons-0.0.16.tgz", - "integrity": "sha1-5oTo3ITTxsyVmKbb1hS3A/hqfUk=", - "dev": true - }, - "typhonjs-escomplex-module": { - "version": "0.0.12", - "resolved": "https://registry.npmjs.org/typhonjs-escomplex-module/-/typhonjs-escomplex-module-0.0.12.tgz", - "integrity": "sha1-xZm7PeKzj/LYMmJa7iwgXxUxvmE=", - "dev": true, - "requires": { - "escomplex-plugin-metrics-module": "0.0.13", - "escomplex-plugin-syntax-babylon": "0.0.13", - "typhonjs-ast-walker": "0.1.1", - "typhonjs-escomplex-commons": "0.0.16", - "typhonjs-plugin-manager": "0.0.3" - } - }, - "typhonjs-escomplex-project": { - "version": "0.0.12", - "resolved": "https://registry.npmjs.org/typhonjs-escomplex-project/-/typhonjs-escomplex-project-0.0.12.tgz", - "integrity": "sha1-EKHWvzJ/czOKG9eHFZ/GMka5x5g=", - "dev": true, - "requires": { - "escomplex-plugin-metrics-project": "0.0.13", - "typhonjs-escomplex-commons": "0.0.16", - "typhonjs-escomplex-module": "0.0.12", - "typhonjs-plugin-manager": "0.0.3" - } - }, - "typhonjs-plugin-manager": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/typhonjs-plugin-manager/-/typhonjs-plugin-manager-0.0.3.tgz", - "integrity": "sha1-hN1eHQG0QRm95JPqZW3O+JJVq4Q=", - "dev": true - }, "ua-parser-js": { "version": "0.7.17", "resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-0.7.17.tgz", @@ -18446,12 +10591,6 @@ "integrity": "sha1-5z3T17DXxe2G+6xrCufYxqadUPo=", "dev": true }, - "underscore": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.6.0.tgz", - "integrity": "sha1-izixDKze9jM3uLJOT/htRa6lKag=", - "dev": true - }, "underscore.string": { "version": "3.3.4", "resolved": "https://registry.npmjs.org/underscore.string/-/underscore.string-3.3.4.tgz", @@ -18706,15 +10845,6 @@ } } }, - "vinyl-sourcemaps-apply": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/vinyl-sourcemaps-apply/-/vinyl-sourcemaps-apply-0.2.1.tgz", - "integrity": "sha1-q2VJ1h0XLCsbh75cUI0jnI74dwU=", - "dev": true, - "requires": { - "source-map": "0.5.7" - } - }, "vm-browserify": { "version": "0.0.4", "resolved": "https://registry.npmjs.org/vm-browserify/-/vm-browserify-0.0.4.tgz", From 22c3ac157026edc3d29b5a58b76f88e418945a84 Mon Sep 17 00:00:00 2001 From: Robert-Frampton Date: Tue, 21 Nov 2017 10:45:43 -0800 Subject: [PATCH 25/70] Run test:saucelabs script on CI --- .travis.yml | 3 +-- package.json | 5 +++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index cca5a048..f129a9a8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,6 @@ addons: before_install: - nvm install 8 - - npm install -g gulp - npm install -g lerna@2.2.0 install: @@ -21,5 +20,5 @@ language: java script: - npm run checkFormat - npm run lint - - gulp test:saucelabs + - npm run test:saucelabs - npm run test:isomorphic diff --git a/package.json b/package.json index 02374e11..fba8fadb 100644 --- a/package.json +++ b/package.json @@ -9,8 +9,9 @@ "precommit": "lint-staged", "prettier": "prettier-eslint 'packages/metal*/{src,test}/**/*.js'", "test": "gulp soy && karma start && npm run test:isomorphic", - "test:coverage": "karma start karma-coverage.conf.js", - "test:isomorphic": "gulp soy:isomorphic && mocha packages/metal-isomorphic/test/isomorphic.js --compilers js:babel-core/register" + "test:coverage": "gulp soy karma start karma-coverage.conf.js", + "test:isomorphic": "gulp soy:isomorphic && mocha packages/metal-isomorphic/test/isomorphic.js --compilers js:babel-core/register", + "test:saucelabs": "gulp soy && karma start karma-saucelabs.conf.js" }, "devDependencies": { "babel-core": "^6.26.0", From bd6d8d23b5d4c87fea8f978dcbccc2d551de4acb Mon Sep 17 00:00:00 2001 From: Robert-Frampton Date: Tue, 21 Nov 2017 11:00:02 -0800 Subject: [PATCH 26/70] Run format --- packages/metal-component/src/Component.js | 9 ++++-- .../src/ComponentDataManager.js | 6 +++- .../metal-component/src/ComponentRegistry.js | 4 ++- packages/metal-component/src/events/events.js | 6 +++- packages/metal-component/src/sync/sync.js | 4 ++- .../metal-dom/src/DomEventEmitterProxy.js | 11 ++++++-- packages/metal-dom/src/domNamed.js | 21 +++++++++++--- packages/metal-dom/src/events.js | 5 +++- packages/metal-dom/src/features.js | 5 ++-- packages/metal-dom/src/globalEval.js | 7 ++++- packages/metal-events/src/EventEmitter.js | 12 ++++++-- .../src/IncrementalDomRenderer.js | 4 ++- .../src/html/HTMLParser.js | 13 +++++++-- .../src/render/render.js | 12 ++++++-- packages/metal-jsx/src/JSXDataManager.js | 7 ++++- packages/metal-soy/src/Soy.js | 4 ++- packages/metal-soy/src/SoyAop.js | 3 +- packages/metal-state/src/State.js | 15 +++++++--- packages/metal-state/src/validators.js | 28 +++++++++++++++---- packages/metal/src/coreNamed.js | 4 ++- 20 files changed, 140 insertions(+), 40 deletions(-) diff --git a/packages/metal-component/src/Component.js b/packages/metal-component/src/Component.js index 2ec78249..9513a95b 100644 --- a/packages/metal-component/src/Component.js +++ b/packages/metal-component/src/Component.js @@ -238,7 +238,8 @@ class Component extends EventEmitter { attachElement(parentElement, siblingElement) { const element = this.element; if (element && (siblingElement || !element.parentNode)) { - const parent = toElement(parentElement) || this.DEFAULT_ELEMENT_PARENT; // eslint-disable-line + const parent = + toElement(parentElement) || this.DEFAULT_ELEMENT_PARENT; // eslint-disable-line parent.insertBefore(element, toElement(siblingElement)); } } @@ -648,7 +649,11 @@ class Component extends EventEmitter { this.dataManager_ = getStaticProperty(this.constructor, 'DATA_MANAGER'); this.dataManager_.setUp( this, - object.mixin({}, this.renderer_.getExtraDataConfig(this), Component.DATA) // eslint-disable-line + object.mixin( + {}, + this.renderer_.getExtraDataConfig(this), + Component.DATA + ) // eslint-disable-line ); } diff --git a/packages/metal-component/src/ComponentDataManager.js b/packages/metal-component/src/ComponentDataManager.js index afb91b5e..0bcb02b5 100644 --- a/packages/metal-component/src/ComponentDataManager.js +++ b/packages/metal-component/src/ComponentDataManager.js @@ -25,7 +25,11 @@ class ComponentDataManager { * @protected */ createState_(component, data) { - const state = new State(component.getInitialConfig(), component, component); // eslint-disable-line + const state = new State( + component.getInitialConfig(), + component, + component + ); // eslint-disable-line state.setKeysBlacklist(BLACKLIST); state.configState( object.mixin({}, data, State.getStateStatic(component.constructor)) diff --git a/packages/metal-component/src/ComponentRegistry.js b/packages/metal-component/src/ComponentRegistry.js index 959bed84..82cda90c 100644 --- a/packages/metal-component/src/ComponentRegistry.js +++ b/packages/metal-component/src/ComponentRegistry.js @@ -19,7 +19,9 @@ class ComponentRegistry { const constructorFn = ComponentRegistry.components_[name]; if (!constructorFn) { console.error( - `There's no constructor registered for the component named ${name}. + `There's no constructor registered for the component named ${ + name + }. Components need to be registered via ComponentRegistry.register.` ); } diff --git a/packages/metal-component/src/events/events.js b/packages/metal-component/src/events/events.js index 7c3b351b..61948f60 100644 --- a/packages/metal-component/src/events/events.js +++ b/packages/metal-component/src/events/events.js @@ -16,7 +16,11 @@ export function addListenersFromObj(component, events) { if (info.fn) { let handle; if (info.selector) { - handle = component.delegate(eventNames[i], info.selector, info.fn); // eslint-disable-line + handle = component.delegate( + eventNames[i], + info.selector, + info.fn + ); // eslint-disable-line } else { handle = component.on(eventNames[i], info.fn); } diff --git a/packages/metal-component/src/sync/sync.js b/packages/metal-component/src/sync/sync.js index f6fcccc6..cec45595 100644 --- a/packages/metal-component/src/sync/sync.js +++ b/packages/metal-component/src/sync/sync.js @@ -24,7 +24,9 @@ function getSyncFns_(component) { const keys = component.getDataManager().getSyncKeys(component); let canCache = true; for (let i = 0; i < keys.length; i++) { - const name = `sync${keys[i].charAt(0).toUpperCase()}${keys[i].slice(1)}`; + const name = `sync${keys[i].charAt(0).toUpperCase()}${keys[i].slice( + 1 + )}`; const fn = component[name]; if (fn) { fns[keys[i]] = fn; diff --git a/packages/metal-dom/src/DomEventEmitterProxy.js b/packages/metal-dom/src/DomEventEmitterProxy.js index 308cb8b5..ebdb4d8b 100644 --- a/packages/metal-dom/src/DomEventEmitterProxy.js +++ b/packages/metal-dom/src/DomEventEmitterProxy.js @@ -23,7 +23,12 @@ class DomEventEmitterProxy extends EventEmitterProxy { const index = event.indexOf(':', 9); const eventName = event.substring(9, index); const selector = event.substring(index + 1); - return delegate(this.originEmitter_, eventName, selector, listener); // eslint-disable-line + return delegate( + this.originEmitter_, + eventName, + selector, + listener + ); // eslint-disable-line } else { return on(this.originEmitter_, event, listener); } @@ -66,7 +71,9 @@ class DomEventEmitterProxy extends EventEmitterProxy { * @override */ shouldProxyEvent_(event) { - return super.shouldProxyEvent_(event) && this.isSupportedDomEvent_(event); // eslint-disable-line + return ( + super.shouldProxyEvent_(event) && this.isSupportedDomEvent_(event) + ); // eslint-disable-line } } diff --git a/packages/metal-dom/src/domNamed.js b/packages/metal-dom/src/domNamed.js index 4e10534b..a2c180b1 100644 --- a/packages/metal-dom/src/domNamed.js +++ b/packages/metal-dom/src/domNamed.js @@ -287,7 +287,13 @@ function isAbleToInteractWith_(node, eventName, eventObj) { return false; } - const matchesSelector = ['BUTTON', 'INPUT', 'SELECT', 'TEXTAREA', 'FIELDSET']; + const matchesSelector = [ + 'BUTTON', + 'INPUT', + 'SELECT', + 'TEXTAREA', + 'FIELDSET', + ]; if (eventName === 'click' && matchesSelector.indexOf(node.tagName) > -1) { return !(node.disabled || parent(node, 'fieldset[disabled]')); } @@ -370,7 +376,9 @@ export function hasClass(element, className) { * @private */ function hasClassWithNative_(element, className) { - return className.indexOf(' ') === -1 && element.classList.contains(className); + return ( + className.indexOf(' ') === -1 && element.classList.contains(className) + ); } /** @@ -723,7 +731,10 @@ export function toElement(selectorOrElement) { ) { return selectorOrElement; } else if (isString(selectorOrElement)) { - if (selectorOrElement[0] === '#' && selectorOrElement.indexOf(' ') === -1) { + if ( + selectorOrElement[0] === '#' && + selectorOrElement.indexOf(' ') === -1 + ) { return document.getElementById(selectorOrElement.substr(1)); } else { return document.querySelector(selectorOrElement); @@ -786,7 +797,9 @@ function toggleClassesWithoutNative_(element, classes) { elementClassName = `${elementClassName}${classes[i]} `; } else { const before = elementClassName.substring(0, classIndex); - const after = elementClassName.substring(classIndex + className.length); // eslint-disable-line + const after = elementClassName.substring( + classIndex + className.length + ); // eslint-disable-line elementClassName = `${before} ${after}`; } } diff --git a/packages/metal-dom/src/events.js b/packages/metal-dom/src/events.js index b3c97705..63756e32 100644 --- a/packages/metal-dom/src/events.js +++ b/packages/metal-dom/src/events.js @@ -21,7 +21,10 @@ function registerEvents() { const related = event.relatedTarget; const target = event.delegateTarget; // eslint-disable-next-line - if (!related || (related !== target && !contains(target, related))) { + if ( + !related || + (related !== target && !contains(target, related)) + ) { event.customType = eventName; return callback(event); } diff --git a/packages/metal-dom/src/features.js b/packages/metal-dom/src/features.js index 35781545..f90ca970 100644 --- a/packages/metal-dom/src/features.js +++ b/packages/metal-dom/src/features.js @@ -47,8 +47,9 @@ class features { } for (let i = 0; i < prefixes.length; i++) { if ( - features.animationElement_.style[prefixes[i] + typeTitleCase] !== // eslint-disable-line - undefined + features.animationElement_.style[ + prefixes[i] + typeTitleCase + ] !== undefined // eslint-disable-line ) { return prefixes[i].toLowerCase() + suffixes[i]; } diff --git a/packages/metal-dom/src/globalEval.js b/packages/metal-dom/src/globalEval.js index d186049f..954b5e62 100644 --- a/packages/metal-dom/src/globalEval.js +++ b/packages/metal-dom/src/globalEval.js @@ -112,7 +112,12 @@ class globalEval { scripts.item(index), function() { if (index < scripts.length - 1) { - globalEval.runScriptsInOrder(scripts, index + 1, defaultFn, appendFn); // eslint-disable-line + globalEval.runScriptsInOrder( + scripts, + index + 1, + defaultFn, + appendFn + ); // eslint-disable-line } else if (defaultFn) { async.nextTick(defaultFn); } diff --git a/packages/metal-events/src/EventEmitter.js b/packages/metal-events/src/EventEmitter.js index 2410e7c1..9902114c 100644 --- a/packages/metal-events/src/EventEmitter.js +++ b/packages/metal-events/src/EventEmitter.js @@ -157,7 +157,9 @@ class EventEmitter extends Disposable { */ getRawListeners_(event) { const directListeners = toArray(this.events_ && this.events_[event]); - return directListeners.concat(toArray(this.events_ && this.events_['*'])); + return directListeners.concat( + toArray(this.events_ && this.events_['*']) + ); } /** @@ -241,7 +243,8 @@ class EventEmitter extends Disposable { matchesListener_(listenerObj, listener) { const fn = listenerObj.fn || listenerObj; return ( - fn === listener || (listenerObj.origin && listenerObj.origin === listener) // eslint-disable-line + fn === listener || + (listenerObj.origin && listenerObj.origin === listener) // eslint-disable-line ); } @@ -285,7 +288,10 @@ class EventEmitter extends Disposable { * @param {!function()} handler */ onListener(handler) { - this.listenerHandlers_ = this.addHandler_(this.listenerHandlers_, handler); // eslint-disable-line + this.listenerHandlers_ = this.addHandler_( + this.listenerHandlers_, + handler + ); // eslint-disable-line } /** diff --git a/packages/metal-incremental-dom/src/IncrementalDomRenderer.js b/packages/metal-incremental-dom/src/IncrementalDomRenderer.js index 7f11b85a..8c64eaa0 100644 --- a/packages/metal-incremental-dom/src/IncrementalDomRenderer.js +++ b/packages/metal-incremental-dom/src/IncrementalDomRenderer.js @@ -193,7 +193,9 @@ class IncrementalDomRenderer extends ComponentRenderer.constructor { return false; } if (component.shouldUpdate) { - return component.shouldUpdate(...this.buildShouldUpdateArgs(changes)); // eslint-disable-line + return component.shouldUpdate( + ...this.buildShouldUpdateArgs(changes) + ); // eslint-disable-line } return true; } diff --git a/packages/metal-incremental-dom/src/html/HTMLParser.js b/packages/metal-incremental-dom/src/html/HTMLParser.js index bff74390..2b56d754 100644 --- a/packages/metal-incremental-dom/src/html/HTMLParser.js +++ b/packages/metal-incremental-dom/src/html/HTMLParser.js @@ -137,7 +137,8 @@ var HTMLParser = function(html, handler) { index = html.indexOf('-->'); if (index >= 0) { - if (handler.comment) handler.comment(html.substring(4, index)); + if (handler.comment) + handler.comment(html.substring(4, index)); html = html.substring(index + 3); chars = false; } @@ -203,7 +204,11 @@ var HTMLParser = function(html, handler) { // usually add anything they want to spans, and browsers allow it). // Note: this exception for "span" was added manually (i.e. it's not // present in the original code). - while (stack.last() && inline[stack.last()] && stack.last() !== 'span') { + while ( + stack.last() && + inline[stack.last()] && + stack.last() !== 'span' + ) { parseEndTag('', stack.last()); } } @@ -224,7 +229,9 @@ var HTMLParser = function(html, handler) { ? arguments[2] : arguments[3] ? arguments[3] - : arguments[4] ? arguments[4] : fillAttrs[name] ? name : ''; + : arguments[4] + ? arguments[4] + : fillAttrs[name] ? name : ''; attrs.push({ name: name, diff --git a/packages/metal-incremental-dom/src/render/render.js b/packages/metal-incremental-dom/src/render/render.js index 0fd3edec..2a1801cc 100644 --- a/packages/metal-incremental-dom/src/render/render.js +++ b/packages/metal-incremental-dom/src/render/render.js @@ -279,7 +279,9 @@ function handleRegularCall_(...args) { config.key = generateKey_(comp, config.key); if (!getData(comp).rootElementReached) { - const elementClasses = comp.getDataManager().get(comp, 'elementClasses'); + const elementClasses = comp + .getDataManager() + .get(comp, 'elementClasses'); if (elementClasses) { addElementClasses_(elementClasses, config); } @@ -343,7 +345,9 @@ function inheritElementClasses_(parent, config) { * @private */ export function isComponentTag_(tag) { - return isFunction(tag) || (isString(tag) && tag[0] === tag[0].toUpperCase()); // eslint-disable-line + return ( + isFunction(tag) || (isString(tag) && tag[0] === tag[0].toUpperCase()) + ); // eslint-disable-line } /** @@ -568,7 +572,9 @@ function resetNodeData_(node) { */ function updateContext_(comp, parent) { const context = comp.context; - const childContext = parent.getChildContext ? parent.getChildContext() : null; // eslint-disable-line + const childContext = parent.getChildContext + ? parent.getChildContext() + : null; // eslint-disable-line object.mixin(context, parent.context, childContext); comp.context = context; } diff --git a/packages/metal-jsx/src/JSXDataManager.js b/packages/metal-jsx/src/JSXDataManager.js index 087abdc7..0fc48703 100644 --- a/packages/metal-jsx/src/JSXDataManager.js +++ b/packages/metal-jsx/src/JSXDataManager.js @@ -109,7 +109,12 @@ class JSXDataManager extends ComponentDataManager.constructor { } const props = this.getManagerData(component).props_; - ComponentDataManager.replaceNonInternal.call(this, component, data, props); // eslint-disable-line + ComponentDataManager.replaceNonInternal.call( + this, + component, + data, + props + ); // eslint-disable-line this.addUnconfiguredProps_(component, props, data); if (component.propsChanged) { component.propsChanged(prevProps); diff --git a/packages/metal-soy/src/Soy.js b/packages/metal-soy/src/Soy.js index 866e9b63..70f39950 100644 --- a/packages/metal-soy/src/Soy.js +++ b/packages/metal-soy/src/Soy.js @@ -85,7 +85,9 @@ class Soy extends IncrementalDomRenderer.constructor { return function(data, ignored, ijData) { if (!goog.loadedModules_[namespace]) { throw new Error( - `No template with namespace "${namespace}" has been loaded yet.` + `No template with namespace "${ + namespace + }" has been loaded yet.` ); } return goog.loadedModules_[namespace][templateName]( diff --git a/packages/metal-soy/src/SoyAop.js b/packages/metal-soy/src/SoyAop.js index f3c516ec..dee929c2 100644 --- a/packages/metal-soy/src/SoyAop.js +++ b/packages/metal-soy/src/SoyAop.js @@ -32,7 +32,8 @@ const SoyAop = { * interception. */ handleTemplateCall_: function(originalFn, data, ignored, ijData) { - const interceptFn = SoyAop.interceptFns_[SoyAop.interceptFns_.length - 1]; // eslint-disable-line + const interceptFn = + SoyAop.interceptFns_[SoyAop.interceptFns_.length - 1]; // eslint-disable-line if (interceptFn) { return interceptFn.call(null, originalFn, data, ignored, ijData); } else { diff --git a/packages/metal-state/src/State.js b/packages/metal-state/src/State.js index 795b8ce4..0db18bc3 100644 --- a/packages/metal-state/src/State.js +++ b/packages/metal-state/src/State.js @@ -136,7 +136,9 @@ class State extends EventEmitter { assertValidStateKeyName_(name) { if (this.keysBlacklist_ && this.keysBlacklist_[name]) { throw new Error( - `It's not allowed to create a state key with the name "${name}".` + `It's not allowed to create a state key with the name "${ + name + }".` ); } } @@ -294,7 +296,9 @@ class State extends EventEmitter { ctor[staticKey] = ctor[staticKey] || {}; - defineContext = ctor[staticKey][ctor.name] ? false : ctor.prototype; // eslint-disable-line + defineContext = ctor[staticKey][ctor.name] + ? false + : ctor.prototype; // eslint-disable-line ctor[staticKey][ctor.name] = true; } this.configState(State.getStateStatic(ctor), defineContext); @@ -417,7 +421,8 @@ class State extends EventEmitter { hasBeenSet(name) { const info = this.getStateInfo(name); return ( - info.state === State.KeyStates.INITIALIZED || this.hasInitialValue_(name) // eslint-disable-line + info.state === State.KeyStates.INITIALIZED || + this.hasInitialValue_(name) // eslint-disable-line ); } @@ -697,7 +702,9 @@ class State extends EventEmitter { const disposed = this.isDisposed(); if (disposed) { console.warn( - `Error. Trying to access property "${name}" on disposed instance` + `Error. Trying to access property "${ + name + }" on disposed instance` ); } return disposed; diff --git a/packages/metal-state/src/validators.js b/packages/metal-state/src/validators.js index 677ea57a..6e7b8ef8 100644 --- a/packages/metal-state/src/validators.js +++ b/packages/metal-state/src/validators.js @@ -84,7 +84,11 @@ const validators = { return result; } return arrayOfValues.indexOf(value) === -1 - ? composeError(composeOneOfErrorMessage(arrayOfValues), name, context) // eslint-disable-line + ? composeError( + composeOneOfErrorMessage(arrayOfValues), + name, + context + ) // eslint-disable-line : true; }); }, @@ -98,14 +102,20 @@ const validators = { */ oneOfType: function(arrayOfTypeValidators) { return maybe((value, name, context) => { - const result = validators.array(arrayOfTypeValidators, name, context); // eslint-disable-line + const result = validators.array( + arrayOfTypeValidators, + name, + context + ); // eslint-disable-line if (isInvalid(result)) { return result; } for (let i = 0; i < arrayOfTypeValidators.length; i++) { // eslint-disable-next-line - if (!isInvalid(arrayOfTypeValidators[i](value, name, context))) { + if ( + !isInvalid(arrayOfTypeValidators[i](value, name, context)) + ) { return true; } } @@ -182,7 +192,9 @@ function composeError(error, name, context) { const renderer = context && context.getRenderer && context.getRenderer(); const parent = renderer && renderer.getParent && renderer.getParent(); const parentName = parent ? getFunctionName(parent.constructor) : null; - const location = parentName ? `Check render method of '${parentName}'.` : ''; + const location = parentName + ? `Check render method of '${parentName}'.` + : ''; return new Error( `Warning: Invalid state passed to '${name}'. ` + `${error} Passed to '${compName}'. ${location}` @@ -225,7 +237,9 @@ function isInvalid(result) { */ function maybe(typeValidator) { return (value, name, context) => { - return isDefAndNotNull(value) ? typeValidator(value, name, context) : true; // eslint-disable-line + return isDefAndNotNull(value) + ? typeValidator(value, name, context) + : true; // eslint-disable-line }; } @@ -257,7 +271,9 @@ function validateArrayItems(validator, value, name, context) { function validateType(expectedType, value, name, context) { const type = getType(value); if (type !== expectedType) { - const msg = `Expected type '${expectedType}', but received type '${type}'.`; + const msg = `Expected type '${expectedType}', but received type '${ + type + }'.`; return composeError(msg, name, context); } return true; diff --git a/packages/metal/src/coreNamed.js b/packages/metal/src/coreNamed.js index 0dbfd127..d829da0c 100644 --- a/packages/metal/src/coreNamed.js +++ b/packages/metal/src/coreNamed.js @@ -126,7 +126,9 @@ export function getStaticProperty( const mergedName = propertyName + '_MERGED'; if (!ctor.hasOwnProperty(mergedName)) { // eslint-disable-next-line - let merged = ctor.hasOwnProperty(propertyName) ? ctor[propertyName] : null; + let merged = ctor.hasOwnProperty(propertyName) + ? ctor[propertyName] + : null; if (ctor.__proto__ && !ctor.__proto__.isPrototypeOf(Function)) { merged = mergeFn( merged, From bbaf0037a1bd6ad6a320cfa3204002b8c123185d Mon Sep 17 00:00:00 2001 From: Robert-Frampton Date: Tue, 21 Nov 2017 12:39:13 -0800 Subject: [PATCH 27/70] Remove legacy version of Android --- karma-saucelabs.conf.js | 6 ------ 1 file changed, 6 deletions(-) diff --git a/karma-saucelabs.conf.js b/karma-saucelabs.conf.js index 8a7620d8..8b74f491 100644 --- a/karma-saucelabs.conf.js +++ b/karma-saucelabs.conf.js @@ -51,12 +51,6 @@ module.exports = function(config) { platform: 'Windows 10', version: '15', }, - sl_android_4: { - base: 'SauceLabs', - browserName: 'android', - platform: 'Linux', - version: '4.4', - }, sl_android_5: { base: 'SauceLabs', browserName: 'android', From dcc640b91e4b609547cded1ab463b04ad1cdab63 Mon Sep 17 00:00:00 2001 From: Robert-Frampton Date: Tue, 21 Nov 2017 14:59:47 -0800 Subject: [PATCH 28/70] Default STATE values should be preserved when rendering web components. Fixes #305 --- packages/metal-web-component/src/define_web_component.js | 6 +++++- .../metal-web-component/test/define_web_component.js | 9 +++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/packages/metal-web-component/src/define_web_component.js b/packages/metal-web-component/src/define_web_component.js index 93bf10c3..854d0a68 100644 --- a/packages/metal-web-component/src/define_web_component.js +++ b/packages/metal-web-component/src/define_web_component.js @@ -80,9 +80,13 @@ export function defineWebComponent(tagName, Ctor) { let opts = {}; for (let i = 0, l = observedAttributes.length; i < l; i++) { - opts[observedAttributes[i]] = this.deserializeValue_( + let deserializedValue = this.deserializeValue_( this.getAttribute(observedAttributes[i]) ); + + if (deserializedValue) { + opts[observedAttributes[i]] = deserializedValue; + } } this.component = new Ctor(opts, element); this.componentHasProps = hasProps; diff --git a/packages/metal-web-component/test/define_web_component.js b/packages/metal-web-component/test/define_web_component.js index b1f9dce8..8ba8783d 100644 --- a/packages/metal-web-component/test/define_web_component.js +++ b/packages/metal-web-component/test/define_web_component.js @@ -137,6 +137,15 @@ describe('Web components', function() { assert.isUndefined(title.key1); assert.equal(title.key3, 'value3'); }); + + it('should have the default state value after rendering', function() { + const tagName = createWebComponent('custom-test-element-09'); + el = document.createElement(tagName); + + document.body.appendChild(el); + + assert.equal(el.component.title, 'default title'); + }); }); describe('Define JSX component', function() { From 05447bc57420cc53badd7bef33fec3ced18e891b Mon Sep 17 00:00:00 2001 From: Robert-Frampton Date: Wed, 22 Nov 2017 08:15:01 -0800 Subject: [PATCH 29/70] Using const instead of let --- packages/metal-web-component/src/define_web_component.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/metal-web-component/src/define_web_component.js b/packages/metal-web-component/src/define_web_component.js index 854d0a68..e0989ae5 100644 --- a/packages/metal-web-component/src/define_web_component.js +++ b/packages/metal-web-component/src/define_web_component.js @@ -78,9 +78,9 @@ export function defineWebComponent(tagName, Ctor) { }); } - let opts = {}; + const opts = {}; for (let i = 0, l = observedAttributes.length; i < l; i++) { - let deserializedValue = this.deserializeValue_( + const deserializedValue = this.deserializeValue_( this.getAttribute(observedAttributes[i]) ); From df918b2d36c4e548b010a3abac06b444fc7713a0 Mon Sep 17 00:00:00 2001 From: Robert-Frampton Date: Wed, 22 Nov 2017 08:20:13 -0800 Subject: [PATCH 30/70] Run format --- packages/metal-component/test/Component.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/metal-component/test/Component.js b/packages/metal-component/test/Component.js index 17c2caf5..7e751b2c 100644 --- a/packages/metal-component/test/Component.js +++ b/packages/metal-component/test/Component.js @@ -213,13 +213,13 @@ describe('Component', function() { assert.strictEqual(1, comp.disposed.callCount); }); - it('should emit "disposed" event when component is disposed', function () { - var listener = sinon.stub(); + it('should emit "disposed" event when component is disposed', function() { + let listener = sinon.stub(); comp = new Component({ events: { - disposed: listener - } + disposed: listener, + }, }); assert.strictEqual(0, listener.callCount); From 3f7fa99d83573a0fcde8c01aa124394e71b5e98a Mon Sep 17 00:00:00 2001 From: Robert-Frampton Date: Wed, 22 Nov 2017 10:06:37 -0800 Subject: [PATCH 31/70] Method calls to Config helpers should return new objects to avoid unintended mutation. Fixes #310 --- packages/metal-state/src/Config.js | 11 ++++++----- packages/metal-state/test/Config.js | 22 ++++++++++++++++++++++ 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/packages/metal-state/src/Config.js b/packages/metal-state/src/Config.js index 2e460902..e76c745c 100644 --- a/packages/metal-state/src/Config.js +++ b/packages/metal-state/src/Config.js @@ -233,11 +233,12 @@ function destructShapeOfConfigs(shape) { */ function mergeConfig(context, config) { let obj = context; - if (obj === Config) { - obj = Object.create(Config); - obj.config = {}; - } - object.mixin(obj.config, config); + const objConfig = obj.config || {}; + + obj = Object.create(Config); + obj.config = {}; + + Object.assign(obj.config, objConfig, config); return obj; } diff --git a/packages/metal-state/test/Config.js b/packages/metal-state/test/Config.js index 3e3dcea0..2a4e67da 100644 --- a/packages/metal-state/test/Config.js +++ b/packages/metal-state/test/Config.js @@ -284,4 +284,26 @@ describe('Config', function() { assert.ok(config.config.validator(10)); assert.ok(config.config.validator('test') instanceof Error); }); + + it('should not mutate config object with subsequent method calls', function() { + const config = Config.string(); + const config2 = config.oneOf(['1', '2']); + const config3 = config2.required(); + + assert.notDeepEqual(config, config2); + assert.notDeepEqual(config, config3); + assert.notDeepEqual(config2, config3); + + assert.ok(config.config.validator(1) instanceof Error); + assert.ok(config2.config.validator(1) instanceof Error); + assert.ok(config3.config.validator(1) instanceof Error); + + assert.ok(config.config.validator('1')); + assert.ok(config2.config.validator('1')); + assert.ok(config3.config.validator('3') instanceof Error); + + assert.isTrue(config3.config.required); + assert.isUndefined(config.config.required); + assert.isUndefined(config2.config.required); + }); }); From a1f7cdb6e21754e6a5ff1dd0cb4bbb2f7ff09937 Mon Sep 17 00:00:00 2001 From: Robert-Frampton Date: Wed, 22 Nov 2017 10:22:48 -0800 Subject: [PATCH 32/70] Import no longer used --- packages/metal-state/src/Config.js | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/metal-state/src/Config.js b/packages/metal-state/src/Config.js index e76c745c..0e24f3f8 100644 --- a/packages/metal-state/src/Config.js +++ b/packages/metal-state/src/Config.js @@ -1,6 +1,5 @@ 'use strict'; -import {object} from 'metal'; import validators from './validators'; /** From c871c51b62706560d93ff84e4dd5ad27ccc64c34 Mon Sep 17 00:00:00 2001 From: Diego Nascimento Date: Mon, 20 Nov 2017 15:42:27 -0300 Subject: [PATCH 33/70] Adding prepend function --- packages/metal-dom/src/domNamed.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/packages/metal-dom/src/domNamed.js b/packages/metal-dom/src/domNamed.js index a2c180b1..907c805c 100644 --- a/packages/metal-dom/src/domNamed.js +++ b/packages/metal-dom/src/domNamed.js @@ -529,6 +529,28 @@ export function parent(element, selector) { return closest(element.parentNode, selector); } +/** + * Inserts a node before first child of the parent. If child is a HTML string + * it will be converted to document fragment before prepending it to the parent. + * @param {!Element} parent The node to prepend to. + * @param {!(Element|NodeList|string)} child The thing who must be prepended + * @return {!Element} The prepended child + */ +export function prepend(parent, child) { + if (isString(child)) { + child = buildFragment(child); + } + if (isNodeListLike(child)) { + const childArr = Array.prototype.slice.call(child); + for (let i = 0; i < childArr.length; i++) { + parent.insertBefore(childArr[i].firstChild, parent); + } + } else { + parent.insertBefore(child, parent.firstChild); + } + return child; +} + /** * Registers a custom event. * @param {string} eventName The name of the custom event. From 063af44770754d94b96dbb5f86cbf8c3aad000ac Mon Sep 17 00:00:00 2001 From: Diego Nascimento Date: Tue, 21 Nov 2017 14:07:24 -0300 Subject: [PATCH 34/70] Adding test cases for prepend --- packages/metal-dom/test/dom.js | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/packages/metal-dom/test/dom.js b/packages/metal-dom/test/dom.js index 3d98ae8d..72c7ce9f 100644 --- a/packages/metal-dom/test/dom.js +++ b/packages/metal-dom/test/dom.js @@ -1239,6 +1239,35 @@ describe('dom', function() { }); }); + describe('prepend', function() { + it('should prepend an element into a div', function() { + let parent = document.createElement('div'); + let p = document.createElement('p'); + let span = document.createElement('span'); + dom.append(parent, p); + dom.prepend(parent, span); + + let nativeParent = document.createElement('div'); + let nativeP = document.createElement('p'); + let nativeSpan = document.createElement('span'); + nativeParent.appendChild(nativeSpan); + nativeParent.appendChild(nativeP); + + assert.deepEqual(parent, dom.toElement(nativeParent)); + }); + it('should prepend a text into a div', function() { + let parent = document.createElement('div'); + dom.append(parent, 'Some text'); + dom.prepend(parent, 'Headline: '); + + let nativeParent = document.createElement('div'); + nativeParent.appendChild(dom.buildFragment('Headline: ')); + nativeParent.appendChild(dom.buildFragment('Some text')); + + assert.deepEqual(parent, dom.toElement(nativeParent)); + }); + }); + describe('closest', function() { it('should return the closest element up the tree that matches the given selector', function() { dom.enterDocument( From c27967a9d9ea76506dbcc7a4c8eb131fb4962060 Mon Sep 17 00:00:00 2001 From: Diego Nascimento Date: Tue, 21 Nov 2017 14:52:16 -0300 Subject: [PATCH 35/70] SF after format --- packages/metal-dom/src/domNamed.js | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/packages/metal-dom/src/domNamed.js b/packages/metal-dom/src/domNamed.js index 907c805c..37b9fec8 100644 --- a/packages/metal-dom/src/domNamed.js +++ b/packages/metal-dom/src/domNamed.js @@ -287,13 +287,7 @@ function isAbleToInteractWith_(node, eventName, eventObj) { return false; } - const matchesSelector = [ - 'BUTTON', - 'INPUT', - 'SELECT', - 'TEXTAREA', - 'FIELDSET', - ]; + const matchesSelector = ['BUTTON', 'INPUT', 'SELECT', 'TEXTAREA', 'FIELDSET']; if (eventName === 'click' && matchesSelector.indexOf(node.tagName) > -1) { return !(node.disabled || parent(node, 'fieldset[disabled]')); } @@ -376,9 +370,7 @@ export function hasClass(element, className) { * @private */ function hasClassWithNative_(element, className) { - return ( - className.indexOf(' ') === -1 && element.classList.contains(className) - ); + return className.indexOf(' ') === -1 && element.classList.contains(className); } /** @@ -753,10 +745,7 @@ export function toElement(selectorOrElement) { ) { return selectorOrElement; } else if (isString(selectorOrElement)) { - if ( - selectorOrElement[0] === '#' && - selectorOrElement.indexOf(' ') === -1 - ) { + if (selectorOrElement[0] === '#' && selectorOrElement.indexOf(' ') === -1) { return document.getElementById(selectorOrElement.substr(1)); } else { return document.querySelector(selectorOrElement); @@ -819,9 +808,7 @@ function toggleClassesWithoutNative_(element, classes) { elementClassName = `${elementClassName}${classes[i]} `; } else { const before = elementClassName.substring(0, classIndex); - const after = elementClassName.substring( - classIndex + className.length - ); // eslint-disable-line + const after = elementClassName.substring(classIndex + className.length); // eslint-disable-line elementClassName = `${before} ${after}`; } } From 6f9bc1aa8470b9e267ccb3d4909fd1da9b2742c0 Mon Sep 17 00:00:00 2001 From: Diego Nascimento Date: Tue, 21 Nov 2017 15:50:24 -0300 Subject: [PATCH 36/70] Now prepend test cases compares a html string --- packages/metal-dom/test/dom.js | 49 ++++++++++++++-------------------- 1 file changed, 20 insertions(+), 29 deletions(-) diff --git a/packages/metal-dom/test/dom.js b/packages/metal-dom/test/dom.js index 72c7ce9f..369c4e76 100644 --- a/packages/metal-dom/test/dom.js +++ b/packages/metal-dom/test/dom.js @@ -215,6 +215,26 @@ describe('dom', function() { assert.strictEqual('myChild2', parent.childNodes[1].className); }); + it('should prepend an element into a div', function() { + let parent = document.createElement('div'); + let p = document.createElement('p'); + let span = document.createElement('span'); + + dom.append(parent, p); + dom.prepend(parent, span); + + assert.strictEqual(parent.innerHTML, '

'); + }); + + it('should prepend a text into a div', function() { + let parent = document.createElement('div'); + + dom.append(parent, 'Some text'); + dom.prepend(parent, 'Headline: '); + + assert.strictEqual(parent.innerHTML, 'Headline: Some text'); + }); + it('should replace an element with a requested element', function() { let element1 = document.createElement('div'); let element2 = document.createElement('div'); @@ -1239,35 +1259,6 @@ describe('dom', function() { }); }); - describe('prepend', function() { - it('should prepend an element into a div', function() { - let parent = document.createElement('div'); - let p = document.createElement('p'); - let span = document.createElement('span'); - dom.append(parent, p); - dom.prepend(parent, span); - - let nativeParent = document.createElement('div'); - let nativeP = document.createElement('p'); - let nativeSpan = document.createElement('span'); - nativeParent.appendChild(nativeSpan); - nativeParent.appendChild(nativeP); - - assert.deepEqual(parent, dom.toElement(nativeParent)); - }); - it('should prepend a text into a div', function() { - let parent = document.createElement('div'); - dom.append(parent, 'Some text'); - dom.prepend(parent, 'Headline: '); - - let nativeParent = document.createElement('div'); - nativeParent.appendChild(dom.buildFragment('Headline: ')); - nativeParent.appendChild(dom.buildFragment('Some text')); - - assert.deepEqual(parent, dom.toElement(nativeParent)); - }); - }); - describe('closest', function() { it('should return the closest element up the tree that matches the given selector', function() { dom.enterDocument( From a3c31d6aca11e612279224c9706d426cc0ff611c Mon Sep 17 00:00:00 2001 From: Diego Nascimento Date: Wed, 22 Nov 2017 17:06:34 -0300 Subject: [PATCH 37/70] Adjust prepend to append if parent doesnt have first child and insert nodelist in order --- packages/metal-dom/src/domNamed.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/metal-dom/src/domNamed.js b/packages/metal-dom/src/domNamed.js index 37b9fec8..ae7cc248 100644 --- a/packages/metal-dom/src/domNamed.js +++ b/packages/metal-dom/src/domNamed.js @@ -532,14 +532,20 @@ export function prepend(parent, child) { if (isString(child)) { child = buildFragment(child); } + + if (!isNodeListLike(child) && !isDefAndNotNull(parent.firstChild)) { + parent.appendChild(child); + } + if (isNodeListLike(child)) { const childArr = Array.prototype.slice.call(child); for (let i = 0; i < childArr.length; i++) { - parent.insertBefore(childArr[i].firstChild, parent); + parent.appendChild(childArr[i]); } } else { parent.insertBefore(child, parent.firstChild); } + return child; } From e4513fae7e9ae090cf53ed4065937282997cc94d Mon Sep 17 00:00:00 2001 From: Diego Nascimento Date: Wed, 22 Nov 2017 17:06:59 -0300 Subject: [PATCH 38/70] Enhance tests for prepend --- packages/metal-dom/test/dom.js | 40 ++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/packages/metal-dom/test/dom.js b/packages/metal-dom/test/dom.js index 369c4e76..c79fae0d 100644 --- a/packages/metal-dom/test/dom.js +++ b/packages/metal-dom/test/dom.js @@ -215,6 +215,15 @@ describe('dom', function() { assert.strictEqual('myChild2', parent.childNodes[1].className); }); + it('should prepend an element into a div without first child', function() { + let parent = document.createElement('div'); + let elem = dom.buildFragment('

Hello World

'); + + dom.prepend(parent, elem); + + assert.strictEqual('

Hello World

', parent.innerHTML); + }); + it('should prepend an element into a div', function() { let parent = document.createElement('div'); let p = document.createElement('p'); @@ -235,6 +244,37 @@ describe('dom', function() { assert.strictEqual(parent.innerHTML, 'Headline: Some text'); }); + it('should prepend a node list to parent element', function() { + let parent = document.createElement('div'); + + let childFrag = dom.buildFragment( + '
el1
el2
el3
' + ); + + dom.prepend(parent, childFrag.childNodes); + + assert.strictEqual(3, parent.childNodes.length); + assert.strictEqual('myChild', parent.childNodes[0].className); + assert.strictEqual('myChild2', parent.childNodes[1].className); + assert.strictEqual('myChild3', parent.childNodes[2].className); + + let parent2 = document.createElement('div'); + + dom.prepend( + parent2, + dom.buildFragment( + '
' + ).childNodes + ); + dom.prepend(parent2, dom.buildFragment('
')); + + assert.strictEqual(4, parent2.childNodes.length); + assert.strictEqual('container', parent2.childNodes[0].className); + assert.strictEqual('myChild', parent2.childNodes[1].className); + assert.strictEqual('myChild2', parent2.childNodes[2].className); + assert.strictEqual('myChild3', parent2.childNodes[3].className); + }); + it('should replace an element with a requested element', function() { let element1 = document.createElement('div'); let element2 = document.createElement('div'); From fa668c7459c8d069a1557e144396ff79d9344716 Mon Sep 17 00:00:00 2001 From: Diego Nascimento Date: Wed, 22 Nov 2017 18:33:04 -0300 Subject: [PATCH 39/70] Now prepend in nodelist uses insertBefore --- packages/metal-dom/src/domNamed.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/metal-dom/src/domNamed.js b/packages/metal-dom/src/domNamed.js index ae7cc248..baf3a464 100644 --- a/packages/metal-dom/src/domNamed.js +++ b/packages/metal-dom/src/domNamed.js @@ -539,8 +539,8 @@ export function prepend(parent, child) { if (isNodeListLike(child)) { const childArr = Array.prototype.slice.call(child); - for (let i = 0; i < childArr.length; i++) { - parent.appendChild(childArr[i]); + for (let i = childArr.length - 1; i >= 0; i--) { + parent.insertBefore(childArr[i], parent.firstChild); } } else { parent.insertBefore(child, parent.firstChild); From 83ca018141ab3b73d98caf3cb0070362806436ba Mon Sep 17 00:00:00 2001 From: Diego Nascimento Date: Wed, 22 Nov 2017 18:35:14 -0300 Subject: [PATCH 40/70] Added a prepend test case --- packages/metal-dom/test/dom.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/packages/metal-dom/test/dom.js b/packages/metal-dom/test/dom.js index c79fae0d..da833dc8 100644 --- a/packages/metal-dom/test/dom.js +++ b/packages/metal-dom/test/dom.js @@ -273,6 +273,24 @@ describe('dom', function() { assert.strictEqual('myChild', parent2.childNodes[1].className); assert.strictEqual('myChild2', parent2.childNodes[2].className); assert.strictEqual('myChild3', parent2.childNodes[3].className); + + let parent3 = document.createElement('div'); + let child = document.createElement('div'); + + dom.addClasses(child, 'child'); + dom.append(parent3, child); + + let childFrag2 = dom.buildFragment( + '
el1
el2
el3
' + ); + + dom.prepend(parent3, childFrag2.childNodes); + + assert.strictEqual(4, parent3.childNodes.length); + assert.strictEqual('myChild', parent3.childNodes[0].className); + assert.strictEqual('myChild2', parent3.childNodes[1].className); + assert.strictEqual('myChild3', parent3.childNodes[2].className); + assert.strictEqual('child', parent3.childNodes[3].className); }); it('should replace an element with a requested element', function() { From b53c1ada9fb7eaa7ca724a8be9ae4f4cced201f1 Mon Sep 17 00:00:00 2001 From: Diego Nascimento Date: Wed, 22 Nov 2017 18:56:36 -0300 Subject: [PATCH 41/70] SF for travis --- packages/metal-dom/test/dom.js | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/packages/metal-dom/test/dom.js b/packages/metal-dom/test/dom.js index da833dc8..fc48f160 100644 --- a/packages/metal-dom/test/dom.js +++ b/packages/metal-dom/test/dom.js @@ -254,9 +254,9 @@ describe('dom', function() { dom.prepend(parent, childFrag.childNodes); assert.strictEqual(3, parent.childNodes.length); - assert.strictEqual('myChild', parent.childNodes[0].className); - assert.strictEqual('myChild2', parent.childNodes[1].className); - assert.strictEqual('myChild3', parent.childNodes[2].className); + assert.strictEqual('myChild', parent.childNodes[0].className.trim()); + assert.strictEqual('myChild2', parent.childNodes[1].className.trim()); + assert.strictEqual('myChild3', parent.childNodes[2].className.trim()); let parent2 = document.createElement('div'); @@ -269,10 +269,10 @@ describe('dom', function() { dom.prepend(parent2, dom.buildFragment('
')); assert.strictEqual(4, parent2.childNodes.length); - assert.strictEqual('container', parent2.childNodes[0].className); - assert.strictEqual('myChild', parent2.childNodes[1].className); - assert.strictEqual('myChild2', parent2.childNodes[2].className); - assert.strictEqual('myChild3', parent2.childNodes[3].className); + assert.strictEqual('container', parent2.childNodes[0].className.trim()); + assert.strictEqual('myChild', parent2.childNodes[1].className.trim()); + assert.strictEqual('myChild2', parent2.childNodes[2].className.trim()); + assert.strictEqual('myChild3', parent2.childNodes[3].className.trim()); let parent3 = document.createElement('div'); let child = document.createElement('div'); @@ -285,12 +285,11 @@ describe('dom', function() { ); dom.prepend(parent3, childFrag2.childNodes); - assert.strictEqual(4, parent3.childNodes.length); - assert.strictEqual('myChild', parent3.childNodes[0].className); - assert.strictEqual('myChild2', parent3.childNodes[1].className); - assert.strictEqual('myChild3', parent3.childNodes[2].className); - assert.strictEqual('child', parent3.childNodes[3].className); + assert.strictEqual('myChild', parent3.childNodes[0].className.trim()); + assert.strictEqual('myChild2', parent3.childNodes[1].className.trim()); + assert.strictEqual('myChild3', parent3.childNodes[2].className.trim()); + assert.strictEqual('child', parent3.childNodes[3].className.trim()); }); it('should replace an element with a requested element', function() { From 7fe2ca07c3c5637fd414f8961ccc5fba572df9e5 Mon Sep 17 00:00:00 2001 From: Diego Nascimento Date: Wed, 22 Nov 2017 19:40:25 -0300 Subject: [PATCH 42/70] Prepend now returns parent --- packages/metal-dom/src/domNamed.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/metal-dom/src/domNamed.js b/packages/metal-dom/src/domNamed.js index baf3a464..65168c8e 100644 --- a/packages/metal-dom/src/domNamed.js +++ b/packages/metal-dom/src/domNamed.js @@ -526,7 +526,7 @@ export function parent(element, selector) { * it will be converted to document fragment before prepending it to the parent. * @param {!Element} parent The node to prepend to. * @param {!(Element|NodeList|string)} child The thing who must be prepended - * @return {!Element} The prepended child + * @return {!Element} The prepended parent */ export function prepend(parent, child) { if (isString(child)) { @@ -534,7 +534,7 @@ export function prepend(parent, child) { } if (!isNodeListLike(child) && !isDefAndNotNull(parent.firstChild)) { - parent.appendChild(child); + return parent.appendChild(child); } if (isNodeListLike(child)) { @@ -546,7 +546,7 @@ export function prepend(parent, child) { parent.insertBefore(child, parent.firstChild); } - return child; + return parent; } /** From 82f806c4b1d468b9392ad073fa7d16cff676acb1 Mon Sep 17 00:00:00 2001 From: Diego Nascimento Date: Wed, 22 Nov 2017 20:06:09 -0300 Subject: [PATCH 43/70] Prepend now returns child --- packages/metal-dom/src/domNamed.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/metal-dom/src/domNamed.js b/packages/metal-dom/src/domNamed.js index 65168c8e..9d3c64c6 100644 --- a/packages/metal-dom/src/domNamed.js +++ b/packages/metal-dom/src/domNamed.js @@ -526,7 +526,7 @@ export function parent(element, selector) { * it will be converted to document fragment before prepending it to the parent. * @param {!Element} parent The node to prepend to. * @param {!(Element|NodeList|string)} child The thing who must be prepended - * @return {!Element} The prepended parent + * @return {!Element} The prepended child */ export function prepend(parent, child) { if (isString(child)) { @@ -534,7 +534,7 @@ export function prepend(parent, child) { } if (!isNodeListLike(child) && !isDefAndNotNull(parent.firstChild)) { - return parent.appendChild(child); + return append(parent, child); } if (isNodeListLike(child)) { @@ -546,7 +546,7 @@ export function prepend(parent, child) { parent.insertBefore(child, parent.firstChild); } - return parent; + return child; } /** From f8c70df4c6071973de00a62890652a87929f46e3 Mon Sep 17 00:00:00 2001 From: Robert-Frampton Date: Wed, 22 Nov 2017 15:58:39 -0800 Subject: [PATCH 44/70] JSDoc formatting --- packages/metal-dom/src/domNamed.js | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/packages/metal-dom/src/domNamed.js b/packages/metal-dom/src/domNamed.js index 9d3c64c6..63e03434 100644 --- a/packages/metal-dom/src/domNamed.js +++ b/packages/metal-dom/src/domNamed.js @@ -287,7 +287,13 @@ function isAbleToInteractWith_(node, eventName, eventObj) { return false; } - const matchesSelector = ['BUTTON', 'INPUT', 'SELECT', 'TEXTAREA', 'FIELDSET']; + const matchesSelector = [ + 'BUTTON', + 'INPUT', + 'SELECT', + 'TEXTAREA', + 'FIELDSET', + ]; if (eventName === 'click' && matchesSelector.indexOf(node.tagName) > -1) { return !(node.disabled || parent(node, 'fieldset[disabled]')); } @@ -370,7 +376,9 @@ export function hasClass(element, className) { * @private */ function hasClassWithNative_(element, className) { - return className.indexOf(' ') === -1 && element.classList.contains(className); + return ( + className.indexOf(' ') === -1 && element.classList.contains(className) + ); } /** @@ -525,8 +533,8 @@ export function parent(element, selector) { * Inserts a node before first child of the parent. If child is a HTML string * it will be converted to document fragment before prepending it to the parent. * @param {!Element} parent The node to prepend to. - * @param {!(Element|NodeList|string)} child The thing who must be prepended - * @return {!Element} The prepended child + * @param {!(Element|NodeList|string)} child The thing to prepend to the parent. + * @return {!Element} The prepended child. */ export function prepend(parent, child) { if (isString(child)) { @@ -751,7 +759,10 @@ export function toElement(selectorOrElement) { ) { return selectorOrElement; } else if (isString(selectorOrElement)) { - if (selectorOrElement[0] === '#' && selectorOrElement.indexOf(' ') === -1) { + if ( + selectorOrElement[0] === '#' && + selectorOrElement.indexOf(' ') === -1 + ) { return document.getElementById(selectorOrElement.substr(1)); } else { return document.querySelector(selectorOrElement); @@ -814,7 +825,9 @@ function toggleClassesWithoutNative_(element, classes) { elementClassName = `${elementClassName}${classes[i]} `; } else { const before = elementClassName.substring(0, classIndex); - const after = elementClassName.substring(classIndex + className.length); // eslint-disable-line + const after = elementClassName.substring( + classIndex + className.length + ); // eslint-disable-line elementClassName = `${before} ${after}`; } } From dba3d82b59c434612a47510e8214e0afb6663c2c Mon Sep 17 00:00:00 2001 From: Robert-Frampton Date: Wed, 22 Nov 2017 15:59:31 -0800 Subject: [PATCH 45/70] Split large test up into smaller parts, remove redundant section --- packages/metal-dom/test/dom.js | 38 +++++++++++----------------------- 1 file changed, 12 insertions(+), 26 deletions(-) diff --git a/packages/metal-dom/test/dom.js b/packages/metal-dom/test/dom.js index fc48f160..fdd8122b 100644 --- a/packages/metal-dom/test/dom.js +++ b/packages/metal-dom/test/dom.js @@ -244,7 +244,7 @@ describe('dom', function() { assert.strictEqual(parent.innerHTML, 'Headline: Some text'); }); - it('should prepend a node list to parent element', function() { + it('should prepend node list to empty parent element', function() { let parent = document.createElement('div'); let childFrag = dom.buildFragment( @@ -257,39 +257,25 @@ describe('dom', function() { assert.strictEqual('myChild', parent.childNodes[0].className.trim()); assert.strictEqual('myChild2', parent.childNodes[1].className.trim()); assert.strictEqual('myChild3', parent.childNodes[2].className.trim()); + }); - let parent2 = document.createElement('div'); - - dom.prepend( - parent2, - dom.buildFragment( - '
' - ).childNodes - ); - dom.prepend(parent2, dom.buildFragment('
')); - - assert.strictEqual(4, parent2.childNodes.length); - assert.strictEqual('container', parent2.childNodes[0].className.trim()); - assert.strictEqual('myChild', parent2.childNodes[1].className.trim()); - assert.strictEqual('myChild2', parent2.childNodes[2].className.trim()); - assert.strictEqual('myChild3', parent2.childNodes[3].className.trim()); - - let parent3 = document.createElement('div'); + it('should prepend node list to parent element with pre-existing children', function() { + let parent = document.createElement('div'); let child = document.createElement('div'); dom.addClasses(child, 'child'); - dom.append(parent3, child); + dom.append(parent, child); - let childFrag2 = dom.buildFragment( + let childFrag = dom.buildFragment( '
el1
el2
el3
' ); - dom.prepend(parent3, childFrag2.childNodes); - assert.strictEqual(4, parent3.childNodes.length); - assert.strictEqual('myChild', parent3.childNodes[0].className.trim()); - assert.strictEqual('myChild2', parent3.childNodes[1].className.trim()); - assert.strictEqual('myChild3', parent3.childNodes[2].className.trim()); - assert.strictEqual('child', parent3.childNodes[3].className.trim()); + dom.prepend(parent, childFrag.childNodes); + assert.strictEqual(4, parent.childNodes.length); + assert.strictEqual('myChild', parent.childNodes[0].className.trim()); + assert.strictEqual('myChild2', parent.childNodes[1].className.trim()); + assert.strictEqual('myChild3', parent.childNodes[2].className.trim()); + assert.strictEqual('child', parent.childNodes[3].className.trim()); }); it('should replace an element with a requested element', function() { From ea3f0901a854a0a5ae3e126f23834e71a4b920be Mon Sep 17 00:00:00 2001 From: Diego Nascimento Date: Thu, 23 Nov 2017 15:44:29 -0300 Subject: [PATCH 46/70] Fixing test:coverage script --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index fba8fadb..224ba433 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "precommit": "lint-staged", "prettier": "prettier-eslint 'packages/metal*/{src,test}/**/*.js'", "test": "gulp soy && karma start && npm run test:isomorphic", - "test:coverage": "gulp soy karma start karma-coverage.conf.js", + "test:coverage": "gulp soy && karma start karma-coverage.conf.js", "test:isomorphic": "gulp soy:isomorphic && mocha packages/metal-isomorphic/test/isomorphic.js --compilers js:babel-core/register", "test:saucelabs": "gulp soy && karma start karma-saucelabs.conf.js" }, From 4842f7aab97ea9465449c8e36d9d28c3a5f0db42 Mon Sep 17 00:00:00 2001 From: Chema Balsas Date: Tue, 28 Nov 2017 10:22:55 +0100 Subject: [PATCH 47/70] Fixes saucelabs testname --- karma-saucelabs.conf.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/karma-saucelabs.conf.js b/karma-saucelabs.conf.js index 8b74f491..3e5bbda5 100644 --- a/karma-saucelabs.conf.js +++ b/karma-saucelabs.conf.js @@ -63,10 +63,9 @@ module.exports = function(config) { if (!sauceLabsAccessKey) { sauceLabsAccessKey = process.env.SAUCE_ACCESS_KEY_ENC; if (sauceLabsAccessKey) { - sauceLabsAccessKey = new Buffer( - sauceLabsAccessKey, - 'base64' - ).toString('binary'); + sauceLabsAccessKey = new Buffer(sauceLabsAccessKey, 'base64').toString( + 'binary' + ); } } @@ -94,7 +93,7 @@ module.exports = function(config) { recordScreenshots: false, recordVideo: false, startConnect: false, - testName: 'metal-drag-drop tests', + testName: 'metal.js tests', tunnelIdentifier: process.env.TRAVIS_JOB_NUMBER, username: process.env.SAUCE_USERNAME, }, From 0b5c1cf7aa589e2615efd3175e4b9271515066e6 Mon Sep 17 00:00:00 2001 From: Diego Nascimento Date: Tue, 7 Nov 2017 14:42:50 -0300 Subject: [PATCH 48/70] Modifying shapeOf message --- packages/metal-state/src/validators.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/packages/metal-state/src/validators.js b/packages/metal-state/src/validators.js index 6e7b8ef8..ded5265f 100644 --- a/packages/metal-state/src/validators.js +++ b/packages/metal-state/src/validators.js @@ -131,11 +131,14 @@ const validators = { */ shapeOf: function(shape) { return maybe((value, name, context) => { - const result = validators.object(shape, name, context); - if (isInvalid(result)) { - return result; + const shapeResult = validators.object(shape, name, context); + const valueResult = validators.object(value, name, context); + if (isInvalid(shapeResult)) { + return shapeResult; + } + if(isInvalid(valueResult)) { + return valueResult; } - for (let key in shape) { if (Object.prototype.hasOwnProperty.call(shape, key)) { let validator = shape[key]; @@ -148,7 +151,7 @@ const validators = { (required && !isDefAndNotNull(value[key])) || isInvalid(validator(value[key])) ) { - return composeError(ERROR_SHAPE_OF, name, context); + return validator(value[key], name + '.' + key, context); } } } From 869c466ed8d1a7a72e001700f5561ea6988aaea0 Mon Sep 17 00:00:00 2001 From: Diego Nascimento Date: Wed, 8 Nov 2017 13:59:47 -0300 Subject: [PATCH 49/70] Modifying function return for improve arrayOf error message --- packages/metal-state/src/validators.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/metal-state/src/validators.js b/packages/metal-state/src/validators.js index ded5265f..37225a70 100644 --- a/packages/metal-state/src/validators.js +++ b/packages/metal-state/src/validators.js @@ -257,7 +257,9 @@ function maybe(typeValidator) { function validateArrayItems(validator, value, name, context) { for (let i = 0; i < value.length; i++) { if (isInvalid(validator(value[i], name, context))) { - return composeError(ERROR_ARRAY_OF_TYPE, name, context); + let itemValidatorError = validator(value[i], name, context); + let errorMessage = `Validator for ${name}[${i}] says: "${itemValidatorError}"`; + return composeError(errorMessage, name, context); } } return true; From b761c79d9749d64048a41e518506f6f5001a20d2 Mon Sep 17 00:00:00 2001 From: Diego Nascimento Date: Tue, 7 Nov 2017 16:01:46 -0300 Subject: [PATCH 50/70] Removing 'warning' on error message test --- packages/metal-state/test/validators.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/metal-state/test/validators.js b/packages/metal-state/test/validators.js index be251dca..33a6d504 100644 --- a/packages/metal-state/test/validators.js +++ b/packages/metal-state/test/validators.js @@ -215,7 +215,7 @@ describe('validators', function() { const PARENT_COMPONENT_NAME = 'parentComponent'; const ERROR_MESSAGE = - `Error: Warning: Invalid state passed to '${NAME}'. ` + + `Error: Invalid state passed to '${NAME}'. ` + `Expected type 'string', but received type 'number'. ` + `Passed to '${COMPONENT_NAME}'. Check render ` + `method of '${PARENT_COMPONENT_NAME}'.`; From d19d0cbd600d8cd012b67b8cc246aac05a814421 Mon Sep 17 00:00:00 2001 From: Diego Nascimento Date: Tue, 7 Nov 2017 20:15:05 -0300 Subject: [PATCH 51/70] =?UTF-8?q?Removing=20=E2=80=98warning=E2=80=99=20on?= =?UTF-8?q?=20composeError=20message?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/metal-state/src/validators.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/metal-state/src/validators.js b/packages/metal-state/src/validators.js index 37225a70..f4364426 100644 --- a/packages/metal-state/src/validators.js +++ b/packages/metal-state/src/validators.js @@ -199,8 +199,8 @@ function composeError(error, name, context) { ? `Check render method of '${parentName}'.` : ''; return new Error( - `Warning: Invalid state passed to '${name}'. ` + - `${error} Passed to '${compName}'. ${location}` + `Invalid state passed to '${name}'.` + +      ` ${error} Passed to '${compName}'. ${location}` ); } From 4b0a470554d552275f6dfbeeefba8cd45afe3855 Mon Sep 17 00:00:00 2001 From: Diego Nascimento Date: Tue, 7 Nov 2017 16:26:43 -0300 Subject: [PATCH 52/70] Removing unused error messages constraints --- packages/metal-state/src/validators.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/packages/metal-state/src/validators.js b/packages/metal-state/src/validators.js index f4364426..853073e6 100644 --- a/packages/metal-state/src/validators.js +++ b/packages/metal-state/src/validators.js @@ -2,11 +2,9 @@ import {getFunctionName, isDefAndNotNull} from 'metal'; -const ERROR_ARRAY_OF_TYPE = 'Expected an array of single type.'; const ERROR_OBJECT_OF_TYPE = 'Expected object of one type.'; const ERROR_ONE_OF = 'Expected one of the following values:'; const ERROR_ONE_OF_TYPE = 'Expected one of given types.'; -const ERROR_SHAPE_OF = 'Expected object with a specific shape.'; /** * Provides access to various type validators that will return an From 61590966ed6fa30b5583c14791b760337b1d066e Mon Sep 17 00:00:00 2001 From: Diego Nascimento Date: Tue, 7 Nov 2017 20:24:07 -0300 Subject: [PATCH 53/70] Added a test case that checks if arrayOf can return errors in shapeOf or oneOf function call --- packages/metal-state/test/Config.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/packages/metal-state/test/Config.js b/packages/metal-state/test/Config.js index 3e3dcea0..4470bfed 100644 --- a/packages/metal-state/test/Config.js +++ b/packages/metal-state/test/Config.js @@ -143,6 +143,34 @@ describe('Config', function() { assert.ok(config.config.validator(['one']) instanceof Error); }); + it('should return config with "arrayOf" validator inheriting "shapeOf" and "oneOf" from "validators"', function(){ + var shape = { + one: Config.bool().value(false), + two: Config.string(), + three: Config.oneOf([ + 'propOne', + 'propTwo', + 'propThree' + ]).value('propOne'), + four: Config.number().required() + }; + var configShape = Config.arrayOf(Config.shapeOf(shape)); + assert.ok(core.isObject(configShape)); + assert.ok(core.isFunction(configShape.config.validator)); + assert.ok(configShape.config.validator({ + one: false, + two: 30, + three: 'anything', + }) instanceof Error); + assert.ok(configShape.config.validator([1, 2]) instanceof Error); + assert.ok(configShape.config.validator({ + one: false, + two: 'is String!', + three: 'propOne', + four: 30 + })); + }); + it('should return config with "bool" validator from "validators"', function() { let config = Config.bool(); assert.ok(core.isObject(config)); From e4dfb6f86f7fdd149e7377567d471e2efcdbef3b Mon Sep 17 00:00:00 2001 From: Diego Nascimento Date: Wed, 8 Nov 2017 15:01:52 -0300 Subject: [PATCH 54/70] Adding validation for arguments in arrayOf and objectOf --- packages/metal-state/src/validators.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/metal-state/src/validators.js b/packages/metal-state/src/validators.js index 853073e6..c43c491b 100644 --- a/packages/metal-state/src/validators.js +++ b/packages/metal-state/src/validators.js @@ -28,6 +28,10 @@ const validators = { * @return {!function()} */ arrayOf: function(validator) { + const argsResult = validators.func(validator); + if(isInvalid(argsResult)){ + return argsResult; + } return maybe((value, name, context) => { const result = validators.array(value, name, context); if (isInvalid(result)) { @@ -59,6 +63,10 @@ const validators = { * @return {!function()} */ objectOf: function(validator) { + const validatorResult = validators.func(validator); + if(isInvalid(validatorResult)){ + return validatorResult; + } return maybe((value, name, context) => { for (let key in value) { if (isInvalid(validator(value[key]))) { From e51c6c6929e188061fb5864f91ac0eac048436c3 Mon Sep 17 00:00:00 2001 From: Diego Nascimento Date: Wed, 8 Nov 2017 15:03:05 -0300 Subject: [PATCH 55/70] Adding tests for invalid arguments in arrayOf and objectOf --- packages/metal-state/test/validators.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/packages/metal-state/test/validators.js b/packages/metal-state/test/validators.js index 33a6d504..dcdc04c2 100644 --- a/packages/metal-state/test/validators.js +++ b/packages/metal-state/test/validators.js @@ -55,6 +55,12 @@ describe('validators', function() { assert.isTrue(validator(function() {})); }); + it('should fail if an argument is not supplied to arrayOf', function() { + const wrongArrayOf = validators.arrayOf(2); + + assert.ok(wrongArrayOf instanceof Error); + }); + it('should validate an array of a single type', function() { const arrayOfNumbers = validators.arrayOf(validators.number); @@ -123,6 +129,12 @@ describe('validators', function() { assert.ok(validator({}) instanceof Error); }); + it('should fail if an argument is not supplied to objectOf', function() { + const wrongObjectOf = validators.objectOf(2); + + assert.ok(wrongObjectOf instanceof Error); + }); + it('should validate an object with certain types of values', function() { const objectOf = validators.objectOf(validators.number); From 2b6c37960ea4a84bd805d2b09991c256c321edda Mon Sep 17 00:00:00 2001 From: Diego Nascimento Date: Mon, 13 Nov 2017 13:26:09 -0300 Subject: [PATCH 56/70] SF template literals --- packages/metal-state/src/validators.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/metal-state/src/validators.js b/packages/metal-state/src/validators.js index c43c491b..b9b0679a 100644 --- a/packages/metal-state/src/validators.js +++ b/packages/metal-state/src/validators.js @@ -157,7 +157,7 @@ const validators = { (required && !isDefAndNotNull(value[key])) || isInvalid(validator(value[key])) ) { - return validator(value[key], name + '.' + key, context); + return validator(value[key], `${name}.${key}`, context); } } } From 7fdb397a54fb9e44c5848bce4562b00e2e2ef90a Mon Sep 17 00:00:00 2001 From: Diego Nascimento Date: Thu, 23 Nov 2017 14:01:01 -0300 Subject: [PATCH 57/70] Now shapeOf checks args outside maybe function --- packages/metal-state/src/validators.js | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/packages/metal-state/src/validators.js b/packages/metal-state/src/validators.js index b9b0679a..3a8a2879 100644 --- a/packages/metal-state/src/validators.js +++ b/packages/metal-state/src/validators.js @@ -29,7 +29,7 @@ const validators = { */ arrayOf: function(validator) { const argsResult = validators.func(validator); - if(isInvalid(argsResult)){ + if (isInvalid(argsResult)) { return argsResult; } return maybe((value, name, context) => { @@ -64,7 +64,7 @@ const validators = { */ objectOf: function(validator) { const validatorResult = validators.func(validator); - if(isInvalid(validatorResult)){ + if (isInvalid(validatorResult)) { return validatorResult; } return maybe((value, name, context) => { @@ -136,13 +136,13 @@ const validators = { * @return {!function()} */ shapeOf: function(shape) { + const shapeResult = validators.object(shape); + if (isInvalid(shapeResult)) { + return shapeResult; + } return maybe((value, name, context) => { - const shapeResult = validators.object(shape, name, context); const valueResult = validators.object(value, name, context); - if (isInvalid(shapeResult)) { - return shapeResult; - } - if(isInvalid(valueResult)) { + if (isInvalid(valueResult)) { return valueResult; } for (let key in shape) { @@ -206,7 +206,7 @@ function composeError(error, name, context) { : ''; return new Error( `Invalid state passed to '${name}'.` + -      ` ${error} Passed to '${compName}'. ${location}` + ` ${error} Passed to '${compName}'. ${location}` ); } @@ -264,7 +264,9 @@ function validateArrayItems(validator, value, name, context) { for (let i = 0; i < value.length; i++) { if (isInvalid(validator(value[i], name, context))) { let itemValidatorError = validator(value[i], name, context); - let errorMessage = `Validator for ${name}[${i}] says: "${itemValidatorError}"`; + let errorMessage = `Validator for ${name}[${i}] says: "${ + itemValidatorError + }"`; return composeError(errorMessage, name, context); } } From b778e4c1210ba9d04c7a8a576e2c425e7c06d1cc Mon Sep 17 00:00:00 2001 From: Diego Nascimento Date: Thu, 23 Nov 2017 15:11:22 -0300 Subject: [PATCH 58/70] Fixing test for shapeOf with object not supplied --- packages/metal-state/test/validators.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/metal-state/test/validators.js b/packages/metal-state/test/validators.js index dcdc04c2..9393aad2 100644 --- a/packages/metal-state/test/validators.js +++ b/packages/metal-state/test/validators.js @@ -218,7 +218,8 @@ describe('validators', function() { it('should fail if an object is not supplied to shape', function() { const validator = validators.shapeOf(1); - assert.ok(validator({}) instanceof Error); + + assert.ok(validator instanceof Error); }); it('should emit warning message', function() { From ad525f49b7ff5c496a277d0a54d932a2567c0fc2 Mon Sep 17 00:00:00 2001 From: Diego Nascimento Date: Thu, 23 Nov 2017 15:52:06 -0300 Subject: [PATCH 59/70] SF --- packages/metal-state/test/Config.js | 40 ++++++++++++++--------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/packages/metal-state/test/Config.js b/packages/metal-state/test/Config.js index 4470bfed..60e77b1a 100644 --- a/packages/metal-state/test/Config.js +++ b/packages/metal-state/test/Config.js @@ -143,32 +143,32 @@ describe('Config', function() { assert.ok(config.config.validator(['one']) instanceof Error); }); - it('should return config with "arrayOf" validator inheriting "shapeOf" and "oneOf" from "validators"', function(){ - var shape = { + it('should return config with "arrayOf" validator inheriting "shapeOf" and "oneOf" from "validators"', function() { + let shape = { one: Config.bool().value(false), two: Config.string(), - three: Config.oneOf([ - 'propOne', - 'propTwo', - 'propThree' - ]).value('propOne'), - four: Config.number().required() + three: Config.oneOf(['propOne', 'propTwo', 'propThree']).value('propOne'), + four: Config.number().required(), }; - var configShape = Config.arrayOf(Config.shapeOf(shape)); + let configShape = Config.arrayOf(Config.shapeOf(shape)); assert.ok(core.isObject(configShape)); assert.ok(core.isFunction(configShape.config.validator)); - assert.ok(configShape.config.validator({ - one: false, - two: 30, - three: 'anything', - }) instanceof Error); + assert.ok( + configShape.config.validator({ + one: false, + two: 30, + three: 'anything', + }) instanceof Error + ); assert.ok(configShape.config.validator([1, 2]) instanceof Error); - assert.ok(configShape.config.validator({ - one: false, - two: 'is String!', - three: 'propOne', - four: 30 - })); + assert.ok( + configShape.config.validator({ + one: false, + two: 'is String!', + three: 'propOne', + four: 30, + }) + ); }); it('should return config with "bool" validator from "validators"', function() { From c16a6f7e3e290f2ca02823c63a91e14dde003841 Mon Sep 17 00:00:00 2001 From: Robert-Frampton Date: Tue, 28 Nov 2017 10:44:53 -0800 Subject: [PATCH 60/70] When checking the args passed to validators, immediately throw error --- packages/metal-state/src/validators.js | 30 ++++++++++++++++++-------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/packages/metal-state/src/validators.js b/packages/metal-state/src/validators.js index 3a8a2879..790eb1be 100644 --- a/packages/metal-state/src/validators.js +++ b/packages/metal-state/src/validators.js @@ -28,9 +28,8 @@ const validators = { * @return {!function()} */ arrayOf: function(validator) { - const argsResult = validators.func(validator); - if (isInvalid(argsResult)) { - return argsResult; + if (isInvalid(validators.func(validator))) { + throwConfigError('function', validator, 'arrayOf'); } return maybe((value, name, context) => { const result = validators.array(value, name, context); @@ -63,9 +62,8 @@ const validators = { * @return {!function()} */ objectOf: function(validator) { - const validatorResult = validators.func(validator); - if (isInvalid(validatorResult)) { - return validatorResult; + if (isInvalid(validators.func(validator))) { + throwConfigError('function', validator, 'objectOf'); } return maybe((value, name, context) => { for (let key in value) { @@ -136,9 +134,8 @@ const validators = { * @return {!function()} */ shapeOf: function(shape) { - const shapeResult = validators.object(shape); - if (isInvalid(shapeResult)) { - return shapeResult; + if (isInvalid(validators.object(shape))) { + throwConfigError('object', shape, 'shapeOf'); } return maybe((value, name, context) => { const valueResult = validators.object(value, name, context); @@ -252,6 +249,21 @@ function maybe(typeValidator) { }; } +/** + * Throws error if validator is invoked with incorrect type. + * @param {string} expectedType String representing the expected type. + * @param {*} value The value to match the type of. + * @param {!string} name Name of the function the validator is intended for. + */ +function throwConfigError(expectedType, value, name) { + const type = getType(value); + throw new Error( + `Expected type ${expectedType}, but received type ${type}. passed to ${ + name + }.` + ); +} + /** * Checks if all the items of the given array pass the given validator. * @param {!function()} validator From c16a408c562986f83e5dd6644110003a358e2d65 Mon Sep 17 00:00:00 2001 From: Robert-Frampton Date: Tue, 28 Nov 2017 10:53:36 -0800 Subject: [PATCH 61/70] Update tests now that error is thrown --- packages/metal-state/test/validators.js | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/packages/metal-state/test/validators.js b/packages/metal-state/test/validators.js index 9393aad2..44b1219e 100644 --- a/packages/metal-state/test/validators.js +++ b/packages/metal-state/test/validators.js @@ -55,10 +55,10 @@ describe('validators', function() { assert.isTrue(validator(function() {})); }); - it('should fail if an argument is not supplied to arrayOf', function() { - const wrongArrayOf = validators.arrayOf(2); - - assert.ok(wrongArrayOf instanceof Error); + it('should throw error if a non-function is passed to arrayOf', function() { + assert.throws(function() { + validators.arrayOf(2); + }, 'Expected type function, but received type number. passed to arrayOf.'); }); it('should validate an array of a single type', function() { @@ -129,10 +129,10 @@ describe('validators', function() { assert.ok(validator({}) instanceof Error); }); - it('should fail if an argument is not supplied to objectOf', function() { - const wrongObjectOf = validators.objectOf(2); - - assert.ok(wrongObjectOf instanceof Error); + it('should throw error if a non-function is passed to objectOf', function() { + assert.throws(function() { + validators.objectOf(2); + }, 'Expected type function, but received type number. passed to objectOf.'); }); it('should validate an object with certain types of values', function() { @@ -216,10 +216,10 @@ describe('validators', function() { assert.ok(validatorFn('true') instanceof Error); }); - it('should fail if an object is not supplied to shape', function() { - const validator = validators.shapeOf(1); - - assert.ok(validator instanceof Error); + it('should throw error if a non-object is passed to shapeOf', function() { + assert.throws(function() { + validators.shapeOf(2); + }, 'Expected type object, but received type number. passed to shapeOf.'); }); it('should emit warning message', function() { From 08a83ad39ca43cb2d0118eda4025504e2911adb8 Mon Sep 17 00:00:00 2001 From: Robert-Frampton Date: Tue, 28 Nov 2017 11:28:15 -0800 Subject: [PATCH 62/70] Add tests for error messages returned by arrayOf and shapeOf --- packages/metal-state/test/validators.js | 42 +++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/packages/metal-state/test/validators.js b/packages/metal-state/test/validators.js index 44b1219e..37e73138 100644 --- a/packages/metal-state/test/validators.js +++ b/packages/metal-state/test/validators.js @@ -61,6 +61,23 @@ describe('validators', function() { }, 'Expected type function, but received type number. passed to arrayOf.'); }); + it('should return detailed error message when nested validator in arrayOf fails', function() { + const arrayOfStrings = validators.arrayOf(validators.string); + + const context = { + constructor: { + name: 'componentName', + }, + }; + + const result = arrayOfStrings(['1', 2], 'arrayName', context); + + assert.equal( + result.message, + `Invalid state passed to 'arrayName'. Validator for arrayName[1] says: "Error: Invalid state passed to 'arrayName'. Expected type 'string', but received type 'number'. Passed to 'componentName'. " Passed to 'componentName'. ` + ); + }); + it('should validate an array of a single type', function() { const arrayOfNumbers = validators.arrayOf(validators.number); @@ -222,6 +239,31 @@ describe('validators', function() { }, 'Expected type object, but received type number. passed to shapeOf.'); }); + it('should return detailed error message when nested validator in shapeOf fails', function() { + const shape = validators.shapeOf({ + key: validators.string, + }); + + const context = { + constructor: { + name: 'componentName', + }, + }; + + const result = shape( + { + key: 2, + }, + 'objectName', + context + ); + + assert.equal( + result.message, + `Invalid state passed to 'objectName.key'. Expected type 'string', but received type 'number'. Passed to 'componentName'. ` + ); + }); + it('should emit warning message', function() { const COMPONENT_NAME = 'componentName'; const NAME = 'name'; From 03a3201e38c84bb8ae6ce9ffd7737bd43a9e99bc Mon Sep 17 00:00:00 2001 From: Robert-Frampton Date: Wed, 29 Nov 2017 11:54:21 -0800 Subject: [PATCH 63/70] Add links to metaljs.com from package readme files --- packages/metal-assertions/README.md | 2 ++ packages/metal-component/README.md | 2 ++ packages/metal-dom/README.md | 2 ++ packages/metal-events/README.md | 2 ++ packages/metal-incremental-dom/README.md | 2 ++ packages/metal-jsx/README.md | 2 ++ packages/metal-soy-bundle/README.md | 2 ++ packages/metal-soy/README.md | 2 ++ packages/metal-state/README.md | 2 ++ packages/metal/README.md | 2 ++ 10 files changed, 20 insertions(+) diff --git a/packages/metal-assertions/README.md b/packages/metal-assertions/README.md index 09545e31..359a6574 100644 --- a/packages/metal-assertions/README.md +++ b/packages/metal-assertions/README.md @@ -1,3 +1,5 @@ # metal-assertions A collection of assertion methods for metal + +See [https://metaljs.com/](https://metaljs.com/) for documentation. diff --git a/packages/metal-component/README.md b/packages/metal-component/README.md index a3605092..8297d68f 100644 --- a/packages/metal-component/README.md +++ b/packages/metal-component/README.md @@ -1,3 +1,5 @@ # metal-component A component class for Metal.js. + +See [https://metaljs.com/](https://metaljs.com/) for documentation. diff --git a/packages/metal-dom/README.md b/packages/metal-dom/README.md index 16e7c0e8..14d3bc85 100644 --- a/packages/metal-dom/README.md +++ b/packages/metal-dom/README.md @@ -1,3 +1,5 @@ # metal-dom A collection of utility functions for handling dom elements. + +See [https://metaljs.com/](https://metaljs.com/) for documentation. diff --git a/packages/metal-events/README.md b/packages/metal-events/README.md index 8974912e..3dad1e7b 100644 --- a/packages/metal-events/README.md +++ b/packages/metal-events/README.md @@ -1,3 +1,5 @@ # metal-events Classes responsible for emitting and listening to events. + +See [https://metaljs.com/](https://metaljs.com/) for documentation. diff --git a/packages/metal-incremental-dom/README.md b/packages/metal-incremental-dom/README.md index 2cde0d35..bab645f1 100644 --- a/packages/metal-incremental-dom/README.md +++ b/packages/metal-incremental-dom/README.md @@ -1,3 +1,5 @@ # metal-incremental-dom A Component renderer for templates compiled to incremental dom. + +See [https://metaljs.com/](https://metaljs.com/) for documentation. diff --git a/packages/metal-jsx/README.md b/packages/metal-jsx/README.md index d39f7132..f5dd60b3 100644 --- a/packages/metal-jsx/README.md +++ b/packages/metal-jsx/README.md @@ -1,3 +1,5 @@ # metal-jsx A JSX templates renderer to be used with Metal.js's Component class. + +See [https://metaljs.com/docs/guides/jsx-components.html](https://metaljs.com/docs/guides/jsx-components.html) for documentation. diff --git a/packages/metal-soy-bundle/README.md b/packages/metal-soy-bundle/README.md index 85dd8078..a49dfcb3 100644 --- a/packages/metal-soy-bundle/README.md +++ b/packages/metal-soy-bundle/README.md @@ -4,3 +4,5 @@ metal-soy-bundle A bundle containing all the closure dependencies required by soy files compiled to incremental-dom. Note that this bundle was built by hand, and some features were deliberately removed to make the resulting bundle smaller, like escaping (which shouldn't be necessary for incremental dom anyway) and bidi directives (which will be added back soon). + +See [https://metaljs.com/](https://metaljs.com/) for documentation. diff --git a/packages/metal-soy/README.md b/packages/metal-soy/README.md index 0ef4d838..70b1b409 100644 --- a/packages/metal-soy/README.md +++ b/packages/metal-soy/README.md @@ -1,3 +1,5 @@ # metal-soy A soy templates renderer to be used with Metal.js's Component class. + +See [https://metaljs.com/docs/guides/soy-components.html](https://metaljs.com/docs/guides/soy-components.html) for documentation. diff --git a/packages/metal-state/README.md b/packages/metal-state/README.md index cf6eb331..0f39ee68 100644 --- a/packages/metal-state/README.md +++ b/packages/metal-state/README.md @@ -1,3 +1,5 @@ # metal-state A class that adds support for watchable, configurable state. + +See [https://metaljs.com/docs/guides/state.html](https://metaljs.com/docs/guides/state.html) for documentation. diff --git a/packages/metal/README.md b/packages/metal/README.md index 524d03f3..5c6bb03c 100644 --- a/packages/metal/README.md +++ b/packages/metal/README.md @@ -1,3 +1,5 @@ # metal Core functions from Metal.js, with utilities for dealing with arrays, objects and others. + +See [https://metaljs.com/](https://metaljs.com/) for documentation. From df5b641bf70d2aa0d6f32aef1ee759b89d69e86c Mon Sep 17 00:00:00 2001 From: Diego Nascimento Date: Wed, 29 Nov 2017 18:13:28 -0300 Subject: [PATCH 64/70] Adding set function --- packages/metal-dom/src/domData.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/packages/metal-dom/src/domData.js b/packages/metal-dom/src/domData.js index f2cac29e..d13c614a 100644 --- a/packages/metal-dom/src/domData.js +++ b/packages/metal-dom/src/domData.js @@ -35,6 +35,27 @@ class domData { static has(element) { return !!element[METAL_DATA]; } + + /** + * Sets Metal.js's data for the given element. + * @param {!Element} element + * @param {string=} name Optional Property from the data to be returned. + * @param {*=} value Optional value to the set the requested property + * to if it doesn't exist yet in the data. + * @return {!Object} + */ + static set(element, name, value) { + if (!element[METAL_DATA]) { + element[METAL_DATA] = {}; + } + if (!name || !value) { + return element[METAL_DATA]; + } + if (!element[METAL_DATA][name] && value) { + element[METAL_DATA][name] = value; + } + return element[METAL_DATA][name]; + } } export default domData; From 5ff1df010d20112caaf1749c9f5ad0fd7c3880fa Mon Sep 17 00:00:00 2001 From: Diego Nascimento Date: Wed, 29 Nov 2017 18:16:38 -0300 Subject: [PATCH 65/70] Refactoring domData tests --- packages/metal-dom/test/domData.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/metal-dom/test/domData.js b/packages/metal-dom/test/domData.js index 2886e41b..22d1af62 100644 --- a/packages/metal-dom/test/domData.js +++ b/packages/metal-dom/test/domData.js @@ -3,8 +3,8 @@ import domData from '../src/domData'; describe('domData', function() { - it('should get data object from element', function() { - let data = domData.get(document.createElement('div')); + it('should set data object from element', function() { + let data = domData.set(document.createElement('div')); assert.ok(data); }); @@ -16,6 +16,6 @@ describe('domData', function() { it('should return different data objects for the different elements', function() { let element1 = document.createElement('div'); let element2 = document.createElement('div'); - assert.notStrictEqual(domData.get(element1), domData.get(element2)); + assert.notStrictEqual(domData.set(element1), domData.set(element2)); }); }); From 2466d463d9a8d470d65cec8a8b830e33e2953afc Mon Sep 17 00:00:00 2001 From: Diego Nascimento Date: Fri, 1 Dec 2017 13:44:58 -0300 Subject: [PATCH 66/70] Now domData.set can overwrite a data object --- packages/metal-dom/src/domData.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/metal-dom/src/domData.js b/packages/metal-dom/src/domData.js index d13c614a..089e7ec5 100644 --- a/packages/metal-dom/src/domData.js +++ b/packages/metal-dom/src/domData.js @@ -53,6 +53,8 @@ class domData { } if (!element[METAL_DATA][name] && value) { element[METAL_DATA][name] = value; + } else if (element[METAL_DATA][name] && value) { + element[METAL_DATA][name] = value; } return element[METAL_DATA][name]; } From f5467cb4d634fe9ed218c5491a7629e847c2ad75 Mon Sep 17 00:00:00 2001 From: Diego Nascimento Date: Fri, 1 Dec 2017 13:45:49 -0300 Subject: [PATCH 67/70] Enhancing some domData tests --- packages/metal-dom/test/domData.js | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/packages/metal-dom/test/domData.js b/packages/metal-dom/test/domData.js index 22d1af62..84bf35bb 100644 --- a/packages/metal-dom/test/domData.js +++ b/packages/metal-dom/test/domData.js @@ -8,6 +8,35 @@ describe('domData', function() { assert.ok(data); }); + it('should get data object from element', function() { + let element = document.createElement('div'); + domData.set(element, 'value', 20); + let data = domData.get(element); + assert.strictEqual(JSON.stringify(data), '{"value":20}'); + }); + + it('should get data value from element', function() { + let element = document.createElement('img'); + domData.set(element, 'value', true); + let data = domData.get(element, 'value'); + assert.strictEqual(data, true); + }); + + it('should set data without a value', function() { + let element = document.createElement('div'); + domData.set(element); + let data = domData.get(element); + assert.strictEqual(JSON.stringify(data), '{}'); + }); + + it('should overwrite a data object using set', function() { + let element = document.createElement('div'); + domData.set(element, 'value', true); + domData.set(element, 'value', 20); + let data = domData.get(element); + assert.strictEqual(data.value, 20); + }); + it('should return same data object for the same element', function() { let element = document.createElement('div'); assert.strictEqual(domData.get(element), domData.get(element)); From b7a89626ef5d89d5dc710485ec91cc8059f1fc43 Mon Sep 17 00:00:00 2001 From: Robert-Frampton Date: Fri, 1 Dec 2017 09:15:51 -0800 Subject: [PATCH 68/70] Do not modify pre-existing tests for get method --- packages/metal-dom/test/domData.js | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/packages/metal-dom/test/domData.js b/packages/metal-dom/test/domData.js index 84bf35bb..ace108ff 100644 --- a/packages/metal-dom/test/domData.js +++ b/packages/metal-dom/test/domData.js @@ -3,11 +3,22 @@ import domData from '../src/domData'; describe('domData', function() { - it('should set data object from element', function() { - let data = domData.set(document.createElement('div')); + it('should get data object from element', function() { + let data = domData.get(document.createElement('div')); assert.ok(data); }); + it('should return same data object for the same element', function() { + let element = document.createElement('div'); + assert.strictEqual(domData.get(element), domData.get(element)); + }); + + it('should return different data objects for the different elements', function() { + let element1 = document.createElement('div'); + let element2 = document.createElement('div'); + assert.notStrictEqual(domData.get(element1), domData.get(element2)); + }); + it('should get data object from element', function() { let element = document.createElement('div'); domData.set(element, 'value', 20); @@ -36,15 +47,4 @@ describe('domData', function() { let data = domData.get(element); assert.strictEqual(data.value, 20); }); - - it('should return same data object for the same element', function() { - let element = document.createElement('div'); - assert.strictEqual(domData.get(element), domData.get(element)); - }); - - it('should return different data objects for the different elements', function() { - let element1 = document.createElement('div'); - let element2 = document.createElement('div'); - assert.notStrictEqual(domData.set(element1), domData.set(element2)); - }); }); From ffc5598bc89217f6a4e114f827e80f6a85f9866f Mon Sep 17 00:00:00 2001 From: Robert-Frampton Date: Fri, 1 Dec 2017 09:55:15 -0800 Subject: [PATCH 69/70] Make domData tests more robust --- packages/metal-dom/test/domData.js | 124 +++++++++++++++++++++-------- 1 file changed, 89 insertions(+), 35 deletions(-) diff --git a/packages/metal-dom/test/domData.js b/packages/metal-dom/test/domData.js index ace108ff..ec11e865 100644 --- a/packages/metal-dom/test/domData.js +++ b/packages/metal-dom/test/domData.js @@ -3,48 +3,102 @@ import domData from '../src/domData'; describe('domData', function() { - it('should get data object from element', function() { - let data = domData.get(document.createElement('div')); - assert.ok(data); - }); + describe('get', function() { + it('should get data object from element', function() { + let data = domData.get(document.createElement('div')); + assert.ok(data); + }); - it('should return same data object for the same element', function() { - let element = document.createElement('div'); - assert.strictEqual(domData.get(element), domData.get(element)); - }); + it('should return same data object for the same element', function() { + let element = document.createElement('div'); + assert.strictEqual(domData.get(element), domData.get(element)); + }); - it('should return different data objects for the different elements', function() { - let element1 = document.createElement('div'); - let element2 = document.createElement('div'); - assert.notStrictEqual(domData.get(element1), domData.get(element2)); - }); + it('should return different data objects for the different elements', function() { + let element1 = document.createElement('div'); + let element2 = document.createElement('div'); + assert.notStrictEqual(domData.get(element1), domData.get(element2)); + }); - it('should get data object from element', function() { - let element = document.createElement('div'); - domData.set(element, 'value', 20); - let data = domData.get(element); - assert.strictEqual(JSON.stringify(data), '{"value":20}'); - }); + it('should set initialValue only if value does not exist', function() { + let element = document.createElement('div'); + let key = domData.get(element, 'key', 'foo'); + assert.strictEqual(key, 'foo'); + + key = domData.get(element, 'key', 'bar'); + assert.strictEqual(key, 'foo'); + }); + + it('should allow initialValue to be falsy', function() { + let element = document.createElement('div'); + let key = domData.get(element, 'key', 0); + assert.strictEqual(key, 0); + + key = domData.get(element, 'key', 1); + assert.strictEqual(key, 0); + }); - it('should get data value from element', function() { - let element = document.createElement('img'); - domData.set(element, 'value', true); - let data = domData.get(element, 'value'); - assert.strictEqual(data, true); + it('should not overwrite initialValue with undefined', function() { + let element = document.createElement('div'); + let key = domData.get(element, 'key', 'foo'); + assert.strictEqual(key, 'foo'); + + key = domData.get(element, 'key'); + assert.strictEqual(key, 'foo'); + }); }); - it('should set data without a value', function() { - let element = document.createElement('div'); - domData.set(element); - let data = domData.get(element); - assert.strictEqual(JSON.stringify(data), '{}'); + describe('has', function() { + it('should return false if no data object exists', function() { + let element = document.createElement('div'); + assert.strictEqual(domData.has(element), false); + }); + + it('should return true if data object exists', function() { + let element = document.createElement('div'); + domData.get(element); + assert.strictEqual(domData.has(element), true); + }); }); - it('should overwrite a data object using set', function() { - let element = document.createElement('div'); - domData.set(element, 'value', true); - domData.set(element, 'value', 20); - let data = domData.get(element); - assert.strictEqual(data.value, 20); + describe('set', function() { + it('should get data object from element', function() { + let element = document.createElement('div'); + domData.set(element, 'value', 20); + let data = domData.get(element); + assert.deepEqual(data, { + value: 20, + }); + }); + + it('should get data value from element', function() { + let element = document.createElement('img'); + domData.set(element, 'value', true); + let data = domData.get(element, 'value'); + assert.strictEqual(data, true); + }); + + it('should create data object without a value', function() { + let element = document.createElement('div'); + domData.set(element); + let data = domData.get(element); + assert.deepEqual(data, {}); + }); + + it('should overwrite a data value using set', function() { + let element = document.createElement('div'); + domData.set(element, 'value', true); + assert.strictEqual(domData.get(element, 'value'), true); + domData.set(element, 'value', 20); + assert.strictEqual(domData.get(element, 'value'), 20); + }); + + it('should set falsy value', function() { + let element = document.createElement('div'); + domData.set(element, 'value', false); + assert.strictEqual(domData.get(element, 'value'), false); + domData.set(element, 'value', 0); + assert.strictEqual(domData.get(element, 'value'), 0); + }); }); }); From 402a12eb1c7df3a0f7b53eb378ff9eae493bd363 Mon Sep 17 00:00:00 2001 From: Robert-Frampton Date: Fri, 1 Dec 2017 09:57:14 -0800 Subject: [PATCH 70/70] Allow falsy values for domData.get --- packages/metal-dom/src/domData.js | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/packages/metal-dom/src/domData.js b/packages/metal-dom/src/domData.js index 089e7ec5..c25800ca 100644 --- a/packages/metal-dom/src/domData.js +++ b/packages/metal-dom/src/domData.js @@ -1,5 +1,7 @@ 'use strict'; +import {isDef} from 'metal'; + const METAL_DATA = '__metal_data__'; /** @@ -21,7 +23,7 @@ class domData { if (!name) { return element[METAL_DATA]; } - if (!element[METAL_DATA][name] && initialValue) { + if (!isDef(element[METAL_DATA][name]) && isDef(initialValue)) { element[METAL_DATA][name] = initialValue; } return element[METAL_DATA][name]; @@ -39,23 +41,18 @@ class domData { /** * Sets Metal.js's data for the given element. * @param {!Element} element - * @param {string=} name Optional Property from the data to be returned. - * @param {*=} value Optional value to the set the requested property - * to if it doesn't exist yet in the data. - * @return {!Object} + * @param {string=} name Property from the data to be set. + * @param {*=} value Value to be set on the element. + * @return {!Object|*} */ static set(element, name, value) { if (!element[METAL_DATA]) { element[METAL_DATA] = {}; } - if (!name || !value) { + if (!name || !isDef(value)) { return element[METAL_DATA]; } - if (!element[METAL_DATA][name] && value) { - element[METAL_DATA][name] = value; - } else if (element[METAL_DATA][name] && value) { - element[METAL_DATA][name] = value; - } + element[METAL_DATA][name] = value; return element[METAL_DATA][name]; } }