diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 5ff9548..4ffd1f5 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -10,15 +10,7 @@ jobs: with: neovim: true - uses: actions/checkout@v1 - - uses: actions/setup-node@v1 - with: - node-version: '12.x' - registry-url: 'https://registry.npmjs.org' - - run: npm install - - name: Test with neovim - run: | - nvim --version - vim --version - make test + - name: Neovim Version + run: nvim --version - name: Test syntax run: make test-syntax diff --git a/.gitignore b/.gitignore index e104877..223f7d3 100644 --- a/.gitignore +++ b/.gitignore @@ -24,26 +24,4 @@ .merlin .DS_Store -.bsb.lock -lib/bs -node_modules -test/**/*.js doc/tags - -server/**/*.d.ts -server/**/*.js.map -server/node_modules/.bin - -# We don't need that file -server/analysis_binaries/README.md - -# We need to vendor node_modules and all the executables -!server/**/node_modules/ -!server/analysis_binaries/darwin/rescript-editor-analysis.exe -!server/analysis_binaries/linux/rescript-editor-analysis.exe -!server/analysis_binaries/win32/rescript-editor-analysis.exe - -examples/**/node_modules -examples/**/lib -examples/**/src/*.js -examples/**/.merlin diff --git a/CHANGELOG.md b/CHANGELOG.md index 262b8ab..2aa6444 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,9 +2,15 @@ ## master +**Breaking Changes:** + +- Remove vendored ReScript LS and remove native Vim Commands (e.g. `:RescriptBuild`, etc) + - The ReScript Language Server will now be shipped as a dedicated npm package [rescript-language-server](https://github.com/rescript-lang/rescript-vscode/tree/master/server#rescript-language-server) + - Migrate to the official language server as described in our README instructions + **Improvements:** -- Improve syntax highlighting for escaped backticks in interpolated strings ([#55](https://github.com/rescript-lang/vim-rescript/pull/55)) +- Improve syntax highlighting for escaped backticks in interpolated strings ([#55](https://github.com/rescript-lang/vim-rescript/pull/55)) - Highlight improvements ([#69](https://github.com/rescript-lang/vim-rescript/pull/69)) ## 2.1.0 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1c36955..ad32761 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -3,9 +3,7 @@ ## Development - Clone the repo -- `npm install` dependencies -- `make test` to run the tests -- `make test-syntax`, require Neovim >= 0.9.0 +- `make test-syntax` to run the syntax tests, require Neovim >= 0.9.0 **Working within VIM** @@ -19,9 +17,6 @@ Plug ~/Projects/vim-rescript - Run `:PlugInstall` (you'll not see the plugin in the interactive vim-plug list, because it is a local project) - You can open and edit functionality in any plugin file. After any changes, just run `:so %` in the same buffer to source the current file, then proceed to do your manual tests -**Integration Specs:** -For all the informal specs about editor integration & the ReScript platform, check out the [CONTRIBUTING](https://github.com/rescript-lang/rescript-vscode/blob/master/CONTRIBUTING.md) file of the rescript-vscode reference implementation. - ### Syntax Tests Syntax tests require Neovim >= 0.9.0 @@ -35,69 +30,3 @@ Syntax tests require Neovim >= 0.9.0 //^ ``` - Run `make test-syntax` - -### Use custom rescript-editor-support.exe - -> Note: Don't do this as a ReScript user. This is only intended for extension development purposes only. -> We won't consider bug reports that are caused by custom editor-support setups. - -We are currently using a forked version of RLS to be able to do type-hinting (without using an LSP client actually). To build the binary, do the following: - -```bash -cd ~/Projects - -git clone https://github.com/rescript-lang/rescript-editor-support.git - -# You will need esy to build the project -esy -``` - -After a successful build, you will find a binary at path `_esy/default/build/install/default/bin/Bin`. To make things easier, we will symlink it: - -```bash -cd ~/Projects/rescript-editor-support -ln -s _esy/default/build/install/default/bin/Bin bin.exe -``` - -Now open your `vimrc` file and add following line: - -```vim -let g:rescript_editor_support_exe = "~/Projects/reason-language-server/bin.exe" -``` - -#### Testing the local setup - -That's it! Now you should be able to use `RescriptTypeHint` / omnicompletion on a `.res` file: - -- Within a ReScript project, create a new `myfile.res` -- Add `let a = ""` -- Move your cursor above the empty string `""` -- Type `:RescriptTypeHint`. A preview window will open to show the type information - - - -## Vendoring a new rescript-vscode version - -We are currently vendoring rescript-vscode to provide all the binaries + LSP for our coc-vim setup. - -First, `curl` the tagged zip bundle from the `rescript-vscode` GH releases: - -``` -curl -L https://github.com/rescript-lang/rescript-vscode/releases/download/1.1.1/rescript-vscode-1.1.1.vsix -o rescript-vscode-1.1.1.zip -``` - -Unzip it and replace the `rescript-vscode` directory. Like this: - -``` -unzip rescript-vscode-1.1.1.zip -d rescript-vscode-1.1.1 -rm -rf server - -mv rescript-vscode-1.1.1/extension/server server -``` - -Lastly: - -- Check in the changes and push to a working branch -- Do a last sanity check, update your `PlugInstall` to point to the newly created branch. Run `PlugUpdate` and check if the LSP / vim setup works as expected -- Run `:RescriptInfo` and check if the output reflects all the changes -- To wrap up, merge the branch, update CHANGELOG, push a new tag diff --git a/Makefile b/Makefile index 43a01e0..50e7747 100644 --- a/Makefile +++ b/Makefile @@ -1,13 +1,3 @@ -.PHONY: test test-ci - -MYVIM ?= nvim --headless - -INMAKE := 1 -export INMAKE - -test: - @$(MYVIM) -u ./test/test_all.vim - test-syntax: nvim -l test/test-syntax.lua git diff --name-only --exit-code -- 'test/syntax/expected/*.res.txt' diff --git a/README.md b/README.md index be48c5c..e26e3a0 100644 --- a/README.md +++ b/README.md @@ -1,47 +1,22 @@ # vim-rescript -**This is the official vim plugin for ReScript.** +Vim runtime files for ReScript. > If you are experiencing any troubles, open an issue or visit our [Forum](https://forum.rescript-lang.org) and ask for guidance. ## Features -**Supported Workflows:** -- Plain VIM (without any third party plugins) -- LSP + [coc-vim](https://github.com/neoclide/coc.nvim) - -**Basics:** - Syntax highlighting for ReSript files - Filetype detection for `.res`, `.resi` - Basic automatic indentation -- Includes LSP for coc-vim usage -- Proper tooling detection for monorepo like setups (yarn workspaces) - -**Provided by vim-rescript commands:** -- Formatting `.res` files w/ syntax error diagnostics in VIM quickfix -- Convert existing `.re` /`.rei` files to `.res` /`.resi` -- Type hint for current cursor position -- Jump to definition for current cursor position -- Building the current projec w/ build diagnostics in VIM quickfix -- Autocompletion w/ Vim's omnicomplete - -**Monorepo support:** - -The vim-rescript plugin automatically updates its project environment on each file open separately. -- Tested for yarn workspaces (see [./examples/monorepo-yarn-workspaces]) -- **Note for non-LSP usage:** Always make sure to switch to a `.res` file **within the project you want to compile** before running `:RescriptBuild` etc. See `:h rescript` for the detailed [helpfile](./doc/rescript.txt). -## Requirements - -The plugin works with projects based on `bs-platform@8.3` or later - ## Installation `vim-rescript` can be installed either manually or by using your favourite plugin manager. -```viml +```vim " vim-plug Plug 'rescript-lang/vim-rescript' @@ -50,89 +25,68 @@ Plugin 'rescript-lang/vim-rescript' " NeoBundle NeoBundle 'rescript-lang/vim-rescript' +``` -" Packer -use 'rescript-lang/vim-rescript' +```lua +-- Lazy.nvim +{ 'rescript-lang/vim-rescript', ft="rescript" } ``` You can also pin your installation to specific tags (check our releases [here](https://github.com/rescript-lang/vim-rescript/releases)): -``` +With Plug: + +```vim Plug 'rescript-lang/vim-rescript', {'tag': 'v2.1.0'} ``` -## Using vim-rescript with COC - -(`:h rescript-coc`) - -Our plugin comes with all the necessary tools (LSP + editor-support binaries for Windows, Mac, Linux) to set up coc-vim. -After the installation, open your coc config (`:CocConfig`) and add the following configuration: +With [Lazy.nvim](https://github.com/folke/lazy.nvim): -```json -"languageserver": { - "rescript": { - "enable": true, - "module": "~/.config/nvim/plugged/vim-rescript/server/out/server.js", - "args": ["--node-ipc"], - "filetypes": ["rescript"], - "rootPatterns": ["bsconfig.json"] - } -} +```lua +{ 'rescript-lang/vim-rescript', tag = "v2.1.0" } ``` -- The config above assumes that you were using `vim-plug` for plugin installations. -- Adapt your `module` path according to the install location of your vim-rescript plugin. -- Save the configuration, run `:CocRestart` and open a (built) ReScript project and check your code for type-hints. - -**Note:** Even if you are using COC, we recommend checking out the builtin commands that come with `vim-rescript` (`:h rescript-commands). - -## Using vim-rescript's functionality (no vim-coc, no vim-ale, etc) +## Setup LSP -(`:h rescript-config`) +First you need install the language server for ReScript from npm -Vim comes with a set of useful functions that are completely self contained and work with any neovim setup without any plugins: +> **Note** +> If you are using [mason.nvim](https://github.com/williamboman/mason.nvim) you can install the ReScript Language Server using the command `MasonInstall rescript-language-server` +```sh +npm install -g @rescript/language-server ``` -:h :RescriptFormat -:h :RescriptUpgradeFromReason -:h :RescriptBuild -:h :RescriptTypeHint -:h :RescriptJumpToDefinition -:h :RescriptInfo -``` -Please refer to the [doc](./doc/rescript.txt) file for more details! -We don't come with any predefined keybindings, but provide a basic set of keymappings down below. +The binary is called `rescript-language-server` -### Basic Key Bindings +### Neovim LSP builtin -These bindings won't collide with any other mappings in your vimrc setup, since they are scoped to `rescript` buffers only: +Install the [nvim-lspconfig](https://github.com/neovim/nvim-lspconfig) package and setup the LSP -```vim -" Note that allows us to use different commands with the same keybindings depending -" on the filetype. This is useful if to override your e.g. ALE bindings while working on -" ReScript projects. -autocmd FileType rescript nnoremap r :RescriptFormat -autocmd FileType rescript nnoremap t :RescriptTypeHint -autocmd FileType rescript nnoremap b :RescriptBuild -autocmd FileType rescript nnoremap gd :RescriptJumpToDefinition -``` +```lua +local lspconfig = require('lspconfig') -### Configure omnicomplete Support +lspconfig.rescriptls.setup{} +``` -(`:h rescript-omnicomplete`) +For more details, see [server configuration](https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#rescriptls) -We support auto-completion with Vim's builtin `omnifunc`, which is triggered with `C-x C-o` in insert mode to look for autocomplete candidates. +### COC (Vim or Neovim) -> While omnicomplete's dialog is open, use `C-n` / `C-p` to navigate to the next / previous item +(`:h rescript-coc`) -```vim -" Hooking up the ReScript autocomplete function -set omnifunc=rescript#Complete +After the installation, open your coc config (`:CocConfig`) and add the following configuration: -" When preview is enabled, omnicomplete will display additional -" information for a selected item -set completeopt+=preview +```json +"languageserver": { + "rescript": { + "enable": true, + "module": "rescript-language-server", + "args": ["--node-ipc"], + "filetypes": ["rescript"], + "rootPatterns": ["rescript.json", "bsconfig.json"] + } +} ``` ## Credits diff --git a/autoload/rescript.vim b/autoload/rescript.vim deleted file mode 100644 index 14a7486..0000000 --- a/autoload/rescript.vim +++ /dev/null @@ -1,556 +0,0 @@ -""" RESCRIPT EDITOR SPEC: - - -let s:rescript_plugin_dir = expand(':p:h:h') - -" Util -" See: https://vi.stackexchange.com/questions/19056/how-to-create-preview-window-to-display-a-string -function! s:ShowInPreview(fname, fileType, lines) - let l:command = "silent! pedit! +setlocal\\ " . - \ "buftype=nofile\\ nobuflisted\\ " . - \ "noswapfile\\ nonumber\\ " . - \ "filetype=" . a:fileType . " " . a:fname - - exe l:command - - if has('nvim') - let l:bufNr = bufnr(a:fname) - call nvim_buf_set_lines(l:bufNr, 0, -1, 0, a:lines) - else - call setbufline(a:fname, 1, a:lines) - endif -endfunction - -" Configures the project related globals based on the current buffer location -" This is needed for supporting monorepos with multiple projects / multiple -" bs-platform setups -function! rescript#UpdateProjectEnv() - " Looks for the nearest node_modules directory - let l:res_bin_dir = finddir('node_modules/rescript/', ".;") . s:rescript_arch - - " If 1, we are running with the old bsb / bsc binaries - let g:rescript_legacy_mode = 0 - - if l:res_bin_dir == s:rescript_arch - " look for bs-platform if rescript node module not found - let l:res_bin_dir = finddir('node_modules/bs-platform/', ".;") . s:rescript_arch - let g:rescript_legacy_mode = 1 - else - " Here we are handling a project that is based on the rescript npm package - " This package only uses a rescript.exe, no bsc, nor bsb - let g:rescript_exe = getcwd() . "/" . l:res_bin_dir . "/rescript.exe" - endif - - " These variables are only used in legacy mode (bs-platform based projects) - let g:rescript_bsc_exe = getcwd() . "/" . l:res_bin_dir . "/bsc.exe" - let g:rescript_bsb_exe = getcwd() . "/" . l:res_bin_dir . "/bsb.exe" - - " Note that this doesn't find bsconfig when the editor was started without a - " specific file within the project - let g:rescript_project_config = getcwd() . "/" . findfile("bsconfig.json", ".;") - - " Try to find the nearest .git folder instead - if g:rescript_project_config == "" - let g:rescript_project_root = finddir(".git/..", expand('%:p:h').';') - else - let g:rescript_project_root = fnamemodify(g:rescript_project_config, ":p:h") - endif - - " Make sure that our local working directory is in the rescript_project_root - "exe "lcd " . g:rescript_project_root -endfunction - -" Inits the plugin variables, e.g. finding all the plugin related binaries -" and initialising some internal state for UI (error window etc.) -function! rescript#Init() - if has('macunix') - let s:rescript_arch = "darwin" - elseif has('win32') - let s:rescript_arch = "win32" - elseif has('unix') - let s:rescript_arch = "linux" - endif - - " Needed for state tracking of the formatting error state - let s:got_format_err = 0 - let s:got_build_err = 0 - - if !exists("g:rescript_analysis_exe") - let g:rescript_analysis_exe = s:rescript_plugin_dir . "/server/analysis_binaries/" . s:rescript_arch . "/rescript-editor-analysis.exe" - endif - - call rescript#UpdateProjectEnv() -endfunction - -function! s:DeleteLines(start, end) abort - silent! execute a:start . ',' . a:end . 'delete _' -endfunction - -function! rescript#GetRescriptServerVersion() - let l:out = readfile(s:rescript_plugin_dir . "/server/package.json") - - try - let l:json = json_decode(l:out) - return l:json.version - catch /.*/ - echo "Could not find rescript-vscode version" - return "?" - endtry -endfunction - -" Retrieves the package.json version of either rescript or bs-platform -function! rescript#DetectVersion() - call rescript#UpdateProjectEnv() - - if g:rescript_legacy_mode ==? 1 - let l:pkg_json = fnamemodify(g:rescript_bsc_exe, ":h") . "/../package.json" - else - let l:pkg_json = fnamemodify(g:rescript_exe, ":h") . "/../package.json" - endif - - let l:out = readfile(l:pkg_json) - - try - let l:json = json_decode(l:out) - return l:json.version - catch /.*/ - echo "Could not read rescript version" - return "?" - endtry -endfunction - -function! rescript#Format() - call rescript#UpdateProjectEnv() - - let l:ext = expand("%:e") - - if matchstr(l:ext, 'resi\?') == "" - echo "Current buffer is not a .res / .resi file... Do nothing." - return - endif - - let l:view = winsaveview() - - " Used for stderr tracking - let l:stderr_tmpname = tempname() - call writefile([], l:stderr_tmpname) - - " Used for the actual buffer content - " this is needed to because bsc -format can't - " consume code from stdin, so we need to dump - " the content into a temporary file first - let l:tmpname = tempname() . "." . l:ext - - call writefile(getline(1, '$'), l:tmpname) - - " bsc -format myFile.res > tempfile - let l:command = g:rescript_bsc_exe . " -color never -format " . l:tmpname . " 2> " . l:stderr_tmpname - - exe "lcd " . g:rescript_project_root - silent let l:out = systemlist(l:command) - exe "lcd -" - - let l:stderr = readfile(l:stderr_tmpname) - - if v:shell_error ==? 0 - call s:DeleteLines(len(l:out), line('$')) - call setline(1, l:out) - - " Make sure syntax highlighting doesn't break - syntax sync fromstart - - " Clear out location list in case a previous syntax error was fixed - let s:got_format_err = 0 - call setqflist([]) - cclose - else - let l:stderr = readfile(l:stderr_tmpname) - - let l:errors = rescript#parsing#ParseCompilerErrorOutput(l:stderr) - - if !empty(l:errors) - for l:err in l:errors - let l:err.filename = @% - endfor - call setqflist(l:errors, 'r') - botright cwindow - cfirst - endif - - let s:got_format_err = 1 - echohl Error | echomsg "rescript format returned an error" | echohl None - endif - - call delete(l:stderr_tmpname) - call delete(l:tmpname) - - call winrestview(l:view) - - if s:got_format_err ==? 1 - return { 'has_error': 1, 'errors': l:errors } - else - return { 'has_error': 0, 'errors': [] } - endif -endfunction - -function! rescript#TypeHint() - call rescript#highlight#StopHighlighting() - - " Make sure we are type hinting on a written file - if &mod == 1 - echo "write" - write - endif - - let c_line = line(".") - let c_col = col(".") - - let l:command = g:rescript_analysis_exe . " hover " . @% . " " . (c_line - 1) . " " . (c_col - 1) - - let out = system(l:command) - - if v:shell_error != 0 - echohl Error | echomsg "Type Info failed with exit code '" . v:shell_error . "'" | echohl None - return - endif - - let l:json = [] - try - let l:json = json_decode(out) - catch /.*/ - echo "No type info (couldn't decode analysis result)" - return - endtry - - let l:match = l:json - - if get(l:match, "contents", "") != "" - let md_content = l:match.contents - - let text = split(md_content, "\n") - let lines = extend(["Pos (l:c): " . c_line . ":" . c_col], text) - - call s:ShowInPreview("type-preview", "markdown", lines) - - "TODO: Add back the highlighting at some point - "---- - " calculate pos for matchadd - "let start_line = item.range.start.line + 1 - " - "let end_line = item.range.end.line + 1 - "let start_col = item.range.start.character + 1 - "let end_col = item.range.end.character - - "let startPos = [start_line, start_col, end_col - start_col] - "let endPos = [end_line, end_col] - - "let pos = [startPos, endPos] - - "call rescript#highlight#HighlightWord(pos) - "------ - return - endif - echo "No type info" -endfunction - -function! rescript#JumpToDefinition() - call rescript#highlight#StopHighlighting() - - " Make sure we are type hinting on a written file - if &mod == 1 - echo "write" - write - endif - - let c_line = line(".") - let c_col = col(".") - - let l:command = g:rescript_analysis_exe . " definition " . @% . " " . (c_line - 1) . " " . (c_col - 1) - - let out = system(l:command) - - if v:shell_error != 0 - echohl Error | echomsg "Analysis binary failed with exit code '" . v:shell_error . "'" | echohl None - return - endif - - let l:json = [] - try - let l:json = json_decode(out) - catch /.*/ - echo "No definition available (couldn't decode analysis result)" - return - endtry - - let c_line = line(".") - let c_col = col(".") - - " Prevents errors when v:null was returned - if type(l:json) == v:t_dict - let l:def = l:json - - if has_key(l:def, "uri") - execute ":e " . l:def.uri - endif - - let start_line = l:def.range.start.line + 1 - let start_col = l:def.range.start.character + 1 - let end_line = l:def.range.end.line + 1 - let end_col = l:def.range.end.character - call cursor(start_line, start_col) - - let startPos = [start_line, start_col, end_col - start_col] - let endPos = [end_line, end_col] - let pos = [startPos, endPos] - - " If pos doesn't point to start: 0,0 and end: 0,0 - if pos != [[1, 1, -1], [1, 0]] - call rescript#highlight#HighlightWord(pos) - endif - - return - endif - echo "No definition found" -endfunction - - -" Item kind: https://github.com/cristianoc/reason-language-server/blob/dumpLocations/src/lsp/NewCompletions.re#L265 -" value: 12 -" type: 22 -" attribute: 5 -" constructor: 4 -" filemodule: 9 -" module: 9 - -let s:completeKinds = { - \'12': "v", - \'22': "t", - \'5': "a", - \'4': "c", - \'9': "m", - \} - -function! rescript#Complete(findstart, base) - let c_line = line(".") - let c_col = col(".") - - if a:findstart - return c_col - endif - - let l:ext = expand("%:e") - - let l:tmpname = tempname() . "." . l:ext - call writefile(getline(1, '$'), l:tmpname) - - let l:command = g:rescript_analysis_exe . " complete " . @% . " " . ( c_line - 1) . " " . (c_col - 1) . " " . l:tmpname - - let out = system(l:command) - - let l:json = [] - try - let l:json = json_decode(out) - catch /.*/ - echo "No completion results" - return - endtry - - if type(l:json) != v:t_list - echo "No completion results" - return [] - endif - - let l:ret = [] - - for item in l:json - ":h complete-items - let l:kind = get(s:completeKinds, string(item.kind), "v") - - let entry = { 'word': item.label, 'kind': l:kind, 'info': item.documentation.value } - - let l:ret = add(l:ret, entry) - endfor - - call delete(l:tmpname) - return l:ret -endfunction - -" with_deps: bool ... if 1, clean deps as well -function! rescript#Clean(...) - let l:with_deps = get(a:, 0, 0) - - if g:rescript_legacy_mode ==? 1 - if l:with_deps ==? 1 - " bsb -clean-world - let l:cmd = g:rescript_bsb_exe . " -clean-world" - else - " bsb -clean - let l:cmd = g:rescript_bsb_exe . " -clean" - endif - else - if l:with_deps ==? 1 - " rescript clean -with-deps - let l:cmd = g:rescript_exe . " clean -with-deps" - else - " rescript clean - let l:cmd = g:rescript_exe . " clean" - endif - endif - - exe "lcd " . g:rescript_project_root - let out = system(l:cmd) - exe "lcd -" - - if v:shell_error ==? 0 - echo "Cleaning successful" - else - echo out - endif - - return v:shell_error -endfunction - -" with_deps: bool ... if 1, clean deps as well -function! rescript#Build(...) - let with_deps = get(a:, 0, 0) - - call rescript#UpdateProjectEnv() - - " If in legacy mode, run bsb - if g:rescript_legacy_mode ==? 1 - let l:cmd = g:rescript_bsb_exe - if l:with_deps ==? 1 - " bsb -make-world - let l:cmd = g:rescript_bsb_exe . " -make-world" - endif - else - " Otherwise we are in modern mode and use rescript.exe - let l:cmd = g:rescript_exe - if l:with_deps ==? 1 - let l:cmd = g:rescript_exe . " build -with-deps" - endif - endif - - exe "lcd " . g:rescript_project_root - let out = system(l:cmd) - exe "lcd -" - - " We don't rely too heavily on exit codes. If there's a compiler.log, - " then there is either an error or a warning, so we rely on the existence - " of the compiler.log as the source of truth instead - let compilerLogFile = g:rescript_project_root . "/lib/bs/.compiler.log" - let compilerLogExists = !empty(glob(compilerLogFile)) - - if v:shell_error ==? 0 && compilerLogExists ==? 0 - let s:got_build_err = 0 - elseif v:shell_error ==? 2 - echo out - else - let lines = readfile(compilerLogFile) - let l:entries = rescript#parsing#ParseCompilerLogEntries(lines) - - if !empty(l:entries) - let l:last = l:entries[len(l:entries)-1] - let l:errors = rescript#parsing#ParseCompilerErrorOutput(l:last) - - if !empty(l:errors) - let i = 0 - let errNum = -1 - while i < len(l:errors) - let l:err = l:errors[i] - if l:err.filename ==# expand("%:p") - " cc is 1 based - let errNum = i + 1 - break - endif - let i = i + 1 - endwhile - call setqflist(l:errors, 'r') - botright cwindow - if errNum > -1 - execute ":cc " . errNum - else - cfirst - endif - else - " If we couldn't parse any proper errors, show the compiler log in a - " preview instead - call s:ShowInPreview("compiler-log", "text", split(out, "\n")) - endif - - let s:got_build_err = 1 - else - " basically empty compiler.log without entries - let s:got_build_err = 0 - endif - - endif - - if s:got_build_err ==? 1 - echohl Error | echomsg "ReScript build failed." | echohl None - return { 'has_error': 1, 'errors': l:errors } - else - echo "Build successful" - - " In case there was an open preview window that could - " be stale by now - pclose - - " Clear out qf list in case a previous build errors were fixed - call setqflist([]) - cclose - - return { 'has_error': 0, 'errors': [] } - endif -endfunction - -function! rescript#ReasonToRescript() - let l:ext = expand("%:e") - - if l:ext !=# "re" && l:ext !=# "rei" - echo "Current buffer is not a .re / .rei file... Do nothing." - return - endif - - let l:command = g:rescript_bsc_exe . " -format " . @% - - silent let l:out = systemlist(l:command) - if v:shell_error ==? 0 - let l:target_ext = l:ext ==# "re" ? "res" : "resi" - let l:res_file = expand("%:p:r") . "." . target_ext - let l:original_file = expand("%:t") - execute "silent! botright vsplit " . l:res_file - let l:out = ["// This file was automatically converted to ReScript from '" .l:original_file . "'" , - \ "// Check the output and make sure to delete the original file"] + l:out - call setline(1, l:out) - echo "Reformatted successfully" - else - echo "Could not reformat Reason file to ReScript" - endif -endfunction - -function! rescript#Info() - let l:version = "ReScript version: " . rescript#DetectVersion() - - echo l:version - - if g:rescript_legacy_mode ==? 1 - echo "Editor mode: legacy (using bsc / bsb instead of rescript)" - else - echo "Editor mode: modern (using rescript.exe instead of bsc / bsb)" - endif - - echo "Detected Config File: " . g:rescript_project_config - echo "Detected Project Root: " . g:rescript_project_root - echo "Detected rescript_analysis_exe: " . g:rescript_analysis_exe - - if g:rescript_legacy_mode ==? 1 - echo "Detected rescript_bsc_exe: " . g:rescript_bsc_exe - echo "Detected rescript_bsb_exe: " . g:rescript_bsb_exe - else - echo "Detected rescript_exe: " . g:rescript_exe - echo "Detected (legacy) rescript_bsc_exe: " . g:rescript_bsc_exe - endif - - echo "Bundled rescript server version: " . rescript#GetRescriptServerVersion() -endfunction diff --git a/autoload/rescript/highlight.vim b/autoload/rescript/highlight.vim deleted file mode 100644 index fb2be47..0000000 --- a/autoload/rescript/highlight.vim +++ /dev/null @@ -1,35 +0,0 @@ -" Some useful resources: -" Highlighting: https://github.com/dominikduda/vim_current_word/blob/master/autoload/vim_current_word.vim - -let s:matches = [] - -if !hlexists("RescriptHighlight") - " TODO: make colors configurable - hi link RescriptHighlight IncSearch -endif - -function! rescript#highlight#HighlightWord(pos) - "let id = matchadd('RescriptHighlight', '\S*\%#\S*', 5) - let id = matchaddpos('RescriptHighlight', a:pos) - let s:matches = add(s:matches, id) - augroup RescriptHighlighting - au! - autocmd InsertEnter call rescript#highlight#StopHighlighting() - autocmd BufWinLeave call rescript#highlight#StopHighlighting() - augroup END -endfunction - -function! rescript#highlight#StopHighlighting() - for item in s:matches - try - call matchdelete(item) - catch /.*/ - " don't really care about highlighting errors - endtry - endfor - let s:matches = [] - - augroup RescriptHighlighting - au! - augroup END -endfunction diff --git a/autoload/rescript/parsing.vim b/autoload/rescript/parsing.vim deleted file mode 100644 index 7de5271..0000000 --- a/autoload/rescript/parsing.vim +++ /dev/null @@ -1,154 +0,0 @@ -" Link to the reference implementation: -" https://github.com/rescript-lang/rescript-vscode/blob/0dbf2eb9cdb0bd6d95be1aee88b73830feecb5cc/server/src/utils.ts#L129-L329 - - -" Parses all syntax errors from the output of the ReScript compiler / -" compiler.log -" -" {output} is a list of lines (usually generated by systemlist) -" Every parsed filepath will be replaced with {filename} (useful for replacing -" temporary filenames) -" -" It returns a list of dicts containing the error information. Those dicts -" follow the same format as documented in |setqflist()| -function! rescript#parsing#ParseCompilerErrorOutput(lines) - let ret = [] - - let l:i = 0 - - " warning_number > -1 means it is a warning - let item = { - \'filedata': [], - \'warning_number': -1, - \'preview': [], - \'text': ""} - - " used for file preview: 2 spaces = start of error message - let spaces = 0 - - " header, filedata, file_preview , error_msg - let mode = "header" - - let l:last = len(a:lines) - 1 - - while l:i < len(a:lines) - let line = a:lines[l:i] - - if mode ==? "header" - let trimmed = trim(line) - - if trimmed ==# "We've found a bug for you!" - let mode = "filedata" - let item = { - \'filedata': [], - \'warning_number': -1, - \'preview': [], - \'text': ""} - elseif trimmed ==# "Syntax error!" - let mode = "filedata" - let item = { - \'filedata': [], - \'warning_number': -1, - \'preview': [], - \'text': "(Syntax)"} - else - let l:tokens = matchlist(line, 'Warning number \([0-9]\+\).*') - - if !empty(l:tokens) - let mode = "filedata" - let item = { - \'filedata': [], - \'warning_number': l:tokens[1], - \'preview': [], - \'text': ""} - endif - endif - elseif mode ==? "filedata" - let l:tokens = matchlist(line, '\s*\(.*\.res\)\s*:*\([0-9]\+\):\([0-9]\+\).*') - if !empty(l:tokens) - let item.filedata = l:tokens - let mode = "file_preview" - endif - elseif mode ==? "file_preview" - if trim(line) == "" - let spaces += 1 - else - let item.preview = add(item.preview, line) - endif - if spaces == 2 - let mode = "error_msg" - let spaces = 0 - endif - elseif mode ==? "error_msg" - let trimmed = trim(get(a:lines, l:i+1, "")) - - if l:i == l:last - \ || trimmed ==# "We've found a bug for you!" - \ || trimmed ==# "Syntax error!" - \ || matchstr(trimmed, 'Warning number [0-9]\+') != "" - if !empty(item.filedata) - let l:type = item.warning_number > -1 ? "W" : "E" - let text = item.warning_number > -1 ? - \"(Warning " . item.warning_number . ") " . item.text - \: item.text - call add(ret, {"filename": item.filedata[1], - \"bufnr": item.filedata[1], - \"lnum": item.filedata[2], - \"col": item.filedata[3], - \"type": l:type, - \"text": text}) - let l:filedata = [] - endif - let mode = "header" - else - let str = substitute(line, '^\s*\(.\{-}\)\s*$', '\1', '') - let text = item.text - if str != "" - let text = text == "" ? str : text . " " . str - endif - let item.text = text - endif - - endif - let l:i += 1 - endwhile - - return ret -endfunction - -" Parses {lines} of strings read from a .compiler.log file and returns a list -" of parsed lines (list of lists of strings) that were enclosed by START / -" DONE markers -function! rescript#parsing#ParseCompilerLogEntries(lines) - let ret = [] - - " start, collect - let mode = "start" - - let i = 0 - - let content = [] - - while i < len(a:lines) - let line = a:lines[i] - - if mode ==? "start" - if matchstr(line, '#Start') != "" - let mode = "collect" - let content = [] - endif - elseif mode ==? "collect" - if matchstr(line, '#Done') != "" - let mode = "start" - if !empty(content) - let ret = add(ret, content) - endif - else - let content = add(content, line) - endif - endif - let i = i + 1 - endwhile - - return ret -endfunction diff --git a/doc/rescript.txt b/doc/rescript.txt index f01f21d..627ed86 100644 --- a/doc/rescript.txt +++ b/doc/rescript.txt @@ -14,74 +14,19 @@ Plugin Website: =============================================================================== CONTENTS *rescript* - Intro ......................... |rescript-introduction| - Config ........................ |rescript-config| - omnicomplete................... |rescript-omnicomplete| - COC Config..................... |rescript-coc| - Variables ..................... |rescript-variables| - Commands ...................... |rescript-commands| + Intro ......................... |rescript-introduction| + COC Config..................... |rescript-coc| =============================================================================== INTRODUCTION *rescript-introduction* -This plugin provides important features to work on ReScript projects, such as: +This plugin provides basic features to work on ReScript projects, such as: - Syntax highlighting -- Code formatting -- Type hints -- Goto Definition -- Autocompletion (via omnicomplete) +- Fileype detection +- Basic automatic indentation -Compatibility: -This plugin is guaranteed to work with `bs-platform@8.3` & `rescript@9.1.1` and -above and comes with all the required executables. - -Please make sure to install your project dependencies. The plugin will look -for the nearest node_modules folder to get access to the ReScript toolchain. - -Legacy Mode: -The plugin switches into "legacy mode" whenever it detects a project that is -based on the `bs-platform` npm package. This mode ensures compatibility for -older codebases that didn't migrate to our `rescript` npm package yet. - -When in legacy mode, the plugin uses g:rescript_bsb_exe and g:rescript_bsc_exe -instead of g:rescript_exe. - -=============================================================================== -CONFIG *rescript-config* - -By default, this plugin will not create any keymappings, nor does it mess -around with any other vim configurations, so you'd need to add some basic -configuration to your |vimrc|to get access to the full set of features. - -Here is a default configuration to get you started - autocmd FileType rescript nnoremap r :RescriptFormat - autocmd FileType rescript nnoremap t :RescriptTypeHint - autocmd FileType rescript nnoremap b :RescriptBuild - autocmd FileType rescript nnoremap gd :RescriptJumpToDefinition - -Note that allows us to use different commands with the same keybindings depending -on the filetype. This is useful if to override your e.g. ALE bindings while working on -ReScript projects. - -=============================================================================== -OMNICOMPLETE *rescript-omnicomplete* - -This plugin supports auto-completion with Vim's builtin |omnifunc|, that is -triggered with `C-x C-o` in insert mode to look for autocomplete candidates. - -While omnicomplete's dialog is open, use `C-n` / `C-p` to navigate to the next -/ previous item - -Put the following settings in your vimrc to activate omnicompletion: > - " Hooking up the ReScript autocomplete function - set omnifunc=rescript#Complete - - " When preview is enabled, omnicomplete will display additional - " information for a selected item - set completeopt+=preview -< =============================================================================== COC-CONFIG *rescript-coc* @@ -91,70 +36,15 @@ In case you want to use ReScript with |coc-nvim|, open your config file with "languageserver": { "rescript": { "enable": true, - "module": "~/.config/nvim/plugged/vim-rescript/server/out/server.js", + "module": "rescript-language-server", "args": ["--node-ipc"], "filetypes": ["rescript"], - "rootPatterns": ["bsconfig.json"] + "rootPatterns": ["rescript.json", "bsconfig.json"] } } < -The config above assumes that you are using vim-plug. Adapt your `module` path -according to the install location of your vim-rescript plugin. - Save the configuration, run |:CocRestart| and open a (built) ReScript project and check your code for type-hints. -=============================================================================== -VARIABLES *rescript-variables* - -g:rescript_analysis_exe string *g:rescript_analysis_exe* - - Path to ReScript's editor-support executable. This is mainly used for - plugin development purposes. Don't abuse this config. - -g:rescript_exe string *g:rescript_exe* - - Path to the universal `rescript.exe` command shipped with the `rescript` - npm package. Will be determined on every `:RescriptBuild`, - `:RescriptClean`, ... call. - -=============================================================================== -COMMANDS *rescript-commands* - -*:RescriptFormat* - Formats the current buffer. In case of an error, it will open a quickfix - window with all the syntax errors. See |:cfirst| |:cnext| |:cprev| for - quick error navigation - -*:RescriptUpgradeFromReason* - Reads from the current .re / .res file, and creates an equivalent .res / - .resi file in the same path. Make sure to delete the original .re file - after writing your new .res file, otherwise the compiler will not compile. - -*:RescriptBuild* - Builds your current project and also its dependencies. In legacy mode, it - will only build the local dependencies (use |:RescriptBuildWithDeps| if you - want to build dependencies as well). - -*:RescriptBuildWithDeps* - Builds your current project with all its dependencies. Only useful in - legacy mode. - -*:RescriptCleanWithDeps* - Cleans all project files + all ReScript dependencies. This is useful for - fixing stale caches (e.g. when upgrading ReScript versions). - -*:RescriptTypeHint* - Uses the g:rescript_analysis_exe executable to extract - type information of the current file and displays the right type hint for - the current cursor position - -*:RescriptJumpToDefinition* - Uses the g:rescript_analysis_exe executable to jump to the - original definition of the entity on the current position - -*:RescriptInfo* - Lists current plugin state (detected config, executable paths, etc) - vim:tw=78:ts=8:noet:ft=help:norl: diff --git a/examples/basic/bsconfig.json b/examples/basic/bsconfig.json deleted file mode 100644 index 8b02898..0000000 --- a/examples/basic/bsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "name": "vim-rescript", - "version": "0.1.0", - "reason": { - "react-jsx": 3 - }, - "sources": { - "dir" : "src", - "subdirs" : true - }, - "package-specs": { - "module": "commonjs", - "in-source": true - }, - "suffix": ".js", - "bs-dependencies": [ - "reason-react" - ], - "warnings": { - "error" : "+101" - }, - "refmt": 3 -} diff --git a/examples/basic/package-lock.json b/examples/basic/package-lock.json deleted file mode 100644 index a4d324c..0000000 --- a/examples/basic/package-lock.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "name": "basic", - "version": "1.0.0", - "lockfileVersion": 1, - "requires": true, - "dependencies": { - "bs-platform": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/bs-platform/-/bs-platform-9.0.0.tgz", - "integrity": "sha512-32gIXIUt1RO+OUWLrkhXFOuZKS5Cka6lEShXaVC/ohg5N8cUnoNZW9M/vW3CWnmgZkQ0Hp9g9vj5I5NfzHpy5A==", - "dev": true - }, - "reason-react": { - "version": "0.9.1", - "resolved": "https://registry.npmjs.org/reason-react/-/reason-react-0.9.1.tgz", - "integrity": "sha512-nlH0O2TDy9KzOLOW+vlEQk4ExHOeciyzFdoLcsmmiit6hx6H5+CVDrwJ+8aiaLT/kqK5xFOjy4PS7PftWz4plA==", - "dev": true - } - } -} diff --git a/examples/basic/package.json b/examples/basic/package.json deleted file mode 100644 index 515a616..0000000 --- a/examples/basic/package.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "basic", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "keywords": [], - "author": "", - "license": "ISC", - "devDependencies": { - "bs-platform": "9.0.0", - "reason-react": "0.9.1" - } -} diff --git a/examples/basic/src/Button.res b/examples/basic/src/Button.res deleted file mode 100644 index ffdb3ca..0000000 --- a/examples/basic/src/Button.res +++ /dev/null @@ -1,6 +0,0 @@ -@react.component -let make = () => { -
- {React.string("Click me")} -
-} diff --git a/examples/basic/src/Json.res b/examples/basic/src/Json.res deleted file mode 100644 index 5732d47..0000000 --- a/examples/basic/src/Json.res +++ /dev/null @@ -1,615 +0,0 @@ -@@ocaml.doc( - " # Json parser - * - * Works with bucklescript and bsb-native - * - * ## Basics - * - * ``` - * open Json.Infix; /* for the nice infix operators */ - * let raw = {|{\"hello\": \"folks\"}|}; - * let who = Json.parse(raw) |> Json.get(\"hello\") |?> Json.string; - * Js.log(who); - * ``` - * - * ## Parse & stringify - * - * @doc parse, stringify - * - * ## Accessing descendents - * - * @doc get, nth, getPath - * - * ## Coercing to types - * - * @doc string, number, array, obj, bool, null - * - * ## The JSON type - * - * @doc t - * - * ## Infix operators for easier working - * - * @doc Infix - " -) -type rec t = - | String(string) - | Number(float) - | Array(list) - | Object(list<(string, t)>) - | True - | False - | Null - -let string_of_number = f => { - let s = Js.Float.toString(f) - if String.get(s, String.length(s) - 1) == '.' { - String.sub(s, 0, String.length(s) - 1) - } else { - s - } -} - -@ocaml.doc(" - * This module is provided for easier working with optional values. - ") -module Infix = { - @ocaml.doc( - " The \"force unwrap\" operator - * - * If you're sure there's a value, you can force it. - * ``` - * open Json.Infix; - * let x: int = Some(10) |! \"Expected this to be present\"; - * Js.log(x); - * ``` - * - * But you gotta be sure, otherwise it will throw. - * ```reason;raises - * open Json.Infix; - * let x: int = None |! \"This will throw\"; - * ``` - " - ) - let \"|!" = (o, d) => - switch o { - | None => failwith(d) - | Some(v) => v - } - @ocaml.doc( - " The \"upwrap with default\" operator - * ``` - * open Json.Infix; - * let x: int = Some(10) |? 4; - * let y: int = None |? 5; - * Js.log2(x, y); - * ``` - " - ) - let \"|?" = (o, d) => - switch o { - | None => d - | Some(v) => v - } - @ocaml.doc( - " The \"transform contents into new optional\" operator - * ``` - * open Json.Infix; - * let maybeInc = x => x > 5 ? Some(x + 1) : None; - * let x: option(int) = Some(14) |?> maybeInc; - * let y: option(int) = None |?> maybeInc; - * ``` - " - ) - let \"|?>" = (o, fn) => - switch o { - | None => None - | Some(v) => fn(v) - } - @ocaml.doc( - " The \"transform contents into new value & then re-wrap\" operator - * ``` - * open Json.Infix; - * let inc = x => x + 1; - * let x: option(int) = Some(7) |?>> inc; - * let y: option(int) = None |?>> inc; - * Js.log2(x, y); - * ``` - " - ) - let \"|?>>" = (o, fn) => - switch o { - | None => None - | Some(v) => Some(fn(v)) - } - @ocaml.doc( - " \"handle the value if present, otherwise here's the default\" - * - * It's called fold because that's what people call it :?. It's the same as \"transform contents to new value\" + \"unwrap with default\". - * - * ``` - * open Json.Infix; - * let inc = x => x + 1; - * let x: int = fold(Some(4), 10, inc); - * let y: int = fold(None, 2, inc); - * Js.log2(x, y); - * ``` - " - ) - let fold = (o, d, f) => - switch o { - | None => d - | Some(v) => f(v) - } -} - -let escape = text => { - let ln = String.length(text) - let buf = Buffer.create(ln) - let rec loop = i => - if i < ln { - switch String.get(text, i) { - | '\012' => Buffer.add_string(buf, "\\f") - | '\\' => Buffer.add_string(buf, "\\\\") - | '"' => Buffer.add_string(buf, "\\\"") - | '\n' => Buffer.add_string(buf, "\\n") - | '\b' => Buffer.add_string(buf, "\\b") - | '\r' => Buffer.add_string(buf, "\\r") - | '\t' => Buffer.add_string(buf, "\\t") - | c => Buffer.add_char(buf, c) - } - loop(i + 1) - } - loop(0) - Buffer.contents(buf) -} - -/* -let rec stringify = t => - switch t { - | String(value) => "\"" ++ (escape(value) ++ "\"") - | Number(num) => string_of_number(num) - | Array(items) => "[" ++ (String.concat(", ", () => {List.map(items, stringify)) ++ "]") - | Object(items) => - "{" ++ - (String.concat( - ", ", - List.map(items, ((k, v)) => "\"" ++ (String.escaped(k) ++ ("\": " ++ stringify(v)))), - ) ++ - "}") - | True => "true" - | False => "false" - | Null => "null" - } - */ - -@ocaml.doc( - " ``` - * let text = {|{\"hello\": \"folks\", \"aa\": [2, 3, \"four\"]}|}; - * let result = Json.stringify(Json.parse(text)); - * Js.log(result); - * assert(text == result); - * ``` - " -) -let white = n => { - let buffer = Buffer.create(n) - for _i in 0 to n - 1 { - Buffer.add_char(buffer, ' ') - } - Buffer.contents(buffer) -} - -/* let rec stringifyPretty = (~indent=0, t) => */ -/* switch t { */ -/* | String(value) => "\"" ++ (escape(value) ++ "\"") */ -/* | Number(num) => string_of_number(num) */ -/* | Array(list{}) => "[]" */ -/* | Array(items) => */ -/* "[\n" ++ */ -/* (white(indent) ++ */ -/* (String.concat(",\n" ++ white(indent), List.map(items, stringifyPretty(~indent=indent + 2))) ++ */ -/* ("\n" ++ */ -/* (white(indent) ++ "]")))) */ -/* | Object(list{}) => "{}" */ -/* | Object(items) => */ -/* "{\n" ++ */ -/* (white(indent) ++ */ -/* (String.concat( */ -/* ",\n" ++ white(indent), */ -/* List.map(items, ((k, v)) => */ -/* "\"" ++ (String.escaped(k) ++ ("\": " ++ stringifyPretty(~indent=indent + 2, v))) */ -/* ), */ -/* ) ++ */ -/* ("\n" ++ */ -/* (white(indent) ++ "}")))) */ -/* | True => "true" */ -/* | False => "false" */ -/* | Null => "null" */ -/* } */ - -let unwrap = (message, t) => - switch t { - | Some(v) => v - | None => failwith(message) - } - -@nodoc -module Parser = { - let split_by = (~keep_empty=false, is_delim, str) => { - let len = String.length(str) - let rec loop = (acc, last_pos, pos) => - if pos == -1 { - if last_pos == 0 && !keep_empty { - acc - } else { - list{String.sub(str, 0, last_pos), ...acc} - } - } else if is_delim(String.get(str, pos)) { - let new_len = last_pos - pos - 1 - if new_len != 0 || keep_empty { - let v = String.sub(str, pos + 1, new_len) - loop(list{v, ...acc}, pos, pos - 1) - } else { - loop(acc, pos, pos - 1) - } - } else { - loop(acc, last_pos, pos - 1) - } - loop(list{}, len, len - 1) - } - let fail = (text, pos, message) => { - let pre = String.sub(text, 0, pos) - let lines = split_by(c => c == '\n', pre) - let count = List.length(lines) - let last = count > 0 ? Belt.List.getExn(lines, count - 1) : "" - let col = String.length(last) + 1 - let line = List.length(lines) - let string = Printf.sprintf("Error \"%s\" at %d:%d -> %s\n", message, line, col, last) - failwith(string) - } - let rec skipToNewline = (text, pos) => - if pos >= String.length(text) { - pos - } else if String.get(text, pos) == '\n' { - pos + 1 - } else { - skipToNewline(text, pos + 1) - } - let stringTail = text => { - let len = String.length(text) - if len > 1 { - String.sub(text, 1, len - 1) - } else { - "" - } - } - let rec skipToCloseMultilineComment = (text, pos) => - if pos + 1 >= String.length(text) { - failwith("Unterminated comment") - } else if String.get(text, pos) == '*' && String.get(text, pos + 1) == '/' { - pos + 2 - } else { - skipToCloseMultilineComment(text, pos + 1) - } - let rec skipWhite = (text, pos) => - if ( - pos < String.length(text) && - (String.get(text, pos) == ' ' || - (String.get(text, pos) == '\t' || - (String.get(text, pos) == '\n' || String.get(text, pos) == '\r'))) - ) { - skipWhite(text, pos + 1) - } else { - pos - } - let parseString = (text, pos) => { - /* let i = ref(pos); */ - let buffer = Buffer.create(String.length(text)) - let ln = String.length(text) - let rec loop = i => - i >= ln - ? fail(text, i, "Unterminated string") - : switch String.get(text, i) { - | '"' => i + 1 - | '\\' => - i + 1 >= ln - ? fail(text, i, "Unterminated string") - : switch String.get(text, i + 1) { - | '/' => - Buffer.add_char(buffer, '/') - loop(i + 2) - | 'f' => - Buffer.add_char(buffer, '\012') - loop(i + 2) - | _ => - Buffer.add_string(buffer, Scanf.unescaped(String.sub(text, i, 2))) - loop(i + 2) - } - | c => - Buffer.add_char(buffer, c) - loop(i + 1) - } - let final = loop(pos) - (Buffer.contents(buffer), final) - } - let parseDigits = (text, pos) => { - let len = String.length(text) - let rec loop = i => - if i >= len { - i - } else { - switch String.get(text, i) { - | '0' .. '9' => loop(i + 1) - | _ => i - } - } - loop(pos + 1) - } - let parseWithDecimal = (text, pos) => { - let pos = parseDigits(text, pos) - if pos < String.length(text) && String.get(text, pos) == '.' { - let pos = parseDigits(text, pos + 1) - pos - } else { - pos - } - } - let parseNumber = (text, pos) => { - let pos = parseWithDecimal(text, pos) - let ln = String.length(text) - if pos < ln - 1 && (String.get(text, pos) == 'E' || String.get(text, pos) == 'e') { - let pos = switch String.get(text, pos + 1) { - | '-' | '+' => pos + 2 - | _ => pos + 1 - } - parseDigits(text, pos) - } else { - pos - } - } - let parseNegativeNumber = (text, pos) => { - let final = if String.get(text, pos) == '-' { - parseNumber(text, pos + 1) - } else { - parseNumber(text, pos) - } - (Number(float_of_string(String.sub(text, pos, final - pos))), final) - } - let expect = (char, text, pos, message) => - if String.get(text, pos) != char { - fail(text, pos, "Expected: " ++ message) - } else { - pos + 1 - } - let parseComment: 'a. (string, int, (string, int) => 'a) => 'a = (text, pos, next) => - if String.get(text, pos) != '/' { - if String.get(text, pos) == '*' { - next(text, skipToCloseMultilineComment(text, pos + 1)) - } else { - failwith("Invalid syntax") - } - } else { - next(text, skipToNewline(text, pos + 1)) - } - let maybeSkipComment = (text, pos) => - if pos < String.length(text) && String.get(text, pos) == '/' { - if pos + 1 < String.length(text) && String.get(text, pos + 1) == '/' { - skipToNewline(text, pos + 1) - } else if pos + 1 < String.length(text) && String.get(text, pos + 1) == '*' { - skipToCloseMultilineComment(text, pos + 1) - } else { - fail(text, pos, "Invalid synatx") - } - } else { - pos - } - let rec skip = (text, pos) => - if pos == String.length(text) { - pos - } else { - let n = skipWhite(text, pos) |> maybeSkipComment(text) - if n > pos { - skip(text, n) - } else { - n - } - } - let rec parse = (text, pos) => - if pos >= String.length(text) { - fail(text, pos, "Reached end of file without being done parsing") - } else { - switch String.get(text, pos) { - | '/' => parseComment(text, pos + 1, parse) - | '[' => parseArray(text, pos + 1) - | '{' => parseObject(text, pos + 1) - | 'n' => - if String.sub(text, pos, 4) == "null" { - (Null, pos + 4) - } else { - fail(text, pos, "unexpected character") - } - | 't' => - if String.sub(text, pos, 4) == "true" { - (True, pos + 4) - } else { - fail(text, pos, "unexpected character") - } - | 'f' => - if String.sub(text, pos, 5) == "false" { - (False, pos + 5) - } else { - fail(text, pos, "unexpected character") - } - | '\n' | '\t' | ' ' | '\r' => parse(text, skipWhite(text, pos)) - | '"' => - let (s, pos) = parseString(text, pos + 1) - (String(s), pos) - | '-' | '0' .. '9' => parseNegativeNumber(text, pos) - | _ => fail(text, pos, "unexpected character") - } - } - and parseArrayValue = (text, pos) => { - let pos = skip(text, pos) - let (value, pos) = parse(text, pos) - let pos = skip(text, pos) - switch String.get(text, pos) { - | ',' => - let pos = skip(text, pos + 1) - if String.get(text, pos) == ']' { - (list{value}, pos + 1) - } else { - let (rest, pos) = parseArrayValue(text, pos) - (list{value, ...rest}, pos) - } - | ']' => (list{value}, pos + 1) - | _ => fail(text, pos, "unexpected character") - } - } - and parseArray = (text, pos) => { - let pos = skip(text, pos) - switch String.get(text, pos) { - | ']' => (Array(list{}), pos + 1) - | _ => - let (items, pos) = parseArrayValue(text, pos) - (Array(items), pos) - } - } - and parseObjectValue = (text, pos) => { - let pos = skip(text, pos) - if String.get(text, pos) != '"' { - fail(text, pos, "Expected string") - } else { - let (key, pos) = parseString(text, pos + 1) - let pos = skip(text, pos) - let pos = expect(':', text, pos, "Colon") - let (value, pos) = parse(text, pos) - let pos = skip(text, pos) - switch String.get(text, pos) { - | ',' => - let pos = skip(text, pos + 1) - if String.get(text, pos) == '}' { - (list{(key, value)}, pos + 1) - } else { - let (rest, pos) = parseObjectValue(text, pos) - (list{(key, value), ...rest}, pos) - } - | '}' => (list{(key, value)}, pos + 1) - | _ => - let (rest, pos) = parseObjectValue(text, pos) - (list{(key, value), ...rest}, pos) - } - } - } - and parseObject = (text, pos) => { - let pos = skip(text, pos) - if String.get(text, pos) == '}' { - (Object(list{}), pos + 1) - } else { - let (pairs, pos) = parseObjectValue(text, pos) - (Object(pairs), pos) - } - } -} - -@ocaml.doc(" Turns some text into a json object. throws on failure ") -let parse = text => { - let (item, pos) = Parser.parse(text, 0) - let pos = Parser.skip(text, pos) - if pos < String.length(text) { - failwith( - "Extra data after parse finished: " ++ String.sub(text, pos, String.length(text) - pos), - ) - } else { - item - } -} - -/* Accessor helpers */ -let bind = (v, fn) => - switch v { - | None => None - | Some(v) => fn(v) - } - -@ocaml.doc(" If `t` is an object, get the value associated with the given string key ") -let get = (key, t) => - switch t { - | Object(items) => Belt.List.getAssoc(items, key, \"=") - | _ => None - } - -@ocaml.doc(" If `t` is an array, get the value associated with the given index ") -let nth = (n, t) => - switch t { - | Array(items) => - if n < List.length(items) { - Some(Belt.List.getExn(items, n)) - } else { - None - } - | _ => None - } - -let string = t => - switch t { - | String(s) => Some(s) - | _ => None - } - -let number = t => - switch t { - | Number(s) => Some(s) - | _ => None - } - -let array = t => - switch t { - | Array(s) => Some(s) - | _ => None - } - -let obj = t => - switch t { - | Object(s) => Some(s) - | _ => None - } - -let bool = t => - switch t { - | True => Some(true) - | False => Some(false) - | _ => None - } - -let null = t => - switch t { - | Null => Some() - | _ => None - } - -let rec parsePath = (keyList, t) => - switch keyList { - | list{} => Some(t) - | list{head, ...rest} => - switch get(head, t) { - | None => None - | Some(value) => parsePath(rest, value) - } - } - -@ocaml.doc( - " Get a deeply nested value from an object `t`. - * ``` - * open Json.Infix; - * let json = Json.parse({|{\"a\": {\"b\": {\"c\": 2}}}|}); - * let num = Json.getPath(\"a.b.c\", json) |?> Json.number; - * assert(num == Some(2.)) - * ``` - " -) -let getPath = (path, t) => { - let keys = Parser.split_by(c => c == '.', path) - parsePath(keys, t) -} diff --git a/examples/basic/src/bar.res b/examples/basic/src/bar.res deleted file mode 100644 index b4bf7b8..0000000 --- a/examples/basic/src/bar.res +++ /dev/null @@ -1,63 +0,0 @@ -/* * this is a test */ -type t - -@val external test: t => unit = "test" - -/* * Decodes a JSON value into a [bool] - -{b Returns} a [bool] if the JSON value is a [true] or [false]. -@raise [DecodeError] if unsuccessful -@example {[ - open Json - (* returns true *) - let _ = Json.parseOrRaise "true" |> Decode.bool - (* returns false *) - let _ = Json.parseOrRaise "false" |> Decode.bool - (* raises DecodeError *) - let _ = Json.parseOrRaise "123" |> Decode.bool - (* raises DecodeError *) - let _ = Json.parseOrRaise "null" |> Decode.bool -]} -*/ -let hello_world = "whatever" - -let whatever = test - -let a = (a, b) => a + b - -let hooloo = hello_world - -let abc =
- -@react.component -let make = () => { -
{React.string("test")}
-} - -type user = {name: string} - -type what = A(string) | B(int) - -let u = {name: "test"} - -let labelTest = (~test: string) => { - "Hello " ++ test -} - -module Test = { - @react.component - let make = (~name) => { - let inputRef = React.useRef(Js.Nullable.null) - -
- - -
- } -} - -let poly1 = #test -let poly2 = #foobar -let poly3 = #foobar - -let callbackU = (. a) => Js.log(a) diff --git a/examples/basic/src/baz.res b/examples/basic/src/baz.res deleted file mode 100644 index 883df34..0000000 --- a/examples/basic/src/baz.res +++ /dev/null @@ -1,3 +0,0 @@ -let add = (a, b) => a + b - -let subst = (a, b) => a - b diff --git a/examples/basic/src/baz.resi b/examples/basic/src/baz.resi deleted file mode 100644 index 3ea082c..0000000 --- a/examples/basic/src/baz.resi +++ /dev/null @@ -1,3 +0,0 @@ -let add: (int, int) => int - -let subst: (int, int) => int diff --git a/examples/basic/src/foo.res b/examples/basic/src/foo.res deleted file mode 100644 index 3140f8a..0000000 --- a/examples/basic/src/foo.res +++ /dev/null @@ -1,32 +0,0 @@ -let a = 1 - -let b = "test" - -let c = Bar.hello_world - -let d = Bar.whatever - -let f = "test" - -let asdf = - -let foo = Bar.Test.make - -let fdsa = - -let plus1 = a => { - Js.log("called plus 1") - a + 1 -} - -let plus2 = a => { - Js.log("called plus 2") - a + 2 -} - -let compose = (f, g, x) => f(g(x)) - -let plus4 = plus1->compose(plus2)->compose(plus1) - -Js.log(plus4) - diff --git a/examples/basic/src/test.json b/examples/basic/src/test.json deleted file mode 100644 index fdb7f36..0000000 --- a/examples/basic/src/test.json +++ /dev/null @@ -1,28 +0,0 @@ -[ - { - "hover": "int", - "range": { - "end": { - "character": 9, - "line": 0 - }, - "start": { - "character": 8, - "line": 0 - } - } - }, - { - "hover": "```\nint\n```\n\n/src/foo.res", - "range": { - "end": { - "character": 5, - "line": 0 - }, - "start": { - "character": 4, - "line": 0 - } - } - } -] diff --git a/examples/monorepo-yarn-workspaces/README.md b/examples/monorepo-yarn-workspaces/README.md deleted file mode 100644 index 163b3bd..0000000 --- a/examples/monorepo-yarn-workspaces/README.md +++ /dev/null @@ -1,23 +0,0 @@ -# yarn workspaces monorepo example - -This example setup is using the `yarn workspace` feature in combination with ReScript's `pinned-dependencies`. - -**Expected IDE plugin behavior:** - -When the editor is opened in one of the subprojects `app` or `common`, the editor extension should correctly detect the `bsc` and `bsb` binary in the monorepo root's `node_modules` directory. - -``` -cd app -nvim . -``` - -## Setup - -``` -cd examples/monorepo-yarn-workspaces -yarn - -# Build the full project -cd app -yarn run build -``` diff --git a/examples/monorepo-yarn-workspaces/app/bsconfig.json b/examples/monorepo-yarn-workspaces/app/bsconfig.json deleted file mode 100644 index a0cfea7..0000000 --- a/examples/monorepo-yarn-workspaces/app/bsconfig.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "$schema": "https://raw.githubusercontent.com/rescript-lang/rescript-compiler/master/docs/docson/build-schema.json", - "name": "app", - "version": "1.0.0", - "sources": { - "dir" : "src", - "subdirs" : true - }, - "package-specs": { - "module": "commonjs", - "in-source": true - }, - "suffix": ".js", - "bs-dependencies": [ - "reason-react", - "common" - ], - "pinned-dependencies": ["common"], - "ppx-flags": [], - "bsc-flags": ["-bs-super-errors", "-bs-no-version-header"], - "warnings": { - "number": "-44", - "error": "+8+26+27+101" - }, - "reason": {"react-jsx": 3} -} diff --git a/examples/monorepo-yarn-workspaces/app/package.json b/examples/monorepo-yarn-workspaces/app/package.json deleted file mode 100644 index bcaede8..0000000 --- a/examples/monorepo-yarn-workspaces/app/package.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "app", - "version": "0.1.0", - "private": true, - "dependencies": { - "common": "1.0.0" - }, - "scripts": { - "clean": "bsb -clean-world", - "build": "bsb -make-world", - "watch": "bsb -make-world -w" - }, - "devDependencies": { - "bs-platform": "^8.4.2" - } -} diff --git a/examples/monorepo-yarn-workspaces/app/src/App.res b/examples/monorepo-yarn-workspaces/app/src/App.res deleted file mode 100644 index 26f68c3..0000000 --- a/examples/monorepo-yarn-workspaces/app/src/App.res +++ /dev/null @@ -1,9 +0,0 @@ -@react.component -let make = () => { - Common.Header.make(Js.Obj.empty())->Js.log - Common.Footer.make(Js.Obj.empty())->Js.log - - <>
{React.string("Main content")}
-} - -make(Js.Obj.empty())->Js.log diff --git a/examples/monorepo-yarn-workspaces/common/bsconfig.json b/examples/monorepo-yarn-workspaces/common/bsconfig.json deleted file mode 100644 index c7d04f4..0000000 --- a/examples/monorepo-yarn-workspaces/common/bsconfig.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "$schema": "https://raw.githubusercontent.com/rescript-lang/rescript-compiler/master/docs/docson/build-schema.json", - "name": "common", - "namespace": "Common", - "version": "0.0.1", - "sources": { - "dir" : "src", - "subdirs" : true - }, - "package-specs": { - "module": "commonjs", - "in-source": true - }, - "suffix": ".js", - "bs-dependencies": [ - "reason-react" - ], - "ppx-flags": [], - "bsc-flags": ["-bs-super-errors", "-bs-no-version-header"], - "warnings": { - "number": "-44", - "error": "+8+26+27+101" - }, - "reason": {"react-jsx": 3} -} diff --git a/examples/monorepo-yarn-workspaces/common/package.json b/examples/monorepo-yarn-workspaces/common/package.json deleted file mode 100644 index 34ca217..0000000 --- a/examples/monorepo-yarn-workspaces/common/package.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name": "common", - "version": "1.0.0", - "main": "index.js", - "license": "MIT", - "scripts": { - "clean": "bsb -clean-world", - "build": "bsb -make-world", - "watch": "bsb -make-world -w" - }, - "dependencies": { - "reason-react": "^0.9.1" - }, - "devDependencies": { - "bs-platform": "^8.4.2" - } -} diff --git a/examples/monorepo-yarn-workspaces/common/src/Footer.res b/examples/monorepo-yarn-workspaces/common/src/Footer.res deleted file mode 100644 index 94489e7..0000000 --- a/examples/monorepo-yarn-workspaces/common/src/Footer.res +++ /dev/null @@ -1,4 +0,0 @@ -@react.component -let make = () => { -
{React.string("Footer")}
-} diff --git a/examples/monorepo-yarn-workspaces/common/src/Header.res b/examples/monorepo-yarn-workspaces/common/src/Header.res deleted file mode 100644 index d2d0fef..0000000 --- a/examples/monorepo-yarn-workspaces/common/src/Header.res +++ /dev/null @@ -1,4 +0,0 @@ -@react.component -let make = () => { -
{"Header"->React.string}
-} diff --git a/examples/monorepo-yarn-workspaces/legacy/bsconfig.json b/examples/monorepo-yarn-workspaces/legacy/bsconfig.json deleted file mode 100644 index d2e5ac9..0000000 --- a/examples/monorepo-yarn-workspaces/legacy/bsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "$schema": "https://raw.githubusercontent.com/rescript-lang/rescript-compiler/master/docs/docson/build-schema.json", - "name": "legacy", - "namespace": "Legacy", - "version": "0.0.1", - "sources": { - "dir" : "src", - "subdirs" : true - }, - "package-specs": { - "module": "commonjs", - "in-source": true - }, - "suffix": ".js", - "bs-dependencies": [], - "ppx-flags": [], - "bsc-flags": ["-bs-super-errors", "-bs-no-version-header"], - "warnings": { - "number": "-44", - "error": "+8+26+27+101" - }, - "reason": {"react-jsx": 3} -} diff --git a/examples/monorepo-yarn-workspaces/legacy/package.json b/examples/monorepo-yarn-workspaces/legacy/package.json deleted file mode 100644 index e3a17c1..0000000 --- a/examples/monorepo-yarn-workspaces/legacy/package.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name": "legacy", - "version": "1.0.0", - "main": "index.js", - "license": "MIT", - "scripts": { - "clean": "bsb -clean-world", - "build": "bsb -make-world", - "watch": "bsb -make-world -w" - }, - "dependencies": { - "reason-react": "^0.9.1" - }, - "devDependencies": { - "bs-platform": "8.4.0" - } -} diff --git a/examples/monorepo-yarn-workspaces/legacy/src/Api.res b/examples/monorepo-yarn-workspaces/legacy/src/Api.res deleted file mode 100644 index 2e751b9..0000000 --- a/examples/monorepo-yarn-workspaces/legacy/src/Api.res +++ /dev/null @@ -1,3 +0,0 @@ -let queryUser = () => { - "my-user" -} diff --git a/examples/monorepo-yarn-workspaces/package.json b/examples/monorepo-yarn-workspaces/package.json deleted file mode 100644 index bdaf467..0000000 --- a/examples/monorepo-yarn-workspaces/package.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "name": "rescript-yarn-workspaces-example", - "private": true, - "workspaces": { - "packages": [ - "app", - "common", - "legacy" - ] - } -} diff --git a/examples/monorepo-yarn-workspaces/yarn.lock b/examples/monorepo-yarn-workspaces/yarn.lock deleted file mode 100644 index 49231de..0000000 --- a/examples/monorepo-yarn-workspaces/yarn.lock +++ /dev/null @@ -1,18 +0,0 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. -# yarn lockfile v1 - - -bs-platform@8.4.0: - version "8.4.0" - resolved "https://registry.yarnpkg.com/bs-platform/-/bs-platform-8.4.0.tgz#abf4cfa260fa3b163a0f033c26adf8d5ed185b8d" - integrity sha512-00LoUWcwrtA35kQSOCD19DK55eZSggWNxVyoz1CsDhkzTh/+1hP8EQx3b+Awl0dfKnQtY5oZFYel0C/tcV7kPw== - -bs-platform@^8.4.2: - version "8.4.2" - resolved "https://registry.yarnpkg.com/bs-platform/-/bs-platform-8.4.2.tgz#778dabd1dfb3bc95e0086c58dabae74e4ebdee8a" - integrity sha512-9q7S4/LLV/a68CweN382NJdCCr/lOSsJR3oQYnmPK98ChfO/AdiA3lYQkQTp6T+U0I5Z5RypUAUprNstwDtMDQ== - -reason-react@^0.9.1: - version "0.9.1" - resolved "https://registry.yarnpkg.com/reason-react/-/reason-react-0.9.1.tgz#30a887158200b659aa03e2d75ff4cc54dc462bb0" - integrity sha512-nlH0O2TDy9KzOLOW+vlEQk4ExHOeciyzFdoLcsmmiit6hx6H5+CVDrwJ+8aiaLT/kqK5xFOjy4PS7PftWz4plA== diff --git a/examples/rescript-project/.gitignore b/examples/rescript-project/.gitignore deleted file mode 100644 index 1dd11f9..0000000 --- a/examples/rescript-project/.gitignore +++ /dev/null @@ -1,27 +0,0 @@ -*.exe -*.obj -*.out -*.compile -*.native -*.byte -*.cmo -*.annot -*.cmi -*.cmx -*.cmt -*.cmti -*.cma -*.a -*.cmxa -*.obj -*~ -*.annot -*.cmj -*.bak -lib/bs -*.mlast -*.mliast -.vscode -.merlin -.bsb.lock -/node_modules/ diff --git a/examples/rescript-project/README.md b/examples/rescript-project/README.md deleted file mode 100644 index c9872ec..0000000 --- a/examples/rescript-project/README.md +++ /dev/null @@ -1,4 +0,0 @@ -# rescript-project - -This is an example project that uses the new `rescript` npm package instead of `bs-platform`. -The plugin should gracefully handle any type of project, no matter what npm package it's based on. diff --git a/examples/rescript-project/bsconfig.json b/examples/rescript-project/bsconfig.json deleted file mode 100644 index f77df3d..0000000 --- a/examples/rescript-project/bsconfig.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "name": "rescript-project", - "version": "0.1.0", - "sources": { - "dir" : "src", - "subdirs" : true - }, - "package-specs": { - "module": "es6", - "in-source": true - } -} diff --git a/examples/rescript-project/package-lock.json b/examples/rescript-project/package-lock.json deleted file mode 100644 index ea0fd47..0000000 --- a/examples/rescript-project/package-lock.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "name": "rescript-project", - "version": "1.0.0", - "lockfileVersion": 2, - "requires": true, - "packages": { - "": { - "version": "1.0.0", - "license": "ISC", - "devDependencies": { - "rescript": "9.1.3" - } - }, - "node_modules/rescript": { - "version": "9.1.3", - "resolved": "https://registry.npmjs.org/rescript/-/rescript-9.1.3.tgz", - "integrity": "sha512-TpfW3DakgCJtWbRvAek7cysuikBWarjqt8PrbFg0Rk3O+o4dt0inBdxyZe/+u3LOAWzyKK+2UlqC0xiCBgs6pQ==", - "dev": true, - "hasInstallScript": true, - "bin": { - "bsc": "bsc", - "bsrefmt": "bsrefmt", - "bstracing": "lib/bstracing", - "rescript": "rescript" - } - } - }, - "dependencies": { - "rescript": { - "version": "9.1.3", - "resolved": "https://registry.npmjs.org/rescript/-/rescript-9.1.3.tgz", - "integrity": "sha512-TpfW3DakgCJtWbRvAek7cysuikBWarjqt8PrbFg0Rk3O+o4dt0inBdxyZe/+u3LOAWzyKK+2UlqC0xiCBgs6pQ==", - "dev": true - } - } -} diff --git a/examples/rescript-project/package.json b/examples/rescript-project/package.json deleted file mode 100644 index dfc6986..0000000 --- a/examples/rescript-project/package.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "rescript-project", - "version": "1.0.0", - "description": "Example project with new ReScript npm package dependency", - "main": "index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "keywords": [], - "author": "", - "license": "ISC", - "devDependencies": { - "rescript": "9.1.3" - } -} diff --git a/examples/rescript-project/src/TestJumpTo.res b/examples/rescript-project/src/TestJumpTo.res deleted file mode 100644 index a778783..0000000 --- a/examples/rescript-project/src/TestJumpTo.res +++ /dev/null @@ -1,6 +0,0 @@ -Demo.a->Js.log -Demo.b->Js.log - -let user = {RecordExample.User.name: "test"} - -RecordExample.logUser(user) diff --git a/examples/rescript-project/src/asyncAwait.res b/examples/rescript-project/src/asyncAwait.res deleted file mode 100644 index ba735d8..0000000 --- a/examples/rescript-project/src/asyncAwait.res +++ /dev/null @@ -1,4 +0,0 @@ -let greetUser = async (userId) => { - let name = await getUserName(. userId) - "Hello " ++ name ++ "!" -} diff --git a/examples/rescript-project/src/demo.res b/examples/rescript-project/src/demo.res deleted file mode 100644 index 37e3b3b..0000000 --- a/examples/rescript-project/src/demo.res +++ /dev/null @@ -1,10 +0,0 @@ -Js.log("Hello, ReScript") - -let a = 1 - - - - - - -let b = a diff --git a/examples/rescript-project/src/escapeSyntax.res b/examples/rescript-project/src/escapeSyntax.res deleted file mode 100644 index 6bd1f9f..0000000 --- a/examples/rescript-project/src/escapeSyntax.res +++ /dev/null @@ -1,27 +0,0 @@ -let a = "abc" - -let str = "aaa\"bbb" - -Js.log(` \` ccc ${a} ddd `) - -Js.log(`a = ${a}`) - -Js.log(``) - -Js.log(`\``) - -Js.log(`first line\nsecond line`) - -Js.log(`first line\r\nsecond line`) - -Js.log(` -multi line -\` -multi line -`) - -let b = 34 - -let parser = %raw(` -adsfadsfzz -`) diff --git a/examples/rescript-project/src/interpolationSyntax.res b/examples/rescript-project/src/interpolationSyntax.res deleted file mode 100644 index 50d5a69..0000000 --- a/examples/rescript-project/src/interpolationSyntax.res +++ /dev/null @@ -1,11 +0,0 @@ -let name = "Amirali" - -let var = `hello ${name} how you doin?` - -let var2 = j`hello ${name} how you doin?` - -let var3 = j`hello $name how you doin?` - -let varInvalid = `hello $name how you doin?` - -let expr = `2 + 2 is ${Belt.Int.toString(2 + 2)}` diff --git a/examples/rescript-project/src/polySyntax.res b/examples/rescript-project/src/polySyntax.res deleted file mode 100644 index bf70396..0000000 --- a/examples/rescript-project/src/polySyntax.res +++ /dev/null @@ -1,11 +0,0 @@ -let a = #normal - -let b = #"exo-tic" - -let c = #"legacy exo-tic" - -let d = #732 - -let e = {RecordExample.User.name: "test"} - -Demo.a->Js.log diff --git a/examples/rescript-project/src/recordExample.res b/examples/rescript-project/src/recordExample.res deleted file mode 100644 index c06e015..0000000 --- a/examples/rescript-project/src/recordExample.res +++ /dev/null @@ -1,16 +0,0 @@ -module User = { - type t = {name: string} -} - -module Role = { - type t = {roleName: string} -} - -let logUser = (u: User.t) => { - Js.log(u.name) -} - -let logRole = (r: Role.t) => { - Js.log(r.roleName) -} - diff --git a/examples/rescript-project/src/recordExample.resi b/examples/rescript-project/src/recordExample.resi deleted file mode 100644 index 6cc004f..0000000 --- a/examples/rescript-project/src/recordExample.resi +++ /dev/null @@ -1,11 +0,0 @@ -module User: { - type t = {name: string} -} - -module Role: { - type t = {roleName: string} -} - -let logUser: User.t => unit - -let logRole: Role.t => unit diff --git a/ftdetect/rescript.vim b/ftdetect/rescript.vim index b0a8176..4fb99cd 100644 --- a/ftdetect/rescript.vim +++ b/ftdetect/rescript.vim @@ -1,2 +1,6 @@ +" Since Neovim 0.8 rescript is detected by vim.filetype API +if has('nvim-0.8') + finish +endif au BufRead,BufNewFile *.res set filetype=rescript au BufRead,BufNewFile *.resi set filetype=rescript diff --git a/ftplugin/rescript.vim b/ftplugin/rescript.vim deleted file mode 100644 index 99b62ac..0000000 --- a/ftplugin/rescript.vim +++ /dev/null @@ -1,18 +0,0 @@ -if !get(g:, 'vim_rescript_enabled', 1) - finish -endif - -if exists("b:did_ftplugin") - finish -endif -let b:did_ftplugin = 1 - -call rescript#Init() - -" On every *.res / *.resi file open, recalculate the project environment -" This helps us to always make sure that we are working off the right -" working directory etc -augroup RescriptAutoProjectEnv - au! - au BufReadPost,BufNewFile *.res,*.resi call rescript#UpdateProjectEnv() -augroup END diff --git a/package-lock.json b/package-lock.json deleted file mode 100644 index 6acdaa4..0000000 --- a/package-lock.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "name": "vim-rescript-test", - "version": "0.0.0", - "lockfileVersion": 1, - "requires": true, - "dependencies": { - "bs-platform": { - "version": "8.4.2", - "resolved": "https://registry.npmjs.org/bs-platform/-/bs-platform-8.4.2.tgz", - "integrity": "sha512-9q7S4/LLV/a68CweN382NJdCCr/lOSsJR3oQYnmPK98ChfO/AdiA3lYQkQTp6T+U0I5Z5RypUAUprNstwDtMDQ==", - "dev": true - } - } -} diff --git a/package.json b/package.json deleted file mode 100644 index 9796f46..0000000 --- a/package.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "name": "vim-rescript-test", - "private": true, - "description": "This is only needed for our test framework", - "version": "0.0.0", - "keywords": [], - "author": "", - "license": "MIT", - "devDependencies": { - "bs-platform": "8.4.2" - } -} diff --git a/plugin/rescript.vim b/plugin/rescript.vim deleted file mode 100644 index 56a3a92..0000000 --- a/plugin/rescript.vim +++ /dev/null @@ -1,18 +0,0 @@ -if !get(g:, 'vim_rescript_enabled', 1) - finish -endif -let g:loaded_vim_rescript = 1 - -command! RescriptFormat call rescript#Format() -command! RescriptBuild call rescript#Build() -command! RescriptBuildWithDeps call rescript#Build(1) - -command! RescriptClean call rescript#Clean() -command! RescriptCleanWithDeps call rescript#Clean(1) - -command! RescriptTypeHint call rescript#TypeHint() -command! RescriptInfo call rescript#Info() -command! RescriptJumpToDefinition call rescript#JumpToDefinition() -command! RescriptUpgradeFromReason call rescript#ReasonToRescript() - -call rescript#Init() diff --git a/server/analysis_binaries/darwin/rescript-editor-analysis.exe b/server/analysis_binaries/darwin/rescript-editor-analysis.exe deleted file mode 100755 index ba73fa9..0000000 Binary files a/server/analysis_binaries/darwin/rescript-editor-analysis.exe and /dev/null differ diff --git a/server/analysis_binaries/linux/rescript-editor-analysis.exe b/server/analysis_binaries/linux/rescript-editor-analysis.exe deleted file mode 100755 index d41e49a..0000000 Binary files a/server/analysis_binaries/linux/rescript-editor-analysis.exe and /dev/null differ diff --git a/server/analysis_binaries/win32/rescript-editor-analysis.exe b/server/analysis_binaries/win32/rescript-editor-analysis.exe deleted file mode 100755 index a292710..0000000 Binary files a/server/analysis_binaries/win32/rescript-editor-analysis.exe and /dev/null differ diff --git a/server/node_modules/.package-lock.json b/server/node_modules/.package-lock.json deleted file mode 100644 index 11951e2..0000000 --- a/server/node_modules/.package-lock.json +++ /dev/null @@ -1,215 +0,0 @@ -{ - "name": "rescript-language-server", - "version": "1.1.3", - "lockfileVersion": 2, - "requires": true, - "packages": { - "node_modules/anymatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.2.tgz", - "integrity": "sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg==", - "dependencies": { - "normalize-path": "^3.0.0", - "picomatch": "^2.0.4" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/binary-extensions": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", - "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", - "engines": { - "node": ">=8" - } - }, - "node_modules/braces": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", - "dependencies": { - "fill-range": "^7.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/chokidar": { - "version": "3.5.1", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.1.tgz", - "integrity": "sha512-9+s+Od+W0VJJzawDma/gvBNQqkTiqYTWLuZoyAsivsI4AaWTCzHG06/TMjsf1cYe9Cb97UCEhjz7HvnPk2p/tw==", - "dependencies": { - "anymatch": "~3.1.1", - "braces": "~3.0.2", - "fsevents": "~2.3.1", - "glob-parent": "~5.1.0", - "is-binary-path": "~2.1.0", - "is-glob": "~4.0.1", - "normalize-path": "~3.0.0", - "readdirp": "~3.5.0" - }, - "engines": { - "node": ">= 8.10.0" - }, - "optionalDependencies": { - "fsevents": "~2.3.1" - } - }, - "node_modules/fill-range": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", - "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", - "dependencies": { - "to-regex-range": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/fsevents": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", - "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", - "hasInstallScript": true, - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": "^8.16.0 || ^10.6.0 || >=11.0.0" - } - }, - "node_modules/glob-parent": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", - "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", - "dependencies": { - "is-glob": "^4.0.1" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/is-binary-path": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", - "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", - "dependencies": { - "binary-extensions": "^2.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/is-extglob": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-glob": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz", - "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==", - "dependencies": { - "is-extglob": "^2.1.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-number": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", - "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", - "engines": { - "node": ">=0.12.0" - } - }, - "node_modules/normalize-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", - "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/picomatch": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.3.tgz", - "integrity": "sha512-KpELjfwcCDUb9PeigTs2mBJzXUPzAuP2oPcA989He8Rte0+YUAjw1JVedDhuTKPkHjSYzMN3npC9luThGYEKdg==", - "engines": { - "node": ">=8.6" - }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" - } - }, - "node_modules/readdirp": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.5.0.tgz", - "integrity": "sha512-cMhu7c/8rdhkHXWsY+osBhfSy0JikwpHK/5+imo+LpeasTF8ouErHrlYkwT0++njiyuDvc7OFY5T3ukvZ8qmFQ==", - "dependencies": { - "picomatch": "^2.2.1" - }, - "engines": { - "node": ">=8.10.0" - } - }, - "node_modules/to-regex-range": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", - "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", - "dependencies": { - "is-number": "^7.0.0" - }, - "engines": { - "node": ">=8.0" - } - }, - "node_modules/vscode-jsonrpc": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-5.0.1.tgz", - "integrity": "sha512-JvONPptw3GAQGXlVV2utDcHx0BiY34FupW/kI6mZ5x06ER5DdPG/tXWMVHjTNULF5uKPOUUD0SaXg5QaubJL0A==", - "engines": { - "node": ">=8.0.0 || >=10.0.0" - } - }, - "node_modules/vscode-languageserver": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/vscode-languageserver/-/vscode-languageserver-7.0.0.tgz", - "integrity": "sha512-60HTx5ID+fLRcgdHfmz0LDZAXYEV68fzwG0JWwEPBode9NuMYTIxuYXPg4ngO8i8+Ou0lM7y6GzaYWbiDL0drw==", - "dependencies": { - "vscode-languageserver-protocol": "3.16.0" - }, - "bin": { - "installServerIntoExtension": "bin/installServerIntoExtension" - } - }, - "node_modules/vscode-languageserver-protocol": { - "version": "3.16.0", - "resolved": "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.16.0.tgz", - "integrity": "sha512-sdeUoAawceQdgIfTI+sdcwkiK2KU+2cbEYA0agzM2uqaUy2UpnnGHtWTHVEtS0ES4zHU0eMFRGN+oQgDxlD66A==", - "dependencies": { - "vscode-jsonrpc": "6.0.0", - "vscode-languageserver-types": "3.16.0" - } - }, - "node_modules/vscode-languageserver-protocol/node_modules/vscode-jsonrpc": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-6.0.0.tgz", - "integrity": "sha512-wnJA4BnEjOSyFMvjZdpiOwhSq9uDoK8e/kpRJDTaMYzwlkrhG1fwDIZI94CLsLzlCK5cIbMMtFlJlfR57Lavmg==", - "engines": { - "node": ">=8.0.0 || >=10.0.0" - } - }, - "node_modules/vscode-languageserver-types": { - "version": "3.16.0", - "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.16.0.tgz", - "integrity": "sha512-k8luDIWJWyenLc5ToFQQMaSrqCHiLwyKPHKPQZ5zz21vM+vIVUSvsRpcbiECH4WR88K2XZqc4ScRcZ7nk/jbeA==" - } - } -} diff --git a/server/node_modules/anymatch/LICENSE b/server/node_modules/anymatch/LICENSE deleted file mode 100644 index 491766c..0000000 --- a/server/node_modules/anymatch/LICENSE +++ /dev/null @@ -1,15 +0,0 @@ -The ISC License - -Copyright (c) 2019 Elan Shanker, Paul Miller (https://paulmillr.com) - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/server/node_modules/anymatch/README.md b/server/node_modules/anymatch/README.md deleted file mode 100644 index 1dd67f5..0000000 --- a/server/node_modules/anymatch/README.md +++ /dev/null @@ -1,87 +0,0 @@ -anymatch [![Build Status](https://travis-ci.org/micromatch/anymatch.svg?branch=master)](https://travis-ci.org/micromatch/anymatch) [![Coverage Status](https://img.shields.io/coveralls/micromatch/anymatch.svg?branch=master)](https://coveralls.io/r/micromatch/anymatch?branch=master) -====== -Javascript module to match a string against a regular expression, glob, string, -or function that takes the string as an argument and returns a truthy or falsy -value. The matcher can also be an array of any or all of these. Useful for -allowing a very flexible user-defined config to define things like file paths. - -__Note: This module has Bash-parity, please be aware that Windows-style backslashes are not supported as separators. See https://github.com/micromatch/micromatch#backslashes for more information.__ - - -Usage ------ -```sh -npm install anymatch -``` - -#### anymatch(matchers, testString, [returnIndex], [options]) -* __matchers__: (_Array|String|RegExp|Function_) -String to be directly matched, string with glob patterns, regular expression -test, function that takes the testString as an argument and returns a truthy -value if it should be matched, or an array of any number and mix of these types. -* __testString__: (_String|Array_) The string to test against the matchers. If -passed as an array, the first element of the array will be used as the -`testString` for non-function matchers, while the entire array will be applied -as the arguments for function matchers. -* __options__: (_Object_ [optional]_) Any of the [picomatch](https://github.com/micromatch/picomatch#options) options. - * __returnIndex__: (_Boolean [optional]_) If true, return the array index of -the first matcher that that testString matched, or -1 if no match, instead of a -boolean result. - -```js -const anymatch = require('anymatch'); - -const matchers = [ 'path/to/file.js', 'path/anyjs/**/*.js', /foo.js$/, string => string.includes('bar') && string.length > 10 ] ; - -anymatch(matchers, 'path/to/file.js'); // true -anymatch(matchers, 'path/anyjs/baz.js'); // true -anymatch(matchers, 'path/to/foo.js'); // true -anymatch(matchers, 'path/to/bar.js'); // true -anymatch(matchers, 'bar.js'); // false - -// returnIndex = true -anymatch(matchers, 'foo.js', {returnIndex: true}); // 2 -anymatch(matchers, 'path/anyjs/foo.js', {returnIndex: true}); // 1 - -// any picomatc - -// using globs to match directories and their children -anymatch('node_modules', 'node_modules'); // true -anymatch('node_modules', 'node_modules/somelib/index.js'); // false -anymatch('node_modules/**', 'node_modules/somelib/index.js'); // true -anymatch('node_modules/**', '/absolute/path/to/node_modules/somelib/index.js'); // false -anymatch('**/node_modules/**', '/absolute/path/to/node_modules/somelib/index.js'); // true - -const matcher = anymatch(matchers); -['foo.js', 'bar.js'].filter(matcher); // [ 'foo.js' ] -anymatch master* ❯ - -``` - -#### anymatch(matchers) -You can also pass in only your matcher(s) to get a curried function that has -already been bound to the provided matching criteria. This can be used as an -`Array#filter` callback. - -```js -var matcher = anymatch(matchers); - -matcher('path/to/file.js'); // true -matcher('path/anyjs/baz.js', true); // 1 - -['foo.js', 'bar.js'].filter(matcher); // ['foo.js'] -``` - -Changelog ----------- -[See release notes page on GitHub](https://github.com/micromatch/anymatch/releases) - -- **v3.0:** Removed `startIndex` and `endIndex` arguments. Node 8.x-only. -- **v2.0:** [micromatch](https://github.com/jonschlinkert/micromatch) moves away from minimatch-parity and inline with Bash. This includes handling backslashes differently (see https://github.com/micromatch/micromatch#backslashes for more information). -- **v1.2:** anymatch uses [micromatch](https://github.com/jonschlinkert/micromatch) -for glob pattern matching. Issues with glob pattern matching should be -reported directly to the [micromatch issue tracker](https://github.com/jonschlinkert/micromatch/issues). - -License -------- -[ISC](https://raw.github.com/micromatch/anymatch/master/LICENSE) diff --git a/server/node_modules/anymatch/index.js b/server/node_modules/anymatch/index.js deleted file mode 100644 index 9fb3ebb..0000000 --- a/server/node_modules/anymatch/index.js +++ /dev/null @@ -1,104 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { value: true }); - -const picomatch = require('picomatch'); -const normalizePath = require('normalize-path'); - -/** - * @typedef {(testString: string) => boolean} AnymatchFn - * @typedef {string|RegExp|AnymatchFn} AnymatchPattern - * @typedef {AnymatchPattern|AnymatchPattern[]} AnymatchMatcher - */ -const BANG = '!'; -const DEFAULT_OPTIONS = {returnIndex: false}; -const arrify = (item) => Array.isArray(item) ? item : [item]; - -/** - * @param {AnymatchPattern} matcher - * @param {object} options - * @returns {AnymatchFn} - */ -const createPattern = (matcher, options) => { - if (typeof matcher === 'function') { - return matcher; - } - if (typeof matcher === 'string') { - const glob = picomatch(matcher, options); - return (string) => matcher === string || glob(string); - } - if (matcher instanceof RegExp) { - return (string) => matcher.test(string); - } - return (string) => false; -}; - -/** - * @param {Array} patterns - * @param {Array} negPatterns - * @param {String|Array} args - * @param {Boolean} returnIndex - * @returns {boolean|number} - */ -const matchPatterns = (patterns, negPatterns, args, returnIndex) => { - const isList = Array.isArray(args); - const _path = isList ? args[0] : args; - if (!isList && typeof _path !== 'string') { - throw new TypeError('anymatch: second argument must be a string: got ' + - Object.prototype.toString.call(_path)) - } - const path = normalizePath(_path); - - for (let index = 0; index < negPatterns.length; index++) { - const nglob = negPatterns[index]; - if (nglob(path)) { - return returnIndex ? -1 : false; - } - } - - const applied = isList && [path].concat(args.slice(1)); - for (let index = 0; index < patterns.length; index++) { - const pattern = patterns[index]; - if (isList ? pattern(...applied) : pattern(path)) { - return returnIndex ? index : true; - } - } - - return returnIndex ? -1 : false; -}; - -/** - * @param {AnymatchMatcher} matchers - * @param {Array|string} testString - * @param {object} options - * @returns {boolean|number|Function} - */ -const anymatch = (matchers, testString, options = DEFAULT_OPTIONS) => { - if (matchers == null) { - throw new TypeError('anymatch: specify first argument'); - } - const opts = typeof options === 'boolean' ? {returnIndex: options} : options; - const returnIndex = opts.returnIndex || false; - - // Early cache for matchers. - const mtchers = arrify(matchers); - const negatedGlobs = mtchers - .filter(item => typeof item === 'string' && item.charAt(0) === BANG) - .map(item => item.slice(1)) - .map(item => picomatch(item, opts)); - const patterns = mtchers - .filter(item => typeof item !== 'string' || (typeof item === 'string' && item.charAt(0) !== BANG)) - .map(matcher => createPattern(matcher, opts)); - - if (testString == null) { - return (testString, ri = false) => { - const returnIndex = typeof ri === 'boolean' ? ri : false; - return matchPatterns(patterns, negatedGlobs, testString, returnIndex); - } - } - - return matchPatterns(patterns, negatedGlobs, testString, returnIndex); -}; - -anymatch.default = anymatch; -module.exports = anymatch; diff --git a/server/node_modules/anymatch/package.json b/server/node_modules/anymatch/package.json deleted file mode 100644 index f9b5284..0000000 --- a/server/node_modules/anymatch/package.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "name": "anymatch", - "version": "3.1.2", - "description": "Matches strings against configurable strings, globs, regular expressions, and/or functions", - "files": [ - "index.js", - "index.d.ts" - ], - "dependencies": { - "normalize-path": "^3.0.0", - "picomatch": "^2.0.4" - }, - "author": { - "name": "Elan Shanker", - "url": "https://github.com/es128" - }, - "license": "ISC", - "homepage": "https://github.com/micromatch/anymatch", - "repository": { - "type": "git", - "url": "https://github.com/micromatch/anymatch" - }, - "keywords": [ - "match", - "any", - "string", - "file", - "fs", - "list", - "glob", - "regex", - "regexp", - "regular", - "expression", - "function" - ], - "scripts": { - "test": "nyc mocha", - "mocha": "mocha" - }, - "devDependencies": { - "mocha": "^6.1.3", - "nyc": "^14.0.0" - }, - "engines": { - "node": ">= 8" - } -} diff --git a/server/node_modules/binary-extensions/binary-extensions.json b/server/node_modules/binary-extensions/binary-extensions.json deleted file mode 100644 index 4aab383..0000000 --- a/server/node_modules/binary-extensions/binary-extensions.json +++ /dev/null @@ -1,260 +0,0 @@ -[ - "3dm", - "3ds", - "3g2", - "3gp", - "7z", - "a", - "aac", - "adp", - "ai", - "aif", - "aiff", - "alz", - "ape", - "apk", - "appimage", - "ar", - "arj", - "asf", - "au", - "avi", - "bak", - "baml", - "bh", - "bin", - "bk", - "bmp", - "btif", - "bz2", - "bzip2", - "cab", - "caf", - "cgm", - "class", - "cmx", - "cpio", - "cr2", - "cur", - "dat", - "dcm", - "deb", - "dex", - "djvu", - "dll", - "dmg", - "dng", - "doc", - "docm", - "docx", - "dot", - "dotm", - "dra", - "DS_Store", - "dsk", - "dts", - "dtshd", - "dvb", - "dwg", - "dxf", - "ecelp4800", - "ecelp7470", - "ecelp9600", - "egg", - "eol", - "eot", - "epub", - "exe", - "f4v", - "fbs", - "fh", - "fla", - "flac", - "flatpak", - "fli", - "flv", - "fpx", - "fst", - "fvt", - "g3", - "gh", - "gif", - "graffle", - "gz", - "gzip", - "h261", - "h263", - "h264", - "icns", - "ico", - "ief", - "img", - "ipa", - "iso", - "jar", - "jpeg", - "jpg", - "jpgv", - "jpm", - "jxr", - "key", - "ktx", - "lha", - "lib", - "lvp", - "lz", - "lzh", - "lzma", - "lzo", - "m3u", - "m4a", - "m4v", - "mar", - "mdi", - "mht", - "mid", - "midi", - "mj2", - "mka", - "mkv", - "mmr", - "mng", - "mobi", - "mov", - "movie", - "mp3", - "mp4", - "mp4a", - "mpeg", - "mpg", - "mpga", - "mxu", - "nef", - "npx", - "numbers", - "nupkg", - "o", - "odp", - "ods", - "odt", - "oga", - "ogg", - "ogv", - "otf", - "ott", - "pages", - "pbm", - "pcx", - "pdb", - "pdf", - "pea", - "pgm", - "pic", - "png", - "pnm", - "pot", - "potm", - "potx", - "ppa", - "ppam", - "ppm", - "pps", - "ppsm", - "ppsx", - "ppt", - "pptm", - "pptx", - "psd", - "pya", - "pyc", - "pyo", - "pyv", - "qt", - "rar", - "ras", - "raw", - "resources", - "rgb", - "rip", - "rlc", - "rmf", - "rmvb", - "rpm", - "rtf", - "rz", - "s3m", - "s7z", - "scpt", - "sgi", - "shar", - "snap", - "sil", - "sketch", - "slk", - "smv", - "snk", - "so", - "stl", - "suo", - "sub", - "swf", - "tar", - "tbz", - "tbz2", - "tga", - "tgz", - "thmx", - "tif", - "tiff", - "tlz", - "ttc", - "ttf", - "txz", - "udf", - "uvh", - "uvi", - "uvm", - "uvp", - "uvs", - "uvu", - "viv", - "vob", - "war", - "wav", - "wax", - "wbmp", - "wdp", - "weba", - "webm", - "webp", - "whl", - "wim", - "wm", - "wma", - "wmv", - "wmx", - "woff", - "woff2", - "wrm", - "wvx", - "xbm", - "xif", - "xla", - "xlam", - "xls", - "xlsb", - "xlsm", - "xlsx", - "xlt", - "xltm", - "xltx", - "xm", - "xmind", - "xpi", - "xpm", - "xwd", - "xz", - "z", - "zip", - "zipx" -] diff --git a/server/node_modules/binary-extensions/index.js b/server/node_modules/binary-extensions/index.js deleted file mode 100644 index d46e468..0000000 --- a/server/node_modules/binary-extensions/index.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./binary-extensions.json'); diff --git a/server/node_modules/binary-extensions/license b/server/node_modules/binary-extensions/license deleted file mode 100644 index 401b1c7..0000000 --- a/server/node_modules/binary-extensions/license +++ /dev/null @@ -1,9 +0,0 @@ -MIT License - -Copyright (c) 2019 Sindre Sorhus (https://sindresorhus.com), Paul Miller (https://paulmillr.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/server/node_modules/binary-extensions/package.json b/server/node_modules/binary-extensions/package.json deleted file mode 100644 index c4d3641..0000000 --- a/server/node_modules/binary-extensions/package.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "name": "binary-extensions", - "version": "2.2.0", - "description": "List of binary file extensions", - "license": "MIT", - "repository": "sindresorhus/binary-extensions", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "engines": { - "node": ">=8" - }, - "scripts": { - "test": "xo && ava && tsd" - }, - "files": [ - "index.js", - "index.d.ts", - "binary-extensions.json", - "binary-extensions.json.d.ts" - ], - "keywords": [ - "binary", - "extensions", - "extension", - "file", - "json", - "list", - "array" - ], - "devDependencies": { - "ava": "^1.4.1", - "tsd": "^0.7.2", - "xo": "^0.24.0" - } -} diff --git a/server/node_modules/binary-extensions/readme.md b/server/node_modules/binary-extensions/readme.md deleted file mode 100644 index 3e25dd8..0000000 --- a/server/node_modules/binary-extensions/readme.md +++ /dev/null @@ -1,41 +0,0 @@ -# binary-extensions - -> List of binary file extensions - -The list is just a [JSON file](binary-extensions.json) and can be used anywhere. - - -## Install - -``` -$ npm install binary-extensions -``` - - -## Usage - -```js -const binaryExtensions = require('binary-extensions'); - -console.log(binaryExtensions); -//=> ['3ds', '3g2', …] -``` - - -## Related - -- [is-binary-path](https://github.com/sindresorhus/is-binary-path) - Check if a filepath is a binary file -- [text-extensions](https://github.com/sindresorhus/text-extensions) - List of text file extensions - - ---- - -
- - Get professional support for this package with a Tidelift subscription - -
- - Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies. -
-
diff --git a/server/node_modules/braces/CHANGELOG.md b/server/node_modules/braces/CHANGELOG.md deleted file mode 100644 index 36f798b..0000000 --- a/server/node_modules/braces/CHANGELOG.md +++ /dev/null @@ -1,184 +0,0 @@ -# Release history - -All notable changes to this project will be documented in this file. - -The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) -and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). - -
- Guiding Principles - -- Changelogs are for humans, not machines. -- There should be an entry for every single version. -- The same types of changes should be grouped. -- Versions and sections should be linkable. -- The latest version comes first. -- The release date of each versions is displayed. -- Mention whether you follow Semantic Versioning. - -
- -
- Types of changes - -Changelog entries are classified using the following labels _(from [keep-a-changelog](http://keepachangelog.com/)_): - -- `Added` for new features. -- `Changed` for changes in existing functionality. -- `Deprecated` for soon-to-be removed features. -- `Removed` for now removed features. -- `Fixed` for any bug fixes. -- `Security` in case of vulnerabilities. - -
- -## [3.0.0] - 2018-04-08 - -v3.0 is a complete refactor, resulting in a faster, smaller codebase, with fewer deps, and a more accurate parser and compiler. - -**Breaking Changes** - -- The undocumented `.makeRe` method was removed - -**Non-breaking changes** - -- Caching was removed - -## [2.3.2] - 2018-04-08 - -- start refactoring -- cover sets -- better range handling - -## [2.3.1] - 2018-02-17 - -- Remove unnecessary escape in Regex. (#14) - -## [2.3.0] - 2017-10-19 - -- minor code reorganization -- optimize regex -- expose `maxLength` option - -## [2.2.1] - 2017-05-30 - -- don't condense when braces contain extglobs - -## [2.2.0] - 2017-05-28 - -- ensure word boundaries are preserved -- fixes edge case where extglob characters precede a brace pattern - -## [2.1.1] - 2017-04-27 - -- use snapdragon-node -- handle edge case -- optimizations, lint - -## [2.0.4] - 2017-04-11 - -- pass opts to compiler -- minor optimization in create method -- re-write parser handlers to remove negation regex - -## [2.0.3] - 2016-12-10 - -- use split-string -- clear queue at the end -- adds sequences example -- add unit tests - -## [2.0.2] - 2016-10-21 - -- fix comma handling in nested extglobs - -## [2.0.1] - 2016-10-20 - -- add comments -- more tests, ensure quotes are stripped - -## [2.0.0] - 2016-10-19 - -- don't expand braces inside character classes -- add quantifier pattern - -## [1.8.5] - 2016-05-21 - -- Refactor (#10) - -## [1.8.4] - 2016-04-20 - -- fixes https://github.com/jonschlinkert/micromatch/issues/66 - -## [1.8.0] - 2015-03-18 - -- adds exponent examples, tests -- fixes the first example in https://github.com/jonschlinkert/micromatch/issues/38 - -## [1.6.0] - 2015-01-30 - -- optimizations, `bash` mode: -- improve path escaping - -## [1.5.0] - 2015-01-28 - -- Merge pull request #5 from eush77/lib-files - -## [1.4.0] - 2015-01-24 - -- add extglob tests -- externalize exponent function -- better whitespace handling - -## [1.3.0] - 2015-01-24 - -- make regex patterns explicity - -## [1.1.0] - 2015-01-11 - -- don't create a match group with `makeRe` - -## [1.0.0] - 2014-12-23 - -- Merge commit '97b05f5544f8348736a8efaecf5c32bbe3e2ad6e' -- support empty brace syntax -- better bash coverage -- better support for regex strings - -## [0.1.4] - 2014-11-14 - -- improve recognition of bad args, recognize mismatched argument types -- support escaping -- remove pathname-expansion -- support whitespace in patterns - -## [0.1.0] - -- first commit - -[2.3.2]: https://github.com/micromatch/braces/compare/2.3.1...2.3.2 -[2.3.1]: https://github.com/micromatch/braces/compare/2.3.0...2.3.1 -[2.3.0]: https://github.com/micromatch/braces/compare/2.2.1...2.3.0 -[2.2.1]: https://github.com/micromatch/braces/compare/2.2.0...2.2.1 -[2.2.0]: https://github.com/micromatch/braces/compare/2.1.1...2.2.0 -[2.1.1]: https://github.com/micromatch/braces/compare/2.1.0...2.1.1 -[2.1.0]: https://github.com/micromatch/braces/compare/2.0.4...2.1.0 -[2.0.4]: https://github.com/micromatch/braces/compare/2.0.3...2.0.4 -[2.0.3]: https://github.com/micromatch/braces/compare/2.0.2...2.0.3 -[2.0.2]: https://github.com/micromatch/braces/compare/2.0.1...2.0.2 -[2.0.1]: https://github.com/micromatch/braces/compare/2.0.0...2.0.1 -[2.0.0]: https://github.com/micromatch/braces/compare/1.8.5...2.0.0 -[1.8.5]: https://github.com/micromatch/braces/compare/1.8.4...1.8.5 -[1.8.4]: https://github.com/micromatch/braces/compare/1.8.0...1.8.4 -[1.8.0]: https://github.com/micromatch/braces/compare/1.6.0...1.8.0 -[1.6.0]: https://github.com/micromatch/braces/compare/1.5.0...1.6.0 -[1.5.0]: https://github.com/micromatch/braces/compare/1.4.0...1.5.0 -[1.4.0]: https://github.com/micromatch/braces/compare/1.3.0...1.4.0 -[1.3.0]: https://github.com/micromatch/braces/compare/1.2.0...1.3.0 -[1.2.0]: https://github.com/micromatch/braces/compare/1.1.0...1.2.0 -[1.1.0]: https://github.com/micromatch/braces/compare/1.0.0...1.1.0 -[1.0.0]: https://github.com/micromatch/braces/compare/0.1.4...1.0.0 -[0.1.4]: https://github.com/micromatch/braces/compare/0.1.0...0.1.4 - -[Unreleased]: https://github.com/micromatch/braces/compare/0.1.0...HEAD -[keep-a-changelog]: https://github.com/olivierlacan/keep-a-changelog \ No newline at end of file diff --git a/server/node_modules/braces/LICENSE b/server/node_modules/braces/LICENSE deleted file mode 100644 index d32ab44..0000000 --- a/server/node_modules/braces/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014-2018, Jon Schlinkert. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/server/node_modules/braces/README.md b/server/node_modules/braces/README.md deleted file mode 100644 index cba2f60..0000000 --- a/server/node_modules/braces/README.md +++ /dev/null @@ -1,593 +0,0 @@ -# braces [![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=W8YFZ425KND68) [![NPM version](https://img.shields.io/npm/v/braces.svg?style=flat)](https://www.npmjs.com/package/braces) [![NPM monthly downloads](https://img.shields.io/npm/dm/braces.svg?style=flat)](https://npmjs.org/package/braces) [![NPM total downloads](https://img.shields.io/npm/dt/braces.svg?style=flat)](https://npmjs.org/package/braces) [![Linux Build Status](https://img.shields.io/travis/micromatch/braces.svg?style=flat&label=Travis)](https://travis-ci.org/micromatch/braces) - -> Bash-like brace expansion, implemented in JavaScript. Safer than other brace expansion libs, with complete support for the Bash 4.3 braces specification, without sacrificing speed. - -Please consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support. - -## Install - -Install with [npm](https://www.npmjs.com/): - -```sh -$ npm install --save braces -``` - -## v3.0.0 Released!! - -See the [changelog](CHANGELOG.md) for details. - -## Why use braces? - -Brace patterns make globs more powerful by adding the ability to match specific ranges and sequences of characters. - -* **Accurate** - complete support for the [Bash 4.3 Brace Expansion](www.gnu.org/software/bash/) specification (passes all of the Bash braces tests) -* **[fast and performant](#benchmarks)** - Starts fast, runs fast and [scales well](#performance) as patterns increase in complexity. -* **Organized code base** - The parser and compiler are easy to maintain and update when edge cases crop up. -* **Well-tested** - Thousands of test assertions, and passes all of the Bash, minimatch, and [brace-expansion](https://github.com/juliangruber/brace-expansion) unit tests (as of the date this was written). -* **Safer** - You shouldn't have to worry about users defining aggressive or malicious brace patterns that can break your application. Braces takes measures to prevent malicious regex that can be used for DDoS attacks (see [catastrophic backtracking](https://www.regular-expressions.info/catastrophic.html)). -* [Supports lists](#lists) - (aka "sets") `a/{b,c}/d` => `['a/b/d', 'a/c/d']` -* [Supports sequences](#sequences) - (aka "ranges") `{01..03}` => `['01', '02', '03']` -* [Supports steps](#steps) - (aka "increments") `{2..10..2}` => `['2', '4', '6', '8', '10']` -* [Supports escaping](#escaping) - To prevent evaluation of special characters. - -## Usage - -The main export is a function that takes one or more brace `patterns` and `options`. - -```js -const braces = require('braces'); -// braces(patterns[, options]); - -console.log(braces(['{01..05}', '{a..e}'])); -//=> ['(0[1-5])', '([a-e])'] - -console.log(braces(['{01..05}', '{a..e}'], { expand: true })); -//=> ['01', '02', '03', '04', '05', 'a', 'b', 'c', 'd', 'e'] -``` - -### Brace Expansion vs. Compilation - -By default, brace patterns are compiled into strings that are optimized for creating regular expressions and matching. - -**Compiled** - -```js -console.log(braces('a/{x,y,z}/b')); -//=> ['a/(x|y|z)/b'] -console.log(braces(['a/{01..20}/b', 'a/{1..5}/b'])); -//=> [ 'a/(0[1-9]|1[0-9]|20)/b', 'a/([1-5])/b' ] -``` - -**Expanded** - -Enable brace expansion by setting the `expand` option to true, or by using [braces.expand()](#expand) (returns an array similar to what you'd expect from Bash, or `echo {1..5}`, or [minimatch](https://github.com/isaacs/minimatch)): - -```js -console.log(braces('a/{x,y,z}/b', { expand: true })); -//=> ['a/x/b', 'a/y/b', 'a/z/b'] - -console.log(braces.expand('{01..10}')); -//=> ['01','02','03','04','05','06','07','08','09','10'] -``` - -### Lists - -Expand lists (like Bash "sets"): - -```js -console.log(braces('a/{foo,bar,baz}/*.js')); -//=> ['a/(foo|bar|baz)/*.js'] - -console.log(braces.expand('a/{foo,bar,baz}/*.js')); -//=> ['a/foo/*.js', 'a/bar/*.js', 'a/baz/*.js'] -``` - -### Sequences - -Expand ranges of characters (like Bash "sequences"): - -```js -console.log(braces.expand('{1..3}')); // ['1', '2', '3'] -console.log(braces.expand('a/{1..3}/b')); // ['a/1/b', 'a/2/b', 'a/3/b'] -console.log(braces('{a..c}', { expand: true })); // ['a', 'b', 'c'] -console.log(braces('foo/{a..c}', { expand: true })); // ['foo/a', 'foo/b', 'foo/c'] - -// supports zero-padded ranges -console.log(braces('a/{01..03}/b')); //=> ['a/(0[1-3])/b'] -console.log(braces('a/{001..300}/b')); //=> ['a/(0{2}[1-9]|0[1-9][0-9]|[12][0-9]{2}|300)/b'] -``` - -See [fill-range](https://github.com/jonschlinkert/fill-range) for all available range-expansion options. - -### Steppped ranges - -Steps, or increments, may be used with ranges: - -```js -console.log(braces.expand('{2..10..2}')); -//=> ['2', '4', '6', '8', '10'] - -console.log(braces('{2..10..2}')); -//=> ['(2|4|6|8|10)'] -``` - -When the [.optimize](#optimize) method is used, or [options.optimize](#optionsoptimize) is set to true, sequences are passed to [to-regex-range](https://github.com/jonschlinkert/to-regex-range) for expansion. - -### Nesting - -Brace patterns may be nested. The results of each expanded string are not sorted, and left to right order is preserved. - -**"Expanded" braces** - -```js -console.log(braces.expand('a{b,c,/{x,y}}/e')); -//=> ['ab/e', 'ac/e', 'a/x/e', 'a/y/e'] - -console.log(braces.expand('a/{x,{1..5},y}/c')); -//=> ['a/x/c', 'a/1/c', 'a/2/c', 'a/3/c', 'a/4/c', 'a/5/c', 'a/y/c'] -``` - -**"Optimized" braces** - -```js -console.log(braces('a{b,c,/{x,y}}/e')); -//=> ['a(b|c|/(x|y))/e'] - -console.log(braces('a/{x,{1..5},y}/c')); -//=> ['a/(x|([1-5])|y)/c'] -``` - -### Escaping - -**Escaping braces** - -A brace pattern will not be expanded or evaluted if _either the opening or closing brace is escaped_: - -```js -console.log(braces.expand('a\\{d,c,b}e')); -//=> ['a{d,c,b}e'] - -console.log(braces.expand('a{d,c,b\\}e')); -//=> ['a{d,c,b}e'] -``` - -**Escaping commas** - -Commas inside braces may also be escaped: - -```js -console.log(braces.expand('a{b\\,c}d')); -//=> ['a{b,c}d'] - -console.log(braces.expand('a{d\\,c,b}e')); -//=> ['ad,ce', 'abe'] -``` - -**Single items** - -Following bash conventions, a brace pattern is also not expanded when it contains a single character: - -```js -console.log(braces.expand('a{b}c')); -//=> ['a{b}c'] -``` - -## Options - -### options.maxLength - -**Type**: `Number` - -**Default**: `65,536` - -**Description**: Limit the length of the input string. Useful when the input string is generated or your application allows users to pass a string, et cetera. - -```js -console.log(braces('a/{b,c}/d', { maxLength: 3 })); //=> throws an error -``` - -### options.expand - -**Type**: `Boolean` - -**Default**: `undefined` - -**Description**: Generate an "expanded" brace pattern (alternatively you can use the `braces.expand()` method, which does the same thing). - -```js -console.log(braces('a/{b,c}/d', { expand: true })); -//=> [ 'a/b/d', 'a/c/d' ] -``` - -### options.nodupes - -**Type**: `Boolean` - -**Default**: `undefined` - -**Description**: Remove duplicates from the returned array. - -### options.rangeLimit - -**Type**: `Number` - -**Default**: `1000` - -**Description**: To prevent malicious patterns from being passed by users, an error is thrown when `braces.expand()` is used or `options.expand` is true and the generated range will exceed the `rangeLimit`. - -You can customize `options.rangeLimit` or set it to `Inifinity` to disable this altogether. - -**Examples** - -```js -// pattern exceeds the "rangeLimit", so it's optimized automatically -console.log(braces.expand('{1..1000}')); -//=> ['([1-9]|[1-9][0-9]{1,2}|1000)'] - -// pattern does not exceed "rangeLimit", so it's NOT optimized -console.log(braces.expand('{1..100}')); -//=> ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31', '32', '33', '34', '35', '36', '37', '38', '39', '40', '41', '42', '43', '44', '45', '46', '47', '48', '49', '50', '51', '52', '53', '54', '55', '56', '57', '58', '59', '60', '61', '62', '63', '64', '65', '66', '67', '68', '69', '70', '71', '72', '73', '74', '75', '76', '77', '78', '79', '80', '81', '82', '83', '84', '85', '86', '87', '88', '89', '90', '91', '92', '93', '94', '95', '96', '97', '98', '99', '100'] -``` - -### options.transform - -**Type**: `Function` - -**Default**: `undefined` - -**Description**: Customize range expansion. - -**Example: Transforming non-numeric values** - -```js -const alpha = braces.expand('x/{a..e}/y', { - transform(value, index) { - // When non-numeric values are passed, "value" is a character code. - return 'foo/' + String.fromCharCode(value) + '-' + index; - } -}); -console.log(alpha); -//=> [ 'x/foo/a-0/y', 'x/foo/b-1/y', 'x/foo/c-2/y', 'x/foo/d-3/y', 'x/foo/e-4/y' ] -``` - -**Example: Transforming numeric values** - -```js -const numeric = braces.expand('{1..5}', { - transform(value) { - // when numeric values are passed, "value" is a number - return 'foo/' + value * 2; - } -}); -console.log(numeric); -//=> [ 'foo/2', 'foo/4', 'foo/6', 'foo/8', 'foo/10' ] -``` - -### options.quantifiers - -**Type**: `Boolean` - -**Default**: `undefined` - -**Description**: In regular expressions, quanitifiers can be used to specify how many times a token can be repeated. For example, `a{1,3}` will match the letter `a` one to three times. - -Unfortunately, regex quantifiers happen to share the same syntax as [Bash lists](#lists) - -The `quantifiers` option tells braces to detect when [regex quantifiers](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp#quantifiers) are defined in the given pattern, and not to try to expand them as lists. - -**Examples** - -```js -const braces = require('braces'); -console.log(braces('a/b{1,3}/{x,y,z}')); -//=> [ 'a/b(1|3)/(x|y|z)' ] -console.log(braces('a/b{1,3}/{x,y,z}', {quantifiers: true})); -//=> [ 'a/b{1,3}/(x|y|z)' ] -console.log(braces('a/b{1,3}/{x,y,z}', {quantifiers: true, expand: true})); -//=> [ 'a/b{1,3}/x', 'a/b{1,3}/y', 'a/b{1,3}/z' ] -``` - -### options.unescape - -**Type**: `Boolean` - -**Default**: `undefined` - -**Description**: Strip backslashes that were used for escaping from the result. - -## What is "brace expansion"? - -Brace expansion is a type of parameter expansion that was made popular by unix shells for generating lists of strings, as well as regex-like matching when used alongside wildcards (globs). - -In addition to "expansion", braces are also used for matching. In other words: - -* [brace expansion](#brace-expansion) is for generating new lists -* [brace matching](#brace-matching) is for filtering existing lists - -
-More about brace expansion (click to expand) - -There are two main types of brace expansion: - -1. **lists**: which are defined using comma-separated values inside curly braces: `{a,b,c}` -2. **sequences**: which are defined using a starting value and an ending value, separated by two dots: `a{1..3}b`. Optionally, a third argument may be passed to define a "step" or increment to use: `a{1..100..10}b`. These are also sometimes referred to as "ranges". - -Here are some example brace patterns to illustrate how they work: - -**Sets** - -``` -{a,b,c} => a b c -{a,b,c}{1,2} => a1 a2 b1 b2 c1 c2 -``` - -**Sequences** - -``` -{1..9} => 1 2 3 4 5 6 7 8 9 -{4..-4} => 4 3 2 1 0 -1 -2 -3 -4 -{1..20..3} => 1 4 7 10 13 16 19 -{a..j} => a b c d e f g h i j -{j..a} => j i h g f e d c b a -{a..z..3} => a d g j m p s v y -``` - -**Combination** - -Sets and sequences can be mixed together or used along with any other strings. - -``` -{a,b,c}{1..3} => a1 a2 a3 b1 b2 b3 c1 c2 c3 -foo/{a,b,c}/bar => foo/a/bar foo/b/bar foo/c/bar -``` - -The fact that braces can be "expanded" from relatively simple patterns makes them ideal for quickly generating test fixtures, file paths, and similar use cases. - -## Brace matching - -In addition to _expansion_, brace patterns are also useful for performing regular-expression-like matching. - -For example, the pattern `foo/{1..3}/bar` would match any of following strings: - -``` -foo/1/bar -foo/2/bar -foo/3/bar -``` - -But not: - -``` -baz/1/qux -baz/2/qux -baz/3/qux -``` - -Braces can also be combined with [glob patterns](https://github.com/jonschlinkert/micromatch) to perform more advanced wildcard matching. For example, the pattern `*/{1..3}/*` would match any of following strings: - -``` -foo/1/bar -foo/2/bar -foo/3/bar -baz/1/qux -baz/2/qux -baz/3/qux -``` - -## Brace matching pitfalls - -Although brace patterns offer a user-friendly way of matching ranges or sets of strings, there are also some major disadvantages and potential risks you should be aware of. - -### tldr - -**"brace bombs"** - -* brace expansion can eat up a huge amount of processing resources -* as brace patterns increase _linearly in size_, the system resources required to expand the pattern increase exponentially -* users can accidentally (or intentially) exhaust your system's resources resulting in the equivalent of a DoS attack (bonus: no programming knowledge is required!) - -For a more detailed explanation with examples, see the [geometric complexity](#geometric-complexity) section. - -### The solution - -Jump to the [performance section](#performance) to see how Braces solves this problem in comparison to other libraries. - -### Geometric complexity - -At minimum, brace patterns with sets limited to two elements have quadradic or `O(n^2)` complexity. But the complexity of the algorithm increases exponentially as the number of sets, _and elements per set_, increases, which is `O(n^c)`. - -For example, the following sets demonstrate quadratic (`O(n^2)`) complexity: - -``` -{1,2}{3,4} => (2X2) => 13 14 23 24 -{1,2}{3,4}{5,6} => (2X2X2) => 135 136 145 146 235 236 245 246 -``` - -But add an element to a set, and we get a n-fold Cartesian product with `O(n^c)` complexity: - -``` -{1,2,3}{4,5,6}{7,8,9} => (3X3X3) => 147 148 149 157 158 159 167 168 169 247 248 - 249 257 258 259 267 268 269 347 348 349 357 - 358 359 367 368 369 -``` - -Now, imagine how this complexity grows given that each element is a n-tuple: - -``` -{1..100}{1..100} => (100X100) => 10,000 elements (38.4 kB) -{1..100}{1..100}{1..100} => (100X100X100) => 1,000,000 elements (5.76 MB) -``` - -Although these examples are clearly contrived, they demonstrate how brace patterns can quickly grow out of control. - -**More information** - -Interested in learning more about brace expansion? - -* [linuxjournal/bash-brace-expansion](http://www.linuxjournal.com/content/bash-brace-expansion) -* [rosettacode/Brace_expansion](https://rosettacode.org/wiki/Brace_expansion) -* [cartesian product](https://en.wikipedia.org/wiki/Cartesian_product) - -
- -## Performance - -Braces is not only screaming fast, it's also more accurate the other brace expansion libraries. - -### Better algorithms - -Fortunately there is a solution to the ["brace bomb" problem](#brace-matching-pitfalls): _don't expand brace patterns into an array when they're used for matching_. - -Instead, convert the pattern into an optimized regular expression. This is easier said than done, and braces is the only library that does this currently. - -**The proof is in the numbers** - -Minimatch gets exponentially slower as patterns increase in complexity, braces does not. The following results were generated using `braces()` and `minimatch.braceExpand()`, respectively. - -| **Pattern** | **braces** | **[minimatch][]** | -| --- | --- | --- | -| `{1..9007199254740991}`[^1] | `298 B` (5ms 459μs)| N/A (freezes) | -| `{1..1000000000000000}` | `41 B` (1ms 15μs) | N/A (freezes) | -| `{1..100000000000000}` | `40 B` (890μs) | N/A (freezes) | -| `{1..10000000000000}` | `39 B` (2ms 49μs) | N/A (freezes) | -| `{1..1000000000000}` | `38 B` (608μs) | N/A (freezes) | -| `{1..100000000000}` | `37 B` (397μs) | N/A (freezes) | -| `{1..10000000000}` | `35 B` (983μs) | N/A (freezes) | -| `{1..1000000000}` | `34 B` (798μs) | N/A (freezes) | -| `{1..100000000}` | `33 B` (733μs) | N/A (freezes) | -| `{1..10000000}` | `32 B` (5ms 632μs) | `78.89 MB` (16s 388ms 569μs) | -| `{1..1000000}` | `31 B` (1ms 381μs) | `6.89 MB` (1s 496ms 887μs) | -| `{1..100000}` | `30 B` (950μs) | `588.89 kB` (146ms 921μs) | -| `{1..10000}` | `29 B` (1ms 114μs) | `48.89 kB` (14ms 187μs) | -| `{1..1000}` | `28 B` (760μs) | `3.89 kB` (1ms 453μs) | -| `{1..100}` | `22 B` (345μs) | `291 B` (196μs) | -| `{1..10}` | `10 B` (533μs) | `20 B` (37μs) | -| `{1..3}` | `7 B` (190μs) | `5 B` (27μs) | - -### Faster algorithms - -When you need expansion, braces is still much faster. - -_(the following results were generated using `braces.expand()` and `minimatch.braceExpand()`, respectively)_ - -| **Pattern** | **braces** | **[minimatch][]** | -| --- | --- | --- | -| `{1..10000000}` | `78.89 MB` (2s 698ms 642μs) | `78.89 MB` (18s 601ms 974μs) | -| `{1..1000000}` | `6.89 MB` (458ms 576μs) | `6.89 MB` (1s 491ms 621μs) | -| `{1..100000}` | `588.89 kB` (20ms 728μs) | `588.89 kB` (156ms 919μs) | -| `{1..10000}` | `48.89 kB` (2ms 202μs) | `48.89 kB` (13ms 641μs) | -| `{1..1000}` | `3.89 kB` (1ms 796μs) | `3.89 kB` (1ms 958μs) | -| `{1..100}` | `291 B` (424μs) | `291 B` (211μs) | -| `{1..10}` | `20 B` (487μs) | `20 B` (72μs) | -| `{1..3}` | `5 B` (166μs) | `5 B` (27μs) | - -If you'd like to run these comparisons yourself, see [test/support/generate.js](test/support/generate.js). - -## Benchmarks - -### Running benchmarks - -Install dev dependencies: - -```bash -npm i -d && npm benchmark -``` - -### Latest results - -Braces is more accurate, without sacrificing performance. - -```bash -# range (expanded) - braces x 29,040 ops/sec ±3.69% (91 runs sampled)) - minimatch x 4,735 ops/sec ±1.28% (90 runs sampled) - -# range (optimized for regex) - braces x 382,878 ops/sec ±0.56% (94 runs sampled) - minimatch x 1,040 ops/sec ±0.44% (93 runs sampled) - -# nested ranges (expanded) - braces x 19,744 ops/sec ±2.27% (92 runs sampled)) - minimatch x 4,579 ops/sec ±0.50% (93 runs sampled) - -# nested ranges (optimized for regex) - braces x 246,019 ops/sec ±2.02% (93 runs sampled) - minimatch x 1,028 ops/sec ±0.39% (94 runs sampled) - -# set (expanded) - braces x 138,641 ops/sec ±0.53% (95 runs sampled) - minimatch x 219,582 ops/sec ±0.98% (94 runs sampled) - -# set (optimized for regex) - braces x 388,408 ops/sec ±0.41% (95 runs sampled) - minimatch x 44,724 ops/sec ±0.91% (89 runs sampled) - -# nested sets (expanded) - braces x 84,966 ops/sec ±0.48% (94 runs sampled) - minimatch x 140,720 ops/sec ±0.37% (95 runs sampled) - -# nested sets (optimized for regex) - braces x 263,340 ops/sec ±2.06% (92 runs sampled) - minimatch x 28,714 ops/sec ±0.40% (90 runs sampled) -``` - -## About - -
-Contributing - -Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). - -
- -
-Running Tests - -Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command: - -```sh -$ npm install && npm test -``` - -
- -
-Building docs - -_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_ - -To generate the readme, run the following command: - -```sh -$ npm install -g verbose/verb#dev verb-generate-readme && verb -``` - -
- -### Contributors - -| **Commits** | **Contributor** | -| --- | --- | -| 197 | [jonschlinkert](https://github.com/jonschlinkert) | -| 4 | [doowb](https://github.com/doowb) | -| 1 | [es128](https://github.com/es128) | -| 1 | [eush77](https://github.com/eush77) | -| 1 | [hemanth](https://github.com/hemanth) | -| 1 | [wtgtybhertgeghgtwtg](https://github.com/wtgtybhertgeghgtwtg) | - -### Author - -**Jon Schlinkert** - -* [GitHub Profile](https://github.com/jonschlinkert) -* [Twitter Profile](https://twitter.com/jonschlinkert) -* [LinkedIn Profile](https://linkedin.com/in/jonschlinkert) - -### License - -Copyright © 2019, [Jon Schlinkert](https://github.com/jonschlinkert). -Released under the [MIT License](LICENSE). - -*** - -_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.8.0, on April 08, 2019._ \ No newline at end of file diff --git a/server/node_modules/braces/index.js b/server/node_modules/braces/index.js deleted file mode 100644 index 0eee0f5..0000000 --- a/server/node_modules/braces/index.js +++ /dev/null @@ -1,170 +0,0 @@ -'use strict'; - -const stringify = require('./lib/stringify'); -const compile = require('./lib/compile'); -const expand = require('./lib/expand'); -const parse = require('./lib/parse'); - -/** - * Expand the given pattern or create a regex-compatible string. - * - * ```js - * const braces = require('braces'); - * console.log(braces('{a,b,c}', { compile: true })); //=> ['(a|b|c)'] - * console.log(braces('{a,b,c}')); //=> ['a', 'b', 'c'] - * ``` - * @param {String} `str` - * @param {Object} `options` - * @return {String} - * @api public - */ - -const braces = (input, options = {}) => { - let output = []; - - if (Array.isArray(input)) { - for (let pattern of input) { - let result = braces.create(pattern, options); - if (Array.isArray(result)) { - output.push(...result); - } else { - output.push(result); - } - } - } else { - output = [].concat(braces.create(input, options)); - } - - if (options && options.expand === true && options.nodupes === true) { - output = [...new Set(output)]; - } - return output; -}; - -/** - * Parse the given `str` with the given `options`. - * - * ```js - * // braces.parse(pattern, [, options]); - * const ast = braces.parse('a/{b,c}/d'); - * console.log(ast); - * ``` - * @param {String} pattern Brace pattern to parse - * @param {Object} options - * @return {Object} Returns an AST - * @api public - */ - -braces.parse = (input, options = {}) => parse(input, options); - -/** - * Creates a braces string from an AST, or an AST node. - * - * ```js - * const braces = require('braces'); - * let ast = braces.parse('foo/{a,b}/bar'); - * console.log(stringify(ast.nodes[2])); //=> '{a,b}' - * ``` - * @param {String} `input` Brace pattern or AST. - * @param {Object} `options` - * @return {Array} Returns an array of expanded values. - * @api public - */ - -braces.stringify = (input, options = {}) => { - if (typeof input === 'string') { - return stringify(braces.parse(input, options), options); - } - return stringify(input, options); -}; - -/** - * Compiles a brace pattern into a regex-compatible, optimized string. - * This method is called by the main [braces](#braces) function by default. - * - * ```js - * const braces = require('braces'); - * console.log(braces.compile('a/{b,c}/d')); - * //=> ['a/(b|c)/d'] - * ``` - * @param {String} `input` Brace pattern or AST. - * @param {Object} `options` - * @return {Array} Returns an array of expanded values. - * @api public - */ - -braces.compile = (input, options = {}) => { - if (typeof input === 'string') { - input = braces.parse(input, options); - } - return compile(input, options); -}; - -/** - * Expands a brace pattern into an array. This method is called by the - * main [braces](#braces) function when `options.expand` is true. Before - * using this method it's recommended that you read the [performance notes](#performance)) - * and advantages of using [.compile](#compile) instead. - * - * ```js - * const braces = require('braces'); - * console.log(braces.expand('a/{b,c}/d')); - * //=> ['a/b/d', 'a/c/d']; - * ``` - * @param {String} `pattern` Brace pattern - * @param {Object} `options` - * @return {Array} Returns an array of expanded values. - * @api public - */ - -braces.expand = (input, options = {}) => { - if (typeof input === 'string') { - input = braces.parse(input, options); - } - - let result = expand(input, options); - - // filter out empty strings if specified - if (options.noempty === true) { - result = result.filter(Boolean); - } - - // filter out duplicates if specified - if (options.nodupes === true) { - result = [...new Set(result)]; - } - - return result; -}; - -/** - * Processes a brace pattern and returns either an expanded array - * (if `options.expand` is true), a highly optimized regex-compatible string. - * This method is called by the main [braces](#braces) function. - * - * ```js - * const braces = require('braces'); - * console.log(braces.create('user-{200..300}/project-{a,b,c}-{1..10}')) - * //=> 'user-(20[0-9]|2[1-9][0-9]|300)/project-(a|b|c)-([1-9]|10)' - * ``` - * @param {String} `pattern` Brace pattern - * @param {Object} `options` - * @return {Array} Returns an array of expanded values. - * @api public - */ - -braces.create = (input, options = {}) => { - if (input === '' || input.length < 3) { - return [input]; - } - - return options.expand !== true - ? braces.compile(input, options) - : braces.expand(input, options); -}; - -/** - * Expose "braces" - */ - -module.exports = braces; diff --git a/server/node_modules/braces/lib/compile.js b/server/node_modules/braces/lib/compile.js deleted file mode 100644 index 3e984a4..0000000 --- a/server/node_modules/braces/lib/compile.js +++ /dev/null @@ -1,57 +0,0 @@ -'use strict'; - -const fill = require('fill-range'); -const utils = require('./utils'); - -const compile = (ast, options = {}) => { - let walk = (node, parent = {}) => { - let invalidBlock = utils.isInvalidBrace(parent); - let invalidNode = node.invalid === true && options.escapeInvalid === true; - let invalid = invalidBlock === true || invalidNode === true; - let prefix = options.escapeInvalid === true ? '\\' : ''; - let output = ''; - - if (node.isOpen === true) { - return prefix + node.value; - } - if (node.isClose === true) { - return prefix + node.value; - } - - if (node.type === 'open') { - return invalid ? (prefix + node.value) : '('; - } - - if (node.type === 'close') { - return invalid ? (prefix + node.value) : ')'; - } - - if (node.type === 'comma') { - return node.prev.type === 'comma' ? '' : (invalid ? node.value : '|'); - } - - if (node.value) { - return node.value; - } - - if (node.nodes && node.ranges > 0) { - let args = utils.reduce(node.nodes); - let range = fill(...args, { ...options, wrap: false, toRegex: true }); - - if (range.length !== 0) { - return args.length > 1 && range.length > 1 ? `(${range})` : range; - } - } - - if (node.nodes) { - for (let child of node.nodes) { - output += walk(child, node); - } - } - return output; - }; - - return walk(ast); -}; - -module.exports = compile; diff --git a/server/node_modules/braces/lib/constants.js b/server/node_modules/braces/lib/constants.js deleted file mode 100644 index a937943..0000000 --- a/server/node_modules/braces/lib/constants.js +++ /dev/null @@ -1,57 +0,0 @@ -'use strict'; - -module.exports = { - MAX_LENGTH: 1024 * 64, - - // Digits - CHAR_0: '0', /* 0 */ - CHAR_9: '9', /* 9 */ - - // Alphabet chars. - CHAR_UPPERCASE_A: 'A', /* A */ - CHAR_LOWERCASE_A: 'a', /* a */ - CHAR_UPPERCASE_Z: 'Z', /* Z */ - CHAR_LOWERCASE_Z: 'z', /* z */ - - CHAR_LEFT_PARENTHESES: '(', /* ( */ - CHAR_RIGHT_PARENTHESES: ')', /* ) */ - - CHAR_ASTERISK: '*', /* * */ - - // Non-alphabetic chars. - CHAR_AMPERSAND: '&', /* & */ - CHAR_AT: '@', /* @ */ - CHAR_BACKSLASH: '\\', /* \ */ - CHAR_BACKTICK: '`', /* ` */ - CHAR_CARRIAGE_RETURN: '\r', /* \r */ - CHAR_CIRCUMFLEX_ACCENT: '^', /* ^ */ - CHAR_COLON: ':', /* : */ - CHAR_COMMA: ',', /* , */ - CHAR_DOLLAR: '$', /* . */ - CHAR_DOT: '.', /* . */ - CHAR_DOUBLE_QUOTE: '"', /* " */ - CHAR_EQUAL: '=', /* = */ - CHAR_EXCLAMATION_MARK: '!', /* ! */ - CHAR_FORM_FEED: '\f', /* \f */ - CHAR_FORWARD_SLASH: '/', /* / */ - CHAR_HASH: '#', /* # */ - CHAR_HYPHEN_MINUS: '-', /* - */ - CHAR_LEFT_ANGLE_BRACKET: '<', /* < */ - CHAR_LEFT_CURLY_BRACE: '{', /* { */ - CHAR_LEFT_SQUARE_BRACKET: '[', /* [ */ - CHAR_LINE_FEED: '\n', /* \n */ - CHAR_NO_BREAK_SPACE: '\u00A0', /* \u00A0 */ - CHAR_PERCENT: '%', /* % */ - CHAR_PLUS: '+', /* + */ - CHAR_QUESTION_MARK: '?', /* ? */ - CHAR_RIGHT_ANGLE_BRACKET: '>', /* > */ - CHAR_RIGHT_CURLY_BRACE: '}', /* } */ - CHAR_RIGHT_SQUARE_BRACKET: ']', /* ] */ - CHAR_SEMICOLON: ';', /* ; */ - CHAR_SINGLE_QUOTE: '\'', /* ' */ - CHAR_SPACE: ' ', /* */ - CHAR_TAB: '\t', /* \t */ - CHAR_UNDERSCORE: '_', /* _ */ - CHAR_VERTICAL_LINE: '|', /* | */ - CHAR_ZERO_WIDTH_NOBREAK_SPACE: '\uFEFF' /* \uFEFF */ -}; diff --git a/server/node_modules/braces/lib/expand.js b/server/node_modules/braces/lib/expand.js deleted file mode 100644 index 376c748..0000000 --- a/server/node_modules/braces/lib/expand.js +++ /dev/null @@ -1,113 +0,0 @@ -'use strict'; - -const fill = require('fill-range'); -const stringify = require('./stringify'); -const utils = require('./utils'); - -const append = (queue = '', stash = '', enclose = false) => { - let result = []; - - queue = [].concat(queue); - stash = [].concat(stash); - - if (!stash.length) return queue; - if (!queue.length) { - return enclose ? utils.flatten(stash).map(ele => `{${ele}}`) : stash; - } - - for (let item of queue) { - if (Array.isArray(item)) { - for (let value of item) { - result.push(append(value, stash, enclose)); - } - } else { - for (let ele of stash) { - if (enclose === true && typeof ele === 'string') ele = `{${ele}}`; - result.push(Array.isArray(ele) ? append(item, ele, enclose) : (item + ele)); - } - } - } - return utils.flatten(result); -}; - -const expand = (ast, options = {}) => { - let rangeLimit = options.rangeLimit === void 0 ? 1000 : options.rangeLimit; - - let walk = (node, parent = {}) => { - node.queue = []; - - let p = parent; - let q = parent.queue; - - while (p.type !== 'brace' && p.type !== 'root' && p.parent) { - p = p.parent; - q = p.queue; - } - - if (node.invalid || node.dollar) { - q.push(append(q.pop(), stringify(node, options))); - return; - } - - if (node.type === 'brace' && node.invalid !== true && node.nodes.length === 2) { - q.push(append(q.pop(), ['{}'])); - return; - } - - if (node.nodes && node.ranges > 0) { - let args = utils.reduce(node.nodes); - - if (utils.exceedsLimit(...args, options.step, rangeLimit)) { - throw new RangeError('expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.'); - } - - let range = fill(...args, options); - if (range.length === 0) { - range = stringify(node, options); - } - - q.push(append(q.pop(), range)); - node.nodes = []; - return; - } - - let enclose = utils.encloseBrace(node); - let queue = node.queue; - let block = node; - - while (block.type !== 'brace' && block.type !== 'root' && block.parent) { - block = block.parent; - queue = block.queue; - } - - for (let i = 0; i < node.nodes.length; i++) { - let child = node.nodes[i]; - - if (child.type === 'comma' && node.type === 'brace') { - if (i === 1) queue.push(''); - queue.push(''); - continue; - } - - if (child.type === 'close') { - q.push(append(q.pop(), queue, enclose)); - continue; - } - - if (child.value && child.type !== 'open') { - queue.push(append(queue.pop(), child.value)); - continue; - } - - if (child.nodes) { - walk(child, node); - } - } - - return queue; - }; - - return utils.flatten(walk(ast)); -}; - -module.exports = expand; diff --git a/server/node_modules/braces/lib/parse.js b/server/node_modules/braces/lib/parse.js deleted file mode 100644 index 145ea26..0000000 --- a/server/node_modules/braces/lib/parse.js +++ /dev/null @@ -1,333 +0,0 @@ -'use strict'; - -const stringify = require('./stringify'); - -/** - * Constants - */ - -const { - MAX_LENGTH, - CHAR_BACKSLASH, /* \ */ - CHAR_BACKTICK, /* ` */ - CHAR_COMMA, /* , */ - CHAR_DOT, /* . */ - CHAR_LEFT_PARENTHESES, /* ( */ - CHAR_RIGHT_PARENTHESES, /* ) */ - CHAR_LEFT_CURLY_BRACE, /* { */ - CHAR_RIGHT_CURLY_BRACE, /* } */ - CHAR_LEFT_SQUARE_BRACKET, /* [ */ - CHAR_RIGHT_SQUARE_BRACKET, /* ] */ - CHAR_DOUBLE_QUOTE, /* " */ - CHAR_SINGLE_QUOTE, /* ' */ - CHAR_NO_BREAK_SPACE, - CHAR_ZERO_WIDTH_NOBREAK_SPACE -} = require('./constants'); - -/** - * parse - */ - -const parse = (input, options = {}) => { - if (typeof input !== 'string') { - throw new TypeError('Expected a string'); - } - - let opts = options || {}; - let max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH; - if (input.length > max) { - throw new SyntaxError(`Input length (${input.length}), exceeds max characters (${max})`); - } - - let ast = { type: 'root', input, nodes: [] }; - let stack = [ast]; - let block = ast; - let prev = ast; - let brackets = 0; - let length = input.length; - let index = 0; - let depth = 0; - let value; - let memo = {}; - - /** - * Helpers - */ - - const advance = () => input[index++]; - const push = node => { - if (node.type === 'text' && prev.type === 'dot') { - prev.type = 'text'; - } - - if (prev && prev.type === 'text' && node.type === 'text') { - prev.value += node.value; - return; - } - - block.nodes.push(node); - node.parent = block; - node.prev = prev; - prev = node; - return node; - }; - - push({ type: 'bos' }); - - while (index < length) { - block = stack[stack.length - 1]; - value = advance(); - - /** - * Invalid chars - */ - - if (value === CHAR_ZERO_WIDTH_NOBREAK_SPACE || value === CHAR_NO_BREAK_SPACE) { - continue; - } - - /** - * Escaped chars - */ - - if (value === CHAR_BACKSLASH) { - push({ type: 'text', value: (options.keepEscaping ? value : '') + advance() }); - continue; - } - - /** - * Right square bracket (literal): ']' - */ - - if (value === CHAR_RIGHT_SQUARE_BRACKET) { - push({ type: 'text', value: '\\' + value }); - continue; - } - - /** - * Left square bracket: '[' - */ - - if (value === CHAR_LEFT_SQUARE_BRACKET) { - brackets++; - - let closed = true; - let next; - - while (index < length && (next = advance())) { - value += next; - - if (next === CHAR_LEFT_SQUARE_BRACKET) { - brackets++; - continue; - } - - if (next === CHAR_BACKSLASH) { - value += advance(); - continue; - } - - if (next === CHAR_RIGHT_SQUARE_BRACKET) { - brackets--; - - if (brackets === 0) { - break; - } - } - } - - push({ type: 'text', value }); - continue; - } - - /** - * Parentheses - */ - - if (value === CHAR_LEFT_PARENTHESES) { - block = push({ type: 'paren', nodes: [] }); - stack.push(block); - push({ type: 'text', value }); - continue; - } - - if (value === CHAR_RIGHT_PARENTHESES) { - if (block.type !== 'paren') { - push({ type: 'text', value }); - continue; - } - block = stack.pop(); - push({ type: 'text', value }); - block = stack[stack.length - 1]; - continue; - } - - /** - * Quotes: '|"|` - */ - - if (value === CHAR_DOUBLE_QUOTE || value === CHAR_SINGLE_QUOTE || value === CHAR_BACKTICK) { - let open = value; - let next; - - if (options.keepQuotes !== true) { - value = ''; - } - - while (index < length && (next = advance())) { - if (next === CHAR_BACKSLASH) { - value += next + advance(); - continue; - } - - if (next === open) { - if (options.keepQuotes === true) value += next; - break; - } - - value += next; - } - - push({ type: 'text', value }); - continue; - } - - /** - * Left curly brace: '{' - */ - - if (value === CHAR_LEFT_CURLY_BRACE) { - depth++; - - let dollar = prev.value && prev.value.slice(-1) === '$' || block.dollar === true; - let brace = { - type: 'brace', - open: true, - close: false, - dollar, - depth, - commas: 0, - ranges: 0, - nodes: [] - }; - - block = push(brace); - stack.push(block); - push({ type: 'open', value }); - continue; - } - - /** - * Right curly brace: '}' - */ - - if (value === CHAR_RIGHT_CURLY_BRACE) { - if (block.type !== 'brace') { - push({ type: 'text', value }); - continue; - } - - let type = 'close'; - block = stack.pop(); - block.close = true; - - push({ type, value }); - depth--; - - block = stack[stack.length - 1]; - continue; - } - - /** - * Comma: ',' - */ - - if (value === CHAR_COMMA && depth > 0) { - if (block.ranges > 0) { - block.ranges = 0; - let open = block.nodes.shift(); - block.nodes = [open, { type: 'text', value: stringify(block) }]; - } - - push({ type: 'comma', value }); - block.commas++; - continue; - } - - /** - * Dot: '.' - */ - - if (value === CHAR_DOT && depth > 0 && block.commas === 0) { - let siblings = block.nodes; - - if (depth === 0 || siblings.length === 0) { - push({ type: 'text', value }); - continue; - } - - if (prev.type === 'dot') { - block.range = []; - prev.value += value; - prev.type = 'range'; - - if (block.nodes.length !== 3 && block.nodes.length !== 5) { - block.invalid = true; - block.ranges = 0; - prev.type = 'text'; - continue; - } - - block.ranges++; - block.args = []; - continue; - } - - if (prev.type === 'range') { - siblings.pop(); - - let before = siblings[siblings.length - 1]; - before.value += prev.value + value; - prev = before; - block.ranges--; - continue; - } - - push({ type: 'dot', value }); - continue; - } - - /** - * Text - */ - - push({ type: 'text', value }); - } - - // Mark imbalanced braces and brackets as invalid - do { - block = stack.pop(); - - if (block.type !== 'root') { - block.nodes.forEach(node => { - if (!node.nodes) { - if (node.type === 'open') node.isOpen = true; - if (node.type === 'close') node.isClose = true; - if (!node.nodes) node.type = 'text'; - node.invalid = true; - } - }); - - // get the location of the block on parent.nodes (block's siblings) - let parent = stack[stack.length - 1]; - let index = parent.nodes.indexOf(block); - // replace the (invalid) block with it's nodes - parent.nodes.splice(index, 1, ...block.nodes); - } - } while (stack.length > 0); - - push({ type: 'eos' }); - return ast; -}; - -module.exports = parse; diff --git a/server/node_modules/braces/lib/stringify.js b/server/node_modules/braces/lib/stringify.js deleted file mode 100644 index 414b7bc..0000000 --- a/server/node_modules/braces/lib/stringify.js +++ /dev/null @@ -1,32 +0,0 @@ -'use strict'; - -const utils = require('./utils'); - -module.exports = (ast, options = {}) => { - let stringify = (node, parent = {}) => { - let invalidBlock = options.escapeInvalid && utils.isInvalidBrace(parent); - let invalidNode = node.invalid === true && options.escapeInvalid === true; - let output = ''; - - if (node.value) { - if ((invalidBlock || invalidNode) && utils.isOpenOrClose(node)) { - return '\\' + node.value; - } - return node.value; - } - - if (node.value) { - return node.value; - } - - if (node.nodes) { - for (let child of node.nodes) { - output += stringify(child); - } - } - return output; - }; - - return stringify(ast); -}; - diff --git a/server/node_modules/braces/lib/utils.js b/server/node_modules/braces/lib/utils.js deleted file mode 100644 index e3551a6..0000000 --- a/server/node_modules/braces/lib/utils.js +++ /dev/null @@ -1,112 +0,0 @@ -'use strict'; - -exports.isInteger = num => { - if (typeof num === 'number') { - return Number.isInteger(num); - } - if (typeof num === 'string' && num.trim() !== '') { - return Number.isInteger(Number(num)); - } - return false; -}; - -/** - * Find a node of the given type - */ - -exports.find = (node, type) => node.nodes.find(node => node.type === type); - -/** - * Find a node of the given type - */ - -exports.exceedsLimit = (min, max, step = 1, limit) => { - if (limit === false) return false; - if (!exports.isInteger(min) || !exports.isInteger(max)) return false; - return ((Number(max) - Number(min)) / Number(step)) >= limit; -}; - -/** - * Escape the given node with '\\' before node.value - */ - -exports.escapeNode = (block, n = 0, type) => { - let node = block.nodes[n]; - if (!node) return; - - if ((type && node.type === type) || node.type === 'open' || node.type === 'close') { - if (node.escaped !== true) { - node.value = '\\' + node.value; - node.escaped = true; - } - } -}; - -/** - * Returns true if the given brace node should be enclosed in literal braces - */ - -exports.encloseBrace = node => { - if (node.type !== 'brace') return false; - if ((node.commas >> 0 + node.ranges >> 0) === 0) { - node.invalid = true; - return true; - } - return false; -}; - -/** - * Returns true if a brace node is invalid. - */ - -exports.isInvalidBrace = block => { - if (block.type !== 'brace') return false; - if (block.invalid === true || block.dollar) return true; - if ((block.commas >> 0 + block.ranges >> 0) === 0) { - block.invalid = true; - return true; - } - if (block.open !== true || block.close !== true) { - block.invalid = true; - return true; - } - return false; -}; - -/** - * Returns true if a node is an open or close node - */ - -exports.isOpenOrClose = node => { - if (node.type === 'open' || node.type === 'close') { - return true; - } - return node.open === true || node.close === true; -}; - -/** - * Reduce an array of text nodes. - */ - -exports.reduce = nodes => nodes.reduce((acc, node) => { - if (node.type === 'text') acc.push(node.value); - if (node.type === 'range') node.type = 'text'; - return acc; -}, []); - -/** - * Flatten an array - */ - -exports.flatten = (...args) => { - const result = []; - const flat = arr => { - for (let i = 0; i < arr.length; i++) { - let ele = arr[i]; - Array.isArray(ele) ? flat(ele, result) : ele !== void 0 && result.push(ele); - } - return result; - }; - flat(args); - return result; -}; diff --git a/server/node_modules/braces/package.json b/server/node_modules/braces/package.json deleted file mode 100644 index 3f52e34..0000000 --- a/server/node_modules/braces/package.json +++ /dev/null @@ -1,77 +0,0 @@ -{ - "name": "braces", - "description": "Bash-like brace expansion, implemented in JavaScript. Safer than other brace expansion libs, with complete support for the Bash 4.3 braces specification, without sacrificing speed.", - "version": "3.0.2", - "homepage": "https://github.com/micromatch/braces", - "author": "Jon Schlinkert (https://github.com/jonschlinkert)", - "contributors": [ - "Brian Woodward (https://twitter.com/doowb)", - "Elan Shanker (https://github.com/es128)", - "Eugene Sharygin (https://github.com/eush77)", - "hemanth.hm (http://h3manth.com)", - "Jon Schlinkert (http://twitter.com/jonschlinkert)" - ], - "repository": "micromatch/braces", - "bugs": { - "url": "https://github.com/micromatch/braces/issues" - }, - "license": "MIT", - "files": [ - "index.js", - "lib" - ], - "main": "index.js", - "engines": { - "node": ">=8" - }, - "scripts": { - "test": "mocha", - "benchmark": "node benchmark" - }, - "dependencies": { - "fill-range": "^7.0.1" - }, - "devDependencies": { - "ansi-colors": "^3.2.4", - "bash-path": "^2.0.1", - "gulp-format-md": "^2.0.0", - "mocha": "^6.1.1" - }, - "keywords": [ - "alpha", - "alphabetical", - "bash", - "brace", - "braces", - "expand", - "expansion", - "filepath", - "fill", - "fs", - "glob", - "globbing", - "letter", - "match", - "matches", - "matching", - "number", - "numerical", - "path", - "range", - "ranges", - "sh" - ], - "verb": { - "toc": false, - "layout": "default", - "tasks": [ - "readme" - ], - "lint": { - "reflinks": true - }, - "plugins": [ - "gulp-format-md" - ] - } -} diff --git a/server/node_modules/chokidar/LICENSE b/server/node_modules/chokidar/LICENSE deleted file mode 100644 index fa9162b..0000000 --- a/server/node_modules/chokidar/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2012-2019 Paul Miller (https://paulmillr.com), Elan Shanker - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the “Software”), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/server/node_modules/chokidar/README.md b/server/node_modules/chokidar/README.md deleted file mode 100644 index 5cfb81e..0000000 --- a/server/node_modules/chokidar/README.md +++ /dev/null @@ -1,307 +0,0 @@ -# Chokidar [![Weekly downloads](https://img.shields.io/npm/dw/chokidar.svg)](https://github.com/paulmillr/chokidar) [![Yearly downloads](https://img.shields.io/npm/dy/chokidar.svg)](https://github.com/paulmillr/chokidar) - -> Minimal and efficient cross-platform file watching library - -[![NPM](https://nodei.co/npm/chokidar.png)](https://www.npmjs.com/package/chokidar) - -## Why? - -Node.js `fs.watch`: - -* Doesn't report filenames on MacOS. -* Doesn't report events at all when using editors like Sublime on MacOS. -* Often reports events twice. -* Emits most changes as `rename`. -* Does not provide an easy way to recursively watch file trees. - -Node.js `fs.watchFile`: - -* Almost as bad at event handling. -* Also does not provide any recursive watching. -* Results in high CPU utilization. - -Chokidar resolves these problems. - -Initially made for **[Brunch](https://brunch.io/)** (an ultra-swift web app build tool), it is now used in -[Microsoft's Visual Studio Code](https://github.com/microsoft/vscode), -[gulp](https://github.com/gulpjs/gulp/), -[karma](https://karma-runner.github.io/), -[PM2](https://github.com/Unitech/PM2), -[browserify](http://browserify.org/), -[webpack](https://webpack.github.io/), -[BrowserSync](https://www.browsersync.io/), -and [many others](https://www.npmjs.com/browse/depended/chokidar). -It has proven itself in production environments. - -Version 3 is out! Check out our blog post about it: [Chokidar 3: How to save 32TB of traffic every week](https://paulmillr.com/posts/chokidar-3-save-32tb-of-traffic/) - -## How? - -Chokidar does still rely on the Node.js core `fs` module, but when using -`fs.watch` and `fs.watchFile` for watching, it normalizes the events it -receives, often checking for truth by getting file stats and/or dir contents. - -On MacOS, chokidar by default uses a native extension exposing the Darwin -`FSEvents` API. This provides very efficient recursive watching compared with -implementations like `kqueue` available on most \*nix platforms. Chokidar still -does have to do some work to normalize the events received that way as well. - -On other platforms, the `fs.watch`-based implementation is the default, which -avoids polling and keeps CPU usage down. Be advised that chokidar will initiate -watchers recursively for everything within scope of the paths that have been -specified, so be judicious about not wasting system resources by watching much -more than needed. - -## Getting started - -Install with npm: - -```sh -npm install chokidar -``` - -Then `require` and use it in your code: - -```javascript -const chokidar = require('chokidar'); - -// One-liner for current directory -chokidar.watch('.').on('all', (event, path) => { - console.log(event, path); -}); -``` - -## API - -```javascript -// Example of a more typical implementation structure - -// Initialize watcher. -const watcher = chokidar.watch('file, dir, glob, or array', { - ignored: /(^|[\/\\])\../, // ignore dotfiles - persistent: true -}); - -// Something to use when events are received. -const log = console.log.bind(console); -// Add event listeners. -watcher - .on('add', path => log(`File ${path} has been added`)) - .on('change', path => log(`File ${path} has been changed`)) - .on('unlink', path => log(`File ${path} has been removed`)); - -// More possible events. -watcher - .on('addDir', path => log(`Directory ${path} has been added`)) - .on('unlinkDir', path => log(`Directory ${path} has been removed`)) - .on('error', error => log(`Watcher error: ${error}`)) - .on('ready', () => log('Initial scan complete. Ready for changes')) - .on('raw', (event, path, details) => { // internal - log('Raw event info:', event, path, details); - }); - -// 'add', 'addDir' and 'change' events also receive stat() results as second -// argument when available: https://nodejs.org/api/fs.html#fs_class_fs_stats -watcher.on('change', (path, stats) => { - if (stats) console.log(`File ${path} changed size to ${stats.size}`); -}); - -// Watch new files. -watcher.add('new-file'); -watcher.add(['new-file-2', 'new-file-3', '**/other-file*']); - -// Get list of actual paths being watched on the filesystem -var watchedPaths = watcher.getWatched(); - -// Un-watch some files. -await watcher.unwatch('new-file*'); - -// Stop watching. -// The method is async! -watcher.close().then(() => console.log('closed')); - -// Full list of options. See below for descriptions. -// Do not use this example! -chokidar.watch('file', { - persistent: true, - - ignored: '*.txt', - ignoreInitial: false, - followSymlinks: true, - cwd: '.', - disableGlobbing: false, - - usePolling: false, - interval: 100, - binaryInterval: 300, - alwaysStat: false, - depth: 99, - awaitWriteFinish: { - stabilityThreshold: 2000, - pollInterval: 100 - }, - - ignorePermissionErrors: false, - atomic: true // or a custom 'atomicity delay', in milliseconds (default 100) -}); - -``` - -`chokidar.watch(paths, [options])` - -* `paths` (string or array of strings). Paths to files, dirs to be watched -recursively, or glob patterns. - - Note: globs must not contain windows separators (`\`), - because that's how they work by the standard — - you'll need to replace them with forward slashes (`/`). - - Note 2: for additional glob documentation, check out low-level - library: [picomatch](https://github.com/micromatch/picomatch). -* `options` (object) Options object as defined below: - -#### Persistence - -* `persistent` (default: `true`). Indicates whether the process -should continue to run as long as files are being watched. If set to -`false` when using `fsevents` to watch, no more events will be emitted -after `ready`, even if the process continues to run. - -#### Path filtering - -* `ignored` ([anymatch](https://github.com/es128/anymatch)-compatible definition) -Defines files/paths to be ignored. The whole relative or absolute path is -tested, not just filename. If a function with two arguments is provided, it -gets called twice per path - once with a single argument (the path), second -time with two arguments (the path and the -[`fs.Stats`](https://nodejs.org/api/fs.html#fs_class_fs_stats) -object of that path). -* `ignoreInitial` (default: `false`). If set to `false` then `add`/`addDir` events are also emitted for matching paths while -instantiating the watching as chokidar discovers these file paths (before the `ready` event). -* `followSymlinks` (default: `true`). When `false`, only the -symlinks themselves will be watched for changes instead of following -the link references and bubbling events through the link's path. -* `cwd` (no default). The base directory from which watch `paths` are to be -derived. Paths emitted with events will be relative to this. -* `disableGlobbing` (default: `false`). If set to `true` then the strings passed to `.watch()` and `.add()` are treated as -literal path names, even if they look like globs. - -#### Performance - -* `usePolling` (default: `false`). -Whether to use fs.watchFile (backed by polling), or fs.watch. If polling -leads to high CPU utilization, consider setting this to `false`. It is -typically necessary to **set this to `true` to successfully watch files over -a network**, and it may be necessary to successfully watch files in other -non-standard situations. Setting to `true` explicitly on MacOS overrides the -`useFsEvents` default. You may also set the CHOKIDAR_USEPOLLING env variable -to true (1) or false (0) in order to override this option. -* _Polling-specific settings_ (effective when `usePolling: true`) - * `interval` (default: `100`). Interval of file system polling, in milliseconds. You may also - set the CHOKIDAR_INTERVAL env variable to override this option. - * `binaryInterval` (default: `300`). Interval of file system - polling for binary files. - ([see list of binary extensions](https://github.com/sindresorhus/binary-extensions/blob/master/binary-extensions.json)) -* `useFsEvents` (default: `true` on MacOS). Whether to use the -`fsevents` watching interface if available. When set to `true` explicitly -and `fsevents` is available this supercedes the `usePolling` setting. When -set to `false` on MacOS, `usePolling: true` becomes the default. -* `alwaysStat` (default: `false`). If relying upon the -[`fs.Stats`](https://nodejs.org/api/fs.html#fs_class_fs_stats) -object that may get passed with `add`, `addDir`, and `change` events, set -this to `true` to ensure it is provided even in cases where it wasn't -already available from the underlying watch events. -* `depth` (default: `undefined`). If set, limits how many levels of -subdirectories will be traversed. -* `awaitWriteFinish` (default: `false`). -By default, the `add` event will fire when a file first appears on disk, before -the entire file has been written. Furthermore, in some cases some `change` -events will be emitted while the file is being written. In some cases, -especially when watching for large files there will be a need to wait for the -write operation to finish before responding to a file creation or modification. -Setting `awaitWriteFinish` to `true` (or a truthy value) will poll file size, -holding its `add` and `change` events until the size does not change for a -configurable amount of time. The appropriate duration setting is heavily -dependent on the OS and hardware. For accurate detection this parameter should -be relatively high, making file watching much less responsive. -Use with caution. - * *`options.awaitWriteFinish` can be set to an object in order to adjust - timing params:* - * `awaitWriteFinish.stabilityThreshold` (default: 2000). Amount of time in - milliseconds for a file size to remain constant before emitting its event. - * `awaitWriteFinish.pollInterval` (default: 100). File size polling interval, in milliseconds. - -#### Errors - -* `ignorePermissionErrors` (default: `false`). Indicates whether to watch files -that don't have read permissions if possible. If watching fails due to `EPERM` -or `EACCES` with this set to `true`, the errors will be suppressed silently. -* `atomic` (default: `true` if `useFsEvents` and `usePolling` are `false`). -Automatically filters out artifacts that occur when using editors that use -"atomic writes" instead of writing directly to the source file. If a file is -re-added within 100 ms of being deleted, Chokidar emits a `change` event -rather than `unlink` then `add`. If the default of 100 ms does not work well -for you, you can override it by setting `atomic` to a custom value, in -milliseconds. - -### Methods & Events - -`chokidar.watch()` produces an instance of `FSWatcher`. Methods of `FSWatcher`: - -* `.add(path / paths)`: Add files, directories, or glob patterns for tracking. -Takes an array of strings or just one string. -* `.on(event, callback)`: Listen for an FS event. -Available events: `add`, `addDir`, `change`, `unlink`, `unlinkDir`, `ready`, -`raw`, `error`. -Additionally `all` is available which gets emitted with the underlying event -name and path for every event other than `ready`, `raw`, and `error`. `raw` is internal, use it carefully. -* `.unwatch(path / paths)`: Stop watching files, directories, or glob patterns. -Takes an array of strings or just one string. Use with `await` to ensure bugs don't happen. -* `.close()`: **async** Removes all listeners from watched files. Asynchronous, returns Promise. -* `.getWatched()`: Returns an object representing all the paths on the file -system being watched by this `FSWatcher` instance. The object's keys are all the -directories (using absolute paths unless the `cwd` option was used), and the -values are arrays of the names of the items contained in each directory. - -## CLI - -If you need a CLI interface for your file watching, check out -[chokidar-cli](https://github.com/kimmobrunfeldt/chokidar-cli), allowing you to -execute a command on each change, or get a stdio stream of change events. - -## Install Troubleshooting - -* `npm WARN optional dep failed, continuing fsevents@n.n.n` - * This message is normal part of how `npm` handles optional dependencies and is - not indicative of a problem. Even if accompanied by other related error messages, - Chokidar should function properly. - -* `TypeError: fsevents is not a constructor` - * Update chokidar by doing `rm -rf node_modules package-lock.json yarn.lock && npm install`, or update your dependency that uses chokidar. - -* Chokidar is producing `ENOSP` error on Linux, like this: - * `bash: cannot set terminal process group (-1): Inappropriate ioctl for device bash: no job control in this shell` - `Error: watch /home/ ENOSPC` - * This means Chokidar ran out of file handles and you'll need to increase their count by executing the following command in Terminal: - `echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p` - -## Changelog - -For more detailed changelog, see [`full_changelog.md`](.github/full_changelog.md). -- **v3.5 (Jan 6, 2021):** Support for ARM Macs with Apple Silicon. Fixes for deleted symlinks. -- **v3.4 (Apr 26, 2020):** Support for directory-based symlinks. Fixes for macos file replacement. -- **v3.3 (Nov 2, 2019):** `FSWatcher#close()` method became async. That fixes IO race conditions related to close method. -- **v3.2 (Oct 1, 2019):** Improve Linux RAM usage by 50%. Race condition fixes. Windows glob fixes. Improve stability by using tight range of dependency versions. -- **v3.1 (Sep 16, 2019):** dotfiles are no longer filtered out by default. Use `ignored` option if needed. Improve initial Linux scan time by 50%. -- **v3 (Apr 30, 2019):** massive CPU & RAM consumption improvements; reduces deps / package size by a factor of 17x and bumps Node.js requirement to v8.16 and higher. -- **v2 (Dec 29, 2017):** Globs are now posix-style-only; without windows support. Tons of bugfixes. -- **v1 (Apr 7, 2015):** Glob support, symlink support, tons of bugfixes. Node 0.8+ is supported -- **v0.1 (Apr 20, 2012):** Initial release, extracted from [Brunch](https://github.com/brunch/brunch/blob/9847a065aea300da99bd0753f90354cde9de1261/src/helpers.coffee#L66) - -## Also - -Why was chokidar named this way? What's the meaning behind it? - ->Chowkidar is a transliteration of a Hindi word meaning 'watchman, gatekeeper', चौकीदार. This ultimately comes from Sanskrit _ चतुष्क_ (crossway, quadrangle, consisting-of-four). - -## License - -MIT (c) Paul Miller (), see [LICENSE](LICENSE) file. diff --git a/server/node_modules/chokidar/index.js b/server/node_modules/chokidar/index.js deleted file mode 100644 index a14deeb..0000000 --- a/server/node_modules/chokidar/index.js +++ /dev/null @@ -1,967 +0,0 @@ -'use strict'; - -const { EventEmitter } = require('events'); -const fs = require('fs'); -const sysPath = require('path'); -const { promisify } = require('util'); -const readdirp = require('readdirp'); -const anymatch = require('anymatch').default; -const globParent = require('glob-parent'); -const isGlob = require('is-glob'); -const braces = require('braces'); -const normalizePath = require('normalize-path'); - -const NodeFsHandler = require('./lib/nodefs-handler'); -const FsEventsHandler = require('./lib/fsevents-handler'); -const { - EV_ALL, - EV_READY, - EV_ADD, - EV_CHANGE, - EV_UNLINK, - EV_ADD_DIR, - EV_UNLINK_DIR, - EV_RAW, - EV_ERROR, - - STR_CLOSE, - STR_END, - - BACK_SLASH_RE, - DOUBLE_SLASH_RE, - SLASH_OR_BACK_SLASH_RE, - DOT_RE, - REPLACER_RE, - - SLASH, - SLASH_SLASH, - BRACE_START, - BANG, - ONE_DOT, - TWO_DOTS, - GLOBSTAR, - SLASH_GLOBSTAR, - ANYMATCH_OPTS, - STRING_TYPE, - FUNCTION_TYPE, - EMPTY_STR, - EMPTY_FN, - - isWindows, - isMacos -} = require('./lib/constants'); - -const stat = promisify(fs.stat); -const readdir = promisify(fs.readdir); - -/** - * @typedef {String} Path - * @typedef {'all'|'add'|'addDir'|'change'|'unlink'|'unlinkDir'|'raw'|'error'|'ready'} EventName - * @typedef {'readdir'|'watch'|'add'|'remove'|'change'} ThrottleType - */ - -/** - * - * @typedef {Object} WatchHelpers - * @property {Boolean} followSymlinks - * @property {'stat'|'lstat'} statMethod - * @property {Path} path - * @property {Path} watchPath - * @property {Function} entryPath - * @property {Boolean} hasGlob - * @property {Object} globFilter - * @property {Function} filterPath - * @property {Function} filterDir - */ - -const arrify = (value = []) => Array.isArray(value) ? value : [value]; -const flatten = (list, result = []) => { - list.forEach(item => { - if (Array.isArray(item)) { - flatten(item, result); - } else { - result.push(item); - } - }); - return result; -}; - -const unifyPaths = (paths_) => { - /** - * @type {Array} - */ - const paths = flatten(arrify(paths_)); - if (!paths.every(p => typeof p === STRING_TYPE)) { - throw new TypeError(`Non-string provided as watch path: ${paths}`); - } - return paths.map(normalizePathToUnix); -}; - -// If SLASH_SLASH occurs at the beginning of path, it is not replaced -// because "//StoragePC/DrivePool/Movies" is a valid network path -const toUnix = (string) => { - let str = string.replace(BACK_SLASH_RE, SLASH); - let prepend = false; - if (str.startsWith(SLASH_SLASH)) { - prepend = true; - } - while (str.match(DOUBLE_SLASH_RE)) { - str = str.replace(DOUBLE_SLASH_RE, SLASH); - } - if (prepend) { - str = SLASH + str; - } - return str; -}; - -// Our version of upath.normalize -// TODO: this is not equal to path-normalize module - investigate why -const normalizePathToUnix = (path) => toUnix(sysPath.normalize(toUnix(path))); - -const normalizeIgnored = (cwd = EMPTY_STR) => (path) => { - if (typeof path !== STRING_TYPE) return path; - return normalizePathToUnix(sysPath.isAbsolute(path) ? path : sysPath.join(cwd, path)); -}; - -const getAbsolutePath = (path, cwd) => { - if (sysPath.isAbsolute(path)) { - return path; - } - if (path.startsWith(BANG)) { - return BANG + sysPath.join(cwd, path.slice(1)); - } - return sysPath.join(cwd, path); -}; - -const undef = (opts, key) => opts[key] === undefined; - -/** - * Directory entry. - * @property {Path} path - * @property {Set} items - */ -class DirEntry { - /** - * @param {Path} dir - * @param {Function} removeWatcher - */ - constructor(dir, removeWatcher) { - this.path = dir; - this._removeWatcher = removeWatcher; - /** @type {Set} */ - this.items = new Set(); - } - - add(item) { - const {items} = this; - if (!items) return; - if (item !== ONE_DOT && item !== TWO_DOTS) items.add(item); - } - - async remove(item) { - const {items} = this; - if (!items) return; - items.delete(item); - if (items.size > 0) return; - - const dir = this.path; - try { - await readdir(dir); - } catch (err) { - if (this._removeWatcher) { - this._removeWatcher(sysPath.dirname(dir), sysPath.basename(dir)); - } - } - } - - has(item) { - const {items} = this; - if (!items) return; - return items.has(item); - } - - /** - * @returns {Array} - */ - getChildren() { - const {items} = this; - if (!items) return; - return [...items.values()]; - } - - dispose() { - this.items.clear(); - delete this.path; - delete this._removeWatcher; - delete this.items; - Object.freeze(this); - } -} - -const STAT_METHOD_F = 'stat'; -const STAT_METHOD_L = 'lstat'; -class WatchHelper { - constructor(path, watchPath, follow, fsw) { - this.fsw = fsw; - this.path = path = path.replace(REPLACER_RE, EMPTY_STR); - this.watchPath = watchPath; - this.fullWatchPath = sysPath.resolve(watchPath); - this.hasGlob = watchPath !== path; - /** @type {object|boolean} */ - if (path === EMPTY_STR) this.hasGlob = false; - this.globSymlink = this.hasGlob && follow ? undefined : false; - this.globFilter = this.hasGlob ? anymatch(path, undefined, ANYMATCH_OPTS) : false; - this.dirParts = this.getDirParts(path); - this.dirParts.forEach((parts) => { - if (parts.length > 1) parts.pop(); - }); - this.followSymlinks = follow; - this.statMethod = follow ? STAT_METHOD_F : STAT_METHOD_L; - } - - checkGlobSymlink(entry) { - // only need to resolve once - // first entry should always have entry.parentDir === EMPTY_STR - if (this.globSymlink === undefined) { - this.globSymlink = entry.fullParentDir === this.fullWatchPath ? - false : {realPath: entry.fullParentDir, linkPath: this.fullWatchPath}; - } - - if (this.globSymlink) { - return entry.fullPath.replace(this.globSymlink.realPath, this.globSymlink.linkPath); - } - - return entry.fullPath; - } - - entryPath(entry) { - return sysPath.join(this.watchPath, - sysPath.relative(this.watchPath, this.checkGlobSymlink(entry)) - ); - } - - filterPath(entry) { - const {stats} = entry; - if (stats && stats.isSymbolicLink()) return this.filterDir(entry); - const resolvedPath = this.entryPath(entry); - const matchesGlob = this.hasGlob && typeof this.globFilter === FUNCTION_TYPE ? - this.globFilter(resolvedPath) : true; - return matchesGlob && - this.fsw._isntIgnored(resolvedPath, stats) && - this.fsw._hasReadPermissions(stats); - } - - getDirParts(path) { - if (!this.hasGlob) return []; - const parts = []; - const expandedPath = path.includes(BRACE_START) ? braces.expand(path) : [path]; - expandedPath.forEach((path) => { - parts.push(sysPath.relative(this.watchPath, path).split(SLASH_OR_BACK_SLASH_RE)); - }); - return parts; - } - - filterDir(entry) { - if (this.hasGlob) { - const entryParts = this.getDirParts(this.checkGlobSymlink(entry)); - let globstar = false; - this.unmatchedGlob = !this.dirParts.some((parts) => { - return parts.every((part, i) => { - if (part === GLOBSTAR) globstar = true; - return globstar || !entryParts[0][i] || anymatch(part, entryParts[0][i], ANYMATCH_OPTS); - }); - }); - } - return !this.unmatchedGlob && this.fsw._isntIgnored(this.entryPath(entry), entry.stats); - } -} - -/** - * Watches files & directories for changes. Emitted events: - * `add`, `addDir`, `change`, `unlink`, `unlinkDir`, `all`, `error` - * - * new FSWatcher() - * .add(directories) - * .on('add', path => log('File', path, 'was added')) - */ -class FSWatcher extends EventEmitter { -// Not indenting methods for history sake; for now. -constructor(_opts) { - super(); - - const opts = {}; - if (_opts) Object.assign(opts, _opts); // for frozen objects - - /** @type {Map} */ - this._watched = new Map(); - /** @type {Map} */ - this._closers = new Map(); - /** @type {Set} */ - this._ignoredPaths = new Set(); - - /** @type {Map} */ - this._throttled = new Map(); - - /** @type {Map} */ - this._symlinkPaths = new Map(); - - this._streams = new Set(); - this.closed = false; - - // Set up default options. - if (undef(opts, 'persistent')) opts.persistent = true; - if (undef(opts, 'ignoreInitial')) opts.ignoreInitial = false; - if (undef(opts, 'ignorePermissionErrors')) opts.ignorePermissionErrors = false; - if (undef(opts, 'interval')) opts.interval = 100; - if (undef(opts, 'binaryInterval')) opts.binaryInterval = 300; - if (undef(opts, 'disableGlobbing')) opts.disableGlobbing = false; - opts.enableBinaryInterval = opts.binaryInterval !== opts.interval; - - // Enable fsevents on OS X when polling isn't explicitly enabled. - if (undef(opts, 'useFsEvents')) opts.useFsEvents = !opts.usePolling; - - // If we can't use fsevents, ensure the options reflect it's disabled. - const canUseFsEvents = FsEventsHandler.canUse(); - if (!canUseFsEvents) opts.useFsEvents = false; - - // Use polling on Mac if not using fsevents. - // Other platforms use non-polling fs_watch. - if (undef(opts, 'usePolling') && !opts.useFsEvents) { - opts.usePolling = isMacos; - } - - // Global override (useful for end-developers that need to force polling for all - // instances of chokidar, regardless of usage/dependency depth) - const envPoll = process.env.CHOKIDAR_USEPOLLING; - if (envPoll !== undefined) { - const envLower = envPoll.toLowerCase(); - - if (envLower === 'false' || envLower === '0') { - opts.usePolling = false; - } else if (envLower === 'true' || envLower === '1') { - opts.usePolling = true; - } else { - opts.usePolling = !!envLower; - } - } - const envInterval = process.env.CHOKIDAR_INTERVAL; - if (envInterval) { - opts.interval = Number.parseInt(envInterval, 10); - } - - // Editor atomic write normalization enabled by default with fs.watch - if (undef(opts, 'atomic')) opts.atomic = !opts.usePolling && !opts.useFsEvents; - if (opts.atomic) this._pendingUnlinks = new Map(); - - if (undef(opts, 'followSymlinks')) opts.followSymlinks = true; - - if (undef(opts, 'awaitWriteFinish')) opts.awaitWriteFinish = false; - if (opts.awaitWriteFinish === true) opts.awaitWriteFinish = {}; - const awf = opts.awaitWriteFinish; - if (awf) { - if (!awf.stabilityThreshold) awf.stabilityThreshold = 2000; - if (!awf.pollInterval) awf.pollInterval = 100; - this._pendingWrites = new Map(); - } - if (opts.ignored) opts.ignored = arrify(opts.ignored); - - let readyCalls = 0; - this._emitReady = () => { - readyCalls++; - if (readyCalls >= this._readyCount) { - this._emitReady = EMPTY_FN; - this._readyEmitted = true; - // use process.nextTick to allow time for listener to be bound - process.nextTick(() => this.emit(EV_READY)); - } - }; - this._emitRaw = (...args) => this.emit(EV_RAW, ...args); - this._readyEmitted = false; - this.options = opts; - - // Initialize with proper watcher. - if (opts.useFsEvents) { - this._fsEventsHandler = new FsEventsHandler(this); - } else { - this._nodeFsHandler = new NodeFsHandler(this); - } - - // You’re frozen when your heart’s not open. - Object.freeze(opts); -} - -// Public methods - -/** - * Adds paths to be watched on an existing FSWatcher instance - * @param {Path|Array} paths_ - * @param {String=} _origAdd private; for handling non-existent paths to be watched - * @param {Boolean=} _internal private; indicates a non-user add - * @returns {FSWatcher} for chaining - */ -add(paths_, _origAdd, _internal) { - const {cwd, disableGlobbing} = this.options; - this.closed = false; - let paths = unifyPaths(paths_); - if (cwd) { - paths = paths.map((path) => { - const absPath = getAbsolutePath(path, cwd); - - // Check `path` instead of `absPath` because the cwd portion can't be a glob - if (disableGlobbing || !isGlob(path)) { - return absPath; - } - return normalizePath(absPath); - }); - } - - // set aside negated glob strings - paths = paths.filter((path) => { - if (path.startsWith(BANG)) { - this._ignoredPaths.add(path.slice(1)); - return false; - } - - // if a path is being added that was previously ignored, stop ignoring it - this._ignoredPaths.delete(path); - this._ignoredPaths.delete(path + SLASH_GLOBSTAR); - - // reset the cached userIgnored anymatch fn - // to make ignoredPaths changes effective - this._userIgnored = undefined; - - return true; - }); - - if (this.options.useFsEvents && this._fsEventsHandler) { - if (!this._readyCount) this._readyCount = paths.length; - if (this.options.persistent) this._readyCount *= 2; - paths.forEach((path) => this._fsEventsHandler._addToFsEvents(path)); - } else { - if (!this._readyCount) this._readyCount = 0; - this._readyCount += paths.length; - Promise.all( - paths.map(async path => { - const res = await this._nodeFsHandler._addToNodeFs(path, !_internal, 0, 0, _origAdd); - if (res) this._emitReady(); - return res; - }) - ).then(results => { - if (this.closed) return; - results.filter(item => item).forEach(item => { - this.add(sysPath.dirname(item), sysPath.basename(_origAdd || item)); - }); - }); - } - - return this; -} - -/** - * Close watchers or start ignoring events from specified paths. - * @param {Path|Array} paths_ - string or array of strings, file/directory paths and/or globs - * @returns {FSWatcher} for chaining -*/ -unwatch(paths_) { - if (this.closed) return this; - const paths = unifyPaths(paths_); - const {cwd} = this.options; - - paths.forEach((path) => { - // convert to absolute path unless relative path already matches - if (!sysPath.isAbsolute(path) && !this._closers.has(path)) { - if (cwd) path = sysPath.join(cwd, path); - path = sysPath.resolve(path); - } - - this._closePath(path); - - this._ignoredPaths.add(path); - if (this._watched.has(path)) { - this._ignoredPaths.add(path + SLASH_GLOBSTAR); - } - - // reset the cached userIgnored anymatch fn - // to make ignoredPaths changes effective - this._userIgnored = undefined; - }); - - return this; -} - -/** - * Close watchers and remove all listeners from watched paths. - * @returns {Promise}. -*/ -close() { - if (this.closed) return this._closePromise; - this.closed = true; - - // Memory management. - this.removeAllListeners(); - const closers = []; - this._closers.forEach(closerList => closerList.forEach(closer => { - const promise = closer(); - if (promise instanceof Promise) closers.push(promise); - })); - this._streams.forEach(stream => stream.destroy()); - this._userIgnored = undefined; - this._readyCount = 0; - this._readyEmitted = false; - this._watched.forEach(dirent => dirent.dispose()); - ['closers', 'watched', 'streams', 'symlinkPaths', 'throttled'].forEach(key => { - this[`_${key}`].clear(); - }); - - this._closePromise = closers.length ? Promise.all(closers).then(() => undefined) : Promise.resolve(); - return this._closePromise; -} - -/** - * Expose list of watched paths - * @returns {Object} for chaining -*/ -getWatched() { - const watchList = {}; - this._watched.forEach((entry, dir) => { - const key = this.options.cwd ? sysPath.relative(this.options.cwd, dir) : dir; - watchList[key || ONE_DOT] = entry.getChildren().sort(); - }); - return watchList; -} - -emitWithAll(event, args) { - this.emit(...args); - if (event !== EV_ERROR) this.emit(EV_ALL, ...args); -} - -// Common helpers -// -------------- - -/** - * Normalize and emit events. - * Calling _emit DOES NOT MEAN emit() would be called! - * @param {EventName} event Type of event - * @param {Path} path File or directory path - * @param {*=} val1 arguments to be passed with event - * @param {*=} val2 - * @param {*=} val3 - * @returns the error if defined, otherwise the value of the FSWatcher instance's `closed` flag - */ -async _emit(event, path, val1, val2, val3) { - if (this.closed) return; - - const opts = this.options; - if (isWindows) path = sysPath.normalize(path); - if (opts.cwd) path = sysPath.relative(opts.cwd, path); - /** @type Array */ - const args = [event, path]; - if (val3 !== undefined) args.push(val1, val2, val3); - else if (val2 !== undefined) args.push(val1, val2); - else if (val1 !== undefined) args.push(val1); - - const awf = opts.awaitWriteFinish; - let pw; - if (awf && (pw = this._pendingWrites.get(path))) { - pw.lastChange = new Date(); - return this; - } - - if (opts.atomic) { - if (event === EV_UNLINK) { - this._pendingUnlinks.set(path, args); - setTimeout(() => { - this._pendingUnlinks.forEach((entry, path) => { - this.emit(...entry); - this.emit(EV_ALL, ...entry); - this._pendingUnlinks.delete(path); - }); - }, typeof opts.atomic === 'number' ? opts.atomic : 100); - return this; - } - if (event === EV_ADD && this._pendingUnlinks.has(path)) { - event = args[0] = EV_CHANGE; - this._pendingUnlinks.delete(path); - } - } - - if (awf && (event === EV_ADD || event === EV_CHANGE) && this._readyEmitted) { - const awfEmit = (err, stats) => { - if (err) { - event = args[0] = EV_ERROR; - args[1] = err; - this.emitWithAll(event, args); - } else if (stats) { - // if stats doesn't exist the file must have been deleted - if (args.length > 2) { - args[2] = stats; - } else { - args.push(stats); - } - this.emitWithAll(event, args); - } - }; - - this._awaitWriteFinish(path, awf.stabilityThreshold, event, awfEmit); - return this; - } - - if (event === EV_CHANGE) { - const isThrottled = !this._throttle(EV_CHANGE, path, 50); - if (isThrottled) return this; - } - - if (opts.alwaysStat && val1 === undefined && - (event === EV_ADD || event === EV_ADD_DIR || event === EV_CHANGE) - ) { - const fullPath = opts.cwd ? sysPath.join(opts.cwd, path) : path; - let stats; - try { - stats = await stat(fullPath); - } catch (err) {} - // Suppress event when fs_stat fails, to avoid sending undefined 'stat' - if (!stats || this.closed) return; - args.push(stats); - } - this.emitWithAll(event, args); - - return this; -} - -/** - * Common handler for errors - * @param {Error} error - * @returns {Error|Boolean} The error if defined, otherwise the value of the FSWatcher instance's `closed` flag - */ -_handleError(error) { - const code = error && error.code; - if (error && code !== 'ENOENT' && code !== 'ENOTDIR' && - (!this.options.ignorePermissionErrors || (code !== 'EPERM' && code !== 'EACCES')) - ) { - this.emit(EV_ERROR, error); - } - return error || this.closed; -} - -/** - * Helper utility for throttling - * @param {ThrottleType} actionType type being throttled - * @param {Path} path being acted upon - * @param {Number} timeout duration of time to suppress duplicate actions - * @returns {Object|false} tracking object or false if action should be suppressed - */ -_throttle(actionType, path, timeout) { - if (!this._throttled.has(actionType)) { - this._throttled.set(actionType, new Map()); - } - - /** @type {Map} */ - const action = this._throttled.get(actionType); - /** @type {Object} */ - const actionPath = action.get(path); - - if (actionPath) { - actionPath.count++; - return false; - } - - let timeoutObject; - const clear = () => { - const item = action.get(path); - const count = item ? item.count : 0; - action.delete(path); - clearTimeout(timeoutObject); - if (item) clearTimeout(item.timeoutObject); - return count; - }; - timeoutObject = setTimeout(clear, timeout); - const thr = {timeoutObject, clear, count: 0}; - action.set(path, thr); - return thr; -} - -_incrReadyCount() { - return this._readyCount++; -} - -/** - * Awaits write operation to finish. - * Polls a newly created file for size variations. When files size does not change for 'threshold' milliseconds calls callback. - * @param {Path} path being acted upon - * @param {Number} threshold Time in milliseconds a file size must be fixed before acknowledging write OP is finished - * @param {EventName} event - * @param {Function} awfEmit Callback to be called when ready for event to be emitted. - */ -_awaitWriteFinish(path, threshold, event, awfEmit) { - let timeoutHandler; - - let fullPath = path; - if (this.options.cwd && !sysPath.isAbsolute(path)) { - fullPath = sysPath.join(this.options.cwd, path); - } - - const now = new Date(); - - const awaitWriteFinish = (prevStat) => { - fs.stat(fullPath, (err, curStat) => { - if (err || !this._pendingWrites.has(path)) { - if (err && err.code !== 'ENOENT') awfEmit(err); - return; - } - - const now = Number(new Date()); - - if (prevStat && curStat.size !== prevStat.size) { - this._pendingWrites.get(path).lastChange = now; - } - const pw = this._pendingWrites.get(path); - const df = now - pw.lastChange; - - if (df >= threshold) { - this._pendingWrites.delete(path); - awfEmit(undefined, curStat); - } else { - timeoutHandler = setTimeout( - awaitWriteFinish, - this.options.awaitWriteFinish.pollInterval, - curStat - ); - } - }); - }; - - if (!this._pendingWrites.has(path)) { - this._pendingWrites.set(path, { - lastChange: now, - cancelWait: () => { - this._pendingWrites.delete(path); - clearTimeout(timeoutHandler); - return event; - } - }); - timeoutHandler = setTimeout( - awaitWriteFinish, - this.options.awaitWriteFinish.pollInterval - ); - } -} - -_getGlobIgnored() { - return [...this._ignoredPaths.values()]; -} - -/** - * Determines whether user has asked to ignore this path. - * @param {Path} path filepath or dir - * @param {fs.Stats=} stats result of fs.stat - * @returns {Boolean} - */ -_isIgnored(path, stats) { - if (this.options.atomic && DOT_RE.test(path)) return true; - if (!this._userIgnored) { - const {cwd} = this.options; - const ign = this.options.ignored; - - const ignored = ign && ign.map(normalizeIgnored(cwd)); - const paths = arrify(ignored) - .filter((path) => typeof path === STRING_TYPE && !isGlob(path)) - .map((path) => path + SLASH_GLOBSTAR); - const list = this._getGlobIgnored().map(normalizeIgnored(cwd)).concat(ignored, paths); - this._userIgnored = anymatch(list, undefined, ANYMATCH_OPTS); - } - - return this._userIgnored([path, stats]); -} - -_isntIgnored(path, stat) { - return !this._isIgnored(path, stat); -} - -/** - * Provides a set of common helpers and properties relating to symlink and glob handling. - * @param {Path} path file, directory, or glob pattern being watched - * @param {Number=} depth at any depth > 0, this isn't a glob - * @returns {WatchHelper} object containing helpers for this path - */ -_getWatchHelpers(path, depth) { - const watchPath = depth || this.options.disableGlobbing || !isGlob(path) ? path : globParent(path); - const follow = this.options.followSymlinks; - - return new WatchHelper(path, watchPath, follow, this); -} - -// Directory helpers -// ----------------- - -/** - * Provides directory tracking objects - * @param {String} directory path of the directory - * @returns {DirEntry} the directory's tracking object - */ -_getWatchedDir(directory) { - if (!this._boundRemove) this._boundRemove = this._remove.bind(this); - const dir = sysPath.resolve(directory); - if (!this._watched.has(dir)) this._watched.set(dir, new DirEntry(dir, this._boundRemove)); - return this._watched.get(dir); -} - -// File helpers -// ------------ - -/** - * Check for read permissions. - * Based on this answer on SO: https://stackoverflow.com/a/11781404/1358405 - * @param {fs.Stats} stats - object, result of fs_stat - * @returns {Boolean} indicates whether the file can be read -*/ -_hasReadPermissions(stats) { - if (this.options.ignorePermissionErrors) return true; - - // stats.mode may be bigint - const md = stats && Number.parseInt(stats.mode, 10); - const st = md & 0o777; - const it = Number.parseInt(st.toString(8)[0], 10); - return Boolean(4 & it); -} - -/** - * Handles emitting unlink events for - * files and directories, and via recursion, for - * files and directories within directories that are unlinked - * @param {String} directory within which the following item is located - * @param {String} item base path of item/directory - * @returns {void} -*/ -_remove(directory, item, isDirectory) { - // if what is being deleted is a directory, get that directory's paths - // for recursive deleting and cleaning of watched object - // if it is not a directory, nestedDirectoryChildren will be empty array - const path = sysPath.join(directory, item); - const fullPath = sysPath.resolve(path); - isDirectory = isDirectory != null - ? isDirectory - : this._watched.has(path) || this._watched.has(fullPath); - - // prevent duplicate handling in case of arriving here nearly simultaneously - // via multiple paths (such as _handleFile and _handleDir) - if (!this._throttle('remove', path, 100)) return; - - // if the only watched file is removed, watch for its return - if (!isDirectory && !this.options.useFsEvents && this._watched.size === 1) { - this.add(directory, item, true); - } - - // This will create a new entry in the watched object in either case - // so we got to do the directory check beforehand - const wp = this._getWatchedDir(path); - const nestedDirectoryChildren = wp.getChildren(); - - // Recursively remove children directories / files. - nestedDirectoryChildren.forEach(nested => this._remove(path, nested)); - - // Check if item was on the watched list and remove it - const parent = this._getWatchedDir(directory); - const wasTracked = parent.has(item); - parent.remove(item); - - // Fixes issue #1042 -> Relative paths were detected and added as symlinks - // (https://github.com/paulmillr/chokidar/blob/e1753ddbc9571bdc33b4a4af172d52cb6e611c10/lib/nodefs-handler.js#L612), - // but never removed from the map in case the path was deleted. - // This leads to an incorrect state if the path was recreated: - // https://github.com/paulmillr/chokidar/blob/e1753ddbc9571bdc33b4a4af172d52cb6e611c10/lib/nodefs-handler.js#L553 - if (this._symlinkPaths.has(fullPath)) { - this._symlinkPaths.delete(fullPath); - } - - // If we wait for this file to be fully written, cancel the wait. - let relPath = path; - if (this.options.cwd) relPath = sysPath.relative(this.options.cwd, path); - if (this.options.awaitWriteFinish && this._pendingWrites.has(relPath)) { - const event = this._pendingWrites.get(relPath).cancelWait(); - if (event === EV_ADD) return; - } - - // The Entry will either be a directory that just got removed - // or a bogus entry to a file, in either case we have to remove it - this._watched.delete(path); - this._watched.delete(fullPath); - const eventName = isDirectory ? EV_UNLINK_DIR : EV_UNLINK; - if (wasTracked && !this._isIgnored(path)) this._emit(eventName, path); - - // Avoid conflicts if we later create another file with the same name - if (!this.options.useFsEvents) { - this._closePath(path); - } -} - -/** - * Closes all watchers for a path - * @param {Path} path - */ -_closePath(path) { - this._closeFile(path) - const dir = sysPath.dirname(path); - this._getWatchedDir(dir).remove(sysPath.basename(path)); -} - -/** - * Closes only file-specific watchers - * @param {Path} path - */ -_closeFile(path) { - const closers = this._closers.get(path); - if (!closers) return; - closers.forEach(closer => closer()); - this._closers.delete(path); -} - -/** - * - * @param {Path} path - * @param {Function} closer - */ -_addPathCloser(path, closer) { - if (!closer) return; - let list = this._closers.get(path); - if (!list) { - list = []; - this._closers.set(path, list); - } - list.push(closer); -} - -_readdirp(root, opts) { - if (this.closed) return; - const options = {type: EV_ALL, alwaysStat: true, lstat: true, ...opts}; - let stream = readdirp(root, options); - this._streams.add(stream); - stream.once(STR_CLOSE, () => { - stream = undefined; - }); - stream.once(STR_END, () => { - if (stream) { - this._streams.delete(stream); - stream = undefined; - } - }); - return stream; -} - -} - -// Export FSWatcher class -exports.FSWatcher = FSWatcher; - -/** - * Instantiates watcher with paths to be tracked. - * @param {String|Array} paths file/directory paths and/or globs - * @param {Object=} options chokidar opts - * @returns an instance of FSWatcher for chaining. - */ -const watch = (paths, options) => { - const watcher = new FSWatcher(options); - watcher.add(paths); - return watcher; -}; - -exports.watch = watch; diff --git a/server/node_modules/chokidar/lib/constants.js b/server/node_modules/chokidar/lib/constants.js deleted file mode 100644 index 84c2d98..0000000 --- a/server/node_modules/chokidar/lib/constants.js +++ /dev/null @@ -1,63 +0,0 @@ -'use strict'; - -const {sep} = require('path'); -const {platform} = process; - -exports.EV_ALL = 'all'; -exports.EV_READY = 'ready'; -exports.EV_ADD = 'add'; -exports.EV_CHANGE = 'change'; -exports.EV_ADD_DIR = 'addDir'; -exports.EV_UNLINK = 'unlink'; -exports.EV_UNLINK_DIR = 'unlinkDir'; -exports.EV_RAW = 'raw'; -exports.EV_ERROR = 'error'; - -exports.STR_DATA = 'data'; -exports.STR_END = 'end'; -exports.STR_CLOSE = 'close'; - -exports.FSEVENT_CREATED = 'created'; -exports.FSEVENT_MODIFIED = 'modified'; -exports.FSEVENT_DELETED = 'deleted'; -exports.FSEVENT_MOVED = 'moved'; -exports.FSEVENT_CLONED = 'cloned'; -exports.FSEVENT_UNKNOWN = 'unknown'; -exports.FSEVENT_TYPE_FILE = 'file'; -exports.FSEVENT_TYPE_DIRECTORY = 'directory'; -exports.FSEVENT_TYPE_SYMLINK = 'symlink'; - -exports.KEY_LISTENERS = 'listeners'; -exports.KEY_ERR = 'errHandlers'; -exports.KEY_RAW = 'rawEmitters'; -exports.HANDLER_KEYS = [exports.KEY_LISTENERS, exports.KEY_ERR, exports.KEY_RAW]; - -exports.DOT_SLASH = `.${sep}`; - -exports.BACK_SLASH_RE = /\\/g; -exports.DOUBLE_SLASH_RE = /\/\//; -exports.SLASH_OR_BACK_SLASH_RE = /[/\\]/; -exports.DOT_RE = /\..*\.(sw[px])$|~$|\.subl.*\.tmp/; -exports.REPLACER_RE = /^\.[/\\]/; - -exports.SLASH = '/'; -exports.SLASH_SLASH = '//'; -exports.BRACE_START = '{'; -exports.BANG = '!'; -exports.ONE_DOT = '.'; -exports.TWO_DOTS = '..'; -exports.STAR = '*'; -exports.GLOBSTAR = '**'; -exports.ROOT_GLOBSTAR = '/**/*'; -exports.SLASH_GLOBSTAR = '/**'; -exports.DIR_SUFFIX = 'Dir'; -exports.ANYMATCH_OPTS = {dot: true}; -exports.STRING_TYPE = 'string'; -exports.FUNCTION_TYPE = 'function'; -exports.EMPTY_STR = ''; -exports.EMPTY_FN = () => {}; -exports.IDENTITY_FN = val => val; - -exports.isWindows = platform === 'win32'; -exports.isMacos = platform === 'darwin'; -exports.isLinux = platform === 'linux'; diff --git a/server/node_modules/chokidar/lib/fsevents-handler.js b/server/node_modules/chokidar/lib/fsevents-handler.js deleted file mode 100644 index 5c84bad..0000000 --- a/server/node_modules/chokidar/lib/fsevents-handler.js +++ /dev/null @@ -1,523 +0,0 @@ -'use strict'; - -const fs = require('fs'); -const sysPath = require('path'); -const { promisify } = require('util'); - -let fsevents; -try { - fsevents = require('fsevents'); -} catch (error) { - if (process.env.CHOKIDAR_PRINT_FSEVENTS_REQUIRE_ERROR) console.error(error); -} - -if (fsevents) { - // TODO: real check - const mtch = process.version.match(/v(\d+)\.(\d+)/); - if (mtch && mtch[1] && mtch[2]) { - const maj = Number.parseInt(mtch[1], 10); - const min = Number.parseInt(mtch[2], 10); - if (maj === 8 && min < 16) { - fsevents = undefined; - } - } -} - -const { - EV_ADD, - EV_CHANGE, - EV_ADD_DIR, - EV_UNLINK, - EV_ERROR, - STR_DATA, - STR_END, - FSEVENT_CREATED, - FSEVENT_MODIFIED, - FSEVENT_DELETED, - FSEVENT_MOVED, - // FSEVENT_CLONED, - FSEVENT_UNKNOWN, - FSEVENT_TYPE_FILE, - FSEVENT_TYPE_DIRECTORY, - FSEVENT_TYPE_SYMLINK, - - ROOT_GLOBSTAR, - DIR_SUFFIX, - DOT_SLASH, - FUNCTION_TYPE, - EMPTY_FN, - IDENTITY_FN -} = require('./constants'); - -const Depth = (value) => isNaN(value) ? {} : {depth: value}; - -const stat = promisify(fs.stat); -const lstat = promisify(fs.lstat); -const realpath = promisify(fs.realpath); - -const statMethods = { stat, lstat }; - -/** - * @typedef {String} Path - */ - -/** - * @typedef {Object} FsEventsWatchContainer - * @property {Set} listeners - * @property {Function} rawEmitter - * @property {{stop: Function}} watcher - */ - -// fsevents instance helper functions -/** - * Object to hold per-process fsevents instances (may be shared across chokidar FSWatcher instances) - * @type {Map} - */ -const FSEventsWatchers = new Map(); - -// Threshold of duplicate path prefixes at which to start -// consolidating going forward -const consolidateThreshhold = 10; - -const wrongEventFlags = new Set([ - 69888, 70400, 71424, 72704, 73472, 131328, 131840, 262912 -]); - -/** - * Instantiates the fsevents interface - * @param {Path} path path to be watched - * @param {Function} callback called when fsevents is bound and ready - * @returns {{stop: Function}} new fsevents instance - */ -const createFSEventsInstance = (path, callback) => { - const stop = fsevents.watch(path, callback); - return {stop}; -}; - -/** - * Instantiates the fsevents interface or binds listeners to an existing one covering - * the same file tree. - * @param {Path} path - to be watched - * @param {Path} realPath - real path for symlinks - * @param {Function} listener - called when fsevents emits events - * @param {Function} rawEmitter - passes data to listeners of the 'raw' event - * @returns {Function} closer - */ -function setFSEventsListener(path, realPath, listener, rawEmitter) { - let watchPath = sysPath.extname(path) ? sysPath.dirname(path) : path; - const parentPath = sysPath.dirname(watchPath); - let cont = FSEventsWatchers.get(watchPath); - - // If we've accumulated a substantial number of paths that - // could have been consolidated by watching one directory - // above the current one, create a watcher on the parent - // path instead, so that we do consolidate going forward. - if (couldConsolidate(parentPath)) { - watchPath = parentPath; - } - - const resolvedPath = sysPath.resolve(path); - const hasSymlink = resolvedPath !== realPath; - - const filteredListener = (fullPath, flags, info) => { - if (hasSymlink) fullPath = fullPath.replace(realPath, resolvedPath); - if ( - fullPath === resolvedPath || - !fullPath.indexOf(resolvedPath + sysPath.sep) - ) listener(fullPath, flags, info); - }; - - // check if there is already a watcher on a parent path - // modifies `watchPath` to the parent path when it finds a match - let watchedParent = false; - for (const watchedPath of FSEventsWatchers.keys()) { - if (realPath.indexOf(sysPath.resolve(watchedPath) + sysPath.sep) === 0) { - watchPath = watchedPath; - cont = FSEventsWatchers.get(watchPath); - watchedParent = true; - break; - } - } - - if (cont || watchedParent) { - cont.listeners.add(filteredListener); - } else { - cont = { - listeners: new Set([filteredListener]), - rawEmitter, - watcher: createFSEventsInstance(watchPath, (fullPath, flags) => { - if (!cont.listeners.size) return; - const info = fsevents.getInfo(fullPath, flags); - cont.listeners.forEach(list => { - list(fullPath, flags, info); - }); - - cont.rawEmitter(info.event, fullPath, info); - }) - }; - FSEventsWatchers.set(watchPath, cont); - } - - // removes this instance's listeners and closes the underlying fsevents - // instance if there are no more listeners left - return () => { - const lst = cont.listeners; - - lst.delete(filteredListener); - if (!lst.size) { - FSEventsWatchers.delete(watchPath); - if (cont.watcher) return cont.watcher.stop().then(() => { - cont.rawEmitter = cont.watcher = undefined; - Object.freeze(cont); - }); - } - }; -} - -// Decide whether or not we should start a new higher-level -// parent watcher -const couldConsolidate = (path) => { - let count = 0; - for (const watchPath of FSEventsWatchers.keys()) { - if (watchPath.indexOf(path) === 0) { - count++; - if (count >= consolidateThreshhold) { - return true; - } - } - } - - return false; -}; - -// returns boolean indicating whether fsevents can be used -const canUse = () => fsevents && FSEventsWatchers.size < 128; - -// determines subdirectory traversal levels from root to path -const calcDepth = (path, root) => { - let i = 0; - while (!path.indexOf(root) && (path = sysPath.dirname(path)) !== root) i++; - return i; -}; - -// returns boolean indicating whether the fsevents' event info has the same type -// as the one returned by fs.stat -const sameTypes = (info, stats) => ( - info.type === FSEVENT_TYPE_DIRECTORY && stats.isDirectory() || - info.type === FSEVENT_TYPE_SYMLINK && stats.isSymbolicLink() || - info.type === FSEVENT_TYPE_FILE && stats.isFile() -) - -/** - * @mixin - */ -class FsEventsHandler { - -/** - * @param {import('../index').FSWatcher} fsw - */ -constructor(fsw) { - this.fsw = fsw; -} -checkIgnored(path, stats) { - const ipaths = this.fsw._ignoredPaths; - if (this.fsw._isIgnored(path, stats)) { - ipaths.add(path); - if (stats && stats.isDirectory()) { - ipaths.add(path + ROOT_GLOBSTAR); - } - return true; - } - - ipaths.delete(path); - ipaths.delete(path + ROOT_GLOBSTAR); -} - -addOrChange(path, fullPath, realPath, parent, watchedDir, item, info, opts) { - const event = watchedDir.has(item) ? EV_CHANGE : EV_ADD; - this.handleEvent(event, path, fullPath, realPath, parent, watchedDir, item, info, opts); -} - -async checkExists(path, fullPath, realPath, parent, watchedDir, item, info, opts) { - try { - const stats = await stat(path) - if (this.fsw.closed) return; - if (sameTypes(info, stats)) { - this.addOrChange(path, fullPath, realPath, parent, watchedDir, item, info, opts); - } else { - this.handleEvent(EV_UNLINK, path, fullPath, realPath, parent, watchedDir, item, info, opts); - } - } catch (error) { - if (error.code === 'EACCES') { - this.addOrChange(path, fullPath, realPath, parent, watchedDir, item, info, opts); - } else { - this.handleEvent(EV_UNLINK, path, fullPath, realPath, parent, watchedDir, item, info, opts); - } - } -} - -handleEvent(event, path, fullPath, realPath, parent, watchedDir, item, info, opts) { - if (this.fsw.closed || this.checkIgnored(path)) return; - - if (event === EV_UNLINK) { - const isDirectory = info.type === FSEVENT_TYPE_DIRECTORY - // suppress unlink events on never before seen files - if (isDirectory || watchedDir.has(item)) { - this.fsw._remove(parent, item, isDirectory); - } - } else { - if (event === EV_ADD) { - // track new directories - if (info.type === FSEVENT_TYPE_DIRECTORY) this.fsw._getWatchedDir(path); - - if (info.type === FSEVENT_TYPE_SYMLINK && opts.followSymlinks) { - // push symlinks back to the top of the stack to get handled - const curDepth = opts.depth === undefined ? - undefined : calcDepth(fullPath, realPath) + 1; - return this._addToFsEvents(path, false, true, curDepth); - } - - // track new paths - // (other than symlinks being followed, which will be tracked soon) - this.fsw._getWatchedDir(parent).add(item); - } - /** - * @type {'add'|'addDir'|'unlink'|'unlinkDir'} - */ - const eventName = info.type === FSEVENT_TYPE_DIRECTORY ? event + DIR_SUFFIX : event; - this.fsw._emit(eventName, path); - if (eventName === EV_ADD_DIR) this._addToFsEvents(path, false, true); - } -} - -/** - * Handle symlinks encountered during directory scan - * @param {String} watchPath - file/dir path to be watched with fsevents - * @param {String} realPath - real path (in case of symlinks) - * @param {Function} transform - path transformer - * @param {Function} globFilter - path filter in case a glob pattern was provided - * @returns {Function} closer for the watcher instance -*/ -_watchWithFsEvents(watchPath, realPath, transform, globFilter) { - if (this.fsw.closed || this.fsw._isIgnored(watchPath)) return; - const opts = this.fsw.options; - const watchCallback = async (fullPath, flags, info) => { - if (this.fsw.closed) return; - if ( - opts.depth !== undefined && - calcDepth(fullPath, realPath) > opts.depth - ) return; - const path = transform(sysPath.join( - watchPath, sysPath.relative(watchPath, fullPath) - )); - if (globFilter && !globFilter(path)) return; - // ensure directories are tracked - const parent = sysPath.dirname(path); - const item = sysPath.basename(path); - const watchedDir = this.fsw._getWatchedDir( - info.type === FSEVENT_TYPE_DIRECTORY ? path : parent - ); - - // correct for wrong events emitted - if (wrongEventFlags.has(flags) || info.event === FSEVENT_UNKNOWN) { - if (typeof opts.ignored === FUNCTION_TYPE) { - let stats; - try { - stats = await stat(path); - } catch (error) {} - if (this.fsw.closed) return; - if (this.checkIgnored(path, stats)) return; - if (sameTypes(info, stats)) { - this.addOrChange(path, fullPath, realPath, parent, watchedDir, item, info, opts); - } else { - this.handleEvent(EV_UNLINK, path, fullPath, realPath, parent, watchedDir, item, info, opts); - } - } else { - this.checkExists(path, fullPath, realPath, parent, watchedDir, item, info, opts); - } - } else { - switch (info.event) { - case FSEVENT_CREATED: - case FSEVENT_MODIFIED: - return this.addOrChange(path, fullPath, realPath, parent, watchedDir, item, info, opts); - case FSEVENT_DELETED: - case FSEVENT_MOVED: - return this.checkExists(path, fullPath, realPath, parent, watchedDir, item, info, opts); - } - } - }; - - const closer = setFSEventsListener( - watchPath, - realPath, - watchCallback, - this.fsw._emitRaw - ); - - this.fsw._emitReady(); - return closer; -} - -/** - * Handle symlinks encountered during directory scan - * @param {String} linkPath path to symlink - * @param {String} fullPath absolute path to the symlink - * @param {Function} transform pre-existing path transformer - * @param {Number} curDepth level of subdirectories traversed to where symlink is - * @returns {Promise} - */ -async _handleFsEventsSymlink(linkPath, fullPath, transform, curDepth) { - // don't follow the same symlink more than once - if (this.fsw.closed || this.fsw._symlinkPaths.has(fullPath)) return; - - this.fsw._symlinkPaths.set(fullPath, true); - this.fsw._incrReadyCount(); - - try { - const linkTarget = await realpath(linkPath); - if (this.fsw.closed) return; - if (this.fsw._isIgnored(linkTarget)) { - return this.fsw._emitReady(); - } - - this.fsw._incrReadyCount(); - - // add the linkTarget for watching with a wrapper for transform - // that causes emitted paths to incorporate the link's path - this._addToFsEvents(linkTarget || linkPath, (path) => { - let aliasedPath = linkPath; - if (linkTarget && linkTarget !== DOT_SLASH) { - aliasedPath = path.replace(linkTarget, linkPath); - } else if (path !== DOT_SLASH) { - aliasedPath = sysPath.join(linkPath, path); - } - return transform(aliasedPath); - }, false, curDepth); - } catch(error) { - if (this.fsw._handleError(error)) { - return this.fsw._emitReady(); - } - } -} - -/** - * - * @param {Path} newPath - * @param {fs.Stats} stats - */ -emitAdd(newPath, stats, processPath, opts, forceAdd) { - const pp = processPath(newPath); - const isDir = stats.isDirectory(); - const dirObj = this.fsw._getWatchedDir(sysPath.dirname(pp)); - const base = sysPath.basename(pp); - - // ensure empty dirs get tracked - if (isDir) this.fsw._getWatchedDir(pp); - if (dirObj.has(base)) return; - dirObj.add(base); - - if (!opts.ignoreInitial || forceAdd === true) { - this.fsw._emit(isDir ? EV_ADD_DIR : EV_ADD, pp, stats); - } -} - -initWatch(realPath, path, wh, processPath) { - if (this.fsw.closed) return; - const closer = this._watchWithFsEvents( - wh.watchPath, - sysPath.resolve(realPath || wh.watchPath), - processPath, - wh.globFilter - ); - this.fsw._addPathCloser(path, closer); -} - -/** - * Handle added path with fsevents - * @param {String} path file/dir path or glob pattern - * @param {Function|Boolean=} transform converts working path to what the user expects - * @param {Boolean=} forceAdd ensure add is emitted - * @param {Number=} priorDepth Level of subdirectories already traversed. - * @returns {Promise} - */ -async _addToFsEvents(path, transform, forceAdd, priorDepth) { - if (this.fsw.closed) { - return; - } - const opts = this.fsw.options; - const processPath = typeof transform === FUNCTION_TYPE ? transform : IDENTITY_FN; - - const wh = this.fsw._getWatchHelpers(path); - - // evaluate what is at the path we're being asked to watch - try { - const stats = await statMethods[wh.statMethod](wh.watchPath); - if (this.fsw.closed) return; - if (this.fsw._isIgnored(wh.watchPath, stats)) { - throw null; - } - if (stats.isDirectory()) { - // emit addDir unless this is a glob parent - if (!wh.globFilter) this.emitAdd(processPath(path), stats, processPath, opts, forceAdd); - - // don't recurse further if it would exceed depth setting - if (priorDepth && priorDepth > opts.depth) return; - - // scan the contents of the dir - this.fsw._readdirp(wh.watchPath, { - fileFilter: entry => wh.filterPath(entry), - directoryFilter: entry => wh.filterDir(entry), - ...Depth(opts.depth - (priorDepth || 0)) - }).on(STR_DATA, (entry) => { - // need to check filterPath on dirs b/c filterDir is less restrictive - if (this.fsw.closed) { - return; - } - if (entry.stats.isDirectory() && !wh.filterPath(entry)) return; - - const joinedPath = sysPath.join(wh.watchPath, entry.path); - const {fullPath} = entry; - - if (wh.followSymlinks && entry.stats.isSymbolicLink()) { - // preserve the current depth here since it can't be derived from - // real paths past the symlink - const curDepth = opts.depth === undefined ? - undefined : calcDepth(joinedPath, sysPath.resolve(wh.watchPath)) + 1; - - this._handleFsEventsSymlink(joinedPath, fullPath, processPath, curDepth); - } else { - this.emitAdd(joinedPath, entry.stats, processPath, opts, forceAdd); - } - }).on(EV_ERROR, EMPTY_FN).on(STR_END, () => { - this.fsw._emitReady(); - }); - } else { - this.emitAdd(wh.watchPath, stats, processPath, opts, forceAdd); - this.fsw._emitReady(); - } - } catch (error) { - if (!error || this.fsw._handleError(error)) { - // TODO: Strange thing: "should not choke on an ignored watch path" will be failed without 2 ready calls -__- - this.fsw._emitReady(); - this.fsw._emitReady(); - } - } - - if (opts.persistent && forceAdd !== true) { - if (typeof transform === FUNCTION_TYPE) { - // realpath has already been resolved - this.initWatch(undefined, path, wh, processPath); - } else { - let realPath; - try { - realPath = await realpath(wh.watchPath); - } catch (e) {} - this.initWatch(realPath, path, wh, processPath); - } - } -} - -} - -module.exports = FsEventsHandler; -module.exports.canUse = canUse; diff --git a/server/node_modules/chokidar/lib/nodefs-handler.js b/server/node_modules/chokidar/lib/nodefs-handler.js deleted file mode 100644 index 3a39643..0000000 --- a/server/node_modules/chokidar/lib/nodefs-handler.js +++ /dev/null @@ -1,646 +0,0 @@ -'use strict'; - -const fs = require('fs'); -const sysPath = require('path'); -const { promisify } = require('util'); -const isBinaryPath = require('is-binary-path'); -const { - isWindows, - isLinux, - EMPTY_FN, - EMPTY_STR, - KEY_LISTENERS, - KEY_ERR, - KEY_RAW, - HANDLER_KEYS, - EV_CHANGE, - EV_ADD, - EV_ADD_DIR, - EV_ERROR, - STR_DATA, - STR_END, - BRACE_START, - STAR -} = require('./constants'); - -const THROTTLE_MODE_WATCH = 'watch'; - -const open = promisify(fs.open); -const stat = promisify(fs.stat); -const lstat = promisify(fs.lstat); -const close = promisify(fs.close); -const fsrealpath = promisify(fs.realpath); - -const statMethods = { lstat, stat }; - -// TODO: emit errors properly. Example: EMFILE on Macos. -const foreach = (val, fn) => { - if (val instanceof Set) { - val.forEach(fn); - } else { - fn(val); - } -}; - -const addAndConvert = (main, prop, item) => { - let container = main[prop]; - if (!(container instanceof Set)) { - main[prop] = container = new Set([container]); - } - container.add(item); -}; - -const clearItem = cont => key => { - const set = cont[key]; - if (set instanceof Set) { - set.clear(); - } else { - delete cont[key]; - } -}; - -const delFromSet = (main, prop, item) => { - const container = main[prop]; - if (container instanceof Set) { - container.delete(item); - } else if (container === item) { - delete main[prop]; - } -}; - -const isEmptySet = (val) => val instanceof Set ? val.size === 0 : !val; - -/** - * @typedef {String} Path - */ - -// fs_watch helpers - -// object to hold per-process fs_watch instances -// (may be shared across chokidar FSWatcher instances) - -/** - * @typedef {Object} FsWatchContainer - * @property {Set} listeners - * @property {Set} errHandlers - * @property {Set} rawEmitters - * @property {fs.FSWatcher=} watcher - * @property {Boolean=} watcherUnusable - */ - -/** - * @type {Map} - */ -const FsWatchInstances = new Map(); - -/** - * Instantiates the fs_watch interface - * @param {String} path to be watched - * @param {Object} options to be passed to fs_watch - * @param {Function} listener main event handler - * @param {Function} errHandler emits info about errors - * @param {Function} emitRaw emits raw event data - * @returns {fs.FSWatcher} new fsevents instance - */ -function createFsWatchInstance(path, options, listener, errHandler, emitRaw) { - const handleEvent = (rawEvent, evPath) => { - listener(path); - emitRaw(rawEvent, evPath, {watchedPath: path}); - - // emit based on events occurring for files from a directory's watcher in - // case the file's watcher misses it (and rely on throttling to de-dupe) - if (evPath && path !== evPath) { - fsWatchBroadcast( - sysPath.resolve(path, evPath), KEY_LISTENERS, sysPath.join(path, evPath) - ); - } - }; - try { - return fs.watch(path, options, handleEvent); - } catch (error) { - errHandler(error); - } -} - -/** - * Helper for passing fs_watch event data to a collection of listeners - * @param {Path} fullPath absolute path bound to fs_watch instance - * @param {String} type listener type - * @param {*=} val1 arguments to be passed to listeners - * @param {*=} val2 - * @param {*=} val3 - */ -const fsWatchBroadcast = (fullPath, type, val1, val2, val3) => { - const cont = FsWatchInstances.get(fullPath); - if (!cont) return; - foreach(cont[type], (listener) => { - listener(val1, val2, val3); - }); -}; - -/** - * Instantiates the fs_watch interface or binds listeners - * to an existing one covering the same file system entry - * @param {String} path - * @param {String} fullPath absolute path - * @param {Object} options to be passed to fs_watch - * @param {Object} handlers container for event listener functions - */ -const setFsWatchListener = (path, fullPath, options, handlers) => { - const {listener, errHandler, rawEmitter} = handlers; - let cont = FsWatchInstances.get(fullPath); - - /** @type {fs.FSWatcher=} */ - let watcher; - if (!options.persistent) { - watcher = createFsWatchInstance( - path, options, listener, errHandler, rawEmitter - ); - return watcher.close.bind(watcher); - } - if (cont) { - addAndConvert(cont, KEY_LISTENERS, listener); - addAndConvert(cont, KEY_ERR, errHandler); - addAndConvert(cont, KEY_RAW, rawEmitter); - } else { - watcher = createFsWatchInstance( - path, - options, - fsWatchBroadcast.bind(null, fullPath, KEY_LISTENERS), - errHandler, // no need to use broadcast here - fsWatchBroadcast.bind(null, fullPath, KEY_RAW) - ); - if (!watcher) return; - watcher.on(EV_ERROR, async (error) => { - const broadcastErr = fsWatchBroadcast.bind(null, fullPath, KEY_ERR); - cont.watcherUnusable = true; // documented since Node 10.4.1 - // Workaround for https://github.com/joyent/node/issues/4337 - if (isWindows && error.code === 'EPERM') { - try { - const fd = await open(path, 'r'); - await close(fd); - broadcastErr(error); - } catch (err) {} - } else { - broadcastErr(error); - } - }); - cont = { - listeners: listener, - errHandlers: errHandler, - rawEmitters: rawEmitter, - watcher - }; - FsWatchInstances.set(fullPath, cont); - } - // const index = cont.listeners.indexOf(listener); - - // removes this instance's listeners and closes the underlying fs_watch - // instance if there are no more listeners left - return () => { - delFromSet(cont, KEY_LISTENERS, listener); - delFromSet(cont, KEY_ERR, errHandler); - delFromSet(cont, KEY_RAW, rawEmitter); - if (isEmptySet(cont.listeners)) { - // Check to protect against issue gh-730. - // if (cont.watcherUnusable) { - cont.watcher.close(); - // } - FsWatchInstances.delete(fullPath); - HANDLER_KEYS.forEach(clearItem(cont)); - cont.watcher = undefined; - Object.freeze(cont); - } - }; -}; - -// fs_watchFile helpers - -// object to hold per-process fs_watchFile instances -// (may be shared across chokidar FSWatcher instances) -const FsWatchFileInstances = new Map(); - -/** - * Instantiates the fs_watchFile interface or binds listeners - * to an existing one covering the same file system entry - * @param {String} path to be watched - * @param {String} fullPath absolute path - * @param {Object} options options to be passed to fs_watchFile - * @param {Object} handlers container for event listener functions - * @returns {Function} closer - */ -const setFsWatchFileListener = (path, fullPath, options, handlers) => { - const {listener, rawEmitter} = handlers; - let cont = FsWatchFileInstances.get(fullPath); - - /* eslint-disable no-unused-vars, prefer-destructuring */ - let listeners = new Set(); - let rawEmitters = new Set(); - - const copts = cont && cont.options; - if (copts && (copts.persistent < options.persistent || copts.interval > options.interval)) { - // "Upgrade" the watcher to persistence or a quicker interval. - // This creates some unlikely edge case issues if the user mixes - // settings in a very weird way, but solving for those cases - // doesn't seem worthwhile for the added complexity. - listeners = cont.listeners; - rawEmitters = cont.rawEmitters; - fs.unwatchFile(fullPath); - cont = undefined; - } - - /* eslint-enable no-unused-vars, prefer-destructuring */ - - if (cont) { - addAndConvert(cont, KEY_LISTENERS, listener); - addAndConvert(cont, KEY_RAW, rawEmitter); - } else { - // TODO - // listeners.add(listener); - // rawEmitters.add(rawEmitter); - cont = { - listeners: listener, - rawEmitters: rawEmitter, - options, - watcher: fs.watchFile(fullPath, options, (curr, prev) => { - foreach(cont.rawEmitters, (rawEmitter) => { - rawEmitter(EV_CHANGE, fullPath, {curr, prev}); - }); - const currmtime = curr.mtimeMs; - if (curr.size !== prev.size || currmtime > prev.mtimeMs || currmtime === 0) { - foreach(cont.listeners, (listener) => listener(path, curr)); - } - }) - }; - FsWatchFileInstances.set(fullPath, cont); - } - // const index = cont.listeners.indexOf(listener); - - // Removes this instance's listeners and closes the underlying fs_watchFile - // instance if there are no more listeners left. - return () => { - delFromSet(cont, KEY_LISTENERS, listener); - delFromSet(cont, KEY_RAW, rawEmitter); - if (isEmptySet(cont.listeners)) { - FsWatchFileInstances.delete(fullPath); - fs.unwatchFile(fullPath); - cont.options = cont.watcher = undefined; - Object.freeze(cont); - } - }; -}; - -/** - * @mixin - */ -class NodeFsHandler { - -/** - * @param {import("../index").FSWatcher} fsW - */ -constructor(fsW) { - this.fsw = fsW; - this._boundHandleError = (error) => fsW._handleError(error); -} - -/** - * Watch file for changes with fs_watchFile or fs_watch. - * @param {String} path to file or dir - * @param {Function} listener on fs change - * @returns {Function} closer for the watcher instance - */ -_watchWithNodeFs(path, listener) { - const opts = this.fsw.options; - const directory = sysPath.dirname(path); - const basename = sysPath.basename(path); - const parent = this.fsw._getWatchedDir(directory); - parent.add(basename); - const absolutePath = sysPath.resolve(path); - const options = {persistent: opts.persistent}; - if (!listener) listener = EMPTY_FN; - - let closer; - if (opts.usePolling) { - options.interval = opts.enableBinaryInterval && isBinaryPath(basename) ? - opts.binaryInterval : opts.interval; - closer = setFsWatchFileListener(path, absolutePath, options, { - listener, - rawEmitter: this.fsw._emitRaw - }); - } else { - closer = setFsWatchListener(path, absolutePath, options, { - listener, - errHandler: this._boundHandleError, - rawEmitter: this.fsw._emitRaw - }); - } - return closer; -} - -/** - * Watch a file and emit add event if warranted. - * @param {Path} file Path - * @param {fs.Stats} stats result of fs_stat - * @param {Boolean} initialAdd was the file added at watch instantiation? - * @returns {Function} closer for the watcher instance - */ -_handleFile(file, stats, initialAdd) { - if (this.fsw.closed) { - return; - } - const dirname = sysPath.dirname(file); - const basename = sysPath.basename(file); - const parent = this.fsw._getWatchedDir(dirname); - // stats is always present - let prevStats = stats; - - // if the file is already being watched, do nothing - if (parent.has(basename)) return; - - const listener = async (path, newStats) => { - if (!this.fsw._throttle(THROTTLE_MODE_WATCH, file, 5)) return; - if (!newStats || newStats.mtimeMs === 0) { - try { - const newStats = await stat(file); - if (this.fsw.closed) return; - // Check that change event was not fired because of changed only accessTime. - const at = newStats.atimeMs; - const mt = newStats.mtimeMs; - if (!at || at <= mt || mt !== prevStats.mtimeMs) { - this.fsw._emit(EV_CHANGE, file, newStats); - } - if (isLinux && prevStats.ino !== newStats.ino) { - this.fsw._closeFile(path) - prevStats = newStats; - this.fsw._addPathCloser(path, this._watchWithNodeFs(file, listener)); - } else { - prevStats = newStats; - } - } catch (error) { - // Fix issues where mtime is null but file is still present - this.fsw._remove(dirname, basename); - } - // add is about to be emitted if file not already tracked in parent - } else if (parent.has(basename)) { - // Check that change event was not fired because of changed only accessTime. - const at = newStats.atimeMs; - const mt = newStats.mtimeMs; - if (!at || at <= mt || mt !== prevStats.mtimeMs) { - this.fsw._emit(EV_CHANGE, file, newStats); - } - prevStats = newStats; - } - } - // kick off the watcher - const closer = this._watchWithNodeFs(file, listener); - - // emit an add event if we're supposed to - if (!(initialAdd && this.fsw.options.ignoreInitial) && this.fsw._isntIgnored(file)) { - if (!this.fsw._throttle(EV_ADD, file, 0)) return; - this.fsw._emit(EV_ADD, file, stats); - } - - return closer; -} - -/** - * Handle symlinks encountered while reading a dir. - * @param {Object} entry returned by readdirp - * @param {String} directory path of dir being read - * @param {String} path of this item - * @param {String} item basename of this item - * @returns {Promise} true if no more processing is needed for this entry. - */ -async _handleSymlink(entry, directory, path, item) { - if (this.fsw.closed) { - return; - } - const full = entry.fullPath; - const dir = this.fsw._getWatchedDir(directory); - - if (!this.fsw.options.followSymlinks) { - // watch symlink directly (don't follow) and detect changes - this.fsw._incrReadyCount(); - const linkPath = await fsrealpath(path); - if (this.fsw.closed) return; - if (dir.has(item)) { - if (this.fsw._symlinkPaths.get(full) !== linkPath) { - this.fsw._symlinkPaths.set(full, linkPath); - this.fsw._emit(EV_CHANGE, path, entry.stats); - } - } else { - dir.add(item); - this.fsw._symlinkPaths.set(full, linkPath); - this.fsw._emit(EV_ADD, path, entry.stats); - } - this.fsw._emitReady(); - return true; - } - - // don't follow the same symlink more than once - if (this.fsw._symlinkPaths.has(full)) { - return true; - } - - this.fsw._symlinkPaths.set(full, true); -} - -_handleRead(directory, initialAdd, wh, target, dir, depth, throttler) { - // Normalize the directory name on Windows - directory = sysPath.join(directory, EMPTY_STR); - - if (!wh.hasGlob) { - throttler = this.fsw._throttle('readdir', directory, 1000); - if (!throttler) return; - } - - const previous = this.fsw._getWatchedDir(wh.path); - const current = new Set(); - - let stream = this.fsw._readdirp(directory, { - fileFilter: entry => wh.filterPath(entry), - directoryFilter: entry => wh.filterDir(entry), - depth: 0 - }).on(STR_DATA, async (entry) => { - if (this.fsw.closed) { - stream = undefined; - return; - } - const item = entry.path; - let path = sysPath.join(directory, item); - current.add(item); - - if (entry.stats.isSymbolicLink() && await this._handleSymlink(entry, directory, path, item)) { - return; - } - - if (this.fsw.closed) { - stream = undefined; - return; - } - // Files that present in current directory snapshot - // but absent in previous are added to watch list and - // emit `add` event. - if (item === target || !target && !previous.has(item)) { - this.fsw._incrReadyCount(); - - // ensure relativeness of path is preserved in case of watcher reuse - path = sysPath.join(dir, sysPath.relative(dir, path)); - - this._addToNodeFs(path, initialAdd, wh, depth + 1); - } - }).on(EV_ERROR, this._boundHandleError); - - return new Promise(resolve => - stream.once(STR_END, () => { - if (this.fsw.closed) { - stream = undefined; - return; - } - const wasThrottled = throttler ? throttler.clear() : false; - - resolve(); - - // Files that absent in current directory snapshot - // but present in previous emit `remove` event - // and are removed from @watched[directory]. - previous.getChildren().filter((item) => { - return item !== directory && - !current.has(item) && - // in case of intersecting globs; - // a path may have been filtered out of this readdir, but - // shouldn't be removed because it matches a different glob - (!wh.hasGlob || wh.filterPath({ - fullPath: sysPath.resolve(directory, item) - })); - }).forEach((item) => { - this.fsw._remove(directory, item); - }); - - stream = undefined; - - // one more time for any missed in case changes came in extremely quickly - if (wasThrottled) this._handleRead(directory, false, wh, target, dir, depth, throttler); - }) - ); -} - -/** - * Read directory to add / remove files from `@watched` list and re-read it on change. - * @param {String} dir fs path - * @param {fs.Stats} stats - * @param {Boolean} initialAdd - * @param {Number} depth relative to user-supplied path - * @param {String} target child path targeted for watch - * @param {Object} wh Common watch helpers for this path - * @param {String} realpath - * @returns {Promise} closer for the watcher instance. - */ -async _handleDir(dir, stats, initialAdd, depth, target, wh, realpath) { - const parentDir = this.fsw._getWatchedDir(sysPath.dirname(dir)); - const tracked = parentDir.has(sysPath.basename(dir)); - if (!(initialAdd && this.fsw.options.ignoreInitial) && !target && !tracked) { - if (!wh.hasGlob || wh.globFilter(dir)) this.fsw._emit(EV_ADD_DIR, dir, stats); - } - - // ensure dir is tracked (harmless if redundant) - parentDir.add(sysPath.basename(dir)); - this.fsw._getWatchedDir(dir); - let throttler; - let closer; - - const oDepth = this.fsw.options.depth; - if ((oDepth == null || depth <= oDepth) && !this.fsw._symlinkPaths.has(realpath)) { - if (!target) { - await this._handleRead(dir, initialAdd, wh, target, dir, depth, throttler); - if (this.fsw.closed) return; - } - - closer = this._watchWithNodeFs(dir, (dirPath, stats) => { - // if current directory is removed, do nothing - if (stats && stats.mtimeMs === 0) return; - - this._handleRead(dirPath, false, wh, target, dir, depth, throttler); - }); - } - return closer; -} - -/** - * Handle added file, directory, or glob pattern. - * Delegates call to _handleFile / _handleDir after checks. - * @param {String} path to file or ir - * @param {Boolean} initialAdd was the file added at watch instantiation? - * @param {Object} priorWh depth relative to user-supplied path - * @param {Number} depth Child path actually targeted for watch - * @param {String=} target Child path actually targeted for watch - * @returns {Promise} - */ -async _addToNodeFs(path, initialAdd, priorWh, depth, target) { - const ready = this.fsw._emitReady; - if (this.fsw._isIgnored(path) || this.fsw.closed) { - ready(); - return false; - } - - const wh = this.fsw._getWatchHelpers(path, depth); - if (!wh.hasGlob && priorWh) { - wh.hasGlob = priorWh.hasGlob; - wh.globFilter = priorWh.globFilter; - wh.filterPath = entry => priorWh.filterPath(entry); - wh.filterDir = entry => priorWh.filterDir(entry); - } - - // evaluate what is at the path we're being asked to watch - try { - const stats = await statMethods[wh.statMethod](wh.watchPath); - if (this.fsw.closed) return; - if (this.fsw._isIgnored(wh.watchPath, stats)) { - ready(); - return false; - } - - const follow = this.fsw.options.followSymlinks && !path.includes(STAR) && !path.includes(BRACE_START); - let closer; - if (stats.isDirectory()) { - const absPath = sysPath.resolve(path); - const targetPath = follow ? await fsrealpath(path) : path; - if (this.fsw.closed) return; - closer = await this._handleDir(wh.watchPath, stats, initialAdd, depth, target, wh, targetPath); - if (this.fsw.closed) return; - // preserve this symlink's target path - if (absPath !== targetPath && targetPath !== undefined) { - this.fsw._symlinkPaths.set(absPath, targetPath); - } - } else if (stats.isSymbolicLink()) { - const targetPath = follow ? await fsrealpath(path) : path; - if (this.fsw.closed) return; - const parent = sysPath.dirname(wh.watchPath); - this.fsw._getWatchedDir(parent).add(wh.watchPath); - this.fsw._emit(EV_ADD, wh.watchPath, stats); - closer = await this._handleDir(parent, stats, initialAdd, depth, path, wh, targetPath); - if (this.fsw.closed) return; - - // preserve this symlink's target path - if (targetPath !== undefined) { - this.fsw._symlinkPaths.set(sysPath.resolve(path), targetPath); - } - } else { - closer = this._handleFile(wh.watchPath, stats, initialAdd); - } - ready(); - - this.fsw._addPathCloser(path, closer); - return false; - - } catch (error) { - if (this.fsw._handleError(error)) { - ready(); - return path; - } - } -} - -} - -module.exports = NodeFsHandler; diff --git a/server/node_modules/chokidar/package.json b/server/node_modules/chokidar/package.json deleted file mode 100644 index 9ebbb40..0000000 --- a/server/node_modules/chokidar/package.json +++ /dev/null @@ -1,78 +0,0 @@ -{ - "name": "chokidar", - "description": "Minimal and efficient cross-platform file watching library", - "version": "3.5.1", - "homepage": "https://github.com/paulmillr/chokidar", - "author": "Paul Miller (https://paulmillr.com)", - "contributors": [ - "Paul Miller (https://paulmillr.com)", - "Elan Shanker" - ], - "engines": { - "node": ">= 8.10.0" - }, - "main": "index.js", - "dependencies": { - "anymatch": "~3.1.1", - "braces": "~3.0.2", - "glob-parent": "~5.1.0", - "is-binary-path": "~2.1.0", - "is-glob": "~4.0.1", - "normalize-path": "~3.0.0", - "readdirp": "~3.5.0" - }, - "optionalDependencies": { - "fsevents": "~2.3.1" - }, - "devDependencies": { - "@types/node": "^14", - "chai": "^4.2", - "dtslint": "^3.3.0", - "eslint": "^7.0.0", - "mocha": "^7.0.0", - "nyc": "^15.0.0", - "rimraf": "^3.0.0", - "sinon": "^9.0.1", - "sinon-chai": "^3.3.0", - "upath": "^1.2.0" - }, - "files": [ - "index.js", - "lib/*.js", - "types/index.d.ts" - ], - "repository": { - "type": "git", - "url": "git+https://github.com/paulmillr/chokidar.git" - }, - "bugs": { - "url": "https://github.com/paulmillr/chokidar/issues" - }, - "license": "MIT", - "scripts": { - "dtslint": "dtslint types", - "lint": "eslint --report-unused-disable-directives --ignore-path .gitignore .", - "mocha": "mocha --exit --timeout 60000", - "test": "npm run lint && npm run mocha" - }, - "keywords": [ - "fs", - "watch", - "watchFile", - "watcher", - "watching", - "file", - "fsevents" - ], - "types": "./types/index.d.ts", - "nyc": { - "include": [ - "index.js", - "lib/*.js" - ], - "reporter": [ - "html", - "text" - ] - } -} diff --git a/server/node_modules/fill-range/LICENSE b/server/node_modules/fill-range/LICENSE deleted file mode 100644 index 9af4a67..0000000 --- a/server/node_modules/fill-range/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014-present, Jon Schlinkert. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/server/node_modules/fill-range/README.md b/server/node_modules/fill-range/README.md deleted file mode 100644 index 8d756fe..0000000 --- a/server/node_modules/fill-range/README.md +++ /dev/null @@ -1,237 +0,0 @@ -# fill-range [![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=W8YFZ425KND68) [![NPM version](https://img.shields.io/npm/v/fill-range.svg?style=flat)](https://www.npmjs.com/package/fill-range) [![NPM monthly downloads](https://img.shields.io/npm/dm/fill-range.svg?style=flat)](https://npmjs.org/package/fill-range) [![NPM total downloads](https://img.shields.io/npm/dt/fill-range.svg?style=flat)](https://npmjs.org/package/fill-range) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/fill-range.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/fill-range) - -> Fill in a range of numbers or letters, optionally passing an increment or `step` to use, or create a regex-compatible range with `options.toRegex` - -Please consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support. - -## Install - -Install with [npm](https://www.npmjs.com/): - -```sh -$ npm install --save fill-range -``` - -## Usage - -Expands numbers and letters, optionally using a `step` as the last argument. _(Numbers may be defined as JavaScript numbers or strings)_. - -```js -const fill = require('fill-range'); -// fill(from, to[, step, options]); - -console.log(fill('1', '10')); //=> ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10'] -console.log(fill('1', '10', { toRegex: true })); //=> [1-9]|10 -``` - -**Params** - -* `from`: **{String|Number}** the number or letter to start with -* `to`: **{String|Number}** the number or letter to end with -* `step`: **{String|Number|Object|Function}** Optionally pass a [step](#optionsstep) to use. -* `options`: **{Object|Function}**: See all available [options](#options) - -## Examples - -By default, an array of values is returned. - -**Alphabetical ranges** - -```js -console.log(fill('a', 'e')); //=> ['a', 'b', 'c', 'd', 'e'] -console.log(fill('A', 'E')); //=> [ 'A', 'B', 'C', 'D', 'E' ] -``` - -**Numerical ranges** - -Numbers can be defined as actual numbers or strings. - -```js -console.log(fill(1, 5)); //=> [ 1, 2, 3, 4, 5 ] -console.log(fill('1', '5')); //=> [ 1, 2, 3, 4, 5 ] -``` - -**Negative ranges** - -Numbers can be defined as actual numbers or strings. - -```js -console.log(fill('-5', '-1')); //=> [ '-5', '-4', '-3', '-2', '-1' ] -console.log(fill('-5', '5')); //=> [ '-5', '-4', '-3', '-2', '-1', '0', '1', '2', '3', '4', '5' ] -``` - -**Steps (increments)** - -```js -// numerical ranges with increments -console.log(fill('0', '25', 4)); //=> [ '0', '4', '8', '12', '16', '20', '24' ] -console.log(fill('0', '25', 5)); //=> [ '0', '5', '10', '15', '20', '25' ] -console.log(fill('0', '25', 6)); //=> [ '0', '6', '12', '18', '24' ] - -// alphabetical ranges with increments -console.log(fill('a', 'z', 4)); //=> [ 'a', 'e', 'i', 'm', 'q', 'u', 'y' ] -console.log(fill('a', 'z', 5)); //=> [ 'a', 'f', 'k', 'p', 'u', 'z' ] -console.log(fill('a', 'z', 6)); //=> [ 'a', 'g', 'm', 's', 'y' ] -``` - -## Options - -### options.step - -**Type**: `number` (formatted as a string or number) - -**Default**: `undefined` - -**Description**: The increment to use for the range. Can be used with letters or numbers. - -**Example(s)** - -```js -// numbers -console.log(fill('1', '10', 2)); //=> [ '1', '3', '5', '7', '9' ] -console.log(fill('1', '10', 3)); //=> [ '1', '4', '7', '10' ] -console.log(fill('1', '10', 4)); //=> [ '1', '5', '9' ] - -// letters -console.log(fill('a', 'z', 5)); //=> [ 'a', 'f', 'k', 'p', 'u', 'z' ] -console.log(fill('a', 'z', 7)); //=> [ 'a', 'h', 'o', 'v' ] -console.log(fill('a', 'z', 9)); //=> [ 'a', 'j', 's' ] -``` - -### options.strictRanges - -**Type**: `boolean` - -**Default**: `false` - -**Description**: By default, `null` is returned when an invalid range is passed. Enable this option to throw a `RangeError` on invalid ranges. - -**Example(s)** - -The following are all invalid: - -```js -fill('1.1', '2'); // decimals not supported in ranges -fill('a', '2'); // incompatible range values -fill(1, 10, 'foo'); // invalid "step" argument -``` - -### options.stringify - -**Type**: `boolean` - -**Default**: `undefined` - -**Description**: Cast all returned values to strings. By default, integers are returned as numbers. - -**Example(s)** - -```js -console.log(fill(1, 5)); //=> [ 1, 2, 3, 4, 5 ] -console.log(fill(1, 5, { stringify: true })); //=> [ '1', '2', '3', '4', '5' ] -``` - -### options.toRegex - -**Type**: `boolean` - -**Default**: `undefined` - -**Description**: Create a regex-compatible source string, instead of expanding values to an array. - -**Example(s)** - -```js -// alphabetical range -console.log(fill('a', 'e', { toRegex: true })); //=> '[a-e]' -// alphabetical with step -console.log(fill('a', 'z', 3, { toRegex: true })); //=> 'a|d|g|j|m|p|s|v|y' -// numerical range -console.log(fill('1', '100', { toRegex: true })); //=> '[1-9]|[1-9][0-9]|100' -// numerical range with zero padding -console.log(fill('000001', '100000', { toRegex: true })); -//=> '0{5}[1-9]|0{4}[1-9][0-9]|0{3}[1-9][0-9]{2}|0{2}[1-9][0-9]{3}|0[1-9][0-9]{4}|100000' -``` - -### options.transform - -**Type**: `function` - -**Default**: `undefined` - -**Description**: Customize each value in the returned array (or [string](#optionstoRegex)). _(you can also pass this function as the last argument to `fill()`)_. - -**Example(s)** - -```js -// add zero padding -console.log(fill(1, 5, value => String(value).padStart(4, '0'))); -//=> ['0001', '0002', '0003', '0004', '0005'] -``` - -## About - -
-Contributing - -Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). - -
- -
-Running Tests - -Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command: - -```sh -$ npm install && npm test -``` - -
- -
-Building docs - -_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_ - -To generate the readme, run the following command: - -```sh -$ npm install -g verbose/verb#dev verb-generate-readme && verb -``` - -
- -### Contributors - -| **Commits** | **Contributor** | -| --- | --- | -| 116 | [jonschlinkert](https://github.com/jonschlinkert) | -| 4 | [paulmillr](https://github.com/paulmillr) | -| 2 | [realityking](https://github.com/realityking) | -| 2 | [bluelovers](https://github.com/bluelovers) | -| 1 | [edorivai](https://github.com/edorivai) | -| 1 | [wtgtybhertgeghgtwtg](https://github.com/wtgtybhertgeghgtwtg) | - -### Author - -**Jon Schlinkert** - -* [GitHub Profile](https://github.com/jonschlinkert) -* [Twitter Profile](https://twitter.com/jonschlinkert) -* [LinkedIn Profile](https://linkedin.com/in/jonschlinkert) - -Please consider supporting me on Patreon, or [start your own Patreon page](https://patreon.com/invite/bxpbvm)! - - - - - -### License - -Copyright © 2019, [Jon Schlinkert](https://github.com/jonschlinkert). -Released under the [MIT License](LICENSE). - -*** - -_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.8.0, on April 08, 2019._ \ No newline at end of file diff --git a/server/node_modules/fill-range/index.js b/server/node_modules/fill-range/index.js deleted file mode 100644 index 97ce35a..0000000 --- a/server/node_modules/fill-range/index.js +++ /dev/null @@ -1,249 +0,0 @@ -/*! - * fill-range - * - * Copyright (c) 2014-present, Jon Schlinkert. - * Licensed under the MIT License. - */ - -'use strict'; - -const util = require('util'); -const toRegexRange = require('to-regex-range'); - -const isObject = val => val !== null && typeof val === 'object' && !Array.isArray(val); - -const transform = toNumber => { - return value => toNumber === true ? Number(value) : String(value); -}; - -const isValidValue = value => { - return typeof value === 'number' || (typeof value === 'string' && value !== ''); -}; - -const isNumber = num => Number.isInteger(+num); - -const zeros = input => { - let value = `${input}`; - let index = -1; - if (value[0] === '-') value = value.slice(1); - if (value === '0') return false; - while (value[++index] === '0'); - return index > 0; -}; - -const stringify = (start, end, options) => { - if (typeof start === 'string' || typeof end === 'string') { - return true; - } - return options.stringify === true; -}; - -const pad = (input, maxLength, toNumber) => { - if (maxLength > 0) { - let dash = input[0] === '-' ? '-' : ''; - if (dash) input = input.slice(1); - input = (dash + input.padStart(dash ? maxLength - 1 : maxLength, '0')); - } - if (toNumber === false) { - return String(input); - } - return input; -}; - -const toMaxLen = (input, maxLength) => { - let negative = input[0] === '-' ? '-' : ''; - if (negative) { - input = input.slice(1); - maxLength--; - } - while (input.length < maxLength) input = '0' + input; - return negative ? ('-' + input) : input; -}; - -const toSequence = (parts, options) => { - parts.negatives.sort((a, b) => a < b ? -1 : a > b ? 1 : 0); - parts.positives.sort((a, b) => a < b ? -1 : a > b ? 1 : 0); - - let prefix = options.capture ? '' : '?:'; - let positives = ''; - let negatives = ''; - let result; - - if (parts.positives.length) { - positives = parts.positives.join('|'); - } - - if (parts.negatives.length) { - negatives = `-(${prefix}${parts.negatives.join('|')})`; - } - - if (positives && negatives) { - result = `${positives}|${negatives}`; - } else { - result = positives || negatives; - } - - if (options.wrap) { - return `(${prefix}${result})`; - } - - return result; -}; - -const toRange = (a, b, isNumbers, options) => { - if (isNumbers) { - return toRegexRange(a, b, { wrap: false, ...options }); - } - - let start = String.fromCharCode(a); - if (a === b) return start; - - let stop = String.fromCharCode(b); - return `[${start}-${stop}]`; -}; - -const toRegex = (start, end, options) => { - if (Array.isArray(start)) { - let wrap = options.wrap === true; - let prefix = options.capture ? '' : '?:'; - return wrap ? `(${prefix}${start.join('|')})` : start.join('|'); - } - return toRegexRange(start, end, options); -}; - -const rangeError = (...args) => { - return new RangeError('Invalid range arguments: ' + util.inspect(...args)); -}; - -const invalidRange = (start, end, options) => { - if (options.strictRanges === true) throw rangeError([start, end]); - return []; -}; - -const invalidStep = (step, options) => { - if (options.strictRanges === true) { - throw new TypeError(`Expected step "${step}" to be a number`); - } - return []; -}; - -const fillNumbers = (start, end, step = 1, options = {}) => { - let a = Number(start); - let b = Number(end); - - if (!Number.isInteger(a) || !Number.isInteger(b)) { - if (options.strictRanges === true) throw rangeError([start, end]); - return []; - } - - // fix negative zero - if (a === 0) a = 0; - if (b === 0) b = 0; - - let descending = a > b; - let startString = String(start); - let endString = String(end); - let stepString = String(step); - step = Math.max(Math.abs(step), 1); - - let padded = zeros(startString) || zeros(endString) || zeros(stepString); - let maxLen = padded ? Math.max(startString.length, endString.length, stepString.length) : 0; - let toNumber = padded === false && stringify(start, end, options) === false; - let format = options.transform || transform(toNumber); - - if (options.toRegex && step === 1) { - return toRange(toMaxLen(start, maxLen), toMaxLen(end, maxLen), true, options); - } - - let parts = { negatives: [], positives: [] }; - let push = num => parts[num < 0 ? 'negatives' : 'positives'].push(Math.abs(num)); - let range = []; - let index = 0; - - while (descending ? a >= b : a <= b) { - if (options.toRegex === true && step > 1) { - push(a); - } else { - range.push(pad(format(a, index), maxLen, toNumber)); - } - a = descending ? a - step : a + step; - index++; - } - - if (options.toRegex === true) { - return step > 1 - ? toSequence(parts, options) - : toRegex(range, null, { wrap: false, ...options }); - } - - return range; -}; - -const fillLetters = (start, end, step = 1, options = {}) => { - if ((!isNumber(start) && start.length > 1) || (!isNumber(end) && end.length > 1)) { - return invalidRange(start, end, options); - } - - - let format = options.transform || (val => String.fromCharCode(val)); - let a = `${start}`.charCodeAt(0); - let b = `${end}`.charCodeAt(0); - - let descending = a > b; - let min = Math.min(a, b); - let max = Math.max(a, b); - - if (options.toRegex && step === 1) { - return toRange(min, max, false, options); - } - - let range = []; - let index = 0; - - while (descending ? a >= b : a <= b) { - range.push(format(a, index)); - a = descending ? a - step : a + step; - index++; - } - - if (options.toRegex === true) { - return toRegex(range, null, { wrap: false, options }); - } - - return range; -}; - -const fill = (start, end, step, options = {}) => { - if (end == null && isValidValue(start)) { - return [start]; - } - - if (!isValidValue(start) || !isValidValue(end)) { - return invalidRange(start, end, options); - } - - if (typeof step === 'function') { - return fill(start, end, 1, { transform: step }); - } - - if (isObject(step)) { - return fill(start, end, 0, step); - } - - let opts = { ...options }; - if (opts.capture === true) opts.wrap = true; - step = step || opts.step || 1; - - if (!isNumber(step)) { - if (step != null && !isObject(step)) return invalidStep(step, opts); - return fill(start, end, 1, step); - } - - if (isNumber(start) && isNumber(end)) { - return fillNumbers(start, end, step, opts); - } - - return fillLetters(start, end, Math.max(Math.abs(step), 1), opts); -}; - -module.exports = fill; diff --git a/server/node_modules/fill-range/package.json b/server/node_modules/fill-range/package.json deleted file mode 100644 index 07d3076..0000000 --- a/server/node_modules/fill-range/package.json +++ /dev/null @@ -1,69 +0,0 @@ -{ - "name": "fill-range", - "description": "Fill in a range of numbers or letters, optionally passing an increment or `step` to use, or create a regex-compatible range with `options.toRegex`", - "version": "7.0.1", - "homepage": "https://github.com/jonschlinkert/fill-range", - "author": "Jon Schlinkert (https://github.com/jonschlinkert)", - "contributors": [ - "Edo Rivai (edo.rivai.nl)", - "Jon Schlinkert (http://twitter.com/jonschlinkert)", - "Paul Miller (paulmillr.com)", - "Rouven Weßling (www.rouvenwessling.de)", - "(https://github.com/wtgtybhertgeghgtwtg)" - ], - "repository": "jonschlinkert/fill-range", - "bugs": { - "url": "https://github.com/jonschlinkert/fill-range/issues" - }, - "license": "MIT", - "files": [ - "index.js" - ], - "main": "index.js", - "engines": { - "node": ">=8" - }, - "scripts": { - "test": "mocha" - }, - "dependencies": { - "to-regex-range": "^5.0.1" - }, - "devDependencies": { - "gulp-format-md": "^2.0.0", - "mocha": "^6.1.1" - }, - "keywords": [ - "alpha", - "alphabetical", - "array", - "bash", - "brace", - "expand", - "expansion", - "fill", - "glob", - "match", - "matches", - "matching", - "number", - "numerical", - "range", - "ranges", - "regex", - "sh" - ], - "verb": { - "toc": false, - "layout": "default", - "tasks": [ - "readme" - ], - "plugins": [ - "gulp-format-md" - ], - "lint": { - "reflinks": true - } - } -} diff --git a/server/node_modules/fsevents/LICENSE b/server/node_modules/fsevents/LICENSE deleted file mode 100644 index 5d70441..0000000 --- a/server/node_modules/fsevents/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -MIT License ------------ - -Copyright (C) 2010-2020 by Philipp Dunkel, Ben Noordhuis, Elan Shankar, Paul Miller - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/server/node_modules/fsevents/README.md b/server/node_modules/fsevents/README.md deleted file mode 100644 index 025c9a1..0000000 --- a/server/node_modules/fsevents/README.md +++ /dev/null @@ -1,83 +0,0 @@ -# fsevents [![NPM](https://nodei.co/npm/fsevents.png)](https://nodei.co/npm/fsevents/) - -Native access to MacOS FSEvents in [Node.js](https://nodejs.org/) - -The FSEvents API in MacOS allows applications to register for notifications of -changes to a given directory tree. It is a very fast and lightweight alternative -to kqueue. - -This is a low-level library. For a cross-platform file watching module that -uses fsevents, check out [Chokidar](https://github.com/paulmillr/chokidar). - -## Installation - -Supports only **Node.js v8.16 and higher**. - -```sh -npm install fsevents -``` - -## Usage - -```js -const fsevents = require('fsevents'); -const stop = fsevents.watch(__dirname, (path, flags, id) => { - const info = fsevents.getInfo(path, flags, id); -}); // To start observation -stop(); // To end observation -``` - -The callback passed as the second parameter to `.watch` get's called whenever the operating system detects a -a change in the file system. It takes three arguments: - -###### `fsevents.watch(dirname: string, (path: string, flags: number, id: string) => void): () => Promise` - - * `path: string` - the item in the filesystem that have been changed - * `flags: number` - a numeric value describing what the change was - * `id: string` - an unique-id identifying this specific event - - Returns closer callback which when called returns a Promise resolving when the watcher process has been shut down. - -###### `fsevents.getInfo(path: string, flags: number, id: string): FsEventInfo` - -The `getInfo` function takes the `path`, `flags` and `id` arguments and converts those parameters into a structure -that is easier to digest to determine what the change was. - -The `FsEventsInfo` has the following shape: - -```js -/** - * @typedef {'created'|'modified'|'deleted'|'moved'|'root-changed'|'cloned'|'unknown'} FsEventsEvent - * @typedef {'file'|'directory'|'symlink'} FsEventsType - */ -{ - "event": "created", // {FsEventsEvent} - "path": "file.txt", - "type": "file", // {FsEventsType} - "changes": { - "inode": true, // Had iNode Meta-Information changed - "finder": false, // Had Finder Meta-Data changed - "access": false, // Had access permissions changed - "xattrs": false // Had xAttributes changed - }, - "flags": 0x100000000 -} -``` - -## Changelog - -- v2.3 supports Apple Silicon ARM CPUs -- v2 supports node 8.16+ and reduces package size massively -- v1.2.8 supports node 6+ -- v1.2.7 supports node 4+ - -## Troubleshooting - -- I'm getting `EBADPLATFORM` `Unsupported platform for fsevents` error. -- It's fine, nothing is broken. fsevents is macos-only. Other platforms are skipped. If you want to hide this warning, report a bug to NPM bugtracker asking them to hide ebadplatform warnings by default. - -## License - -The MIT License Copyright (C) 2010-2020 by Philipp Dunkel, Ben Noordhuis, Elan Shankar, Paul Miller — see LICENSE file. - -Visit our [GitHub page](https://github.com/fsevents/fsevents) and [NPM Page](https://npmjs.org/package/fsevents) diff --git a/server/node_modules/fsevents/fsevents.js b/server/node_modules/fsevents/fsevents.js deleted file mode 100644 index f1b31c9..0000000 --- a/server/node_modules/fsevents/fsevents.js +++ /dev/null @@ -1,82 +0,0 @@ -/* - ** © 2020 by Philipp Dunkel, Ben Noordhuis, Elan Shankar, Paul Miller - ** Licensed under MIT License. - */ - -/* jshint node:true */ -"use strict"; - -if (process.platform !== "darwin") { - throw new Error(`Module 'fsevents' is not compatible with platform '${process.platform}'`); -} - -const Native = require("./fsevents.node"); -const events = Native.constants; - -function watch(path, since, handler) { - if (typeof path !== "string") { - throw new TypeError(`fsevents argument 1 must be a string and not a ${typeof path}`); - } - if ("function" === typeof since && "undefined" === typeof handler) { - handler = since; - since = Native.flags.SinceNow; - } - if (typeof since !== "number") { - throw new TypeError(`fsevents argument 2 must be a number and not a ${typeof since}`); - } - if (typeof handler !== "function") { - throw new TypeError(`fsevents argument 3 must be a function and not a ${typeof handler}`); - } - - let instance = Native.start(Native.global, path, since, handler); - if (!instance) throw new Error(`could not watch: ${path}`); - return () => { - const result = instance ? Promise.resolve(instance).then(Native.stop) : Promise.resolve(undefined); - instance = undefined; - return result; - }; -} - -function getInfo(path, flags) { - return { - path, - flags, - event: getEventType(flags), - type: getFileType(flags), - changes: getFileChanges(flags), - }; -} - -function getFileType(flags) { - if (events.ItemIsFile & flags) return "file"; - if (events.ItemIsDir & flags) return "directory"; - if (events.ItemIsSymlink & flags) return "symlink"; -} -function anyIsTrue(obj) { - for (let key in obj) { - if (obj[key]) return true; - } - return false; -} -function getEventType(flags) { - if (events.ItemRemoved & flags) return "deleted"; - if (events.ItemRenamed & flags) return "moved"; - if (events.ItemCreated & flags) return "created"; - if (events.ItemModified & flags) return "modified"; - if (events.RootChanged & flags) return "root-changed"; - if (events.ItemCloned & flags) return "cloned"; - if (anyIsTrue(flags)) return "modified"; - return "unknown"; -} -function getFileChanges(flags) { - return { - inode: !!(events.ItemInodeMetaMod & flags), - finder: !!(events.ItemFinderInfoMod & flags), - access: !!(events.ItemChangeOwner & flags), - xattrs: !!(events.ItemXattrMod & flags), - }; -} - -exports.watch = watch; -exports.getInfo = getInfo; -exports.constants = events; diff --git a/server/node_modules/fsevents/fsevents.node b/server/node_modules/fsevents/fsevents.node deleted file mode 100755 index 00fac7e..0000000 Binary files a/server/node_modules/fsevents/fsevents.node and /dev/null differ diff --git a/server/node_modules/fsevents/package.json b/server/node_modules/fsevents/package.json deleted file mode 100644 index af6da84..0000000 --- a/server/node_modules/fsevents/package.json +++ /dev/null @@ -1,62 +0,0 @@ -{ - "name": "fsevents", - "version": "2.3.2", - "description": "Native Access to MacOS FSEvents", - "main": "fsevents.js", - "types": "fsevents.d.ts", - "os": [ - "darwin" - ], - "files": [ - "fsevents.d.ts", - "fsevents.js", - "fsevents.node" - ], - "engines": { - "node": "^8.16.0 || ^10.6.0 || >=11.0.0" - }, - "scripts": { - "clean": "node-gyp clean && rm -f fsevents.node", - "build": "node-gyp clean && rm -f fsevents.node && node-gyp rebuild && node-gyp clean", - "test": "/bin/bash ./test.sh 2>/dev/null", - "prepublishOnly": "npm run build" - }, - "repository": { - "type": "git", - "url": "https://github.com/fsevents/fsevents.git" - }, - "keywords": [ - "fsevents", - "mac" - ], - "contributors": [ - { - "name": "Philipp Dunkel", - "email": "pip@pipobscure.com" - }, - { - "name": "Ben Noordhuis", - "email": "info@bnoordhuis.nl" - }, - { - "name": "Elan Shankar", - "email": "elan.shanker@gmail.com" - }, - { - "name": "Miroslav Bajtoš", - "email": "mbajtoss@gmail.com" - }, - { - "name": "Paul Miller", - "url": "https://paulmillr.com" - } - ], - "license": "MIT", - "bugs": { - "url": "https://github.com/fsevents/fsevents/issues" - }, - "homepage": "https://github.com/fsevents/fsevents", - "devDependencies": { - "node-gyp": "^6.1.0" - } -} diff --git a/server/node_modules/glob-parent/CHANGELOG.md b/server/node_modules/glob-parent/CHANGELOG.md deleted file mode 100644 index fb9de96..0000000 --- a/server/node_modules/glob-parent/CHANGELOG.md +++ /dev/null @@ -1,110 +0,0 @@ -### [5.1.2](https://github.com/gulpjs/glob-parent/compare/v5.1.1...v5.1.2) (2021-03-06) - - -### Bug Fixes - -* eliminate ReDoS ([#36](https://github.com/gulpjs/glob-parent/issues/36)) ([f923116](https://github.com/gulpjs/glob-parent/commit/f9231168b0041fea3f8f954b3cceb56269fc6366)) - -### [5.1.1](https://github.com/gulpjs/glob-parent/compare/v5.1.0...v5.1.1) (2021-01-27) - - -### Bug Fixes - -* unescape exclamation mark ([#26](https://github.com/gulpjs/glob-parent/issues/26)) ([a98874f](https://github.com/gulpjs/glob-parent/commit/a98874f1a59e407f4fb1beb0db4efa8392da60bb)) - -## [5.1.0](https://github.com/gulpjs/glob-parent/compare/v5.0.0...v5.1.0) (2021-01-27) - - -### Features - -* add `flipBackslashes` option to disable auto conversion of slashes (closes [#24](https://github.com/gulpjs/glob-parent/issues/24)) ([#25](https://github.com/gulpjs/glob-parent/issues/25)) ([eecf91d](https://github.com/gulpjs/glob-parent/commit/eecf91d5e3834ed78aee39c4eaaae654d76b87b3)) - -## [5.0.0](https://github.com/gulpjs/glob-parent/compare/v4.0.0...v5.0.0) (2021-01-27) - - -### ⚠ BREAKING CHANGES - -* Drop support for node <6 & bump dependencies - -### Miscellaneous Chores - -* Drop support for node <6 & bump dependencies ([896c0c0](https://github.com/gulpjs/glob-parent/commit/896c0c00b4e7362f60b96e7fc295ae929245255a)) - -## [4.0.0](https://github.com/gulpjs/glob-parent/compare/v3.1.0...v4.0.0) (2021-01-27) - - -### ⚠ BREAKING CHANGES - -* question marks are valid path characters on Windows so avoid flagging as a glob when alone -* Update is-glob dependency - -### Features - -* hoist regexps and strings for performance gains ([4a80667](https://github.com/gulpjs/glob-parent/commit/4a80667c69355c76a572a5892b0f133c8e1f457e)) -* question marks are valid path characters on Windows so avoid flagging as a glob when alone ([2a551dd](https://github.com/gulpjs/glob-parent/commit/2a551dd0dc3235e78bf3c94843d4107072d17841)) -* Update is-glob dependency ([e41fcd8](https://github.com/gulpjs/glob-parent/commit/e41fcd895d1f7bc617dba45c9d935a7949b9c281)) - -## [3.1.0](https://github.com/gulpjs/glob-parent/compare/v3.0.1...v3.1.0) (2021-01-27) - - -### Features - -* allow basic win32 backslash use ([272afa5](https://github.com/gulpjs/glob-parent/commit/272afa5fd070fc0f796386a5993d4ee4a846988b)) -* handle extglobs (parentheses) containing separators ([7db1bdb](https://github.com/gulpjs/glob-parent/commit/7db1bdb0756e55fd14619e8ce31aa31b17b117fd)) -* new approach to braces/brackets handling ([8269bd8](https://github.com/gulpjs/glob-parent/commit/8269bd89290d99fac9395a354fb56fdcdb80f0be)) -* pre-process braces/brackets sections ([9ef8a87](https://github.com/gulpjs/glob-parent/commit/9ef8a87f66b1a43d0591e7a8e4fc5a18415ee388)) -* preserve escaped brace/bracket at end of string ([8cfb0ba](https://github.com/gulpjs/glob-parent/commit/8cfb0ba84202d51571340dcbaf61b79d16a26c76)) - - -### Bug Fixes - -* trailing escaped square brackets ([99ec9fe](https://github.com/gulpjs/glob-parent/commit/99ec9fecc60ee488ded20a94dd4f18b4f55c4ccf)) - -### [3.0.1](https://github.com/gulpjs/glob-parent/compare/v3.0.0...v3.0.1) (2021-01-27) - - -### Features - -* use path-dirname ponyfill ([cdbea5f](https://github.com/gulpjs/glob-parent/commit/cdbea5f32a58a54e001a75ddd7c0fccd4776aacc)) - - -### Bug Fixes - -* unescape glob-escaped dirnames on output ([598c533](https://github.com/gulpjs/glob-parent/commit/598c533bdf49c1428bc063aa9b8db40c5a86b030)) - -## [3.0.0](https://github.com/gulpjs/glob-parent/compare/v2.0.0...v3.0.0) (2021-01-27) - - -### ⚠ BREAKING CHANGES - -* update is-glob dependency - -### Features - -* update is-glob dependency ([5c5f8ef](https://github.com/gulpjs/glob-parent/commit/5c5f8efcee362a8e7638cf8220666acd8784f6bd)) - -## [2.0.0](https://github.com/gulpjs/glob-parent/compare/v1.3.0...v2.0.0) (2021-01-27) - - -### Features - -* move up to dirname regardless of glob characters ([f97fb83](https://github.com/gulpjs/glob-parent/commit/f97fb83be2e0a9fc8d3b760e789d2ecadd6aa0c2)) - -## [1.3.0](https://github.com/gulpjs/glob-parent/compare/v1.2.0...v1.3.0) (2021-01-27) - -## [1.2.0](https://github.com/gulpjs/glob-parent/compare/v1.1.0...v1.2.0) (2021-01-27) - - -### Reverts - -* feat: make regex test strings smaller ([dc80fa9](https://github.com/gulpjs/glob-parent/commit/dc80fa9658dca20549cfeba44bbd37d5246fcce0)) - -## [1.1.0](https://github.com/gulpjs/glob-parent/compare/v1.0.0...v1.1.0) (2021-01-27) - - -### Features - -* make regex test strings smaller ([cd83220](https://github.com/gulpjs/glob-parent/commit/cd832208638f45169f986d80fcf66e401f35d233)) - -## 1.0.0 (2021-01-27) - diff --git a/server/node_modules/glob-parent/LICENSE b/server/node_modules/glob-parent/LICENSE deleted file mode 100644 index 63222d7..0000000 --- a/server/node_modules/glob-parent/LICENSE +++ /dev/null @@ -1,15 +0,0 @@ -The ISC License - -Copyright (c) 2015, 2019 Elan Shanker - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/server/node_modules/glob-parent/README.md b/server/node_modules/glob-parent/README.md deleted file mode 100644 index 36a2793..0000000 --- a/server/node_modules/glob-parent/README.md +++ /dev/null @@ -1,137 +0,0 @@ -

- - - -

- -# glob-parent - -[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Azure Pipelines Build Status][azure-pipelines-image]][azure-pipelines-url] [![Travis Build Status][travis-image]][travis-url] [![AppVeyor Build Status][appveyor-image]][appveyor-url] [![Coveralls Status][coveralls-image]][coveralls-url] [![Gitter chat][gitter-image]][gitter-url] - -Extract the non-magic parent path from a glob string. - -## Usage - -```js -var globParent = require('glob-parent'); - -globParent('path/to/*.js'); // 'path/to' -globParent('/root/path/to/*.js'); // '/root/path/to' -globParent('/*.js'); // '/' -globParent('*.js'); // '.' -globParent('**/*.js'); // '.' -globParent('path/{to,from}'); // 'path' -globParent('path/!(to|from)'); // 'path' -globParent('path/?(to|from)'); // 'path' -globParent('path/+(to|from)'); // 'path' -globParent('path/*(to|from)'); // 'path' -globParent('path/@(to|from)'); // 'path' -globParent('path/**/*'); // 'path' - -// if provided a non-glob path, returns the nearest dir -globParent('path/foo/bar.js'); // 'path/foo' -globParent('path/foo/'); // 'path/foo' -globParent('path/foo'); // 'path' (see issue #3 for details) -``` - -## API - -### `globParent(maybeGlobString, [options])` - -Takes a string and returns the part of the path before the glob begins. Be aware of Escaping rules and Limitations below. - -#### options - -```js -{ - // Disables the automatic conversion of slashes for Windows - flipBackslashes: true -} -``` - -## Escaping - -The following characters have special significance in glob patterns and must be escaped if you want them to be treated as regular path characters: - -- `?` (question mark) unless used as a path segment alone -- `*` (asterisk) -- `|` (pipe) -- `(` (opening parenthesis) -- `)` (closing parenthesis) -- `{` (opening curly brace) -- `}` (closing curly brace) -- `[` (opening bracket) -- `]` (closing bracket) - -**Example** - -```js -globParent('foo/[bar]/') // 'foo' -globParent('foo/\\[bar]/') // 'foo/[bar]' -``` - -## Limitations - -### Braces & Brackets -This library attempts a quick and imperfect method of determining which path -parts have glob magic without fully parsing/lexing the pattern. There are some -advanced use cases that can trip it up, such as nested braces where the outer -pair is escaped and the inner one contains a path separator. If you find -yourself in the unlikely circumstance of being affected by this or need to -ensure higher-fidelity glob handling in your library, it is recommended that you -pre-process your input with [expand-braces] and/or [expand-brackets]. - -### Windows -Backslashes are not valid path separators for globs. If a path with backslashes -is provided anyway, for simple cases, glob-parent will replace the path -separator for you and return the non-glob parent path (now with -forward-slashes, which are still valid as Windows path separators). - -This cannot be used in conjunction with escape characters. - -```js -// BAD -globParent('C:\\Program Files \\(x86\\)\\*.ext') // 'C:/Program Files /(x86/)' - -// GOOD -globParent('C:/Program Files\\(x86\\)/*.ext') // 'C:/Program Files (x86)' -``` - -If you are using escape characters for a pattern without path parts (i.e. -relative to `cwd`), prefix with `./` to avoid confusing glob-parent. - -```js -// BAD -globParent('foo \\[bar]') // 'foo ' -globParent('foo \\[bar]*') // 'foo ' - -// GOOD -globParent('./foo \\[bar]') // 'foo [bar]' -globParent('./foo \\[bar]*') // '.' -``` - -## License - -ISC - -[expand-braces]: https://github.com/jonschlinkert/expand-braces -[expand-brackets]: https://github.com/jonschlinkert/expand-brackets - -[downloads-image]: https://img.shields.io/npm/dm/glob-parent.svg -[npm-url]: https://www.npmjs.com/package/glob-parent -[npm-image]: https://img.shields.io/npm/v/glob-parent.svg - -[azure-pipelines-url]: https://dev.azure.com/gulpjs/gulp/_build/latest?definitionId=2&branchName=master -[azure-pipelines-image]: https://dev.azure.com/gulpjs/gulp/_apis/build/status/glob-parent?branchName=master - -[travis-url]: https://travis-ci.org/gulpjs/glob-parent -[travis-image]: https://img.shields.io/travis/gulpjs/glob-parent.svg?label=travis-ci - -[appveyor-url]: https://ci.appveyor.com/project/gulpjs/glob-parent -[appveyor-image]: https://img.shields.io/appveyor/ci/gulpjs/glob-parent.svg?label=appveyor - -[coveralls-url]: https://coveralls.io/r/gulpjs/glob-parent -[coveralls-image]: https://img.shields.io/coveralls/gulpjs/glob-parent/master.svg - -[gitter-url]: https://gitter.im/gulpjs/gulp -[gitter-image]: https://badges.gitter.im/gulpjs/gulp.svg diff --git a/server/node_modules/glob-parent/index.js b/server/node_modules/glob-parent/index.js deleted file mode 100644 index 09e257e..0000000 --- a/server/node_modules/glob-parent/index.js +++ /dev/null @@ -1,42 +0,0 @@ -'use strict'; - -var isGlob = require('is-glob'); -var pathPosixDirname = require('path').posix.dirname; -var isWin32 = require('os').platform() === 'win32'; - -var slash = '/'; -var backslash = /\\/g; -var enclosure = /[\{\[].*[\}\]]$/; -var globby = /(^|[^\\])([\{\[]|\([^\)]+$)/; -var escaped = /\\([\!\*\?\|\[\]\(\)\{\}])/g; - -/** - * @param {string} str - * @param {Object} opts - * @param {boolean} [opts.flipBackslashes=true] - * @returns {string} - */ -module.exports = function globParent(str, opts) { - var options = Object.assign({ flipBackslashes: true }, opts); - - // flip windows path separators - if (options.flipBackslashes && isWin32 && str.indexOf(slash) < 0) { - str = str.replace(backslash, slash); - } - - // special case for strings ending in enclosure containing path separator - if (enclosure.test(str)) { - str += slash; - } - - // preserves full path in case of trailing path separator - str += 'a'; - - // remove path parts that are globby - do { - str = pathPosixDirname(str); - } while (isGlob(str) || globby.test(str)); - - // remove escape chars and return result - return str.replace(escaped, '$1'); -}; diff --git a/server/node_modules/glob-parent/package.json b/server/node_modules/glob-parent/package.json deleted file mode 100644 index 125c971..0000000 --- a/server/node_modules/glob-parent/package.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "name": "glob-parent", - "version": "5.1.2", - "description": "Extract the non-magic parent path from a glob string.", - "author": "Gulp Team (https://gulpjs.com/)", - "contributors": [ - "Elan Shanker (https://github.com/es128)", - "Blaine Bublitz " - ], - "repository": "gulpjs/glob-parent", - "license": "ISC", - "engines": { - "node": ">= 6" - }, - "main": "index.js", - "files": [ - "LICENSE", - "index.js" - ], - "scripts": { - "lint": "eslint .", - "pretest": "npm run lint", - "test": "nyc mocha --async-only", - "azure-pipelines": "nyc mocha --async-only --reporter xunit -O output=test.xunit", - "coveralls": "nyc report --reporter=text-lcov | coveralls" - }, - "dependencies": { - "is-glob": "^4.0.1" - }, - "devDependencies": { - "coveralls": "^3.0.11", - "eslint": "^2.13.1", - "eslint-config-gulp": "^3.0.1", - "expect": "^1.20.2", - "mocha": "^6.0.2", - "nyc": "^13.3.0" - }, - "keywords": [ - "glob", - "parent", - "strip", - "path", - "dirname", - "directory", - "base", - "wildcard" - ] -} diff --git a/server/node_modules/is-binary-path/index.js b/server/node_modules/is-binary-path/index.js deleted file mode 100644 index ef7548c..0000000 --- a/server/node_modules/is-binary-path/index.js +++ /dev/null @@ -1,7 +0,0 @@ -'use strict'; -const path = require('path'); -const binaryExtensions = require('binary-extensions'); - -const extensions = new Set(binaryExtensions); - -module.exports = filePath => extensions.has(path.extname(filePath).slice(1).toLowerCase()); diff --git a/server/node_modules/is-binary-path/license b/server/node_modules/is-binary-path/license deleted file mode 100644 index 401b1c7..0000000 --- a/server/node_modules/is-binary-path/license +++ /dev/null @@ -1,9 +0,0 @@ -MIT License - -Copyright (c) 2019 Sindre Sorhus (https://sindresorhus.com), Paul Miller (https://paulmillr.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/server/node_modules/is-binary-path/package.json b/server/node_modules/is-binary-path/package.json deleted file mode 100644 index a8d005a..0000000 --- a/server/node_modules/is-binary-path/package.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "name": "is-binary-path", - "version": "2.1.0", - "description": "Check if a file path is a binary file", - "license": "MIT", - "repository": "sindresorhus/is-binary-path", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "engines": { - "node": ">=8" - }, - "scripts": { - "test": "xo && ava && tsd" - }, - "files": [ - "index.js", - "index.d.ts" - ], - "keywords": [ - "binary", - "extensions", - "extension", - "file", - "path", - "check", - "detect", - "is" - ], - "dependencies": { - "binary-extensions": "^2.0.0" - }, - "devDependencies": { - "ava": "^1.4.1", - "tsd": "^0.7.2", - "xo": "^0.24.0" - } -} diff --git a/server/node_modules/is-binary-path/readme.md b/server/node_modules/is-binary-path/readme.md deleted file mode 100644 index b4ab025..0000000 --- a/server/node_modules/is-binary-path/readme.md +++ /dev/null @@ -1,34 +0,0 @@ -# is-binary-path [![Build Status](https://travis-ci.org/sindresorhus/is-binary-path.svg?branch=master)](https://travis-ci.org/sindresorhus/is-binary-path) - -> Check if a file path is a binary file - - -## Install - -``` -$ npm install is-binary-path -``` - - -## Usage - -```js -const isBinaryPath = require('is-binary-path'); - -isBinaryPath('source/unicorn.png'); -//=> true - -isBinaryPath('source/unicorn.txt'); -//=> false -``` - - -## Related - -- [binary-extensions](https://github.com/sindresorhus/binary-extensions) - List of binary file extensions -- [is-text-path](https://github.com/sindresorhus/is-text-path) - Check if a filepath is a text file - - -## License - -MIT © [Sindre Sorhus](https://sindresorhus.com), [Paul Miller](https://paulmillr.com) diff --git a/server/node_modules/is-extglob/LICENSE b/server/node_modules/is-extglob/LICENSE deleted file mode 100644 index 842218c..0000000 --- a/server/node_modules/is-extglob/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014-2016, Jon Schlinkert - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/server/node_modules/is-extglob/README.md b/server/node_modules/is-extglob/README.md deleted file mode 100644 index 0416af5..0000000 --- a/server/node_modules/is-extglob/README.md +++ /dev/null @@ -1,107 +0,0 @@ -# is-extglob [![NPM version](https://img.shields.io/npm/v/is-extglob.svg?style=flat)](https://www.npmjs.com/package/is-extglob) [![NPM downloads](https://img.shields.io/npm/dm/is-extglob.svg?style=flat)](https://npmjs.org/package/is-extglob) [![Build Status](https://img.shields.io/travis/jonschlinkert/is-extglob.svg?style=flat)](https://travis-ci.org/jonschlinkert/is-extglob) - -> Returns true if a string has an extglob. - -## Install - -Install with [npm](https://www.npmjs.com/): - -```sh -$ npm install --save is-extglob -``` - -## Usage - -```js -var isExtglob = require('is-extglob'); -``` - -**True** - -```js -isExtglob('?(abc)'); -isExtglob('@(abc)'); -isExtglob('!(abc)'); -isExtglob('*(abc)'); -isExtglob('+(abc)'); -``` - -**False** - -Escaped extglobs: - -```js -isExtglob('\\?(abc)'); -isExtglob('\\@(abc)'); -isExtglob('\\!(abc)'); -isExtglob('\\*(abc)'); -isExtglob('\\+(abc)'); -``` - -Everything else... - -```js -isExtglob('foo.js'); -isExtglob('!foo.js'); -isExtglob('*.js'); -isExtglob('**/abc.js'); -isExtglob('abc/*.js'); -isExtglob('abc/(aaa|bbb).js'); -isExtglob('abc/[a-z].js'); -isExtglob('abc/{a,b}.js'); -isExtglob('abc/?.js'); -isExtglob('abc.js'); -isExtglob('abc/def/ghi.js'); -``` - -## History - -**v2.0** - -Adds support for escaping. Escaped exglobs no longer return true. - -## About - -### Related projects - -* [has-glob](https://www.npmjs.com/package/has-glob): Returns `true` if an array has a glob pattern. | [homepage](https://github.com/jonschlinkert/has-glob "Returns `true` if an array has a glob pattern.") -* [is-glob](https://www.npmjs.com/package/is-glob): Returns `true` if the given string looks like a glob pattern or an extglob pattern… [more](https://github.com/jonschlinkert/is-glob) | [homepage](https://github.com/jonschlinkert/is-glob "Returns `true` if the given string looks like a glob pattern or an extglob pattern. This makes it easy to create code that only uses external modules like node-glob when necessary, resulting in much faster code execution and initialization time, and a bet") -* [micromatch](https://www.npmjs.com/package/micromatch): Glob matching for javascript/node.js. A drop-in replacement and faster alternative to minimatch and multimatch. | [homepage](https://github.com/jonschlinkert/micromatch "Glob matching for javascript/node.js. A drop-in replacement and faster alternative to minimatch and multimatch.") - -### Contributing - -Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). - -### Building docs - -_(This document was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme) (a [verb](https://github.com/verbose/verb) generator), please don't edit the readme directly. Any changes to the readme must be made in [.verb.md](.verb.md).)_ - -To generate the readme and API documentation with [verb](https://github.com/verbose/verb): - -```sh -$ npm install -g verb verb-generate-readme && verb -``` - -### Running tests - -Install dev dependencies: - -```sh -$ npm install -d && npm test -``` - -### Author - -**Jon Schlinkert** - -* [github/jonschlinkert](https://github.com/jonschlinkert) -* [twitter/jonschlinkert](http://twitter.com/jonschlinkert) - -### License - -Copyright © 2016, [Jon Schlinkert](https://github.com/jonschlinkert). -Released under the [MIT license](https://github.com/jonschlinkert/is-extglob/blob/master/LICENSE). - -*** - -_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.1.31, on October 12, 2016._ \ No newline at end of file diff --git a/server/node_modules/is-extglob/index.js b/server/node_modules/is-extglob/index.js deleted file mode 100644 index c1d986f..0000000 --- a/server/node_modules/is-extglob/index.js +++ /dev/null @@ -1,20 +0,0 @@ -/*! - * is-extglob - * - * Copyright (c) 2014-2016, Jon Schlinkert. - * Licensed under the MIT License. - */ - -module.exports = function isExtglob(str) { - if (typeof str !== 'string' || str === '') { - return false; - } - - var match; - while ((match = /(\\).|([@?!+*]\(.*\))/g.exec(str))) { - if (match[2]) return true; - str = str.slice(match.index + match[0].length); - } - - return false; -}; diff --git a/server/node_modules/is-extglob/package.json b/server/node_modules/is-extglob/package.json deleted file mode 100644 index 7a90836..0000000 --- a/server/node_modules/is-extglob/package.json +++ /dev/null @@ -1,69 +0,0 @@ -{ - "name": "is-extglob", - "description": "Returns true if a string has an extglob.", - "version": "2.1.1", - "homepage": "https://github.com/jonschlinkert/is-extglob", - "author": "Jon Schlinkert (https://github.com/jonschlinkert)", - "repository": "jonschlinkert/is-extglob", - "bugs": { - "url": "https://github.com/jonschlinkert/is-extglob/issues" - }, - "license": "MIT", - "files": [ - "index.js" - ], - "main": "index.js", - "engines": { - "node": ">=0.10.0" - }, - "scripts": { - "test": "mocha" - }, - "devDependencies": { - "gulp-format-md": "^0.1.10", - "mocha": "^3.0.2" - }, - "keywords": [ - "bash", - "braces", - "check", - "exec", - "expression", - "extglob", - "glob", - "globbing", - "globstar", - "is", - "match", - "matches", - "pattern", - "regex", - "regular", - "string", - "test" - ], - "verb": { - "toc": false, - "layout": "default", - "tasks": [ - "readme" - ], - "plugins": [ - "gulp-format-md" - ], - "related": { - "list": [ - "has-glob", - "is-glob", - "micromatch" - ] - }, - "reflinks": [ - "verb", - "verb-generate-readme" - ], - "lint": { - "reflinks": true - } - } -} diff --git a/server/node_modules/is-glob/LICENSE b/server/node_modules/is-glob/LICENSE deleted file mode 100644 index 3f2eca1..0000000 --- a/server/node_modules/is-glob/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014-2017, Jon Schlinkert. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/server/node_modules/is-glob/README.md b/server/node_modules/is-glob/README.md deleted file mode 100644 index 59444eb..0000000 --- a/server/node_modules/is-glob/README.md +++ /dev/null @@ -1,206 +0,0 @@ -# is-glob [![NPM version](https://img.shields.io/npm/v/is-glob.svg?style=flat)](https://www.npmjs.com/package/is-glob) [![NPM monthly downloads](https://img.shields.io/npm/dm/is-glob.svg?style=flat)](https://npmjs.org/package/is-glob) [![NPM total downloads](https://img.shields.io/npm/dt/is-glob.svg?style=flat)](https://npmjs.org/package/is-glob) [![Linux Build Status](https://img.shields.io/travis/micromatch/is-glob.svg?style=flat&label=Travis)](https://travis-ci.org/micromatch/is-glob) [![Windows Build Status](https://img.shields.io/appveyor/ci/micromatch/is-glob.svg?style=flat&label=AppVeyor)](https://ci.appveyor.com/project/micromatch/is-glob) - -> Returns `true` if the given string looks like a glob pattern or an extglob pattern. This makes it easy to create code that only uses external modules like node-glob when necessary, resulting in much faster code execution and initialization time, and a better user experience. - -Please consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support. - -## Install - -Install with [npm](https://www.npmjs.com/): - -```sh -$ npm install --save is-glob -``` - -You might also be interested in [is-valid-glob](https://github.com/jonschlinkert/is-valid-glob) and [has-glob](https://github.com/jonschlinkert/has-glob). - -## Usage - -```js -var isGlob = require('is-glob'); -``` - -### Default behavior - -**True** - -Patterns that have glob characters or regex patterns will return `true`: - -```js -isGlob('!foo.js'); -isGlob('*.js'); -isGlob('**/abc.js'); -isGlob('abc/*.js'); -isGlob('abc/(aaa|bbb).js'); -isGlob('abc/[a-z].js'); -isGlob('abc/{a,b}.js'); -//=> true -``` - -Extglobs - -```js -isGlob('abc/@(a).js'); -isGlob('abc/!(a).js'); -isGlob('abc/+(a).js'); -isGlob('abc/*(a).js'); -isGlob('abc/?(a).js'); -//=> true -``` - -**False** - -Escaped globs or extglobs return `false`: - -```js -isGlob('abc/\\@(a).js'); -isGlob('abc/\\!(a).js'); -isGlob('abc/\\+(a).js'); -isGlob('abc/\\*(a).js'); -isGlob('abc/\\?(a).js'); -isGlob('\\!foo.js'); -isGlob('\\*.js'); -isGlob('\\*\\*/abc.js'); -isGlob('abc/\\*.js'); -isGlob('abc/\\(aaa|bbb).js'); -isGlob('abc/\\[a-z].js'); -isGlob('abc/\\{a,b}.js'); -//=> false -``` - -Patterns that do not have glob patterns return `false`: - -```js -isGlob('abc.js'); -isGlob('abc/def/ghi.js'); -isGlob('foo.js'); -isGlob('abc/@.js'); -isGlob('abc/+.js'); -isGlob('abc/?.js'); -isGlob(); -isGlob(null); -//=> false -``` - -Arrays are also `false` (If you want to check if an array has a glob pattern, use [has-glob](https://github.com/jonschlinkert/has-glob)): - -```js -isGlob(['**/*.js']); -isGlob(['foo.js']); -//=> false -``` - -### Option strict - -When `options.strict === false` the behavior is less strict in determining if a pattern is a glob. Meaning that -some patterns that would return `false` may return `true`. This is done so that matching libraries like [micromatch](https://github.com/micromatch/micromatch) have a chance at determining if the pattern is a glob or not. - -**True** - -Patterns that have glob characters or regex patterns will return `true`: - -```js -isGlob('!foo.js', {strict: false}); -isGlob('*.js', {strict: false}); -isGlob('**/abc.js', {strict: false}); -isGlob('abc/*.js', {strict: false}); -isGlob('abc/(aaa|bbb).js', {strict: false}); -isGlob('abc/[a-z].js', {strict: false}); -isGlob('abc/{a,b}.js', {strict: false}); -//=> true -``` - -Extglobs - -```js -isGlob('abc/@(a).js', {strict: false}); -isGlob('abc/!(a).js', {strict: false}); -isGlob('abc/+(a).js', {strict: false}); -isGlob('abc/*(a).js', {strict: false}); -isGlob('abc/?(a).js', {strict: false}); -//=> true -``` - -**False** - -Escaped globs or extglobs return `false`: - -```js -isGlob('\\!foo.js', {strict: false}); -isGlob('\\*.js', {strict: false}); -isGlob('\\*\\*/abc.js', {strict: false}); -isGlob('abc/\\*.js', {strict: false}); -isGlob('abc/\\(aaa|bbb).js', {strict: false}); -isGlob('abc/\\[a-z].js', {strict: false}); -isGlob('abc/\\{a,b}.js', {strict: false}); -//=> false -``` - -## About - -
-Contributing - -Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). - -
- -
-Running Tests - -Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command: - -```sh -$ npm install && npm test -``` - -
- -
-Building docs - -_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_ - -To generate the readme, run the following command: - -```sh -$ npm install -g verbose/verb#dev verb-generate-readme && verb -``` - -
- -### Related projects - -You might also be interested in these projects: - -* [assemble](https://www.npmjs.com/package/assemble): Get the rocks out of your socks! Assemble makes you fast at creating web projects… [more](https://github.com/assemble/assemble) | [homepage](https://github.com/assemble/assemble "Get the rocks out of your socks! Assemble makes you fast at creating web projects. Assemble is used by thousands of projects for rapid prototyping, creating themes, scaffolds, boilerplates, e-books, UI components, API documentation, blogs, building websit") -* [base](https://www.npmjs.com/package/base): Framework for rapidly creating high quality, server-side node.js applications, using plugins like building blocks | [homepage](https://github.com/node-base/base "Framework for rapidly creating high quality, server-side node.js applications, using plugins like building blocks") -* [update](https://www.npmjs.com/package/update): Be scalable! Update is a new, open source developer framework and CLI for automating updates… [more](https://github.com/update/update) | [homepage](https://github.com/update/update "Be scalable! Update is a new, open source developer framework and CLI for automating updates of any kind in code projects.") -* [verb](https://www.npmjs.com/package/verb): Documentation generator for GitHub projects. Verb is extremely powerful, easy to use, and is used… [more](https://github.com/verbose/verb) | [homepage](https://github.com/verbose/verb "Documentation generator for GitHub projects. Verb is extremely powerful, easy to use, and is used on hundreds of projects of all sizes to generate everything from API docs to readmes.") - -### Contributors - -| **Commits** | **Contributor** | -| --- | --- | -| 47 | [jonschlinkert](https://github.com/jonschlinkert) | -| 5 | [doowb](https://github.com/doowb) | -| 1 | [phated](https://github.com/phated) | -| 1 | [danhper](https://github.com/danhper) | -| 1 | [paulmillr](https://github.com/paulmillr) | - -### Author - -**Jon Schlinkert** - -* [GitHub Profile](https://github.com/jonschlinkert) -* [Twitter Profile](https://twitter.com/jonschlinkert) -* [LinkedIn Profile](https://linkedin.com/in/jonschlinkert) - -### License - -Copyright © 2019, [Jon Schlinkert](https://github.com/jonschlinkert). -Released under the [MIT License](LICENSE). - -*** - -_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.8.0, on March 27, 2019._ \ No newline at end of file diff --git a/server/node_modules/is-glob/index.js b/server/node_modules/is-glob/index.js deleted file mode 100644 index 5582651..0000000 --- a/server/node_modules/is-glob/index.js +++ /dev/null @@ -1,48 +0,0 @@ -/*! - * is-glob - * - * Copyright (c) 2014-2017, Jon Schlinkert. - * Released under the MIT License. - */ - -var isExtglob = require('is-extglob'); -var chars = { '{': '}', '(': ')', '[': ']'}; -var strictRegex = /\\(.)|(^!|\*|[\].+)]\?|\[[^\\\]]+\]|\{[^\\}]+\}|\(\?[:!=][^\\)]+\)|\([^|]+\|[^\\)]+\))/; -var relaxedRegex = /\\(.)|(^!|[*?{}()[\]]|\(\?)/; - -module.exports = function isGlob(str, options) { - if (typeof str !== 'string' || str === '') { - return false; - } - - if (isExtglob(str)) { - return true; - } - - var regex = strictRegex; - var match; - - // optionally relax regex - if (options && options.strict === false) { - regex = relaxedRegex; - } - - while ((match = regex.exec(str))) { - if (match[2]) return true; - var idx = match.index + match[0].length; - - // if an open bracket/brace/paren is escaped, - // set the index to the next closing character - var open = match[1]; - var close = open ? chars[open] : null; - if (open && close) { - var n = str.indexOf(close, idx); - if (n !== -1) { - idx = n + 1; - } - } - - str = str.slice(idx); - } - return false; -}; diff --git a/server/node_modules/is-glob/package.json b/server/node_modules/is-glob/package.json deleted file mode 100644 index 806000d..0000000 --- a/server/node_modules/is-glob/package.json +++ /dev/null @@ -1,81 +0,0 @@ -{ - "name": "is-glob", - "description": "Returns `true` if the given string looks like a glob pattern or an extglob pattern. This makes it easy to create code that only uses external modules like node-glob when necessary, resulting in much faster code execution and initialization time, and a better user experience.", - "version": "4.0.1", - "homepage": "https://github.com/micromatch/is-glob", - "author": "Jon Schlinkert (https://github.com/jonschlinkert)", - "contributors": [ - "Brian Woodward (https://twitter.com/doowb)", - "Daniel Perez (https://tuvistavie.com)", - "Jon Schlinkert (http://twitter.com/jonschlinkert)" - ], - "repository": "micromatch/is-glob", - "bugs": { - "url": "https://github.com/micromatch/is-glob/issues" - }, - "license": "MIT", - "files": [ - "index.js" - ], - "main": "index.js", - "engines": { - "node": ">=0.10.0" - }, - "scripts": { - "test": "mocha" - }, - "dependencies": { - "is-extglob": "^2.1.1" - }, - "devDependencies": { - "gulp-format-md": "^0.1.10", - "mocha": "^3.0.2" - }, - "keywords": [ - "bash", - "braces", - "check", - "exec", - "expression", - "extglob", - "glob", - "globbing", - "globstar", - "is", - "match", - "matches", - "pattern", - "regex", - "regular", - "string", - "test" - ], - "verb": { - "layout": "default", - "plugins": [ - "gulp-format-md" - ], - "related": { - "list": [ - "assemble", - "base", - "update", - "verb" - ] - }, - "reflinks": [ - "assemble", - "bach", - "base", - "composer", - "gulp", - "has-glob", - "is-valid-glob", - "micromatch", - "npm", - "scaffold", - "verb", - "vinyl" - ] - } -} diff --git a/server/node_modules/is-number/LICENSE b/server/node_modules/is-number/LICENSE deleted file mode 100644 index 9af4a67..0000000 --- a/server/node_modules/is-number/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014-present, Jon Schlinkert. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/server/node_modules/is-number/README.md b/server/node_modules/is-number/README.md deleted file mode 100644 index eb8149e..0000000 --- a/server/node_modules/is-number/README.md +++ /dev/null @@ -1,187 +0,0 @@ -# is-number [![NPM version](https://img.shields.io/npm/v/is-number.svg?style=flat)](https://www.npmjs.com/package/is-number) [![NPM monthly downloads](https://img.shields.io/npm/dm/is-number.svg?style=flat)](https://npmjs.org/package/is-number) [![NPM total downloads](https://img.shields.io/npm/dt/is-number.svg?style=flat)](https://npmjs.org/package/is-number) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/is-number.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/is-number) - -> Returns true if the value is a finite number. - -Please consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support. - -## Install - -Install with [npm](https://www.npmjs.com/): - -```sh -$ npm install --save is-number -``` - -## Why is this needed? - -In JavaScript, it's not always as straightforward as it should be to reliably check if a value is a number. It's common for devs to use `+`, `-`, or `Number()` to cast a string value to a number (for example, when values are returned from user input, regex matches, parsers, etc). But there are many non-intuitive edge cases that yield unexpected results: - -```js -console.log(+[]); //=> 0 -console.log(+''); //=> 0 -console.log(+' '); //=> 0 -console.log(typeof NaN); //=> 'number' -``` - -This library offers a performant way to smooth out edge cases like these. - -## Usage - -```js -const isNumber = require('is-number'); -``` - -See the [tests](./test.js) for more examples. - -### true - -```js -isNumber(5e3); // true -isNumber(0xff); // true -isNumber(-1.1); // true -isNumber(0); // true -isNumber(1); // true -isNumber(1.1); // true -isNumber(10); // true -isNumber(10.10); // true -isNumber(100); // true -isNumber('-1.1'); // true -isNumber('0'); // true -isNumber('012'); // true -isNumber('0xff'); // true -isNumber('1'); // true -isNumber('1.1'); // true -isNumber('10'); // true -isNumber('10.10'); // true -isNumber('100'); // true -isNumber('5e3'); // true -isNumber(parseInt('012')); // true -isNumber(parseFloat('012')); // true -``` - -### False - -Everything else is false, as you would expect: - -```js -isNumber(Infinity); // false -isNumber(NaN); // false -isNumber(null); // false -isNumber(undefined); // false -isNumber(''); // false -isNumber(' '); // false -isNumber('foo'); // false -isNumber([1]); // false -isNumber([]); // false -isNumber(function () {}); // false -isNumber({}); // false -``` - -## Release history - -### 7.0.0 - -* Refactor. Now uses `.isFinite` if it exists. -* Performance is about the same as v6.0 when the value is a string or number. But it's now 3x-4x faster when the value is not a string or number. - -### 6.0.0 - -* Optimizations, thanks to @benaadams. - -### 5.0.0 - -**Breaking changes** - -* removed support for `instanceof Number` and `instanceof String` - -## Benchmarks - -As with all benchmarks, take these with a grain of salt. See the [benchmarks](./benchmark/index.js) for more detail. - -``` -# all -v7.0 x 413,222 ops/sec ±2.02% (86 runs sampled) -v6.0 x 111,061 ops/sec ±1.29% (85 runs sampled) -parseFloat x 317,596 ops/sec ±1.36% (86 runs sampled) -fastest is 'v7.0' - -# string -v7.0 x 3,054,496 ops/sec ±1.05% (89 runs sampled) -v6.0 x 2,957,781 ops/sec ±0.98% (88 runs sampled) -parseFloat x 3,071,060 ops/sec ±1.13% (88 runs sampled) -fastest is 'parseFloat,v7.0' - -# number -v7.0 x 3,146,895 ops/sec ±0.89% (89 runs sampled) -v6.0 x 3,214,038 ops/sec ±1.07% (89 runs sampled) -parseFloat x 3,077,588 ops/sec ±1.07% (87 runs sampled) -fastest is 'v6.0' -``` - -## About - -
-Contributing - -Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). - -
- -
-Running Tests - -Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command: - -```sh -$ npm install && npm test -``` - -
- -
-Building docs - -_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_ - -To generate the readme, run the following command: - -```sh -$ npm install -g verbose/verb#dev verb-generate-readme && verb -``` - -
- -### Related projects - -You might also be interested in these projects: - -* [is-plain-object](https://www.npmjs.com/package/is-plain-object): Returns true if an object was created by the `Object` constructor. | [homepage](https://github.com/jonschlinkert/is-plain-object "Returns true if an object was created by the `Object` constructor.") -* [is-primitive](https://www.npmjs.com/package/is-primitive): Returns `true` if the value is a primitive. | [homepage](https://github.com/jonschlinkert/is-primitive "Returns `true` if the value is a primitive. ") -* [isobject](https://www.npmjs.com/package/isobject): Returns true if the value is an object and not an array or null. | [homepage](https://github.com/jonschlinkert/isobject "Returns true if the value is an object and not an array or null.") -* [kind-of](https://www.npmjs.com/package/kind-of): Get the native type of a value. | [homepage](https://github.com/jonschlinkert/kind-of "Get the native type of a value.") - -### Contributors - -| **Commits** | **Contributor** | -| --- | --- | -| 49 | [jonschlinkert](https://github.com/jonschlinkert) | -| 5 | [charlike-old](https://github.com/charlike-old) | -| 1 | [benaadams](https://github.com/benaadams) | -| 1 | [realityking](https://github.com/realityking) | - -### Author - -**Jon Schlinkert** - -* [LinkedIn Profile](https://linkedin.com/in/jonschlinkert) -* [GitHub Profile](https://github.com/jonschlinkert) -* [Twitter Profile](https://twitter.com/jonschlinkert) - -### License - -Copyright © 2018, [Jon Schlinkert](https://github.com/jonschlinkert). -Released under the [MIT License](LICENSE). - -*** - -_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on June 15, 2018._ \ No newline at end of file diff --git a/server/node_modules/is-number/index.js b/server/node_modules/is-number/index.js deleted file mode 100644 index 27f19b7..0000000 --- a/server/node_modules/is-number/index.js +++ /dev/null @@ -1,18 +0,0 @@ -/*! - * is-number - * - * Copyright (c) 2014-present, Jon Schlinkert. - * Released under the MIT License. - */ - -'use strict'; - -module.exports = function(num) { - if (typeof num === 'number') { - return num - num === 0; - } - if (typeof num === 'string' && num.trim() !== '') { - return Number.isFinite ? Number.isFinite(+num) : isFinite(+num); - } - return false; -}; diff --git a/server/node_modules/is-number/package.json b/server/node_modules/is-number/package.json deleted file mode 100644 index 3715072..0000000 --- a/server/node_modules/is-number/package.json +++ /dev/null @@ -1,82 +0,0 @@ -{ - "name": "is-number", - "description": "Returns true if a number or string value is a finite number. Useful for regex matches, parsing, user input, etc.", - "version": "7.0.0", - "homepage": "https://github.com/jonschlinkert/is-number", - "author": "Jon Schlinkert (https://github.com/jonschlinkert)", - "contributors": [ - "Jon Schlinkert (http://twitter.com/jonschlinkert)", - "Olsten Larck (https://i.am.charlike.online)", - "Rouven Weßling (www.rouvenwessling.de)" - ], - "repository": "jonschlinkert/is-number", - "bugs": { - "url": "https://github.com/jonschlinkert/is-number/issues" - }, - "license": "MIT", - "files": [ - "index.js" - ], - "main": "index.js", - "engines": { - "node": ">=0.12.0" - }, - "scripts": { - "test": "mocha" - }, - "devDependencies": { - "ansi": "^0.3.1", - "benchmark": "^2.1.4", - "gulp-format-md": "^1.0.0", - "mocha": "^3.5.3" - }, - "keywords": [ - "cast", - "check", - "coerce", - "coercion", - "finite", - "integer", - "is", - "isnan", - "is-nan", - "is-num", - "is-number", - "isnumber", - "isfinite", - "istype", - "kind", - "math", - "nan", - "num", - "number", - "numeric", - "parseFloat", - "parseInt", - "test", - "type", - "typeof", - "value" - ], - "verb": { - "toc": false, - "layout": "default", - "tasks": [ - "readme" - ], - "related": { - "list": [ - "is-plain-object", - "is-primitive", - "isobject", - "kind-of" - ] - }, - "plugins": [ - "gulp-format-md" - ], - "lint": { - "reflinks": true - } - } -} diff --git a/server/node_modules/normalize-path/LICENSE b/server/node_modules/normalize-path/LICENSE deleted file mode 100644 index d32ab44..0000000 --- a/server/node_modules/normalize-path/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014-2018, Jon Schlinkert. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/server/node_modules/normalize-path/README.md b/server/node_modules/normalize-path/README.md deleted file mode 100644 index 726d4d6..0000000 --- a/server/node_modules/normalize-path/README.md +++ /dev/null @@ -1,127 +0,0 @@ -# normalize-path [![NPM version](https://img.shields.io/npm/v/normalize-path.svg?style=flat)](https://www.npmjs.com/package/normalize-path) [![NPM monthly downloads](https://img.shields.io/npm/dm/normalize-path.svg?style=flat)](https://npmjs.org/package/normalize-path) [![NPM total downloads](https://img.shields.io/npm/dt/normalize-path.svg?style=flat)](https://npmjs.org/package/normalize-path) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/normalize-path.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/normalize-path) - -> Normalize slashes in a file path to be posix/unix-like forward slashes. Also condenses repeat slashes to a single slash and removes and trailing slashes, unless disabled. - -Please consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support. - -## Install - -Install with [npm](https://www.npmjs.com/): - -```sh -$ npm install --save normalize-path -``` - -## Usage - -```js -const normalize = require('normalize-path'); - -console.log(normalize('\\foo\\bar\\baz\\')); -//=> '/foo/bar/baz' -``` - -**win32 namespaces** - -```js -console.log(normalize('\\\\?\\UNC\\Server01\\user\\docs\\Letter.txt')); -//=> '//?/UNC/Server01/user/docs/Letter.txt' - -console.log(normalize('\\\\.\\CdRomX')); -//=> '//./CdRomX' -``` - -**Consecutive slashes** - -Condenses multiple consecutive forward slashes (except for leading slashes in win32 namespaces) to a single slash. - -```js -console.log(normalize('.//foo//bar///////baz/')); -//=> './foo/bar/baz' -``` - -### Trailing slashes - -By default trailing slashes are removed. Pass `false` as the last argument to disable this behavior and _**keep** trailing slashes_: - -```js -console.log(normalize('foo\\bar\\baz\\', false)); //=> 'foo/bar/baz/' -console.log(normalize('./foo/bar/baz/', false)); //=> './foo/bar/baz/' -``` - -## Release history - -### v3.0 - -No breaking changes in this release. - -* a check was added to ensure that [win32 namespaces](https://msdn.microsoft.com/library/windows/desktop/aa365247(v=vs.85).aspx#namespaces) are handled properly by win32 `path.parse()` after a path has been normalized by this library. -* a minor optimization was made to simplify how the trailing separator was handled - -## About - -
-Contributing - -Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). - -
- -
-Running Tests - -Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command: - -```sh -$ npm install && npm test -``` - -
- -
-Building docs - -_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_ - -To generate the readme, run the following command: - -```sh -$ npm install -g verbose/verb#dev verb-generate-readme && verb -``` - -
- -### Related projects - -Other useful path-related libraries: - -* [contains-path](https://www.npmjs.com/package/contains-path): Return true if a file path contains the given path. | [homepage](https://github.com/jonschlinkert/contains-path "Return true if a file path contains the given path.") -* [is-absolute](https://www.npmjs.com/package/is-absolute): Returns true if a file path is absolute. Does not rely on the path module… [more](https://github.com/jonschlinkert/is-absolute) | [homepage](https://github.com/jonschlinkert/is-absolute "Returns true if a file path is absolute. Does not rely on the path module and can be used as a polyfill for node.js native `path.isAbolute`.") -* [is-relative](https://www.npmjs.com/package/is-relative): Returns `true` if the path appears to be relative. | [homepage](https://github.com/jonschlinkert/is-relative "Returns `true` if the path appears to be relative.") -* [parse-filepath](https://www.npmjs.com/package/parse-filepath): Pollyfill for node.js `path.parse`, parses a filepath into an object. | [homepage](https://github.com/jonschlinkert/parse-filepath "Pollyfill for node.js `path.parse`, parses a filepath into an object.") -* [path-ends-with](https://www.npmjs.com/package/path-ends-with): Return `true` if a file path ends with the given string/suffix. | [homepage](https://github.com/jonschlinkert/path-ends-with "Return `true` if a file path ends with the given string/suffix.") -* [unixify](https://www.npmjs.com/package/unixify): Convert Windows file paths to unix paths. | [homepage](https://github.com/jonschlinkert/unixify "Convert Windows file paths to unix paths.") - -### Contributors - -| **Commits** | **Contributor** | -| --- | --- | -| 35 | [jonschlinkert](https://github.com/jonschlinkert) | -| 1 | [phated](https://github.com/phated) | - -### Author - -**Jon Schlinkert** - -* [LinkedIn Profile](https://linkedin.com/in/jonschlinkert) -* [GitHub Profile](https://github.com/jonschlinkert) -* [Twitter Profile](https://twitter.com/jonschlinkert) - -### License - -Copyright © 2018, [Jon Schlinkert](https://github.com/jonschlinkert). -Released under the [MIT License](LICENSE). - -*** - -_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on April 19, 2018._ \ No newline at end of file diff --git a/server/node_modules/normalize-path/index.js b/server/node_modules/normalize-path/index.js deleted file mode 100644 index 6fac553..0000000 --- a/server/node_modules/normalize-path/index.js +++ /dev/null @@ -1,35 +0,0 @@ -/*! - * normalize-path - * - * Copyright (c) 2014-2018, Jon Schlinkert. - * Released under the MIT License. - */ - -module.exports = function(path, stripTrailing) { - if (typeof path !== 'string') { - throw new TypeError('expected path to be a string'); - } - - if (path === '\\' || path === '/') return '/'; - - var len = path.length; - if (len <= 1) return path; - - // ensure that win32 namespaces has two leading slashes, so that the path is - // handled properly by the win32 version of path.parse() after being normalized - // https://msdn.microsoft.com/library/windows/desktop/aa365247(v=vs.85).aspx#namespaces - var prefix = ''; - if (len > 4 && path[3] === '\\') { - var ch = path[2]; - if ((ch === '?' || ch === '.') && path.slice(0, 2) === '\\\\') { - path = path.slice(2); - prefix = '//'; - } - } - - var segs = path.split(/[/\\]+/); - if (stripTrailing !== false && segs[segs.length - 1] === '') { - segs.pop(); - } - return prefix + segs.join('/'); -}; diff --git a/server/node_modules/normalize-path/package.json b/server/node_modules/normalize-path/package.json deleted file mode 100644 index ad61098..0000000 --- a/server/node_modules/normalize-path/package.json +++ /dev/null @@ -1,77 +0,0 @@ -{ - "name": "normalize-path", - "description": "Normalize slashes in a file path to be posix/unix-like forward slashes. Also condenses repeat slashes to a single slash and removes and trailing slashes, unless disabled.", - "version": "3.0.0", - "homepage": "https://github.com/jonschlinkert/normalize-path", - "author": "Jon Schlinkert (https://github.com/jonschlinkert)", - "contributors": [ - "Blaine Bublitz (https://twitter.com/BlaineBublitz)", - "Jon Schlinkert (http://twitter.com/jonschlinkert)" - ], - "repository": "jonschlinkert/normalize-path", - "bugs": { - "url": "https://github.com/jonschlinkert/normalize-path/issues" - }, - "license": "MIT", - "files": [ - "index.js" - ], - "main": "index.js", - "engines": { - "node": ">=0.10.0" - }, - "scripts": { - "test": "mocha" - }, - "devDependencies": { - "gulp-format-md": "^1.0.0", - "minimist": "^1.2.0", - "mocha": "^3.5.3" - }, - "keywords": [ - "absolute", - "backslash", - "delimiter", - "file", - "file-path", - "filepath", - "fix", - "forward", - "fp", - "fs", - "normalize", - "path", - "relative", - "separator", - "slash", - "slashes", - "trailing", - "unix", - "urix" - ], - "verb": { - "toc": false, - "layout": "default", - "tasks": [ - "readme" - ], - "plugins": [ - "gulp-format-md" - ], - "related": { - "description": "Other useful path-related libraries:", - "list": [ - "contains-path", - "is-absolute", - "is-relative", - "parse-filepath", - "path-ends-with", - "path-ends-with", - "unixify" - ] - }, - "lint": { - "reflinks": true - } - } -} diff --git a/server/node_modules/picomatch/CHANGELOG.md b/server/node_modules/picomatch/CHANGELOG.md deleted file mode 100644 index 1301f3a..0000000 --- a/server/node_modules/picomatch/CHANGELOG.md +++ /dev/null @@ -1,120 +0,0 @@ -# Release history - -**All notable changes to this project will be documented in this file.** - -The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) -and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). - -
- Guiding Principles - -- Changelogs are for humans, not machines. -- There should be an entry for every single version. -- The same types of changes should be grouped. -- Versions and sections should be linkable. -- The latest version comes first. -- The release date of each versions is displayed. -- Mention whether you follow Semantic Versioning. - -
- -
- Types of changes - -Changelog entries are classified using the following labels _(from [keep-a-changelog](http://keepachangelog.com/)_): - -- `Added` for new features. -- `Changed` for changes in existing functionality. -- `Deprecated` for soon-to-be removed features. -- `Removed` for now removed features. -- `Fixed` for any bug fixes. -- `Security` in case of vulnerabilities. - -
- -## 2.2.3 (2021-04-10) - -### Fixed - -* Do not skip pattern seperator for square brackets ([fb08a30](https://github.com/micromatch/picomatch/commit/fb08a30)). -* Set negatedExtGlob also if it does not span the whole pattern ([032e3f5](https://github.com/micromatch/picomatch/commit/032e3f5)). - -## 2.2.2 (2020-03-21) - -### Fixed - -* Correctly handle parts of the pattern after parentheses in the `scan` method ([e15b920](https://github.com/micromatch/picomatch/commit/e15b920)). - -## 2.2.1 (2020-01-04) - -* Fixes [#49](https://github.com/micromatch/picomatch/issues/49), so that braces with no sets or ranges are now propertly treated as literals. - -## 2.2.0 (2020-01-04) - -* Disable fastpaths mode for the parse method ([5b8d33f](https://github.com/micromatch/picomatch/commit/5b8d33f)) -* Add `tokens`, `slashes`, and `parts` to the object returned by `picomatch.scan()`. - -## 2.1.0 (2019-10-31) - -* add benchmarks for scan ([4793b92](https://github.com/micromatch/picomatch/commit/4793b92)) -* Add eslint object-curly-spacing rule ([707c650](https://github.com/micromatch/picomatch/commit/707c650)) -* Add prefer-const eslint rule ([5c7501c](https://github.com/micromatch/picomatch/commit/5c7501c)) -* Add support for nonegate in scan API ([275c9b9](https://github.com/micromatch/picomatch/commit/275c9b9)) -* Change lets to consts. Move root import up. ([4840625](https://github.com/micromatch/picomatch/commit/4840625)) -* closes https://github.com/micromatch/picomatch/issues/21 ([766bcb0](https://github.com/micromatch/picomatch/commit/766bcb0)) -* Fix "Extglobs" table in readme ([eb19da8](https://github.com/micromatch/picomatch/commit/eb19da8)) -* fixes https://github.com/micromatch/picomatch/issues/20 ([9caca07](https://github.com/micromatch/picomatch/commit/9caca07)) -* fixes https://github.com/micromatch/picomatch/issues/26 ([fa58f45](https://github.com/micromatch/picomatch/commit/fa58f45)) -* Lint test ([d433a34](https://github.com/micromatch/picomatch/commit/d433a34)) -* lint unit tests ([0159b55](https://github.com/micromatch/picomatch/commit/0159b55)) -* Make scan work with noext ([6c02e03](https://github.com/micromatch/picomatch/commit/6c02e03)) -* minor linting ([c2a2b87](https://github.com/micromatch/picomatch/commit/c2a2b87)) -* minor parser improvements ([197671d](https://github.com/micromatch/picomatch/commit/197671d)) -* remove eslint since it... ([07876fa](https://github.com/micromatch/picomatch/commit/07876fa)) -* remove funding file ([8ebe96d](https://github.com/micromatch/picomatch/commit/8ebe96d)) -* Remove unused funks ([cbc6d54](https://github.com/micromatch/picomatch/commit/cbc6d54)) -* Run eslint during pretest, fix existing eslint findings ([0682367](https://github.com/micromatch/picomatch/commit/0682367)) -* support `noparen` in scan ([3d37569](https://github.com/micromatch/picomatch/commit/3d37569)) -* update changelog ([7b34e77](https://github.com/micromatch/picomatch/commit/7b34e77)) -* update travis ([777f038](https://github.com/micromatch/picomatch/commit/777f038)) -* Use eslint-disable-next-line instead of eslint-disable ([4e7c1fd](https://github.com/micromatch/picomatch/commit/4e7c1fd)) - -## 2.0.7 (2019-05-14) - -* 2.0.7 ([9eb9a71](https://github.com/micromatch/picomatch/commit/9eb9a71)) -* supports lookbehinds ([1f63f7e](https://github.com/micromatch/picomatch/commit/1f63f7e)) -* update .verb.md file with typo change ([2741279](https://github.com/micromatch/picomatch/commit/2741279)) -* fix: typo in README ([0753e44](https://github.com/micromatch/picomatch/commit/0753e44)) - -## 2.0.4 (2019-04-10) - -### Fixed - -- Readme link [fixed](https://github.com/micromatch/picomatch/pull/13/commits/a96ab3aa2b11b6861c23289964613d85563b05df) by @danez. -- `options.capture` now works as expected when fastpaths are enabled. See https://github.com/micromatch/picomatch/pull/12/commits/26aefd71f1cfaf95c37f1c1fcab68a693b037304. Thanks to @DrPizza. - -## 2.0.0 (2019-04-10) - -### Added - -- Adds support for `options.onIgnore`. See the readme for details -- Adds support for `options.onResult`. See the readme for details - -### Breaking changes - -- The unixify option was renamed to `windows` -- caching and all related options and methods have been removed - -## 1.0.0 (2018-11-05) - -- adds `.onMatch` option -- improvements to `.scan` method -- numerous improvements and optimizations for matching and parsing -- better windows path handling - -## 0.1.0 - 2017-04-13 - -First release. - - -[keep-a-changelog]: https://github.com/olivierlacan/keep-a-changelog diff --git a/server/node_modules/picomatch/LICENSE b/server/node_modules/picomatch/LICENSE deleted file mode 100644 index 3608dca..0000000 --- a/server/node_modules/picomatch/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2017-present, Jon Schlinkert. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/server/node_modules/picomatch/README.md b/server/node_modules/picomatch/README.md deleted file mode 100644 index 85f4bfb..0000000 --- a/server/node_modules/picomatch/README.md +++ /dev/null @@ -1,691 +0,0 @@ -

Picomatch

- -

- - version - - - test status - - - coverage status - - - downloads - -

- -
-
- -

-Blazing fast and accurate glob matcher written in JavaScript.
-No dependencies and full support for standard and extended Bash glob features, including braces, extglobs, POSIX brackets, and regular expressions. -

- -
-
- -## Why picomatch? - -* **Lightweight** - No dependencies -* **Minimal** - Tiny API surface. Main export is a function that takes a glob pattern and returns a matcher function. -* **Fast** - Loads in about 2ms (that's several times faster than a [single frame of a HD movie](http://www.endmemo.com/sconvert/framespersecondframespermillisecond.php) at 60fps) -* **Performant** - Use the returned matcher function to speed up repeat matching (like when watching files) -* **Accurate matching** - Using wildcards (`*` and `?`), globstars (`**`) for nested directories, [advanced globbing](#advanced-globbing) with extglobs, braces, and POSIX brackets, and support for escaping special characters with `\` or quotes. -* **Well tested** - Thousands of unit tests - -See the [library comparison](#library-comparisons) to other libraries. - -
-
- -## Table of Contents - -
Click to expand - -- [Install](#install) -- [Usage](#usage) -- [API](#api) - * [picomatch](#picomatch) - * [.test](#test) - * [.matchBase](#matchbase) - * [.isMatch](#ismatch) - * [.parse](#parse) - * [.scan](#scan) - * [.compileRe](#compilere) - * [.toRegex](#toregex) -- [Options](#options) - * [Picomatch options](#picomatch-options) - * [Scan Options](#scan-options) - * [Options Examples](#options-examples) -- [Globbing features](#globbing-features) - * [Basic globbing](#basic-globbing) - * [Advanced globbing](#advanced-globbing) - * [Braces](#braces) - * [Matching special characters as literals](#matching-special-characters-as-literals) -- [Library Comparisons](#library-comparisons) -- [Benchmarks](#benchmarks) -- [Philosophies](#philosophies) -- [About](#about) - * [Author](#author) - * [License](#license) - -_(TOC generated by [verb](https://github.com/verbose/verb) using [markdown-toc](https://github.com/jonschlinkert/markdown-toc))_ - -
- -
-
- -## Install - -Install with [npm](https://www.npmjs.com/): - -```sh -npm install --save picomatch -``` - -
- -## Usage - -The main export is a function that takes a glob pattern and an options object and returns a function for matching strings. - -```js -const pm = require('picomatch'); -const isMatch = pm('*.js'); - -console.log(isMatch('abcd')); //=> false -console.log(isMatch('a.js')); //=> true -console.log(isMatch('a.md')); //=> false -console.log(isMatch('a/b.js')); //=> false -``` - -
- -## API - -### [picomatch](lib/picomatch.js#L32) - -Creates a matcher function from one or more glob patterns. The returned function takes a string to match as its first argument, and returns true if the string is a match. The returned matcher function also takes a boolean as the second argument that, when true, returns an object with additional information. - -**Params** - -* `globs` **{String|Array}**: One or more glob patterns. -* `options` **{Object=}** -* `returns` **{Function=}**: Returns a matcher function. - -**Example** - -```js -const picomatch = require('picomatch'); -// picomatch(glob[, options]); - -const isMatch = picomatch('*.!(*a)'); -console.log(isMatch('a.a')); //=> false -console.log(isMatch('a.b')); //=> true -``` - -### [.test](lib/picomatch.js#L117) - -Test `input` with the given `regex`. This is used by the main `picomatch()` function to test the input string. - -**Params** - -* `input` **{String}**: String to test. -* `regex` **{RegExp}** -* `returns` **{Object}**: Returns an object with matching info. - -**Example** - -```js -const picomatch = require('picomatch'); -// picomatch.test(input, regex[, options]); - -console.log(picomatch.test('foo/bar', /^(?:([^/]*?)\/([^/]*?))$/)); -// { isMatch: true, match: [ 'foo/', 'foo', 'bar' ], output: 'foo/bar' } -``` - -### [.matchBase](lib/picomatch.js#L161) - -Match the basename of a filepath. - -**Params** - -* `input` **{String}**: String to test. -* `glob` **{RegExp|String}**: Glob pattern or regex created by [.makeRe](#makeRe). -* `returns` **{Boolean}** - -**Example** - -```js -const picomatch = require('picomatch'); -// picomatch.matchBase(input, glob[, options]); -console.log(picomatch.matchBase('foo/bar.js', '*.js'); // true -``` - -### [.isMatch](lib/picomatch.js#L183) - -Returns true if **any** of the given glob `patterns` match the specified `string`. - -**Params** - -* **{String|Array}**: str The string to test. -* **{String|Array}**: patterns One or more glob patterns to use for matching. -* **{Object}**: See available [options](#options). -* `returns` **{Boolean}**: Returns true if any patterns match `str` - -**Example** - -```js -const picomatch = require('picomatch'); -// picomatch.isMatch(string, patterns[, options]); - -console.log(picomatch.isMatch('a.a', ['b.*', '*.a'])); //=> true -console.log(picomatch.isMatch('a.a', 'b.*')); //=> false -``` - -### [.parse](lib/picomatch.js#L199) - -Parse a glob pattern to create the source string for a regular expression. - -**Params** - -* `pattern` **{String}** -* `options` **{Object}** -* `returns` **{Object}**: Returns an object with useful properties and output to be used as a regex source string. - -**Example** - -```js -const picomatch = require('picomatch'); -const result = picomatch.parse(pattern[, options]); -``` - -### [.scan](lib/picomatch.js#L231) - -Scan a glob pattern to separate the pattern into segments. - -**Params** - -* `input` **{String}**: Glob pattern to scan. -* `options` **{Object}** -* `returns` **{Object}**: Returns an object with - -**Example** - -```js -const picomatch = require('picomatch'); -// picomatch.scan(input[, options]); - -const result = picomatch.scan('!./foo/*.js'); -console.log(result); -{ prefix: '!./', - input: '!./foo/*.js', - start: 3, - base: 'foo', - glob: '*.js', - isBrace: false, - isBracket: false, - isGlob: true, - isExtglob: false, - isGlobstar: false, - negated: true } -``` - -### [.compileRe](lib/picomatch.js#L250) - -Create a regular expression from a parsed glob pattern. - -**Params** - -* `state` **{String}**: The object returned from the `.parse` method. -* `options` **{Object}** -* `returns` **{RegExp}**: Returns a regex created from the given pattern. - -**Example** - -```js -const picomatch = require('picomatch'); -const state = picomatch.parse('*.js'); -// picomatch.compileRe(state[, options]); - -console.log(picomatch.compileRe(state)); -//=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/ -``` - -### [.toRegex](lib/picomatch.js#L318) - -Create a regular expression from the given regex source string. - -**Params** - -* `source` **{String}**: Regular expression source string. -* `options` **{Object}** -* `returns` **{RegExp}** - -**Example** - -```js -const picomatch = require('picomatch'); -// picomatch.toRegex(source[, options]); - -const { output } = picomatch.parse('*.js'); -console.log(picomatch.toRegex(output)); -//=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/ -``` - -
- -## Options - -### Picomatch options - -The following options may be used with the main `picomatch()` function or any of the methods on the picomatch API. - -| **Option** | **Type** | **Default value** | **Description** | -| --- | --- | --- | --- | -| `basename` | `boolean` | `false` | If set, then patterns without slashes will be matched against the basename of the path if it contains slashes. For example, `a?b` would match the path `/xyz/123/acb`, but not `/xyz/acb/123`. | -| `bash` | `boolean` | `false` | Follow bash matching rules more strictly - disallows backslashes as escape characters, and treats single stars as globstars (`**`). | -| `capture` | `boolean` | `undefined` | Return regex matches in supporting methods. | -| `contains` | `boolean` | `undefined` | Allows glob to match any part of the given string(s). | -| `cwd` | `string` | `process.cwd()` | Current working directory. Used by `picomatch.split()` | -| `debug` | `boolean` | `undefined` | Debug regular expressions when an error is thrown. | -| `dot` | `boolean` | `false` | Enable dotfile matching. By default, dotfiles are ignored unless a `.` is explicitly defined in the pattern, or `options.dot` is true | -| `expandRange` | `function` | `undefined` | Custom function for expanding ranges in brace patterns, such as `{a..z}`. The function receives the range values as two arguments, and it must return a string to be used in the generated regex. It's recommended that returned strings be wrapped in parentheses. | -| `failglob` | `boolean` | `false` | Throws an error if no matches are found. Based on the bash option of the same name. | -| `fastpaths` | `boolean` | `true` | To speed up processing, full parsing is skipped for a handful common glob patterns. Disable this behavior by setting this option to `false`. | -| `flags` | `boolean` | `undefined` | Regex flags to use in the generated regex. If defined, the `nocase` option will be overridden. | -| [format](#optionsformat) | `function` | `undefined` | Custom function for formatting the returned string. This is useful for removing leading slashes, converting Windows paths to Posix paths, etc. | -| `ignore` | `array\|string` | `undefined` | One or more glob patterns for excluding strings that should not be matched from the result. | -| `keepQuotes` | `boolean` | `false` | Retain quotes in the generated regex, since quotes may also be used as an alternative to backslashes. | -| `literalBrackets` | `boolean` | `undefined` | When `true`, brackets in the glob pattern will be escaped so that only literal brackets will be matched. | -| `lookbehinds` | `boolean` | `true` | Support regex positive and negative lookbehinds. Note that you must be using Node 8.1.10 or higher to enable regex lookbehinds. | -| `matchBase` | `boolean` | `false` | Alias for `basename` | -| `maxLength` | `boolean` | `65536` | Limit the max length of the input string. An error is thrown if the input string is longer than this value. | -| `nobrace` | `boolean` | `false` | Disable brace matching, so that `{a,b}` and `{1..3}` would be treated as literal characters. | -| `nobracket` | `boolean` | `undefined` | Disable matching with regex brackets. | -| `nocase` | `boolean` | `false` | Make matching case-insensitive. Equivalent to the regex `i` flag. Note that this option is overridden by the `flags` option. | -| `nodupes` | `boolean` | `true` | Deprecated, use `nounique` instead. This option will be removed in a future major release. By default duplicates are removed. Disable uniquification by setting this option to false. | -| `noext` | `boolean` | `false` | Alias for `noextglob` | -| `noextglob` | `boolean` | `false` | Disable support for matching with extglobs (like `+(a\|b)`) | -| `noglobstar` | `boolean` | `false` | Disable support for matching nested directories with globstars (`**`) | -| `nonegate` | `boolean` | `false` | Disable support for negating with leading `!` | -| `noquantifiers` | `boolean` | `false` | Disable support for regex quantifiers (like `a{1,2}`) and treat them as brace patterns to be expanded. | -| [onIgnore](#optionsonIgnore) | `function` | `undefined` | Function to be called on ignored items. | -| [onMatch](#optionsonMatch) | `function` | `undefined` | Function to be called on matched items. | -| [onResult](#optionsonResult) | `function` | `undefined` | Function to be called on all items, regardless of whether or not they are matched or ignored. | -| `posix` | `boolean` | `false` | Support POSIX character classes ("posix brackets"). | -| `posixSlashes` | `boolean` | `undefined` | Convert all slashes in file paths to forward slashes. This does not convert slashes in the glob pattern itself | -| `prepend` | `boolean` | `undefined` | String to prepend to the generated regex used for matching. | -| `regex` | `boolean` | `false` | Use regular expression rules for `+` (instead of matching literal `+`), and for stars that follow closing parentheses or brackets (as in `)*` and `]*`). | -| `strictBrackets` | `boolean` | `undefined` | Throw an error if brackets, braces, or parens are imbalanced. | -| `strictSlashes` | `boolean` | `undefined` | When true, picomatch won't match trailing slashes with single stars. | -| `unescape` | `boolean` | `undefined` | Remove backslashes preceding escaped characters in the glob pattern. By default, backslashes are retained. | -| `unixify` | `boolean` | `undefined` | Alias for `posixSlashes`, for backwards compatibility. | - -### Scan Options - -In addition to the main [picomatch options](#picomatch-options), the following options may also be used with the [.scan](#scan) method. - -| **Option** | **Type** | **Default value** | **Description** | -| --- | --- | --- | --- | -| `tokens` | `boolean` | `false` | When `true`, the returned object will include an array of tokens (objects), representing each path "segment" in the scanned glob pattern | -| `parts` | `boolean` | `false` | When `true`, the returned object will include an array of strings representing each path "segment" in the scanned glob pattern. This is automatically enabled when `options.tokens` is true | - -**Example** - -```js -const picomatch = require('picomatch'); -const result = picomatch.scan('!./foo/*.js', { tokens: true }); -console.log(result); -// { -// prefix: '!./', -// input: '!./foo/*.js', -// start: 3, -// base: 'foo', -// glob: '*.js', -// isBrace: false, -// isBracket: false, -// isGlob: true, -// isExtglob: false, -// isGlobstar: false, -// negated: true, -// maxDepth: 2, -// tokens: [ -// { value: '!./', depth: 0, isGlob: false, negated: true, isPrefix: true }, -// { value: 'foo', depth: 1, isGlob: false }, -// { value: '*.js', depth: 1, isGlob: true } -// ], -// slashes: [ 2, 6 ], -// parts: [ 'foo', '*.js' ] -// } -``` - -
- -### Options Examples - -#### options.expandRange - -**Type**: `function` - -**Default**: `undefined` - -Custom function for expanding ranges in brace patterns. The [fill-range](https://github.com/jonschlinkert/fill-range) library is ideal for this purpose, or you can use custom code to do whatever you need. - -**Example** - -The following example shows how to create a glob that matches a folder - -```js -const fill = require('fill-range'); -const regex = pm.makeRe('foo/{01..25}/bar', { - expandRange(a, b) { - return `(${fill(a, b, { toRegex: true })})`; - } -}); - -console.log(regex); -//=> /^(?:foo\/((?:0[1-9]|1[0-9]|2[0-5]))\/bar)$/ - -console.log(regex.test('foo/00/bar')) // false -console.log(regex.test('foo/01/bar')) // true -console.log(regex.test('foo/10/bar')) // true -console.log(regex.test('foo/22/bar')) // true -console.log(regex.test('foo/25/bar')) // true -console.log(regex.test('foo/26/bar')) // false -``` - -#### options.format - -**Type**: `function` - -**Default**: `undefined` - -Custom function for formatting strings before they're matched. - -**Example** - -```js -// strip leading './' from strings -const format = str => str.replace(/^\.\//, ''); -const isMatch = picomatch('foo/*.js', { format }); -console.log(isMatch('./foo/bar.js')); //=> true -``` - -#### options.onMatch - -```js -const onMatch = ({ glob, regex, input, output }) => { - console.log({ glob, regex, input, output }); -}; - -const isMatch = picomatch('*', { onMatch }); -isMatch('foo'); -isMatch('bar'); -isMatch('baz'); -``` - -#### options.onIgnore - -```js -const onIgnore = ({ glob, regex, input, output }) => { - console.log({ glob, regex, input, output }); -}; - -const isMatch = picomatch('*', { onIgnore, ignore: 'f*' }); -isMatch('foo'); -isMatch('bar'); -isMatch('baz'); -``` - -#### options.onResult - -```js -const onResult = ({ glob, regex, input, output }) => { - console.log({ glob, regex, input, output }); -}; - -const isMatch = picomatch('*', { onResult, ignore: 'f*' }); -isMatch('foo'); -isMatch('bar'); -isMatch('baz'); -``` - -
-
- -## Globbing features - -* [Basic globbing](#basic-globbing) (Wildcard matching) -* [Advanced globbing](#advanced-globbing) (extglobs, posix brackets, brace matching) - -### Basic globbing - -| **Character** | **Description** | -| --- | --- | -| `*` | Matches any character zero or more times, excluding path separators. Does _not match_ path separators or hidden files or directories ("dotfiles"), unless explicitly enabled by setting the `dot` option to `true`. | -| `**` | Matches any character zero or more times, including path separators. Note that `**` will only match path separators (`/`, and `\\` on Windows) when they are the only characters in a path segment. Thus, `foo**/bar` is equivalent to `foo*/bar`, and `foo/a**b/bar` is equivalent to `foo/a*b/bar`, and _more than two_ consecutive stars in a glob path segment are regarded as _a single star_. Thus, `foo/***/bar` is equivalent to `foo/*/bar`. | -| `?` | Matches any character excluding path separators one time. Does _not match_ path separators or leading dots. | -| `[abc]` | Matches any characters inside the brackets. For example, `[abc]` would match the characters `a`, `b` or `c`, and nothing else. | - -#### Matching behavior vs. Bash - -Picomatch's matching features and expected results in unit tests are based on Bash's unit tests and the Bash 4.3 specification, with the following exceptions: - -* Bash will match `foo/bar/baz` with `*`. Picomatch only matches nested directories with `**`. -* Bash greedily matches with negated extglobs. For example, Bash 4.3 says that `!(foo)*` should match `foo` and `foobar`, since the trailing `*` bracktracks to match the preceding pattern. This is very memory-inefficient, and IMHO, also incorrect. Picomatch would return `false` for both `foo` and `foobar`. - -
- -### Advanced globbing - -* [extglobs](#extglobs) -* [POSIX brackets](#posix-brackets) -* [Braces](#brace-expansion) - -#### Extglobs - -| **Pattern** | **Description** | -| --- | --- | -| `@(pattern)` | Match _only one_ consecutive occurrence of `pattern` | -| `*(pattern)` | Match _zero or more_ consecutive occurrences of `pattern` | -| `+(pattern)` | Match _one or more_ consecutive occurrences of `pattern` | -| `?(pattern)` | Match _zero or **one**_ consecutive occurrences of `pattern` | -| `!(pattern)` | Match _anything but_ `pattern` | - -**Examples** - -```js -const pm = require('picomatch'); - -// *(pattern) matches ZERO or more of "pattern" -console.log(pm.isMatch('a', 'a*(z)')); // true -console.log(pm.isMatch('az', 'a*(z)')); // true -console.log(pm.isMatch('azzz', 'a*(z)')); // true - -// +(pattern) matches ONE or more of "pattern" -console.log(pm.isMatch('a', 'a*(z)')); // true -console.log(pm.isMatch('az', 'a*(z)')); // true -console.log(pm.isMatch('azzz', 'a*(z)')); // true - -// supports multiple extglobs -console.log(pm.isMatch('foo.bar', '!(foo).!(bar)')); // false - -// supports nested extglobs -console.log(pm.isMatch('foo.bar', '!(!(foo)).!(!(bar))')); // true -``` - -#### POSIX brackets - -POSIX classes are disabled by default. Enable this feature by setting the `posix` option to true. - -**Enable POSIX bracket support** - -```js -console.log(pm.makeRe('[[:word:]]+', { posix: true })); -//=> /^(?:(?=.)[A-Za-z0-9_]+\/?)$/ -``` - -**Supported POSIX classes** - -The following named POSIX bracket expressions are supported: - -* `[:alnum:]` - Alphanumeric characters, equ `[a-zA-Z0-9]` -* `[:alpha:]` - Alphabetical characters, equivalent to `[a-zA-Z]`. -* `[:ascii:]` - ASCII characters, equivalent to `[\\x00-\\x7F]`. -* `[:blank:]` - Space and tab characters, equivalent to `[ \\t]`. -* `[:cntrl:]` - Control characters, equivalent to `[\\x00-\\x1F\\x7F]`. -* `[:digit:]` - Numerical digits, equivalent to `[0-9]`. -* `[:graph:]` - Graph characters, equivalent to `[\\x21-\\x7E]`. -* `[:lower:]` - Lowercase letters, equivalent to `[a-z]`. -* `[:print:]` - Print characters, equivalent to `[\\x20-\\x7E ]`. -* `[:punct:]` - Punctuation and symbols, equivalent to `[\\-!"#$%&\'()\\*+,./:;<=>?@[\\]^_`{|}~]`. -* `[:space:]` - Extended space characters, equivalent to `[ \\t\\r\\n\\v\\f]`. -* `[:upper:]` - Uppercase letters, equivalent to `[A-Z]`. -* `[:word:]` - Word characters (letters, numbers and underscores), equivalent to `[A-Za-z0-9_]`. -* `[:xdigit:]` - Hexadecimal digits, equivalent to `[A-Fa-f0-9]`. - -See the [Bash Reference Manual](https://www.gnu.org/software/bash/manual/html_node/Pattern-Matching.html) for more information. - -### Braces - -Picomatch does not do brace expansion. For [brace expansion](https://www.gnu.org/software/bash/manual/html_node/Brace-Expansion.html) and advanced matching with braces, use [micromatch](https://github.com/micromatch/micromatch) instead. Picomatch has very basic support for braces. - -### Matching special characters as literals - -If you wish to match the following special characters in a filepath, and you want to use these characters in your glob pattern, they must be escaped with backslashes or quotes: - -**Special Characters** - -Some characters that are used for matching in regular expressions are also regarded as valid file path characters on some platforms. - -To match any of the following characters as literals: `$^*+?()[]` - -Examples: - -```js -console.log(pm.makeRe('foo/bar \\(1\\)')); -console.log(pm.makeRe('foo/bar \\(1\\)')); -``` - -
-
- -## Library Comparisons - -The following table shows which features are supported by [minimatch](https://github.com/isaacs/minimatch), [micromatch](https://github.com/micromatch/micromatch), [picomatch](https://github.com/micromatch/picomatch), [nanomatch](https://github.com/micromatch/nanomatch), [extglob](https://github.com/micromatch/extglob), [braces](https://github.com/micromatch/braces), and [expand-brackets](https://github.com/micromatch/expand-brackets). - -| **Feature** | `minimatch` | `micromatch` | `picomatch` | `nanomatch` | `extglob` | `braces` | `expand-brackets` | -| --- | --- | --- | --- | --- | --- | --- | --- | -| Wildcard matching (`*?+`) | ✔ | ✔ | ✔ | ✔ | - | - | - | -| Advancing globbing | ✔ | ✔ | ✔ | - | - | - | - | -| Brace _matching_ | ✔ | ✔ | ✔ | - | - | ✔ | - | -| Brace _expansion_ | ✔ | ✔ | - | - | - | ✔ | - | -| Extglobs | partial | ✔ | ✔ | - | ✔ | - | - | -| Posix brackets | - | ✔ | ✔ | - | - | - | ✔ | -| Regular expression syntax | - | ✔ | ✔ | ✔ | ✔ | - | ✔ | -| File system operations | - | - | - | - | - | - | - | - -
-
- -## Benchmarks - -Performance comparison of picomatch and minimatch. - -``` -# .makeRe star - picomatch x 1,993,050 ops/sec ±0.51% (91 runs sampled) - minimatch x 627,206 ops/sec ±1.96% (87 runs sampled)) - -# .makeRe star; dot=true - picomatch x 1,436,640 ops/sec ±0.62% (91 runs sampled) - minimatch x 525,876 ops/sec ±0.60% (88 runs sampled) - -# .makeRe globstar - picomatch x 1,592,742 ops/sec ±0.42% (90 runs sampled) - minimatch x 962,043 ops/sec ±1.76% (91 runs sampled)d) - -# .makeRe globstars - picomatch x 1,615,199 ops/sec ±0.35% (94 runs sampled) - minimatch x 477,179 ops/sec ±1.33% (91 runs sampled) - -# .makeRe with leading star - picomatch x 1,220,856 ops/sec ±0.40% (92 runs sampled) - minimatch x 453,564 ops/sec ±1.43% (94 runs sampled) - -# .makeRe - basic braces - picomatch x 392,067 ops/sec ±0.70% (90 runs sampled) - minimatch x 99,532 ops/sec ±2.03% (87 runs sampled)) -``` - -
-
- -## Philosophies - -The goal of this library is to be blazing fast, without compromising on accuracy. - -**Accuracy** - -The number one of goal of this library is accuracy. However, it's not unusual for different glob implementations to have different rules for matching behavior, even with simple wildcard matching. It gets increasingly more complicated when combinations of different features are combined, like when extglobs are combined with globstars, braces, slashes, and so on: `!(**/{a,b,*/c})`. - -Thus, given that there is no canonical glob specification to use as a single source of truth when differences of opinion arise regarding behavior, sometimes we have to implement our best judgement and rely on feedback from users to make improvements. - -**Performance** - -Although this library performs well in benchmarks, and in most cases it's faster than other popular libraries we benchmarked against, we will always choose accuracy over performance. It's not helpful to anyone if our library is faster at returning the wrong answer. - -
-
- -## About - -
-Contributing - -Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). - -Please read the [contributing guide](.github/contributing.md) for advice on opening issues, pull requests, and coding standards. - -
- -
-Running Tests - -Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command: - -```sh -npm install && npm test -``` - -
- -
-Building docs - -_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_ - -To generate the readme, run the following command: - -```sh -npm install -g verbose/verb#dev verb-generate-readme && verb -``` - -
- -### Author - -**Jon Schlinkert** - -* [GitHub Profile](https://github.com/jonschlinkert) -* [Twitter Profile](https://twitter.com/jonschlinkert) -* [LinkedIn Profile](https://linkedin.com/in/jonschlinkert) - -### License - -Copyright © 2017-present, [Jon Schlinkert](https://github.com/jonschlinkert). -Released under the [MIT License](LICENSE). diff --git a/server/node_modules/picomatch/index.js b/server/node_modules/picomatch/index.js deleted file mode 100644 index d2f2bc5..0000000 --- a/server/node_modules/picomatch/index.js +++ /dev/null @@ -1,3 +0,0 @@ -'use strict'; - -module.exports = require('./lib/picomatch'); diff --git a/server/node_modules/picomatch/lib/constants.js b/server/node_modules/picomatch/lib/constants.js deleted file mode 100644 index a62ef38..0000000 --- a/server/node_modules/picomatch/lib/constants.js +++ /dev/null @@ -1,179 +0,0 @@ -'use strict'; - -const path = require('path'); -const WIN_SLASH = '\\\\/'; -const WIN_NO_SLASH = `[^${WIN_SLASH}]`; - -/** - * Posix glob regex - */ - -const DOT_LITERAL = '\\.'; -const PLUS_LITERAL = '\\+'; -const QMARK_LITERAL = '\\?'; -const SLASH_LITERAL = '\\/'; -const ONE_CHAR = '(?=.)'; -const QMARK = '[^/]'; -const END_ANCHOR = `(?:${SLASH_LITERAL}|$)`; -const START_ANCHOR = `(?:^|${SLASH_LITERAL})`; -const DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`; -const NO_DOT = `(?!${DOT_LITERAL})`; -const NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`; -const NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`; -const NO_DOTS_SLASH = `(?!${DOTS_SLASH})`; -const QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`; -const STAR = `${QMARK}*?`; - -const POSIX_CHARS = { - DOT_LITERAL, - PLUS_LITERAL, - QMARK_LITERAL, - SLASH_LITERAL, - ONE_CHAR, - QMARK, - END_ANCHOR, - DOTS_SLASH, - NO_DOT, - NO_DOTS, - NO_DOT_SLASH, - NO_DOTS_SLASH, - QMARK_NO_DOT, - STAR, - START_ANCHOR -}; - -/** - * Windows glob regex - */ - -const WINDOWS_CHARS = { - ...POSIX_CHARS, - - SLASH_LITERAL: `[${WIN_SLASH}]`, - QMARK: WIN_NO_SLASH, - STAR: `${WIN_NO_SLASH}*?`, - DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`, - NO_DOT: `(?!${DOT_LITERAL})`, - NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`, - NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`, - NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`, - QMARK_NO_DOT: `[^.${WIN_SLASH}]`, - START_ANCHOR: `(?:^|[${WIN_SLASH}])`, - END_ANCHOR: `(?:[${WIN_SLASH}]|$)` -}; - -/** - * POSIX Bracket Regex - */ - -const POSIX_REGEX_SOURCE = { - alnum: 'a-zA-Z0-9', - alpha: 'a-zA-Z', - ascii: '\\x00-\\x7F', - blank: ' \\t', - cntrl: '\\x00-\\x1F\\x7F', - digit: '0-9', - graph: '\\x21-\\x7E', - lower: 'a-z', - print: '\\x20-\\x7E ', - punct: '\\-!"#$%&\'()\\*+,./:;<=>?@[\\]^_`{|}~', - space: ' \\t\\r\\n\\v\\f', - upper: 'A-Z', - word: 'A-Za-z0-9_', - xdigit: 'A-Fa-f0-9' -}; - -module.exports = { - MAX_LENGTH: 1024 * 64, - POSIX_REGEX_SOURCE, - - // regular expressions - REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g, - REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/, - REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/, - REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g, - REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g, - REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g, - - // Replace globs with equivalent patterns to reduce parsing time. - REPLACEMENTS: { - '***': '*', - '**/**': '**', - '**/**/**': '**' - }, - - // Digits - CHAR_0: 48, /* 0 */ - CHAR_9: 57, /* 9 */ - - // Alphabet chars. - CHAR_UPPERCASE_A: 65, /* A */ - CHAR_LOWERCASE_A: 97, /* a */ - CHAR_UPPERCASE_Z: 90, /* Z */ - CHAR_LOWERCASE_Z: 122, /* z */ - - CHAR_LEFT_PARENTHESES: 40, /* ( */ - CHAR_RIGHT_PARENTHESES: 41, /* ) */ - - CHAR_ASTERISK: 42, /* * */ - - // Non-alphabetic chars. - CHAR_AMPERSAND: 38, /* & */ - CHAR_AT: 64, /* @ */ - CHAR_BACKWARD_SLASH: 92, /* \ */ - CHAR_CARRIAGE_RETURN: 13, /* \r */ - CHAR_CIRCUMFLEX_ACCENT: 94, /* ^ */ - CHAR_COLON: 58, /* : */ - CHAR_COMMA: 44, /* , */ - CHAR_DOT: 46, /* . */ - CHAR_DOUBLE_QUOTE: 34, /* " */ - CHAR_EQUAL: 61, /* = */ - CHAR_EXCLAMATION_MARK: 33, /* ! */ - CHAR_FORM_FEED: 12, /* \f */ - CHAR_FORWARD_SLASH: 47, /* / */ - CHAR_GRAVE_ACCENT: 96, /* ` */ - CHAR_HASH: 35, /* # */ - CHAR_HYPHEN_MINUS: 45, /* - */ - CHAR_LEFT_ANGLE_BRACKET: 60, /* < */ - CHAR_LEFT_CURLY_BRACE: 123, /* { */ - CHAR_LEFT_SQUARE_BRACKET: 91, /* [ */ - CHAR_LINE_FEED: 10, /* \n */ - CHAR_NO_BREAK_SPACE: 160, /* \u00A0 */ - CHAR_PERCENT: 37, /* % */ - CHAR_PLUS: 43, /* + */ - CHAR_QUESTION_MARK: 63, /* ? */ - CHAR_RIGHT_ANGLE_BRACKET: 62, /* > */ - CHAR_RIGHT_CURLY_BRACE: 125, /* } */ - CHAR_RIGHT_SQUARE_BRACKET: 93, /* ] */ - CHAR_SEMICOLON: 59, /* ; */ - CHAR_SINGLE_QUOTE: 39, /* ' */ - CHAR_SPACE: 32, /* */ - CHAR_TAB: 9, /* \t */ - CHAR_UNDERSCORE: 95, /* _ */ - CHAR_VERTICAL_LINE: 124, /* | */ - CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279, /* \uFEFF */ - - SEP: path.sep, - - /** - * Create EXTGLOB_CHARS - */ - - extglobChars(chars) { - return { - '!': { type: 'negate', open: '(?:(?!(?:', close: `))${chars.STAR})` }, - '?': { type: 'qmark', open: '(?:', close: ')?' }, - '+': { type: 'plus', open: '(?:', close: ')+' }, - '*': { type: 'star', open: '(?:', close: ')*' }, - '@': { type: 'at', open: '(?:', close: ')' } - }; - }, - - /** - * Create GLOB_CHARS - */ - - globChars(win32) { - return win32 === true ? WINDOWS_CHARS : POSIX_CHARS; - } -}; diff --git a/server/node_modules/picomatch/lib/parse.js b/server/node_modules/picomatch/lib/parse.js deleted file mode 100644 index bb8e043..0000000 --- a/server/node_modules/picomatch/lib/parse.js +++ /dev/null @@ -1,1078 +0,0 @@ -'use strict'; - -const constants = require('./constants'); -const utils = require('./utils'); - -/** - * Constants - */ - -const { - MAX_LENGTH, - POSIX_REGEX_SOURCE, - REGEX_NON_SPECIAL_CHARS, - REGEX_SPECIAL_CHARS_BACKREF, - REPLACEMENTS -} = constants; - -/** - * Helpers - */ - -const expandRange = (args, options) => { - if (typeof options.expandRange === 'function') { - return options.expandRange(...args, options); - } - - args.sort(); - const value = `[${args.join('-')}]`; - - try { - /* eslint-disable-next-line no-new */ - new RegExp(value); - } catch (ex) { - return args.map(v => utils.escapeRegex(v)).join('..'); - } - - return value; -}; - -/** - * Create the message for a syntax error - */ - -const syntaxError = (type, char) => { - return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`; -}; - -/** - * Parse the given input string. - * @param {String} input - * @param {Object} options - * @return {Object} - */ - -const parse = (input, options) => { - if (typeof input !== 'string') { - throw new TypeError('Expected a string'); - } - - input = REPLACEMENTS[input] || input; - - const opts = { ...options }; - const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH; - - let len = input.length; - if (len > max) { - throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`); - } - - const bos = { type: 'bos', value: '', output: opts.prepend || '' }; - const tokens = [bos]; - - const capture = opts.capture ? '' : '?:'; - const win32 = utils.isWindows(options); - - // create constants based on platform, for windows or posix - const PLATFORM_CHARS = constants.globChars(win32); - const EXTGLOB_CHARS = constants.extglobChars(PLATFORM_CHARS); - - const { - DOT_LITERAL, - PLUS_LITERAL, - SLASH_LITERAL, - ONE_CHAR, - DOTS_SLASH, - NO_DOT, - NO_DOT_SLASH, - NO_DOTS_SLASH, - QMARK, - QMARK_NO_DOT, - STAR, - START_ANCHOR - } = PLATFORM_CHARS; - - const globstar = (opts) => { - return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`; - }; - - const nodot = opts.dot ? '' : NO_DOT; - const qmarkNoDot = opts.dot ? QMARK : QMARK_NO_DOT; - let star = opts.bash === true ? globstar(opts) : STAR; - - if (opts.capture) { - star = `(${star})`; - } - - // minimatch options support - if (typeof opts.noext === 'boolean') { - opts.noextglob = opts.noext; - } - - const state = { - input, - index: -1, - start: 0, - dot: opts.dot === true, - consumed: '', - output: '', - prefix: '', - backtrack: false, - negated: false, - brackets: 0, - braces: 0, - parens: 0, - quotes: 0, - globstar: false, - tokens - }; - - input = utils.removePrefix(input, state); - len = input.length; - - const extglobs = []; - const braces = []; - const stack = []; - let prev = bos; - let value; - - /** - * Tokenizing helpers - */ - - const eos = () => state.index === len - 1; - const peek = state.peek = (n = 1) => input[state.index + n]; - const advance = state.advance = () => input[++state.index]; - const remaining = () => input.slice(state.index + 1); - const consume = (value = '', num = 0) => { - state.consumed += value; - state.index += num; - }; - const append = token => { - state.output += token.output != null ? token.output : token.value; - consume(token.value); - }; - - const negate = () => { - let count = 1; - - while (peek() === '!' && (peek(2) !== '(' || peek(3) === '?')) { - advance(); - state.start++; - count++; - } - - if (count % 2 === 0) { - return false; - } - - state.negated = true; - state.start++; - return true; - }; - - const increment = type => { - state[type]++; - stack.push(type); - }; - - const decrement = type => { - state[type]--; - stack.pop(); - }; - - /** - * Push tokens onto the tokens array. This helper speeds up - * tokenizing by 1) helping us avoid backtracking as much as possible, - * and 2) helping us avoid creating extra tokens when consecutive - * characters are plain text. This improves performance and simplifies - * lookbehinds. - */ - - const push = tok => { - if (prev.type === 'globstar') { - const isBrace = state.braces > 0 && (tok.type === 'comma' || tok.type === 'brace'); - const isExtglob = tok.extglob === true || (extglobs.length && (tok.type === 'pipe' || tok.type === 'paren')); - - if (tok.type !== 'slash' && tok.type !== 'paren' && !isBrace && !isExtglob) { - state.output = state.output.slice(0, -prev.output.length); - prev.type = 'star'; - prev.value = '*'; - prev.output = star; - state.output += prev.output; - } - } - - if (extglobs.length && tok.type !== 'paren' && !EXTGLOB_CHARS[tok.value]) { - extglobs[extglobs.length - 1].inner += tok.value; - } - - if (tok.value || tok.output) append(tok); - if (prev && prev.type === 'text' && tok.type === 'text') { - prev.value += tok.value; - prev.output = (prev.output || '') + tok.value; - return; - } - - tok.prev = prev; - tokens.push(tok); - prev = tok; - }; - - const extglobOpen = (type, value) => { - const token = { ...EXTGLOB_CHARS[value], conditions: 1, inner: '' }; - - token.prev = prev; - token.parens = state.parens; - token.output = state.output; - const output = (opts.capture ? '(' : '') + token.open; - - increment('parens'); - push({ type, value, output: state.output ? '' : ONE_CHAR }); - push({ type: 'paren', extglob: true, value: advance(), output }); - extglobs.push(token); - }; - - const extglobClose = token => { - let output = token.close + (opts.capture ? ')' : ''); - - if (token.type === 'negate') { - let extglobStar = star; - - if (token.inner && token.inner.length > 1 && token.inner.includes('/')) { - extglobStar = globstar(opts); - } - - if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) { - output = token.close = `)$))${extglobStar}`; - } - - if (token.prev.type === 'bos') { - state.negatedExtglob = true; - } - } - - push({ type: 'paren', extglob: true, value, output }); - decrement('parens'); - }; - - /** - * Fast paths - */ - - if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) { - let backslashes = false; - - let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index) => { - if (first === '\\') { - backslashes = true; - return m; - } - - if (first === '?') { - if (esc) { - return esc + first + (rest ? QMARK.repeat(rest.length) : ''); - } - if (index === 0) { - return qmarkNoDot + (rest ? QMARK.repeat(rest.length) : ''); - } - return QMARK.repeat(chars.length); - } - - if (first === '.') { - return DOT_LITERAL.repeat(chars.length); - } - - if (first === '*') { - if (esc) { - return esc + first + (rest ? star : ''); - } - return star; - } - return esc ? m : `\\${m}`; - }); - - if (backslashes === true) { - if (opts.unescape === true) { - output = output.replace(/\\/g, ''); - } else { - output = output.replace(/\\+/g, m => { - return m.length % 2 === 0 ? '\\\\' : (m ? '\\' : ''); - }); - } - } - - if (output === input && opts.contains === true) { - state.output = input; - return state; - } - - state.output = utils.wrapOutput(output, state, options); - return state; - } - - /** - * Tokenize input until we reach end-of-string - */ - - while (!eos()) { - value = advance(); - - if (value === '\u0000') { - continue; - } - - /** - * Escaped characters - */ - - if (value === '\\') { - const next = peek(); - - if (next === '/' && opts.bash !== true) { - continue; - } - - if (next === '.' || next === ';') { - continue; - } - - if (!next) { - value += '\\'; - push({ type: 'text', value }); - continue; - } - - // collapse slashes to reduce potential for exploits - const match = /^\\+/.exec(remaining()); - let slashes = 0; - - if (match && match[0].length > 2) { - slashes = match[0].length; - state.index += slashes; - if (slashes % 2 !== 0) { - value += '\\'; - } - } - - if (opts.unescape === true) { - value = advance() || ''; - } else { - value += advance() || ''; - } - - if (state.brackets === 0) { - push({ type: 'text', value }); - continue; - } - } - - /** - * If we're inside a regex character class, continue - * until we reach the closing bracket. - */ - - if (state.brackets > 0 && (value !== ']' || prev.value === '[' || prev.value === '[^')) { - if (opts.posix !== false && value === ':') { - const inner = prev.value.slice(1); - if (inner.includes('[')) { - prev.posix = true; - - if (inner.includes(':')) { - const idx = prev.value.lastIndexOf('['); - const pre = prev.value.slice(0, idx); - const rest = prev.value.slice(idx + 2); - const posix = POSIX_REGEX_SOURCE[rest]; - if (posix) { - prev.value = pre + posix; - state.backtrack = true; - advance(); - - if (!bos.output && tokens.indexOf(prev) === 1) { - bos.output = ONE_CHAR; - } - continue; - } - } - } - } - - if ((value === '[' && peek() !== ':') || (value === '-' && peek() === ']')) { - value = `\\${value}`; - } - - if (value === ']' && (prev.value === '[' || prev.value === '[^')) { - value = `\\${value}`; - } - - if (opts.posix === true && value === '!' && prev.value === '[') { - value = '^'; - } - - prev.value += value; - append({ value }); - continue; - } - - /** - * If we're inside a quoted string, continue - * until we reach the closing double quote. - */ - - if (state.quotes === 1 && value !== '"') { - value = utils.escapeRegex(value); - prev.value += value; - append({ value }); - continue; - } - - /** - * Double quotes - */ - - if (value === '"') { - state.quotes = state.quotes === 1 ? 0 : 1; - if (opts.keepQuotes === true) { - push({ type: 'text', value }); - } - continue; - } - - /** - * Parentheses - */ - - if (value === '(') { - increment('parens'); - push({ type: 'paren', value }); - continue; - } - - if (value === ')') { - if (state.parens === 0 && opts.strictBrackets === true) { - throw new SyntaxError(syntaxError('opening', '(')); - } - - const extglob = extglobs[extglobs.length - 1]; - if (extglob && state.parens === extglob.parens + 1) { - extglobClose(extglobs.pop()); - continue; - } - - push({ type: 'paren', value, output: state.parens ? ')' : '\\)' }); - decrement('parens'); - continue; - } - - /** - * Square brackets - */ - - if (value === '[') { - if (opts.nobracket === true || !remaining().includes(']')) { - if (opts.nobracket !== true && opts.strictBrackets === true) { - throw new SyntaxError(syntaxError('closing', ']')); - } - - value = `\\${value}`; - } else { - increment('brackets'); - } - - push({ type: 'bracket', value }); - continue; - } - - if (value === ']') { - if (opts.nobracket === true || (prev && prev.type === 'bracket' && prev.value.length === 1)) { - push({ type: 'text', value, output: `\\${value}` }); - continue; - } - - if (state.brackets === 0) { - if (opts.strictBrackets === true) { - throw new SyntaxError(syntaxError('opening', '[')); - } - - push({ type: 'text', value, output: `\\${value}` }); - continue; - } - - decrement('brackets'); - - const prevValue = prev.value.slice(1); - if (prev.posix !== true && prevValue[0] === '^' && !prevValue.includes('/')) { - value = `/${value}`; - } - - prev.value += value; - append({ value }); - - // when literal brackets are explicitly disabled - // assume we should match with a regex character class - if (opts.literalBrackets === false || utils.hasRegexChars(prevValue)) { - continue; - } - - const escaped = utils.escapeRegex(prev.value); - state.output = state.output.slice(0, -prev.value.length); - - // when literal brackets are explicitly enabled - // assume we should escape the brackets to match literal characters - if (opts.literalBrackets === true) { - state.output += escaped; - prev.value = escaped; - continue; - } - - // when the user specifies nothing, try to match both - prev.value = `(${capture}${escaped}|${prev.value})`; - state.output += prev.value; - continue; - } - - /** - * Braces - */ - - if (value === '{' && opts.nobrace !== true) { - increment('braces'); - - const open = { - type: 'brace', - value, - output: '(', - outputIndex: state.output.length, - tokensIndex: state.tokens.length - }; - - braces.push(open); - push(open); - continue; - } - - if (value === '}') { - const brace = braces[braces.length - 1]; - - if (opts.nobrace === true || !brace) { - push({ type: 'text', value, output: value }); - continue; - } - - let output = ')'; - - if (brace.dots === true) { - const arr = tokens.slice(); - const range = []; - - for (let i = arr.length - 1; i >= 0; i--) { - tokens.pop(); - if (arr[i].type === 'brace') { - break; - } - if (arr[i].type !== 'dots') { - range.unshift(arr[i].value); - } - } - - output = expandRange(range, opts); - state.backtrack = true; - } - - if (brace.comma !== true && brace.dots !== true) { - const out = state.output.slice(0, brace.outputIndex); - const toks = state.tokens.slice(brace.tokensIndex); - brace.value = brace.output = '\\{'; - value = output = '\\}'; - state.output = out; - for (const t of toks) { - state.output += (t.output || t.value); - } - } - - push({ type: 'brace', value, output }); - decrement('braces'); - braces.pop(); - continue; - } - - /** - * Pipes - */ - - if (value === '|') { - if (extglobs.length > 0) { - extglobs[extglobs.length - 1].conditions++; - } - push({ type: 'text', value }); - continue; - } - - /** - * Commas - */ - - if (value === ',') { - let output = value; - - const brace = braces[braces.length - 1]; - if (brace && stack[stack.length - 1] === 'braces') { - brace.comma = true; - output = '|'; - } - - push({ type: 'comma', value, output }); - continue; - } - - /** - * Slashes - */ - - if (value === '/') { - // if the beginning of the glob is "./", advance the start - // to the current index, and don't add the "./" characters - // to the state. This greatly simplifies lookbehinds when - // checking for BOS characters like "!" and "." (not "./") - if (prev.type === 'dot' && state.index === state.start + 1) { - state.start = state.index + 1; - state.consumed = ''; - state.output = ''; - tokens.pop(); - prev = bos; // reset "prev" to the first token - continue; - } - - push({ type: 'slash', value, output: SLASH_LITERAL }); - continue; - } - - /** - * Dots - */ - - if (value === '.') { - if (state.braces > 0 && prev.type === 'dot') { - if (prev.value === '.') prev.output = DOT_LITERAL; - const brace = braces[braces.length - 1]; - prev.type = 'dots'; - prev.output += value; - prev.value += value; - brace.dots = true; - continue; - } - - if ((state.braces + state.parens) === 0 && prev.type !== 'bos' && prev.type !== 'slash') { - push({ type: 'text', value, output: DOT_LITERAL }); - continue; - } - - push({ type: 'dot', value, output: DOT_LITERAL }); - continue; - } - - /** - * Question marks - */ - - if (value === '?') { - const isGroup = prev && prev.value === '('; - if (!isGroup && opts.noextglob !== true && peek() === '(' && peek(2) !== '?') { - extglobOpen('qmark', value); - continue; - } - - if (prev && prev.type === 'paren') { - const next = peek(); - let output = value; - - if (next === '<' && !utils.supportsLookbehinds()) { - throw new Error('Node.js v10 or higher is required for regex lookbehinds'); - } - - if ((prev.value === '(' && !/[!=<:]/.test(next)) || (next === '<' && !/<([!=]|\w+>)/.test(remaining()))) { - output = `\\${value}`; - } - - push({ type: 'text', value, output }); - continue; - } - - if (opts.dot !== true && (prev.type === 'slash' || prev.type === 'bos')) { - push({ type: 'qmark', value, output: QMARK_NO_DOT }); - continue; - } - - push({ type: 'qmark', value, output: QMARK }); - continue; - } - - /** - * Exclamation - */ - - if (value === '!') { - if (opts.noextglob !== true && peek() === '(') { - if (peek(2) !== '?' || !/[!=<:]/.test(peek(3))) { - extglobOpen('negate', value); - continue; - } - } - - if (opts.nonegate !== true && state.index === 0) { - negate(); - continue; - } - } - - /** - * Plus - */ - - if (value === '+') { - if (opts.noextglob !== true && peek() === '(' && peek(2) !== '?') { - extglobOpen('plus', value); - continue; - } - - if ((prev && prev.value === '(') || opts.regex === false) { - push({ type: 'plus', value, output: PLUS_LITERAL }); - continue; - } - - if ((prev && (prev.type === 'bracket' || prev.type === 'paren' || prev.type === 'brace')) || state.parens > 0) { - push({ type: 'plus', value }); - continue; - } - - push({ type: 'plus', value: PLUS_LITERAL }); - continue; - } - - /** - * Plain text - */ - - if (value === '@') { - if (opts.noextglob !== true && peek() === '(' && peek(2) !== '?') { - push({ type: 'at', extglob: true, value, output: '' }); - continue; - } - - push({ type: 'text', value }); - continue; - } - - /** - * Plain text - */ - - if (value !== '*') { - if (value === '$' || value === '^') { - value = `\\${value}`; - } - - const match = REGEX_NON_SPECIAL_CHARS.exec(remaining()); - if (match) { - value += match[0]; - state.index += match[0].length; - } - - push({ type: 'text', value }); - continue; - } - - /** - * Stars - */ - - if (prev && (prev.type === 'globstar' || prev.star === true)) { - prev.type = 'star'; - prev.star = true; - prev.value += value; - prev.output = star; - state.backtrack = true; - state.globstar = true; - consume(value); - continue; - } - - let rest = remaining(); - if (opts.noextglob !== true && /^\([^?]/.test(rest)) { - extglobOpen('star', value); - continue; - } - - if (prev.type === 'star') { - if (opts.noglobstar === true) { - consume(value); - continue; - } - - const prior = prev.prev; - const before = prior.prev; - const isStart = prior.type === 'slash' || prior.type === 'bos'; - const afterStar = before && (before.type === 'star' || before.type === 'globstar'); - - if (opts.bash === true && (!isStart || (rest[0] && rest[0] !== '/'))) { - push({ type: 'star', value, output: '' }); - continue; - } - - const isBrace = state.braces > 0 && (prior.type === 'comma' || prior.type === 'brace'); - const isExtglob = extglobs.length && (prior.type === 'pipe' || prior.type === 'paren'); - if (!isStart && prior.type !== 'paren' && !isBrace && !isExtglob) { - push({ type: 'star', value, output: '' }); - continue; - } - - // strip consecutive `/**/` - while (rest.slice(0, 3) === '/**') { - const after = input[state.index + 4]; - if (after && after !== '/') { - break; - } - rest = rest.slice(3); - consume('/**', 3); - } - - if (prior.type === 'bos' && eos()) { - prev.type = 'globstar'; - prev.value += value; - prev.output = globstar(opts); - state.output = prev.output; - state.globstar = true; - consume(value); - continue; - } - - if (prior.type === 'slash' && prior.prev.type !== 'bos' && !afterStar && eos()) { - state.output = state.output.slice(0, -(prior.output + prev.output).length); - prior.output = `(?:${prior.output}`; - - prev.type = 'globstar'; - prev.output = globstar(opts) + (opts.strictSlashes ? ')' : '|$)'); - prev.value += value; - state.globstar = true; - state.output += prior.output + prev.output; - consume(value); - continue; - } - - if (prior.type === 'slash' && prior.prev.type !== 'bos' && rest[0] === '/') { - const end = rest[1] !== void 0 ? '|$' : ''; - - state.output = state.output.slice(0, -(prior.output + prev.output).length); - prior.output = `(?:${prior.output}`; - - prev.type = 'globstar'; - prev.output = `${globstar(opts)}${SLASH_LITERAL}|${SLASH_LITERAL}${end})`; - prev.value += value; - - state.output += prior.output + prev.output; - state.globstar = true; - - consume(value + advance()); - - push({ type: 'slash', value: '/', output: '' }); - continue; - } - - if (prior.type === 'bos' && rest[0] === '/') { - prev.type = 'globstar'; - prev.value += value; - prev.output = `(?:^|${SLASH_LITERAL}|${globstar(opts)}${SLASH_LITERAL})`; - state.output = prev.output; - state.globstar = true; - consume(value + advance()); - push({ type: 'slash', value: '/', output: '' }); - continue; - } - - // remove single star from output - state.output = state.output.slice(0, -prev.output.length); - - // reset previous token to globstar - prev.type = 'globstar'; - prev.output = globstar(opts); - prev.value += value; - - // reset output with globstar - state.output += prev.output; - state.globstar = true; - consume(value); - continue; - } - - const token = { type: 'star', value, output: star }; - - if (opts.bash === true) { - token.output = '.*?'; - if (prev.type === 'bos' || prev.type === 'slash') { - token.output = nodot + token.output; - } - push(token); - continue; - } - - if (prev && (prev.type === 'bracket' || prev.type === 'paren') && opts.regex === true) { - token.output = value; - push(token); - continue; - } - - if (state.index === state.start || prev.type === 'slash' || prev.type === 'dot') { - if (prev.type === 'dot') { - state.output += NO_DOT_SLASH; - prev.output += NO_DOT_SLASH; - - } else if (opts.dot === true) { - state.output += NO_DOTS_SLASH; - prev.output += NO_DOTS_SLASH; - - } else { - state.output += nodot; - prev.output += nodot; - } - - if (peek() !== '*') { - state.output += ONE_CHAR; - prev.output += ONE_CHAR; - } - } - - push(token); - } - - while (state.brackets > 0) { - if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', ']')); - state.output = utils.escapeLast(state.output, '['); - decrement('brackets'); - } - - while (state.parens > 0) { - if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', ')')); - state.output = utils.escapeLast(state.output, '('); - decrement('parens'); - } - - while (state.braces > 0) { - if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', '}')); - state.output = utils.escapeLast(state.output, '{'); - decrement('braces'); - } - - if (opts.strictSlashes !== true && (prev.type === 'star' || prev.type === 'bracket')) { - push({ type: 'maybe_slash', value: '', output: `${SLASH_LITERAL}?` }); - } - - // rebuild the output if we had to backtrack at any point - if (state.backtrack === true) { - state.output = ''; - - for (const token of state.tokens) { - state.output += token.output != null ? token.output : token.value; - - if (token.suffix) { - state.output += token.suffix; - } - } - } - - return state; -}; - -/** - * Fast paths for creating regular expressions for common glob patterns. - * This can significantly speed up processing and has very little downside - * impact when none of the fast paths match. - */ - -parse.fastpaths = (input, options) => { - const opts = { ...options }; - const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH; - const len = input.length; - if (len > max) { - throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`); - } - - input = REPLACEMENTS[input] || input; - const win32 = utils.isWindows(options); - - // create constants based on platform, for windows or posix - const { - DOT_LITERAL, - SLASH_LITERAL, - ONE_CHAR, - DOTS_SLASH, - NO_DOT, - NO_DOTS, - NO_DOTS_SLASH, - STAR, - START_ANCHOR - } = constants.globChars(win32); - - const nodot = opts.dot ? NO_DOTS : NO_DOT; - const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT; - const capture = opts.capture ? '' : '?:'; - const state = { negated: false, prefix: '' }; - let star = opts.bash === true ? '.*?' : STAR; - - if (opts.capture) { - star = `(${star})`; - } - - const globstar = (opts) => { - if (opts.noglobstar === true) return star; - return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`; - }; - - const create = str => { - switch (str) { - case '*': - return `${nodot}${ONE_CHAR}${star}`; - - case '.*': - return `${DOT_LITERAL}${ONE_CHAR}${star}`; - - case '*.*': - return `${nodot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`; - - case '*/*': - return `${nodot}${star}${SLASH_LITERAL}${ONE_CHAR}${slashDot}${star}`; - - case '**': - return nodot + globstar(opts); - - case '**/*': - return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${ONE_CHAR}${star}`; - - case '**/*.*': - return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`; - - case '**/.*': - return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${DOT_LITERAL}${ONE_CHAR}${star}`; - - default: { - const match = /^(.*?)\.(\w+)$/.exec(str); - if (!match) return; - - const source = create(match[1]); - if (!source) return; - - return source + DOT_LITERAL + match[2]; - } - } - }; - - const output = utils.removePrefix(input, state); - let source = create(output); - - if (source && opts.strictSlashes !== true) { - source += `${SLASH_LITERAL}?`; - } - - return source; -}; - -module.exports = parse; diff --git a/server/node_modules/picomatch/lib/picomatch.js b/server/node_modules/picomatch/lib/picomatch.js deleted file mode 100644 index df7438a..0000000 --- a/server/node_modules/picomatch/lib/picomatch.js +++ /dev/null @@ -1,339 +0,0 @@ -'use strict'; - -const path = require('path'); -const scan = require('./scan'); -const parse = require('./parse'); -const utils = require('./utils'); -const constants = require('./constants'); -const isObject = val => val && typeof val === 'object' && !Array.isArray(val); - -/** - * Creates a matcher function from one or more glob patterns. The - * returned function takes a string to match as its first argument, - * and returns true if the string is a match. The returned matcher - * function also takes a boolean as the second argument that, when true, - * returns an object with additional information. - * - * ```js - * const picomatch = require('picomatch'); - * // picomatch(glob[, options]); - * - * const isMatch = picomatch('*.!(*a)'); - * console.log(isMatch('a.a')); //=> false - * console.log(isMatch('a.b')); //=> true - * ``` - * @name picomatch - * @param {String|Array} `globs` One or more glob patterns. - * @param {Object=} `options` - * @return {Function=} Returns a matcher function. - * @api public - */ - -const picomatch = (glob, options, returnState = false) => { - if (Array.isArray(glob)) { - const fns = glob.map(input => picomatch(input, options, returnState)); - const arrayMatcher = str => { - for (const isMatch of fns) { - const state = isMatch(str); - if (state) return state; - } - return false; - }; - return arrayMatcher; - } - - const isState = isObject(glob) && glob.tokens && glob.input; - - if (glob === '' || (typeof glob !== 'string' && !isState)) { - throw new TypeError('Expected pattern to be a non-empty string'); - } - - const opts = options || {}; - const posix = utils.isWindows(options); - const regex = isState - ? picomatch.compileRe(glob, options) - : picomatch.makeRe(glob, options, false, true); - - const state = regex.state; - delete regex.state; - - let isIgnored = () => false; - if (opts.ignore) { - const ignoreOpts = { ...options, ignore: null, onMatch: null, onResult: null }; - isIgnored = picomatch(opts.ignore, ignoreOpts, returnState); - } - - const matcher = (input, returnObject = false) => { - const { isMatch, match, output } = picomatch.test(input, regex, options, { glob, posix }); - const result = { glob, state, regex, posix, input, output, match, isMatch }; - - if (typeof opts.onResult === 'function') { - opts.onResult(result); - } - - if (isMatch === false) { - result.isMatch = false; - return returnObject ? result : false; - } - - if (isIgnored(input)) { - if (typeof opts.onIgnore === 'function') { - opts.onIgnore(result); - } - result.isMatch = false; - return returnObject ? result : false; - } - - if (typeof opts.onMatch === 'function') { - opts.onMatch(result); - } - return returnObject ? result : true; - }; - - if (returnState) { - matcher.state = state; - } - - return matcher; -}; - -/** - * Test `input` with the given `regex`. This is used by the main - * `picomatch()` function to test the input string. - * - * ```js - * const picomatch = require('picomatch'); - * // picomatch.test(input, regex[, options]); - * - * console.log(picomatch.test('foo/bar', /^(?:([^/]*?)\/([^/]*?))$/)); - * // { isMatch: true, match: [ 'foo/', 'foo', 'bar' ], output: 'foo/bar' } - * ``` - * @param {String} `input` String to test. - * @param {RegExp} `regex` - * @return {Object} Returns an object with matching info. - * @api public - */ - -picomatch.test = (input, regex, options, { glob, posix } = {}) => { - if (typeof input !== 'string') { - throw new TypeError('Expected input to be a string'); - } - - if (input === '') { - return { isMatch: false, output: '' }; - } - - const opts = options || {}; - const format = opts.format || (posix ? utils.toPosixSlashes : null); - let match = input === glob; - let output = (match && format) ? format(input) : input; - - if (match === false) { - output = format ? format(input) : input; - match = output === glob; - } - - if (match === false || opts.capture === true) { - if (opts.matchBase === true || opts.basename === true) { - match = picomatch.matchBase(input, regex, options, posix); - } else { - match = regex.exec(output); - } - } - - return { isMatch: Boolean(match), match, output }; -}; - -/** - * Match the basename of a filepath. - * - * ```js - * const picomatch = require('picomatch'); - * // picomatch.matchBase(input, glob[, options]); - * console.log(picomatch.matchBase('foo/bar.js', '*.js'); // true - * ``` - * @param {String} `input` String to test. - * @param {RegExp|String} `glob` Glob pattern or regex created by [.makeRe](#makeRe). - * @return {Boolean} - * @api public - */ - -picomatch.matchBase = (input, glob, options, posix = utils.isWindows(options)) => { - const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options); - return regex.test(path.basename(input)); -}; - -/** - * Returns true if **any** of the given glob `patterns` match the specified `string`. - * - * ```js - * const picomatch = require('picomatch'); - * // picomatch.isMatch(string, patterns[, options]); - * - * console.log(picomatch.isMatch('a.a', ['b.*', '*.a'])); //=> true - * console.log(picomatch.isMatch('a.a', 'b.*')); //=> false - * ``` - * @param {String|Array} str The string to test. - * @param {String|Array} patterns One or more glob patterns to use for matching. - * @param {Object} [options] See available [options](#options). - * @return {Boolean} Returns true if any patterns match `str` - * @api public - */ - -picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str); - -/** - * Parse a glob pattern to create the source string for a regular - * expression. - * - * ```js - * const picomatch = require('picomatch'); - * const result = picomatch.parse(pattern[, options]); - * ``` - * @param {String} `pattern` - * @param {Object} `options` - * @return {Object} Returns an object with useful properties and output to be used as a regex source string. - * @api public - */ - -picomatch.parse = (pattern, options) => { - if (Array.isArray(pattern)) return pattern.map(p => picomatch.parse(p, options)); - return parse(pattern, { ...options, fastpaths: false }); -}; - -/** - * Scan a glob pattern to separate the pattern into segments. - * - * ```js - * const picomatch = require('picomatch'); - * // picomatch.scan(input[, options]); - * - * const result = picomatch.scan('!./foo/*.js'); - * console.log(result); - * { prefix: '!./', - * input: '!./foo/*.js', - * start: 3, - * base: 'foo', - * glob: '*.js', - * isBrace: false, - * isBracket: false, - * isGlob: true, - * isExtglob: false, - * isGlobstar: false, - * negated: true } - * ``` - * @param {String} `input` Glob pattern to scan. - * @param {Object} `options` - * @return {Object} Returns an object with - * @api public - */ - -picomatch.scan = (input, options) => scan(input, options); - -/** - * Create a regular expression from a parsed glob pattern. - * - * ```js - * const picomatch = require('picomatch'); - * const state = picomatch.parse('*.js'); - * // picomatch.compileRe(state[, options]); - * - * console.log(picomatch.compileRe(state)); - * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/ - * ``` - * @param {String} `state` The object returned from the `.parse` method. - * @param {Object} `options` - * @return {RegExp} Returns a regex created from the given pattern. - * @api public - */ - -picomatch.compileRe = (parsed, options, returnOutput = false, returnState = false) => { - if (returnOutput === true) { - return parsed.output; - } - - const opts = options || {}; - const prepend = opts.contains ? '' : '^'; - const append = opts.contains ? '' : '$'; - - let source = `${prepend}(?:${parsed.output})${append}`; - if (parsed && parsed.negated === true) { - source = `^(?!${source}).*$`; - } - - const regex = picomatch.toRegex(source, options); - if (returnState === true) { - regex.state = parsed; - } - - return regex; -}; - -picomatch.makeRe = (input, options, returnOutput = false, returnState = false) => { - if (!input || typeof input !== 'string') { - throw new TypeError('Expected a non-empty string'); - } - - const opts = options || {}; - let parsed = { negated: false, fastpaths: true }; - let prefix = ''; - let output; - - if (input.startsWith('./')) { - input = input.slice(2); - prefix = parsed.prefix = './'; - } - - if (opts.fastpaths !== false && (input[0] === '.' || input[0] === '*')) { - output = parse.fastpaths(input, options); - } - - if (output === undefined) { - parsed = parse(input, options); - parsed.prefix = prefix + (parsed.prefix || ''); - } else { - parsed.output = output; - } - - return picomatch.compileRe(parsed, options, returnOutput, returnState); -}; - -/** - * Create a regular expression from the given regex source string. - * - * ```js - * const picomatch = require('picomatch'); - * // picomatch.toRegex(source[, options]); - * - * const { output } = picomatch.parse('*.js'); - * console.log(picomatch.toRegex(output)); - * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/ - * ``` - * @param {String} `source` Regular expression source string. - * @param {Object} `options` - * @return {RegExp} - * @api public - */ - -picomatch.toRegex = (source, options) => { - try { - const opts = options || {}; - return new RegExp(source, opts.flags || (opts.nocase ? 'i' : '')); - } catch (err) { - if (options && options.debug === true) throw err; - return /$^/; - } -}; - -/** - * Picomatch constants. - * @return {Object} - */ - -picomatch.constants = constants; - -/** - * Expose "picomatch" - */ - -module.exports = picomatch; diff --git a/server/node_modules/picomatch/lib/scan.js b/server/node_modules/picomatch/lib/scan.js deleted file mode 100644 index 456c2f8..0000000 --- a/server/node_modules/picomatch/lib/scan.js +++ /dev/null @@ -1,385 +0,0 @@ -'use strict'; - -const utils = require('./utils'); -const { - CHAR_ASTERISK, /* * */ - CHAR_AT, /* @ */ - CHAR_BACKWARD_SLASH, /* \ */ - CHAR_COMMA, /* , */ - CHAR_DOT, /* . */ - CHAR_EXCLAMATION_MARK, /* ! */ - CHAR_FORWARD_SLASH, /* / */ - CHAR_LEFT_CURLY_BRACE, /* { */ - CHAR_LEFT_PARENTHESES, /* ( */ - CHAR_LEFT_SQUARE_BRACKET, /* [ */ - CHAR_PLUS, /* + */ - CHAR_QUESTION_MARK, /* ? */ - CHAR_RIGHT_CURLY_BRACE, /* } */ - CHAR_RIGHT_PARENTHESES, /* ) */ - CHAR_RIGHT_SQUARE_BRACKET /* ] */ -} = require('./constants'); - -const isPathSeparator = code => { - return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH; -}; - -const depth = token => { - if (token.isPrefix !== true) { - token.depth = token.isGlobstar ? Infinity : 1; - } -}; - -/** - * Quickly scans a glob pattern and returns an object with a handful of - * useful properties, like `isGlob`, `path` (the leading non-glob, if it exists), - * `glob` (the actual pattern), and `negated` (true if the path starts with `!`). - * - * ```js - * const pm = require('picomatch'); - * console.log(pm.scan('foo/bar/*.js')); - * { isGlob: true, input: 'foo/bar/*.js', base: 'foo/bar', glob: '*.js' } - * ``` - * @param {String} `str` - * @param {Object} `options` - * @return {Object} Returns an object with tokens and regex source string. - * @api public - */ - -const scan = (input, options) => { - const opts = options || {}; - - const length = input.length - 1; - const scanToEnd = opts.parts === true || opts.scanToEnd === true; - const slashes = []; - const tokens = []; - const parts = []; - - let str = input; - let index = -1; - let start = 0; - let lastIndex = 0; - let isBrace = false; - let isBracket = false; - let isGlob = false; - let isExtglob = false; - let isGlobstar = false; - let braceEscaped = false; - let backslashes = false; - let negated = false; - let finished = false; - let braces = 0; - let prev; - let code; - let token = { value: '', depth: 0, isGlob: false }; - - const eos = () => index >= length; - const peek = () => str.charCodeAt(index + 1); - const advance = () => { - prev = code; - return str.charCodeAt(++index); - }; - - while (index < length) { - code = advance(); - let next; - - if (code === CHAR_BACKWARD_SLASH) { - backslashes = token.backslashes = true; - code = advance(); - - if (code === CHAR_LEFT_CURLY_BRACE) { - braceEscaped = true; - } - continue; - } - - if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE) { - braces++; - - while (eos() !== true && (code = advance())) { - if (code === CHAR_BACKWARD_SLASH) { - backslashes = token.backslashes = true; - advance(); - continue; - } - - if (code === CHAR_LEFT_CURLY_BRACE) { - braces++; - continue; - } - - if (braceEscaped !== true && code === CHAR_DOT && (code = advance()) === CHAR_DOT) { - isBrace = token.isBrace = true; - isGlob = token.isGlob = true; - finished = true; - - if (scanToEnd === true) { - continue; - } - - break; - } - - if (braceEscaped !== true && code === CHAR_COMMA) { - isBrace = token.isBrace = true; - isGlob = token.isGlob = true; - finished = true; - - if (scanToEnd === true) { - continue; - } - - break; - } - - if (code === CHAR_RIGHT_CURLY_BRACE) { - braces--; - - if (braces === 0) { - braceEscaped = false; - isBrace = token.isBrace = true; - finished = true; - break; - } - } - } - - if (scanToEnd === true) { - continue; - } - - break; - } - - if (code === CHAR_FORWARD_SLASH) { - slashes.push(index); - tokens.push(token); - token = { value: '', depth: 0, isGlob: false }; - - if (finished === true) continue; - if (prev === CHAR_DOT && index === (start + 1)) { - start += 2; - continue; - } - - lastIndex = index + 1; - continue; - } - - if (opts.noext !== true) { - const isExtglobChar = code === CHAR_PLUS - || code === CHAR_AT - || code === CHAR_ASTERISK - || code === CHAR_QUESTION_MARK - || code === CHAR_EXCLAMATION_MARK; - - if (isExtglobChar === true && peek() === CHAR_LEFT_PARENTHESES) { - isGlob = token.isGlob = true; - isExtglob = token.isExtglob = true; - finished = true; - - if (scanToEnd === true) { - while (eos() !== true && (code = advance())) { - if (code === CHAR_BACKWARD_SLASH) { - backslashes = token.backslashes = true; - code = advance(); - continue; - } - - if (code === CHAR_RIGHT_PARENTHESES) { - isGlob = token.isGlob = true; - finished = true; - break; - } - } - continue; - } - break; - } - } - - if (code === CHAR_ASTERISK) { - if (prev === CHAR_ASTERISK) isGlobstar = token.isGlobstar = true; - isGlob = token.isGlob = true; - finished = true; - - if (scanToEnd === true) { - continue; - } - break; - } - - if (code === CHAR_QUESTION_MARK) { - isGlob = token.isGlob = true; - finished = true; - - if (scanToEnd === true) { - continue; - } - break; - } - - if (code === CHAR_LEFT_SQUARE_BRACKET) { - while (eos() !== true && (next = advance())) { - if (next === CHAR_BACKWARD_SLASH) { - backslashes = token.backslashes = true; - advance(); - continue; - } - - if (next === CHAR_RIGHT_SQUARE_BRACKET) { - isBracket = token.isBracket = true; - isGlob = token.isGlob = true; - finished = true; - break; - } - } - - if (scanToEnd === true) { - continue; - } - - break; - } - - if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index === start) { - negated = token.negated = true; - start++; - continue; - } - - if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) { - isGlob = token.isGlob = true; - - if (scanToEnd === true) { - while (eos() !== true && (code = advance())) { - if (code === CHAR_LEFT_PARENTHESES) { - backslashes = token.backslashes = true; - code = advance(); - continue; - } - - if (code === CHAR_RIGHT_PARENTHESES) { - finished = true; - break; - } - } - continue; - } - break; - } - - if (isGlob === true) { - finished = true; - - if (scanToEnd === true) { - continue; - } - - break; - } - } - - if (opts.noext === true) { - isExtglob = false; - isGlob = false; - } - - let base = str; - let prefix = ''; - let glob = ''; - - if (start > 0) { - prefix = str.slice(0, start); - str = str.slice(start); - lastIndex -= start; - } - - if (base && isGlob === true && lastIndex > 0) { - base = str.slice(0, lastIndex); - glob = str.slice(lastIndex); - } else if (isGlob === true) { - base = ''; - glob = str; - } else { - base = str; - } - - if (base && base !== '' && base !== '/' && base !== str) { - if (isPathSeparator(base.charCodeAt(base.length - 1))) { - base = base.slice(0, -1); - } - } - - if (opts.unescape === true) { - if (glob) glob = utils.removeBackslashes(glob); - - if (base && backslashes === true) { - base = utils.removeBackslashes(base); - } - } - - const state = { - prefix, - input, - start, - base, - glob, - isBrace, - isBracket, - isGlob, - isExtglob, - isGlobstar, - negated - }; - - if (opts.tokens === true) { - state.maxDepth = 0; - if (!isPathSeparator(code)) { - tokens.push(token); - } - state.tokens = tokens; - } - - if (opts.parts === true || opts.tokens === true) { - let prevIndex; - - for (let idx = 0; idx < slashes.length; idx++) { - const n = prevIndex ? prevIndex + 1 : start; - const i = slashes[idx]; - const value = input.slice(n, i); - if (opts.tokens) { - if (idx === 0 && start !== 0) { - tokens[idx].isPrefix = true; - tokens[idx].value = prefix; - } else { - tokens[idx].value = value; - } - depth(tokens[idx]); - state.maxDepth += tokens[idx].depth; - } - if (idx !== 0 || value !== '') { - parts.push(value); - } - prevIndex = i; - } - - if (prevIndex && prevIndex + 1 < input.length) { - const value = input.slice(prevIndex + 1); - parts.push(value); - - if (opts.tokens) { - tokens[tokens.length - 1].value = value; - depth(tokens[tokens.length - 1]); - state.maxDepth += tokens[tokens.length - 1].depth; - } - } - - state.slashes = slashes; - state.parts = parts; - } - - return state; -}; - -module.exports = scan; diff --git a/server/node_modules/picomatch/lib/utils.js b/server/node_modules/picomatch/lib/utils.js deleted file mode 100644 index c3ca766..0000000 --- a/server/node_modules/picomatch/lib/utils.js +++ /dev/null @@ -1,64 +0,0 @@ -'use strict'; - -const path = require('path'); -const win32 = process.platform === 'win32'; -const { - REGEX_BACKSLASH, - REGEX_REMOVE_BACKSLASH, - REGEX_SPECIAL_CHARS, - REGEX_SPECIAL_CHARS_GLOBAL -} = require('./constants'); - -exports.isObject = val => val !== null && typeof val === 'object' && !Array.isArray(val); -exports.hasRegexChars = str => REGEX_SPECIAL_CHARS.test(str); -exports.isRegexChar = str => str.length === 1 && exports.hasRegexChars(str); -exports.escapeRegex = str => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, '\\$1'); -exports.toPosixSlashes = str => str.replace(REGEX_BACKSLASH, '/'); - -exports.removeBackslashes = str => { - return str.replace(REGEX_REMOVE_BACKSLASH, match => { - return match === '\\' ? '' : match; - }); -}; - -exports.supportsLookbehinds = () => { - const segs = process.version.slice(1).split('.').map(Number); - if (segs.length === 3 && segs[0] >= 9 || (segs[0] === 8 && segs[1] >= 10)) { - return true; - } - return false; -}; - -exports.isWindows = options => { - if (options && typeof options.windows === 'boolean') { - return options.windows; - } - return win32 === true || path.sep === '\\'; -}; - -exports.escapeLast = (input, char, lastIdx) => { - const idx = input.lastIndexOf(char, lastIdx); - if (idx === -1) return input; - if (input[idx - 1] === '\\') return exports.escapeLast(input, char, idx - 1); - return `${input.slice(0, idx)}\\${input.slice(idx)}`; -}; - -exports.removePrefix = (input, state = {}) => { - let output = input; - if (output.startsWith('./')) { - output = output.slice(2); - state.prefix = './'; - } - return output; -}; - -exports.wrapOutput = (input, state = {}, options = {}) => { - const prepend = options.contains ? '' : '^'; - const append = options.contains ? '' : '$'; - - let output = `${prepend}(?:${input})${append}`; - if (state.negated === true) { - output = `(?:^(?!${output}).*$)`; - } - return output; -}; diff --git a/server/node_modules/picomatch/package.json b/server/node_modules/picomatch/package.json deleted file mode 100644 index 9be4556..0000000 --- a/server/node_modules/picomatch/package.json +++ /dev/null @@ -1,81 +0,0 @@ -{ - "name": "picomatch", - "description": "Blazing fast and accurate glob matcher written in JavaScript, with no dependencies and full support for standard and extended Bash glob features, including braces, extglobs, POSIX brackets, and regular expressions.", - "version": "2.2.3", - "homepage": "https://github.com/micromatch/picomatch", - "author": "Jon Schlinkert (https://github.com/jonschlinkert)", - "funding": "https://github.com/sponsors/jonschlinkert", - "repository": "micromatch/picomatch", - "bugs": { - "url": "https://github.com/micromatch/picomatch/issues" - }, - "license": "MIT", - "files": [ - "index.js", - "lib" - ], - "main": "index.js", - "engines": { - "node": ">=8.6" - }, - "scripts": { - "lint": "eslint --cache --cache-location node_modules/.cache/.eslintcache --report-unused-disable-directives --ignore-path .gitignore .", - "mocha": "mocha --reporter dot", - "test": "npm run lint && npm run mocha", - "test:ci": "npm run test:cover", - "test:cover": "nyc npm run mocha" - }, - "devDependencies": { - "eslint": "^6.8.0", - "fill-range": "^7.0.1", - "gulp-format-md": "^2.0.0", - "mocha": "^6.2.2", - "nyc": "^15.0.0", - "time-require": "github:jonschlinkert/time-require" - }, - "keywords": [ - "glob", - "match", - "picomatch" - ], - "nyc": { - "reporter": [ - "html", - "lcov", - "text-summary" - ] - }, - "verb": { - "toc": { - "render": true, - "method": "preWrite", - "maxdepth": 3 - }, - "layout": "empty", - "tasks": [ - "readme" - ], - "plugins": [ - "gulp-format-md" - ], - "lint": { - "reflinks": true - }, - "related": { - "list": [ - "braces", - "micromatch" - ] - }, - "reflinks": [ - "braces", - "expand-brackets", - "extglob", - "fill-range", - "micromatch", - "minimatch", - "nanomatch", - "picomatch" - ] - } -} diff --git a/server/node_modules/readdirp/LICENSE b/server/node_modules/readdirp/LICENSE deleted file mode 100644 index 037cbb4..0000000 --- a/server/node_modules/readdirp/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2012-2019 Thorsten Lorenz, Paul Miller (https://paulmillr.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/server/node_modules/readdirp/README.md b/server/node_modules/readdirp/README.md deleted file mode 100644 index 465593c..0000000 --- a/server/node_modules/readdirp/README.md +++ /dev/null @@ -1,122 +0,0 @@ -# readdirp [![Weekly downloads](https://img.shields.io/npm/dw/readdirp.svg)](https://github.com/paulmillr/readdirp) - -Recursive version of [fs.readdir](https://nodejs.org/api/fs.html#fs_fs_readdir_path_options_callback). Exposes a **stream API** and a **promise API**. - - -```sh -npm install readdirp -``` - -```javascript -const readdirp = require('readdirp'); - -// Use streams to achieve small RAM & CPU footprint. -// 1) Streams example with for-await. -for await (const entry of readdirp('.')) { - const {path} = entry; - console.log(`${JSON.stringify({path})}`); -} - -// 2) Streams example, non for-await. -// Print out all JS files along with their size within the current folder & subfolders. -readdirp('.', {fileFilter: '*.js', alwaysStat: true}) - .on('data', (entry) => { - const {path, stats: {size}} = entry; - console.log(`${JSON.stringify({path, size})}`); - }) - // Optionally call stream.destroy() in `warn()` in order to abort and cause 'close' to be emitted - .on('warn', error => console.error('non-fatal error', error)) - .on('error', error => console.error('fatal error', error)) - .on('end', () => console.log('done')); - -// 3) Promise example. More RAM and CPU than streams / for-await. -const files = await readdirp.promise('.'); -console.log(files.map(file => file.path)); - -// Other options. -readdirp('test', { - fileFilter: '*.js', - directoryFilter: ['!.git', '!*modules'] - // directoryFilter: (di) => di.basename.length === 9 - type: 'files_directories', - depth: 1 -}); -``` - -For more examples, check out `examples` directory. - -## API - -`const stream = readdirp(root[, options])` — **Stream API** - -- Reads given root recursively and returns a `stream` of [entry infos](#entryinfo) -- Optionally can be used like `for await (const entry of stream)` with node.js 10+ (`asyncIterator`). -- `on('data', (entry) => {})` [entry info](#entryinfo) for every file / dir. -- `on('warn', (error) => {})` non-fatal `Error` that prevents a file / dir from being processed. Example: inaccessible to the user. -- `on('error', (error) => {})` fatal `Error` which also ends the stream. Example: illegal options where passed. -- `on('end')` — we are done. Called when all entries were found and no more will be emitted. -- `on('close')` — stream is destroyed via `stream.destroy()`. - Could be useful if you want to manually abort even on a non fatal error. - At that point the stream is no longer `readable` and no more entries, warning or errors are emitted -- To learn more about streams, consult the very detailed [nodejs streams documentation](https://nodejs.org/api/stream.html) - or the [stream-handbook](https://github.com/substack/stream-handbook) - -`const entries = await readdirp.promise(root[, options])` — **Promise API**. Returns a list of [entry infos](#entryinfo). - -First argument is awalys `root`, path in which to start reading and recursing into subdirectories. - -### options - -- `fileFilter: ["*.js"]`: filter to include or exclude files. A `Function`, Glob string or Array of glob strings. - - **Function**: a function that takes an entry info as a parameter and returns true to include or false to exclude the entry - - **Glob string**: a string (e.g., `*.js`) which is matched using [picomatch](https://github.com/micromatch/picomatch), so go there for more - information. Globstars (`**`) are not supported since specifying a recursive pattern for an already recursive function doesn't make sense. Negated globs (as explained in the minimatch documentation) are allowed, e.g., `!*.txt` matches everything but text files. - - **Array of glob strings**: either need to be all inclusive or all exclusive (negated) patterns otherwise an error is thrown. - `['*.json', '*.js']` includes all JavaScript and Json files. - `['!.git', '!node_modules']` includes all directories except the '.git' and 'node_modules'. - - Directories that do not pass a filter will not be recursed into. -- `directoryFilter: ['!.git']`: filter to include/exclude directories found and to recurse into. Directories that do not pass a filter will not be recursed into. -- `depth: 5`: depth at which to stop recursing even if more subdirectories are found -- `type: 'files'`: determines if data events on the stream should be emitted for `'files'` (default), `'directories'`, `'files_directories'`, or `'all'`. Setting to `'all'` will also include entries for other types of file descriptors like character devices, unix sockets and named pipes. -- `alwaysStat: false`: always return `stats` property for every file. Default is `false`, readdirp will return `Dirent` entries. Setting it to `true` can double readdir execution time - use it only when you need file `size`, `mtime` etc. Cannot be enabled on node <10.10.0. -- `lstat: false`: include symlink entries in the stream along with files. When `true`, `fs.lstat` would be used instead of `fs.stat` - -### `EntryInfo` - -Has the following properties: - -- `path: 'assets/javascripts/react.js'`: path to the file/directory (relative to given root) -- `fullPath: '/Users/dev/projects/app/assets/javascripts/react.js'`: full path to the file/directory found -- `basename: 'react.js'`: name of the file/directory -- `dirent: fs.Dirent`: built-in [dir entry object](https://nodejs.org/api/fs.html#fs_class_fs_dirent) - only with `alwaysStat: false` -- `stats: fs.Stats`: built in [stat object](https://nodejs.org/api/fs.html#fs_class_fs_stats) - only with `alwaysStat: true` - -## Changelog - -- 3.5 (Oct 13, 2020) disallows recursive directory-based symlinks. - Before, it could have entered infinite loop. -- 3.4 (Mar 19, 2020) adds support for directory-based symlinks. -- 3.3 (Dec 6, 2019) stabilizes RAM consumption and enables perf management with `highWaterMark` option. Fixes race conditions related to `for-await` looping. -- 3.2 (Oct 14, 2019) improves performance by 250% and makes streams implementation more idiomatic. -- 3.1 (Jul 7, 2019) brings `bigint` support to `stat` output on Windows. This is backwards-incompatible for some cases. Be careful. It you use it incorrectly, you'll see "TypeError: Cannot mix BigInt and other types, use explicit conversions". -- 3.0 brings huge performance improvements and stream backpressure support. -- Upgrading 2.x to 3.x: - - Signature changed from `readdirp(options)` to `readdirp(root, options)` - - Replaced callback API with promise API. - - Renamed `entryType` option to `type` - - Renamed `entryType: 'both'` to `'files_directories'` - - `EntryInfo` - - Renamed `stat` to `stats` - - Emitted only when `alwaysStat: true` - - `dirent` is emitted instead of `stats` by default with `alwaysStat: false` - - Renamed `name` to `basename` - - Removed `parentDir` and `fullParentDir` properties -- Supported node.js versions: - - 3.x: node 8+ - - 2.x: node 0.6+ - -## License - -Copyright (c) 2012-2019 Thorsten Lorenz, Paul Miller () - -MIT License, see [LICENSE](LICENSE) file. diff --git a/server/node_modules/readdirp/index.js b/server/node_modules/readdirp/index.js deleted file mode 100644 index 30df947..0000000 --- a/server/node_modules/readdirp/index.js +++ /dev/null @@ -1,282 +0,0 @@ -'use strict'; - -const fs = require('fs'); -const { Readable } = require('stream'); -const sysPath = require('path'); -const { promisify } = require('util'); -const picomatch = require('picomatch'); - -const readdir = promisify(fs.readdir); -const stat = promisify(fs.stat); -const lstat = promisify(fs.lstat); -const realpath = promisify(fs.realpath); - -/** - * @typedef {Object} EntryInfo - * @property {String} path - * @property {String} fullPath - * @property {fs.Stats=} stats - * @property {fs.Dirent=} dirent - * @property {String} basename - */ - -const BANG = '!'; -const NORMAL_FLOW_ERRORS = new Set(['ENOENT', 'EPERM', 'EACCES', 'ELOOP']); -const FILE_TYPE = 'files'; -const DIR_TYPE = 'directories'; -const FILE_DIR_TYPE = 'files_directories'; -const EVERYTHING_TYPE = 'all'; -const ALL_TYPES = [FILE_TYPE, DIR_TYPE, FILE_DIR_TYPE, EVERYTHING_TYPE]; - -const isNormalFlowError = error => NORMAL_FLOW_ERRORS.has(error.code); - -const normalizeFilter = filter => { - if (filter === undefined) return; - if (typeof filter === 'function') return filter; - - if (typeof filter === 'string') { - const glob = picomatch(filter.trim()); - return entry => glob(entry.basename); - } - - if (Array.isArray(filter)) { - const positive = []; - const negative = []; - for (const item of filter) { - const trimmed = item.trim(); - if (trimmed.charAt(0) === BANG) { - negative.push(picomatch(trimmed.slice(1))); - } else { - positive.push(picomatch(trimmed)); - } - } - - if (negative.length > 0) { - if (positive.length > 0) { - return entry => - positive.some(f => f(entry.basename)) && !negative.some(f => f(entry.basename)); - } - return entry => !negative.some(f => f(entry.basename)); - } - return entry => positive.some(f => f(entry.basename)); - } -}; - -class ReaddirpStream extends Readable { - static get defaultOptions() { - return { - root: '.', - /* eslint-disable no-unused-vars */ - fileFilter: (path) => true, - directoryFilter: (path) => true, - /* eslint-enable no-unused-vars */ - type: FILE_TYPE, - lstat: false, - depth: 2147483648, - alwaysStat: false - }; - } - - constructor(options = {}) { - super({ - objectMode: true, - autoDestroy: true, - highWaterMark: options.highWaterMark || 4096 - }); - const opts = { ...ReaddirpStream.defaultOptions, ...options }; - const { root, type } = opts; - - this._fileFilter = normalizeFilter(opts.fileFilter); - this._directoryFilter = normalizeFilter(opts.directoryFilter); - - const statMethod = opts.lstat ? lstat : stat; - // Use bigint stats if it's windows and stat() supports options (node 10+). - if (process.platform === 'win32' && stat.length === 3) { - this._stat = path => statMethod(path, { bigint: true }); - } else { - this._stat = statMethod; - } - - this._maxDepth = opts.depth; - this._wantsDir = [DIR_TYPE, FILE_DIR_TYPE, EVERYTHING_TYPE].includes(type); - this._wantsFile = [FILE_TYPE, FILE_DIR_TYPE, EVERYTHING_TYPE].includes(type); - this._wantsEverything = type === EVERYTHING_TYPE; - this._root = sysPath.resolve(root); - this._isDirent = ('Dirent' in fs) && !opts.alwaysStat; - this._statsProp = this._isDirent ? 'dirent' : 'stats'; - this._rdOptions = { encoding: 'utf8', withFileTypes: this._isDirent }; - - // Launch stream with one parent, the root dir. - this.parents = [this._exploreDir(root, 1)]; - this.reading = false; - this.parent = undefined; - } - - async _read(batch) { - if (this.reading) return; - this.reading = true; - - try { - while (!this.destroyed && batch > 0) { - const { path, depth, files = [] } = this.parent || {}; - - if (files.length > 0) { - const slice = files.splice(0, batch).map(dirent => this._formatEntry(dirent, path)); - for (const entry of await Promise.all(slice)) { - if (this.destroyed) return; - - const entryType = await this._getEntryType(entry); - if (entryType === 'directory' && this._directoryFilter(entry)) { - if (depth <= this._maxDepth) { - this.parents.push(this._exploreDir(entry.fullPath, depth + 1)); - } - - if (this._wantsDir) { - this.push(entry); - batch--; - } - } else if ((entryType === 'file' || this._includeAsFile(entry)) && this._fileFilter(entry)) { - if (this._wantsFile) { - this.push(entry); - batch--; - } - } - } - } else { - const parent = this.parents.pop(); - if (!parent) { - this.push(null); - break; - } - this.parent = await parent; - if (this.destroyed) return; - } - } - } catch (error) { - this.destroy(error); - } finally { - this.reading = false; - } - } - - async _exploreDir(path, depth) { - let files; - try { - files = await readdir(path, this._rdOptions); - } catch (error) { - this._onError(error); - } - return {files, depth, path}; - } - - async _formatEntry(dirent, path) { - let entry; - try { - const basename = this._isDirent ? dirent.name : dirent; - const fullPath = sysPath.resolve(sysPath.join(path, basename)); - entry = {path: sysPath.relative(this._root, fullPath), fullPath, basename}; - entry[this._statsProp] = this._isDirent ? dirent : await this._stat(fullPath); - } catch (err) { - this._onError(err); - } - return entry; - } - - _onError(err) { - if (isNormalFlowError(err) && !this.destroyed) { - this.emit('warn', err); - } else { - this.destroy(err); - } - } - - async _getEntryType(entry) { - // entry may be undefined, because a warning or an error were emitted - // and the statsProp is undefined - const stats = entry && entry[this._statsProp]; - if (!stats) { - return; - } - if (stats.isFile()) { - return 'file'; - } - if (stats.isDirectory()) { - return 'directory'; - } - if (stats && stats.isSymbolicLink()) { - const full = entry.fullPath; - try { - const entryRealPath = await realpath(full); - const entryRealPathStats = await lstat(entryRealPath); - if (entryRealPathStats.isFile()) { - return 'file'; - } - if (entryRealPathStats.isDirectory()) { - const len = entryRealPath.length; - if (full.startsWith(entryRealPath) && full.substr(len, 1) === sysPath.sep) { - return this._onError(new Error( - `Circular symlink detected: "${full}" points to "${entryRealPath}"` - )); - } - return 'directory'; - } - } catch (error) { - this._onError(error); - } - } - } - - _includeAsFile(entry) { - const stats = entry && entry[this._statsProp]; - - return stats && this._wantsEverything && !stats.isDirectory(); - } -} - -/** - * @typedef {Object} ReaddirpArguments - * @property {Function=} fileFilter - * @property {Function=} directoryFilter - * @property {String=} type - * @property {Number=} depth - * @property {String=} root - * @property {Boolean=} lstat - * @property {Boolean=} bigint - */ - -/** - * Main function which ends up calling readdirRec and reads all files and directories in given root recursively. - * @param {String} root Root directory - * @param {ReaddirpArguments=} options Options to specify root (start directory), filters and recursion depth - */ -const readdirp = (root, options = {}) => { - let type = options.entryType || options.type; - if (type === 'both') type = FILE_DIR_TYPE; // backwards-compatibility - if (type) options.type = type; - if (!root) { - throw new Error('readdirp: root argument is required. Usage: readdirp(root, options)'); - } else if (typeof root !== 'string') { - throw new TypeError('readdirp: root argument must be a string. Usage: readdirp(root, options)'); - } else if (type && !ALL_TYPES.includes(type)) { - throw new Error(`readdirp: Invalid type passed. Use one of ${ALL_TYPES.join(', ')}`); - } - - options.root = root; - return new ReaddirpStream(options); -}; - -const readdirpPromise = (root, options = {}) => { - return new Promise((resolve, reject) => { - const files = []; - readdirp(root, options) - .on('data', entry => files.push(entry)) - .on('end', () => resolve(files)) - .on('error', error => reject(error)); - }); -}; - -readdirp.promise = readdirpPromise; -readdirp.ReaddirpStream = ReaddirpStream; -readdirp.default = readdirp; - -module.exports = readdirp; diff --git a/server/node_modules/readdirp/package.json b/server/node_modules/readdirp/package.json deleted file mode 100644 index 5a35475..0000000 --- a/server/node_modules/readdirp/package.json +++ /dev/null @@ -1,122 +0,0 @@ -{ - "name": "readdirp", - "description": "Recursive version of fs.readdir with streaming API.", - "version": "3.5.0", - "homepage": "https://github.com/paulmillr/readdirp", - "repository": { - "type": "git", - "url": "git://github.com/paulmillr/readdirp.git" - }, - "license": "MIT", - "bugs": { - "url": "https://github.com/paulmillr/readdirp/issues" - }, - "author": "Thorsten Lorenz (thlorenz.com)", - "contributors": [ - "Thorsten Lorenz (thlorenz.com)", - "Paul Miller (https://paulmillr.com)" - ], - "main": "index.js", - "engines": { - "node": ">=8.10.0" - }, - "files": [ - "index.js", - "index.d.ts" - ], - "keywords": [ - "recursive", - "fs", - "stream", - "streams", - "readdir", - "filesystem", - "find", - "filter" - ], - "scripts": { - "dtslint": "dtslint", - "nyc": "nyc", - "mocha": "mocha --exit", - "lint": "eslint --report-unused-disable-directives --ignore-path .gitignore .", - "test": "npm run lint && nyc npm run mocha" - }, - "dependencies": { - "picomatch": "^2.2.1" - }, - "devDependencies": { - "@types/node": "^14", - "chai": "^4.2", - "chai-subset": "^1.6", - "dtslint": "^3.3.0", - "eslint": "^7.0.0", - "mocha": "^7.1.1", - "nyc": "^15.0.0", - "rimraf": "^3.0.0", - "typescript": "^4.0.3" - }, - "nyc": { - "reporter": [ - "html", - "text" - ] - }, - "eslintConfig": { - "root": true, - "extends": "eslint:recommended", - "parserOptions": { - "ecmaVersion": 9, - "sourceType": "script" - }, - "env": { - "node": true, - "es6": true - }, - "rules": { - "array-callback-return": "error", - "no-empty": [ - "error", - { - "allowEmptyCatch": true - } - ], - "no-else-return": [ - "error", - { - "allowElseIf": false - } - ], - "no-lonely-if": "error", - "no-var": "error", - "object-shorthand": "error", - "prefer-arrow-callback": [ - "error", - { - "allowNamedFunctions": true - } - ], - "prefer-const": [ - "error", - { - "ignoreReadBeforeAssign": true - } - ], - "prefer-destructuring": [ - "error", - { - "object": true, - "array": false - } - ], - "prefer-spread": "error", - "prefer-template": "error", - "radix": "error", - "semi": "error", - "strict": "error", - "quotes": [ - "error", - "single" - ] - } - } -} diff --git a/server/node_modules/to-regex-range/LICENSE b/server/node_modules/to-regex-range/LICENSE deleted file mode 100644 index 7cccaf9..0000000 --- a/server/node_modules/to-regex-range/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015-present, Jon Schlinkert. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/server/node_modules/to-regex-range/README.md b/server/node_modules/to-regex-range/README.md deleted file mode 100644 index 38887da..0000000 --- a/server/node_modules/to-regex-range/README.md +++ /dev/null @@ -1,305 +0,0 @@ -# to-regex-range [![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=W8YFZ425KND68) [![NPM version](https://img.shields.io/npm/v/to-regex-range.svg?style=flat)](https://www.npmjs.com/package/to-regex-range) [![NPM monthly downloads](https://img.shields.io/npm/dm/to-regex-range.svg?style=flat)](https://npmjs.org/package/to-regex-range) [![NPM total downloads](https://img.shields.io/npm/dt/to-regex-range.svg?style=flat)](https://npmjs.org/package/to-regex-range) [![Linux Build Status](https://img.shields.io/travis/micromatch/to-regex-range.svg?style=flat&label=Travis)](https://travis-ci.org/micromatch/to-regex-range) - -> Pass two numbers, get a regex-compatible source string for matching ranges. Validated against more than 2.78 million test assertions. - -Please consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support. - -## Install - -Install with [npm](https://www.npmjs.com/): - -```sh -$ npm install --save to-regex-range -``` - -
-What does this do? - -
- -This libary generates the `source` string to be passed to `new RegExp()` for matching a range of numbers. - -**Example** - -```js -const toRegexRange = require('to-regex-range'); -const regex = new RegExp(toRegexRange('15', '95')); -``` - -A string is returned so that you can do whatever you need with it before passing it to `new RegExp()` (like adding `^` or `$` boundaries, defining flags, or combining it another string). - -
- -
- -
-Why use this library? - -
- -### Convenience - -Creating regular expressions for matching numbers gets deceptively complicated pretty fast. - -For example, let's say you need a validation regex for matching part of a user-id, postal code, social security number, tax id, etc: - -* regex for matching `1` => `/1/` (easy enough) -* regex for matching `1` through `5` => `/[1-5]/` (not bad...) -* regex for matching `1` or `5` => `/(1|5)/` (still easy...) -* regex for matching `1` through `50` => `/([1-9]|[1-4][0-9]|50)/` (uh-oh...) -* regex for matching `1` through `55` => `/([1-9]|[1-4][0-9]|5[0-5])/` (no prob, I can do this...) -* regex for matching `1` through `555` => `/([1-9]|[1-9][0-9]|[1-4][0-9]{2}|5[0-4][0-9]|55[0-5])/` (maybe not...) -* regex for matching `0001` through `5555` => `/(0{3}[1-9]|0{2}[1-9][0-9]|0[1-9][0-9]{2}|[1-4][0-9]{3}|5[0-4][0-9]{2}|55[0-4][0-9]|555[0-5])/` (okay, I get the point!) - -The numbers are contrived, but they're also really basic. In the real world you might need to generate a regex on-the-fly for validation. - -**Learn more** - -If you're interested in learning more about [character classes](http://www.regular-expressions.info/charclass.html) and other regex features, I personally have always found [regular-expressions.info](http://www.regular-expressions.info/charclass.html) to be pretty useful. - -### Heavily tested - -As of April 07, 2019, this library runs [>1m test assertions](./test/test.js) against generated regex-ranges to provide brute-force verification that results are correct. - -Tests run in ~280ms on my MacBook Pro, 2.5 GHz Intel Core i7. - -### Optimized - -Generated regular expressions are optimized: - -* duplicate sequences and character classes are reduced using quantifiers -* smart enough to use `?` conditionals when number(s) or range(s) can be positive or negative -* uses fragment caching to avoid processing the same exact string more than once - -
- -
- -## Usage - -Add this library to your javascript application with the following line of code - -```js -const toRegexRange = require('to-regex-range'); -``` - -The main export is a function that takes two integers: the `min` value and `max` value (formatted as strings or numbers). - -```js -const source = toRegexRange('15', '95'); -//=> 1[5-9]|[2-8][0-9]|9[0-5] - -const regex = new RegExp(`^${source}$`); -console.log(regex.test('14')); //=> false -console.log(regex.test('50')); //=> true -console.log(regex.test('94')); //=> true -console.log(regex.test('96')); //=> false -``` - -## Options - -### options.capture - -**Type**: `boolean` - -**Deafault**: `undefined` - -Wrap the returned value in parentheses when there is more than one regex condition. Useful when you're dynamically generating ranges. - -```js -console.log(toRegexRange('-10', '10')); -//=> -[1-9]|-?10|[0-9] - -console.log(toRegexRange('-10', '10', { capture: true })); -//=> (-[1-9]|-?10|[0-9]) -``` - -### options.shorthand - -**Type**: `boolean` - -**Deafault**: `undefined` - -Use the regex shorthand for `[0-9]`: - -```js -console.log(toRegexRange('0', '999999')); -//=> [0-9]|[1-9][0-9]{1,5} - -console.log(toRegexRange('0', '999999', { shorthand: true })); -//=> \d|[1-9]\d{1,5} -``` - -### options.relaxZeros - -**Type**: `boolean` - -**Default**: `true` - -This option relaxes matching for leading zeros when when ranges are zero-padded. - -```js -const source = toRegexRange('-0010', '0010'); -const regex = new RegExp(`^${source}$`); -console.log(regex.test('-10')); //=> true -console.log(regex.test('-010')); //=> true -console.log(regex.test('-0010')); //=> true -console.log(regex.test('10')); //=> true -console.log(regex.test('010')); //=> true -console.log(regex.test('0010')); //=> true -``` - -When `relaxZeros` is false, matching is strict: - -```js -const source = toRegexRange('-0010', '0010', { relaxZeros: false }); -const regex = new RegExp(`^${source}$`); -console.log(regex.test('-10')); //=> false -console.log(regex.test('-010')); //=> false -console.log(regex.test('-0010')); //=> true -console.log(regex.test('10')); //=> false -console.log(regex.test('010')); //=> false -console.log(regex.test('0010')); //=> true -``` - -## Examples - -| **Range** | **Result** | **Compile time** | -| --- | --- | --- | -| `toRegexRange(-10, 10)` | `-[1-9]\|-?10\|[0-9]` | _132μs_ | -| `toRegexRange(-100, -10)` | `-1[0-9]\|-[2-9][0-9]\|-100` | _50μs_ | -| `toRegexRange(-100, 100)` | `-[1-9]\|-?[1-9][0-9]\|-?100\|[0-9]` | _42μs_ | -| `toRegexRange(001, 100)` | `0{0,2}[1-9]\|0?[1-9][0-9]\|100` | _109μs_ | -| `toRegexRange(001, 555)` | `0{0,2}[1-9]\|0?[1-9][0-9]\|[1-4][0-9]{2}\|5[0-4][0-9]\|55[0-5]` | _51μs_ | -| `toRegexRange(0010, 1000)` | `0{0,2}1[0-9]\|0{0,2}[2-9][0-9]\|0?[1-9][0-9]{2}\|1000` | _31μs_ | -| `toRegexRange(1, 50)` | `[1-9]\|[1-4][0-9]\|50` | _24μs_ | -| `toRegexRange(1, 55)` | `[1-9]\|[1-4][0-9]\|5[0-5]` | _23μs_ | -| `toRegexRange(1, 555)` | `[1-9]\|[1-9][0-9]\|[1-4][0-9]{2}\|5[0-4][0-9]\|55[0-5]` | _30μs_ | -| `toRegexRange(1, 5555)` | `[1-9]\|[1-9][0-9]{1,2}\|[1-4][0-9]{3}\|5[0-4][0-9]{2}\|55[0-4][0-9]\|555[0-5]` | _43μs_ | -| `toRegexRange(111, 555)` | `11[1-9]\|1[2-9][0-9]\|[2-4][0-9]{2}\|5[0-4][0-9]\|55[0-5]` | _38μs_ | -| `toRegexRange(29, 51)` | `29\|[34][0-9]\|5[01]` | _24μs_ | -| `toRegexRange(31, 877)` | `3[1-9]\|[4-9][0-9]\|[1-7][0-9]{2}\|8[0-6][0-9]\|87[0-7]` | _32μs_ | -| `toRegexRange(5, 5)` | `5` | _8μs_ | -| `toRegexRange(5, 6)` | `5\|6` | _11μs_ | -| `toRegexRange(1, 2)` | `1\|2` | _6μs_ | -| `toRegexRange(1, 5)` | `[1-5]` | _15μs_ | -| `toRegexRange(1, 10)` | `[1-9]\|10` | _22μs_ | -| `toRegexRange(1, 100)` | `[1-9]\|[1-9][0-9]\|100` | _25μs_ | -| `toRegexRange(1, 1000)` | `[1-9]\|[1-9][0-9]{1,2}\|1000` | _31μs_ | -| `toRegexRange(1, 10000)` | `[1-9]\|[1-9][0-9]{1,3}\|10000` | _34μs_ | -| `toRegexRange(1, 100000)` | `[1-9]\|[1-9][0-9]{1,4}\|100000` | _36μs_ | -| `toRegexRange(1, 1000000)` | `[1-9]\|[1-9][0-9]{1,5}\|1000000` | _42μs_ | -| `toRegexRange(1, 10000000)` | `[1-9]\|[1-9][0-9]{1,6}\|10000000` | _42μs_ | - -## Heads up! - -**Order of arguments** - -When the `min` is larger than the `max`, values will be flipped to create a valid range: - -```js -toRegexRange('51', '29'); -``` - -Is effectively flipped to: - -```js -toRegexRange('29', '51'); -//=> 29|[3-4][0-9]|5[0-1] -``` - -**Steps / increments** - -This library does not support steps (increments). A pr to add support would be welcome. - -## History - -### v2.0.0 - 2017-04-21 - -**New features** - -Adds support for zero-padding! - -### v1.0.0 - -**Optimizations** - -Repeating ranges are now grouped using quantifiers. rocessing time is roughly the same, but the generated regex is much smaller, which should result in faster matching. - -## Attribution - -Inspired by the python library [range-regex](https://github.com/dimka665/range-regex). - -## About - -
-Contributing - -Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). - -
- -
-Running Tests - -Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command: - -```sh -$ npm install && npm test -``` - -
- -
-Building docs - -_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_ - -To generate the readme, run the following command: - -```sh -$ npm install -g verbose/verb#dev verb-generate-readme && verb -``` - -
- -### Related projects - -You might also be interested in these projects: - -* [expand-range](https://www.npmjs.com/package/expand-range): Fast, bash-like range expansion. Expand a range of numbers or letters, uppercase or lowercase. Used… [more](https://github.com/jonschlinkert/expand-range) | [homepage](https://github.com/jonschlinkert/expand-range "Fast, bash-like range expansion. Expand a range of numbers or letters, uppercase or lowercase. Used by micromatch.") -* [fill-range](https://www.npmjs.com/package/fill-range): Fill in a range of numbers or letters, optionally passing an increment or `step` to… [more](https://github.com/jonschlinkert/fill-range) | [homepage](https://github.com/jonschlinkert/fill-range "Fill in a range of numbers or letters, optionally passing an increment or `step` to use, or create a regex-compatible range with `options.toRegex`") -* [micromatch](https://www.npmjs.com/package/micromatch): Glob matching for javascript/node.js. A drop-in replacement and faster alternative to minimatch and multimatch. | [homepage](https://github.com/micromatch/micromatch "Glob matching for javascript/node.js. A drop-in replacement and faster alternative to minimatch and multimatch.") -* [repeat-element](https://www.npmjs.com/package/repeat-element): Create an array by repeating the given value n times. | [homepage](https://github.com/jonschlinkert/repeat-element "Create an array by repeating the given value n times.") -* [repeat-string](https://www.npmjs.com/package/repeat-string): Repeat the given string n times. Fastest implementation for repeating a string. | [homepage](https://github.com/jonschlinkert/repeat-string "Repeat the given string n times. Fastest implementation for repeating a string.") - -### Contributors - -| **Commits** | **Contributor** | -| --- | --- | -| 63 | [jonschlinkert](https://github.com/jonschlinkert) | -| 3 | [doowb](https://github.com/doowb) | -| 2 | [realityking](https://github.com/realityking) | - -### Author - -**Jon Schlinkert** - -* [GitHub Profile](https://github.com/jonschlinkert) -* [Twitter Profile](https://twitter.com/jonschlinkert) -* [LinkedIn Profile](https://linkedin.com/in/jonschlinkert) - -Please consider supporting me on Patreon, or [start your own Patreon page](https://patreon.com/invite/bxpbvm)! - - - - - -### License - -Copyright © 2019, [Jon Schlinkert](https://github.com/jonschlinkert). -Released under the [MIT License](LICENSE). - -*** - -_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.8.0, on April 07, 2019._ \ No newline at end of file diff --git a/server/node_modules/to-regex-range/index.js b/server/node_modules/to-regex-range/index.js deleted file mode 100644 index 77fbace..0000000 --- a/server/node_modules/to-regex-range/index.js +++ /dev/null @@ -1,288 +0,0 @@ -/*! - * to-regex-range - * - * Copyright (c) 2015-present, Jon Schlinkert. - * Released under the MIT License. - */ - -'use strict'; - -const isNumber = require('is-number'); - -const toRegexRange = (min, max, options) => { - if (isNumber(min) === false) { - throw new TypeError('toRegexRange: expected the first argument to be a number'); - } - - if (max === void 0 || min === max) { - return String(min); - } - - if (isNumber(max) === false) { - throw new TypeError('toRegexRange: expected the second argument to be a number.'); - } - - let opts = { relaxZeros: true, ...options }; - if (typeof opts.strictZeros === 'boolean') { - opts.relaxZeros = opts.strictZeros === false; - } - - let relax = String(opts.relaxZeros); - let shorthand = String(opts.shorthand); - let capture = String(opts.capture); - let wrap = String(opts.wrap); - let cacheKey = min + ':' + max + '=' + relax + shorthand + capture + wrap; - - if (toRegexRange.cache.hasOwnProperty(cacheKey)) { - return toRegexRange.cache[cacheKey].result; - } - - let a = Math.min(min, max); - let b = Math.max(min, max); - - if (Math.abs(a - b) === 1) { - let result = min + '|' + max; - if (opts.capture) { - return `(${result})`; - } - if (opts.wrap === false) { - return result; - } - return `(?:${result})`; - } - - let isPadded = hasPadding(min) || hasPadding(max); - let state = { min, max, a, b }; - let positives = []; - let negatives = []; - - if (isPadded) { - state.isPadded = isPadded; - state.maxLen = String(state.max).length; - } - - if (a < 0) { - let newMin = b < 0 ? Math.abs(b) : 1; - negatives = splitToPatterns(newMin, Math.abs(a), state, opts); - a = state.a = 0; - } - - if (b >= 0) { - positives = splitToPatterns(a, b, state, opts); - } - - state.negatives = negatives; - state.positives = positives; - state.result = collatePatterns(negatives, positives, opts); - - if (opts.capture === true) { - state.result = `(${state.result})`; - } else if (opts.wrap !== false && (positives.length + negatives.length) > 1) { - state.result = `(?:${state.result})`; - } - - toRegexRange.cache[cacheKey] = state; - return state.result; -}; - -function collatePatterns(neg, pos, options) { - let onlyNegative = filterPatterns(neg, pos, '-', false, options) || []; - let onlyPositive = filterPatterns(pos, neg, '', false, options) || []; - let intersected = filterPatterns(neg, pos, '-?', true, options) || []; - let subpatterns = onlyNegative.concat(intersected).concat(onlyPositive); - return subpatterns.join('|'); -} - -function splitToRanges(min, max) { - let nines = 1; - let zeros = 1; - - let stop = countNines(min, nines); - let stops = new Set([max]); - - while (min <= stop && stop <= max) { - stops.add(stop); - nines += 1; - stop = countNines(min, nines); - } - - stop = countZeros(max + 1, zeros) - 1; - - while (min < stop && stop <= max) { - stops.add(stop); - zeros += 1; - stop = countZeros(max + 1, zeros) - 1; - } - - stops = [...stops]; - stops.sort(compare); - return stops; -} - -/** - * Convert a range to a regex pattern - * @param {Number} `start` - * @param {Number} `stop` - * @return {String} - */ - -function rangeToPattern(start, stop, options) { - if (start === stop) { - return { pattern: start, count: [], digits: 0 }; - } - - let zipped = zip(start, stop); - let digits = zipped.length; - let pattern = ''; - let count = 0; - - for (let i = 0; i < digits; i++) { - let [startDigit, stopDigit] = zipped[i]; - - if (startDigit === stopDigit) { - pattern += startDigit; - - } else if (startDigit !== '0' || stopDigit !== '9') { - pattern += toCharacterClass(startDigit, stopDigit, options); - - } else { - count++; - } - } - - if (count) { - pattern += options.shorthand === true ? '\\d' : '[0-9]'; - } - - return { pattern, count: [count], digits }; -} - -function splitToPatterns(min, max, tok, options) { - let ranges = splitToRanges(min, max); - let tokens = []; - let start = min; - let prev; - - for (let i = 0; i < ranges.length; i++) { - let max = ranges[i]; - let obj = rangeToPattern(String(start), String(max), options); - let zeros = ''; - - if (!tok.isPadded && prev && prev.pattern === obj.pattern) { - if (prev.count.length > 1) { - prev.count.pop(); - } - - prev.count.push(obj.count[0]); - prev.string = prev.pattern + toQuantifier(prev.count); - start = max + 1; - continue; - } - - if (tok.isPadded) { - zeros = padZeros(max, tok, options); - } - - obj.string = zeros + obj.pattern + toQuantifier(obj.count); - tokens.push(obj); - start = max + 1; - prev = obj; - } - - return tokens; -} - -function filterPatterns(arr, comparison, prefix, intersection, options) { - let result = []; - - for (let ele of arr) { - let { string } = ele; - - // only push if _both_ are negative... - if (!intersection && !contains(comparison, 'string', string)) { - result.push(prefix + string); - } - - // or _both_ are positive - if (intersection && contains(comparison, 'string', string)) { - result.push(prefix + string); - } - } - return result; -} - -/** - * Zip strings - */ - -function zip(a, b) { - let arr = []; - for (let i = 0; i < a.length; i++) arr.push([a[i], b[i]]); - return arr; -} - -function compare(a, b) { - return a > b ? 1 : b > a ? -1 : 0; -} - -function contains(arr, key, val) { - return arr.some(ele => ele[key] === val); -} - -function countNines(min, len) { - return Number(String(min).slice(0, -len) + '9'.repeat(len)); -} - -function countZeros(integer, zeros) { - return integer - (integer % Math.pow(10, zeros)); -} - -function toQuantifier(digits) { - let [start = 0, stop = ''] = digits; - if (stop || start > 1) { - return `{${start + (stop ? ',' + stop : '')}}`; - } - return ''; -} - -function toCharacterClass(a, b, options) { - return `[${a}${(b - a === 1) ? '' : '-'}${b}]`; -} - -function hasPadding(str) { - return /^-?(0+)\d/.test(str); -} - -function padZeros(value, tok, options) { - if (!tok.isPadded) { - return value; - } - - let diff = Math.abs(tok.maxLen - String(value).length); - let relax = options.relaxZeros !== false; - - switch (diff) { - case 0: - return ''; - case 1: - return relax ? '0?' : '0'; - case 2: - return relax ? '0{0,2}' : '00'; - default: { - return relax ? `0{0,${diff}}` : `0{${diff}}`; - } - } -} - -/** - * Cache - */ - -toRegexRange.cache = {}; -toRegexRange.clearCache = () => (toRegexRange.cache = {}); - -/** - * Expose `toRegexRange` - */ - -module.exports = toRegexRange; diff --git a/server/node_modules/to-regex-range/package.json b/server/node_modules/to-regex-range/package.json deleted file mode 100644 index 4ef194f..0000000 --- a/server/node_modules/to-regex-range/package.json +++ /dev/null @@ -1,88 +0,0 @@ -{ - "name": "to-regex-range", - "description": "Pass two numbers, get a regex-compatible source string for matching ranges. Validated against more than 2.78 million test assertions.", - "version": "5.0.1", - "homepage": "https://github.com/micromatch/to-regex-range", - "author": "Jon Schlinkert (https://github.com/jonschlinkert)", - "contributors": [ - "Jon Schlinkert (http://twitter.com/jonschlinkert)", - "Rouven Weßling (www.rouvenwessling.de)" - ], - "repository": "micromatch/to-regex-range", - "bugs": { - "url": "https://github.com/micromatch/to-regex-range/issues" - }, - "license": "MIT", - "files": [ - "index.js" - ], - "main": "index.js", - "engines": { - "node": ">=8.0" - }, - "scripts": { - "test": "mocha" - }, - "dependencies": { - "is-number": "^7.0.0" - }, - "devDependencies": { - "fill-range": "^6.0.0", - "gulp-format-md": "^2.0.0", - "mocha": "^6.0.2", - "text-table": "^0.2.0", - "time-diff": "^0.3.1" - }, - "keywords": [ - "bash", - "date", - "expand", - "expansion", - "expression", - "glob", - "match", - "match date", - "match number", - "match numbers", - "match year", - "matches", - "matching", - "number", - "numbers", - "numerical", - "range", - "ranges", - "regex", - "regexp", - "regular", - "regular expression", - "sequence" - ], - "verb": { - "layout": "default", - "toc": false, - "tasks": [ - "readme" - ], - "plugins": [ - "gulp-format-md" - ], - "lint": { - "reflinks": true - }, - "helpers": { - "examples": { - "displayName": "examples" - } - }, - "related": { - "list": [ - "expand-range", - "fill-range", - "micromatch", - "repeat-element", - "repeat-string" - ] - } - } -} diff --git a/server/node_modules/vscode-jsonrpc/.eslintignore b/server/node_modules/vscode-jsonrpc/.eslintignore deleted file mode 100644 index 7951405..0000000 --- a/server/node_modules/vscode-jsonrpc/.eslintignore +++ /dev/null @@ -1 +0,0 @@ -lib \ No newline at end of file diff --git a/server/node_modules/vscode-jsonrpc/License.txt b/server/node_modules/vscode-jsonrpc/License.txt deleted file mode 100644 index c94a5f1..0000000 --- a/server/node_modules/vscode-jsonrpc/License.txt +++ /dev/null @@ -1,11 +0,0 @@ -Copyright (c) Microsoft Corporation - -All rights reserved. - -MIT License - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/server/node_modules/vscode-jsonrpc/README.md b/server/node_modules/vscode-jsonrpc/README.md deleted file mode 100644 index 5e6f281..0000000 --- a/server/node_modules/vscode-jsonrpc/README.md +++ /dev/null @@ -1,69 +0,0 @@ -# VSCode JSON RPC - -[![NPM Version](https://img.shields.io/npm/v/vscode-jsonrpc.svg)](https://npmjs.org/package/vscode-jsonrpc) -[![NPM Downloads](https://img.shields.io/npm/dm/vscode-jsonrpc.svg)](https://npmjs.org/package/vscode-jsonrpc) -[![Build Status](https://travis-ci.org/Microsoft/vscode-languageserver-node.svg?branch=master)](https://travis-ci.org/Microsoft/vscode-languageserver-node) - -This npm module implements the base messaging protocol spoken between a VSCode language server and a VSCode language client. - -The npm module can also be used standalone to establish a [JSON-RPC](http://www.jsonrpc.org/) channel between -a client and a server. Below an example how to setup a JSON-RPC connection. First the client side. - -```ts -import * as cp from 'child_process'; -import * as rpc from 'vscode-jsonrpc'; - -let childProcess = cp.spawn(...); - -// Use stdin and stdout for communication: -let connection = rpc.createMessageConnection( - new rpc.StreamMessageReader(childProcess.stdout), - new rpc.StreamMessageWriter(childProcess.stdin)); - -let notification = new rpc.NotificationType('testNotification'); - -connection.listen(); - -connection.sendNotification(notification, 'Hello World'); -``` - -The server side looks very symmetrical: - -```ts -import * as rpc from 'vscode-jsonrpc'; - - -let connection = rpc.createMessageConnection( - new rpc.StreamMessageReader(process.stdin), - new rpc.StreamMessageWriter(process.stdout)); - -let notification = new rpc.NotificationType('testNotification'); -connection.onNotification(notification, (param: string) => { - console.log(param); // This prints Hello World -}); - -connection.listen(); -``` - -# History - -### 5.0.0 - -- add progress support -- move JS target to ES2017 - -### 4.0.0 - -- move JS target to ES6. - -### 3.0.0: - -- converted the NPM module to use TypeScript 2.0.3. -- added strict null support. -- support for passing more than one parameter to a request or notification. -- Breaking changes: - - due to the use of TypeScript 2.0.3 and differences in d.ts generation users of the new version need to move to - TypeScript 2.0.3 as well. - -## License -[MIT](https://github.com/Microsoft/vscode-languageserver-node/blob/master/License.txt) diff --git a/server/node_modules/vscode-jsonrpc/lib/cancellation.js b/server/node_modules/vscode-jsonrpc/lib/cancellation.js deleted file mode 100644 index af6a96d..0000000 --- a/server/node_modules/vscode-jsonrpc/lib/cancellation.js +++ /dev/null @@ -1,94 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ -'use strict'; -Object.defineProperty(exports, "__esModule", { value: true }); -const events_1 = require("./events"); -const Is = require("./is"); -var CancellationToken; -(function (CancellationToken) { - CancellationToken.None = Object.freeze({ - isCancellationRequested: false, - onCancellationRequested: events_1.Event.None - }); - CancellationToken.Cancelled = Object.freeze({ - isCancellationRequested: true, - onCancellationRequested: events_1.Event.None - }); - function is(value) { - let candidate = value; - return candidate && (candidate === CancellationToken.None - || candidate === CancellationToken.Cancelled - || (Is.boolean(candidate.isCancellationRequested) && !!candidate.onCancellationRequested)); - } - CancellationToken.is = is; -})(CancellationToken = exports.CancellationToken || (exports.CancellationToken = {})); -const shortcutEvent = Object.freeze(function (callback, context) { - let handle = setTimeout(callback.bind(context), 0); - return { dispose() { clearTimeout(handle); } }; -}); -class MutableToken { - constructor() { - this._isCancelled = false; - } - cancel() { - if (!this._isCancelled) { - this._isCancelled = true; - if (this._emitter) { - this._emitter.fire(undefined); - this.dispose(); - } - } - } - get isCancellationRequested() { - return this._isCancelled; - } - get onCancellationRequested() { - if (this._isCancelled) { - return shortcutEvent; - } - if (!this._emitter) { - this._emitter = new events_1.Emitter(); - } - return this._emitter.event; - } - dispose() { - if (this._emitter) { - this._emitter.dispose(); - this._emitter = undefined; - } - } -} -class CancellationTokenSource { - get token() { - if (!this._token) { - // be lazy and create the token only when - // actually needed - this._token = new MutableToken(); - } - return this._token; - } - cancel() { - if (!this._token) { - // save an object by returning the default - // cancelled token when cancellation happens - // before someone asks for the token - this._token = CancellationToken.Cancelled; - } - else { - this._token.cancel(); - } - } - dispose() { - if (!this._token) { - // ensure to initialize with an empty token if we had none - this._token = CancellationToken.None; - } - else if (this._token instanceof MutableToken) { - // actually dispose - this._token.dispose(); - } - } -} -exports.CancellationTokenSource = CancellationTokenSource; diff --git a/server/node_modules/vscode-jsonrpc/lib/events.js b/server/node_modules/vscode-jsonrpc/lib/events.js deleted file mode 100644 index cd80c3f..0000000 --- a/server/node_modules/vscode-jsonrpc/lib/events.js +++ /dev/null @@ -1,132 +0,0 @@ -/* -------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * ------------------------------------------------------------------------------------------ */ -'use strict'; -Object.defineProperty(exports, "__esModule", { value: true }); -var Disposable; -(function (Disposable) { - function create(func) { - return { - dispose: func - }; - } - Disposable.create = create; -})(Disposable = exports.Disposable || (exports.Disposable = {})); -var Event; -(function (Event) { - const _disposable = { dispose() { } }; - Event.None = function () { return _disposable; }; -})(Event = exports.Event || (exports.Event = {})); -class CallbackList { - add(callback, context = null, bucket) { - if (!this._callbacks) { - this._callbacks = []; - this._contexts = []; - } - this._callbacks.push(callback); - this._contexts.push(context); - if (Array.isArray(bucket)) { - bucket.push({ dispose: () => this.remove(callback, context) }); - } - } - remove(callback, context = null) { - if (!this._callbacks) { - return; - } - var foundCallbackWithDifferentContext = false; - for (var i = 0, len = this._callbacks.length; i < len; i++) { - if (this._callbacks[i] === callback) { - if (this._contexts[i] === context) { - // callback & context match => remove it - this._callbacks.splice(i, 1); - this._contexts.splice(i, 1); - return; - } - else { - foundCallbackWithDifferentContext = true; - } - } - } - if (foundCallbackWithDifferentContext) { - throw new Error('When adding a listener with a context, you should remove it with the same context'); - } - } - invoke(...args) { - if (!this._callbacks) { - return []; - } - var ret = [], callbacks = this._callbacks.slice(0), contexts = this._contexts.slice(0); - for (var i = 0, len = callbacks.length; i < len; i++) { - try { - ret.push(callbacks[i].apply(contexts[i], args)); - } - catch (e) { - // eslint-disable-next-line no-console - console.error(e); - } - } - return ret; - } - isEmpty() { - return !this._callbacks || this._callbacks.length === 0; - } - dispose() { - this._callbacks = undefined; - this._contexts = undefined; - } -} -class Emitter { - constructor(_options) { - this._options = _options; - } - /** - * For the public to allow to subscribe - * to events from this Emitter - */ - get event() { - if (!this._event) { - this._event = (listener, thisArgs, disposables) => { - if (!this._callbacks) { - this._callbacks = new CallbackList(); - } - if (this._options && this._options.onFirstListenerAdd && this._callbacks.isEmpty()) { - this._options.onFirstListenerAdd(this); - } - this._callbacks.add(listener, thisArgs); - let result; - result = { - dispose: () => { - this._callbacks.remove(listener, thisArgs); - result.dispose = Emitter._noop; - if (this._options && this._options.onLastListenerRemove && this._callbacks.isEmpty()) { - this._options.onLastListenerRemove(this); - } - } - }; - if (Array.isArray(disposables)) { - disposables.push(result); - } - return result; - }; - } - return this._event; - } - /** - * To be kept private to fire an event to - * subscribers - */ - fire(event) { - if (this._callbacks) { - this._callbacks.invoke.call(this._callbacks, event); - } - } - dispose() { - if (this._callbacks) { - this._callbacks.dispose(); - this._callbacks = undefined; - } - } -} -exports.Emitter = Emitter; -Emitter._noop = function () { }; diff --git a/server/node_modules/vscode-jsonrpc/lib/is.js b/server/node_modules/vscode-jsonrpc/lib/is.js deleted file mode 100644 index 1e50698..0000000 --- a/server/node_modules/vscode-jsonrpc/lib/is.js +++ /dev/null @@ -1,34 +0,0 @@ -/* -------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * ------------------------------------------------------------------------------------------ */ -'use strict'; -Object.defineProperty(exports, "__esModule", { value: true }); -function boolean(value) { - return value === true || value === false; -} -exports.boolean = boolean; -function string(value) { - return typeof value === 'string' || value instanceof String; -} -exports.string = string; -function number(value) { - return typeof value === 'number' || value instanceof Number; -} -exports.number = number; -function error(value) { - return value instanceof Error; -} -exports.error = error; -function func(value) { - return typeof value === 'function'; -} -exports.func = func; -function array(value) { - return Array.isArray(value); -} -exports.array = array; -function stringArray(value) { - return array(value) && value.every(elem => string(elem)); -} -exports.stringArray = stringArray; diff --git a/server/node_modules/vscode-jsonrpc/lib/linkedMap.js b/server/node_modules/vscode-jsonrpc/lib/linkedMap.js deleted file mode 100644 index 7f6c069..0000000 --- a/server/node_modules/vscode-jsonrpc/lib/linkedMap.js +++ /dev/null @@ -1,279 +0,0 @@ -"use strict"; -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ -Object.defineProperty(exports, "__esModule", { value: true }); -var Touch; -(function (Touch) { - Touch.None = 0; - Touch.First = 1; - Touch.Last = 2; -})(Touch = exports.Touch || (exports.Touch = {})); -class LinkedMap { - constructor() { - this._map = new Map(); - this._head = undefined; - this._tail = undefined; - this._size = 0; - } - clear() { - this._map.clear(); - this._head = undefined; - this._tail = undefined; - this._size = 0; - } - isEmpty() { - return !this._head && !this._tail; - } - get size() { - return this._size; - } - has(key) { - return this._map.has(key); - } - get(key) { - const item = this._map.get(key); - if (!item) { - return undefined; - } - return item.value; - } - set(key, value, touch = Touch.None) { - let item = this._map.get(key); - if (item) { - item.value = value; - if (touch !== Touch.None) { - this.touch(item, touch); - } - } - else { - item = { key, value, next: undefined, previous: undefined }; - switch (touch) { - case Touch.None: - this.addItemLast(item); - break; - case Touch.First: - this.addItemFirst(item); - break; - case Touch.Last: - this.addItemLast(item); - break; - default: - this.addItemLast(item); - break; - } - this._map.set(key, item); - this._size++; - } - } - delete(key) { - const item = this._map.get(key); - if (!item) { - return false; - } - this._map.delete(key); - this.removeItem(item); - this._size--; - return true; - } - shift() { - if (!this._head && !this._tail) { - return undefined; - } - if (!this._head || !this._tail) { - throw new Error('Invalid list'); - } - const item = this._head; - this._map.delete(item.key); - this.removeItem(item); - this._size--; - return item.value; - } - forEach(callbackfn, thisArg) { - let current = this._head; - while (current) { - if (thisArg) { - callbackfn.bind(thisArg)(current.value, current.key, this); - } - else { - callbackfn(current.value, current.key, this); - } - current = current.next; - } - } - forEachReverse(callbackfn, thisArg) { - let current = this._tail; - while (current) { - if (thisArg) { - callbackfn.bind(thisArg)(current.value, current.key, this); - } - else { - callbackfn(current.value, current.key, this); - } - current = current.previous; - } - } - values() { - let result = []; - let current = this._head; - while (current) { - result.push(current.value); - current = current.next; - } - return result; - } - keys() { - let result = []; - let current = this._head; - while (current) { - result.push(current.key); - current = current.next; - } - return result; - } - /* JSON RPC run on es5 which has no Symbol.iterator - public keys(): IterableIterator { - let current = this._head; - let iterator: IterableIterator = { - [Symbol.iterator]() { - return iterator; - }, - next():IteratorResult { - if (current) { - let result = { value: current.key, done: false }; - current = current.next; - return result; - } else { - return { value: undefined, done: true }; - } - } - }; - return iterator; - } - - public values(): IterableIterator { - let current = this._head; - let iterator: IterableIterator = { - [Symbol.iterator]() { - return iterator; - }, - next():IteratorResult { - if (current) { - let result = { value: current.value, done: false }; - current = current.next; - return result; - } else { - return { value: undefined, done: true }; - } - } - }; - return iterator; - } - */ - addItemFirst(item) { - // First time Insert - if (!this._head && !this._tail) { - this._tail = item; - } - else if (!this._head) { - throw new Error('Invalid list'); - } - else { - item.next = this._head; - this._head.previous = item; - } - this._head = item; - } - addItemLast(item) { - // First time Insert - if (!this._head && !this._tail) { - this._head = item; - } - else if (!this._tail) { - throw new Error('Invalid list'); - } - else { - item.previous = this._tail; - this._tail.next = item; - } - this._tail = item; - } - removeItem(item) { - if (item === this._head && item === this._tail) { - this._head = undefined; - this._tail = undefined; - } - else if (item === this._head) { - this._head = item.next; - } - else if (item === this._tail) { - this._tail = item.previous; - } - else { - const next = item.next; - const previous = item.previous; - if (!next || !previous) { - throw new Error('Invalid list'); - } - next.previous = previous; - previous.next = next; - } - } - touch(item, touch) { - if (!this._head || !this._tail) { - throw new Error('Invalid list'); - } - if ((touch !== Touch.First && touch !== Touch.Last)) { - return; - } - if (touch === Touch.First) { - if (item === this._head) { - return; - } - const next = item.next; - const previous = item.previous; - // Unlink the item - if (item === this._tail) { - // previous must be defined since item was not head but is tail - // So there are more than on item in the map - previous.next = undefined; - this._tail = previous; - } - else { - // Both next and previous are not undefined since item was neither head nor tail. - next.previous = previous; - previous.next = next; - } - // Insert the node at head - item.previous = undefined; - item.next = this._head; - this._head.previous = item; - this._head = item; - } - else if (touch === Touch.Last) { - if (item === this._tail) { - return; - } - const next = item.next; - const previous = item.previous; - // Unlink the item. - if (item === this._head) { - // next must be defined since item was not tail but is head - // So there are more than on item in the map - next.previous = undefined; - this._head = next; - } - else { - // Both next and previous are not undefined since item was neither head nor tail. - next.previous = previous; - previous.next = next; - } - item.next = undefined; - item.previous = this._tail; - this._tail.next = item; - this._tail = item; - } - } -} -exports.LinkedMap = LinkedMap; diff --git a/server/node_modules/vscode-jsonrpc/lib/main.js b/server/node_modules/vscode-jsonrpc/lib/main.js deleted file mode 100644 index 41e54ab..0000000 --- a/server/node_modules/vscode-jsonrpc/lib/main.js +++ /dev/null @@ -1,961 +0,0 @@ -/* -------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * ------------------------------------------------------------------------------------------ */ -/// -'use strict'; -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -const Is = require("./is"); -const messages_1 = require("./messages"); -exports.RequestType = messages_1.RequestType; -exports.RequestType0 = messages_1.RequestType0; -exports.RequestType1 = messages_1.RequestType1; -exports.RequestType2 = messages_1.RequestType2; -exports.RequestType3 = messages_1.RequestType3; -exports.RequestType4 = messages_1.RequestType4; -exports.RequestType5 = messages_1.RequestType5; -exports.RequestType6 = messages_1.RequestType6; -exports.RequestType7 = messages_1.RequestType7; -exports.RequestType8 = messages_1.RequestType8; -exports.RequestType9 = messages_1.RequestType9; -exports.ResponseError = messages_1.ResponseError; -exports.ErrorCodes = messages_1.ErrorCodes; -exports.NotificationType = messages_1.NotificationType; -exports.NotificationType0 = messages_1.NotificationType0; -exports.NotificationType1 = messages_1.NotificationType1; -exports.NotificationType2 = messages_1.NotificationType2; -exports.NotificationType3 = messages_1.NotificationType3; -exports.NotificationType4 = messages_1.NotificationType4; -exports.NotificationType5 = messages_1.NotificationType5; -exports.NotificationType6 = messages_1.NotificationType6; -exports.NotificationType7 = messages_1.NotificationType7; -exports.NotificationType8 = messages_1.NotificationType8; -exports.NotificationType9 = messages_1.NotificationType9; -const messageReader_1 = require("./messageReader"); -exports.MessageReader = messageReader_1.MessageReader; -exports.StreamMessageReader = messageReader_1.StreamMessageReader; -exports.IPCMessageReader = messageReader_1.IPCMessageReader; -exports.SocketMessageReader = messageReader_1.SocketMessageReader; -const messageWriter_1 = require("./messageWriter"); -exports.MessageWriter = messageWriter_1.MessageWriter; -exports.StreamMessageWriter = messageWriter_1.StreamMessageWriter; -exports.IPCMessageWriter = messageWriter_1.IPCMessageWriter; -exports.SocketMessageWriter = messageWriter_1.SocketMessageWriter; -const events_1 = require("./events"); -exports.Disposable = events_1.Disposable; -exports.Event = events_1.Event; -exports.Emitter = events_1.Emitter; -const cancellation_1 = require("./cancellation"); -exports.CancellationTokenSource = cancellation_1.CancellationTokenSource; -exports.CancellationToken = cancellation_1.CancellationToken; -const linkedMap_1 = require("./linkedMap"); -__export(require("./pipeSupport")); -__export(require("./socketSupport")); -var CancelNotification; -(function (CancelNotification) { - CancelNotification.type = new messages_1.NotificationType('$/cancelRequest'); -})(CancelNotification || (CancelNotification = {})); -var ProgressNotification; -(function (ProgressNotification) { - ProgressNotification.type = new messages_1.NotificationType('$/progress'); -})(ProgressNotification || (ProgressNotification = {})); -class ProgressType { - constructor() { - } -} -exports.ProgressType = ProgressType; -exports.NullLogger = Object.freeze({ - error: () => { }, - warn: () => { }, - info: () => { }, - log: () => { } -}); -var Trace; -(function (Trace) { - Trace[Trace["Off"] = 0] = "Off"; - Trace[Trace["Messages"] = 1] = "Messages"; - Trace[Trace["Verbose"] = 2] = "Verbose"; -})(Trace = exports.Trace || (exports.Trace = {})); -(function (Trace) { - function fromString(value) { - if (!Is.string(value)) { - return Trace.Off; - } - value = value.toLowerCase(); - switch (value) { - case 'off': - return Trace.Off; - case 'messages': - return Trace.Messages; - case 'verbose': - return Trace.Verbose; - default: - return Trace.Off; - } - } - Trace.fromString = fromString; - function toString(value) { - switch (value) { - case Trace.Off: - return 'off'; - case Trace.Messages: - return 'messages'; - case Trace.Verbose: - return 'verbose'; - default: - return 'off'; - } - } - Trace.toString = toString; -})(Trace = exports.Trace || (exports.Trace = {})); -var TraceFormat; -(function (TraceFormat) { - TraceFormat["Text"] = "text"; - TraceFormat["JSON"] = "json"; -})(TraceFormat = exports.TraceFormat || (exports.TraceFormat = {})); -(function (TraceFormat) { - function fromString(value) { - value = value.toLowerCase(); - if (value === 'json') { - return TraceFormat.JSON; - } - else { - return TraceFormat.Text; - } - } - TraceFormat.fromString = fromString; -})(TraceFormat = exports.TraceFormat || (exports.TraceFormat = {})); -var SetTraceNotification; -(function (SetTraceNotification) { - SetTraceNotification.type = new messages_1.NotificationType('$/setTraceNotification'); -})(SetTraceNotification = exports.SetTraceNotification || (exports.SetTraceNotification = {})); -var LogTraceNotification; -(function (LogTraceNotification) { - LogTraceNotification.type = new messages_1.NotificationType('$/logTraceNotification'); -})(LogTraceNotification = exports.LogTraceNotification || (exports.LogTraceNotification = {})); -var ConnectionErrors; -(function (ConnectionErrors) { - /** - * The connection is closed. - */ - ConnectionErrors[ConnectionErrors["Closed"] = 1] = "Closed"; - /** - * The connection got disposed. - */ - ConnectionErrors[ConnectionErrors["Disposed"] = 2] = "Disposed"; - /** - * The connection is already in listening mode. - */ - ConnectionErrors[ConnectionErrors["AlreadyListening"] = 3] = "AlreadyListening"; -})(ConnectionErrors = exports.ConnectionErrors || (exports.ConnectionErrors = {})); -class ConnectionError extends Error { - constructor(code, message) { - super(message); - this.code = code; - Object.setPrototypeOf(this, ConnectionError.prototype); - } -} -exports.ConnectionError = ConnectionError; -var ConnectionStrategy; -(function (ConnectionStrategy) { - function is(value) { - let candidate = value; - return candidate && Is.func(candidate.cancelUndispatched); - } - ConnectionStrategy.is = is; -})(ConnectionStrategy = exports.ConnectionStrategy || (exports.ConnectionStrategy = {})); -var ConnectionState; -(function (ConnectionState) { - ConnectionState[ConnectionState["New"] = 1] = "New"; - ConnectionState[ConnectionState["Listening"] = 2] = "Listening"; - ConnectionState[ConnectionState["Closed"] = 3] = "Closed"; - ConnectionState[ConnectionState["Disposed"] = 4] = "Disposed"; -})(ConnectionState || (ConnectionState = {})); -function _createMessageConnection(messageReader, messageWriter, logger, strategy) { - let sequenceNumber = 0; - let notificationSquenceNumber = 0; - let unknownResponseSquenceNumber = 0; - const version = '2.0'; - let starRequestHandler = undefined; - let requestHandlers = Object.create(null); - let starNotificationHandler = undefined; - let notificationHandlers = Object.create(null); - let progressHandlers = new Map(); - let timer; - let messageQueue = new linkedMap_1.LinkedMap(); - let responsePromises = Object.create(null); - let requestTokens = Object.create(null); - let trace = Trace.Off; - let traceFormat = TraceFormat.Text; - let tracer; - let state = ConnectionState.New; - let errorEmitter = new events_1.Emitter(); - let closeEmitter = new events_1.Emitter(); - let unhandledNotificationEmitter = new events_1.Emitter(); - let unhandledProgressEmitter = new events_1.Emitter(); - let disposeEmitter = new events_1.Emitter(); - function createRequestQueueKey(id) { - return 'req-' + id.toString(); - } - function createResponseQueueKey(id) { - if (id === null) { - return 'res-unknown-' + (++unknownResponseSquenceNumber).toString(); - } - else { - return 'res-' + id.toString(); - } - } - function createNotificationQueueKey() { - return 'not-' + (++notificationSquenceNumber).toString(); - } - function addMessageToQueue(queue, message) { - if (messages_1.isRequestMessage(message)) { - queue.set(createRequestQueueKey(message.id), message); - } - else if (messages_1.isResponseMessage(message)) { - queue.set(createResponseQueueKey(message.id), message); - } - else { - queue.set(createNotificationQueueKey(), message); - } - } - function cancelUndispatched(_message) { - return undefined; - } - function isListening() { - return state === ConnectionState.Listening; - } - function isClosed() { - return state === ConnectionState.Closed; - } - function isDisposed() { - return state === ConnectionState.Disposed; - } - function closeHandler() { - if (state === ConnectionState.New || state === ConnectionState.Listening) { - state = ConnectionState.Closed; - closeEmitter.fire(undefined); - } - // If the connection is disposed don't sent close events. - } - function readErrorHandler(error) { - errorEmitter.fire([error, undefined, undefined]); - } - function writeErrorHandler(data) { - errorEmitter.fire(data); - } - messageReader.onClose(closeHandler); - messageReader.onError(readErrorHandler); - messageWriter.onClose(closeHandler); - messageWriter.onError(writeErrorHandler); - function triggerMessageQueue() { - if (timer || messageQueue.size === 0) { - return; - } - timer = setImmediate(() => { - timer = undefined; - processMessageQueue(); - }); - } - function processMessageQueue() { - if (messageQueue.size === 0) { - return; - } - let message = messageQueue.shift(); - try { - if (messages_1.isRequestMessage(message)) { - handleRequest(message); - } - else if (messages_1.isNotificationMessage(message)) { - handleNotification(message); - } - else if (messages_1.isResponseMessage(message)) { - handleResponse(message); - } - else { - handleInvalidMessage(message); - } - } - finally { - triggerMessageQueue(); - } - } - let callback = (message) => { - try { - // We have received a cancellation message. Check if the message is still in the queue - // and cancel it if allowed to do so. - if (messages_1.isNotificationMessage(message) && message.method === CancelNotification.type.method) { - let key = createRequestQueueKey(message.params.id); - let toCancel = messageQueue.get(key); - if (messages_1.isRequestMessage(toCancel)) { - let response = strategy && strategy.cancelUndispatched ? strategy.cancelUndispatched(toCancel, cancelUndispatched) : cancelUndispatched(toCancel); - if (response && (response.error !== void 0 || response.result !== void 0)) { - messageQueue.delete(key); - response.id = toCancel.id; - traceSendingResponse(response, message.method, Date.now()); - messageWriter.write(response); - return; - } - } - } - addMessageToQueue(messageQueue, message); - } - finally { - triggerMessageQueue(); - } - }; - function handleRequest(requestMessage) { - if (isDisposed()) { - // we return here silently since we fired an event when the - // connection got disposed. - return; - } - function reply(resultOrError, method, startTime) { - let message = { - jsonrpc: version, - id: requestMessage.id - }; - if (resultOrError instanceof messages_1.ResponseError) { - message.error = resultOrError.toJson(); - } - else { - message.result = resultOrError === void 0 ? null : resultOrError; - } - traceSendingResponse(message, method, startTime); - messageWriter.write(message); - } - function replyError(error, method, startTime) { - let message = { - jsonrpc: version, - id: requestMessage.id, - error: error.toJson() - }; - traceSendingResponse(message, method, startTime); - messageWriter.write(message); - } - function replySuccess(result, method, startTime) { - // The JSON RPC defines that a response must either have a result or an error - // So we can't treat undefined as a valid response result. - if (result === void 0) { - result = null; - } - let message = { - jsonrpc: version, - id: requestMessage.id, - result: result - }; - traceSendingResponse(message, method, startTime); - messageWriter.write(message); - } - traceReceivedRequest(requestMessage); - let element = requestHandlers[requestMessage.method]; - let type; - let requestHandler; - if (element) { - type = element.type; - requestHandler = element.handler; - } - let startTime = Date.now(); - if (requestHandler || starRequestHandler) { - let cancellationSource = new cancellation_1.CancellationTokenSource(); - let tokenKey = String(requestMessage.id); - requestTokens[tokenKey] = cancellationSource; - try { - let handlerResult; - if (requestMessage.params === void 0 || (type !== void 0 && type.numberOfParams === 0)) { - handlerResult = requestHandler - ? requestHandler(cancellationSource.token) - : starRequestHandler(requestMessage.method, cancellationSource.token); - } - else if (Is.array(requestMessage.params) && (type === void 0 || type.numberOfParams > 1)) { - handlerResult = requestHandler - ? requestHandler(...requestMessage.params, cancellationSource.token) - : starRequestHandler(requestMessage.method, ...requestMessage.params, cancellationSource.token); - } - else { - handlerResult = requestHandler - ? requestHandler(requestMessage.params, cancellationSource.token) - : starRequestHandler(requestMessage.method, requestMessage.params, cancellationSource.token); - } - let promise = handlerResult; - if (!handlerResult) { - delete requestTokens[tokenKey]; - replySuccess(handlerResult, requestMessage.method, startTime); - } - else if (promise.then) { - promise.then((resultOrError) => { - delete requestTokens[tokenKey]; - reply(resultOrError, requestMessage.method, startTime); - }, error => { - delete requestTokens[tokenKey]; - if (error instanceof messages_1.ResponseError) { - replyError(error, requestMessage.method, startTime); - } - else if (error && Is.string(error.message)) { - replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed with message: ${error.message}`), requestMessage.method, startTime); - } - else { - replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed unexpectedly without providing any details.`), requestMessage.method, startTime); - } - }); - } - else { - delete requestTokens[tokenKey]; - reply(handlerResult, requestMessage.method, startTime); - } - } - catch (error) { - delete requestTokens[tokenKey]; - if (error instanceof messages_1.ResponseError) { - reply(error, requestMessage.method, startTime); - } - else if (error && Is.string(error.message)) { - replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed with message: ${error.message}`), requestMessage.method, startTime); - } - else { - replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed unexpectedly without providing any details.`), requestMessage.method, startTime); - } - } - } - else { - replyError(new messages_1.ResponseError(messages_1.ErrorCodes.MethodNotFound, `Unhandled method ${requestMessage.method}`), requestMessage.method, startTime); - } - } - function handleResponse(responseMessage) { - if (isDisposed()) { - // See handle request. - return; - } - if (responseMessage.id === null) { - if (responseMessage.error) { - logger.error(`Received response message without id: Error is: \n${JSON.stringify(responseMessage.error, undefined, 4)}`); - } - else { - logger.error(`Received response message without id. No further error information provided.`); - } - } - else { - let key = String(responseMessage.id); - let responsePromise = responsePromises[key]; - traceReceivedResponse(responseMessage, responsePromise); - if (responsePromise) { - delete responsePromises[key]; - try { - if (responseMessage.error) { - let error = responseMessage.error; - responsePromise.reject(new messages_1.ResponseError(error.code, error.message, error.data)); - } - else if (responseMessage.result !== void 0) { - responsePromise.resolve(responseMessage.result); - } - else { - throw new Error('Should never happen.'); - } - } - catch (error) { - if (error.message) { - logger.error(`Response handler '${responsePromise.method}' failed with message: ${error.message}`); - } - else { - logger.error(`Response handler '${responsePromise.method}' failed unexpectedly.`); - } - } - } - } - } - function handleNotification(message) { - if (isDisposed()) { - // See handle request. - return; - } - let type = undefined; - let notificationHandler; - if (message.method === CancelNotification.type.method) { - notificationHandler = (params) => { - let id = params.id; - let source = requestTokens[String(id)]; - if (source) { - source.cancel(); - } - }; - } - else { - let element = notificationHandlers[message.method]; - if (element) { - notificationHandler = element.handler; - type = element.type; - } - } - if (notificationHandler || starNotificationHandler) { - try { - traceReceivedNotification(message); - if (message.params === void 0 || (type !== void 0 && type.numberOfParams === 0)) { - notificationHandler ? notificationHandler() : starNotificationHandler(message.method); - } - else if (Is.array(message.params) && (type === void 0 || type.numberOfParams > 1)) { - notificationHandler ? notificationHandler(...message.params) : starNotificationHandler(message.method, ...message.params); - } - else { - notificationHandler ? notificationHandler(message.params) : starNotificationHandler(message.method, message.params); - } - } - catch (error) { - if (error.message) { - logger.error(`Notification handler '${message.method}' failed with message: ${error.message}`); - } - else { - logger.error(`Notification handler '${message.method}' failed unexpectedly.`); - } - } - } - else { - unhandledNotificationEmitter.fire(message); - } - } - function handleInvalidMessage(message) { - if (!message) { - logger.error('Received empty message.'); - return; - } - logger.error(`Received message which is neither a response nor a notification message:\n${JSON.stringify(message, null, 4)}`); - // Test whether we find an id to reject the promise - let responseMessage = message; - if (Is.string(responseMessage.id) || Is.number(responseMessage.id)) { - let key = String(responseMessage.id); - let responseHandler = responsePromises[key]; - if (responseHandler) { - responseHandler.reject(new Error('The received response has neither a result nor an error property.')); - } - } - } - function traceSendingRequest(message) { - if (trace === Trace.Off || !tracer) { - return; - } - if (traceFormat === TraceFormat.Text) { - let data = undefined; - if (trace === Trace.Verbose && message.params) { - data = `Params: ${JSON.stringify(message.params, null, 4)}\n\n`; - } - tracer.log(`Sending request '${message.method} - (${message.id})'.`, data); - } - else { - logLSPMessage('send-request', message); - } - } - function traceSendingNotification(message) { - if (trace === Trace.Off || !tracer) { - return; - } - if (traceFormat === TraceFormat.Text) { - let data = undefined; - if (trace === Trace.Verbose) { - if (message.params) { - data = `Params: ${JSON.stringify(message.params, null, 4)}\n\n`; - } - else { - data = 'No parameters provided.\n\n'; - } - } - tracer.log(`Sending notification '${message.method}'.`, data); - } - else { - logLSPMessage('send-notification', message); - } - } - function traceSendingResponse(message, method, startTime) { - if (trace === Trace.Off || !tracer) { - return; - } - if (traceFormat === TraceFormat.Text) { - let data = undefined; - if (trace === Trace.Verbose) { - if (message.error && message.error.data) { - data = `Error data: ${JSON.stringify(message.error.data, null, 4)}\n\n`; - } - else { - if (message.result) { - data = `Result: ${JSON.stringify(message.result, null, 4)}\n\n`; - } - else if (message.error === void 0) { - data = 'No result returned.\n\n'; - } - } - } - tracer.log(`Sending response '${method} - (${message.id})'. Processing request took ${Date.now() - startTime}ms`, data); - } - else { - logLSPMessage('send-response', message); - } - } - function traceReceivedRequest(message) { - if (trace === Trace.Off || !tracer) { - return; - } - if (traceFormat === TraceFormat.Text) { - let data = undefined; - if (trace === Trace.Verbose && message.params) { - data = `Params: ${JSON.stringify(message.params, null, 4)}\n\n`; - } - tracer.log(`Received request '${message.method} - (${message.id})'.`, data); - } - else { - logLSPMessage('receive-request', message); - } - } - function traceReceivedNotification(message) { - if (trace === Trace.Off || !tracer || message.method === LogTraceNotification.type.method) { - return; - } - if (traceFormat === TraceFormat.Text) { - let data = undefined; - if (trace === Trace.Verbose) { - if (message.params) { - data = `Params: ${JSON.stringify(message.params, null, 4)}\n\n`; - } - else { - data = 'No parameters provided.\n\n'; - } - } - tracer.log(`Received notification '${message.method}'.`, data); - } - else { - logLSPMessage('receive-notification', message); - } - } - function traceReceivedResponse(message, responsePromise) { - if (trace === Trace.Off || !tracer) { - return; - } - if (traceFormat === TraceFormat.Text) { - let data = undefined; - if (trace === Trace.Verbose) { - if (message.error && message.error.data) { - data = `Error data: ${JSON.stringify(message.error.data, null, 4)}\n\n`; - } - else { - if (message.result) { - data = `Result: ${JSON.stringify(message.result, null, 4)}\n\n`; - } - else if (message.error === void 0) { - data = 'No result returned.\n\n'; - } - } - } - if (responsePromise) { - let error = message.error ? ` Request failed: ${message.error.message} (${message.error.code}).` : ''; - tracer.log(`Received response '${responsePromise.method} - (${message.id})' in ${Date.now() - responsePromise.timerStart}ms.${error}`, data); - } - else { - tracer.log(`Received response ${message.id} without active response promise.`, data); - } - } - else { - logLSPMessage('receive-response', message); - } - } - function logLSPMessage(type, message) { - if (!tracer || trace === Trace.Off) { - return; - } - const lspMessage = { - isLSPMessage: true, - type, - message, - timestamp: Date.now() - }; - tracer.log(lspMessage); - } - function throwIfClosedOrDisposed() { - if (isClosed()) { - throw new ConnectionError(ConnectionErrors.Closed, 'Connection is closed.'); - } - if (isDisposed()) { - throw new ConnectionError(ConnectionErrors.Disposed, 'Connection is disposed.'); - } - } - function throwIfListening() { - if (isListening()) { - throw new ConnectionError(ConnectionErrors.AlreadyListening, 'Connection is already listening'); - } - } - function throwIfNotListening() { - if (!isListening()) { - throw new Error('Call listen() first.'); - } - } - function undefinedToNull(param) { - if (param === void 0) { - return null; - } - else { - return param; - } - } - function computeMessageParams(type, params) { - let result; - let numberOfParams = type.numberOfParams; - switch (numberOfParams) { - case 0: - result = null; - break; - case 1: - result = undefinedToNull(params[0]); - break; - default: - result = []; - for (let i = 0; i < params.length && i < numberOfParams; i++) { - result.push(undefinedToNull(params[i])); - } - if (params.length < numberOfParams) { - for (let i = params.length; i < numberOfParams; i++) { - result.push(null); - } - } - break; - } - return result; - } - let connection = { - sendNotification: (type, ...params) => { - throwIfClosedOrDisposed(); - let method; - let messageParams; - if (Is.string(type)) { - method = type; - switch (params.length) { - case 0: - messageParams = null; - break; - case 1: - messageParams = params[0]; - break; - default: - messageParams = params; - break; - } - } - else { - method = type.method; - messageParams = computeMessageParams(type, params); - } - let notificationMessage = { - jsonrpc: version, - method: method, - params: messageParams - }; - traceSendingNotification(notificationMessage); - messageWriter.write(notificationMessage); - }, - onNotification: (type, handler) => { - throwIfClosedOrDisposed(); - if (Is.func(type)) { - starNotificationHandler = type; - } - else if (handler) { - if (Is.string(type)) { - notificationHandlers[type] = { type: undefined, handler }; - } - else { - notificationHandlers[type.method] = { type, handler }; - } - } - }, - onProgress: (_type, token, handler) => { - if (progressHandlers.has(token)) { - throw new Error(`Progress handler for token ${token} already registered`); - } - progressHandlers.set(token, handler); - return { - dispose: () => { - progressHandlers.delete(token); - } - }; - }, - sendProgress: (_type, token, value) => { - connection.sendNotification(ProgressNotification.type, { token, value }); - }, - onUnhandledProgress: unhandledProgressEmitter.event, - sendRequest: (type, ...params) => { - throwIfClosedOrDisposed(); - throwIfNotListening(); - let method; - let messageParams; - let token = undefined; - if (Is.string(type)) { - method = type; - switch (params.length) { - case 0: - messageParams = null; - break; - case 1: - // The cancellation token is optional so it can also be undefined. - if (cancellation_1.CancellationToken.is(params[0])) { - messageParams = null; - token = params[0]; - } - else { - messageParams = undefinedToNull(params[0]); - } - break; - default: - const last = params.length - 1; - if (cancellation_1.CancellationToken.is(params[last])) { - token = params[last]; - if (params.length === 2) { - messageParams = undefinedToNull(params[0]); - } - else { - messageParams = params.slice(0, last).map(value => undefinedToNull(value)); - } - } - else { - messageParams = params.map(value => undefinedToNull(value)); - } - break; - } - } - else { - method = type.method; - messageParams = computeMessageParams(type, params); - let numberOfParams = type.numberOfParams; - token = cancellation_1.CancellationToken.is(params[numberOfParams]) ? params[numberOfParams] : undefined; - } - let id = sequenceNumber++; - let result = new Promise((resolve, reject) => { - let requestMessage = { - jsonrpc: version, - id: id, - method: method, - params: messageParams - }; - let responsePromise = { method: method, timerStart: Date.now(), resolve, reject }; - traceSendingRequest(requestMessage); - try { - messageWriter.write(requestMessage); - } - catch (e) { - // Writing the message failed. So we need to reject the promise. - responsePromise.reject(new messages_1.ResponseError(messages_1.ErrorCodes.MessageWriteError, e.message ? e.message : 'Unknown reason')); - responsePromise = null; - } - if (responsePromise) { - responsePromises[String(id)] = responsePromise; - } - }); - if (token) { - token.onCancellationRequested(() => { - connection.sendNotification(CancelNotification.type, { id }); - }); - } - return result; - }, - onRequest: (type, handler) => { - throwIfClosedOrDisposed(); - if (Is.func(type)) { - starRequestHandler = type; - } - else if (handler) { - if (Is.string(type)) { - requestHandlers[type] = { type: undefined, handler }; - } - else { - requestHandlers[type.method] = { type, handler }; - } - } - }, - trace: (_value, _tracer, sendNotificationOrTraceOptions) => { - let _sendNotification = false; - let _traceFormat = TraceFormat.Text; - if (sendNotificationOrTraceOptions !== void 0) { - if (Is.boolean(sendNotificationOrTraceOptions)) { - _sendNotification = sendNotificationOrTraceOptions; - } - else { - _sendNotification = sendNotificationOrTraceOptions.sendNotification || false; - _traceFormat = sendNotificationOrTraceOptions.traceFormat || TraceFormat.Text; - } - } - trace = _value; - traceFormat = _traceFormat; - if (trace === Trace.Off) { - tracer = undefined; - } - else { - tracer = _tracer; - } - if (_sendNotification && !isClosed() && !isDisposed()) { - connection.sendNotification(SetTraceNotification.type, { value: Trace.toString(_value) }); - } - }, - onError: errorEmitter.event, - onClose: closeEmitter.event, - onUnhandledNotification: unhandledNotificationEmitter.event, - onDispose: disposeEmitter.event, - dispose: () => { - if (isDisposed()) { - return; - } - state = ConnectionState.Disposed; - disposeEmitter.fire(undefined); - let error = new Error('Connection got disposed.'); - Object.keys(responsePromises).forEach((key) => { - responsePromises[key].reject(error); - }); - responsePromises = Object.create(null); - requestTokens = Object.create(null); - messageQueue = new linkedMap_1.LinkedMap(); - // Test for backwards compatibility - if (Is.func(messageWriter.dispose)) { - messageWriter.dispose(); - } - if (Is.func(messageReader.dispose)) { - messageReader.dispose(); - } - }, - listen: () => { - throwIfClosedOrDisposed(); - throwIfListening(); - state = ConnectionState.Listening; - messageReader.listen(callback); - }, - inspect: () => { - // eslint-disable-next-line no-console - console.log('inspect'); - } - }; - connection.onNotification(LogTraceNotification.type, (params) => { - if (trace === Trace.Off || !tracer) { - return; - } - tracer.log(params.message, trace === Trace.Verbose ? params.verbose : undefined); - }); - connection.onNotification(ProgressNotification.type, (params) => { - const handler = progressHandlers.get(params.token); - if (handler) { - handler(params.value); - } - else { - unhandledProgressEmitter.fire(params); - } - }); - return connection; -} -function isMessageReader(value) { - return value.listen !== void 0 && value.read === void 0; -} -function isMessageWriter(value) { - return value.write !== void 0 && value.end === void 0; -} -function createMessageConnection(input, output, logger, strategy) { - if (!logger) { - logger = exports.NullLogger; - } - let reader = isMessageReader(input) ? input : new messageReader_1.StreamMessageReader(input); - let writer = isMessageWriter(output) ? output : new messageWriter_1.StreamMessageWriter(output); - return _createMessageConnection(reader, writer, logger, strategy); -} -exports.createMessageConnection = createMessageConnection; diff --git a/server/node_modules/vscode-jsonrpc/lib/messageReader.js b/server/node_modules/vscode-jsonrpc/lib/messageReader.js deleted file mode 100644 index 5342509..0000000 --- a/server/node_modules/vscode-jsonrpc/lib/messageReader.js +++ /dev/null @@ -1,225 +0,0 @@ -/* -------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * ------------------------------------------------------------------------------------------ */ -'use strict'; -Object.defineProperty(exports, "__esModule", { value: true }); -const events_1 = require("./events"); -const Is = require("./is"); -let DefaultSize = 8192; -let CR = Buffer.from('\r', 'ascii')[0]; -let LF = Buffer.from('\n', 'ascii')[0]; -let CRLF = '\r\n'; -class MessageBuffer { - constructor(encoding = 'utf8') { - this.encoding = encoding; - this.index = 0; - this.buffer = Buffer.allocUnsafe(DefaultSize); - } - append(chunk) { - var toAppend = chunk; - if (typeof (chunk) === 'string') { - var str = chunk; - var bufferLen = Buffer.byteLength(str, this.encoding); - toAppend = Buffer.allocUnsafe(bufferLen); - toAppend.write(str, 0, bufferLen, this.encoding); - } - if (this.buffer.length - this.index >= toAppend.length) { - toAppend.copy(this.buffer, this.index, 0, toAppend.length); - } - else { - var newSize = (Math.ceil((this.index + toAppend.length) / DefaultSize) + 1) * DefaultSize; - if (this.index === 0) { - this.buffer = Buffer.allocUnsafe(newSize); - toAppend.copy(this.buffer, 0, 0, toAppend.length); - } - else { - this.buffer = Buffer.concat([this.buffer.slice(0, this.index), toAppend], newSize); - } - } - this.index += toAppend.length; - } - tryReadHeaders() { - let result = undefined; - let current = 0; - while (current + 3 < this.index && (this.buffer[current] !== CR || this.buffer[current + 1] !== LF || this.buffer[current + 2] !== CR || this.buffer[current + 3] !== LF)) { - current++; - } - // No header / body separator found (e.g CRLFCRLF) - if (current + 3 >= this.index) { - return result; - } - result = Object.create(null); - let headers = this.buffer.toString('ascii', 0, current).split(CRLF); - headers.forEach((header) => { - let index = header.indexOf(':'); - if (index === -1) { - throw new Error('Message header must separate key and value using :'); - } - let key = header.substr(0, index); - let value = header.substr(index + 1).trim(); - result[key] = value; - }); - let nextStart = current + 4; - this.buffer = this.buffer.slice(nextStart); - this.index = this.index - nextStart; - return result; - } - tryReadContent(length) { - if (this.index < length) { - return null; - } - let result = this.buffer.toString(this.encoding, 0, length); - let nextStart = length; - this.buffer.copy(this.buffer, 0, nextStart); - this.index = this.index - nextStart; - return result; - } - get numberOfBytes() { - return this.index; - } -} -var MessageReader; -(function (MessageReader) { - function is(value) { - let candidate = value; - return candidate && Is.func(candidate.listen) && Is.func(candidate.dispose) && - Is.func(candidate.onError) && Is.func(candidate.onClose) && Is.func(candidate.onPartialMessage); - } - MessageReader.is = is; -})(MessageReader = exports.MessageReader || (exports.MessageReader = {})); -class AbstractMessageReader { - constructor() { - this.errorEmitter = new events_1.Emitter(); - this.closeEmitter = new events_1.Emitter(); - this.partialMessageEmitter = new events_1.Emitter(); - } - dispose() { - this.errorEmitter.dispose(); - this.closeEmitter.dispose(); - } - get onError() { - return this.errorEmitter.event; - } - fireError(error) { - this.errorEmitter.fire(this.asError(error)); - } - get onClose() { - return this.closeEmitter.event; - } - fireClose() { - this.closeEmitter.fire(undefined); - } - get onPartialMessage() { - return this.partialMessageEmitter.event; - } - firePartialMessage(info) { - this.partialMessageEmitter.fire(info); - } - asError(error) { - if (error instanceof Error) { - return error; - } - else { - return new Error(`Reader received error. Reason: ${Is.string(error.message) ? error.message : 'unknown'}`); - } - } -} -exports.AbstractMessageReader = AbstractMessageReader; -class StreamMessageReader extends AbstractMessageReader { - constructor(readable, encoding = 'utf8') { - super(); - this.readable = readable; - this.buffer = new MessageBuffer(encoding); - this._partialMessageTimeout = 10000; - } - set partialMessageTimeout(timeout) { - this._partialMessageTimeout = timeout; - } - get partialMessageTimeout() { - return this._partialMessageTimeout; - } - listen(callback) { - this.nextMessageLength = -1; - this.messageToken = 0; - this.partialMessageTimer = undefined; - this.callback = callback; - this.readable.on('data', (data) => { - this.onData(data); - }); - this.readable.on('error', (error) => this.fireError(error)); - this.readable.on('close', () => this.fireClose()); - } - onData(data) { - this.buffer.append(data); - while (true) { - if (this.nextMessageLength === -1) { - let headers = this.buffer.tryReadHeaders(); - if (!headers) { - return; - } - let contentLength = headers['Content-Length']; - if (!contentLength) { - throw new Error('Header must provide a Content-Length property.'); - } - let length = parseInt(contentLength); - if (isNaN(length)) { - throw new Error('Content-Length value must be a number.'); - } - this.nextMessageLength = length; - // Take the encoding form the header. For compatibility - // treat both utf-8 and utf8 as node utf8 - } - var msg = this.buffer.tryReadContent(this.nextMessageLength); - if (msg === null) { - /** We haven't received the full message yet. */ - this.setPartialMessageTimer(); - return; - } - this.clearPartialMessageTimer(); - this.nextMessageLength = -1; - this.messageToken++; - var json = JSON.parse(msg); - this.callback(json); - } - } - clearPartialMessageTimer() { - if (this.partialMessageTimer) { - clearTimeout(this.partialMessageTimer); - this.partialMessageTimer = undefined; - } - } - setPartialMessageTimer() { - this.clearPartialMessageTimer(); - if (this._partialMessageTimeout <= 0) { - return; - } - this.partialMessageTimer = setTimeout((token, timeout) => { - this.partialMessageTimer = undefined; - if (token === this.messageToken) { - this.firePartialMessage({ messageToken: token, waitingTime: timeout }); - this.setPartialMessageTimer(); - } - }, this._partialMessageTimeout, this.messageToken, this._partialMessageTimeout); - } -} -exports.StreamMessageReader = StreamMessageReader; -class IPCMessageReader extends AbstractMessageReader { - constructor(process) { - super(); - this.process = process; - let eventEmitter = this.process; - eventEmitter.on('error', (error) => this.fireError(error)); - eventEmitter.on('close', () => this.fireClose()); - } - listen(callback) { - this.process.on('message', callback); - } -} -exports.IPCMessageReader = IPCMessageReader; -class SocketMessageReader extends StreamMessageReader { - constructor(socket, encoding = 'utf-8') { - super(socket, encoding); - } -} -exports.SocketMessageReader = SocketMessageReader; diff --git a/server/node_modules/vscode-jsonrpc/lib/messageWriter.js b/server/node_modules/vscode-jsonrpc/lib/messageWriter.js deleted file mode 100644 index e02e0a0..0000000 --- a/server/node_modules/vscode-jsonrpc/lib/messageWriter.js +++ /dev/null @@ -1,194 +0,0 @@ -/* -------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * ------------------------------------------------------------------------------------------ */ -'use strict'; -Object.defineProperty(exports, "__esModule", { value: true }); -const events_1 = require("./events"); -const Is = require("./is"); -let ContentLength = 'Content-Length: '; -let CRLF = '\r\n'; -var MessageWriter; -(function (MessageWriter) { - function is(value) { - let candidate = value; - return candidate && Is.func(candidate.dispose) && Is.func(candidate.onClose) && - Is.func(candidate.onError) && Is.func(candidate.write); - } - MessageWriter.is = is; -})(MessageWriter = exports.MessageWriter || (exports.MessageWriter = {})); -class AbstractMessageWriter { - constructor() { - this.errorEmitter = new events_1.Emitter(); - this.closeEmitter = new events_1.Emitter(); - } - dispose() { - this.errorEmitter.dispose(); - this.closeEmitter.dispose(); - } - get onError() { - return this.errorEmitter.event; - } - fireError(error, message, count) { - this.errorEmitter.fire([this.asError(error), message, count]); - } - get onClose() { - return this.closeEmitter.event; - } - fireClose() { - this.closeEmitter.fire(undefined); - } - asError(error) { - if (error instanceof Error) { - return error; - } - else { - return new Error(`Writer received error. Reason: ${Is.string(error.message) ? error.message : 'unknown'}`); - } - } -} -exports.AbstractMessageWriter = AbstractMessageWriter; -class StreamMessageWriter extends AbstractMessageWriter { - constructor(writable, encoding = 'utf8') { - super(); - this.writable = writable; - this.encoding = encoding; - this.errorCount = 0; - this.writable.on('error', (error) => this.fireError(error)); - this.writable.on('close', () => this.fireClose()); - } - write(msg) { - let json = JSON.stringify(msg); - let contentLength = Buffer.byteLength(json, this.encoding); - let headers = [ - ContentLength, contentLength.toString(), CRLF, - CRLF - ]; - try { - // Header must be written in ASCII encoding - this.writable.write(headers.join(''), 'ascii'); - // Now write the content. This can be written in any encoding - this.writable.write(json, this.encoding); - this.errorCount = 0; - } - catch (error) { - this.errorCount++; - this.fireError(error, msg, this.errorCount); - } - } -} -exports.StreamMessageWriter = StreamMessageWriter; -class IPCMessageWriter extends AbstractMessageWriter { - constructor(process) { - super(); - this.process = process; - this.errorCount = 0; - this.queue = []; - this.sending = false; - let eventEmitter = this.process; - eventEmitter.on('error', (error) => this.fireError(error)); - eventEmitter.on('close', () => this.fireClose); - } - write(msg) { - if (!this.sending && this.queue.length === 0) { - // See https://github.com/nodejs/node/issues/7657 - this.doWriteMessage(msg); - } - else { - this.queue.push(msg); - } - } - doWriteMessage(msg) { - try { - if (this.process.send) { - this.sending = true; - this.process.send(msg, undefined, undefined, (error) => { - this.sending = false; - if (error) { - this.errorCount++; - this.fireError(error, msg, this.errorCount); - } - else { - this.errorCount = 0; - } - if (this.queue.length > 0) { - this.doWriteMessage(this.queue.shift()); - } - }); - } - } - catch (error) { - this.errorCount++; - this.fireError(error, msg, this.errorCount); - } - } -} -exports.IPCMessageWriter = IPCMessageWriter; -class SocketMessageWriter extends AbstractMessageWriter { - constructor(socket, encoding = 'utf8') { - super(); - this.socket = socket; - this.queue = []; - this.sending = false; - this.encoding = encoding; - this.errorCount = 0; - this.socket.on('error', (error) => this.fireError(error)); - this.socket.on('close', () => this.fireClose()); - } - dispose() { - super.dispose(); - this.socket.destroy(); - } - write(msg) { - if (!this.sending && this.queue.length === 0) { - // See https://github.com/nodejs/node/issues/7657 - this.doWriteMessage(msg); - } - else { - this.queue.push(msg); - } - } - doWriteMessage(msg) { - let json = JSON.stringify(msg); - let contentLength = Buffer.byteLength(json, this.encoding); - let headers = [ - ContentLength, contentLength.toString(), CRLF, - CRLF - ]; - try { - // Header must be written in ASCII encoding - this.sending = true; - this.socket.write(headers.join(''), 'ascii', (error) => { - if (error) { - this.handleError(error, msg); - } - try { - // Now write the content. This can be written in any encoding - this.socket.write(json, this.encoding, (error) => { - this.sending = false; - if (error) { - this.handleError(error, msg); - } - else { - this.errorCount = 0; - } - if (this.queue.length > 0) { - this.doWriteMessage(this.queue.shift()); - } - }); - } - catch (error) { - this.handleError(error, msg); - } - }); - } - catch (error) { - this.handleError(error, msg); - } - } - handleError(error, msg) { - this.errorCount++; - this.fireError(error, msg, this.errorCount); - } -} -exports.SocketMessageWriter = SocketMessageWriter; diff --git a/server/node_modules/vscode-jsonrpc/lib/messages.js b/server/node_modules/vscode-jsonrpc/lib/messages.js deleted file mode 100644 index bcc2653..0000000 --- a/server/node_modules/vscode-jsonrpc/lib/messages.js +++ /dev/null @@ -1,234 +0,0 @@ -/* -------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * ------------------------------------------------------------------------------------------ */ -'use strict'; -Object.defineProperty(exports, "__esModule", { value: true }); -const is = require("./is"); -/** - * Predefined error codes. - */ -var ErrorCodes; -(function (ErrorCodes) { - // Defined by JSON RPC - ErrorCodes.ParseError = -32700; - ErrorCodes.InvalidRequest = -32600; - ErrorCodes.MethodNotFound = -32601; - ErrorCodes.InvalidParams = -32602; - ErrorCodes.InternalError = -32603; - ErrorCodes.serverErrorStart = -32099; - ErrorCodes.serverErrorEnd = -32000; - ErrorCodes.ServerNotInitialized = -32002; - ErrorCodes.UnknownErrorCode = -32001; - // Defined by the protocol. - ErrorCodes.RequestCancelled = -32800; - ErrorCodes.ContentModified = -32801; - // Defined by VSCode library. - ErrorCodes.MessageWriteError = 1; - ErrorCodes.MessageReadError = 2; -})(ErrorCodes = exports.ErrorCodes || (exports.ErrorCodes = {})); -/** - * An error object return in a response in case a request - * has failed. - */ -class ResponseError extends Error { - constructor(code, message, data) { - super(message); - this.code = is.number(code) ? code : ErrorCodes.UnknownErrorCode; - this.data = data; - Object.setPrototypeOf(this, ResponseError.prototype); - } - toJson() { - return { - code: this.code, - message: this.message, - data: this.data, - }; - } -} -exports.ResponseError = ResponseError; -/** - * An abstract implementation of a MessageType. - */ -class AbstractMessageType { - constructor(_method, _numberOfParams) { - this._method = _method; - this._numberOfParams = _numberOfParams; - } - get method() { - return this._method; - } - get numberOfParams() { - return this._numberOfParams; - } -} -exports.AbstractMessageType = AbstractMessageType; -/** - * Classes to type request response pairs - * - * The type parameter RO will be removed in the next major version - * of the JSON RPC library since it is a LSP concept and doesn't - * belong here. For now it is tagged as default never. - */ -class RequestType0 extends AbstractMessageType { - constructor(method) { - super(method, 0); - } -} -exports.RequestType0 = RequestType0; -class RequestType extends AbstractMessageType { - constructor(method) { - super(method, 1); - } -} -exports.RequestType = RequestType; -class RequestType1 extends AbstractMessageType { - constructor(method) { - super(method, 1); - } -} -exports.RequestType1 = RequestType1; -class RequestType2 extends AbstractMessageType { - constructor(method) { - super(method, 2); - } -} -exports.RequestType2 = RequestType2; -class RequestType3 extends AbstractMessageType { - constructor(method) { - super(method, 3); - } -} -exports.RequestType3 = RequestType3; -class RequestType4 extends AbstractMessageType { - constructor(method) { - super(method, 4); - } -} -exports.RequestType4 = RequestType4; -class RequestType5 extends AbstractMessageType { - constructor(method) { - super(method, 5); - } -} -exports.RequestType5 = RequestType5; -class RequestType6 extends AbstractMessageType { - constructor(method) { - super(method, 6); - } -} -exports.RequestType6 = RequestType6; -class RequestType7 extends AbstractMessageType { - constructor(method) { - super(method, 7); - } -} -exports.RequestType7 = RequestType7; -class RequestType8 extends AbstractMessageType { - constructor(method) { - super(method, 8); - } -} -exports.RequestType8 = RequestType8; -class RequestType9 extends AbstractMessageType { - constructor(method) { - super(method, 9); - } -} -exports.RequestType9 = RequestType9; -/** - * The type parameter RO will be removed in the next major version - * of the JSON RPC library since it is a LSP concept and doesn't - * belong here. For now it is tagged as default never. - */ -class NotificationType extends AbstractMessageType { - constructor(method) { - super(method, 1); - this._ = undefined; - } -} -exports.NotificationType = NotificationType; -class NotificationType0 extends AbstractMessageType { - constructor(method) { - super(method, 0); - } -} -exports.NotificationType0 = NotificationType0; -class NotificationType1 extends AbstractMessageType { - constructor(method) { - super(method, 1); - } -} -exports.NotificationType1 = NotificationType1; -class NotificationType2 extends AbstractMessageType { - constructor(method) { - super(method, 2); - } -} -exports.NotificationType2 = NotificationType2; -class NotificationType3 extends AbstractMessageType { - constructor(method) { - super(method, 3); - } -} -exports.NotificationType3 = NotificationType3; -class NotificationType4 extends AbstractMessageType { - constructor(method) { - super(method, 4); - } -} -exports.NotificationType4 = NotificationType4; -class NotificationType5 extends AbstractMessageType { - constructor(method) { - super(method, 5); - } -} -exports.NotificationType5 = NotificationType5; -class NotificationType6 extends AbstractMessageType { - constructor(method) { - super(method, 6); - } -} -exports.NotificationType6 = NotificationType6; -class NotificationType7 extends AbstractMessageType { - constructor(method) { - super(method, 7); - } -} -exports.NotificationType7 = NotificationType7; -class NotificationType8 extends AbstractMessageType { - constructor(method) { - super(method, 8); - } -} -exports.NotificationType8 = NotificationType8; -class NotificationType9 extends AbstractMessageType { - constructor(method) { - super(method, 9); - } -} -exports.NotificationType9 = NotificationType9; -/** - * Tests if the given message is a request message - */ -function isRequestMessage(message) { - let candidate = message; - return candidate && is.string(candidate.method) && (is.string(candidate.id) || is.number(candidate.id)); -} -exports.isRequestMessage = isRequestMessage; -/** - * Tests if the given message is a notification message - */ -function isNotificationMessage(message) { - let candidate = message; - return candidate && is.string(candidate.method) && message.id === void 0; -} -exports.isNotificationMessage = isNotificationMessage; -/** - * Tests if the given message is a response message - */ -function isResponseMessage(message) { - let candidate = message; - return candidate && (candidate.result !== void 0 || !!candidate.error) && (is.string(candidate.id) || is.number(candidate.id) || candidate.id === null); -} -exports.isResponseMessage = isResponseMessage; diff --git a/server/node_modules/vscode-jsonrpc/lib/pipeSupport.js b/server/node_modules/vscode-jsonrpc/lib/pipeSupport.js deleted file mode 100644 index de5894f..0000000 --- a/server/node_modules/vscode-jsonrpc/lib/pipeSupport.js +++ /dev/null @@ -1,54 +0,0 @@ -/* -------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * ------------------------------------------------------------------------------------------ */ -'use strict'; -Object.defineProperty(exports, "__esModule", { value: true }); -const path_1 = require("path"); -const os_1 = require("os"); -const crypto_1 = require("crypto"); -const net_1 = require("net"); -const messageReader_1 = require("./messageReader"); -const messageWriter_1 = require("./messageWriter"); -function generateRandomPipeName() { - const randomSuffix = crypto_1.randomBytes(21).toString('hex'); - if (process.platform === 'win32') { - return `\\\\.\\pipe\\vscode-jsonrpc-${randomSuffix}-sock`; - } - else { - // Mac/Unix: use socket file - return path_1.join(os_1.tmpdir(), `vscode-${randomSuffix}.sock`); - } -} -exports.generateRandomPipeName = generateRandomPipeName; -function createClientPipeTransport(pipeName, encoding = 'utf-8') { - let connectResolve; - let connected = new Promise((resolve, _reject) => { - connectResolve = resolve; - }); - return new Promise((resolve, reject) => { - let server = net_1.createServer((socket) => { - server.close(); - connectResolve([ - new messageReader_1.SocketMessageReader(socket, encoding), - new messageWriter_1.SocketMessageWriter(socket, encoding) - ]); - }); - server.on('error', reject); - server.listen(pipeName, () => { - server.removeListener('error', reject); - resolve({ - onConnected: () => { return connected; } - }); - }); - }); -} -exports.createClientPipeTransport = createClientPipeTransport; -function createServerPipeTransport(pipeName, encoding = 'utf-8') { - const socket = net_1.createConnection(pipeName); - return [ - new messageReader_1.SocketMessageReader(socket, encoding), - new messageWriter_1.SocketMessageWriter(socket, encoding) - ]; -} -exports.createServerPipeTransport = createServerPipeTransport; diff --git a/server/node_modules/vscode-jsonrpc/lib/socketSupport.js b/server/node_modules/vscode-jsonrpc/lib/socketSupport.js deleted file mode 100644 index d37db2d..0000000 --- a/server/node_modules/vscode-jsonrpc/lib/socketSupport.js +++ /dev/null @@ -1,40 +0,0 @@ -/* -------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * ------------------------------------------------------------------------------------------ */ -'use strict'; -Object.defineProperty(exports, "__esModule", { value: true }); -const net_1 = require("net"); -const messageReader_1 = require("./messageReader"); -const messageWriter_1 = require("./messageWriter"); -function createClientSocketTransport(port, encoding = 'utf-8') { - let connectResolve; - let connected = new Promise((resolve, _reject) => { - connectResolve = resolve; - }); - return new Promise((resolve, reject) => { - let server = net_1.createServer((socket) => { - server.close(); - connectResolve([ - new messageReader_1.SocketMessageReader(socket, encoding), - new messageWriter_1.SocketMessageWriter(socket, encoding) - ]); - }); - server.on('error', reject); - server.listen(port, '127.0.0.1', () => { - server.removeListener('error', reject); - resolve({ - onConnected: () => { return connected; } - }); - }); - }); -} -exports.createClientSocketTransport = createClientSocketTransport; -function createServerSocketTransport(port, encoding = 'utf-8') { - const socket = net_1.createConnection(port, '127.0.0.1'); - return [ - new messageReader_1.SocketMessageReader(socket, encoding), - new messageWriter_1.SocketMessageWriter(socket, encoding) - ]; -} -exports.createServerSocketTransport = createServerSocketTransport; diff --git a/server/node_modules/vscode-jsonrpc/package.json b/server/node_modules/vscode-jsonrpc/package.json deleted file mode 100644 index 070ef85..0000000 --- a/server/node_modules/vscode-jsonrpc/package.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "vscode-jsonrpc", - "description": "A json rpc implementation over streams", - "version": "5.0.1", - "author": "Microsoft Corporation", - "license": "MIT", - "repository": { - "type": "git", - "url": "https://github.com/Microsoft/vscode-languageserver-node.git", - "directory": "jsonrpc" - }, - "bugs": { - "url": "https://github.com/Microsoft/vscode-languageserver-node/issues" - }, - "engines": { - "node": ">=8.0.0 || >=10.0.0" - }, - "main": "./lib/main.js", - "typings": "./lib/main.d.ts", - "scripts": { - "prepublishOnly": "npm run clean && npm run compile && npm test", - "postpublish": "node ../build/npm/post-publish.js", - "compile": "node ../build/bin/tsc -b ./tsconfig.json", - "watch": "node ../build/bin/tsc -b ./tsconfig.json -w", - "test": "node ../node_modules/mocha/bin/_mocha", - "clean": "node ../node_modules/rimraf/bin.js lib", - "preversion": "npm test" - } -} diff --git a/server/node_modules/vscode-jsonrpc/thirdpartynotices.txt b/server/node_modules/vscode-jsonrpc/thirdpartynotices.txt deleted file mode 100644 index 6517b3a..0000000 --- a/server/node_modules/vscode-jsonrpc/thirdpartynotices.txt +++ /dev/null @@ -1,31 +0,0 @@ -THIRD-PARTY SOFTWARE NOTICES AND INFORMATION -For Microsoft vscode-jsonrpc - -This project incorporates material from the project(s) listed below (collectively, “Third Party Code”). -Microsoft is not the original author of the Third Party Code. The original copyright notice and license -under which Microsoft received such Third Party Code are set out below. This Third Party Code is licensed -to you under their original license terms set forth below. Microsoft reserves all other rights not expressly -granted, whether by implication, estoppel or otherwise. - -1. DefinitelyTyped version 0.0.1 (https://github.com/borisyankov/DefinitelyTyped) - -This project is licensed under the MIT license. -Copyrights are respective of each contributor listed at the beginning of each definition file. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. \ No newline at end of file diff --git a/server/node_modules/vscode-languageserver-protocol/License.txt b/server/node_modules/vscode-languageserver-protocol/License.txt deleted file mode 100644 index a07e3ae..0000000 --- a/server/node_modules/vscode-languageserver-protocol/License.txt +++ /dev/null @@ -1,11 +0,0 @@ -Copyright (c) Microsoft Corporation - -All rights reserved. - -MIT License - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/server/node_modules/vscode-languageserver-protocol/README.md b/server/node_modules/vscode-languageserver-protocol/README.md deleted file mode 100644 index 604fd79..0000000 --- a/server/node_modules/vscode-languageserver-protocol/README.md +++ /dev/null @@ -1,16 +0,0 @@ -# VSCode Language Server - Protocol Module - -[![NPM Version](https://img.shields.io/npm/v/vscode-languageserver-protocol.svg)](https://npmjs.org/package/vscode-languageclient) -[![NPM Downloads](https://img.shields.io/npm/dm/vscode-languageserver-protocol.svg)](https://npmjs.org/package/vscode-languageclient) -[![Build Status](https://travis-ci.org/Microsoft/vscode-languageserver-node.svg?branch=master)](https://travis-ci.org/Microsoft/vscode-languageserver-node) - -This npm module is a tool independent implementation of the language server protocol and can be used in any type of node application. - -See [here](https://github.com/Microsoft/language-server-protocol) for a detailed documentation on the language server protocol. - -## History - -For the history please see the [main repository](https://github.com/Microsoft/vscode-languageserver-node/blob/master/README.md) - -## License -[MIT](https://github.com/Microsoft/vscode-languageserver-node/blob/master/License.txt) diff --git a/server/node_modules/vscode-languageserver-protocol/browser.js b/server/node_modules/vscode-languageserver-protocol/browser.js deleted file mode 100644 index f5caebf..0000000 --- a/server/node_modules/vscode-languageserver-protocol/browser.js +++ /dev/null @@ -1,7 +0,0 @@ -/* -------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * ----------------------------------------------------------------------------------------- */ -'use strict'; - -module.exports = require('./lib/browser/main'); \ No newline at end of file diff --git a/server/node_modules/vscode-languageserver-protocol/lib/browser/main.js b/server/node_modules/vscode-languageserver-protocol/lib/browser/main.js deleted file mode 100644 index 632b20e..0000000 --- a/server/node_modules/vscode-languageserver-protocol/lib/browser/main.js +++ /dev/null @@ -1,25 +0,0 @@ -"use strict"; -/* -------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * ------------------------------------------------------------------------------------------ */ -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.createProtocolConnection = void 0; -const browser_1 = require("vscode-jsonrpc/browser"); -__exportStar(require("vscode-jsonrpc/browser"), exports); -__exportStar(require("../common/api"), exports); -function createProtocolConnection(reader, writer, logger, options) { - return browser_1.createMessageConnection(reader, writer, logger, options); -} -exports.createProtocolConnection = createProtocolConnection; -//# sourceMappingURL=main.js.map \ No newline at end of file diff --git a/server/node_modules/vscode-languageserver-protocol/lib/common/api.js b/server/node_modules/vscode-languageserver-protocol/lib/common/api.js deleted file mode 100644 index b594bb8..0000000 --- a/server/node_modules/vscode-languageserver-protocol/lib/common/api.js +++ /dev/null @@ -1,43 +0,0 @@ -"use strict"; -/* -------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * ------------------------------------------------------------------------------------------ */ -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.LSPErrorCodes = exports.createProtocolConnection = void 0; -__exportStar(require("vscode-jsonrpc"), exports); -__exportStar(require("vscode-languageserver-types"), exports); -__exportStar(require("./messages"), exports); -__exportStar(require("./protocol"), exports); -var connection_1 = require("./connection"); -Object.defineProperty(exports, "createProtocolConnection", { enumerable: true, get: function () { return connection_1.createProtocolConnection; } }); -var LSPErrorCodes; -(function (LSPErrorCodes) { - /** - * This is the start range of LSP reserved error codes. - * It doesn't denote a real error code. - * - * @since 3.16.0 - */ - LSPErrorCodes.lspReservedErrorRangeStart = -32899; - LSPErrorCodes.ContentModified = -32801; - LSPErrorCodes.RequestCancelled = -32800; - /** - * This is the end range of LSP reserved error codes. - * It doesn't denote a real error code. - * - * @since 3.16.0 - */ - LSPErrorCodes.lspReservedErrorRangeEnd = -32800; -})(LSPErrorCodes = exports.LSPErrorCodes || (exports.LSPErrorCodes = {})); -//# sourceMappingURL=api.js.map \ No newline at end of file diff --git a/server/node_modules/vscode-languageserver-protocol/lib/common/connection.js b/server/node_modules/vscode-languageserver-protocol/lib/common/connection.js deleted file mode 100644 index 691d647..0000000 --- a/server/node_modules/vscode-languageserver-protocol/lib/common/connection.js +++ /dev/null @@ -1,16 +0,0 @@ -"use strict"; -/* -------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * ------------------------------------------------------------------------------------------ */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.createProtocolConnection = void 0; -const vscode_jsonrpc_1 = require("vscode-jsonrpc"); -function createProtocolConnection(input, output, logger, options) { - if (vscode_jsonrpc_1.ConnectionStrategy.is(options)) { - options = { connectionStrategy: options }; - } - return vscode_jsonrpc_1.createMessageConnection(input, output, logger, options); -} -exports.createProtocolConnection = createProtocolConnection; -//# sourceMappingURL=connection.js.map \ No newline at end of file diff --git a/server/node_modules/vscode-languageserver-protocol/lib/common/messages.js b/server/node_modules/vscode-languageserver-protocol/lib/common/messages.js deleted file mode 100644 index 865e8f4..0000000 --- a/server/node_modules/vscode-languageserver-protocol/lib/common/messages.js +++ /dev/null @@ -1,42 +0,0 @@ -"use strict"; -/* -------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * ------------------------------------------------------------------------------------------ */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ProtocolNotificationType = exports.ProtocolNotificationType0 = exports.ProtocolRequestType = exports.ProtocolRequestType0 = exports.RegistrationType = void 0; -const vscode_jsonrpc_1 = require("vscode-jsonrpc"); -class RegistrationType { - constructor(method) { - this.method = method; - } -} -exports.RegistrationType = RegistrationType; -class ProtocolRequestType0 extends vscode_jsonrpc_1.RequestType0 { - constructor(method) { - super(method); - } -} -exports.ProtocolRequestType0 = ProtocolRequestType0; -class ProtocolRequestType extends vscode_jsonrpc_1.RequestType { - constructor(method) { - super(method, vscode_jsonrpc_1.ParameterStructures.byName); - } -} -exports.ProtocolRequestType = ProtocolRequestType; -class ProtocolNotificationType0 extends vscode_jsonrpc_1.NotificationType0 { - constructor(method) { - super(method); - } -} -exports.ProtocolNotificationType0 = ProtocolNotificationType0; -class ProtocolNotificationType extends vscode_jsonrpc_1.NotificationType { - constructor(method) { - super(method, vscode_jsonrpc_1.ParameterStructures.byName); - } -} -exports.ProtocolNotificationType = ProtocolNotificationType; -// let x: ProtocolNotificationType; -// let y: ProtocolNotificationType; -// x = y; -//# sourceMappingURL=messages.js.map \ No newline at end of file diff --git a/server/node_modules/vscode-languageserver-protocol/lib/common/protocol.callHierarchy.js b/server/node_modules/vscode-languageserver-protocol/lib/common/protocol.callHierarchy.js deleted file mode 100644 index 5bc74e7..0000000 --- a/server/node_modules/vscode-languageserver-protocol/lib/common/protocol.callHierarchy.js +++ /dev/null @@ -1,40 +0,0 @@ -"use strict"; -/* -------------------------------------------------------------------------------------------- - * Copyright (c) TypeFox and others. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * ------------------------------------------------------------------------------------------ */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.CallHierarchyOutgoingCallsRequest = exports.CallHierarchyIncomingCallsRequest = exports.CallHierarchyPrepareRequest = void 0; -const messages_1 = require("./messages"); -/** - * A request to result a `CallHierarchyItem` in a document at a given position. - * Can be used as an input to a incoming or outgoing call hierarchy. - * - * @since 3.16.0 - */ -var CallHierarchyPrepareRequest; -(function (CallHierarchyPrepareRequest) { - CallHierarchyPrepareRequest.method = 'textDocument/prepareCallHierarchy'; - CallHierarchyPrepareRequest.type = new messages_1.ProtocolRequestType(CallHierarchyPrepareRequest.method); -})(CallHierarchyPrepareRequest = exports.CallHierarchyPrepareRequest || (exports.CallHierarchyPrepareRequest = {})); -/** - * A request to resolve the incoming calls for a given `CallHierarchyItem`. - * - * @since 3.16.0 - */ -var CallHierarchyIncomingCallsRequest; -(function (CallHierarchyIncomingCallsRequest) { - CallHierarchyIncomingCallsRequest.method = 'callHierarchy/incomingCalls'; - CallHierarchyIncomingCallsRequest.type = new messages_1.ProtocolRequestType(CallHierarchyIncomingCallsRequest.method); -})(CallHierarchyIncomingCallsRequest = exports.CallHierarchyIncomingCallsRequest || (exports.CallHierarchyIncomingCallsRequest = {})); -/** - * A request to resolve the outgoing calls for a given `CallHierarchyItem`. - * - * @since 3.16.0 - */ -var CallHierarchyOutgoingCallsRequest; -(function (CallHierarchyOutgoingCallsRequest) { - CallHierarchyOutgoingCallsRequest.method = 'callHierarchy/outgoingCalls'; - CallHierarchyOutgoingCallsRequest.type = new messages_1.ProtocolRequestType(CallHierarchyOutgoingCallsRequest.method); -})(CallHierarchyOutgoingCallsRequest = exports.CallHierarchyOutgoingCallsRequest || (exports.CallHierarchyOutgoingCallsRequest = {})); -//# sourceMappingURL=protocol.callHierarchy.js.map \ No newline at end of file diff --git a/server/node_modules/vscode-languageserver-protocol/lib/common/protocol.colorProvider.js b/server/node_modules/vscode-languageserver-protocol/lib/common/protocol.colorProvider.js deleted file mode 100644 index 4ecf725..0000000 --- a/server/node_modules/vscode-languageserver-protocol/lib/common/protocol.colorProvider.js +++ /dev/null @@ -1,30 +0,0 @@ -"use strict"; -/* -------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * ------------------------------------------------------------------------------------------ */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ColorPresentationRequest = exports.DocumentColorRequest = void 0; -const messages_1 = require("./messages"); -/** - * A request to list all color symbols found in a given text document. The request's - * parameter is of type [DocumentColorParams](#DocumentColorParams) the - * response is of type [ColorInformation[]](#ColorInformation) or a Thenable - * that resolves to such. - */ -var DocumentColorRequest; -(function (DocumentColorRequest) { - DocumentColorRequest.method = 'textDocument/documentColor'; - DocumentColorRequest.type = new messages_1.ProtocolRequestType(DocumentColorRequest.method); -})(DocumentColorRequest = exports.DocumentColorRequest || (exports.DocumentColorRequest = {})); -/** - * A request to list all presentation for a color. The request's - * parameter is of type [ColorPresentationParams](#ColorPresentationParams) the - * response is of type [ColorInformation[]](#ColorInformation) or a Thenable - * that resolves to such. - */ -var ColorPresentationRequest; -(function (ColorPresentationRequest) { - ColorPresentationRequest.type = new messages_1.ProtocolRequestType('textDocument/colorPresentation'); -})(ColorPresentationRequest = exports.ColorPresentationRequest || (exports.ColorPresentationRequest = {})); -//# sourceMappingURL=protocol.colorProvider.js.map \ No newline at end of file diff --git a/server/node_modules/vscode-languageserver-protocol/lib/common/protocol.configuration.js b/server/node_modules/vscode-languageserver-protocol/lib/common/protocol.configuration.js deleted file mode 100644 index e53621f..0000000 --- a/server/node_modules/vscode-languageserver-protocol/lib/common/protocol.configuration.js +++ /dev/null @@ -1,22 +0,0 @@ -"use strict"; -/* -------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * ------------------------------------------------------------------------------------------ */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ConfigurationRequest = void 0; -const messages_1 = require("./messages"); -/** - * The 'workspace/configuration' request is sent from the server to the client to fetch a certain - * configuration setting. - * - * This pull model replaces the old push model were the client signaled configuration change via an - * event. If the server still needs to react to configuration changes (since the server caches the - * result of `workspace/configuration` requests) the server should register for an empty configuration - * change event and empty the cache if such an event is received. - */ -var ConfigurationRequest; -(function (ConfigurationRequest) { - ConfigurationRequest.type = new messages_1.ProtocolRequestType('workspace/configuration'); -})(ConfigurationRequest = exports.ConfigurationRequest || (exports.ConfigurationRequest = {})); -//# sourceMappingURL=protocol.configuration.js.map \ No newline at end of file diff --git a/server/node_modules/vscode-languageserver-protocol/lib/common/protocol.declaration.js b/server/node_modules/vscode-languageserver-protocol/lib/common/protocol.declaration.js deleted file mode 100644 index b2347de..0000000 --- a/server/node_modules/vscode-languageserver-protocol/lib/common/protocol.declaration.js +++ /dev/null @@ -1,23 +0,0 @@ -"use strict"; -/* -------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * ------------------------------------------------------------------------------------------ */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.DeclarationRequest = void 0; -const messages_1 = require("./messages"); -// @ts-ignore: to avoid inlining LocatioLink as dynamic import -let __noDynamicImport; -/** - * A request to resolve the type definition locations of a symbol at a given text - * document position. The request's parameter is of type [TextDocumentPositioParams] - * (#TextDocumentPositionParams) the response is of type [Declaration](#Declaration) - * or a typed array of [DeclarationLink](#DeclarationLink) or a Thenable that resolves - * to such. - */ -var DeclarationRequest; -(function (DeclarationRequest) { - DeclarationRequest.method = 'textDocument/declaration'; - DeclarationRequest.type = new messages_1.ProtocolRequestType(DeclarationRequest.method); -})(DeclarationRequest = exports.DeclarationRequest || (exports.DeclarationRequest = {})); -//# sourceMappingURL=protocol.declaration.js.map \ No newline at end of file diff --git a/server/node_modules/vscode-languageserver-protocol/lib/common/protocol.fileOperations.js b/server/node_modules/vscode-languageserver-protocol/lib/common/protocol.fileOperations.js deleted file mode 100644 index f35dadb..0000000 --- a/server/node_modules/vscode-languageserver-protocol/lib/common/protocol.fileOperations.js +++ /dev/null @@ -1,92 +0,0 @@ -"use strict"; -/* -------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * ------------------------------------------------------------------------------------------ */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.WillDeleteFilesRequest = exports.DidDeleteFilesNotification = exports.DidRenameFilesNotification = exports.WillRenameFilesRequest = exports.DidCreateFilesNotification = exports.WillCreateFilesRequest = exports.FileOperationPatternKind = void 0; -const messages_1 = require("./messages"); -/** - * A pattern kind describing if a glob pattern matches a file a folder or - * both. - * - * @since 3.16.0 - */ -var FileOperationPatternKind; -(function (FileOperationPatternKind) { - /** - * The pattern matches a file only. - */ - FileOperationPatternKind.file = 'file'; - /** - * The pattern matches a folder only. - */ - FileOperationPatternKind.folder = 'folder'; -})(FileOperationPatternKind = exports.FileOperationPatternKind || (exports.FileOperationPatternKind = {})); -/** - * The will create files request is sent from the client to the server before files are actually - * created as long as the creation is triggered from within the client. - * - * @since 3.16.0 - */ -var WillCreateFilesRequest; -(function (WillCreateFilesRequest) { - WillCreateFilesRequest.method = 'workspace/willCreateFiles'; - WillCreateFilesRequest.type = new messages_1.ProtocolRequestType(WillCreateFilesRequest.method); -})(WillCreateFilesRequest = exports.WillCreateFilesRequest || (exports.WillCreateFilesRequest = {})); -/** - * The did create files notification is sent from the client to the server when - * files were created from within the client. - * - * @since 3.16.0 - */ -var DidCreateFilesNotification; -(function (DidCreateFilesNotification) { - DidCreateFilesNotification.method = 'workspace/didCreateFiles'; - DidCreateFilesNotification.type = new messages_1.ProtocolNotificationType(DidCreateFilesNotification.method); -})(DidCreateFilesNotification = exports.DidCreateFilesNotification || (exports.DidCreateFilesNotification = {})); -/** - * The will rename files request is sent from the client to the server before files are actually - * renamed as long as the rename is triggered from within the client. - * - * @since 3.16.0 - */ -var WillRenameFilesRequest; -(function (WillRenameFilesRequest) { - WillRenameFilesRequest.method = 'workspace/willRenameFiles'; - WillRenameFilesRequest.type = new messages_1.ProtocolRequestType(WillRenameFilesRequest.method); -})(WillRenameFilesRequest = exports.WillRenameFilesRequest || (exports.WillRenameFilesRequest = {})); -/** - * The did rename files notification is sent from the client to the server when - * files were renamed from within the client. - * - * @since 3.16.0 - */ -var DidRenameFilesNotification; -(function (DidRenameFilesNotification) { - DidRenameFilesNotification.method = 'workspace/didRenameFiles'; - DidRenameFilesNotification.type = new messages_1.ProtocolNotificationType(DidRenameFilesNotification.method); -})(DidRenameFilesNotification = exports.DidRenameFilesNotification || (exports.DidRenameFilesNotification = {})); -/** - * The will delete files request is sent from the client to the server before files are actually - * deleted as long as the deletion is triggered from within the client. - * - * @since 3.16.0 - */ -var DidDeleteFilesNotification; -(function (DidDeleteFilesNotification) { - DidDeleteFilesNotification.method = 'workspace/didDeleteFiles'; - DidDeleteFilesNotification.type = new messages_1.ProtocolNotificationType(DidDeleteFilesNotification.method); -})(DidDeleteFilesNotification = exports.DidDeleteFilesNotification || (exports.DidDeleteFilesNotification = {})); -/** - * The did delete files notification is sent from the client to the server when - * files were deleted from within the client. - * - * @since 3.16.0 - */ -var WillDeleteFilesRequest; -(function (WillDeleteFilesRequest) { - WillDeleteFilesRequest.method = 'workspace/willDeleteFiles'; - WillDeleteFilesRequest.type = new messages_1.ProtocolRequestType(WillDeleteFilesRequest.method); -})(WillDeleteFilesRequest = exports.WillDeleteFilesRequest || (exports.WillDeleteFilesRequest = {})); -//# sourceMappingURL=protocol.fileOperations.js.map \ No newline at end of file diff --git a/server/node_modules/vscode-languageserver-protocol/lib/common/protocol.foldingRange.js b/server/node_modules/vscode-languageserver-protocol/lib/common/protocol.foldingRange.js deleted file mode 100644 index 5bd0e83..0000000 --- a/server/node_modules/vscode-languageserver-protocol/lib/common/protocol.foldingRange.js +++ /dev/null @@ -1,38 +0,0 @@ -"use strict"; -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.FoldingRangeRequest = exports.FoldingRangeKind = void 0; -const messages_1 = require("./messages"); -/** - * Enum of known range kinds - */ -var FoldingRangeKind; -(function (FoldingRangeKind) { - /** - * Folding range for a comment - */ - FoldingRangeKind["Comment"] = "comment"; - /** - * Folding range for a imports or includes - */ - FoldingRangeKind["Imports"] = "imports"; - /** - * Folding range for a region (e.g. `#region`) - */ - FoldingRangeKind["Region"] = "region"; -})(FoldingRangeKind = exports.FoldingRangeKind || (exports.FoldingRangeKind = {})); -/** - * A request to provide folding ranges in a document. The request's - * parameter is of type [FoldingRangeParams](#FoldingRangeParams), the - * response is of type [FoldingRangeList](#FoldingRangeList) or a Thenable - * that resolves to such. - */ -var FoldingRangeRequest; -(function (FoldingRangeRequest) { - FoldingRangeRequest.method = 'textDocument/foldingRange'; - FoldingRangeRequest.type = new messages_1.ProtocolRequestType(FoldingRangeRequest.method); -})(FoldingRangeRequest = exports.FoldingRangeRequest || (exports.FoldingRangeRequest = {})); -//# sourceMappingURL=protocol.foldingRange.js.map \ No newline at end of file diff --git a/server/node_modules/vscode-languageserver-protocol/lib/common/protocol.implementation.js b/server/node_modules/vscode-languageserver-protocol/lib/common/protocol.implementation.js deleted file mode 100644 index 4ea726c..0000000 --- a/server/node_modules/vscode-languageserver-protocol/lib/common/protocol.implementation.js +++ /dev/null @@ -1,22 +0,0 @@ -"use strict"; -/* -------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * ------------------------------------------------------------------------------------------ */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ImplementationRequest = void 0; -const messages_1 = require("./messages"); -// @ts-ignore: to avoid inlining LocatioLink as dynamic import -let __noDynamicImport; -/** - * A request to resolve the implementation locations of a symbol at a given text - * document position. The request's parameter is of type [TextDocumentPositioParams] - * (#TextDocumentPositionParams) the response is of type [Definition](#Definition) or a - * Thenable that resolves to such. - */ -var ImplementationRequest; -(function (ImplementationRequest) { - ImplementationRequest.method = 'textDocument/implementation'; - ImplementationRequest.type = new messages_1.ProtocolRequestType(ImplementationRequest.method); -})(ImplementationRequest = exports.ImplementationRequest || (exports.ImplementationRequest = {})); -//# sourceMappingURL=protocol.implementation.js.map \ No newline at end of file diff --git a/server/node_modules/vscode-languageserver-protocol/lib/common/protocol.js b/server/node_modules/vscode-languageserver-protocol/lib/common/protocol.js deleted file mode 100644 index b756efe..0000000 --- a/server/node_modules/vscode-languageserver-protocol/lib/common/protocol.js +++ /dev/null @@ -1,755 +0,0 @@ -"use strict"; -/* -------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * ------------------------------------------------------------------------------------------ */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.DocumentLinkRequest = exports.CodeLensRefreshRequest = exports.CodeLensResolveRequest = exports.CodeLensRequest = exports.WorkspaceSymbolRequest = exports.CodeActionResolveRequest = exports.CodeActionRequest = exports.DocumentSymbolRequest = exports.DocumentHighlightRequest = exports.ReferencesRequest = exports.DefinitionRequest = exports.SignatureHelpRequest = exports.SignatureHelpTriggerKind = exports.HoverRequest = exports.CompletionResolveRequest = exports.CompletionRequest = exports.CompletionTriggerKind = exports.PublishDiagnosticsNotification = exports.WatchKind = exports.FileChangeType = exports.DidChangeWatchedFilesNotification = exports.WillSaveTextDocumentWaitUntilRequest = exports.WillSaveTextDocumentNotification = exports.TextDocumentSaveReason = exports.DidSaveTextDocumentNotification = exports.DidCloseTextDocumentNotification = exports.DidChangeTextDocumentNotification = exports.TextDocumentContentChangeEvent = exports.DidOpenTextDocumentNotification = exports.TextDocumentSyncKind = exports.TelemetryEventNotification = exports.LogMessageNotification = exports.ShowMessageRequest = exports.ShowMessageNotification = exports.MessageType = exports.DidChangeConfigurationNotification = exports.ExitNotification = exports.ShutdownRequest = exports.InitializedNotification = exports.InitializeError = exports.InitializeRequest = exports.WorkDoneProgressOptions = exports.TextDocumentRegistrationOptions = exports.StaticRegistrationOptions = exports.FailureHandlingKind = exports.ResourceOperationKind = exports.UnregistrationRequest = exports.RegistrationRequest = exports.DocumentSelector = exports.DocumentFilter = void 0; -exports.MonikerRequest = exports.MonikerKind = exports.UniquenessLevel = exports.WillDeleteFilesRequest = exports.DidDeleteFilesNotification = exports.WillRenameFilesRequest = exports.DidRenameFilesNotification = exports.WillCreateFilesRequest = exports.DidCreateFilesNotification = exports.FileOperationPatternKind = exports.LinkedEditingRangeRequest = exports.ShowDocumentRequest = exports.SemanticTokensRegistrationType = exports.SemanticTokensRefreshRequest = exports.SemanticTokensRangeRequest = exports.SemanticTokensDeltaRequest = exports.SemanticTokensRequest = exports.TokenFormat = exports.SemanticTokens = exports.SemanticTokenModifiers = exports.SemanticTokenTypes = exports.CallHierarchyPrepareRequest = exports.CallHierarchyOutgoingCallsRequest = exports.CallHierarchyIncomingCallsRequest = exports.WorkDoneProgressCancelNotification = exports.WorkDoneProgressCreateRequest = exports.WorkDoneProgress = exports.SelectionRangeRequest = exports.DeclarationRequest = exports.FoldingRangeRequest = exports.ColorPresentationRequest = exports.DocumentColorRequest = exports.ConfigurationRequest = exports.DidChangeWorkspaceFoldersNotification = exports.WorkspaceFoldersRequest = exports.TypeDefinitionRequest = exports.ImplementationRequest = exports.ApplyWorkspaceEditRequest = exports.ExecuteCommandRequest = exports.PrepareRenameRequest = exports.RenameRequest = exports.PrepareSupportDefaultBehavior = exports.DocumentOnTypeFormattingRequest = exports.DocumentRangeFormattingRequest = exports.DocumentFormattingRequest = exports.DocumentLinkResolveRequest = void 0; -const Is = require("./utils/is"); -const messages_1 = require("./messages"); -const protocol_implementation_1 = require("./protocol.implementation"); -Object.defineProperty(exports, "ImplementationRequest", { enumerable: true, get: function () { return protocol_implementation_1.ImplementationRequest; } }); -const protocol_typeDefinition_1 = require("./protocol.typeDefinition"); -Object.defineProperty(exports, "TypeDefinitionRequest", { enumerable: true, get: function () { return protocol_typeDefinition_1.TypeDefinitionRequest; } }); -const protocol_workspaceFolders_1 = require("./protocol.workspaceFolders"); -Object.defineProperty(exports, "WorkspaceFoldersRequest", { enumerable: true, get: function () { return protocol_workspaceFolders_1.WorkspaceFoldersRequest; } }); -Object.defineProperty(exports, "DidChangeWorkspaceFoldersNotification", { enumerable: true, get: function () { return protocol_workspaceFolders_1.DidChangeWorkspaceFoldersNotification; } }); -const protocol_configuration_1 = require("./protocol.configuration"); -Object.defineProperty(exports, "ConfigurationRequest", { enumerable: true, get: function () { return protocol_configuration_1.ConfigurationRequest; } }); -const protocol_colorProvider_1 = require("./protocol.colorProvider"); -Object.defineProperty(exports, "DocumentColorRequest", { enumerable: true, get: function () { return protocol_colorProvider_1.DocumentColorRequest; } }); -Object.defineProperty(exports, "ColorPresentationRequest", { enumerable: true, get: function () { return protocol_colorProvider_1.ColorPresentationRequest; } }); -const protocol_foldingRange_1 = require("./protocol.foldingRange"); -Object.defineProperty(exports, "FoldingRangeRequest", { enumerable: true, get: function () { return protocol_foldingRange_1.FoldingRangeRequest; } }); -const protocol_declaration_1 = require("./protocol.declaration"); -Object.defineProperty(exports, "DeclarationRequest", { enumerable: true, get: function () { return protocol_declaration_1.DeclarationRequest; } }); -const protocol_selectionRange_1 = require("./protocol.selectionRange"); -Object.defineProperty(exports, "SelectionRangeRequest", { enumerable: true, get: function () { return protocol_selectionRange_1.SelectionRangeRequest; } }); -const protocol_progress_1 = require("./protocol.progress"); -Object.defineProperty(exports, "WorkDoneProgress", { enumerable: true, get: function () { return protocol_progress_1.WorkDoneProgress; } }); -Object.defineProperty(exports, "WorkDoneProgressCreateRequest", { enumerable: true, get: function () { return protocol_progress_1.WorkDoneProgressCreateRequest; } }); -Object.defineProperty(exports, "WorkDoneProgressCancelNotification", { enumerable: true, get: function () { return protocol_progress_1.WorkDoneProgressCancelNotification; } }); -const protocol_callHierarchy_1 = require("./protocol.callHierarchy"); -Object.defineProperty(exports, "CallHierarchyIncomingCallsRequest", { enumerable: true, get: function () { return protocol_callHierarchy_1.CallHierarchyIncomingCallsRequest; } }); -Object.defineProperty(exports, "CallHierarchyOutgoingCallsRequest", { enumerable: true, get: function () { return protocol_callHierarchy_1.CallHierarchyOutgoingCallsRequest; } }); -Object.defineProperty(exports, "CallHierarchyPrepareRequest", { enumerable: true, get: function () { return protocol_callHierarchy_1.CallHierarchyPrepareRequest; } }); -const protocol_semanticTokens_1 = require("./protocol.semanticTokens"); -Object.defineProperty(exports, "SemanticTokenTypes", { enumerable: true, get: function () { return protocol_semanticTokens_1.SemanticTokenTypes; } }); -Object.defineProperty(exports, "SemanticTokenModifiers", { enumerable: true, get: function () { return protocol_semanticTokens_1.SemanticTokenModifiers; } }); -Object.defineProperty(exports, "SemanticTokens", { enumerable: true, get: function () { return protocol_semanticTokens_1.SemanticTokens; } }); -Object.defineProperty(exports, "TokenFormat", { enumerable: true, get: function () { return protocol_semanticTokens_1.TokenFormat; } }); -Object.defineProperty(exports, "SemanticTokensRequest", { enumerable: true, get: function () { return protocol_semanticTokens_1.SemanticTokensRequest; } }); -Object.defineProperty(exports, "SemanticTokensDeltaRequest", { enumerable: true, get: function () { return protocol_semanticTokens_1.SemanticTokensDeltaRequest; } }); -Object.defineProperty(exports, "SemanticTokensRangeRequest", { enumerable: true, get: function () { return protocol_semanticTokens_1.SemanticTokensRangeRequest; } }); -Object.defineProperty(exports, "SemanticTokensRefreshRequest", { enumerable: true, get: function () { return protocol_semanticTokens_1.SemanticTokensRefreshRequest; } }); -Object.defineProperty(exports, "SemanticTokensRegistrationType", { enumerable: true, get: function () { return protocol_semanticTokens_1.SemanticTokensRegistrationType; } }); -const protocol_showDocument_1 = require("./protocol.showDocument"); -Object.defineProperty(exports, "ShowDocumentRequest", { enumerable: true, get: function () { return protocol_showDocument_1.ShowDocumentRequest; } }); -const protocol_linkedEditingRange_1 = require("./protocol.linkedEditingRange"); -Object.defineProperty(exports, "LinkedEditingRangeRequest", { enumerable: true, get: function () { return protocol_linkedEditingRange_1.LinkedEditingRangeRequest; } }); -const protocol_fileOperations_1 = require("./protocol.fileOperations"); -Object.defineProperty(exports, "FileOperationPatternKind", { enumerable: true, get: function () { return protocol_fileOperations_1.FileOperationPatternKind; } }); -Object.defineProperty(exports, "DidCreateFilesNotification", { enumerable: true, get: function () { return protocol_fileOperations_1.DidCreateFilesNotification; } }); -Object.defineProperty(exports, "WillCreateFilesRequest", { enumerable: true, get: function () { return protocol_fileOperations_1.WillCreateFilesRequest; } }); -Object.defineProperty(exports, "DidRenameFilesNotification", { enumerable: true, get: function () { return protocol_fileOperations_1.DidRenameFilesNotification; } }); -Object.defineProperty(exports, "WillRenameFilesRequest", { enumerable: true, get: function () { return protocol_fileOperations_1.WillRenameFilesRequest; } }); -Object.defineProperty(exports, "DidDeleteFilesNotification", { enumerable: true, get: function () { return protocol_fileOperations_1.DidDeleteFilesNotification; } }); -Object.defineProperty(exports, "WillDeleteFilesRequest", { enumerable: true, get: function () { return protocol_fileOperations_1.WillDeleteFilesRequest; } }); -const protocol_moniker_1 = require("./protocol.moniker"); -Object.defineProperty(exports, "UniquenessLevel", { enumerable: true, get: function () { return protocol_moniker_1.UniquenessLevel; } }); -Object.defineProperty(exports, "MonikerKind", { enumerable: true, get: function () { return protocol_moniker_1.MonikerKind; } }); -Object.defineProperty(exports, "MonikerRequest", { enumerable: true, get: function () { return protocol_moniker_1.MonikerRequest; } }); -// @ts-ignore: to avoid inlining LocationLink as dynamic import -let __noDynamicImport; -/** - * The DocumentFilter namespace provides helper functions to work with - * [DocumentFilter](#DocumentFilter) literals. - */ -var DocumentFilter; -(function (DocumentFilter) { - function is(value) { - const candidate = value; - return Is.string(candidate.language) || Is.string(candidate.scheme) || Is.string(candidate.pattern); - } - DocumentFilter.is = is; -})(DocumentFilter = exports.DocumentFilter || (exports.DocumentFilter = {})); -/** - * The DocumentSelector namespace provides helper functions to work with - * [DocumentSelector](#DocumentSelector)s. - */ -var DocumentSelector; -(function (DocumentSelector) { - function is(value) { - if (!Array.isArray(value)) { - return false; - } - for (let elem of value) { - if (!Is.string(elem) && !DocumentFilter.is(elem)) { - return false; - } - } - return true; - } - DocumentSelector.is = is; -})(DocumentSelector = exports.DocumentSelector || (exports.DocumentSelector = {})); -/** - * The `client/registerCapability` request is sent from the server to the client to register a new capability - * handler on the client side. - */ -var RegistrationRequest; -(function (RegistrationRequest) { - RegistrationRequest.type = new messages_1.ProtocolRequestType('client/registerCapability'); -})(RegistrationRequest = exports.RegistrationRequest || (exports.RegistrationRequest = {})); -/** - * The `client/unregisterCapability` request is sent from the server to the client to unregister a previously registered capability - * handler on the client side. - */ -var UnregistrationRequest; -(function (UnregistrationRequest) { - UnregistrationRequest.type = new messages_1.ProtocolRequestType('client/unregisterCapability'); -})(UnregistrationRequest = exports.UnregistrationRequest || (exports.UnregistrationRequest = {})); -var ResourceOperationKind; -(function (ResourceOperationKind) { - /** - * Supports creating new files and folders. - */ - ResourceOperationKind.Create = 'create'; - /** - * Supports renaming existing files and folders. - */ - ResourceOperationKind.Rename = 'rename'; - /** - * Supports deleting existing files and folders. - */ - ResourceOperationKind.Delete = 'delete'; -})(ResourceOperationKind = exports.ResourceOperationKind || (exports.ResourceOperationKind = {})); -var FailureHandlingKind; -(function (FailureHandlingKind) { - /** - * Applying the workspace change is simply aborted if one of the changes provided - * fails. All operations executed before the failing operation stay executed. - */ - FailureHandlingKind.Abort = 'abort'; - /** - * All operations are executed transactional. That means they either all - * succeed or no changes at all are applied to the workspace. - */ - FailureHandlingKind.Transactional = 'transactional'; - /** - * If the workspace edit contains only textual file changes they are executed transactional. - * If resource changes (create, rename or delete file) are part of the change the failure - * handling strategy is abort. - */ - FailureHandlingKind.TextOnlyTransactional = 'textOnlyTransactional'; - /** - * The client tries to undo the operations already executed. But there is no - * guarantee that this is succeeding. - */ - FailureHandlingKind.Undo = 'undo'; -})(FailureHandlingKind = exports.FailureHandlingKind || (exports.FailureHandlingKind = {})); -/** - * The StaticRegistrationOptions namespace provides helper functions to work with - * [StaticRegistrationOptions](#StaticRegistrationOptions) literals. - */ -var StaticRegistrationOptions; -(function (StaticRegistrationOptions) { - function hasId(value) { - const candidate = value; - return candidate && Is.string(candidate.id) && candidate.id.length > 0; - } - StaticRegistrationOptions.hasId = hasId; -})(StaticRegistrationOptions = exports.StaticRegistrationOptions || (exports.StaticRegistrationOptions = {})); -/** - * The TextDocumentRegistrationOptions namespace provides helper functions to work with - * [TextDocumentRegistrationOptions](#TextDocumentRegistrationOptions) literals. - */ -var TextDocumentRegistrationOptions; -(function (TextDocumentRegistrationOptions) { - function is(value) { - const candidate = value; - return candidate && (candidate.documentSelector === null || DocumentSelector.is(candidate.documentSelector)); - } - TextDocumentRegistrationOptions.is = is; -})(TextDocumentRegistrationOptions = exports.TextDocumentRegistrationOptions || (exports.TextDocumentRegistrationOptions = {})); -/** - * The WorkDoneProgressOptions namespace provides helper functions to work with - * [WorkDoneProgressOptions](#WorkDoneProgressOptions) literals. - */ -var WorkDoneProgressOptions; -(function (WorkDoneProgressOptions) { - function is(value) { - const candidate = value; - return Is.objectLiteral(candidate) && (candidate.workDoneProgress === undefined || Is.boolean(candidate.workDoneProgress)); - } - WorkDoneProgressOptions.is = is; - function hasWorkDoneProgress(value) { - const candidate = value; - return candidate && Is.boolean(candidate.workDoneProgress); - } - WorkDoneProgressOptions.hasWorkDoneProgress = hasWorkDoneProgress; -})(WorkDoneProgressOptions = exports.WorkDoneProgressOptions || (exports.WorkDoneProgressOptions = {})); -/** - * The initialize request is sent from the client to the server. - * It is sent once as the request after starting up the server. - * The requests parameter is of type [InitializeParams](#InitializeParams) - * the response if of type [InitializeResult](#InitializeResult) of a Thenable that - * resolves to such. - */ -var InitializeRequest; -(function (InitializeRequest) { - InitializeRequest.type = new messages_1.ProtocolRequestType('initialize'); -})(InitializeRequest = exports.InitializeRequest || (exports.InitializeRequest = {})); -/** - * Known error codes for an `InitializeError`; - */ -var InitializeError; -(function (InitializeError) { - /** - * If the protocol version provided by the client can't be handled by the server. - * @deprecated This initialize error got replaced by client capabilities. There is - * no version handshake in version 3.0x - */ - InitializeError.unknownProtocolVersion = 1; -})(InitializeError = exports.InitializeError || (exports.InitializeError = {})); -/** - * The initialized notification is sent from the client to the - * server after the client is fully initialized and the server - * is allowed to send requests from the server to the client. - */ -var InitializedNotification; -(function (InitializedNotification) { - InitializedNotification.type = new messages_1.ProtocolNotificationType('initialized'); -})(InitializedNotification = exports.InitializedNotification || (exports.InitializedNotification = {})); -//---- Shutdown Method ---- -/** - * A shutdown request is sent from the client to the server. - * It is sent once when the client decides to shutdown the - * server. The only notification that is sent after a shutdown request - * is the exit event. - */ -var ShutdownRequest; -(function (ShutdownRequest) { - ShutdownRequest.type = new messages_1.ProtocolRequestType0('shutdown'); -})(ShutdownRequest = exports.ShutdownRequest || (exports.ShutdownRequest = {})); -//---- Exit Notification ---- -/** - * The exit event is sent from the client to the server to - * ask the server to exit its process. - */ -var ExitNotification; -(function (ExitNotification) { - ExitNotification.type = new messages_1.ProtocolNotificationType0('exit'); -})(ExitNotification = exports.ExitNotification || (exports.ExitNotification = {})); -/** - * The configuration change notification is sent from the client to the server - * when the client's configuration has changed. The notification contains - * the changed configuration as defined by the language client. - */ -var DidChangeConfigurationNotification; -(function (DidChangeConfigurationNotification) { - DidChangeConfigurationNotification.type = new messages_1.ProtocolNotificationType('workspace/didChangeConfiguration'); -})(DidChangeConfigurationNotification = exports.DidChangeConfigurationNotification || (exports.DidChangeConfigurationNotification = {})); -//---- Message show and log notifications ---- -/** - * The message type - */ -var MessageType; -(function (MessageType) { - /** - * An error message. - */ - MessageType.Error = 1; - /** - * A warning message. - */ - MessageType.Warning = 2; - /** - * An information message. - */ - MessageType.Info = 3; - /** - * A log message. - */ - MessageType.Log = 4; -})(MessageType = exports.MessageType || (exports.MessageType = {})); -/** - * The show message notification is sent from a server to a client to ask - * the client to display a particular message in the user interface. - */ -var ShowMessageNotification; -(function (ShowMessageNotification) { - ShowMessageNotification.type = new messages_1.ProtocolNotificationType('window/showMessage'); -})(ShowMessageNotification = exports.ShowMessageNotification || (exports.ShowMessageNotification = {})); -/** - * The show message request is sent from the server to the client to show a message - * and a set of options actions to the user. - */ -var ShowMessageRequest; -(function (ShowMessageRequest) { - ShowMessageRequest.type = new messages_1.ProtocolRequestType('window/showMessageRequest'); -})(ShowMessageRequest = exports.ShowMessageRequest || (exports.ShowMessageRequest = {})); -/** - * The log message notification is sent from the server to the client to ask - * the client to log a particular message. - */ -var LogMessageNotification; -(function (LogMessageNotification) { - LogMessageNotification.type = new messages_1.ProtocolNotificationType('window/logMessage'); -})(LogMessageNotification = exports.LogMessageNotification || (exports.LogMessageNotification = {})); -//---- Telemetry notification -/** - * The telemetry event notification is sent from the server to the client to ask - * the client to log telemetry data. - */ -var TelemetryEventNotification; -(function (TelemetryEventNotification) { - TelemetryEventNotification.type = new messages_1.ProtocolNotificationType('telemetry/event'); -})(TelemetryEventNotification = exports.TelemetryEventNotification || (exports.TelemetryEventNotification = {})); -/** - * Defines how the host (editor) should sync - * document changes to the language server. - */ -var TextDocumentSyncKind; -(function (TextDocumentSyncKind) { - /** - * Documents should not be synced at all. - */ - TextDocumentSyncKind.None = 0; - /** - * Documents are synced by always sending the full content - * of the document. - */ - TextDocumentSyncKind.Full = 1; - /** - * Documents are synced by sending the full content on open. - * After that only incremental updates to the document are - * send. - */ - TextDocumentSyncKind.Incremental = 2; -})(TextDocumentSyncKind = exports.TextDocumentSyncKind || (exports.TextDocumentSyncKind = {})); -/** - * The document open notification is sent from the client to the server to signal - * newly opened text documents. The document's truth is now managed by the client - * and the server must not try to read the document's truth using the document's - * uri. Open in this sense means it is managed by the client. It doesn't necessarily - * mean that its content is presented in an editor. An open notification must not - * be sent more than once without a corresponding close notification send before. - * This means open and close notification must be balanced and the max open count - * is one. - */ -var DidOpenTextDocumentNotification; -(function (DidOpenTextDocumentNotification) { - DidOpenTextDocumentNotification.method = 'textDocument/didOpen'; - DidOpenTextDocumentNotification.type = new messages_1.ProtocolNotificationType(DidOpenTextDocumentNotification.method); -})(DidOpenTextDocumentNotification = exports.DidOpenTextDocumentNotification || (exports.DidOpenTextDocumentNotification = {})); -var TextDocumentContentChangeEvent; -(function (TextDocumentContentChangeEvent) { - /** - * Checks whether the information describes a delta event. - */ - function isIncremental(event) { - let candidate = event; - return candidate !== undefined && candidate !== null && - typeof candidate.text === 'string' && candidate.range !== undefined && - (candidate.rangeLength === undefined || typeof candidate.rangeLength === 'number'); - } - TextDocumentContentChangeEvent.isIncremental = isIncremental; - /** - * Checks whether the information describes a full replacement event. - */ - function isFull(event) { - let candidate = event; - return candidate !== undefined && candidate !== null && - typeof candidate.text === 'string' && candidate.range === undefined && candidate.rangeLength === undefined; - } - TextDocumentContentChangeEvent.isFull = isFull; -})(TextDocumentContentChangeEvent = exports.TextDocumentContentChangeEvent || (exports.TextDocumentContentChangeEvent = {})); -/** - * The document change notification is sent from the client to the server to signal - * changes to a text document. - */ -var DidChangeTextDocumentNotification; -(function (DidChangeTextDocumentNotification) { - DidChangeTextDocumentNotification.method = 'textDocument/didChange'; - DidChangeTextDocumentNotification.type = new messages_1.ProtocolNotificationType(DidChangeTextDocumentNotification.method); -})(DidChangeTextDocumentNotification = exports.DidChangeTextDocumentNotification || (exports.DidChangeTextDocumentNotification = {})); -/** - * The document close notification is sent from the client to the server when - * the document got closed in the client. The document's truth now exists where - * the document's uri points to (e.g. if the document's uri is a file uri the - * truth now exists on disk). As with the open notification the close notification - * is about managing the document's content. Receiving a close notification - * doesn't mean that the document was open in an editor before. A close - * notification requires a previous open notification to be sent. - */ -var DidCloseTextDocumentNotification; -(function (DidCloseTextDocumentNotification) { - DidCloseTextDocumentNotification.method = 'textDocument/didClose'; - DidCloseTextDocumentNotification.type = new messages_1.ProtocolNotificationType(DidCloseTextDocumentNotification.method); -})(DidCloseTextDocumentNotification = exports.DidCloseTextDocumentNotification || (exports.DidCloseTextDocumentNotification = {})); -/** - * The document save notification is sent from the client to the server when - * the document got saved in the client. - */ -var DidSaveTextDocumentNotification; -(function (DidSaveTextDocumentNotification) { - DidSaveTextDocumentNotification.method = 'textDocument/didSave'; - DidSaveTextDocumentNotification.type = new messages_1.ProtocolNotificationType(DidSaveTextDocumentNotification.method); -})(DidSaveTextDocumentNotification = exports.DidSaveTextDocumentNotification || (exports.DidSaveTextDocumentNotification = {})); -/** - * Represents reasons why a text document is saved. - */ -var TextDocumentSaveReason; -(function (TextDocumentSaveReason) { - /** - * Manually triggered, e.g. by the user pressing save, by starting debugging, - * or by an API call. - */ - TextDocumentSaveReason.Manual = 1; - /** - * Automatic after a delay. - */ - TextDocumentSaveReason.AfterDelay = 2; - /** - * When the editor lost focus. - */ - TextDocumentSaveReason.FocusOut = 3; -})(TextDocumentSaveReason = exports.TextDocumentSaveReason || (exports.TextDocumentSaveReason = {})); -/** - * A document will save notification is sent from the client to the server before - * the document is actually saved. - */ -var WillSaveTextDocumentNotification; -(function (WillSaveTextDocumentNotification) { - WillSaveTextDocumentNotification.method = 'textDocument/willSave'; - WillSaveTextDocumentNotification.type = new messages_1.ProtocolNotificationType(WillSaveTextDocumentNotification.method); -})(WillSaveTextDocumentNotification = exports.WillSaveTextDocumentNotification || (exports.WillSaveTextDocumentNotification = {})); -/** - * A document will save request is sent from the client to the server before - * the document is actually saved. The request can return an array of TextEdits - * which will be applied to the text document before it is saved. Please note that - * clients might drop results if computing the text edits took too long or if a - * server constantly fails on this request. This is done to keep the save fast and - * reliable. - */ -var WillSaveTextDocumentWaitUntilRequest; -(function (WillSaveTextDocumentWaitUntilRequest) { - WillSaveTextDocumentWaitUntilRequest.method = 'textDocument/willSaveWaitUntil'; - WillSaveTextDocumentWaitUntilRequest.type = new messages_1.ProtocolRequestType(WillSaveTextDocumentWaitUntilRequest.method); -})(WillSaveTextDocumentWaitUntilRequest = exports.WillSaveTextDocumentWaitUntilRequest || (exports.WillSaveTextDocumentWaitUntilRequest = {})); -/** - * The watched files notification is sent from the client to the server when - * the client detects changes to file watched by the language client. - */ -var DidChangeWatchedFilesNotification; -(function (DidChangeWatchedFilesNotification) { - DidChangeWatchedFilesNotification.type = new messages_1.ProtocolNotificationType('workspace/didChangeWatchedFiles'); -})(DidChangeWatchedFilesNotification = exports.DidChangeWatchedFilesNotification || (exports.DidChangeWatchedFilesNotification = {})); -/** - * The file event type - */ -var FileChangeType; -(function (FileChangeType) { - /** - * The file got created. - */ - FileChangeType.Created = 1; - /** - * The file got changed. - */ - FileChangeType.Changed = 2; - /** - * The file got deleted. - */ - FileChangeType.Deleted = 3; -})(FileChangeType = exports.FileChangeType || (exports.FileChangeType = {})); -var WatchKind; -(function (WatchKind) { - /** - * Interested in create events. - */ - WatchKind.Create = 1; - /** - * Interested in change events - */ - WatchKind.Change = 2; - /** - * Interested in delete events - */ - WatchKind.Delete = 4; -})(WatchKind = exports.WatchKind || (exports.WatchKind = {})); -/** - * Diagnostics notification are sent from the server to the client to signal - * results of validation runs. - */ -var PublishDiagnosticsNotification; -(function (PublishDiagnosticsNotification) { - PublishDiagnosticsNotification.type = new messages_1.ProtocolNotificationType('textDocument/publishDiagnostics'); -})(PublishDiagnosticsNotification = exports.PublishDiagnosticsNotification || (exports.PublishDiagnosticsNotification = {})); -/** - * How a completion was triggered - */ -var CompletionTriggerKind; -(function (CompletionTriggerKind) { - /** - * Completion was triggered by typing an identifier (24x7 code - * complete), manual invocation (e.g Ctrl+Space) or via API. - */ - CompletionTriggerKind.Invoked = 1; - /** - * Completion was triggered by a trigger character specified by - * the `triggerCharacters` properties of the `CompletionRegistrationOptions`. - */ - CompletionTriggerKind.TriggerCharacter = 2; - /** - * Completion was re-triggered as current completion list is incomplete - */ - CompletionTriggerKind.TriggerForIncompleteCompletions = 3; -})(CompletionTriggerKind = exports.CompletionTriggerKind || (exports.CompletionTriggerKind = {})); -/** - * Request to request completion at a given text document position. The request's - * parameter is of type [TextDocumentPosition](#TextDocumentPosition) the response - * is of type [CompletionItem[]](#CompletionItem) or [CompletionList](#CompletionList) - * or a Thenable that resolves to such. - * - * The request can delay the computation of the [`detail`](#CompletionItem.detail) - * and [`documentation`](#CompletionItem.documentation) properties to the `completionItem/resolve` - * request. However, properties that are needed for the initial sorting and filtering, like `sortText`, - * `filterText`, `insertText`, and `textEdit`, must not be changed during resolve. - */ -var CompletionRequest; -(function (CompletionRequest) { - CompletionRequest.method = 'textDocument/completion'; - CompletionRequest.type = new messages_1.ProtocolRequestType(CompletionRequest.method); -})(CompletionRequest = exports.CompletionRequest || (exports.CompletionRequest = {})); -/** - * Request to resolve additional information for a given completion item.The request's - * parameter is of type [CompletionItem](#CompletionItem) the response - * is of type [CompletionItem](#CompletionItem) or a Thenable that resolves to such. - */ -var CompletionResolveRequest; -(function (CompletionResolveRequest) { - CompletionResolveRequest.method = 'completionItem/resolve'; - CompletionResolveRequest.type = new messages_1.ProtocolRequestType(CompletionResolveRequest.method); -})(CompletionResolveRequest = exports.CompletionResolveRequest || (exports.CompletionResolveRequest = {})); -/** - * Request to request hover information at a given text document position. The request's - * parameter is of type [TextDocumentPosition](#TextDocumentPosition) the response is of - * type [Hover](#Hover) or a Thenable that resolves to such. - */ -var HoverRequest; -(function (HoverRequest) { - HoverRequest.method = 'textDocument/hover'; - HoverRequest.type = new messages_1.ProtocolRequestType(HoverRequest.method); -})(HoverRequest = exports.HoverRequest || (exports.HoverRequest = {})); -/** - * How a signature help was triggered. - * - * @since 3.15.0 - */ -var SignatureHelpTriggerKind; -(function (SignatureHelpTriggerKind) { - /** - * Signature help was invoked manually by the user or by a command. - */ - SignatureHelpTriggerKind.Invoked = 1; - /** - * Signature help was triggered by a trigger character. - */ - SignatureHelpTriggerKind.TriggerCharacter = 2; - /** - * Signature help was triggered by the cursor moving or by the document content changing. - */ - SignatureHelpTriggerKind.ContentChange = 3; -})(SignatureHelpTriggerKind = exports.SignatureHelpTriggerKind || (exports.SignatureHelpTriggerKind = {})); -var SignatureHelpRequest; -(function (SignatureHelpRequest) { - SignatureHelpRequest.method = 'textDocument/signatureHelp'; - SignatureHelpRequest.type = new messages_1.ProtocolRequestType(SignatureHelpRequest.method); -})(SignatureHelpRequest = exports.SignatureHelpRequest || (exports.SignatureHelpRequest = {})); -/** - * A request to resolve the definition location of a symbol at a given text - * document position. The request's parameter is of type [TextDocumentPosition] - * (#TextDocumentPosition) the response is of either type [Definition](#Definition) - * or a typed array of [DefinitionLink](#DefinitionLink) or a Thenable that resolves - * to such. - */ -var DefinitionRequest; -(function (DefinitionRequest) { - DefinitionRequest.method = 'textDocument/definition'; - DefinitionRequest.type = new messages_1.ProtocolRequestType(DefinitionRequest.method); -})(DefinitionRequest = exports.DefinitionRequest || (exports.DefinitionRequest = {})); -/** - * A request to resolve project-wide references for the symbol denoted - * by the given text document position. The request's parameter is of - * type [ReferenceParams](#ReferenceParams) the response is of type - * [Location[]](#Location) or a Thenable that resolves to such. - */ -var ReferencesRequest; -(function (ReferencesRequest) { - ReferencesRequest.method = 'textDocument/references'; - ReferencesRequest.type = new messages_1.ProtocolRequestType(ReferencesRequest.method); -})(ReferencesRequest = exports.ReferencesRequest || (exports.ReferencesRequest = {})); -/** - * Request to resolve a [DocumentHighlight](#DocumentHighlight) for a given - * text document position. The request's parameter is of type [TextDocumentPosition] - * (#TextDocumentPosition) the request response is of type [DocumentHighlight[]] - * (#DocumentHighlight) or a Thenable that resolves to such. - */ -var DocumentHighlightRequest; -(function (DocumentHighlightRequest) { - DocumentHighlightRequest.method = 'textDocument/documentHighlight'; - DocumentHighlightRequest.type = new messages_1.ProtocolRequestType(DocumentHighlightRequest.method); -})(DocumentHighlightRequest = exports.DocumentHighlightRequest || (exports.DocumentHighlightRequest = {})); -/** - * A request to list all symbols found in a given text document. The request's - * parameter is of type [TextDocumentIdentifier](#TextDocumentIdentifier) the - * response is of type [SymbolInformation[]](#SymbolInformation) or a Thenable - * that resolves to such. - */ -var DocumentSymbolRequest; -(function (DocumentSymbolRequest) { - DocumentSymbolRequest.method = 'textDocument/documentSymbol'; - DocumentSymbolRequest.type = new messages_1.ProtocolRequestType(DocumentSymbolRequest.method); -})(DocumentSymbolRequest = exports.DocumentSymbolRequest || (exports.DocumentSymbolRequest = {})); -/** - * A request to provide commands for the given text document and range. - */ -var CodeActionRequest; -(function (CodeActionRequest) { - CodeActionRequest.method = 'textDocument/codeAction'; - CodeActionRequest.type = new messages_1.ProtocolRequestType(CodeActionRequest.method); -})(CodeActionRequest = exports.CodeActionRequest || (exports.CodeActionRequest = {})); -/** - * Request to resolve additional information for a given code action.The request's - * parameter is of type [CodeAction](#CodeAction) the response - * is of type [CodeAction](#CodeAction) or a Thenable that resolves to such. - */ -var CodeActionResolveRequest; -(function (CodeActionResolveRequest) { - CodeActionResolveRequest.method = 'codeAction/resolve'; - CodeActionResolveRequest.type = new messages_1.ProtocolRequestType(CodeActionResolveRequest.method); -})(CodeActionResolveRequest = exports.CodeActionResolveRequest || (exports.CodeActionResolveRequest = {})); -/** - * A request to list project-wide symbols matching the query string given - * by the [WorkspaceSymbolParams](#WorkspaceSymbolParams). The response is - * of type [SymbolInformation[]](#SymbolInformation) or a Thenable that - * resolves to such. - */ -var WorkspaceSymbolRequest; -(function (WorkspaceSymbolRequest) { - WorkspaceSymbolRequest.method = 'workspace/symbol'; - WorkspaceSymbolRequest.type = new messages_1.ProtocolRequestType(WorkspaceSymbolRequest.method); -})(WorkspaceSymbolRequest = exports.WorkspaceSymbolRequest || (exports.WorkspaceSymbolRequest = {})); -/** - * A request to provide code lens for the given text document. - */ -var CodeLensRequest; -(function (CodeLensRequest) { - CodeLensRequest.method = 'textDocument/codeLens'; - CodeLensRequest.type = new messages_1.ProtocolRequestType(CodeLensRequest.method); -})(CodeLensRequest = exports.CodeLensRequest || (exports.CodeLensRequest = {})); -/** - * A request to resolve a command for a given code lens. - */ -var CodeLensResolveRequest; -(function (CodeLensResolveRequest) { - CodeLensResolveRequest.method = 'codeLens/resolve'; - CodeLensResolveRequest.type = new messages_1.ProtocolRequestType(CodeLensResolveRequest.method); -})(CodeLensResolveRequest = exports.CodeLensResolveRequest || (exports.CodeLensResolveRequest = {})); -/** - * A request to refresh all code actions - * - * @since 3.16.0 - */ -var CodeLensRefreshRequest; -(function (CodeLensRefreshRequest) { - CodeLensRefreshRequest.method = `workspace/codeLens/refresh`; - CodeLensRefreshRequest.type = new messages_1.ProtocolRequestType0(CodeLensRefreshRequest.method); -})(CodeLensRefreshRequest = exports.CodeLensRefreshRequest || (exports.CodeLensRefreshRequest = {})); -/** - * A request to provide document links - */ -var DocumentLinkRequest; -(function (DocumentLinkRequest) { - DocumentLinkRequest.method = 'textDocument/documentLink'; - DocumentLinkRequest.type = new messages_1.ProtocolRequestType(DocumentLinkRequest.method); -})(DocumentLinkRequest = exports.DocumentLinkRequest || (exports.DocumentLinkRequest = {})); -/** - * Request to resolve additional information for a given document link. The request's - * parameter is of type [DocumentLink](#DocumentLink) the response - * is of type [DocumentLink](#DocumentLink) or a Thenable that resolves to such. - */ -var DocumentLinkResolveRequest; -(function (DocumentLinkResolveRequest) { - DocumentLinkResolveRequest.method = 'documentLink/resolve'; - DocumentLinkResolveRequest.type = new messages_1.ProtocolRequestType(DocumentLinkResolveRequest.method); -})(DocumentLinkResolveRequest = exports.DocumentLinkResolveRequest || (exports.DocumentLinkResolveRequest = {})); -/** - * A request to to format a whole document. - */ -var DocumentFormattingRequest; -(function (DocumentFormattingRequest) { - DocumentFormattingRequest.method = 'textDocument/formatting'; - DocumentFormattingRequest.type = new messages_1.ProtocolRequestType(DocumentFormattingRequest.method); -})(DocumentFormattingRequest = exports.DocumentFormattingRequest || (exports.DocumentFormattingRequest = {})); -/** - * A request to to format a range in a document. - */ -var DocumentRangeFormattingRequest; -(function (DocumentRangeFormattingRequest) { - DocumentRangeFormattingRequest.method = 'textDocument/rangeFormatting'; - DocumentRangeFormattingRequest.type = new messages_1.ProtocolRequestType(DocumentRangeFormattingRequest.method); -})(DocumentRangeFormattingRequest = exports.DocumentRangeFormattingRequest || (exports.DocumentRangeFormattingRequest = {})); -/** - * A request to format a document on type. - */ -var DocumentOnTypeFormattingRequest; -(function (DocumentOnTypeFormattingRequest) { - DocumentOnTypeFormattingRequest.method = 'textDocument/onTypeFormatting'; - DocumentOnTypeFormattingRequest.type = new messages_1.ProtocolRequestType(DocumentOnTypeFormattingRequest.method); -})(DocumentOnTypeFormattingRequest = exports.DocumentOnTypeFormattingRequest || (exports.DocumentOnTypeFormattingRequest = {})); -//---- Rename ---------------------------------------------- -var PrepareSupportDefaultBehavior; -(function (PrepareSupportDefaultBehavior) { - /** - * The client's default behavior is to select the identifier - * according the to language's syntax rule. - */ - PrepareSupportDefaultBehavior.Identifier = 1; -})(PrepareSupportDefaultBehavior = exports.PrepareSupportDefaultBehavior || (exports.PrepareSupportDefaultBehavior = {})); -/** - * A request to rename a symbol. - */ -var RenameRequest; -(function (RenameRequest) { - RenameRequest.method = 'textDocument/rename'; - RenameRequest.type = new messages_1.ProtocolRequestType(RenameRequest.method); -})(RenameRequest = exports.RenameRequest || (exports.RenameRequest = {})); -/** - * A request to test and perform the setup necessary for a rename. - * - * @since 3.16 - support for default behavior - */ -var PrepareRenameRequest; -(function (PrepareRenameRequest) { - PrepareRenameRequest.method = 'textDocument/prepareRename'; - PrepareRenameRequest.type = new messages_1.ProtocolRequestType(PrepareRenameRequest.method); -})(PrepareRenameRequest = exports.PrepareRenameRequest || (exports.PrepareRenameRequest = {})); -/** - * A request send from the client to the server to execute a command. The request might return - * a workspace edit which the client will apply to the workspace. - */ -var ExecuteCommandRequest; -(function (ExecuteCommandRequest) { - ExecuteCommandRequest.type = new messages_1.ProtocolRequestType('workspace/executeCommand'); -})(ExecuteCommandRequest = exports.ExecuteCommandRequest || (exports.ExecuteCommandRequest = {})); -/** - * A request sent from the server to the client to modified certain resources. - */ -var ApplyWorkspaceEditRequest; -(function (ApplyWorkspaceEditRequest) { - ApplyWorkspaceEditRequest.type = new messages_1.ProtocolRequestType('workspace/applyEdit'); -})(ApplyWorkspaceEditRequest = exports.ApplyWorkspaceEditRequest || (exports.ApplyWorkspaceEditRequest = {})); -//# sourceMappingURL=protocol.js.map \ No newline at end of file diff --git a/server/node_modules/vscode-languageserver-protocol/lib/common/protocol.linkedEditingRange.js b/server/node_modules/vscode-languageserver-protocol/lib/common/protocol.linkedEditingRange.js deleted file mode 100644 index c7cf018..0000000 --- a/server/node_modules/vscode-languageserver-protocol/lib/common/protocol.linkedEditingRange.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict"; -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.LinkedEditingRangeRequest = void 0; -const messages_1 = require("./messages"); -/** - * A request to provide ranges that can be edited together. - * - * @since 3.16.0 - */ -var LinkedEditingRangeRequest; -(function (LinkedEditingRangeRequest) { - LinkedEditingRangeRequest.method = 'textDocument/linkedEditingRange'; - LinkedEditingRangeRequest.type = new messages_1.ProtocolRequestType(LinkedEditingRangeRequest.method); -})(LinkedEditingRangeRequest = exports.LinkedEditingRangeRequest || (exports.LinkedEditingRangeRequest = {})); -//# sourceMappingURL=protocol.linkedEditingRange.js.map \ No newline at end of file diff --git a/server/node_modules/vscode-languageserver-protocol/lib/common/protocol.moniker.js b/server/node_modules/vscode-languageserver-protocol/lib/common/protocol.moniker.js deleted file mode 100644 index 34d9b2d..0000000 --- a/server/node_modules/vscode-languageserver-protocol/lib/common/protocol.moniker.js +++ /dev/null @@ -1,68 +0,0 @@ -"use strict"; -/* -------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * ------------------------------------------------------------------------------------------ */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.MonikerRequest = exports.MonikerKind = exports.UniquenessLevel = void 0; -const messages_1 = require("./messages"); -/** - * Moniker uniqueness level to define scope of the moniker. - * - * @since 3.16.0 - */ -var UniquenessLevel; -(function (UniquenessLevel) { - /** - * The moniker is only unique inside a document - */ - UniquenessLevel["document"] = "document"; - /** - * The moniker is unique inside a project for which a dump got created - */ - UniquenessLevel["project"] = "project"; - /** - * The moniker is unique inside the group to which a project belongs - */ - UniquenessLevel["group"] = "group"; - /** - * The moniker is unique inside the moniker scheme. - */ - UniquenessLevel["scheme"] = "scheme"; - /** - * The moniker is globally unique - */ - UniquenessLevel["global"] = "global"; -})(UniquenessLevel = exports.UniquenessLevel || (exports.UniquenessLevel = {})); -/** - * The moniker kind. - * - * @since 3.16.0 - */ -var MonikerKind; -(function (MonikerKind) { - /** - * The moniker represent a symbol that is imported into a project - */ - MonikerKind["import"] = "import"; - /** - * The moniker represents a symbol that is exported from a project - */ - MonikerKind["export"] = "export"; - /** - * The moniker represents a symbol that is local to a project (e.g. a local - * variable of a function, a class not visible outside the project, ...) - */ - MonikerKind["local"] = "local"; -})(MonikerKind = exports.MonikerKind || (exports.MonikerKind = {})); -/** - * A request to get the moniker of a symbol at a given text document position. - * The request parameter is of type [TextDocumentPositionParams](#TextDocumentPositionParams). - * The response is of type [Moniker[]](#Moniker[]) or `null`. - */ -var MonikerRequest; -(function (MonikerRequest) { - MonikerRequest.method = 'textDocument/moniker'; - MonikerRequest.type = new messages_1.ProtocolRequestType(MonikerRequest.method); -})(MonikerRequest = exports.MonikerRequest || (exports.MonikerRequest = {})); -//# sourceMappingURL=protocol.moniker.js.map \ No newline at end of file diff --git a/server/node_modules/vscode-languageserver-protocol/lib/common/protocol.progress.js b/server/node_modules/vscode-languageserver-protocol/lib/common/protocol.progress.js deleted file mode 100644 index 47a33cc..0000000 --- a/server/node_modules/vscode-languageserver-protocol/lib/common/protocol.progress.js +++ /dev/null @@ -1,34 +0,0 @@ -"use strict"; -/* -------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * ------------------------------------------------------------------------------------------ */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.WorkDoneProgressCancelNotification = exports.WorkDoneProgressCreateRequest = exports.WorkDoneProgress = void 0; -const vscode_jsonrpc_1 = require("vscode-jsonrpc"); -const messages_1 = require("./messages"); -var WorkDoneProgress; -(function (WorkDoneProgress) { - WorkDoneProgress.type = new vscode_jsonrpc_1.ProgressType(); - function is(value) { - return value === WorkDoneProgress.type; - } - WorkDoneProgress.is = is; -})(WorkDoneProgress = exports.WorkDoneProgress || (exports.WorkDoneProgress = {})); -/** - * The `window/workDoneProgress/create` request is sent from the server to the client to initiate progress - * reporting from the server. - */ -var WorkDoneProgressCreateRequest; -(function (WorkDoneProgressCreateRequest) { - WorkDoneProgressCreateRequest.type = new messages_1.ProtocolRequestType('window/workDoneProgress/create'); -})(WorkDoneProgressCreateRequest = exports.WorkDoneProgressCreateRequest || (exports.WorkDoneProgressCreateRequest = {})); -/** - * The `window/workDoneProgress/cancel` notification is sent from the client to the server to cancel a progress - * initiated on the server side. - */ -var WorkDoneProgressCancelNotification; -(function (WorkDoneProgressCancelNotification) { - WorkDoneProgressCancelNotification.type = new messages_1.ProtocolNotificationType('window/workDoneProgress/cancel'); -})(WorkDoneProgressCancelNotification = exports.WorkDoneProgressCancelNotification || (exports.WorkDoneProgressCancelNotification = {})); -//# sourceMappingURL=protocol.progress.js.map \ No newline at end of file diff --git a/server/node_modules/vscode-languageserver-protocol/lib/common/protocol.selectionRange.js b/server/node_modules/vscode-languageserver-protocol/lib/common/protocol.selectionRange.js deleted file mode 100644 index f15e70d..0000000 --- a/server/node_modules/vscode-languageserver-protocol/lib/common/protocol.selectionRange.js +++ /dev/null @@ -1,20 +0,0 @@ -"use strict"; -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.SelectionRangeRequest = void 0; -const messages_1 = require("./messages"); -/** - * A request to provide selection ranges in a document. The request's - * parameter is of type [SelectionRangeParams](#SelectionRangeParams), the - * response is of type [SelectionRange[]](#SelectionRange[]) or a Thenable - * that resolves to such. - */ -var SelectionRangeRequest; -(function (SelectionRangeRequest) { - SelectionRangeRequest.method = 'textDocument/selectionRange'; - SelectionRangeRequest.type = new messages_1.ProtocolRequestType(SelectionRangeRequest.method); -})(SelectionRangeRequest = exports.SelectionRangeRequest || (exports.SelectionRangeRequest = {})); -//# sourceMappingURL=protocol.selectionRange.js.map \ No newline at end of file diff --git a/server/node_modules/vscode-languageserver-protocol/lib/common/protocol.semanticTokens.js b/server/node_modules/vscode-languageserver-protocol/lib/common/protocol.semanticTokens.js deleted file mode 100644 index e7689be..0000000 --- a/server/node_modules/vscode-languageserver-protocol/lib/common/protocol.semanticTokens.js +++ /dev/null @@ -1,119 +0,0 @@ -"use strict"; -/* -------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * ------------------------------------------------------------------------------------------ */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.SemanticTokensRefreshRequest = exports.SemanticTokensRangeRequest = exports.SemanticTokensDeltaRequest = exports.SemanticTokensRequest = exports.SemanticTokensRegistrationType = exports.TokenFormat = exports.SemanticTokens = exports.SemanticTokenModifiers = exports.SemanticTokenTypes = void 0; -const messages_1 = require("./messages"); -/** - * A set of predefined token types. This set is not fixed - * an clients can specify additional token types via the - * corresponding client capabilities. - * - * @since 3.16.0 - */ -var SemanticTokenTypes; -(function (SemanticTokenTypes) { - SemanticTokenTypes["namespace"] = "namespace"; - /** - * Represents a generic type. Acts as a fallback for types which can't be mapped to - * a specific type like class or enum. - */ - SemanticTokenTypes["type"] = "type"; - SemanticTokenTypes["class"] = "class"; - SemanticTokenTypes["enum"] = "enum"; - SemanticTokenTypes["interface"] = "interface"; - SemanticTokenTypes["struct"] = "struct"; - SemanticTokenTypes["typeParameter"] = "typeParameter"; - SemanticTokenTypes["parameter"] = "parameter"; - SemanticTokenTypes["variable"] = "variable"; - SemanticTokenTypes["property"] = "property"; - SemanticTokenTypes["enumMember"] = "enumMember"; - SemanticTokenTypes["event"] = "event"; - SemanticTokenTypes["function"] = "function"; - SemanticTokenTypes["method"] = "method"; - SemanticTokenTypes["macro"] = "macro"; - SemanticTokenTypes["keyword"] = "keyword"; - SemanticTokenTypes["modifier"] = "modifier"; - SemanticTokenTypes["comment"] = "comment"; - SemanticTokenTypes["string"] = "string"; - SemanticTokenTypes["number"] = "number"; - SemanticTokenTypes["regexp"] = "regexp"; - SemanticTokenTypes["operator"] = "operator"; -})(SemanticTokenTypes = exports.SemanticTokenTypes || (exports.SemanticTokenTypes = {})); -/** - * A set of predefined token modifiers. This set is not fixed - * an clients can specify additional token types via the - * corresponding client capabilities. - * - * @since 3.16.0 - */ -var SemanticTokenModifiers; -(function (SemanticTokenModifiers) { - SemanticTokenModifiers["declaration"] = "declaration"; - SemanticTokenModifiers["definition"] = "definition"; - SemanticTokenModifiers["readonly"] = "readonly"; - SemanticTokenModifiers["static"] = "static"; - SemanticTokenModifiers["deprecated"] = "deprecated"; - SemanticTokenModifiers["abstract"] = "abstract"; - SemanticTokenModifiers["async"] = "async"; - SemanticTokenModifiers["modification"] = "modification"; - SemanticTokenModifiers["documentation"] = "documentation"; - SemanticTokenModifiers["defaultLibrary"] = "defaultLibrary"; -})(SemanticTokenModifiers = exports.SemanticTokenModifiers || (exports.SemanticTokenModifiers = {})); -/** - * @since 3.16.0 - */ -var SemanticTokens; -(function (SemanticTokens) { - function is(value) { - const candidate = value; - return candidate !== undefined && (candidate.resultId === undefined || typeof candidate.resultId === 'string') && - Array.isArray(candidate.data) && (candidate.data.length === 0 || typeof candidate.data[0] === 'number'); - } - SemanticTokens.is = is; -})(SemanticTokens = exports.SemanticTokens || (exports.SemanticTokens = {})); -//------- 'textDocument/semanticTokens' ----- -var TokenFormat; -(function (TokenFormat) { - TokenFormat.Relative = 'relative'; -})(TokenFormat = exports.TokenFormat || (exports.TokenFormat = {})); -var SemanticTokensRegistrationType; -(function (SemanticTokensRegistrationType) { - SemanticTokensRegistrationType.method = 'textDocument/semanticTokens'; - SemanticTokensRegistrationType.type = new messages_1.RegistrationType(SemanticTokensRegistrationType.method); -})(SemanticTokensRegistrationType = exports.SemanticTokensRegistrationType || (exports.SemanticTokensRegistrationType = {})); -/** - * @since 3.16.0 - */ -var SemanticTokensRequest; -(function (SemanticTokensRequest) { - SemanticTokensRequest.method = 'textDocument/semanticTokens/full'; - SemanticTokensRequest.type = new messages_1.ProtocolRequestType(SemanticTokensRequest.method); -})(SemanticTokensRequest = exports.SemanticTokensRequest || (exports.SemanticTokensRequest = {})); -/** - * @since 3.16.0 - */ -var SemanticTokensDeltaRequest; -(function (SemanticTokensDeltaRequest) { - SemanticTokensDeltaRequest.method = 'textDocument/semanticTokens/full/delta'; - SemanticTokensDeltaRequest.type = new messages_1.ProtocolRequestType(SemanticTokensDeltaRequest.method); -})(SemanticTokensDeltaRequest = exports.SemanticTokensDeltaRequest || (exports.SemanticTokensDeltaRequest = {})); -/** - * @since 3.16.0 - */ -var SemanticTokensRangeRequest; -(function (SemanticTokensRangeRequest) { - SemanticTokensRangeRequest.method = 'textDocument/semanticTokens/range'; - SemanticTokensRangeRequest.type = new messages_1.ProtocolRequestType(SemanticTokensRangeRequest.method); -})(SemanticTokensRangeRequest = exports.SemanticTokensRangeRequest || (exports.SemanticTokensRangeRequest = {})); -/** - * @since 3.16.0 - */ -var SemanticTokensRefreshRequest; -(function (SemanticTokensRefreshRequest) { - SemanticTokensRefreshRequest.method = `workspace/semanticTokens/refresh`; - SemanticTokensRefreshRequest.type = new messages_1.ProtocolRequestType0(SemanticTokensRefreshRequest.method); -})(SemanticTokensRefreshRequest = exports.SemanticTokensRefreshRequest || (exports.SemanticTokensRefreshRequest = {})); -//# sourceMappingURL=protocol.semanticTokens.js.map \ No newline at end of file diff --git a/server/node_modules/vscode-languageserver-protocol/lib/common/protocol.showDocument.js b/server/node_modules/vscode-languageserver-protocol/lib/common/protocol.showDocument.js deleted file mode 100644 index 73637d7..0000000 --- a/server/node_modules/vscode-languageserver-protocol/lib/common/protocol.showDocument.js +++ /dev/null @@ -1,22 +0,0 @@ -"use strict"; -/* -------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * ------------------------------------------------------------------------------------------ */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ShowDocumentRequest = void 0; -const messages_1 = require("./messages"); -/** - * A request to show a document. This request might open an - * external program depending on the value of the URI to open. - * For example a request to open `https://code.visualstudio.com/` - * will very likely open the URI in a WEB browser. - * - * @since 3.16.0 -*/ -var ShowDocumentRequest; -(function (ShowDocumentRequest) { - ShowDocumentRequest.method = 'window/showDocument'; - ShowDocumentRequest.type = new messages_1.ProtocolRequestType(ShowDocumentRequest.method); -})(ShowDocumentRequest = exports.ShowDocumentRequest || (exports.ShowDocumentRequest = {})); -//# sourceMappingURL=protocol.showDocument.js.map \ No newline at end of file diff --git a/server/node_modules/vscode-languageserver-protocol/lib/common/protocol.typeDefinition.js b/server/node_modules/vscode-languageserver-protocol/lib/common/protocol.typeDefinition.js deleted file mode 100644 index 4fce708..0000000 --- a/server/node_modules/vscode-languageserver-protocol/lib/common/protocol.typeDefinition.js +++ /dev/null @@ -1,22 +0,0 @@ -"use strict"; -/* -------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * ------------------------------------------------------------------------------------------ */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.TypeDefinitionRequest = void 0; -const messages_1 = require("./messages"); -// @ts-ignore: to avoid inlining LocatioLink as dynamic import -let __noDynamicImport; -/** - * A request to resolve the type definition locations of a symbol at a given text - * document position. The request's parameter is of type [TextDocumentPositioParams] - * (#TextDocumentPositionParams) the response is of type [Definition](#Definition) or a - * Thenable that resolves to such. - */ -var TypeDefinitionRequest; -(function (TypeDefinitionRequest) { - TypeDefinitionRequest.method = 'textDocument/typeDefinition'; - TypeDefinitionRequest.type = new messages_1.ProtocolRequestType(TypeDefinitionRequest.method); -})(TypeDefinitionRequest = exports.TypeDefinitionRequest || (exports.TypeDefinitionRequest = {})); -//# sourceMappingURL=protocol.typeDefinition.js.map \ No newline at end of file diff --git a/server/node_modules/vscode-languageserver-protocol/lib/common/protocol.workspaceFolders.js b/server/node_modules/vscode-languageserver-protocol/lib/common/protocol.workspaceFolders.js deleted file mode 100644 index 94f859a..0000000 --- a/server/node_modules/vscode-languageserver-protocol/lib/common/protocol.workspaceFolders.js +++ /dev/null @@ -1,24 +0,0 @@ -"use strict"; -/* -------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * ------------------------------------------------------------------------------------------ */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.DidChangeWorkspaceFoldersNotification = exports.WorkspaceFoldersRequest = void 0; -const messages_1 = require("./messages"); -/** - * The `workspace/workspaceFolders` is sent from the server to the client to fetch the open workspace folders. - */ -var WorkspaceFoldersRequest; -(function (WorkspaceFoldersRequest) { - WorkspaceFoldersRequest.type = new messages_1.ProtocolRequestType0('workspace/workspaceFolders'); -})(WorkspaceFoldersRequest = exports.WorkspaceFoldersRequest || (exports.WorkspaceFoldersRequest = {})); -/** - * The `workspace/didChangeWorkspaceFolders` notification is sent from the client to the server when the workspace - * folder configuration changes. - */ -var DidChangeWorkspaceFoldersNotification; -(function (DidChangeWorkspaceFoldersNotification) { - DidChangeWorkspaceFoldersNotification.type = new messages_1.ProtocolNotificationType('workspace/didChangeWorkspaceFolders'); -})(DidChangeWorkspaceFoldersNotification = exports.DidChangeWorkspaceFoldersNotification || (exports.DidChangeWorkspaceFoldersNotification = {})); -//# sourceMappingURL=protocol.workspaceFolders.js.map \ No newline at end of file diff --git a/server/node_modules/vscode-languageserver-protocol/lib/common/utils/is.js b/server/node_modules/vscode-languageserver-protocol/lib/common/utils/is.js deleted file mode 100644 index 8b88e81..0000000 --- a/server/node_modules/vscode-languageserver-protocol/lib/common/utils/is.js +++ /dev/null @@ -1,47 +0,0 @@ -/* -------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * ------------------------------------------------------------------------------------------ */ -'use strict'; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.objectLiteral = exports.typedArray = exports.stringArray = exports.array = exports.func = exports.error = exports.number = exports.string = exports.boolean = void 0; -function boolean(value) { - return value === true || value === false; -} -exports.boolean = boolean; -function string(value) { - return typeof value === 'string' || value instanceof String; -} -exports.string = string; -function number(value) { - return typeof value === 'number' || value instanceof Number; -} -exports.number = number; -function error(value) { - return value instanceof Error; -} -exports.error = error; -function func(value) { - return typeof value === 'function'; -} -exports.func = func; -function array(value) { - return Array.isArray(value); -} -exports.array = array; -function stringArray(value) { - return array(value) && value.every(elem => string(elem)); -} -exports.stringArray = stringArray; -function typedArray(value, check) { - return Array.isArray(value) && value.every(check); -} -exports.typedArray = typedArray; -function objectLiteral(value) { - // Strictly speaking class instances pass this check as well. Since the LSP - // doesn't use classes we ignore this for now. If we do we need to add something - // like this: `Object.getPrototypeOf(Object.getPrototypeOf(x)) === null` - return value !== null && typeof value === 'object'; -} -exports.objectLiteral = objectLiteral; -//# sourceMappingURL=is.js.map \ No newline at end of file diff --git a/server/node_modules/vscode-languageserver-protocol/lib/node/main.js b/server/node_modules/vscode-languageserver-protocol/lib/node/main.js deleted file mode 100644 index eab9808..0000000 --- a/server/node_modules/vscode-languageserver-protocol/lib/node/main.js +++ /dev/null @@ -1,25 +0,0 @@ -"use strict"; -/* -------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * ------------------------------------------------------------------------------------------ */ -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.createProtocolConnection = void 0; -const node_1 = require("vscode-jsonrpc/node"); -__exportStar(require("vscode-jsonrpc/node"), exports); -__exportStar(require("../common/api"), exports); -function createProtocolConnection(input, output, logger, options) { - return node_1.createMessageConnection(input, output, logger, options); -} -exports.createProtocolConnection = createProtocolConnection; -//# sourceMappingURL=main.js.map \ No newline at end of file diff --git a/server/node_modules/vscode-languageserver-protocol/node.cmd b/server/node_modules/vscode-languageserver-protocol/node.cmd deleted file mode 100644 index 791e6e3..0000000 --- a/server/node_modules/vscode-languageserver-protocol/node.cmd +++ /dev/null @@ -1,5 +0,0 @@ -@echo off -REM This file is necessary to ensure that under Windows we don't -REM run the node.js file in the Windows Script Host when using -REM node in packakge.json scripts. See also PATHEXT setting -node.exe %* \ No newline at end of file diff --git a/server/node_modules/vscode-languageserver-protocol/node.js b/server/node_modules/vscode-languageserver-protocol/node.js deleted file mode 100644 index 388e319..0000000 --- a/server/node_modules/vscode-languageserver-protocol/node.js +++ /dev/null @@ -1,7 +0,0 @@ -/* -------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * ----------------------------------------------------------------------------------------- */ -'use strict'; - -module.exports = require('./lib/node/main'); \ No newline at end of file diff --git a/server/node_modules/vscode-languageserver-protocol/node_modules/vscode-jsonrpc/License.txt b/server/node_modules/vscode-languageserver-protocol/node_modules/vscode-jsonrpc/License.txt deleted file mode 100644 index a07e3ae..0000000 --- a/server/node_modules/vscode-languageserver-protocol/node_modules/vscode-jsonrpc/License.txt +++ /dev/null @@ -1,11 +0,0 @@ -Copyright (c) Microsoft Corporation - -All rights reserved. - -MIT License - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/server/node_modules/vscode-languageserver-protocol/node_modules/vscode-jsonrpc/README.md b/server/node_modules/vscode-languageserver-protocol/node_modules/vscode-jsonrpc/README.md deleted file mode 100644 index 4eac3c3..0000000 --- a/server/node_modules/vscode-languageserver-protocol/node_modules/vscode-jsonrpc/README.md +++ /dev/null @@ -1,69 +0,0 @@ -# VSCode JSON RPC - -[![NPM Version](https://img.shields.io/npm/v/vscode-jsonrpc.svg)](https://npmjs.org/package/vscode-jsonrpc) -[![NPM Downloads](https://img.shields.io/npm/dm/vscode-jsonrpc.svg)](https://npmjs.org/package/vscode-jsonrpc) -[![Build Status](https://travis-ci.org/Microsoft/vscode-languageserver-node.svg?branch=master)](https://travis-ci.org/Microsoft/vscode-languageserver-node) - -This npm module implements the base messaging protocol spoken between a VSCode language server and a VSCode language client. - -The npm module can also be used standalone to establish a [JSON-RPC](http://www.jsonrpc.org/) channel between -a client and a server. Below an example how to setup a JSON-RPC connection. First the client side. - -```ts -import * as cp from 'child_process'; -import * as rpc from 'vscode-jsonrpc'; - -let childProcess = cp.spawn(...); - -// Use stdin and stdout for communication: -let connection = rpc.createMessageConnection( - new rpc.StreamMessageReader(childProcess.stdout), - new rpc.StreamMessageWriter(childProcess.stdin)); - -let notification = new rpc.NotificationType('testNotification'); - -connection.listen(); - -connection.sendNotification(notification, 'Hello World'); -``` - -The server side looks very symmetrical: - -```ts -import * as rpc from 'vscode-jsonrpc'; - - -let connection = rpc.createMessageConnection( - new rpc.StreamMessageReader(process.stdin), - new rpc.StreamMessageWriter(process.stdout)); - -let notification = new rpc.NotificationType('testNotification'); -connection.onNotification(notification, (param: string) => { - console.log(param); // This prints Hello World -}); - -connection.listen(); -``` - -# History - -### 5.0.0 - -- add progress support -- move JS target to ES2017 - -### 4.0.0 - -- move JS target to ES6. - -### 3.0.0: - -- converted the NPM module to use TypeScript 2.0.3. -- added strict null support. -- support for passing more than one parameter to a request or notification. -- Breaking changes: - - due to the use of TypeScript 2.0.3 and differences in d.ts generation users of the new version need to move to - TypeScript 2.0.3 as well. - -## License -[MIT](https://github.com/Microsoft/vscode-languageserver-node/blob/master/License.txt) diff --git a/server/node_modules/vscode-languageserver-protocol/node_modules/vscode-jsonrpc/browser.js b/server/node_modules/vscode-languageserver-protocol/node_modules/vscode-jsonrpc/browser.js deleted file mode 100644 index f5caebf..0000000 --- a/server/node_modules/vscode-languageserver-protocol/node_modules/vscode-jsonrpc/browser.js +++ /dev/null @@ -1,7 +0,0 @@ -/* -------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * ----------------------------------------------------------------------------------------- */ -'use strict'; - -module.exports = require('./lib/browser/main'); \ No newline at end of file diff --git a/server/node_modules/vscode-languageserver-protocol/node_modules/vscode-jsonrpc/lib/browser/main.js b/server/node_modules/vscode-languageserver-protocol/node_modules/vscode-jsonrpc/lib/browser/main.js deleted file mode 100644 index 6289e82..0000000 --- a/server/node_modules/vscode-languageserver-protocol/node_modules/vscode-jsonrpc/lib/browser/main.js +++ /dev/null @@ -1,73 +0,0 @@ -"use strict"; -/* -------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * ------------------------------------------------------------------------------------------ */ -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.createMessageConnection = exports.BrowserMessageWriter = exports.BrowserMessageReader = void 0; -const ril_1 = require("./ril"); -// Install the browser runtime abstract. -ril_1.default.install(); -const api_1 = require("../common/api"); -__exportStar(require("../common/api"), exports); -class BrowserMessageReader extends api_1.AbstractMessageReader { - constructor(context) { - super(); - this._onData = new api_1.Emitter(); - this._messageListener = (event) => { - this._onData.fire(event.data); - }; - context.addEventListener('error', (event) => this.fireError(event)); - context.onmessage = this._messageListener; - } - listen(callback) { - return this._onData.event(callback); - } -} -exports.BrowserMessageReader = BrowserMessageReader; -class BrowserMessageWriter extends api_1.AbstractMessageWriter { - constructor(context) { - super(); - this.context = context; - this.errorCount = 0; - context.addEventListener('error', (event) => this.fireError(event)); - } - write(msg) { - try { - this.context.postMessage(msg); - return Promise.resolve(); - } - catch (error) { - this.handleError(error, msg); - return Promise.reject(error); - } - } - handleError(error, msg) { - this.errorCount++; - this.fireError(error, msg, this.errorCount); - } - end() { - } -} -exports.BrowserMessageWriter = BrowserMessageWriter; -function createMessageConnection(reader, writer, logger, options) { - if (logger === undefined) { - logger = api_1.NullLogger; - } - if (api_1.ConnectionStrategy.is(options)) { - options = { connectionStrategy: options }; - } - return api_1.createMessageConnection(reader, writer, logger, options); -} -exports.createMessageConnection = createMessageConnection; -//# sourceMappingURL=main.js.map \ No newline at end of file diff --git a/server/node_modules/vscode-languageserver-protocol/node_modules/vscode-jsonrpc/lib/browser/ril.js b/server/node_modules/vscode-languageserver-protocol/node_modules/vscode-jsonrpc/lib/browser/ril.js deleted file mode 100644 index adb73a0..0000000 --- a/server/node_modules/vscode-languageserver-protocol/node_modules/vscode-jsonrpc/lib/browser/ril.js +++ /dev/null @@ -1,158 +0,0 @@ -"use strict"; -/* -------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * ------------------------------------------------------------------------------------------ */ -Object.defineProperty(exports, "__esModule", { value: true }); -const ral_1 = require("../common/ral"); -const disposable_1 = require("../common/disposable"); -const events_1 = require("../common/events"); -const messageBuffer_1 = require("../common/messageBuffer"); -class MessageBuffer extends messageBuffer_1.AbstractMessageBuffer { - constructor(encoding = 'utf-8') { - super(encoding); - this.asciiDecoder = new TextDecoder('ascii'); - } - emptyBuffer() { - return MessageBuffer.emptyBuffer; - } - fromString(value, _encoding) { - return (new TextEncoder()).encode(value); - } - toString(value, encoding) { - if (encoding === 'ascii') { - return this.asciiDecoder.decode(value); - } - else { - return (new TextDecoder(encoding)).decode(value); - } - } - asNative(buffer, length) { - if (length === undefined) { - return buffer; - } - else { - return buffer.slice(0, length); - } - } - allocNative(length) { - return new Uint8Array(length); - } -} -MessageBuffer.emptyBuffer = new Uint8Array(0); -class ReadableStreamWrapper { - constructor(socket) { - this.socket = socket; - this._onData = new events_1.Emitter(); - this._messageListener = (event) => { - const blob = event.data; - blob.arrayBuffer().then((buffer) => { - this._onData.fire(new Uint8Array(buffer)); - }); - }; - this.socket.addEventListener('message', this._messageListener); - } - onClose(listener) { - this.socket.addEventListener('close', listener); - return disposable_1.Disposable.create(() => this.socket.removeEventListener('close', listener)); - } - onError(listener) { - this.socket.addEventListener('error', listener); - return disposable_1.Disposable.create(() => this.socket.removeEventListener('error', listener)); - } - onEnd(listener) { - this.socket.addEventListener('end', listener); - return disposable_1.Disposable.create(() => this.socket.removeEventListener('end', listener)); - } - onData(listener) { - return this._onData.event(listener); - } -} -class WritableStreamWrapper { - constructor(socket) { - this.socket = socket; - } - onClose(listener) { - this.socket.addEventListener('close', listener); - return disposable_1.Disposable.create(() => this.socket.removeEventListener('close', listener)); - } - onError(listener) { - this.socket.addEventListener('error', listener); - return disposable_1.Disposable.create(() => this.socket.removeEventListener('error', listener)); - } - onEnd(listener) { - this.socket.addEventListener('end', listener); - return disposable_1.Disposable.create(() => this.socket.removeEventListener('end', listener)); - } - write(data, encoding) { - if (typeof data === 'string') { - if (encoding !== undefined && encoding !== 'utf-8') { - throw new Error(`In a Browser environments only utf-8 text encding is supported. But got encoding: ${encoding}`); - } - this.socket.send(data); - } - else { - this.socket.send(data); - } - return Promise.resolve(); - } - end() { - this.socket.close(); - } -} -const _textEncoder = new TextEncoder(); -const _ril = Object.freeze({ - messageBuffer: Object.freeze({ - create: (encoding) => new MessageBuffer(encoding) - }), - applicationJson: Object.freeze({ - encoder: Object.freeze({ - name: 'application/json', - encode: (msg, options) => { - if (options.charset !== 'utf-8') { - throw new Error(`In a Browser environments only utf-8 text encding is supported. But got encoding: ${options.charset}`); - } - return Promise.resolve(_textEncoder.encode(JSON.stringify(msg, undefined, 0))); - } - }), - decoder: Object.freeze({ - name: 'application/json', - decode: (buffer, options) => { - if (!(buffer instanceof Uint8Array)) { - throw new Error(`In a Browser environments only Uint8Arrays are supported.`); - } - return Promise.resolve(JSON.parse(new TextDecoder(options.charset).decode(buffer))); - } - }) - }), - stream: Object.freeze({ - asReadableStream: (socket) => new ReadableStreamWrapper(socket), - asWritableStream: (socket) => new WritableStreamWrapper(socket) - }), - console: console, - timer: Object.freeze({ - setTimeout(callback, ms, ...args) { - return setTimeout(callback, ms, ...args); - }, - clearTimeout(handle) { - clearTimeout(handle); - }, - setImmediate(callback, ...args) { - return setTimeout(callback, 0, ...args); - }, - clearImmediate(handle) { - clearTimeout(handle); - } - }) -}); -function RIL() { - return _ril; -} -(function (RIL) { - function install() { - ral_1.default.install(_ril); - } - RIL.install = install; -})(RIL || (RIL = {})); -exports.default = RIL; -//# sourceMappingURL=ril.js.map \ No newline at end of file diff --git a/server/node_modules/vscode-languageserver-protocol/node_modules/vscode-jsonrpc/lib/common/api.js b/server/node_modules/vscode-languageserver-protocol/node_modules/vscode-jsonrpc/lib/common/api.js deleted file mode 100644 index 86b7a07..0000000 --- a/server/node_modules/vscode-languageserver-protocol/node_modules/vscode-jsonrpc/lib/common/api.js +++ /dev/null @@ -1,69 +0,0 @@ -"use strict"; -/* -------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * ------------------------------------------------------------------------------------------ */ -/// -Object.defineProperty(exports, "__esModule", { value: true }); -exports.CancellationSenderStrategy = exports.CancellationReceiverStrategy = exports.ConnectionError = exports.ConnectionErrors = exports.LogTraceNotification = exports.SetTraceNotification = exports.TraceFormat = exports.Trace = exports.ProgressType = exports.createMessageConnection = exports.NullLogger = exports.ConnectionOptions = exports.ConnectionStrategy = exports.WriteableStreamMessageWriter = exports.AbstractMessageWriter = exports.MessageWriter = exports.ReadableStreamMessageReader = exports.AbstractMessageReader = exports.MessageReader = exports.CancellationToken = exports.CancellationTokenSource = exports.Emitter = exports.Event = exports.Disposable = exports.ParameterStructures = exports.NotificationType9 = exports.NotificationType8 = exports.NotificationType7 = exports.NotificationType6 = exports.NotificationType5 = exports.NotificationType4 = exports.NotificationType3 = exports.NotificationType2 = exports.NotificationType1 = exports.NotificationType0 = exports.NotificationType = exports.ErrorCodes = exports.ResponseError = exports.RequestType9 = exports.RequestType8 = exports.RequestType7 = exports.RequestType6 = exports.RequestType5 = exports.RequestType4 = exports.RequestType3 = exports.RequestType2 = exports.RequestType1 = exports.RequestType0 = exports.RequestType = exports.RAL = void 0; -exports.CancellationStrategy = void 0; -const messages_1 = require("../common/messages"); -Object.defineProperty(exports, "RequestType", { enumerable: true, get: function () { return messages_1.RequestType; } }); -Object.defineProperty(exports, "RequestType0", { enumerable: true, get: function () { return messages_1.RequestType0; } }); -Object.defineProperty(exports, "RequestType1", { enumerable: true, get: function () { return messages_1.RequestType1; } }); -Object.defineProperty(exports, "RequestType2", { enumerable: true, get: function () { return messages_1.RequestType2; } }); -Object.defineProperty(exports, "RequestType3", { enumerable: true, get: function () { return messages_1.RequestType3; } }); -Object.defineProperty(exports, "RequestType4", { enumerable: true, get: function () { return messages_1.RequestType4; } }); -Object.defineProperty(exports, "RequestType5", { enumerable: true, get: function () { return messages_1.RequestType5; } }); -Object.defineProperty(exports, "RequestType6", { enumerable: true, get: function () { return messages_1.RequestType6; } }); -Object.defineProperty(exports, "RequestType7", { enumerable: true, get: function () { return messages_1.RequestType7; } }); -Object.defineProperty(exports, "RequestType8", { enumerable: true, get: function () { return messages_1.RequestType8; } }); -Object.defineProperty(exports, "RequestType9", { enumerable: true, get: function () { return messages_1.RequestType9; } }); -Object.defineProperty(exports, "ResponseError", { enumerable: true, get: function () { return messages_1.ResponseError; } }); -Object.defineProperty(exports, "ErrorCodes", { enumerable: true, get: function () { return messages_1.ErrorCodes; } }); -Object.defineProperty(exports, "NotificationType", { enumerable: true, get: function () { return messages_1.NotificationType; } }); -Object.defineProperty(exports, "NotificationType0", { enumerable: true, get: function () { return messages_1.NotificationType0; } }); -Object.defineProperty(exports, "NotificationType1", { enumerable: true, get: function () { return messages_1.NotificationType1; } }); -Object.defineProperty(exports, "NotificationType2", { enumerable: true, get: function () { return messages_1.NotificationType2; } }); -Object.defineProperty(exports, "NotificationType3", { enumerable: true, get: function () { return messages_1.NotificationType3; } }); -Object.defineProperty(exports, "NotificationType4", { enumerable: true, get: function () { return messages_1.NotificationType4; } }); -Object.defineProperty(exports, "NotificationType5", { enumerable: true, get: function () { return messages_1.NotificationType5; } }); -Object.defineProperty(exports, "NotificationType6", { enumerable: true, get: function () { return messages_1.NotificationType6; } }); -Object.defineProperty(exports, "NotificationType7", { enumerable: true, get: function () { return messages_1.NotificationType7; } }); -Object.defineProperty(exports, "NotificationType8", { enumerable: true, get: function () { return messages_1.NotificationType8; } }); -Object.defineProperty(exports, "NotificationType9", { enumerable: true, get: function () { return messages_1.NotificationType9; } }); -Object.defineProperty(exports, "ParameterStructures", { enumerable: true, get: function () { return messages_1.ParameterStructures; } }); -const disposable_1 = require("../common/disposable"); -Object.defineProperty(exports, "Disposable", { enumerable: true, get: function () { return disposable_1.Disposable; } }); -const events_1 = require("../common/events"); -Object.defineProperty(exports, "Event", { enumerable: true, get: function () { return events_1.Event; } }); -Object.defineProperty(exports, "Emitter", { enumerable: true, get: function () { return events_1.Emitter; } }); -const cancellation_1 = require("../common/cancellation"); -Object.defineProperty(exports, "CancellationTokenSource", { enumerable: true, get: function () { return cancellation_1.CancellationTokenSource; } }); -Object.defineProperty(exports, "CancellationToken", { enumerable: true, get: function () { return cancellation_1.CancellationToken; } }); -const messageReader_1 = require("../common/messageReader"); -Object.defineProperty(exports, "MessageReader", { enumerable: true, get: function () { return messageReader_1.MessageReader; } }); -Object.defineProperty(exports, "AbstractMessageReader", { enumerable: true, get: function () { return messageReader_1.AbstractMessageReader; } }); -Object.defineProperty(exports, "ReadableStreamMessageReader", { enumerable: true, get: function () { return messageReader_1.ReadableStreamMessageReader; } }); -const messageWriter_1 = require("../common/messageWriter"); -Object.defineProperty(exports, "MessageWriter", { enumerable: true, get: function () { return messageWriter_1.MessageWriter; } }); -Object.defineProperty(exports, "AbstractMessageWriter", { enumerable: true, get: function () { return messageWriter_1.AbstractMessageWriter; } }); -Object.defineProperty(exports, "WriteableStreamMessageWriter", { enumerable: true, get: function () { return messageWriter_1.WriteableStreamMessageWriter; } }); -const connection_1 = require("../common/connection"); -Object.defineProperty(exports, "ConnectionStrategy", { enumerable: true, get: function () { return connection_1.ConnectionStrategy; } }); -Object.defineProperty(exports, "ConnectionOptions", { enumerable: true, get: function () { return connection_1.ConnectionOptions; } }); -Object.defineProperty(exports, "NullLogger", { enumerable: true, get: function () { return connection_1.NullLogger; } }); -Object.defineProperty(exports, "createMessageConnection", { enumerable: true, get: function () { return connection_1.createMessageConnection; } }); -Object.defineProperty(exports, "ProgressType", { enumerable: true, get: function () { return connection_1.ProgressType; } }); -Object.defineProperty(exports, "Trace", { enumerable: true, get: function () { return connection_1.Trace; } }); -Object.defineProperty(exports, "TraceFormat", { enumerable: true, get: function () { return connection_1.TraceFormat; } }); -Object.defineProperty(exports, "SetTraceNotification", { enumerable: true, get: function () { return connection_1.SetTraceNotification; } }); -Object.defineProperty(exports, "LogTraceNotification", { enumerable: true, get: function () { return connection_1.LogTraceNotification; } }); -Object.defineProperty(exports, "ConnectionErrors", { enumerable: true, get: function () { return connection_1.ConnectionErrors; } }); -Object.defineProperty(exports, "ConnectionError", { enumerable: true, get: function () { return connection_1.ConnectionError; } }); -Object.defineProperty(exports, "CancellationReceiverStrategy", { enumerable: true, get: function () { return connection_1.CancellationReceiverStrategy; } }); -Object.defineProperty(exports, "CancellationSenderStrategy", { enumerable: true, get: function () { return connection_1.CancellationSenderStrategy; } }); -Object.defineProperty(exports, "CancellationStrategy", { enumerable: true, get: function () { return connection_1.CancellationStrategy; } }); -const ral_1 = require("./ral"); -exports.RAL = ral_1.default; -//# sourceMappingURL=api.js.map \ No newline at end of file diff --git a/server/node_modules/vscode-languageserver-protocol/node_modules/vscode-jsonrpc/lib/common/cancellation.js b/server/node_modules/vscode-languageserver-protocol/node_modules/vscode-jsonrpc/lib/common/cancellation.js deleted file mode 100644 index 64f2c14..0000000 --- a/server/node_modules/vscode-languageserver-protocol/node_modules/vscode-jsonrpc/lib/common/cancellation.js +++ /dev/null @@ -1,97 +0,0 @@ -"use strict"; -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.CancellationTokenSource = exports.CancellationToken = void 0; -const ral_1 = require("./ral"); -const Is = require("./is"); -const events_1 = require("./events"); -var CancellationToken; -(function (CancellationToken) { - CancellationToken.None = Object.freeze({ - isCancellationRequested: false, - onCancellationRequested: events_1.Event.None - }); - CancellationToken.Cancelled = Object.freeze({ - isCancellationRequested: true, - onCancellationRequested: events_1.Event.None - }); - function is(value) { - const candidate = value; - return candidate && (candidate === CancellationToken.None - || candidate === CancellationToken.Cancelled - || (Is.boolean(candidate.isCancellationRequested) && !!candidate.onCancellationRequested)); - } - CancellationToken.is = is; -})(CancellationToken = exports.CancellationToken || (exports.CancellationToken = {})); -const shortcutEvent = Object.freeze(function (callback, context) { - const handle = ral_1.default().timer.setTimeout(callback.bind(context), 0); - return { dispose() { ral_1.default().timer.clearTimeout(handle); } }; -}); -class MutableToken { - constructor() { - this._isCancelled = false; - } - cancel() { - if (!this._isCancelled) { - this._isCancelled = true; - if (this._emitter) { - this._emitter.fire(undefined); - this.dispose(); - } - } - } - get isCancellationRequested() { - return this._isCancelled; - } - get onCancellationRequested() { - if (this._isCancelled) { - return shortcutEvent; - } - if (!this._emitter) { - this._emitter = new events_1.Emitter(); - } - return this._emitter.event; - } - dispose() { - if (this._emitter) { - this._emitter.dispose(); - this._emitter = undefined; - } - } -} -class CancellationTokenSource { - get token() { - if (!this._token) { - // be lazy and create the token only when - // actually needed - this._token = new MutableToken(); - } - return this._token; - } - cancel() { - if (!this._token) { - // save an object by returning the default - // cancelled token when cancellation happens - // before someone asks for the token - this._token = CancellationToken.Cancelled; - } - else { - this._token.cancel(); - } - } - dispose() { - if (!this._token) { - // ensure to initialize with an empty token if we had none - this._token = CancellationToken.None; - } - else if (this._token instanceof MutableToken) { - // actually dispose - this._token.dispose(); - } - } -} -exports.CancellationTokenSource = CancellationTokenSource; -//# sourceMappingURL=cancellation.js.map \ No newline at end of file diff --git a/server/node_modules/vscode-languageserver-protocol/node_modules/vscode-jsonrpc/lib/common/connection.js b/server/node_modules/vscode-languageserver-protocol/node_modules/vscode-jsonrpc/lib/common/connection.js deleted file mode 100644 index c47fe73..0000000 --- a/server/node_modules/vscode-languageserver-protocol/node_modules/vscode-jsonrpc/lib/common/connection.js +++ /dev/null @@ -1,1088 +0,0 @@ -"use strict"; -/* -------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * ------------------------------------------------------------------------------------------ */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.createMessageConnection = exports.ConnectionOptions = exports.CancellationStrategy = exports.CancellationSenderStrategy = exports.CancellationReceiverStrategy = exports.ConnectionStrategy = exports.ConnectionError = exports.ConnectionErrors = exports.LogTraceNotification = exports.SetTraceNotification = exports.TraceFormat = exports.Trace = exports.NullLogger = exports.ProgressType = void 0; -const ral_1 = require("./ral"); -const Is = require("./is"); -const messages_1 = require("./messages"); -const linkedMap_1 = require("./linkedMap"); -const events_1 = require("./events"); -const cancellation_1 = require("./cancellation"); -var CancelNotification; -(function (CancelNotification) { - CancelNotification.type = new messages_1.NotificationType('$/cancelRequest'); -})(CancelNotification || (CancelNotification = {})); -var ProgressNotification; -(function (ProgressNotification) { - ProgressNotification.type = new messages_1.NotificationType('$/progress'); -})(ProgressNotification || (ProgressNotification = {})); -class ProgressType { - constructor() { - } -} -exports.ProgressType = ProgressType; -var StarRequestHandler; -(function (StarRequestHandler) { - function is(value) { - return Is.func(value); - } - StarRequestHandler.is = is; -})(StarRequestHandler || (StarRequestHandler = {})); -exports.NullLogger = Object.freeze({ - error: () => { }, - warn: () => { }, - info: () => { }, - log: () => { } -}); -var Trace; -(function (Trace) { - Trace[Trace["Off"] = 0] = "Off"; - Trace[Trace["Messages"] = 1] = "Messages"; - Trace[Trace["Verbose"] = 2] = "Verbose"; -})(Trace = exports.Trace || (exports.Trace = {})); -(function (Trace) { - function fromString(value) { - if (!Is.string(value)) { - return Trace.Off; - } - value = value.toLowerCase(); - switch (value) { - case 'off': - return Trace.Off; - case 'messages': - return Trace.Messages; - case 'verbose': - return Trace.Verbose; - default: - return Trace.Off; - } - } - Trace.fromString = fromString; - function toString(value) { - switch (value) { - case Trace.Off: - return 'off'; - case Trace.Messages: - return 'messages'; - case Trace.Verbose: - return 'verbose'; - default: - return 'off'; - } - } - Trace.toString = toString; -})(Trace = exports.Trace || (exports.Trace = {})); -var TraceFormat; -(function (TraceFormat) { - TraceFormat["Text"] = "text"; - TraceFormat["JSON"] = "json"; -})(TraceFormat = exports.TraceFormat || (exports.TraceFormat = {})); -(function (TraceFormat) { - function fromString(value) { - value = value.toLowerCase(); - if (value === 'json') { - return TraceFormat.JSON; - } - else { - return TraceFormat.Text; - } - } - TraceFormat.fromString = fromString; -})(TraceFormat = exports.TraceFormat || (exports.TraceFormat = {})); -var SetTraceNotification; -(function (SetTraceNotification) { - SetTraceNotification.type = new messages_1.NotificationType('$/setTrace'); -})(SetTraceNotification = exports.SetTraceNotification || (exports.SetTraceNotification = {})); -var LogTraceNotification; -(function (LogTraceNotification) { - LogTraceNotification.type = new messages_1.NotificationType('$/logTrace'); -})(LogTraceNotification = exports.LogTraceNotification || (exports.LogTraceNotification = {})); -var ConnectionErrors; -(function (ConnectionErrors) { - /** - * The connection is closed. - */ - ConnectionErrors[ConnectionErrors["Closed"] = 1] = "Closed"; - /** - * The connection got disposed. - */ - ConnectionErrors[ConnectionErrors["Disposed"] = 2] = "Disposed"; - /** - * The connection is already in listening mode. - */ - ConnectionErrors[ConnectionErrors["AlreadyListening"] = 3] = "AlreadyListening"; -})(ConnectionErrors = exports.ConnectionErrors || (exports.ConnectionErrors = {})); -class ConnectionError extends Error { - constructor(code, message) { - super(message); - this.code = code; - Object.setPrototypeOf(this, ConnectionError.prototype); - } -} -exports.ConnectionError = ConnectionError; -var ConnectionStrategy; -(function (ConnectionStrategy) { - function is(value) { - const candidate = value; - return candidate && Is.func(candidate.cancelUndispatched); - } - ConnectionStrategy.is = is; -})(ConnectionStrategy = exports.ConnectionStrategy || (exports.ConnectionStrategy = {})); -var CancellationReceiverStrategy; -(function (CancellationReceiverStrategy) { - CancellationReceiverStrategy.Message = Object.freeze({ - createCancellationTokenSource(_) { - return new cancellation_1.CancellationTokenSource(); - } - }); - function is(value) { - const candidate = value; - return candidate && Is.func(candidate.createCancellationTokenSource); - } - CancellationReceiverStrategy.is = is; -})(CancellationReceiverStrategy = exports.CancellationReceiverStrategy || (exports.CancellationReceiverStrategy = {})); -var CancellationSenderStrategy; -(function (CancellationSenderStrategy) { - CancellationSenderStrategy.Message = Object.freeze({ - sendCancellation(conn, id) { - conn.sendNotification(CancelNotification.type, { id }); - }, - cleanup(_) { } - }); - function is(value) { - const candidate = value; - return candidate && Is.func(candidate.sendCancellation) && Is.func(candidate.cleanup); - } - CancellationSenderStrategy.is = is; -})(CancellationSenderStrategy = exports.CancellationSenderStrategy || (exports.CancellationSenderStrategy = {})); -var CancellationStrategy; -(function (CancellationStrategy) { - CancellationStrategy.Message = Object.freeze({ - receiver: CancellationReceiverStrategy.Message, - sender: CancellationSenderStrategy.Message - }); - function is(value) { - const candidate = value; - return candidate && CancellationReceiverStrategy.is(candidate.receiver) && CancellationSenderStrategy.is(candidate.sender); - } - CancellationStrategy.is = is; -})(CancellationStrategy = exports.CancellationStrategy || (exports.CancellationStrategy = {})); -var ConnectionOptions; -(function (ConnectionOptions) { - function is(value) { - const candidate = value; - return candidate && (CancellationStrategy.is(candidate.cancellationStrategy) || ConnectionStrategy.is(candidate.connectionStrategy)); - } - ConnectionOptions.is = is; -})(ConnectionOptions = exports.ConnectionOptions || (exports.ConnectionOptions = {})); -var ConnectionState; -(function (ConnectionState) { - ConnectionState[ConnectionState["New"] = 1] = "New"; - ConnectionState[ConnectionState["Listening"] = 2] = "Listening"; - ConnectionState[ConnectionState["Closed"] = 3] = "Closed"; - ConnectionState[ConnectionState["Disposed"] = 4] = "Disposed"; -})(ConnectionState || (ConnectionState = {})); -function createMessageConnection(messageReader, messageWriter, _logger, options) { - const logger = _logger !== undefined ? _logger : exports.NullLogger; - let sequenceNumber = 0; - let notificationSquenceNumber = 0; - let unknownResponseSquenceNumber = 0; - const version = '2.0'; - let starRequestHandler = undefined; - const requestHandlers = Object.create(null); - let starNotificationHandler = undefined; - const notificationHandlers = Object.create(null); - const progressHandlers = new Map(); - let timer; - let messageQueue = new linkedMap_1.LinkedMap(); - let responsePromises = Object.create(null); - let requestTokens = Object.create(null); - let trace = Trace.Off; - let traceFormat = TraceFormat.Text; - let tracer; - let state = ConnectionState.New; - const errorEmitter = new events_1.Emitter(); - const closeEmitter = new events_1.Emitter(); - const unhandledNotificationEmitter = new events_1.Emitter(); - const unhandledProgressEmitter = new events_1.Emitter(); - const disposeEmitter = new events_1.Emitter(); - const cancellationStrategy = (options && options.cancellationStrategy) ? options.cancellationStrategy : CancellationStrategy.Message; - function createRequestQueueKey(id) { - if (id === null) { - throw new Error(`Can't send requests with id null since the response can't be correlated.`); - } - return 'req-' + id.toString(); - } - function createResponseQueueKey(id) { - if (id === null) { - return 'res-unknown-' + (++unknownResponseSquenceNumber).toString(); - } - else { - return 'res-' + id.toString(); - } - } - function createNotificationQueueKey() { - return 'not-' + (++notificationSquenceNumber).toString(); - } - function addMessageToQueue(queue, message) { - if (messages_1.isRequestMessage(message)) { - queue.set(createRequestQueueKey(message.id), message); - } - else if (messages_1.isResponseMessage(message)) { - queue.set(createResponseQueueKey(message.id), message); - } - else { - queue.set(createNotificationQueueKey(), message); - } - } - function cancelUndispatched(_message) { - return undefined; - } - function isListening() { - return state === ConnectionState.Listening; - } - function isClosed() { - return state === ConnectionState.Closed; - } - function isDisposed() { - return state === ConnectionState.Disposed; - } - function closeHandler() { - if (state === ConnectionState.New || state === ConnectionState.Listening) { - state = ConnectionState.Closed; - closeEmitter.fire(undefined); - } - // If the connection is disposed don't sent close events. - } - function readErrorHandler(error) { - errorEmitter.fire([error, undefined, undefined]); - } - function writeErrorHandler(data) { - errorEmitter.fire(data); - } - messageReader.onClose(closeHandler); - messageReader.onError(readErrorHandler); - messageWriter.onClose(closeHandler); - messageWriter.onError(writeErrorHandler); - function triggerMessageQueue() { - if (timer || messageQueue.size === 0) { - return; - } - timer = ral_1.default().timer.setImmediate(() => { - timer = undefined; - processMessageQueue(); - }); - } - function processMessageQueue() { - if (messageQueue.size === 0) { - return; - } - const message = messageQueue.shift(); - try { - if (messages_1.isRequestMessage(message)) { - handleRequest(message); - } - else if (messages_1.isNotificationMessage(message)) { - handleNotification(message); - } - else if (messages_1.isResponseMessage(message)) { - handleResponse(message); - } - else { - handleInvalidMessage(message); - } - } - finally { - triggerMessageQueue(); - } - } - const callback = (message) => { - try { - // We have received a cancellation message. Check if the message is still in the queue - // and cancel it if allowed to do so. - if (messages_1.isNotificationMessage(message) && message.method === CancelNotification.type.method) { - const key = createRequestQueueKey(message.params.id); - const toCancel = messageQueue.get(key); - if (messages_1.isRequestMessage(toCancel)) { - const strategy = options === null || options === void 0 ? void 0 : options.connectionStrategy; - const response = (strategy && strategy.cancelUndispatched) ? strategy.cancelUndispatched(toCancel, cancelUndispatched) : cancelUndispatched(toCancel); - if (response && (response.error !== undefined || response.result !== undefined)) { - messageQueue.delete(key); - response.id = toCancel.id; - traceSendingResponse(response, message.method, Date.now()); - messageWriter.write(response); - return; - } - } - } - addMessageToQueue(messageQueue, message); - } - finally { - triggerMessageQueue(); - } - }; - function handleRequest(requestMessage) { - if (isDisposed()) { - // we return here silently since we fired an event when the - // connection got disposed. - return; - } - function reply(resultOrError, method, startTime) { - const message = { - jsonrpc: version, - id: requestMessage.id - }; - if (resultOrError instanceof messages_1.ResponseError) { - message.error = resultOrError.toJson(); - } - else { - message.result = resultOrError === undefined ? null : resultOrError; - } - traceSendingResponse(message, method, startTime); - messageWriter.write(message); - } - function replyError(error, method, startTime) { - const message = { - jsonrpc: version, - id: requestMessage.id, - error: error.toJson() - }; - traceSendingResponse(message, method, startTime); - messageWriter.write(message); - } - function replySuccess(result, method, startTime) { - // The JSON RPC defines that a response must either have a result or an error - // So we can't treat undefined as a valid response result. - if (result === undefined) { - result = null; - } - const message = { - jsonrpc: version, - id: requestMessage.id, - result: result - }; - traceSendingResponse(message, method, startTime); - messageWriter.write(message); - } - traceReceivedRequest(requestMessage); - const element = requestHandlers[requestMessage.method]; - let type; - let requestHandler; - if (element) { - type = element.type; - requestHandler = element.handler; - } - const startTime = Date.now(); - if (requestHandler || starRequestHandler) { - const tokenKey = String(requestMessage.id); - const cancellationSource = cancellationStrategy.receiver.createCancellationTokenSource(tokenKey); - requestTokens[tokenKey] = cancellationSource; - try { - let handlerResult; - if (requestHandler) { - if (requestMessage.params === undefined) { - if (type !== undefined && type.numberOfParams !== 0) { - replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InvalidParams, `Request ${requestMessage.method} defines ${type.numberOfParams} params but recevied none.`), requestMessage.method, startTime); - return; - } - handlerResult = requestHandler(cancellationSource.token); - } - else if (Array.isArray(requestMessage.params)) { - if (type !== undefined && type.parameterStructures === messages_1.ParameterStructures.byName) { - replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InvalidParams, `Request ${requestMessage.method} defines parameters by name but received parameters by position`), requestMessage.method, startTime); - return; - } - handlerResult = requestHandler(...requestMessage.params, cancellationSource.token); - } - else { - if (type !== undefined && type.parameterStructures === messages_1.ParameterStructures.byPosition) { - replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InvalidParams, `Request ${requestMessage.method} defines parameters by position but received parameters by name`), requestMessage.method, startTime); - return; - } - handlerResult = requestHandler(requestMessage.params, cancellationSource.token); - } - } - else if (starRequestHandler) { - handlerResult = starRequestHandler(requestMessage.method, requestMessage.params, cancellationSource.token); - } - const promise = handlerResult; - if (!handlerResult) { - delete requestTokens[tokenKey]; - replySuccess(handlerResult, requestMessage.method, startTime); - } - else if (promise.then) { - promise.then((resultOrError) => { - delete requestTokens[tokenKey]; - reply(resultOrError, requestMessage.method, startTime); - }, error => { - delete requestTokens[tokenKey]; - if (error instanceof messages_1.ResponseError) { - replyError(error, requestMessage.method, startTime); - } - else if (error && Is.string(error.message)) { - replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed with message: ${error.message}`), requestMessage.method, startTime); - } - else { - replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed unexpectedly without providing any details.`), requestMessage.method, startTime); - } - }); - } - else { - delete requestTokens[tokenKey]; - reply(handlerResult, requestMessage.method, startTime); - } - } - catch (error) { - delete requestTokens[tokenKey]; - if (error instanceof messages_1.ResponseError) { - reply(error, requestMessage.method, startTime); - } - else if (error && Is.string(error.message)) { - replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed with message: ${error.message}`), requestMessage.method, startTime); - } - else { - replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed unexpectedly without providing any details.`), requestMessage.method, startTime); - } - } - } - else { - replyError(new messages_1.ResponseError(messages_1.ErrorCodes.MethodNotFound, `Unhandled method ${requestMessage.method}`), requestMessage.method, startTime); - } - } - function handleResponse(responseMessage) { - if (isDisposed()) { - // See handle request. - return; - } - if (responseMessage.id === null) { - if (responseMessage.error) { - logger.error(`Received response message without id: Error is: \n${JSON.stringify(responseMessage.error, undefined, 4)}`); - } - else { - logger.error(`Received response message without id. No further error information provided.`); - } - } - else { - const key = String(responseMessage.id); - const responsePromise = responsePromises[key]; - traceReceivedResponse(responseMessage, responsePromise); - if (responsePromise) { - delete responsePromises[key]; - try { - if (responseMessage.error) { - const error = responseMessage.error; - responsePromise.reject(new messages_1.ResponseError(error.code, error.message, error.data)); - } - else if (responseMessage.result !== undefined) { - responsePromise.resolve(responseMessage.result); - } - else { - throw new Error('Should never happen.'); - } - } - catch (error) { - if (error.message) { - logger.error(`Response handler '${responsePromise.method}' failed with message: ${error.message}`); - } - else { - logger.error(`Response handler '${responsePromise.method}' failed unexpectedly.`); - } - } - } - } - } - function handleNotification(message) { - if (isDisposed()) { - // See handle request. - return; - } - let type = undefined; - let notificationHandler; - if (message.method === CancelNotification.type.method) { - notificationHandler = (params) => { - const id = params.id; - const source = requestTokens[String(id)]; - if (source) { - source.cancel(); - } - }; - } - else { - const element = notificationHandlers[message.method]; - if (element) { - notificationHandler = element.handler; - type = element.type; - } - } - if (notificationHandler || starNotificationHandler) { - try { - traceReceivedNotification(message); - if (notificationHandler) { - if (message.params === undefined) { - if (type !== undefined) { - if (type.numberOfParams !== 0 && type.parameterStructures !== messages_1.ParameterStructures.byName) { - logger.error(`Notification ${message.method} defines ${type.numberOfParams} params but recevied none.`); - } - } - notificationHandler(); - } - else if (Array.isArray(message.params)) { - if (type !== undefined) { - if (type.parameterStructures === messages_1.ParameterStructures.byName) { - logger.error(`Notification ${message.method} defines parameters by name but received parameters by position`); - } - if (type.numberOfParams !== message.params.length) { - logger.error(`Notification ${message.method} defines ${type.numberOfParams} params but received ${message.params.length} argumennts`); - } - } - notificationHandler(...message.params); - } - else { - if (type !== undefined && type.parameterStructures === messages_1.ParameterStructures.byPosition) { - logger.error(`Notification ${message.method} defines parameters by position but received parameters by name`); - } - notificationHandler(message.params); - } - } - else if (starNotificationHandler) { - starNotificationHandler(message.method, message.params); - } - } - catch (error) { - if (error.message) { - logger.error(`Notification handler '${message.method}' failed with message: ${error.message}`); - } - else { - logger.error(`Notification handler '${message.method}' failed unexpectedly.`); - } - } - } - else { - unhandledNotificationEmitter.fire(message); - } - } - function handleInvalidMessage(message) { - if (!message) { - logger.error('Received empty message.'); - return; - } - logger.error(`Received message which is neither a response nor a notification message:\n${JSON.stringify(message, null, 4)}`); - // Test whether we find an id to reject the promise - const responseMessage = message; - if (Is.string(responseMessage.id) || Is.number(responseMessage.id)) { - const key = String(responseMessage.id); - const responseHandler = responsePromises[key]; - if (responseHandler) { - responseHandler.reject(new Error('The received response has neither a result nor an error property.')); - } - } - } - function traceSendingRequest(message) { - if (trace === Trace.Off || !tracer) { - return; - } - if (traceFormat === TraceFormat.Text) { - let data = undefined; - if (trace === Trace.Verbose && message.params) { - data = `Params: ${JSON.stringify(message.params, null, 4)}\n\n`; - } - tracer.log(`Sending request '${message.method} - (${message.id})'.`, data); - } - else { - logLSPMessage('send-request', message); - } - } - function traceSendingNotification(message) { - if (trace === Trace.Off || !tracer) { - return; - } - if (traceFormat === TraceFormat.Text) { - let data = undefined; - if (trace === Trace.Verbose) { - if (message.params) { - data = `Params: ${JSON.stringify(message.params, null, 4)}\n\n`; - } - else { - data = 'No parameters provided.\n\n'; - } - } - tracer.log(`Sending notification '${message.method}'.`, data); - } - else { - logLSPMessage('send-notification', message); - } - } - function traceSendingResponse(message, method, startTime) { - if (trace === Trace.Off || !tracer) { - return; - } - if (traceFormat === TraceFormat.Text) { - let data = undefined; - if (trace === Trace.Verbose) { - if (message.error && message.error.data) { - data = `Error data: ${JSON.stringify(message.error.data, null, 4)}\n\n`; - } - else { - if (message.result) { - data = `Result: ${JSON.stringify(message.result, null, 4)}\n\n`; - } - else if (message.error === undefined) { - data = 'No result returned.\n\n'; - } - } - } - tracer.log(`Sending response '${method} - (${message.id})'. Processing request took ${Date.now() - startTime}ms`, data); - } - else { - logLSPMessage('send-response', message); - } - } - function traceReceivedRequest(message) { - if (trace === Trace.Off || !tracer) { - return; - } - if (traceFormat === TraceFormat.Text) { - let data = undefined; - if (trace === Trace.Verbose && message.params) { - data = `Params: ${JSON.stringify(message.params, null, 4)}\n\n`; - } - tracer.log(`Received request '${message.method} - (${message.id})'.`, data); - } - else { - logLSPMessage('receive-request', message); - } - } - function traceReceivedNotification(message) { - if (trace === Trace.Off || !tracer || message.method === LogTraceNotification.type.method) { - return; - } - if (traceFormat === TraceFormat.Text) { - let data = undefined; - if (trace === Trace.Verbose) { - if (message.params) { - data = `Params: ${JSON.stringify(message.params, null, 4)}\n\n`; - } - else { - data = 'No parameters provided.\n\n'; - } - } - tracer.log(`Received notification '${message.method}'.`, data); - } - else { - logLSPMessage('receive-notification', message); - } - } - function traceReceivedResponse(message, responsePromise) { - if (trace === Trace.Off || !tracer) { - return; - } - if (traceFormat === TraceFormat.Text) { - let data = undefined; - if (trace === Trace.Verbose) { - if (message.error && message.error.data) { - data = `Error data: ${JSON.stringify(message.error.data, null, 4)}\n\n`; - } - else { - if (message.result) { - data = `Result: ${JSON.stringify(message.result, null, 4)}\n\n`; - } - else if (message.error === undefined) { - data = 'No result returned.\n\n'; - } - } - } - if (responsePromise) { - const error = message.error ? ` Request failed: ${message.error.message} (${message.error.code}).` : ''; - tracer.log(`Received response '${responsePromise.method} - (${message.id})' in ${Date.now() - responsePromise.timerStart}ms.${error}`, data); - } - else { - tracer.log(`Received response ${message.id} without active response promise.`, data); - } - } - else { - logLSPMessage('receive-response', message); - } - } - function logLSPMessage(type, message) { - if (!tracer || trace === Trace.Off) { - return; - } - const lspMessage = { - isLSPMessage: true, - type, - message, - timestamp: Date.now() - }; - tracer.log(lspMessage); - } - function throwIfClosedOrDisposed() { - if (isClosed()) { - throw new ConnectionError(ConnectionErrors.Closed, 'Connection is closed.'); - } - if (isDisposed()) { - throw new ConnectionError(ConnectionErrors.Disposed, 'Connection is disposed.'); - } - } - function throwIfListening() { - if (isListening()) { - throw new ConnectionError(ConnectionErrors.AlreadyListening, 'Connection is already listening'); - } - } - function throwIfNotListening() { - if (!isListening()) { - throw new Error('Call listen() first.'); - } - } - function undefinedToNull(param) { - if (param === undefined) { - return null; - } - else { - return param; - } - } - function nullToUndefined(param) { - if (param === null) { - return undefined; - } - else { - return param; - } - } - function isNamedParam(param) { - return param !== undefined && param !== null && !Array.isArray(param) && typeof param === 'object'; - } - function computeSingleParam(parameterStructures, param) { - switch (parameterStructures) { - case messages_1.ParameterStructures.auto: - if (isNamedParam(param)) { - return nullToUndefined(param); - } - else { - return [undefinedToNull(param)]; - } - break; - case messages_1.ParameterStructures.byName: - if (!isNamedParam(param)) { - throw new Error(`Recevied parameters by name but param is not an object literal.`); - } - return nullToUndefined(param); - case messages_1.ParameterStructures.byPosition: - return [undefinedToNull(param)]; - default: - throw new Error(`Unknown parameter structure ${parameterStructures.toString()}`); - } - } - function computeMessageParams(type, params) { - let result; - const numberOfParams = type.numberOfParams; - switch (numberOfParams) { - case 0: - result = undefined; - break; - case 1: - result = computeSingleParam(type.parameterStructures, params[0]); - break; - default: - result = []; - for (let i = 0; i < params.length && i < numberOfParams; i++) { - result.push(undefinedToNull(params[i])); - } - if (params.length < numberOfParams) { - for (let i = params.length; i < numberOfParams; i++) { - result.push(null); - } - } - break; - } - return result; - } - const connection = { - sendNotification: (type, ...args) => { - throwIfClosedOrDisposed(); - let method; - let messageParams; - if (Is.string(type)) { - method = type; - const first = args[0]; - let paramStart = 0; - let parameterStructures = messages_1.ParameterStructures.auto; - if (messages_1.ParameterStructures.is(first)) { - paramStart = 1; - parameterStructures = first; - } - let paramEnd = args.length; - const numberOfParams = paramEnd - paramStart; - switch (numberOfParams) { - case 0: - messageParams = undefined; - break; - case 1: - messageParams = computeSingleParam(parameterStructures, args[paramStart]); - break; - default: - if (parameterStructures === messages_1.ParameterStructures.byName) { - throw new Error(`Recevied ${numberOfParams} parameters for 'by Name' notification parameter structure.`); - } - messageParams = args.slice(paramStart, paramEnd).map(value => undefinedToNull(value)); - break; - } - } - else { - const params = args; - method = type.method; - messageParams = computeMessageParams(type, params); - } - const notificationMessage = { - jsonrpc: version, - method: method, - params: messageParams - }; - traceSendingNotification(notificationMessage); - messageWriter.write(notificationMessage); - }, - onNotification: (type, handler) => { - throwIfClosedOrDisposed(); - let method; - if (Is.func(type)) { - starNotificationHandler = type; - } - else if (handler) { - if (Is.string(type)) { - method = type; - notificationHandlers[type] = { type: undefined, handler }; - } - else { - method = type.method; - notificationHandlers[type.method] = { type, handler }; - } - } - return { - dispose: () => { - if (method !== undefined) { - delete notificationHandlers[method]; - } - else { - starNotificationHandler = undefined; - } - } - }; - }, - onProgress: (_type, token, handler) => { - if (progressHandlers.has(token)) { - throw new Error(`Progress handler for token ${token} already registered`); - } - progressHandlers.set(token, handler); - return { - dispose: () => { - progressHandlers.delete(token); - } - }; - }, - sendProgress: (_type, token, value) => { - connection.sendNotification(ProgressNotification.type, { token, value }); - }, - onUnhandledProgress: unhandledProgressEmitter.event, - sendRequest: (type, ...args) => { - throwIfClosedOrDisposed(); - throwIfNotListening(); - let method; - let messageParams; - let token = undefined; - if (Is.string(type)) { - method = type; - const first = args[0]; - const last = args[args.length - 1]; - let paramStart = 0; - let parameterStructures = messages_1.ParameterStructures.auto; - if (messages_1.ParameterStructures.is(first)) { - paramStart = 1; - parameterStructures = first; - } - let paramEnd = args.length; - if (cancellation_1.CancellationToken.is(last)) { - paramEnd = paramEnd - 1; - token = last; - } - const numberOfParams = paramEnd - paramStart; - switch (numberOfParams) { - case 0: - messageParams = undefined; - break; - case 1: - messageParams = computeSingleParam(parameterStructures, args[paramStart]); - break; - default: - if (parameterStructures === messages_1.ParameterStructures.byName) { - throw new Error(`Recevied ${numberOfParams} parameters for 'by Name' request parameter structure.`); - } - messageParams = args.slice(paramStart, paramEnd).map(value => undefinedToNull(value)); - break; - } - } - else { - const params = args; - method = type.method; - messageParams = computeMessageParams(type, params); - const numberOfParams = type.numberOfParams; - token = cancellation_1.CancellationToken.is(params[numberOfParams]) ? params[numberOfParams] : undefined; - } - const id = sequenceNumber++; - let disposable; - if (token) { - disposable = token.onCancellationRequested(() => { - cancellationStrategy.sender.sendCancellation(connection, id); - }); - } - const result = new Promise((resolve, reject) => { - const requestMessage = { - jsonrpc: version, - id: id, - method: method, - params: messageParams - }; - const resolveWithCleanup = (r) => { - resolve(r); - cancellationStrategy.sender.cleanup(id); - disposable === null || disposable === void 0 ? void 0 : disposable.dispose(); - }; - const rejectWithCleanup = (r) => { - reject(r); - cancellationStrategy.sender.cleanup(id); - disposable === null || disposable === void 0 ? void 0 : disposable.dispose(); - }; - let responsePromise = { method: method, timerStart: Date.now(), resolve: resolveWithCleanup, reject: rejectWithCleanup }; - traceSendingRequest(requestMessage); - try { - messageWriter.write(requestMessage); - } - catch (e) { - // Writing the message failed. So we need to reject the promise. - responsePromise.reject(new messages_1.ResponseError(messages_1.ErrorCodes.MessageWriteError, e.message ? e.message : 'Unknown reason')); - responsePromise = null; - } - if (responsePromise) { - responsePromises[String(id)] = responsePromise; - } - }); - return result; - }, - onRequest: (type, handler) => { - throwIfClosedOrDisposed(); - let method = null; - if (StarRequestHandler.is(type)) { - method = undefined; - starRequestHandler = type; - } - else if (Is.string(type)) { - method = null; - if (handler !== undefined) { - method = type; - requestHandlers[type] = { handler: handler, type: undefined }; - } - } - else { - if (handler !== undefined) { - method = type.method; - requestHandlers[type.method] = { type, handler }; - } - } - return { - dispose: () => { - if (method === null) { - return; - } - if (method !== undefined) { - delete requestHandlers[method]; - } - else { - starRequestHandler = undefined; - } - } - }; - }, - trace: (_value, _tracer, sendNotificationOrTraceOptions) => { - let _sendNotification = false; - let _traceFormat = TraceFormat.Text; - if (sendNotificationOrTraceOptions !== undefined) { - if (Is.boolean(sendNotificationOrTraceOptions)) { - _sendNotification = sendNotificationOrTraceOptions; - } - else { - _sendNotification = sendNotificationOrTraceOptions.sendNotification || false; - _traceFormat = sendNotificationOrTraceOptions.traceFormat || TraceFormat.Text; - } - } - trace = _value; - traceFormat = _traceFormat; - if (trace === Trace.Off) { - tracer = undefined; - } - else { - tracer = _tracer; - } - if (_sendNotification && !isClosed() && !isDisposed()) { - connection.sendNotification(SetTraceNotification.type, { value: Trace.toString(_value) }); - } - }, - onError: errorEmitter.event, - onClose: closeEmitter.event, - onUnhandledNotification: unhandledNotificationEmitter.event, - onDispose: disposeEmitter.event, - end: () => { - messageWriter.end(); - }, - dispose: () => { - if (isDisposed()) { - return; - } - state = ConnectionState.Disposed; - disposeEmitter.fire(undefined); - const error = new Error('Connection got disposed.'); - Object.keys(responsePromises).forEach((key) => { - responsePromises[key].reject(error); - }); - responsePromises = Object.create(null); - requestTokens = Object.create(null); - messageQueue = new linkedMap_1.LinkedMap(); - // Test for backwards compatibility - if (Is.func(messageWriter.dispose)) { - messageWriter.dispose(); - } - if (Is.func(messageReader.dispose)) { - messageReader.dispose(); - } - }, - listen: () => { - throwIfClosedOrDisposed(); - throwIfListening(); - state = ConnectionState.Listening; - messageReader.listen(callback); - }, - inspect: () => { - // eslint-disable-next-line no-console - ral_1.default().console.log('inspect'); - } - }; - connection.onNotification(LogTraceNotification.type, (params) => { - if (trace === Trace.Off || !tracer) { - return; - } - tracer.log(params.message, trace === Trace.Verbose ? params.verbose : undefined); - }); - connection.onNotification(ProgressNotification.type, (params) => { - const handler = progressHandlers.get(params.token); - if (handler) { - handler(params.value); - } - else { - unhandledProgressEmitter.fire(params); - } - }); - return connection; -} -exports.createMessageConnection = createMessageConnection; -//# sourceMappingURL=connection.js.map \ No newline at end of file diff --git a/server/node_modules/vscode-languageserver-protocol/node_modules/vscode-jsonrpc/lib/common/disposable.js b/server/node_modules/vscode-languageserver-protocol/node_modules/vscode-jsonrpc/lib/common/disposable.js deleted file mode 100644 index 99c386e..0000000 --- a/server/node_modules/vscode-languageserver-protocol/node_modules/vscode-jsonrpc/lib/common/disposable.js +++ /dev/null @@ -1,17 +0,0 @@ -"use strict"; -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Disposable = void 0; -var Disposable; -(function (Disposable) { - function create(func) { - return { - dispose: func - }; - } - Disposable.create = create; -})(Disposable = exports.Disposable || (exports.Disposable = {})); -//# sourceMappingURL=disposable.js.map \ No newline at end of file diff --git a/server/node_modules/vscode-languageserver-protocol/node_modules/vscode-jsonrpc/lib/common/encoding.js b/server/node_modules/vscode-languageserver-protocol/node_modules/vscode-jsonrpc/lib/common/encoding.js deleted file mode 100644 index f3931ef..0000000 --- a/server/node_modules/vscode-languageserver-protocol/node_modules/vscode-jsonrpc/lib/common/encoding.js +++ /dev/null @@ -1,71 +0,0 @@ -"use strict"; -/* -------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * ------------------------------------------------------------------------------------------ */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Encodings = void 0; -var Encodings; -(function (Encodings) { - function getEncodingHeaderValue(encodings) { - if (encodings.length === 1) { - return encodings[0].name; - } - const distribute = encodings.length - 1; - if (distribute > 1000) { - throw new Error(`Quality value can only have three decimal digits but trying to distribute ${encodings.length} elements.`); - } - const digits = Math.ceil(Math.log10(distribute)); - const factor = Math.pow(10, digits); - const diff = Math.floor((1 / distribute) * factor) / factor; - const result = []; - let q = 1; - for (const encoding of encodings) { - result.push(`${encoding.name};q=${q === 1 || q === 0 ? q.toFixed(0) : q.toFixed(digits)}`); - q = q - diff; - } - return result.join(', '); - } - Encodings.getEncodingHeaderValue = getEncodingHeaderValue; - function parseEncodingHeaderValue(value) { - const map = new Map(); - const encodings = value.split(/\s*,\s*/); - for (const value of encodings) { - const [encoding, q] = parseEncoding(value); - if (encoding === '*') { - continue; - } - let values = map.get(q); - if (values === undefined) { - values = []; - map.set(q, values); - } - values.push(encoding); - } - const keys = Array.from(map.keys()); - keys.sort((a, b) => b - a); - const result = []; - for (const key of keys) { - result.push(...map.get(key)); - } - return result; - } - Encodings.parseEncodingHeaderValue = parseEncodingHeaderValue; - function parseEncoding(value) { - let q = 1; - let encoding; - const index = value.indexOf(';q='); - if (index !== -1) { - const parsed = parseFloat(value.substr(index)); - if (parsed !== NaN) { - q = parsed; - } - encoding = value.substr(0, index); - } - else { - encoding = value; - } - return [encoding, q]; - } -})(Encodings = exports.Encodings || (exports.Encodings = {})); -//# sourceMappingURL=encoding.js.map \ No newline at end of file diff --git a/server/node_modules/vscode-languageserver-protocol/node_modules/vscode-jsonrpc/lib/common/events.js b/server/node_modules/vscode-languageserver-protocol/node_modules/vscode-jsonrpc/lib/common/events.js deleted file mode 100644 index cc5171a..0000000 --- a/server/node_modules/vscode-languageserver-protocol/node_modules/vscode-jsonrpc/lib/common/events.js +++ /dev/null @@ -1,129 +0,0 @@ -"use strict"; -/* -------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * ------------------------------------------------------------------------------------------ */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Emitter = exports.Event = void 0; -const ral_1 = require("./ral"); -var Event; -(function (Event) { - const _disposable = { dispose() { } }; - Event.None = function () { return _disposable; }; -})(Event = exports.Event || (exports.Event = {})); -class CallbackList { - add(callback, context = null, bucket) { - if (!this._callbacks) { - this._callbacks = []; - this._contexts = []; - } - this._callbacks.push(callback); - this._contexts.push(context); - if (Array.isArray(bucket)) { - bucket.push({ dispose: () => this.remove(callback, context) }); - } - } - remove(callback, context = null) { - if (!this._callbacks) { - return; - } - let foundCallbackWithDifferentContext = false; - for (let i = 0, len = this._callbacks.length; i < len; i++) { - if (this._callbacks[i] === callback) { - if (this._contexts[i] === context) { - // callback & context match => remove it - this._callbacks.splice(i, 1); - this._contexts.splice(i, 1); - return; - } - else { - foundCallbackWithDifferentContext = true; - } - } - } - if (foundCallbackWithDifferentContext) { - throw new Error('When adding a listener with a context, you should remove it with the same context'); - } - } - invoke(...args) { - if (!this._callbacks) { - return []; - } - const ret = [], callbacks = this._callbacks.slice(0), contexts = this._contexts.slice(0); - for (let i = 0, len = callbacks.length; i < len; i++) { - try { - ret.push(callbacks[i].apply(contexts[i], args)); - } - catch (e) { - // eslint-disable-next-line no-console - ral_1.default().console.error(e); - } - } - return ret; - } - isEmpty() { - return !this._callbacks || this._callbacks.length === 0; - } - dispose() { - this._callbacks = undefined; - this._contexts = undefined; - } -} -class Emitter { - constructor(_options) { - this._options = _options; - } - /** - * For the public to allow to subscribe - * to events from this Emitter - */ - get event() { - if (!this._event) { - this._event = (listener, thisArgs, disposables) => { - if (!this._callbacks) { - this._callbacks = new CallbackList(); - } - if (this._options && this._options.onFirstListenerAdd && this._callbacks.isEmpty()) { - this._options.onFirstListenerAdd(this); - } - this._callbacks.add(listener, thisArgs); - const result = { - dispose: () => { - if (!this._callbacks) { - // disposable is disposed after emitter is disposed. - return; - } - this._callbacks.remove(listener, thisArgs); - result.dispose = Emitter._noop; - if (this._options && this._options.onLastListenerRemove && this._callbacks.isEmpty()) { - this._options.onLastListenerRemove(this); - } - } - }; - if (Array.isArray(disposables)) { - disposables.push(result); - } - return result; - }; - } - return this._event; - } - /** - * To be kept private to fire an event to - * subscribers - */ - fire(event) { - if (this._callbacks) { - this._callbacks.invoke.call(this._callbacks, event); - } - } - dispose() { - if (this._callbacks) { - this._callbacks.dispose(); - this._callbacks = undefined; - } - } -} -exports.Emitter = Emitter; -Emitter._noop = function () { }; -//# sourceMappingURL=events.js.map \ No newline at end of file diff --git a/server/node_modules/vscode-languageserver-protocol/node_modules/vscode-jsonrpc/lib/common/is.js b/server/node_modules/vscode-languageserver-protocol/node_modules/vscode-jsonrpc/lib/common/is.js deleted file mode 100644 index a8fad75..0000000 --- a/server/node_modules/vscode-languageserver-protocol/node_modules/vscode-jsonrpc/lib/common/is.js +++ /dev/null @@ -1,36 +0,0 @@ -"use strict"; -/* -------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * ------------------------------------------------------------------------------------------ */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.stringArray = exports.array = exports.func = exports.error = exports.number = exports.string = exports.boolean = void 0; -function boolean(value) { - return value === true || value === false; -} -exports.boolean = boolean; -function string(value) { - return typeof value === 'string' || value instanceof String; -} -exports.string = string; -function number(value) { - return typeof value === 'number' || value instanceof Number; -} -exports.number = number; -function error(value) { - return value instanceof Error; -} -exports.error = error; -function func(value) { - return typeof value === 'function'; -} -exports.func = func; -function array(value) { - return Array.isArray(value); -} -exports.array = array; -function stringArray(value) { - return array(value) && value.every(elem => string(elem)); -} -exports.stringArray = stringArray; -//# sourceMappingURL=is.js.map \ No newline at end of file diff --git a/server/node_modules/vscode-languageserver-protocol/node_modules/vscode-jsonrpc/lib/common/linkedMap.js b/server/node_modules/vscode-languageserver-protocol/node_modules/vscode-jsonrpc/lib/common/linkedMap.js deleted file mode 100644 index d5f1e87..0000000 --- a/server/node_modules/vscode-languageserver-protocol/node_modules/vscode-jsonrpc/lib/common/linkedMap.js +++ /dev/null @@ -1,403 +0,0 @@ -"use strict"; -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.LRUCache = exports.LinkedMap = exports.Touch = void 0; -var Touch; -(function (Touch) { - Touch.None = 0; - Touch.First = 1; - Touch.AsOld = Touch.First; - Touch.Last = 2; - Touch.AsNew = Touch.Last; -})(Touch = exports.Touch || (exports.Touch = {})); -class LinkedMap { - constructor() { - this[Symbol.toStringTag] = 'LinkedMap'; - this._map = new Map(); - this._head = undefined; - this._tail = undefined; - this._size = 0; - this._state = 0; - } - clear() { - this._map.clear(); - this._head = undefined; - this._tail = undefined; - this._size = 0; - this._state++; - } - isEmpty() { - return !this._head && !this._tail; - } - get size() { - return this._size; - } - get first() { - var _a; - return (_a = this._head) === null || _a === void 0 ? void 0 : _a.value; - } - get last() { - var _a; - return (_a = this._tail) === null || _a === void 0 ? void 0 : _a.value; - } - has(key) { - return this._map.has(key); - } - get(key, touch = Touch.None) { - const item = this._map.get(key); - if (!item) { - return undefined; - } - if (touch !== Touch.None) { - this.touch(item, touch); - } - return item.value; - } - set(key, value, touch = Touch.None) { - let item = this._map.get(key); - if (item) { - item.value = value; - if (touch !== Touch.None) { - this.touch(item, touch); - } - } - else { - item = { key, value, next: undefined, previous: undefined }; - switch (touch) { - case Touch.None: - this.addItemLast(item); - break; - case Touch.First: - this.addItemFirst(item); - break; - case Touch.Last: - this.addItemLast(item); - break; - default: - this.addItemLast(item); - break; - } - this._map.set(key, item); - this._size++; - } - return this; - } - delete(key) { - return !!this.remove(key); - } - remove(key) { - const item = this._map.get(key); - if (!item) { - return undefined; - } - this._map.delete(key); - this.removeItem(item); - this._size--; - return item.value; - } - shift() { - if (!this._head && !this._tail) { - return undefined; - } - if (!this._head || !this._tail) { - throw new Error('Invalid list'); - } - const item = this._head; - this._map.delete(item.key); - this.removeItem(item); - this._size--; - return item.value; - } - forEach(callbackfn, thisArg) { - const state = this._state; - let current = this._head; - while (current) { - if (thisArg) { - callbackfn.bind(thisArg)(current.value, current.key, this); - } - else { - callbackfn(current.value, current.key, this); - } - if (this._state !== state) { - throw new Error(`LinkedMap got modified during iteration.`); - } - current = current.next; - } - } - keys() { - const map = this; - const state = this._state; - let current = this._head; - const iterator = { - [Symbol.iterator]() { - return iterator; - }, - next() { - if (map._state !== state) { - throw new Error(`LinkedMap got modified during iteration.`); - } - if (current) { - const result = { value: current.key, done: false }; - current = current.next; - return result; - } - else { - return { value: undefined, done: true }; - } - } - }; - return iterator; - } - values() { - const map = this; - const state = this._state; - let current = this._head; - const iterator = { - [Symbol.iterator]() { - return iterator; - }, - next() { - if (map._state !== state) { - throw new Error(`LinkedMap got modified during iteration.`); - } - if (current) { - const result = { value: current.value, done: false }; - current = current.next; - return result; - } - else { - return { value: undefined, done: true }; - } - } - }; - return iterator; - } - entries() { - const map = this; - const state = this._state; - let current = this._head; - const iterator = { - [Symbol.iterator]() { - return iterator; - }, - next() { - if (map._state !== state) { - throw new Error(`LinkedMap got modified during iteration.`); - } - if (current) { - const result = { value: [current.key, current.value], done: false }; - current = current.next; - return result; - } - else { - return { value: undefined, done: true }; - } - } - }; - return iterator; - } - [Symbol.iterator]() { - return this.entries(); - } - trimOld(newSize) { - if (newSize >= this.size) { - return; - } - if (newSize === 0) { - this.clear(); - return; - } - let current = this._head; - let currentSize = this.size; - while (current && currentSize > newSize) { - this._map.delete(current.key); - current = current.next; - currentSize--; - } - this._head = current; - this._size = currentSize; - if (current) { - current.previous = undefined; - } - this._state++; - } - addItemFirst(item) { - // First time Insert - if (!this._head && !this._tail) { - this._tail = item; - } - else if (!this._head) { - throw new Error('Invalid list'); - } - else { - item.next = this._head; - this._head.previous = item; - } - this._head = item; - this._state++; - } - addItemLast(item) { - // First time Insert - if (!this._head && !this._tail) { - this._head = item; - } - else if (!this._tail) { - throw new Error('Invalid list'); - } - else { - item.previous = this._tail; - this._tail.next = item; - } - this._tail = item; - this._state++; - } - removeItem(item) { - if (item === this._head && item === this._tail) { - this._head = undefined; - this._tail = undefined; - } - else if (item === this._head) { - // This can only happend if size === 1 which is handle - // by the case above. - if (!item.next) { - throw new Error('Invalid list'); - } - item.next.previous = undefined; - this._head = item.next; - } - else if (item === this._tail) { - // This can only happend if size === 1 which is handle - // by the case above. - if (!item.previous) { - throw new Error('Invalid list'); - } - item.previous.next = undefined; - this._tail = item.previous; - } - else { - const next = item.next; - const previous = item.previous; - if (!next || !previous) { - throw new Error('Invalid list'); - } - next.previous = previous; - previous.next = next; - } - item.next = undefined; - item.previous = undefined; - this._state++; - } - touch(item, touch) { - if (!this._head || !this._tail) { - throw new Error('Invalid list'); - } - if ((touch !== Touch.First && touch !== Touch.Last)) { - return; - } - if (touch === Touch.First) { - if (item === this._head) { - return; - } - const next = item.next; - const previous = item.previous; - // Unlink the item - if (item === this._tail) { - // previous must be defined since item was not head but is tail - // So there are more than on item in the map - previous.next = undefined; - this._tail = previous; - } - else { - // Both next and previous are not undefined since item was neither head nor tail. - next.previous = previous; - previous.next = next; - } - // Insert the node at head - item.previous = undefined; - item.next = this._head; - this._head.previous = item; - this._head = item; - this._state++; - } - else if (touch === Touch.Last) { - if (item === this._tail) { - return; - } - const next = item.next; - const previous = item.previous; - // Unlink the item. - if (item === this._head) { - // next must be defined since item was not tail but is head - // So there are more than on item in the map - next.previous = undefined; - this._head = next; - } - else { - // Both next and previous are not undefined since item was neither head nor tail. - next.previous = previous; - previous.next = next; - } - item.next = undefined; - item.previous = this._tail; - this._tail.next = item; - this._tail = item; - this._state++; - } - } - toJSON() { - const data = []; - this.forEach((value, key) => { - data.push([key, value]); - }); - return data; - } - fromJSON(data) { - this.clear(); - for (const [key, value] of data) { - this.set(key, value); - } - } -} -exports.LinkedMap = LinkedMap; -class LRUCache extends LinkedMap { - constructor(limit, ratio = 1) { - super(); - this._limit = limit; - this._ratio = Math.min(Math.max(0, ratio), 1); - } - get limit() { - return this._limit; - } - set limit(limit) { - this._limit = limit; - this.checkTrim(); - } - get ratio() { - return this._ratio; - } - set ratio(ratio) { - this._ratio = Math.min(Math.max(0, ratio), 1); - this.checkTrim(); - } - get(key, touch = Touch.AsNew) { - return super.get(key, touch); - } - peek(key) { - return super.get(key, Touch.None); - } - set(key, value) { - super.set(key, value, Touch.Last); - this.checkTrim(); - return this; - } - checkTrim() { - if (this.size > this._limit) { - this.trimOld(Math.round(this._limit * this._ratio)); - } - } -} -exports.LRUCache = LRUCache; -//# sourceMappingURL=linkedMap.js.map \ No newline at end of file diff --git a/server/node_modules/vscode-languageserver-protocol/node_modules/vscode-jsonrpc/lib/common/messageBuffer.js b/server/node_modules/vscode-languageserver-protocol/node_modules/vscode-jsonrpc/lib/common/messageBuffer.js deleted file mode 100644 index f29173e..0000000 --- a/server/node_modules/vscode-languageserver-protocol/node_modules/vscode-jsonrpc/lib/common/messageBuffer.js +++ /dev/null @@ -1,153 +0,0 @@ -"use strict"; -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.AbstractMessageBuffer = void 0; -const CR = 13; -const LF = 10; -const CRLF = '\r\n'; -class AbstractMessageBuffer { - constructor(encoding = 'utf-8') { - this._encoding = encoding; - this._chunks = []; - this._totalLength = 0; - } - get encoding() { - return this._encoding; - } - append(chunk) { - const toAppend = typeof chunk === 'string' ? this.fromString(chunk, this._encoding) : chunk; - this._chunks.push(toAppend); - this._totalLength += toAppend.byteLength; - } - tryReadHeaders() { - if (this._chunks.length === 0) { - return undefined; - } - let state = 0; - let chunkIndex = 0; - let offset = 0; - let chunkBytesRead = 0; - row: while (chunkIndex < this._chunks.length) { - const chunk = this._chunks[chunkIndex]; - offset = 0; - column: while (offset < chunk.length) { - const value = chunk[offset]; - switch (value) { - case CR: - switch (state) { - case 0: - state = 1; - break; - case 2: - state = 3; - break; - default: - state = 0; - } - break; - case LF: - switch (state) { - case 1: - state = 2; - break; - case 3: - state = 4; - offset++; - break row; - default: - state = 0; - } - break; - default: - state = 0; - } - offset++; - } - chunkBytesRead += chunk.byteLength; - chunkIndex++; - } - if (state !== 4) { - return undefined; - } - // The buffer contains the two CRLF at the end. So we will - // have two empty lines after the split at the end as well. - const buffer = this._read(chunkBytesRead + offset); - const result = new Map(); - const headers = this.toString(buffer, 'ascii').split(CRLF); - if (headers.length < 2) { - return result; - } - for (let i = 0; i < headers.length - 2; i++) { - const header = headers[i]; - const index = header.indexOf(':'); - if (index === -1) { - throw new Error('Message header must separate key and value using :'); - } - const key = header.substr(0, index); - const value = header.substr(index + 1).trim(); - result.set(key, value); - } - return result; - } - tryReadBody(length) { - if (this._totalLength < length) { - return undefined; - } - return this._read(length); - } - get numberOfBytes() { - return this._totalLength; - } - _read(byteCount) { - if (byteCount === 0) { - return this.emptyBuffer(); - } - if (byteCount > this._totalLength) { - throw new Error(`Cannot read so many bytes!`); - } - if (this._chunks[0].byteLength === byteCount) { - // super fast path, precisely first chunk must be returned - const chunk = this._chunks[0]; - this._chunks.shift(); - this._totalLength -= byteCount; - return this.asNative(chunk); - } - if (this._chunks[0].byteLength > byteCount) { - // fast path, the reading is entirely within the first chunk - const chunk = this._chunks[0]; - const result = this.asNative(chunk, byteCount); - this._chunks[0] = chunk.slice(byteCount); - this._totalLength -= byteCount; - return result; - } - const result = this.allocNative(byteCount); - let resultOffset = 0; - let chunkIndex = 0; - while (byteCount > 0) { - const chunk = this._chunks[chunkIndex]; - if (chunk.byteLength > byteCount) { - // this chunk will survive - const chunkPart = chunk.slice(0, byteCount); - result.set(chunkPart, resultOffset); - resultOffset += byteCount; - this._chunks[chunkIndex] = chunk.slice(byteCount); - this._totalLength -= byteCount; - byteCount -= byteCount; - } - else { - // this chunk will be entirely read - result.set(chunk, resultOffset); - resultOffset += chunk.byteLength; - this._chunks.shift(); - this._totalLength -= chunk.byteLength; - byteCount -= chunk.byteLength; - } - } - return result; - } -} -exports.AbstractMessageBuffer = AbstractMessageBuffer; -//# sourceMappingURL=messageBuffer.js.map \ No newline at end of file diff --git a/server/node_modules/vscode-languageserver-protocol/node_modules/vscode-jsonrpc/lib/common/messageReader.js b/server/node_modules/vscode-languageserver-protocol/node_modules/vscode-jsonrpc/lib/common/messageReader.js deleted file mode 100644 index 15b2393..0000000 --- a/server/node_modules/vscode-languageserver-protocol/node_modules/vscode-jsonrpc/lib/common/messageReader.js +++ /dev/null @@ -1,193 +0,0 @@ -"use strict"; -/* -------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * ------------------------------------------------------------------------------------------ */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ReadableStreamMessageReader = exports.AbstractMessageReader = exports.MessageReader = void 0; -const ral_1 = require("./ral"); -const Is = require("./is"); -const events_1 = require("./events"); -var MessageReader; -(function (MessageReader) { - function is(value) { - let candidate = value; - return candidate && Is.func(candidate.listen) && Is.func(candidate.dispose) && - Is.func(candidate.onError) && Is.func(candidate.onClose) && Is.func(candidate.onPartialMessage); - } - MessageReader.is = is; -})(MessageReader = exports.MessageReader || (exports.MessageReader = {})); -class AbstractMessageReader { - constructor() { - this.errorEmitter = new events_1.Emitter(); - this.closeEmitter = new events_1.Emitter(); - this.partialMessageEmitter = new events_1.Emitter(); - } - dispose() { - this.errorEmitter.dispose(); - this.closeEmitter.dispose(); - } - get onError() { - return this.errorEmitter.event; - } - fireError(error) { - this.errorEmitter.fire(this.asError(error)); - } - get onClose() { - return this.closeEmitter.event; - } - fireClose() { - this.closeEmitter.fire(undefined); - } - get onPartialMessage() { - return this.partialMessageEmitter.event; - } - firePartialMessage(info) { - this.partialMessageEmitter.fire(info); - } - asError(error) { - if (error instanceof Error) { - return error; - } - else { - return new Error(`Reader received error. Reason: ${Is.string(error.message) ? error.message : 'unknown'}`); - } - } -} -exports.AbstractMessageReader = AbstractMessageReader; -var ResolvedMessageReaderOptions; -(function (ResolvedMessageReaderOptions) { - function fromOptions(options) { - var _a; - let charset; - let result; - let contentDecoder; - const contentDecoders = new Map(); - let contentTypeDecoder; - const contentTypeDecoders = new Map(); - if (options === undefined || typeof options === 'string') { - charset = options !== null && options !== void 0 ? options : 'utf-8'; - } - else { - charset = (_a = options.charset) !== null && _a !== void 0 ? _a : 'utf-8'; - if (options.contentDecoder !== undefined) { - contentDecoder = options.contentDecoder; - contentDecoders.set(contentDecoder.name, contentDecoder); - } - if (options.contentDecoders !== undefined) { - for (const decoder of options.contentDecoders) { - contentDecoders.set(decoder.name, decoder); - } - } - if (options.contentTypeDecoder !== undefined) { - contentTypeDecoder = options.contentTypeDecoder; - contentTypeDecoders.set(contentTypeDecoder.name, contentTypeDecoder); - } - if (options.contentTypeDecoders !== undefined) { - for (const decoder of options.contentTypeDecoders) { - contentTypeDecoders.set(decoder.name, decoder); - } - } - } - if (contentTypeDecoder === undefined) { - contentTypeDecoder = ral_1.default().applicationJson.decoder; - contentTypeDecoders.set(contentTypeDecoder.name, contentTypeDecoder); - } - return { charset, contentDecoder, contentDecoders, contentTypeDecoder, contentTypeDecoders }; - } - ResolvedMessageReaderOptions.fromOptions = fromOptions; -})(ResolvedMessageReaderOptions || (ResolvedMessageReaderOptions = {})); -class ReadableStreamMessageReader extends AbstractMessageReader { - constructor(readable, options) { - super(); - this.readable = readable; - this.options = ResolvedMessageReaderOptions.fromOptions(options); - this.buffer = ral_1.default().messageBuffer.create(this.options.charset); - this._partialMessageTimeout = 10000; - this.nextMessageLength = -1; - this.messageToken = 0; - } - set partialMessageTimeout(timeout) { - this._partialMessageTimeout = timeout; - } - get partialMessageTimeout() { - return this._partialMessageTimeout; - } - listen(callback) { - this.nextMessageLength = -1; - this.messageToken = 0; - this.partialMessageTimer = undefined; - this.callback = callback; - const result = this.readable.onData((data) => { - this.onData(data); - }); - this.readable.onError((error) => this.fireError(error)); - this.readable.onClose(() => this.fireClose()); - return result; - } - onData(data) { - this.buffer.append(data); - while (true) { - if (this.nextMessageLength === -1) { - const headers = this.buffer.tryReadHeaders(); - if (!headers) { - return; - } - const contentLength = headers.get('Content-Length'); - if (!contentLength) { - throw new Error('Header must provide a Content-Length property.'); - } - const length = parseInt(contentLength); - if (isNaN(length)) { - throw new Error('Content-Length value must be a number.'); - } - this.nextMessageLength = length; - } - const body = this.buffer.tryReadBody(this.nextMessageLength); - if (body === undefined) { - /** We haven't received the full message yet. */ - this.setPartialMessageTimer(); - return; - } - this.clearPartialMessageTimer(); - this.nextMessageLength = -1; - let p; - if (this.options.contentDecoder !== undefined) { - p = this.options.contentDecoder.decode(body); - } - else { - p = Promise.resolve(body); - } - p.then((value) => { - this.options.contentTypeDecoder.decode(value, this.options).then((msg) => { - this.callback(msg); - }, (error) => { - this.fireError(error); - }); - }, (error) => { - this.fireError(error); - }); - } - } - clearPartialMessageTimer() { - if (this.partialMessageTimer) { - ral_1.default().timer.clearTimeout(this.partialMessageTimer); - this.partialMessageTimer = undefined; - } - } - setPartialMessageTimer() { - this.clearPartialMessageTimer(); - if (this._partialMessageTimeout <= 0) { - return; - } - this.partialMessageTimer = ral_1.default().timer.setTimeout((token, timeout) => { - this.partialMessageTimer = undefined; - if (token === this.messageToken) { - this.firePartialMessage({ messageToken: token, waitingTime: timeout }); - this.setPartialMessageTimer(); - } - }, this._partialMessageTimeout, this.messageToken, this._partialMessageTimeout); - } -} -exports.ReadableStreamMessageReader = ReadableStreamMessageReader; -//# sourceMappingURL=messageReader.js.map \ No newline at end of file diff --git a/server/node_modules/vscode-languageserver-protocol/node_modules/vscode-jsonrpc/lib/common/messageWriter.js b/server/node_modules/vscode-languageserver-protocol/node_modules/vscode-jsonrpc/lib/common/messageWriter.js deleted file mode 100644 index a13f298..0000000 --- a/server/node_modules/vscode-languageserver-protocol/node_modules/vscode-jsonrpc/lib/common/messageWriter.js +++ /dev/null @@ -1,117 +0,0 @@ -"use strict"; -/* -------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * ------------------------------------------------------------------------------------------ */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.WriteableStreamMessageWriter = exports.AbstractMessageWriter = exports.MessageWriter = void 0; -const ral_1 = require("./ral"); -const Is = require("./is"); -const semaphore_1 = require("./semaphore"); -const events_1 = require("./events"); -const ContentLength = 'Content-Length: '; -const CRLF = '\r\n'; -var MessageWriter; -(function (MessageWriter) { - function is(value) { - let candidate = value; - return candidate && Is.func(candidate.dispose) && Is.func(candidate.onClose) && - Is.func(candidate.onError) && Is.func(candidate.write); - } - MessageWriter.is = is; -})(MessageWriter = exports.MessageWriter || (exports.MessageWriter = {})); -class AbstractMessageWriter { - constructor() { - this.errorEmitter = new events_1.Emitter(); - this.closeEmitter = new events_1.Emitter(); - } - dispose() { - this.errorEmitter.dispose(); - this.closeEmitter.dispose(); - } - get onError() { - return this.errorEmitter.event; - } - fireError(error, message, count) { - this.errorEmitter.fire([this.asError(error), message, count]); - } - get onClose() { - return this.closeEmitter.event; - } - fireClose() { - this.closeEmitter.fire(undefined); - } - asError(error) { - if (error instanceof Error) { - return error; - } - else { - return new Error(`Writer received error. Reason: ${Is.string(error.message) ? error.message : 'unknown'}`); - } - } -} -exports.AbstractMessageWriter = AbstractMessageWriter; -var ResolvedMessageWriterOptions; -(function (ResolvedMessageWriterOptions) { - function fromOptions(options) { - var _a, _b; - if (options === undefined || typeof options === 'string') { - return { charset: options !== null && options !== void 0 ? options : 'utf-8', contentTypeEncoder: ral_1.default().applicationJson.encoder }; - } - else { - return { charset: (_a = options.charset) !== null && _a !== void 0 ? _a : 'utf-8', contentEncoder: options.contentEncoder, contentTypeEncoder: (_b = options.contentTypeEncoder) !== null && _b !== void 0 ? _b : ral_1.default().applicationJson.encoder }; - } - } - ResolvedMessageWriterOptions.fromOptions = fromOptions; -})(ResolvedMessageWriterOptions || (ResolvedMessageWriterOptions = {})); -class WriteableStreamMessageWriter extends AbstractMessageWriter { - constructor(writable, options) { - super(); - this.writable = writable; - this.options = ResolvedMessageWriterOptions.fromOptions(options); - this.errorCount = 0; - this.writeSemaphore = new semaphore_1.Semaphore(1); - this.writable.onError((error) => this.fireError(error)); - this.writable.onClose(() => this.fireClose()); - } - async write(msg) { - return this.writeSemaphore.lock(async () => { - const payload = this.options.contentTypeEncoder.encode(msg, this.options).then((buffer) => { - if (this.options.contentEncoder !== undefined) { - return this.options.contentEncoder.encode(buffer); - } - else { - return buffer; - } - }); - return payload.then((buffer) => { - const headers = []; - headers.push(ContentLength, buffer.byteLength.toString(), CRLF); - headers.push(CRLF); - return this.doWrite(msg, headers, buffer); - }, (error) => { - this.fireError(error); - throw error; - }); - }); - } - async doWrite(msg, headers, data) { - try { - await this.writable.write(headers.join(''), 'ascii'); - return this.writable.write(data); - } - catch (error) { - this.handleError(error, msg); - return Promise.reject(error); - } - } - handleError(error, msg) { - this.errorCount++; - this.fireError(error, msg, this.errorCount); - } - end() { - this.writable.end(); - } -} -exports.WriteableStreamMessageWriter = WriteableStreamMessageWriter; -//# sourceMappingURL=messageWriter.js.map \ No newline at end of file diff --git a/server/node_modules/vscode-languageserver-protocol/node_modules/vscode-jsonrpc/lib/common/messages.js b/server/node_modules/vscode-languageserver-protocol/node_modules/vscode-jsonrpc/lib/common/messages.js deleted file mode 100644 index b0666d6..0000000 --- a/server/node_modules/vscode-languageserver-protocol/node_modules/vscode-jsonrpc/lib/common/messages.js +++ /dev/null @@ -1,282 +0,0 @@ -"use strict"; -/* -------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * ------------------------------------------------------------------------------------------ */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.isResponseMessage = exports.isNotificationMessage = exports.isRequestMessage = exports.NotificationType9 = exports.NotificationType8 = exports.NotificationType7 = exports.NotificationType6 = exports.NotificationType5 = exports.NotificationType4 = exports.NotificationType3 = exports.NotificationType2 = exports.NotificationType1 = exports.NotificationType0 = exports.NotificationType = exports.RequestType9 = exports.RequestType8 = exports.RequestType7 = exports.RequestType6 = exports.RequestType5 = exports.RequestType4 = exports.RequestType3 = exports.RequestType2 = exports.RequestType1 = exports.RequestType = exports.RequestType0 = exports.AbstractMessageSignature = exports.ParameterStructures = exports.ResponseError = exports.ErrorCodes = void 0; -const is = require("./is"); -/** - * Predefined error codes. - */ -var ErrorCodes; -(function (ErrorCodes) { - // Defined by JSON RPC - ErrorCodes.ParseError = -32700; - ErrorCodes.InvalidRequest = -32600; - ErrorCodes.MethodNotFound = -32601; - ErrorCodes.InvalidParams = -32602; - ErrorCodes.InternalError = -32603; - /** - * This is the start range of JSON RPC reserved error codes. - * It doesn't denote a real error code. No application error codes should - * be defined between the start and end range. For backwards - * compatibility the `ServerNotInitialized` and the `UnknownErrorCode` - * are left in the range. - * - * @since 3.16.0 - */ - ErrorCodes.jsonrpcReservedErrorRangeStart = -32099; - /** @deprecated use jsonrpcReservedErrorRangeStart */ - ErrorCodes.serverErrorStart = ErrorCodes.jsonrpcReservedErrorRangeStart; - ErrorCodes.MessageWriteError = -32099; - ErrorCodes.MessageReadError = -32098; - ErrorCodes.ServerNotInitialized = -32002; - ErrorCodes.UnknownErrorCode = -32001; - /** - * This is the end range of JSON RPC reserved error codes. - * It doesn't denote a real error code. - * - * @since 3.16.0 - */ - ErrorCodes.jsonrpcReservedErrorRangeEnd = -32000; - /** @deprecated use jsonrpcReservedErrorRangeEnd */ - ErrorCodes.serverErrorEnd = ErrorCodes.jsonrpcReservedErrorRangeEnd; -})(ErrorCodes = exports.ErrorCodes || (exports.ErrorCodes = {})); -/** - * An error object return in a response in case a request - * has failed. - */ -class ResponseError extends Error { - constructor(code, message, data) { - super(message); - this.code = is.number(code) ? code : ErrorCodes.UnknownErrorCode; - this.data = data; - Object.setPrototypeOf(this, ResponseError.prototype); - } - toJson() { - return { - code: this.code, - message: this.message, - data: this.data, - }; - } -} -exports.ResponseError = ResponseError; -class ParameterStructures { - constructor(kind) { - this.kind = kind; - } - static is(value) { - return value === ParameterStructures.auto || value === ParameterStructures.byName || value === ParameterStructures.byPosition; - } - toString() { - return this.kind; - } -} -exports.ParameterStructures = ParameterStructures; -/** - * The parameter structure is automatically inferred on the number of parameters - * and the parameter type in case of a single param. - */ -ParameterStructures.auto = new ParameterStructures('auto'); -/** - * Forces `byPosition` parameter structure. This is useful if you have a single - * parameter which has a literal type. - */ -ParameterStructures.byPosition = new ParameterStructures('byPosition'); -/** - * Forces `byName` parameter structure. This is only useful when having a single - * parameter. The library will report errors if used with a different number of - * parameters. - */ -ParameterStructures.byName = new ParameterStructures('byName'); -/** - * An abstract implementation of a MessageType. - */ -class AbstractMessageSignature { - constructor(method, numberOfParams) { - this.method = method; - this.numberOfParams = numberOfParams; - } - get parameterStructures() { - return ParameterStructures.auto; - } -} -exports.AbstractMessageSignature = AbstractMessageSignature; -/** - * Classes to type request response pairs - */ -class RequestType0 extends AbstractMessageSignature { - constructor(method) { - super(method, 0); - } -} -exports.RequestType0 = RequestType0; -class RequestType extends AbstractMessageSignature { - constructor(method, _parameterStructures = ParameterStructures.auto) { - super(method, 1); - this._parameterStructures = _parameterStructures; - } - get parameterStructures() { - return this._parameterStructures; - } -} -exports.RequestType = RequestType; -class RequestType1 extends AbstractMessageSignature { - constructor(method, _parameterStructures = ParameterStructures.auto) { - super(method, 1); - this._parameterStructures = _parameterStructures; - } - get parameterStructures() { - return this._parameterStructures; - } -} -exports.RequestType1 = RequestType1; -class RequestType2 extends AbstractMessageSignature { - constructor(method) { - super(method, 2); - } -} -exports.RequestType2 = RequestType2; -class RequestType3 extends AbstractMessageSignature { - constructor(method) { - super(method, 3); - } -} -exports.RequestType3 = RequestType3; -class RequestType4 extends AbstractMessageSignature { - constructor(method) { - super(method, 4); - } -} -exports.RequestType4 = RequestType4; -class RequestType5 extends AbstractMessageSignature { - constructor(method) { - super(method, 5); - } -} -exports.RequestType5 = RequestType5; -class RequestType6 extends AbstractMessageSignature { - constructor(method) { - super(method, 6); - } -} -exports.RequestType6 = RequestType6; -class RequestType7 extends AbstractMessageSignature { - constructor(method) { - super(method, 7); - } -} -exports.RequestType7 = RequestType7; -class RequestType8 extends AbstractMessageSignature { - constructor(method) { - super(method, 8); - } -} -exports.RequestType8 = RequestType8; -class RequestType9 extends AbstractMessageSignature { - constructor(method) { - super(method, 9); - } -} -exports.RequestType9 = RequestType9; -class NotificationType extends AbstractMessageSignature { - constructor(method, _parameterStructures = ParameterStructures.auto) { - super(method, 1); - this._parameterStructures = _parameterStructures; - } - get parameterStructures() { - return this._parameterStructures; - } -} -exports.NotificationType = NotificationType; -class NotificationType0 extends AbstractMessageSignature { - constructor(method) { - super(method, 0); - } -} -exports.NotificationType0 = NotificationType0; -class NotificationType1 extends AbstractMessageSignature { - constructor(method, _parameterStructures = ParameterStructures.auto) { - super(method, 1); - this._parameterStructures = _parameterStructures; - } - get parameterStructures() { - return this._parameterStructures; - } -} -exports.NotificationType1 = NotificationType1; -class NotificationType2 extends AbstractMessageSignature { - constructor(method) { - super(method, 2); - } -} -exports.NotificationType2 = NotificationType2; -class NotificationType3 extends AbstractMessageSignature { - constructor(method) { - super(method, 3); - } -} -exports.NotificationType3 = NotificationType3; -class NotificationType4 extends AbstractMessageSignature { - constructor(method) { - super(method, 4); - } -} -exports.NotificationType4 = NotificationType4; -class NotificationType5 extends AbstractMessageSignature { - constructor(method) { - super(method, 5); - } -} -exports.NotificationType5 = NotificationType5; -class NotificationType6 extends AbstractMessageSignature { - constructor(method) { - super(method, 6); - } -} -exports.NotificationType6 = NotificationType6; -class NotificationType7 extends AbstractMessageSignature { - constructor(method) { - super(method, 7); - } -} -exports.NotificationType7 = NotificationType7; -class NotificationType8 extends AbstractMessageSignature { - constructor(method) { - super(method, 8); - } -} -exports.NotificationType8 = NotificationType8; -class NotificationType9 extends AbstractMessageSignature { - constructor(method) { - super(method, 9); - } -} -exports.NotificationType9 = NotificationType9; -/** - * Tests if the given message is a request message - */ -function isRequestMessage(message) { - const candidate = message; - return candidate && is.string(candidate.method) && (is.string(candidate.id) || is.number(candidate.id)); -} -exports.isRequestMessage = isRequestMessage; -/** - * Tests if the given message is a notification message - */ -function isNotificationMessage(message) { - const candidate = message; - return candidate && is.string(candidate.method) && message.id === void 0; -} -exports.isNotificationMessage = isNotificationMessage; -/** - * Tests if the given message is a response message - */ -function isResponseMessage(message) { - const candidate = message; - return candidate && (candidate.result !== void 0 || !!candidate.error) && (is.string(candidate.id) || is.number(candidate.id) || candidate.id === null); -} -exports.isResponseMessage = isResponseMessage; -//# sourceMappingURL=messages.js.map \ No newline at end of file diff --git a/server/node_modules/vscode-languageserver-protocol/node_modules/vscode-jsonrpc/lib/common/ral.js b/server/node_modules/vscode-languageserver-protocol/node_modules/vscode-jsonrpc/lib/common/ral.js deleted file mode 100644 index 717c59e..0000000 --- a/server/node_modules/vscode-languageserver-protocol/node_modules/vscode-jsonrpc/lib/common/ral.js +++ /dev/null @@ -1,24 +0,0 @@ -"use strict"; -/* -------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * ------------------------------------------------------------------------------------------ */ -Object.defineProperty(exports, "__esModule", { value: true }); -let _ral; -function RAL() { - if (_ral === undefined) { - throw new Error(`No runtime abstraction layer installed`); - } - return _ral; -} -(function (RAL) { - function install(ral) { - if (ral === undefined) { - throw new Error(`No runtime abstraction layer provided`); - } - _ral = ral; - } - RAL.install = install; -})(RAL || (RAL = {})); -exports.default = RAL; -//# sourceMappingURL=ral.js.map \ No newline at end of file diff --git a/server/node_modules/vscode-languageserver-protocol/node_modules/vscode-jsonrpc/lib/common/semaphore.js b/server/node_modules/vscode-languageserver-protocol/node_modules/vscode-jsonrpc/lib/common/semaphore.js deleted file mode 100644 index 8844bef..0000000 --- a/server/node_modules/vscode-languageserver-protocol/node_modules/vscode-jsonrpc/lib/common/semaphore.js +++ /dev/null @@ -1,69 +0,0 @@ -"use strict"; -/* -------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * ------------------------------------------------------------------------------------------ */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Semaphore = void 0; -const ral_1 = require("./ral"); -class Semaphore { - constructor(capacity = 1) { - if (capacity <= 0) { - throw new Error('Capacity must be greater than 0'); - } - this._capacity = capacity; - this._active = 0; - this._waiting = []; - } - lock(thunk) { - return new Promise((resolve, reject) => { - this._waiting.push({ thunk, resolve, reject }); - this.runNext(); - }); - } - get active() { - return this._active; - } - runNext() { - if (this._waiting.length === 0 || this._active === this._capacity) { - return; - } - ral_1.default().timer.setImmediate(() => this.doRunNext()); - } - doRunNext() { - if (this._waiting.length === 0 || this._active === this._capacity) { - return; - } - const next = this._waiting.shift(); - this._active++; - if (this._active > this._capacity) { - throw new Error(`To many thunks active`); - } - try { - const result = next.thunk(); - if (result instanceof Promise) { - result.then((value) => { - this._active--; - next.resolve(value); - this.runNext(); - }, (err) => { - this._active--; - next.reject(err); - this.runNext(); - }); - } - else { - this._active--; - next.resolve(result); - this.runNext(); - } - } - catch (err) { - this._active--; - next.reject(err); - this.runNext(); - } - } -} -exports.Semaphore = Semaphore; -//# sourceMappingURL=semaphore.js.map \ No newline at end of file diff --git a/server/node_modules/vscode-languageserver-protocol/node_modules/vscode-jsonrpc/lib/node/main.js b/server/node_modules/vscode-languageserver-protocol/node_modules/vscode-jsonrpc/lib/node/main.js deleted file mode 100644 index 2ab9f00..0000000 --- a/server/node_modules/vscode-languageserver-protocol/node_modules/vscode-jsonrpc/lib/node/main.js +++ /dev/null @@ -1,213 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.createMessageConnection = exports.createServerSocketTransport = exports.createClientSocketTransport = exports.createServerPipeTransport = exports.createClientPipeTransport = exports.generateRandomPipeName = exports.StreamMessageWriter = exports.StreamMessageReader = exports.SocketMessageWriter = exports.SocketMessageReader = exports.IPCMessageWriter = exports.IPCMessageReader = void 0; -/* -------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * ----------------------------------------------------------------------------------------- */ -const ril_1 = require("./ril"); -// Install the node runtime abstract. -ril_1.default.install(); -const api_1 = require("../common/api"); -const path = require("path"); -const os = require("os"); -const crypto_1 = require("crypto"); -const net_1 = require("net"); -__exportStar(require("../common/api"), exports); -class IPCMessageReader extends api_1.AbstractMessageReader { - constructor(process) { - super(); - this.process = process; - let eventEmitter = this.process; - eventEmitter.on('error', (error) => this.fireError(error)); - eventEmitter.on('close', () => this.fireClose()); - } - listen(callback) { - this.process.on('message', callback); - return api_1.Disposable.create(() => this.process.off('message', callback)); - } -} -exports.IPCMessageReader = IPCMessageReader; -class IPCMessageWriter extends api_1.AbstractMessageWriter { - constructor(process) { - super(); - this.process = process; - this.errorCount = 0; - let eventEmitter = this.process; - eventEmitter.on('error', (error) => this.fireError(error)); - eventEmitter.on('close', () => this.fireClose); - } - write(msg) { - try { - if (typeof this.process.send === 'function') { - this.process.send(msg, undefined, undefined, (error) => { - if (error) { - this.errorCount++; - this.handleError(error, msg); - } - else { - this.errorCount = 0; - } - }); - } - return Promise.resolve(); - } - catch (error) { - this.handleError(error, msg); - return Promise.reject(error); - } - } - handleError(error, msg) { - this.errorCount++; - this.fireError(error, msg, this.errorCount); - } - end() { - } -} -exports.IPCMessageWriter = IPCMessageWriter; -class SocketMessageReader extends api_1.ReadableStreamMessageReader { - constructor(socket, encoding = 'utf-8') { - super(ril_1.default().stream.asReadableStream(socket), encoding); - } -} -exports.SocketMessageReader = SocketMessageReader; -class SocketMessageWriter extends api_1.WriteableStreamMessageWriter { - constructor(socket, options) { - super(ril_1.default().stream.asWritableStream(socket), options); - this.socket = socket; - } - dispose() { - super.dispose(); - this.socket.destroy(); - } -} -exports.SocketMessageWriter = SocketMessageWriter; -class StreamMessageReader extends api_1.ReadableStreamMessageReader { - constructor(readble, encoding) { - super(ril_1.default().stream.asReadableStream(readble), encoding); - } -} -exports.StreamMessageReader = StreamMessageReader; -class StreamMessageWriter extends api_1.WriteableStreamMessageWriter { - constructor(writable, options) { - super(ril_1.default().stream.asWritableStream(writable), options); - } -} -exports.StreamMessageWriter = StreamMessageWriter; -const XDG_RUNTIME_DIR = process.env['XDG_RUNTIME_DIR']; -const safeIpcPathLengths = new Map([ - ['linux', 107], - ['darwin', 103] -]); -function generateRandomPipeName() { - const randomSuffix = crypto_1.randomBytes(21).toString('hex'); - if (process.platform === 'win32') { - return `\\\\.\\pipe\\vscode-jsonrpc-${randomSuffix}-sock`; - } - let result; - if (XDG_RUNTIME_DIR) { - result = path.join(XDG_RUNTIME_DIR, `vscode-ipc-${randomSuffix}.sock`); - } - else { - result = path.join(os.tmpdir(), `vscode-${randomSuffix}.sock`); - } - const limit = safeIpcPathLengths.get(process.platform); - if (limit !== undefined && result.length >= limit) { - ril_1.default().console.warn(`WARNING: IPC handle "${result}" is longer than ${limit} characters.`); - } - return result; -} -exports.generateRandomPipeName = generateRandomPipeName; -function createClientPipeTransport(pipeName, encoding = 'utf-8') { - let connectResolve; - const connected = new Promise((resolve, _reject) => { - connectResolve = resolve; - }); - return new Promise((resolve, reject) => { - let server = net_1.createServer((socket) => { - server.close(); - connectResolve([ - new SocketMessageReader(socket, encoding), - new SocketMessageWriter(socket, encoding) - ]); - }); - server.on('error', reject); - server.listen(pipeName, () => { - server.removeListener('error', reject); - resolve({ - onConnected: () => { return connected; } - }); - }); - }); -} -exports.createClientPipeTransport = createClientPipeTransport; -function createServerPipeTransport(pipeName, encoding = 'utf-8') { - const socket = net_1.createConnection(pipeName); - return [ - new SocketMessageReader(socket, encoding), - new SocketMessageWriter(socket, encoding) - ]; -} -exports.createServerPipeTransport = createServerPipeTransport; -function createClientSocketTransport(port, encoding = 'utf-8') { - let connectResolve; - const connected = new Promise((resolve, _reject) => { - connectResolve = resolve; - }); - return new Promise((resolve, reject) => { - const server = net_1.createServer((socket) => { - server.close(); - connectResolve([ - new SocketMessageReader(socket, encoding), - new SocketMessageWriter(socket, encoding) - ]); - }); - server.on('error', reject); - server.listen(port, '127.0.0.1', () => { - server.removeListener('error', reject); - resolve({ - onConnected: () => { return connected; } - }); - }); - }); -} -exports.createClientSocketTransport = createClientSocketTransport; -function createServerSocketTransport(port, encoding = 'utf-8') { - const socket = net_1.createConnection(port, '127.0.0.1'); - return [ - new SocketMessageReader(socket, encoding), - new SocketMessageWriter(socket, encoding) - ]; -} -exports.createServerSocketTransport = createServerSocketTransport; -function isReadableStream(value) { - const candidate = value; - return candidate.read !== undefined && candidate.addListener !== undefined; -} -function isWritableStream(value) { - const candidate = value; - return candidate.write !== undefined && candidate.addListener !== undefined; -} -function createMessageConnection(input, output, logger, options) { - if (!logger) { - logger = api_1.NullLogger; - } - const reader = isReadableStream(input) ? new StreamMessageReader(input) : input; - const writer = isWritableStream(output) ? new StreamMessageWriter(output) : output; - if (api_1.ConnectionStrategy.is(options)) { - options = { connectionStrategy: options }; - } - return api_1.createMessageConnection(reader, writer, logger, options); -} -exports.createMessageConnection = createMessageConnection; -//# sourceMappingURL=main.js.map \ No newline at end of file diff --git a/server/node_modules/vscode-languageserver-protocol/node_modules/vscode-jsonrpc/lib/node/ril.js b/server/node_modules/vscode-languageserver-protocol/node_modules/vscode-jsonrpc/lib/node/ril.js deleted file mode 100644 index bfa6c50..0000000 --- a/server/node_modules/vscode-languageserver-protocol/node_modules/vscode-jsonrpc/lib/node/ril.js +++ /dev/null @@ -1,164 +0,0 @@ -"use strict"; -/* -------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * ------------------------------------------------------------------------------------------ */ -Object.defineProperty(exports, "__esModule", { value: true }); -const ral_1 = require("../common/ral"); -const util_1 = require("util"); -const disposable_1 = require("../common/disposable"); -const messageBuffer_1 = require("../common/messageBuffer"); -class MessageBuffer extends messageBuffer_1.AbstractMessageBuffer { - constructor(encoding = 'utf-8') { - super(encoding); - } - emptyBuffer() { - return MessageBuffer.emptyBuffer; - } - fromString(value, encoding) { - return Buffer.from(value, encoding); - } - toString(value, encoding) { - if (value instanceof Buffer) { - return value.toString(encoding); - } - else { - return new util_1.TextDecoder(encoding).decode(value); - } - } - asNative(buffer, length) { - if (length === undefined) { - return buffer instanceof Buffer ? buffer : Buffer.from(buffer); - } - else { - return buffer instanceof Buffer ? buffer.slice(0, length) : Buffer.from(buffer, 0, length); - } - } - allocNative(length) { - return Buffer.allocUnsafe(length); - } -} -MessageBuffer.emptyBuffer = Buffer.allocUnsafe(0); -class ReadableStreamWrapper { - constructor(stream) { - this.stream = stream; - } - onClose(listener) { - this.stream.on('close', listener); - return disposable_1.Disposable.create(() => this.stream.off('close', listener)); - } - onError(listener) { - this.stream.on('error', listener); - return disposable_1.Disposable.create(() => this.stream.off('error', listener)); - } - onEnd(listener) { - this.stream.on('end', listener); - return disposable_1.Disposable.create(() => this.stream.off('end', listener)); - } - onData(listener) { - this.stream.on('data', listener); - return disposable_1.Disposable.create(() => this.stream.off('data', listener)); - } -} -class WritableStreamWrapper { - constructor(stream) { - this.stream = stream; - } - onClose(listener) { - this.stream.on('close', listener); - return disposable_1.Disposable.create(() => this.stream.off('close', listener)); - } - onError(listener) { - this.stream.on('error', listener); - return disposable_1.Disposable.create(() => this.stream.off('error', listener)); - } - onEnd(listener) { - this.stream.on('end', listener); - return disposable_1.Disposable.create(() => this.stream.off('end', listener)); - } - write(data, encoding) { - return new Promise((resolve, reject) => { - const callback = (error) => { - if (error === undefined || error === null) { - resolve(); - } - else { - reject(error); - } - }; - if (typeof data === 'string') { - this.stream.write(data, encoding, callback); - } - else { - this.stream.write(data, callback); - } - }); - } - end() { - this.stream.end(); - } -} -const _ril = Object.freeze({ - messageBuffer: Object.freeze({ - create: (encoding) => new MessageBuffer(encoding) - }), - applicationJson: Object.freeze({ - encoder: Object.freeze({ - name: 'application/json', - encode: (msg, options) => { - try { - return Promise.resolve(Buffer.from(JSON.stringify(msg, undefined, 0), options.charset)); - } - catch (err) { - return Promise.reject(err); - } - } - }), - decoder: Object.freeze({ - name: 'application/json', - decode: (buffer, options) => { - try { - if (buffer instanceof Buffer) { - return Promise.resolve(JSON.parse(buffer.toString(options.charset))); - } - else { - return Promise.resolve(JSON.parse(new util_1.TextDecoder(options.charset).decode(buffer))); - } - } - catch (err) { - return Promise.reject(err); - } - } - }) - }), - stream: Object.freeze({ - asReadableStream: (stream) => new ReadableStreamWrapper(stream), - asWritableStream: (stream) => new WritableStreamWrapper(stream) - }), - console: console, - timer: Object.freeze({ - setTimeout(callback, ms, ...args) { - return setTimeout(callback, ms, ...args); - }, - clearTimeout(handle) { - clearTimeout(handle); - }, - setImmediate(callback, ...args) { - return setImmediate(callback, ...args); - }, - clearImmediate(handle) { - clearImmediate(handle); - } - }) -}); -function RIL() { - return _ril; -} -(function (RIL) { - function install() { - ral_1.default.install(_ril); - } - RIL.install = install; -})(RIL || (RIL = {})); -exports.default = RIL; -//# sourceMappingURL=ril.js.map \ No newline at end of file diff --git a/server/node_modules/vscode-languageserver-protocol/node_modules/vscode-jsonrpc/node.cmd b/server/node_modules/vscode-languageserver-protocol/node_modules/vscode-jsonrpc/node.cmd deleted file mode 100644 index 791e6e3..0000000 --- a/server/node_modules/vscode-languageserver-protocol/node_modules/vscode-jsonrpc/node.cmd +++ /dev/null @@ -1,5 +0,0 @@ -@echo off -REM This file is necessary to ensure that under Windows we don't -REM run the node.js file in the Windows Script Host when using -REM node in packakge.json scripts. See also PATHEXT setting -node.exe %* \ No newline at end of file diff --git a/server/node_modules/vscode-languageserver-protocol/node_modules/vscode-jsonrpc/node.js b/server/node_modules/vscode-languageserver-protocol/node_modules/vscode-jsonrpc/node.js deleted file mode 100644 index 388e319..0000000 --- a/server/node_modules/vscode-languageserver-protocol/node_modules/vscode-jsonrpc/node.js +++ /dev/null @@ -1,7 +0,0 @@ -/* -------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * ----------------------------------------------------------------------------------------- */ -'use strict'; - -module.exports = require('./lib/node/main'); \ No newline at end of file diff --git a/server/node_modules/vscode-languageserver-protocol/node_modules/vscode-jsonrpc/package.json b/server/node_modules/vscode-languageserver-protocol/node_modules/vscode-jsonrpc/package.json deleted file mode 100644 index 8c7becf..0000000 --- a/server/node_modules/vscode-languageserver-protocol/node_modules/vscode-jsonrpc/package.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "name": "vscode-jsonrpc", - "description": "A json rpc implementation over streams", - "version": "6.0.0", - "author": "Microsoft Corporation", - "license": "MIT", - "repository": { - "type": "git", - "url": "https://github.com/Microsoft/vscode-languageserver-node.git", - "directory": "jsonrpc" - }, - "bugs": { - "url": "https://github.com/Microsoft/vscode-languageserver-node/issues" - }, - "engines": { - "node": ">=8.0.0 || >=10.0.0" - }, - "main": "./lib/node/main.js", - "browser": { - "./lib/node/main.js": "./lib/browser/main.js" - }, - "typings": "./lib/common/api.d.ts", - "devDependencies": { - "@types/msgpack-lite": "^0.1.7", - "msgpack-lite": "^0.1.26" - }, - "scripts": { - "prepublishOnly": "git clean -xfd . && npm install && npm run clean && npm run compile && npm test", - "postpublish": "node ../build/npm/post-publish.js", - "preversion": "npm test", - "compile": "node ../build/bin/tsc -b ./tsconfig.json", - "watch": "node ../build/bin/tsc -b ./tsconfig-watch.json -w", - "clean": "node ../node_modules/rimraf/bin.js lib && node ../node_modules/rimraf/bin.js dist", - "test": "npm run test:node && npm run test:browser", - "test:node": "node ../node_modules/mocha/bin/_mocha", - "test:browser": "npm run webpack:test:silent && node ../build/bin/runBrowserTests.js http://127.0.0.1:8080/jsonrpc/src/browser/test/", - "webpack": "node ../build/bin/webpack --mode none --config ./webpack.config.js", - "webpack:test": "node ../build/bin/webpack --mode none --config ./src/browser/test/webpack.config.js", - "webpack:test:silent": "node ../build/bin/webpack --no-stats --mode none --config ./src/browser/test/webpack.config.js" - } -} diff --git a/server/node_modules/vscode-languageserver-protocol/node_modules/vscode-jsonrpc/thirdpartynotices.txt b/server/node_modules/vscode-languageserver-protocol/node_modules/vscode-jsonrpc/thirdpartynotices.txt deleted file mode 100644 index 4a6720c..0000000 --- a/server/node_modules/vscode-languageserver-protocol/node_modules/vscode-jsonrpc/thirdpartynotices.txt +++ /dev/null @@ -1,31 +0,0 @@ -THIRD-PARTY SOFTWARE NOTICES AND INFORMATION -For Microsoft vscode-jsonrpc - -This project incorporates material from the project(s) listed below (collectively, “Third Party Code”). -Microsoft is not the original author of the Third Party Code. The original copyright notice and license -under which Microsoft received such Third Party Code are set out below. This Third Party Code is licensed -to you under their original license terms set forth below. Microsoft reserves all other rights not expressly -granted, whether by implication, estoppel or otherwise. - -1. DefinitelyTyped version 0.0.1 (https://github.com/borisyankov/DefinitelyTyped) - -This project is licensed under the MIT license. -Copyrights are respective of each contributor listed at the beginning of each definition file. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. \ No newline at end of file diff --git a/server/node_modules/vscode-languageserver-protocol/package.json b/server/node_modules/vscode-languageserver-protocol/package.json deleted file mode 100644 index 4f39d92..0000000 --- a/server/node_modules/vscode-languageserver-protocol/package.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "name": "vscode-languageserver-protocol", - "description": "VSCode Language Server Protocol implementation", - "version": "3.16.0", - "author": "Microsoft Corporation", - "license": "MIT", - "repository": { - "type": "git", - "url": "https://github.com/Microsoft/vscode-languageserver-node.git", - "directory": "protocol" - }, - "bugs": { - "url": "https://github.com/Microsoft/vscode-languageserver-node/issues" - }, - "main": "./lib/node/main.js", - "browser": { - "./lib/node/main.js": "./lib/browser/main.js" - }, - "typings": "./lib/common/api.d.ts", - "dependencies": { - "vscode-jsonrpc": "6.0.0", - "vscode-languageserver-types": "3.16.0" - }, - "scripts": { - "prepublishOnly": "git clean -xfd . && npm install && npm run clean && npm run compile && npm test", - "postpublish": "node ../build/npm/post-publish.js", - "preversion": "npm test", - "compile": "node ../build/bin/tsc -b ./tsconfig.json", - "watch": "node ../build/bin/tsc -b ./tsconfig-watch.json -w", - "clean": "node ../node_modules/rimraf/bin.js lib && node ../node_modules/rimraf/bin.js dist", - "test": "npm run test:node && npm run test:browser", - "test:node": "node ../node_modules/mocha/bin/_mocha", - "test:browser": "npm run webpack:test:silent && node ../build/bin/runBrowserTests.js http://127.0.0.1:8080/protocol/src/browser/test/", - "webpack:test": "cd ../types && npm run compile:esm && cd ../protocol && node ../build/bin/webpack --mode none --config ./src/browser/test/webpack.config.js", - "webpack:test:silent": "cd ../types && npm run compile:esm && cd ../protocol && node ../build/bin/webpack --no-stats --mode none --config ./src/browser/test/webpack.config.js" - } -} diff --git a/server/node_modules/vscode-languageserver-protocol/thirdpartynotices.txt b/server/node_modules/vscode-languageserver-protocol/thirdpartynotices.txt deleted file mode 100644 index b7a9030..0000000 --- a/server/node_modules/vscode-languageserver-protocol/thirdpartynotices.txt +++ /dev/null @@ -1,31 +0,0 @@ -THIRD-PARTY SOFTWARE NOTICES AND INFORMATION -For Microsoft vscode-languageclient - -This project incorporates material from the project(s) listed below (collectively, “Third Party Code”). -Microsoft is not the original author of the Third Party Code. The original copyright notice and license -under which Microsoft received such Third Party Code are set out below. This Third Party Code is licensed -to you under their original license terms set forth below. Microsoft reserves all other rights not expressly -granted, whether by implication, estoppel or otherwise. - -1. DefinitelyTyped version 0.0.1 (https://github.com/borisyankov/DefinitelyTyped) - -This project is licensed under the MIT license. -Copyrights are respective of each contributor listed at the beginning of each definition file. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. \ No newline at end of file diff --git a/server/node_modules/vscode-languageserver-types/License.txt b/server/node_modules/vscode-languageserver-types/License.txt deleted file mode 100644 index a07e3ae..0000000 --- a/server/node_modules/vscode-languageserver-types/License.txt +++ /dev/null @@ -1,11 +0,0 @@ -Copyright (c) Microsoft Corporation - -All rights reserved. - -MIT License - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/server/node_modules/vscode-languageserver-types/README.md b/server/node_modules/vscode-languageserver-types/README.md deleted file mode 100644 index d47c6d8..0000000 --- a/server/node_modules/vscode-languageserver-types/README.md +++ /dev/null @@ -1,17 +0,0 @@ -# VSCode Language Server Types - -[![NPM Version](https://img.shields.io/npm/v/vscode-languageserver-types.svg)](https://npmjs.org/package/vscode-languageserver-types) -[![NPM Downloads](https://img.shields.io/npm/dm/vscode-languageserver-types.svg)](https://npmjs.org/package/vscode-languageserver-types) -[![Build Status](https://travis-ci.org/Microsoft/vscode-languageserver-types-node.svg?branch=master)](https://travis-ci.org/Microsoft/vscode-languageserver-types-node) - -Npm module containing the types used by the VSCode language client and [Node.js](https://nodejs.org/) language server - -Click [here](https://code.visualstudio.com/docs/extensions/example-language-server) for a detailed document on how -to implement language servers for [VSCode](https://code.visualstudio.com/). - -## History - -For the history please see the [main repository](https://github.com/Microsoft/vscode-languageserver-node/blob/master/README.md) - -## License -[MIT](https://github.com/Microsoft/vscode-languageserver-node/blob/master/License.txt) diff --git a/server/node_modules/vscode-languageserver-types/lib/esm/main.js b/server/node_modules/vscode-languageserver-types/lib/esm/main.js deleted file mode 100644 index fd0c7d6..0000000 --- a/server/node_modules/vscode-languageserver-types/lib/esm/main.js +++ /dev/null @@ -1,1908 +0,0 @@ -/* -------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * ------------------------------------------------------------------------------------------ */ -'use strict'; -export var integer; -(function (integer) { - integer.MIN_VALUE = -2147483648; - integer.MAX_VALUE = 2147483647; -})(integer || (integer = {})); -export var uinteger; -(function (uinteger) { - uinteger.MIN_VALUE = 0; - uinteger.MAX_VALUE = 2147483647; -})(uinteger || (uinteger = {})); -/** - * The Position namespace provides helper functions to work with - * [Position](#Position) literals. - */ -export var Position; -(function (Position) { - /** - * Creates a new Position literal from the given line and character. - * @param line The position's line. - * @param character The position's character. - */ - function create(line, character) { - if (line === Number.MAX_VALUE) { - line = uinteger.MAX_VALUE; - } - if (character === Number.MAX_VALUE) { - character = uinteger.MAX_VALUE; - } - return { line: line, character: character }; - } - Position.create = create; - /** - * Checks whether the given literal conforms to the [Position](#Position) interface. - */ - function is(value) { - var candidate = value; - return Is.objectLiteral(candidate) && Is.uinteger(candidate.line) && Is.uinteger(candidate.character); - } - Position.is = is; -})(Position || (Position = {})); -/** - * The Range namespace provides helper functions to work with - * [Range](#Range) literals. - */ -export var Range; -(function (Range) { - function create(one, two, three, four) { - if (Is.uinteger(one) && Is.uinteger(two) && Is.uinteger(three) && Is.uinteger(four)) { - return { start: Position.create(one, two), end: Position.create(three, four) }; - } - else if (Position.is(one) && Position.is(two)) { - return { start: one, end: two }; - } - else { - throw new Error("Range#create called with invalid arguments[" + one + ", " + two + ", " + three + ", " + four + "]"); - } - } - Range.create = create; - /** - * Checks whether the given literal conforms to the [Range](#Range) interface. - */ - function is(value) { - var candidate = value; - return Is.objectLiteral(candidate) && Position.is(candidate.start) && Position.is(candidate.end); - } - Range.is = is; -})(Range || (Range = {})); -/** - * The Location namespace provides helper functions to work with - * [Location](#Location) literals. - */ -export var Location; -(function (Location) { - /** - * Creates a Location literal. - * @param uri The location's uri. - * @param range The location's range. - */ - function create(uri, range) { - return { uri: uri, range: range }; - } - Location.create = create; - /** - * Checks whether the given literal conforms to the [Location](#Location) interface. - */ - function is(value) { - var candidate = value; - return Is.defined(candidate) && Range.is(candidate.range) && (Is.string(candidate.uri) || Is.undefined(candidate.uri)); - } - Location.is = is; -})(Location || (Location = {})); -/** - * The LocationLink namespace provides helper functions to work with - * [LocationLink](#LocationLink) literals. - */ -export var LocationLink; -(function (LocationLink) { - /** - * Creates a LocationLink literal. - * @param targetUri The definition's uri. - * @param targetRange The full range of the definition. - * @param targetSelectionRange The span of the symbol definition at the target. - * @param originSelectionRange The span of the symbol being defined in the originating source file. - */ - function create(targetUri, targetRange, targetSelectionRange, originSelectionRange) { - return { targetUri: targetUri, targetRange: targetRange, targetSelectionRange: targetSelectionRange, originSelectionRange: originSelectionRange }; - } - LocationLink.create = create; - /** - * Checks whether the given literal conforms to the [LocationLink](#LocationLink) interface. - */ - function is(value) { - var candidate = value; - return Is.defined(candidate) && Range.is(candidate.targetRange) && Is.string(candidate.targetUri) - && (Range.is(candidate.targetSelectionRange) || Is.undefined(candidate.targetSelectionRange)) - && (Range.is(candidate.originSelectionRange) || Is.undefined(candidate.originSelectionRange)); - } - LocationLink.is = is; -})(LocationLink || (LocationLink = {})); -/** - * The Color namespace provides helper functions to work with - * [Color](#Color) literals. - */ -export var Color; -(function (Color) { - /** - * Creates a new Color literal. - */ - function create(red, green, blue, alpha) { - return { - red: red, - green: green, - blue: blue, - alpha: alpha, - }; - } - Color.create = create; - /** - * Checks whether the given literal conforms to the [Color](#Color) interface. - */ - function is(value) { - var candidate = value; - return Is.numberRange(candidate.red, 0, 1) - && Is.numberRange(candidate.green, 0, 1) - && Is.numberRange(candidate.blue, 0, 1) - && Is.numberRange(candidate.alpha, 0, 1); - } - Color.is = is; -})(Color || (Color = {})); -/** - * The ColorInformation namespace provides helper functions to work with - * [ColorInformation](#ColorInformation) literals. - */ -export var ColorInformation; -(function (ColorInformation) { - /** - * Creates a new ColorInformation literal. - */ - function create(range, color) { - return { - range: range, - color: color, - }; - } - ColorInformation.create = create; - /** - * Checks whether the given literal conforms to the [ColorInformation](#ColorInformation) interface. - */ - function is(value) { - var candidate = value; - return Range.is(candidate.range) && Color.is(candidate.color); - } - ColorInformation.is = is; -})(ColorInformation || (ColorInformation = {})); -/** - * The Color namespace provides helper functions to work with - * [ColorPresentation](#ColorPresentation) literals. - */ -export var ColorPresentation; -(function (ColorPresentation) { - /** - * Creates a new ColorInformation literal. - */ - function create(label, textEdit, additionalTextEdits) { - return { - label: label, - textEdit: textEdit, - additionalTextEdits: additionalTextEdits, - }; - } - ColorPresentation.create = create; - /** - * Checks whether the given literal conforms to the [ColorInformation](#ColorInformation) interface. - */ - function is(value) { - var candidate = value; - return Is.string(candidate.label) - && (Is.undefined(candidate.textEdit) || TextEdit.is(candidate)) - && (Is.undefined(candidate.additionalTextEdits) || Is.typedArray(candidate.additionalTextEdits, TextEdit.is)); - } - ColorPresentation.is = is; -})(ColorPresentation || (ColorPresentation = {})); -/** - * Enum of known range kinds - */ -export var FoldingRangeKind; -(function (FoldingRangeKind) { - /** - * Folding range for a comment - */ - FoldingRangeKind["Comment"] = "comment"; - /** - * Folding range for a imports or includes - */ - FoldingRangeKind["Imports"] = "imports"; - /** - * Folding range for a region (e.g. `#region`) - */ - FoldingRangeKind["Region"] = "region"; -})(FoldingRangeKind || (FoldingRangeKind = {})); -/** - * The folding range namespace provides helper functions to work with - * [FoldingRange](#FoldingRange) literals. - */ -export var FoldingRange; -(function (FoldingRange) { - /** - * Creates a new FoldingRange literal. - */ - function create(startLine, endLine, startCharacter, endCharacter, kind) { - var result = { - startLine: startLine, - endLine: endLine - }; - if (Is.defined(startCharacter)) { - result.startCharacter = startCharacter; - } - if (Is.defined(endCharacter)) { - result.endCharacter = endCharacter; - } - if (Is.defined(kind)) { - result.kind = kind; - } - return result; - } - FoldingRange.create = create; - /** - * Checks whether the given literal conforms to the [FoldingRange](#FoldingRange) interface. - */ - function is(value) { - var candidate = value; - return Is.uinteger(candidate.startLine) && Is.uinteger(candidate.startLine) - && (Is.undefined(candidate.startCharacter) || Is.uinteger(candidate.startCharacter)) - && (Is.undefined(candidate.endCharacter) || Is.uinteger(candidate.endCharacter)) - && (Is.undefined(candidate.kind) || Is.string(candidate.kind)); - } - FoldingRange.is = is; -})(FoldingRange || (FoldingRange = {})); -/** - * The DiagnosticRelatedInformation namespace provides helper functions to work with - * [DiagnosticRelatedInformation](#DiagnosticRelatedInformation) literals. - */ -export var DiagnosticRelatedInformation; -(function (DiagnosticRelatedInformation) { - /** - * Creates a new DiagnosticRelatedInformation literal. - */ - function create(location, message) { - return { - location: location, - message: message - }; - } - DiagnosticRelatedInformation.create = create; - /** - * Checks whether the given literal conforms to the [DiagnosticRelatedInformation](#DiagnosticRelatedInformation) interface. - */ - function is(value) { - var candidate = value; - return Is.defined(candidate) && Location.is(candidate.location) && Is.string(candidate.message); - } - DiagnosticRelatedInformation.is = is; -})(DiagnosticRelatedInformation || (DiagnosticRelatedInformation = {})); -/** - * The diagnostic's severity. - */ -export var DiagnosticSeverity; -(function (DiagnosticSeverity) { - /** - * Reports an error. - */ - DiagnosticSeverity.Error = 1; - /** - * Reports a warning. - */ - DiagnosticSeverity.Warning = 2; - /** - * Reports an information. - */ - DiagnosticSeverity.Information = 3; - /** - * Reports a hint. - */ - DiagnosticSeverity.Hint = 4; -})(DiagnosticSeverity || (DiagnosticSeverity = {})); -/** - * The diagnostic tags. - * - * @since 3.15.0 - */ -export var DiagnosticTag; -(function (DiagnosticTag) { - /** - * Unused or unnecessary code. - * - * Clients are allowed to render diagnostics with this tag faded out instead of having - * an error squiggle. - */ - DiagnosticTag.Unnecessary = 1; - /** - * Deprecated or obsolete code. - * - * Clients are allowed to rendered diagnostics with this tag strike through. - */ - DiagnosticTag.Deprecated = 2; -})(DiagnosticTag || (DiagnosticTag = {})); -/** - * The CodeDescription namespace provides functions to deal with descriptions for diagnostic codes. - * - * @since 3.16.0 - */ -export var CodeDescription; -(function (CodeDescription) { - function is(value) { - var candidate = value; - return candidate !== undefined && candidate !== null && Is.string(candidate.href); - } - CodeDescription.is = is; -})(CodeDescription || (CodeDescription = {})); -/** - * The Diagnostic namespace provides helper functions to work with - * [Diagnostic](#Diagnostic) literals. - */ -export var Diagnostic; -(function (Diagnostic) { - /** - * Creates a new Diagnostic literal. - */ - function create(range, message, severity, code, source, relatedInformation) { - var result = { range: range, message: message }; - if (Is.defined(severity)) { - result.severity = severity; - } - if (Is.defined(code)) { - result.code = code; - } - if (Is.defined(source)) { - result.source = source; - } - if (Is.defined(relatedInformation)) { - result.relatedInformation = relatedInformation; - } - return result; - } - Diagnostic.create = create; - /** - * Checks whether the given literal conforms to the [Diagnostic](#Diagnostic) interface. - */ - function is(value) { - var _a; - var candidate = value; - return Is.defined(candidate) - && Range.is(candidate.range) - && Is.string(candidate.message) - && (Is.number(candidate.severity) || Is.undefined(candidate.severity)) - && (Is.integer(candidate.code) || Is.string(candidate.code) || Is.undefined(candidate.code)) - && (Is.undefined(candidate.codeDescription) || (Is.string((_a = candidate.codeDescription) === null || _a === void 0 ? void 0 : _a.href))) - && (Is.string(candidate.source) || Is.undefined(candidate.source)) - && (Is.undefined(candidate.relatedInformation) || Is.typedArray(candidate.relatedInformation, DiagnosticRelatedInformation.is)); - } - Diagnostic.is = is; -})(Diagnostic || (Diagnostic = {})); -/** - * The Command namespace provides helper functions to work with - * [Command](#Command) literals. - */ -export var Command; -(function (Command) { - /** - * Creates a new Command literal. - */ - function create(title, command) { - var args = []; - for (var _i = 2; _i < arguments.length; _i++) { - args[_i - 2] = arguments[_i]; - } - var result = { title: title, command: command }; - if (Is.defined(args) && args.length > 0) { - result.arguments = args; - } - return result; - } - Command.create = create; - /** - * Checks whether the given literal conforms to the [Command](#Command) interface. - */ - function is(value) { - var candidate = value; - return Is.defined(candidate) && Is.string(candidate.title) && Is.string(candidate.command); - } - Command.is = is; -})(Command || (Command = {})); -/** - * The TextEdit namespace provides helper function to create replace, - * insert and delete edits more easily. - */ -export var TextEdit; -(function (TextEdit) { - /** - * Creates a replace text edit. - * @param range The range of text to be replaced. - * @param newText The new text. - */ - function replace(range, newText) { - return { range: range, newText: newText }; - } - TextEdit.replace = replace; - /** - * Creates a insert text edit. - * @param position The position to insert the text at. - * @param newText The text to be inserted. - */ - function insert(position, newText) { - return { range: { start: position, end: position }, newText: newText }; - } - TextEdit.insert = insert; - /** - * Creates a delete text edit. - * @param range The range of text to be deleted. - */ - function del(range) { - return { range: range, newText: '' }; - } - TextEdit.del = del; - function is(value) { - var candidate = value; - return Is.objectLiteral(candidate) - && Is.string(candidate.newText) - && Range.is(candidate.range); - } - TextEdit.is = is; -})(TextEdit || (TextEdit = {})); -export var ChangeAnnotation; -(function (ChangeAnnotation) { - function create(label, needsConfirmation, description) { - var result = { label: label }; - if (needsConfirmation !== undefined) { - result.needsConfirmation = needsConfirmation; - } - if (description !== undefined) { - result.description = description; - } - return result; - } - ChangeAnnotation.create = create; - function is(value) { - var candidate = value; - return candidate !== undefined && Is.objectLiteral(candidate) && Is.string(candidate.label) && - (Is.boolean(candidate.needsConfirmation) || candidate.needsConfirmation === undefined) && - (Is.string(candidate.description) || candidate.description === undefined); - } - ChangeAnnotation.is = is; -})(ChangeAnnotation || (ChangeAnnotation = {})); -export var ChangeAnnotationIdentifier; -(function (ChangeAnnotationIdentifier) { - function is(value) { - var candidate = value; - return typeof candidate === 'string'; - } - ChangeAnnotationIdentifier.is = is; -})(ChangeAnnotationIdentifier || (ChangeAnnotationIdentifier = {})); -export var AnnotatedTextEdit; -(function (AnnotatedTextEdit) { - /** - * Creates an annotated replace text edit. - * - * @param range The range of text to be replaced. - * @param newText The new text. - * @param annotation The annotation. - */ - function replace(range, newText, annotation) { - return { range: range, newText: newText, annotationId: annotation }; - } - AnnotatedTextEdit.replace = replace; - /** - * Creates an annotated insert text edit. - * - * @param position The position to insert the text at. - * @param newText The text to be inserted. - * @param annotation The annotation. - */ - function insert(position, newText, annotation) { - return { range: { start: position, end: position }, newText: newText, annotationId: annotation }; - } - AnnotatedTextEdit.insert = insert; - /** - * Creates an annotated delete text edit. - * - * @param range The range of text to be deleted. - * @param annotation The annotation. - */ - function del(range, annotation) { - return { range: range, newText: '', annotationId: annotation }; - } - AnnotatedTextEdit.del = del; - function is(value) { - var candidate = value; - return TextEdit.is(candidate) && (ChangeAnnotation.is(candidate.annotationId) || ChangeAnnotationIdentifier.is(candidate.annotationId)); - } - AnnotatedTextEdit.is = is; -})(AnnotatedTextEdit || (AnnotatedTextEdit = {})); -/** - * The TextDocumentEdit namespace provides helper function to create - * an edit that manipulates a text document. - */ -export var TextDocumentEdit; -(function (TextDocumentEdit) { - /** - * Creates a new `TextDocumentEdit` - */ - function create(textDocument, edits) { - return { textDocument: textDocument, edits: edits }; - } - TextDocumentEdit.create = create; - function is(value) { - var candidate = value; - return Is.defined(candidate) - && OptionalVersionedTextDocumentIdentifier.is(candidate.textDocument) - && Array.isArray(candidate.edits); - } - TextDocumentEdit.is = is; -})(TextDocumentEdit || (TextDocumentEdit = {})); -export var CreateFile; -(function (CreateFile) { - function create(uri, options, annotation) { - var result = { - kind: 'create', - uri: uri - }; - if (options !== undefined && (options.overwrite !== undefined || options.ignoreIfExists !== undefined)) { - result.options = options; - } - if (annotation !== undefined) { - result.annotationId = annotation; - } - return result; - } - CreateFile.create = create; - function is(value) { - var candidate = value; - return candidate && candidate.kind === 'create' && Is.string(candidate.uri) && (candidate.options === undefined || - ((candidate.options.overwrite === undefined || Is.boolean(candidate.options.overwrite)) && (candidate.options.ignoreIfExists === undefined || Is.boolean(candidate.options.ignoreIfExists)))) && (candidate.annotationId === undefined || ChangeAnnotationIdentifier.is(candidate.annotationId)); - } - CreateFile.is = is; -})(CreateFile || (CreateFile = {})); -export var RenameFile; -(function (RenameFile) { - function create(oldUri, newUri, options, annotation) { - var result = { - kind: 'rename', - oldUri: oldUri, - newUri: newUri - }; - if (options !== undefined && (options.overwrite !== undefined || options.ignoreIfExists !== undefined)) { - result.options = options; - } - if (annotation !== undefined) { - result.annotationId = annotation; - } - return result; - } - RenameFile.create = create; - function is(value) { - var candidate = value; - return candidate && candidate.kind === 'rename' && Is.string(candidate.oldUri) && Is.string(candidate.newUri) && (candidate.options === undefined || - ((candidate.options.overwrite === undefined || Is.boolean(candidate.options.overwrite)) && (candidate.options.ignoreIfExists === undefined || Is.boolean(candidate.options.ignoreIfExists)))) && (candidate.annotationId === undefined || ChangeAnnotationIdentifier.is(candidate.annotationId)); - } - RenameFile.is = is; -})(RenameFile || (RenameFile = {})); -export var DeleteFile; -(function (DeleteFile) { - function create(uri, options, annotation) { - var result = { - kind: 'delete', - uri: uri - }; - if (options !== undefined && (options.recursive !== undefined || options.ignoreIfNotExists !== undefined)) { - result.options = options; - } - if (annotation !== undefined) { - result.annotationId = annotation; - } - return result; - } - DeleteFile.create = create; - function is(value) { - var candidate = value; - return candidate && candidate.kind === 'delete' && Is.string(candidate.uri) && (candidate.options === undefined || - ((candidate.options.recursive === undefined || Is.boolean(candidate.options.recursive)) && (candidate.options.ignoreIfNotExists === undefined || Is.boolean(candidate.options.ignoreIfNotExists)))) && (candidate.annotationId === undefined || ChangeAnnotationIdentifier.is(candidate.annotationId)); - } - DeleteFile.is = is; -})(DeleteFile || (DeleteFile = {})); -export var WorkspaceEdit; -(function (WorkspaceEdit) { - function is(value) { - var candidate = value; - return candidate && - (candidate.changes !== undefined || candidate.documentChanges !== undefined) && - (candidate.documentChanges === undefined || candidate.documentChanges.every(function (change) { - if (Is.string(change.kind)) { - return CreateFile.is(change) || RenameFile.is(change) || DeleteFile.is(change); - } - else { - return TextDocumentEdit.is(change); - } - })); - } - WorkspaceEdit.is = is; -})(WorkspaceEdit || (WorkspaceEdit = {})); -var TextEditChangeImpl = /** @class */ (function () { - function TextEditChangeImpl(edits, changeAnnotations) { - this.edits = edits; - this.changeAnnotations = changeAnnotations; - } - TextEditChangeImpl.prototype.insert = function (position, newText, annotation) { - var edit; - var id; - if (annotation === undefined) { - edit = TextEdit.insert(position, newText); - } - else if (ChangeAnnotationIdentifier.is(annotation)) { - id = annotation; - edit = AnnotatedTextEdit.insert(position, newText, annotation); - } - else { - this.assertChangeAnnotations(this.changeAnnotations); - id = this.changeAnnotations.manage(annotation); - edit = AnnotatedTextEdit.insert(position, newText, id); - } - this.edits.push(edit); - if (id !== undefined) { - return id; - } - }; - TextEditChangeImpl.prototype.replace = function (range, newText, annotation) { - var edit; - var id; - if (annotation === undefined) { - edit = TextEdit.replace(range, newText); - } - else if (ChangeAnnotationIdentifier.is(annotation)) { - id = annotation; - edit = AnnotatedTextEdit.replace(range, newText, annotation); - } - else { - this.assertChangeAnnotations(this.changeAnnotations); - id = this.changeAnnotations.manage(annotation); - edit = AnnotatedTextEdit.replace(range, newText, id); - } - this.edits.push(edit); - if (id !== undefined) { - return id; - } - }; - TextEditChangeImpl.prototype.delete = function (range, annotation) { - var edit; - var id; - if (annotation === undefined) { - edit = TextEdit.del(range); - } - else if (ChangeAnnotationIdentifier.is(annotation)) { - id = annotation; - edit = AnnotatedTextEdit.del(range, annotation); - } - else { - this.assertChangeAnnotations(this.changeAnnotations); - id = this.changeAnnotations.manage(annotation); - edit = AnnotatedTextEdit.del(range, id); - } - this.edits.push(edit); - if (id !== undefined) { - return id; - } - }; - TextEditChangeImpl.prototype.add = function (edit) { - this.edits.push(edit); - }; - TextEditChangeImpl.prototype.all = function () { - return this.edits; - }; - TextEditChangeImpl.prototype.clear = function () { - this.edits.splice(0, this.edits.length); - }; - TextEditChangeImpl.prototype.assertChangeAnnotations = function (value) { - if (value === undefined) { - throw new Error("Text edit change is not configured to manage change annotations."); - } - }; - return TextEditChangeImpl; -}()); -/** - * A helper class - */ -var ChangeAnnotations = /** @class */ (function () { - function ChangeAnnotations(annotations) { - this._annotations = annotations === undefined ? Object.create(null) : annotations; - this._counter = 0; - this._size = 0; - } - ChangeAnnotations.prototype.all = function () { - return this._annotations; - }; - Object.defineProperty(ChangeAnnotations.prototype, "size", { - get: function () { - return this._size; - }, - enumerable: false, - configurable: true - }); - ChangeAnnotations.prototype.manage = function (idOrAnnotation, annotation) { - var id; - if (ChangeAnnotationIdentifier.is(idOrAnnotation)) { - id = idOrAnnotation; - } - else { - id = this.nextId(); - annotation = idOrAnnotation; - } - if (this._annotations[id] !== undefined) { - throw new Error("Id " + id + " is already in use."); - } - if (annotation === undefined) { - throw new Error("No annotation provided for id " + id); - } - this._annotations[id] = annotation; - this._size++; - return id; - }; - ChangeAnnotations.prototype.nextId = function () { - this._counter++; - return this._counter.toString(); - }; - return ChangeAnnotations; -}()); -/** - * A workspace change helps constructing changes to a workspace. - */ -var WorkspaceChange = /** @class */ (function () { - function WorkspaceChange(workspaceEdit) { - var _this = this; - this._textEditChanges = Object.create(null); - if (workspaceEdit !== undefined) { - this._workspaceEdit = workspaceEdit; - if (workspaceEdit.documentChanges) { - this._changeAnnotations = new ChangeAnnotations(workspaceEdit.changeAnnotations); - workspaceEdit.changeAnnotations = this._changeAnnotations.all(); - workspaceEdit.documentChanges.forEach(function (change) { - if (TextDocumentEdit.is(change)) { - var textEditChange = new TextEditChangeImpl(change.edits, _this._changeAnnotations); - _this._textEditChanges[change.textDocument.uri] = textEditChange; - } - }); - } - else if (workspaceEdit.changes) { - Object.keys(workspaceEdit.changes).forEach(function (key) { - var textEditChange = new TextEditChangeImpl(workspaceEdit.changes[key]); - _this._textEditChanges[key] = textEditChange; - }); - } - } - else { - this._workspaceEdit = {}; - } - } - Object.defineProperty(WorkspaceChange.prototype, "edit", { - /** - * Returns the underlying [WorkspaceEdit](#WorkspaceEdit) literal - * use to be returned from a workspace edit operation like rename. - */ - get: function () { - this.initDocumentChanges(); - if (this._changeAnnotations !== undefined) { - if (this._changeAnnotations.size === 0) { - this._workspaceEdit.changeAnnotations = undefined; - } - else { - this._workspaceEdit.changeAnnotations = this._changeAnnotations.all(); - } - } - return this._workspaceEdit; - }, - enumerable: false, - configurable: true - }); - WorkspaceChange.prototype.getTextEditChange = function (key) { - if (OptionalVersionedTextDocumentIdentifier.is(key)) { - this.initDocumentChanges(); - if (this._workspaceEdit.documentChanges === undefined) { - throw new Error('Workspace edit is not configured for document changes.'); - } - var textDocument = { uri: key.uri, version: key.version }; - var result = this._textEditChanges[textDocument.uri]; - if (!result) { - var edits = []; - var textDocumentEdit = { - textDocument: textDocument, - edits: edits - }; - this._workspaceEdit.documentChanges.push(textDocumentEdit); - result = new TextEditChangeImpl(edits, this._changeAnnotations); - this._textEditChanges[textDocument.uri] = result; - } - return result; - } - else { - this.initChanges(); - if (this._workspaceEdit.changes === undefined) { - throw new Error('Workspace edit is not configured for normal text edit changes.'); - } - var result = this._textEditChanges[key]; - if (!result) { - var edits = []; - this._workspaceEdit.changes[key] = edits; - result = new TextEditChangeImpl(edits); - this._textEditChanges[key] = result; - } - return result; - } - }; - WorkspaceChange.prototype.initDocumentChanges = function () { - if (this._workspaceEdit.documentChanges === undefined && this._workspaceEdit.changes === undefined) { - this._changeAnnotations = new ChangeAnnotations(); - this._workspaceEdit.documentChanges = []; - this._workspaceEdit.changeAnnotations = this._changeAnnotations.all(); - } - }; - WorkspaceChange.prototype.initChanges = function () { - if (this._workspaceEdit.documentChanges === undefined && this._workspaceEdit.changes === undefined) { - this._workspaceEdit.changes = Object.create(null); - } - }; - WorkspaceChange.prototype.createFile = function (uri, optionsOrAnnotation, options) { - this.initDocumentChanges(); - if (this._workspaceEdit.documentChanges === undefined) { - throw new Error('Workspace edit is not configured for document changes.'); - } - var annotation; - if (ChangeAnnotation.is(optionsOrAnnotation) || ChangeAnnotationIdentifier.is(optionsOrAnnotation)) { - annotation = optionsOrAnnotation; - } - else { - options = optionsOrAnnotation; - } - var operation; - var id; - if (annotation === undefined) { - operation = CreateFile.create(uri, options); - } - else { - id = ChangeAnnotationIdentifier.is(annotation) ? annotation : this._changeAnnotations.manage(annotation); - operation = CreateFile.create(uri, options, id); - } - this._workspaceEdit.documentChanges.push(operation); - if (id !== undefined) { - return id; - } - }; - WorkspaceChange.prototype.renameFile = function (oldUri, newUri, optionsOrAnnotation, options) { - this.initDocumentChanges(); - if (this._workspaceEdit.documentChanges === undefined) { - throw new Error('Workspace edit is not configured for document changes.'); - } - var annotation; - if (ChangeAnnotation.is(optionsOrAnnotation) || ChangeAnnotationIdentifier.is(optionsOrAnnotation)) { - annotation = optionsOrAnnotation; - } - else { - options = optionsOrAnnotation; - } - var operation; - var id; - if (annotation === undefined) { - operation = RenameFile.create(oldUri, newUri, options); - } - else { - id = ChangeAnnotationIdentifier.is(annotation) ? annotation : this._changeAnnotations.manage(annotation); - operation = RenameFile.create(oldUri, newUri, options, id); - } - this._workspaceEdit.documentChanges.push(operation); - if (id !== undefined) { - return id; - } - }; - WorkspaceChange.prototype.deleteFile = function (uri, optionsOrAnnotation, options) { - this.initDocumentChanges(); - if (this._workspaceEdit.documentChanges === undefined) { - throw new Error('Workspace edit is not configured for document changes.'); - } - var annotation; - if (ChangeAnnotation.is(optionsOrAnnotation) || ChangeAnnotationIdentifier.is(optionsOrAnnotation)) { - annotation = optionsOrAnnotation; - } - else { - options = optionsOrAnnotation; - } - var operation; - var id; - if (annotation === undefined) { - operation = DeleteFile.create(uri, options); - } - else { - id = ChangeAnnotationIdentifier.is(annotation) ? annotation : this._changeAnnotations.manage(annotation); - operation = DeleteFile.create(uri, options, id); - } - this._workspaceEdit.documentChanges.push(operation); - if (id !== undefined) { - return id; - } - }; - return WorkspaceChange; -}()); -export { WorkspaceChange }; -/** - * The TextDocumentIdentifier namespace provides helper functions to work with - * [TextDocumentIdentifier](#TextDocumentIdentifier) literals. - */ -export var TextDocumentIdentifier; -(function (TextDocumentIdentifier) { - /** - * Creates a new TextDocumentIdentifier literal. - * @param uri The document's uri. - */ - function create(uri) { - return { uri: uri }; - } - TextDocumentIdentifier.create = create; - /** - * Checks whether the given literal conforms to the [TextDocumentIdentifier](#TextDocumentIdentifier) interface. - */ - function is(value) { - var candidate = value; - return Is.defined(candidate) && Is.string(candidate.uri); - } - TextDocumentIdentifier.is = is; -})(TextDocumentIdentifier || (TextDocumentIdentifier = {})); -/** - * The VersionedTextDocumentIdentifier namespace provides helper functions to work with - * [VersionedTextDocumentIdentifier](#VersionedTextDocumentIdentifier) literals. - */ -export var VersionedTextDocumentIdentifier; -(function (VersionedTextDocumentIdentifier) { - /** - * Creates a new VersionedTextDocumentIdentifier literal. - * @param uri The document's uri. - * @param uri The document's text. - */ - function create(uri, version) { - return { uri: uri, version: version }; - } - VersionedTextDocumentIdentifier.create = create; - /** - * Checks whether the given literal conforms to the [VersionedTextDocumentIdentifier](#VersionedTextDocumentIdentifier) interface. - */ - function is(value) { - var candidate = value; - return Is.defined(candidate) && Is.string(candidate.uri) && Is.integer(candidate.version); - } - VersionedTextDocumentIdentifier.is = is; -})(VersionedTextDocumentIdentifier || (VersionedTextDocumentIdentifier = {})); -/** - * The OptionalVersionedTextDocumentIdentifier namespace provides helper functions to work with - * [OptionalVersionedTextDocumentIdentifier](#OptionalVersionedTextDocumentIdentifier) literals. - */ -export var OptionalVersionedTextDocumentIdentifier; -(function (OptionalVersionedTextDocumentIdentifier) { - /** - * Creates a new OptionalVersionedTextDocumentIdentifier literal. - * @param uri The document's uri. - * @param uri The document's text. - */ - function create(uri, version) { - return { uri: uri, version: version }; - } - OptionalVersionedTextDocumentIdentifier.create = create; - /** - * Checks whether the given literal conforms to the [OptionalVersionedTextDocumentIdentifier](#OptionalVersionedTextDocumentIdentifier) interface. - */ - function is(value) { - var candidate = value; - return Is.defined(candidate) && Is.string(candidate.uri) && (candidate.version === null || Is.integer(candidate.version)); - } - OptionalVersionedTextDocumentIdentifier.is = is; -})(OptionalVersionedTextDocumentIdentifier || (OptionalVersionedTextDocumentIdentifier = {})); -/** - * The TextDocumentItem namespace provides helper functions to work with - * [TextDocumentItem](#TextDocumentItem) literals. - */ -export var TextDocumentItem; -(function (TextDocumentItem) { - /** - * Creates a new TextDocumentItem literal. - * @param uri The document's uri. - * @param languageId The document's language identifier. - * @param version The document's version number. - * @param text The document's text. - */ - function create(uri, languageId, version, text) { - return { uri: uri, languageId: languageId, version: version, text: text }; - } - TextDocumentItem.create = create; - /** - * Checks whether the given literal conforms to the [TextDocumentItem](#TextDocumentItem) interface. - */ - function is(value) { - var candidate = value; - return Is.defined(candidate) && Is.string(candidate.uri) && Is.string(candidate.languageId) && Is.integer(candidate.version) && Is.string(candidate.text); - } - TextDocumentItem.is = is; -})(TextDocumentItem || (TextDocumentItem = {})); -/** - * Describes the content type that a client supports in various - * result literals like `Hover`, `ParameterInfo` or `CompletionItem`. - * - * Please note that `MarkupKinds` must not start with a `$`. This kinds - * are reserved for internal usage. - */ -export var MarkupKind; -(function (MarkupKind) { - /** - * Plain text is supported as a content format - */ - MarkupKind.PlainText = 'plaintext'; - /** - * Markdown is supported as a content format - */ - MarkupKind.Markdown = 'markdown'; -})(MarkupKind || (MarkupKind = {})); -(function (MarkupKind) { - /** - * Checks whether the given value is a value of the [MarkupKind](#MarkupKind) type. - */ - function is(value) { - var candidate = value; - return candidate === MarkupKind.PlainText || candidate === MarkupKind.Markdown; - } - MarkupKind.is = is; -})(MarkupKind || (MarkupKind = {})); -export var MarkupContent; -(function (MarkupContent) { - /** - * Checks whether the given value conforms to the [MarkupContent](#MarkupContent) interface. - */ - function is(value) { - var candidate = value; - return Is.objectLiteral(value) && MarkupKind.is(candidate.kind) && Is.string(candidate.value); - } - MarkupContent.is = is; -})(MarkupContent || (MarkupContent = {})); -/** - * The kind of a completion entry. - */ -export var CompletionItemKind; -(function (CompletionItemKind) { - CompletionItemKind.Text = 1; - CompletionItemKind.Method = 2; - CompletionItemKind.Function = 3; - CompletionItemKind.Constructor = 4; - CompletionItemKind.Field = 5; - CompletionItemKind.Variable = 6; - CompletionItemKind.Class = 7; - CompletionItemKind.Interface = 8; - CompletionItemKind.Module = 9; - CompletionItemKind.Property = 10; - CompletionItemKind.Unit = 11; - CompletionItemKind.Value = 12; - CompletionItemKind.Enum = 13; - CompletionItemKind.Keyword = 14; - CompletionItemKind.Snippet = 15; - CompletionItemKind.Color = 16; - CompletionItemKind.File = 17; - CompletionItemKind.Reference = 18; - CompletionItemKind.Folder = 19; - CompletionItemKind.EnumMember = 20; - CompletionItemKind.Constant = 21; - CompletionItemKind.Struct = 22; - CompletionItemKind.Event = 23; - CompletionItemKind.Operator = 24; - CompletionItemKind.TypeParameter = 25; -})(CompletionItemKind || (CompletionItemKind = {})); -/** - * Defines whether the insert text in a completion item should be interpreted as - * plain text or a snippet. - */ -export var InsertTextFormat; -(function (InsertTextFormat) { - /** - * The primary text to be inserted is treated as a plain string. - */ - InsertTextFormat.PlainText = 1; - /** - * The primary text to be inserted is treated as a snippet. - * - * A snippet can define tab stops and placeholders with `$1`, `$2` - * and `${3:foo}`. `$0` defines the final tab stop, it defaults to - * the end of the snippet. Placeholders with equal identifiers are linked, - * that is typing in one will update others too. - * - * See also: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#snippet_syntax - */ - InsertTextFormat.Snippet = 2; -})(InsertTextFormat || (InsertTextFormat = {})); -/** - * Completion item tags are extra annotations that tweak the rendering of a completion - * item. - * - * @since 3.15.0 - */ -export var CompletionItemTag; -(function (CompletionItemTag) { - /** - * Render a completion as obsolete, usually using a strike-out. - */ - CompletionItemTag.Deprecated = 1; -})(CompletionItemTag || (CompletionItemTag = {})); -/** - * The InsertReplaceEdit namespace provides functions to deal with insert / replace edits. - * - * @since 3.16.0 - */ -export var InsertReplaceEdit; -(function (InsertReplaceEdit) { - /** - * Creates a new insert / replace edit - */ - function create(newText, insert, replace) { - return { newText: newText, insert: insert, replace: replace }; - } - InsertReplaceEdit.create = create; - /** - * Checks whether the given literal conforms to the [InsertReplaceEdit](#InsertReplaceEdit) interface. - */ - function is(value) { - var candidate = value; - return candidate && Is.string(candidate.newText) && Range.is(candidate.insert) && Range.is(candidate.replace); - } - InsertReplaceEdit.is = is; -})(InsertReplaceEdit || (InsertReplaceEdit = {})); -/** - * How whitespace and indentation is handled during completion - * item insertion. - * - * @since 3.16.0 - */ -export var InsertTextMode; -(function (InsertTextMode) { - /** - * The insertion or replace strings is taken as it is. If the - * value is multi line the lines below the cursor will be - * inserted using the indentation defined in the string value. - * The client will not apply any kind of adjustments to the - * string. - */ - InsertTextMode.asIs = 1; - /** - * The editor adjusts leading whitespace of new lines so that - * they match the indentation up to the cursor of the line for - * which the item is accepted. - * - * Consider a line like this: <2tabs><3tabs>foo. Accepting a - * multi line completion item is indented using 2 tabs and all - * following lines inserted will be indented using 2 tabs as well. - */ - InsertTextMode.adjustIndentation = 2; -})(InsertTextMode || (InsertTextMode = {})); -/** - * The CompletionItem namespace provides functions to deal with - * completion items. - */ -export var CompletionItem; -(function (CompletionItem) { - /** - * Create a completion item and seed it with a label. - * @param label The completion item's label - */ - function create(label) { - return { label: label }; - } - CompletionItem.create = create; -})(CompletionItem || (CompletionItem = {})); -/** - * The CompletionList namespace provides functions to deal with - * completion lists. - */ -export var CompletionList; -(function (CompletionList) { - /** - * Creates a new completion list. - * - * @param items The completion items. - * @param isIncomplete The list is not complete. - */ - function create(items, isIncomplete) { - return { items: items ? items : [], isIncomplete: !!isIncomplete }; - } - CompletionList.create = create; -})(CompletionList || (CompletionList = {})); -export var MarkedString; -(function (MarkedString) { - /** - * Creates a marked string from plain text. - * - * @param plainText The plain text. - */ - function fromPlainText(plainText) { - return plainText.replace(/[\\`*_{}[\]()#+\-.!]/g, '\\$&'); // escape markdown syntax tokens: http://daringfireball.net/projects/markdown/syntax#backslash - } - MarkedString.fromPlainText = fromPlainText; - /** - * Checks whether the given value conforms to the [MarkedString](#MarkedString) type. - */ - function is(value) { - var candidate = value; - return Is.string(candidate) || (Is.objectLiteral(candidate) && Is.string(candidate.language) && Is.string(candidate.value)); - } - MarkedString.is = is; -})(MarkedString || (MarkedString = {})); -export var Hover; -(function (Hover) { - /** - * Checks whether the given value conforms to the [Hover](#Hover) interface. - */ - function is(value) { - var candidate = value; - return !!candidate && Is.objectLiteral(candidate) && (MarkupContent.is(candidate.contents) || - MarkedString.is(candidate.contents) || - Is.typedArray(candidate.contents, MarkedString.is)) && (value.range === undefined || Range.is(value.range)); - } - Hover.is = is; -})(Hover || (Hover = {})); -/** - * The ParameterInformation namespace provides helper functions to work with - * [ParameterInformation](#ParameterInformation) literals. - */ -export var ParameterInformation; -(function (ParameterInformation) { - /** - * Creates a new parameter information literal. - * - * @param label A label string. - * @param documentation A doc string. - */ - function create(label, documentation) { - return documentation ? { label: label, documentation: documentation } : { label: label }; - } - ParameterInformation.create = create; -})(ParameterInformation || (ParameterInformation = {})); -/** - * The SignatureInformation namespace provides helper functions to work with - * [SignatureInformation](#SignatureInformation) literals. - */ -export var SignatureInformation; -(function (SignatureInformation) { - function create(label, documentation) { - var parameters = []; - for (var _i = 2; _i < arguments.length; _i++) { - parameters[_i - 2] = arguments[_i]; - } - var result = { label: label }; - if (Is.defined(documentation)) { - result.documentation = documentation; - } - if (Is.defined(parameters)) { - result.parameters = parameters; - } - else { - result.parameters = []; - } - return result; - } - SignatureInformation.create = create; -})(SignatureInformation || (SignatureInformation = {})); -/** - * A document highlight kind. - */ -export var DocumentHighlightKind; -(function (DocumentHighlightKind) { - /** - * A textual occurrence. - */ - DocumentHighlightKind.Text = 1; - /** - * Read-access of a symbol, like reading a variable. - */ - DocumentHighlightKind.Read = 2; - /** - * Write-access of a symbol, like writing to a variable. - */ - DocumentHighlightKind.Write = 3; -})(DocumentHighlightKind || (DocumentHighlightKind = {})); -/** - * DocumentHighlight namespace to provide helper functions to work with - * [DocumentHighlight](#DocumentHighlight) literals. - */ -export var DocumentHighlight; -(function (DocumentHighlight) { - /** - * Create a DocumentHighlight object. - * @param range The range the highlight applies to. - */ - function create(range, kind) { - var result = { range: range }; - if (Is.number(kind)) { - result.kind = kind; - } - return result; - } - DocumentHighlight.create = create; -})(DocumentHighlight || (DocumentHighlight = {})); -/** - * A symbol kind. - */ -export var SymbolKind; -(function (SymbolKind) { - SymbolKind.File = 1; - SymbolKind.Module = 2; - SymbolKind.Namespace = 3; - SymbolKind.Package = 4; - SymbolKind.Class = 5; - SymbolKind.Method = 6; - SymbolKind.Property = 7; - SymbolKind.Field = 8; - SymbolKind.Constructor = 9; - SymbolKind.Enum = 10; - SymbolKind.Interface = 11; - SymbolKind.Function = 12; - SymbolKind.Variable = 13; - SymbolKind.Constant = 14; - SymbolKind.String = 15; - SymbolKind.Number = 16; - SymbolKind.Boolean = 17; - SymbolKind.Array = 18; - SymbolKind.Object = 19; - SymbolKind.Key = 20; - SymbolKind.Null = 21; - SymbolKind.EnumMember = 22; - SymbolKind.Struct = 23; - SymbolKind.Event = 24; - SymbolKind.Operator = 25; - SymbolKind.TypeParameter = 26; -})(SymbolKind || (SymbolKind = {})); -/** - * Symbol tags are extra annotations that tweak the rendering of a symbol. - * @since 3.16 - */ -export var SymbolTag; -(function (SymbolTag) { - /** - * Render a symbol as obsolete, usually using a strike-out. - */ - SymbolTag.Deprecated = 1; -})(SymbolTag || (SymbolTag = {})); -export var SymbolInformation; -(function (SymbolInformation) { - /** - * Creates a new symbol information literal. - * - * @param name The name of the symbol. - * @param kind The kind of the symbol. - * @param range The range of the location of the symbol. - * @param uri The resource of the location of symbol, defaults to the current document. - * @param containerName The name of the symbol containing the symbol. - */ - function create(name, kind, range, uri, containerName) { - var result = { - name: name, - kind: kind, - location: { uri: uri, range: range } - }; - if (containerName) { - result.containerName = containerName; - } - return result; - } - SymbolInformation.create = create; -})(SymbolInformation || (SymbolInformation = {})); -export var DocumentSymbol; -(function (DocumentSymbol) { - /** - * Creates a new symbol information literal. - * - * @param name The name of the symbol. - * @param detail The detail of the symbol. - * @param kind The kind of the symbol. - * @param range The range of the symbol. - * @param selectionRange The selectionRange of the symbol. - * @param children Children of the symbol. - */ - function create(name, detail, kind, range, selectionRange, children) { - var result = { - name: name, - detail: detail, - kind: kind, - range: range, - selectionRange: selectionRange - }; - if (children !== undefined) { - result.children = children; - } - return result; - } - DocumentSymbol.create = create; - /** - * Checks whether the given literal conforms to the [DocumentSymbol](#DocumentSymbol) interface. - */ - function is(value) { - var candidate = value; - return candidate && - Is.string(candidate.name) && Is.number(candidate.kind) && - Range.is(candidate.range) && Range.is(candidate.selectionRange) && - (candidate.detail === undefined || Is.string(candidate.detail)) && - (candidate.deprecated === undefined || Is.boolean(candidate.deprecated)) && - (candidate.children === undefined || Array.isArray(candidate.children)) && - (candidate.tags === undefined || Array.isArray(candidate.tags)); - } - DocumentSymbol.is = is; -})(DocumentSymbol || (DocumentSymbol = {})); -/** - * A set of predefined code action kinds - */ -export var CodeActionKind; -(function (CodeActionKind) { - /** - * Empty kind. - */ - CodeActionKind.Empty = ''; - /** - * Base kind for quickfix actions: 'quickfix' - */ - CodeActionKind.QuickFix = 'quickfix'; - /** - * Base kind for refactoring actions: 'refactor' - */ - CodeActionKind.Refactor = 'refactor'; - /** - * Base kind for refactoring extraction actions: 'refactor.extract' - * - * Example extract actions: - * - * - Extract method - * - Extract function - * - Extract variable - * - Extract interface from class - * - ... - */ - CodeActionKind.RefactorExtract = 'refactor.extract'; - /** - * Base kind for refactoring inline actions: 'refactor.inline' - * - * Example inline actions: - * - * - Inline function - * - Inline variable - * - Inline constant - * - ... - */ - CodeActionKind.RefactorInline = 'refactor.inline'; - /** - * Base kind for refactoring rewrite actions: 'refactor.rewrite' - * - * Example rewrite actions: - * - * - Convert JavaScript function to class - * - Add or remove parameter - * - Encapsulate field - * - Make method static - * - Move method to base class - * - ... - */ - CodeActionKind.RefactorRewrite = 'refactor.rewrite'; - /** - * Base kind for source actions: `source` - * - * Source code actions apply to the entire file. - */ - CodeActionKind.Source = 'source'; - /** - * Base kind for an organize imports source action: `source.organizeImports` - */ - CodeActionKind.SourceOrganizeImports = 'source.organizeImports'; - /** - * Base kind for auto-fix source actions: `source.fixAll`. - * - * Fix all actions automatically fix errors that have a clear fix that do not require user input. - * They should not suppress errors or perform unsafe fixes such as generating new types or classes. - * - * @since 3.15.0 - */ - CodeActionKind.SourceFixAll = 'source.fixAll'; -})(CodeActionKind || (CodeActionKind = {})); -/** - * The CodeActionContext namespace provides helper functions to work with - * [CodeActionContext](#CodeActionContext) literals. - */ -export var CodeActionContext; -(function (CodeActionContext) { - /** - * Creates a new CodeActionContext literal. - */ - function create(diagnostics, only) { - var result = { diagnostics: diagnostics }; - if (only !== undefined && only !== null) { - result.only = only; - } - return result; - } - CodeActionContext.create = create; - /** - * Checks whether the given literal conforms to the [CodeActionContext](#CodeActionContext) interface. - */ - function is(value) { - var candidate = value; - return Is.defined(candidate) && Is.typedArray(candidate.diagnostics, Diagnostic.is) && (candidate.only === undefined || Is.typedArray(candidate.only, Is.string)); - } - CodeActionContext.is = is; -})(CodeActionContext || (CodeActionContext = {})); -export var CodeAction; -(function (CodeAction) { - function create(title, kindOrCommandOrEdit, kind) { - var result = { title: title }; - var checkKind = true; - if (typeof kindOrCommandOrEdit === 'string') { - checkKind = false; - result.kind = kindOrCommandOrEdit; - } - else if (Command.is(kindOrCommandOrEdit)) { - result.command = kindOrCommandOrEdit; - } - else { - result.edit = kindOrCommandOrEdit; - } - if (checkKind && kind !== undefined) { - result.kind = kind; - } - return result; - } - CodeAction.create = create; - function is(value) { - var candidate = value; - return candidate && Is.string(candidate.title) && - (candidate.diagnostics === undefined || Is.typedArray(candidate.diagnostics, Diagnostic.is)) && - (candidate.kind === undefined || Is.string(candidate.kind)) && - (candidate.edit !== undefined || candidate.command !== undefined) && - (candidate.command === undefined || Command.is(candidate.command)) && - (candidate.isPreferred === undefined || Is.boolean(candidate.isPreferred)) && - (candidate.edit === undefined || WorkspaceEdit.is(candidate.edit)); - } - CodeAction.is = is; -})(CodeAction || (CodeAction = {})); -/** - * The CodeLens namespace provides helper functions to work with - * [CodeLens](#CodeLens) literals. - */ -export var CodeLens; -(function (CodeLens) { - /** - * Creates a new CodeLens literal. - */ - function create(range, data) { - var result = { range: range }; - if (Is.defined(data)) { - result.data = data; - } - return result; - } - CodeLens.create = create; - /** - * Checks whether the given literal conforms to the [CodeLens](#CodeLens) interface. - */ - function is(value) { - var candidate = value; - return Is.defined(candidate) && Range.is(candidate.range) && (Is.undefined(candidate.command) || Command.is(candidate.command)); - } - CodeLens.is = is; -})(CodeLens || (CodeLens = {})); -/** - * The FormattingOptions namespace provides helper functions to work with - * [FormattingOptions](#FormattingOptions) literals. - */ -export var FormattingOptions; -(function (FormattingOptions) { - /** - * Creates a new FormattingOptions literal. - */ - function create(tabSize, insertSpaces) { - return { tabSize: tabSize, insertSpaces: insertSpaces }; - } - FormattingOptions.create = create; - /** - * Checks whether the given literal conforms to the [FormattingOptions](#FormattingOptions) interface. - */ - function is(value) { - var candidate = value; - return Is.defined(candidate) && Is.uinteger(candidate.tabSize) && Is.boolean(candidate.insertSpaces); - } - FormattingOptions.is = is; -})(FormattingOptions || (FormattingOptions = {})); -/** - * The DocumentLink namespace provides helper functions to work with - * [DocumentLink](#DocumentLink) literals. - */ -export var DocumentLink; -(function (DocumentLink) { - /** - * Creates a new DocumentLink literal. - */ - function create(range, target, data) { - return { range: range, target: target, data: data }; - } - DocumentLink.create = create; - /** - * Checks whether the given literal conforms to the [DocumentLink](#DocumentLink) interface. - */ - function is(value) { - var candidate = value; - return Is.defined(candidate) && Range.is(candidate.range) && (Is.undefined(candidate.target) || Is.string(candidate.target)); - } - DocumentLink.is = is; -})(DocumentLink || (DocumentLink = {})); -/** - * The SelectionRange namespace provides helper function to work with - * SelectionRange literals. - */ -export var SelectionRange; -(function (SelectionRange) { - /** - * Creates a new SelectionRange - * @param range the range. - * @param parent an optional parent. - */ - function create(range, parent) { - return { range: range, parent: parent }; - } - SelectionRange.create = create; - function is(value) { - var candidate = value; - return candidate !== undefined && Range.is(candidate.range) && (candidate.parent === undefined || SelectionRange.is(candidate.parent)); - } - SelectionRange.is = is; -})(SelectionRange || (SelectionRange = {})); -export var EOL = ['\n', '\r\n', '\r']; -/** - * @deprecated Use the text document from the new vscode-languageserver-textdocument package. - */ -export var TextDocument; -(function (TextDocument) { - /** - * Creates a new ITextDocument literal from the given uri and content. - * @param uri The document's uri. - * @param languageId The document's language Id. - * @param content The document's content. - */ - function create(uri, languageId, version, content) { - return new FullTextDocument(uri, languageId, version, content); - } - TextDocument.create = create; - /** - * Checks whether the given literal conforms to the [ITextDocument](#ITextDocument) interface. - */ - function is(value) { - var candidate = value; - return Is.defined(candidate) && Is.string(candidate.uri) && (Is.undefined(candidate.languageId) || Is.string(candidate.languageId)) && Is.uinteger(candidate.lineCount) - && Is.func(candidate.getText) && Is.func(candidate.positionAt) && Is.func(candidate.offsetAt) ? true : false; - } - TextDocument.is = is; - function applyEdits(document, edits) { - var text = document.getText(); - var sortedEdits = mergeSort(edits, function (a, b) { - var diff = a.range.start.line - b.range.start.line; - if (diff === 0) { - return a.range.start.character - b.range.start.character; - } - return diff; - }); - var lastModifiedOffset = text.length; - for (var i = sortedEdits.length - 1; i >= 0; i--) { - var e = sortedEdits[i]; - var startOffset = document.offsetAt(e.range.start); - var endOffset = document.offsetAt(e.range.end); - if (endOffset <= lastModifiedOffset) { - text = text.substring(0, startOffset) + e.newText + text.substring(endOffset, text.length); - } - else { - throw new Error('Overlapping edit'); - } - lastModifiedOffset = startOffset; - } - return text; - } - TextDocument.applyEdits = applyEdits; - function mergeSort(data, compare) { - if (data.length <= 1) { - // sorted - return data; - } - var p = (data.length / 2) | 0; - var left = data.slice(0, p); - var right = data.slice(p); - mergeSort(left, compare); - mergeSort(right, compare); - var leftIdx = 0; - var rightIdx = 0; - var i = 0; - while (leftIdx < left.length && rightIdx < right.length) { - var ret = compare(left[leftIdx], right[rightIdx]); - if (ret <= 0) { - // smaller_equal -> take left to preserve order - data[i++] = left[leftIdx++]; - } - else { - // greater -> take right - data[i++] = right[rightIdx++]; - } - } - while (leftIdx < left.length) { - data[i++] = left[leftIdx++]; - } - while (rightIdx < right.length) { - data[i++] = right[rightIdx++]; - } - return data; - } -})(TextDocument || (TextDocument = {})); -/** - * @deprecated Use the text document from the new vscode-languageserver-textdocument package. - */ -var FullTextDocument = /** @class */ (function () { - function FullTextDocument(uri, languageId, version, content) { - this._uri = uri; - this._languageId = languageId; - this._version = version; - this._content = content; - this._lineOffsets = undefined; - } - Object.defineProperty(FullTextDocument.prototype, "uri", { - get: function () { - return this._uri; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(FullTextDocument.prototype, "languageId", { - get: function () { - return this._languageId; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(FullTextDocument.prototype, "version", { - get: function () { - return this._version; - }, - enumerable: false, - configurable: true - }); - FullTextDocument.prototype.getText = function (range) { - if (range) { - var start = this.offsetAt(range.start); - var end = this.offsetAt(range.end); - return this._content.substring(start, end); - } - return this._content; - }; - FullTextDocument.prototype.update = function (event, version) { - this._content = event.text; - this._version = version; - this._lineOffsets = undefined; - }; - FullTextDocument.prototype.getLineOffsets = function () { - if (this._lineOffsets === undefined) { - var lineOffsets = []; - var text = this._content; - var isLineStart = true; - for (var i = 0; i < text.length; i++) { - if (isLineStart) { - lineOffsets.push(i); - isLineStart = false; - } - var ch = text.charAt(i); - isLineStart = (ch === '\r' || ch === '\n'); - if (ch === '\r' && i + 1 < text.length && text.charAt(i + 1) === '\n') { - i++; - } - } - if (isLineStart && text.length > 0) { - lineOffsets.push(text.length); - } - this._lineOffsets = lineOffsets; - } - return this._lineOffsets; - }; - FullTextDocument.prototype.positionAt = function (offset) { - offset = Math.max(Math.min(offset, this._content.length), 0); - var lineOffsets = this.getLineOffsets(); - var low = 0, high = lineOffsets.length; - if (high === 0) { - return Position.create(0, offset); - } - while (low < high) { - var mid = Math.floor((low + high) / 2); - if (lineOffsets[mid] > offset) { - high = mid; - } - else { - low = mid + 1; - } - } - // low is the least x for which the line offset is larger than the current offset - // or array.length if no line offset is larger than the current offset - var line = low - 1; - return Position.create(line, offset - lineOffsets[line]); - }; - FullTextDocument.prototype.offsetAt = function (position) { - var lineOffsets = this.getLineOffsets(); - if (position.line >= lineOffsets.length) { - return this._content.length; - } - else if (position.line < 0) { - return 0; - } - var lineOffset = lineOffsets[position.line]; - var nextLineOffset = (position.line + 1 < lineOffsets.length) ? lineOffsets[position.line + 1] : this._content.length; - return Math.max(Math.min(lineOffset + position.character, nextLineOffset), lineOffset); - }; - Object.defineProperty(FullTextDocument.prototype, "lineCount", { - get: function () { - return this.getLineOffsets().length; - }, - enumerable: false, - configurable: true - }); - return FullTextDocument; -}()); -var Is; -(function (Is) { - var toString = Object.prototype.toString; - function defined(value) { - return typeof value !== 'undefined'; - } - Is.defined = defined; - function undefined(value) { - return typeof value === 'undefined'; - } - Is.undefined = undefined; - function boolean(value) { - return value === true || value === false; - } - Is.boolean = boolean; - function string(value) { - return toString.call(value) === '[object String]'; - } - Is.string = string; - function number(value) { - return toString.call(value) === '[object Number]'; - } - Is.number = number; - function numberRange(value, min, max) { - return toString.call(value) === '[object Number]' && min <= value && value <= max; - } - Is.numberRange = numberRange; - function integer(value) { - return toString.call(value) === '[object Number]' && -2147483648 <= value && value <= 2147483647; - } - Is.integer = integer; - function uinteger(value) { - return toString.call(value) === '[object Number]' && 0 <= value && value <= 2147483647; - } - Is.uinteger = uinteger; - function func(value) { - return toString.call(value) === '[object Function]'; - } - Is.func = func; - function objectLiteral(value) { - // Strictly speaking class instances pass this check as well. Since the LSP - // doesn't use classes we ignore this for now. If we do we need to add something - // like this: `Object.getPrototypeOf(Object.getPrototypeOf(x)) === null` - return value !== null && typeof value === 'object'; - } - Is.objectLiteral = objectLiteral; - function typedArray(value, check) { - return Array.isArray(value) && value.every(check); - } - Is.typedArray = typedArray; -})(Is || (Is = {})); diff --git a/server/node_modules/vscode-languageserver-types/lib/umd/main.js b/server/node_modules/vscode-languageserver-types/lib/umd/main.js deleted file mode 100644 index 9b21226..0000000 --- a/server/node_modules/vscode-languageserver-types/lib/umd/main.js +++ /dev/null @@ -1,1921 +0,0 @@ -(function (factory) { - if (typeof module === "object" && typeof module.exports === "object") { - var v = factory(require, exports); - if (v !== undefined) module.exports = v; - } - else if (typeof define === "function" && define.amd) { - define(["require", "exports"], factory); - } -})(function (require, exports) { - /* -------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * ------------------------------------------------------------------------------------------ */ - 'use strict'; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.TextDocument = exports.EOL = exports.SelectionRange = exports.DocumentLink = exports.FormattingOptions = exports.CodeLens = exports.CodeAction = exports.CodeActionContext = exports.CodeActionKind = exports.DocumentSymbol = exports.SymbolInformation = exports.SymbolTag = exports.SymbolKind = exports.DocumentHighlight = exports.DocumentHighlightKind = exports.SignatureInformation = exports.ParameterInformation = exports.Hover = exports.MarkedString = exports.CompletionList = exports.CompletionItem = exports.InsertTextMode = exports.InsertReplaceEdit = exports.CompletionItemTag = exports.InsertTextFormat = exports.CompletionItemKind = exports.MarkupContent = exports.MarkupKind = exports.TextDocumentItem = exports.OptionalVersionedTextDocumentIdentifier = exports.VersionedTextDocumentIdentifier = exports.TextDocumentIdentifier = exports.WorkspaceChange = exports.WorkspaceEdit = exports.DeleteFile = exports.RenameFile = exports.CreateFile = exports.TextDocumentEdit = exports.AnnotatedTextEdit = exports.ChangeAnnotationIdentifier = exports.ChangeAnnotation = exports.TextEdit = exports.Command = exports.Diagnostic = exports.CodeDescription = exports.DiagnosticTag = exports.DiagnosticSeverity = exports.DiagnosticRelatedInformation = exports.FoldingRange = exports.FoldingRangeKind = exports.ColorPresentation = exports.ColorInformation = exports.Color = exports.LocationLink = exports.Location = exports.Range = exports.Position = exports.uinteger = exports.integer = void 0; - var integer; - (function (integer) { - integer.MIN_VALUE = -2147483648; - integer.MAX_VALUE = 2147483647; - })(integer = exports.integer || (exports.integer = {})); - var uinteger; - (function (uinteger) { - uinteger.MIN_VALUE = 0; - uinteger.MAX_VALUE = 2147483647; - })(uinteger = exports.uinteger || (exports.uinteger = {})); - /** - * The Position namespace provides helper functions to work with - * [Position](#Position) literals. - */ - var Position; - (function (Position) { - /** - * Creates a new Position literal from the given line and character. - * @param line The position's line. - * @param character The position's character. - */ - function create(line, character) { - if (line === Number.MAX_VALUE) { - line = uinteger.MAX_VALUE; - } - if (character === Number.MAX_VALUE) { - character = uinteger.MAX_VALUE; - } - return { line: line, character: character }; - } - Position.create = create; - /** - * Checks whether the given literal conforms to the [Position](#Position) interface. - */ - function is(value) { - var candidate = value; - return Is.objectLiteral(candidate) && Is.uinteger(candidate.line) && Is.uinteger(candidate.character); - } - Position.is = is; - })(Position = exports.Position || (exports.Position = {})); - /** - * The Range namespace provides helper functions to work with - * [Range](#Range) literals. - */ - var Range; - (function (Range) { - function create(one, two, three, four) { - if (Is.uinteger(one) && Is.uinteger(two) && Is.uinteger(three) && Is.uinteger(four)) { - return { start: Position.create(one, two), end: Position.create(three, four) }; - } - else if (Position.is(one) && Position.is(two)) { - return { start: one, end: two }; - } - else { - throw new Error("Range#create called with invalid arguments[" + one + ", " + two + ", " + three + ", " + four + "]"); - } - } - Range.create = create; - /** - * Checks whether the given literal conforms to the [Range](#Range) interface. - */ - function is(value) { - var candidate = value; - return Is.objectLiteral(candidate) && Position.is(candidate.start) && Position.is(candidate.end); - } - Range.is = is; - })(Range = exports.Range || (exports.Range = {})); - /** - * The Location namespace provides helper functions to work with - * [Location](#Location) literals. - */ - var Location; - (function (Location) { - /** - * Creates a Location literal. - * @param uri The location's uri. - * @param range The location's range. - */ - function create(uri, range) { - return { uri: uri, range: range }; - } - Location.create = create; - /** - * Checks whether the given literal conforms to the [Location](#Location) interface. - */ - function is(value) { - var candidate = value; - return Is.defined(candidate) && Range.is(candidate.range) && (Is.string(candidate.uri) || Is.undefined(candidate.uri)); - } - Location.is = is; - })(Location = exports.Location || (exports.Location = {})); - /** - * The LocationLink namespace provides helper functions to work with - * [LocationLink](#LocationLink) literals. - */ - var LocationLink; - (function (LocationLink) { - /** - * Creates a LocationLink literal. - * @param targetUri The definition's uri. - * @param targetRange The full range of the definition. - * @param targetSelectionRange The span of the symbol definition at the target. - * @param originSelectionRange The span of the symbol being defined in the originating source file. - */ - function create(targetUri, targetRange, targetSelectionRange, originSelectionRange) { - return { targetUri: targetUri, targetRange: targetRange, targetSelectionRange: targetSelectionRange, originSelectionRange: originSelectionRange }; - } - LocationLink.create = create; - /** - * Checks whether the given literal conforms to the [LocationLink](#LocationLink) interface. - */ - function is(value) { - var candidate = value; - return Is.defined(candidate) && Range.is(candidate.targetRange) && Is.string(candidate.targetUri) - && (Range.is(candidate.targetSelectionRange) || Is.undefined(candidate.targetSelectionRange)) - && (Range.is(candidate.originSelectionRange) || Is.undefined(candidate.originSelectionRange)); - } - LocationLink.is = is; - })(LocationLink = exports.LocationLink || (exports.LocationLink = {})); - /** - * The Color namespace provides helper functions to work with - * [Color](#Color) literals. - */ - var Color; - (function (Color) { - /** - * Creates a new Color literal. - */ - function create(red, green, blue, alpha) { - return { - red: red, - green: green, - blue: blue, - alpha: alpha, - }; - } - Color.create = create; - /** - * Checks whether the given literal conforms to the [Color](#Color) interface. - */ - function is(value) { - var candidate = value; - return Is.numberRange(candidate.red, 0, 1) - && Is.numberRange(candidate.green, 0, 1) - && Is.numberRange(candidate.blue, 0, 1) - && Is.numberRange(candidate.alpha, 0, 1); - } - Color.is = is; - })(Color = exports.Color || (exports.Color = {})); - /** - * The ColorInformation namespace provides helper functions to work with - * [ColorInformation](#ColorInformation) literals. - */ - var ColorInformation; - (function (ColorInformation) { - /** - * Creates a new ColorInformation literal. - */ - function create(range, color) { - return { - range: range, - color: color, - }; - } - ColorInformation.create = create; - /** - * Checks whether the given literal conforms to the [ColorInformation](#ColorInformation) interface. - */ - function is(value) { - var candidate = value; - return Range.is(candidate.range) && Color.is(candidate.color); - } - ColorInformation.is = is; - })(ColorInformation = exports.ColorInformation || (exports.ColorInformation = {})); - /** - * The Color namespace provides helper functions to work with - * [ColorPresentation](#ColorPresentation) literals. - */ - var ColorPresentation; - (function (ColorPresentation) { - /** - * Creates a new ColorInformation literal. - */ - function create(label, textEdit, additionalTextEdits) { - return { - label: label, - textEdit: textEdit, - additionalTextEdits: additionalTextEdits, - }; - } - ColorPresentation.create = create; - /** - * Checks whether the given literal conforms to the [ColorInformation](#ColorInformation) interface. - */ - function is(value) { - var candidate = value; - return Is.string(candidate.label) - && (Is.undefined(candidate.textEdit) || TextEdit.is(candidate)) - && (Is.undefined(candidate.additionalTextEdits) || Is.typedArray(candidate.additionalTextEdits, TextEdit.is)); - } - ColorPresentation.is = is; - })(ColorPresentation = exports.ColorPresentation || (exports.ColorPresentation = {})); - /** - * Enum of known range kinds - */ - var FoldingRangeKind; - (function (FoldingRangeKind) { - /** - * Folding range for a comment - */ - FoldingRangeKind["Comment"] = "comment"; - /** - * Folding range for a imports or includes - */ - FoldingRangeKind["Imports"] = "imports"; - /** - * Folding range for a region (e.g. `#region`) - */ - FoldingRangeKind["Region"] = "region"; - })(FoldingRangeKind = exports.FoldingRangeKind || (exports.FoldingRangeKind = {})); - /** - * The folding range namespace provides helper functions to work with - * [FoldingRange](#FoldingRange) literals. - */ - var FoldingRange; - (function (FoldingRange) { - /** - * Creates a new FoldingRange literal. - */ - function create(startLine, endLine, startCharacter, endCharacter, kind) { - var result = { - startLine: startLine, - endLine: endLine - }; - if (Is.defined(startCharacter)) { - result.startCharacter = startCharacter; - } - if (Is.defined(endCharacter)) { - result.endCharacter = endCharacter; - } - if (Is.defined(kind)) { - result.kind = kind; - } - return result; - } - FoldingRange.create = create; - /** - * Checks whether the given literal conforms to the [FoldingRange](#FoldingRange) interface. - */ - function is(value) { - var candidate = value; - return Is.uinteger(candidate.startLine) && Is.uinteger(candidate.startLine) - && (Is.undefined(candidate.startCharacter) || Is.uinteger(candidate.startCharacter)) - && (Is.undefined(candidate.endCharacter) || Is.uinteger(candidate.endCharacter)) - && (Is.undefined(candidate.kind) || Is.string(candidate.kind)); - } - FoldingRange.is = is; - })(FoldingRange = exports.FoldingRange || (exports.FoldingRange = {})); - /** - * The DiagnosticRelatedInformation namespace provides helper functions to work with - * [DiagnosticRelatedInformation](#DiagnosticRelatedInformation) literals. - */ - var DiagnosticRelatedInformation; - (function (DiagnosticRelatedInformation) { - /** - * Creates a new DiagnosticRelatedInformation literal. - */ - function create(location, message) { - return { - location: location, - message: message - }; - } - DiagnosticRelatedInformation.create = create; - /** - * Checks whether the given literal conforms to the [DiagnosticRelatedInformation](#DiagnosticRelatedInformation) interface. - */ - function is(value) { - var candidate = value; - return Is.defined(candidate) && Location.is(candidate.location) && Is.string(candidate.message); - } - DiagnosticRelatedInformation.is = is; - })(DiagnosticRelatedInformation = exports.DiagnosticRelatedInformation || (exports.DiagnosticRelatedInformation = {})); - /** - * The diagnostic's severity. - */ - var DiagnosticSeverity; - (function (DiagnosticSeverity) { - /** - * Reports an error. - */ - DiagnosticSeverity.Error = 1; - /** - * Reports a warning. - */ - DiagnosticSeverity.Warning = 2; - /** - * Reports an information. - */ - DiagnosticSeverity.Information = 3; - /** - * Reports a hint. - */ - DiagnosticSeverity.Hint = 4; - })(DiagnosticSeverity = exports.DiagnosticSeverity || (exports.DiagnosticSeverity = {})); - /** - * The diagnostic tags. - * - * @since 3.15.0 - */ - var DiagnosticTag; - (function (DiagnosticTag) { - /** - * Unused or unnecessary code. - * - * Clients are allowed to render diagnostics with this tag faded out instead of having - * an error squiggle. - */ - DiagnosticTag.Unnecessary = 1; - /** - * Deprecated or obsolete code. - * - * Clients are allowed to rendered diagnostics with this tag strike through. - */ - DiagnosticTag.Deprecated = 2; - })(DiagnosticTag = exports.DiagnosticTag || (exports.DiagnosticTag = {})); - /** - * The CodeDescription namespace provides functions to deal with descriptions for diagnostic codes. - * - * @since 3.16.0 - */ - var CodeDescription; - (function (CodeDescription) { - function is(value) { - var candidate = value; - return candidate !== undefined && candidate !== null && Is.string(candidate.href); - } - CodeDescription.is = is; - })(CodeDescription = exports.CodeDescription || (exports.CodeDescription = {})); - /** - * The Diagnostic namespace provides helper functions to work with - * [Diagnostic](#Diagnostic) literals. - */ - var Diagnostic; - (function (Diagnostic) { - /** - * Creates a new Diagnostic literal. - */ - function create(range, message, severity, code, source, relatedInformation) { - var result = { range: range, message: message }; - if (Is.defined(severity)) { - result.severity = severity; - } - if (Is.defined(code)) { - result.code = code; - } - if (Is.defined(source)) { - result.source = source; - } - if (Is.defined(relatedInformation)) { - result.relatedInformation = relatedInformation; - } - return result; - } - Diagnostic.create = create; - /** - * Checks whether the given literal conforms to the [Diagnostic](#Diagnostic) interface. - */ - function is(value) { - var _a; - var candidate = value; - return Is.defined(candidate) - && Range.is(candidate.range) - && Is.string(candidate.message) - && (Is.number(candidate.severity) || Is.undefined(candidate.severity)) - && (Is.integer(candidate.code) || Is.string(candidate.code) || Is.undefined(candidate.code)) - && (Is.undefined(candidate.codeDescription) || (Is.string((_a = candidate.codeDescription) === null || _a === void 0 ? void 0 : _a.href))) - && (Is.string(candidate.source) || Is.undefined(candidate.source)) - && (Is.undefined(candidate.relatedInformation) || Is.typedArray(candidate.relatedInformation, DiagnosticRelatedInformation.is)); - } - Diagnostic.is = is; - })(Diagnostic = exports.Diagnostic || (exports.Diagnostic = {})); - /** - * The Command namespace provides helper functions to work with - * [Command](#Command) literals. - */ - var Command; - (function (Command) { - /** - * Creates a new Command literal. - */ - function create(title, command) { - var args = []; - for (var _i = 2; _i < arguments.length; _i++) { - args[_i - 2] = arguments[_i]; - } - var result = { title: title, command: command }; - if (Is.defined(args) && args.length > 0) { - result.arguments = args; - } - return result; - } - Command.create = create; - /** - * Checks whether the given literal conforms to the [Command](#Command) interface. - */ - function is(value) { - var candidate = value; - return Is.defined(candidate) && Is.string(candidate.title) && Is.string(candidate.command); - } - Command.is = is; - })(Command = exports.Command || (exports.Command = {})); - /** - * The TextEdit namespace provides helper function to create replace, - * insert and delete edits more easily. - */ - var TextEdit; - (function (TextEdit) { - /** - * Creates a replace text edit. - * @param range The range of text to be replaced. - * @param newText The new text. - */ - function replace(range, newText) { - return { range: range, newText: newText }; - } - TextEdit.replace = replace; - /** - * Creates a insert text edit. - * @param position The position to insert the text at. - * @param newText The text to be inserted. - */ - function insert(position, newText) { - return { range: { start: position, end: position }, newText: newText }; - } - TextEdit.insert = insert; - /** - * Creates a delete text edit. - * @param range The range of text to be deleted. - */ - function del(range) { - return { range: range, newText: '' }; - } - TextEdit.del = del; - function is(value) { - var candidate = value; - return Is.objectLiteral(candidate) - && Is.string(candidate.newText) - && Range.is(candidate.range); - } - TextEdit.is = is; - })(TextEdit = exports.TextEdit || (exports.TextEdit = {})); - var ChangeAnnotation; - (function (ChangeAnnotation) { - function create(label, needsConfirmation, description) { - var result = { label: label }; - if (needsConfirmation !== undefined) { - result.needsConfirmation = needsConfirmation; - } - if (description !== undefined) { - result.description = description; - } - return result; - } - ChangeAnnotation.create = create; - function is(value) { - var candidate = value; - return candidate !== undefined && Is.objectLiteral(candidate) && Is.string(candidate.label) && - (Is.boolean(candidate.needsConfirmation) || candidate.needsConfirmation === undefined) && - (Is.string(candidate.description) || candidate.description === undefined); - } - ChangeAnnotation.is = is; - })(ChangeAnnotation = exports.ChangeAnnotation || (exports.ChangeAnnotation = {})); - var ChangeAnnotationIdentifier; - (function (ChangeAnnotationIdentifier) { - function is(value) { - var candidate = value; - return typeof candidate === 'string'; - } - ChangeAnnotationIdentifier.is = is; - })(ChangeAnnotationIdentifier = exports.ChangeAnnotationIdentifier || (exports.ChangeAnnotationIdentifier = {})); - var AnnotatedTextEdit; - (function (AnnotatedTextEdit) { - /** - * Creates an annotated replace text edit. - * - * @param range The range of text to be replaced. - * @param newText The new text. - * @param annotation The annotation. - */ - function replace(range, newText, annotation) { - return { range: range, newText: newText, annotationId: annotation }; - } - AnnotatedTextEdit.replace = replace; - /** - * Creates an annotated insert text edit. - * - * @param position The position to insert the text at. - * @param newText The text to be inserted. - * @param annotation The annotation. - */ - function insert(position, newText, annotation) { - return { range: { start: position, end: position }, newText: newText, annotationId: annotation }; - } - AnnotatedTextEdit.insert = insert; - /** - * Creates an annotated delete text edit. - * - * @param range The range of text to be deleted. - * @param annotation The annotation. - */ - function del(range, annotation) { - return { range: range, newText: '', annotationId: annotation }; - } - AnnotatedTextEdit.del = del; - function is(value) { - var candidate = value; - return TextEdit.is(candidate) && (ChangeAnnotation.is(candidate.annotationId) || ChangeAnnotationIdentifier.is(candidate.annotationId)); - } - AnnotatedTextEdit.is = is; - })(AnnotatedTextEdit = exports.AnnotatedTextEdit || (exports.AnnotatedTextEdit = {})); - /** - * The TextDocumentEdit namespace provides helper function to create - * an edit that manipulates a text document. - */ - var TextDocumentEdit; - (function (TextDocumentEdit) { - /** - * Creates a new `TextDocumentEdit` - */ - function create(textDocument, edits) { - return { textDocument: textDocument, edits: edits }; - } - TextDocumentEdit.create = create; - function is(value) { - var candidate = value; - return Is.defined(candidate) - && OptionalVersionedTextDocumentIdentifier.is(candidate.textDocument) - && Array.isArray(candidate.edits); - } - TextDocumentEdit.is = is; - })(TextDocumentEdit = exports.TextDocumentEdit || (exports.TextDocumentEdit = {})); - var CreateFile; - (function (CreateFile) { - function create(uri, options, annotation) { - var result = { - kind: 'create', - uri: uri - }; - if (options !== undefined && (options.overwrite !== undefined || options.ignoreIfExists !== undefined)) { - result.options = options; - } - if (annotation !== undefined) { - result.annotationId = annotation; - } - return result; - } - CreateFile.create = create; - function is(value) { - var candidate = value; - return candidate && candidate.kind === 'create' && Is.string(candidate.uri) && (candidate.options === undefined || - ((candidate.options.overwrite === undefined || Is.boolean(candidate.options.overwrite)) && (candidate.options.ignoreIfExists === undefined || Is.boolean(candidate.options.ignoreIfExists)))) && (candidate.annotationId === undefined || ChangeAnnotationIdentifier.is(candidate.annotationId)); - } - CreateFile.is = is; - })(CreateFile = exports.CreateFile || (exports.CreateFile = {})); - var RenameFile; - (function (RenameFile) { - function create(oldUri, newUri, options, annotation) { - var result = { - kind: 'rename', - oldUri: oldUri, - newUri: newUri - }; - if (options !== undefined && (options.overwrite !== undefined || options.ignoreIfExists !== undefined)) { - result.options = options; - } - if (annotation !== undefined) { - result.annotationId = annotation; - } - return result; - } - RenameFile.create = create; - function is(value) { - var candidate = value; - return candidate && candidate.kind === 'rename' && Is.string(candidate.oldUri) && Is.string(candidate.newUri) && (candidate.options === undefined || - ((candidate.options.overwrite === undefined || Is.boolean(candidate.options.overwrite)) && (candidate.options.ignoreIfExists === undefined || Is.boolean(candidate.options.ignoreIfExists)))) && (candidate.annotationId === undefined || ChangeAnnotationIdentifier.is(candidate.annotationId)); - } - RenameFile.is = is; - })(RenameFile = exports.RenameFile || (exports.RenameFile = {})); - var DeleteFile; - (function (DeleteFile) { - function create(uri, options, annotation) { - var result = { - kind: 'delete', - uri: uri - }; - if (options !== undefined && (options.recursive !== undefined || options.ignoreIfNotExists !== undefined)) { - result.options = options; - } - if (annotation !== undefined) { - result.annotationId = annotation; - } - return result; - } - DeleteFile.create = create; - function is(value) { - var candidate = value; - return candidate && candidate.kind === 'delete' && Is.string(candidate.uri) && (candidate.options === undefined || - ((candidate.options.recursive === undefined || Is.boolean(candidate.options.recursive)) && (candidate.options.ignoreIfNotExists === undefined || Is.boolean(candidate.options.ignoreIfNotExists)))) && (candidate.annotationId === undefined || ChangeAnnotationIdentifier.is(candidate.annotationId)); - } - DeleteFile.is = is; - })(DeleteFile = exports.DeleteFile || (exports.DeleteFile = {})); - var WorkspaceEdit; - (function (WorkspaceEdit) { - function is(value) { - var candidate = value; - return candidate && - (candidate.changes !== undefined || candidate.documentChanges !== undefined) && - (candidate.documentChanges === undefined || candidate.documentChanges.every(function (change) { - if (Is.string(change.kind)) { - return CreateFile.is(change) || RenameFile.is(change) || DeleteFile.is(change); - } - else { - return TextDocumentEdit.is(change); - } - })); - } - WorkspaceEdit.is = is; - })(WorkspaceEdit = exports.WorkspaceEdit || (exports.WorkspaceEdit = {})); - var TextEditChangeImpl = /** @class */ (function () { - function TextEditChangeImpl(edits, changeAnnotations) { - this.edits = edits; - this.changeAnnotations = changeAnnotations; - } - TextEditChangeImpl.prototype.insert = function (position, newText, annotation) { - var edit; - var id; - if (annotation === undefined) { - edit = TextEdit.insert(position, newText); - } - else if (ChangeAnnotationIdentifier.is(annotation)) { - id = annotation; - edit = AnnotatedTextEdit.insert(position, newText, annotation); - } - else { - this.assertChangeAnnotations(this.changeAnnotations); - id = this.changeAnnotations.manage(annotation); - edit = AnnotatedTextEdit.insert(position, newText, id); - } - this.edits.push(edit); - if (id !== undefined) { - return id; - } - }; - TextEditChangeImpl.prototype.replace = function (range, newText, annotation) { - var edit; - var id; - if (annotation === undefined) { - edit = TextEdit.replace(range, newText); - } - else if (ChangeAnnotationIdentifier.is(annotation)) { - id = annotation; - edit = AnnotatedTextEdit.replace(range, newText, annotation); - } - else { - this.assertChangeAnnotations(this.changeAnnotations); - id = this.changeAnnotations.manage(annotation); - edit = AnnotatedTextEdit.replace(range, newText, id); - } - this.edits.push(edit); - if (id !== undefined) { - return id; - } - }; - TextEditChangeImpl.prototype.delete = function (range, annotation) { - var edit; - var id; - if (annotation === undefined) { - edit = TextEdit.del(range); - } - else if (ChangeAnnotationIdentifier.is(annotation)) { - id = annotation; - edit = AnnotatedTextEdit.del(range, annotation); - } - else { - this.assertChangeAnnotations(this.changeAnnotations); - id = this.changeAnnotations.manage(annotation); - edit = AnnotatedTextEdit.del(range, id); - } - this.edits.push(edit); - if (id !== undefined) { - return id; - } - }; - TextEditChangeImpl.prototype.add = function (edit) { - this.edits.push(edit); - }; - TextEditChangeImpl.prototype.all = function () { - return this.edits; - }; - TextEditChangeImpl.prototype.clear = function () { - this.edits.splice(0, this.edits.length); - }; - TextEditChangeImpl.prototype.assertChangeAnnotations = function (value) { - if (value === undefined) { - throw new Error("Text edit change is not configured to manage change annotations."); - } - }; - return TextEditChangeImpl; - }()); - /** - * A helper class - */ - var ChangeAnnotations = /** @class */ (function () { - function ChangeAnnotations(annotations) { - this._annotations = annotations === undefined ? Object.create(null) : annotations; - this._counter = 0; - this._size = 0; - } - ChangeAnnotations.prototype.all = function () { - return this._annotations; - }; - Object.defineProperty(ChangeAnnotations.prototype, "size", { - get: function () { - return this._size; - }, - enumerable: false, - configurable: true - }); - ChangeAnnotations.prototype.manage = function (idOrAnnotation, annotation) { - var id; - if (ChangeAnnotationIdentifier.is(idOrAnnotation)) { - id = idOrAnnotation; - } - else { - id = this.nextId(); - annotation = idOrAnnotation; - } - if (this._annotations[id] !== undefined) { - throw new Error("Id " + id + " is already in use."); - } - if (annotation === undefined) { - throw new Error("No annotation provided for id " + id); - } - this._annotations[id] = annotation; - this._size++; - return id; - }; - ChangeAnnotations.prototype.nextId = function () { - this._counter++; - return this._counter.toString(); - }; - return ChangeAnnotations; - }()); - /** - * A workspace change helps constructing changes to a workspace. - */ - var WorkspaceChange = /** @class */ (function () { - function WorkspaceChange(workspaceEdit) { - var _this = this; - this._textEditChanges = Object.create(null); - if (workspaceEdit !== undefined) { - this._workspaceEdit = workspaceEdit; - if (workspaceEdit.documentChanges) { - this._changeAnnotations = new ChangeAnnotations(workspaceEdit.changeAnnotations); - workspaceEdit.changeAnnotations = this._changeAnnotations.all(); - workspaceEdit.documentChanges.forEach(function (change) { - if (TextDocumentEdit.is(change)) { - var textEditChange = new TextEditChangeImpl(change.edits, _this._changeAnnotations); - _this._textEditChanges[change.textDocument.uri] = textEditChange; - } - }); - } - else if (workspaceEdit.changes) { - Object.keys(workspaceEdit.changes).forEach(function (key) { - var textEditChange = new TextEditChangeImpl(workspaceEdit.changes[key]); - _this._textEditChanges[key] = textEditChange; - }); - } - } - else { - this._workspaceEdit = {}; - } - } - Object.defineProperty(WorkspaceChange.prototype, "edit", { - /** - * Returns the underlying [WorkspaceEdit](#WorkspaceEdit) literal - * use to be returned from a workspace edit operation like rename. - */ - get: function () { - this.initDocumentChanges(); - if (this._changeAnnotations !== undefined) { - if (this._changeAnnotations.size === 0) { - this._workspaceEdit.changeAnnotations = undefined; - } - else { - this._workspaceEdit.changeAnnotations = this._changeAnnotations.all(); - } - } - return this._workspaceEdit; - }, - enumerable: false, - configurable: true - }); - WorkspaceChange.prototype.getTextEditChange = function (key) { - if (OptionalVersionedTextDocumentIdentifier.is(key)) { - this.initDocumentChanges(); - if (this._workspaceEdit.documentChanges === undefined) { - throw new Error('Workspace edit is not configured for document changes.'); - } - var textDocument = { uri: key.uri, version: key.version }; - var result = this._textEditChanges[textDocument.uri]; - if (!result) { - var edits = []; - var textDocumentEdit = { - textDocument: textDocument, - edits: edits - }; - this._workspaceEdit.documentChanges.push(textDocumentEdit); - result = new TextEditChangeImpl(edits, this._changeAnnotations); - this._textEditChanges[textDocument.uri] = result; - } - return result; - } - else { - this.initChanges(); - if (this._workspaceEdit.changes === undefined) { - throw new Error('Workspace edit is not configured for normal text edit changes.'); - } - var result = this._textEditChanges[key]; - if (!result) { - var edits = []; - this._workspaceEdit.changes[key] = edits; - result = new TextEditChangeImpl(edits); - this._textEditChanges[key] = result; - } - return result; - } - }; - WorkspaceChange.prototype.initDocumentChanges = function () { - if (this._workspaceEdit.documentChanges === undefined && this._workspaceEdit.changes === undefined) { - this._changeAnnotations = new ChangeAnnotations(); - this._workspaceEdit.documentChanges = []; - this._workspaceEdit.changeAnnotations = this._changeAnnotations.all(); - } - }; - WorkspaceChange.prototype.initChanges = function () { - if (this._workspaceEdit.documentChanges === undefined && this._workspaceEdit.changes === undefined) { - this._workspaceEdit.changes = Object.create(null); - } - }; - WorkspaceChange.prototype.createFile = function (uri, optionsOrAnnotation, options) { - this.initDocumentChanges(); - if (this._workspaceEdit.documentChanges === undefined) { - throw new Error('Workspace edit is not configured for document changes.'); - } - var annotation; - if (ChangeAnnotation.is(optionsOrAnnotation) || ChangeAnnotationIdentifier.is(optionsOrAnnotation)) { - annotation = optionsOrAnnotation; - } - else { - options = optionsOrAnnotation; - } - var operation; - var id; - if (annotation === undefined) { - operation = CreateFile.create(uri, options); - } - else { - id = ChangeAnnotationIdentifier.is(annotation) ? annotation : this._changeAnnotations.manage(annotation); - operation = CreateFile.create(uri, options, id); - } - this._workspaceEdit.documentChanges.push(operation); - if (id !== undefined) { - return id; - } - }; - WorkspaceChange.prototype.renameFile = function (oldUri, newUri, optionsOrAnnotation, options) { - this.initDocumentChanges(); - if (this._workspaceEdit.documentChanges === undefined) { - throw new Error('Workspace edit is not configured for document changes.'); - } - var annotation; - if (ChangeAnnotation.is(optionsOrAnnotation) || ChangeAnnotationIdentifier.is(optionsOrAnnotation)) { - annotation = optionsOrAnnotation; - } - else { - options = optionsOrAnnotation; - } - var operation; - var id; - if (annotation === undefined) { - operation = RenameFile.create(oldUri, newUri, options); - } - else { - id = ChangeAnnotationIdentifier.is(annotation) ? annotation : this._changeAnnotations.manage(annotation); - operation = RenameFile.create(oldUri, newUri, options, id); - } - this._workspaceEdit.documentChanges.push(operation); - if (id !== undefined) { - return id; - } - }; - WorkspaceChange.prototype.deleteFile = function (uri, optionsOrAnnotation, options) { - this.initDocumentChanges(); - if (this._workspaceEdit.documentChanges === undefined) { - throw new Error('Workspace edit is not configured for document changes.'); - } - var annotation; - if (ChangeAnnotation.is(optionsOrAnnotation) || ChangeAnnotationIdentifier.is(optionsOrAnnotation)) { - annotation = optionsOrAnnotation; - } - else { - options = optionsOrAnnotation; - } - var operation; - var id; - if (annotation === undefined) { - operation = DeleteFile.create(uri, options); - } - else { - id = ChangeAnnotationIdentifier.is(annotation) ? annotation : this._changeAnnotations.manage(annotation); - operation = DeleteFile.create(uri, options, id); - } - this._workspaceEdit.documentChanges.push(operation); - if (id !== undefined) { - return id; - } - }; - return WorkspaceChange; - }()); - exports.WorkspaceChange = WorkspaceChange; - /** - * The TextDocumentIdentifier namespace provides helper functions to work with - * [TextDocumentIdentifier](#TextDocumentIdentifier) literals. - */ - var TextDocumentIdentifier; - (function (TextDocumentIdentifier) { - /** - * Creates a new TextDocumentIdentifier literal. - * @param uri The document's uri. - */ - function create(uri) { - return { uri: uri }; - } - TextDocumentIdentifier.create = create; - /** - * Checks whether the given literal conforms to the [TextDocumentIdentifier](#TextDocumentIdentifier) interface. - */ - function is(value) { - var candidate = value; - return Is.defined(candidate) && Is.string(candidate.uri); - } - TextDocumentIdentifier.is = is; - })(TextDocumentIdentifier = exports.TextDocumentIdentifier || (exports.TextDocumentIdentifier = {})); - /** - * The VersionedTextDocumentIdentifier namespace provides helper functions to work with - * [VersionedTextDocumentIdentifier](#VersionedTextDocumentIdentifier) literals. - */ - var VersionedTextDocumentIdentifier; - (function (VersionedTextDocumentIdentifier) { - /** - * Creates a new VersionedTextDocumentIdentifier literal. - * @param uri The document's uri. - * @param uri The document's text. - */ - function create(uri, version) { - return { uri: uri, version: version }; - } - VersionedTextDocumentIdentifier.create = create; - /** - * Checks whether the given literal conforms to the [VersionedTextDocumentIdentifier](#VersionedTextDocumentIdentifier) interface. - */ - function is(value) { - var candidate = value; - return Is.defined(candidate) && Is.string(candidate.uri) && Is.integer(candidate.version); - } - VersionedTextDocumentIdentifier.is = is; - })(VersionedTextDocumentIdentifier = exports.VersionedTextDocumentIdentifier || (exports.VersionedTextDocumentIdentifier = {})); - /** - * The OptionalVersionedTextDocumentIdentifier namespace provides helper functions to work with - * [OptionalVersionedTextDocumentIdentifier](#OptionalVersionedTextDocumentIdentifier) literals. - */ - var OptionalVersionedTextDocumentIdentifier; - (function (OptionalVersionedTextDocumentIdentifier) { - /** - * Creates a new OptionalVersionedTextDocumentIdentifier literal. - * @param uri The document's uri. - * @param uri The document's text. - */ - function create(uri, version) { - return { uri: uri, version: version }; - } - OptionalVersionedTextDocumentIdentifier.create = create; - /** - * Checks whether the given literal conforms to the [OptionalVersionedTextDocumentIdentifier](#OptionalVersionedTextDocumentIdentifier) interface. - */ - function is(value) { - var candidate = value; - return Is.defined(candidate) && Is.string(candidate.uri) && (candidate.version === null || Is.integer(candidate.version)); - } - OptionalVersionedTextDocumentIdentifier.is = is; - })(OptionalVersionedTextDocumentIdentifier = exports.OptionalVersionedTextDocumentIdentifier || (exports.OptionalVersionedTextDocumentIdentifier = {})); - /** - * The TextDocumentItem namespace provides helper functions to work with - * [TextDocumentItem](#TextDocumentItem) literals. - */ - var TextDocumentItem; - (function (TextDocumentItem) { - /** - * Creates a new TextDocumentItem literal. - * @param uri The document's uri. - * @param languageId The document's language identifier. - * @param version The document's version number. - * @param text The document's text. - */ - function create(uri, languageId, version, text) { - return { uri: uri, languageId: languageId, version: version, text: text }; - } - TextDocumentItem.create = create; - /** - * Checks whether the given literal conforms to the [TextDocumentItem](#TextDocumentItem) interface. - */ - function is(value) { - var candidate = value; - return Is.defined(candidate) && Is.string(candidate.uri) && Is.string(candidate.languageId) && Is.integer(candidate.version) && Is.string(candidate.text); - } - TextDocumentItem.is = is; - })(TextDocumentItem = exports.TextDocumentItem || (exports.TextDocumentItem = {})); - /** - * Describes the content type that a client supports in various - * result literals like `Hover`, `ParameterInfo` or `CompletionItem`. - * - * Please note that `MarkupKinds` must not start with a `$`. This kinds - * are reserved for internal usage. - */ - var MarkupKind; - (function (MarkupKind) { - /** - * Plain text is supported as a content format - */ - MarkupKind.PlainText = 'plaintext'; - /** - * Markdown is supported as a content format - */ - MarkupKind.Markdown = 'markdown'; - })(MarkupKind = exports.MarkupKind || (exports.MarkupKind = {})); - (function (MarkupKind) { - /** - * Checks whether the given value is a value of the [MarkupKind](#MarkupKind) type. - */ - function is(value) { - var candidate = value; - return candidate === MarkupKind.PlainText || candidate === MarkupKind.Markdown; - } - MarkupKind.is = is; - })(MarkupKind = exports.MarkupKind || (exports.MarkupKind = {})); - var MarkupContent; - (function (MarkupContent) { - /** - * Checks whether the given value conforms to the [MarkupContent](#MarkupContent) interface. - */ - function is(value) { - var candidate = value; - return Is.objectLiteral(value) && MarkupKind.is(candidate.kind) && Is.string(candidate.value); - } - MarkupContent.is = is; - })(MarkupContent = exports.MarkupContent || (exports.MarkupContent = {})); - /** - * The kind of a completion entry. - */ - var CompletionItemKind; - (function (CompletionItemKind) { - CompletionItemKind.Text = 1; - CompletionItemKind.Method = 2; - CompletionItemKind.Function = 3; - CompletionItemKind.Constructor = 4; - CompletionItemKind.Field = 5; - CompletionItemKind.Variable = 6; - CompletionItemKind.Class = 7; - CompletionItemKind.Interface = 8; - CompletionItemKind.Module = 9; - CompletionItemKind.Property = 10; - CompletionItemKind.Unit = 11; - CompletionItemKind.Value = 12; - CompletionItemKind.Enum = 13; - CompletionItemKind.Keyword = 14; - CompletionItemKind.Snippet = 15; - CompletionItemKind.Color = 16; - CompletionItemKind.File = 17; - CompletionItemKind.Reference = 18; - CompletionItemKind.Folder = 19; - CompletionItemKind.EnumMember = 20; - CompletionItemKind.Constant = 21; - CompletionItemKind.Struct = 22; - CompletionItemKind.Event = 23; - CompletionItemKind.Operator = 24; - CompletionItemKind.TypeParameter = 25; - })(CompletionItemKind = exports.CompletionItemKind || (exports.CompletionItemKind = {})); - /** - * Defines whether the insert text in a completion item should be interpreted as - * plain text or a snippet. - */ - var InsertTextFormat; - (function (InsertTextFormat) { - /** - * The primary text to be inserted is treated as a plain string. - */ - InsertTextFormat.PlainText = 1; - /** - * The primary text to be inserted is treated as a snippet. - * - * A snippet can define tab stops and placeholders with `$1`, `$2` - * and `${3:foo}`. `$0` defines the final tab stop, it defaults to - * the end of the snippet. Placeholders with equal identifiers are linked, - * that is typing in one will update others too. - * - * See also: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#snippet_syntax - */ - InsertTextFormat.Snippet = 2; - })(InsertTextFormat = exports.InsertTextFormat || (exports.InsertTextFormat = {})); - /** - * Completion item tags are extra annotations that tweak the rendering of a completion - * item. - * - * @since 3.15.0 - */ - var CompletionItemTag; - (function (CompletionItemTag) { - /** - * Render a completion as obsolete, usually using a strike-out. - */ - CompletionItemTag.Deprecated = 1; - })(CompletionItemTag = exports.CompletionItemTag || (exports.CompletionItemTag = {})); - /** - * The InsertReplaceEdit namespace provides functions to deal with insert / replace edits. - * - * @since 3.16.0 - */ - var InsertReplaceEdit; - (function (InsertReplaceEdit) { - /** - * Creates a new insert / replace edit - */ - function create(newText, insert, replace) { - return { newText: newText, insert: insert, replace: replace }; - } - InsertReplaceEdit.create = create; - /** - * Checks whether the given literal conforms to the [InsertReplaceEdit](#InsertReplaceEdit) interface. - */ - function is(value) { - var candidate = value; - return candidate && Is.string(candidate.newText) && Range.is(candidate.insert) && Range.is(candidate.replace); - } - InsertReplaceEdit.is = is; - })(InsertReplaceEdit = exports.InsertReplaceEdit || (exports.InsertReplaceEdit = {})); - /** - * How whitespace and indentation is handled during completion - * item insertion. - * - * @since 3.16.0 - */ - var InsertTextMode; - (function (InsertTextMode) { - /** - * The insertion or replace strings is taken as it is. If the - * value is multi line the lines below the cursor will be - * inserted using the indentation defined in the string value. - * The client will not apply any kind of adjustments to the - * string. - */ - InsertTextMode.asIs = 1; - /** - * The editor adjusts leading whitespace of new lines so that - * they match the indentation up to the cursor of the line for - * which the item is accepted. - * - * Consider a line like this: <2tabs><3tabs>foo. Accepting a - * multi line completion item is indented using 2 tabs and all - * following lines inserted will be indented using 2 tabs as well. - */ - InsertTextMode.adjustIndentation = 2; - })(InsertTextMode = exports.InsertTextMode || (exports.InsertTextMode = {})); - /** - * The CompletionItem namespace provides functions to deal with - * completion items. - */ - var CompletionItem; - (function (CompletionItem) { - /** - * Create a completion item and seed it with a label. - * @param label The completion item's label - */ - function create(label) { - return { label: label }; - } - CompletionItem.create = create; - })(CompletionItem = exports.CompletionItem || (exports.CompletionItem = {})); - /** - * The CompletionList namespace provides functions to deal with - * completion lists. - */ - var CompletionList; - (function (CompletionList) { - /** - * Creates a new completion list. - * - * @param items The completion items. - * @param isIncomplete The list is not complete. - */ - function create(items, isIncomplete) { - return { items: items ? items : [], isIncomplete: !!isIncomplete }; - } - CompletionList.create = create; - })(CompletionList = exports.CompletionList || (exports.CompletionList = {})); - var MarkedString; - (function (MarkedString) { - /** - * Creates a marked string from plain text. - * - * @param plainText The plain text. - */ - function fromPlainText(plainText) { - return plainText.replace(/[\\`*_{}[\]()#+\-.!]/g, '\\$&'); // escape markdown syntax tokens: http://daringfireball.net/projects/markdown/syntax#backslash - } - MarkedString.fromPlainText = fromPlainText; - /** - * Checks whether the given value conforms to the [MarkedString](#MarkedString) type. - */ - function is(value) { - var candidate = value; - return Is.string(candidate) || (Is.objectLiteral(candidate) && Is.string(candidate.language) && Is.string(candidate.value)); - } - MarkedString.is = is; - })(MarkedString = exports.MarkedString || (exports.MarkedString = {})); - var Hover; - (function (Hover) { - /** - * Checks whether the given value conforms to the [Hover](#Hover) interface. - */ - function is(value) { - var candidate = value; - return !!candidate && Is.objectLiteral(candidate) && (MarkupContent.is(candidate.contents) || - MarkedString.is(candidate.contents) || - Is.typedArray(candidate.contents, MarkedString.is)) && (value.range === undefined || Range.is(value.range)); - } - Hover.is = is; - })(Hover = exports.Hover || (exports.Hover = {})); - /** - * The ParameterInformation namespace provides helper functions to work with - * [ParameterInformation](#ParameterInformation) literals. - */ - var ParameterInformation; - (function (ParameterInformation) { - /** - * Creates a new parameter information literal. - * - * @param label A label string. - * @param documentation A doc string. - */ - function create(label, documentation) { - return documentation ? { label: label, documentation: documentation } : { label: label }; - } - ParameterInformation.create = create; - })(ParameterInformation = exports.ParameterInformation || (exports.ParameterInformation = {})); - /** - * The SignatureInformation namespace provides helper functions to work with - * [SignatureInformation](#SignatureInformation) literals. - */ - var SignatureInformation; - (function (SignatureInformation) { - function create(label, documentation) { - var parameters = []; - for (var _i = 2; _i < arguments.length; _i++) { - parameters[_i - 2] = arguments[_i]; - } - var result = { label: label }; - if (Is.defined(documentation)) { - result.documentation = documentation; - } - if (Is.defined(parameters)) { - result.parameters = parameters; - } - else { - result.parameters = []; - } - return result; - } - SignatureInformation.create = create; - })(SignatureInformation = exports.SignatureInformation || (exports.SignatureInformation = {})); - /** - * A document highlight kind. - */ - var DocumentHighlightKind; - (function (DocumentHighlightKind) { - /** - * A textual occurrence. - */ - DocumentHighlightKind.Text = 1; - /** - * Read-access of a symbol, like reading a variable. - */ - DocumentHighlightKind.Read = 2; - /** - * Write-access of a symbol, like writing to a variable. - */ - DocumentHighlightKind.Write = 3; - })(DocumentHighlightKind = exports.DocumentHighlightKind || (exports.DocumentHighlightKind = {})); - /** - * DocumentHighlight namespace to provide helper functions to work with - * [DocumentHighlight](#DocumentHighlight) literals. - */ - var DocumentHighlight; - (function (DocumentHighlight) { - /** - * Create a DocumentHighlight object. - * @param range The range the highlight applies to. - */ - function create(range, kind) { - var result = { range: range }; - if (Is.number(kind)) { - result.kind = kind; - } - return result; - } - DocumentHighlight.create = create; - })(DocumentHighlight = exports.DocumentHighlight || (exports.DocumentHighlight = {})); - /** - * A symbol kind. - */ - var SymbolKind; - (function (SymbolKind) { - SymbolKind.File = 1; - SymbolKind.Module = 2; - SymbolKind.Namespace = 3; - SymbolKind.Package = 4; - SymbolKind.Class = 5; - SymbolKind.Method = 6; - SymbolKind.Property = 7; - SymbolKind.Field = 8; - SymbolKind.Constructor = 9; - SymbolKind.Enum = 10; - SymbolKind.Interface = 11; - SymbolKind.Function = 12; - SymbolKind.Variable = 13; - SymbolKind.Constant = 14; - SymbolKind.String = 15; - SymbolKind.Number = 16; - SymbolKind.Boolean = 17; - SymbolKind.Array = 18; - SymbolKind.Object = 19; - SymbolKind.Key = 20; - SymbolKind.Null = 21; - SymbolKind.EnumMember = 22; - SymbolKind.Struct = 23; - SymbolKind.Event = 24; - SymbolKind.Operator = 25; - SymbolKind.TypeParameter = 26; - })(SymbolKind = exports.SymbolKind || (exports.SymbolKind = {})); - /** - * Symbol tags are extra annotations that tweak the rendering of a symbol. - * @since 3.16 - */ - var SymbolTag; - (function (SymbolTag) { - /** - * Render a symbol as obsolete, usually using a strike-out. - */ - SymbolTag.Deprecated = 1; - })(SymbolTag = exports.SymbolTag || (exports.SymbolTag = {})); - var SymbolInformation; - (function (SymbolInformation) { - /** - * Creates a new symbol information literal. - * - * @param name The name of the symbol. - * @param kind The kind of the symbol. - * @param range The range of the location of the symbol. - * @param uri The resource of the location of symbol, defaults to the current document. - * @param containerName The name of the symbol containing the symbol. - */ - function create(name, kind, range, uri, containerName) { - var result = { - name: name, - kind: kind, - location: { uri: uri, range: range } - }; - if (containerName) { - result.containerName = containerName; - } - return result; - } - SymbolInformation.create = create; - })(SymbolInformation = exports.SymbolInformation || (exports.SymbolInformation = {})); - var DocumentSymbol; - (function (DocumentSymbol) { - /** - * Creates a new symbol information literal. - * - * @param name The name of the symbol. - * @param detail The detail of the symbol. - * @param kind The kind of the symbol. - * @param range The range of the symbol. - * @param selectionRange The selectionRange of the symbol. - * @param children Children of the symbol. - */ - function create(name, detail, kind, range, selectionRange, children) { - var result = { - name: name, - detail: detail, - kind: kind, - range: range, - selectionRange: selectionRange - }; - if (children !== undefined) { - result.children = children; - } - return result; - } - DocumentSymbol.create = create; - /** - * Checks whether the given literal conforms to the [DocumentSymbol](#DocumentSymbol) interface. - */ - function is(value) { - var candidate = value; - return candidate && - Is.string(candidate.name) && Is.number(candidate.kind) && - Range.is(candidate.range) && Range.is(candidate.selectionRange) && - (candidate.detail === undefined || Is.string(candidate.detail)) && - (candidate.deprecated === undefined || Is.boolean(candidate.deprecated)) && - (candidate.children === undefined || Array.isArray(candidate.children)) && - (candidate.tags === undefined || Array.isArray(candidate.tags)); - } - DocumentSymbol.is = is; - })(DocumentSymbol = exports.DocumentSymbol || (exports.DocumentSymbol = {})); - /** - * A set of predefined code action kinds - */ - var CodeActionKind; - (function (CodeActionKind) { - /** - * Empty kind. - */ - CodeActionKind.Empty = ''; - /** - * Base kind for quickfix actions: 'quickfix' - */ - CodeActionKind.QuickFix = 'quickfix'; - /** - * Base kind for refactoring actions: 'refactor' - */ - CodeActionKind.Refactor = 'refactor'; - /** - * Base kind for refactoring extraction actions: 'refactor.extract' - * - * Example extract actions: - * - * - Extract method - * - Extract function - * - Extract variable - * - Extract interface from class - * - ... - */ - CodeActionKind.RefactorExtract = 'refactor.extract'; - /** - * Base kind for refactoring inline actions: 'refactor.inline' - * - * Example inline actions: - * - * - Inline function - * - Inline variable - * - Inline constant - * - ... - */ - CodeActionKind.RefactorInline = 'refactor.inline'; - /** - * Base kind for refactoring rewrite actions: 'refactor.rewrite' - * - * Example rewrite actions: - * - * - Convert JavaScript function to class - * - Add or remove parameter - * - Encapsulate field - * - Make method static - * - Move method to base class - * - ... - */ - CodeActionKind.RefactorRewrite = 'refactor.rewrite'; - /** - * Base kind for source actions: `source` - * - * Source code actions apply to the entire file. - */ - CodeActionKind.Source = 'source'; - /** - * Base kind for an organize imports source action: `source.organizeImports` - */ - CodeActionKind.SourceOrganizeImports = 'source.organizeImports'; - /** - * Base kind for auto-fix source actions: `source.fixAll`. - * - * Fix all actions automatically fix errors that have a clear fix that do not require user input. - * They should not suppress errors or perform unsafe fixes such as generating new types or classes. - * - * @since 3.15.0 - */ - CodeActionKind.SourceFixAll = 'source.fixAll'; - })(CodeActionKind = exports.CodeActionKind || (exports.CodeActionKind = {})); - /** - * The CodeActionContext namespace provides helper functions to work with - * [CodeActionContext](#CodeActionContext) literals. - */ - var CodeActionContext; - (function (CodeActionContext) { - /** - * Creates a new CodeActionContext literal. - */ - function create(diagnostics, only) { - var result = { diagnostics: diagnostics }; - if (only !== undefined && only !== null) { - result.only = only; - } - return result; - } - CodeActionContext.create = create; - /** - * Checks whether the given literal conforms to the [CodeActionContext](#CodeActionContext) interface. - */ - function is(value) { - var candidate = value; - return Is.defined(candidate) && Is.typedArray(candidate.diagnostics, Diagnostic.is) && (candidate.only === undefined || Is.typedArray(candidate.only, Is.string)); - } - CodeActionContext.is = is; - })(CodeActionContext = exports.CodeActionContext || (exports.CodeActionContext = {})); - var CodeAction; - (function (CodeAction) { - function create(title, kindOrCommandOrEdit, kind) { - var result = { title: title }; - var checkKind = true; - if (typeof kindOrCommandOrEdit === 'string') { - checkKind = false; - result.kind = kindOrCommandOrEdit; - } - else if (Command.is(kindOrCommandOrEdit)) { - result.command = kindOrCommandOrEdit; - } - else { - result.edit = kindOrCommandOrEdit; - } - if (checkKind && kind !== undefined) { - result.kind = kind; - } - return result; - } - CodeAction.create = create; - function is(value) { - var candidate = value; - return candidate && Is.string(candidate.title) && - (candidate.diagnostics === undefined || Is.typedArray(candidate.diagnostics, Diagnostic.is)) && - (candidate.kind === undefined || Is.string(candidate.kind)) && - (candidate.edit !== undefined || candidate.command !== undefined) && - (candidate.command === undefined || Command.is(candidate.command)) && - (candidate.isPreferred === undefined || Is.boolean(candidate.isPreferred)) && - (candidate.edit === undefined || WorkspaceEdit.is(candidate.edit)); - } - CodeAction.is = is; - })(CodeAction = exports.CodeAction || (exports.CodeAction = {})); - /** - * The CodeLens namespace provides helper functions to work with - * [CodeLens](#CodeLens) literals. - */ - var CodeLens; - (function (CodeLens) { - /** - * Creates a new CodeLens literal. - */ - function create(range, data) { - var result = { range: range }; - if (Is.defined(data)) { - result.data = data; - } - return result; - } - CodeLens.create = create; - /** - * Checks whether the given literal conforms to the [CodeLens](#CodeLens) interface. - */ - function is(value) { - var candidate = value; - return Is.defined(candidate) && Range.is(candidate.range) && (Is.undefined(candidate.command) || Command.is(candidate.command)); - } - CodeLens.is = is; - })(CodeLens = exports.CodeLens || (exports.CodeLens = {})); - /** - * The FormattingOptions namespace provides helper functions to work with - * [FormattingOptions](#FormattingOptions) literals. - */ - var FormattingOptions; - (function (FormattingOptions) { - /** - * Creates a new FormattingOptions literal. - */ - function create(tabSize, insertSpaces) { - return { tabSize: tabSize, insertSpaces: insertSpaces }; - } - FormattingOptions.create = create; - /** - * Checks whether the given literal conforms to the [FormattingOptions](#FormattingOptions) interface. - */ - function is(value) { - var candidate = value; - return Is.defined(candidate) && Is.uinteger(candidate.tabSize) && Is.boolean(candidate.insertSpaces); - } - FormattingOptions.is = is; - })(FormattingOptions = exports.FormattingOptions || (exports.FormattingOptions = {})); - /** - * The DocumentLink namespace provides helper functions to work with - * [DocumentLink](#DocumentLink) literals. - */ - var DocumentLink; - (function (DocumentLink) { - /** - * Creates a new DocumentLink literal. - */ - function create(range, target, data) { - return { range: range, target: target, data: data }; - } - DocumentLink.create = create; - /** - * Checks whether the given literal conforms to the [DocumentLink](#DocumentLink) interface. - */ - function is(value) { - var candidate = value; - return Is.defined(candidate) && Range.is(candidate.range) && (Is.undefined(candidate.target) || Is.string(candidate.target)); - } - DocumentLink.is = is; - })(DocumentLink = exports.DocumentLink || (exports.DocumentLink = {})); - /** - * The SelectionRange namespace provides helper function to work with - * SelectionRange literals. - */ - var SelectionRange; - (function (SelectionRange) { - /** - * Creates a new SelectionRange - * @param range the range. - * @param parent an optional parent. - */ - function create(range, parent) { - return { range: range, parent: parent }; - } - SelectionRange.create = create; - function is(value) { - var candidate = value; - return candidate !== undefined && Range.is(candidate.range) && (candidate.parent === undefined || SelectionRange.is(candidate.parent)); - } - SelectionRange.is = is; - })(SelectionRange = exports.SelectionRange || (exports.SelectionRange = {})); - exports.EOL = ['\n', '\r\n', '\r']; - /** - * @deprecated Use the text document from the new vscode-languageserver-textdocument package. - */ - var TextDocument; - (function (TextDocument) { - /** - * Creates a new ITextDocument literal from the given uri and content. - * @param uri The document's uri. - * @param languageId The document's language Id. - * @param content The document's content. - */ - function create(uri, languageId, version, content) { - return new FullTextDocument(uri, languageId, version, content); - } - TextDocument.create = create; - /** - * Checks whether the given literal conforms to the [ITextDocument](#ITextDocument) interface. - */ - function is(value) { - var candidate = value; - return Is.defined(candidate) && Is.string(candidate.uri) && (Is.undefined(candidate.languageId) || Is.string(candidate.languageId)) && Is.uinteger(candidate.lineCount) - && Is.func(candidate.getText) && Is.func(candidate.positionAt) && Is.func(candidate.offsetAt) ? true : false; - } - TextDocument.is = is; - function applyEdits(document, edits) { - var text = document.getText(); - var sortedEdits = mergeSort(edits, function (a, b) { - var diff = a.range.start.line - b.range.start.line; - if (diff === 0) { - return a.range.start.character - b.range.start.character; - } - return diff; - }); - var lastModifiedOffset = text.length; - for (var i = sortedEdits.length - 1; i >= 0; i--) { - var e = sortedEdits[i]; - var startOffset = document.offsetAt(e.range.start); - var endOffset = document.offsetAt(e.range.end); - if (endOffset <= lastModifiedOffset) { - text = text.substring(0, startOffset) + e.newText + text.substring(endOffset, text.length); - } - else { - throw new Error('Overlapping edit'); - } - lastModifiedOffset = startOffset; - } - return text; - } - TextDocument.applyEdits = applyEdits; - function mergeSort(data, compare) { - if (data.length <= 1) { - // sorted - return data; - } - var p = (data.length / 2) | 0; - var left = data.slice(0, p); - var right = data.slice(p); - mergeSort(left, compare); - mergeSort(right, compare); - var leftIdx = 0; - var rightIdx = 0; - var i = 0; - while (leftIdx < left.length && rightIdx < right.length) { - var ret = compare(left[leftIdx], right[rightIdx]); - if (ret <= 0) { - // smaller_equal -> take left to preserve order - data[i++] = left[leftIdx++]; - } - else { - // greater -> take right - data[i++] = right[rightIdx++]; - } - } - while (leftIdx < left.length) { - data[i++] = left[leftIdx++]; - } - while (rightIdx < right.length) { - data[i++] = right[rightIdx++]; - } - return data; - } - })(TextDocument = exports.TextDocument || (exports.TextDocument = {})); - /** - * @deprecated Use the text document from the new vscode-languageserver-textdocument package. - */ - var FullTextDocument = /** @class */ (function () { - function FullTextDocument(uri, languageId, version, content) { - this._uri = uri; - this._languageId = languageId; - this._version = version; - this._content = content; - this._lineOffsets = undefined; - } - Object.defineProperty(FullTextDocument.prototype, "uri", { - get: function () { - return this._uri; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(FullTextDocument.prototype, "languageId", { - get: function () { - return this._languageId; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(FullTextDocument.prototype, "version", { - get: function () { - return this._version; - }, - enumerable: false, - configurable: true - }); - FullTextDocument.prototype.getText = function (range) { - if (range) { - var start = this.offsetAt(range.start); - var end = this.offsetAt(range.end); - return this._content.substring(start, end); - } - return this._content; - }; - FullTextDocument.prototype.update = function (event, version) { - this._content = event.text; - this._version = version; - this._lineOffsets = undefined; - }; - FullTextDocument.prototype.getLineOffsets = function () { - if (this._lineOffsets === undefined) { - var lineOffsets = []; - var text = this._content; - var isLineStart = true; - for (var i = 0; i < text.length; i++) { - if (isLineStart) { - lineOffsets.push(i); - isLineStart = false; - } - var ch = text.charAt(i); - isLineStart = (ch === '\r' || ch === '\n'); - if (ch === '\r' && i + 1 < text.length && text.charAt(i + 1) === '\n') { - i++; - } - } - if (isLineStart && text.length > 0) { - lineOffsets.push(text.length); - } - this._lineOffsets = lineOffsets; - } - return this._lineOffsets; - }; - FullTextDocument.prototype.positionAt = function (offset) { - offset = Math.max(Math.min(offset, this._content.length), 0); - var lineOffsets = this.getLineOffsets(); - var low = 0, high = lineOffsets.length; - if (high === 0) { - return Position.create(0, offset); - } - while (low < high) { - var mid = Math.floor((low + high) / 2); - if (lineOffsets[mid] > offset) { - high = mid; - } - else { - low = mid + 1; - } - } - // low is the least x for which the line offset is larger than the current offset - // or array.length if no line offset is larger than the current offset - var line = low - 1; - return Position.create(line, offset - lineOffsets[line]); - }; - FullTextDocument.prototype.offsetAt = function (position) { - var lineOffsets = this.getLineOffsets(); - if (position.line >= lineOffsets.length) { - return this._content.length; - } - else if (position.line < 0) { - return 0; - } - var lineOffset = lineOffsets[position.line]; - var nextLineOffset = (position.line + 1 < lineOffsets.length) ? lineOffsets[position.line + 1] : this._content.length; - return Math.max(Math.min(lineOffset + position.character, nextLineOffset), lineOffset); - }; - Object.defineProperty(FullTextDocument.prototype, "lineCount", { - get: function () { - return this.getLineOffsets().length; - }, - enumerable: false, - configurable: true - }); - return FullTextDocument; - }()); - var Is; - (function (Is) { - var toString = Object.prototype.toString; - function defined(value) { - return typeof value !== 'undefined'; - } - Is.defined = defined; - function undefined(value) { - return typeof value === 'undefined'; - } - Is.undefined = undefined; - function boolean(value) { - return value === true || value === false; - } - Is.boolean = boolean; - function string(value) { - return toString.call(value) === '[object String]'; - } - Is.string = string; - function number(value) { - return toString.call(value) === '[object Number]'; - } - Is.number = number; - function numberRange(value, min, max) { - return toString.call(value) === '[object Number]' && min <= value && value <= max; - } - Is.numberRange = numberRange; - function integer(value) { - return toString.call(value) === '[object Number]' && -2147483648 <= value && value <= 2147483647; - } - Is.integer = integer; - function uinteger(value) { - return toString.call(value) === '[object Number]' && 0 <= value && value <= 2147483647; - } - Is.uinteger = uinteger; - function func(value) { - return toString.call(value) === '[object Function]'; - } - Is.func = func; - function objectLiteral(value) { - // Strictly speaking class instances pass this check as well. Since the LSP - // doesn't use classes we ignore this for now. If we do we need to add something - // like this: `Object.getPrototypeOf(Object.getPrototypeOf(x)) === null` - return value !== null && typeof value === 'object'; - } - Is.objectLiteral = objectLiteral; - function typedArray(value, check) { - return Array.isArray(value) && value.every(check); - } - Is.typedArray = typedArray; - })(Is || (Is = {})); -}); -//# sourceMappingURL=main.js.map \ No newline at end of file diff --git a/server/node_modules/vscode-languageserver-types/package.json b/server/node_modules/vscode-languageserver-types/package.json deleted file mode 100644 index 8c8e202..0000000 --- a/server/node_modules/vscode-languageserver-types/package.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "name": "vscode-languageserver-types", - "description": "Types used by the Language server for node", - "version": "3.16.0", - "author": "Microsoft Corporation", - "license": "MIT", - "repository": { - "type": "git", - "url": "https://github.com/Microsoft/vscode-languageserver-node.git", - "directory": "types" - }, - "bugs": { - "url": "https://github.com/Microsoft/vscode-languageserver-node/issues" - }, - "main": "./lib/umd/main.js", - "typings": "./lib/umd/main", - "module": "./lib/esm/main.js", - "scripts": { - "prepublishOnly": "git clean -xfd . && npm install && npm run clean && npm run compile:esm && npm run compile && npm run test", - "postpublish": "node ../build/npm/post-publish.js", - "compile": "node ../build/bin/tsc -b ./tsconfig.json", - "compile:esm": "node ../build/bin/tsc -b ./tsconfig.esm.json", - "clean": "node ../node_modules/rimraf/bin.js lib", - "watch": "node ../build/bin/tsc -b ./tsconfig-watch.json -w", - "test": "node ../node_modules/mocha/bin/_mocha", - "preversion": "npm test" - } -} diff --git a/server/node_modules/vscode-languageserver/License.txt b/server/node_modules/vscode-languageserver/License.txt deleted file mode 100644 index a07e3ae..0000000 --- a/server/node_modules/vscode-languageserver/License.txt +++ /dev/null @@ -1,11 +0,0 @@ -Copyright (c) Microsoft Corporation - -All rights reserved. - -MIT License - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/server/node_modules/vscode-languageserver/README.md b/server/node_modules/vscode-languageserver/README.md deleted file mode 100644 index 4198157..0000000 --- a/server/node_modules/vscode-languageserver/README.md +++ /dev/null @@ -1,17 +0,0 @@ -# VSCode Language Server - -[![NPM Version](https://img.shields.io/npm/v/vscode-languageserver.svg)](https://npmjs.org/package/vscode-languageserver) -[![NPM Downloads](https://img.shields.io/npm/dm/vscode-languageserver.svg)](https://npmjs.org/package/vscode-languageserver) -[![Build Status](https://travis-ci.org/Microsoft/vscode-languageserver-node.svg?branch=master)](https://travis-ci.org/Microsoft/vscode-languageserver-node) - -Npm module to implement a VSCode language server using [Node.js](https://nodejs.org/) as a runtime. - -Click [here](https://code.visualstudio.com/docs/extensions/example-language-server) for a detailed document on how to use this npm module -to implement language servers for [VSCode](https://code.visualstudio.com/). - -## History - -For the history please see the [main repository](https://github.com/Microsoft/vscode-languageserver-node/blob/master/README.md) - -## License -[MIT](https://github.com/Microsoft/vscode-languageserver-node/blob/master/License.txt) \ No newline at end of file diff --git a/server/node_modules/vscode-languageserver/bin/installServerIntoExtension b/server/node_modules/vscode-languageserver/bin/installServerIntoExtension deleted file mode 100755 index 0e84cbc..0000000 --- a/server/node_modules/vscode-languageserver/bin/installServerIntoExtension +++ /dev/null @@ -1,73 +0,0 @@ -/* eslint-disable no-console */ -#!/usr/bin/env node - -var path = require('path'); -var fs = require('fs'); -var cp = require('child_process'); - -var extensionDirectory = process.argv[2]; -if (!extensionDirectory) { - console.error('No extension directory provided.'); - process.exit(1); -} -extensionDirectory = path.resolve(extensionDirectory); -if (!fs.existsSync(extensionDirectory)) { - console.error('Extension directory ' + extensionDirectory + ' doesn\'t exist on disk.'); - process.exit(1); -} - -var packageFile = process.argv[3]; -if (!packageFile) { - console.error('No package.json file provided.'); - process.exit(1); -} -packageFile = path.resolve(packageFile); -if (!fs.existsSync(packageFile)) { - console.error('Package file ' + packageFile + ' doesn\'t exist on disk.'); - process.exit(1); -} -var tsconfigFile = process.argv[4]; -if (!tsconfigFile) { - console.error('No tsconfig.json file provided'); - process.exit(1); -} -tsconfigFile = path.resolve(tsconfigFile); -if (!fs.existsSync(tsconfigFile)) { - console.error('tsconfig file ' + tsconfigFile + ' doesn\'t exist on disk.'); - process.exit(1); -} - -var extensionServerDirectory = path.join(extensionDirectory, 'server'); - -var json = require(tsconfigFile); -var compilerOptions = json.compilerOptions; -if (compilerOptions) { - var outDir = compilerOptions.outDir; - if (!outDir || path.join(path.dirname(tsconfigFile), outDir) !== extensionServerDirectory) { - console.error('outDir in ' + process.argv[4] + ' must point to ' + extensionServerDirectory + ' but it points to ' + path.join(path.dirname(tsconfigFile), outDir)); - console.error('Please change outDir in ' + process.argv[4] + ' to ' + path.relative(path.dirname(tsconfigFile), extensionServerDirectory).replace(/\\/g, '/')); - process.exit(1); - } -} - -if (!fs.existsSync(extensionServerDirectory)) { - fs.mkdirSync(extensionServerDirectory); -} - -var dest = path.join(extensionServerDirectory, 'package.json'); -console.log('Copying package.json to extension\'s server location...'); -fs.writeFileSync(dest, fs.readFileSync(packageFile)); - -var shrinkwrapFile = process.argv[5]; -if (fs.existsSync(shrinkwrapFile)) { - const shrinkWrapDest = path.join(extensionServerDirectory, 'npm-shrinkwrap.json'); - shrinkwrapFile = path.resolve(shrinkwrapFile); - console.log('Copying npm-shrinkwrap.json to extension\'s server location...'); - fs.writeFileSync(shrinkWrapDest, fs.readFileSync(shrinkwrapFile)); - -} - -console.log('The script is deprecated. See https://github.com/microsoft/vscode-extension-samples/tree/master/lsp-sample for an example on how to setup an extension / server project.'); -console.log(''); -console.log('Updating server npm modules into extension\'s server location...'); -cp.execSync('npm update --production --prefix ' + extensionServerDirectory); diff --git a/server/node_modules/vscode-languageserver/browser.js b/server/node_modules/vscode-languageserver/browser.js deleted file mode 100644 index f5caebf..0000000 --- a/server/node_modules/vscode-languageserver/browser.js +++ /dev/null @@ -1,7 +0,0 @@ -/* -------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * ----------------------------------------------------------------------------------------- */ -'use strict'; - -module.exports = require('./lib/browser/main'); \ No newline at end of file diff --git a/server/node_modules/vscode-languageserver/lib/browser/main.js b/server/node_modules/vscode-languageserver/lib/browser/main.js deleted file mode 100644 index e69eca4..0000000 --- a/server/node_modules/vscode-languageserver/lib/browser/main.js +++ /dev/null @@ -1,59 +0,0 @@ -"use strict"; -/* -------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * ------------------------------------------------------------------------------------------ */ -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.createConnection = void 0; -const api_1 = require("../common/api"); -__exportStar(require("vscode-languageserver-protocol/browser"), exports); -__exportStar(require("../common/api"), exports); -let _shutdownReceived = false; -const watchDog = { - initialize: (_params) => { - }, - get shutdownReceived() { - return _shutdownReceived; - }, - set shutdownReceived(value) { - _shutdownReceived = value; - }, - exit: (_code) => { - } -}; -function createConnection(arg1, arg2, arg3, arg4) { - let factories; - let reader; - let writer; - let options; - if (arg1 !== void 0 && arg1.__brand === 'features') { - factories = arg1; - arg1 = arg2; - arg2 = arg3; - arg3 = arg4; - } - if (api_1.ConnectionStrategy.is(arg1) || api_1.ConnectionOptions.is(arg1)) { - options = arg1; - } - else { - reader = arg1; - writer = arg2; - options = arg3; - } - const connectionFactory = (logger) => { - return api_1.createProtocolConnection(reader, writer, logger, options); - }; - return api_1.createConnection(connectionFactory, watchDog, factories); -} -exports.createConnection = createConnection; -//# sourceMappingURL=main.js.map \ No newline at end of file diff --git a/server/node_modules/vscode-languageserver/lib/common/api.js b/server/node_modules/vscode-languageserver/lib/common/api.js deleted file mode 100644 index 3cd6262..0000000 --- a/server/node_modules/vscode-languageserver/lib/common/api.js +++ /dev/null @@ -1,28 +0,0 @@ -"use strict"; -/* -------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * ------------------------------------------------------------------------------------------ */ -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ProposedFeatures = exports.SemanticTokensBuilder = void 0; -const semanticTokens_1 = require("./semanticTokens"); -Object.defineProperty(exports, "SemanticTokensBuilder", { enumerable: true, get: function () { return semanticTokens_1.SemanticTokensBuilder; } }); -__exportStar(require("vscode-languageserver-protocol/"), exports); -__exportStar(require("./server"), exports); -var ProposedFeatures; -(function (ProposedFeatures) { - ProposedFeatures.all = { - __brand: 'features' - }; -})(ProposedFeatures = exports.ProposedFeatures || (exports.ProposedFeatures = {})); -//# sourceMappingURL=api.js.map \ No newline at end of file diff --git a/server/node_modules/vscode-languageserver/lib/common/callHierarchy.js b/server/node_modules/vscode-languageserver/lib/common/callHierarchy.js deleted file mode 100644 index 783f140..0000000 --- a/server/node_modules/vscode-languageserver/lib/common/callHierarchy.js +++ /dev/null @@ -1,35 +0,0 @@ -/* -------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * ------------------------------------------------------------------------------------------ */ -'use strict'; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.CallHierarchyFeature = void 0; -const vscode_languageserver_protocol_1 = require("vscode-languageserver-protocol"); -const CallHierarchyFeature = (Base) => { - return class extends Base { - get callHierarchy() { - return { - onPrepare: (handler) => { - this.connection.onRequest(vscode_languageserver_protocol_1.CallHierarchyPrepareRequest.type, (params, cancel) => { - return handler(params, cancel, this.attachWorkDoneProgress(params), undefined); - }); - }, - onIncomingCalls: (handler) => { - const type = vscode_languageserver_protocol_1.CallHierarchyIncomingCallsRequest.type; - this.connection.onRequest(type, (params, cancel) => { - return handler(params, cancel, this.attachWorkDoneProgress(params), this.attachPartialResultProgress(type, params)); - }); - }, - onOutgoingCalls: (handler) => { - const type = vscode_languageserver_protocol_1.CallHierarchyOutgoingCallsRequest.type; - this.connection.onRequest(type, (params, cancel) => { - return handler(params, cancel, this.attachWorkDoneProgress(params), this.attachPartialResultProgress(type, params)); - }); - } - }; - } - }; -}; -exports.CallHierarchyFeature = CallHierarchyFeature; -//# sourceMappingURL=callHierarchy.js.map \ No newline at end of file diff --git a/server/node_modules/vscode-languageserver/lib/common/configuration.js b/server/node_modules/vscode-languageserver/lib/common/configuration.js deleted file mode 100644 index 988c7a7..0000000 --- a/server/node_modules/vscode-languageserver/lib/common/configuration.js +++ /dev/null @@ -1,34 +0,0 @@ -"use strict"; -/* -------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * ------------------------------------------------------------------------------------------ */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ConfigurationFeature = void 0; -const vscode_languageserver_protocol_1 = require("vscode-languageserver-protocol"); -const Is = require("./utils/is"); -const ConfigurationFeature = (Base) => { - return class extends Base { - getConfiguration(arg) { - if (!arg) { - return this._getConfiguration({}); - } - else if (Is.string(arg)) { - return this._getConfiguration({ section: arg }); - } - else { - return this._getConfiguration(arg); - } - } - _getConfiguration(arg) { - let params = { - items: Array.isArray(arg) ? arg : [arg] - }; - return this.connection.sendRequest(vscode_languageserver_protocol_1.ConfigurationRequest.type, params).then((result) => { - return Array.isArray(arg) ? result : result[0]; - }); - } - }; -}; -exports.ConfigurationFeature = ConfigurationFeature; -//# sourceMappingURL=configuration.js.map \ No newline at end of file diff --git a/server/node_modules/vscode-languageserver/lib/common/fileOperations.js b/server/node_modules/vscode-languageserver/lib/common/fileOperations.js deleted file mode 100644 index b9ce58b..0000000 --- a/server/node_modules/vscode-languageserver/lib/common/fileOperations.js +++ /dev/null @@ -1,44 +0,0 @@ -"use strict"; -/* -------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * ------------------------------------------------------------------------------------------ */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.FileOperationsFeature = void 0; -const vscode_languageserver_protocol_1 = require("vscode-languageserver-protocol"); -const FileOperationsFeature = (Base) => { - return class extends Base { - onDidCreateFiles(handler) { - this.connection.onNotification(vscode_languageserver_protocol_1.DidCreateFilesNotification.type, (params) => { - handler(params); - }); - } - onDidRenameFiles(handler) { - this.connection.onNotification(vscode_languageserver_protocol_1.DidRenameFilesNotification.type, (params) => { - handler(params); - }); - } - onDidDeleteFiles(handler) { - this.connection.onNotification(vscode_languageserver_protocol_1.DidDeleteFilesNotification.type, (params) => { - handler(params); - }); - } - onWillCreateFiles(handler) { - return this.connection.onRequest(vscode_languageserver_protocol_1.WillCreateFilesRequest.type, (params, cancel) => { - return handler(params, cancel); - }); - } - onWillRenameFiles(handler) { - return this.connection.onRequest(vscode_languageserver_protocol_1.WillRenameFilesRequest.type, (params, cancel) => { - return handler(params, cancel); - }); - } - onWillDeleteFiles(handler) { - return this.connection.onRequest(vscode_languageserver_protocol_1.WillDeleteFilesRequest.type, (params, cancel) => { - return handler(params, cancel); - }); - } - }; -}; -exports.FileOperationsFeature = FileOperationsFeature; -//# sourceMappingURL=fileOperations.js.map \ No newline at end of file diff --git a/server/node_modules/vscode-languageserver/lib/common/linkedEditingRange.js b/server/node_modules/vscode-languageserver/lib/common/linkedEditingRange.js deleted file mode 100644 index bc36f12..0000000 --- a/server/node_modules/vscode-languageserver/lib/common/linkedEditingRange.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict"; -/* -------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * ------------------------------------------------------------------------------------------ */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.LinkedEditingRangeFeature = void 0; -const vscode_languageserver_protocol_1 = require("vscode-languageserver-protocol"); -const LinkedEditingRangeFeature = (Base) => { - return class extends Base { - onLinkedEditingRange(handler) { - this.connection.onRequest(vscode_languageserver_protocol_1.LinkedEditingRangeRequest.type, (params, cancel) => { - return handler(params, cancel, this.attachWorkDoneProgress(params), undefined); - }); - } - }; -}; -exports.LinkedEditingRangeFeature = LinkedEditingRangeFeature; -//# sourceMappingURL=linkedEditingRange.js.map \ No newline at end of file diff --git a/server/node_modules/vscode-languageserver/lib/common/moniker.js b/server/node_modules/vscode-languageserver/lib/common/moniker.js deleted file mode 100644 index 7fee871..0000000 --- a/server/node_modules/vscode-languageserver/lib/common/moniker.js +++ /dev/null @@ -1,24 +0,0 @@ -/* -------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * ------------------------------------------------------------------------------------------ */ -'use strict'; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.MonikerFeature = void 0; -const vscode_languageserver_protocol_1 = require("vscode-languageserver-protocol"); -const MonikerFeature = (Base) => { - return class extends Base { - get moniker() { - return { - on: (handler) => { - const type = vscode_languageserver_protocol_1.MonikerRequest.type; - this.connection.onRequest(type, (params, cancel) => { - return handler(params, cancel, this.attachWorkDoneProgress(params), this.attachPartialResultProgress(type, params)); - }); - }, - }; - } - }; -}; -exports.MonikerFeature = MonikerFeature; -//# sourceMappingURL=moniker.js.map \ No newline at end of file diff --git a/server/node_modules/vscode-languageserver/lib/common/progress.js b/server/node_modules/vscode-languageserver/lib/common/progress.js deleted file mode 100644 index 2b3a988..0000000 --- a/server/node_modules/vscode-languageserver/lib/common/progress.js +++ /dev/null @@ -1,160 +0,0 @@ -"use strict"; -/* -------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * ------------------------------------------------------------------------------------------ */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.attachPartialResult = exports.ProgressFeature = exports.attachWorkDone = void 0; -const vscode_languageserver_protocol_1 = require("vscode-languageserver-protocol"); -const uuid_1 = require("./utils/uuid"); -class WorkDoneProgressReporterImpl { - constructor(_connection, _token) { - this._connection = _connection; - this._token = _token; - WorkDoneProgressReporterImpl.Instances.set(this._token, this); - } - begin(title, percentage, message, cancellable) { - let param = { - kind: 'begin', - title, - percentage, - message, - cancellable - }; - this._connection.sendProgress(vscode_languageserver_protocol_1.WorkDoneProgress.type, this._token, param); - } - report(arg0, arg1) { - let param = { - kind: 'report' - }; - if (typeof arg0 === 'number') { - param.percentage = arg0; - if (arg1 !== undefined) { - param.message = arg1; - } - } - else { - param.message = arg0; - } - this._connection.sendProgress(vscode_languageserver_protocol_1.WorkDoneProgress.type, this._token, param); - } - done() { - WorkDoneProgressReporterImpl.Instances.delete(this._token); - this._connection.sendProgress(vscode_languageserver_protocol_1.WorkDoneProgress.type, this._token, { kind: 'end' }); - } -} -WorkDoneProgressReporterImpl.Instances = new Map(); -class WorkDoneProgressServerReporterImpl extends WorkDoneProgressReporterImpl { - constructor(connection, token) { - super(connection, token); - this._source = new vscode_languageserver_protocol_1.CancellationTokenSource(); - } - get token() { - return this._source.token; - } - done() { - this._source.dispose(); - super.done(); - } - cancel() { - this._source.cancel(); - } -} -class NullProgressReporter { - constructor() { - } - begin() { - } - report() { - } - done() { - } -} -class NullProgressServerReporter extends NullProgressReporter { - constructor() { - super(); - this._source = new vscode_languageserver_protocol_1.CancellationTokenSource(); - } - get token() { - return this._source.token; - } - done() { - this._source.dispose(); - } - cancel() { - this._source.cancel(); - } -} -function attachWorkDone(connection, params) { - if (params === undefined || params.workDoneToken === undefined) { - return new NullProgressReporter(); - } - const token = params.workDoneToken; - delete params.workDoneToken; - return new WorkDoneProgressReporterImpl(connection, token); -} -exports.attachWorkDone = attachWorkDone; -const ProgressFeature = (Base) => { - return class extends Base { - constructor() { - super(); - this._progressSupported = false; - } - initialize(capabilities) { - var _a; - if (((_a = capabilities === null || capabilities === void 0 ? void 0 : capabilities.window) === null || _a === void 0 ? void 0 : _a.workDoneProgress) === true) { - this._progressSupported = true; - this.connection.onNotification(vscode_languageserver_protocol_1.WorkDoneProgressCancelNotification.type, (params) => { - let progress = WorkDoneProgressReporterImpl.Instances.get(params.token); - if (progress instanceof WorkDoneProgressServerReporterImpl || progress instanceof NullProgressServerReporter) { - progress.cancel(); - } - }); - } - } - attachWorkDoneProgress(token) { - if (token === undefined) { - return new NullProgressReporter(); - } - else { - return new WorkDoneProgressReporterImpl(this.connection, token); - } - } - createWorkDoneProgress() { - if (this._progressSupported) { - const token = uuid_1.generateUuid(); - return this.connection.sendRequest(vscode_languageserver_protocol_1.WorkDoneProgressCreateRequest.type, { token }).then(() => { - const result = new WorkDoneProgressServerReporterImpl(this.connection, token); - return result; - }); - } - else { - return Promise.resolve(new NullProgressServerReporter()); - } - } - }; -}; -exports.ProgressFeature = ProgressFeature; -var ResultProgress; -(function (ResultProgress) { - ResultProgress.type = new vscode_languageserver_protocol_1.ProgressType(); -})(ResultProgress || (ResultProgress = {})); -class ResultProgressReporterImpl { - constructor(_connection, _token) { - this._connection = _connection; - this._token = _token; - } - report(data) { - this._connection.sendProgress(ResultProgress.type, this._token, data); - } -} -function attachPartialResult(connection, params) { - if (params === undefined || params.partialResultToken === undefined) { - return undefined; - } - const token = params.partialResultToken; - delete params.partialResultToken; - return new ResultProgressReporterImpl(connection, token); -} -exports.attachPartialResult = attachPartialResult; -//# sourceMappingURL=progress.js.map \ No newline at end of file diff --git a/server/node_modules/vscode-languageserver/lib/common/semanticTokens.js b/server/node_modules/vscode-languageserver/lib/common/semanticTokens.js deleted file mode 100644 index 66170c9..0000000 --- a/server/node_modules/vscode-languageserver/lib/common/semanticTokens.js +++ /dev/null @@ -1,127 +0,0 @@ -"use strict"; -/* -------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * ------------------------------------------------------------------------------------------ */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.SemanticTokensBuilder = exports.SemanticTokensFeature = void 0; -const vscode_languageserver_protocol_1 = require("vscode-languageserver-protocol"); -const SemanticTokensFeature = (Base) => { - return class extends Base { - get semanticTokens() { - return { - on: (handler) => { - const type = vscode_languageserver_protocol_1.SemanticTokensRequest.type; - this.connection.onRequest(type, (params, cancel) => { - return handler(params, cancel, this.attachWorkDoneProgress(params), this.attachPartialResultProgress(type, params)); - }); - }, - onDelta: (handler) => { - const type = vscode_languageserver_protocol_1.SemanticTokensDeltaRequest.type; - this.connection.onRequest(type, (params, cancel) => { - return handler(params, cancel, this.attachWorkDoneProgress(params), this.attachPartialResultProgress(type, params)); - }); - }, - onRange: (handler) => { - const type = vscode_languageserver_protocol_1.SemanticTokensRangeRequest.type; - this.connection.onRequest(type, (params, cancel) => { - return handler(params, cancel, this.attachWorkDoneProgress(params), this.attachPartialResultProgress(type, params)); - }); - } - }; - } - }; -}; -exports.SemanticTokensFeature = SemanticTokensFeature; -class SemanticTokensBuilder { - constructor() { - this._prevData = undefined; - this.initialize(); - } - initialize() { - this._id = Date.now(); - this._prevLine = 0; - this._prevChar = 0; - this._data = []; - this._dataLen = 0; - } - push(line, char, length, tokenType, tokenModifiers) { - let pushLine = line; - let pushChar = char; - if (this._dataLen > 0) { - pushLine -= this._prevLine; - if (pushLine === 0) { - pushChar -= this._prevChar; - } - } - this._data[this._dataLen++] = pushLine; - this._data[this._dataLen++] = pushChar; - this._data[this._dataLen++] = length; - this._data[this._dataLen++] = tokenType; - this._data[this._dataLen++] = tokenModifiers; - this._prevLine = line; - this._prevChar = char; - } - get id() { - return this._id.toString(); - } - previousResult(id) { - if (this.id === id) { - this._prevData = this._data; - } - this.initialize(); - } - build() { - this._prevData = undefined; - return { - resultId: this.id, - data: this._data - }; - } - canBuildEdits() { - return this._prevData !== undefined; - } - buildEdits() { - if (this._prevData !== undefined) { - const prevDataLength = this._prevData.length; - const dataLength = this._data.length; - let startIndex = 0; - while (startIndex < dataLength && startIndex < prevDataLength && this._prevData[startIndex] === this._data[startIndex]) { - startIndex++; - } - if (startIndex < dataLength && startIndex < prevDataLength) { - // Find end index - let endIndex = 0; - while (endIndex < dataLength && endIndex < prevDataLength && this._prevData[prevDataLength - 1 - endIndex] === this._data[dataLength - 1 - endIndex]) { - endIndex++; - } - const newData = this._data.slice(startIndex, dataLength - endIndex); - const result = { - resultId: this.id, - edits: [ - { start: startIndex, deleteCount: prevDataLength - endIndex - startIndex, data: newData } - ] - }; - return result; - } - else if (startIndex < dataLength) { - return { resultId: this.id, edits: [ - { start: startIndex, deleteCount: 0, data: this._data.slice(startIndex) } - ] }; - } - else if (startIndex < prevDataLength) { - return { resultId: this.id, edits: [ - { start: startIndex, deleteCount: prevDataLength - startIndex } - ] }; - } - else { - return { resultId: this.id, edits: [] }; - } - } - else { - return this.build(); - } - } -} -exports.SemanticTokensBuilder = SemanticTokensBuilder; -//# sourceMappingURL=semanticTokens.js.map \ No newline at end of file diff --git a/server/node_modules/vscode-languageserver/lib/common/server.js b/server/node_modules/vscode-languageserver/lib/common/server.js deleted file mode 100644 index b672f6a..0000000 --- a/server/node_modules/vscode-languageserver/lib/common/server.js +++ /dev/null @@ -1,834 +0,0 @@ -"use strict"; -/* -------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * ------------------------------------------------------------------------------------------ */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.createConnection = exports.combineFeatures = exports.combineLanguagesFeatures = exports.combineWorkspaceFeatures = exports.combineWindowFeatures = exports.combineClientFeatures = exports.combineTracerFeatures = exports.combineTelemetryFeatures = exports.combineConsoleFeatures = exports._LanguagesImpl = exports.BulkUnregistration = exports.BulkRegistration = exports.ErrorMessageTracker = exports.TextDocuments = void 0; -const vscode_languageserver_protocol_1 = require("vscode-languageserver-protocol"); -const Is = require("./utils/is"); -const UUID = require("./utils/uuid"); -const progress_1 = require("./progress"); -const configuration_1 = require("./configuration"); -const workspaceFolders_1 = require("./workspaceFolders"); -const callHierarchy_1 = require("./callHierarchy"); -const semanticTokens_1 = require("./semanticTokens"); -const showDocument_1 = require("./showDocument"); -const fileOperations_1 = require("./fileOperations"); -const linkedEditingRange_1 = require("./linkedEditingRange"); -const moniker_1 = require("./moniker"); -function null2Undefined(value) { - if (value === null) { - return undefined; - } - return value; -} -/** - * A manager for simple text documents - */ -class TextDocuments { - /** - * Create a new text document manager. - */ - constructor(configuration) { - this._documents = Object.create(null); - this._configuration = configuration; - this._onDidChangeContent = new vscode_languageserver_protocol_1.Emitter(); - this._onDidOpen = new vscode_languageserver_protocol_1.Emitter(); - this._onDidClose = new vscode_languageserver_protocol_1.Emitter(); - this._onDidSave = new vscode_languageserver_protocol_1.Emitter(); - this._onWillSave = new vscode_languageserver_protocol_1.Emitter(); - } - /** - * An event that fires when a text document managed by this manager - * has been opened or the content changes. - */ - get onDidChangeContent() { - return this._onDidChangeContent.event; - } - /** - * An event that fires when a text document managed by this manager - * has been opened. - */ - get onDidOpen() { - return this._onDidOpen.event; - } - /** - * An event that fires when a text document managed by this manager - * will be saved. - */ - get onWillSave() { - return this._onWillSave.event; - } - /** - * Sets a handler that will be called if a participant wants to provide - * edits during a text document save. - */ - onWillSaveWaitUntil(handler) { - this._willSaveWaitUntil = handler; - } - /** - * An event that fires when a text document managed by this manager - * has been saved. - */ - get onDidSave() { - return this._onDidSave.event; - } - /** - * An event that fires when a text document managed by this manager - * has been closed. - */ - get onDidClose() { - return this._onDidClose.event; - } - /** - * Returns the document for the given URI. Returns undefined if - * the document is not managed by this instance. - * - * @param uri The text document's URI to retrieve. - * @return the text document or `undefined`. - */ - get(uri) { - return this._documents[uri]; - } - /** - * Returns all text documents managed by this instance. - * - * @return all text documents. - */ - all() { - return Object.keys(this._documents).map(key => this._documents[key]); - } - /** - * Returns the URIs of all text documents managed by this instance. - * - * @return the URI's of all text documents. - */ - keys() { - return Object.keys(this._documents); - } - /** - * Listens for `low level` notification on the given connection to - * update the text documents managed by this instance. - * - * Please note that the connection only provides handlers not an event model. Therefore - * listening on a connection will overwrite the following handlers on a connection: - * `onDidOpenTextDocument`, `onDidChangeTextDocument`, `onDidCloseTextDocument`, - * `onWillSaveTextDocument`, `onWillSaveTextDocumentWaitUntil` and `onDidSaveTextDocument`. - * - * Use the corresponding events on the TextDocuments instance instead. - * - * @param connection The connection to listen on. - */ - listen(connection) { - connection.__textDocumentSync = vscode_languageserver_protocol_1.TextDocumentSyncKind.Full; - connection.onDidOpenTextDocument((event) => { - let td = event.textDocument; - let document = this._configuration.create(td.uri, td.languageId, td.version, td.text); - this._documents[td.uri] = document; - let toFire = Object.freeze({ document }); - this._onDidOpen.fire(toFire); - this._onDidChangeContent.fire(toFire); - }); - connection.onDidChangeTextDocument((event) => { - let td = event.textDocument; - let changes = event.contentChanges; - if (changes.length === 0) { - return; - } - let document = this._documents[td.uri]; - const { version } = td; - if (version === null || version === undefined) { - throw new Error(`Received document change event for ${td.uri} without valid version identifier`); - } - document = this._configuration.update(document, changes, version); - this._documents[td.uri] = document; - this._onDidChangeContent.fire(Object.freeze({ document })); - }); - connection.onDidCloseTextDocument((event) => { - let document = this._documents[event.textDocument.uri]; - if (document) { - delete this._documents[event.textDocument.uri]; - this._onDidClose.fire(Object.freeze({ document })); - } - }); - connection.onWillSaveTextDocument((event) => { - let document = this._documents[event.textDocument.uri]; - if (document) { - this._onWillSave.fire(Object.freeze({ document, reason: event.reason })); - } - }); - connection.onWillSaveTextDocumentWaitUntil((event, token) => { - let document = this._documents[event.textDocument.uri]; - if (document && this._willSaveWaitUntil) { - return this._willSaveWaitUntil(Object.freeze({ document, reason: event.reason }), token); - } - else { - return []; - } - }); - connection.onDidSaveTextDocument((event) => { - let document = this._documents[event.textDocument.uri]; - if (document) { - this._onDidSave.fire(Object.freeze({ document })); - } - }); - } -} -exports.TextDocuments = TextDocuments; -/** - * Helps tracking error message. Equal occurrences of the same - * message are only stored once. This class is for example - * useful if text documents are validated in a loop and equal - * error message should be folded into one. - */ -class ErrorMessageTracker { - constructor() { - this._messages = Object.create(null); - } - /** - * Add a message to the tracker. - * - * @param message The message to add. - */ - add(message) { - let count = this._messages[message]; - if (!count) { - count = 0; - } - count++; - this._messages[message] = count; - } - /** - * Send all tracked messages to the connection's window. - * - * @param connection The connection established between client and server. - */ - sendErrors(connection) { - Object.keys(this._messages).forEach(message => { - connection.window.showErrorMessage(message); - }); - } -} -exports.ErrorMessageTracker = ErrorMessageTracker; -class RemoteConsoleImpl { - constructor() { - } - rawAttach(connection) { - this._rawConnection = connection; - } - attach(connection) { - this._connection = connection; - } - get connection() { - if (!this._connection) { - throw new Error('Remote is not attached to a connection yet.'); - } - return this._connection; - } - fillServerCapabilities(_capabilities) { - } - initialize(_capabilities) { - } - error(message) { - this.send(vscode_languageserver_protocol_1.MessageType.Error, message); - } - warn(message) { - this.send(vscode_languageserver_protocol_1.MessageType.Warning, message); - } - info(message) { - this.send(vscode_languageserver_protocol_1.MessageType.Info, message); - } - log(message) { - this.send(vscode_languageserver_protocol_1.MessageType.Log, message); - } - send(type, message) { - if (this._rawConnection) { - this._rawConnection.sendNotification(vscode_languageserver_protocol_1.LogMessageNotification.type, { type, message }); - } - } -} -class _RemoteWindowImpl { - constructor() { - } - attach(connection) { - this._connection = connection; - } - get connection() { - if (!this._connection) { - throw new Error('Remote is not attached to a connection yet.'); - } - return this._connection; - } - initialize(_capabilities) { - } - fillServerCapabilities(_capabilities) { - } - showErrorMessage(message, ...actions) { - let params = { type: vscode_languageserver_protocol_1.MessageType.Error, message, actions }; - return this.connection.sendRequest(vscode_languageserver_protocol_1.ShowMessageRequest.type, params).then(null2Undefined); - } - showWarningMessage(message, ...actions) { - let params = { type: vscode_languageserver_protocol_1.MessageType.Warning, message, actions }; - return this.connection.sendRequest(vscode_languageserver_protocol_1.ShowMessageRequest.type, params).then(null2Undefined); - } - showInformationMessage(message, ...actions) { - let params = { type: vscode_languageserver_protocol_1.MessageType.Info, message, actions }; - return this.connection.sendRequest(vscode_languageserver_protocol_1.ShowMessageRequest.type, params).then(null2Undefined); - } -} -const RemoteWindowImpl = showDocument_1.ShowDocumentFeature(progress_1.ProgressFeature(_RemoteWindowImpl)); -var BulkRegistration; -(function (BulkRegistration) { - /** - * Creates a new bulk registration. - * @return an empty bulk registration. - */ - function create() { - return new BulkRegistrationImpl(); - } - BulkRegistration.create = create; -})(BulkRegistration = exports.BulkRegistration || (exports.BulkRegistration = {})); -class BulkRegistrationImpl { - constructor() { - this._registrations = []; - this._registered = new Set(); - } - add(type, registerOptions) { - const method = Is.string(type) ? type : type.method; - if (this._registered.has(method)) { - throw new Error(`${method} is already added to this registration`); - } - const id = UUID.generateUuid(); - this._registrations.push({ - id: id, - method: method, - registerOptions: registerOptions || {} - }); - this._registered.add(method); - } - asRegistrationParams() { - return { - registrations: this._registrations - }; - } -} -var BulkUnregistration; -(function (BulkUnregistration) { - function create() { - return new BulkUnregistrationImpl(undefined, []); - } - BulkUnregistration.create = create; -})(BulkUnregistration = exports.BulkUnregistration || (exports.BulkUnregistration = {})); -class BulkUnregistrationImpl { - constructor(_connection, unregistrations) { - this._connection = _connection; - this._unregistrations = new Map(); - unregistrations.forEach(unregistration => { - this._unregistrations.set(unregistration.method, unregistration); - }); - } - get isAttached() { - return !!this._connection; - } - attach(connection) { - this._connection = connection; - } - add(unregistration) { - this._unregistrations.set(unregistration.method, unregistration); - } - dispose() { - let unregistrations = []; - for (let unregistration of this._unregistrations.values()) { - unregistrations.push(unregistration); - } - let params = { - unregisterations: unregistrations - }; - this._connection.sendRequest(vscode_languageserver_protocol_1.UnregistrationRequest.type, params).then(undefined, (_error) => { - this._connection.console.info(`Bulk unregistration failed.`); - }); - } - disposeSingle(arg) { - const method = Is.string(arg) ? arg : arg.method; - const unregistration = this._unregistrations.get(method); - if (!unregistration) { - return false; - } - let params = { - unregisterations: [unregistration] - }; - this._connection.sendRequest(vscode_languageserver_protocol_1.UnregistrationRequest.type, params).then(() => { - this._unregistrations.delete(method); - }, (_error) => { - this._connection.console.info(`Un-registering request handler for ${unregistration.id} failed.`); - }); - return true; - } -} -class RemoteClientImpl { - attach(connection) { - this._connection = connection; - } - get connection() { - if (!this._connection) { - throw new Error('Remote is not attached to a connection yet.'); - } - return this._connection; - } - initialize(_capabilities) { - } - fillServerCapabilities(_capabilities) { - } - register(typeOrRegistrations, registerOptionsOrType, registerOptions) { - if (typeOrRegistrations instanceof BulkRegistrationImpl) { - return this.registerMany(typeOrRegistrations); - } - else if (typeOrRegistrations instanceof BulkUnregistrationImpl) { - return this.registerSingle1(typeOrRegistrations, registerOptionsOrType, registerOptions); - } - else { - return this.registerSingle2(typeOrRegistrations, registerOptionsOrType); - } - } - registerSingle1(unregistration, type, registerOptions) { - const method = Is.string(type) ? type : type.method; - const id = UUID.generateUuid(); - let params = { - registrations: [{ id, method, registerOptions: registerOptions || {} }] - }; - if (!unregistration.isAttached) { - unregistration.attach(this.connection); - } - return this.connection.sendRequest(vscode_languageserver_protocol_1.RegistrationRequest.type, params).then((_result) => { - unregistration.add({ id: id, method: method }); - return unregistration; - }, (_error) => { - this.connection.console.info(`Registering request handler for ${method} failed.`); - return Promise.reject(_error); - }); - } - registerSingle2(type, registerOptions) { - const method = Is.string(type) ? type : type.method; - const id = UUID.generateUuid(); - let params = { - registrations: [{ id, method, registerOptions: registerOptions || {} }] - }; - return this.connection.sendRequest(vscode_languageserver_protocol_1.RegistrationRequest.type, params).then((_result) => { - return vscode_languageserver_protocol_1.Disposable.create(() => { - this.unregisterSingle(id, method); - }); - }, (_error) => { - this.connection.console.info(`Registering request handler for ${method} failed.`); - return Promise.reject(_error); - }); - } - unregisterSingle(id, method) { - let params = { - unregisterations: [{ id, method }] - }; - return this.connection.sendRequest(vscode_languageserver_protocol_1.UnregistrationRequest.type, params).then(undefined, (_error) => { - this.connection.console.info(`Un-registering request handler for ${id} failed.`); - }); - } - registerMany(registrations) { - let params = registrations.asRegistrationParams(); - return this.connection.sendRequest(vscode_languageserver_protocol_1.RegistrationRequest.type, params).then(() => { - return new BulkUnregistrationImpl(this._connection, params.registrations.map(registration => { return { id: registration.id, method: registration.method }; })); - }, (_error) => { - this.connection.console.info(`Bulk registration failed.`); - return Promise.reject(_error); - }); - } -} -class _RemoteWorkspaceImpl { - constructor() { - } - attach(connection) { - this._connection = connection; - } - get connection() { - if (!this._connection) { - throw new Error('Remote is not attached to a connection yet.'); - } - return this._connection; - } - initialize(_capabilities) { - } - fillServerCapabilities(_capabilities) { - } - applyEdit(paramOrEdit) { - function isApplyWorkspaceEditParams(value) { - return value && !!value.edit; - } - let params = isApplyWorkspaceEditParams(paramOrEdit) ? paramOrEdit : { edit: paramOrEdit }; - return this.connection.sendRequest(vscode_languageserver_protocol_1.ApplyWorkspaceEditRequest.type, params); - } -} -const RemoteWorkspaceImpl = fileOperations_1.FileOperationsFeature(workspaceFolders_1.WorkspaceFoldersFeature(configuration_1.ConfigurationFeature(_RemoteWorkspaceImpl))); -class TracerImpl { - constructor() { - this._trace = vscode_languageserver_protocol_1.Trace.Off; - } - attach(connection) { - this._connection = connection; - } - get connection() { - if (!this._connection) { - throw new Error('Remote is not attached to a connection yet.'); - } - return this._connection; - } - initialize(_capabilities) { - } - fillServerCapabilities(_capabilities) { - } - set trace(value) { - this._trace = value; - } - log(message, verbose) { - if (this._trace === vscode_languageserver_protocol_1.Trace.Off) { - return; - } - this.connection.sendNotification(vscode_languageserver_protocol_1.LogTraceNotification.type, { - message: message, - verbose: this._trace === vscode_languageserver_protocol_1.Trace.Verbose ? verbose : undefined - }); - } -} -class TelemetryImpl { - constructor() { - } - attach(connection) { - this._connection = connection; - } - get connection() { - if (!this._connection) { - throw new Error('Remote is not attached to a connection yet.'); - } - return this._connection; - } - initialize(_capabilities) { - } - fillServerCapabilities(_capabilities) { - } - logEvent(data) { - this.connection.sendNotification(vscode_languageserver_protocol_1.TelemetryEventNotification.type, data); - } -} -class _LanguagesImpl { - constructor() { - } - attach(connection) { - this._connection = connection; - } - get connection() { - if (!this._connection) { - throw new Error('Remote is not attached to a connection yet.'); - } - return this._connection; - } - initialize(_capabilities) { - } - fillServerCapabilities(_capabilities) { - } - attachWorkDoneProgress(params) { - return progress_1.attachWorkDone(this.connection, params); - } - attachPartialResultProgress(_type, params) { - return progress_1.attachPartialResult(this.connection, params); - } -} -exports._LanguagesImpl = _LanguagesImpl; -const LanguagesImpl = moniker_1.MonikerFeature(linkedEditingRange_1.LinkedEditingRangeFeature(semanticTokens_1.SemanticTokensFeature(callHierarchy_1.CallHierarchyFeature(_LanguagesImpl)))); -function combineConsoleFeatures(one, two) { - return function (Base) { - return two(one(Base)); - }; -} -exports.combineConsoleFeatures = combineConsoleFeatures; -function combineTelemetryFeatures(one, two) { - return function (Base) { - return two(one(Base)); - }; -} -exports.combineTelemetryFeatures = combineTelemetryFeatures; -function combineTracerFeatures(one, two) { - return function (Base) { - return two(one(Base)); - }; -} -exports.combineTracerFeatures = combineTracerFeatures; -function combineClientFeatures(one, two) { - return function (Base) { - return two(one(Base)); - }; -} -exports.combineClientFeatures = combineClientFeatures; -function combineWindowFeatures(one, two) { - return function (Base) { - return two(one(Base)); - }; -} -exports.combineWindowFeatures = combineWindowFeatures; -function combineWorkspaceFeatures(one, two) { - return function (Base) { - return two(one(Base)); - }; -} -exports.combineWorkspaceFeatures = combineWorkspaceFeatures; -function combineLanguagesFeatures(one, two) { - return function (Base) { - return two(one(Base)); - }; -} -exports.combineLanguagesFeatures = combineLanguagesFeatures; -function combineFeatures(one, two) { - function combine(one, two, func) { - if (one && two) { - return func(one, two); - } - else if (one) { - return one; - } - else { - return two; - } - } - let result = { - __brand: 'features', - console: combine(one.console, two.console, combineConsoleFeatures), - tracer: combine(one.tracer, two.tracer, combineTracerFeatures), - telemetry: combine(one.telemetry, two.telemetry, combineTelemetryFeatures), - client: combine(one.client, two.client, combineClientFeatures), - window: combine(one.window, two.window, combineWindowFeatures), - workspace: combine(one.workspace, two.workspace, combineWorkspaceFeatures) - }; - return result; -} -exports.combineFeatures = combineFeatures; -function createConnection(connectionFactory, watchDog, factories) { - const logger = (factories && factories.console ? new (factories.console(RemoteConsoleImpl))() : new RemoteConsoleImpl()); - const connection = connectionFactory(logger); - logger.rawAttach(connection); - const tracer = (factories && factories.tracer ? new (factories.tracer(TracerImpl))() : new TracerImpl()); - const telemetry = (factories && factories.telemetry ? new (factories.telemetry(TelemetryImpl))() : new TelemetryImpl()); - const client = (factories && factories.client ? new (factories.client(RemoteClientImpl))() : new RemoteClientImpl()); - const remoteWindow = (factories && factories.window ? new (factories.window(RemoteWindowImpl))() : new RemoteWindowImpl()); - const workspace = (factories && factories.workspace ? new (factories.workspace(RemoteWorkspaceImpl))() : new RemoteWorkspaceImpl()); - const languages = (factories && factories.languages ? new (factories.languages(LanguagesImpl))() : new LanguagesImpl()); - const allRemotes = [logger, tracer, telemetry, client, remoteWindow, workspace, languages]; - function asPromise(value) { - if (value instanceof Promise) { - return value; - } - else if (Is.thenable(value)) { - return new Promise((resolve, reject) => { - value.then((resolved) => resolve(resolved), (error) => reject(error)); - }); - } - else { - return Promise.resolve(value); - } - } - let shutdownHandler = undefined; - let initializeHandler = undefined; - let exitHandler = undefined; - let protocolConnection = { - listen: () => connection.listen(), - sendRequest: (type, ...params) => connection.sendRequest(Is.string(type) ? type : type.method, ...params), - onRequest: (type, handler) => connection.onRequest(type, handler), - sendNotification: (type, param) => { - const method = Is.string(type) ? type : type.method; - if (arguments.length === 1) { - connection.sendNotification(method); - } - else { - connection.sendNotification(method, param); - } - }, - onNotification: (type, handler) => connection.onNotification(type, handler), - onProgress: connection.onProgress, - sendProgress: connection.sendProgress, - onInitialize: (handler) => initializeHandler = handler, - onInitialized: (handler) => connection.onNotification(vscode_languageserver_protocol_1.InitializedNotification.type, handler), - onShutdown: (handler) => shutdownHandler = handler, - onExit: (handler) => exitHandler = handler, - get console() { return logger; }, - get telemetry() { return telemetry; }, - get tracer() { return tracer; }, - get client() { return client; }, - get window() { return remoteWindow; }, - get workspace() { return workspace; }, - get languages() { return languages; }, - onDidChangeConfiguration: (handler) => connection.onNotification(vscode_languageserver_protocol_1.DidChangeConfigurationNotification.type, handler), - onDidChangeWatchedFiles: (handler) => connection.onNotification(vscode_languageserver_protocol_1.DidChangeWatchedFilesNotification.type, handler), - __textDocumentSync: undefined, - onDidOpenTextDocument: (handler) => connection.onNotification(vscode_languageserver_protocol_1.DidOpenTextDocumentNotification.type, handler), - onDidChangeTextDocument: (handler) => connection.onNotification(vscode_languageserver_protocol_1.DidChangeTextDocumentNotification.type, handler), - onDidCloseTextDocument: (handler) => connection.onNotification(vscode_languageserver_protocol_1.DidCloseTextDocumentNotification.type, handler), - onWillSaveTextDocument: (handler) => connection.onNotification(vscode_languageserver_protocol_1.WillSaveTextDocumentNotification.type, handler), - onWillSaveTextDocumentWaitUntil: (handler) => connection.onRequest(vscode_languageserver_protocol_1.WillSaveTextDocumentWaitUntilRequest.type, handler), - onDidSaveTextDocument: (handler) => connection.onNotification(vscode_languageserver_protocol_1.DidSaveTextDocumentNotification.type, handler), - sendDiagnostics: (params) => connection.sendNotification(vscode_languageserver_protocol_1.PublishDiagnosticsNotification.type, params), - onHover: (handler) => connection.onRequest(vscode_languageserver_protocol_1.HoverRequest.type, (params, cancel) => { - return handler(params, cancel, progress_1.attachWorkDone(connection, params), undefined); - }), - onCompletion: (handler) => connection.onRequest(vscode_languageserver_protocol_1.CompletionRequest.type, (params, cancel) => { - return handler(params, cancel, progress_1.attachWorkDone(connection, params), progress_1.attachPartialResult(connection, params)); - }), - onCompletionResolve: (handler) => connection.onRequest(vscode_languageserver_protocol_1.CompletionResolveRequest.type, handler), - onSignatureHelp: (handler) => connection.onRequest(vscode_languageserver_protocol_1.SignatureHelpRequest.type, (params, cancel) => { - return handler(params, cancel, progress_1.attachWorkDone(connection, params), undefined); - }), - onDeclaration: (handler) => connection.onRequest(vscode_languageserver_protocol_1.DeclarationRequest.type, (params, cancel) => { - return handler(params, cancel, progress_1.attachWorkDone(connection, params), progress_1.attachPartialResult(connection, params)); - }), - onDefinition: (handler) => connection.onRequest(vscode_languageserver_protocol_1.DefinitionRequest.type, (params, cancel) => { - return handler(params, cancel, progress_1.attachWorkDone(connection, params), progress_1.attachPartialResult(connection, params)); - }), - onTypeDefinition: (handler) => connection.onRequest(vscode_languageserver_protocol_1.TypeDefinitionRequest.type, (params, cancel) => { - return handler(params, cancel, progress_1.attachWorkDone(connection, params), progress_1.attachPartialResult(connection, params)); - }), - onImplementation: (handler) => connection.onRequest(vscode_languageserver_protocol_1.ImplementationRequest.type, (params, cancel) => { - return handler(params, cancel, progress_1.attachWorkDone(connection, params), progress_1.attachPartialResult(connection, params)); - }), - onReferences: (handler) => connection.onRequest(vscode_languageserver_protocol_1.ReferencesRequest.type, (params, cancel) => { - return handler(params, cancel, progress_1.attachWorkDone(connection, params), progress_1.attachPartialResult(connection, params)); - }), - onDocumentHighlight: (handler) => connection.onRequest(vscode_languageserver_protocol_1.DocumentHighlightRequest.type, (params, cancel) => { - return handler(params, cancel, progress_1.attachWorkDone(connection, params), progress_1.attachPartialResult(connection, params)); - }), - onDocumentSymbol: (handler) => connection.onRequest(vscode_languageserver_protocol_1.DocumentSymbolRequest.type, (params, cancel) => { - return handler(params, cancel, progress_1.attachWorkDone(connection, params), progress_1.attachPartialResult(connection, params)); - }), - onWorkspaceSymbol: (handler) => connection.onRequest(vscode_languageserver_protocol_1.WorkspaceSymbolRequest.type, (params, cancel) => { - return handler(params, cancel, progress_1.attachWorkDone(connection, params), progress_1.attachPartialResult(connection, params)); - }), - onCodeAction: (handler) => connection.onRequest(vscode_languageserver_protocol_1.CodeActionRequest.type, (params, cancel) => { - return handler(params, cancel, progress_1.attachWorkDone(connection, params), progress_1.attachPartialResult(connection, params)); - }), - onCodeActionResolve: (handler) => connection.onRequest(vscode_languageserver_protocol_1.CodeActionResolveRequest.type, (params, cancel) => { - return handler(params, cancel); - }), - onCodeLens: (handler) => connection.onRequest(vscode_languageserver_protocol_1.CodeLensRequest.type, (params, cancel) => { - return handler(params, cancel, progress_1.attachWorkDone(connection, params), progress_1.attachPartialResult(connection, params)); - }), - onCodeLensResolve: (handler) => connection.onRequest(vscode_languageserver_protocol_1.CodeLensResolveRequest.type, (params, cancel) => { - return handler(params, cancel); - }), - onDocumentFormatting: (handler) => connection.onRequest(vscode_languageserver_protocol_1.DocumentFormattingRequest.type, (params, cancel) => { - return handler(params, cancel, progress_1.attachWorkDone(connection, params), undefined); - }), - onDocumentRangeFormatting: (handler) => connection.onRequest(vscode_languageserver_protocol_1.DocumentRangeFormattingRequest.type, (params, cancel) => { - return handler(params, cancel, progress_1.attachWorkDone(connection, params), undefined); - }), - onDocumentOnTypeFormatting: (handler) => connection.onRequest(vscode_languageserver_protocol_1.DocumentOnTypeFormattingRequest.type, (params, cancel) => { - return handler(params, cancel); - }), - onRenameRequest: (handler) => connection.onRequest(vscode_languageserver_protocol_1.RenameRequest.type, (params, cancel) => { - return handler(params, cancel, progress_1.attachWorkDone(connection, params), undefined); - }), - onPrepareRename: (handler) => connection.onRequest(vscode_languageserver_protocol_1.PrepareRenameRequest.type, (params, cancel) => { - return handler(params, cancel); - }), - onDocumentLinks: (handler) => connection.onRequest(vscode_languageserver_protocol_1.DocumentLinkRequest.type, (params, cancel) => { - return handler(params, cancel, progress_1.attachWorkDone(connection, params), progress_1.attachPartialResult(connection, params)); - }), - onDocumentLinkResolve: (handler) => connection.onRequest(vscode_languageserver_protocol_1.DocumentLinkResolveRequest.type, (params, cancel) => { - return handler(params, cancel); - }), - onDocumentColor: (handler) => connection.onRequest(vscode_languageserver_protocol_1.DocumentColorRequest.type, (params, cancel) => { - return handler(params, cancel, progress_1.attachWorkDone(connection, params), progress_1.attachPartialResult(connection, params)); - }), - onColorPresentation: (handler) => connection.onRequest(vscode_languageserver_protocol_1.ColorPresentationRequest.type, (params, cancel) => { - return handler(params, cancel, progress_1.attachWorkDone(connection, params), progress_1.attachPartialResult(connection, params)); - }), - onFoldingRanges: (handler) => connection.onRequest(vscode_languageserver_protocol_1.FoldingRangeRequest.type, (params, cancel) => { - return handler(params, cancel, progress_1.attachWorkDone(connection, params), progress_1.attachPartialResult(connection, params)); - }), - onSelectionRanges: (handler) => connection.onRequest(vscode_languageserver_protocol_1.SelectionRangeRequest.type, (params, cancel) => { - return handler(params, cancel, progress_1.attachWorkDone(connection, params), progress_1.attachPartialResult(connection, params)); - }), - onExecuteCommand: (handler) => connection.onRequest(vscode_languageserver_protocol_1.ExecuteCommandRequest.type, (params, cancel) => { - return handler(params, cancel, progress_1.attachWorkDone(connection, params), undefined); - }), - dispose: () => connection.dispose() - }; - for (let remote of allRemotes) { - remote.attach(protocolConnection); - } - connection.onRequest(vscode_languageserver_protocol_1.InitializeRequest.type, (params) => { - watchDog.initialize(params); - if (Is.string(params.trace)) { - tracer.trace = vscode_languageserver_protocol_1.Trace.fromString(params.trace); - } - for (let remote of allRemotes) { - remote.initialize(params.capabilities); - } - if (initializeHandler) { - let result = initializeHandler(params, new vscode_languageserver_protocol_1.CancellationTokenSource().token, progress_1.attachWorkDone(connection, params), undefined); - return asPromise(result).then((value) => { - if (value instanceof vscode_languageserver_protocol_1.ResponseError) { - return value; - } - let result = value; - if (!result) { - result = { capabilities: {} }; - } - let capabilities = result.capabilities; - if (!capabilities) { - capabilities = {}; - result.capabilities = capabilities; - } - if (capabilities.textDocumentSync === undefined || capabilities.textDocumentSync === null) { - capabilities.textDocumentSync = Is.number(protocolConnection.__textDocumentSync) ? protocolConnection.__textDocumentSync : vscode_languageserver_protocol_1.TextDocumentSyncKind.None; - } - else if (!Is.number(capabilities.textDocumentSync) && !Is.number(capabilities.textDocumentSync.change)) { - capabilities.textDocumentSync.change = Is.number(protocolConnection.__textDocumentSync) ? protocolConnection.__textDocumentSync : vscode_languageserver_protocol_1.TextDocumentSyncKind.None; - } - for (let remote of allRemotes) { - remote.fillServerCapabilities(capabilities); - } - return result; - }); - } - else { - let result = { capabilities: { textDocumentSync: vscode_languageserver_protocol_1.TextDocumentSyncKind.None } }; - for (let remote of allRemotes) { - remote.fillServerCapabilities(result.capabilities); - } - return result; - } - }); - connection.onRequest(vscode_languageserver_protocol_1.ShutdownRequest.type, () => { - watchDog.shutdownReceived = true; - if (shutdownHandler) { - return shutdownHandler(new vscode_languageserver_protocol_1.CancellationTokenSource().token); - } - else { - return undefined; - } - }); - connection.onNotification(vscode_languageserver_protocol_1.ExitNotification.type, () => { - try { - if (exitHandler) { - exitHandler(); - } - } - finally { - if (watchDog.shutdownReceived) { - watchDog.exit(0); - } - else { - watchDog.exit(1); - } - } - }); - connection.onNotification(vscode_languageserver_protocol_1.SetTraceNotification.type, (params) => { - tracer.trace = vscode_languageserver_protocol_1.Trace.fromString(params.value); - }); - return protocolConnection; -} -exports.createConnection = createConnection; -//# sourceMappingURL=server.js.map \ No newline at end of file diff --git a/server/node_modules/vscode-languageserver/lib/common/showDocument.js b/server/node_modules/vscode-languageserver/lib/common/showDocument.js deleted file mode 100644 index 1eb8601..0000000 --- a/server/node_modules/vscode-languageserver/lib/common/showDocument.js +++ /dev/null @@ -1,17 +0,0 @@ -"use strict"; -/* -------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * ------------------------------------------------------------------------------------------ */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ShowDocumentFeature = void 0; -const vscode_languageserver_protocol_1 = require("vscode-languageserver-protocol"); -const ShowDocumentFeature = (Base) => { - return class extends Base { - showDocument(params) { - return this.connection.sendRequest(vscode_languageserver_protocol_1.ShowDocumentRequest.type, params); - } - }; -}; -exports.ShowDocumentFeature = ShowDocumentFeature; -//# sourceMappingURL=showDocument.js.map \ No newline at end of file diff --git a/server/node_modules/vscode-languageserver/lib/common/utils/is.js b/server/node_modules/vscode-languageserver/lib/common/utils/is.js deleted file mode 100644 index 2ff00fc..0000000 --- a/server/node_modules/vscode-languageserver/lib/common/utils/is.js +++ /dev/null @@ -1,44 +0,0 @@ -"use strict"; -/* -------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * ------------------------------------------------------------------------------------------ */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.thenable = exports.typedArray = exports.stringArray = exports.array = exports.func = exports.error = exports.number = exports.string = exports.boolean = void 0; -function boolean(value) { - return value === true || value === false; -} -exports.boolean = boolean; -function string(value) { - return typeof value === 'string' || value instanceof String; -} -exports.string = string; -function number(value) { - return typeof value === 'number' || value instanceof Number; -} -exports.number = number; -function error(value) { - return value instanceof Error; -} -exports.error = error; -function func(value) { - return typeof value === 'function'; -} -exports.func = func; -function array(value) { - return Array.isArray(value); -} -exports.array = array; -function stringArray(value) { - return array(value) && value.every(elem => string(elem)); -} -exports.stringArray = stringArray; -function typedArray(value, check) { - return Array.isArray(value) && value.every(check); -} -exports.typedArray = typedArray; -function thenable(value) { - return value && func(value.then); -} -exports.thenable = thenable; -//# sourceMappingURL=is.js.map \ No newline at end of file diff --git a/server/node_modules/vscode-languageserver/lib/common/utils/uuid.js b/server/node_modules/vscode-languageserver/lib/common/utils/uuid.js deleted file mode 100644 index 3637330..0000000 --- a/server/node_modules/vscode-languageserver/lib/common/utils/uuid.js +++ /dev/null @@ -1,98 +0,0 @@ -"use strict"; -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.generateUuid = exports.parse = exports.isUUID = exports.v4 = exports.empty = void 0; -class ValueUUID { - constructor(_value) { - this._value = _value; - // empty - } - asHex() { - return this._value; - } - equals(other) { - return this.asHex() === other.asHex(); - } -} -class V4UUID extends ValueUUID { - constructor() { - super([ - V4UUID._randomHex(), - V4UUID._randomHex(), - V4UUID._randomHex(), - V4UUID._randomHex(), - V4UUID._randomHex(), - V4UUID._randomHex(), - V4UUID._randomHex(), - V4UUID._randomHex(), - '-', - V4UUID._randomHex(), - V4UUID._randomHex(), - V4UUID._randomHex(), - V4UUID._randomHex(), - '-', - '4', - V4UUID._randomHex(), - V4UUID._randomHex(), - V4UUID._randomHex(), - '-', - V4UUID._oneOf(V4UUID._timeHighBits), - V4UUID._randomHex(), - V4UUID._randomHex(), - V4UUID._randomHex(), - '-', - V4UUID._randomHex(), - V4UUID._randomHex(), - V4UUID._randomHex(), - V4UUID._randomHex(), - V4UUID._randomHex(), - V4UUID._randomHex(), - V4UUID._randomHex(), - V4UUID._randomHex(), - V4UUID._randomHex(), - V4UUID._randomHex(), - V4UUID._randomHex(), - V4UUID._randomHex(), - ].join('')); - } - static _oneOf(array) { - return array[Math.floor(array.length * Math.random())]; - } - static _randomHex() { - return V4UUID._oneOf(V4UUID._chars); - } -} -V4UUID._chars = ['0', '1', '2', '3', '4', '5', '6', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f']; -V4UUID._timeHighBits = ['8', '9', 'a', 'b']; -/** - * An empty UUID that contains only zeros. - */ -exports.empty = new ValueUUID('00000000-0000-0000-0000-000000000000'); -function v4() { - return new V4UUID(); -} -exports.v4 = v4; -const _UUIDPattern = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i; -function isUUID(value) { - return _UUIDPattern.test(value); -} -exports.isUUID = isUUID; -/** - * Parses a UUID that is of the format xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx. - * @param value A uuid string. - */ -function parse(value) { - if (!isUUID(value)) { - throw new Error('invalid uuid'); - } - return new ValueUUID(value); -} -exports.parse = parse; -function generateUuid() { - return v4().asHex(); -} -exports.generateUuid = generateUuid; -//# sourceMappingURL=uuid.js.map \ No newline at end of file diff --git a/server/node_modules/vscode-languageserver/lib/common/workspaceFolders.js b/server/node_modules/vscode-languageserver/lib/common/workspaceFolders.js deleted file mode 100644 index fe50a10..0000000 --- a/server/node_modules/vscode-languageserver/lib/common/workspaceFolders.js +++ /dev/null @@ -1,35 +0,0 @@ -/* -------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * ------------------------------------------------------------------------------------------ */ -'use strict'; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.WorkspaceFoldersFeature = void 0; -const vscode_languageserver_protocol_1 = require("vscode-languageserver-protocol"); -const WorkspaceFoldersFeature = (Base) => { - return class extends Base { - initialize(capabilities) { - let workspaceCapabilities = capabilities.workspace; - if (workspaceCapabilities && workspaceCapabilities.workspaceFolders) { - this._onDidChangeWorkspaceFolders = new vscode_languageserver_protocol_1.Emitter(); - this.connection.onNotification(vscode_languageserver_protocol_1.DidChangeWorkspaceFoldersNotification.type, (params) => { - this._onDidChangeWorkspaceFolders.fire(params.event); - }); - } - } - getWorkspaceFolders() { - return this.connection.sendRequest(vscode_languageserver_protocol_1.WorkspaceFoldersRequest.type); - } - get onDidChangeWorkspaceFolders() { - if (!this._onDidChangeWorkspaceFolders) { - throw new Error('Client doesn\'t support sending workspace folder change events.'); - } - if (!this._unregistration) { - this._unregistration = this.connection.client.register(vscode_languageserver_protocol_1.DidChangeWorkspaceFoldersNotification.type); - } - return this._onDidChangeWorkspaceFolders.event; - } - }; -}; -exports.WorkspaceFoldersFeature = WorkspaceFoldersFeature; -//# sourceMappingURL=workspaceFolders.js.map \ No newline at end of file diff --git a/server/node_modules/vscode-languageserver/lib/node/files.js b/server/node_modules/vscode-languageserver/lib/node/files.js deleted file mode 100644 index 2afac48..0000000 --- a/server/node_modules/vscode-languageserver/lib/node/files.js +++ /dev/null @@ -1,263 +0,0 @@ -"use strict"; -/* -------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * ------------------------------------------------------------------------------------------ */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.resolveModulePath = exports.FileSystem = exports.resolveGlobalYarnPath = exports.resolveGlobalNodePath = exports.resolve = exports.uriToFilePath = void 0; -const url = require("url"); -const path = require("path"); -const fs = require("fs"); -const child_process_1 = require("child_process"); -/** - * @deprecated Use the `vscode-uri` npm module which provides a more - * complete implementation of handling VS Code URIs. - */ -function uriToFilePath(uri) { - let parsed = url.parse(uri); - if (parsed.protocol !== 'file:' || !parsed.path) { - return undefined; - } - let segments = parsed.path.split('/'); - for (var i = 0, len = segments.length; i < len; i++) { - segments[i] = decodeURIComponent(segments[i]); - } - if (process.platform === 'win32' && segments.length > 1) { - let first = segments[0]; - let second = segments[1]; - // Do we have a drive letter and we started with a / which is the - // case if the first segement is empty (see split above) - if (first.length === 0 && second.length > 1 && second[1] === ':') { - // Remove first slash - segments.shift(); - } - } - return path.normalize(segments.join('/')); -} -exports.uriToFilePath = uriToFilePath; -function isWindows() { - return process.platform === 'win32'; -} -function resolve(moduleName, nodePath, cwd, tracer) { - const nodePathKey = 'NODE_PATH'; - const app = [ - 'var p = process;', - 'p.on(\'message\',function(m){', - 'if(m.c===\'e\'){', - 'p.exit(0);', - '}', - 'else if(m.c===\'rs\'){', - 'try{', - 'var r=require.resolve(m.a);', - 'p.send({c:\'r\',s:true,r:r});', - '}', - 'catch(err){', - 'p.send({c:\'r\',s:false});', - '}', - '}', - '});' - ].join(''); - return new Promise((resolve, reject) => { - let env = process.env; - let newEnv = Object.create(null); - Object.keys(env).forEach(key => newEnv[key] = env[key]); - if (nodePath && fs.existsSync(nodePath) /* see issue 545 */) { - if (newEnv[nodePathKey]) { - newEnv[nodePathKey] = nodePath + path.delimiter + newEnv[nodePathKey]; - } - else { - newEnv[nodePathKey] = nodePath; - } - if (tracer) { - tracer(`NODE_PATH value is: ${newEnv[nodePathKey]}`); - } - } - newEnv['ELECTRON_RUN_AS_NODE'] = '1'; - try { - let cp = child_process_1.fork('', [], { - cwd: cwd, - env: newEnv, - execArgv: ['-e', app] - }); - if (cp.pid === void 0) { - reject(new Error(`Starting process to resolve node module ${moduleName} failed`)); - return; - } - cp.on('error', (error) => { - reject(error); - }); - cp.on('message', (message) => { - if (message.c === 'r') { - cp.send({ c: 'e' }); - if (message.s) { - resolve(message.r); - } - else { - reject(new Error(`Failed to resolve module: ${moduleName}`)); - } - } - }); - let message = { - c: 'rs', - a: moduleName - }; - cp.send(message); - } - catch (error) { - reject(error); - } - }); -} -exports.resolve = resolve; -/** - * Resolve the global npm package path. - * @deprecated Since this depends on the used package manager and their version the best is that servers - * implement this themselves since they know best what kind of package managers to support. - * @param tracer the tracer to use - */ -function resolveGlobalNodePath(tracer) { - let npmCommand = 'npm'; - const env = Object.create(null); - Object.keys(process.env).forEach(key => env[key] = process.env[key]); - env['NO_UPDATE_NOTIFIER'] = 'true'; - const options = { - encoding: 'utf8', - env - }; - if (isWindows()) { - npmCommand = 'npm.cmd'; - options.shell = true; - } - let handler = () => { }; - try { - process.on('SIGPIPE', handler); - let stdout = child_process_1.spawnSync(npmCommand, ['config', 'get', 'prefix'], options).stdout; - if (!stdout) { - if (tracer) { - tracer(`'npm config get prefix' didn't return a value.`); - } - return undefined; - } - let prefix = stdout.trim(); - if (tracer) { - tracer(`'npm config get prefix' value is: ${prefix}`); - } - if (prefix.length > 0) { - if (isWindows()) { - return path.join(prefix, 'node_modules'); - } - else { - return path.join(prefix, 'lib', 'node_modules'); - } - } - return undefined; - } - catch (err) { - return undefined; - } - finally { - process.removeListener('SIGPIPE', handler); - } -} -exports.resolveGlobalNodePath = resolveGlobalNodePath; -/* - * Resolve the global yarn pakage path. - * @deprecated Since this depends on the used package manager and their version the best is that servers - * implement this themselves since they know best what kind of package managers to support. - * @param tracer the tracer to use - */ -function resolveGlobalYarnPath(tracer) { - let yarnCommand = 'yarn'; - let options = { - encoding: 'utf8' - }; - if (isWindows()) { - yarnCommand = 'yarn.cmd'; - options.shell = true; - } - let handler = () => { }; - try { - process.on('SIGPIPE', handler); - let results = child_process_1.spawnSync(yarnCommand, ['global', 'dir', '--json'], options); - let stdout = results.stdout; - if (!stdout) { - if (tracer) { - tracer(`'yarn global dir' didn't return a value.`); - if (results.stderr) { - tracer(results.stderr); - } - } - return undefined; - } - let lines = stdout.trim().split(/\r?\n/); - for (let line of lines) { - try { - let yarn = JSON.parse(line); - if (yarn.type === 'log') { - return path.join(yarn.data, 'node_modules'); - } - } - catch (e) { - // Do nothing. Ignore the line - } - } - return undefined; - } - catch (err) { - return undefined; - } - finally { - process.removeListener('SIGPIPE', handler); - } -} -exports.resolveGlobalYarnPath = resolveGlobalYarnPath; -var FileSystem; -(function (FileSystem) { - let _isCaseSensitive = undefined; - function isCaseSensitive() { - if (_isCaseSensitive !== void 0) { - return _isCaseSensitive; - } - if (process.platform === 'win32') { - _isCaseSensitive = false; - } - else { - // convert current file name to upper case / lower case and check if file exists - // (guards against cases when name is already all uppercase or lowercase) - _isCaseSensitive = !fs.existsSync(__filename.toUpperCase()) || !fs.existsSync(__filename.toLowerCase()); - } - return _isCaseSensitive; - } - FileSystem.isCaseSensitive = isCaseSensitive; - function isParent(parent, child) { - if (isCaseSensitive()) { - return path.normalize(child).indexOf(path.normalize(parent)) === 0; - } - else { - return path.normalize(child).toLowerCase().indexOf(path.normalize(parent).toLowerCase()) === 0; - } - } - FileSystem.isParent = isParent; -})(FileSystem = exports.FileSystem || (exports.FileSystem = {})); -function resolveModulePath(workspaceRoot, moduleName, nodePath, tracer) { - if (nodePath) { - if (!path.isAbsolute(nodePath)) { - nodePath = path.join(workspaceRoot, nodePath); - } - return resolve(moduleName, nodePath, nodePath, tracer).then((value) => { - if (FileSystem.isParent(nodePath, value)) { - return value; - } - else { - return Promise.reject(new Error(`Failed to load ${moduleName} from node path location.`)); - } - }).then(undefined, (_error) => { - return resolve(moduleName, resolveGlobalNodePath(tracer), workspaceRoot, tracer); - }); - } - else { - return resolve(moduleName, resolveGlobalNodePath(tracer), workspaceRoot, tracer); - } -} -exports.resolveModulePath = resolveModulePath; -//# sourceMappingURL=files.js.map \ No newline at end of file diff --git a/server/node_modules/vscode-languageserver/lib/node/main.js b/server/node_modules/vscode-languageserver/lib/node/main.js deleted file mode 100644 index e89ee90..0000000 --- a/server/node_modules/vscode-languageserver/lib/node/main.js +++ /dev/null @@ -1,208 +0,0 @@ -"use strict"; -/* -------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * ------------------------------------------------------------------------------------------ */ -/// -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.createConnection = exports.Files = void 0; -const Is = require("../common/utils/is"); -const server_1 = require("../common/server"); -const fm = require("./files"); -const node_1 = require("vscode-languageserver-protocol/node"); -__exportStar(require("vscode-languageserver-protocol/node"), exports); -__exportStar(require("../common/api"), exports); -var Files; -(function (Files) { - Files.uriToFilePath = fm.uriToFilePath; - Files.resolveGlobalNodePath = fm.resolveGlobalNodePath; - Files.resolveGlobalYarnPath = fm.resolveGlobalYarnPath; - Files.resolve = fm.resolve; - Files.resolveModulePath = fm.resolveModulePath; -})(Files = exports.Files || (exports.Files = {})); -let _protocolConnection; -function endProtocolConnection() { - if (_protocolConnection === undefined) { - return; - } - try { - _protocolConnection.end(); - } - catch (_err) { - // Ignore. The client process could have already - // did and we can't send an end into the connection. - } -} -let _shutdownReceived = false; -let exitTimer = undefined; -function setupExitTimer() { - const argName = '--clientProcessId'; - function runTimer(value) { - try { - let processId = parseInt(value); - if (!isNaN(processId)) { - exitTimer = setInterval(() => { - try { - process.kill(processId, 0); - } - catch (ex) { - // Parent process doesn't exist anymore. Exit the server. - endProtocolConnection(); - process.exit(_shutdownReceived ? 0 : 1); - } - }, 3000); - } - } - catch (e) { - // Ignore errors; - } - } - for (let i = 2; i < process.argv.length; i++) { - let arg = process.argv[i]; - if (arg === argName && i + 1 < process.argv.length) { - runTimer(process.argv[i + 1]); - return; - } - else { - let args = arg.split('='); - if (args[0] === argName) { - runTimer(args[1]); - } - } - } -} -setupExitTimer(); -const watchDog = { - initialize: (params) => { - const processId = params.processId; - if (Is.number(processId) && exitTimer === undefined) { - // We received a parent process id. Set up a timer to periodically check - // if the parent is still alive. - setInterval(() => { - try { - process.kill(processId, 0); - } - catch (ex) { - // Parent process doesn't exist anymore. Exit the server. - process.exit(_shutdownReceived ? 0 : 1); - } - }, 3000); - } - }, - get shutdownReceived() { - return _shutdownReceived; - }, - set shutdownReceived(value) { - _shutdownReceived = value; - }, - exit: (code) => { - endProtocolConnection(); - process.exit(code); - } -}; -function createConnection(arg1, arg2, arg3, arg4) { - let factories; - let input; - let output; - let options; - if (arg1 !== void 0 && arg1.__brand === 'features') { - factories = arg1; - arg1 = arg2; - arg2 = arg3; - arg3 = arg4; - } - if (node_1.ConnectionStrategy.is(arg1) || node_1.ConnectionOptions.is(arg1)) { - options = arg1; - } - else { - input = arg1; - output = arg2; - options = arg3; - } - return _createConnection(input, output, options, factories); -} -exports.createConnection = createConnection; -function _createConnection(input, output, options, factories) { - if (!input && !output && process.argv.length > 2) { - let port = void 0; - let pipeName = void 0; - let argv = process.argv.slice(2); - for (let i = 0; i < argv.length; i++) { - let arg = argv[i]; - if (arg === '--node-ipc') { - input = new node_1.IPCMessageReader(process); - output = new node_1.IPCMessageWriter(process); - break; - } - else if (arg === '--stdio') { - input = process.stdin; - output = process.stdout; - break; - } - else if (arg === '--socket') { - port = parseInt(argv[i + 1]); - break; - } - else if (arg === '--pipe') { - pipeName = argv[i + 1]; - break; - } - else { - var args = arg.split('='); - if (args[0] === '--socket') { - port = parseInt(args[1]); - break; - } - else if (args[0] === '--pipe') { - pipeName = args[1]; - break; - } - } - } - if (port) { - let transport = node_1.createServerSocketTransport(port); - input = transport[0]; - output = transport[1]; - } - else if (pipeName) { - let transport = node_1.createServerPipeTransport(pipeName); - input = transport[0]; - output = transport[1]; - } - } - var commandLineMessage = 'Use arguments of createConnection or set command line parameters: \'--node-ipc\', \'--stdio\' or \'--socket={number}\''; - if (!input) { - throw new Error('Connection input stream is not set. ' + commandLineMessage); - } - if (!output) { - throw new Error('Connection output stream is not set. ' + commandLineMessage); - } - // Backwards compatibility - if (Is.func(input.read) && Is.func(input.on)) { - let inputStream = input; - inputStream.on('end', () => { - endProtocolConnection(); - process.exit(_shutdownReceived ? 0 : 1); - }); - inputStream.on('close', () => { - endProtocolConnection(); - process.exit(_shutdownReceived ? 0 : 1); - }); - } - const connectionFactory = (logger) => { - const result = node_1.createProtocolConnection(input, output, logger, options); - return result; - }; - return server_1.createConnection(connectionFactory, watchDog, factories); -} -//# sourceMappingURL=main.js.map \ No newline at end of file diff --git a/server/node_modules/vscode-languageserver/lib/node/resolve.js b/server/node_modules/vscode-languageserver/lib/node/resolve.js deleted file mode 100644 index 253f1a7..0000000 --- a/server/node_modules/vscode-languageserver/lib/node/resolve.js +++ /dev/null @@ -1,20 +0,0 @@ -"use strict"; -/* -------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * ------------------------------------------------------------------------------------------ */ -process.on('message', (message) => { - if (message.command === 'exit') { - process.exit(0); - } - else if (message.command === 'resolve') { - try { - let result = require.resolve(message.args); - process.send({ command: 'resolve', success: true, result: result }); - } - catch (err) { - process.send({ command: 'resolve', success: false }); - } - } -}); -//# sourceMappingURL=resolve.js.map \ No newline at end of file diff --git a/server/node_modules/vscode-languageserver/node.cmd b/server/node_modules/vscode-languageserver/node.cmd deleted file mode 100644 index 791e6e3..0000000 --- a/server/node_modules/vscode-languageserver/node.cmd +++ /dev/null @@ -1,5 +0,0 @@ -@echo off -REM This file is necessary to ensure that under Windows we don't -REM run the node.js file in the Windows Script Host when using -REM node in packakge.json scripts. See also PATHEXT setting -node.exe %* \ No newline at end of file diff --git a/server/node_modules/vscode-languageserver/node.js b/server/node_modules/vscode-languageserver/node.js deleted file mode 100644 index 388e319..0000000 --- a/server/node_modules/vscode-languageserver/node.js +++ /dev/null @@ -1,7 +0,0 @@ -/* -------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * ----------------------------------------------------------------------------------------- */ -'use strict'; - -module.exports = require('./lib/node/main'); \ No newline at end of file diff --git a/server/node_modules/vscode-languageserver/package.json b/server/node_modules/vscode-languageserver/package.json deleted file mode 100644 index 2610f88..0000000 --- a/server/node_modules/vscode-languageserver/package.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name": "vscode-languageserver", - "description": "Language server implementation for node", - "version": "7.0.0", - "author": "Microsoft Corporation", - "license": "MIT", - "repository": { - "type": "git", - "url": "https://github.com/Microsoft/vscode-languageserver-node.git", - "directory": "server" - }, - "bugs": { - "url": "https://github.com/Microsoft/vscode-languageserver-node/issues" - }, - "main": "./lib/node/main.js", - "browser": { - "./lib/node/main.js": "./lib/browser/main.js" - }, - "typings": "./lib/common/api.d.ts", - "bin": { - "installServerIntoExtension": "./bin/installServerIntoExtension" - }, - "dependencies": { - "vscode-languageserver-protocol": "3.16.0" - }, - "scripts": { - "prepublishOnly": "git clean -xfd . && npm install && npm run clean && npm run compile && npm test", - "postpublish": "node ../build/npm/post-publish.js", - "compile": "node ../build/bin/tsc -b ./tsconfig.json", - "watch": "node ../build/bin/tsc -b ./tsconfig-watch.json -w", - "clean": "node ../node_modules/rimraf/bin.js lib", - "test": "node ../node_modules/mocha/bin/_mocha", - "preversion": "npm test" - } -} diff --git a/server/node_modules/vscode-languageserver/thirdpartynotices.txt b/server/node_modules/vscode-languageserver/thirdpartynotices.txt deleted file mode 100644 index 0ca4633..0000000 --- a/server/node_modules/vscode-languageserver/thirdpartynotices.txt +++ /dev/null @@ -1,35 +0,0 @@ -THIRD-PARTY SOFTWARE NOTICES AND INFORMATION -For Microsoft vscode-languageserver - -This project incorporates material from the project(s) listed below (collectively, “Third Party Code”). -Microsoft is not the original author of the Third Party Code. The original copyright notice and license -under which Microsoft received such Third Party Code are set out below. This Third Party Code is licensed -to you under their original license terms set forth below. Microsoft reserves all other rights not expressly -granted, whether by implication, estoppel or otherwise. - -1. DefinitelyTyped version 0.0.1 (https://github.com/borisyankov/DefinitelyTyped) - -%% DefinitelyTyped NOTICES AND INFORMATION BEGIN HERE -========================================= -This project is licensed under the MIT license. -Copyrights are respective of each contributor listed at the beginning of each definition file. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. -========================================= -END OF DefinitelyTyped NOTICES AND INFORMATION \ No newline at end of file diff --git a/server/out/constants.js b/server/out/constants.js deleted file mode 100644 index ed1d586..0000000 --- a/server/out/constants.js +++ /dev/null @@ -1,42 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.startBuildAction = exports.cmiExt = exports.resiExt = exports.resExt = exports.compilerLogPartialPath = exports.compilerDirPartialPath = exports.bsconfigPartialPath = exports.bsbLock = exports.bsbNodePartialPath = exports.rescriptNodePartialPath = exports.analysisProdPath = exports.analysisDevPath = exports.bscNativePartialPath = exports.bscNativeReScriptPartialPath = exports.jsonrpcVersion = void 0; -const path = __importStar(require("path")); -// See https://microsoft.github.io/language-server-protocol/specification Abstract Message -// version is fixed to 2.0 -exports.jsonrpcVersion = "2.0"; -exports.bscNativeReScriptPartialPath = path.join("node_modules", "rescript", process.platform, "bsc.exe"); -exports.bscNativePartialPath = path.join("node_modules", "bs-platform", process.platform, "bsc.exe"); -exports.analysisDevPath = path.join(path.dirname(__dirname), "..", "analysis", "rescript-editor-analysis.exe"); -exports.analysisProdPath = path.join(path.dirname(__dirname), "analysis_binaries", process.platform, "rescript-editor-analysis.exe"); -// can't use the native bsb/rescript since we might need the watcher -w flag, which is only in the JS wrapper -exports.rescriptNodePartialPath = path.join("node_modules", ".bin", "rescript"); -exports.bsbNodePartialPath = path.join("node_modules", ".bin", "bsb"); -exports.bsbLock = ".bsb.lock"; -exports.bsconfigPartialPath = "bsconfig.json"; -exports.compilerDirPartialPath = path.join("lib", "bs"); -exports.compilerLogPartialPath = path.join("lib", "bs", ".compiler.log"); -exports.resExt = ".res"; -exports.resiExt = ".resi"; -exports.cmiExt = ".cmi"; -exports.startBuildAction = "Start Build"; -//# sourceMappingURL=constants.js.map \ No newline at end of file diff --git a/server/out/server.js b/server/out/server.js deleted file mode 100644 index 9ab16a9..0000000 --- a/server/out/server.js +++ /dev/null @@ -1,671 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const process_1 = __importDefault(require("process")); -const p = __importStar(require("vscode-languageserver-protocol")); -const m = __importStar(require("vscode-jsonrpc/lib/messages")); -const v = __importStar(require("vscode-languageserver")); -const rpc = __importStar(require("vscode-jsonrpc")); -const path = __importStar(require("path")); -const fs_1 = __importDefault(require("fs")); -// TODO: check DidChangeWatchedFilesNotification. -const vscode_languageserver_protocol_1 = require("vscode-languageserver-protocol"); -const utils = __importStar(require("./utils")); -const c = __importStar(require("./constants")); -const chokidar = __importStar(require("chokidar")); -const console_1 = require("console"); -const url_1 = require("url"); -// https://microsoft.github.io/language-server-protocol/specification#initialize -// According to the spec, there could be requests before the 'initialize' request. Link in comment tells how to handle them. -let initialized = false; -let serverSentRequestIdCounter = 0; -// https://microsoft.github.io/language-server-protocol/specification#exit -let shutdownRequestAlreadyReceived = false; -let stupidFileContentCache = new Map(); -let projectsFiles = new Map(); -// ^ caching AND states AND distributed system. Why does LSP has to be stupid like this -// will be properly defined later depending on the mode (stdio/node-rpc) -let send = (_) => { }; -let createInterfaceRequest = new v.RequestType("rescript-vscode.create_interface"); -let sendUpdatedDiagnostics = () => { - projectsFiles.forEach(({ filesWithDiagnostics }, projectRootPath) => { - let content = fs_1.default.readFileSync(path.join(projectRootPath, c.compilerLogPartialPath), { encoding: "utf-8" }); - let { done, result: filesAndErrors } = utils.parseCompilerLogOutput(content); - // diff - Object.keys(filesAndErrors).forEach((file) => { - let params = { - uri: file, - diagnostics: filesAndErrors[file], - }; - let notification = { - jsonrpc: c.jsonrpcVersion, - method: "textDocument/publishDiagnostics", - params: params, - }; - send(notification); - filesWithDiagnostics.add(file); - }); - if (done) { - // clear old files - filesWithDiagnostics.forEach((file) => { - if (filesAndErrors[file] == null) { - // Doesn't exist in the new diagnostics. Clear this diagnostic - let params = { - uri: file, - diagnostics: [], - }; - let notification = { - jsonrpc: c.jsonrpcVersion, - method: "textDocument/publishDiagnostics", - params: params, - }; - send(notification); - filesWithDiagnostics.delete(file); - } - }); - } - }); -}; -let deleteProjectDiagnostics = (projectRootPath) => { - let root = projectsFiles.get(projectRootPath); - if (root != null) { - root.filesWithDiagnostics.forEach((file) => { - let params = { - uri: file, - diagnostics: [], - }; - let notification = { - jsonrpc: c.jsonrpcVersion, - method: "textDocument/publishDiagnostics", - params: params, - }; - send(notification); - }); - projectsFiles.delete(projectRootPath); - } -}; -let compilerLogsWatcher = chokidar - .watch([], { - awaitWriteFinish: { - stabilityThreshold: 1, - }, -}) - .on("all", (_e, changedPath) => { - sendUpdatedDiagnostics(); -}); -let stopWatchingCompilerLog = () => { - // TODO: cleanup of compilerLogs? - compilerLogsWatcher.close(); -}; -let openedFile = (fileUri, fileContent) => { - let filePath = url_1.fileURLToPath(fileUri); - stupidFileContentCache.set(filePath, fileContent); - let projectRootPath = utils.findProjectRootOfFile(filePath); - if (projectRootPath != null) { - if (!projectsFiles.has(projectRootPath)) { - projectsFiles.set(projectRootPath, { - openFiles: new Set(), - filesWithDiagnostics: new Set(), - bsbWatcherByEditor: null, - }); - compilerLogsWatcher.add(path.join(projectRootPath, c.compilerLogPartialPath)); - } - let root = projectsFiles.get(projectRootPath); - root.openFiles.add(filePath); - let firstOpenFileOfProject = root.openFiles.size === 1; - // check if .bsb.lock is still there. If not, start a bsb -w ourselves - // because otherwise the diagnostics info we'll display might be stale - let bsbLockPath = path.join(projectRootPath, c.bsbLock); - if (firstOpenFileOfProject && !fs_1.default.existsSync(bsbLockPath)) { - // TODO: sometime stale .bsb.lock dangling. bsb -w knows .bsb.lock is - // stale. Use that logic - // TODO: close watcher when lang-server shuts down - if (utils.findNodeBuildOfProjectRoot(projectRootPath) != null) { - let payload = { - title: c.startBuildAction, - projectRootPath: projectRootPath, - }; - let params = { - type: p.MessageType.Info, - message: `Start a build for this project to get the freshest data?`, - actions: [payload], - }; - let request = { - jsonrpc: c.jsonrpcVersion, - id: serverSentRequestIdCounter++, - method: "window/showMessageRequest", - params: params, - }; - send(request); - // the client might send us back the "start build" action, which we'll - // handle in the isResponseMessage check in the message handling way - // below - } - else { - // we should send something to say that we can't find bsb.exe. But right now we'll silently not do anything - } - } - // no need to call sendUpdatedDiagnostics() here; the watcher add will - // call the listener which calls it - } -}; -let closedFile = (fileUri) => { - let filePath = url_1.fileURLToPath(fileUri); - stupidFileContentCache.delete(filePath); - let projectRootPath = utils.findProjectRootOfFile(filePath); - if (projectRootPath != null) { - let root = projectsFiles.get(projectRootPath); - if (root != null) { - root.openFiles.delete(filePath); - // clear diagnostics too if no open files open in said project - if (root.openFiles.size === 0) { - compilerLogsWatcher.unwatch(path.join(projectRootPath, c.compilerLogPartialPath)); - deleteProjectDiagnostics(projectRootPath); - if (root.bsbWatcherByEditor !== null) { - root.bsbWatcherByEditor.kill(); - root.bsbWatcherByEditor = null; - } - } - } - } -}; -let updateOpenedFile = (fileUri, fileContent) => { - let filePath = url_1.fileURLToPath(fileUri); - console_1.assert(stupidFileContentCache.has(filePath)); - stupidFileContentCache.set(filePath, fileContent); -}; -let getOpenedFileContent = (fileUri) => { - let filePath = url_1.fileURLToPath(fileUri); - let content = stupidFileContentCache.get(filePath); - console_1.assert(content != null); - return content; -}; -// Start listening now! -// We support two modes: the regular node RPC mode for VSCode, and the --stdio -// mode for other editors The latter is _technically unsupported_. It's an -// implementation detail that might change at any time -if (process_1.default.argv.includes("--stdio")) { - let writer = new rpc.StreamMessageWriter(process_1.default.stdout); - let reader = new rpc.StreamMessageReader(process_1.default.stdin); - // proper `this` scope for writer - send = (msg) => writer.write(msg); - reader.listen(onMessage); -} -else { - // proper `this` scope for process - send = (msg) => process_1.default.send(msg); - process_1.default.on("message", onMessage); -} -function hover(msg) { - let params = msg.params; - let filePath = url_1.fileURLToPath(params.textDocument.uri); - let response = utils.runAnalysisCommand(filePath, ["hover", filePath, params.position.line, params.position.character], msg); - return response; -} -function definition(msg) { - // https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_definition - let params = msg.params; - let filePath = url_1.fileURLToPath(params.textDocument.uri); - let response = utils.runAnalysisCommand(filePath, ["definition", filePath, params.position.line, params.position.character], msg); - return response; -} -function typeDefinition(msg) { - // https://microsoft.github.io/language-server-protocol/specification/specification-current/#textDocument_typeDefinition - let params = msg.params; - let filePath = url_1.fileURLToPath(params.textDocument.uri); - let response = utils.runAnalysisCommand(filePath, ["typeDefinition", filePath, params.position.line, params.position.character], msg); - return response; -} -function references(msg) { - // https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_references - let params = msg.params; - let filePath = url_1.fileURLToPath(params.textDocument.uri); - let result = utils.getReferencesForPosition(filePath, params.position); - let response = { - jsonrpc: c.jsonrpcVersion, - id: msg.id, - result, - // error: code and message set in case an exception happens during the definition request. - }; - return response; -} -function prepareRename(msg) { - // https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_prepareRename - let params = msg.params; - let filePath = url_1.fileURLToPath(params.textDocument.uri); - let locations = utils.getReferencesForPosition(filePath, params.position); - let result = null; - if (locations !== null) { - locations.forEach(loc => { - if (path.normalize(url_1.fileURLToPath(loc.uri)) === - path.normalize(url_1.fileURLToPath(params.textDocument.uri))) { - let { start, end } = loc.range; - let pos = params.position; - if (start.character <= pos.character && - start.line <= pos.line && - end.character >= pos.character && - end.line >= pos.line) { - result = loc.range; - } - ; - } - }); - } - ; - return { - jsonrpc: c.jsonrpcVersion, - id: msg.id, - result - }; -} -function rename(msg) { - // https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_rename - let params = msg.params; - let filePath = url_1.fileURLToPath(params.textDocument.uri); - let documentChanges = utils.runAnalysisAfterSanityCheck(filePath, [ - "rename", - filePath, - params.position.line, - params.position.character, - params.newName - ]); - let result = null; - if (documentChanges !== null) { - result = { documentChanges }; - } - ; - let response = { - jsonrpc: c.jsonrpcVersion, - id: msg.id, - result - }; - return response; -} -function documentSymbol(msg) { - // https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_documentSymbol - let params = msg.params; - let filePath = url_1.fileURLToPath(params.textDocument.uri); - let response = utils.runAnalysisCommand(filePath, ["documentSymbol", filePath], msg); - return response; -} -function completion(msg) { - let params = msg.params; - let filePath = url_1.fileURLToPath(params.textDocument.uri); - let code = getOpenedFileContent(params.textDocument.uri); - let tmpname = utils.createFileInTempDir(); - fs_1.default.writeFileSync(tmpname, code, { encoding: "utf-8" }); - let response = utils.runAnalysisCommand(filePath, [ - "completion", - filePath, - params.position.line, - params.position.character, - tmpname, - ], msg); - fs_1.default.unlink(tmpname, () => null); - return response; -} -function format(msg) { - // technically, a formatting failure should reply with the error. Sadly - // the LSP alert box for these error replies sucks (e.g. doesn't actually - // display the message). In order to signal the client to display a proper - // alert box (sometime with actionable buttons), we need to first send - // back a fake success message (because each request mandates a - // response), then right away send a server notification to display a - // nicer alert. Ugh. - let fakeSuccessResponse = { - jsonrpc: c.jsonrpcVersion, - id: msg.id, - result: [], - }; - let params = msg.params; - let filePath = url_1.fileURLToPath(params.textDocument.uri); - let extension = path.extname(params.textDocument.uri); - if (extension !== c.resExt && extension !== c.resiExt) { - let params = { - type: p.MessageType.Error, - message: `Not a ${c.resExt} or ${c.resiExt} file. Cannot format it.`, - }; - let response = { - jsonrpc: c.jsonrpcVersion, - method: "window/showMessage", - params: params, - }; - return [fakeSuccessResponse, response]; - } - else { - // See comment on findBscNativeDirOfFile for why we need - // to recursively search for bsc.exe upward - let bscNativePath = utils.findBscNativeOfFile(filePath); - if (bscNativePath === null) { - let params = { - type: p.MessageType.Error, - message: `Cannot find a nearby bsc.exe in rescript or bs-platform. It's needed for formatting.`, - }; - let response = { - jsonrpc: c.jsonrpcVersion, - method: "window/showMessage", - params: params, - }; - return [fakeSuccessResponse, response]; - } - else { - // code will always be defined here, even though technically it can be undefined - let code = getOpenedFileContent(params.textDocument.uri); - let formattedResult = utils.formatUsingValidBscNativePath(code, bscNativePath, extension === c.resiExt); - if (formattedResult.kind === "success") { - let max = code.length; - let result = [ - { - range: { - start: { line: 0, character: 0 }, - end: { line: max, character: max }, - }, - newText: formattedResult.result, - }, - ]; - let response = { - jsonrpc: c.jsonrpcVersion, - id: msg.id, - result: result, - }; - return [response]; - } - else { - // let the diagnostics logic display the updated syntax errors, - // from the build. - // Again, not sending the actual errors. See fakeSuccessResponse - // above for explanation - return [fakeSuccessResponse]; - } - } - } -} -function createInterface(msg) { - let params = msg.params; - let extension = path.extname(params.uri); - let filePath = url_1.fileURLToPath(params.uri); - let bscNativePath = utils.findBscNativeOfFile(filePath); - let projDir = utils.findProjectRootOfFile(filePath); - let code = getOpenedFileContent(params.uri); - let isReactComponent = code.includes("@react.component"); - if (bscNativePath === null || projDir === null) { - let params = { - type: p.MessageType.Error, - message: `Cannot find a nearby bsc.exe to generate the interface file.`, - }; - let response = { - jsonrpc: c.jsonrpcVersion, - method: "window/showMessage", - params: params, - }; - return response; - } - if (extension !== c.resExt) { - let params = { - type: p.MessageType.Error, - message: `Not a ${c.resExt} file. Cannot create an interface for it.`, - }; - let response = { - jsonrpc: c.jsonrpcVersion, - method: "window/showMessage", - params: params, - }; - return response; - } - if (isReactComponent) { - let params = { - type: p.MessageType.Error, - message: `Creating an interface with @react.component is not currently supported.`, - }; - let response = { - jsonrpc: c.jsonrpcVersion, - method: "window/showMessage", - params: params, - }; - return response; - } - let cmiPartialPath = utils.replaceFileExtension(filePath.split(projDir)[1], c.cmiExt); - let cmiPath = path.join(projDir, c.compilerDirPartialPath, cmiPartialPath); - let cmiAvailable = fs_1.default.existsSync(cmiPath); - if (!cmiAvailable) { - let params = { - type: p.MessageType.Error, - message: `No compiled interface file found. Please compile your project first.`, - }; - let response = { - jsonrpc: c.jsonrpcVersion, - method: "window/showMessage", - params, - }; - return response; - } - let intfResult = utils.createInterfaceFileUsingValidBscExePath(filePath, cmiPath, bscNativePath); - if (intfResult.kind === "success") { - let response = { - jsonrpc: c.jsonrpcVersion, - id: msg.id, - result: intfResult.result, - }; - return response; - } - else { - let response = { - jsonrpc: c.jsonrpcVersion, - id: msg.id, - error: { - code: m.ErrorCodes.InternalError, - message: "Unable to create interface file.", - }, - }; - return response; - } -} -function onMessage(msg) { - if (m.isNotificationMessage(msg)) { - // notification message, aka the client ends it and doesn't want a reply - if (!initialized && msg.method !== "exit") { - // From spec: "Notifications should be dropped, except for the exit notification. This will allow the exit of a server without an initialize request" - // For us: do nothing. We don't have anything we need to clean up right now - // TODO: we might have things we need to clean up now... like some watcher stuff - } - else if (msg.method === "exit") { - // The server should exit with success code 0 if the shutdown request has been received before; otherwise with error code 1 - if (shutdownRequestAlreadyReceived) { - process_1.default.exit(0); - } - else { - process_1.default.exit(1); - } - } - else if (msg.method === vscode_languageserver_protocol_1.DidOpenTextDocumentNotification.method) { - let params = msg.params; - let extName = path.extname(params.textDocument.uri); - if (extName === c.resExt || extName === c.resiExt) { - openedFile(params.textDocument.uri, params.textDocument.text); - } - } - else if (msg.method === vscode_languageserver_protocol_1.DidChangeTextDocumentNotification.method) { - let params = msg.params; - let extName = path.extname(params.textDocument.uri); - if (extName === c.resExt || extName === c.resiExt) { - let changes = params.contentChanges; - if (changes.length === 0) { - // no change? - } - else { - // we currently only support full changes - updateOpenedFile(params.textDocument.uri, changes[changes.length - 1].text); - } - } - } - else if (msg.method === vscode_languageserver_protocol_1.DidCloseTextDocumentNotification.method) { - let params = msg.params; - closedFile(params.textDocument.uri); - } - } - else if (m.isRequestMessage(msg)) { - // request message, aka client sent request and waits for our mandatory reply - if (!initialized && msg.method !== "initialize") { - let response = { - jsonrpc: c.jsonrpcVersion, - id: msg.id, - error: { - code: m.ErrorCodes.ServerNotInitialized, - message: "Server not initialized.", - }, - }; - send(response); - } - else if (msg.method === "initialize") { - // send the list of features we support - let result = { - // This tells the client: "hey, we support the following operations". - // Example: we want to expose "jump-to-definition". - // By adding `definitionProvider: true`, the client will now send "jump-to-definition" requests. - capabilities: { - // TODO: incremental sync? - textDocumentSync: v.TextDocumentSyncKind.Full, - documentFormattingProvider: true, - hoverProvider: true, - definitionProvider: true, - typeDefinitionProvider: true, - referencesProvider: true, - renameProvider: { prepareProvider: true }, - // disabled right now until we use the parser to show non-stale symbols per keystroke - // documentSymbolProvider: true, - completionProvider: { triggerCharacters: [".", ">", "@", "~"] }, - }, - }; - let response = { - jsonrpc: c.jsonrpcVersion, - id: msg.id, - result: result, - }; - initialized = true; - send(response); - } - else if (msg.method === "initialized") { - // sent from client after initialize. Nothing to do for now - let response = { - jsonrpc: c.jsonrpcVersion, - id: msg.id, - result: null, - }; - send(response); - } - else if (msg.method === "shutdown") { - // https://microsoft.github.io/language-server-protocol/specification#shutdown - if (shutdownRequestAlreadyReceived) { - let response = { - jsonrpc: c.jsonrpcVersion, - id: msg.id, - error: { - code: m.ErrorCodes.InvalidRequest, - message: `Language server already received the shutdown request`, - }, - }; - send(response); - } - else { - shutdownRequestAlreadyReceived = true; - // TODO: recheck logic around init/shutdown... - stopWatchingCompilerLog(); - // TODO: delete bsb watchers - let response = { - jsonrpc: c.jsonrpcVersion, - id: msg.id, - result: null, - }; - send(response); - } - } - else if (msg.method === p.HoverRequest.method) { - send(hover(msg)); - } - else if (msg.method === p.DefinitionRequest.method) { - send(definition(msg)); - } - else if (msg.method === p.TypeDefinitionRequest.method) { - send(typeDefinition(msg)); - } - else if (msg.method === p.ReferencesRequest.method) { - send(references(msg)); - } - else if (msg.method === p.PrepareRenameRequest.method) { - send(prepareRename(msg)); - } - else if (msg.method === p.RenameRequest.method) { - send(rename(msg)); - } - else if (msg.method === p.DocumentSymbolRequest.method) { - send(documentSymbol(msg)); - } - else if (msg.method === p.CompletionRequest.method) { - send(completion(msg)); - } - else if (msg.method === p.DocumentFormattingRequest.method) { - let responses = format(msg); - responses.forEach((response) => send(response)); - } - else if (msg.method === createInterfaceRequest.method) { - send(createInterface(msg)); - } - else { - let response = { - jsonrpc: c.jsonrpcVersion, - id: msg.id, - error: { - code: m.ErrorCodes.InvalidRequest, - message: "Unrecognized editor request.", - }, - }; - send(response); - } - } - else if (m.isResponseMessage(msg)) { - // response message. Currently the client should have only sent a response - // for asking us to start the build (see window/showMessageRequest in this - // file) - if (msg.result != null && - // @ts-ignore - msg.result.title != null && - // @ts-ignore - msg.result.title === c.startBuildAction) { - let msg_ = msg.result; - let projectRootPath = msg_.projectRootPath; - // TODO: sometime stale .bsb.lock dangling - // TODO: close watcher when lang-server shuts down. However, by Node's - // default, these subprocesses are automatically killed when this - // language-server process exits - let found = utils.findNodeBuildOfProjectRoot(projectRootPath); - if (found != null) { - let bsbProcess = utils.runBuildWatcherUsingValidBuildPath(found.buildPath, found.isReScript, projectRootPath); - let root = projectsFiles.get(projectRootPath); - root.bsbWatcherByEditor = bsbProcess; - // bsbProcess.on("message", (a) => console.log(a)); - } - } - } -} -//# sourceMappingURL=server.js.map \ No newline at end of file diff --git a/server/out/utils.js b/server/out/utils.js deleted file mode 100644 index 27f789b..0000000 --- a/server/out/utils.js +++ /dev/null @@ -1,441 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.parseCompilerLogOutput = exports.runBuildWatcherUsingValidBuildPath = exports.createInterfaceFileUsingValidBscExePath = exports.replaceFileExtension = exports.getReferencesForPosition = exports.runAnalysisCommand = exports.runAnalysisAfterSanityCheck = exports.formatUsingValidBscNativePath = exports.findNodeBuildOfProjectRoot = exports.findBscNativeOfFile = exports.findProjectRootOfFile = exports.createFileInTempDir = void 0; -const c = __importStar(require("./constants")); -const childProcess = __importStar(require("child_process")); -const path = __importStar(require("path")); -const t = __importStar(require("vscode-languageserver-types")); -const fs_1 = __importDefault(require("fs")); -const os = __importStar(require("os")); -let tempFilePrefix = "rescript_format_file_" + process.pid + "_"; -let tempFileId = 0; -let createFileInTempDir = (extension = "") => { - let tempFileName = tempFilePrefix + tempFileId + extension; - tempFileId = tempFileId + 1; - return path.join(os.tmpdir(), tempFileName); -}; -exports.createFileInTempDir = createFileInTempDir; -// TODO: races here? -// TODO: this doesn't handle file:/// scheme -let findProjectRootOfFile = (source) => { - let dir = path.dirname(source); - if (fs_1.default.existsSync(path.join(dir, c.bsconfigPartialPath))) { - return dir; - } - else { - if (dir === source) { - // reached top - return null; - } - else { - return exports.findProjectRootOfFile(dir); - } - } -}; -exports.findProjectRootOfFile = findProjectRootOfFile; -// TODO: races here? -// TODO: this doesn't handle file:/// scheme -// We need to recursively search for bs-platform/{platform}/bsc.exe upward from -// the project's root, because in some setups, such as yarn workspace/monorepo, -// the node_modules/bs-platform package might be hoisted up instead of alongside -// the project root. -// Also, if someone's ever formatting a regular project setup's dependency -// (which is weird but whatever), they'll at least find an upward bs-platform -// from the dependent. -let findBscNativeOfFile = (source) => { - let dir = path.dirname(source); - // The rescript package's rescript command is a JS wrapper. `rescript format` - // also invokes another JS wrapper. _That_ JS wrapper ultimately calls the - // (unexposed) bsc -format anyway. - let bscNativeReScriptPath = path.join(dir, c.bscNativeReScriptPartialPath); - let bscNativePath = path.join(dir, c.bscNativePartialPath); - if (fs_1.default.existsSync(bscNativeReScriptPath)) { - return bscNativeReScriptPath; - } - else if (fs_1.default.existsSync(bscNativePath)) { - return bscNativePath; - } - else if (dir === source) { - // reached the top - return null; - } - else { - return exports.findBscNativeOfFile(dir); - } -}; -exports.findBscNativeOfFile = findBscNativeOfFile; -// TODO: this doesn't handle file:/// scheme -let findNodeBuildOfProjectRoot = (projectRootPath) => { - let rescriptNodePath = path.join(projectRootPath, c.rescriptNodePartialPath); - let bsbNodePath = path.join(projectRootPath, c.bsbNodePartialPath); - if (fs_1.default.existsSync(rescriptNodePath)) { - return { buildPath: rescriptNodePath, isReScript: true }; - } - else if (fs_1.default.existsSync(bsbNodePath)) { - return { buildPath: bsbNodePath, isReScript: false }; - } - return null; -}; -exports.findNodeBuildOfProjectRoot = findNodeBuildOfProjectRoot; -let formatUsingValidBscNativePath = (code, bscNativePath, isInterface) => { - let extension = isInterface ? c.resiExt : c.resExt; - let formatTempFileFullPath = exports.createFileInTempDir(extension); - fs_1.default.writeFileSync(formatTempFileFullPath, code, { - encoding: "utf-8", - }); - try { - let result = childProcess.execFileSync(bscNativePath, [ - "-color", - "never", - "-format", - formatTempFileFullPath, - ]); - return { - kind: "success", - result: result.toString(), - }; - } - catch (e) { - return { - kind: "error", - error: e.message, - }; - } - finally { - // async close is fine. We don't use this file name again - fs_1.default.unlink(formatTempFileFullPath, () => null); - } -}; -exports.formatUsingValidBscNativePath = formatUsingValidBscNativePath; -let runAnalysisAfterSanityCheck = (filePath, args) => { - let binaryPath; - if (fs_1.default.existsSync(c.analysisDevPath)) { - binaryPath = c.analysisDevPath; - } - else if (fs_1.default.existsSync(c.analysisProdPath)) { - binaryPath = c.analysisProdPath; - } - else { - return null; - } - let projectRootPath = exports.findProjectRootOfFile(filePath); - if (projectRootPath == null) { - return null; - } - let stdout = childProcess.execFileSync(binaryPath, args, { - cwd: projectRootPath, - }); - return JSON.parse(stdout.toString()); -}; -exports.runAnalysisAfterSanityCheck = runAnalysisAfterSanityCheck; -let runAnalysisCommand = (filePath, args, msg) => { - let result = exports.runAnalysisAfterSanityCheck(filePath, args); - let response = { - jsonrpc: c.jsonrpcVersion, - id: msg.id, - result, - }; - return response; -}; -exports.runAnalysisCommand = runAnalysisCommand; -let getReferencesForPosition = (filePath, position) => exports.runAnalysisAfterSanityCheck(filePath, [ - "references", - filePath, - position.line, - position.character, -]); -exports.getReferencesForPosition = getReferencesForPosition; -let replaceFileExtension = (filePath, ext) => { - let name = path.basename(filePath, path.extname(filePath)); - return path.format({ dir: path.dirname(filePath), name, ext }); -}; -exports.replaceFileExtension = replaceFileExtension; -let createInterfaceFileUsingValidBscExePath = (filePath, cmiPath, bscExePath) => { - try { - let resiString = childProcess.execFileSync(bscExePath, [ - "-color", - "never", - cmiPath, - ]); - let resiPath = exports.replaceFileExtension(filePath, c.resiExt); - fs_1.default.writeFileSync(resiPath, resiString, { encoding: "utf-8" }); - return { - kind: "success", - result: "Interface successfully created.", - }; - } - catch (e) { - return { - kind: "error", - error: e.message, - }; - } -}; -exports.createInterfaceFileUsingValidBscExePath = createInterfaceFileUsingValidBscExePath; -let runBuildWatcherUsingValidBuildPath = (buildPath, isRescript, projectRootPath) => { - let cwdEnv = { - cwd: projectRootPath, - }; - if (process.platform === "win32") { - /* - - a node.js script in node_modules/.bin on windows is wrapped in a - batch script wrapper (there's also a regular binary of the same name on - windows, but that one's a shell script wrapper for cygwin). More info: - https://github.com/npm/cmd-shim/blob/c5118da34126e6639361fe9706a5ff07e726ed45/index.js#L1 - - a batch script adds the suffix .cmd to the script - - you can't call batch scripts through the regular `execFile`: - https://nodejs.org/api/child_process.html#child_process_spawning_bat_and_cmd_files_on_windows - - So you have to use `exec` instead, and make sure you quote the path - (since the path might have spaces), which `execFile` would have done - for you under the hood - */ - if (isRescript) { - return childProcess.exec(`"${buildPath}".cmd build -w`, cwdEnv); - } - else { - return childProcess.exec(`"${buildPath}".cmd -w`, cwdEnv); - } - } - else { - if (isRescript) { - return childProcess.execFile(buildPath, ["build", "-w"], cwdEnv); - } - else { - return childProcess.execFile(buildPath, ["-w"], cwdEnv); - } - } -}; -exports.runBuildWatcherUsingValidBuildPath = runBuildWatcherUsingValidBuildPath; -// Logic for parsing .compiler.log -/* example .compiler.log content: - -#Start(1600519680823) - - Syntax error! - /Users/chenglou/github/reason-react/src/test.res:1:8-2:3 - - 1 │ let a = - 2 │ let b = - 3 │ - - This let-binding misses an expression - - - Warning number 8 - /Users/chenglou/github/reason-react/src/test.res:3:5-8 - - 1 │ let a = j`😀` - 2 │ let b = `😀` - 3 │ let None = None - 4 │ let bla: int = " - 5 │ hi - - You forgot to handle a possible case here, for example: - Some _ - - - We've found a bug for you! - /Users/chenglou/github/reason-react/src/test.res:3:9 - - 1 │ let a = 1 - 2 │ let b = "hi" - 3 │ let a = b + 1 - - This has type: string - Somewhere wanted: int - -#Done(1600519680836) -*/ -// parser helpers -let pathToURI = (file) => { - return process.platform === "win32" ? `file:\\\\\\${file}` : `file://${file}`; -}; -let parseFileAndRange = (fileAndRange) => { - // https://github.com/rescript-lang/rescript-compiler/blob/0a3f4bb32ca81e89cefd5a912b8795878836f883/jscomp/super_errors/super_location.ml#L15-L25 - /* The file + location format can be: - a/b.res <- fallback, no location available (usually due to bad ppx...) - a/b.res:10:20 - a/b.res:10:20-21 <- last number here is the end char of line 10 - a/b.res:10:20-30:11 - */ - let regex = /(.+)\:(\d+)\:(\d+)(-(\d+)(\:(\d+))?)?$/; - /* ^^ file - ^^^ start line - ^^^ start character - ^ optional range - ^^^ end line or chararacter - ^^^ end character - */ - // for the trimming, see https://github.com/rescript-lang/rescript-vscode/pull/71#issuecomment-769160576 - let trimmedFileAndRange = fileAndRange.trim(); - let match = trimmedFileAndRange.match(regex); - if (match === null) { - // no location! Though LSP insist that we provide at least a dummy location - return { - file: pathToURI(trimmedFileAndRange), - range: { - start: { line: 0, character: 0 }, - end: { line: 0, character: 0 }, - }, - }; - } - let [_source, file, startLine, startChar, optionalEndGroup, endLineOrChar, _colonPlusEndCharOrNothing, endCharOrNothing,] = match; - // language-server position is 0-based. Ours is 1-based. Convert - // also, our end character is inclusive. Language-server's is exclusive - let range; - if (optionalEndGroup == null) { - let start = { - line: parseInt(startLine) - 1, - character: parseInt(startChar), - }; - range = { - start: start, - end: start, - }; - } - else { - let isSingleLine = endCharOrNothing == null; - let [endLine, endChar] = isSingleLine - ? [startLine, endLineOrChar] - : [endLineOrChar, endCharOrNothing]; - range = { - start: { - line: parseInt(startLine) - 1, - character: parseInt(startChar) - 1, - }, - end: { line: parseInt(endLine) - 1, character: parseInt(endChar) }, - }; - } - return { - file: pathToURI(file), - range, - }; -}; -let parseCompilerLogOutput = (content) => { - let parsedDiagnostics = []; - let lines = content.split(os.EOL); - let done = false; - for (let i = 0; i < lines.length; i++) { - let line = lines[i]; - if (line.startsWith(" We've found a bug for you!")) { - parsedDiagnostics.push({ - code: undefined, - severity: t.DiagnosticSeverity.Error, - tag: undefined, - content: [], - }); - } - else if (line.startsWith(" Warning number ")) { - let warningNumber = parseInt(line.slice(" Warning number ".length)); - let tag = undefined; - switch (warningNumber) { - case 11: - case 20: - case 26: - case 27: - case 32: - case 33: - case 34: - case 35: - case 36: - case 37: - case 38: - case 39: - case 60: - case 66: - case 67: - case 101: - tag = t.DiagnosticTag.Unnecessary; - break; - case 3: - tag = t.DiagnosticTag.Deprecated; - break; - } - parsedDiagnostics.push({ - code: Number.isNaN(warningNumber) ? undefined : warningNumber, - severity: t.DiagnosticSeverity.Warning, - tag: tag, - content: [], - }); - } - else if (line.startsWith(" Syntax error!")) { - parsedDiagnostics.push({ - code: undefined, - severity: t.DiagnosticSeverity.Error, - tag: undefined, - content: [], - }); - } - else if (line.startsWith("#Start(")) { - // do nothing for now - } - else if (line.startsWith("#Done(")) { - done = true; - } - else if (/^ +([0-9]+| +|\.) (│|┆)/.test(line)) { - // ^^ indent - // ^^^^^^^^^^^^^^^ gutter - // ^^^^^ separator - // swallow code display. Examples: - // 10 │ - // . │ - // │ - // 10 ┆ - } - else if (line.startsWith(" ")) { - // part of the actual diagnostics message - parsedDiagnostics[parsedDiagnostics.length - 1].content.push(line.slice(2)); - } - else if (line.trim() != "") { - // We'll assume that everything else is also part of the diagnostics too. - // Most of these should have been indented 2 spaces; sadly, some of them - // aren't (e.g. outcome printer printing badly, and certain old ocaml type - // messages not printing with indent). We used to get bug reports and fix - // the messages, but that strategy turned out too slow. One day we should - // revert to not having this branch... - parsedDiagnostics[parsedDiagnostics.length - 1].content.push(line); - } - } - let result = {}; - parsedDiagnostics.forEach((parsedDiagnostic) => { - let [fileAndRangeLine, ...diagnosticMessage] = parsedDiagnostic.content; - let { file, range } = parseFileAndRange(fileAndRangeLine); - if (result[file] == null) { - result[file] = []; - } - result[file].push({ - severity: parsedDiagnostic.severity, - tags: parsedDiagnostic.tag === undefined ? [] : [parsedDiagnostic.tag], - code: parsedDiagnostic.code, - range, - source: "ReScript", - // remove start and end whitespaces/newlines - message: diagnosticMessage.join("\n").trim() + "\n", - }); - }); - return { done, result }; -}; -exports.parseCompilerLogOutput = parseCompilerLogOutput; -//# sourceMappingURL=utils.js.map \ No newline at end of file diff --git a/server/package-lock.json b/server/package-lock.json deleted file mode 100644 index 7280483..0000000 --- a/server/package-lock.json +++ /dev/null @@ -1,376 +0,0 @@ -{ - "name": "rescript-language-server", - "version": "1.1.3", - "lockfileVersion": 2, - "requires": true, - "packages": { - "": { - "name": "rescript-language-server", - "version": "1.1.3", - "license": "MIT", - "dependencies": { - "chokidar": "^3.5.1", - "vscode-jsonrpc": "^5.0.1", - "vscode-languageserver": "^7.0.0", - "vscode-languageserver-protocol": "^3.16.0" - }, - "engines": { - "node": "*" - } - }, - "node_modules/anymatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.2.tgz", - "integrity": "sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg==", - "dependencies": { - "normalize-path": "^3.0.0", - "picomatch": "^2.0.4" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/binary-extensions": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", - "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", - "engines": { - "node": ">=8" - } - }, - "node_modules/braces": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", - "dependencies": { - "fill-range": "^7.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/chokidar": { - "version": "3.5.1", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.1.tgz", - "integrity": "sha512-9+s+Od+W0VJJzawDma/gvBNQqkTiqYTWLuZoyAsivsI4AaWTCzHG06/TMjsf1cYe9Cb97UCEhjz7HvnPk2p/tw==", - "dependencies": { - "anymatch": "~3.1.1", - "braces": "~3.0.2", - "fsevents": "~2.3.1", - "glob-parent": "~5.1.0", - "is-binary-path": "~2.1.0", - "is-glob": "~4.0.1", - "normalize-path": "~3.0.0", - "readdirp": "~3.5.0" - }, - "engines": { - "node": ">= 8.10.0" - }, - "optionalDependencies": { - "fsevents": "~2.3.1" - } - }, - "node_modules/fill-range": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", - "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", - "dependencies": { - "to-regex-range": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/fsevents": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", - "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", - "hasInstallScript": true, - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": "^8.16.0 || ^10.6.0 || >=11.0.0" - } - }, - "node_modules/glob-parent": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", - "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", - "dependencies": { - "is-glob": "^4.0.1" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/is-binary-path": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", - "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", - "dependencies": { - "binary-extensions": "^2.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/is-extglob": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-glob": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz", - "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==", - "dependencies": { - "is-extglob": "^2.1.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-number": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", - "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", - "engines": { - "node": ">=0.12.0" - } - }, - "node_modules/normalize-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", - "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/picomatch": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.3.tgz", - "integrity": "sha512-KpELjfwcCDUb9PeigTs2mBJzXUPzAuP2oPcA989He8Rte0+YUAjw1JVedDhuTKPkHjSYzMN3npC9luThGYEKdg==", - "engines": { - "node": ">=8.6" - }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" - } - }, - "node_modules/readdirp": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.5.0.tgz", - "integrity": "sha512-cMhu7c/8rdhkHXWsY+osBhfSy0JikwpHK/5+imo+LpeasTF8ouErHrlYkwT0++njiyuDvc7OFY5T3ukvZ8qmFQ==", - "dependencies": { - "picomatch": "^2.2.1" - }, - "engines": { - "node": ">=8.10.0" - } - }, - "node_modules/to-regex-range": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", - "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", - "dependencies": { - "is-number": "^7.0.0" - }, - "engines": { - "node": ">=8.0" - } - }, - "node_modules/vscode-jsonrpc": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-5.0.1.tgz", - "integrity": "sha512-JvONPptw3GAQGXlVV2utDcHx0BiY34FupW/kI6mZ5x06ER5DdPG/tXWMVHjTNULF5uKPOUUD0SaXg5QaubJL0A==", - "engines": { - "node": ">=8.0.0 || >=10.0.0" - } - }, - "node_modules/vscode-languageserver": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/vscode-languageserver/-/vscode-languageserver-7.0.0.tgz", - "integrity": "sha512-60HTx5ID+fLRcgdHfmz0LDZAXYEV68fzwG0JWwEPBode9NuMYTIxuYXPg4ngO8i8+Ou0lM7y6GzaYWbiDL0drw==", - "dependencies": { - "vscode-languageserver-protocol": "3.16.0" - }, - "bin": { - "installServerIntoExtension": "bin/installServerIntoExtension" - } - }, - "node_modules/vscode-languageserver-protocol": { - "version": "3.16.0", - "resolved": "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.16.0.tgz", - "integrity": "sha512-sdeUoAawceQdgIfTI+sdcwkiK2KU+2cbEYA0agzM2uqaUy2UpnnGHtWTHVEtS0ES4zHU0eMFRGN+oQgDxlD66A==", - "dependencies": { - "vscode-jsonrpc": "6.0.0", - "vscode-languageserver-types": "3.16.0" - } - }, - "node_modules/vscode-languageserver-protocol/node_modules/vscode-jsonrpc": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-6.0.0.tgz", - "integrity": "sha512-wnJA4BnEjOSyFMvjZdpiOwhSq9uDoK8e/kpRJDTaMYzwlkrhG1fwDIZI94CLsLzlCK5cIbMMtFlJlfR57Lavmg==", - "engines": { - "node": ">=8.0.0 || >=10.0.0" - } - }, - "node_modules/vscode-languageserver-types": { - "version": "3.16.0", - "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.16.0.tgz", - "integrity": "sha512-k8luDIWJWyenLc5ToFQQMaSrqCHiLwyKPHKPQZ5zz21vM+vIVUSvsRpcbiECH4WR88K2XZqc4ScRcZ7nk/jbeA==" - } - }, - "dependencies": { - "anymatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.2.tgz", - "integrity": "sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg==", - "requires": { - "normalize-path": "^3.0.0", - "picomatch": "^2.0.4" - } - }, - "binary-extensions": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", - "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==" - }, - "braces": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", - "requires": { - "fill-range": "^7.0.1" - } - }, - "chokidar": { - "version": "3.5.1", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.1.tgz", - "integrity": "sha512-9+s+Od+W0VJJzawDma/gvBNQqkTiqYTWLuZoyAsivsI4AaWTCzHG06/TMjsf1cYe9Cb97UCEhjz7HvnPk2p/tw==", - "requires": { - "anymatch": "~3.1.1", - "braces": "~3.0.2", - "fsevents": "~2.3.1", - "glob-parent": "~5.1.0", - "is-binary-path": "~2.1.0", - "is-glob": "~4.0.1", - "normalize-path": "~3.0.0", - "readdirp": "~3.5.0" - } - }, - "fill-range": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", - "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", - "requires": { - "to-regex-range": "^5.0.1" - } - }, - "fsevents": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", - "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", - "optional": true - }, - "glob-parent": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", - "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", - "requires": { - "is-glob": "^4.0.1" - } - }, - "is-binary-path": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", - "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", - "requires": { - "binary-extensions": "^2.0.0" - } - }, - "is-extglob": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=" - }, - "is-glob": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz", - "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==", - "requires": { - "is-extglob": "^2.1.1" - } - }, - "is-number": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", - "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==" - }, - "normalize-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", - "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==" - }, - "picomatch": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.3.tgz", - "integrity": "sha512-KpELjfwcCDUb9PeigTs2mBJzXUPzAuP2oPcA989He8Rte0+YUAjw1JVedDhuTKPkHjSYzMN3npC9luThGYEKdg==" - }, - "readdirp": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.5.0.tgz", - "integrity": "sha512-cMhu7c/8rdhkHXWsY+osBhfSy0JikwpHK/5+imo+LpeasTF8ouErHrlYkwT0++njiyuDvc7OFY5T3ukvZ8qmFQ==", - "requires": { - "picomatch": "^2.2.1" - } - }, - "to-regex-range": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", - "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", - "requires": { - "is-number": "^7.0.0" - } - }, - "vscode-jsonrpc": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-5.0.1.tgz", - "integrity": "sha512-JvONPptw3GAQGXlVV2utDcHx0BiY34FupW/kI6mZ5x06ER5DdPG/tXWMVHjTNULF5uKPOUUD0SaXg5QaubJL0A==" - }, - "vscode-languageserver": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/vscode-languageserver/-/vscode-languageserver-7.0.0.tgz", - "integrity": "sha512-60HTx5ID+fLRcgdHfmz0LDZAXYEV68fzwG0JWwEPBode9NuMYTIxuYXPg4ngO8i8+Ou0lM7y6GzaYWbiDL0drw==", - "requires": { - "vscode-languageserver-protocol": "3.16.0" - } - }, - "vscode-languageserver-protocol": { - "version": "3.16.0", - "resolved": "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.16.0.tgz", - "integrity": "sha512-sdeUoAawceQdgIfTI+sdcwkiK2KU+2cbEYA0agzM2uqaUy2UpnnGHtWTHVEtS0ES4zHU0eMFRGN+oQgDxlD66A==", - "requires": { - "vscode-jsonrpc": "6.0.0", - "vscode-languageserver-types": "3.16.0" - }, - "dependencies": { - "vscode-jsonrpc": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-6.0.0.tgz", - "integrity": "sha512-wnJA4BnEjOSyFMvjZdpiOwhSq9uDoK8e/kpRJDTaMYzwlkrhG1fwDIZI94CLsLzlCK5cIbMMtFlJlfR57Lavmg==" - } - } - }, - "vscode-languageserver-types": { - "version": "3.16.0", - "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.16.0.tgz", - "integrity": "sha512-k8luDIWJWyenLc5ToFQQMaSrqCHiLwyKPHKPQZ5zz21vM+vIVUSvsRpcbiECH4WR88K2XZqc4ScRcZ7nk/jbeA==" - } - } -} diff --git a/server/package.json b/server/package.json deleted file mode 100644 index 5abd507..0000000 --- a/server/package.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name": "rescript-language-server", - "description": "ReScript's language-server", - "version": "1.1.3", - "author": "chenglou", - "license": "MIT", - "engines": { - "node": "*" - }, - "repository": { - "type": "git", - "url": "https://github.com/rescript-lang/rescript-vscode" - }, - "dependencies": { - "chokidar": "^3.5.1", - "vscode-jsonrpc": "^5.0.1", - "vscode-languageserver": "^7.0.0", - "vscode-languageserver-protocol": "^3.16.0" - }, - "scripts": {} -} diff --git a/test/fixtures/compiler/compiler-log.exp b/test/fixtures/compiler/compiler-log.exp deleted file mode 100644 index 771f065..0000000 --- a/test/fixtures/compiler/compiler-log.exp +++ /dev/null @@ -1,5 +0,0 @@ -/Users/rescript/Projects/vim-rescript/src/foo.res:12:6 -> [E] (Syntax) Did you forget a `=` here? -/Users/rescript/Projects/vim-rescript/src/Text.res:47:11 -> [W] (Warning 20) deprecated: Pervasives.string_of_float Please use something else, otherwise we can't do much about it -/Users/rescript/Projects/vim-rescript/src/Button.res:50:58 -> [E] This has type: list Somewhere wanted: string => int -/Users/rescript/Projects/vim-rescript/src/Json.res:20:11 -> [W] (Warning 3) deprecated: Pervasives.string_of_float Please use Js.Float.toString instead, string_of_float generates unparseable floats -/Users/rescript/Projects/vim-rescript/src/Decode.res:182:58 -> [E] This has type: list Somewhere wanted: 'a => 'b diff --git a/test/fixtures/compiler/compiler-log.txt b/test/fixtures/compiler/compiler-log.txt deleted file mode 100644 index 6f57613..0000000 --- a/test/fixtures/compiler/compiler-log.txt +++ /dev/null @@ -1,67 +0,0 @@ -#Start(1402242571131) - - Syntax error! - /Users/rescript/Projects/vim-rescript/src/foo.res:12:6 - - 10 │ let f = "test" - 11 │ - 12 │ let z; - 13 │ - - Did you forget a `=` here? - - - Warning number 20 - /Users/rescript/Projects/vim-rescript/src/Text.res:47:11-25 - - 45 │ - 46 │ let string_of_number = f => { - 47 │ let s = string_of_float(f) - 48 │ if String.get(s, String.length(s) - 1) == '.' { - 49 │ String.sub(s, 0, String.length(s) - 1) - - deprecated: Pervasives.string_of_float -Please use something else, otherwise we can't do much about it - - We've found a bug for you! - /Users/rescript/Projects/vim-rescript/src/Button.res:50:58-62 - - 180 ┆ | String(value) => "\"" ++ (escape(value) ++ "\"") - 181 ┆ | Number(num) => string_of_number(num) - 182 ┆ | Array(items) => "[" ++ (String.concat(", ", List.map(items, strin - gify)) ++ "]") - 183 ┆ | Object(items) => - 184 ┆ "{" ++ - - This has type: list - Somewhere wanted: string => int - -#Done(1402242571246) -#Start(1602242571131) - - Warning number 3 - /Users/rescript/Projects/vim-rescript/src/Json.res:20:11-25 - - 45 │ - 46 │ let string_of_number = f => { - 47 │ let s = string_of_float(f) - 48 │ if String.get(s, String.length(s) - 1) == '.' { - 49 │ String.sub(s, 0, String.length(s) - 1) - - deprecated: Pervasives.string_of_float -Please use Js.Float.toString instead, string_of_float generates unparseable floats - - We've found a bug for you! - /Users/rescript/Projects/vim-rescript/src/Decode.res:182:58-62 - - 180 ┆ | String(value) => "\"" ++ (escape(value) ++ "\"") - 181 ┆ | Number(num) => string_of_number(num) - 182 ┆ | Array(items) => "[" ++ (String.concat(", ", List.map(items, strin - gify)) ++ "]") - 183 ┆ | Object(items) => - 184 ┆ "{" ++ - - This has type: list - Somewhere wanted: 'a => 'b - -#Done(1602242571246) diff --git a/test/fixtures/let-binding.exp b/test/fixtures/let-binding.exp deleted file mode 100644 index d676886..0000000 --- a/test/fixtures/let-binding.exp +++ /dev/null @@ -1,8 +0,0 @@ -test/fixtures/let-binding.res:4:18 -> [E] (Syntax) Did you forget a `=` here? -test/fixtures/let-binding.res:10:12 -> [E] (Syntax) Did you forget a `=` here? -test/fixtures/let-binding.res:16:19 -> [E] (Syntax) Did you forget a `=` here? -test/fixtures/let-binding.res:20:39 -> [E] (Syntax) This let-binding misses an expression -test/fixtures/let-binding.res:22:10 -> [E] (Syntax) This let-binding misses an expression -test/fixtures/let-binding.res:25:11 -> [E] (Syntax) Did you forget a `=` here? -test/fixtures/let-binding.res:28:6 -> [E] (Syntax) Did you forget a `=` here? -test/fixtures/let-binding.res:31:13 -> [E] (Syntax) Did you forget a `=` here? diff --git a/test/fixtures/let-binding.res b/test/fixtures/let-binding.res deleted file mode 100644 index 345b35d..0000000 --- a/test/fixtures/let-binding.res +++ /dev/null @@ -1,31 +0,0 @@ -// See: https://github.com/rescript-lang/syntax/blob/master/tests/parsing/errors/structure/letBinding.js - -// missing = -let rightResource ur.resources.find( - r => r.account_id === connection.left.account.id -) - -let x = { - // missing = - let field p->parseFieldDeclaration - field -} - -let t = { - // missing = - let (_, _, token) scanner->scan - token -} - -let keyTable: Belt.Map.String.t = - -let foo = - -// no magic in the syntax -let x: int :> string = y - -// no magic in the syntax -let x :> string = y - -// no magic in the syntax -let x : int1 :> int2 = 3 :> int3 diff --git a/test/fixtures/should-format.res b/test/fixtures/should-format.res deleted file mode 100644 index e3d6426..0000000 --- a/test/fixtures/should-format.res +++ /dev/null @@ -1,12 +0,0 @@ -let a = () - - -=> - - - { - - 3 - } - - diff --git a/test/fixtures/spread.exp b/test/fixtures/spread.exp deleted file mode 100644 index 6816fe2..0000000 --- a/test/fixtures/spread.exp +++ /dev/null @@ -1,5 +0,0 @@ -test/fixtures/spread.res:3:12 -> [E] (Syntax) Arrays can't use the `...` spread currently. Please use `concat` or other Array helpers. -test/fixtures/spread.res:4:6 -> [E] (Syntax) Array's `...` spread is not supported in pattern matches. Explanation: such spread would create a subarray; out of performance concern, our pattern matching currently guarantees to never create new intermediate data. Solution: if it's to validate the first few elements, use a `when` clause + Array size check + `get` checks on the current pattern. If it's to obtain a subarray, use `Array.sub` or `Belt.Array.slice`. -test/fixtures/spread.res:6:21 -> [E] (Syntax) Records can only have one `...` spread, at the beginning. Explanation: since records have a known, fixed shape, a spread like `{a, ...b}` wouldn't make sense, as `b` would override every field of `a` anyway. -test/fixtures/spread.res:7:15 -> [E] (Syntax) Record's `...` spread is not supported in pattern matches. Explanation: you can't collect a subset of a record's field into its own record, since a record needs an explicit declaration and that subset wouldn't have one. Solution: you need to pull out each field you want explicitly. -test/fixtures/spread.res:10:13 -> [E] (Syntax) List pattern matches only supports one `...` spread, at the end. Explanation: a list spread at the tail is efficient, but a spread in the middle would create new list[s]; out of performance concern, our pattern matching currently guarantees to never create new intermediate data. diff --git a/test/fixtures/spread.res b/test/fixtures/spread.res deleted file mode 100644 index f17909c..0000000 --- a/test/fixtures/spread.res +++ /dev/null @@ -1,10 +0,0 @@ -// See: https://github.com/rescript-lang/syntax/blob/master/tests/parsing/errors/other/spread.js - -let arr = [...x, ...y] -let [...arr, _] = [1, 2, 3] - -let record = {...x, ...y} -let {...x, ...y} = myRecord - -let myList = list{...x, ...y} -let list{...x, ...y} = myList diff --git a/test/fixtures/weird-numbers.exp b/test/fixtures/weird-numbers.exp deleted file mode 100644 index b9ec7eb..0000000 --- a/test/fixtures/weird-numbers.exp +++ /dev/null @@ -1 +0,0 @@ -test/fixtures/weird-numbers.res:10:4 -> [E] (Syntax) Did you forget a `)` here? diff --git a/test/fixtures/weird-numbers.res b/test/fixtures/weird-numbers.res deleted file mode 100644 index 4d60e67..0000000 --- a/test/fixtures/weird-numbers.res +++ /dev/null @@ -1,12 +0,0 @@ -let a = ( - - -=> - - - { - - 3 - } - - diff --git a/test/test_all.vim b/test/test_all.vim deleted file mode 100644 index bc841e5..0000000 --- a/test/test_all.vim +++ /dev/null @@ -1,144 +0,0 @@ -" Original testing idea from: -" https://github.com/lervag/vimtex/blob/master/test/tests/test-paths/test.vim - -set nocompatible -let &rtp = '.,' . &rtp - -filetype plugin on - -nnoremap q :qall! - -" ---------- UTIL ------------------ -" For formatting a list of qf errors to human readable strings -function! s:FormatErrorsToStrings(errors) - let l:ret = [] - for l:err in a:errors - let str = l:err.filename . ":" . l:err.lnum . ":" . l:err.col . " -> [" . l:err.type . "] " . l:err.text - let l:ret = add(l:ret, str) - endfor - - return l:ret -endfunction - -if empty($INMAKE) | finish | endif - -" ---------- TEST MAIN ------------------ -" triggers the ftplugin loading -setfiletype rescript - -function! InitTest() - " This test fails if the initialization doesn't set the right - " binary paths correctly (depending on the platform) - - if has('macunix') - let l:platform = "darwin" - elseif has('win32') - let l:platform = "win32" - elseif has('unix') - let l:platform = "linux" - endif - - call assert_equal(getcwd() . "/node_modules/bs-platform/" . l:platform . "/bsc.exe", g:rescript_bsc_exe) - call assert_equal(getcwd() . "/node_modules/bs-platform/" . l:platform . "/bsb.exe", g:rescript_bsb_exe) -endfunction - -function FormatErrorTest(fixtureName,...) - " This test fails if given fixture .res file doesn't cause the same error as - " defined in its .exp file - " - " fixtureName: name of the file in test/fixtures; e.g. 'let-binding' or 'spread' - " writeFixture: bool. If 1, write a new fixture file - let writeFixture= get(a:, 1, 0) - - let l:resFile = "test/fixtures/" . a:fixtureName . ".res" - let l:expFile = "test/fixtures/" . a:fixtureName . ".exp" - - silent execute 'edit' l:resFile - - let ret = rescript#Format() - let actual = s:FormatErrorsToStrings(ret.errors) - let exp = readfile(l:expFile) - - if writeFixture == 1 - echo "WRITING NEW FIXTURE FILE: " . l:expFile - let out = s:FormatErrorsToStrings(ret.errors) - call writefile(out, l:expFile) - endif - - call assert_equal(exp, actual, l:resFile . " and " . l:expFile . " do not match") - - execute 'bd!' l:resFile -endfunction - -function! FormatSuccessTest(fixtureName) - " This test is successful if given fixture .res file formats successfully - " fixtureName: name of the file in test/fixtures; e.g. 'let-binding' or 'spread' - - let l:resFile = "test/fixtures/" . a:fixtureName . ".res" - - silent execute 'edit' l:resFile - - let ret = rescript#Format() - - call assert_equal(0, ret.has_error, l:resFile . " should format correctly (but found " . len(ret.errors) . " errors)") - - execute 'bd!' l:resFile -endfunction - -function! CompilerErrorParserTest(fixtureName,...) - " This test should successfully parse compiler generated warning and error - " messages - " fixtureName: name of the file in test/fixtures/compiler; e.g. 'compiler-log' - " writeFixture: bool. If 1, write a new fixture file - let writeFixture= get(a:, 1, 0) - - let l:inputFile = "test/fixtures/compiler/" . a:fixtureName . ".txt" - let l:expFile = "test/fixtures/compiler/" . a:fixtureName . ".exp" - - let l:output = readfile(inputFile) - let logEntries = rescript#parsing#ParseCompilerLogEntries(l:output) - - let allErrors = [] - - for item in logEntries - let ret = rescript#parsing#ParseCompilerErrorOutput(item) - let allErrors = allErrors + ret - endfor - - if writeFixture == 1 - echo "WRITING NEW FIXTURE FILE: " . l:expFile - let out = s:FormatErrorsToStrings(allErrors) - call writefile(out, l:expFile) - endif - - let exp = readfile(l:expFile) - let actual = s:FormatErrorsToStrings(allErrors) - - call assert_equal(exp, actual, l:inputFile . " and " . l:expFile . " do not match") -endfunction - -" Init tests -call InitTest() - -" Formatting tests -call FormatSuccessTest("should-format") -call FormatErrorTest("let-binding") -call FormatErrorTest("spread") -call FormatErrorTest("weird-numbers") - -" Compiler error parsing tests -call CompilerErrorParserTest("compiler-log") - -if len(v:errors) > 0 - echo printf(len(v:errors) . " tests failed\n") - echo "--------ERROR RESULTS------------" - for err in v:errors - echo err - echo "****" - endfor - cq -else - echo "--------TESTS SUCCESSFUL------------" -endif - -qa!