├── .gitignore
├── .no-sublime-package
├── Default.sublime-keymap
├── JavaScript.sublime-commands
├── JavaScript.sublime-settings
├── Original_README.md
├── README.md
├── dev_bundle
├── darwin
│ └── node
├── linux
│ └── node
└── windows
│ └── node.exe
├── img
├── demo.gif
├── demo2.gif
├── demo3.gif
└── demo4.gif
├── node_modules
├── .bin
│ └── tern
└── tern
│ ├── .jshintrc
│ ├── .no-sublime-package
│ ├── .npmignore
│ ├── .tern-project
│ ├── .travis.yml
│ ├── AUTHORS
│ ├── LICENSE
│ ├── README.md
│ ├── bin
│ ├── condense
│ ├── from_ts
│ ├── tern
│ ├── test
│ └── update_authors.sh
│ ├── defs
│ ├── browser.json
│ ├── chai.json
│ ├── ecma5.json
│ ├── ecma6.json
│ ├── jquery.json
│ └── underscore.json
│ ├── doc
│ ├── BACKERS.txt
│ ├── Makefile
│ ├── demo.html
│ ├── demo
│ │ ├── demo.css
│ │ ├── demo.js
│ │ ├── polyfill.js
│ │ └── underscore.js
│ ├── docs.css
│ ├── header.svg
│ ├── logo.png
│ ├── manual.html
│ └── src
│ │ ├── asciidoc.conf
│ │ └── manual.txt
│ ├── emacs
│ ├── tern-auto-complete.el
│ └── tern.el
│ ├── index.html
│ ├── lib
│ ├── comment.js
│ ├── condense.js
│ ├── def.js
│ ├── infer.js
│ ├── signal.js
│ ├── tern.js
│ └── typescript.js
│ ├── node_modules
│ ├── .bin
│ │ ├── acorn
│ │ └── tsc
│ ├── acorn
│ │ ├── .editorconfig
│ │ ├── .gitattributes
│ │ ├── .npmignore
│ │ ├── .tern-project
│ │ ├── .travis.yml
│ │ ├── AUTHORS
│ │ ├── LICENSE
│ │ ├── README.md
│ │ ├── acorn.js
│ │ ├── acorn_csp.js
│ │ ├── acorn_loose.js
│ │ ├── bin
│ │ │ ├── acorn
│ │ │ ├── update_authors.sh
│ │ │ └── without_eval
│ │ ├── docco.css
│ │ ├── package.json
│ │ ├── tools
│ │ │ └── generate-identifier-regex.js
│ │ └── util
│ │ │ └── walk.js
│ ├── glob
│ │ ├── .npmignore
│ │ ├── .travis.yml
│ │ ├── LICENSE
│ │ ├── README.md
│ │ ├── examples
│ │ │ ├── g.js
│ │ │ └── usr-local.js
│ │ ├── glob.js
│ │ ├── node_modules
│ │ │ ├── inherits
│ │ │ │ ├── LICENSE
│ │ │ │ ├── README.md
│ │ │ │ ├── inherits.js
│ │ │ │ ├── inherits_browser.js
│ │ │ │ ├── package.json
│ │ │ │ └── test.js
│ │ │ └── minimatch
│ │ │ │ ├── .npmignore
│ │ │ │ ├── LICENSE
│ │ │ │ ├── README.md
│ │ │ │ ├── minimatch.js
│ │ │ │ ├── node_modules
│ │ │ │ ├── lru-cache
│ │ │ │ │ ├── .npmignore
│ │ │ │ │ ├── CONTRIBUTORS
│ │ │ │ │ ├── LICENSE
│ │ │ │ │ ├── README.md
│ │ │ │ │ ├── lib
│ │ │ │ │ │ └── lru-cache.js
│ │ │ │ │ ├── package.json
│ │ │ │ │ └── test
│ │ │ │ │ │ ├── basic.js
│ │ │ │ │ │ ├── foreach.js
│ │ │ │ │ │ └── memory-leak.js
│ │ │ │ └── sigmund
│ │ │ │ │ ├── LICENSE
│ │ │ │ │ ├── README.md
│ │ │ │ │ ├── bench.js
│ │ │ │ │ ├── package.json
│ │ │ │ │ ├── sigmund.js
│ │ │ │ │ └── test
│ │ │ │ │ └── basic.js
│ │ │ │ ├── package.json
│ │ │ │ └── test
│ │ │ │ ├── basic.js
│ │ │ │ ├── brace-expand.js
│ │ │ │ ├── caching.js
│ │ │ │ ├── defaults.js
│ │ │ │ └── extglob-ending-with-state-char.js
│ │ ├── package.json
│ │ └── test
│ │ │ ├── 00-setup.js
│ │ │ ├── bash-comparison.js
│ │ │ ├── bash-results.json
│ │ │ ├── cwd-test.js
│ │ │ ├── globstar-match.js
│ │ │ ├── mark.js
│ │ │ ├── new-glob-optional-options.js
│ │ │ ├── nocase-nomagic.js
│ │ │ ├── pause-resume.js
│ │ │ ├── readme-issue.js
│ │ │ ├── root-nomount.js
│ │ │ ├── root.js
│ │ │ ├── stat.js
│ │ │ └── zz-cleanup.js
│ ├── minimatch
│ │ ├── .npmignore
│ │ ├── LICENSE
│ │ ├── README.md
│ │ ├── minimatch.js
│ │ ├── node_modules
│ │ │ ├── lru-cache
│ │ │ │ ├── .npmignore
│ │ │ │ ├── CONTRIBUTORS
│ │ │ │ ├── LICENSE
│ │ │ │ ├── README.md
│ │ │ │ ├── lib
│ │ │ │ │ └── lru-cache.js
│ │ │ │ ├── package.json
│ │ │ │ └── test
│ │ │ │ │ ├── basic.js
│ │ │ │ │ ├── foreach.js
│ │ │ │ │ └── memory-leak.js
│ │ │ └── sigmund
│ │ │ │ ├── LICENSE
│ │ │ │ ├── README.md
│ │ │ │ ├── bench.js
│ │ │ │ ├── package.json
│ │ │ │ ├── sigmund.js
│ │ │ │ └── test
│ │ │ │ └── basic.js
│ │ ├── package.json
│ │ └── test
│ │ │ ├── basic.js
│ │ │ ├── brace-expand.js
│ │ │ ├── caching.js
│ │ │ ├── defaults.js
│ │ │ └── extglob-ending-with-state-char.js
│ └── typescript
│ │ ├── .npmignore
│ │ ├── CopyrightNotice.txt
│ │ ├── LICENSE.txt
│ │ ├── README.txt
│ │ ├── ThirdPartyNoticeText.txt
│ │ ├── bin
│ │ ├── lib.d.ts
│ │ ├── resources
│ │ │ ├── cs
│ │ │ │ ├── cz
│ │ │ │ │ └── diagnosticMessages.generated.json
│ │ │ │ └── diagnosticMessages.generated.json
│ │ │ ├── cz
│ │ │ │ └── diagnosticMessages.generated.json
│ │ │ ├── de
│ │ │ │ └── diagnosticMessages.generated.json
│ │ │ ├── diagnosticMessages.generated.json
│ │ │ ├── en
│ │ │ │ ├── diagnosticMessages.generated.json
│ │ │ │ └── us
│ │ │ │ │ └── diagnosticMessages.generated.json
│ │ │ ├── es
│ │ │ │ └── diagnosticMessages.generated.json
│ │ │ ├── fr
│ │ │ │ └── diagnosticMessages.generated.json
│ │ │ ├── it
│ │ │ │ └── diagnosticMessages.generated.json
│ │ │ ├── ja
│ │ │ │ ├── diagnosticMessages.generated.json
│ │ │ │ └── jp
│ │ │ │ │ └── diagnosticMessages.generated.json
│ │ │ ├── ko
│ │ │ │ ├── diagnosticMessages.generated.json
│ │ │ │ └── kr
│ │ │ │ │ └── diagnosticMessages.generated.json
│ │ │ ├── pl
│ │ │ │ └── diagnosticMessages.generated.json
│ │ │ ├── pt
│ │ │ │ ├── br
│ │ │ │ │ └── diagnosticMessages.generated.json
│ │ │ │ └── diagnosticMessages.generated.json
│ │ │ ├── ru
│ │ │ │ └── diagnosticMessages.generated.json
│ │ │ ├── tr
│ │ │ │ └── diagnosticMessages.generated.json
│ │ │ └── zh
│ │ │ │ ├── cn
│ │ │ │ └── diagnosticMessages.generated.json
│ │ │ │ └── tw
│ │ │ │ └── diagnosticMessages.generated.json
│ │ ├── tsc
│ │ ├── tsc.js
│ │ └── typescript.js
│ │ └── package.json
│ ├── package.json
│ ├── plugin
│ ├── angular.js
│ ├── complete_strings.js
│ ├── component.js
│ ├── doc_comment.js
│ ├── meteor.js
│ ├── node.js
│ └── requirejs.js
│ └── test
│ ├── cases
│ ├── angular
│ │ ├── config.js
│ │ ├── filters.js
│ │ └── main.js
│ ├── angular_service.js
│ ├── arguments.js
│ ├── autothis.js
│ ├── blowup.js
│ ├── browser.js
│ ├── builtins.js
│ ├── catch_error.js
│ ├── cautiouspropagation.js
│ ├── complete_strings.js
│ ├── component
│ │ ├── component.json
│ │ ├── components
│ │ │ └── marijnh-tern
│ │ │ │ ├── component.json
│ │ │ │ └── index.js
│ │ ├── localfile.js
│ │ └── main.js
│ ├── computedprop.js
│ ├── contextcomplete.js
│ ├── copyprops.js
│ ├── ctorpattern.js
│ ├── def_type_string.js
│ ├── defineProperty.js
│ ├── defs
│ │ ├── span.json
│ │ └── string.json
│ ├── docstrings.js
│ ├── effects.js
│ ├── extends.js
│ ├── finddef.js
│ ├── findref.js
│ ├── fn_arguments.js
│ ├── generic_each.js
│ ├── getter.js
│ ├── global_this.js
│ ├── hint-objlit.js
│ ├── hint_browser.js
│ ├── hint_ecma5.js
│ ├── hint_simple.js
│ ├── in_comment.js
│ ├── indirect_class.js
│ ├── infinite-expansion.js
│ ├── jquery_event.js
│ ├── jsdoc.js
│ ├── merge.js
│ ├── new_array.js
│ ├── new_to_prototype.js
│ ├── node
│ │ ├── binary.node
│ │ ├── dir
│ │ │ ├── index.js
│ │ │ └── lib
│ │ │ │ ├── other.js
│ │ │ │ └── relative.js
│ │ ├── exportfunc.js
│ │ ├── localfile.js
│ │ └── main.js
│ ├── node_exports.js
│ ├── node_modules
│ │ ├── mod1
│ │ │ ├── a.js
│ │ │ ├── dir1
│ │ │ │ └── index.js
│ │ │ ├── doc.js
│ │ │ ├── mainfile.js
│ │ │ ├── node_modules
│ │ │ │ └── subdep1
│ │ │ │ │ ├── package.json
│ │ │ │ │ └── subdep1.js
│ │ │ ├── package.json
│ │ │ ├── reassign_exports.js
│ │ │ ├── reassign_exports_to_required.js
│ │ │ └── secondfile.js
│ │ └── mymod.json
│ ├── node_origin_paths.js
│ ├── object_create.js
│ ├── objnames.js
│ ├── order_of_definition.js
│ ├── plus.js
│ ├── promise.js
│ ├── proto.js
│ ├── protoname.js
│ ├── replace_bogus_prop.js
│ ├── requirejs
│ │ ├── bar.js
│ │ ├── baz.js
│ │ ├── foo.js
│ │ ├── func.js
│ │ ├── main.js
│ │ ├── module_exports.js
│ │ ├── named.js
│ │ ├── requireme.js
│ │ ├── simplifiedcommon.js
│ │ ├── subdir
│ │ │ └── zap.js
│ │ └── useexports.js
│ ├── requirejs_config
│ │ └── main.js
│ ├── simple.js
│ ├── simple_generic.js
│ ├── span_from_def.js
│ └── underscore.js
│ ├── condense.js
│ ├── condense
│ ├── add_to_old.js
│ ├── add_to_old.json
│ ├── angular_simple.js
│ ├── angular_simple.json
│ ├── array.js
│ ├── array.json
│ ├── basic.js
│ ├── basic.json
│ ├── double_ref.js
│ ├── double_ref.json
│ ├── extend_foo.js
│ ├── fn.js
│ ├── fn.json
│ ├── function_prop.js
│ ├── function_prop.json
│ ├── generic.js
│ ├── generic.json
│ ├── ignore_newer.js
│ ├── ignore_newer.json
│ ├── node_export_function_a.js
│ ├── node_fn_export.js
│ ├── node_fn_export.json
│ ├── node_other_module_type_ref.js
│ ├── node_other_module_type_ref.json
│ ├── node_require_private.js
│ ├── node_require_private.json
│ ├── node_simple.js
│ ├── node_simple.json
│ ├── proto.js
│ ├── proto.json
│ ├── recursive.js
│ ├── recursive.json
│ ├── ref_in_type.js
│ ├── ref_in_type.json
│ ├── ref_to_old.js
│ ├── ref_to_old.json
│ ├── requirejs_const.js
│ ├── requirejs_const.json
│ ├── requirejs_dep.js
│ ├── requirejs_dep.json
│ ├── requirejs_empty_deps.js
│ ├── requirejs_empty_deps.json
│ ├── requirejs_primitive.js
│ ├── requirejs_primitive.json
│ ├── requirejs_setup.js
│ ├── requirejs_setup.json
│ ├── uniontype.js
│ └── uniontype.json
│ ├── data
│ └── large.js
│ ├── fragments.js
│ ├── reload.js
│ ├── runcases.js
│ ├── timeout.js
│ └── util.js
├── package.json
└── tern.py
/.gitignore:
--------------------------------------------------------------------------------
1 | lib-cov
2 | *.seed
3 | *.log
4 | *.csv
5 | *.dat
6 | *.out
7 | *.pid
8 | *.gz
9 |
10 | pids
11 | logs
12 | results
13 |
14 | npm-debug.log
15 |
--------------------------------------------------------------------------------
/.no-sublime-package:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Slava/tern-meteor-sublime/38b97309957d336854941a1a988519ea4b10aec9/.no-sublime-package
--------------------------------------------------------------------------------
/Default.sublime-keymap:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "keys": ["alt+."],
4 | "command": "tern_jump_to_def",
5 | "context": [
6 | {"key": "selector", "operand": "source.js"}
7 | ]
8 | },
9 | {
10 | "keys": ["alt+,"],
11 | "command": "tern_jump_back",
12 | "context": [
13 | {"key": "selector", "operand": "source.js"}
14 | ]
15 | },
16 | {
17 | "keys": ["alt+space"],
18 | "command": "tern_select_variable",
19 | "context": [
20 | {"key": "selector", "operand": "source.js"}
21 | ]
22 | }
23 | ]
24 |
--------------------------------------------------------------------------------
/JavaScript.sublime-commands:
--------------------------------------------------------------------------------
1 | [
2 | { "caption": "TernJS: Jump To Definition", "command": "tern_jump_to_def", "args": {} },
3 | { "caption": "TernJS: Show Documentation For Selection", "command": "tern_show_documentation", "args": {} },
4 | { "caption": "TernJS: Get Type For Selection", "command": "tern_show_type", "args": {} },
5 | { "caption": "TernJS: Select Variable locally", "command": "tern_select_variable", "args": {} }
6 | ]
7 |
--------------------------------------------------------------------------------
/JavaScript.sublime-settings:
--------------------------------------------------------------------------------
1 | {
2 | // Characters that are considered to separate words
3 | "word_separators": "./\\()\"'-:,.;<>~!@#%^&*|+=[]{}`~?"
4 | }
--------------------------------------------------------------------------------
/Original_README.md:
--------------------------------------------------------------------------------
1 | # Tern for Sublime Text
2 |
3 | This is a [Sublime Text][st] (version 2 and 3) package that provides
4 | [Tern][tern]-based JavaScript editing support.
5 |
6 | [st]: http://www.sublimetext.com/
7 | [tern]: http://ternjs.net
8 |
9 | In JavaScript files, the package will handle autocompletion.
10 |
11 | The following keys will be found (in JavaScript files):
12 |
13 | `alt+.`
14 | Jump to the definition of the thing that the cursor is pointing at. If
15 | there is no known code location, but it has a documentation URL
16 | associated with, this will open the documentation in your browser
17 | instead.
18 |
19 | `alt+,`
20 | Jump back to where you were when executing the previous `alt+.` command.
21 |
22 | `alt+space`
23 | When on a variable, select all references to that variable in the
24 | current file.
25 |
26 | ## Installation
27 |
28 | Check out the code in this repository into a subdirectory of your
29 | Sublime Text's `Packages` directory.
30 |
31 | cd /path/to/sublime-text-N/Packages
32 | git clone git://github.com/marijnh/tern_for_sublime.git
33 |
34 | Next, make sure [node.js][node] and [npm][npm] are installed (Tern is
35 | a JavaScript program), and install the depedencies of the package.
36 |
37 | [node]: http://nodejs.org
38 | [npm]: https://npmjs.org/
39 |
40 | cd tern_for_sublime
41 | npm install
42 |
43 | You should be all set now.
44 |
45 | ## Configuration
46 |
47 | The plugin will load its settings from `Preferences.sublime-settings`,
48 | and recognized the following settings:
49 |
50 | `tern_argument_hints` (boolean, defaults to false)
51 | Whether to show argument hints (May impact responsiveness on slow machines or big projects).
52 |
53 | `tern_argument_hints_type` (status, panel, tooltip, defaults to tooltip when available, otherwise status)
54 | __status__ - When status is enabled, the status bar will list
55 | the arguments for the function call that the cursor is inside.
56 | Unfortunately, the status bar is tiny and Sublime Text 2 provides no saner way to show these hints.
57 | __panel__ - When panel is enabled, a new panel window opens and will list
58 | the arguments for the function call that the cursor is inside.
59 | __tooltip__ - (only available on SublimeText build 3070+) When tooltip is enabled, a tooltip opens and will list the arguments for the function call that the cursor is inside, as well as, a clickable URL (if available) to the docs and a snippet of documentation (if available).
60 |
61 |
62 | `tern_command` (list of strings) The command to execute to start a
63 | Tern server. The default is
64 | `["node", "/path/to/Packages/tern_for_sublime/node_modules/tern/bin/tern"]`.
65 | If your node installation lives somewhere that's not in the default
66 | path, or your Tern checkout is not where the module expects it to be,
67 | you'll want to manually set this option.
68 |
69 | `tern_arguments` (list of strings) An extra set of arguments to pass
70 | to the Tern server. For example `--no-port-file` to suppress the
71 | creation of `.tern-port` files.
72 |
73 | Tern uses `.tern-project` files to configure loading libraries and
74 | plugins for a project. See the [Tern docs][docs] for details.
75 |
76 | [docs]: http://ternjs.net/doc/manual.html#configuration
77 |
78 | ### Automatically Showing Completions
79 |
80 | Add `{"selector": "source.js", "characters": "."}` to your
81 | `auto_complete_triggers` array in the Sublime Text preferences to
82 | automatically show completions after a dot is typed following an
83 | object name.
84 |
85 | Example:
86 | ```javascript
87 | "auto_complete_triggers": [ {"selector": "text.html", "characters": "<"}, {"selector": "source.js", "characters": "."} ]
88 | ```
89 |
90 | Ensure that your `auto_complete` preference is set to `true`. It's enabled by default.
91 |
92 | ## Alternative package
93 |
94 | There exists also [Sublime Tern][stern], a package with similar goals
95 | (Tern integration for ST). It exposes a slightly different set of
96 | functionality, and uses the PyV8 bridge, rather than node.js, to run
97 | the Tern server.
98 |
99 | [stern]: https://github.com/emmetio/sublime-tern
100 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Tern.js Meteor for Sublime Text 3
2 |
3 | 
4 |
5 | This is a repository with a package for the Sublime Text 3 editor. By running a
6 | customized version of Tern.js, this package provides an autocompletion option
7 | for developing Meteor applications in JavaScript.
8 |
9 | Interested in this for a different editor? Check out [this project](https://github.com/slava/tern-meteor).
10 |
11 | This package is a fork of the [original `tern_for_sublime`
12 | package](https://github.com/marijnh/tern_for_sublime). You can find the original
13 | README in this repository as [Original_README.md](./Original_README.md).
14 |
15 | ## Installation
16 |
17 | There are two parts to the installation. First, let your Sublime Text 3 know to
18 | autocomplete words on the dot character (`.`):
19 |
20 | 1. Open Sublime Text 3
21 | 2. Open "Preferences", "Settings - User"
22 | 3. Add a line to your JSON (inside the main object):
23 | `, "auto_complete_triggers": [ { "characters": "<", "selector": "text.html" }, { "characters": ".", "selector": "source.js" } ]`
24 |
25 | The second part is to install the package itself. The automatic way is to
26 | install it from the Package Control.
27 |
28 | 1. Install the Package Control from
29 | 2. Install this package by running "Cmd/Ctrl + Shift + P" -> "Install Package" -> "Meteor Autocomplete (TernJS)"
30 |
31 | The manual way is to clone this repo in your Sublime Text 3 editor's "Packages"
32 | folder. See [this handy page by
33 | floobits](https://floobits.com/help/plugins/sublime) to learn more.
34 |
35 | Restart your Sublime Text 3 editor.
36 |
37 | ## Usage
38 |
39 | ### Autocompletion
40 |
41 | This package searches your source tree for the folder called ".meteor" or a "package.js" file.
42 | Once it is found, the package considers its parent to be the root of your Meteor
43 | project or package.
44 |
45 | In addition to the default Meteor symbols generated out of the documentation,
46 | you get the autocompetion between files and packages. This package is not smart
47 | enough to understand the packages dependencies, but it can distinguish local
48 | files scope as well as the global scope.
49 |
50 | ### Jump to definition
51 |
52 | Put your cursor on a symbol and press the `alt+.` combination to jump to the
53 | symbol definition. You can jump back to where you started by pressing the
54 | `alt+,` combination.
55 |
56 | Alternatively, you can select the "TernJS: Jump To Definition" item from the
57 | command palette.
58 |
59 | ### Look up type of selection
60 |
61 | 
62 |
63 | Put your blinking cursor on a symbol or select an expression and run "TernJS:
64 | Show Type For Selection" from the command palette.
65 |
66 | ### Look up documentation of selection
67 |
68 | Similarly, you can get an API documentation excerpt and a link to the docs if
69 | you run "TernJS: Show Documentation For Selection" from the command palette.
70 |
71 | By default, this plugin provides docs for Meteor APIs, as well as APIs for
72 | node.js, jQuery, and browser/ES5,6 features.
73 |
74 | ### Jump to the Template declaration file
75 |
76 | You can find the `.html` Template file just by looking at its JavaScript
77 | reference. You can call the same "TernJS: Jump To Definition" command or press
78 | `alt+.`.
79 |
80 | 
81 |
82 | ### Using Meteor Packages from Atmosphere
83 |
84 | This plugin will find and analyze all 3rd party packages your app uses if you
85 | run your app with the `meteor` command at least once. Every time you update your
86 | used packages, you would need to trigger the re-reading of the
87 | `.meteor/versions` file (either by restarting the Tern server or restarting
88 | Sublime or editing and saving the versions file).
89 |
90 | 
91 |
92 | ## Using Meteor with Sublime? Here is more!
93 |
94 | Here is a list of recommended Sublime Text packages by other authors you might want to install.
95 |
96 | - Gitignored File Excluder - ignores lots and lots of build files from your search queries
97 |
98 |
99 | ## Background
100 |
101 | - https://www.youtube.com/watch?v=OxzdNZCxPjk
102 | - https://www.youtube.com/watch?v=CcPZ56t8x4I
103 |
--------------------------------------------------------------------------------
/dev_bundle/darwin/node:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Slava/tern-meteor-sublime/38b97309957d336854941a1a988519ea4b10aec9/dev_bundle/darwin/node
--------------------------------------------------------------------------------
/dev_bundle/linux/node:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Slava/tern-meteor-sublime/38b97309957d336854941a1a988519ea4b10aec9/dev_bundle/linux/node
--------------------------------------------------------------------------------
/dev_bundle/windows/node.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Slava/tern-meteor-sublime/38b97309957d336854941a1a988519ea4b10aec9/dev_bundle/windows/node.exe
--------------------------------------------------------------------------------
/img/demo.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Slava/tern-meteor-sublime/38b97309957d336854941a1a988519ea4b10aec9/img/demo.gif
--------------------------------------------------------------------------------
/img/demo2.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Slava/tern-meteor-sublime/38b97309957d336854941a1a988519ea4b10aec9/img/demo2.gif
--------------------------------------------------------------------------------
/img/demo3.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Slava/tern-meteor-sublime/38b97309957d336854941a1a988519ea4b10aec9/img/demo3.gif
--------------------------------------------------------------------------------
/img/demo4.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Slava/tern-meteor-sublime/38b97309957d336854941a1a988519ea4b10aec9/img/demo4.gif
--------------------------------------------------------------------------------
/node_modules/.bin/tern:
--------------------------------------------------------------------------------
1 | ../tern/bin/tern
--------------------------------------------------------------------------------
/node_modules/tern/.jshintrc:
--------------------------------------------------------------------------------
1 | {
2 | "sub" : true,
3 | "boss" : true,
4 | "expr" : true,
5 | "node" : true,
6 | "devel" : true,
7 | "curly" : false,
8 | "immed" : true,
9 | "noarg" : true,
10 | "undef" : true,
11 | "newcap" : true,
12 | "shadow" : true,
13 | "newcap" : false,
14 | "eqnull" : true,
15 | "jquery" : true,
16 | "eqeqeq" : false,
17 | "browser" : true,
18 | "latedef" : false,
19 | "supernew" : true,
20 | "laxcomma" : false,
21 | "laxbreak" : true,
22 | "lastsemic": true,
23 | "globals" : {"tern": true, "acorn": true, "define": true},
24 | "loopfunc" : true
25 | }
--------------------------------------------------------------------------------
/node_modules/tern/.no-sublime-package:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/node_modules/tern/.npmignore:
--------------------------------------------------------------------------------
1 | .tern-port
2 | /node_modules
3 | /misc
4 | *.elc
5 | *.pyc
6 |
7 | .DS_Store
--------------------------------------------------------------------------------
/node_modules/tern/.tern-project:
--------------------------------------------------------------------------------
1 | {
2 | "libs": [
3 | ],
4 | "plugins": {
5 | "node": {},
6 | "complete_strings": {}
7 | }
8 | }
--------------------------------------------------------------------------------
/node_modules/tern/.travis.yml:
--------------------------------------------------------------------------------
1 | language: node_js
2 | node_js:
3 | - "0.10"
4 |
--------------------------------------------------------------------------------
/node_modules/tern/AUTHORS:
--------------------------------------------------------------------------------
1 | List of Tern contributors. Updated before every release.
2 |
3 | Adam Faulkner
4 | Anders Thøgersen
5 | angelozerr
6 | Ben McCormick
7 | Brian Frichette
8 | Claus Reinke
9 | Damien Diederen
10 | Dewdrops
11 | dloverin
12 | Dmitry Gutov
13 | Erik Tierney
14 | Forbes Lindesay
15 | Francisc Romano
16 | Hans Huebner
17 | Hiroaki Otsu
18 | Jeffrey Fisher
19 | Josh Giles
20 | jzhang
21 | katspaugh
22 | Marijn Haverbeke
23 | Matthias Dahl
24 | MetaMemoryT
25 | Michael Russell
26 | Michał Grzejszczak
27 | Miguel Castillo
28 | Mihai Bazon
29 | Miroslav Bajtoš
30 | Mounir Lamouri
31 | Nate Eagleson
32 | Nick Malaguti
33 | Nicolas Petton
34 | Nico Weber
35 | othree
36 | Paul Bakker
37 | Paul Verest
38 | Peter Farland
39 | Quinn Slack
40 | Randy Edmunds
41 | Reuben Thomas
42 | Ryan Stewart
43 | SAKURAI Masashi
44 | Sean Usick
45 | Sergey Chikuyonok
46 | Sérgio Ramos
47 | sevin7676
48 | Sindre Sorhus
49 | Stephan Seidt
50 | Steve Purcell
51 | stoskov
52 | Tim M. Madsen
53 | vheon
54 |
--------------------------------------------------------------------------------
/node_modules/tern/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (C) 2013 by Marijn Haverbeke and others
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy
4 | of this software and associated documentation files (the "Software"), to deal
5 | in the Software without restriction, including without limitation the rights
6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | copies of the Software, and to permit persons to whom the Software is
8 | furnished to do so, subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in
11 | all copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | THE SOFTWARE.
20 |
--------------------------------------------------------------------------------
/node_modules/tern/README.md:
--------------------------------------------------------------------------------
1 | # Tern
2 |
3 | [](http://travis-ci.org/marijnh/tern)
4 | [](https://www.npmjs.org/package/tern)
5 | [Funding status: ](https://marijnhaverbeke.nl/fund/)
6 |
7 | This is [Tern][1]. Tern is a stand-alone, editor-independent
8 | JavaScript analyzer that can be used to improve the JavaScript
9 | integration of existing editors.
10 |
11 | Thanks to a group of generous [crowd funders][2], Tern is open-source
12 | software, under an MIT license.
13 |
14 | There are currently plugins available for [Emacs][emacs] (and Emacs
15 | [company-mode][cmode]), [Vim][vim], [Sublime Text][st], [Eclipse (and general Java API)][ec],
16 | [Light Table][lt], and [gedit][gedit], and built-in support in
17 | [Brackets][brackets] and [Edge Code][edge_code].
18 |
19 | For further documentation, see the [project page][1] and the
20 | [manual][3].
21 |
22 | [1]: http://ternjs.net
23 | [2]: http://www.indiegogo.com/projects/tern-intelligent-javascript-editing
24 | [3]: http://ternjs.net/doc/manual.html
25 |
26 | [emacs]: http://ternjs.net/doc/manual.html#emacs
27 | [ec]: https://github.com/angelozerr/tern.java
28 | [vim]: https://github.com/marijnh/tern_for_vim
29 | [st]: https://github.com/marijnh/tern_for_sublime
30 | [lt]: https://github.com/mortalapeman/LT-TernJS
31 | [gedit]: https://github.com/Swatinem/tern_for_gedit
32 | [brackets]: http://brackets.io
33 | [edge_code]: http://html.adobe.com/edge/code
34 | [cmode]: https://github.com/proofit404/company-tern
35 |
--------------------------------------------------------------------------------
/node_modules/tern/bin/condense:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 |
3 | var tern = require("../lib/tern"), condense = require("../lib/condense");
4 | var path = require("path"), fs = require("fs");
5 | require("../plugin/doc_comment");
6 |
7 | var localDir = process.cwd(), ourDir = path.resolve(__dirname, "..");
8 | var spans = true;
9 |
10 | function usage(exit) {
11 | console.error("usage: " + process.argv[1] + " [--name name] [--plugin name]* [--def name]* [+extrafile.js]* [file.js]+");
12 | if (exit != null) process.exit(exit);
13 | }
14 |
15 | function findFile(file, where, ext) {
16 | if (file.slice(file.length - ext.length) != ext) file += ext;
17 | var local = path.resolve(localDir, file);
18 | if (fs.existsSync(local)) return local;
19 | var our = path.resolve(path.resolve(ourDir, where), file);
20 | if (fs.existsSync(our)) return our;
21 | }
22 |
23 | var defs = [], plugins = {doc_comment: {}}, files = [], name;
24 |
25 | function loadDef(name) {
26 | var found = findFile(name, "defs", ".json");
27 | if (!found) {
28 | console.error("Could not find def file " + name);
29 | process.exit(1);
30 | }
31 | defs.push(JSON.parse(fs.readFileSync(found, "utf8")));
32 | }
33 |
34 | loadDef("ecma5");
35 |
36 | function loadPlugin(name, val) {
37 | var found = findFile(name, "plugin", ".js");
38 | if (!found) {
39 | try {
40 | found = require.resolve("tern-" + name);
41 | } catch (e) {
42 | console.error("Could not find plugin " + name);
43 | process.exit(1);
44 | }
45 | }
46 | var mod = require(found);
47 | if (mod.hasOwnProperty("initialize")) mod.initialize(ourDir);
48 | plugins[path.basename(name, ".js")] = val;
49 | }
50 |
51 | for (var i = 2, len = process.argv.length; i < len; ++i) {
52 | var cur = process.argv[i];
53 | if (cur == "--plugin" && i < len - 1) {
54 | var plugin = process.argv[++i], eq = plugin.indexOf("=");
55 | if (eq > -1)
56 | loadPlugin(plugin.slice(0, eq), JSON.parse(plugin.slice(eq + 1)));
57 | else
58 | loadPlugin(plugin, {});
59 | } else if (cur == "--def" && i < len - 1) {
60 | loadDef(process.argv[++i]);
61 | } else if (cur == "--name" && i < len - 1) {
62 | name = process.argv[++i];
63 | } else if (cur == "--no-spans") {
64 | spans = false;
65 | } else if (cur.charAt(0) == "-") {
66 | usage(1);
67 | } else {
68 | files.push(cur);
69 | }
70 | }
71 |
72 | var server = new tern.Server({
73 | getFile: function(file) { return fs.readFileSync(path.resolve(localDir, file), "utf8"); },
74 | defs: defs,
75 | plugins: plugins,
76 | debug: true,
77 | projectDir: localDir
78 | });
79 |
80 | var origins = [];
81 | for (var i = 0; i < files.length; ++i) {
82 | var file = files[i];
83 | if (file.charAt(0) == "+") {
84 | file = file.slice(1);
85 | } else {
86 | origins.push(file);
87 | if (!name) name = file;
88 | }
89 | if (!fs.existsSync(file)) {
90 | console.error("File " + file + " does not exist");
91 | process.exit(1);
92 | }
93 | server.addFile(file, fs.readFileSync(file, "utf8"));
94 | }
95 |
96 | if (!origins.length) usage(1);
97 |
98 | server.flush(function(err) {
99 | if (err) throw err;
100 | console.log(JSON.stringify(condense.condense(origins, name, {spans: spans}), null, 2));
101 | });
102 |
--------------------------------------------------------------------------------
/node_modules/tern/bin/from_ts:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 |
3 | var ts = require("../lib/typescript.js");
4 | var fs = require("fs"), path = require("path"), url = require("url");
5 |
6 | var arg = process.argv[2];
7 | if (!arg) { console.log("Usage: " + process.argv[1] + " (path|url)"); process.exit(1); }
8 |
9 | function fetch(target, redir) {
10 | require(/^https/.test(target) ? "https" : "http").get(url.parse(target), function(resp) {
11 | var body = "";
12 | resp.setEncoding("utf8");
13 | resp.on("data", function(d) { body += d; });
14 | resp.on("end", function() {
15 | if (resp.statusCode >= 400) { console.log("Could not fetch " + target + ":\n" + body); process.exit(1); }
16 | if (resp.statusCode >= 300 && redir < 10 && resp.headers.location) return fetch(resp.headers.location, redir + 1);
17 | finish(body, path.basename(target.slice(6)));
18 | });
19 | });
20 | }
21 |
22 | if (/^https?:/.test(arg))
23 | fetch(arg, 0);
24 | else
25 | finish(fs.readFileSync(arg, "utf8"), path.basename(arg));
26 |
27 | function finish(text, name) {
28 | console.log(JSON.stringify(ts.translate(text, name), null, 2));
29 | }
30 |
--------------------------------------------------------------------------------
/node_modules/tern/bin/test:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 |
3 | var filter = process.argv[2];
4 |
5 | require("../test/runcases").runTests(filter);
6 | require("../test/fragments").runTests(filter);
7 | require("../test/condense").runTests(filter);
8 | require("../test/timeout").runTests(filter);
9 | require("../test/reload").runTests(filter);
10 |
11 | process.exit(require("../test/util").hasFailed());
12 |
--------------------------------------------------------------------------------
/node_modules/tern/bin/update_authors.sh:
--------------------------------------------------------------------------------
1 | # Combine existing list of authors with everyone known in git, sort, add header.
2 | tail --lines=+3 AUTHORS > AUTHORS.tmp
3 | git log --format='%aN' | grep -v 'Sérgio Ramos\|othree_kao\|Angelo$' >> AUTHORS.tmp
4 | echo -e "List of Tern contributors. Updated before every release.\n" > AUTHORS
5 | sort -u AUTHORS.tmp >> AUTHORS
6 | rm -f AUTHORS.tmp
7 |
--------------------------------------------------------------------------------
/node_modules/tern/doc/Makefile:
--------------------------------------------------------------------------------
1 | all: manual.html
2 |
3 | manual.html: src/manual.txt src/asciidoc.conf
4 | PATH=../node_modules/codemirror/bin:$(PATH) asciidoc --backend=html5 -o manual.html src/manual.txt
5 |
--------------------------------------------------------------------------------
/node_modules/tern/doc/demo/demo.css:
--------------------------------------------------------------------------------
1 | .CodeMirror {
2 | border: 1px solid silver;
3 | height: 400px;
4 | line-height: 1.3;
5 | font-size: 14pt;
6 | font-family: "Ubuntu Mono";
7 | z-index: 2;
8 | }
9 | .CodeMirror pre {
10 | padding: 0 9px;
11 | }
12 | .CodeMirror-linenumber {
13 | font-size: 80%;
14 | padding-top: 2px;
15 | }
16 |
17 | ul.tabs {
18 | list-style: none;
19 | margin: 0 0 -1px 0;
20 | padding: 0 0 0 37px;
21 | font-family: "Ubuntu Mono";
22 | overflow: hidden;
23 | }
24 | ul.tabs li {
25 | font-size: 11pt;
26 | color: #777;
27 | cursor: pointer;
28 | margin: 0 2px 0 0;
29 | padding: 2px 10px 5px;
30 | border: 1px solid silver;
31 | border-bottom-width: 0px;
32 | background: #f3f3f3;
33 | display: inline-block;
34 | z-index: 1;
35 | border-top-left-radius: 6px;
36 | border-top-right-radius: 6px;
37 | position: relative;
38 | }
39 | ul.tabs li:hover {
40 | color: #444;
41 | }
42 | ul.tabs li.selected {
43 | background: white;
44 | color: #222;
45 | z-index: 3;
46 | cursor: default;
47 | }
48 | ul.tabs li:before,
49 | ul.tabs li:after {
50 | position: absolute;
51 | bottom: 0;
52 | width: 6px;
53 | height: 6px;
54 | content: " ";
55 | border: 1px solid silver;
56 | }
57 | ul.tabs li:before {
58 | left: -7px;
59 | border-bottom-right-radius: 6px;
60 | border-width: 0 1px 1px 0;
61 | box-shadow: 2px 2px 0 #f3f3f3;
62 | }
63 | ul.tabs li:after {
64 | right: -7px;
65 | border-bottom-left-radius: 6px;
66 | border-width: 0 0 1px 1px;
67 | box-shadow: -2px 2px 0 #f3f3f3;
68 | }
69 | ul.tabs li.selected:before {
70 | box-shadow: 2px 2px 0 white;
71 | }
72 | ul.tabs li.selected:after {
73 | box-shadow: -2px 2px 0 white;
74 | }
75 |
76 | #commands {
77 | font-family: "Ubuntu Mono";
78 | font-size: 11pt;
79 | position: absolute;
80 | right: 0;
81 | top: 0;
82 | max-width: 10em;
83 | }
84 |
85 | .CodeMirror div.CodeMirror-cursor {
86 | border-left: 2px solid #444;
87 | }
88 |
89 | .CodeMirror-hint { font-size: 12pt; }
90 |
--------------------------------------------------------------------------------
/node_modules/tern/doc/docs.css:
--------------------------------------------------------------------------------
1 | @font-face {
2 | font-family: 'Signika';
3 | font-style: normal;
4 | font-weight: 700;
5 | src: local('Signika-Bold'), url(http://themes.googleusercontent.com/static/fonts/signika/v3/7M5kxD4eGxuhgFaIk95pBRsxEYwM7FgeyaSgU71cLG0.woff) format('woff');
6 | }
7 |
8 | @font-face {
9 | font-family: 'Ubuntu Mono';
10 | font-style: normal;
11 | font-weight: 500;
12 | src: local('Ubuntu Mono'), local('UbuntuMono-Regular'), url('http://themes.googleusercontent.com/static/fonts/ubuntumono/v3/ViZhet7Ak-LRXZMXzuAfkYbN6UDyHWBl620a-IRfuBk.woff') format('woff');
13 | }
14 |
15 | body {
16 | font-family: "Helvetica Neue", "Lucida Grande", "Lucida Sans Unicode", Helvetica, Arial, sans-serif;
17 | color: #222;
18 | font-size: 11pt;
19 | max-width: 700px;
20 | margin: 0 0 0 60px;
21 | padding: 60px 0 4em;
22 | }
23 |
24 | #top {
25 | position: fixed;
26 | top: 0;
27 | background: white;
28 | padding-top: 15px;
29 | left: 20px; right: 20px;
30 | z-index: 5;
31 | }
32 |
33 | #head {
34 | border-radius: 5px;
35 | background: #1c5b64;
36 | box-shadow: 0px 3px 3px rgba(0, 0, 0, .5);
37 | position: relative;
38 | font-family: "Signika", sans-serif;
39 | font-weight: 700;
40 | }
41 |
42 | #head > a {
43 | border-right: 1px solid #276c81;
44 | display: inline-block;
45 | height: 25px;
46 | padding: 5px 20px;
47 | color: white;
48 | text-decoration: none;
49 | line-height: 25px;
50 | font-size: 17px;
51 | }
52 |
53 | #head > a.title {
54 | font-size: 20px;
55 | line-height: 24px;
56 | padding-left: 80px;
57 | background: url(logo.png);
58 | background-position: 40px center;
59 | background-size: auto 80%;
60 | background-repeat: no-repeat;
61 | border-bottom-left-radius: 5px;
62 | border-top-left-radius: 5px;
63 | }
64 |
65 | #head > a:hover {
66 | background-color: #276c81 !important;
67 | }
68 |
69 | .title span {
70 | font-size: 13px;
71 | }
72 |
73 | code, pre { font-family: "Ubuntu Mono", monospace; }
74 | code { color: #124f55; font-size: 110%; }
75 | pre {
76 | border-left: 3px solid #def;
77 | padding: 2px 0 2px 10px;
78 | }
79 |
80 | h1, h2, h3, h4 {
81 | font-family: "Signika", sans-serif;
82 | font-weight: 700;
83 | color: #124f55;
84 | }
85 | h1 { font-size: 20pt; }
86 | h2 { font-size: 17pt; }
87 | h3 { font-size: 13pt; }
88 | h4 { font-size: 11pt; }
89 |
90 | a, a:visited, a code { color: #df4c11; text-decoration: none; }
91 | a:hover { text-decoration: underline; }
92 |
93 | ul, ol {
94 | margin: 0;
95 | padding: 0;
96 | }
97 | li {
98 | margin-left: 1.5em;
99 | padding: 0;
100 | }
101 |
102 | li p { margin: 0; }
103 | dd p:first-child { margin-top: 1px; }
104 | dd { margin-left: 20px; }
105 | dt { text-indent: -1em; padding-left: 1em; }
106 |
107 | a[id] {
108 | position: relative;
109 | display: inline-block;
110 | vertical-align: top;
111 | top: -60px;
112 | }
113 |
114 | .release-note {
115 | margin-left: 1em;
116 | }
117 |
118 | /* CodeMirror default theme for highlighting */
119 |
120 | .cm-s-default .cm-keyword {color: #708;}
121 | .cm-s-default .cm-atom {color: #219;}
122 | .cm-s-default .cm-number {color: #164;}
123 | .cm-s-default .cm-def {color: #00f;}
124 | .cm-s-default .cm-variable {color: black;}
125 | .cm-s-default .cm-variable-2 {color: #05a;}
126 | .cm-s-default .cm-variable-3 {color: #085;}
127 | .cm-s-default .cm-property {color: black;}
128 | .cm-s-default .cm-operator {color: black;}
129 | .cm-s-default .cm-comment {color: #a50;}
130 | .cm-s-default .cm-string {color: #a11;}
131 | .cm-s-default .cm-string-2 {color: #f50;}
132 | .cm-s-default .cm-meta {color: #555;}
133 | .cm-s-default .cm-error {color: #f00;}
134 | .cm-s-default .cm-qualifier {color: #555;}
135 | .cm-s-default .cm-builtin {color: #30a;}
136 | .cm-s-default .cm-bracket {color: #997;}
137 | .cm-s-default .cm-tag {color: #170;}
138 | .cm-s-default .cm-attribute {color: #00c;}
139 | .cm-s-default .cm-header {color: blue;}
140 | .cm-s-default .cm-quote {color: #090;}
141 | .cm-s-default .cm-hr {color: #999;}
142 | .cm-s-default .cm-link {color: #00c;}
143 |
--------------------------------------------------------------------------------
/node_modules/tern/doc/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Slava/tern-meteor-sublime/38b97309957d336854941a1a988519ea4b10aec9/node_modules/tern/doc/logo.png
--------------------------------------------------------------------------------
/node_modules/tern/doc/src/asciidoc.conf:
--------------------------------------------------------------------------------
1 | [miscellaneous]
2 | newline=\n
3 |
4 | [attributes]
5 | disable-javascript=True
6 | warnings=False
7 | #pygments=True
8 | highlight=True
9 |
10 | [literal-inlinemacro]
11 | {passtext}
12 |
13 | [sect0]
14 | {id? }{title}
15 | |
16 |
17 | [sect1]
18 | {id? }{title}
19 | |
20 |
21 | [sect2]
22 | {id? }{title}
23 | |
24 |
25 | [sect3]
26 | {id? }{title}
27 | |
28 |
29 | [paragraph]
30 | {id? }{title?
{title}
}
31 | |
32 |
33 |
34 | [listtags-labeled]
35 | list=|
36 | term=|
37 | item=|
38 | text=|
39 |
40 | [header]
41 |
42 |
43 |
44 |
45 | {doctitle}
46 |
47 |
48 |
56 | {doctitle}
57 |
58 | [footer]
59 |
60 |
61 | [source-highlight-block]
62 |
63 | |
64 |
--------------------------------------------------------------------------------
/node_modules/tern/emacs/tern-auto-complete.el:
--------------------------------------------------------------------------------
1 | ;;; -*- lexical-binding: t -*-
2 | ;;; tern-auto-complete.el --- Tern Completion by auto-complete.el
3 |
4 | ;; Author:
5 | ;; Version: 0.0.1
6 | ;; Package-Requires: ((tern "0.0.1") (auto-complete "1.4") (cl-lib "0.5") (emacs "24"))
7 |
8 | ;;; Commentary:
9 |
10 | ;; Display completion items with its type and document.
11 |
12 | ;; If `tern-ac-on-dot' is non-nil (default), typing '.(dot)' invokes auto-complete with tern.
13 | ;; Calling the command `tern-ac-complete', you can invoke auto-complete manually.
14 | ;; This program does not provide an ac-source for arbitrary timing yet.
15 |
16 | ;;; Installation:
17 |
18 | ;; Add following lines below the tern setup code.
19 |
20 | ;; (eval-after-load 'tern
21 | ;; '(progn
22 | ;; (require 'tern-auto-complete)
23 | ;; (tern-ac-setup)))
24 |
25 | ;;; Code:
26 |
27 | (require 'cl-lib)
28 | (require 'tern)
29 | (require 'auto-complete)
30 |
31 |
32 |
33 | ;;; Completion
34 |
35 | (defcustom tern-ac-on-dot t
36 | "[AC] If t, tern enable completion by auto-completion."
37 | :type 'boolean
38 | :group 'auto-complete)
39 |
40 | (defvar tern-ac-complete-reply nil "[internal] tern-ac-complete-reply.")
41 |
42 | (defvar tern-ac-complete-request-point 0
43 | "[internal] The point where `tern-ac-complete-request' is called.")
44 |
45 | (defun tern-ac-complete-request (cc)
46 | (setq tern-last-point-pos (point))
47 | (setq tern-ac-complete-reply nil)
48 | (setq tern-ac-complete-request-point (point))
49 | (tern-run-query
50 | (lambda (data)
51 | (tern-ac-complete-response data)
52 | (funcall cc))
53 | `((type . "completions") (types . t) (docs . t) (caseInsensitive . t))
54 | (point)))
55 |
56 | (defun tern-ac-complete-response (data)
57 | (let ((cs (cl-loop for elt across (cdr (assq 'completions data)) collect elt))
58 | (start (+ 1 (cdr (assq 'start data))))
59 | (end (+ 1 (cdr (assq 'end data)))))
60 | (setq tern-last-completions (list (buffer-substring-no-properties start end) start end cs))
61 | (setq tern-ac-complete-reply cs)))
62 |
63 | (defun tern-ac-complete ()
64 | "Complete code at point by tern."
65 | (interactive)
66 | (tern-ac-complete-request
67 | (lambda ()
68 | (let ((ac-sources (cons 'ac-source-tern-completion ac-sources)))
69 | (ac-start)))))
70 |
71 | (defun tern-ac-dot-complete ()
72 | "Insert dot and complete code at point by tern."
73 | (interactive)
74 | (insert ".")
75 | (unless (nth 4 (syntax-ppss))
76 | (tern-ac-complete)))
77 |
78 | (defvar tern-ac-completion-truncate-length 22
79 | "[AC] truncation length for type summary.")
80 |
81 | (defun tern-ac-completion-matches ()
82 | (mapcar
83 | (lambda (item)
84 | (let ((doc (cdr (assq 'doc item)))
85 | (type (cdr (assq 'type item)))
86 | (name (cdr (assq 'name item))))
87 | (popup-make-item
88 | name
89 | :symbol (if (string-match "fn" type) "f" "v")
90 | :summary (truncate-string-to-width
91 | type tern-ac-completion-truncate-length 0 nil "...")
92 | :document (concat type "\n\n" doc))))
93 | tern-ac-complete-reply))
94 |
95 | (defun tern-ac-completion-prefix ()
96 | (or (ac-prefix-default)
97 | (when (= tern-ac-complete-request-point (point))
98 | tern-ac-complete-request-point)))
99 |
100 | ;; (makunbound 'ac-source-tern-completion)
101 | (ac-define-source tern-completion
102 | '((candidates . tern-ac-completion-matches)
103 | (prefix . tern-ac-completion-prefix)
104 | (requires . -1)))
105 |
106 | ;;;###autoload
107 | (defun tern-ac-setup ()
108 | "Setup auto-complete for tern-mode."
109 | (interactive)
110 | (if tern-ac-on-dot
111 | (define-key tern-mode-keymap "." 'tern-ac-dot-complete)
112 | (define-key tern-mode-keymap "." nil)))
113 |
114 |
115 | (provide 'tern-auto-complete)
116 | ;;; tern-auto-complete.el ends here
117 |
--------------------------------------------------------------------------------
/node_modules/tern/lib/comment.js:
--------------------------------------------------------------------------------
1 | (function(mod) {
2 | if (typeof exports == "object" && typeof module == "object") // CommonJS
3 | return mod(exports);
4 | if (typeof define == "function" && define.amd) // AMD
5 | return define(["exports"], mod);
6 | mod(tern.comment || (tern.comment = {}));
7 | })(function(exports) {
8 | function isSpace(ch) {
9 | return (ch < 14 && ch > 8) || ch === 32 || ch === 160;
10 | }
11 |
12 | function onOwnLine(text, pos) {
13 | for (; pos > 0; --pos) {
14 | var ch = text.charCodeAt(pos - 1);
15 | if (ch == 10) break;
16 | if (!isSpace(ch)) return false;
17 | }
18 | return true;
19 | }
20 |
21 | // Gather comments directly before a function
22 | exports.commentsBefore = function(text, pos) {
23 | var found = null, emptyLines = 0, topIsLineComment;
24 | out: while (pos > 0) {
25 | var prev = text.charCodeAt(pos - 1);
26 | if (prev == 10) {
27 | for (var scan = --pos, sawNonWS = false; scan > 0; --scan) {
28 | prev = text.charCodeAt(scan - 1);
29 | if (prev == 47 && text.charCodeAt(scan - 2) == 47) {
30 | if (!onOwnLine(text, scan - 2)) break out;
31 | var content = text.slice(scan, pos);
32 | if (!emptyLines && topIsLineComment) found[0] = content + "\n" + found[0];
33 | else (found || (found = [])).unshift(content);
34 | topIsLineComment = true;
35 | emptyLines = 0;
36 | pos = scan - 2;
37 | break;
38 | } else if (prev == 10) {
39 | if (!sawNonWS && ++emptyLines > 1) break out;
40 | break;
41 | } else if (!sawNonWS && !isSpace(prev)) {
42 | sawNonWS = true;
43 | }
44 | }
45 | } else if (prev == 47 && text.charCodeAt(pos - 2) == 42) {
46 | for (var scan = pos - 2; scan > 1; --scan) {
47 | if (text.charCodeAt(scan - 1) == 42 && text.charCodeAt(scan - 2) == 47) {
48 | if (!onOwnLine(text, scan - 2)) break out;
49 | (found || (found = [])).unshift(text.slice(scan, pos - 2));
50 | topIsLineComment = false;
51 | emptyLines = 0;
52 | break;
53 | }
54 | }
55 | pos = scan - 2;
56 | } else if (isSpace(prev)) {
57 | --pos;
58 | } else {
59 | break;
60 | }
61 | }
62 | return found;
63 | };
64 |
65 | exports.commentAfter = function(text, pos) {
66 | while (pos < text.length) {
67 | var next = text.charCodeAt(pos);
68 | if (next == 47) {
69 | var after = text.charCodeAt(pos + 1), end;
70 | if (after == 47) // line comment
71 | end = text.indexOf("\n", pos + 2);
72 | else if (after == 42) // block comment
73 | end = text.indexOf("*/", pos + 2);
74 | else
75 | return;
76 | return text.slice(pos + 2, end < 0 ? text.length : end);
77 | } else if (isSpace(next)) {
78 | ++pos;
79 | }
80 | }
81 | };
82 |
83 | exports.ensureCommentsBefore = function(text, node) {
84 | if (node.hasOwnProperty("commentsBefore")) return node.commentsBefore;
85 | return node.commentsBefore = exports.commentsBefore(text, node.start);
86 | };
87 | });
88 |
--------------------------------------------------------------------------------
/node_modules/tern/lib/signal.js:
--------------------------------------------------------------------------------
1 | (function(root, mod) {
2 | if (typeof exports == "object" && typeof module == "object") // CommonJS
3 | return mod(exports);
4 | if (typeof define == "function" && define.amd) // AMD
5 | return define(["exports"], mod);
6 | mod((root.tern || (root.tern = {})).signal = {}); // Plain browser env
7 | })(this, function(exports) {
8 | function on(type, f) {
9 | var handlers = this._handlers || (this._handlers = Object.create(null));
10 | (handlers[type] || (handlers[type] = [])).push(f);
11 | }
12 | function off(type, f) {
13 | var arr = this._handlers && this._handlers[type];
14 | if (arr) for (var i = 0; i < arr.length; ++i)
15 | if (arr[i] == f) { arr.splice(i, 1); break; }
16 | }
17 | function signal(type, a1, a2, a3, a4) {
18 | var arr = this._handlers && this._handlers[type];
19 | if (arr) for (var i = 0; i < arr.length; ++i) arr[i].call(this, a1, a2, a3, a4);
20 | }
21 |
22 | exports.mixin = function(obj) {
23 | obj.on = on; obj.off = off; obj.signal = signal;
24 | return obj;
25 | };
26 | });
27 |
--------------------------------------------------------------------------------
/node_modules/tern/node_modules/.bin/acorn:
--------------------------------------------------------------------------------
1 | ../acorn/bin/acorn
--------------------------------------------------------------------------------
/node_modules/tern/node_modules/.bin/tsc:
--------------------------------------------------------------------------------
1 | ../typescript/bin/tsc
--------------------------------------------------------------------------------
/node_modules/tern/node_modules/acorn/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | indent_style = space
5 | indent_size = 2
6 | end_of_line = lf
7 | insert_final_newline = true
8 |
--------------------------------------------------------------------------------
/node_modules/tern/node_modules/acorn/.gitattributes:
--------------------------------------------------------------------------------
1 | * text eol=lf
2 |
--------------------------------------------------------------------------------
/node_modules/tern/node_modules/acorn/.npmignore:
--------------------------------------------------------------------------------
1 | /.tern-port
2 | /test
3 | /local
4 |
--------------------------------------------------------------------------------
/node_modules/tern/node_modules/acorn/.tern-project:
--------------------------------------------------------------------------------
1 | {}
--------------------------------------------------------------------------------
/node_modules/tern/node_modules/acorn/.travis.yml:
--------------------------------------------------------------------------------
1 | language: node_js
2 | node_js: '0.10'
3 |
--------------------------------------------------------------------------------
/node_modules/tern/node_modules/acorn/AUTHORS:
--------------------------------------------------------------------------------
1 | List of Acorn contributors. Updated before every release.
2 |
3 | Alistair Braidwood
4 | Aparajita Fishman
5 | Arian Stolwijk
6 | Artem Govorov
7 | Brandon Mills
8 | Charles Hughes
9 | Conrad Irwin
10 | David Bonnet
11 | impinball
12 | Ingvar Stepanyan
13 | Jiaxing Wang
14 | Johannes Herr
15 | Jürg Lehni
16 | keeyipchan
17 | krator
18 | Marijn Haverbeke
19 | Martin Carlberg
20 | Mathias Bynens
21 | Mathieu 'p01' Henri
22 | Max Schaefer
23 | Mihai Bazon
24 | Mike Rennie
25 | Oskar Schöldström
26 | Paul Harper
27 | Peter Rust
28 | PlNG
29 | r-e-d
30 | Rich Harris
31 | Sebastian McKenzie
32 | zsjforcn
33 |
--------------------------------------------------------------------------------
/node_modules/tern/node_modules/acorn/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (C) 2012-2014 by various contributors (see AUTHORS)
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy
4 | of this software and associated documentation files (the "Software"), to deal
5 | in the Software without restriction, including without limitation the rights
6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | copies of the Software, and to permit persons to whom the Software is
8 | furnished to do so, subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in
11 | all copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | THE SOFTWARE.
20 |
--------------------------------------------------------------------------------
/node_modules/tern/node_modules/acorn/bin/acorn:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 |
3 | var path = require("path");
4 | var fs = require("fs");
5 | var acorn = require("../acorn.js");
6 |
7 | var infile, parsed, tokens, options = {}, silent = false, compact = false, tokenize = false;
8 |
9 | function help(status) {
10 | var print = (status == 0) ? console.log : console.error;
11 | print("usage: " + path.basename(process.argv[1]) + " [--ecma3|--ecma5|--ecma6] [--strictSemicolons]");
12 | print(" [--tokenize] [--locations] [--compact] [--silent] [--help] [--] infile");
13 | process.exit(status);
14 | }
15 |
16 | for (var i = 2; i < process.argv.length; ++i) {
17 | var arg = process.argv[i];
18 | if (arg[0] != "-" && !infile) infile = arg;
19 | else if (arg == "--" && !infile && i + 2 == process.argv.length) infile = process.argv[++i];
20 | else if (arg == "--ecma3") options.ecmaVersion = 3;
21 | else if (arg == "--ecma5") options.ecmaVersion = 5;
22 | else if (arg == "--ecma6") options.ecmaVersion = 6;
23 | else if (arg == "--ecma7") options.ecmaVersion = 7;
24 | else if (arg == "--strictSemicolons") options.strictSemicolons = true;
25 | else if (arg == "--locations") options.locations = true;
26 | else if (arg == "--silent") silent = true;
27 | else if (arg == "--compact") compact = true;
28 | else if (arg == "--help") help(0);
29 | else if (arg == "--tokenize") tokenize = true;
30 | else help(1);
31 | }
32 |
33 | try {
34 | var code = fs.readFileSync(infile, "utf8");
35 |
36 | if (!tokenize)
37 | parsed = acorn.parse(code, options);
38 | else {
39 | var get = acorn.tokenize(code, options);
40 | tokens = [];
41 | while (true) {
42 | var token = get();
43 | tokens.push(token);
44 | if (token.type.type == "eof")
45 | break;
46 | }
47 | }
48 | } catch(e) {
49 | console.log(e.message);
50 | process.exit(1);
51 | }
52 |
53 | if (!silent)
54 | console.log(JSON.stringify(tokenize ? tokens : parsed, null, compact ? null : 2));
55 |
--------------------------------------------------------------------------------
/node_modules/tern/node_modules/acorn/bin/update_authors.sh:
--------------------------------------------------------------------------------
1 | # Combine existing list of authors with everyone known in git, sort, add header.
2 | tail --lines=+3 AUTHORS > AUTHORS.tmp
3 | git log --format='%aN' | grep -v abraidwood >> AUTHORS.tmp
4 | echo -e "List of Acorn contributors. Updated before every release.\n" > AUTHORS
5 | sort -u AUTHORS.tmp >> AUTHORS
6 | rm -f AUTHORS.tmp
7 |
--------------------------------------------------------------------------------
/node_modules/tern/node_modules/acorn/bin/without_eval:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 |
3 | var fs = require("fs");
4 |
5 | var acornSrc = fs.readFileSync(require.resolve("../acorn"), "utf8");
6 | var acorn = require("../acorn"), walk = require("../util/walk");
7 |
8 | var ast = acorn.parse(acornSrc);
9 | var touchups = [], uses = [];
10 |
11 | walk.simple(ast, {
12 | FunctionDeclaration: function(node) {
13 | if (node.id.name == "makePredicate")
14 | touchups.push({text: "// Removed to create an eval-free library", from: node.start, to: node.end});
15 | },
16 | VariableDeclaration: function(node) {
17 | node.declarations.forEach(function(decl) {
18 | if (decl.init && decl.init.type == "CallExpression" &&
19 | decl.init.callee.name == "makePredicate")
20 | uses.push(decl);
21 | });
22 | }
23 | });
24 |
25 | var results = Object.create(null);
26 | var functions = new Function("predicates", acornSrc.replace(
27 | /\}\);\s*$/, uses.map(function(decl) {
28 | return "predicates[" + JSON.stringify(decl.id.name) + "] = " + decl.id.name + ";";
29 | }).join("") + "});"))(results);
30 |
31 | uses.forEach(function(decl) {
32 | touchups.push({text: results[decl.id.name].toString(),
33 | from: decl.init.start, to: decl.init.end});
34 | });
35 |
36 | var result = "", pos = 0;
37 | touchups.sort(function(a, b) { return a.from - b.from; });
38 | touchups.forEach(function(touchup) {
39 | result += acornSrc.slice(pos, touchup.from);
40 | result += touchup.text;
41 | pos = touchup.to;
42 | });
43 | result += acornSrc.slice(pos);
44 |
45 | process.stdout.write(result);
46 |
--------------------------------------------------------------------------------
/node_modules/tern/node_modules/acorn/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "acorn",
3 | "description": "ECMAScript parser",
4 | "homepage": "http://marijnhaverbeke.nl/acorn/",
5 | "main": "acorn.js",
6 | "version": "0.12.0",
7 | "engines": {
8 | "node": ">=0.4.0"
9 | },
10 | "maintainers": [
11 | {
12 | "name": "marijn",
13 | "email": "marijnh@gmail.com"
14 | }
15 | ],
16 | "repository": {
17 | "type": "git",
18 | "url": "http://marijnhaverbeke.nl/git/acorn"
19 | },
20 | "licenses": [
21 | {
22 | "type": "MIT",
23 | "url": "http://marijnhaverbeke.nl/acorn/LICENSE"
24 | }
25 | ],
26 | "scripts": {
27 | "test": "node test/run.js",
28 | "prepublish": "node bin/without_eval > acorn_csp.js"
29 | },
30 | "bin": {
31 | "acorn": "./bin/acorn"
32 | },
33 | "devDependencies": {
34 | "regenerate": "~0.6.2",
35 | "unicode-7.0.0": "~0.1.5"
36 | },
37 | "contributors": [
38 | {
39 | "name": "List of Acorn contributors. Updated before every release."
40 | },
41 | {
42 | "name": "Alistair Braidwood"
43 | },
44 | {
45 | "name": "Aparajita Fishman"
46 | },
47 | {
48 | "name": "Arian Stolwijk"
49 | },
50 | {
51 | "name": "Artem Govorov"
52 | },
53 | {
54 | "name": "Brandon Mills"
55 | },
56 | {
57 | "name": "Charles Hughes"
58 | },
59 | {
60 | "name": "Conrad Irwin"
61 | },
62 | {
63 | "name": "David Bonnet"
64 | },
65 | {
66 | "name": "impinball"
67 | },
68 | {
69 | "name": "Ingvar Stepanyan"
70 | },
71 | {
72 | "name": "Jiaxing Wang"
73 | },
74 | {
75 | "name": "Johannes Herr"
76 | },
77 | {
78 | "name": "Jürg Lehni"
79 | },
80 | {
81 | "name": "keeyipchan"
82 | },
83 | {
84 | "name": "krator"
85 | },
86 | {
87 | "name": "Marijn Haverbeke"
88 | },
89 | {
90 | "name": "Martin Carlberg"
91 | },
92 | {
93 | "name": "Mathias Bynens"
94 | },
95 | {
96 | "name": "Mathieu 'p01' Henri"
97 | },
98 | {
99 | "name": "Max Schaefer"
100 | },
101 | {
102 | "name": "Mihai Bazon"
103 | },
104 | {
105 | "name": "Mike Rennie"
106 | },
107 | {
108 | "name": "Oskar Schöldström"
109 | },
110 | {
111 | "name": "Paul Harper"
112 | },
113 | {
114 | "name": "Peter Rust"
115 | },
116 | {
117 | "name": "PlNG"
118 | },
119 | {
120 | "name": "r-e-d"
121 | },
122 | {
123 | "name": "Rich Harris"
124 | },
125 | {
126 | "name": "Sebastian McKenzie"
127 | },
128 | {
129 | "name": "zsjforcn"
130 | }
131 | ],
132 | "gitHead": "99f1989f72c340f517ac5a99f9293484ba1fddc5",
133 | "_id": "acorn@0.12.0",
134 | "_shasum": "337b0bb293dfd6239d7e66c92c727c56a08d403e",
135 | "_from": "acorn@>=0.12.0",
136 | "_npmVersion": "1.4.28",
137 | "_npmUser": {
138 | "name": "marijn",
139 | "email": "marijnh@gmail.com"
140 | },
141 | "dist": {
142 | "shasum": "337b0bb293dfd6239d7e66c92c727c56a08d403e",
143 | "tarball": "http://registry.npmjs.org/acorn/-/acorn-0.12.0.tgz"
144 | },
145 | "directories": {},
146 | "_resolved": "https://registry.npmjs.org/acorn/-/acorn-0.12.0.tgz"
147 | }
148 |
--------------------------------------------------------------------------------
/node_modules/tern/node_modules/acorn/tools/generate-identifier-regex.js:
--------------------------------------------------------------------------------
1 | // Based on https://gist.github.com/mathiasbynens/6334847 by @mathias
2 |
3 | var regenerate = require('regenerate');
4 |
5 | // Which Unicode version should be used?
6 | var version = '7.0.0'; // note: also update `package.json` when this changes
7 |
8 | // Shorthand function
9 | var get = function(what) {
10 | return require('unicode-' + version + '/' + what + '/code-points');
11 | };
12 |
13 | // Unicode categories needed to construct the ES5 regex
14 | var Lu = get('categories/Lu');
15 | var Ll = get('categories/Ll');
16 | var Lt = get('categories/Lt');
17 | var Lm = get('categories/Lm');
18 | var Lo = get('categories/Lo');
19 | var Nl = get('categories/Nl');
20 | var Mn = get('categories/Mn');
21 | var Mc = get('categories/Mc');
22 | var Nd = get('categories/Nd');
23 | var Pc = get('categories/Pc');
24 |
25 | var generateES5Regex = function() { // ES 5.1
26 | // http://mathiasbynens.be/notes/javascript-identifiers#valid-identifier-names
27 | var identifierStart = regenerate('$', '_')
28 | .add(Lu, Ll, Lt, Lm, Lo, Nl)
29 | .removeRange(0x010000, 0x10FFFF) // remove astral symbols
30 | .removeRange(0x0, 0x7F); // remove ASCII symbols (Acorn-specific)
31 | var identifierPart = regenerate('\u200C', '\u200D', Mn, Mc, Nd, Pc)
32 | .removeRange(0x010000, 0x10FFFF) // remove astral symbols
33 | .remove(identifierStart) // (Acorn-specific)
34 | .removeRange(0x0, 0x7F); // remove ASCII symbols (Acorn-specific)
35 | return {
36 | 'NonAsciiIdentifierStart': identifierStart.toString(),
37 | 'NonAsciiIdentifierPart': identifierPart.toString()
38 | };
39 | };
40 |
41 | var result = generateES5Regex();
42 | console.log(
43 | '// ECMAScript 5.1/Unicode v%s `nonASCIIidentifierStart`:\n\n%s\n',
44 | version,
45 | result.NonAsciiIdentifierStart
46 | );
47 | console.log(
48 | '// ECMAScript 5.1/Unicode v%s `nonASCIIidentifier`:\n\n%s',
49 | version,
50 | result.NonAsciiIdentifierPart
51 | );
52 |
--------------------------------------------------------------------------------
/node_modules/tern/node_modules/glob/.npmignore:
--------------------------------------------------------------------------------
1 | .*.swp
2 | test/a/
3 |
--------------------------------------------------------------------------------
/node_modules/tern/node_modules/glob/.travis.yml:
--------------------------------------------------------------------------------
1 | language: node_js
2 | node_js:
3 | - 0.8
4 |
--------------------------------------------------------------------------------
/node_modules/tern/node_modules/glob/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) Isaac Z. Schlueter ("Author")
2 | All rights reserved.
3 |
4 | The BSD License
5 |
6 | Redistribution and use in source and binary forms, with or without
7 | modification, are permitted provided that the following conditions
8 | are met:
9 |
10 | 1. Redistributions of source code must retain the above copyright
11 | notice, this list of conditions and the following disclaimer.
12 |
13 | 2. Redistributions in binary form must reproduce the above copyright
14 | notice, this list of conditions and the following disclaimer in the
15 | documentation and/or other materials provided with the distribution.
16 |
17 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
20 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS
21 | BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
24 | BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
25 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
26 | OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
27 | IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 |
--------------------------------------------------------------------------------
/node_modules/tern/node_modules/glob/examples/g.js:
--------------------------------------------------------------------------------
1 | var Glob = require("../").Glob
2 |
3 | var pattern = "test/a/**/[cg]/../[cg]"
4 | console.log(pattern)
5 |
6 | var mg = new Glob(pattern, {mark: true, sync:true}, function (er, matches) {
7 | console.log("matches", matches)
8 | })
9 | console.log("after")
10 |
--------------------------------------------------------------------------------
/node_modules/tern/node_modules/glob/examples/usr-local.js:
--------------------------------------------------------------------------------
1 | var Glob = require("../").Glob
2 |
3 | var pattern = "{./*/*,/*,/usr/local/*}"
4 | console.log(pattern)
5 |
6 | var mg = new Glob(pattern, {mark: true}, function (er, matches) {
7 | console.log("matches", matches)
8 | })
9 | console.log("after")
10 |
--------------------------------------------------------------------------------
/node_modules/tern/node_modules/glob/node_modules/inherits/LICENSE:
--------------------------------------------------------------------------------
1 | The ISC License
2 |
3 | Copyright (c) Isaac Z. Schlueter
4 |
5 | Permission to use, copy, modify, and/or distribute this software for any
6 | purpose with or without fee is hereby granted, provided that the above
7 | copyright notice and this permission notice appear in all copies.
8 |
9 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
10 | REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
11 | FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
12 | INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13 | LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
14 | OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15 | PERFORMANCE OF THIS SOFTWARE.
16 |
17 |
--------------------------------------------------------------------------------
/node_modules/tern/node_modules/glob/node_modules/inherits/README.md:
--------------------------------------------------------------------------------
1 | Browser-friendly inheritance fully compatible with standard node.js
2 | [inherits](http://nodejs.org/api/util.html#util_util_inherits_constructor_superconstructor).
3 |
4 | This package exports standard `inherits` from node.js `util` module in
5 | node environment, but also provides alternative browser-friendly
6 | implementation through [browser
7 | field](https://gist.github.com/shtylman/4339901). Alternative
8 | implementation is a literal copy of standard one located in standalone
9 | module to avoid requiring of `util`. It also has a shim for old
10 | browsers with no `Object.create` support.
11 |
12 | While keeping you sure you are using standard `inherits`
13 | implementation in node.js environment, it allows bundlers such as
14 | [browserify](https://github.com/substack/node-browserify) to not
15 | include full `util` package to your client code if all you need is
16 | just `inherits` function. It worth, because browser shim for `util`
17 | package is large and `inherits` is often the single function you need
18 | from it.
19 |
20 | It's recommended to use this package instead of
21 | `require('util').inherits` for any code that has chances to be used
22 | not only in node.js but in browser too.
23 |
24 | ## usage
25 |
26 | ```js
27 | var inherits = require('inherits');
28 | // then use exactly as the standard one
29 | ```
30 |
31 | ## note on version ~1.0
32 |
33 | Version ~1.0 had completely different motivation and is not compatible
34 | neither with 2.0 nor with standard node.js `inherits`.
35 |
36 | If you are using version ~1.0 and planning to switch to ~2.0, be
37 | careful:
38 |
39 | * new version uses `super_` instead of `super` for referencing
40 | superclass
41 | * new version overwrites current prototype while old one preserves any
42 | existing fields on it
43 |
--------------------------------------------------------------------------------
/node_modules/tern/node_modules/glob/node_modules/inherits/inherits.js:
--------------------------------------------------------------------------------
1 | module.exports = require('util').inherits
2 |
--------------------------------------------------------------------------------
/node_modules/tern/node_modules/glob/node_modules/inherits/inherits_browser.js:
--------------------------------------------------------------------------------
1 | if (typeof Object.create === 'function') {
2 | // implementation from standard node.js 'util' module
3 | module.exports = function inherits(ctor, superCtor) {
4 | ctor.super_ = superCtor
5 | ctor.prototype = Object.create(superCtor.prototype, {
6 | constructor: {
7 | value: ctor,
8 | enumerable: false,
9 | writable: true,
10 | configurable: true
11 | }
12 | });
13 | };
14 | } else {
15 | // old school shim for old browsers
16 | module.exports = function inherits(ctor, superCtor) {
17 | ctor.super_ = superCtor
18 | var TempCtor = function () {}
19 | TempCtor.prototype = superCtor.prototype
20 | ctor.prototype = new TempCtor()
21 | ctor.prototype.constructor = ctor
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/node_modules/tern/node_modules/glob/node_modules/inherits/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "inherits",
3 | "description": "Browser-friendly inheritance fully compatible with standard node.js inherits()",
4 | "version": "2.0.1",
5 | "keywords": [
6 | "inheritance",
7 | "class",
8 | "klass",
9 | "oop",
10 | "object-oriented",
11 | "inherits",
12 | "browser",
13 | "browserify"
14 | ],
15 | "main": "./inherits.js",
16 | "browser": "./inherits_browser.js",
17 | "repository": {
18 | "type": "git",
19 | "url": "git://github.com/isaacs/inherits"
20 | },
21 | "license": "ISC",
22 | "scripts": {
23 | "test": "node test"
24 | },
25 | "bugs": {
26 | "url": "https://github.com/isaacs/inherits/issues"
27 | },
28 | "_id": "inherits@2.0.1",
29 | "dist": {
30 | "shasum": "b17d08d326b4423e568eff719f91b0b1cbdf69f1",
31 | "tarball": "http://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz"
32 | },
33 | "_from": "inherits@>=2.0.0-0 <3.0.0-0",
34 | "_npmVersion": "1.3.8",
35 | "_npmUser": {
36 | "name": "isaacs",
37 | "email": "i@izs.me"
38 | },
39 | "maintainers": [
40 | {
41 | "name": "isaacs",
42 | "email": "i@izs.me"
43 | }
44 | ],
45 | "directories": {},
46 | "_shasum": "b17d08d326b4423e568eff719f91b0b1cbdf69f1",
47 | "_resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz",
48 | "readme": "Browser-friendly inheritance fully compatible with standard node.js\n[inherits](http://nodejs.org/api/util.html#util_util_inherits_constructor_superconstructor).\n\nThis package exports standard `inherits` from node.js `util` module in\nnode environment, but also provides alternative browser-friendly\nimplementation through [browser\nfield](https://gist.github.com/shtylman/4339901). Alternative\nimplementation is a literal copy of standard one located in standalone\nmodule to avoid requiring of `util`. It also has a shim for old\nbrowsers with no `Object.create` support.\n\nWhile keeping you sure you are using standard `inherits`\nimplementation in node.js environment, it allows bundlers such as\n[browserify](https://github.com/substack/node-browserify) to not\ninclude full `util` package to your client code if all you need is\njust `inherits` function. It worth, because browser shim for `util`\npackage is large and `inherits` is often the single function you need\nfrom it.\n\nIt's recommended to use this package instead of\n`require('util').inherits` for any code that has chances to be used\nnot only in node.js but in browser too.\n\n## usage\n\n```js\nvar inherits = require('inherits');\n// then use exactly as the standard one\n```\n\n## note on version ~1.0\n\nVersion ~1.0 had completely different motivation and is not compatible\nneither with 2.0 nor with standard node.js `inherits`.\n\nIf you are using version ~1.0 and planning to switch to ~2.0, be\ncareful:\n\n* new version uses `super_` instead of `super` for referencing\n superclass\n* new version overwrites current prototype while old one preserves any\n existing fields on it\n",
49 | "readmeFilename": "README.md",
50 | "homepage": "https://github.com/isaacs/inherits"
51 | }
52 |
--------------------------------------------------------------------------------
/node_modules/tern/node_modules/glob/node_modules/inherits/test.js:
--------------------------------------------------------------------------------
1 | var inherits = require('./inherits.js')
2 | var assert = require('assert')
3 |
4 | function test(c) {
5 | assert(c.constructor === Child)
6 | assert(c.constructor.super_ === Parent)
7 | assert(Object.getPrototypeOf(c) === Child.prototype)
8 | assert(Object.getPrototypeOf(Object.getPrototypeOf(c)) === Parent.prototype)
9 | assert(c instanceof Child)
10 | assert(c instanceof Parent)
11 | }
12 |
13 | function Child() {
14 | Parent.call(this)
15 | test(this)
16 | }
17 |
18 | function Parent() {}
19 |
20 | inherits(Child, Parent)
21 |
22 | var c = new Child
23 | test(c)
24 |
25 | console.log('ok')
26 |
--------------------------------------------------------------------------------
/node_modules/tern/node_modules/glob/node_modules/minimatch/.npmignore:
--------------------------------------------------------------------------------
1 | node_modules
2 |
--------------------------------------------------------------------------------
/node_modules/tern/node_modules/glob/node_modules/minimatch/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright 2009, 2010, 2011 Isaac Z. Schlueter.
2 | All rights reserved.
3 |
4 | Permission is hereby granted, free of charge, to any person
5 | obtaining a copy of this software and associated documentation
6 | files (the "Software"), to deal in the Software without
7 | restriction, including without limitation the rights to use,
8 | copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the
10 | Software is furnished to do so, subject to the following
11 | conditions:
12 |
13 | The above copyright notice and this permission notice shall be
14 | included in all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
18 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 | OTHER DEALINGS IN THE SOFTWARE.
24 |
--------------------------------------------------------------------------------
/node_modules/tern/node_modules/glob/node_modules/minimatch/node_modules/lru-cache/.npmignore:
--------------------------------------------------------------------------------
1 | /node_modules
2 |
--------------------------------------------------------------------------------
/node_modules/tern/node_modules/glob/node_modules/minimatch/node_modules/lru-cache/CONTRIBUTORS:
--------------------------------------------------------------------------------
1 | # Authors, sorted by whether or not they are me
2 | Isaac Z. Schlueter
3 | Brian Cottingham
4 | Carlos Brito Lage
5 | Jesse Dailey
6 | Kevin O'Hara
7 | Marco Rogers
8 | Mark Cavage
9 | Marko Mikulicic
10 | Nathan Rajlich
11 | Satheesh Natesan
12 | Trent Mick
13 | ashleybrener
14 | n4kz
15 |
--------------------------------------------------------------------------------
/node_modules/tern/node_modules/glob/node_modules/minimatch/node_modules/lru-cache/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright 2009, 2010, 2011 Isaac Z. Schlueter.
2 | All rights reserved.
3 |
4 | Permission is hereby granted, free of charge, to any person
5 | obtaining a copy of this software and associated documentation
6 | files (the "Software"), to deal in the Software without
7 | restriction, including without limitation the rights to use,
8 | copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the
10 | Software is furnished to do so, subject to the following
11 | conditions:
12 |
13 | The above copyright notice and this permission notice shall be
14 | included in all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
18 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 | OTHER DEALINGS IN THE SOFTWARE.
24 |
--------------------------------------------------------------------------------
/node_modules/tern/node_modules/glob/node_modules/minimatch/node_modules/lru-cache/README.md:
--------------------------------------------------------------------------------
1 | # lru cache
2 |
3 | A cache object that deletes the least-recently-used items.
4 |
5 | ## Usage:
6 |
7 | ```javascript
8 | var LRU = require("lru-cache")
9 | , options = { max: 500
10 | , length: function (n) { return n * 2 }
11 | , dispose: function (key, n) { n.close() }
12 | , maxAge: 1000 * 60 * 60 }
13 | , cache = LRU(options)
14 | , otherCache = LRU(50) // sets just the max size
15 |
16 | cache.set("key", "value")
17 | cache.get("key") // "value"
18 |
19 | cache.reset() // empty the cache
20 | ```
21 |
22 | If you put more stuff in it, then items will fall out.
23 |
24 | If you try to put an oversized thing in it, then it'll fall out right
25 | away.
26 |
27 | ## Options
28 |
29 | * `max` The maximum size of the cache, checked by applying the length
30 | function to all values in the cache. Not setting this is kind of
31 | silly, since that's the whole purpose of this lib, but it defaults
32 | to `Infinity`.
33 | * `maxAge` Maximum age in ms. Items are not pro-actively pruned out
34 | as they age, but if you try to get an item that is too old, it'll
35 | drop it and return undefined instead of giving it to you.
36 | * `length` Function that is used to calculate the length of stored
37 | items. If you're storing strings or buffers, then you probably want
38 | to do something like `function(n){return n.length}`. The default is
39 | `function(n){return 1}`, which is fine if you want to store `n`
40 | like-sized things.
41 | * `dispose` Function that is called on items when they are dropped
42 | from the cache. This can be handy if you want to close file
43 | descriptors or do other cleanup tasks when items are no longer
44 | accessible. Called with `key, value`. It's called *before*
45 | actually removing the item from the internal cache, so if you want
46 | to immediately put it back in, you'll have to do that in a
47 | `nextTick` or `setTimeout` callback or it won't do anything.
48 | * `stale` By default, if you set a `maxAge`, it'll only actually pull
49 | stale items out of the cache when you `get(key)`. (That is, it's
50 | not pre-emptively doing a `setTimeout` or anything.) If you set
51 | `stale:true`, it'll return the stale value before deleting it. If
52 | you don't set this, then it'll return `undefined` when you try to
53 | get a stale entry, as if it had already been deleted.
54 |
55 | ## API
56 |
57 | * `set(key, value)`
58 | * `get(key) => value`
59 |
60 | Both of these will update the "recently used"-ness of the key.
61 | They do what you think.
62 |
63 | * `peek(key)`
64 |
65 | Returns the key value (or `undefined` if not found) without
66 | updating the "recently used"-ness of the key.
67 |
68 | (If you find yourself using this a lot, you *might* be using the
69 | wrong sort of data structure, but there are some use cases where
70 | it's handy.)
71 |
72 | * `del(key)`
73 |
74 | Deletes a key out of the cache.
75 |
76 | * `reset()`
77 |
78 | Clear the cache entirely, throwing away all values.
79 |
80 | * `has(key)`
81 |
82 | Check if a key is in the cache, without updating the recent-ness
83 | or deleting it for being stale.
84 |
85 | * `forEach(function(value,key,cache), [thisp])`
86 |
87 | Just like `Array.prototype.forEach`. Iterates over all the keys
88 | in the cache, in order of recent-ness. (Ie, more recently used
89 | items are iterated over first.)
90 |
91 | * `keys()`
92 |
93 | Return an array of the keys in the cache.
94 |
95 | * `values()`
96 |
97 | Return an array of the values in the cache.
98 |
--------------------------------------------------------------------------------
/node_modules/tern/node_modules/glob/node_modules/minimatch/node_modules/lru-cache/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "lru-cache",
3 | "description": "A cache object that deletes the least-recently-used items.",
4 | "version": "2.5.0",
5 | "author": {
6 | "name": "Isaac Z. Schlueter",
7 | "email": "i@izs.me"
8 | },
9 | "scripts": {
10 | "test": "tap test --gc"
11 | },
12 | "main": "lib/lru-cache.js",
13 | "repository": {
14 | "type": "git",
15 | "url": "git://github.com/isaacs/node-lru-cache.git"
16 | },
17 | "devDependencies": {
18 | "tap": "",
19 | "weak": ""
20 | },
21 | "license": {
22 | "type": "MIT",
23 | "url": "http://github.com/isaacs/node-lru-cache/raw/master/LICENSE"
24 | },
25 | "bugs": {
26 | "url": "https://github.com/isaacs/node-lru-cache/issues"
27 | },
28 | "homepage": "https://github.com/isaacs/node-lru-cache",
29 | "_id": "lru-cache@2.5.0",
30 | "dist": {
31 | "shasum": "d82388ae9c960becbea0c73bb9eb79b6c6ce9aeb",
32 | "tarball": "http://registry.npmjs.org/lru-cache/-/lru-cache-2.5.0.tgz"
33 | },
34 | "_from": "lru-cache@>=2.0.0-0 <3.0.0-0",
35 | "_npmVersion": "1.3.15",
36 | "_npmUser": {
37 | "name": "isaacs",
38 | "email": "i@izs.me"
39 | },
40 | "maintainers": [
41 | {
42 | "name": "isaacs",
43 | "email": "i@izs.me"
44 | }
45 | ],
46 | "directories": {},
47 | "_shasum": "d82388ae9c960becbea0c73bb9eb79b6c6ce9aeb",
48 | "_resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-2.5.0.tgz",
49 | "readme": "# lru cache\n\nA cache object that deletes the least-recently-used items.\n\n## Usage:\n\n```javascript\nvar LRU = require(\"lru-cache\")\n , options = { max: 500\n , length: function (n) { return n * 2 }\n , dispose: function (key, n) { n.close() }\n , maxAge: 1000 * 60 * 60 }\n , cache = LRU(options)\n , otherCache = LRU(50) // sets just the max size\n\ncache.set(\"key\", \"value\")\ncache.get(\"key\") // \"value\"\n\ncache.reset() // empty the cache\n```\n\nIf you put more stuff in it, then items will fall out.\n\nIf you try to put an oversized thing in it, then it'll fall out right\naway.\n\n## Options\n\n* `max` The maximum size of the cache, checked by applying the length\n function to all values in the cache. Not setting this is kind of\n silly, since that's the whole purpose of this lib, but it defaults\n to `Infinity`.\n* `maxAge` Maximum age in ms. Items are not pro-actively pruned out\n as they age, but if you try to get an item that is too old, it'll\n drop it and return undefined instead of giving it to you.\n* `length` Function that is used to calculate the length of stored\n items. If you're storing strings or buffers, then you probably want\n to do something like `function(n){return n.length}`. The default is\n `function(n){return 1}`, which is fine if you want to store `n`\n like-sized things.\n* `dispose` Function that is called on items when they are dropped\n from the cache. This can be handy if you want to close file\n descriptors or do other cleanup tasks when items are no longer\n accessible. Called with `key, value`. It's called *before*\n actually removing the item from the internal cache, so if you want\n to immediately put it back in, you'll have to do that in a\n `nextTick` or `setTimeout` callback or it won't do anything.\n* `stale` By default, if you set a `maxAge`, it'll only actually pull\n stale items out of the cache when you `get(key)`. (That is, it's\n not pre-emptively doing a `setTimeout` or anything.) If you set\n `stale:true`, it'll return the stale value before deleting it. If\n you don't set this, then it'll return `undefined` when you try to\n get a stale entry, as if it had already been deleted.\n\n## API\n\n* `set(key, value)`\n* `get(key) => value`\n\n Both of these will update the \"recently used\"-ness of the key.\n They do what you think.\n\n* `peek(key)`\n\n Returns the key value (or `undefined` if not found) without\n updating the \"recently used\"-ness of the key.\n\n (If you find yourself using this a lot, you *might* be using the\n wrong sort of data structure, but there are some use cases where\n it's handy.)\n\n* `del(key)`\n\n Deletes a key out of the cache.\n\n* `reset()`\n\n Clear the cache entirely, throwing away all values.\n\n* `has(key)`\n\n Check if a key is in the cache, without updating the recent-ness\n or deleting it for being stale.\n\n* `forEach(function(value,key,cache), [thisp])`\n\n Just like `Array.prototype.forEach`. Iterates over all the keys\n in the cache, in order of recent-ness. (Ie, more recently used\n items are iterated over first.)\n\n* `keys()`\n\n Return an array of the keys in the cache.\n\n* `values()`\n\n Return an array of the values in the cache.\n",
50 | "readmeFilename": "README.md"
51 | }
52 |
--------------------------------------------------------------------------------
/node_modules/tern/node_modules/glob/node_modules/minimatch/node_modules/lru-cache/test/foreach.js:
--------------------------------------------------------------------------------
1 | var test = require('tap').test
2 | var LRU = require('../')
3 |
4 | test('forEach', function (t) {
5 | var l = new LRU(5)
6 | for (var i = 0; i < 10; i ++) {
7 | l.set(i.toString(), i.toString(2))
8 | }
9 |
10 | var i = 9
11 | l.forEach(function (val, key, cache) {
12 | t.equal(cache, l)
13 | t.equal(key, i.toString())
14 | t.equal(val, i.toString(2))
15 | i -= 1
16 | })
17 |
18 | // get in order of most recently used
19 | l.get(6)
20 | l.get(8)
21 |
22 | var order = [ 8, 6, 9, 7, 5 ]
23 | var i = 0
24 |
25 | l.forEach(function (val, key, cache) {
26 | var j = order[i ++]
27 | t.equal(cache, l)
28 | t.equal(key, j.toString())
29 | t.equal(val, j.toString(2))
30 | })
31 |
32 | t.end()
33 | })
34 |
35 | test('keys() and values()', function (t) {
36 | var l = new LRU(5)
37 | for (var i = 0; i < 10; i ++) {
38 | l.set(i.toString(), i.toString(2))
39 | }
40 |
41 | t.similar(l.keys(), ['9', '8', '7', '6', '5'])
42 | t.similar(l.values(), ['1001', '1000', '111', '110', '101'])
43 |
44 | // get in order of most recently used
45 | l.get(6)
46 | l.get(8)
47 |
48 | t.similar(l.keys(), ['8', '6', '9', '7', '5'])
49 | t.similar(l.values(), ['1000', '110', '1001', '111', '101'])
50 |
51 | t.end()
52 | })
53 |
--------------------------------------------------------------------------------
/node_modules/tern/node_modules/glob/node_modules/minimatch/node_modules/lru-cache/test/memory-leak.js:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node --expose_gc
2 |
3 | var weak = require('weak');
4 | var test = require('tap').test
5 | var LRU = require('../')
6 | var l = new LRU({ max: 10 })
7 | var refs = 0
8 | function X() {
9 | refs ++
10 | weak(this, deref)
11 | }
12 |
13 | function deref() {
14 | refs --
15 | }
16 |
17 | test('no leaks', function (t) {
18 | // fill up the cache
19 | for (var i = 0; i < 100; i++) {
20 | l.set(i, new X);
21 | // throw some gets in there, too.
22 | if (i % 2 === 0)
23 | l.get(i / 2)
24 | }
25 |
26 | gc()
27 |
28 | var start = process.memoryUsage()
29 |
30 | // capture the memory
31 | var startRefs = refs
32 |
33 | // do it again, but more
34 | for (var i = 0; i < 10000; i++) {
35 | l.set(i, new X);
36 | // throw some gets in there, too.
37 | if (i % 2 === 0)
38 | l.get(i / 2)
39 | }
40 |
41 | gc()
42 |
43 | var end = process.memoryUsage()
44 | t.equal(refs, startRefs, 'no leaky refs')
45 |
46 | console.error('start: %j\n' +
47 | 'end: %j', start, end);
48 | t.pass();
49 | t.end();
50 | })
51 |
--------------------------------------------------------------------------------
/node_modules/tern/node_modules/glob/node_modules/minimatch/node_modules/sigmund/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) Isaac Z. Schlueter ("Author")
2 | All rights reserved.
3 |
4 | The BSD License
5 |
6 | Redistribution and use in source and binary forms, with or without
7 | modification, are permitted provided that the following conditions
8 | are met:
9 |
10 | 1. Redistributions of source code must retain the above copyright
11 | notice, this list of conditions and the following disclaimer.
12 |
13 | 2. Redistributions in binary form must reproduce the above copyright
14 | notice, this list of conditions and the following disclaimer in the
15 | documentation and/or other materials provided with the distribution.
16 |
17 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
20 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS
21 | BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
24 | BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
25 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
26 | OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
27 | IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 |
--------------------------------------------------------------------------------
/node_modules/tern/node_modules/glob/node_modules/minimatch/node_modules/sigmund/README.md:
--------------------------------------------------------------------------------
1 | # sigmund
2 |
3 | Quick and dirty signatures for Objects.
4 |
5 | This is like a much faster `deepEquals` comparison, which returns a
6 | string key suitable for caches and the like.
7 |
8 | ## Usage
9 |
10 | ```javascript
11 | function doSomething (someObj) {
12 | var key = sigmund(someObj, maxDepth) // max depth defaults to 10
13 | var cached = cache.get(key)
14 | if (cached) return cached)
15 |
16 | var result = expensiveCalculation(someObj)
17 | cache.set(key, result)
18 | return result
19 | }
20 | ```
21 |
22 | The resulting key will be as unique and reproducible as calling
23 | `JSON.stringify` or `util.inspect` on the object, but is much faster.
24 | In order to achieve this speed, some differences are glossed over.
25 | For example, the object `{0:'foo'}` will be treated identically to the
26 | array `['foo']`.
27 |
28 | Also, just as there is no way to summon the soul from the scribblings
29 | of a cocain-addled psychoanalyst, there is no way to revive the object
30 | from the signature string that sigmund gives you. In fact, it's
31 | barely even readable.
32 |
33 | As with `sys.inspect` and `JSON.stringify`, larger objects will
34 | produce larger signature strings.
35 |
36 | Because sigmund is a bit less strict than the more thorough
37 | alternatives, the strings will be shorter, and also there is a
38 | slightly higher chance for collisions. For example, these objects
39 | have the same signature:
40 |
41 | var obj1 = {a:'b',c:/def/,g:['h','i',{j:'',k:'l'}]}
42 | var obj2 = {a:'b',c:'/def/',g:['h','i','{jkl']}
43 |
44 | Like a good Freudian, sigmund is most effective when you already have
45 | some understanding of what you're looking for. It can help you help
46 | yourself, but you must be willing to do some work as well.
47 |
48 | Cycles are handled, and cyclical objects are silently omitted (though
49 | the key is included in the signature output.)
50 |
51 | The second argument is the maximum depth, which defaults to 10,
52 | because that is the maximum object traversal depth covered by most
53 | insurance carriers.
54 |
--------------------------------------------------------------------------------
/node_modules/tern/node_modules/glob/node_modules/minimatch/node_modules/sigmund/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "sigmund",
3 | "version": "1.0.0",
4 | "description": "Quick and dirty signatures for Objects.",
5 | "main": "sigmund.js",
6 | "directories": {
7 | "test": "test"
8 | },
9 | "dependencies": {},
10 | "devDependencies": {
11 | "tap": "~0.3.0"
12 | },
13 | "scripts": {
14 | "test": "tap test/*.js",
15 | "bench": "node bench.js"
16 | },
17 | "repository": {
18 | "type": "git",
19 | "url": "git://github.com/isaacs/sigmund"
20 | },
21 | "keywords": [
22 | "object",
23 | "signature",
24 | "key",
25 | "data",
26 | "psychoanalysis"
27 | ],
28 | "author": {
29 | "name": "Isaac Z. Schlueter",
30 | "email": "i@izs.me",
31 | "url": "http://blog.izs.me/"
32 | },
33 | "license": "BSD",
34 | "readme": "# sigmund\n\nQuick and dirty signatures for Objects.\n\nThis is like a much faster `deepEquals` comparison, which returns a\nstring key suitable for caches and the like.\n\n## Usage\n\n```javascript\nfunction doSomething (someObj) {\n var key = sigmund(someObj, maxDepth) // max depth defaults to 10\n var cached = cache.get(key)\n if (cached) return cached)\n\n var result = expensiveCalculation(someObj)\n cache.set(key, result)\n return result\n}\n```\n\nThe resulting key will be as unique and reproducible as calling\n`JSON.stringify` or `util.inspect` on the object, but is much faster.\nIn order to achieve this speed, some differences are glossed over.\nFor example, the object `{0:'foo'}` will be treated identically to the\narray `['foo']`.\n\nAlso, just as there is no way to summon the soul from the scribblings\nof a cocain-addled psychoanalyst, there is no way to revive the object\nfrom the signature string that sigmund gives you. In fact, it's\nbarely even readable.\n\nAs with `sys.inspect` and `JSON.stringify`, larger objects will\nproduce larger signature strings.\n\nBecause sigmund is a bit less strict than the more thorough\nalternatives, the strings will be shorter, and also there is a\nslightly higher chance for collisions. For example, these objects\nhave the same signature:\n\n var obj1 = {a:'b',c:/def/,g:['h','i',{j:'',k:'l'}]}\n var obj2 = {a:'b',c:'/def/',g:['h','i','{jkl']}\n\nLike a good Freudian, sigmund is most effective when you already have\nsome understanding of what you're looking for. It can help you help\nyourself, but you must be willing to do some work as well.\n\nCycles are handled, and cyclical objects are silently omitted (though\nthe key is included in the signature output.)\n\nThe second argument is the maximum depth, which defaults to 10,\nbecause that is the maximum object traversal depth covered by most\ninsurance carriers.\n",
35 | "_id": "sigmund@1.0.0",
36 | "dist": {
37 | "shasum": "66a2b3a749ae8b5fb89efd4fcc01dc94fbe02296",
38 | "tarball": "http://registry.npmjs.org/sigmund/-/sigmund-1.0.0.tgz"
39 | },
40 | "_npmVersion": "1.1.48",
41 | "_npmUser": {
42 | "name": "isaacs",
43 | "email": "i@izs.me"
44 | },
45 | "maintainers": [
46 | {
47 | "name": "isaacs",
48 | "email": "i@izs.me"
49 | }
50 | ],
51 | "_shasum": "66a2b3a749ae8b5fb89efd4fcc01dc94fbe02296",
52 | "_from": "sigmund@>=1.0.0-0 <1.1.0-0",
53 | "_resolved": "https://registry.npmjs.org/sigmund/-/sigmund-1.0.0.tgz",
54 | "bugs": {
55 | "url": "https://github.com/isaacs/sigmund/issues"
56 | },
57 | "homepage": "https://github.com/isaacs/sigmund"
58 | }
59 |
--------------------------------------------------------------------------------
/node_modules/tern/node_modules/glob/node_modules/minimatch/node_modules/sigmund/sigmund.js:
--------------------------------------------------------------------------------
1 | module.exports = sigmund
2 | function sigmund (subject, maxSessions) {
3 | maxSessions = maxSessions || 10;
4 | var notes = [];
5 | var analysis = '';
6 | var RE = RegExp;
7 |
8 | function psychoAnalyze (subject, session) {
9 | if (session > maxSessions) return;
10 |
11 | if (typeof subject === 'function' ||
12 | typeof subject === 'undefined') {
13 | return;
14 | }
15 |
16 | if (typeof subject !== 'object' || !subject ||
17 | (subject instanceof RE)) {
18 | analysis += subject;
19 | return;
20 | }
21 |
22 | if (notes.indexOf(subject) !== -1 || session === maxSessions) return;
23 |
24 | notes.push(subject);
25 | analysis += '{';
26 | Object.keys(subject).forEach(function (issue, _, __) {
27 | // pseudo-private values. skip those.
28 | if (issue.charAt(0) === '_') return;
29 | var to = typeof subject[issue];
30 | if (to === 'function' || to === 'undefined') return;
31 | analysis += issue;
32 | psychoAnalyze(subject[issue], session + 1);
33 | });
34 | }
35 | psychoAnalyze(subject, 0);
36 | return analysis;
37 | }
38 |
39 | // vim: set softtabstop=4 shiftwidth=4:
40 |
--------------------------------------------------------------------------------
/node_modules/tern/node_modules/glob/node_modules/minimatch/node_modules/sigmund/test/basic.js:
--------------------------------------------------------------------------------
1 | var test = require('tap').test
2 | var sigmund = require('../sigmund.js')
3 |
4 |
5 | // occasionally there are duplicates
6 | // that's an acceptable edge-case. JSON.stringify and util.inspect
7 | // have some collision potential as well, though less, and collision
8 | // detection is expensive.
9 | var hash = '{abc/def/g{0h1i2{jkl'
10 | var obj1 = {a:'b',c:/def/,g:['h','i',{j:'',k:'l'}]}
11 | var obj2 = {a:'b',c:'/def/',g:['h','i','{jkl']}
12 |
13 | var obj3 = JSON.parse(JSON.stringify(obj1))
14 | obj3.c = /def/
15 | obj3.g[2].cycle = obj3
16 | var cycleHash = '{abc/def/g{0h1i2{jklcycle'
17 |
18 | test('basic', function (t) {
19 | t.equal(sigmund(obj1), hash)
20 | t.equal(sigmund(obj2), hash)
21 | t.equal(sigmund(obj3), cycleHash)
22 | t.end()
23 | })
24 |
25 |
--------------------------------------------------------------------------------
/node_modules/tern/node_modules/glob/node_modules/minimatch/test/brace-expand.js:
--------------------------------------------------------------------------------
1 | var tap = require("tap")
2 | , minimatch = require("../")
3 |
4 | tap.test("brace expansion", function (t) {
5 | // [ pattern, [expanded] ]
6 | ; [ [ "a{b,c{d,e},{f,g}h}x{y,z}"
7 | , [ "abxy"
8 | , "abxz"
9 | , "acdxy"
10 | , "acdxz"
11 | , "acexy"
12 | , "acexz"
13 | , "afhxy"
14 | , "afhxz"
15 | , "aghxy"
16 | , "aghxz" ] ]
17 | , [ "a{1..5}b"
18 | , [ "a1b"
19 | , "a2b"
20 | , "a3b"
21 | , "a4b"
22 | , "a5b" ] ]
23 | , [ "a{b}c", ["a{b}c"] ]
24 | ].forEach(function (tc) {
25 | var p = tc[0]
26 | , expect = tc[1]
27 | t.equivalent(minimatch.braceExpand(p), expect, p)
28 | })
29 | console.error("ending")
30 | t.end()
31 | })
32 |
33 |
34 |
--------------------------------------------------------------------------------
/node_modules/tern/node_modules/glob/node_modules/minimatch/test/caching.js:
--------------------------------------------------------------------------------
1 | var Minimatch = require("../minimatch.js").Minimatch
2 | var tap = require("tap")
3 | tap.test("cache test", function (t) {
4 | var mm1 = new Minimatch("a?b")
5 | var mm2 = new Minimatch("a?b")
6 | t.equal(mm1, mm2, "should get the same object")
7 | // the lru should drop it after 100 entries
8 | for (var i = 0; i < 100; i ++) {
9 | new Minimatch("a"+i)
10 | }
11 | mm2 = new Minimatch("a?b")
12 | t.notEqual(mm1, mm2, "cache should have dropped")
13 | t.end()
14 | })
15 |
--------------------------------------------------------------------------------
/node_modules/tern/node_modules/glob/node_modules/minimatch/test/extglob-ending-with-state-char.js:
--------------------------------------------------------------------------------
1 | var test = require('tap').test
2 | var minimatch = require('../')
3 |
4 | test('extglob ending with statechar', function(t) {
5 | t.notOk(minimatch('ax', 'a?(b*)'))
6 | t.ok(minimatch('ax', '?(a*|b)'))
7 | t.end()
8 | })
9 |
--------------------------------------------------------------------------------
/node_modules/tern/node_modules/glob/test/bash-comparison.js:
--------------------------------------------------------------------------------
1 | // basic test
2 | // show that it does the same thing by default as the shell.
3 | var tap = require("tap")
4 | , child_process = require("child_process")
5 | , bashResults = require("./bash-results.json")
6 | , globs = Object.keys(bashResults)
7 | , glob = require("../")
8 | , path = require("path")
9 |
10 | // run from the root of the project
11 | // this is usually where you're at anyway, but be sure.
12 | process.chdir(path.resolve(__dirname, ".."))
13 |
14 | function alphasort (a, b) {
15 | a = a.toLowerCase()
16 | b = b.toLowerCase()
17 | return a > b ? 1 : a < b ? -1 : 0
18 | }
19 |
20 | globs.forEach(function (pattern) {
21 | var expect = bashResults[pattern]
22 | // anything regarding the symlink thing will fail on windows, so just skip it
23 | if (process.platform === "win32" &&
24 | expect.some(function (m) {
25 | return /\/symlink\//.test(m)
26 | }))
27 | return
28 |
29 | tap.test(pattern, function (t) {
30 | glob(pattern, function (er, matches) {
31 | if (er)
32 | throw er
33 |
34 | // sort and unmark, just to match the shell results
35 | matches = cleanResults(matches)
36 |
37 | t.deepEqual(matches, expect, pattern)
38 | t.end()
39 | })
40 | })
41 |
42 | tap.test(pattern + " sync", function (t) {
43 | var matches = cleanResults(glob.sync(pattern))
44 |
45 | t.deepEqual(matches, expect, "should match shell")
46 | t.end()
47 | })
48 | })
49 |
50 | function cleanResults (m) {
51 | // normalize discrepancies in ordering, duplication,
52 | // and ending slashes.
53 | return m.map(function (m) {
54 | return m.replace(/\/+/g, "/").replace(/\/$/, "")
55 | }).sort(alphasort).reduce(function (set, f) {
56 | if (f !== set[set.length - 1]) set.push(f)
57 | return set
58 | }, []).sort(alphasort).map(function (f) {
59 | // de-windows
60 | return (process.platform !== 'win32') ? f
61 | : f.replace(/^[a-zA-Z]:[\/\\]+/, '/').replace(/[\\\/]+/g, '/')
62 | })
63 | }
64 |
--------------------------------------------------------------------------------
/node_modules/tern/node_modules/glob/test/cwd-test.js:
--------------------------------------------------------------------------------
1 | var tap = require("tap")
2 |
3 | var origCwd = process.cwd()
4 | process.chdir(__dirname)
5 |
6 | tap.test("changing cwd and searching for **/d", function (t) {
7 | var glob = require('../')
8 | var path = require('path')
9 | t.test('.', function (t) {
10 | glob('**/d', function (er, matches) {
11 | t.ifError(er)
12 | t.like(matches, [ 'a/b/c/d', 'a/c/d' ])
13 | t.end()
14 | })
15 | })
16 |
17 | t.test('a', function (t) {
18 | glob('**/d', {cwd:path.resolve('a')}, function (er, matches) {
19 | t.ifError(er)
20 | t.like(matches, [ 'b/c/d', 'c/d' ])
21 | t.end()
22 | })
23 | })
24 |
25 | t.test('a/b', function (t) {
26 | glob('**/d', {cwd:path.resolve('a/b')}, function (er, matches) {
27 | t.ifError(er)
28 | t.like(matches, [ 'c/d' ])
29 | t.end()
30 | })
31 | })
32 |
33 | t.test('a/b/', function (t) {
34 | glob('**/d', {cwd:path.resolve('a/b/')}, function (er, matches) {
35 | t.ifError(er)
36 | t.like(matches, [ 'c/d' ])
37 | t.end()
38 | })
39 | })
40 |
41 | t.test('.', function (t) {
42 | glob('**/d', {cwd: process.cwd()}, function (er, matches) {
43 | t.ifError(er)
44 | t.like(matches, [ 'a/b/c/d', 'a/c/d' ])
45 | t.end()
46 | })
47 | })
48 |
49 | t.test('cd -', function (t) {
50 | process.chdir(origCwd)
51 | t.end()
52 | })
53 |
54 | t.end()
55 | })
56 |
--------------------------------------------------------------------------------
/node_modules/tern/node_modules/glob/test/globstar-match.js:
--------------------------------------------------------------------------------
1 | var Glob = require("../glob.js").Glob
2 | var test = require('tap').test
3 |
4 | test('globstar should not have dupe matches', function(t) {
5 | var pattern = 'a/**/[gh]'
6 | var g = new Glob(pattern, { cwd: __dirname })
7 | var matches = []
8 | g.on('match', function(m) {
9 | console.error('match %j', m)
10 | matches.push(m)
11 | })
12 | g.on('end', function(set) {
13 | console.error('set', set)
14 | matches = matches.sort()
15 | set = set.sort()
16 | t.same(matches, set, 'should have same set of matches')
17 | t.end()
18 | })
19 | })
20 |
--------------------------------------------------------------------------------
/node_modules/tern/node_modules/glob/test/mark.js:
--------------------------------------------------------------------------------
1 | var test = require("tap").test
2 | var glob = require('../')
3 | process.chdir(__dirname)
4 |
5 | // expose timing issues
6 | var lag = 5
7 | glob.Glob.prototype._stat = function(o) { return function(f, cb) {
8 | var args = arguments
9 | setTimeout(function() {
10 | o.call(this, f, cb)
11 | }.bind(this), lag += 5)
12 | }}(glob.Glob.prototype._stat)
13 |
14 |
15 | test("mark, with **", function (t) {
16 | glob("a/*b*/**", {mark: true}, function (er, results) {
17 | if (er)
18 | throw er
19 | var expect =
20 | [ 'a/abcdef/',
21 | 'a/abcdef/g/',
22 | 'a/abcdef/g/h',
23 | 'a/abcfed/',
24 | 'a/abcfed/g/',
25 | 'a/abcfed/g/h',
26 | 'a/b/',
27 | 'a/b/c/',
28 | 'a/b/c/d',
29 | 'a/bc/',
30 | 'a/bc/e/',
31 | 'a/bc/e/f',
32 | 'a/cb/',
33 | 'a/cb/e/',
34 | 'a/cb/e/f' ]
35 |
36 | t.same(results, expect)
37 | t.end()
38 | })
39 | })
40 |
41 | test("mark, no / on pattern", function (t) {
42 | glob("a/*", {mark: true}, function (er, results) {
43 | if (er)
44 | throw er
45 | var expect = [ 'a/abcdef/',
46 | 'a/abcfed/',
47 | 'a/b/',
48 | 'a/bc/',
49 | 'a/c/',
50 | 'a/cb/' ]
51 |
52 | if (process.platform !== "win32")
53 | expect.push('a/symlink/')
54 |
55 | t.same(results, expect)
56 | t.end()
57 | }).on('match', function(m) {
58 | t.similar(m, /\/$/)
59 | })
60 | })
61 |
62 | test("mark=false, no / on pattern", function (t) {
63 | glob("a/*", function (er, results) {
64 | if (er)
65 | throw er
66 | var expect = [ 'a/abcdef',
67 | 'a/abcfed',
68 | 'a/b',
69 | 'a/bc',
70 | 'a/c',
71 | 'a/cb' ]
72 |
73 | if (process.platform !== "win32")
74 | expect.push('a/symlink')
75 | t.same(results, expect)
76 | t.end()
77 | }).on('match', function(m) {
78 | t.similar(m, /[^\/]$/)
79 | })
80 | })
81 |
82 | test("mark=true, / on pattern", function (t) {
83 | glob("a/*/", {mark: true}, function (er, results) {
84 | if (er)
85 | throw er
86 | var expect = [ 'a/abcdef/',
87 | 'a/abcfed/',
88 | 'a/b/',
89 | 'a/bc/',
90 | 'a/c/',
91 | 'a/cb/' ]
92 | if (process.platform !== "win32")
93 | expect.push('a/symlink/')
94 | t.same(results, expect)
95 | t.end()
96 | }).on('match', function(m) {
97 | t.similar(m, /\/$/)
98 | })
99 | })
100 |
101 | test("mark=false, / on pattern", function (t) {
102 | glob("a/*/", function (er, results) {
103 | if (er)
104 | throw er
105 | var expect = [ 'a/abcdef/',
106 | 'a/abcfed/',
107 | 'a/b/',
108 | 'a/bc/',
109 | 'a/c/',
110 | 'a/cb/' ]
111 | if (process.platform !== "win32")
112 | expect.push('a/symlink/')
113 | t.same(results, expect)
114 | t.end()
115 | }).on('match', function(m) {
116 | t.similar(m, /\/$/)
117 | })
118 | })
119 |
--------------------------------------------------------------------------------
/node_modules/tern/node_modules/glob/test/new-glob-optional-options.js:
--------------------------------------------------------------------------------
1 | var Glob = require('../glob.js').Glob;
2 | var test = require('tap').test;
3 |
4 | test('new glob, with cb, and no options', function (t) {
5 | new Glob(__filename, function(er, results) {
6 | if (er) throw er;
7 | t.same(results, [__filename]);
8 | t.end();
9 | });
10 | });
11 |
--------------------------------------------------------------------------------
/node_modules/tern/node_modules/glob/test/nocase-nomagic.js:
--------------------------------------------------------------------------------
1 | var fs = require('fs');
2 | var test = require('tap').test;
3 | var glob = require('../');
4 |
5 | test('mock fs', function(t) {
6 | var stat = fs.stat
7 | var statSync = fs.statSync
8 | var readdir = fs.readdir
9 | var readdirSync = fs.readdirSync
10 |
11 | function fakeStat(path) {
12 | var ret
13 | switch (path.toLowerCase()) {
14 | case '/tmp': case '/tmp/':
15 | ret = { isDirectory: function() { return true } }
16 | break
17 | case '/tmp/a':
18 | ret = { isDirectory: function() { return false } }
19 | break
20 | }
21 | return ret
22 | }
23 |
24 | fs.stat = function(path, cb) {
25 | var f = fakeStat(path);
26 | if (f) {
27 | process.nextTick(function() {
28 | cb(null, f)
29 | })
30 | } else {
31 | stat.call(fs, path, cb)
32 | }
33 | }
34 |
35 | fs.statSync = function(path) {
36 | return fakeStat(path) || statSync.call(fs, path)
37 | }
38 |
39 | function fakeReaddir(path) {
40 | var ret
41 | switch (path.toLowerCase()) {
42 | case '/tmp': case '/tmp/':
43 | ret = [ 'a', 'A' ]
44 | break
45 | case '/':
46 | ret = ['tmp', 'tMp', 'tMP', 'TMP']
47 | }
48 | return ret
49 | }
50 |
51 | fs.readdir = function(path, cb) {
52 | var f = fakeReaddir(path)
53 | if (f)
54 | process.nextTick(function() {
55 | cb(null, f)
56 | })
57 | else
58 | readdir.call(fs, path, cb)
59 | }
60 |
61 | fs.readdirSync = function(path) {
62 | return fakeReaddir(path) || readdirSync.call(fs, path)
63 | }
64 |
65 | t.pass('mocked')
66 | t.end()
67 | })
68 |
69 | test('nocase, nomagic', function(t) {
70 | var n = 2
71 | var want = [ '/TMP/A',
72 | '/TMP/a',
73 | '/tMP/A',
74 | '/tMP/a',
75 | '/tMp/A',
76 | '/tMp/a',
77 | '/tmp/A',
78 | '/tmp/a' ]
79 | glob('/tmp/a', { nocase: true }, function(er, res) {
80 | if (er)
81 | throw er
82 | t.same(res.sort(), want)
83 | if (--n === 0) t.end()
84 | })
85 | glob('/tmp/A', { nocase: true }, function(er, res) {
86 | if (er)
87 | throw er
88 | t.same(res.sort(), want)
89 | if (--n === 0) t.end()
90 | })
91 | })
92 |
93 | test('nocase, with some magic', function(t) {
94 | t.plan(2)
95 | var want = [ '/TMP/A',
96 | '/TMP/a',
97 | '/tMP/A',
98 | '/tMP/a',
99 | '/tMp/A',
100 | '/tMp/a',
101 | '/tmp/A',
102 | '/tmp/a' ]
103 | glob('/tmp/*', { nocase: true }, function(er, res) {
104 | if (er)
105 | throw er
106 | t.same(res.sort(), want)
107 | })
108 | glob('/tmp/*', { nocase: true }, function(er, res) {
109 | if (er)
110 | throw er
111 | t.same(res.sort(), want)
112 | })
113 | })
114 |
--------------------------------------------------------------------------------
/node_modules/tern/node_modules/glob/test/pause-resume.js:
--------------------------------------------------------------------------------
1 | // show that no match events happen while paused.
2 | var tap = require("tap")
3 | , child_process = require("child_process")
4 | // just some gnarly pattern with lots of matches
5 | , pattern = "test/a/!(symlink)/**"
6 | , bashResults = require("./bash-results.json")
7 | , patterns = Object.keys(bashResults)
8 | , glob = require("../")
9 | , Glob = glob.Glob
10 | , path = require("path")
11 |
12 | // run from the root of the project
13 | // this is usually where you're at anyway, but be sure.
14 | process.chdir(path.resolve(__dirname, ".."))
15 |
16 | function alphasort (a, b) {
17 | a = a.toLowerCase()
18 | b = b.toLowerCase()
19 | return a > b ? 1 : a < b ? -1 : 0
20 | }
21 |
22 | function cleanResults (m) {
23 | // normalize discrepancies in ordering, duplication,
24 | // and ending slashes.
25 | return m.map(function (m) {
26 | return m.replace(/\/+/g, "/").replace(/\/$/, "")
27 | }).sort(alphasort).reduce(function (set, f) {
28 | if (f !== set[set.length - 1]) set.push(f)
29 | return set
30 | }, []).sort(alphasort).map(function (f) {
31 | // de-windows
32 | return (process.platform !== 'win32') ? f
33 | : f.replace(/^[a-zA-Z]:\\\\/, '/').replace(/\\/g, '/')
34 | })
35 | }
36 |
37 | var globResults = []
38 | tap.test("use a Glob object, and pause/resume it", function (t) {
39 | var g = new Glob(pattern)
40 | , paused = false
41 | , res = []
42 | , expect = bashResults[pattern]
43 |
44 | g.on("pause", function () {
45 | console.error("pause")
46 | })
47 |
48 | g.on("resume", function () {
49 | console.error("resume")
50 | })
51 |
52 | g.on("match", function (m) {
53 | t.notOk(g.paused, "must not be paused")
54 | globResults.push(m)
55 | g.pause()
56 | t.ok(g.paused, "must be paused")
57 | setTimeout(g.resume.bind(g), 10)
58 | })
59 |
60 | g.on("end", function (matches) {
61 | t.pass("reached glob end")
62 | globResults = cleanResults(globResults)
63 | matches = cleanResults(matches)
64 | t.deepEqual(matches, globResults,
65 | "end event matches should be the same as match events")
66 |
67 | t.deepEqual(matches, expect,
68 | "glob matches should be the same as bash results")
69 |
70 | t.end()
71 | })
72 | })
73 |
74 |
--------------------------------------------------------------------------------
/node_modules/tern/node_modules/glob/test/readme-issue.js:
--------------------------------------------------------------------------------
1 | var test = require("tap").test
2 | var glob = require("../")
3 |
4 | var mkdirp = require("mkdirp")
5 | var fs = require("fs")
6 | var rimraf = require("rimraf")
7 | var dir = __dirname + "/package"
8 |
9 | test("setup", function (t) {
10 | mkdirp.sync(dir)
11 | fs.writeFileSync(dir + "/package.json", "{}", "ascii")
12 | fs.writeFileSync(dir + "/README", "x", "ascii")
13 | t.pass("setup done")
14 | t.end()
15 | })
16 |
17 | test("glob", function (t) {
18 | var opt = {
19 | cwd: dir,
20 | nocase: true,
21 | mark: true
22 | }
23 |
24 | glob("README?(.*)", opt, function (er, files) {
25 | if (er)
26 | throw er
27 | t.same(files, ["README"])
28 | t.end()
29 | })
30 | })
31 |
32 | test("cleanup", function (t) {
33 | rimraf.sync(dir)
34 | t.pass("clean")
35 | t.end()
36 | })
37 |
--------------------------------------------------------------------------------
/node_modules/tern/node_modules/glob/test/root-nomount.js:
--------------------------------------------------------------------------------
1 | var tap = require("tap")
2 |
3 | var origCwd = process.cwd()
4 | process.chdir(__dirname)
5 |
6 | tap.test("changing root and searching for /b*/**", function (t) {
7 | var glob = require('../')
8 | var path = require('path')
9 | t.test('.', function (t) {
10 | glob('/b*/**', { globDebug: true, root: '.', nomount: true }, function (er, matches) {
11 | t.ifError(er)
12 | t.like(matches, [])
13 | t.end()
14 | })
15 | })
16 |
17 | t.test('a', function (t) {
18 | glob('/b*/**', { globDebug: true, root: path.resolve('a'), nomount: true }, function (er, matches) {
19 | t.ifError(er)
20 | t.like(matches, [ '/b', '/b/c', '/b/c/d', '/bc', '/bc/e', '/bc/e/f' ])
21 | t.end()
22 | })
23 | })
24 |
25 | t.test('root=a, cwd=a/b', function (t) {
26 | glob('/b*/**', { globDebug: true, root: 'a', cwd: path.resolve('a/b'), nomount: true }, function (er, matches) {
27 | t.ifError(er)
28 | t.like(matches, [ '/b', '/b/c', '/b/c/d', '/bc', '/bc/e', '/bc/e/f' ])
29 | t.end()
30 | })
31 | })
32 |
33 | t.test('cd -', function (t) {
34 | process.chdir(origCwd)
35 | t.end()
36 | })
37 |
38 | t.end()
39 | })
40 |
--------------------------------------------------------------------------------
/node_modules/tern/node_modules/glob/test/root.js:
--------------------------------------------------------------------------------
1 | var t = require("tap")
2 |
3 | var origCwd = process.cwd()
4 | process.chdir(__dirname)
5 |
6 | var glob = require('../')
7 | var path = require('path')
8 |
9 | t.test('.', function (t) {
10 | glob('/b*/**', { globDebug: true, root: '.' }, function (er, matches) {
11 | t.ifError(er)
12 | t.like(matches, [])
13 | t.end()
14 | })
15 | })
16 |
17 |
18 | t.test('a', function (t) {
19 | console.error("root=" + path.resolve('a'))
20 | glob('/b*/**', { globDebug: true, root: path.resolve('a') }, function (er, matches) {
21 | t.ifError(er)
22 | var wanted = [
23 | '/b', '/b/c', '/b/c/d', '/bc', '/bc/e', '/bc/e/f'
24 | ].map(function (m) {
25 | return path.join(path.resolve('a'), m).replace(/\\/g, '/')
26 | })
27 |
28 | t.like(matches, wanted)
29 | t.end()
30 | })
31 | })
32 |
33 | t.test('root=a, cwd=a/b', function (t) {
34 | glob('/b*/**', { globDebug: true, root: 'a', cwd: path.resolve('a/b') }, function (er, matches) {
35 | t.ifError(er)
36 | t.like(matches, [ '/b', '/b/c', '/b/c/d', '/bc', '/bc/e', '/bc/e/f' ].map(function (m) {
37 | return path.join(path.resolve('a'), m).replace(/\\/g, '/')
38 | }))
39 | t.end()
40 | })
41 | })
42 |
43 | t.test('cd -', function (t) {
44 | process.chdir(origCwd)
45 | t.end()
46 | })
47 |
--------------------------------------------------------------------------------
/node_modules/tern/node_modules/glob/test/stat.js:
--------------------------------------------------------------------------------
1 | var glob = require('../')
2 | var test = require('tap').test
3 | var path = require('path')
4 |
5 | test('stat all the things', function(t) {
6 | var g = new glob.Glob('a/*abc*/**', { stat: true, cwd: __dirname })
7 | var matches = []
8 | g.on('match', function(m) {
9 | matches.push(m)
10 | })
11 | var stats = []
12 | g.on('stat', function(m) {
13 | stats.push(m)
14 | })
15 | g.on('end', function(eof) {
16 | stats = stats.sort()
17 | matches = matches.sort()
18 | eof = eof.sort()
19 | t.same(stats, matches)
20 | t.same(eof, matches)
21 | var cache = Object.keys(this.statCache)
22 | t.same(cache.map(function (f) {
23 | return path.relative(__dirname, f)
24 | }).sort(), matches)
25 |
26 | cache.forEach(function(c) {
27 | t.equal(typeof this.statCache[c], 'object')
28 | }, this)
29 |
30 | t.end()
31 | })
32 | })
33 |
--------------------------------------------------------------------------------
/node_modules/tern/node_modules/glob/test/zz-cleanup.js:
--------------------------------------------------------------------------------
1 | // remove the fixtures
2 | var tap = require("tap")
3 | , rimraf = require("rimraf")
4 | , path = require("path")
5 |
6 | tap.test("cleanup fixtures", function (t) {
7 | rimraf(path.resolve(__dirname, "a"), function (er) {
8 | t.ifError(er, "removed")
9 | t.end()
10 | })
11 | })
12 |
--------------------------------------------------------------------------------
/node_modules/tern/node_modules/minimatch/.npmignore:
--------------------------------------------------------------------------------
1 | node_modules
2 |
--------------------------------------------------------------------------------
/node_modules/tern/node_modules/minimatch/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright 2009, 2010, 2011 Isaac Z. Schlueter.
2 | All rights reserved.
3 |
4 | Permission is hereby granted, free of charge, to any person
5 | obtaining a copy of this software and associated documentation
6 | files (the "Software"), to deal in the Software without
7 | restriction, including without limitation the rights to use,
8 | copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the
10 | Software is furnished to do so, subject to the following
11 | conditions:
12 |
13 | The above copyright notice and this permission notice shall be
14 | included in all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
18 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 | OTHER DEALINGS IN THE SOFTWARE.
24 |
--------------------------------------------------------------------------------
/node_modules/tern/node_modules/minimatch/node_modules/lru-cache/.npmignore:
--------------------------------------------------------------------------------
1 | /node_modules
2 |
--------------------------------------------------------------------------------
/node_modules/tern/node_modules/minimatch/node_modules/lru-cache/CONTRIBUTORS:
--------------------------------------------------------------------------------
1 | # Authors, sorted by whether or not they are me
2 | Isaac Z. Schlueter
3 | Brian Cottingham
4 | Carlos Brito Lage
5 | Jesse Dailey
6 | Kevin O'Hara
7 | Marco Rogers
8 | Mark Cavage
9 | Marko Mikulicic
10 | Nathan Rajlich
11 | Satheesh Natesan
12 | Trent Mick
13 | ashleybrener
14 | n4kz
15 |
--------------------------------------------------------------------------------
/node_modules/tern/node_modules/minimatch/node_modules/lru-cache/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright 2009, 2010, 2011 Isaac Z. Schlueter.
2 | All rights reserved.
3 |
4 | Permission is hereby granted, free of charge, to any person
5 | obtaining a copy of this software and associated documentation
6 | files (the "Software"), to deal in the Software without
7 | restriction, including without limitation the rights to use,
8 | copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the
10 | Software is furnished to do so, subject to the following
11 | conditions:
12 |
13 | The above copyright notice and this permission notice shall be
14 | included in all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
18 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 | OTHER DEALINGS IN THE SOFTWARE.
24 |
--------------------------------------------------------------------------------
/node_modules/tern/node_modules/minimatch/node_modules/lru-cache/README.md:
--------------------------------------------------------------------------------
1 | # lru cache
2 |
3 | A cache object that deletes the least-recently-used items.
4 |
5 | ## Usage:
6 |
7 | ```javascript
8 | var LRU = require("lru-cache")
9 | , options = { max: 500
10 | , length: function (n) { return n * 2 }
11 | , dispose: function (key, n) { n.close() }
12 | , maxAge: 1000 * 60 * 60 }
13 | , cache = LRU(options)
14 | , otherCache = LRU(50) // sets just the max size
15 |
16 | cache.set("key", "value")
17 | cache.get("key") // "value"
18 |
19 | cache.reset() // empty the cache
20 | ```
21 |
22 | If you put more stuff in it, then items will fall out.
23 |
24 | If you try to put an oversized thing in it, then it'll fall out right
25 | away.
26 |
27 | ## Options
28 |
29 | * `max` The maximum size of the cache, checked by applying the length
30 | function to all values in the cache. Not setting this is kind of
31 | silly, since that's the whole purpose of this lib, but it defaults
32 | to `Infinity`.
33 | * `maxAge` Maximum age in ms. Items are not pro-actively pruned out
34 | as they age, but if you try to get an item that is too old, it'll
35 | drop it and return undefined instead of giving it to you.
36 | * `length` Function that is used to calculate the length of stored
37 | items. If you're storing strings or buffers, then you probably want
38 | to do something like `function(n){return n.length}`. The default is
39 | `function(n){return 1}`, which is fine if you want to store `n`
40 | like-sized things.
41 | * `dispose` Function that is called on items when they are dropped
42 | from the cache. This can be handy if you want to close file
43 | descriptors or do other cleanup tasks when items are no longer
44 | accessible. Called with `key, value`. It's called *before*
45 | actually removing the item from the internal cache, so if you want
46 | to immediately put it back in, you'll have to do that in a
47 | `nextTick` or `setTimeout` callback or it won't do anything.
48 | * `stale` By default, if you set a `maxAge`, it'll only actually pull
49 | stale items out of the cache when you `get(key)`. (That is, it's
50 | not pre-emptively doing a `setTimeout` or anything.) If you set
51 | `stale:true`, it'll return the stale value before deleting it. If
52 | you don't set this, then it'll return `undefined` when you try to
53 | get a stale entry, as if it had already been deleted.
54 |
55 | ## API
56 |
57 | * `set(key, value)`
58 | * `get(key) => value`
59 |
60 | Both of these will update the "recently used"-ness of the key.
61 | They do what you think.
62 |
63 | * `peek(key)`
64 |
65 | Returns the key value (or `undefined` if not found) without
66 | updating the "recently used"-ness of the key.
67 |
68 | (If you find yourself using this a lot, you *might* be using the
69 | wrong sort of data structure, but there are some use cases where
70 | it's handy.)
71 |
72 | * `del(key)`
73 |
74 | Deletes a key out of the cache.
75 |
76 | * `reset()`
77 |
78 | Clear the cache entirely, throwing away all values.
79 |
80 | * `has(key)`
81 |
82 | Check if a key is in the cache, without updating the recent-ness
83 | or deleting it for being stale.
84 |
85 | * `forEach(function(value,key,cache), [thisp])`
86 |
87 | Just like `Array.prototype.forEach`. Iterates over all the keys
88 | in the cache, in order of recent-ness. (Ie, more recently used
89 | items are iterated over first.)
90 |
91 | * `keys()`
92 |
93 | Return an array of the keys in the cache.
94 |
95 | * `values()`
96 |
97 | Return an array of the values in the cache.
98 |
--------------------------------------------------------------------------------
/node_modules/tern/node_modules/minimatch/node_modules/lru-cache/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "lru-cache",
3 | "description": "A cache object that deletes the least-recently-used items.",
4 | "version": "2.5.0",
5 | "author": {
6 | "name": "Isaac Z. Schlueter",
7 | "email": "i@izs.me"
8 | },
9 | "scripts": {
10 | "test": "tap test --gc"
11 | },
12 | "main": "lib/lru-cache.js",
13 | "repository": {
14 | "type": "git",
15 | "url": "git://github.com/isaacs/node-lru-cache.git"
16 | },
17 | "devDependencies": {
18 | "tap": "",
19 | "weak": ""
20 | },
21 | "license": {
22 | "type": "MIT",
23 | "url": "http://github.com/isaacs/node-lru-cache/raw/master/LICENSE"
24 | },
25 | "bugs": {
26 | "url": "https://github.com/isaacs/node-lru-cache/issues"
27 | },
28 | "homepage": "https://github.com/isaacs/node-lru-cache",
29 | "_id": "lru-cache@2.5.0",
30 | "dist": {
31 | "shasum": "d82388ae9c960becbea0c73bb9eb79b6c6ce9aeb",
32 | "tarball": "http://registry.npmjs.org/lru-cache/-/lru-cache-2.5.0.tgz"
33 | },
34 | "_from": "lru-cache@>=2.0.0-0 <3.0.0-0",
35 | "_npmVersion": "1.3.15",
36 | "_npmUser": {
37 | "name": "isaacs",
38 | "email": "i@izs.me"
39 | },
40 | "maintainers": [
41 | {
42 | "name": "isaacs",
43 | "email": "i@izs.me"
44 | }
45 | ],
46 | "directories": {},
47 | "_shasum": "d82388ae9c960becbea0c73bb9eb79b6c6ce9aeb",
48 | "_resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-2.5.0.tgz",
49 | "readme": "# lru cache\n\nA cache object that deletes the least-recently-used items.\n\n## Usage:\n\n```javascript\nvar LRU = require(\"lru-cache\")\n , options = { max: 500\n , length: function (n) { return n * 2 }\n , dispose: function (key, n) { n.close() }\n , maxAge: 1000 * 60 * 60 }\n , cache = LRU(options)\n , otherCache = LRU(50) // sets just the max size\n\ncache.set(\"key\", \"value\")\ncache.get(\"key\") // \"value\"\n\ncache.reset() // empty the cache\n```\n\nIf you put more stuff in it, then items will fall out.\n\nIf you try to put an oversized thing in it, then it'll fall out right\naway.\n\n## Options\n\n* `max` The maximum size of the cache, checked by applying the length\n function to all values in the cache. Not setting this is kind of\n silly, since that's the whole purpose of this lib, but it defaults\n to `Infinity`.\n* `maxAge` Maximum age in ms. Items are not pro-actively pruned out\n as they age, but if you try to get an item that is too old, it'll\n drop it and return undefined instead of giving it to you.\n* `length` Function that is used to calculate the length of stored\n items. If you're storing strings or buffers, then you probably want\n to do something like `function(n){return n.length}`. The default is\n `function(n){return 1}`, which is fine if you want to store `n`\n like-sized things.\n* `dispose` Function that is called on items when they are dropped\n from the cache. This can be handy if you want to close file\n descriptors or do other cleanup tasks when items are no longer\n accessible. Called with `key, value`. It's called *before*\n actually removing the item from the internal cache, so if you want\n to immediately put it back in, you'll have to do that in a\n `nextTick` or `setTimeout` callback or it won't do anything.\n* `stale` By default, if you set a `maxAge`, it'll only actually pull\n stale items out of the cache when you `get(key)`. (That is, it's\n not pre-emptively doing a `setTimeout` or anything.) If you set\n `stale:true`, it'll return the stale value before deleting it. If\n you don't set this, then it'll return `undefined` when you try to\n get a stale entry, as if it had already been deleted.\n\n## API\n\n* `set(key, value)`\n* `get(key) => value`\n\n Both of these will update the \"recently used\"-ness of the key.\n They do what you think.\n\n* `peek(key)`\n\n Returns the key value (or `undefined` if not found) without\n updating the \"recently used\"-ness of the key.\n\n (If you find yourself using this a lot, you *might* be using the\n wrong sort of data structure, but there are some use cases where\n it's handy.)\n\n* `del(key)`\n\n Deletes a key out of the cache.\n\n* `reset()`\n\n Clear the cache entirely, throwing away all values.\n\n* `has(key)`\n\n Check if a key is in the cache, without updating the recent-ness\n or deleting it for being stale.\n\n* `forEach(function(value,key,cache), [thisp])`\n\n Just like `Array.prototype.forEach`. Iterates over all the keys\n in the cache, in order of recent-ness. (Ie, more recently used\n items are iterated over first.)\n\n* `keys()`\n\n Return an array of the keys in the cache.\n\n* `values()`\n\n Return an array of the values in the cache.\n",
50 | "readmeFilename": "README.md"
51 | }
52 |
--------------------------------------------------------------------------------
/node_modules/tern/node_modules/minimatch/node_modules/lru-cache/test/foreach.js:
--------------------------------------------------------------------------------
1 | var test = require('tap').test
2 | var LRU = require('../')
3 |
4 | test('forEach', function (t) {
5 | var l = new LRU(5)
6 | for (var i = 0; i < 10; i ++) {
7 | l.set(i.toString(), i.toString(2))
8 | }
9 |
10 | var i = 9
11 | l.forEach(function (val, key, cache) {
12 | t.equal(cache, l)
13 | t.equal(key, i.toString())
14 | t.equal(val, i.toString(2))
15 | i -= 1
16 | })
17 |
18 | // get in order of most recently used
19 | l.get(6)
20 | l.get(8)
21 |
22 | var order = [ 8, 6, 9, 7, 5 ]
23 | var i = 0
24 |
25 | l.forEach(function (val, key, cache) {
26 | var j = order[i ++]
27 | t.equal(cache, l)
28 | t.equal(key, j.toString())
29 | t.equal(val, j.toString(2))
30 | })
31 |
32 | t.end()
33 | })
34 |
35 | test('keys() and values()', function (t) {
36 | var l = new LRU(5)
37 | for (var i = 0; i < 10; i ++) {
38 | l.set(i.toString(), i.toString(2))
39 | }
40 |
41 | t.similar(l.keys(), ['9', '8', '7', '6', '5'])
42 | t.similar(l.values(), ['1001', '1000', '111', '110', '101'])
43 |
44 | // get in order of most recently used
45 | l.get(6)
46 | l.get(8)
47 |
48 | t.similar(l.keys(), ['8', '6', '9', '7', '5'])
49 | t.similar(l.values(), ['1000', '110', '1001', '111', '101'])
50 |
51 | t.end()
52 | })
53 |
--------------------------------------------------------------------------------
/node_modules/tern/node_modules/minimatch/node_modules/lru-cache/test/memory-leak.js:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node --expose_gc
2 |
3 | var weak = require('weak');
4 | var test = require('tap').test
5 | var LRU = require('../')
6 | var l = new LRU({ max: 10 })
7 | var refs = 0
8 | function X() {
9 | refs ++
10 | weak(this, deref)
11 | }
12 |
13 | function deref() {
14 | refs --
15 | }
16 |
17 | test('no leaks', function (t) {
18 | // fill up the cache
19 | for (var i = 0; i < 100; i++) {
20 | l.set(i, new X);
21 | // throw some gets in there, too.
22 | if (i % 2 === 0)
23 | l.get(i / 2)
24 | }
25 |
26 | gc()
27 |
28 | var start = process.memoryUsage()
29 |
30 | // capture the memory
31 | var startRefs = refs
32 |
33 | // do it again, but more
34 | for (var i = 0; i < 10000; i++) {
35 | l.set(i, new X);
36 | // throw some gets in there, too.
37 | if (i % 2 === 0)
38 | l.get(i / 2)
39 | }
40 |
41 | gc()
42 |
43 | var end = process.memoryUsage()
44 | t.equal(refs, startRefs, 'no leaky refs')
45 |
46 | console.error('start: %j\n' +
47 | 'end: %j', start, end);
48 | t.pass();
49 | t.end();
50 | })
51 |
--------------------------------------------------------------------------------
/node_modules/tern/node_modules/minimatch/node_modules/sigmund/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) Isaac Z. Schlueter ("Author")
2 | All rights reserved.
3 |
4 | The BSD License
5 |
6 | Redistribution and use in source and binary forms, with or without
7 | modification, are permitted provided that the following conditions
8 | are met:
9 |
10 | 1. Redistributions of source code must retain the above copyright
11 | notice, this list of conditions and the following disclaimer.
12 |
13 | 2. Redistributions in binary form must reproduce the above copyright
14 | notice, this list of conditions and the following disclaimer in the
15 | documentation and/or other materials provided with the distribution.
16 |
17 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
20 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS
21 | BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
24 | BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
25 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
26 | OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
27 | IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 |
--------------------------------------------------------------------------------
/node_modules/tern/node_modules/minimatch/node_modules/sigmund/README.md:
--------------------------------------------------------------------------------
1 | # sigmund
2 |
3 | Quick and dirty signatures for Objects.
4 |
5 | This is like a much faster `deepEquals` comparison, which returns a
6 | string key suitable for caches and the like.
7 |
8 | ## Usage
9 |
10 | ```javascript
11 | function doSomething (someObj) {
12 | var key = sigmund(someObj, maxDepth) // max depth defaults to 10
13 | var cached = cache.get(key)
14 | if (cached) return cached)
15 |
16 | var result = expensiveCalculation(someObj)
17 | cache.set(key, result)
18 | return result
19 | }
20 | ```
21 |
22 | The resulting key will be as unique and reproducible as calling
23 | `JSON.stringify` or `util.inspect` on the object, but is much faster.
24 | In order to achieve this speed, some differences are glossed over.
25 | For example, the object `{0:'foo'}` will be treated identically to the
26 | array `['foo']`.
27 |
28 | Also, just as there is no way to summon the soul from the scribblings
29 | of a cocain-addled psychoanalyst, there is no way to revive the object
30 | from the signature string that sigmund gives you. In fact, it's
31 | barely even readable.
32 |
33 | As with `sys.inspect` and `JSON.stringify`, larger objects will
34 | produce larger signature strings.
35 |
36 | Because sigmund is a bit less strict than the more thorough
37 | alternatives, the strings will be shorter, and also there is a
38 | slightly higher chance for collisions. For example, these objects
39 | have the same signature:
40 |
41 | var obj1 = {a:'b',c:/def/,g:['h','i',{j:'',k:'l'}]}
42 | var obj2 = {a:'b',c:'/def/',g:['h','i','{jkl']}
43 |
44 | Like a good Freudian, sigmund is most effective when you already have
45 | some understanding of what you're looking for. It can help you help
46 | yourself, but you must be willing to do some work as well.
47 |
48 | Cycles are handled, and cyclical objects are silently omitted (though
49 | the key is included in the signature output.)
50 |
51 | The second argument is the maximum depth, which defaults to 10,
52 | because that is the maximum object traversal depth covered by most
53 | insurance carriers.
54 |
--------------------------------------------------------------------------------
/node_modules/tern/node_modules/minimatch/node_modules/sigmund/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "sigmund",
3 | "version": "1.0.0",
4 | "description": "Quick and dirty signatures for Objects.",
5 | "main": "sigmund.js",
6 | "directories": {
7 | "test": "test"
8 | },
9 | "dependencies": {},
10 | "devDependencies": {
11 | "tap": "~0.3.0"
12 | },
13 | "scripts": {
14 | "test": "tap test/*.js",
15 | "bench": "node bench.js"
16 | },
17 | "repository": {
18 | "type": "git",
19 | "url": "git://github.com/isaacs/sigmund"
20 | },
21 | "keywords": [
22 | "object",
23 | "signature",
24 | "key",
25 | "data",
26 | "psychoanalysis"
27 | ],
28 | "author": {
29 | "name": "Isaac Z. Schlueter",
30 | "email": "i@izs.me",
31 | "url": "http://blog.izs.me/"
32 | },
33 | "license": "BSD",
34 | "readme": "# sigmund\n\nQuick and dirty signatures for Objects.\n\nThis is like a much faster `deepEquals` comparison, which returns a\nstring key suitable for caches and the like.\n\n## Usage\n\n```javascript\nfunction doSomething (someObj) {\n var key = sigmund(someObj, maxDepth) // max depth defaults to 10\n var cached = cache.get(key)\n if (cached) return cached)\n\n var result = expensiveCalculation(someObj)\n cache.set(key, result)\n return result\n}\n```\n\nThe resulting key will be as unique and reproducible as calling\n`JSON.stringify` or `util.inspect` on the object, but is much faster.\nIn order to achieve this speed, some differences are glossed over.\nFor example, the object `{0:'foo'}` will be treated identically to the\narray `['foo']`.\n\nAlso, just as there is no way to summon the soul from the scribblings\nof a cocain-addled psychoanalyst, there is no way to revive the object\nfrom the signature string that sigmund gives you. In fact, it's\nbarely even readable.\n\nAs with `sys.inspect` and `JSON.stringify`, larger objects will\nproduce larger signature strings.\n\nBecause sigmund is a bit less strict than the more thorough\nalternatives, the strings will be shorter, and also there is a\nslightly higher chance for collisions. For example, these objects\nhave the same signature:\n\n var obj1 = {a:'b',c:/def/,g:['h','i',{j:'',k:'l'}]}\n var obj2 = {a:'b',c:'/def/',g:['h','i','{jkl']}\n\nLike a good Freudian, sigmund is most effective when you already have\nsome understanding of what you're looking for. It can help you help\nyourself, but you must be willing to do some work as well.\n\nCycles are handled, and cyclical objects are silently omitted (though\nthe key is included in the signature output.)\n\nThe second argument is the maximum depth, which defaults to 10,\nbecause that is the maximum object traversal depth covered by most\ninsurance carriers.\n",
35 | "_id": "sigmund@1.0.0",
36 | "dist": {
37 | "shasum": "66a2b3a749ae8b5fb89efd4fcc01dc94fbe02296",
38 | "tarball": "http://registry.npmjs.org/sigmund/-/sigmund-1.0.0.tgz"
39 | },
40 | "_npmVersion": "1.1.48",
41 | "_npmUser": {
42 | "name": "isaacs",
43 | "email": "i@izs.me"
44 | },
45 | "maintainers": [
46 | {
47 | "name": "isaacs",
48 | "email": "i@izs.me"
49 | }
50 | ],
51 | "_shasum": "66a2b3a749ae8b5fb89efd4fcc01dc94fbe02296",
52 | "_from": "sigmund@>=1.0.0-0 <1.1.0-0",
53 | "_resolved": "https://registry.npmjs.org/sigmund/-/sigmund-1.0.0.tgz",
54 | "bugs": {
55 | "url": "https://github.com/isaacs/sigmund/issues"
56 | },
57 | "homepage": "https://github.com/isaacs/sigmund"
58 | }
59 |
--------------------------------------------------------------------------------
/node_modules/tern/node_modules/minimatch/node_modules/sigmund/sigmund.js:
--------------------------------------------------------------------------------
1 | module.exports = sigmund
2 | function sigmund (subject, maxSessions) {
3 | maxSessions = maxSessions || 10;
4 | var notes = [];
5 | var analysis = '';
6 | var RE = RegExp;
7 |
8 | function psychoAnalyze (subject, session) {
9 | if (session > maxSessions) return;
10 |
11 | if (typeof subject === 'function' ||
12 | typeof subject === 'undefined') {
13 | return;
14 | }
15 |
16 | if (typeof subject !== 'object' || !subject ||
17 | (subject instanceof RE)) {
18 | analysis += subject;
19 | return;
20 | }
21 |
22 | if (notes.indexOf(subject) !== -1 || session === maxSessions) return;
23 |
24 | notes.push(subject);
25 | analysis += '{';
26 | Object.keys(subject).forEach(function (issue, _, __) {
27 | // pseudo-private values. skip those.
28 | if (issue.charAt(0) === '_') return;
29 | var to = typeof subject[issue];
30 | if (to === 'function' || to === 'undefined') return;
31 | analysis += issue;
32 | psychoAnalyze(subject[issue], session + 1);
33 | });
34 | }
35 | psychoAnalyze(subject, 0);
36 | return analysis;
37 | }
38 |
39 | // vim: set softtabstop=4 shiftwidth=4:
40 |
--------------------------------------------------------------------------------
/node_modules/tern/node_modules/minimatch/node_modules/sigmund/test/basic.js:
--------------------------------------------------------------------------------
1 | var test = require('tap').test
2 | var sigmund = require('../sigmund.js')
3 |
4 |
5 | // occasionally there are duplicates
6 | // that's an acceptable edge-case. JSON.stringify and util.inspect
7 | // have some collision potential as well, though less, and collision
8 | // detection is expensive.
9 | var hash = '{abc/def/g{0h1i2{jkl'
10 | var obj1 = {a:'b',c:/def/,g:['h','i',{j:'',k:'l'}]}
11 | var obj2 = {a:'b',c:'/def/',g:['h','i','{jkl']}
12 |
13 | var obj3 = JSON.parse(JSON.stringify(obj1))
14 | obj3.c = /def/
15 | obj3.g[2].cycle = obj3
16 | var cycleHash = '{abc/def/g{0h1i2{jklcycle'
17 |
18 | test('basic', function (t) {
19 | t.equal(sigmund(obj1), hash)
20 | t.equal(sigmund(obj2), hash)
21 | t.equal(sigmund(obj3), cycleHash)
22 | t.end()
23 | })
24 |
25 |
--------------------------------------------------------------------------------
/node_modules/tern/node_modules/minimatch/test/brace-expand.js:
--------------------------------------------------------------------------------
1 | var tap = require("tap")
2 | , minimatch = require("../")
3 |
4 | tap.test("brace expansion", function (t) {
5 | // [ pattern, [expanded] ]
6 | ; [ [ "a{b,c{d,e},{f,g}h}x{y,z}"
7 | , [ "abxy"
8 | , "abxz"
9 | , "acdxy"
10 | , "acdxz"
11 | , "acexy"
12 | , "acexz"
13 | , "afhxy"
14 | , "afhxz"
15 | , "aghxy"
16 | , "aghxz" ] ]
17 | , [ "a{1..5}b"
18 | , [ "a1b"
19 | , "a2b"
20 | , "a3b"
21 | , "a4b"
22 | , "a5b" ] ]
23 | , [ "a{b}c", ["a{b}c"] ]
24 | ].forEach(function (tc) {
25 | var p = tc[0]
26 | , expect = tc[1]
27 | t.equivalent(minimatch.braceExpand(p), expect, p)
28 | })
29 | console.error("ending")
30 | t.end()
31 | })
32 |
33 |
34 |
--------------------------------------------------------------------------------
/node_modules/tern/node_modules/minimatch/test/caching.js:
--------------------------------------------------------------------------------
1 | var Minimatch = require("../minimatch.js").Minimatch
2 | var tap = require("tap")
3 | tap.test("cache test", function (t) {
4 | var mm1 = new Minimatch("a?b")
5 | var mm2 = new Minimatch("a?b")
6 | t.equal(mm1, mm2, "should get the same object")
7 | // the lru should drop it after 100 entries
8 | for (var i = 0; i < 100; i ++) {
9 | new Minimatch("a"+i)
10 | }
11 | mm2 = new Minimatch("a?b")
12 | t.notEqual(mm1, mm2, "cache should have dropped")
13 | t.end()
14 | })
15 |
--------------------------------------------------------------------------------
/node_modules/tern/node_modules/minimatch/test/extglob-ending-with-state-char.js:
--------------------------------------------------------------------------------
1 | var test = require('tap').test
2 | var minimatch = require('../')
3 |
4 | test('extglob ending with statechar', function(t) {
5 | t.notOk(minimatch('ax', 'a?(b*)'))
6 | t.ok(minimatch('ax', '?(a*|b)'))
7 | t.end()
8 | })
9 |
--------------------------------------------------------------------------------
/node_modules/tern/node_modules/typescript/.npmignore:
--------------------------------------------------------------------------------
1 | built
2 | doc
3 | samples
4 | src
5 | tests
6 | typings
7 | bin/winjs.d.ts
8 | bin/winrt.d.ts
9 | bin/*.bat
10 | bin/jquery.d.ts
11 | bin/typescriptServices.js
12 | Jakefile
13 |
--------------------------------------------------------------------------------
/node_modules/tern/node_modules/typescript/CopyrightNotice.txt:
--------------------------------------------------------------------------------
1 | /*! *****************************************************************************
2 | Copyright (c) Microsoft Corporation. All rights reserved.
3 | Licensed under the Apache License, Version 2.0 (the "License"); you may not use
4 | this file except in compliance with the License. You may obtain a copy of the
5 | License at http://www.apache.org/licenses/LICENSE-2.0
6 |
7 | THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
8 | KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
9 | WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10 | MERCHANTABLITY OR NON-INFRINGEMENT.
11 |
12 | See the Apache Version 2.0 License for specific language governing permissions
13 | and limitations under the License.
14 | ***************************************************************************** */
15 |
16 |
--------------------------------------------------------------------------------
/node_modules/tern/node_modules/typescript/README.txt:
--------------------------------------------------------------------------------
1 | # TypeScript
2 |
3 | Scalable JavaScript development with types, classes and modules.
4 |
5 | ## Install
6 |
7 | npm install -g typescript
8 |
9 | ## Usage
10 |
11 | tsc hello.ts
12 |
13 |
14 | ## Build
15 |
16 | 1. Install Node if you haven't already (http://nodejs.org/)
17 | 2. Install Jake, the tool we use to build our compiler (https://github.com/mde/jake). To do this, run "npm install -g jake".
18 | 3. To use jake, run one of the following commands:
19 | - jake local - This builds the compiler. The output is in built/local in the public directory
20 | - jake clean - deletes the build compiler
21 | - jake LKG - This replaces the LKG (last known good) version of the compiler with the built one.
22 | - This is a bootstrapping step to be executed whenever the built compiler reaches a stable state.
23 | - jake tests - This builds the test infrastructure, using the built compiler.
24 | - jake runtests - This runs the tests, using the built compiler and built test infrastructure.
25 | - You can also override the host or specify a test for this command. Use host= or tests=.
26 | - jake baseline-accept - This replaces the baseline test results with the results obtained from jake runtests.
27 | - jake -T lists the above commands.
28 |
--------------------------------------------------------------------------------
/node_modules/tern/node_modules/typescript/ThirdPartyNoticeText.txt:
--------------------------------------------------------------------------------
1 | /*!----------------- TypeScript ThirdPartyNotices -------------------------------------------------------
2 |
3 | The TypeScript software is based on or incorporates material and code from the projects listed below
4 | (collectively "Third Party Code"). Microsoft is not the original author of the
5 | Third Party Code. The original copyright notice and the license, under which
6 | Microsoft received such Third Party Code, are set forth below. Such license and
7 | notices are provided for informational purposes only. Microsoft licenses the Third
8 | Party Code to you under the terms of the Apache 2.0 License.
9 | All Third Party Code licensed by Microsoft under the Apache License, Version 2.0 (the "License"); you
10 | may not use this file except in compliance with the License. You may obtain a copy
11 | of the License at http://www.apache.org/licenses/LICENSE-2.0
12 |
13 | THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
14 | EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR
15 | CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT.
16 |
17 | See the Apache Version 2.0 License for specific language governing permissions and
18 | limitations under the License.
19 | ---------------------------------------------
20 | Third Party Code Components
21 | --------------------------------------------
22 | ---- Mozilla Developer Code---------
23 | The following Mozilla Developer Code is under Public Domain as updated after Aug. 20, 2012, see, https://developer.mozilla.org/en-US/docs/Project:Copyrights
24 | 1. Array filter Compatibility Method,
25 | Available at https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/filter
26 | Any copyright is dedicated to the Public Domain.
27 |
28 | 2. Array forEach Compatibility Method,
29 | Available at https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/forEach
30 | Any copyright is dedicated to the Public Domain.
31 |
32 | 3. Array indexOf Compatibility Method,
33 | Available at https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/indexOf
34 | Any copyright is dedicated to the Public Domain.
35 |
36 | 4. Array map Compatibility Method,
37 | Available at https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/map
38 | Any copyright is dedicated to the Public Domain.
39 |
40 | 5. Array Reduce Compatibility Method,
41 | Available at https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/Reduce
42 | Any copyright is dedicated to the Public Domain.
43 |
44 | 6. String Trim Compatibility Method,
45 | Available at https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/Trim
46 | Any copyright is dedicated to the Public Domain.
47 |
48 | 7. Date now Compatibility Method,
49 | Available at https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/now
50 | Any copyright is dedicated to the Public Domain.
51 |
52 | ------------JSON2 Script------------------------
53 | json2.js 2012-10-08
54 | Public Domain.
55 | NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
56 | See, http://www.JSON.org/js.html
57 |
58 | --------------r.js----------------------
59 | Copyright (c) 2010-2011 Dojo Foundation. All Rights Reserved.
60 | Originally License under MIT License
61 | -------------------------------------------------------------------------
62 | Provided for Informational Purposes Only
63 | MIT License
64 |
65 | Permission is hereby granted, free of charge, to any person obtaining
66 | a copy of this software and associated documentation files (the
67 | "Software"), to deal in the Software without restriction, including
68 | without limitation the rights to use, copy, modify, merge, publish,
69 | distribute, sublicense, and/or sell copies of the Software, and to
70 | permit persons to whom the Software is furnished to do so, subject to
71 | the following conditions:
72 |
73 | The above copyright notice and this permission notice shall be
74 | included in all copies or substantial portions of the Software.
75 |
76 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
77 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
78 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
79 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
80 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
81 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
82 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
83 | --------------------------------------------------------------------------------------
84 |
85 | ------------- End of ThirdPartyNotices --------------------------------------------------- */
86 |
--------------------------------------------------------------------------------
/node_modules/tern/node_modules/typescript/bin/tsc:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 | require('./tsc.js')
3 |
--------------------------------------------------------------------------------
/node_modules/tern/node_modules/typescript/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "typescript",
3 | "author": {
4 | "name": "Microsoft Corp."
5 | },
6 | "homepage": "http://typescriptlang.org/",
7 | "version": "1.0.1",
8 | "licenses": [
9 | {
10 | "type": "Apache License 2.0",
11 | "url": "http://typescript.codeplex.com/license"
12 | }
13 | ],
14 | "description": "TypeScript is a language for application scale JavaScript development",
15 | "keywords": [
16 | "TypeScript",
17 | "Microsoft",
18 | "compiler",
19 | "language",
20 | "javascript"
21 | ],
22 | "bugs": {
23 | "url": "http://typescript.codeplex.com/workitem/list/basic"
24 | },
25 | "repository": {
26 | "type": "git",
27 | "url": "https://git01.codeplex.com/typescript"
28 | },
29 | "preferGlobal": true,
30 | "main": "./bin/typescript.js",
31 | "bin": {
32 | "tsc": "./bin/tsc"
33 | },
34 | "engines": {
35 | "node": ">=0.8.0"
36 | },
37 | "devDependencies": {
38 | "jake": "latest"
39 | },
40 | "_id": "typescript@1.0.1",
41 | "dist": {
42 | "shasum": "e8eacde3084a091d3fe29b60ac5862252662a25a",
43 | "tarball": "http://registry.npmjs.org/typescript/-/typescript-1.0.1.tgz"
44 | },
45 | "_from": "typescript@1.0.1",
46 | "_npmVersion": "1.4.3",
47 | "_npmUser": {
48 | "name": "typescript",
49 | "email": "typescript@microsoft.com"
50 | },
51 | "maintainers": [
52 | {
53 | "name": "typescript",
54 | "email": "typescript@microsoft.com"
55 | }
56 | ],
57 | "directories": {},
58 | "_shasum": "e8eacde3084a091d3fe29b60ac5862252662a25a",
59 | "_resolved": "https://registry.npmjs.org/typescript/-/typescript-1.0.1.tgz"
60 | }
61 |
--------------------------------------------------------------------------------
/node_modules/tern/plugin/complete_strings.js:
--------------------------------------------------------------------------------
1 | // Parses comments above variable declarations, function declarations,
2 | // and object properties as docstrings and JSDoc-style type
3 | // annotations.
4 |
5 | (function(mod) {
6 | if (typeof exports == "object" && typeof module == "object") // CommonJS
7 | return mod(require("../lib/infer"), require("../lib/tern"), require("acorn/util/walk"));
8 | if (typeof define == "function" && define.amd) // AMD
9 | return define(["../lib/infer", "../lib/tern", "acorn/util/walk"], mod);
10 | mod(tern, tern, acorn.walk);
11 | })(function(infer, tern, walk) {
12 | "use strict";
13 |
14 | tern.registerPlugin("complete_strings", function(server, options) {
15 | server._completeStrings = { maxLen: options && options.maxLength || 15,
16 | seen: Object.create(null) };
17 | server.on("reset", function() {
18 | server._completeStrings.seen = Object.create(null);
19 | });
20 | return {
21 | passes: {
22 | postParse: postParse,
23 | completion: complete
24 | }
25 | };
26 | });
27 |
28 | function postParse(ast) {
29 | var data = infer.cx().parent._completeStrings;
30 | walk.simple(ast, {
31 | Literal: function(node) {
32 | if (typeof node.value == "string" && node.value && node.value.length < data.maxLen)
33 | data.seen[node.value] = ast.sourceFile.name;
34 | }
35 | });
36 | }
37 |
38 | function complete(file, query) {
39 | var pos = tern.resolvePos(file, query.end);
40 | var lit = infer.findExpressionAround(file.ast, null, pos, file.scope, "Literal");
41 | if (!lit || typeof lit.node.value != "string") return;
42 | var before = lit.node.value.slice(0, pos - lit.node.start - 1);
43 | var matches = [], seen = infer.cx().parent._completeStrings.seen;
44 | for (var str in seen) if (str.length > before.length && str.indexOf(before) == 0) {
45 | if (query.types || query.docs || query.urls || query.origins) {
46 | var rec = {name: JSON.stringify(str), displayName: str};
47 | matches.push(rec);
48 | if (query.types) rec.type = "string";
49 | if (query.origins) rec.origin = seen[str];
50 | } else {
51 | matches.push(JSON.stringify(str));
52 | }
53 | }
54 | if (matches.length) return {
55 | start: tern.outputPos(query, file, lit.node.start),
56 | end: tern.outputPos(query, file, pos + (file.text.charAt(pos) == file.text.charAt(lit.node.start) ? 1 : 0)),
57 | isProperty: false,
58 | completions: matches
59 | };
60 | }
61 | });
62 |
--------------------------------------------------------------------------------
/node_modules/tern/test/cases/angular/config.js:
--------------------------------------------------------------------------------
1 | angular.module('sample.config', [])
2 |
3 | .value('myConfig', {
4 | myColor: 'red',
5 | })
6 |
7 | ;
8 |
--------------------------------------------------------------------------------
/node_modules/tern/test/cases/angular/filters.js:
--------------------------------------------------------------------------------
1 | angular.module('sample.filters', [])
2 |
3 | // greet greets the named user.
4 | .filter('greet', function() {
5 | return function(s) {
6 | return 'Hello, ' + s + '!';
7 | };
8 | })
9 |
10 | .constant("someNumber", 44)
11 |
12 | ;
13 |
--------------------------------------------------------------------------------
/node_modules/tern/test/cases/angular/main.js:
--------------------------------------------------------------------------------
1 | // plugin=angular
2 | // environment=browser
3 | // environment=jquery
4 | // loadfiles=config.js, filters.js
5 |
6 | angular.module('sample', ['ngResource', 'sample.config', 'sample.filters'])
7 |
8 | .run(function($rootScope, someNumber) {
9 | someNumber; //: number
10 | $rootScope.rootName; //: string
11 | })
12 |
13 | .controller('GreetingCtrl', ['$rootScope', '$scope', 'User', 'myConfig', 'version', function($rootScope, $scope, User, myConfig, version) {
14 | $rootScope.rootName = $scope.myName = 'John';
15 | $scope.myName; //: string
16 |
17 | $scope.myConfig = myConfig; //: {myColor}
18 | $scope.myConfig; //: {myColor}
19 |
20 | $scope.version = version; //: string
21 | $scope.version; //: string
22 |
23 | User; //doc: doc for User
24 |
25 | $scope.user = User.get({login: 'sqs'});
26 | $scope.user.$promise.finally; //: fn(callback: fn()) -> Promise
27 | }])
28 |
29 | .controller('OtherCtrl', ['$scope', function($scope) {
30 | // Test that controllers' $scope objects are distinct.
31 | $scope.myName; //: ?
32 | }])
33 |
34 | .constant('version', 'v1.2.3')
35 |
36 | // doc for User
37 | .factory('User', ['$resource', function($resource) {
38 | return $resource('https://api.github.com/users/:login');
39 | }])
40 |
41 | ;
42 |
43 | angular.module('docsScopeProblemExample', [])
44 | .directive('myCustomer', function() {
45 | return {
46 | //+ bindToController, compile, controller, controllerAs, template, templateUrl, ...
47 | };
48 | }).directive('myCustomer', function() {
49 | return {
50 | t //+ template, templateNamespace, templateUrl, ...
51 | };
52 | });
53 |
--------------------------------------------------------------------------------
/node_modules/tern/test/cases/angular_service.js:
--------------------------------------------------------------------------------
1 | // Issue #267
2 |
3 | // plugin=angular
4 | // environment=browser
5 |
6 | var foodMeApp = angular.module('foodMeApp');
7 |
8 | foodMeApp.service('cart', function Cart(localStorage, customer, $rootScope, $http, alert) {
9 | this.length = "4";
10 | });
11 |
12 | foodMeApp.controller('CheckoutController', function CheckoutController($scope, cart) {
13 | cart; //: Cart
14 | cart.length; //: string
15 | });
16 |
--------------------------------------------------------------------------------
/node_modules/tern/test/cases/arguments.js:
--------------------------------------------------------------------------------
1 | var arguments = 1; //: number
2 |
3 | (function() { return arguments.length; })(); //: number
4 |
--------------------------------------------------------------------------------
/node_modules/tern/test/cases/autothis.js:
--------------------------------------------------------------------------------
1 | function Bar() { this.prop = 10; }
2 | Bar.prototype.hallo = function() {
3 | this; //: Bar
4 | this.prop; //: number
5 | };
6 |
7 | Bar.prototype.fn2 = function() {
8 | this; //: Date
9 | };
10 |
11 | Date.prototype.fn2 = Bar.prototype.fn2;
12 | new Date().fn2();
13 |
--------------------------------------------------------------------------------
/node_modules/tern/test/cases/blowup.js:
--------------------------------------------------------------------------------
1 | var Ext = Ext || {};
2 | Ext.extend = function(subclass, superclass) {
3 | superclass = subclass;
4 | subclass = function() { superclass.apply(this, arguments); };
5 |
6 | var F = function() {};
7 | F.prototype = superclass.prototype;
8 | subclass.prototype = new F();
9 |
10 | subclass.extend = function(o) { return Ext.extend(subclass, o); };
11 | };
12 |
13 | var Ext = Ext || {};
14 | Ext.extend = function(subclass, superclass) {
15 | superclass = subclass;
16 | subclass = function() { superclass.apply(this, arguments); };
17 |
18 | var F = function() {};
19 | F.prototype = superclass.prototype;
20 | subclass.prototype = new F();
21 |
22 | subclass.extend = function(o) { return Ext.extend(subclass, o); };
23 | };
24 |
--------------------------------------------------------------------------------
/node_modules/tern/test/cases/browser.js:
--------------------------------------------------------------------------------
1 | // environment=browser
2 |
3 | window.document.body; //: Element
4 |
5 | var newElt = document.createElement("div"); //: Element
6 |
7 | newElt.style.border; //: string
8 |
9 | var e_which;
10 | window.addEventListener("mousemove", function(e) { e_which = e.which; });
11 | e_which; //: number
12 |
--------------------------------------------------------------------------------
/node_modules/tern/test/cases/builtins.js:
--------------------------------------------------------------------------------
1 | var x = Math.PI; //: number
2 | Math.cos(x); //: number
3 |
4 | var a = [1, 2, 3]; //: [number]
5 | a.slice(2); //: [number]
6 | a.pop(); //: number
7 |
8 | ["x"].concat(["hi"]); //: [string]
9 |
10 | [true, false, true].filter(function(x){return x;}); //: [bool]
11 |
12 | [].map(function() {return "x";}); //: [string]
13 |
14 | [].reduce(function(a, b) { return a - 2; }, 0); //: number
15 |
16 | Math.cos.call(null, 10); //: number
17 |
18 | (10).toFixed; //: fn(digits: number) -> string
19 |
20 | "foo bar baz".split(" "); //: [string]
21 |
22 | toString; //: fn() -> string
23 |
24 | new Date; //: Date
25 |
26 | var num = new Number(1);
27 | num; //: Number
28 |
29 | "foo".toString(); //: string
30 |
31 | Array.prototype.slice.call([1, 2, 3], 1); //: [number]
32 |
33 | Array.prototype.slice.apply([1, 2, 3], [1]); //: [number]
34 |
35 | String.prototype.indexOf.bind("abcde", "a"); //: fn(from?: number) -> number
36 |
--------------------------------------------------------------------------------
/node_modules/tern/test/cases/catch_error.js:
--------------------------------------------------------------------------------
1 | try {
2 | foo();
3 | } catch(e) {
4 | e.message; //doc: A human-readable description of the error.
5 | }
6 |
--------------------------------------------------------------------------------
/node_modules/tern/test/cases/cautiouspropagation.js:
--------------------------------------------------------------------------------
1 | var grabbag = {};
2 | grabbag[foo()] = "hi";
3 | grabbag[bar()] = {abc: 10};
4 | grabbag[baz()] = [1, 2, 3];
5 | var inner = 55 || grabbag[quux()];
6 | inner; //: number
7 |
8 | var simple = {};
9 | simple[foo()] = "a";
10 | simple[bar()] = "b";
11 | simple[baz()] = "c";
12 | simple[quux()]; //: string
13 |
--------------------------------------------------------------------------------
/node_modules/tern/test/cases/complete_strings.js:
--------------------------------------------------------------------------------
1 | // plugin=complete_strings
2 | // blank-comments=true
3 |
4 | if (x == "foobar") {
5 | apparently(x == "f
6 | //<+ "foobar"
7 | }
8 |
--------------------------------------------------------------------------------
/node_modules/tern/test/cases/component/component.json:
--------------------------------------------------------------------------------
1 | {
2 | "dependencies": {
3 | "marijnh/tern": "*"
4 | }
5 | }
--------------------------------------------------------------------------------
/node_modules/tern/test/cases/component/components/marijnh-tern/component.json:
--------------------------------------------------------------------------------
1 | {
2 | "main": "index.js"
3 | }
--------------------------------------------------------------------------------
/node_modules/tern/test/cases/component/components/marijnh-tern/index.js:
--------------------------------------------------------------------------------
1 | exports.hello = function() { return 10; };
--------------------------------------------------------------------------------
/node_modules/tern/test/cases/component/localfile.js:
--------------------------------------------------------------------------------
1 | exports.hey = function() { return "you"; };
2 |
--------------------------------------------------------------------------------
/node_modules/tern/test/cases/component/main.js:
--------------------------------------------------------------------------------
1 | // plugin=component
2 |
3 | require('./localfile').hey; //: fn() -> string
4 | require('tern').hello; //: fn() -> number
--------------------------------------------------------------------------------
/node_modules/tern/test/cases/computedprop.js:
--------------------------------------------------------------------------------
1 | var x = {};
2 | x[foo()] = {a: 10, b: 20};
3 | x.bar.a; //: number
4 | x.bar. //+? a, b
5 |
--------------------------------------------------------------------------------
/node_modules/tern/test/cases/contextcomplete.js:
--------------------------------------------------------------------------------
1 | function whoAmI(a, i) {
2 | a.splice(i, 1);
3 | a.c //+? concat
4 | }
5 |
--------------------------------------------------------------------------------
/node_modules/tern/test/cases/copyprops.js:
--------------------------------------------------------------------------------
1 | function buildCopy(o) {
2 | var oo = {};
3 | for (var prop in o) oo[prop] = o[prop];
4 | return oo;
5 | }
6 |
7 | buildCopy({xx: 10, yy: 20}); //:: {xx: number, yy: number}
8 |
--------------------------------------------------------------------------------
/node_modules/tern/test/cases/ctorpattern.js:
--------------------------------------------------------------------------------
1 | // Verify that the binding of `this` to the top scope is overridden by
2 | // the binding to an instance.
3 |
4 | function Ctor() {
5 | if (!(this instanceof Ctor)) return new Ctor();
6 | this.foo = 20;
7 | }
8 |
9 | Ctor().foo; //: number
10 | foo; //: ?
11 |
--------------------------------------------------------------------------------
/node_modules/tern/test/cases/def_type_string.js:
--------------------------------------------------------------------------------
1 | // environment=string
2 |
3 | foo; //: string
4 |
--------------------------------------------------------------------------------
/node_modules/tern/test/cases/defineProperty.js:
--------------------------------------------------------------------------------
1 | var o = {};
2 |
3 | // Docstring for prop1
4 | Object.defineProperty(o, "prop1", {
5 | get: function() { return "hi"; }
6 | });
7 |
8 | Object.defineProperty(o, "prop2", {
9 | value: 100
10 | });
11 |
12 | o.prop1; //: string
13 | o.prop2; //: number
14 |
15 | o.prop1; //doc: Docstring for prop1
16 |
--------------------------------------------------------------------------------
/node_modules/tern/test/cases/defs/span.json:
--------------------------------------------------------------------------------
1 | {
2 | "!name": "a/b.js",
3 | "iHaveASpan": {
4 | "!type": "fn()",
5 | "!span": "40[3:2]-60[3:22]"
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/node_modules/tern/test/cases/defs/string.json:
--------------------------------------------------------------------------------
1 | {
2 | "!name": "a/b.js",
3 | "foo": {
4 | "!type": "string",
5 | "!span": "1[1:1]-2[2:2]"
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/node_modules/tern/test/cases/docstrings.js:
--------------------------------------------------------------------------------
1 | Date; //doc: Creates JavaScript Date instances which let you work with dates and times.
2 | new Date; //doc: Creates JavaScript Date instances which let you work with dates and times.
3 |
4 | var myalias = Date;
5 |
6 | myalias; //doc: Creates JavaScript Date instances which let you work with dates and times.
7 |
8 | // This is variable foo.
9 | var foo = 10;
10 |
11 | foo; //doc: This is variable foo.
12 |
13 | // This function returns a monkey.
14 | function makeMonkey() { return "monkey"; }
15 |
16 | makeMonkey; //doc: This function returns a monkey.
17 |
18 | var monkeyAlias = makeMonkey;
19 |
20 | monkeyAlias; //doc: This function returns a monkey.
21 |
22 | // This is an irrelevant comment.
23 |
24 |
25 | // This describes abc.
26 | var abc = 20;
27 |
28 | abc; //doc: This describes abc.
29 |
30 | // Quux is a thing. And here are a bunch more sentences that would
31 | // make the docstring too long, and are thus wisely stripped by Tern's
32 | // brain-dead heuristics. Ayay.
33 | function Quux() {}
34 |
35 | Quux; //doc: Quux is a thing.
36 |
37 | /* Extra bogus
38 | * whitespace is also stripped.
39 | */
40 | var baz = "hi";
41 |
42 | baz; //doc: Extra bogus whitespace is also stripped.
43 |
44 | var o = {
45 | // Get the name.
46 | getName: function() { return this.name; },
47 | // The name
48 | name: "Harold"
49 | };
50 |
51 | // The string "foo".
52 | o.foo = "foo";
53 |
54 | o.getName; //doc: Get the name.
55 | o.name; //doc: The name
56 | o.foo; //doc: The string "foo".
57 |
--------------------------------------------------------------------------------
/node_modules/tern/test/cases/effects.js:
--------------------------------------------------------------------------------
1 | ["foo", "bar"].map(function(s) { return s.charCodeAt(0); }); //: [number]
2 |
3 | var b = [];
4 | b.push(true);
5 | b; //: [bool]
6 |
7 | var c = [];
8 | c.push("hi");
9 | c.push(10);
10 | c; //: [string|number]
11 |
12 | var d;
13 | function setD(a) { d = a; }
14 | setD.call(null, 55);
15 | d; //: number
16 |
--------------------------------------------------------------------------------
/node_modules/tern/test/cases/extends.js:
--------------------------------------------------------------------------------
1 | // Follows the pattern CoffeeScript uses to define classes.
2 |
3 | var __extends = function(child, parent) {
4 | for (var key in parent) { child[key] = parent[key]; }
5 | function ctor() { this.constructor = child; }
6 | ctor.prototype = parent.prototype;
7 | child.prototype = new ctor();
8 | };
9 |
10 | var Top = (function() {
11 | function Top() {}
12 | Top.prototype.topMethod = function() {return "hey";};
13 | Top.topStatic = 20;
14 | return Top;
15 | })();
16 |
17 | var SubOne = (function(_super) {
18 | function SubOne(arg) { this.argOne = arg; }
19 | __extends(SubOne, _super);
20 | SubOne.prototype.methodOne = function() {return 11;};
21 | return SubOne;
22 | })(Top);
23 |
24 | var SubTwo = (function(_super) {
25 | function SubTwo(arg) { this.argTwo = arg; }
26 | __extends(SubTwo, _super);
27 | SubTwo.prototype.methodTwo = function() {return null;};
28 | return SubTwo;
29 | })(Top);
30 |
31 | var SubEleven = (function(_super) {
32 | function SubEleven(arg) { SubOne.call(this, arg); }
33 | __extends(SubEleven, SubOne);
34 | SubEleven.prototype.methodEleven = function() {return "blah";};
35 | return SubEleven;
36 | })(SubOne);
37 |
38 | var top = new Top, one = new SubOne(true), two = new SubTwo(false), elf = new SubEleven(true);
39 |
40 | one.topMethod; //: fn() -> string
41 |
42 | one.methodOne; //: fn() -> number
43 |
44 | one.argOne; //: bool
45 |
46 | one.argTwo; //: ?
47 |
48 | two.argTwo; //: bool
49 |
50 | one.methodTwo; //: ?
51 |
52 | one.methodEleven; //: ?
53 |
54 | SubEleven.topStatic; //: number
55 |
56 | elf.methodOne; //: fn() -> number
57 |
58 | elf.methodEleven(); //: string
59 |
60 | two.methodEleven; //: ?
61 |
--------------------------------------------------------------------------------
/node_modules/tern/test/cases/finddef.js:
--------------------------------------------------------------------------------
1 | function blah() {}
2 |
3 | var jaja = 40;
4 |
5 | var obj = {
6 | prop1: 10,
7 | prop2: function(foo) {}
8 | };
9 |
10 | obj.prop3 = "hi";
11 |
12 | blah; //loc: 1, 9
13 | jaja; //loc: 3, 4
14 | obj; //loc: 5, 4
15 | obj.prop1; //loc: 6, 2
16 | obj.prop2; //loc: 7, 2
17 | obj.prop3; //loc: 10, 4
18 |
19 | function hide() { return obj.prop2; }
20 |
21 | hide(); //loc: 7, 9
22 |
23 | function another(arg) {
24 | var local = 1;
25 | arg; // 23, 17
26 | local; //loc: 24, 6
27 | }
28 |
--------------------------------------------------------------------------------
/node_modules/tern/test/cases/findref.js:
--------------------------------------------------------------------------------
1 | function hello(a, b) {
2 | var c = a + b;
3 | hello(a, c);
4 | a; //refs: 1,15 2,10 3,8, 4,2
5 | c; //refs: 2,6 3,11 5,2
6 | }
7 |
8 | hello; //refs: 1,9 3,2 8,0
9 |
10 | var obj = {
11 | x // string
15 | this.foo; //: fn() -> number
16 | }
17 | });
18 |
--------------------------------------------------------------------------------
/node_modules/tern/test/cases/infinite-expansion.js:
--------------------------------------------------------------------------------
1 | // Issue #16
2 |
3 | var f = function(n) {
4 | n.prototype = {}; // Make this count as a type construction function
5 | f(n()); // Push an IsCallee constraint from the body
6 | };
7 | f(f);
8 |
9 | // Create a self-referential type
10 | var x = [x];
11 |
12 | // Force analysis
13 | x[0]; //: [?]
14 |
15 | function goop(n) {
16 | n.prototype = {};
17 | return function(f){f(1);};
18 | };
19 | goop(1)(goop);
20 |
--------------------------------------------------------------------------------
/node_modules/tern/test/cases/jquery_event.js:
--------------------------------------------------------------------------------
1 | // environment=browser
2 | // environment=jquery
3 |
4 | $("#foo").blur().click(function(e) {
5 | e; //: jQuery.Event
6 | e.pageX; //: number
7 | });
8 |
--------------------------------------------------------------------------------
/node_modules/tern/test/cases/jsdoc.js:
--------------------------------------------------------------------------------
1 | /** @type {Date} */
2 | var a = getSomething();
3 | a; //: Date
4 |
5 | a.getTime; //: fn() -> number
6 |
7 | /** @type {{x: Integer, y: [String]}} */
8 | var c = somethingElse();
9 | c; //:: {x: number, y: [string]}
10 |
11 | /**
12 | * This is a function
13 | * @return {[Number]}
14 | * @param {Number} a
15 | * @param {String} b
16 | */
17 | function foo(a, b) { return hohoho(); }
18 | foo; //: fn(a: number, b: string) -> [number]
19 |
20 | /** @this Date */
21 | var abc = function() {
22 | this; //: Date
23 | };
24 |
25 | /**
26 | * This is also a function
27 | * @returns {string}
28 | * @arg {Number} a
29 | */
30 | var bar = function(a, b) { return goop(); };
31 | bar(gulp(), 10);
32 | bar; //: fn(a: number, b: number) -> string
33 |
34 | var o = {
35 | /** @type {String} */
36 | prop1: mystery(),
37 |
38 | /** @returns {Number} */
39 | prop2: function() { return anything(); }
40 | };
41 |
42 | /** @returns {String} */
43 | o.prop3 = function() { return something(); };
44 |
45 | o.prop1; //: string
46 | o.prop2; //: fn() -> number
47 | o.prop3; //: fn() -> string
48 |
49 | /** @type {Array.} */
50 | var closureArray = anotherThing();
51 | closureArray[1]; //: string
52 |
53 | /** @type {Object.} */
54 | var closureMap = yetAnotherThing();
55 | closureMap[1]; //: bool
56 |
57 | /** @param {Number=} a */
58 | function takesOpt(a) { console.log(a || 20); }
59 |
60 | takesOpt; //: fn(a?: number)
61 |
62 | /** @typedef {Array.} Bitset */
63 |
64 | someNonDeclarationStatement();
65 |
66 | /** @type {Bitset} */
67 | var myBitset = getABitset();
68 |
69 | myBitset; //: [bool]
70 |
71 | function NonAscïį() { this.length = "hi"; }
72 |
73 | /** @type {NonAscïį} */
74 | var inst;
75 |
76 | inst.length; //: string
77 |
78 | /** @type {bogus.Type} */
79 | var bogus = abcdef();
80 |
81 | bogus; //: bogus.Type
82 |
83 | /** @type {bogus.Overridden} */
84 | var again = 10;
85 |
86 | again; //: number
87 |
88 | /**
89 | * @return {bogus.Retval}
90 | * @param {bogus.Arg} a
91 | */
92 | function functionBogus(a) { return hohoho(); }
93 |
94 | functionBogus; //: fn(a: bogus.Arg) -> bogus.Retval
95 |
96 | /** @type {string|number} */
97 | var stringOrNumber;
98 |
99 | stringOrNumber; //: string|number
100 |
101 | /**
102 | * @param {string|null} a
103 | * @return {Array.}
104 | */
105 | function unionFunction(a) { return argh(); }
106 |
107 | unionFunction; //: fn(a: string) -> [Foo|number]
108 |
--------------------------------------------------------------------------------
/node_modules/tern/test/cases/merge.js:
--------------------------------------------------------------------------------
1 | function sum(a) {
2 | return a.x + 20;
3 | }
4 |
5 | sum({x: 10, y: 20});
6 | sum({x: 10, y: 20});
7 |
8 | sum; //:: fn(a: {x: number, y: number}) -> number
9 |
--------------------------------------------------------------------------------
/node_modules/tern/test/cases/new_array.js:
--------------------------------------------------------------------------------
1 | var a = new Array();
2 | a.push("hi");
3 | a[0]; //: string
4 |
5 | var b = new Array(true, false, true);
6 | b[0]; //: bool
7 |
8 | var c = new Array(1);
9 | c[0]; //: ?
10 |
11 | var d = new Array("one");
12 | d[0]; //: string
13 |
--------------------------------------------------------------------------------
/node_modules/tern/test/cases/new_to_prototype.js:
--------------------------------------------------------------------------------
1 | function A() {}
2 | A.prototype.prop_A = 1;
3 | function B() {}
4 | B.prototype = new A;
5 | B.prototype.prop_B = 2;
6 | function C() {}
7 | C.prototype = new A;
8 | C.prototype.prop_C = 3;
9 |
10 | (new A).prop_ //+ prop_A
11 | ;
12 | (new B).prop_ //+ prop_A, prop_B
13 | ;
14 | (new C).prop_ //+ prop_A, prop_C
15 |
--------------------------------------------------------------------------------
/node_modules/tern/test/cases/node/binary.node:
--------------------------------------------------------------------------------
1 | exports.binary = 1;
2 |
--------------------------------------------------------------------------------
/node_modules/tern/test/cases/node/dir/index.js:
--------------------------------------------------------------------------------
1 | exports.foo = "hey";
2 | exports.rel = require("./lib/relative");
3 |
--------------------------------------------------------------------------------
/node_modules/tern/test/cases/node/dir/lib/other.js:
--------------------------------------------------------------------------------
1 | exports.xyz = "foo";
2 |
--------------------------------------------------------------------------------
/node_modules/tern/test/cases/node/dir/lib/relative.js:
--------------------------------------------------------------------------------
1 | exports.abc = 1;
2 | exports.def = require("./other.js");
3 |
--------------------------------------------------------------------------------
/node_modules/tern/test/cases/node/exportfunc.js:
--------------------------------------------------------------------------------
1 | var f = module.exports = function(a, b) {
2 | return a + b;
3 | };
4 |
5 | f(1, 2);
6 |
--------------------------------------------------------------------------------
/node_modules/tern/test/cases/node/localfile.js:
--------------------------------------------------------------------------------
1 | exports.hello = function() { return 10; };
2 |
--------------------------------------------------------------------------------
/node_modules/tern/test/cases/node/main.js:
--------------------------------------------------------------------------------
1 | // plugin=node
2 |
3 | var fs = require("fs"), crypto = require("crypto"), tls = require("tls");
4 |
5 | fs.readFileSync; //: fn(filename: string, encoding: string) -> Buffer
6 |
7 | fs.stat("foobar", function(err, stats) {
8 | err; //: Error
9 | stats.isFile(); //: bool
10 | });
11 |
12 | var module = {};
13 |
14 | crypto.getCiphers()[3]; //: string
15 | crypto.createHash("sha1").digest().readUInt16BE(0); //: number
16 |
17 | tls.createServer({}, function(stream) {
18 | // Has event emitter props
19 | stream.once; //: fn(event: string, listener: fn())
20 | // Writable stream props
21 | stream.write; //: fn(chunk: Buffer, encoding?: string, callback?: fn()) -> bool
22 | // Readable stream
23 | stream.read; //: fn(size?: number) -> Buffer
24 | // ClearTextStream
25 | stream.authorized; //: bool
26 | });
27 |
28 | require("timers").setInterval; //: fn(callback: fn(), ms: number) -> timers.Timer
29 | setInterval; //: fn(callback: fn(), ms: number) -> timers.Timer
30 | setTimeout(function(){}, 10).ref; //: fn()
31 |
32 |
33 | require("module");
34 |
35 | // don't attempt to handle .node binary modules
36 | require("./binary.node").binary; //: ?
37 |
38 | var mymod = require("mymod");
39 |
40 | require("_stream_readable");
41 |
42 | mymod.foo; //: number
43 | mymod.bar; //: string
44 |
45 | require("./localfile").hello; //: fn() -> number
46 |
47 | require("./foo/../exportfunc.js"); //: fn(a: number, b: number) -> number
48 |
49 | require("./dir"); //:: {foo: string, rel: {abc: number, def: {xyz: string}}}
50 |
51 | var mod1 = require("mod1");
52 | var mod2 = require("mod1/mainfile.js");
53 | mod1.mainExport.x; //: number
54 | mod2.mainExport.x; //: number
55 | mod1.fromSubdep; //: fn()
56 |
57 | require("mod1/secondfile").secondExport.u; //: number
58 | require("mod1/dir1").foo.a; //: number
59 |
60 | require("mod1/reassign_exports").funcPropExport; //loc: 2, 15
61 |
62 | require("mod1/reassign_exports_to_required"); //:: {A: number}
63 |
64 | // inference should continue even if a module is not found
65 | require("mod_not_found"); //: ?
66 |
67 | var doc = require("mod1/doc");
68 | doc.f1; //doc: doc for f1
69 | doc.f2; //doc: doc for f2
70 |
71 | module.exports. //+
72 |
73 | // completion on known require module
74 | require('f //+ 'fs'
75 | // completion on custom require module
76 | require("my //+ "mymod"
77 |
78 | // go to definition for modulest
79 | require('./localfile'//loc: 1, 0, localfile.js
80 |
--------------------------------------------------------------------------------
/node_modules/tern/test/cases/node_exports.js:
--------------------------------------------------------------------------------
1 | // plugin=node
2 |
3 | exports.a = 10;
4 |
5 | exports.b = function() {};
6 |
7 | //exports: {a: number, b: fn()}
8 |
9 |
--------------------------------------------------------------------------------
/node_modules/tern/test/cases/node_modules/mod1/a.js:
--------------------------------------------------------------------------------
1 | exports.A = 1;
2 |
--------------------------------------------------------------------------------
/node_modules/tern/test/cases/node_modules/mod1/dir1/index.js:
--------------------------------------------------------------------------------
1 | exports.foo = {a: 10};
2 |
--------------------------------------------------------------------------------
/node_modules/tern/test/cases/node_modules/mod1/doc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | // doc for f1
3 | f1: function() { return 7; }
4 | };
5 |
6 | // doc for f2
7 | module.exports.f2 = function() { return 7; };
8 |
--------------------------------------------------------------------------------
/node_modules/tern/test/cases/node_modules/mod1/mainfile.js:
--------------------------------------------------------------------------------
1 | exports.mainExport = {x: 10, y: 20};
2 |
3 | exports.fromSubdep = require("subdep1").subdepFunc;
4 |
--------------------------------------------------------------------------------
/node_modules/tern/test/cases/node_modules/mod1/node_modules/subdep1/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "subdep1",
3 | "version": "0.0.1",
4 | "main": "subdep1"
5 | }
6 |
--------------------------------------------------------------------------------
/node_modules/tern/test/cases/node_modules/mod1/node_modules/subdep1/subdep1.js:
--------------------------------------------------------------------------------
1 | exports.subdepFunc = function(){};
2 |
--------------------------------------------------------------------------------
/node_modules/tern/test/cases/node_modules/mod1/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "main": "mainfile.js",
3 | "dependencies": {
4 | "subdep1": "0.0.1"
5 | },
6 | "bundledDependencies": ["subdep1"]
7 | }
8 |
--------------------------------------------------------------------------------
/node_modules/tern/test/cases/node_modules/mod1/reassign_exports.js:
--------------------------------------------------------------------------------
1 | module.exports = function() {};
2 | module.exports.funcPropExport = 7;
3 |
--------------------------------------------------------------------------------
/node_modules/tern/test/cases/node_modules/mod1/reassign_exports_to_required.js:
--------------------------------------------------------------------------------
1 | module.exports = require('./a');
2 |
--------------------------------------------------------------------------------
/node_modules/tern/test/cases/node_modules/mod1/secondfile.js:
--------------------------------------------------------------------------------
1 | exports.secondExport = {u: 10, v: 20};
2 |
--------------------------------------------------------------------------------
/node_modules/tern/test/cases/node_modules/mymod.json:
--------------------------------------------------------------------------------
1 | {
2 | "!name": "mymod",
3 | "exports": {
4 | "foo": "number",
5 | "bar": "string"
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/node_modules/tern/test/cases/node_origin_paths.js:
--------------------------------------------------------------------------------
1 | // plugin=node
2 |
3 | require('./node_exports').b; //origin: node_exports.js
4 |
--------------------------------------------------------------------------------
/node_modules/tern/test/cases/object_create.js:
--------------------------------------------------------------------------------
1 | var base = {foo: 10, bar: 20};
2 | var gen1 = Object.create(base);
3 | var gen2 = Object.create(gen1);
4 |
5 | base.baz = 30;
6 | gen1.quux = 50;
7 | gen2.kaka = 10;
8 |
9 | gen1.foo; //: number
10 |
11 | gen2.foo; //: number
12 |
13 | gen1.baz; //: number
14 |
15 | gen2.baz; //: number
16 |
17 | gen1.quux; //: number
18 |
19 | gen2.quux; //: number
20 |
21 | gen1.kaka; //: ?
22 |
23 | var extend = Object.create(base, {prop1: {value: "hi"}, prop2: {}});
24 |
25 | extend.prop1; //: string
26 |
27 | extend.bar; //: number
28 |
29 | var empty = Object.create(null);
30 | empty.prop1 = "hi";
31 |
32 | empty.hasOwnProperty; //: ?
33 | empty.prop1; //: string
34 |
--------------------------------------------------------------------------------
/node_modules/tern/test/cases/objnames.js:
--------------------------------------------------------------------------------
1 | function Ctor1() { this.x = 10; }
2 | Ctor1.prototype = {a: 1};
3 |
4 | function Ctor2() {}
5 |
6 | var singleton = {a: 10, b: 20}; //: singleton
7 |
8 | new Ctor1(); //: Ctor1
9 | new Ctor2(); //: Ctor2
10 |
--------------------------------------------------------------------------------
/node_modules/tern/test/cases/order_of_definition.js:
--------------------------------------------------------------------------------
1 | foo.bar.baz.bug({
2 | prop: function() {
3 | this.a; //: bool
4 | }
5 | });
6 |
7 | var foo = {};
8 |
9 | var baz = {bug: function(o) {
10 | function x() { this.a = true; }
11 | x.prototype = o;
12 | return new x;
13 | }};
14 |
15 | foo.bar = {baz: baz};
16 |
--------------------------------------------------------------------------------
/node_modules/tern/test/cases/plus.js:
--------------------------------------------------------------------------------
1 | var x = 10;
2 | var y = "foo";
3 |
4 | x + 20; //: number
5 | x + y; //: string
6 | "foo" + y; //: string
7 | "foo" + x; //: string
8 |
--------------------------------------------------------------------------------
/node_modules/tern/test/cases/promise.js:
--------------------------------------------------------------------------------
1 | // environment=ecma6
2 |
3 | var p = new Promise(function(accept, reject) {
4 | reject; //: fn(reason: ?)
5 | accept({x: 20});
6 | });
7 |
8 | p.then(function(value) {
9 | value; //:: {x: number}
10 | });
11 |
12 | var p2 = new Promise(function(acc) { acc("hi"); });
13 |
14 | Promise.all([p2]).then(function(value) {
15 | value; //: string
16 | });
17 |
18 | var p3 = Promise.resolve(10);
19 | p3.value; //: number
20 |
21 | p3.then(function(value) {
22 | value; //: number
23 | });
24 |
--------------------------------------------------------------------------------
/node_modules/tern/test/cases/proto.js:
--------------------------------------------------------------------------------
1 | function Foo(x) {
2 | this.x = x;
3 | this.y = [1];
4 | }
5 | Foo; //: fn(x: bool)
6 |
7 | Foo.prototype = {
8 | makeString: function() { return "hi"; },
9 | bar: 13
10 | };
11 |
12 | var z = new Foo(true); //:: {x: bool, y: [number]}
13 |
14 | z.toString; //: fn() -> string
15 |
16 | z.bar; //: number
17 |
--------------------------------------------------------------------------------
/node_modules/tern/test/cases/protoname.js:
--------------------------------------------------------------------------------
1 | function Base() {}
2 | Base.prototype = {};
3 |
4 | Base.prototype; //: Base.prototype
5 | new Base; //: Base
6 |
7 | function Sub1() {}
8 | Sub1.prototype = new Base();
9 | new Sub1(); //: Sub1
10 |
11 | function Sub2() {}
12 | Sub2.prototype = Object.create(Base.prototype);
13 | new Sub2(); //: Sub2
14 |
15 | function Base2() {}
16 |
17 | function Sub3() {}
18 | Sub3.prototype = new Base2();
19 |
20 | new Sub3(); //: Sub3
21 |
--------------------------------------------------------------------------------
/node_modules/tern/test/cases/replace_bogus_prop.js:
--------------------------------------------------------------------------------
1 | var x = new Type();
2 |
3 | x.foo; //: string
4 |
5 | function Type() {}
6 | Type.prototype.foo = "hi";
7 |
--------------------------------------------------------------------------------
/node_modules/tern/test/cases/requirejs/bar.js:
--------------------------------------------------------------------------------
1 | define(["baz"], function(baz) {
2 | return {aNumber: 10, baz: baz};
3 | });
4 |
--------------------------------------------------------------------------------
/node_modules/tern/test/cases/requirejs/baz.js:
--------------------------------------------------------------------------------
1 | define("foo", function(foo) {
2 | return {bazProp: new Date, bazFooProp: foo.aString};
3 | });
4 |
--------------------------------------------------------------------------------
/node_modules/tern/test/cases/requirejs/foo.js:
--------------------------------------------------------------------------------
1 | define({aString: "hello"});
2 |
--------------------------------------------------------------------------------
/node_modules/tern/test/cases/requirejs/func.js:
--------------------------------------------------------------------------------
1 | define(function(require, exports, module){
2 | function aFunction() { return false; }
3 | return aFunction;
4 | });
5 |
--------------------------------------------------------------------------------
/node_modules/tern/test/cases/requirejs/main.js:
--------------------------------------------------------------------------------
1 | // environment=browser
2 | // environment=jquery
3 | // plugin=requirejs {"override": {"jquery": "=$"}}
4 |
5 | requirejs(["foo", "bar!abc", "useexports", "simplifiedcommon", "subdir/zap", "module_exports"],
6 | function(foo, bar, useexports, simplified, zap, module_exports) {
7 | foo.aString; //: string
8 | bar.aNumber; //: number
9 | bar.baz.bazProp; //: Date
10 | bar.baz.bazFooProp; //: string
11 | useexports.hello; //: bool
12 | simplified.hello; //: string
13 | simplified.func; //: fn() -> bool
14 | zap; //: string
15 | module_exports; //:: {one: number, two: number}
16 |
17 | foo; //origin: foo.js
18 | bar; //origin: bar.js
19 | bar.baz; //origin: baz.js
20 | });
21 |
22 | requirejs(["jquery"], function($) {
23 | $.fx.off; //: bool
24 | });
25 |
26 | requirejs(["require"], function(require) {
27 | require("jquery").fx.off; //: bool
28 | require("requireme").someprop; //: string
29 | });
30 |
31 | requirejs(["named"], function(named) {
32 | named.foo; //:: {a: number}
33 | });
34 |
35 | requirejs.config({
36 | p //+ packages, paths, ...
37 | });
38 |
39 | requirejs.config({
40 | //+ baseUrl, config, context, map, nodeIdCompat, packages, paths, shim, ...
41 | });
42 |
43 | requirejs.config({
44 | baseUrl: '',
45 | //+ config, context, map, nodeIdCompat, packages, paths, shim, ...
46 | });
47 |
--------------------------------------------------------------------------------
/node_modules/tern/test/cases/requirejs/module_exports.js:
--------------------------------------------------------------------------------
1 | define(["module"], function(module) {
2 | module.exports = {one: 1, two: 2};
3 | });
4 |
--------------------------------------------------------------------------------
/node_modules/tern/test/cases/requirejs/named.js:
--------------------------------------------------------------------------------
1 | define("myname", ["exports"], function(exports) {
2 | exports.foo = {a: 10};
3 | });
4 |
--------------------------------------------------------------------------------
/node_modules/tern/test/cases/requirejs/requireme.js:
--------------------------------------------------------------------------------
1 | define(["exports"], function(exports) {
2 | exports.someprop = "a string";
3 | });
4 |
--------------------------------------------------------------------------------
/node_modules/tern/test/cases/requirejs/simplifiedcommon.js:
--------------------------------------------------------------------------------
1 | define(function(require, exports) {
2 | exports.hello = require("foo").aString;
3 | exports.func = require("func");
4 | });
5 |
--------------------------------------------------------------------------------
/node_modules/tern/test/cases/requirejs/subdir/zap.js:
--------------------------------------------------------------------------------
1 | define(["../foo"], function(foo) {
2 | return foo.aString;
3 | });
4 |
--------------------------------------------------------------------------------
/node_modules/tern/test/cases/requirejs/useexports.js:
--------------------------------------------------------------------------------
1 | define(["exports"], function(exports) {
2 | exports.hello = true;
3 | });
4 |
--------------------------------------------------------------------------------
/node_modules/tern/test/cases/requirejs_config/main.js:
--------------------------------------------------------------------------------
1 | // plugin=requirejs
2 |
3 | requirejs.config({
4 | paths: {
5 | fooAlias: "../requirejs/foo"
6 | }
7 | });
8 |
9 | require(["fooAlias"], function(foo) {
10 | foo.aString; //: string
11 | });
12 |
--------------------------------------------------------------------------------
/node_modules/tern/test/cases/simple.js:
--------------------------------------------------------------------------------
1 | var foo = (function() {
2 | return 42;
3 | })();
4 | foo; //: number
5 |
6 | var x = {};
7 |
8 | function init(v) {
9 | v.foo = 10;
10 | v.bar = 1 + 1;
11 | }
12 | init; //:: fn(v: {bar: number, foo: number})
13 |
14 | init(x);
15 | x; //:: {bar: number, foo: number}
16 |
--------------------------------------------------------------------------------
/node_modules/tern/test/cases/simple_generic.js:
--------------------------------------------------------------------------------
1 | function last(arr) { return arr[arr.length - 1]; }
2 |
3 | last([1, 2, 3]); //: number
4 | last(["a", "b", "c"]); //: string
5 |
6 | function map(arr, f) {
7 | var res = [];
8 | for (var i = 0; i < arr.length; ++i) res.push(f(arr[i]));
9 | return res;
10 | }
11 |
12 | map([1, 2, 3], function() { return "X"; }); //: [string]
13 | map([1, 2, 3], function() { return true; }); //: [bool]
14 |
--------------------------------------------------------------------------------
/node_modules/tern/test/cases/span_from_def.js:
--------------------------------------------------------------------------------
1 | // environment=span
2 |
3 | iHaveASpan; //loc: 4, 2
4 |
--------------------------------------------------------------------------------
/node_modules/tern/test/cases/underscore.js:
--------------------------------------------------------------------------------
1 | // environment=underscore
2 |
3 | var cloneObjOrig = {a: 1}, cloneObjCopy = _.clone(cloneObjOrig);
4 | cloneObjOrig.a; //: number
5 | cloneObjCopy.a; //: number
6 |
7 | var extendObj = {a: 1, b: true};
8 | _.extend(extendObj, {c: ''}, {d: 2});
9 | extendObj; //:: {a: number, b: bool, c: string, d: number}
10 |
11 | var defaulted = {x: 10};
12 | _.defaults(defaulted, {y: ""});
13 | defaulted.x; //: number
14 | defaulted.y; //: string
15 |
16 | _.has({}, "foo"); //: bool
17 | _.isNaN(NaN); //: bool
18 |
19 | var tapped;
20 | _.tap(11, function(a) { tapped = a; });
21 | tapped; //: number
22 |
23 | _.reduce(["foo", "bar"], function(sum, s) { return sum + s.length; }, 0); //: number
24 | _.map([1, 2, 3], toString); //: [string]
25 | _.each([true, false], function(val, i) {
26 | val; //: bool
27 | i; //: number
28 | this.aa; //: number
29 | }, {aa: 4});
30 |
--------------------------------------------------------------------------------
/node_modules/tern/test/condense.js:
--------------------------------------------------------------------------------
1 | var util = require("./util");
2 | var tern = require("../lib/tern"), condense = require("../lib/condense");
3 | var fs = require("fs"), path = require("path");
4 | require("../plugin/angular");
5 | require("../plugin/node");
6 |
7 | var condenseDir = "test/condense";
8 | function jsonFile(name) { return util.resolve(condenseDir + "/" + name.replace(/\.js$/, ".json")); }
9 |
10 | function runTest(options) {
11 | var server = new tern.Server({
12 | defs: [util.ecma5, util.browser],
13 | plugins: options.plugins,
14 | projectDir: util.resolve(condenseDir),
15 | getFile: function(name) {
16 | return fs.readFileSync(path.resolve(condenseDir, name), "utf8");
17 | }
18 | });
19 | options.load.forEach(function(file) {
20 | server.addFile(file);
21 | });
22 | server.flush(function() {
23 | var origins = options.include || options.load;
24 | var condensed = condense.condense(origins, null, {sortOutput: true});
25 | var out = JSON.stringify(condensed, null, 2);
26 | var expect = fs.readFileSync(jsonFile(origins[0]), "utf8").trim();
27 | if (out != expect)
28 | return util.failure("condense/" + origins[0] + ": Mismatch in condense output. Got " +
29 | out + "\nExpected " + expect);
30 |
31 | // Test loading the condensed defs.
32 | var server2 = new tern.Server({
33 | defs: [util.ecma5, util.browser, condensed],
34 | plugins: options.plugins
35 | });
36 | server2.flush(function() {
37 | var condensed = condense.condense(origins, null, {sortOutput: true});
38 | var out = JSON.stringify(condensed, null, 2);
39 | if (out != expect)
40 | util.failure("condense/" + origins[0] + ": Mismatch in condense output after loading defs. Got " +
41 | out + "\nExpected " + expect);
42 | });
43 | });
44 | }
45 |
46 | exports.runTests = function(filter) {
47 | function jsFile(f) {
48 | return f + ".js";
49 | }
50 | function test(options) {
51 | if (typeof options == "string") options = {load: [options]};
52 | options.load = options.load.map(jsFile);
53 | if (options.include) options.include = options.include.map(jsFile);
54 | if (filter && options.load[0].indexOf(filter) == -1) return;
55 | util.addTest();
56 | util.addFile();
57 | runTest(options);
58 | }
59 |
60 | test("basic");
61 | test("fn");
62 | test("add_to_old");
63 | test({load: ["ignore_newer", "extend_foo"],
64 | include: ["ignore_newer"]});
65 | test("ref_to_old");
66 | test("ref_in_type");
67 | test("double_ref");
68 | test("proto");
69 | test("generic");
70 | test("array");
71 | test("function_prop");
72 | test("uniontype");
73 |
74 | test({load: ["node_simple"], plugins: {node: true}});
75 | test({load: ["node_require_private"], plugins: {node: true}});
76 | test({load: ["node_fn_export"], plugins: {node: true}});
77 | test({load: ["node_other_module_type_ref"], include: ["node_other_module_type_ref", "node_export_function_a"], plugins: {node: true}});
78 |
79 | test({load: ["angular_simple"], plugins: {angular: true}});
80 |
81 | test({load: ["requirejs_const"], plugins: {requirejs: true}});
82 | test({load: ["requirejs_primitive"], plugins: {requirejs: true}});
83 | test({load: ["requirejs_setup"], plugins: {requirejs: true}});
84 | test({load: ["requirejs_empty_deps"], plugins: {requirejs: true}});
85 | // TODO(sqs): if load order is reversed, then
86 | // !define.!requirejs.requirejs_dep.a duplicates the definition instead of
87 | // referring to !requirejs.requirejs_const.
88 | test({load: ["requirejs_const", "requirejs_dep"], include: ["requirejs_dep", "requirejs_const"], plugins: {requirejs: true}});
89 |
90 | test("recursive");
91 | };
92 |
--------------------------------------------------------------------------------
/node_modules/tern/test/condense/add_to_old.js:
--------------------------------------------------------------------------------
1 | function Thing() {}
2 |
3 | Element.prototype.foo = new Thing;
4 |
--------------------------------------------------------------------------------
/node_modules/tern/test/condense/add_to_old.json:
--------------------------------------------------------------------------------
1 | {
2 | "!name": "add_to_old.js",
3 | "Element": {
4 | "prototype": {
5 | "foo": {
6 | "!span": "39[2:18]-42[2:21]",
7 | "!type": "+Thing"
8 | }
9 | }
10 | },
11 | "Thing": {
12 | "!span": "9[0:9]-14[0:14]",
13 | "!type": "fn()"
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/node_modules/tern/test/condense/angular_simple.js:
--------------------------------------------------------------------------------
1 | angular.module("foo", []).value("fooVal", {info: "info"}});
2 |
3 | angular.module("test", ["foo"])
4 | // Doc for testVal
5 | .factory("testVal", function() {
6 | return "hi";
7 | });
8 |
--------------------------------------------------------------------------------
/node_modules/tern/test/condense/angular_simple.json:
--------------------------------------------------------------------------------
1 | {
2 | "!define": {
3 | "!ng": {
4 | "foo": {
5 | "!data": {
6 | "includes": []
7 | },
8 | "!proto": "angular.Module.prototype",
9 | "_inject_fooVal": {
10 | "!span": "32[0:32]-40[0:40]",
11 | "info": {
12 | "!span": "43[0:43]-47[0:47]",
13 | "!type": "string"
14 | }
15 | }
16 | },
17 | "test": {
18 | "!data": {
19 | "includes": [
20 | "foo"
21 | ]
22 | },
23 | "!proto": "angular.Module.prototype",
24 | "_inject_testVal": {
25 | "!doc": "Doc for testVal",
26 | "!span": "121[4:9]-130[4:18]",
27 | "!type": "string"
28 | }
29 | }
30 | }
31 | },
32 | "!name": "angular_simple.js"
33 | }
34 |
--------------------------------------------------------------------------------
/node_modules/tern/test/condense/array.js:
--------------------------------------------------------------------------------
1 | var x = [{a: 10, b: true}];
2 |
--------------------------------------------------------------------------------
/node_modules/tern/test/condense/array.json:
--------------------------------------------------------------------------------
1 | {
2 | "!define": {
3 | "x.": {
4 | "!span": "9[0:9]-25[0:25]",
5 | "a": {
6 | "!span": "10[0:10]-11[0:11]",
7 | "!type": "number"
8 | },
9 | "b": {
10 | "!span": "17[0:17]-18[0:18]",
11 | "!type": "bool"
12 | }
13 | }
14 | },
15 | "!name": "array.js",
16 | "x": {
17 | "!span": "4[0:4]-5[0:5]",
18 | "!type": "[x.]"
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/node_modules/tern/test/condense/basic.js:
--------------------------------------------------------------------------------
1 | var x = 10;
2 | var y = {
3 | foo: 20,
4 | bar: "hi";
5 | };
6 |
--------------------------------------------------------------------------------
/node_modules/tern/test/condense/basic.json:
--------------------------------------------------------------------------------
1 | {
2 | "!name": "basic.js",
3 | "x": {
4 | "!span": "4[0:4]-5[0:5]",
5 | "!type": "number"
6 | },
7 | "y": {
8 | "!span": "16[1:4]-17[1:5]",
9 | "bar": {
10 | "!span": "35[3:2]-38[3:5]",
11 | "!type": "string"
12 | },
13 | "foo": {
14 | "!span": "24[2:2]-27[2:5]",
15 | "!type": "number"
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/node_modules/tern/test/condense/double_ref.js:
--------------------------------------------------------------------------------
1 | var a = {an: "object"};
2 | var b = a;
3 |
--------------------------------------------------------------------------------
/node_modules/tern/test/condense/double_ref.json:
--------------------------------------------------------------------------------
1 | {
2 | "!name": "double_ref.js",
3 | "a": {
4 | "!span": "4[0:4]-5[0:5]",
5 | "an": {
6 | "!span": "9[0:9]-11[0:11]",
7 | "!type": "string"
8 | }
9 | },
10 | "b": "a"
11 | }
12 |
--------------------------------------------------------------------------------
/node_modules/tern/test/condense/extend_foo.js:
--------------------------------------------------------------------------------
1 | foo.z = {something: "else"};
2 |
--------------------------------------------------------------------------------
/node_modules/tern/test/condense/fn.js:
--------------------------------------------------------------------------------
1 | function a(){}
2 | var b = a;
3 |
--------------------------------------------------------------------------------
/node_modules/tern/test/condense/fn.json:
--------------------------------------------------------------------------------
1 | {
2 | "!name": "fn.js",
3 | "a": {
4 | "!span": "9[0:9]-10[0:10]",
5 | "!type": "fn()"
6 | },
7 | "b": "a"
8 | }
9 |
--------------------------------------------------------------------------------
/node_modules/tern/test/condense/function_prop.js:
--------------------------------------------------------------------------------
1 | foo = function() {};
2 | foo.s = '';
3 |
--------------------------------------------------------------------------------
/node_modules/tern/test/condense/function_prop.json:
--------------------------------------------------------------------------------
1 | {
2 | "!name": "function_prop.js",
3 | "foo": {
4 | "!span": "0[0:0]-3[0:3]",
5 | "!type": "fn()",
6 | "s": {
7 | "!span": "25[1:4]-26[1:5]",
8 | "!type": "string"
9 | }
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/node_modules/tern/test/condense/generic.js:
--------------------------------------------------------------------------------
1 | function x(y) { return y.bar; }
2 |
--------------------------------------------------------------------------------
/node_modules/tern/test/condense/generic.json:
--------------------------------------------------------------------------------
1 | {
2 | "!name": "generic.js",
3 | "x": {
4 | "!span": "9[0:9]-10[0:10]",
5 | "!type": "fn(y: ?) -> !0.bar"
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/node_modules/tern/test/condense/ignore_newer.js:
--------------------------------------------------------------------------------
1 | var foo = {
2 | x: 10,
3 | y: 20
4 | };
5 |
--------------------------------------------------------------------------------
/node_modules/tern/test/condense/ignore_newer.json:
--------------------------------------------------------------------------------
1 | {
2 | "!name": "ignore_newer.js",
3 | "foo": {
4 | "!span": "4[0:4]-7[0:7]",
5 | "x": {
6 | "!span": "14[1:2]-15[1:3]",
7 | "!type": "number"
8 | },
9 | "y": {
10 | "!span": "23[2:2]-24[2:3]",
11 | "!type": "number"
12 | }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/node_modules/tern/test/condense/node_export_function_a.js:
--------------------------------------------------------------------------------
1 | exports.a = function(){};
2 |
--------------------------------------------------------------------------------
/node_modules/tern/test/condense/node_fn_export.js:
--------------------------------------------------------------------------------
1 | module.exports = function(a) { return a; };
2 |
--------------------------------------------------------------------------------
/node_modules/tern/test/condense/node_fn_export.json:
--------------------------------------------------------------------------------
1 | {
2 | "!define": {
3 | "!node": {
4 | "node_fn_export`js": {
5 | "!span": "17[0:17]-42[0:42]",
6 | "!type": "fn(a: ?) -> !0"
7 | }
8 | }
9 | },
10 | "!name": "node_fn_export.js"
11 | }
12 |
--------------------------------------------------------------------------------
/node_modules/tern/test/condense/node_other_module_type_ref.js:
--------------------------------------------------------------------------------
1 | exports.b = require('./node_export_function_a').a;
2 |
--------------------------------------------------------------------------------
/node_modules/tern/test/condense/node_other_module_type_ref.json:
--------------------------------------------------------------------------------
1 | {
2 | "!define": {
3 | "!node": {
4 | "node_export_function_a`js": {
5 | "!span": "0[0:0]-26[1:0]",
6 | "a": {
7 | "!span": "8[0:8]-9[0:9]",
8 | "!type": "fn()"
9 | }
10 | },
11 | "node_other_module_type_ref`js": {
12 | "!span": "0[0:0]-51[1:0]",
13 | "b": "!node.node_export_function_a`js.a"
14 | }
15 | }
16 | },
17 | "!name": "node_other_module_type_ref.js"
18 | }
19 |
--------------------------------------------------------------------------------
/node_modules/tern/test/condense/node_require_private.js:
--------------------------------------------------------------------------------
1 | // "freelist" could be any other undocumented node.js API module that isn't
2 | // included in the tern node plugin definitions.
3 | require('freelist');
4 |
--------------------------------------------------------------------------------
/node_modules/tern/test/condense/node_require_private.json:
--------------------------------------------------------------------------------
1 | {
2 | "!name": "node_require_private.js"
3 | }
4 |
--------------------------------------------------------------------------------
/node_modules/tern/test/condense/node_simple.js:
--------------------------------------------------------------------------------
1 | exports.a = 10;
2 | exports.b = function() { return exports.a; };
3 |
--------------------------------------------------------------------------------
/node_modules/tern/test/condense/node_simple.json:
--------------------------------------------------------------------------------
1 | {
2 | "!define": {
3 | "!node": {
4 | "node_simple`js": {
5 | "!span": "0[0:0]-62[2:0]",
6 | "a": {
7 | "!span": "8[0:8]-9[0:9]",
8 | "!type": "number"
9 | },
10 | "b": {
11 | "!span": "24[1:8]-25[1:9]",
12 | "!type": "fn() -> number"
13 | }
14 | }
15 | }
16 | },
17 | "!name": "node_simple.js"
18 | }
19 |
--------------------------------------------------------------------------------
/node_modules/tern/test/condense/proto.js:
--------------------------------------------------------------------------------
1 | var x = {my: "object"};
2 | var y = Object.create(x);
3 | y.bar = "extended";
4 |
--------------------------------------------------------------------------------
/node_modules/tern/test/condense/proto.json:
--------------------------------------------------------------------------------
1 | {
2 | "!name": "proto.js",
3 | "x": {
4 | "!span": "4[0:4]-5[0:5]",
5 | "my": {
6 | "!span": "9[0:9]-11[0:11]",
7 | "!type": "string"
8 | }
9 | },
10 | "y": {
11 | "!proto": "x",
12 | "!span": "28[1:4]-29[1:5]",
13 | "bar": {
14 | "!span": "52[2:2]-55[2:5]",
15 | "!type": "string"
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/node_modules/tern/test/condense/recursive.js:
--------------------------------------------------------------------------------
1 | var b = {};
2 | b[3] = [b[3]];
3 |
--------------------------------------------------------------------------------
/node_modules/tern/test/condense/recursive.json:
--------------------------------------------------------------------------------
1 | {
2 | "!name": "recursive.js",
3 | "b": {
4 | "!span": "4[0:4]-5[0:5]",
5 | "": {
6 | "!span": "14[1:2]-15[1:3]",
7 | "!type": "[b.]"
8 | }
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/node_modules/tern/test/condense/ref_in_type.js:
--------------------------------------------------------------------------------
1 | function out(a) { return a.bar + 10; }
2 |
3 | (function() {
4 | function Foo() { this.bar = 10; }
5 | out(new Foo);
6 | })();
7 |
--------------------------------------------------------------------------------
/node_modules/tern/test/condense/ref_in_type.json:
--------------------------------------------------------------------------------
1 | {
2 | "!define": {
3 | "out.!0": {
4 | "bar": {
5 | "!span": "78[3:24]-81[3:27]",
6 | "!type": "number"
7 | }
8 | }
9 | },
10 | "!name": "ref_in_type.js",
11 | "out": {
12 | "!span": "9[0:9]-12[0:12]",
13 | "!type": "fn(a: out.!0) -> number"
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/node_modules/tern/test/condense/ref_to_old.js:
--------------------------------------------------------------------------------
1 | var myElement = new Date();
2 |
--------------------------------------------------------------------------------
/node_modules/tern/test/condense/ref_to_old.json:
--------------------------------------------------------------------------------
1 | {
2 | "!name": "ref_to_old.js",
3 | "myElement": {
4 | "!span": "4[0:4]-13[0:13]",
5 | "!type": "+Date"
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/node_modules/tern/test/condense/requirejs_const.js:
--------------------------------------------------------------------------------
1 | define({a: "a"});
2 |
--------------------------------------------------------------------------------
/node_modules/tern/test/condense/requirejs_const.json:
--------------------------------------------------------------------------------
1 | {
2 | "!define": {
3 | "!requirejs": {
4 | "requirejs_const": {
5 | "!span": "7[0:7]-15[0:15]",
6 | "a": {
7 | "!span": "8[0:8]-9[0:9]",
8 | "!type": "string"
9 | }
10 | }
11 | }
12 | },
13 | "!name": "requirejs_const.js"
14 | }
15 |
--------------------------------------------------------------------------------
/node_modules/tern/test/condense/requirejs_dep.js:
--------------------------------------------------------------------------------
1 | define(['./requirejs_const'], function(requirejs_const) {
2 | return {a: requirejs_const};
3 | });
4 |
--------------------------------------------------------------------------------
/node_modules/tern/test/condense/requirejs_dep.json:
--------------------------------------------------------------------------------
1 | {
2 | "!define": {
3 | "!requirejs": {
4 | "requirejs_const": {
5 | "!span": "7[0:7]-15[0:15]",
6 | "a": {
7 | "!span": "8[0:8]-9[0:9]",
8 | "!type": "string"
9 | }
10 | },
11 | "requirejs_dep": {
12 | "!span": "67[1:9]-87[1:29]",
13 | "a": "!requirejs.requirejs_const"
14 | }
15 | }
16 | },
17 | "!name": "requirejs_dep.js"
18 | }
19 |
--------------------------------------------------------------------------------
/node_modules/tern/test/condense/requirejs_empty_deps.js:
--------------------------------------------------------------------------------
1 | define([], function() {
2 | return {c: "c"};
3 | });
4 |
--------------------------------------------------------------------------------
/node_modules/tern/test/condense/requirejs_empty_deps.json:
--------------------------------------------------------------------------------
1 | {
2 | "!define": {
3 | "!requirejs": {
4 | "requirejs_empty_deps": {
5 | "!span": "33[1:9]-41[1:17]",
6 | "c": {
7 | "!span": "34[1:10]-35[1:11]",
8 | "!type": "string"
9 | }
10 | }
11 | }
12 | },
13 | "!name": "requirejs_empty_deps.js"
14 | }
15 |
--------------------------------------------------------------------------------
/node_modules/tern/test/condense/requirejs_primitive.js:
--------------------------------------------------------------------------------
1 | define([], function() {
2 | return 1;
3 | });
4 |
--------------------------------------------------------------------------------
/node_modules/tern/test/condense/requirejs_primitive.json:
--------------------------------------------------------------------------------
1 | {
2 | "!define": {
3 | "!requirejs": {
4 | "requirejs_primitive": "number"
5 | }
6 | },
7 | "!name": "requirejs_primitive.js"
8 | }
9 |
--------------------------------------------------------------------------------
/node_modules/tern/test/condense/requirejs_setup.js:
--------------------------------------------------------------------------------
1 | define(function() {
2 | return {b: "b"};
3 | });
4 |
--------------------------------------------------------------------------------
/node_modules/tern/test/condense/requirejs_setup.json:
--------------------------------------------------------------------------------
1 | {
2 | "!define": {
3 | "!requirejs": {
4 | "requirejs_setup": {
5 | "!span": "29[1:9]-37[1:17]",
6 | "b": {
7 | "!span": "30[1:10]-31[1:11]",
8 | "!type": "string"
9 | }
10 | }
11 | }
12 | },
13 | "!name": "requirejs_setup.js"
14 | }
15 |
--------------------------------------------------------------------------------
/node_modules/tern/test/condense/uniontype.js:
--------------------------------------------------------------------------------
1 | function x(a) {}
2 | function y() { if (something) return true; else return 100; }
3 |
4 | x("hi");
5 | x([10]);
6 | y();
7 |
--------------------------------------------------------------------------------
/node_modules/tern/test/condense/uniontype.json:
--------------------------------------------------------------------------------
1 | {
2 | "!name": "uniontype.js",
3 | "x": {
4 | "!span": "9[0:9]-10[0:10]",
5 | "!type": "fn(a: string|[number])"
6 | },
7 | "y": {
8 | "!span": "26[1:9]-27[1:10]",
9 | "!type": "fn() -> bool|number"
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/node_modules/tern/test/fragments.js:
--------------------------------------------------------------------------------
1 | var util = require("./util");
2 | var tern = require("../lib/tern");
3 | var fs = require("fs");
4 |
5 | var file = fs.readFileSync(util.resolve("test/data/large.js"), "utf8");
6 |
7 | var server = new tern.Server({defs: [util.ecma5]});
8 |
9 | var curTest;
10 | function fail(msg) { throw curTest + ": " + msg; }
11 | function eq(a, b, msg) { if (a != b) fail(msg || a + " != " + b); }
12 |
13 | exports.runTests = function(filter) {
14 | var added = false;
15 | function test(name, start, text, query, check) {
16 | name = "fragments/" + name;
17 | if (filter && name.indexOf(filter) == -1) return;
18 | if (!added) {
19 | server.request({files: [{type: "full", name: "file", text: file}]}, function(){});
20 | util.addFile();
21 | added = true;
22 | }
23 | util.addTest();
24 | curTest = name;
25 | if (typeof text == "number") text = file.slice(start, text);
26 | query.file = "#0";
27 | var fdata = {type: "part", name: "file", text: text, offset: start};
28 | server.request({files: [fdata], query: query}, function(err, data) {
29 | try {
30 | if (err) fail(err);
31 | else check(data);
32 | } catch (e) {
33 | util.failure(String(e));
34 | }
35 | });
36 | }
37 |
38 | test("simple", 864, 1065, {type: "definition", end: 59},
39 | function(data) { eq(data.start, 888); });
40 | test("only_body", 895, 1064, {type: "definition", end: 28},
41 | function(data) { eq(data.start, 888); });
42 | test("replace_body", 895, "\n file", {type: "definition", end: 7},
43 | function(data) { eq(data.start, 888); });
44 |
45 | test("long_line", 6141, 6774, {type: "type", end: 603},
46 | function(data) { eq(data.type, "bool"); });
47 | test("long_line_replace", 6141, "var x = 'hi'; x;", {type: "type", end: 15},
48 | function(data) { eq(data.type, "string"); });
49 |
50 | test("redefine", 2444, "var defaults = 900; // and a long comment to cover the whole exprssion\n",
51 | {type: "type", end: 0, variable: "defaults"},
52 | function(data) { eq(data.type, "number"); });
53 |
54 | test("find_def", 3424, "function foo() { hasFrontMatter; }",
55 | {type: "definition", end: 31},
56 | function(data) { eq(data.start, 873); });
57 | test("find_def_in_fragment", 3420, file.slice(3424, 5103),
58 | {type: "definition", end: 1280},
59 | function(data) { eq(data.start, 3429); });
60 | };
61 |
--------------------------------------------------------------------------------
/node_modules/tern/test/reload.js:
--------------------------------------------------------------------------------
1 | var tern = require("../lib/tern");
2 | var util = require("./util");
3 |
4 | var tests = [], added = false;
5 | function test(name, f) {
6 | tests.push(function(filter) {
7 | if (filter && name.indexOf(filter) == -1) return;
8 | if (!added) { util.addFile(); added = true; }
9 | util.addTest();
10 |
11 | f(new tern.Server({defs: [util.ecma5], debug: true}));
12 | });
13 | }
14 |
15 | exports.runTests = function(filter) {
16 | tests.forEach(function(test) { test(filter); });
17 | };
18 |
19 | test("reloadCall", function(server) {
20 | server.addFile("call.js", "myfun('2');");
21 | server.addFile("fun.js", "function myfun(x) {\n x;\n}");
22 | server.flush(function() {
23 | var query = {files: [{name: "fun.js", type: "full", text: "function myfun(xy) {\n xy;\n}"}],
24 | query: {type: "type", end: {line: 1, ch: 4}, file: "fun.js"}};
25 | server.request(query, function(err, data) {
26 | if (err) return util.failure(err);
27 | if (data.type != "string") util.failure("reloadCall: Reloading function cleared argument type");
28 | });
29 | });
30 | });
31 |
32 | test("reloadProps", function(server) {
33 | server.addFile("obj.js", "var o = {};\no.id = 1234;\no.name = 'test';");
34 | server.flush(function() {
35 | var query = {files: [{name: "obj.js", type: "full", text: "var o = {};\no.kapow = 1234;\no.name = 'test';\no."}],
36 | query: {type: "completions", end: {line: 3, ch: 2}, file: "obj.js"}};
37 | server.request(query, function(err, data) {
38 | if (err) return util.failure(err);
39 | var compls = data.completions;
40 | compls.sort();
41 | if (compls.join() != "kapow,name") util.failure("reloadProps: Reloading properties failed (" + compls + ")");
42 | });
43 | });
44 | });
45 |
46 | test("reloadVar", function(server) {
47 | server.addFile("a.js", "var x = 1;");
48 | server.flush(function() {
49 | server.request({files: [{name: "a.js", type: "full", text: "var x = 'hi';"}],
50 | query: {type: "type", end: {line: 0, ch: 5}, file: "a.js"}}, function(err, data) {
51 |
52 | if (err) return util.failure(err);
53 | if (data.type != "string")
54 | util.failure("reloadVar: var did not get new string type (" + data.type + ")");
55 | });
56 | });
57 | });
58 |
59 | test("reloadForeignProp", function(server) {
60 | server.addFile("a.js", "Date.foo = 100;");
61 | server.flush(function() {
62 | server.request({files: [{name: "a.js", type: "full", text: "Date.foo"}],
63 | query: {type: "type", end: {line: 0, ch: 8}, file: "a.js"}}, function(err, data) {
64 | if (err) return util.failure(err);
65 | if (data.type != "?")
66 | util.failure("reloadForeignProp: reload did not clear Date.foo (" + data.type + ")");
67 | });
68 | });
69 | });
70 |
71 | test("reloadCalledForeignProp", function(server) {
72 | server.addFile("a.js", "Date.foo = function(a) { return a; };");
73 | server.addFile("b.js", "Date.foo('hi');");
74 | server.flush(function() {
75 | server.request({files: [{name: "a.js", type: "full", text: "Date.foo = function(a) { return a + 1; };"}],
76 | query: {type: "type", end: {line: 0, ch: 33}, file: "a.js"}}, function(err, data) {
77 | if (err) return util.failure(err);
78 | if (data.type != "string")
79 | util.failure("reloadCalledForeignProp: reload cleared argument type for Date.foo (" + data.type + ")");
80 | });
81 | });
82 | });
83 |
84 | test("reloadDelFile", function(server) {
85 | server.addFile("a.js", "function foobar() { return 10; }");
86 | server.flush(function() {
87 | server.delFile("a.js");
88 | server.request({files: [{name: "b.js", type: "full", text: "foobar"}],
89 | query: {type: "type", end: {line: 0, ch: 6}, file: "b.js"}}, function(err, data) {
90 | if (err) return util.failure(err);
91 | if (data.type != "?")
92 | util.failure("reloadDelFile: deleting a file did not clear the variable it created (" + data.type + ")");
93 | });
94 | });
95 | });
96 |
--------------------------------------------------------------------------------
/node_modules/tern/test/timeout.js:
--------------------------------------------------------------------------------
1 | var tern = require("../lib/tern");
2 | var infer = require("../lib/infer");
3 | var util = require("./util");
4 | var fs = require("fs");
5 |
6 | exports.runTests = function(filter) {
7 | if (filter && "timeout".indexOf(filter) == -1) return;
8 |
9 | util.addFile();
10 | util.addTest();
11 | var server = new tern.Server({});
12 | var file = fs.readFileSync(util.resolve("lib/infer.js"), "utf8");
13 | try {
14 | server.request({timeout: 10, files: [{type: "full", name: "infer.js", text: file}]}, Math.max);
15 | util.failure("timeout: failed to time out");
16 | } catch(e) {
17 | if (!(e instanceof infer.TimedOut))
18 | util.failure("timeout: wrong error thrown: " + e.stack);
19 | }
20 | };
21 |
--------------------------------------------------------------------------------
/node_modules/tern/test/util.js:
--------------------------------------------------------------------------------
1 | var fs = require("fs"), path = require("path");
2 |
3 | var projectDir = path.resolve(__dirname, "..");
4 | exports.resolve = function(pth) { return path.resolve(projectDir, pth); };
5 |
6 | exports.ecma5 = JSON.parse(fs.readFileSync(exports.resolve("defs/ecma5.json")), "utf8");
7 | exports.ecma6 = JSON.parse(fs.readFileSync(exports.resolve("defs/ecma6.json")), "utf8");
8 | exports.browser = JSON.parse(fs.readFileSync(exports.resolve("defs/browser.json")), "utf8");
9 | exports.jquery = JSON.parse(fs.readFileSync(exports.resolve("defs/jquery.json")), "utf8");
10 | exports.underscore = JSON.parse(fs.readFileSync(exports.resolve("defs/underscore.json")), "utf8");
11 |
12 | var files = 0, tests = 0, failed = 0;
13 |
14 | exports.addFile = function() { ++files; };
15 | exports.addTest = function() { ++tests; };
16 |
17 | exports.failure = function(message) {
18 | console.log(message);
19 | ++failed;
20 | };
21 |
22 | exports.hasFailed = function() { return failed > 0; };
23 |
24 | process.on("exit", function() {
25 | console.log("Ran " + tests + " tests from " + files + " files.");
26 | console.log(failed ? failed + " failures!" : "All passed.");
27 | });
28 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "tern_for_sublime",
3 | "license": "MIT",
4 | "version": "0.4.0",
5 | "author": "Marijn Haverbeke ",
6 | "description": "Sublime Text package for Tern",
7 | "repository": {
8 | "type": "git",
9 | "url": "git://github.com/marijnh/tern_for_sublime.git"
10 | },
11 | "dependencies": {
12 | "tern": ">=0.5"
13 | }
14 | }
15 |
--------------------------------------------------------------------------------