diff --git a/README.md b/README.md index c2ad92c..60276df 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ This plugin treats all lowercase tags as html elements and mixed cased tags as C In general JSX Attribute Expressions are treated as properties by default, with exception of hyphenated(-) ones that will always be set as attributes on the DOM element. Plain string attributes(Non expression, no {}) will be treated as attributes. -For dynamic expressions that should be wrapped in a computation for partial re-render use inner parenthesis in the expression ```{( )}```. +For dynamic expressions that should be wrapped in a computation for partial re-render use inner parenthesis in the expression ```{( )}```. ## Example @@ -94,7 +94,20 @@ This method should register a cleanup method to be called when the context is re ### ref -This binding will assign the variable you pass to it with the DOM element +This binding will assign the variable you pass to it with the DOM element. + +### forwardRef + +This binding takes a props.ref for Function Components and forwards a Real DOM reference. + +```jsx +const Child = props =>
+ +const Parent = () => { + let ref; + return +} +``` ### on(eventName) / model @@ -124,7 +137,7 @@ where valueAccessor is function wrapping the expression. This takes an object and assigns all the keys as classes which are truthy. ```jsx -
+
``` ### events @@ -135,11 +148,34 @@ Generic event method for Level 3 "addEventListener" events. Experimental. ### ... (spreads) +Spreads let you pass multiple props at once. If you wish dynamic updating remember to wrap with a parenthesis: + +```jsx +
+``` + Keep in mind given the independent nature of binding updates there is no guarantee of order using spreads at this time. It's under consideration. +## Components + +Components are just Capital Cased tags. The same rules around dynamic wrapping apply. Instead of wrapping with computation dynamic props will just be getter accessors. * Remember property access triggers so don't destructure outside of computations. + +```jsx +const MyComp = props => ( + <> +
{( props.param )}
+
{ props.static }
+ +); + + +``` + +Components may have children. This is available as props.children and is always an array. + ## Control Flow -Loops and conditionals are handled by a special JSX tag `<$>`. The reason to use a tag instead of just data.map comes from the fact that it isn't just a map function in fine grain. It requires creating nested contexts and memoizing values. Even with custom methods the injection can never be as optimized as giving a special helper and I found I was re-writing pretty much identical code in all implementations. Currently there is support for 3 props on this component 'each', 'when', 'suspend', and 'portal' where the argument is the list to iterate or the condition. The Child is a function (render prop). For each it passes the item and the index to the function, and for when it passes the evaluated value. +Loops and conditionals are handled by a special JSX tag `<$>`. The reason to use a tag instead of just data.map comes from the fact that it isn't just a map function in fine grain. It requires creating nested contexts and memoizing values. Even with custom methods the injection can never be as optimized as giving a special helper and I found I was re-writing pretty much identical code in all implementations. Currently there is support for 4 props on this component 'each', 'when', 'suspend', and 'portal' where the argument is the list to iterate or the condition. The Child is a function (render prop). For each it passes the item and the index to the function, and for when it passes the evaluated value. ```jsx
    diff --git a/package-lock.json b/package-lock.json index c145d5d..e744b20 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-jsx-dom-expressions", - "version": "0.5.2", + "version": "0.5.3", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -14,18 +14,18 @@ } }, "@babel/core": { - "version": "7.3.3", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.3.3.tgz", - "integrity": "sha512-w445QGI2qd0E0GlSnq6huRZWPMmQGCp5gd5ZWS4hagn0EiwzxD5QMFkpchyusAyVC1n27OKXzQ0/88aVU9n4xQ==", + "version": "7.4.3", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.4.3.tgz", + "integrity": "sha512-oDpASqKFlbspQfzAE7yaeTmdljSH2ADIvBlb0RwbStltTuWa0+7CCI1fYVINNv9saHPa1W7oaKeuNuKj+RQCvA==", "dev": true, "requires": { "@babel/code-frame": "^7.0.0", - "@babel/generator": "^7.3.3", - "@babel/helpers": "^7.2.0", - "@babel/parser": "^7.3.3", - "@babel/template": "^7.2.2", - "@babel/traverse": "^7.2.2", - "@babel/types": "^7.3.3", + "@babel/generator": "^7.4.0", + "@babel/helpers": "^7.4.3", + "@babel/parser": "^7.4.3", + "@babel/template": "^7.4.0", + "@babel/traverse": "^7.4.3", + "@babel/types": "^7.4.0", "convert-source-map": "^1.1.0", "debug": "^4.1.0", "json5": "^2.1.0", @@ -83,13 +83,13 @@ } }, "@babel/helpers": { - "version": "7.4.2", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.4.2.tgz", - "integrity": "sha512-gQR1eQeroDzFBikhrCccm5Gs2xBjZ57DNjGbqTaHo911IpmSxflOQWMAHPw/TXk8L3isv7s9lYzUkexOeTQUYg==", + "version": "7.4.3", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.4.3.tgz", + "integrity": "sha512-BMh7X0oZqb36CfyhvtbSmcWc3GXocfxv3yNsAEuM0l+fAqSO22rQrUpijr3oE/10jCTrB6/0b9kzmG4VetCj8Q==", "dev": true, "requires": { "@babel/template": "^7.4.0", - "@babel/traverse": "^7.4.0", + "@babel/traverse": "^7.4.3", "@babel/types": "^7.4.0" } }, @@ -105,9 +105,9 @@ } }, "@babel/parser": { - "version": "7.4.2", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.4.2.tgz", - "integrity": "sha512-9fJTDipQFvlfSVdD/JBtkiY0br9BtfvW2R8wo6CX/Ej2eMuV0gWPk1M67Mt3eggQvBqYW1FCEk8BN7WvGm/g5g==", + "version": "7.4.3", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.4.3.tgz", + "integrity": "sha512-gxpEUhTS1sGA63EGQGuA+WESPR/6tz6ng7tSHFCmaTJK/cGK8y37cBTspX+U2xCAue2IQVvF6Z0oigmjwD8YGQ==", "dev": true }, "@babel/plugin-syntax-jsx": { @@ -139,16 +139,16 @@ } }, "@babel/traverse": { - "version": "7.4.0", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.4.0.tgz", - "integrity": "sha512-/DtIHKfyg2bBKnIN+BItaIlEg5pjAnzHOIQe5w+rHAw/rg9g0V7T4rqPX8BJPfW11kt3koyjAnTNwCzb28Y1PA==", + "version": "7.4.3", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.4.3.tgz", + "integrity": "sha512-HmA01qrtaCwwJWpSKpA948cBvU5BrmviAief/b3AVw936DtcdsTexlbyzNuDnthwhOQ37xshn7hvQaEQk7ISYQ==", "dev": true, "requires": { "@babel/code-frame": "^7.0.0", "@babel/generator": "^7.4.0", "@babel/helper-function-name": "^7.1.0", "@babel/helper-split-export-declaration": "^7.4.0", - "@babel/parser": "^7.4.0", + "@babel/parser": "^7.4.3", "@babel/types": "^7.4.0", "debug": "^4.1.0", "globals": "^11.1.0", @@ -188,32 +188,32 @@ } }, "@jest/core": { - "version": "24.6.0", - "resolved": "https://registry.npmjs.org/@jest/core/-/core-24.6.0.tgz", - "integrity": "sha512-rZ/5295Geou6o1+vp2+G+p7nV6wITrCR7KSnZc+Dru8QbWAR+M9SPb0BHiRTzQvfVQFkk0AkbTw1GWjCRUX/GA==", + "version": "24.7.0", + "resolved": "https://registry.npmjs.org/@jest/core/-/core-24.7.0.tgz", + "integrity": "sha512-Ub8+TYkhYSTeQTUrrlDgfidpkVPjN8oZawagHlyJRrtITtR+FivmpqlfqmWziBgeJ3EuaWxF9Ctb55WvA95loA==", "dev": true, "requires": { "@jest/console": "^24.6.0", - "@jest/reporters": "^24.6.0", - "@jest/test-result": "^24.6.0", - "@jest/transform": "^24.6.0", - "@jest/types": "^24.6.0", + "@jest/reporters": "^24.7.0", + "@jest/test-result": "^24.7.0", + "@jest/transform": "^24.7.0", + "@jest/types": "^24.7.0", "ansi-escapes": "^3.0.0", "chalk": "^2.0.1", "exit": "^0.1.2", "graceful-fs": "^4.1.15", - "jest-changed-files": "^24.6.0", - "jest-config": "^24.6.0", - "jest-haste-map": "^24.6.0", - "jest-message-util": "^24.6.0", + "jest-changed-files": "^24.7.0", + "jest-config": "^24.7.0", + "jest-haste-map": "^24.7.0", + "jest-message-util": "^24.7.0", "jest-regex-util": "^24.3.0", - "jest-resolve-dependencies": "^24.6.0", - "jest-runner": "^24.6.0", - "jest-runtime": "^24.6.0", - "jest-snapshot": "^24.6.0", - "jest-util": "^24.6.0", - "jest-validate": "^24.6.0", - "jest-watcher": "^24.6.0", + "jest-resolve-dependencies": "^24.7.0", + "jest-runner": "^24.7.0", + "jest-runtime": "^24.7.0", + "jest-snapshot": "^24.7.0", + "jest-util": "^24.7.0", + "jest-validate": "^24.7.0", + "jest-watcher": "^24.7.0", "micromatch": "^3.1.10", "p-each-series": "^1.0.0", "pirates": "^4.0.1", @@ -223,38 +223,38 @@ } }, "@jest/environment": { - "version": "24.6.0", - "resolved": "https://registry.npmjs.org/@jest/environment/-/environment-24.6.0.tgz", - "integrity": "sha512-LccuUfnREDNFbKmMWrtzUJu6fwU1E6ddYlYSDuClEQvboMKQQMUuCSYXvRUQFtDdeVjUfxkHqfSVvBzuph0b7w==", + "version": "24.7.0", + "resolved": "https://registry.npmjs.org/@jest/environment/-/environment-24.7.0.tgz", + "integrity": "sha512-Vfv5vTPcE5Rp5TYK/hpUI07LV+OH6HOIpDNZ5lWLQ88HkPsDi9ILcSDLJs4tBZLcYltotlGapb5XUTjAfaRWow==", "dev": true, "requires": { - "@jest/fake-timers": "^24.6.0", - "@jest/transform": "^24.6.0", - "@jest/types": "^24.6.0", - "jest-mock": "^24.6.0" + "@jest/fake-timers": "^24.7.0", + "@jest/transform": "^24.7.0", + "@jest/types": "^24.7.0", + "jest-mock": "^24.7.0" } }, "@jest/fake-timers": { - "version": "24.6.0", - "resolved": "https://registry.npmjs.org/@jest/fake-timers/-/fake-timers-24.6.0.tgz", - "integrity": "sha512-92nYqkZceki6knls7F6/FrPxKXnQl0QjYXbjLk/EFfp6xcg4ETLQSAur7pMZsiAzazAgQag/XDvMmKwMbunAeg==", + "version": "24.7.0", + "resolved": "https://registry.npmjs.org/@jest/fake-timers/-/fake-timers-24.7.0.tgz", + "integrity": "sha512-wwq54UIqxC0JsKNQcwJyD4JjSkUYV9rZ1qz2lGGG1iMrFgn6ls37GBo/Cay2qCcnmdyVy+kQ5RE1+7Un7Kw4ew==", "dev": true, "requires": { - "@jest/types": "^24.6.0", - "jest-message-util": "^24.6.0", - "jest-mock": "^24.6.0" + "@jest/types": "^24.7.0", + "jest-message-util": "^24.7.0", + "jest-mock": "^24.7.0" } }, "@jest/reporters": { - "version": "24.6.0", - "resolved": "https://registry.npmjs.org/@jest/reporters/-/reporters-24.6.0.tgz", - "integrity": "sha512-fx20elfvGcuImjQZrNPS1fl/uj3mjuSf0vQFUoAPhQDarMzSbekLfRH8ZWt4ir1kpE36dLdFeFkeB8dhaTueIA==", + "version": "24.7.0", + "resolved": "https://registry.npmjs.org/@jest/reporters/-/reporters-24.7.0.tgz", + "integrity": "sha512-iOLYOXtRJEkY//aI6b95U5T1JzcRrvfKAlk7zj5ab+4w/Drko9x0PaP0eRBMRvSolzwiXaF8f1zWId397N6Vyg==", "dev": true, "requires": { - "@jest/environment": "^24.6.0", - "@jest/test-result": "^24.6.0", - "@jest/transform": "^24.6.0", - "@jest/types": "^24.6.0", + "@jest/environment": "^24.7.0", + "@jest/test-result": "^24.7.0", + "@jest/transform": "^24.7.0", + "@jest/types": "^24.7.0", "chalk": "^2.0.1", "exit": "^0.1.2", "glob": "^7.1.2", @@ -262,10 +262,10 @@ "istanbul-lib-coverage": "^2.0.2", "istanbul-lib-instrument": "^3.0.1", "istanbul-lib-source-maps": "^3.0.1", - "jest-haste-map": "^24.6.0", - "jest-resolve": "^24.6.0", - "jest-runtime": "^24.6.0", - "jest-util": "^24.6.0", + "jest-haste-map": "^24.7.0", + "jest-resolve": "^24.7.0", + "jest-runtime": "^24.7.0", + "jest-util": "^24.7.0", "jest-worker": "^24.6.0", "node-notifier": "^5.2.1", "slash": "^2.0.0", @@ -301,32 +301,44 @@ } }, "@jest/test-result": { - "version": "24.6.0", - "resolved": "https://registry.npmjs.org/@jest/test-result/-/test-result-24.6.0.tgz", - "integrity": "sha512-k6pdgBBJIDbBgQGZgt8IbQC/KrOAC+fsSZrHw62R54FnfoYzuDqnrbB/AfPJS8T4RjDsWvnAHgXLH866yG10Pg==", + "version": "24.7.0", + "resolved": "https://registry.npmjs.org/@jest/test-result/-/test-result-24.7.0.tgz", + "integrity": "sha512-bl7HcDnMYEemy/myEmc9AaO9YXxANADNYtXJRC9haolx8btNHY6q78YdL+jb/KC4vBmEEoK+OSgMae90C1tZMQ==", "dev": true, "requires": { "@jest/console": "^24.6.0", - "@jest/types": "^24.6.0", + "@jest/types": "^24.7.0", "@types/istanbul-lib-coverage": "^2.0.0" } }, + "@jest/test-sequencer": { + "version": "24.7.0", + "resolved": "https://registry.npmjs.org/@jest/test-sequencer/-/test-sequencer-24.7.0.tgz", + "integrity": "sha512-+i7aeDimhwDVzk6pt5r7ZPNMMJ6/p9jaIu6nVumXQjDR2UmuH+/QOnQcKml7+9/U/TEX9Fl61n+OoH+Ds0PTxw==", + "dev": true, + "requires": { + "@jest/test-result": "^24.7.0", + "jest-haste-map": "^24.7.0", + "jest-runner": "^24.7.0", + "jest-runtime": "^24.7.0" + } + }, "@jest/transform": { - "version": "24.6.0", - "resolved": "https://registry.npmjs.org/@jest/transform/-/transform-24.6.0.tgz", - "integrity": "sha512-aC7Yff2XREV1C/RQCoP1WzO3NU4EtmImIJXnNm4tTgaLoGGv1HJuXziyd5v7zOjBzn96793rF0iLHlFT4w4ErA==", + "version": "24.7.0", + "resolved": "https://registry.npmjs.org/@jest/transform/-/transform-24.7.0.tgz", + "integrity": "sha512-jwgjrNaZjUuYAf9OZFgyChqEN9p/LS8YkK6D0vuORLXoxiBSZy76tX0/RkCkSkOjgI8IsFwccOJ6RcYBw45R6Q==", "dev": true, "requires": { "@babel/core": "^7.1.0", - "@jest/types": "^24.6.0", + "@jest/types": "^24.7.0", "babel-plugin-istanbul": "^5.1.0", "chalk": "^2.0.1", "convert-source-map": "^1.4.0", "fast-json-stable-stringify": "^2.0.0", "graceful-fs": "^4.1.15", - "jest-haste-map": "^24.6.0", + "jest-haste-map": "^24.7.0", "jest-regex-util": "^24.3.0", - "jest-util": "^24.6.0", + "jest-util": "^24.7.0", "micromatch": "^3.1.10", "realpath-native": "^1.1.0", "slash": "^2.0.0", @@ -343,9 +355,9 @@ } }, "@jest/types": { - "version": "24.6.0", - "resolved": "https://registry.npmjs.org/@jest/types/-/types-24.6.0.tgz", - "integrity": "sha512-hnCMhUokUm6A4HPE9j3pNG9N+bSFfhqje3EbIrW6YjUW2SXuyZxy1QsJdaICo1oN1o2vVSx6qlVqQYkmWVsjiA==", + "version": "24.7.0", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-24.7.0.tgz", + "integrity": "sha512-ipJUa2rFWiKoBqMKP63Myb6h9+iT3FHRTF2M8OR6irxWzItisa8i4dcSg14IbvmXUnBlHBlUQPYUHWyX3UPpYA==", "dev": true, "requires": { "@types/istanbul-lib-coverage": "^2.0.0", @@ -623,13 +635,13 @@ "dev": true }, "babel-jest": { - "version": "24.6.0", - "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-24.6.0.tgz", - "integrity": "sha512-HpI/orChKlJZbWC2p52ghWeK+UYqU9ql+zYw+ctOr3vIuPZowcSL13RwReW5ZeYKxsRr8dZmQozGvPX93Gw1tw==", + "version": "24.7.0", + "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-24.7.0.tgz", + "integrity": "sha512-7WRraf28jlluyVLPyDY4+DXzCptiWor44caqRzefo+3btgHUb7FXEFXeqxwH2UuNCMnNY3plh/7hQ9bsLVwmUQ==", "dev": true, "requires": { - "@jest/transform": "^24.6.0", - "@jest/types": "^24.6.0", + "@jest/transform": "^24.7.0", + "@jest/types": "^24.7.0", "@types/babel__core": "^7.1.0", "babel-plugin-istanbul": "^5.1.0", "babel-preset-jest": "^24.6.0", @@ -1044,9 +1056,9 @@ "dev": true }, "coveralls": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/coveralls/-/coveralls-3.0.2.tgz", - "integrity": "sha512-Tv0LKe/MkBOilH2v7WBiTBdudg2ChfGbdXafc/s330djpF3zKOmuehTeRwjXWc7pzfj9FrDUTA7tEx6Div8NFw==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/coveralls/-/coveralls-3.0.3.tgz", + "integrity": "sha512-viNfeGlda2zJr8Gj1zqXpDMRjw9uM54p7wzZdvLRyOgnAfCe974Dq4veZkjJdxQXbmdppu6flEajFYseHYaUhg==", "dev": true, "requires": { "growl": "~> 1.10.0", @@ -1054,7 +1066,7 @@ "lcov-parse": "^0.0.10", "log-driver": "^1.2.7", "minimist": "^1.2.0", - "request": "^2.85.0" + "request": "^2.86.0" } }, "cross-spawn": { @@ -1414,16 +1426,16 @@ } }, "expect": { - "version": "24.6.0", - "resolved": "https://registry.npmjs.org/expect/-/expect-24.6.0.tgz", - "integrity": "sha512-kxe6ALQboiWfbAvY+ApKyQ42ZGksLPfUhF0Nf0k04aBcLjVxwwn47Uz9Kbv4pELUuzJaU7tvWbvzRpNrIXfcQw==", + "version": "24.7.0", + "resolved": "https://registry.npmjs.org/expect/-/expect-24.7.0.tgz", + "integrity": "sha512-sVRlM83O5tH2G7VUZuClY01k1UGqw7jJcI9rCNn0zaPkbcn+nOOj8MLzhHxF7rI4Ak2vblW/KzCDwSXPhXHlOg==", "dev": true, "requires": { - "@jest/types": "^24.6.0", + "@jest/types": "^24.7.0", "ansi-styles": "^3.2.0", "jest-get-type": "^24.3.0", - "jest-matcher-utils": "^24.6.0", - "jest-message-util": "^24.6.0", + "jest-matcher-utils": "^24.7.0", + "jest-message-util": "^24.7.0", "jest-regex-util": "^24.3.0" } }, @@ -1632,6 +1644,535 @@ "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", "dev": true }, + "fsevents": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.7.tgz", + "integrity": "sha512-Pxm6sI2MeBD7RdD12RYsqaP0nMiwx8eZBXCa6z2L+mRHm2DYrOYwihmhjpkdjUHwQhslWQjRpEgNq4XvBmaAuw==", + "dev": true, + "optional": true, + "requires": { + "nan": "^2.9.2", + "node-pre-gyp": "^0.10.0" + }, + "dependencies": { + "abbrev": { + "version": "1.1.1", + "bundled": true, + "dev": true, + "optional": true + }, + "ansi-regex": { + "version": "2.1.1", + "bundled": true, + "dev": true + }, + "aproba": { + "version": "1.2.0", + "bundled": true, + "dev": true, + "optional": true + }, + "are-we-there-yet": { + "version": "1.1.5", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "delegates": "^1.0.0", + "readable-stream": "^2.0.6" + } + }, + "balanced-match": { + "version": "1.0.0", + "bundled": true, + "dev": true + }, + "brace-expansion": { + "version": "1.1.11", + "bundled": true, + "dev": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "chownr": { + "version": "1.1.1", + "bundled": true, + "dev": true, + "optional": true + }, + "code-point-at": { + "version": "1.1.0", + "bundled": true, + "dev": true + }, + "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, + "optional": true + }, + "debug": { + "version": "2.6.9", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "ms": "2.0.0" + } + }, + "deep-extend": { + "version": "0.6.0", + "bundled": true, + "dev": true, + "optional": true + }, + "delegates": { + "version": "1.0.0", + "bundled": true, + "dev": true, + "optional": true + }, + "detect-libc": { + "version": "1.0.3", + "bundled": true, + "dev": true, + "optional": true + }, + "fs-minipass": { + "version": "1.2.5", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "minipass": "^2.2.1" + } + }, + "fs.realpath": { + "version": "1.0.0", + "bundled": true, + "dev": true, + "optional": true + }, + "gauge": { + "version": "2.7.4", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "aproba": "^1.0.3", + "console-control-strings": "^1.0.0", + "has-unicode": "^2.0.0", + "object-assign": "^4.1.0", + "signal-exit": "^3.0.0", + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1", + "wide-align": "^1.1.0" + } + }, + "glob": { + "version": "7.1.3", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "has-unicode": { + "version": "2.0.1", + "bundled": true, + "dev": true, + "optional": true + }, + "iconv-lite": { + "version": "0.4.24", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "safer-buffer": ">= 2.1.2 < 3" + } + }, + "ignore-walk": { + "version": "3.0.1", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "minimatch": "^3.0.4" + } + }, + "inflight": { + "version": "1.0.6", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.3", + "bundled": true, + "dev": true + }, + "ini": { + "version": "1.3.5", + "bundled": true, + "dev": true, + "optional": true + }, + "is-fullwidth-code-point": { + "version": "1.0.0", + "bundled": true, + "dev": true, + "requires": { + "number-is-nan": "^1.0.0" + } + }, + "isarray": { + "version": "1.0.0", + "bundled": true, + "dev": true, + "optional": true + }, + "minimatch": { + "version": "3.0.4", + "bundled": true, + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "minimist": { + "version": "0.0.8", + "bundled": true, + "dev": true + }, + "minipass": { + "version": "2.3.5", + "bundled": true, + "dev": true, + "requires": { + "safe-buffer": "^5.1.2", + "yallist": "^3.0.0" + } + }, + "minizlib": { + "version": "1.2.1", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "minipass": "^2.2.1" + } + }, + "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 + }, + "needle": { + "version": "2.2.4", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "debug": "^2.1.2", + "iconv-lite": "^0.4.4", + "sax": "^1.2.4" + } + }, + "node-pre-gyp": { + "version": "0.10.3", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "detect-libc": "^1.0.2", + "mkdirp": "^0.5.1", + "needle": "^2.2.1", + "nopt": "^4.0.1", + "npm-packlist": "^1.1.6", + "npmlog": "^4.0.2", + "rc": "^1.2.7", + "rimraf": "^2.6.1", + "semver": "^5.3.0", + "tar": "^4" + } + }, + "nopt": { + "version": "4.0.1", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "abbrev": "1", + "osenv": "^0.1.4" + } + }, + "npm-bundled": { + "version": "1.0.5", + "bundled": true, + "dev": true, + "optional": true + }, + "npm-packlist": { + "version": "1.2.0", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "ignore-walk": "^3.0.1", + "npm-bundled": "^1.0.1" + } + }, + "npmlog": { + "version": "4.1.2", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "are-we-there-yet": "~1.1.2", + "console-control-strings": "~1.1.0", + "gauge": "~2.7.3", + "set-blocking": "~2.0.0" + } + }, + "number-is-nan": { + "version": "1.0.1", + "bundled": true, + "dev": 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" + } + }, + "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.5", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "os-homedir": "^1.0.0", + "os-tmpdir": "^1.0.0" + } + }, + "path-is-absolute": { + "version": "1.0.1", + "bundled": true, + "dev": true, + "optional": true + }, + "process-nextick-args": { + "version": "2.0.0", + "bundled": true, + "dev": true, + "optional": true + }, + "rc": { + "version": "1.2.8", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "deep-extend": "^0.6.0", + "ini": "~1.3.0", + "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.3.6", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "rimraf": { + "version": "2.6.3", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "glob": "^7.1.3" + } + }, + "safe-buffer": { + "version": "5.1.2", + "bundled": true, + "dev": true + }, + "safer-buffer": { + "version": "2.1.2", + "bundled": true, + "dev": true, + "optional": true + }, + "sax": { + "version": "1.2.4", + "bundled": true, + "dev": true, + "optional": true + }, + "semver": { + "version": "5.6.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 + }, + "string-width": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "requires": { + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" + } + }, + "string_decoder": { + "version": "1.1.1", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "safe-buffer": "~5.1.0" + } + }, + "strip-ansi": { + "version": "3.0.1", + "bundled": true, + "dev": true, + "requires": { + "ansi-regex": "^2.0.0" + } + }, + "strip-json-comments": { + "version": "2.0.1", + "bundled": true, + "dev": true, + "optional": true + }, + "tar": { + "version": "4.4.8", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "chownr": "^1.1.1", + "fs-minipass": "^1.2.5", + "minipass": "^2.3.4", + "minizlib": "^1.1.1", + "mkdirp": "^0.5.0", + "safe-buffer": "^5.1.2", + "yallist": "^3.0.2" + } + }, + "util-deprecate": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "optional": true + }, + "wide-align": { + "version": "1.1.3", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "string-width": "^1.0.2 || 2" + } + }, + "wrappy": { + "version": "1.0.2", + "bundled": true, + "dev": true + }, + "yallist": { + "version": "3.0.3", + "bundled": true, + "dev": true + } + } + }, "function-bind": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", @@ -2192,31 +2733,31 @@ } }, "jest": { - "version": "24.6.0", - "resolved": "https://registry.npmjs.org/jest/-/jest-24.6.0.tgz", - "integrity": "sha512-09Y/1FUQIGRVY2hdt0VpiL5mH0MGKeNM+Rhd1qWUZEBI/HwI6upHQR5XxlTm5d0BpXvhB/8bDpHu5ehL7JGi1g==", + "version": "24.7.0", + "resolved": "https://registry.npmjs.org/jest/-/jest-24.7.0.tgz", + "integrity": "sha512-1bb9H06UeqTgiyZ9Lm81No06YdWq7f4ahLdQZJnQ0n2wuyA+ODrRfbqM8emmSS85IDw54LodW0tlud/b2F+4dQ==", "dev": true, "requires": { "import-local": "^2.0.0", - "jest-cli": "^24.6.0" + "jest-cli": "^24.7.0" }, "dependencies": { "jest-cli": { - "version": "24.6.0", - "resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-24.6.0.tgz", - "integrity": "sha512-0PDd5XgX/KXAAb00c5ATaCEjh7pw3r0D44K/7mqS9qT7ieawsjJe2bU7wDXkTOw4VhPtv9kK0FghIMqTruMDqg==", + "version": "24.7.0", + "resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-24.7.0.tgz", + "integrity": "sha512-/JNCbQGRTc2+HE+Qq1vCExOyyHvAFIdhBvdsEjQvH+UmghJBvA4UdOl6ok4fsPQnysa/p3gez3KosCWJdt0l6w==", "dev": true, "requires": { - "@jest/core": "^24.6.0", - "@jest/test-result": "^24.6.0", - "@jest/types": "^24.6.0", + "@jest/core": "^24.7.0", + "@jest/test-result": "^24.7.0", + "@jest/types": "^24.7.0", "chalk": "^2.0.1", "exit": "^0.1.2", "import-local": "^2.0.0", "is-ci": "^2.0.0", - "jest-config": "^24.6.0", - "jest-util": "^24.6.0", - "jest-validate": "^24.6.0", + "jest-config": "^24.7.0", + "jest-util": "^24.7.0", + "jest-validate": "^24.7.0", "prompts": "^2.0.1", "realpath-native": "^1.1.0", "yargs": "^12.0.2" @@ -2225,50 +2766,51 @@ } }, "jest-changed-files": { - "version": "24.6.0", - "resolved": "https://registry.npmjs.org/jest-changed-files/-/jest-changed-files-24.6.0.tgz", - "integrity": "sha512-Om7dJrGPcH6mMdEjMZ5XxRhCLk6qe1NVSJKOIn4twrtH7s8Nd++qULEH9bhRsdNduR2cMQOQwJ9GIVucWEKrsQ==", + "version": "24.7.0", + "resolved": "https://registry.npmjs.org/jest-changed-files/-/jest-changed-files-24.7.0.tgz", + "integrity": "sha512-33BgewurnwSfJrW7T5/ZAXGE44o7swLslwh8aUckzq2e17/2Os1V0QU506ZNik3hjs8MgnEMKNkcud442NCDTw==", "dev": true, "requires": { - "@jest/types": "^24.6.0", + "@jest/types": "^24.7.0", "execa": "^1.0.0", "throat": "^4.0.0" } }, "jest-config": { - "version": "24.6.0", - "resolved": "https://registry.npmjs.org/jest-config/-/jest-config-24.6.0.tgz", - "integrity": "sha512-NHXt65TlmwlJnTk2LbISFaL5h4sBLK2wDxw06H+ku9UwplEBYfbYg9//8PPDfx4XqF0QncegUD/bXeX0vJ9Euw==", + "version": "24.7.0", + "resolved": "https://registry.npmjs.org/jest-config/-/jest-config-24.7.0.tgz", + "integrity": "sha512-OsE0l9+QrXCLPQ8yJOWX/hQiH8OBf10/5pmBN6OTttU80KE0nF17gs3sUJ4ZikNsQLkbjQs1hW7g9Wg7u0eTpw==", "dev": true, "requires": { "@babel/core": "^7.1.0", - "@jest/types": "^24.6.0", - "babel-jest": "^24.6.0", + "@jest/test-sequencer": "^24.7.0", + "@jest/types": "^24.7.0", + "babel-jest": "^24.7.0", "chalk": "^2.0.1", "glob": "^7.1.1", - "jest-environment-jsdom": "^24.6.0", - "jest-environment-node": "^24.6.0", + "jest-environment-jsdom": "^24.7.0", + "jest-environment-node": "^24.7.0", "jest-get-type": "^24.3.0", - "jest-jasmine2": "^24.6.0", + "jest-jasmine2": "^24.7.0", "jest-regex-util": "^24.3.0", - "jest-resolve": "^24.6.0", - "jest-util": "^24.6.0", - "jest-validate": "^24.6.0", + "jest-resolve": "^24.7.0", + "jest-util": "^24.7.0", + "jest-validate": "^24.7.0", "micromatch": "^3.1.10", - "pretty-format": "^24.6.0", + "pretty-format": "^24.7.0", "realpath-native": "^1.1.0" } }, "jest-diff": { - "version": "24.6.0", - "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-24.6.0.tgz", - "integrity": "sha512-r+W4NHYot9ywuiO8JJ3WeDxV+8Bu9vNg7YLWmjLx9RQOC7UtiPcODgvLJIckJ2QIwJ4B/EfjiaLGN24Kew/Y2w==", + "version": "24.7.0", + "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-24.7.0.tgz", + "integrity": "sha512-ULQZ5B1lWpH70O4xsANC4tf4Ko6RrpwhE3PtG6ERjMg1TiYTC2Wp4IntJVGro6a8HG9luYHhhmF4grF0Pltckg==", "dev": true, "requires": { "chalk": "^2.0.1", "diff-sequences": "^24.3.0", "jest-get-type": "^24.3.0", - "pretty-format": "^24.6.0" + "pretty-format": "^24.7.0" } }, "jest-docblock": { @@ -2281,43 +2823,43 @@ } }, "jest-each": { - "version": "24.6.0", - "resolved": "https://registry.npmjs.org/jest-each/-/jest-each-24.6.0.tgz", - "integrity": "sha512-+LiF4T/sgpAE4j2p449rwHEJUGPcT+aBOo9mbMSqafnOWGY7R4D1O3DZBGtW7ObumSHj7ZuQkigu9vNQqw5oPQ==", + "version": "24.7.0", + "resolved": "https://registry.npmjs.org/jest-each/-/jest-each-24.7.0.tgz", + "integrity": "sha512-QIva7rgK9R+23uQUnqgSRlZJ5MwJIVanoQNzRZl0zbhv9M05TDqoneVOhpQyDM5ZUJjqCLzwu0PoG6L8U7i8qA==", "dev": true, "requires": { - "@jest/types": "^24.6.0", + "@jest/types": "^24.7.0", "chalk": "^2.0.1", "jest-get-type": "^24.3.0", - "jest-util": "^24.6.0", - "pretty-format": "^24.6.0" + "jest-util": "^24.7.0", + "pretty-format": "^24.7.0" } }, "jest-environment-jsdom": { - "version": "24.6.0", - "resolved": "https://registry.npmjs.org/jest-environment-jsdom/-/jest-environment-jsdom-24.6.0.tgz", - "integrity": "sha512-nRuKr5vKC9hXOGENgKja50SA0+wNEjsl73qqZV1jwzmMcdzOREuMZZ3jTLQT8/ScOo+SNo9q5YpAp0C+m34Rdw==", + "version": "24.7.0", + "resolved": "https://registry.npmjs.org/jest-environment-jsdom/-/jest-environment-jsdom-24.7.0.tgz", + "integrity": "sha512-U3IscwOkfZLUfv0sgeHX2DP7gxZNREXBwulNyP2+SYtLKdGYYjD7pLY4DcUq0y7cc0+VXfrok2QXeGF8qDbixw==", "dev": true, "requires": { - "@jest/environment": "^24.6.0", - "@jest/fake-timers": "^24.6.0", - "@jest/types": "^24.6.0", - "jest-mock": "^24.6.0", - "jest-util": "^24.6.0", + "@jest/environment": "^24.7.0", + "@jest/fake-timers": "^24.7.0", + "@jest/types": "^24.7.0", + "jest-mock": "^24.7.0", + "jest-util": "^24.7.0", "jsdom": "^11.5.1" } }, "jest-environment-node": { - "version": "24.6.0", - "resolved": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-24.6.0.tgz", - "integrity": "sha512-3JLQ7FVzOqzjCR3Knt7Nk+nYUaBEkS+H/paZDICzGpJidb/Z1tU4JJdM2G9umr08CyUNyH0LWiZ6yghlE2Kv3w==", + "version": "24.7.0", + "resolved": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-24.7.0.tgz", + "integrity": "sha512-XECuhDfrdHuw/+5JrjS+D9tuBsv2M0MpSzJmSTGqBeCmgekaCbLB4wcU5XYWsyFUAlhDTU2Vn6UqReQceiHtKQ==", "dev": true, "requires": { - "@jest/environment": "^24.6.0", - "@jest/fake-timers": "^24.6.0", - "@jest/types": "^24.6.0", - "jest-mock": "^24.6.0", - "jest-util": "^24.6.0" + "@jest/environment": "^24.7.0", + "@jest/fake-timers": "^24.7.0", + "@jest/types": "^24.7.0", + "jest-mock": "^24.7.0", + "jest-util": "^24.7.0" } }, "jest-get-type": { @@ -2327,76 +2869,79 @@ "dev": true }, "jest-haste-map": { - "version": "24.6.0", - "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-24.6.0.tgz", - "integrity": "sha512-P0Lhy/vZ/4S7DzVS3KeWMT1FFQ9Qo3QdiqywPoG3FE74iNk44nGzwin3pYnR8dzrfd+SBmutdXLaIfywuU1XxQ==", + "version": "24.7.0", + "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-24.7.0.tgz", + "integrity": "sha512-f84QcZoA/PbAjGbPnisNJfj73x3noM/wgPhRO5kT1l18pi46Lcs+QsN3WW+bGNdzIUUDzjaJqZtRTJxT71sHCA==", "dev": true, "requires": { - "@jest/types": "^24.6.0", + "@jest/types": "^24.7.0", + "anymatch": "^2.0.0", "fb-watchman": "^2.0.0", + "fsevents": "^1.2.7", "graceful-fs": "^4.1.15", "invariant": "^2.2.4", "jest-serializer": "^24.4.0", - "jest-util": "^24.6.0", + "jest-util": "^24.7.0", "jest-worker": "^24.6.0", "micromatch": "^3.1.10", - "sane": "^4.0.3" + "sane": "^4.0.3", + "walker": "^1.0.7" } }, "jest-jasmine2": { - "version": "24.6.0", - "resolved": "https://registry.npmjs.org/jest-jasmine2/-/jest-jasmine2-24.6.0.tgz", - "integrity": "sha512-Tx1EqstTsiQ92J5vjHB357W87BrNIKaBab2xgG0Ffu7ZJx9R+RnCKuyKzkIEMRcSso+A70f3Memfsqp7idi4sw==", + "version": "24.7.0", + "resolved": "https://registry.npmjs.org/jest-jasmine2/-/jest-jasmine2-24.7.0.tgz", + "integrity": "sha512-bPlCXEl3YXeCLAXa0tegW8WWa94RQkXf4K4FaoMXS8F5iNic6qdj0CaPNQjMkz8s3qdnSN8GMgwF5RK8Vu5krQ==", "dev": true, "requires": { "@babel/traverse": "^7.1.0", - "@jest/environment": "^24.6.0", - "@jest/test-result": "^24.6.0", - "@jest/types": "^24.6.0", + "@jest/environment": "^24.7.0", + "@jest/test-result": "^24.7.0", + "@jest/types": "^24.7.0", "chalk": "^2.0.1", "co": "^4.6.0", - "expect": "^24.6.0", + "expect": "^24.7.0", "is-generator-fn": "^2.0.0", - "jest-each": "^24.6.0", - "jest-matcher-utils": "^24.6.0", - "jest-message-util": "^24.6.0", - "jest-runtime": "^24.6.0", - "jest-snapshot": "^24.6.0", - "jest-util": "^24.6.0", - "pretty-format": "^24.6.0", + "jest-each": "^24.7.0", + "jest-matcher-utils": "^24.7.0", + "jest-message-util": "^24.7.0", + "jest-runtime": "^24.7.0", + "jest-snapshot": "^24.7.0", + "jest-util": "^24.7.0", + "pretty-format": "^24.7.0", "throat": "^4.0.0" } }, "jest-leak-detector": { - "version": "24.6.0", - "resolved": "https://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-24.6.0.tgz", - "integrity": "sha512-lBYsv8IyBjH4bVdMxT4tZRKwBMLIMl6tKyeQ9htSGkTatmnCI8cvRal/P1x8TJsxFvTo0HLhBUQdmkGWNMu2qg==", + "version": "24.7.0", + "resolved": "https://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-24.7.0.tgz", + "integrity": "sha512-zV0qHKZGXtmPVVzT99CVEcHE9XDf+8LwiE0Ob7jjezERiGVljmqKFWpV2IkG+rkFIEUHFEkMiICu7wnoPM/RoQ==", "dev": true, "requires": { - "pretty-format": "^24.6.0" + "pretty-format": "^24.7.0" } }, "jest-matcher-utils": { - "version": "24.6.0", - "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-24.6.0.tgz", - "integrity": "sha512-bXC5aDKXd1t7FfRiEahVoDWuvZI7NMWPd5u8Mn6aPMmQ0k+wG8RmASKjfuCGUOQJ4egV2hTx3wBQ8aipz3qFoA==", + "version": "24.7.0", + "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-24.7.0.tgz", + "integrity": "sha512-158ieSgk3LNXeUhbVJYRXyTPSCqNgVXOp/GT7O94mYd3pk/8+odKTyR1JLtNOQSPzNi8NFYVONtvSWA/e1RDXg==", "dev": true, "requires": { "chalk": "^2.0.1", - "jest-diff": "^24.6.0", + "jest-diff": "^24.7.0", "jest-get-type": "^24.3.0", - "pretty-format": "^24.6.0" + "pretty-format": "^24.7.0" } }, "jest-message-util": { - "version": "24.6.0", - "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-24.6.0.tgz", - "integrity": "sha512-5VEaI9jAm78YlMqNa92670QU/+d4F5TK0eiKEVQ3KwYbVL1kp8RmHg/2oqiKC3LMulyzlIiaqZTnJPk3hcqxwQ==", + "version": "24.7.0", + "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-24.7.0.tgz", + "integrity": "sha512-hzuxx/g7t3uWxC2A12cZbVQI0XDyaXbvcvjNqX/XYijRDJa73/7PDl8ZdCRicbE5L7/jLK9kfzwDd/AimuUWbQ==", "dev": true, "requires": { "@babel/code-frame": "^7.0.0", - "@jest/test-result": "^24.6.0", - "@jest/types": "^24.6.0", + "@jest/test-result": "^24.7.0", + "@jest/types": "^24.7.0", "@types/stack-utils": "^1.0.1", "chalk": "^2.0.1", "micromatch": "^3.1.10", @@ -2405,12 +2950,12 @@ } }, "jest-mock": { - "version": "24.6.0", - "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-24.6.0.tgz", - "integrity": "sha512-GoJKwJrQUlI0yYLUO6fhR+s+aBqgCBERCdA8nDbMuqntkuydwLtMcYJI05eEWXL4zsH5Hw4Z5wfiMLjZsZZ3QA==", + "version": "24.7.0", + "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-24.7.0.tgz", + "integrity": "sha512-6taW4B4WUcEiT2V9BbOmwyGuwuAFT2G8yghF7nyNW1/2gq5+6aTqSPcS9lS6ArvEkX55vbPAS/Jarx5LSm4Fng==", "dev": true, "requires": { - "@jest/types": "^24.6.0" + "@jest/types": "^24.7.0" } }, "jest-pnp-resolver": { @@ -2426,12 +2971,12 @@ "dev": true }, "jest-resolve": { - "version": "24.6.0", - "resolved": "https://registry.npmjs.org/jest-resolve/-/jest-resolve-24.6.0.tgz", - "integrity": "sha512-d72QLxKtVb4M+3GRyxSWMQ2umgTktleqrgarSwpRkRECYE7xg55655cgPEj2cfhBjFkj6Pq4mAU2P3GRploMmQ==", + "version": "24.7.0", + "resolved": "https://registry.npmjs.org/jest-resolve/-/jest-resolve-24.7.0.tgz", + "integrity": "sha512-1coBnLJHuz3VEe1x/I1tFaAgPsp42KVIZKNaVSUxVUyDEwkp4OvsZ59Mwl+bF3L+2OFEdCWj3DFU398NUrANsg==", "dev": true, "requires": { - "@jest/types": "^24.6.0", + "@jest/types": "^24.7.0", "browser-resolve": "^1.11.3", "chalk": "^2.0.1", "jest-pnp-resolver": "^1.2.1", @@ -2439,68 +2984,68 @@ } }, "jest-resolve-dependencies": { - "version": "24.6.0", - "resolved": "https://registry.npmjs.org/jest-resolve-dependencies/-/jest-resolve-dependencies-24.6.0.tgz", - "integrity": "sha512-2QVOYOJVTI4sNcXAL1P22/qW7A2u2V7Y69OlVWAyUmN+XVoVjCbz7AwUCJjIOLyg5isxQqSJBPQC0tXUUGl0xA==", + "version": "24.7.0", + "resolved": "https://registry.npmjs.org/jest-resolve-dependencies/-/jest-resolve-dependencies-24.7.0.tgz", + "integrity": "sha512-R0nllgRNorl/Z1SPp669f3ELTLPTIQ1ZbLyHZW9KYCLgUhbUVESwbOsXjcWmtrhKKxtTaaLtQbDkynOIj53gJQ==", "dev": true, "requires": { - "@jest/types": "^24.6.0", + "@jest/types": "^24.7.0", "jest-regex-util": "^24.3.0", - "jest-snapshot": "^24.6.0" + "jest-snapshot": "^24.7.0" } }, "jest-runner": { - "version": "24.6.0", - "resolved": "https://registry.npmjs.org/jest-runner/-/jest-runner-24.6.0.tgz", - "integrity": "sha512-CFvh7LT4ROqm6Nj0mynUSGA/6QXXoUHij+9GRE2YYp/oY5qntJPmwTXewrEH7bx5LBV8F3EEFSW0c5YavV5X6w==", + "version": "24.7.0", + "resolved": "https://registry.npmjs.org/jest-runner/-/jest-runner-24.7.0.tgz", + "integrity": "sha512-1ClbQ5CoRjyjmIOR5k5O0EhrVi0N0p7Q7eD9AKlWLMhrYwQOJrVclI/II0g5W4kPsKHZIdoL7KhwcUEiXNmckg==", "dev": true, "requires": { "@jest/console": "^24.6.0", - "@jest/environment": "^24.6.0", - "@jest/test-result": "^24.6.0", - "@jest/types": "^24.6.0", + "@jest/environment": "^24.7.0", + "@jest/test-result": "^24.7.0", + "@jest/types": "^24.7.0", "chalk": "^2.4.2", "exit": "^0.1.2", "graceful-fs": "^4.1.15", - "jest-config": "^24.6.0", + "jest-config": "^24.7.0", "jest-docblock": "^24.3.0", - "jest-haste-map": "^24.6.0", - "jest-jasmine2": "^24.6.0", - "jest-leak-detector": "^24.6.0", - "jest-message-util": "^24.6.0", - "jest-resolve": "^24.6.0", - "jest-runtime": "^24.6.0", - "jest-util": "^24.6.0", + "jest-haste-map": "^24.7.0", + "jest-jasmine2": "^24.7.0", + "jest-leak-detector": "^24.7.0", + "jest-message-util": "^24.7.0", + "jest-resolve": "^24.7.0", + "jest-runtime": "^24.7.0", + "jest-util": "^24.7.0", "jest-worker": "^24.6.0", "source-map-support": "^0.5.6", "throat": "^4.0.0" } }, "jest-runtime": { - "version": "24.6.0", - "resolved": "https://registry.npmjs.org/jest-runtime/-/jest-runtime-24.6.0.tgz", - "integrity": "sha512-DkMEP5ygtW1MSvjAEJ2euV8Z5UUm/G8RlJN2vH5kmsV+J/Snm32JD3LuaD8NuTeO7iKnUPEU70dFTtJsd8n5xg==", + "version": "24.7.0", + "resolved": "https://registry.npmjs.org/jest-runtime/-/jest-runtime-24.7.0.tgz", + "integrity": "sha512-UHrBjGhXM8zjhxgaYqHD9GqN/nr14dHNJSltQY2GKFIYFup2PpGYPs/UgaioAdmWpgmAHxrrZD2T2o8JaBiKMg==", "dev": true, "requires": { "@jest/console": "^24.6.0", - "@jest/environment": "^24.6.0", + "@jest/environment": "^24.7.0", "@jest/source-map": "^24.3.0", - "@jest/transform": "^24.6.0", - "@jest/types": "^24.6.0", + "@jest/transform": "^24.7.0", + "@jest/types": "^24.7.0", "@types/yargs": "^12.0.2", "chalk": "^2.0.1", "exit": "^0.1.2", "glob": "^7.1.3", "graceful-fs": "^4.1.15", - "jest-config": "^24.6.0", - "jest-haste-map": "^24.6.0", - "jest-message-util": "^24.6.0", - "jest-mock": "^24.6.0", + "jest-config": "^24.7.0", + "jest-haste-map": "^24.7.0", + "jest-message-util": "^24.7.0", + "jest-mock": "^24.7.0", "jest-regex-util": "^24.3.0", - "jest-resolve": "^24.6.0", - "jest-snapshot": "^24.6.0", - "jest-util": "^24.6.0", - "jest-validate": "^24.6.0", + "jest-resolve": "^24.7.0", + "jest-snapshot": "^24.7.0", + "jest-util": "^24.7.0", + "jest-validate": "^24.7.0", "realpath-native": "^1.1.0", "slash": "^2.0.0", "strip-bom": "^3.0.0", @@ -2514,36 +3059,36 @@ "dev": true }, "jest-snapshot": { - "version": "24.6.0", - "resolved": "https://registry.npmjs.org/jest-snapshot/-/jest-snapshot-24.6.0.tgz", - "integrity": "sha512-G+1q27n6lOdzqpcmP5GnpCfwz4t0E/wasoyNdqvjb6gbLCdfo6Y5ZcPxiclYNOBtGATbbb3IVXeR+ey3aWjSFg==", + "version": "24.7.0", + "resolved": "https://registry.npmjs.org/jest-snapshot/-/jest-snapshot-24.7.0.tgz", + "integrity": "sha512-2TsxHzf4LZ8Wp1a4ORNnM+aL3lN30nOn4V5rNInGQ5an56u3k4lzOQ45AbzFArvcxPpujY6GzNCmstNJ5p/LYA==", "dev": true, "requires": { "@babel/types": "^7.0.0", - "@jest/types": "^24.6.0", + "@jest/types": "^24.7.0", "chalk": "^2.0.1", - "expect": "^24.6.0", - "jest-diff": "^24.6.0", - "jest-matcher-utils": "^24.6.0", - "jest-message-util": "^24.6.0", - "jest-resolve": "^24.6.0", + "expect": "^24.7.0", + "jest-diff": "^24.7.0", + "jest-matcher-utils": "^24.7.0", + "jest-message-util": "^24.7.0", + "jest-resolve": "^24.7.0", "mkdirp": "^0.5.1", "natural-compare": "^1.4.0", - "pretty-format": "^24.6.0", + "pretty-format": "^24.7.0", "semver": "^5.5.0" } }, "jest-util": { - "version": "24.6.0", - "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-24.6.0.tgz", - "integrity": "sha512-f7JbP/tfJuc955+PMvCI49Mn8wCPe+5CV4vSfc2Pi06jrSDGlsTj6mmc5+UF8ApzIQ7ficTUv4JXXcjplbm9TA==", + "version": "24.7.0", + "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-24.7.0.tgz", + "integrity": "sha512-rgkYsdFksdXiLT74l282VJC0AEqcJ/xNwfnX7kNdIwCD5CA7j6D3kk3MlnVYdE0EVYTqSN7Q8tOFp5n2HQU2PQ==", "dev": true, "requires": { "@jest/console": "^24.6.0", - "@jest/fake-timers": "^24.6.0", + "@jest/fake-timers": "^24.7.0", "@jest/source-map": "^24.3.0", - "@jest/test-result": "^24.6.0", - "@jest/types": "^24.6.0", + "@jest/test-result": "^24.7.0", + "@jest/types": "^24.7.0", "callsites": "^3.0.0", "chalk": "^2.0.1", "graceful-fs": "^4.1.15", @@ -2562,31 +3107,31 @@ } }, "jest-validate": { - "version": "24.6.0", - "resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-24.6.0.tgz", - "integrity": "sha512-iBbRzTCyjHidvRUor2KM8FeMAFDWok6/c39fGwRDaLwjlPhDVPy44RLZst8wMRSj1W/Ujdd570btK9SS71CKjw==", + "version": "24.7.0", + "resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-24.7.0.tgz", + "integrity": "sha512-cgai/gts9B2chz1rqVdmLhzYxQbgQurh1PEQSvSgPZ8KGa1AqXsqC45W5wKEwzxKrWqypuQrQxnF4+G9VejJJA==", "dev": true, "requires": { - "@jest/types": "^24.6.0", + "@jest/types": "^24.7.0", "camelcase": "^5.0.0", "chalk": "^2.0.1", "jest-get-type": "^24.3.0", "leven": "^2.1.0", - "pretty-format": "^24.6.0" + "pretty-format": "^24.7.0" } }, "jest-watcher": { - "version": "24.6.0", - "resolved": "https://registry.npmjs.org/jest-watcher/-/jest-watcher-24.6.0.tgz", - "integrity": "sha512-u9YFF8VjGh8vRwuNpuVUAwZFZno+lZuqayITjXkwEsWumuUNx0s9/6+DvB/AiQx/FxcpbXlMDNAflFa7vs7UHg==", + "version": "24.7.0", + "resolved": "https://registry.npmjs.org/jest-watcher/-/jest-watcher-24.7.0.tgz", + "integrity": "sha512-BBDn/6iG1dSM7fR7FBu5o6R+ZwBJBhKmM2tAqpp3yOzZD/1Aerhdx7laLFs2gajWpBzC7OEHr6yMddDX+6n0Mw==", "dev": true, "requires": { - "@jest/test-result": "^24.6.0", - "@jest/types": "^24.6.0", + "@jest/test-result": "^24.7.0", + "@jest/types": "^24.7.0", "@types/yargs": "^12.0.9", "ansi-escapes": "^3.0.0", "chalk": "^2.0.1", - "jest-util": "^24.6.0", + "jest-util": "^24.7.0", "string-length": "^2.0.0" } }, @@ -2985,6 +3530,13 @@ "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", "dev": true }, + "nan": { + "version": "2.13.2", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.13.2.tgz", + "integrity": "sha512-TghvYc72wlMGMVMluVo9WRJc0mB8KxxF/gZ4YYFy7V2ZQX9l7rgbPg7vjS9mt6U5HXODVFVI2bOduCzwOMv/lw==", + "dev": true, + "optional": true + }, "nanomatch": { "version": "1.2.13", "resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.13.tgz", @@ -3381,12 +3933,12 @@ "dev": true }, "pretty-format": { - "version": "24.6.0", - "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-24.6.0.tgz", - "integrity": "sha512-xEeJZFqXgvzSEMxoZ3j4aTaax/pl1upVsfMstcIC048Id84Ve5aqX0WkAta/wFIBLDRz6Tbuj6HcoBXRNk7rtA==", + "version": "24.7.0", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-24.7.0.tgz", + "integrity": "sha512-apen5cjf/U4dj7tHetpC7UEFCvtAgnNZnBDkfPv3fokzIqyOJckAG9OlAPC1BlFALnqT/lGB2tl9EJjlK6eCsA==", "dev": true, "requires": { - "@jest/types": "^24.6.0", + "@jest/types": "^24.7.0", "ansi-regex": "^4.0.0", "ansi-styles": "^3.2.0", "react-is": "^16.8.4" @@ -3621,9 +4173,9 @@ } }, "rollup": { - "version": "1.7.4", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-1.7.4.tgz", - "integrity": "sha512-nc86fETLHdozhRWlW/uNVIQ7ODuA1vU2/L8znAxP9TNMx1NA6GTth3llqoxxCle2kkyui+OfGzbKaQxD60NJjA==", + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-1.8.0.tgz", + "integrity": "sha512-dKxL6ihUZ9YrVySKf/LBz5joW2sqwWkiuki34279Ppr2cL+O6Za6Ujovk+rtTX0AFCIsH1rs6y8LYKdZZ/7C5A==", "dev": true, "requires": { "@types/estree": "0.0.39", diff --git a/package.json b/package.json index 7eef695..2be3891 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "babel-plugin-jsx-dom-expressions", "description": "A JSX to DOM plugin that wraps expressions for fine grained change detection", - "version": "0.5.2", + "version": "0.5.3", "author": "Ryan Carniato", "license": "MIT", "repository": { @@ -18,12 +18,12 @@ "prepublishOnly": "npm run build" }, "devDependencies": { - "@babel/core": "7.3.3", - "babel-plugin-tester": "^6.0.0", - "coveralls": "3.0.2", - "jest": "^24.1.0", - "rollup": "^1.1.2", - "rollup-plugin-node-resolve": "^4.0.0", + "@babel/core": "7.4.3", + "babel-plugin-tester": "^6.0.1", + "coveralls": "3.0.3", + "jest": "^24.7.0", + "rollup": "^1.8.0", + "rollup-plugin-node-resolve": "^4.0.1", "s-js": "0.4.9" }, "dependencies": { diff --git a/src/index.js b/src/index.js index 1166954..e9ff965 100644 --- a/src/index.js +++ b/src/index.js @@ -175,11 +175,32 @@ export default (babel) => { props.push(t.objectExpression(runningObject)); runningObject = []; } - props.push(attribute.argument); + if (attribute.argument.extra && attribute.argument.extra.parenthesized) { + const key = t.identifier('k$'), + memo = t.identifier('m$'); + dynamic.push(t.spreadElement(t.callExpression(t.memberExpression(t.identifier('Object'), t.identifier('keys')), [attribute.argument]))); + props.push( + t.callExpression(t.memberExpression(t.callExpression(t.memberExpression(t.identifier('Object'), t.identifier('keys')), [attribute.argument]), t.identifier('reduce')), [ + t.arrowFunctionExpression([memo, key], + t.assignmentExpression('=', + t.memberExpression(memo, key, true), + t.arrowFunctionExpression([], t.memberExpression(attribute.argument,key, true)) + )), + t.objectExpression([]) + ]) + ); + } else props.push(attribute.argument); } else { const value = attribute.value; if (t.isJSXExpressionContainer(value)) - if (checkParens(value, path)) { + if (attribute.name.name === 'ref') { + runningObject.push(t.objectProperty( + t.identifier('ref'), + t.arrowFunctionExpression([t.identifier('r$')], t.assignmentExpression('=', value.expression, t.identifier('r$'))) + )); + } else if (attribute.name.name === 'forwardRef') { + runningObject.push(t.objectProperty(t.identifier('ref'), value.expression)); + } else if (checkParens(value, path)) { dynamic.push(t.stringLiteral(attribute.name.name)); runningObject.push(t.objectProperty(t.identifier(attribute.name.name), t.arrowFunctionExpression([], value.expression))); } else runningObject.push(t.objectProperty(t.identifier(attribute.name.name), value.expression)); @@ -220,9 +241,12 @@ export default (babel) => { let elem = results.id; jsx.openingElement.attributes.forEach(attribute => { if (t.isJSXSpreadAttribute(attribute)) { - return results.exprs.push( - t.expressionStatement(t.callExpression(t.identifier(`${moduleName}.spread`), [elem, t.arrowFunctionExpression([], attribute.argument)])) - ); + if (attribute.argument.extra && attribute.argument.extra.parenthesized) { + results.exprs.push( + t.expressionStatement(t.callExpression(t.identifier(`${moduleName}.spread`), [elem, t.arrowFunctionExpression([], attribute.argument)])) + ); + } else results.exprs.push(t.expressionStatement(t.callExpression(t.identifier(`${moduleName}.spread`), [elem, attribute.argument]))); + return; } let value = attribute.value, @@ -230,6 +254,8 @@ export default (babel) => { if (t.isJSXExpressionContainer(value)) { if (key === 'ref') { results.exprs.unshift(t.expressionStatement(t.assignmentExpression("=", value.expression, elem))); + } else if (key === 'forwardRef') { + results.exprs.unshift(t.expressionStatement(t.logicalExpression('&&', value.expression, t.callExpression(value.expression, [elem])))); } else if (key.startsWith("on")) { const ev = toEventName(key); if (delegateEvents && key !== key.toLowerCase() && !NonComposedEvents.has(ev)) { diff --git a/src/runtime/createRuntime.js b/src/runtime/createRuntime.js index 3d2096b..c3a4fb5 100644 --- a/src/runtime/createRuntime.js +++ b/src/runtime/createRuntime.js @@ -112,6 +112,24 @@ export function createRuntime(config) { return current; } + function spreadExpression(node, props) { + let info; + for (const prop in props) { + const value = props[prop]; + if (prop === 'style') { + Object.assign(node.style, value); + } else if (prop === 'classList') { + for (const className in value) node.classList.toggle(className, value[className]); + } else if (prop === 'events') { + for (const eventName in value) node.addEventListener(eventName, value[eventName]); + } else if (info = Attributes[prop]) { + if (info.type === 'attribute') { + node.setAttribute(prop, value) + } else node[info.alias] = value; + } else node[prop] = value; + } + } + return Object.assign({ insert(parent, accessor, init, marker) { if (typeof accessor !== 'function') return insertExpression(parent, accessor, init, marker); @@ -137,24 +155,8 @@ export function createRuntime(config) { eventRegistry.clear(); }, spread(node, accessor) { - wrap(function() { - const props = accessor(); - let info; - for (const prop in props) { - const value = props[prop]; - if (prop === 'style') { - Object.assign(node.style, value); - } else if (prop === 'classList') { - for (const className in value) node.classList.toggle(className, value[className]); - } else if (prop === 'events') { - for (const eventName in value) node.addEventListener(eventName, value[eventName]); - } else if (info = Attributes[prop]) { - if (info.type === 'attribute') { - node.setAttribute(prop, value) - } else node[info.alias] = value; - } else node[prop] = value; - } - }); + if (typeof accessor !== 'function') return spreadExpression(node, accessor); + wrap(() => spreadExpression(node, accessor())); }, flow(parent, type, accessor, expr, options, marker) { let startNode; diff --git a/test/plugin/__fixtures__/attributeExpressions/code.js b/test/plugin/__fixtures__/attributeExpressions/code.js index 1ac5091..e4df075 100644 --- a/test/plugin/__fixtures__/attributeExpressions/code.js +++ b/test/plugin/__fixtures__/attributeExpressions/code.js @@ -9,7 +9,8 @@ let link; const template = (

    diff --git a/test/plugin/__fixtures__/attributeExpressions/output.js b/test/plugin/__fixtures__/attributeExpressions/output.js index 4146eef..1cda926 100644 --- a/test/plugin/__fixtures__/attributeExpressions/output.js +++ b/test/plugin/__fixtures__/attributeExpressions/output.js @@ -28,6 +28,7 @@ const template = function () { for (let i = 0; i < classKeys.length; i++) _el$.classList.toggle(classKeys[i], classNames[classKeys[i]]); }); r.spread(_el$2, () => props); + r.spread(_el$2, results); r.wrap(() => _el$2.title = welcoming); r.wrap(() => Object.assign(_el$2.style, { backgroundColor: color diff --git a/test/plugin/__fixtures__/subTemplates/code.js b/test/plugin/__fixtures__/subTemplates/code.js index bac7087..17ea896 100644 --- a/test/plugin/__fixtures__/subTemplates/code.js +++ b/test/plugin/__fixtures__/subTemplates/code.js @@ -1,25 +1,28 @@ const Child = props => ( <> -
    Hello {props.name}
    +
    Hello {props.name}
    {props.children}
    ); const someProps = {some: 'stuff', more: 'things'} -const template = ( -
    - -
    From Parent
    -
    - -
    {state.content}
    -
    - { context => - context - } -
    -) +const template = props => { + let childRef; + return ( +
    + +
    From Parent
    +
    + +
    {state.content}
    +
    + { context => + context + } +
    + ); +} const template2 = ( diff --git a/test/plugin/__fixtures__/subTemplates/output.js b/test/plugin/__fixtures__/subTemplates/output.js index 0b5126d..ea0111c 100644 --- a/test/plugin/__fixtures__/subTemplates/output.js +++ b/test/plugin/__fixtures__/subTemplates/output.js @@ -21,6 +21,7 @@ const Child = props => function () { _el$4 = _el$3.nextSibling, _el$5 = _el$2.nextSibling; + props.ref && props.ref(_el$2); r.insert(_el$2, props.name, null, _el$4); r.insert(_el$5, props.children); return _el$; @@ -31,31 +32,37 @@ const someProps = { more: 'things' }; -const template = function () { - const _el$6 = _tmpl$4.content.firstChild.cloneNode(true), - _el$8 = _el$6.firstChild, - _el$10 = _el$8.nextSibling, - _el$11 = _el$10.nextSibling; +const template = props => { + let childRef; + return function () { + const _el$6 = _tmpl$4.content.firstChild.cloneNode(true), + _el$8 = _el$6.firstChild, + _el$10 = _el$8.nextSibling, + _el$11 = _el$10.nextSibling; - r.insert(_el$6, Child(Object.assign({ - name: 'John' - }, someProps, { - children: [_tmpl$2.content.firstChild.cloneNode(true)] - })), null, _el$8); - r.insert(_el$6, Child({ - name: 'Jason', - children: [(() => { - const _el$9 = _tmpl$3.content.firstChild.cloneNode(true); + r.insert(_el$6, Child(Object.assign({ + name: 'John' + }, props, { + ref: r$ => childRef = r$, + children: [_tmpl$2.content.firstChild.cloneNode(true)] + })), null, _el$8); + r.insert(_el$6, r.createComponent(Child, Object.assign({ + name: 'Jason' + }, Object.keys(props).reduce((m$, k$) => m$[k$] = () => props[k$], {}), { + ref: props.ref, + children: [(() => { + const _el$9 = _tmpl$3.content.firstChild.cloneNode(true); - r.insert(_el$9, state.content); - return _el$9; - })()] - }), null, _el$10); - r.insert(_el$6, Context.Consumer({ - children: [context => context] - }), null, _el$11); - return _el$6; -}(); + r.insert(_el$9, state.content); + return _el$9; + })()] + }), [...Object.keys(props)]), null, _el$10); + r.insert(_el$6, Context.Consumer({ + children: [context => context] + }), null, _el$11); + return _el$6; + }(); +}; const template2 = r.createComponent(Child, { name: 'Jake',