Commit de09c80d authored by Rosanny Sihombing's avatar Rosanny Sihombing
Browse files

Merge branch 'revert-4806fefb' into 'testing'

Revert "Merge branch 'cherry-pick-5b932c11' into 'testing'"

See merge request !170
parents 4806fefb 5b5df7d0
Pipeline #6897 passed with stage
in 6 seconds
/*istanbul ignore start*/'use strict';
exports.__esModule = true;
exports. /*istanbul ignore end*/generateOptions = generateOptions;
function generateOptions(options, defaults) {
if (typeof options === 'function') {
defaults.callback = options;
} else if (options) {
for (var name in options) {
/* istanbul ignore else */
if (options.hasOwnProperty(name)) {
defaults[name] = options[name];
}
}
}
return defaults;
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dGlsL3BhcmFtcy5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Z0NBQWdCLGUsR0FBQSxlO0FBQVQsU0FBUyxlQUFULENBQXlCLE9BQXpCLEVBQWtDLFFBQWxDLEVBQTRDO0FBQ2pELE1BQUksT0FBTyxPQUFQLEtBQW1CLFVBQXZCLEVBQW1DO0FBQ2pDLGFBQVMsUUFBVCxHQUFvQixPQUFwQjtBQUNELEdBRkQsTUFFTyxJQUFJLE9BQUosRUFBYTtBQUNsQixTQUFLLElBQUksSUFBVCxJQUFpQixPQUFqQixFQUEwQjs7QUFFeEIsVUFBSSxRQUFRLGNBQVIsQ0FBdUIsSUFBdkIsQ0FBSixFQUFrQztBQUNoQyxpQkFBUyxJQUFULElBQWlCLFFBQVEsSUFBUixDQUFqQjtBQUNEO0FBQ0Y7QUFDRjtBQUNELFNBQU8sUUFBUDtBQUNEIiwiZmlsZSI6InBhcmFtcy5qcyIsInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCBmdW5jdGlvbiBnZW5lcmF0ZU9wdGlvbnMob3B0aW9ucywgZGVmYXVsdHMpIHtcbiAgaWYgKHR5cGVvZiBvcHRpb25zID09PSAnZnVuY3Rpb24nKSB7XG4gICAgZGVmYXVsdHMuY2FsbGJhY2sgPSBvcHRpb25zO1xuICB9IGVsc2UgaWYgKG9wdGlvbnMpIHtcbiAgICBmb3IgKGxldCBuYW1lIGluIG9wdGlvbnMpIHtcbiAgICAgIC8qIGlzdGFuYnVsIGlnbm9yZSBlbHNlICovXG4gICAgICBpZiAob3B0aW9ucy5oYXNPd25Qcm9wZXJ0eShuYW1lKSkge1xuICAgICAgICBkZWZhdWx0c1tuYW1lXSA9IG9wdGlvbnNbbmFtZV07XG4gICAgICB9XG4gICAgfVxuICB9XG4gIHJldHVybiBkZWZhdWx0cztcbn1cbiJdfQ==
{
"name": "diff",
"version": "3.2.0",
"description": "A javascript text diff implementation.",
"keywords": [
"diff",
"javascript"
],
"maintainers": [
"Kevin Decker <kpdecker@gmail.com> (http://incaseofstairs.com)"
],
"bugs": {
"email": "kpdecker@gmail.com",
"url": "http://github.com/kpdecker/jsdiff/issues"
},
"license": "BSD-3-Clause",
"repository": {
"type": "git",
"url": "git://github.com/kpdecker/jsdiff.git"
},
"engines": {
"node": ">=0.3.1"
},
"main": "./lib",
"scripts": {
"test": "grunt"
},
"dependencies": {},
"devDependencies": {
"async": "^1.4.2",
"babel-core": "^6.0.0",
"babel-loader": "^6.0.0",
"babel-preset-es2015-mod": "^6.3.13",
"babel-preset-es3": "^1.0.1",
"chai": "^3.3.0",
"colors": "^1.1.2",
"eslint": "^1.6.0",
"grunt": "^0.4.5",
"grunt-babel": "^6.0.0",
"grunt-clean": "^0.4.0",
"grunt-cli": "^0.1.13",
"grunt-contrib-clean": "^1.0.0",
"grunt-contrib-copy": "^1.0.0",
"grunt-contrib-uglify": "^1.0.0",
"grunt-contrib-watch": "^1.0.0",
"grunt-eslint": "^17.3.1",
"grunt-karma": "^0.12.1",
"grunt-mocha-istanbul": "^3.0.1",
"grunt-mocha-test": "^0.12.7",
"grunt-webpack": "^1.0.11",
"istanbul": "github:kpdecker/istanbul",
"karma": "^0.13.11",
"karma-mocha": "^0.2.0",
"karma-mocha-reporter": "^2.0.0",
"karma-phantomjs-launcher": "^1.0.0",
"karma-sauce-launcher": "^0.3.0",
"karma-sourcemap-loader": "^0.3.6",
"karma-webpack": "^1.7.0",
"mocha": "^2.3.3",
"phantomjs-prebuilt": "^2.1.5",
"semver": "^5.0.3",
"webpack": "^1.12.2",
"webpack-dev-server": "^1.12.0"
},
"optionalDependencies": {},
"babel": {
"sourceMaps": "inline",
"presets": [
"es3",
"es2015-mod"
],
"auxiliaryCommentBefore": "istanbul ignore start",
"auxiliaryCommentAfter": "istanbul ignore end"
}
}
# Release Notes
## Development
[Commits](https://github.com/kpdecker/jsdiff/compare/v3.2.0...master)
## v3.2.0 - December 26th, 2016
- [#156](https://github.com/kpdecker/jsdiff/pull/156) - Add `undefinedReplacement` option to `diffJson` ([@ewnd9](https://api.github.com/users/ewnd9))
- [#154](https://github.com/kpdecker/jsdiff/pull/154) - Add `examples` and `images` to `.npmignore`. ([@wtgtybhertgeghgtwtg](https://api.github.com/users/wtgtybhertgeghgtwtg))
- [#153](https://github.com/kpdecker/jsdiff/pull/153) - feat(structuredPatch): Pass options to diffLines ([@Kiougar](https://api.github.com/users/Kiougar))
[Commits](https://github.com/kpdecker/jsdiff/compare/v3.1.0...v3.2.0)
## v3.1.0 - November 27th, 2016
- [#146](https://github.com/kpdecker/jsdiff/pull/146) - JsDiff.diffArrays to compare arrays ([@wvanderdeijl](https://api.github.com/users/wvanderdeijl))
- [#144](https://github.com/kpdecker/jsdiff/pull/144) - Split file using all possible line delimiter instead of hard-coded "/n" and join lines back using the original delimiters ([@soulbeing](https://api.github.com/users/soulbeing))
[Commits](https://github.com/kpdecker/jsdiff/compare/v3.0.1...v3.1.0)
## v3.0.1 - October 9th, 2016
- [#139](https://github.com/kpdecker/jsdiff/pull/139) - Make README.md look nicer in npmjs.com ([@takenspc](https://api.github.com/users/takenspc))
- [#135](https://github.com/kpdecker/jsdiff/issues/135) - parsePatch combines patches from multiple files into a single IUniDiff when there is no "Index" line ([@ramya-rao-a](https://api.github.com/users/ramya-rao-a))
- [#124](https://github.com/kpdecker/jsdiff/issues/124) - IE7/IE8 failure since 2.0.0 ([@boneskull](https://api.github.com/users/boneskull))
[Commits](https://github.com/kpdecker/jsdiff/compare/v3.0.0...v3.0.1)
## v3.0.0 - August 23rd, 2016
- [#130](https://github.com/kpdecker/jsdiff/pull/130) - Add callback argument to applyPatches `patched` option ([@piranna](https://api.github.com/users/piranna))
- [#120](https://github.com/kpdecker/jsdiff/pull/120) - Correctly handle file names containing spaces ([@adius](https://api.github.com/users/adius))
- [#119](https://github.com/kpdecker/jsdiff/pull/119) - Do single reflow ([@wifiextender](https://api.github.com/users/wifiextender))
- [#117](https://github.com/kpdecker/jsdiff/pull/117) - Make more usable with long strings. ([@abnbgist](https://api.github.com/users/abnbgist))
Compatibility notes:
- applyPatches patch callback now is async and requires the callback be called to continue operation
[Commits](https://github.com/kpdecker/jsdiff/compare/v2.2.3...v3.0.0)
## v2.2.3 - May 31st, 2016
- [#118](https://github.com/kpdecker/jsdiff/pull/118) - Add a fix for applying 0-length destination patches ([@chaaz](https://api.github.com/users/chaaz))
- [#115](https://github.com/kpdecker/jsdiff/pull/115) - Fixed grammar in README ([@krizalys](https://api.github.com/users/krizalys))
- [#113](https://github.com/kpdecker/jsdiff/pull/113) - fix typo ([@vmazare](https://api.github.com/users/vmazare))
[Commits](https://github.com/kpdecker/jsdiff/compare/v2.2.2...v2.2.3)
## v2.2.2 - March 13th, 2016
- [#102](https://github.com/kpdecker/jsdiff/issues/102) - diffJson with dates, returns empty curly braces ([@dr-dimitru](https://api.github.com/users/dr-dimitru))
- [#97](https://github.com/kpdecker/jsdiff/issues/97) - Whitespaces & diffWords ([@faiwer](https://api.github.com/users/faiwer))
- [#92](https://github.com/kpdecker/jsdiff/pull/92) - Fixes typo in the readme ([@bg451](https://api.github.com/users/bg451))
[Commits](https://github.com/kpdecker/jsdiff/compare/v2.2.1...v2.2.2)
## v2.2.1 - November 12th, 2015
- [#89](https://github.com/kpdecker/jsdiff/pull/89) - add in display selector to readme ([@FranDias](https://api.github.com/users/FranDias))
- [#88](https://github.com/kpdecker/jsdiff/pull/88) - Split diffs based on file headers instead of 'Index:' metadata ([@piranna](https://api.github.com/users/piranna))
[Commits](https://github.com/kpdecker/jsdiff/compare/v2.2.0...v2.2.1)
## v2.2.0 - October 29th, 2015
- [#80](https://github.com/kpdecker/jsdiff/pull/80) - Fix a typo: applyPath -> applyPatch ([@fluxxu](https://api.github.com/users/fluxxu))
- [#83](https://github.com/kpdecker/jsdiff/pull/83) - Add basic fuzzy matching to applyPatch ([@piranna](https://github.com/piranna))
[Commits](https://github.com/kpdecker/jsdiff/compare/v2.2.0...v2.2.0)
## v2.2.0 - October 29th, 2015
- [#80](https://github.com/kpdecker/jsdiff/pull/80) - Fix a typo: applyPath -> applyPatch ([@fluxxu](https://api.github.com/users/fluxxu))
- [#83](https://github.com/kpdecker/jsdiff/pull/83) - Add basic fuzzy matching to applyPatch ([@piranna](https://github.com/piranna))
[Commits](https://github.com/kpdecker/jsdiff/compare/v2.1.3...v2.2.0)
## v2.1.3 - September 30th, 2015
- [#78](https://github.com/kpdecker/jsdiff/pull/78) - fix: error throwing when apply patch to empty string ([@21paradox](https://api.github.com/users/21paradox))
[Commits](https://github.com/kpdecker/jsdiff/compare/v2.1.2...v2.1.3)
## v2.1.2 - September 23rd, 2015
- [#76](https://github.com/kpdecker/jsdiff/issues/76) - diff headers give error ([@piranna](https://api.github.com/users/piranna))
[Commits](https://github.com/kpdecker/jsdiff/compare/v2.1.1...v2.1.2)
## v2.1.1 - September 9th, 2015
- [#73](https://github.com/kpdecker/jsdiff/issues/73) - Is applyPatches() exposed in the API? ([@davidparsson](https://api.github.com/users/davidparsson))
[Commits](https://github.com/kpdecker/jsdiff/compare/v2.1.0...v2.1.1)
## v2.1.0 - August 27th, 2015
- [#72](https://github.com/kpdecker/jsdiff/issues/72) - Consider using options object API for flag permutations ([@kpdecker](https://api.github.com/users/kpdecker))
- [#70](https://github.com/kpdecker/jsdiff/issues/70) - diffWords treats \n at the end as significant whitespace ([@nesQuick](https://api.github.com/users/nesQuick))
- [#69](https://github.com/kpdecker/jsdiff/issues/69) - Missing count ([@wfalkwallace](https://api.github.com/users/wfalkwallace))
- [#68](https://github.com/kpdecker/jsdiff/issues/68) - diffLines seems broken ([@wfalkwallace](https://api.github.com/users/wfalkwallace))
- [#60](https://github.com/kpdecker/jsdiff/issues/60) - Support multiple diff hunks ([@piranna](https://api.github.com/users/piranna))
- [#54](https://github.com/kpdecker/jsdiff/issues/54) - Feature Reuqest: 3-way merge ([@mog422](https://api.github.com/users/mog422))
- [#42](https://github.com/kpdecker/jsdiff/issues/42) - Fuzz factor for applyPatch ([@stuartpb](https://api.github.com/users/stuartpb))
- Move whitespace ignore out of equals method - 542063c
- Include source maps in babel output - 7f7ab21
- Merge diff/line and diff/patch implementations - 1597705
- Drop map utility method - 1ddc939
- Documentation for parsePatch and applyPatches - 27c4b77
Compatibility notes:
- The undocumented ignoreWhitespace flag has been removed from the Diff equality check directly. This implementation may be copied to diff utilities if dependencies existed on this functionality.
[Commits](https://github.com/kpdecker/jsdiff/compare/v2.0.2...v2.1.0)
## v2.0.2 - August 8th, 2015
- [#67](https://github.com/kpdecker/jsdiff/issues/67) - cannot require from npm module in node ([@commenthol](https://api.github.com/users/commenthol))
- Convert to chai since we don’t support IE8 - a96bbad
[Commits](https://github.com/kpdecker/jsdiff/compare/v2.0.1...v2.0.2)
## v2.0.1 - August 7th, 2015
- Add release build at proper step - 57542fd
[Commits](https://github.com/kpdecker/jsdiff/compare/v2.0.0...v2.0.1)
## v2.0.0 - August 7th, 2015
- [#66](https://github.com/kpdecker/jsdiff/issues/66) - Add karma and sauce tests ([@kpdecker](https://api.github.com/users/kpdecker))
- [#65](https://github.com/kpdecker/jsdiff/issues/65) - Create component repository for bower ([@kpdecker](https://api.github.com/users/kpdecker))
- [#64](https://github.com/kpdecker/jsdiff/issues/64) - Automatically call removeEmpty for all tokenizer calls ([@kpdecker](https://api.github.com/users/kpdecker))
- [#62](https://github.com/kpdecker/jsdiff/pull/62) - Allow access to structured object representation of patch data ([@bittrance](https://api.github.com/users/bittrance))
- [#61](https://github.com/kpdecker/jsdiff/pull/61) - Use svg instead of png to get better image quality ([@PeterDaveHello](https://api.github.com/users/PeterDaveHello))
- [#29](https://github.com/kpdecker/jsdiff/issues/29) - word tokenizer works only for 7 bit ascii ([@plasmagunman](https://api.github.com/users/plasmagunman))
Compatibility notes:
- `this.removeEmpty` is now called automatically for all instances. If this is not desired, this may be overriden on a per instance basis.
- The library has been refactored to use some ES6 features. The external APIs should remain the same, but bower projects that directly referenced the repository will now have to point to the [components/jsdiff](https://github.com/components/jsdiff) repository.
[Commits](https://github.com/kpdecker/jsdiff/compare/v1.4.0...v2.0.0)
## v1.4.0 - May 6th, 2015
- [#57](https://github.com/kpdecker/jsdiff/issues/57) - createPatch -> applyPatch failed. ([@mog422](https://api.github.com/users/mog422))
- [#56](https://github.com/kpdecker/jsdiff/pull/56) - Two files patch ([@rgeissert](https://api.github.com/users/rgeissert))
- [#14](https://github.com/kpdecker/jsdiff/issues/14) - Flip added and removed order? ([@jakesandlund](https://api.github.com/users/jakesandlund))
[Commits](https://github.com/kpdecker/jsdiff/compare/v1.3.2...v1.4.0)
## v1.3.2 - March 30th, 2015
- [#53](https://github.com/kpdecker/jsdiff/pull/53) - Updated README.MD with Bower installation instructions ([@ofbriggs](https://api.github.com/users/ofbriggs))
- [#49](https://github.com/kpdecker/jsdiff/issues/49) - Cannot read property 'oldlines' of undefined ([@nwtn](https://api.github.com/users/nwtn))
- [#44](https://github.com/kpdecker/jsdiff/issues/44) - invalid-meta jsdiff is missing "main" entry in bower.json
[Commits](https://github.com/kpdecker/jsdiff/compare/v1.3.1...v1.3.2)
## v1.3.1 - March 13th, 2015
- [#52](https://github.com/kpdecker/jsdiff/pull/52) - Fix for #51 Wrong result of JsDiff.diffLines ([@felicienfrancois](https://api.github.com/users/felicienfrancois))
[Commits](https://github.com/kpdecker/jsdiff/compare/v1.3.0...v1.3.1)
## v1.3.0 - March 2nd, 2015
- [#47](https://github.com/kpdecker/jsdiff/pull/47) - Adding Diff Trimmed Lines ([@JamesGould123](https://api.github.com/users/JamesGould123))
[Commits](https://github.com/kpdecker/jsdiff/compare/v1.2.2...v1.3.0)
## v1.2.2 - January 26th, 2015
- [#45](https://github.com/kpdecker/jsdiff/pull/45) - Fix AMD module loading ([@pedrocarrico](https://api.github.com/users/pedrocarrico))
- [#43](https://github.com/kpdecker/jsdiff/pull/43) - added a bower file ([@nbrustein](https://api.github.com/users/nbrustein))
[Commits](https://github.com/kpdecker/jsdiff/compare/v1.2.1...v1.2.2)
## v1.2.1 - December 26th, 2014
- [#41](https://github.com/kpdecker/jsdiff/pull/41) - change condition of using node export system. ([@ironhee](https://api.github.com/users/ironhee))
[Commits](https://github.com/kpdecker/jsdiff/compare/v1.2.0...v1.2.1)
## v1.2.0 - November 29th, 2014
- [#37](https://github.com/kpdecker/jsdiff/pull/37) - Add support for sentences. ([@vmariano](https://api.github.com/users/vmariano))
- [#28](https://github.com/kpdecker/jsdiff/pull/28) - Implemented diffJson ([@papandreou](https://api.github.com/users/papandreou))
- [#27](https://github.com/kpdecker/jsdiff/issues/27) - Slow to execute over diffs with a large number of changes ([@termi](https://api.github.com/users/termi))
- Allow for optional async diffing - 19385b9
- Fix diffChars implementation - eaa44ed
[Commits](https://github.com/kpdecker/jsdiff/compare/v1.1.0...v1.2.0)
## v1.1.0 - November 25th, 2014
- [#33](https://github.com/kpdecker/jsdiff/pull/33) - AMD and global exports ([@ovcharik](https://api.github.com/users/ovcharik))
- [#32](https://github.com/kpdecker/jsdiff/pull/32) - Add support for component ([@vmariano](https://api.github.com/users/vmariano))
- [#31](https://github.com/kpdecker/jsdiff/pull/31) - Don't rely on Array.prototype.map ([@papandreou](https://api.github.com/users/papandreou))
[Commits](https://github.com/kpdecker/jsdiff/compare/v1.0.8...v1.1.0)
## v1.0.8 - December 22nd, 2013
- [#24](https://github.com/kpdecker/jsdiff/pull/24) - Handle windows newlines on non windows machines. ([@benogle](https://api.github.com/users/benogle))
- [#23](https://github.com/kpdecker/jsdiff/pull/23) - Prettied up the API formatting a little, and added basic node and web examples ([@airportyh](https://api.github.com/users/airportyh))
[Commits](https://github.com/kpdecker/jsdiff/compare/v1.0.7...v1.0.8)
## v1.0.7 - September 11th, 2013
- [#22](https://github.com/kpdecker/jsdiff/pull/22) - Added variant of WordDiff that doesn't ignore whitespace differences ([@papandreou](https://api.github.com/users/papandreou)
- Add 0.10 to travis tests - 243a526
[Commits](https://github.com/kpdecker/jsdiff/compare/v1.0.6...v1.0.7)
## v1.0.6 - August 30th, 2013
- [#19](https://github.com/kpdecker/jsdiff/pull/19) - Explicitly define contents of npm package ([@sindresorhus](https://api.github.com/users/sindresorhus)
[Commits](https://github.com/kpdecker/jsdiff/compare/v1.0.5...v1.0.6)
require('babel-core/register')({
ignore: /\/lib\/|\/node_modules\//
});
# Growl for nodejs
Growl support for Nodejs. This is essentially a port of my [Ruby Growl Library](http://github.com/visionmedia/growl). Ubuntu/Linux support added thanks to [@niftylettuce](http://github.com/niftylettuce).
## Installation
### Install
### Mac OS X (Darwin):
Install [growlnotify(1)](http://growl.info/extras.php#growlnotify). On OS X 10.8, Notification Center is supported using [terminal-notifier](https://github.com/alloy/terminal-notifier). To install:
$ sudo gem install terminal-notifier
Install [npm](http://npmjs.org/) and run:
$ npm install growl
### Ubuntu (Linux):
Install `notify-send` through the [libnotify-bin](http://packages.ubuntu.com/libnotify-bin) package:
$ sudo apt-get install libnotify-bin
Install [npm](http://npmjs.org/) and run:
$ npm install growl
### Windows:
Download and install [Growl for Windows](http://www.growlforwindows.com/gfw/default.aspx)
Download [growlnotify](http://www.growlforwindows.com/gfw/help/growlnotify.aspx) - **IMPORTANT :** Unpack growlnotify to a folder that is present in your path!
Install [npm](http://npmjs.org/) and run:
$ npm install growl
## Examples
Callback functions are optional
```javascript
var growl = require('growl')
growl('You have mail!')
growl('5 new messages', { sticky: true })
growl('5 new emails', { title: 'Email Client', image: 'Safari', sticky: true })
growl('Message with title', { title: 'Title'})
growl('Set priority', { priority: 2 })
growl('Show Safari icon', { image: 'Safari' })
growl('Show icon', { image: 'path/to/icon.icns' })
growl('Show image', { image: 'path/to/my.image.png' })
growl('Show png filesystem icon', { image: 'png' })
growl('Show pdf filesystem icon', { image: 'article.pdf' })
growl('Show pdf filesystem icon', { image: 'article.pdf' }, function(err){
// ... notified
})
```
## Options
- title
- notification title
- name
- application name
- priority
- priority for the notification (default is 0)
- sticky
- weither or not the notification should remainin until closed
- image
- Auto-detects the context:
- path to an icon sets --iconpath
- path to an image sets --image
- capitalized word sets --appIcon
- filename uses extname as --icon
- otherwise treated as --icon
- exec
- manually specify a shell command instead
- appends message to end of shell command
- or, replaces `%s` with message
- optionally prepends title (example: `title: message`)
- examples: `{exec: 'tmux display-message'}`, `{exec: 'echo "%s" > messages.log}`
## License
(The MIT License)
Copyright (c) 2009 TJ Holowaychuk <tj@vision-media.ca>
Copyright (c) 2016 Joshua Boy Nicolai Appelman <joshua@jbna.nl>
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// Growl - Copyright TJ Holowaychuk <tj@vision-media.ca> (MIT Licensed)
/**
* Module dependencies.
*/
var exec = require('child_process').exec
, fs = require('fs')
, path = require('path')
, exists = fs.existsSync || path.existsSync
, os = require('os')
, quote = JSON.stringify
, cmd;
function which(name) {
var paths = process.env.PATH.split(':');
var loc;
for (var i = 0, len = paths.length; i < len; ++i) {
loc = path.join(paths[i], name);
if (exists(loc)) return loc;
}
}
switch(os.type()) {
case 'Darwin':
if (which('terminal-notifier')) {
cmd = {
type: "Darwin-NotificationCenter"
, pkg: "terminal-notifier"
, msg: '-message'
, title: '-title'
, subtitle: '-subtitle'
, icon: '-appIcon'
, sound: '-sound'
, url: '-open'
, priority: {
cmd: '-execute'
, range: []
}
};
} else {
cmd = {
type: "Darwin-Growl"
, pkg: "growlnotify"
, msg: '-m'
, sticky: '--sticky'
, priority: {
cmd: '--priority'
, range: [
-2
, -1
, 0
, 1
, 2
, "Very Low"
, "Moderate"
, "Normal"
, "High"
, "Emergency"
]
}
};
}
break;
case 'Linux':
if (which('growl')) {
cmd = {
type: "Linux-Growl"
, pkg: "growl"
, msg: '-m'
, title: '-title'
, subtitle: '-subtitle'
, host: {
cmd: '-H'
, hostname: '192.168.33.1'
}
};
} else {
cmd = {
type: "Linux"
, pkg: "notify-send"
, msg: ''
, sticky: '-t 0'
, icon: '-i'
, priority: {
cmd: '-u'
, range: [
"low"
, "normal"
, "critical"
]
}
};
}
break;
case 'Windows_NT':
cmd = {
type: "Windows"
, pkg: "growlnotify"
, msg: ''
, sticky: '/s:true'
, title: '/t:'
, icon: '/i:'
, url: '/cu:'
, priority: {
cmd: '/p:'
, range: [
-2
, -1
, 0
, 1
, 2
]
}
};
break;
}
/**
* Expose `growl`.
*/
exports = module.exports = growl;
/**
* Node-growl version.
*/
exports.version = '1.4.1'
/**
* Send growl notification _msg_ with _options_.
*
* Options:
*
* - title Notification title
* - sticky Make the notification stick (defaults to false)
* - priority Specify an int or named key (default is 0)
* - name Application name (defaults to growlnotify)
* - sound Sound efect ( in OSx defined in preferences -> sound -> effects) * works only in OSX > 10.8x
* - image
* - path to an icon sets --iconpath
* - path to an image sets --image
* - capitalized word sets --appIcon
* - filename uses extname as --icon
* - otherwise treated as --icon
*
* Examples:
*
* growl('New email')
* growl('5 new emails', { title: 'Thunderbird' })
* growl('5 new emails', { title: 'Thunderbird', sound: 'Purr' })
* growl('Email sent', function(){
* // ... notification sent
* })
*
* @param {string} msg
* @param {object} options
* @param {function} fn
* @api public
*/
function growl(msg, options, fn) {
var image
, args
, options = options || {}
, fn = fn || function(){};
if (options.exec) {
cmd = {
type: "Custom"
, pkg: options.exec
, range: []
};
}
// noop
if (!cmd) return fn(new Error('growl not supported on this platform'));
args = [cmd.pkg];
// image
if (image = options.image) {
switch(cmd.type) {
case 'Darwin-Growl':
var flag, ext = path.extname(image).substr(1)
flag = flag || ext == 'icns' && 'iconpath'
flag = flag || /^[A-Z]/.test(image) && 'appIcon'
flag = flag || /^png|gif|jpe?g$/.test(ext) && 'image'
flag = flag || ext && (image = ext) && 'icon'
flag = flag || 'icon'
args.push('--' + flag, quote(image))
break;
case 'Darwin-NotificationCenter':
args.push(cmd.icon, quote(image));
break;
case 'Linux':
args.push(cmd.icon, quote(image));
// libnotify defaults to sticky, set a hint for transient notifications
if (!options.sticky) args.push('--hint=int:transient:1');
break;
case 'Windows':
args.push(cmd.icon + quote(image));
break;
}
}
// sticky
if (options.sticky) args.push(cmd.sticky);
// priority
if (options.priority) {
var priority = options.priority + '';
var checkindexOf = cmd.priority.range.indexOf(priority);
if (~cmd.priority.range.indexOf(priority)) {
args.push(cmd.priority, options.priority);
}
}
//sound
if(options.sound && cmd.type === 'Darwin-NotificationCenter'){
args.push(cmd.sound, options.sound)
}
// name
if (options.name && cmd.type === "Darwin-Growl") {
args.push('--name', options.name);
}
switch(cmd.type) {
case 'Darwin-Growl':
args.push(cmd.msg);
args.push(quote(msg).replace(/\\n/g, '\n'));
if (options.title) args.push(quote(options.title));
break;
case 'Darwin-NotificationCenter':
args.push(cmd.msg);
var stringifiedMsg = quote(msg);
var escapedMsg = stringifiedMsg.replace(/\\n/g, '\n');
args.push(escapedMsg);
if (options.title) {
args.push(cmd.title);
args.push(quote(options.title));
}
if (options.subtitle) {
args.push(cmd.subtitle);
args.push(quote(options.subtitle));
}
if (options.url) {
args.push(cmd.url);
args.push(quote(options.url));
}
break;
case 'Linux-Growl':
args.push(cmd.msg);
args.push(quote(msg).replace(/\\n/g, '\n'));
if (options.title) args.push(quote(options.title));
if (cmd.host) {
args.push(cmd.host.cmd, cmd.host.hostname)
}
break;
case 'Linux':
if (options.title) {
args.push(quote(options.title));
args.push(cmd.msg);
args.push(quote(msg).replace(/\\n/g, '\n'));
} else {
args.push(quote(msg).replace(/\\n/g, '\n'));
}
break;
case 'Windows':
args.push(quote(msg).replace(/\\n/g, '\n'));
if (options.title) args.push(cmd.title + quote(options.title));
if (options.url) args.push(cmd.url + quote(options.url));
break;
case 'Custom':
args[0] = (function(origCommand) {
var message = options.title
? options.title + ': ' + msg
: msg;
var command = origCommand.replace(/(^|[^%])%s/g, '$1' + quote(message));
if (command === origCommand) args.push(quote(message));
return command;
})(args[0]);
break;
}
// execute
exec(args.join(' '), fn);
};
{
"name": "growl",
"version": "1.9.2",
"description": "Growl unobtrusive notifications",
"author": "TJ Holowaychuk <tj@vision-media.ca>",
"maintainers": [
"Joshua Boy Nicolai Appelman <joshua@jbnicolai.nl>"
],
"repository": {
"type": "git",
"url": "git://github.com/tj/node-growl.git"
},
"main": "./lib/growl.js",
"license": "MIT"
}
var growl = require('./lib/growl')
growl('Support sound notifications', {title: 'Make a sound', sound: 'purr'});
growl('You have mail!')
growl('5 new messages', { sticky: true })
growl('5 new emails', { title: 'Email Client', image: 'Safari', sticky: true })
growl('Message with title', { title: 'Title'})
growl('Set priority', { priority: 2 })
growl('Show Safari icon', { image: 'Safari' })
growl('Show icon', { image: 'path/to/icon.icns' })
growl('Show image', { image: 'path/to/my.image.png' })
growl('Show png filesystem icon', { image: 'png' })
growl('Show pdf filesystem icon', { image: 'article.pdf' })
growl('Show pdf filesystem icon', { image: 'article.pdf' }, function(){
console.log('callback');
})
growl('Show pdf filesystem icon', { title: 'Use show()', image: 'article.pdf' })
growl('here \' are \n some \\ characters that " need escaping', {}, function(error, stdout, stderr) {
if (error !== null) throw new Error('escaping failed:\n' + stdout + stderr);
})
growl('Allow custom notifiers', { exec: 'echo XXX %s' }, function(error, stdout, stderr) {
console.log(stdout);
})
growl('Allow custom notifiers', { title: 'test', exec: 'echo YYY' }, function(error, stdout, stderr) {
console.log(stdout);
})
growl('Allow custom notifiers', { title: 'test', exec: 'echo ZZZ %s' }, function(error, stdout, stderr) {
console.log(stdout);
})
growl('Open a URL', { url: 'https://npmjs.org/package/growl' });
This diff is collapsed.
MIT License
Copyright (c) 2014-present Sebastian McKenzie and other contributors
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# @babel/highlight
> Syntax highlight JavaScript strings for output in terminals.
See our website [@babel/highlight](https://babeljs.io/docs/en/babel-highlight) for more information.
## Install
Using npm:
```sh
npm install --save-dev @babel/highlight
```
or using yarn:
```sh
yarn add @babel/highlight --dev
```
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = highlight;
exports.getChalk = getChalk;
exports.shouldHighlight = shouldHighlight;
var _jsTokens = require("js-tokens");
var _helperValidatorIdentifier = require("@babel/helper-validator-identifier");
var _chalk = require("chalk");
const sometimesKeywords = new Set(["as", "async", "from", "get", "of", "set"]);
function getDefs(chalk) {
return {
keyword: chalk.cyan,
capitalized: chalk.yellow,
jsxIdentifier: chalk.yellow,
punctuator: chalk.yellow,
number: chalk.magenta,
string: chalk.green,
regex: chalk.magenta,
comment: chalk.grey,
invalid: chalk.white.bgRed.bold
};
}
const NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
const BRACKET = /^[()[\]{}]$/;
let tokenize;
{
const JSX_TAG = /^[a-z][\w-]*$/i;
const getTokenType = function (token, offset, text) {
if (token.type === "name") {
if ((0, _helperValidatorIdentifier.isKeyword)(token.value) || (0, _helperValidatorIdentifier.isStrictReservedWord)(token.value, true) || sometimesKeywords.has(token.value)) {
return "keyword";
}
if (JSX_TAG.test(token.value) && (text[offset - 1] === "<" || text.slice(offset - 2, offset) == "</")) {
return "jsxIdentifier";
}
if (token.value[0] !== token.value[0].toLowerCase()) {
return "capitalized";
}
}
if (token.type === "punctuator" && BRACKET.test(token.value)) {
return "bracket";
}
if (token.type === "invalid" && (token.value === "@" || token.value === "#")) {
return "punctuator";
}
return token.type;
};
tokenize = function* (text) {
let match;
while (match = _jsTokens.default.exec(text)) {
const token = _jsTokens.matchToToken(match);
yield {
type: getTokenType(token, match.index, text),
value: token.value
};
}
};
}
function highlightTokens(defs, text) {
let highlighted = "";
for (const {
type,
value
} of tokenize(text)) {
const colorize = defs[type];
if (colorize) {
highlighted += value.split(NEWLINE).map(str => colorize(str)).join("\n");
} else {
highlighted += value;
}
}
return highlighted;
}
function shouldHighlight(options) {
return !!_chalk.supportsColor || options.forceColor;
}
function getChalk(options) {
return options.forceColor ? new _chalk.constructor({
enabled: true,
level: 1
}) : _chalk;
}
function highlight(code, options = {}) {
if (code !== "" && shouldHighlight(options)) {
const chalk = getChalk(options);
const defs = getDefs(chalk);
return highlightTokens(defs, code);
} else {
return code;
}
}
\ No newline at end of file
{
"name": "@babel/highlight",
"version": "7.18.6",
"description": "Syntax highlight JavaScript strings for output in terminals.",
"author": "The Babel Team (https://babel.dev/team)",
"homepage": "https://babel.dev/docs/en/next/babel-highlight",
"license": "MIT",
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "https://github.com/babel/babel.git",
"directory": "packages/babel-highlight"
},
"main": "./lib/index.js",
"dependencies": {
"@babel/helper-validator-identifier": "^7.18.6",
"chalk": "^2.0.0",
"js-tokens": "^4.0.0"
},
"devDependencies": {
"@types/chalk": "^2.0.0",
"strip-ansi": "^4.0.0"
},
"engines": {
"node": ">=6.9.0"
},
"type": "commonjs"
}
\ No newline at end of file
......@@ -14840,7 +14840,7 @@ class StatementParser extends ExpressionParser {
}
parseDecorator() {
this.expectOnePlugin(["decorators-legacy", "decorators"]);
this.expectOnePlugin(["decorators", "decorators-legacy"]);
const node = this.startNode();
this.next();
......
This diff is collapsed.
{
"name": "@babel/parser",
"version": "7.18.6",
"version": "7.18.8",
"description": "A JavaScript parser",
"author": "The Babel Team (https://babel.dev/team)",
"homepage": "https://babel.dev/docs/en/next/babel-parser",
......
......@@ -939,7 +939,7 @@ function classAccessorProperty(key, value = null, typeAnnotation = null, decorat
});
}
function classPrivateProperty(key, value = null, decorators = null, _static) {
function classPrivateProperty(key, value = null, decorators = null, _static = false) {
return (0, _validateNode.default)({
type: "ClassPrivateProperty",
key,
......
......@@ -9,8 +9,12 @@ var _generated = require("../generated");
var _removeTypeDuplicates = require("../../modifications/typescript/removeTypeDuplicates");
var _index = require("../../validators/generated/index");
function createTSUnionType(typeAnnotations) {
const types = typeAnnotations.map(type => type.typeAnnotation);
const types = typeAnnotations.map(type => {
return (0, _index.isTSTypeAnnotation)(type) ? type.typeAnnotation : type;
});
const flattened = (0, _removeTypeDuplicates.default)(types);
if (flattened.length === 1) {
......
......@@ -278,7 +278,8 @@ defineType("ForStatement", {
}
}
});
const functionCommon = {
const functionCommon = () => ({
params: {
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Identifier", "Pattern", "RestElement")))
},
......@@ -288,9 +289,11 @@ const functionCommon = {
async: {
default: false
}
};
});
exports.functionCommon = functionCommon;
const functionTypeAnnotationCommon = {
const functionTypeAnnotationCommon = () => ({
returnType: {
validate: (0, _utils.assertNodeType)("TypeAnnotation", "TSTypeAnnotation", "Noop"),
optional: true
......@@ -299,9 +302,11 @@ const functionTypeAnnotationCommon = {
validate: (0, _utils.assertNodeType)("TypeParameterDeclaration", "TSTypeParameterDeclaration", "Noop"),
optional: true
}
};
});
exports.functionTypeAnnotationCommon = functionTypeAnnotationCommon;
const functionDeclarationCommon = Object.assign({}, functionCommon, {
const functionDeclarationCommon = () => Object.assign({}, functionCommon(), {
declare: {
validate: (0, _utils.assertValueType)("boolean"),
optional: true
......@@ -311,11 +316,12 @@ const functionDeclarationCommon = Object.assign({}, functionCommon, {
optional: true
}
});
exports.functionDeclarationCommon = functionDeclarationCommon;
defineType("FunctionDeclaration", {
builder: ["id", "params", "body", "generator", "async"],
visitor: ["id", "params", "body", "returnType", "typeParameters"],
fields: Object.assign({}, functionDeclarationCommon, functionTypeAnnotationCommon, {
fields: Object.assign({}, functionDeclarationCommon(), functionTypeAnnotationCommon(), {
body: {
validate: (0, _utils.assertNodeType)("BlockStatement")
},
......@@ -338,7 +344,7 @@ defineType("FunctionDeclaration", {
defineType("FunctionExpression", {
inherits: "FunctionDeclaration",
aliases: ["Scopable", "Function", "BlockParent", "FunctionParent", "Expression", "Pureish"],
fields: Object.assign({}, functionCommon, functionTypeAnnotationCommon, {
fields: Object.assign({}, functionCommon(), functionTypeAnnotationCommon(), {
id: {
validate: (0, _utils.assertNodeType)("Identifier"),
optional: true
......@@ -352,21 +358,24 @@ defineType("FunctionExpression", {
}
})
});
const patternLikeCommon = {
const patternLikeCommon = () => ({
typeAnnotation: {
validate: (0, _utils.assertNodeType)("TypeAnnotation", "TSTypeAnnotation", "Noop"),
optional: true
},
decorators: {
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Decorator")))
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Decorator"))),
optional: true
}
};
});
exports.patternLikeCommon = patternLikeCommon;
defineType("Identifier", {
builder: ["name"],
visitor: ["typeAnnotation", "decorators"],
aliases: ["Expression", "PatternLike", "LVal", "TSEntityName"],
fields: Object.assign({}, patternLikeCommon, {
fields: Object.assign({}, patternLikeCommon(), {
name: {
validate: (0, _utils.chain)((0, _utils.assertValueType)("string"), Object.assign(function (node, key, val) {
if (!process.env.BABEL_TYPES_8_BREAKING) return;
......@@ -587,7 +596,7 @@ defineType("ObjectExpression", {
});
defineType("ObjectMethod", {
builder: ["kind", "key", "params", "body", "computed", "generator", "async"],
fields: Object.assign({}, functionCommon, functionTypeAnnotationCommon, {
fields: Object.assign({}, functionCommon(), functionTypeAnnotationCommon(), {
kind: Object.assign({
validate: (0, _utils.assertOneOf)("method", "get", "set")
}, !process.env.BABEL_TYPES_8_BREAKING ? {
......@@ -598,7 +607,7 @@ defineType("ObjectMethod", {
},
key: {
validate: function () {
const normal = (0, _utils.assertNodeType)("Identifier", "StringLiteral", "NumericLiteral");
const normal = (0, _utils.assertNodeType)("Identifier", "StringLiteral", "NumericLiteral", "BigIntLiteral");
const computed = (0, _utils.assertNodeType)("Expression");
const validator = function (node, key, val) {
......@@ -606,7 +615,7 @@ defineType("ObjectMethod", {
validator(node, key, val);
};
validator.oneOfNodeTypes = ["Expression", "Identifier", "StringLiteral", "NumericLiteral"];
validator.oneOfNodeTypes = ["Expression", "Identifier", "StringLiteral", "NumericLiteral", "BigIntLiteral"];
return validator;
}()
},
......@@ -683,7 +692,7 @@ defineType("RestElement", {
builder: ["argument"],
aliases: ["LVal", "PatternLike"],
deprecatedAlias: "RestProperty",
fields: Object.assign({}, patternLikeCommon, {
fields: Object.assign({}, patternLikeCommon(), {
argument: {
validate: !process.env.BABEL_TYPES_8_BREAKING ? (0, _utils.assertNodeType)("LVal") : (0, _utils.assertNodeType)("Identifier", "ArrayPattern", "ObjectPattern", "MemberExpression", "TSAsExpression", "TSTypeAssertion", "TSNonNullExpression")
},
......@@ -910,7 +919,7 @@ defineType("AssignmentPattern", {
visitor: ["left", "right", "decorators"],
builder: ["left", "right"],
aliases: ["Pattern", "PatternLike", "LVal"],
fields: Object.assign({}, patternLikeCommon, {
fields: Object.assign({}, patternLikeCommon(), {
left: {
validate: (0, _utils.assertNodeType)("Identifier", "ObjectPattern", "ArrayPattern", "MemberExpression", "TSAsExpression", "TSTypeAssertion", "TSNonNullExpression")
},
......@@ -927,7 +936,7 @@ defineType("ArrayPattern", {
visitor: ["elements", "typeAnnotation"],
builder: ["elements"],
aliases: ["Pattern", "PatternLike", "LVal"],
fields: Object.assign({}, patternLikeCommon, {
fields: Object.assign({}, patternLikeCommon(), {
elements: {
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeOrValueType)("null", "PatternLike")))
},
......@@ -945,7 +954,7 @@ defineType("ArrowFunctionExpression", {
builder: ["params", "body", "async"],
visitor: ["params", "body", "returnType", "typeParameters"],
aliases: ["Scopable", "Function", "BlockParent", "FunctionParent", "Expression", "Pureish"],
fields: Object.assign({}, functionCommon, functionTypeAnnotationCommon, {
fields: Object.assign({}, functionCommon(), functionTypeAnnotationCommon(), {
expression: {
validate: (0, _utils.assertValueType)("boolean")
},
......@@ -1267,7 +1276,8 @@ defineType("MetaProperty", {
}
}
});
const classMethodOrPropertyCommon = {
const classMethodOrPropertyCommon = () => ({
abstract: {
validate: (0, _utils.assertValueType)("boolean"),
optional: true
......@@ -1297,11 +1307,13 @@ const classMethodOrPropertyCommon = {
const validator = node.computed ? computed : normal;
validator(node, key, val);
};
}(), (0, _utils.assertNodeType)("Identifier", "StringLiteral", "NumericLiteral", "Expression"))
}(), (0, _utils.assertNodeType)("Identifier", "StringLiteral", "NumericLiteral", "BigIntLiteral", "Expression"))
}
};
});
exports.classMethodOrPropertyCommon = classMethodOrPropertyCommon;
const classMethodOrDeclareMethodCommon = Object.assign({}, functionCommon, classMethodOrPropertyCommon, {
const classMethodOrDeclareMethodCommon = () => Object.assign({}, functionCommon(), classMethodOrPropertyCommon(), {
params: {
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Identifier", "Pattern", "RestElement", "TSParameterProperty")))
},
......@@ -1318,12 +1330,13 @@ const classMethodOrDeclareMethodCommon = Object.assign({}, functionCommon, class
optional: true
}
});
exports.classMethodOrDeclareMethodCommon = classMethodOrDeclareMethodCommon;
defineType("ClassMethod", {
aliases: ["Function", "Scopable", "BlockParent", "FunctionParent", "Method"],
builder: ["kind", "key", "params", "body", "computed", "static", "generator", "async"],
visitor: ["key", "params", "body", "decorators", "returnType", "typeParameters"],
fields: Object.assign({}, classMethodOrDeclareMethodCommon, functionTypeAnnotationCommon, {
fields: Object.assign({}, classMethodOrDeclareMethodCommon(), functionTypeAnnotationCommon(), {
body: {
validate: (0, _utils.assertNodeType)("BlockStatement")
}
......@@ -1333,7 +1346,7 @@ defineType("ObjectPattern", {
visitor: ["properties", "typeAnnotation", "decorators"],
builder: ["properties"],
aliases: ["Pattern", "PatternLike", "LVal"],
fields: Object.assign({}, patternLikeCommon, {
fields: Object.assign({}, patternLikeCommon(), {
properties: {
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("RestElement", "ObjectProperty")))
}
......@@ -1515,7 +1528,7 @@ defineType("ClassProperty", {
visitor: ["key", "value", "typeAnnotation", "decorators"],
builder: ["key", "value", "typeAnnotation", "decorators", "computed", "static"],
aliases: ["Property"],
fields: Object.assign({}, classMethodOrPropertyCommon, {
fields: Object.assign({}, classMethodOrPropertyCommon(), {
value: {
validate: (0, _utils.assertNodeType)("Expression"),
optional: true
......@@ -1550,16 +1563,16 @@ defineType("ClassAccessorProperty", {
visitor: ["key", "value", "typeAnnotation", "decorators"],
builder: ["key", "value", "typeAnnotation", "decorators", "computed", "static"],
aliases: ["Property", "Accessor"],
fields: Object.assign({}, classMethodOrPropertyCommon, {
fields: Object.assign({}, classMethodOrPropertyCommon(), {
key: {
validate: (0, _utils.chain)(function () {
const normal = (0, _utils.assertNodeType)("Identifier", "StringLiteral", "NumericLiteral", "PrivateName");
const normal = (0, _utils.assertNodeType)("Identifier", "StringLiteral", "NumericLiteral", "BigIntLiteral", "PrivateName");
const computed = (0, _utils.assertNodeType)("Expression");
return function (node, key, val) {
const validator = node.computed ? computed : normal;
validator(node, key, val);
};
}(), (0, _utils.assertNodeType)("Identifier", "StringLiteral", "NumericLiteral", "Expression", "PrivateName"))
}(), (0, _utils.assertNodeType)("Identifier", "StringLiteral", "NumericLiteral", "BigIntLiteral", "Expression", "PrivateName"))
},
value: {
validate: (0, _utils.assertNodeType)("Expression"),
......@@ -1611,6 +1624,10 @@ defineType("ClassPrivateProperty", {
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Decorator"))),
optional: true
},
static: {
validate: (0, _utils.assertValueType)("boolean"),
default: false
},
readonly: {
validate: (0, _utils.assertValueType)("boolean"),
optional: true
......@@ -1629,7 +1646,11 @@ defineType("ClassPrivateMethod", {
builder: ["kind", "key", "params", "body", "static"],
visitor: ["key", "params", "body", "decorators", "returnType", "typeParameters"],
aliases: ["Function", "Scopable", "BlockParent", "FunctionParent", "Method", "Private"],
fields: Object.assign({}, classMethodOrDeclareMethodCommon, functionTypeAnnotationCommon, {
fields: Object.assign({}, classMethodOrDeclareMethodCommon(), functionTypeAnnotationCommon(), {
kind: {
validate: (0, _utils.assertOneOf)("get", "set", "method"),
default: "method"
},
key: {
validate: (0, _utils.assertNodeType)("PrivateName")
},
......
......@@ -8,7 +8,8 @@ var _is = require("../validators/is");
const defineType = (0, _utils.defineAliasedType)("TypeScript");
const bool = (0, _utils.assertValueType)("boolean");
const tSFunctionTypeAnnotationCommon = {
const tSFunctionTypeAnnotationCommon = () => ({
returnType: {
validate: (0, _utils.assertNodeType)("TSTypeAnnotation", "Noop"),
optional: true
......@@ -17,7 +18,8 @@ const tSFunctionTypeAnnotationCommon = {
validate: (0, _utils.assertNodeType)("TSTypeParameterDeclaration", "Noop"),
optional: true
}
};
});
defineType("TSParameterProperty", {
aliases: ["LVal"],
visitor: ["parameter"],
......@@ -46,11 +48,11 @@ defineType("TSParameterProperty", {
defineType("TSDeclareFunction", {
aliases: ["Statement", "Declaration"],
visitor: ["id", "typeParameters", "params", "returnType"],
fields: Object.assign({}, _core.functionDeclarationCommon, tSFunctionTypeAnnotationCommon)
fields: Object.assign({}, (0, _core.functionDeclarationCommon)(), tSFunctionTypeAnnotationCommon())
});
defineType("TSDeclareMethod", {
visitor: ["decorators", "key", "typeParameters", "params", "returnType"],
fields: Object.assign({}, _core.classMethodOrDeclareMethodCommon, tSFunctionTypeAnnotationCommon)
fields: Object.assign({}, (0, _core.classMethodOrDeclareMethodCommon)(), tSFunctionTypeAnnotationCommon())
});
defineType("TSQualifiedName", {
aliases: ["TSEntityName"],
......@@ -60,27 +62,33 @@ defineType("TSQualifiedName", {
right: (0, _utils.validateType)("Identifier")
}
});
const signatureDeclarationCommon = {
const signatureDeclarationCommon = () => ({
typeParameters: (0, _utils.validateOptionalType)("TSTypeParameterDeclaration"),
["parameters"]: (0, _utils.validateArrayOfType)(["Identifier", "RestElement"]),
["typeAnnotation"]: (0, _utils.validateOptionalType)("TSTypeAnnotation")
};
});
const callConstructSignatureDeclaration = {
aliases: ["TSTypeElement"],
visitor: ["typeParameters", "parameters", "typeAnnotation"],
fields: signatureDeclarationCommon
fields: signatureDeclarationCommon()
};
defineType("TSCallSignatureDeclaration", callConstructSignatureDeclaration);
defineType("TSConstructSignatureDeclaration", callConstructSignatureDeclaration);
const namedTypeElementCommon = {
const namedTypeElementCommon = () => ({
key: (0, _utils.validateType)("Expression"),
computed: (0, _utils.validate)(bool),
computed: {
default: false
},
optional: (0, _utils.validateOptional)(bool)
};
});
defineType("TSPropertySignature", {
aliases: ["TSTypeElement"],
visitor: ["key", "typeAnnotation", "initializer"],
fields: Object.assign({}, namedTypeElementCommon, {
fields: Object.assign({}, namedTypeElementCommon(), {
readonly: (0, _utils.validateOptional)(bool),
typeAnnotation: (0, _utils.validateOptionalType)("TSTypeAnnotation"),
initializer: (0, _utils.validateOptionalType)("Expression"),
......@@ -92,7 +100,7 @@ defineType("TSPropertySignature", {
defineType("TSMethodSignature", {
aliases: ["TSTypeElement"],
visitor: ["key", "typeParameters", "parameters", "typeAnnotation"],
fields: Object.assign({}, signatureDeclarationCommon, namedTypeElementCommon, {
fields: Object.assign({}, signatureDeclarationCommon(), namedTypeElementCommon(), {
kind: {
validate: (0, _utils.assertOneOf)("method", "get", "set")
}
......@@ -128,10 +136,10 @@ const fnOrCtrBase = {
visitor: ["typeParameters", "parameters", "typeAnnotation"]
};
defineType("TSFunctionType", Object.assign({}, fnOrCtrBase, {
fields: signatureDeclarationCommon
fields: signatureDeclarationCommon()
}));
defineType("TSConstructorType", Object.assign({}, fnOrCtrBase, {
fields: Object.assign({}, signatureDeclarationCommon, {
fields: Object.assign({}, signatureDeclarationCommon(), {
abstract: (0, _utils.validateOptional)(bool)
})
}));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment