Fix extensions
This commit is contained in:
@@ -1 +1 @@
|
|||||||
[{"identifier":{"id":"piousdeer.adwaita-theme","uuid":"93fbc635-4a9a-4ff1-88ba-bf017484c602"},"version":"1.1.0","location":{"$mid":1,"path":"/home/trude/.vscode-oss/extensions/piousdeer.adwaita-theme-1.1.0-universal","scheme":"file"},"relativeLocation":"piousdeer.adwaita-theme-1.1.0-universal","metadata":{"id":"93fbc635-4a9a-4ff1-88ba-bf017484c602","publisherId":"93befe42-7314-4d14-8724-19419a27ed64","publisherDisplayName":"piousdeer","targetPlatform":"universal","updated":false,"isPreReleaseVersion":false,"hasPreReleaseVersion":false,"installedTimestamp":1713908192752,"pinned":false,"source":"gallery"}},{"identifier":{"id":"oderwat.indent-rainbow","uuid":"eaa2127d-cb69-4ab9-8505-a60c9ee5f28b"},"version":"8.3.1","location":{"$mid":1,"fsPath":"/home/trude/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal","external":"file:///home/trude/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal","path":"/home/trude/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal","scheme":"file"},"relativeLocation":"oderwat.indent-rainbow-8.3.1-universal","metadata":{"id":"eaa2127d-cb69-4ab9-8505-a60c9ee5f28b","publisherId":"ac064ae0-224d-4351-9aa4-45ef7bf3ed21","publisherDisplayName":"oderwat","targetPlatform":"universal","updated":false,"isPreReleaseVersion":false,"hasPreReleaseVersion":false,"installedTimestamp":1714048339842,"pinned":false,"source":"gallery"}}]
|
[{"identifier":{"id":"piousdeer.adwaita-theme","uuid":"93fbc635-4a9a-4ff1-88ba-bf017484c602"},"version":"1.1.0","location":{"$mid":1,"path":"/home/trude/.vscode-oss/extensions/piousdeer.adwaita-theme-1.1.0-universal","scheme":"file"},"relativeLocation":"piousdeer.adwaita-theme-1.1.0-universal","metadata":{"id":"93fbc635-4a9a-4ff1-88ba-bf017484c602","publisherId":"93befe42-7314-4d14-8724-19419a27ed64","publisherDisplayName":"piousdeer","targetPlatform":"universal","updated":false,"isPreReleaseVersion":false,"hasPreReleaseVersion":false,"installedTimestamp":1714048423200,"pinned":false,"source":"gallery"}},{"identifier":{"id":"oderwat.indent-rainbow","uuid":"eaa2127d-cb69-4ab9-8505-a60c9ee5f28b"},"version":"8.3.1","location":{"$mid":1,"fsPath":"/home/trude/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal","external":"file:///home/trude/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal","path":"/home/trude/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal","scheme":"file"},"relativeLocation":"oderwat.indent-rainbow-8.3.1-universal","metadata":{"id":"eaa2127d-cb69-4ab9-8505-a60c9ee5f28b","publisherId":"ac064ae0-224d-4351-9aa4-45ef7bf3ed21","publisherDisplayName":"oderwat","targetPlatform":"universal","updated":false,"isPreReleaseVersion":false,"hasPreReleaseVersion":false,"installedTimestamp":1714048433635,"pinned":false,"source":"gallery"}}]
|
||||||
12
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/.github/FUNDING.yml
vendored
Normal file
12
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/.github/FUNDING.yml
vendored
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
# These are supported funding model platforms
|
||||||
|
|
||||||
|
github: oderwat
|
||||||
|
patreon: #
|
||||||
|
open_collective: # Replace with a single Open Collective username
|
||||||
|
ko_fi: # Replace with a single Ko-fi username
|
||||||
|
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
|
||||||
|
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
||||||
|
liberapay: # Replace with a single Liberapay username
|
||||||
|
issuehunt: # Replace with a single IssueHunt username
|
||||||
|
otechie: # Replace with a single Otechie username
|
||||||
|
custom: # Replace with a single custom sponsorship URL
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011">
|
||||||
|
<Metadata>
|
||||||
|
<Identity Language="en-US" Id="indent-rainbow" Version="8.3.1" Publisher="oderwat" />
|
||||||
|
<DisplayName>indent-rainbow</DisplayName>
|
||||||
|
<Description xml:space="preserve">Makes indentation easier to read</Description>
|
||||||
|
<Tags>__web_extension</Tags>
|
||||||
|
<Categories>Other</Categories>
|
||||||
|
<GalleryFlags>Public</GalleryFlags>
|
||||||
|
|
||||||
|
<Properties>
|
||||||
|
<Property Id="Microsoft.VisualStudio.Code.Engine" Value="^1.52.0" />
|
||||||
|
<Property Id="Microsoft.VisualStudio.Code.ExtensionDependencies" Value="" />
|
||||||
|
<Property Id="Microsoft.VisualStudio.Code.ExtensionPack" Value="" />
|
||||||
|
<Property Id="Microsoft.VisualStudio.Code.ExtensionKind" Value="workspace,web" />
|
||||||
|
<Property Id="Microsoft.VisualStudio.Code.LocalizedLanguages" Value="" />
|
||||||
|
|
||||||
|
<Property Id="Microsoft.VisualStudio.Services.Links.Source" Value="https://github.com/oderwat/vscode-indent-rainbow.git" />
|
||||||
|
<Property Id="Microsoft.VisualStudio.Services.Links.Getstarted" Value="https://github.com/oderwat/vscode-indent-rainbow.git" />
|
||||||
|
<Property Id="Microsoft.VisualStudio.Services.Links.GitHub" Value="https://github.com/oderwat/vscode-indent-rainbow.git" />
|
||||||
|
<Property Id="Microsoft.VisualStudio.Services.Links.Support" Value="https://github.com/oderwat/vscode-indent-rainbow/issues" />
|
||||||
|
<Property Id="Microsoft.VisualStudio.Services.Links.Learn" Value="https://github.com/oderwat/vscode-indent-rainbow#readme" />
|
||||||
|
|
||||||
|
|
||||||
|
<Property Id="Microsoft.VisualStudio.Services.GitHubFlavoredMarkdown" Value="true" />
|
||||||
|
|
||||||
|
|
||||||
|
</Properties>
|
||||||
|
<License>extension/LICENSE.txt</License>
|
||||||
|
<Icon>extension/assets/icon.png</Icon>
|
||||||
|
</Metadata>
|
||||||
|
<Installation>
|
||||||
|
<InstallationTarget Id="Microsoft.VisualStudio.Code"/>
|
||||||
|
</Installation>
|
||||||
|
<Dependencies/>
|
||||||
|
<Assets>
|
||||||
|
<Asset Type="Microsoft.VisualStudio.Code.Manifest" Path="extension/package.json" Addressable="true" />
|
||||||
|
<Asset Type="Microsoft.VisualStudio.Services.Content.Details" Path="extension/README.md" Addressable="true" />
|
||||||
|
<Asset Type="Microsoft.VisualStudio.Services.Content.License" Path="extension/LICENSE.txt" Addressable="true" />
|
||||||
|
<Asset Type="Microsoft.VisualStudio.Services.Icons.Default" Path="extension/assets/icon.png" Addressable="true" />
|
||||||
|
</Assets>
|
||||||
|
</PackageManifest>
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2016 Hans Raaf
|
||||||
|
|
||||||
|
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.
|
||||||
@@ -0,0 +1,114 @@
|
|||||||
|
# Indent-Rainbow
|
||||||
|
|
||||||
|
## A simple extension to make indentation more readable
|
||||||
|
|
||||||
|
If you use this plugin a lot, please consider a donation:
|
||||||
|
|
||||||
|
<a href="https://www.buymeacoffee.com/oderwat" target="_blank"><img src="https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png" alt="Buy Me A Coffee" style="height: auto !important;width: auto !important;" ></a>
|
||||||
|
|
||||||
|
[](https://paypal.me/oderwat)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
This extension colorizes the indentation in front of your text, alternating four different colors on each step. Some may find it helpful in writing code for Python, Nim, Yaml, and probably even filetypes that are not indentation dependent.
|
||||||
|
|
||||||
|
Note: This will also work with vscode-web (github.dev) since version 8.0.0.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
Get it here: [Visual Studio Code Marketplace](https://marketplace.visualstudio.com/items?itemName=oderwat.indent-rainbow)
|
||||||
|
|
||||||
|
It uses the current editor window tab size and can handle mixed tab + spaces (not recommended). In addition, it visibly marks lines where the indentation is not a multiple of the tab size. The visualization can help to find problems with the indentation in some situations.
|
||||||
|
|
||||||
|
### Configuration
|
||||||
|
|
||||||
|
Although you can use it as it is, there is the possibility to configure some aspects of the extension:
|
||||||
|
|
||||||
|
```js
|
||||||
|
// For which languages indent-rainbow should be activated (if empty it means all).
|
||||||
|
"indentRainbow.includedLanguages": [] // for example ["nim", "nims", "python"]
|
||||||
|
|
||||||
|
// For which languages indent-rainbow should be deactivated (if empty it means none).
|
||||||
|
"indentRainbow.excludedLanguages": ["plaintext"]
|
||||||
|
|
||||||
|
// The delay in ms until the editor gets updated.
|
||||||
|
"indentRainbow.updateDelay": 100 // 10 makes it super fast but may cost more resources
|
||||||
|
```
|
||||||
|
|
||||||
|
*Notice: Defining both `includedLanguages` and `excludedLanguages` does not make much sense. Use one of both!*
|
||||||
|
|
||||||
|
You can configure your own colors by adding and tampering with the following code:
|
||||||
|
|
||||||
|
```js
|
||||||
|
// Defining custom colors instead of default "Rainbow" for dark backgrounds.
|
||||||
|
"indentRainbow.colors": [
|
||||||
|
"rgba(255,255,64,0.07)",
|
||||||
|
"rgba(127,255,127,0.07)",
|
||||||
|
"rgba(255,127,255,0.07)",
|
||||||
|
"rgba(79,236,236,0.07)"
|
||||||
|
]
|
||||||
|
|
||||||
|
// The indent color if the number of spaces is not a multiple of "tabSize".
|
||||||
|
"indentRainbow.errorColor": "rgba(128,32,32,0.6)"
|
||||||
|
|
||||||
|
// The indent color when there is a mix between spaces and tabs.
|
||||||
|
// To be disabled this coloring set this to an empty string.
|
||||||
|
"indentRainbow.tabmixColor": "rgba(128,32,96,0.6)"
|
||||||
|
```
|
||||||
|
|
||||||
|
> Notice: `errorColor` was renamed from `error_color` in earlier versions.
|
||||||
|
|
||||||
|
### Light mode (new since v8.3.0)
|
||||||
|
|
||||||
|
There is a (new) alternate mode that uses lines (with a customizable width) instead of the background coloring of the whitespace. Here is an example configuration I like:
|
||||||
|
|
||||||
|
```js
|
||||||
|
// Using the light mode
|
||||||
|
"indentRainbow.indicatorStyle": "light",
|
||||||
|
// we use a simple 1 pixel wide line
|
||||||
|
"indentRainbow.lightIndicatorStyleLineWidth": 1,
|
||||||
|
// the same colors as above but more visible
|
||||||
|
"indentRainbow.colors": [
|
||||||
|
"rgba(255,255,64,0.3)",
|
||||||
|
"rgba(127,255,127,0.3)",
|
||||||
|
"rgba(255,127,255,0.3)",
|
||||||
|
"rgba(79,236,236,0.3)"
|
||||||
|
```
|
||||||
|
|
||||||
|
> For this addition, a big thank you goes to Christian Hoock [wk1](https://github.com/wk1). He also added the editor window reload on config changes.
|
||||||
|
|
||||||
|
### Hiding error highlighting
|
||||||
|
|
||||||
|
Skip error highlighting for RegEx patterns. For example, you may want to turn off the indent errors for JSDoc's valid additional space (disabled by default), or comment lines beginning with `//`
|
||||||
|
|
||||||
|
```js
|
||||||
|
// Example of regular expression in JSON (note double backslash to escape characters)
|
||||||
|
"indentRainbow.ignoreLinePatterns" : [
|
||||||
|
"/[ \t]* [*]/g", // lines begining with <whitespace><space>*
|
||||||
|
"/[ \t]+[/]{2}/g" // lines begininning with <whitespace>//
|
||||||
|
]
|
||||||
|
```
|
||||||
|
|
||||||
|
Skip error highlighting for some or all languages. For example, you may want to turn off the indent errors for `markdown` and `haskell` (which is the default)
|
||||||
|
|
||||||
|
```js
|
||||||
|
"indentRainbow.ignoreErrorLanguages" : [
|
||||||
|
"markdown",
|
||||||
|
"haskell"
|
||||||
|
]
|
||||||
|
```
|
||||||
|
|
||||||
|
If error color is disabled, indent colors will be rendered until the length of rendered characters (white spaces, tabs, and other ones) is divisible by tabsize. Turn on this option to render white spaces and tabs only.
|
||||||
|
|
||||||
|
```js
|
||||||
|
"indentRainbow.colorOnWhiteSpaceOnly": true // false is the default
|
||||||
|
```
|
||||||
|
|
||||||
|
Build with:
|
||||||
|
|
||||||
|
```
|
||||||
|
npm install
|
||||||
|
npm run vscode:prepublish
|
||||||
|
```
|
||||||
|
|
||||||
|
Running `npm run compile` makes the compiler recompile on file change.
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 122 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 11 KiB |
@@ -0,0 +1,59 @@
|
|||||||
|
/*---------------------------------------------------------------------------------------------
|
||||||
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||||
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
//@ts-check
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
//@ts-check
|
||||||
|
/** @typedef {import('webpack').Configuration} WebpackConfig **/
|
||||||
|
|
||||||
|
const path = require('path');
|
||||||
|
const webpack = require('webpack');
|
||||||
|
|
||||||
|
module.exports = /** @type WebpackConfig */ {
|
||||||
|
context: path.dirname(__dirname),
|
||||||
|
mode: 'none', // this leaves the source code as close as possible to the original (when packaging we set this to 'production')
|
||||||
|
target: 'webworker', // extensions run in a webworker context
|
||||||
|
entry: {
|
||||||
|
'extension': './src/extension.ts'
|
||||||
|
},
|
||||||
|
resolve: {
|
||||||
|
mainFields: ['module', 'main'],
|
||||||
|
extensions: ['.ts', '.js'], // support ts-files and js-files
|
||||||
|
alias: {
|
||||||
|
},
|
||||||
|
fallback: {
|
||||||
|
'assert': require.resolve('assert')
|
||||||
|
}
|
||||||
|
},
|
||||||
|
module: {
|
||||||
|
rules: [{
|
||||||
|
test: /\.ts$/,
|
||||||
|
exclude: /node_modules/,
|
||||||
|
use: [
|
||||||
|
{
|
||||||
|
loader: 'ts-loader'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
plugins: [
|
||||||
|
new webpack.ProvidePlugin({
|
||||||
|
process: 'process/browser',
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
externals: {
|
||||||
|
'vscode': 'commonjs vscode', // ignored because it doesn't exist
|
||||||
|
},
|
||||||
|
performance: {
|
||||||
|
hints: false
|
||||||
|
},
|
||||||
|
output: {
|
||||||
|
filename: '[name].js',
|
||||||
|
path: path.join(__dirname, '../dist/web'),
|
||||||
|
libraryTarget: 'commonjs'
|
||||||
|
},
|
||||||
|
devtool: 'nosources-source-map'
|
||||||
|
};
|
||||||
1
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/dist/web/extension.js
vendored
Normal file
1
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/dist/web/extension.js
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
(()=>{"use strict";var e={496:e=>{e.exports=require("vscode")}},o={};function n(t){var i=o[t];if(void 0!==i)return i.exports;var r=o[t]={exports:{}};return e[t](r,r.exports,n),r.exports}var t={};(()=>{var e=t;Object.defineProperty(e,"__esModule",{value:!0}),e.activate=void 0;const o=n(496);e.activate=function(e){let n=[],t=!1,i=!1,r=null,a=!1,c=o.window.activeTextEditor;const d=o.workspace.getConfiguration("indentRainbow").errorColor||"rgba(128,32,32,0.3)",s=o.window.createTextEditorDecorationType({backgroundColor:d}),u=o.workspace.getConfiguration("indentRainbow").tabmixColor||"",g=""!==u?o.window.createTextEditorDecorationType({backgroundColor:u}):null,l=o.workspace.getConfiguration("indentRainbow").ignoreLinePatterns||[],w=o.workspace.getConfiguration("indentRainbow").colorOnWhiteSpaceOnly||!1,f=o.workspace.getConfiguration("indentRainbow").indicatorStyle||"classic",p=o.workspace.getConfiguration("indentRainbow").lightIndicatorStyleLineWidth||1;function h(){var e=o.workspace.getConfiguration("indentRainbow").ignoreErrorLanguages||[];a=!1,0!==e.length&&(-1===e.indexOf("*")&&-1===e.indexOf(r)||(a=!0))}function x(){if(c&&r!==c.document.languageId){var e=o.workspace.getConfiguration("indentRainbow").includedLanguages||[],a=o.workspace.getConfiguration("indentRainbow").excludedLanguages||[];r=c.document.languageId,t=!0,0!==e.length&&-1===e.indexOf(r)&&(t=!1),t&&0!==a.length&&-1!==a.indexOf(r)&&(t=!1)}if(i&&!t){var d=[];for(let e of n)c.setDecorations(e,d);i=!1}return h(),t}(o.workspace.getConfiguration("indentRainbow").colors||["rgba(255,255,64,0.07)","rgba(127,255,127,0.07)","rgba(255,127,255,0.07)","rgba(79,236,236,0.07)"]).forEach(((e,t)=>{"classic"===f?n[t]=o.window.createTextEditorDecorationType({backgroundColor:e}):"light"===f&&(n[t]=o.window.createTextEditorDecorationType({borderStyle:"solid",borderColor:e,borderWidth:`0 0 0 ${p}px`}))})),l.forEach(((e,o)=>{if("string"==typeof e){var n=e.match(/^\/(.*?)\/([gim]*)$/);l[o]=n?new RegExp(n[1],n[2]):new RegExp(e)}})),c&&h(),c&&x()&&v(),o.window.onDidChangeActiveTextEditor((e=>{c=e,e&&h(),e&&x()&&v()}),null,e.subscriptions),o.workspace.onDidChangeTextDocument((e=>{c&&h(),c&&e.document===c.document&&x()&&v()}),null,e.subscriptions);var b=null;function v(){b&&clearTimeout(b);var e=o.workspace.getConfiguration("indentRainbow").updateDelay||100;b=setTimeout(m,e)}function m(){if(!c)return;var e=/^[\t ]+/gm,t=c.document.getText(),r=c.options.tabSize,d=4;"auto"!==r&&(d=+r);var u=" ".repeat(d);const f=[];let p=[],h=g?[]:null,x=[];var b,v;n.forEach((()=>{x.push([])})),a||l.forEach((e=>{for(;v=e.exec(t);){const e=c.document.positionAt(v.index),o=c.document.lineAt(e).lineNumber;f.push(o)}}));for(var m=new RegExp("\t","g");b=e.exec(t);){const e=c.document.positionAt(b.index),n=c.document.lineAt(e).lineNumber;let t=a||-1!==f.indexOf(n);var C=b[0],k=b[0].replace(m,u).length;if(t||k%d==0)for(var R=b[0],E=R.length,T=0,y=0;y<E;){O=c.document.positionAt(b.index+y),"\t"===R[y]?y++:y+=d,w&&y>E&&(y=E),L=c.document.positionAt(b.index+y),M={range:new o.Range(O,L),hoverMessage:null};var D=0,A=0;if(!t&&h&&(A=C.split("\t").length-1)&&(D=C.split(" ").length-1),D>0&&A>0)h.push(M);else{let e=T%x.length;x[e].push(M)}T++}else{var O=c.document.positionAt(b.index),L=c.document.positionAt(b.index+b[0].length),M={range:new o.Range(O,L),hoverMessage:null};p.push(M)}}n.forEach(((e,o)=>{c.setDecorations(e,x[o])})),c.setDecorations(s,p),g&&c.setDecorations(g,h),i=!0}o.workspace.onDidChangeConfiguration((e=>{if(e.affectsConfiguration("indentRainbow")){const e=["Reload now","Later"];o.window.showInformationMessage("The VSCode window needs to reload for the changes to take effect. Would you like to reload the window now?",...e).then((n=>{n===e[0]&&o.commands.executeCommand("workbench.action.reloadWindow")}))}}))}})();var i=exports;for(var r in t)i[r]=t[r];t.__esModule&&Object.defineProperty(i,"__esModule",{value:!0})})();
|
||||||
22
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/@koa/router/LICENSE
generated
vendored
Normal file
22
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/@koa/router/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2015 Alexander C. Mingoia
|
||||||
|
Copyright (c) 2019-present Nick Baugh and Koajs contributors
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
||||||
55
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/@koa/router/README.md
generated
vendored
Normal file
55
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/@koa/router/README.md
generated
vendored
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
# [@koa/router](https://github.com/koajs/router)
|
||||||
|
|
||||||
|
> Router middleware for [Koa](https://github.com/koajs/koa).
|
||||||
|
|
||||||
|
[](https://npmjs.org/package/@koa/router)
|
||||||
|
[](https://npmjs.org/package/@koa/router)
|
||||||
|
[](http://nodejs.org/download/)
|
||||||
|
[](http://travis-ci.org/koajs/router)
|
||||||
|
[](https://gitter.im/koajs/koa)
|
||||||
|
|
||||||
|
* Express-style routing (`app.get`, `app.put`, `app.post`, etc.)
|
||||||
|
* Named URL parameters
|
||||||
|
* Named routes with URL generation
|
||||||
|
* Responds to `OPTIONS` requests with allowed methods
|
||||||
|
* Support for `405 Method Not Allowed` and `501 Not Implemented`
|
||||||
|
* Multiple route middleware
|
||||||
|
* Multiple and nestable routers
|
||||||
|
* `async/await` support
|
||||||
|
|
||||||
|
## Migrating to 7 / Koa 2
|
||||||
|
|
||||||
|
- The API has changed to match the new promise-based middleware
|
||||||
|
signature of koa 2. See the [koa 2.x readme](https://github.com/koajs/koa/tree/2.0.0-alpha.3) for more
|
||||||
|
information.
|
||||||
|
- Middleware is now always run in the order declared by `.use()` (or `.get()`,
|
||||||
|
etc.), which matches Express 4 API.
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# npm ..
|
||||||
|
npm i @koa/router
|
||||||
|
# yarn ..
|
||||||
|
yarn add @koa/router
|
||||||
|
```
|
||||||
|
|
||||||
|
## [API Reference](./API.md)
|
||||||
|
|
||||||
|
## Contributing
|
||||||
|
|
||||||
|
Please submit all issues and pull requests to the [koajs/router](http://github.com/koajs/router) repository!
|
||||||
|
|
||||||
|
## Support
|
||||||
|
|
||||||
|
If you have any problem or suggestion please open an issue [here](https://github.com/koajs/router/issues).
|
||||||
|
|
||||||
|
## Call for Maintainers
|
||||||
|
|
||||||
|
This module is forked from the original [koa-router](https://github.com/ZijianHe/koa-router) due to its lack of activity. `koa-router` is the most widely used router module in the Koa community and we need maintainers. If you're interested in fixing bugs or implementing new features feel free to open a pull request. We'll be adding active contributors as collaborators.
|
||||||
|
|
||||||
|
Thanks to the original authors @alexmingoia and the original team for their great work.
|
||||||
|
|
||||||
|
### License
|
||||||
|
|
||||||
|
[MIT](LICENSE)
|
||||||
157
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/@koa/router/history.md
generated
vendored
Normal file
157
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/@koa/router/history.md
generated
vendored
Normal file
@@ -0,0 +1,157 @@
|
|||||||
|
9.0.0 / 2020-04-09
|
||||||
|
==================
|
||||||
|
|
||||||
|
- Update `path-to-regexp`. Migration path: change usage of `'*'` in routes to `(.*)` or `:splat*`.
|
||||||
|
- Example: `router.get('*', ....)` becomes `router.get('(.*)') ....)`
|
||||||
|
|
||||||
|
|
||||||
|
8.0.0 / 2019-06-16
|
||||||
|
==================
|
||||||
|
|
||||||
|
**others**
|
||||||
|
* [[`b5dd5e8`](http://github.com/koajs/koa-router/commit/b5dd5e8f00e841b7061a62ab6228cbe96a999470)] - chore: rename to @koa/router (dead-horse <<dead_horse@qq.com>>)
|
||||||
|
|
||||||
|
-------------
|
||||||
|
|
||||||
|
# Changelogs inherit from koa-router.
|
||||||
|
|
||||||
|
## 7.4.0
|
||||||
|
|
||||||
|
- Fix router.url() for multiple nested routers [#407](https://github.com/alexmingoia/koa-router/pull/407)
|
||||||
|
- `layer.name` added to `ctx` at `ctx.routerName` during routing [#412](https://github.com/alexmingoia/koa-router/pull/412)
|
||||||
|
- Router.use() was erroneously settings `(.*)` as a prefix to all routers nested with .use that did not pass an explicit prefix string as the first argument. This resulted in routes being matched that should not have been, included the running of multiple route handlers in error. [#369](https://github.com/alexmingoia/koa-router/issues/369) and [#410](https://github.com/alexmingoia/koa-router/issues/410) include information on this issue.
|
||||||
|
|
||||||
|
## 7.3.0
|
||||||
|
|
||||||
|
- Router#url() now accepts query parameters to add to generated urls [#396](https://github.com/alexmingoia/koa-router/pull/396)
|
||||||
|
|
||||||
|
## 7.2.1
|
||||||
|
|
||||||
|
- Respond to CORS preflights with 200, 0 length body [#359](https://github.com/alexmingoia/koa-router/issues/359)
|
||||||
|
|
||||||
|
## 7.2.0
|
||||||
|
|
||||||
|
- Fix a bug in Router#url and append Router object to ctx. [#350](https://github.com/alexmingoia/koa-router/pull/350)
|
||||||
|
- Adds `_matchedRouteName` to context [#337](https://github.com/alexmingoia/koa-router/pull/337)
|
||||||
|
- Respond to CORS preflights with 200, 0 length body [#359](https://github.com/alexmingoia/koa-router/issues/359)
|
||||||
|
|
||||||
|
## 7.1.1
|
||||||
|
|
||||||
|
- Fix bug where param handlers were run out of order [#282](https://github.com/alexmingoia/koa-router/pull/282)
|
||||||
|
|
||||||
|
## 7.1.0
|
||||||
|
|
||||||
|
- Backports: merge 5.4 work into the 7.x upstream. See 5.4.0 updates for more details.
|
||||||
|
|
||||||
|
## 7.0.1
|
||||||
|
|
||||||
|
- Fix: allowedMethods should be ctx.method not this.method [#215](https://github.com/alexmingoia/koa-router/pull/215)
|
||||||
|
|
||||||
|
## 7.0.0
|
||||||
|
|
||||||
|
- The API has changed to match the new promise-based middleware
|
||||||
|
signature of koa 2. See the
|
||||||
|
[koa 2.x readme](https://github.com/koajs/koa/tree/2.0.0-alpha.3) for more
|
||||||
|
information.
|
||||||
|
- Middleware is now always run in the order declared by `.use()` (or `.get()`,
|
||||||
|
etc.), which matches Express 4 API.
|
||||||
|
|
||||||
|
## 5.4.0
|
||||||
|
|
||||||
|
- Expose matched route at `ctx._matchedRoute`.
|
||||||
|
|
||||||
|
## 5.3.0
|
||||||
|
|
||||||
|
- Register multiple routes with array of paths [#203](https://github.com/alexmingoia/koa-router/issue/143).
|
||||||
|
- Improved router.url() [#143](https://github.com/alexmingoia/koa-router/pull/143)
|
||||||
|
- Adds support for named routes and regular expressions
|
||||||
|
[#152](https://github.com/alexmingoia/koa-router/pull/152)
|
||||||
|
- Add support for custom throw functions for 405 and 501 responses [#206](https://github.com/alexmingoia/koa-router/pull/206)
|
||||||
|
|
||||||
|
## 5.2.3
|
||||||
|
|
||||||
|
- Fix for middleware running twice when nesting routes [#184](https://github.com/alexmingoia/koa-router/issues/184)
|
||||||
|
|
||||||
|
## 5.2.2
|
||||||
|
|
||||||
|
- Register routes without params before those with params [#183](https://github.com/alexmingoia/koa-router/pull/183)
|
||||||
|
- Fix for allowed methods [#182](https://github.com/alexmingoia/koa-router/issues/182)
|
||||||
|
|
||||||
|
## 5.2.0
|
||||||
|
|
||||||
|
- Add support for async/await. Resolves [#130](https://github.com/alexmingoia/koa-router/issues/130).
|
||||||
|
- Add support for array of paths by Router#use(). Resolves [#175](https://github.com/alexmingoia/koa-router/issues/175).
|
||||||
|
- Inherit param middleware when nesting routers. Fixes [#170](https://github.com/alexmingoia/koa-router/issues/170).
|
||||||
|
- Default router middleware without path to root. Fixes [#161](https://github.com/alexmingoia/koa-router/issues/161), [#155](https://github.com/alexmingoia/koa-router/issues/155), [#156](https://github.com/alexmingoia/koa-router/issues/156).
|
||||||
|
- Run nested router middleware after parent's. Fixes [#156](https://github.com/alexmingoia/koa-router/issues/156).
|
||||||
|
- Remove dependency on koa-compose.
|
||||||
|
|
||||||
|
## 5.1.1
|
||||||
|
|
||||||
|
- Match routes in order they were defined. Fixes #131.
|
||||||
|
|
||||||
|
## 5.1.0
|
||||||
|
|
||||||
|
- Support mounting router middleware at a given path.
|
||||||
|
|
||||||
|
## 5.0.1
|
||||||
|
|
||||||
|
- Fix bug with missing parameters when nesting routers.
|
||||||
|
|
||||||
|
## 5.0.0
|
||||||
|
|
||||||
|
- Remove confusing API for extending koa app with router methods. Router#use()
|
||||||
|
does not have the same behavior as app#use().
|
||||||
|
- Add support for nesting routes.
|
||||||
|
- Remove support for regular expression routes to achieve nestable routers and
|
||||||
|
enable future trie-based routing optimizations.
|
||||||
|
|
||||||
|
## 4.3.2
|
||||||
|
|
||||||
|
- Do not send 405 if route matched but status is 404. Fixes #112, closes #114.
|
||||||
|
|
||||||
|
## 4.3.1
|
||||||
|
|
||||||
|
- Do not run middleware if not yielded to by previous middleware. Fixes #115.
|
||||||
|
|
||||||
|
## 4.3.0
|
||||||
|
|
||||||
|
- Add support for router prefixes.
|
||||||
|
- Add MIT license.
|
||||||
|
|
||||||
|
## 4.2.0
|
||||||
|
|
||||||
|
- Fixed issue with router middleware being applied even if no route was
|
||||||
|
matched.
|
||||||
|
- Router.url - new static method to generate url from url pattern and data
|
||||||
|
|
||||||
|
## 4.1.0
|
||||||
|
|
||||||
|
Private API changed to separate context parameter decoration from route
|
||||||
|
matching. `Router#match` and `Route#match` are now pure functions that return
|
||||||
|
an array of routes that match the URL path.
|
||||||
|
|
||||||
|
For modules using this private API that need to determine if a method and path
|
||||||
|
match a route, `route.methods` must be checked against the routes returned from
|
||||||
|
`router.match()`:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var matchedRoute = router.match(path).filter(function (route) {
|
||||||
|
return ~route.methods.indexOf(method);
|
||||||
|
}).shift();
|
||||||
|
```
|
||||||
|
|
||||||
|
## 4.0.0
|
||||||
|
|
||||||
|
405, 501, and OPTIONS response handling was moved into separate middleware
|
||||||
|
`router.allowedMethods()`. This resolves incorrect 501 or 405 responses when
|
||||||
|
using multiple routers.
|
||||||
|
|
||||||
|
### Breaking changes
|
||||||
|
|
||||||
|
4.x is mostly backwards compatible with 3.x, except for the following:
|
||||||
|
|
||||||
|
- Instantiating a router with `new` and `app` returns the router instance,
|
||||||
|
whereas 3.x returns the router middleware. When creating a router in 4.x, the
|
||||||
|
only time router middleware is returned is when creating using the
|
||||||
|
`Router(app)` signature (with `app` and without `new`).
|
||||||
7
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/@koa/router/lib/API_tpl.hbs
generated
vendored
Normal file
7
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/@koa/router/lib/API_tpl.hbs
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
|
||||||
|
## API Reference
|
||||||
|
{{#module name="koa-router"~}}
|
||||||
|
{{>body~}}
|
||||||
|
{{>member-index~}}
|
||||||
|
{{>members~}}
|
||||||
|
{{/module~}}
|
||||||
238
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/@koa/router/lib/layer.js
generated
vendored
Normal file
238
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/@koa/router/lib/layer.js
generated
vendored
Normal file
@@ -0,0 +1,238 @@
|
|||||||
|
const { pathToRegexp, compile, parse } = require('path-to-regexp');
|
||||||
|
const { parse: parseUrl, format: formatUrl } = require('url');
|
||||||
|
|
||||||
|
module.exports = Layer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize a new routing Layer with given `method`, `path`, and `middleware`.
|
||||||
|
*
|
||||||
|
* @param {String|RegExp} path Path string or regular expression.
|
||||||
|
* @param {Array} methods Array of HTTP verbs.
|
||||||
|
* @param {Array} middleware Layer callback/middleware or series of.
|
||||||
|
* @param {Object=} opts
|
||||||
|
* @param {String=} opts.name route name
|
||||||
|
* @param {String=} opts.sensitive case sensitive (default: false)
|
||||||
|
* @param {String=} opts.strict require the trailing slash (default: false)
|
||||||
|
* @returns {Layer}
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
|
||||||
|
function Layer(path, methods, middleware, opts) {
|
||||||
|
this.opts = opts || {};
|
||||||
|
this.name = this.opts.name || null;
|
||||||
|
this.methods = [];
|
||||||
|
this.paramNames = [];
|
||||||
|
this.stack = Array.isArray(middleware) ? middleware : [middleware];
|
||||||
|
|
||||||
|
for (let i = 0; i < methods.length; i++) {
|
||||||
|
const l = this.methods.push(methods[i].toUpperCase());
|
||||||
|
if (this.methods[l - 1] === 'GET') this.methods.unshift('HEAD');
|
||||||
|
}
|
||||||
|
|
||||||
|
// ensure middleware is a function
|
||||||
|
for (let i = 0; i < this.stack.length; i++) {
|
||||||
|
const fn = this.stack[i];
|
||||||
|
const type = (typeof fn);
|
||||||
|
if (type !== 'function')
|
||||||
|
throw new Error(
|
||||||
|
`${methods.toString()} \`${this.opts.name || path}\`: \`middleware\` must be a function, not \`${type}\``
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.path = path;
|
||||||
|
this.regexp = pathToRegexp(path, this.paramNames, this.opts);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether request `path` matches route.
|
||||||
|
*
|
||||||
|
* @param {String} path
|
||||||
|
* @returns {Boolean}
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
|
||||||
|
Layer.prototype.match = function (path) {
|
||||||
|
return this.regexp.test(path);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns map of URL parameters for given `path` and `paramNames`.
|
||||||
|
*
|
||||||
|
* @param {String} path
|
||||||
|
* @param {Array.<String>} captures
|
||||||
|
* @param {Object=} existingParams
|
||||||
|
* @returns {Object}
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
|
||||||
|
Layer.prototype.params = function (path, captures, existingParams) {
|
||||||
|
const params = existingParams || {};
|
||||||
|
|
||||||
|
for (let len = captures.length, i = 0; i < len; i++) {
|
||||||
|
if (this.paramNames[i]) {
|
||||||
|
const c = captures[i];
|
||||||
|
if (c && c.length !== 0) params[this.paramNames[i].name] = c ? safeDecodeURIComponent(c) : c;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return params;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns array of regexp url path captures.
|
||||||
|
*
|
||||||
|
* @param {String} path
|
||||||
|
* @returns {Array.<String>}
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
|
||||||
|
Layer.prototype.captures = function (path) {
|
||||||
|
return this.opts.ignoreCaptures ? [] : path.match(this.regexp).slice(1);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate URL for route using given `params`.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* ```javascript
|
||||||
|
* const route = new Layer('/users/:id', ['GET'], fn);
|
||||||
|
*
|
||||||
|
* route.url({ id: 123 }); // => "/users/123"
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* @param {Object} params url parameters
|
||||||
|
* @returns {String}
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
|
||||||
|
Layer.prototype.url = function (params, options) {
|
||||||
|
let args = params;
|
||||||
|
const url = this.path.replace(/\(\.\*\)/g, '');
|
||||||
|
|
||||||
|
if (typeof params != 'object') {
|
||||||
|
args = Array.prototype.slice.call(arguments);
|
||||||
|
if (typeof args[args.length - 1] == 'object') {
|
||||||
|
options = args[args.length - 1];
|
||||||
|
args = args.slice(0, args.length - 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const toPath = compile(url, options);
|
||||||
|
let replaced;
|
||||||
|
|
||||||
|
const tokens = parse(url);
|
||||||
|
let replace = {};
|
||||||
|
|
||||||
|
if (args instanceof Array) {
|
||||||
|
for (let len = tokens.length, i = 0, j = 0; i < len; i++) {
|
||||||
|
if (tokens[i].name) replace[tokens[i].name] = args[j++];
|
||||||
|
}
|
||||||
|
} else if (tokens.some(token => token.name)) {
|
||||||
|
replace = params;
|
||||||
|
} else if (!options) {
|
||||||
|
options = params;
|
||||||
|
}
|
||||||
|
|
||||||
|
replaced = toPath(replace);
|
||||||
|
|
||||||
|
if (options && options.query) {
|
||||||
|
replaced = parseUrl(replaced);
|
||||||
|
if (typeof options.query === 'string') {
|
||||||
|
replaced.search = options.query;
|
||||||
|
} else {
|
||||||
|
replaced.search = undefined;
|
||||||
|
replaced.query = options.query;
|
||||||
|
}
|
||||||
|
return formatUrl(replaced);
|
||||||
|
}
|
||||||
|
|
||||||
|
return replaced;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Run validations on route named parameters.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* ```javascript
|
||||||
|
* router
|
||||||
|
* .param('user', function (id, ctx, next) {
|
||||||
|
* ctx.user = users[id];
|
||||||
|
* if (!user) return ctx.status = 404;
|
||||||
|
* next();
|
||||||
|
* })
|
||||||
|
* .get('/users/:user', function (ctx, next) {
|
||||||
|
* ctx.body = ctx.user;
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* @param {String} param
|
||||||
|
* @param {Function} middleware
|
||||||
|
* @returns {Layer}
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
|
||||||
|
Layer.prototype.param = function (param, fn) {
|
||||||
|
const stack = this.stack;
|
||||||
|
const params = this.paramNames;
|
||||||
|
const middleware = function (ctx, next) {
|
||||||
|
return fn.call(this, ctx.params[param], ctx, next);
|
||||||
|
};
|
||||||
|
middleware.param = param;
|
||||||
|
|
||||||
|
const names = params.map(function (p) {
|
||||||
|
return p.name;
|
||||||
|
});
|
||||||
|
|
||||||
|
const x = names.indexOf(param);
|
||||||
|
if (x > -1) {
|
||||||
|
// iterate through the stack, to figure out where to place the handler fn
|
||||||
|
stack.some(function (fn, i) {
|
||||||
|
// param handlers are always first, so when we find an fn w/o a param property, stop here
|
||||||
|
// if the param handler at this part of the stack comes after the one we are adding, stop here
|
||||||
|
if (!fn.param || names.indexOf(fn.param) > x) {
|
||||||
|
// inject this param handler right before the current item
|
||||||
|
stack.splice(i, 0, middleware);
|
||||||
|
return true; // then break the loop
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return this;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prefix route path.
|
||||||
|
*
|
||||||
|
* @param {String} prefix
|
||||||
|
* @returns {Layer}
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
|
||||||
|
Layer.prototype.setPrefix = function (prefix) {
|
||||||
|
if (this.path) {
|
||||||
|
this.path = (this.path !== '/' || this.opts.strict === true) ? `${prefix}${this.path}` : prefix
|
||||||
|
this.paramNames = [];
|
||||||
|
this.regexp = pathToRegexp(this.path, this.paramNames, this.opts);
|
||||||
|
}
|
||||||
|
|
||||||
|
return this;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Safe decodeURIComponent, won't throw any error.
|
||||||
|
* If `decodeURIComponent` error happen, just return the original value.
|
||||||
|
*
|
||||||
|
* @param {String} text
|
||||||
|
* @returns {String} URL decode original string.
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
|
||||||
|
function safeDecodeURIComponent(text) {
|
||||||
|
try {
|
||||||
|
return decodeURIComponent(text);
|
||||||
|
} catch (e) {
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
}
|
||||||
753
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/@koa/router/lib/router.js
generated
vendored
Normal file
753
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/@koa/router/lib/router.js
generated
vendored
Normal file
@@ -0,0 +1,753 @@
|
|||||||
|
/**
|
||||||
|
* RESTful resource routing middleware for koa.
|
||||||
|
*
|
||||||
|
* @author Alex Mingoia <talk@alexmingoia.com>
|
||||||
|
* @link https://github.com/alexmingoia/koa-router
|
||||||
|
*/
|
||||||
|
|
||||||
|
const debug = require('debug')('koa-router');
|
||||||
|
const compose = require('koa-compose');
|
||||||
|
const HttpError = require('http-errors');
|
||||||
|
const methods = require('methods');
|
||||||
|
const Layer = require('./layer');
|
||||||
|
const { pathToRegexp } = require('path-to-regexp');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @module koa-router
|
||||||
|
*/
|
||||||
|
|
||||||
|
module.exports = Router;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new router.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* Basic usage:
|
||||||
|
*
|
||||||
|
* ```javascript
|
||||||
|
* const Koa = require('koa');
|
||||||
|
* const Router = require('@koa/router');
|
||||||
|
*
|
||||||
|
* const app = new Koa();
|
||||||
|
* const router = new Router();
|
||||||
|
*
|
||||||
|
* router.get('/', (ctx, next) => {
|
||||||
|
* // ctx.router available
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* app
|
||||||
|
* .use(router.routes())
|
||||||
|
* .use(router.allowedMethods());
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* @alias module:koa-router
|
||||||
|
* @param {Object=} opts
|
||||||
|
* @param {String=} opts.prefix prefix router paths
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
|
||||||
|
function Router(opts) {
|
||||||
|
if (!(this instanceof Router)) return new Router(opts);
|
||||||
|
|
||||||
|
this.opts = opts || {};
|
||||||
|
this.methods = this.opts.methods || [
|
||||||
|
'HEAD',
|
||||||
|
'OPTIONS',
|
||||||
|
'GET',
|
||||||
|
'PUT',
|
||||||
|
'PATCH',
|
||||||
|
'POST',
|
||||||
|
'DELETE'
|
||||||
|
];
|
||||||
|
|
||||||
|
this.params = {};
|
||||||
|
this.stack = [];
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create `router.verb()` methods, where *verb* is one of the HTTP verbs such
|
||||||
|
* as `router.get()` or `router.post()`.
|
||||||
|
*
|
||||||
|
* Match URL patterns to callback functions or controller actions using `router.verb()`,
|
||||||
|
* where **verb** is one of the HTTP verbs such as `router.get()` or `router.post()`.
|
||||||
|
*
|
||||||
|
* Additionaly, `router.all()` can be used to match against all methods.
|
||||||
|
*
|
||||||
|
* ```javascript
|
||||||
|
* router
|
||||||
|
* .get('/', (ctx, next) => {
|
||||||
|
* ctx.body = 'Hello World!';
|
||||||
|
* })
|
||||||
|
* .post('/users', (ctx, next) => {
|
||||||
|
* // ...
|
||||||
|
* })
|
||||||
|
* .put('/users/:id', (ctx, next) => {
|
||||||
|
* // ...
|
||||||
|
* })
|
||||||
|
* .del('/users/:id', (ctx, next) => {
|
||||||
|
* // ...
|
||||||
|
* })
|
||||||
|
* .all('/users/:id', (ctx, next) => {
|
||||||
|
* // ...
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* When a route is matched, its path is available at `ctx._matchedRoute` and if named,
|
||||||
|
* the name is available at `ctx._matchedRouteName`
|
||||||
|
*
|
||||||
|
* Route paths will be translated to regular expressions using
|
||||||
|
* [path-to-regexp](https://github.com/pillarjs/path-to-regexp).
|
||||||
|
*
|
||||||
|
* Query strings will not be considered when matching requests.
|
||||||
|
*
|
||||||
|
* #### Named routes
|
||||||
|
*
|
||||||
|
* Routes can optionally have names. This allows generation of URLs and easy
|
||||||
|
* renaming of URLs during development.
|
||||||
|
*
|
||||||
|
* ```javascript
|
||||||
|
* router.get('user', '/users/:id', (ctx, next) => {
|
||||||
|
* // ...
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* router.url('user', 3);
|
||||||
|
* // => "/users/3"
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* #### Multiple middleware
|
||||||
|
*
|
||||||
|
* Multiple middleware may be given:
|
||||||
|
*
|
||||||
|
* ```javascript
|
||||||
|
* router.get(
|
||||||
|
* '/users/:id',
|
||||||
|
* (ctx, next) => {
|
||||||
|
* return User.findOne(ctx.params.id).then(function(user) {
|
||||||
|
* ctx.user = user;
|
||||||
|
* next();
|
||||||
|
* });
|
||||||
|
* },
|
||||||
|
* ctx => {
|
||||||
|
* console.log(ctx.user);
|
||||||
|
* // => { id: 17, name: "Alex" }
|
||||||
|
* }
|
||||||
|
* );
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* ### Nested routers
|
||||||
|
*
|
||||||
|
* Nesting routers is supported:
|
||||||
|
*
|
||||||
|
* ```javascript
|
||||||
|
* const forums = new Router();
|
||||||
|
* const posts = new Router();
|
||||||
|
*
|
||||||
|
* posts.get('/', (ctx, next) => {...});
|
||||||
|
* posts.get('/:pid', (ctx, next) => {...});
|
||||||
|
* forums.use('/forums/:fid/posts', posts.routes(), posts.allowedMethods());
|
||||||
|
*
|
||||||
|
* // responds to "/forums/123/posts" and "/forums/123/posts/123"
|
||||||
|
* app.use(forums.routes());
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* #### Router prefixes
|
||||||
|
*
|
||||||
|
* Route paths can be prefixed at the router level:
|
||||||
|
*
|
||||||
|
* ```javascript
|
||||||
|
* const router = new Router({
|
||||||
|
* prefix: '/users'
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* router.get('/', ...); // responds to "/users"
|
||||||
|
* router.get('/:id', ...); // responds to "/users/:id"
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* #### URL parameters
|
||||||
|
*
|
||||||
|
* Named route parameters are captured and added to `ctx.params`.
|
||||||
|
*
|
||||||
|
* ```javascript
|
||||||
|
* router.get('/:category/:title', (ctx, next) => {
|
||||||
|
* console.log(ctx.params);
|
||||||
|
* // => { category: 'programming', title: 'how-to-node' }
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* The [path-to-regexp](https://github.com/pillarjs/path-to-regexp) module is
|
||||||
|
* used to convert paths to regular expressions.
|
||||||
|
*
|
||||||
|
* @name get|put|post|patch|delete|del
|
||||||
|
* @memberof module:koa-router.prototype
|
||||||
|
* @param {String} path
|
||||||
|
* @param {Function=} middleware route middleware(s)
|
||||||
|
* @param {Function} callback route callback
|
||||||
|
* @returns {Router}
|
||||||
|
*/
|
||||||
|
|
||||||
|
for (let i = 0; i < methods.length; i++) {
|
||||||
|
function setMethodVerb(method) {
|
||||||
|
Router.prototype[method] = function(name, path, middleware) {
|
||||||
|
if (typeof path === "string" || path instanceof RegExp) {
|
||||||
|
middleware = Array.prototype.slice.call(arguments, 2);
|
||||||
|
} else {
|
||||||
|
middleware = Array.prototype.slice.call(arguments, 1);
|
||||||
|
path = name;
|
||||||
|
name = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.register(path, [method], middleware, {
|
||||||
|
name: name
|
||||||
|
});
|
||||||
|
|
||||||
|
return this;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
setMethodVerb(methods[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Alias for `router.delete()` because delete is a reserved word
|
||||||
|
Router.prototype.del = Router.prototype['delete'];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use given middleware.
|
||||||
|
*
|
||||||
|
* Middleware run in the order they are defined by `.use()`. They are invoked
|
||||||
|
* sequentially, requests start at the first middleware and work their way
|
||||||
|
* "down" the middleware stack.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* ```javascript
|
||||||
|
* // session middleware will run before authorize
|
||||||
|
* router
|
||||||
|
* .use(session())
|
||||||
|
* .use(authorize());
|
||||||
|
*
|
||||||
|
* // use middleware only with given path
|
||||||
|
* router.use('/users', userAuth());
|
||||||
|
*
|
||||||
|
* // or with an array of paths
|
||||||
|
* router.use(['/users', '/admin'], userAuth());
|
||||||
|
*
|
||||||
|
* app.use(router.routes());
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* @param {String=} path
|
||||||
|
* @param {Function} middleware
|
||||||
|
* @param {Function=} ...
|
||||||
|
* @returns {Router}
|
||||||
|
*/
|
||||||
|
|
||||||
|
Router.prototype.use = function () {
|
||||||
|
const router = this;
|
||||||
|
const middleware = Array.prototype.slice.call(arguments);
|
||||||
|
let path;
|
||||||
|
|
||||||
|
// support array of paths
|
||||||
|
if (Array.isArray(middleware[0]) && typeof middleware[0][0] === 'string') {
|
||||||
|
let arrPaths = middleware[0];
|
||||||
|
for (let i = 0; i < arrPaths.length; i++) {
|
||||||
|
const p = arrPaths[i];
|
||||||
|
router.use.apply(router, [p].concat(middleware.slice(1)));
|
||||||
|
}
|
||||||
|
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
const hasPath = typeof middleware[0] === 'string';
|
||||||
|
if (hasPath) path = middleware.shift();
|
||||||
|
|
||||||
|
for (let i = 0; i < middleware.length; i++) {
|
||||||
|
const m = middleware[i];
|
||||||
|
if (m.router) {
|
||||||
|
const cloneRouter = Object.assign(Object.create(Router.prototype), m.router, {
|
||||||
|
stack: m.router.stack.slice(0)
|
||||||
|
});
|
||||||
|
|
||||||
|
for (let j = 0; j < cloneRouter.stack.length; j++) {
|
||||||
|
const nestedLayer = cloneRouter.stack[j];
|
||||||
|
const cloneLayer = Object.assign(
|
||||||
|
Object.create(Layer.prototype),
|
||||||
|
nestedLayer
|
||||||
|
);
|
||||||
|
|
||||||
|
if (path) cloneLayer.setPrefix(path);
|
||||||
|
if (router.opts.prefix) cloneLayer.setPrefix(router.opts.prefix);
|
||||||
|
router.stack.push(cloneLayer);
|
||||||
|
cloneRouter.stack[j] = cloneLayer;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (router.params) {
|
||||||
|
function setRouterParams(paramArr) {
|
||||||
|
const routerParams = paramArr;
|
||||||
|
for (let j = 0; j < routerParams.length; j++) {
|
||||||
|
const key = routerParams[j];
|
||||||
|
cloneRouter.param(key, router.params[key]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
setRouterParams(Object.keys(router.params));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
const keys = [];
|
||||||
|
pathToRegexp(router.opts.prefix || '', keys);
|
||||||
|
const routerPrefixHasParam = router.opts.prefix && keys.length;
|
||||||
|
router.register(path || '([^\/]*)', [], m, { end: false, ignoreCaptures: !hasPath && !routerPrefixHasParam });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return this;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the path prefix for a Router instance that was already initialized.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* ```javascript
|
||||||
|
* router.prefix('/things/:thing_id')
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* @param {String} prefix
|
||||||
|
* @returns {Router}
|
||||||
|
*/
|
||||||
|
|
||||||
|
Router.prototype.prefix = function (prefix) {
|
||||||
|
prefix = prefix.replace(/\/$/, '');
|
||||||
|
|
||||||
|
this.opts.prefix = prefix;
|
||||||
|
|
||||||
|
for (let i = 0; i < this.stack.length; i++) {
|
||||||
|
const route = this.stack[i];
|
||||||
|
route.setPrefix(prefix);
|
||||||
|
}
|
||||||
|
|
||||||
|
return this;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns router middleware which dispatches a route matching the request.
|
||||||
|
*
|
||||||
|
* @returns {Function}
|
||||||
|
*/
|
||||||
|
|
||||||
|
Router.prototype.routes = Router.prototype.middleware = function () {
|
||||||
|
const router = this;
|
||||||
|
|
||||||
|
let dispatch = function dispatch(ctx, next) {
|
||||||
|
debug('%s %s', ctx.method, ctx.path);
|
||||||
|
|
||||||
|
const path = router.opts.routerPath || ctx.routerPath || ctx.path;
|
||||||
|
const matched = router.match(path, ctx.method);
|
||||||
|
let layerChain;
|
||||||
|
|
||||||
|
if (ctx.matched) {
|
||||||
|
ctx.matched.push.apply(ctx.matched, matched.path);
|
||||||
|
} else {
|
||||||
|
ctx.matched = matched.path;
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx.router = router;
|
||||||
|
|
||||||
|
if (!matched.route) return next();
|
||||||
|
|
||||||
|
const matchedLayers = matched.pathAndMethod
|
||||||
|
const mostSpecificLayer = matchedLayers[matchedLayers.length - 1]
|
||||||
|
ctx._matchedRoute = mostSpecificLayer.path;
|
||||||
|
if (mostSpecificLayer.name) {
|
||||||
|
ctx._matchedRouteName = mostSpecificLayer.name;
|
||||||
|
}
|
||||||
|
|
||||||
|
layerChain = matchedLayers.reduce(function(memo, layer) {
|
||||||
|
memo.push(function(ctx, next) {
|
||||||
|
ctx.captures = layer.captures(path, ctx.captures);
|
||||||
|
ctx.params = ctx.request.params = layer.params(path, ctx.captures, ctx.params);
|
||||||
|
ctx.routerPath = layer.path;
|
||||||
|
ctx.routerName = layer.name;
|
||||||
|
ctx._matchedRoute = layer.path;
|
||||||
|
if (layer.name) {
|
||||||
|
ctx._matchedRouteName = layer.name;
|
||||||
|
}
|
||||||
|
return next();
|
||||||
|
});
|
||||||
|
return memo.concat(layer.stack);
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
return compose(layerChain)(ctx, next);
|
||||||
|
};
|
||||||
|
|
||||||
|
dispatch.router = this;
|
||||||
|
|
||||||
|
return dispatch;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns separate middleware for responding to `OPTIONS` requests with
|
||||||
|
* an `Allow` header containing the allowed methods, as well as responding
|
||||||
|
* with `405 Method Not Allowed` and `501 Not Implemented` as appropriate.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* ```javascript
|
||||||
|
* const Koa = require('koa');
|
||||||
|
* const Router = require('@koa/router');
|
||||||
|
*
|
||||||
|
* const app = new Koa();
|
||||||
|
* const router = new Router();
|
||||||
|
*
|
||||||
|
* app.use(router.routes());
|
||||||
|
* app.use(router.allowedMethods());
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* **Example with [Boom](https://github.com/hapijs/boom)**
|
||||||
|
*
|
||||||
|
* ```javascript
|
||||||
|
* const Koa = require('koa');
|
||||||
|
* const Router = require('@koa/router');
|
||||||
|
* const Boom = require('boom');
|
||||||
|
*
|
||||||
|
* const app = new Koa();
|
||||||
|
* const router = new Router();
|
||||||
|
*
|
||||||
|
* app.use(router.routes());
|
||||||
|
* app.use(router.allowedMethods({
|
||||||
|
* throw: true,
|
||||||
|
* notImplemented: () => new Boom.notImplemented(),
|
||||||
|
* methodNotAllowed: () => new Boom.methodNotAllowed()
|
||||||
|
* }));
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* @param {Object=} options
|
||||||
|
* @param {Boolean=} options.throw throw error instead of setting status and header
|
||||||
|
* @param {Function=} options.notImplemented throw the returned value in place of the default NotImplemented error
|
||||||
|
* @param {Function=} options.methodNotAllowed throw the returned value in place of the default MethodNotAllowed error
|
||||||
|
* @returns {Function}
|
||||||
|
*/
|
||||||
|
|
||||||
|
Router.prototype.allowedMethods = function (options) {
|
||||||
|
options = options || {};
|
||||||
|
const implemented = this.methods;
|
||||||
|
|
||||||
|
return function allowedMethods(ctx, next) {
|
||||||
|
return next().then(function() {
|
||||||
|
const allowed = {};
|
||||||
|
|
||||||
|
if (!ctx.status || ctx.status === 404) {
|
||||||
|
for (let i = 0; i < ctx.matched.length; i++) {
|
||||||
|
const route = ctx.matched[i];
|
||||||
|
for (let j = 0; j < route.methods.length; j++) {
|
||||||
|
const method = route.methods[j];
|
||||||
|
allowed[method] = method;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const allowedArr = Object.keys(allowed);
|
||||||
|
|
||||||
|
if (!~implemented.indexOf(ctx.method)) {
|
||||||
|
if (options.throw) {
|
||||||
|
let notImplementedThrowable = (typeof options.notImplemented === 'function')
|
||||||
|
? options.notImplemented() // set whatever the user returns from their function
|
||||||
|
: new HttpError.NotImplemented();
|
||||||
|
|
||||||
|
throw notImplementedThrowable;
|
||||||
|
} else {
|
||||||
|
ctx.status = 501;
|
||||||
|
ctx.set('Allow', allowedArr.join(', '));
|
||||||
|
}
|
||||||
|
} else if (allowedArr.length) {
|
||||||
|
if (ctx.method === 'OPTIONS') {
|
||||||
|
ctx.status = 200;
|
||||||
|
ctx.body = '';
|
||||||
|
ctx.set('Allow', allowedArr.join(', '));
|
||||||
|
} else if (!allowed[ctx.method]) {
|
||||||
|
if (options.throw) {
|
||||||
|
let notAllowedThrowable = (typeof options.methodNotAllowed === 'function')
|
||||||
|
? options.methodNotAllowed() // set whatever the user returns from their function
|
||||||
|
: new HttpError.MethodNotAllowed();
|
||||||
|
|
||||||
|
throw notAllowedThrowable;
|
||||||
|
} else {
|
||||||
|
ctx.status = 405;
|
||||||
|
ctx.set('Allow', allowedArr.join(', '));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register route with all methods.
|
||||||
|
*
|
||||||
|
* @param {String} name Optional.
|
||||||
|
* @param {String} path
|
||||||
|
* @param {Function=} middleware You may also pass multiple middleware.
|
||||||
|
* @param {Function} callback
|
||||||
|
* @returns {Router}
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
|
||||||
|
Router.prototype.all = function (name, path, middleware) {
|
||||||
|
if (typeof path === 'string') {
|
||||||
|
middleware = Array.prototype.slice.call(arguments, 2);
|
||||||
|
} else {
|
||||||
|
middleware = Array.prototype.slice.call(arguments, 1);
|
||||||
|
path = name;
|
||||||
|
name = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.register(path, methods, middleware, { name });
|
||||||
|
|
||||||
|
return this;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Redirect `source` to `destination` URL with optional 30x status `code`.
|
||||||
|
*
|
||||||
|
* Both `source` and `destination` can be route names.
|
||||||
|
*
|
||||||
|
* ```javascript
|
||||||
|
* router.redirect('/login', 'sign-in');
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* This is equivalent to:
|
||||||
|
*
|
||||||
|
* ```javascript
|
||||||
|
* router.all('/login', ctx => {
|
||||||
|
* ctx.redirect('/sign-in');
|
||||||
|
* ctx.status = 301;
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* @param {String} source URL or route name.
|
||||||
|
* @param {String} destination URL or route name.
|
||||||
|
* @param {Number=} code HTTP status code (default: 301).
|
||||||
|
* @returns {Router}
|
||||||
|
*/
|
||||||
|
|
||||||
|
Router.prototype.redirect = function (source, destination, code) {
|
||||||
|
// lookup source route by name
|
||||||
|
if (source[0] !== '/') source = this.url(source);
|
||||||
|
|
||||||
|
// lookup destination route by name
|
||||||
|
if (destination[0] !== '/' && !destination.includes('://')) destination = this.url(destination);
|
||||||
|
|
||||||
|
return this.all(source, ctx => {
|
||||||
|
ctx.redirect(destination);
|
||||||
|
ctx.status = code || 301;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create and register a route.
|
||||||
|
*
|
||||||
|
* @param {String} path Path string.
|
||||||
|
* @param {Array.<String>} methods Array of HTTP verbs.
|
||||||
|
* @param {Function} middleware Multiple middleware also accepted.
|
||||||
|
* @returns {Layer}
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
|
||||||
|
Router.prototype.register = function (path, methods, middleware, opts) {
|
||||||
|
opts = opts || {};
|
||||||
|
|
||||||
|
const router = this;
|
||||||
|
const stack = this.stack;
|
||||||
|
|
||||||
|
// support array of paths
|
||||||
|
if (Array.isArray(path)) {
|
||||||
|
for (let i = 0; i < path.length; i++) {
|
||||||
|
const curPath = path[i];
|
||||||
|
router.register.call(router, curPath, methods, middleware, opts);
|
||||||
|
}
|
||||||
|
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
// create route
|
||||||
|
const route = new Layer(path, methods, middleware, {
|
||||||
|
end: opts.end === false ? opts.end : true,
|
||||||
|
name: opts.name,
|
||||||
|
sensitive: opts.sensitive || this.opts.sensitive || false,
|
||||||
|
strict: opts.strict || this.opts.strict || false,
|
||||||
|
prefix: opts.prefix || this.opts.prefix || "",
|
||||||
|
ignoreCaptures: opts.ignoreCaptures
|
||||||
|
});
|
||||||
|
|
||||||
|
if (this.opts.prefix) {
|
||||||
|
route.setPrefix(this.opts.prefix);
|
||||||
|
}
|
||||||
|
|
||||||
|
// add parameter middleware
|
||||||
|
for (let i = 0; i < Object.keys(this.params).length; i++) {
|
||||||
|
const param = Object.keys(this.params)[i];
|
||||||
|
route.param(param, this.params[param]);
|
||||||
|
}
|
||||||
|
|
||||||
|
stack.push(route);
|
||||||
|
|
||||||
|
debug('defined route %s %s', route.methods, route.path);
|
||||||
|
|
||||||
|
return route;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lookup route with given `name`.
|
||||||
|
*
|
||||||
|
* @param {String} name
|
||||||
|
* @returns {Layer|false}
|
||||||
|
*/
|
||||||
|
|
||||||
|
Router.prototype.route = function (name) {
|
||||||
|
const routes = this.stack;
|
||||||
|
|
||||||
|
for (let len = routes.length, i=0; i<len; i++) {
|
||||||
|
if (routes[i].name && routes[i].name === name) return routes[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate URL for route. Takes a route name and map of named `params`.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* ```javascript
|
||||||
|
* router.get('user', '/users/:id', (ctx, next) => {
|
||||||
|
* // ...
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* router.url('user', 3);
|
||||||
|
* // => "/users/3"
|
||||||
|
*
|
||||||
|
* router.url('user', { id: 3 });
|
||||||
|
* // => "/users/3"
|
||||||
|
*
|
||||||
|
* router.use((ctx, next) => {
|
||||||
|
* // redirect to named route
|
||||||
|
* ctx.redirect(ctx.router.url('sign-in'));
|
||||||
|
* })
|
||||||
|
*
|
||||||
|
* router.url('user', { id: 3 }, { query: { limit: 1 } });
|
||||||
|
* // => "/users/3?limit=1"
|
||||||
|
*
|
||||||
|
* router.url('user', { id: 3 }, { query: "limit=1" });
|
||||||
|
* // => "/users/3?limit=1"
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* @param {String} name route name
|
||||||
|
* @param {Object} params url parameters
|
||||||
|
* @param {Object} [options] options parameter
|
||||||
|
* @param {Object|String} [options.query] query options
|
||||||
|
* @returns {String|Error}
|
||||||
|
*/
|
||||||
|
|
||||||
|
Router.prototype.url = function (name, params) {
|
||||||
|
const route = this.route(name);
|
||||||
|
|
||||||
|
if (route) {
|
||||||
|
const args = Array.prototype.slice.call(arguments, 1);
|
||||||
|
return route.url.apply(route, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Error(`No route found for name: ${name}`);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Match given `path` and return corresponding routes.
|
||||||
|
*
|
||||||
|
* @param {String} path
|
||||||
|
* @param {String} method
|
||||||
|
* @returns {Object.<path, pathAndMethod>} returns layers that matched path and
|
||||||
|
* path and method.
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
|
||||||
|
Router.prototype.match = function (path, method) {
|
||||||
|
const layers = this.stack;
|
||||||
|
let layer;
|
||||||
|
const matched = {
|
||||||
|
path: [],
|
||||||
|
pathAndMethod: [],
|
||||||
|
route: false
|
||||||
|
};
|
||||||
|
|
||||||
|
for (let len = layers.length, i = 0; i < len; i++) {
|
||||||
|
layer = layers[i];
|
||||||
|
|
||||||
|
debug('test %s %s', layer.path, layer.regexp);
|
||||||
|
|
||||||
|
if (layer.match(path)) {
|
||||||
|
matched.path.push(layer);
|
||||||
|
|
||||||
|
if (layer.methods.length === 0 || ~layer.methods.indexOf(method)) {
|
||||||
|
matched.pathAndMethod.push(layer);
|
||||||
|
if (layer.methods.length) matched.route = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return matched;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Run middleware for named route parameters. Useful for auto-loading or
|
||||||
|
* validation.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* ```javascript
|
||||||
|
* router
|
||||||
|
* .param('user', (id, ctx, next) => {
|
||||||
|
* ctx.user = users[id];
|
||||||
|
* if (!ctx.user) return ctx.status = 404;
|
||||||
|
* return next();
|
||||||
|
* })
|
||||||
|
* .get('/users/:user', ctx => {
|
||||||
|
* ctx.body = ctx.user;
|
||||||
|
* })
|
||||||
|
* .get('/users/:user/friends', ctx => {
|
||||||
|
* return ctx.user.getFriends().then(function(friends) {
|
||||||
|
* ctx.body = friends;
|
||||||
|
* });
|
||||||
|
* })
|
||||||
|
* // /users/3 => {"id": 3, "name": "Alex"}
|
||||||
|
* // /users/3/friends => [{"id": 4, "name": "TJ"}]
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* @param {String} param
|
||||||
|
* @param {Function} middleware
|
||||||
|
* @returns {Router}
|
||||||
|
*/
|
||||||
|
|
||||||
|
Router.prototype.param = function(param, middleware) {
|
||||||
|
this.params[param] = middleware;
|
||||||
|
for (let i = 0; i < this.stack.length; i++) {
|
||||||
|
const route = this.stack[i];
|
||||||
|
route.param(param, middleware);
|
||||||
|
}
|
||||||
|
|
||||||
|
return this;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate URL from url pattern and given `params`.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* ```javascript
|
||||||
|
* const url = Router.url('/users/:id', {id: 1});
|
||||||
|
* // => "/users/1"
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* @param {String} path url pattern
|
||||||
|
* @param {Object} params url parameters
|
||||||
|
* @returns {String}
|
||||||
|
*/
|
||||||
|
Router.url = function (path) {
|
||||||
|
const args = Array.prototype.slice.call(arguments, 1);
|
||||||
|
return Layer.prototype.url.apply({ path }, args);
|
||||||
|
};
|
||||||
85
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/@koa/router/package.json
generated
vendored
Normal file
85
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/@koa/router/package.json
generated
vendored
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
{
|
||||||
|
"_args": [
|
||||||
|
[
|
||||||
|
"@koa/router@10.1.1",
|
||||||
|
"/tmp/repository/main"
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"_from": "@koa/router@10.1.1",
|
||||||
|
"_id": "@koa/router@10.1.1",
|
||||||
|
"_inBundle": false,
|
||||||
|
"_integrity": "sha512-ORNjq5z4EmQPriKbR0ER3k4Gh7YGNhWDL7JBW+8wXDrHLbWYKYSJaOJ9aN06npF5tbTxe2JBOsurpJDAvjiXKw==",
|
||||||
|
"_location": "/@koa/router",
|
||||||
|
"_phantomChildren": {},
|
||||||
|
"_requested": {
|
||||||
|
"type": "version",
|
||||||
|
"registry": true,
|
||||||
|
"raw": "@koa/router@10.1.1",
|
||||||
|
"name": "@koa/router",
|
||||||
|
"escapedName": "@koa%2frouter",
|
||||||
|
"scope": "@koa",
|
||||||
|
"rawSpec": "10.1.1",
|
||||||
|
"saveSpec": null,
|
||||||
|
"fetchSpec": "10.1.1"
|
||||||
|
},
|
||||||
|
"_requiredBy": [
|
||||||
|
"/@vscode/test-web"
|
||||||
|
],
|
||||||
|
"_resolved": "https://registry.npmjs.org/@koa/router/-/router-10.1.1.tgz",
|
||||||
|
"_spec": "10.1.1",
|
||||||
|
"_where": "/tmp/repository/main",
|
||||||
|
"author": {
|
||||||
|
"name": "Alex Mingoia",
|
||||||
|
"email": "talk@alexmingoia.com"
|
||||||
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/koajs/router/issues",
|
||||||
|
"email": "niftylettuce@gmail.com"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"debug": "^4.1.1",
|
||||||
|
"http-errors": "^1.7.3",
|
||||||
|
"koa-compose": "^4.1.0",
|
||||||
|
"methods": "^1.1.2",
|
||||||
|
"path-to-regexp": "^6.1.0"
|
||||||
|
},
|
||||||
|
"description": "Router middleware for koa. Provides RESTful resource routing.",
|
||||||
|
"devDependencies": {
|
||||||
|
"@ladjs/env": "^1.0.0",
|
||||||
|
"expect.js": "^0.3.1",
|
||||||
|
"jsdoc-to-markdown": "^5.0.3",
|
||||||
|
"koa": "^2.11.0",
|
||||||
|
"mocha": "^7.0.1",
|
||||||
|
"nyc": "^15.0.0",
|
||||||
|
"should": "^13.2.3",
|
||||||
|
"supertest": "^4.0.2",
|
||||||
|
"wrk": "^1.2.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 8.0.0"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"lib"
|
||||||
|
],
|
||||||
|
"homepage": "https://github.com/koajs/router",
|
||||||
|
"keywords": [
|
||||||
|
"koa",
|
||||||
|
"middleware",
|
||||||
|
"route",
|
||||||
|
"router"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"main": "lib/router.js",
|
||||||
|
"name": "@koa/router",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/koajs/router.git"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"bench": "make -C bench",
|
||||||
|
"coverage": "nyc npm run test",
|
||||||
|
"docs": "NODE_ENV=test jsdoc2md -t ./lib/API_tpl.hbs --src ./lib/*.js >| API.md",
|
||||||
|
"test": "mocha test/**/*.js"
|
||||||
|
},
|
||||||
|
"version": "10.1.1"
|
||||||
|
}
|
||||||
39
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/@tootallnate/once/dist/index.js
generated
vendored
Normal file
39
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/@tootallnate/once/dist/index.js
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
"use strict";
|
||||||
|
function noop() { }
|
||||||
|
function once(emitter, name) {
|
||||||
|
const o = once.spread(emitter, name);
|
||||||
|
const r = o.then((args) => args[0]);
|
||||||
|
r.cancel = o.cancel;
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
(function (once) {
|
||||||
|
function spread(emitter, name) {
|
||||||
|
let c = null;
|
||||||
|
const p = new Promise((resolve, reject) => {
|
||||||
|
function cancel() {
|
||||||
|
emitter.removeListener(name, onEvent);
|
||||||
|
emitter.removeListener('error', onError);
|
||||||
|
p.cancel = noop;
|
||||||
|
}
|
||||||
|
function onEvent(...args) {
|
||||||
|
cancel();
|
||||||
|
resolve(args);
|
||||||
|
}
|
||||||
|
function onError(err) {
|
||||||
|
cancel();
|
||||||
|
reject(err);
|
||||||
|
}
|
||||||
|
c = cancel;
|
||||||
|
emitter.on(name, onEvent);
|
||||||
|
emitter.on('error', onError);
|
||||||
|
});
|
||||||
|
if (!c) {
|
||||||
|
throw new TypeError('Could not get `cancel()` function');
|
||||||
|
}
|
||||||
|
p.cancel = c;
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
once.spread = spread;
|
||||||
|
})(once || (once = {}));
|
||||||
|
module.exports = once;
|
||||||
|
//# sourceMappingURL=index.js.map
|
||||||
79
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/@tootallnate/once/package.json
generated
vendored
Normal file
79
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/@tootallnate/once/package.json
generated
vendored
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
{
|
||||||
|
"_args": [
|
||||||
|
[
|
||||||
|
"@tootallnate/once@1.1.2",
|
||||||
|
"/tmp/repository/main"
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"_from": "@tootallnate/once@1.1.2",
|
||||||
|
"_id": "@tootallnate/once@1.1.2",
|
||||||
|
"_inBundle": false,
|
||||||
|
"_integrity": "sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw==",
|
||||||
|
"_location": "/@tootallnate/once",
|
||||||
|
"_phantomChildren": {},
|
||||||
|
"_requested": {
|
||||||
|
"type": "version",
|
||||||
|
"registry": true,
|
||||||
|
"raw": "@tootallnate/once@1.1.2",
|
||||||
|
"name": "@tootallnate/once",
|
||||||
|
"escapedName": "@tootallnate%2fonce",
|
||||||
|
"scope": "@tootallnate",
|
||||||
|
"rawSpec": "1.1.2",
|
||||||
|
"saveSpec": null,
|
||||||
|
"fetchSpec": "1.1.2"
|
||||||
|
},
|
||||||
|
"_requiredBy": [
|
||||||
|
"/http-proxy-agent"
|
||||||
|
],
|
||||||
|
"_resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-1.1.2.tgz",
|
||||||
|
"_spec": "1.1.2",
|
||||||
|
"_where": "/tmp/repository/main",
|
||||||
|
"author": {
|
||||||
|
"name": "Nathan Rajlich",
|
||||||
|
"email": "nathan@tootallnate.net",
|
||||||
|
"url": "http://n8.io/"
|
||||||
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/TooTallNate/once/issues"
|
||||||
|
},
|
||||||
|
"description": "Creates a Promise that waits for a single event",
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/node": "^12.12.11",
|
||||||
|
"@typescript-eslint/eslint-plugin": "1.6.0",
|
||||||
|
"@typescript-eslint/parser": "1.1.0",
|
||||||
|
"eslint": "5.16.0",
|
||||||
|
"eslint-config-airbnb": "17.1.0",
|
||||||
|
"eslint-config-prettier": "4.1.0",
|
||||||
|
"eslint-import-resolver-typescript": "1.1.1",
|
||||||
|
"eslint-plugin-import": "2.16.0",
|
||||||
|
"eslint-plugin-jsx-a11y": "6.2.1",
|
||||||
|
"eslint-plugin-react": "7.12.4",
|
||||||
|
"mocha": "^6.2.2",
|
||||||
|
"rimraf": "^3.0.0",
|
||||||
|
"typescript": "^3.7.3"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 6"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"dist"
|
||||||
|
],
|
||||||
|
"homepage": "https://github.com/TooTallNate/once#readme",
|
||||||
|
"keywords": [],
|
||||||
|
"license": "MIT",
|
||||||
|
"main": "./dist/index.js",
|
||||||
|
"name": "@tootallnate/once",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git://github.com/TooTallNate/once.git"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"build": "tsc",
|
||||||
|
"prebuild": "rimraf dist",
|
||||||
|
"prepublishOnly": "npm run build",
|
||||||
|
"test": "mocha --reporter spec",
|
||||||
|
"test-lint": "eslint src --ext .js,.ts"
|
||||||
|
},
|
||||||
|
"types": "./dist/index.d.ts",
|
||||||
|
"version": "1.1.2"
|
||||||
|
}
|
||||||
21
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/@types/node/LICENSE
generated
vendored
Executable file
21
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/@types/node/LICENSE
generated
vendored
Executable file
@@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) Microsoft Corporation.
|
||||||
|
|
||||||
|
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
|
||||||
16
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/@types/node/README.md
generated
vendored
Executable file
16
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/@types/node/README.md
generated
vendored
Executable file
@@ -0,0 +1,16 @@
|
|||||||
|
# Installation
|
||||||
|
> `npm install --save @types/node`
|
||||||
|
|
||||||
|
# Summary
|
||||||
|
This package contains type definitions for Node.js (https://nodejs.org/).
|
||||||
|
|
||||||
|
# Details
|
||||||
|
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node/v12.
|
||||||
|
|
||||||
|
### Additional Details
|
||||||
|
* Last updated: Tue, 21 Sep 2021 18:31:42 GMT
|
||||||
|
* Dependencies: none
|
||||||
|
* Global values: `Buffer`, `NodeJS`, `__dirname`, `__filename`, `clearImmediate`, `clearInterval`, `clearTimeout`, `console`, `exports`, `global`, `module`, `process`, `queueMicrotask`, `require`, `setImmediate`, `setInterval`, `setTimeout`
|
||||||
|
|
||||||
|
# Credits
|
||||||
|
These definitions were written by [Microsoft TypeScript](https://github.com/Microsoft), [DefinitelyTyped](https://github.com/DefinitelyTyped), [Alberto Schiabel](https://github.com/jkomyno), [Alvis HT Tang](https://github.com/alvis), [Andrew Makarov](https://github.com/r3nya), [Benjamin Toueg](https://github.com/btoueg), [Chigozirim C.](https://github.com/smac89), [David Junger](https://github.com/touffy), [Deividas Bakanas](https://github.com/DeividasBakanas), [Eugene Y. Q. Shen](https://github.com/eyqs), [Hannes Magnusson](https://github.com/Hannes-Magnusson-CK), [Hoàng Văn Khải](https://github.com/KSXGitHub), [Huw](https://github.com/hoo29), [Kelvin Jin](https://github.com/kjin), [Klaus Meinhardt](https://github.com/ajafff), [Lishude](https://github.com/islishude), [Mariusz Wiktorczyk](https://github.com/mwiktorczyk), [Mohsen Azimi](https://github.com/mohsen1), [Nicolas Even](https://github.com/n-e), [Nikita Galkin](https://github.com/galkin), [Parambir Singh](https://github.com/parambirs), [Sebastian Silbermann](https://github.com/eps1lon), [Simon Schick](https://github.com/SimonSchick), [Thomas den Hollander](https://github.com/ThomasdenH), [Wilco Bakker](https://github.com/WilcoBakker), [wwwy3y3](https://github.com/wwwy3y3), [Zane Hannan AU](https://github.com/ZaneHannanAU), [Samuel Ainsworth](https://github.com/samuela), [Kyle Uehlein](https://github.com/kuehlein), [Thanik Bhongbhibhat](https://github.com/bhongy), [Marcin Kopacz](https://github.com/chyzwar), [Trivikram Kamat](https://github.com/trivikr), [Minh Son Nguyen](https://github.com/nguymin4), [Junxiao Shi](https://github.com/yoursunny), [Ilia Baryshnikov](https://github.com/qwelias), [ExE Boss](https://github.com/ExE-Boss), and [Jason Kwok](https://github.com/JasonHK).
|
||||||
203
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/@types/node/package.json
generated
vendored
Executable file
203
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/@types/node/package.json
generated
vendored
Executable file
@@ -0,0 +1,203 @@
|
|||||||
|
{
|
||||||
|
"_args": [
|
||||||
|
[
|
||||||
|
"@types/node@12.20.26",
|
||||||
|
"/tmp/repository/main"
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"_from": "@types/node@12.20.26",
|
||||||
|
"_id": "@types/node@12.20.26",
|
||||||
|
"_inBundle": false,
|
||||||
|
"_integrity": "sha512-gIt+h4u2uTho2bsH1K250fUv5fHU71ET1yWT7bM4523zV/XrFb9jlWBOV4DO8FpscY+Sz/WEr1EEjIP2H4yumQ==",
|
||||||
|
"_location": "/@types/node",
|
||||||
|
"_phantomChildren": {},
|
||||||
|
"_requested": {
|
||||||
|
"type": "version",
|
||||||
|
"registry": true,
|
||||||
|
"raw": "@types/node@12.20.26",
|
||||||
|
"name": "@types/node",
|
||||||
|
"escapedName": "@types%2fnode",
|
||||||
|
"scope": "@types",
|
||||||
|
"rawSpec": "12.20.26",
|
||||||
|
"saveSpec": null,
|
||||||
|
"fetchSpec": "12.20.26"
|
||||||
|
},
|
||||||
|
"_requiredBy": [
|
||||||
|
"#DEV:/",
|
||||||
|
"/@types/glob",
|
||||||
|
"/@types/yauzl",
|
||||||
|
"/jest-worker"
|
||||||
|
],
|
||||||
|
"_resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.26.tgz",
|
||||||
|
"_spec": "12.20.26",
|
||||||
|
"_where": "/tmp/repository/main",
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped/issues"
|
||||||
|
},
|
||||||
|
"contributors": [
|
||||||
|
{
|
||||||
|
"name": "Microsoft TypeScript",
|
||||||
|
"url": "https://github.com/Microsoft"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "DefinitelyTyped",
|
||||||
|
"url": "https://github.com/DefinitelyTyped"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Alberto Schiabel",
|
||||||
|
"url": "https://github.com/jkomyno"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Alvis HT Tang",
|
||||||
|
"url": "https://github.com/alvis"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Andrew Makarov",
|
||||||
|
"url": "https://github.com/r3nya"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Benjamin Toueg",
|
||||||
|
"url": "https://github.com/btoueg"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Chigozirim C.",
|
||||||
|
"url": "https://github.com/smac89"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "David Junger",
|
||||||
|
"url": "https://github.com/touffy"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Deividas Bakanas",
|
||||||
|
"url": "https://github.com/DeividasBakanas"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Eugene Y. Q. Shen",
|
||||||
|
"url": "https://github.com/eyqs"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Hannes Magnusson",
|
||||||
|
"url": "https://github.com/Hannes-Magnusson-CK"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Hoàng Văn Khải",
|
||||||
|
"url": "https://github.com/KSXGitHub"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Huw",
|
||||||
|
"url": "https://github.com/hoo29"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Kelvin Jin",
|
||||||
|
"url": "https://github.com/kjin"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Klaus Meinhardt",
|
||||||
|
"url": "https://github.com/ajafff"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Lishude",
|
||||||
|
"url": "https://github.com/islishude"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Mariusz Wiktorczyk",
|
||||||
|
"url": "https://github.com/mwiktorczyk"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Mohsen Azimi",
|
||||||
|
"url": "https://github.com/mohsen1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Nicolas Even",
|
||||||
|
"url": "https://github.com/n-e"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Nikita Galkin",
|
||||||
|
"url": "https://github.com/galkin"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Parambir Singh",
|
||||||
|
"url": "https://github.com/parambirs"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Sebastian Silbermann",
|
||||||
|
"url": "https://github.com/eps1lon"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Simon Schick",
|
||||||
|
"url": "https://github.com/SimonSchick"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Thomas den Hollander",
|
||||||
|
"url": "https://github.com/ThomasdenH"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Wilco Bakker",
|
||||||
|
"url": "https://github.com/WilcoBakker"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "wwwy3y3",
|
||||||
|
"url": "https://github.com/wwwy3y3"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Zane Hannan AU",
|
||||||
|
"url": "https://github.com/ZaneHannanAU"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Samuel Ainsworth",
|
||||||
|
"url": "https://github.com/samuela"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Kyle Uehlein",
|
||||||
|
"url": "https://github.com/kuehlein"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Thanik Bhongbhibhat",
|
||||||
|
"url": "https://github.com/bhongy"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Marcin Kopacz",
|
||||||
|
"url": "https://github.com/chyzwar"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Trivikram Kamat",
|
||||||
|
"url": "https://github.com/trivikr"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Minh Son Nguyen",
|
||||||
|
"url": "https://github.com/nguymin4"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Junxiao Shi",
|
||||||
|
"url": "https://github.com/yoursunny"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Ilia Baryshnikov",
|
||||||
|
"url": "https://github.com/qwelias"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "ExE Boss",
|
||||||
|
"url": "https://github.com/ExE-Boss"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Jason Kwok",
|
||||||
|
"url": "https://github.com/JasonHK"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"dependencies": {},
|
||||||
|
"description": "TypeScript definitions for Node.js",
|
||||||
|
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
|
||||||
|
"license": "MIT",
|
||||||
|
"main": "",
|
||||||
|
"name": "@types/node",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/DefinitelyTyped/DefinitelyTyped.git",
|
||||||
|
"directory": "types/node"
|
||||||
|
},
|
||||||
|
"scripts": {},
|
||||||
|
"typeScriptVersion": "3.7",
|
||||||
|
"types": "index.d.ts",
|
||||||
|
"typesPublisherContentHash": "a306840a5ab2bd20920a38042841e53fb66553e7f394ca81bcae00ef7572dd93",
|
||||||
|
"version": "12.20.26"
|
||||||
|
}
|
||||||
21
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/@types/yauzl/LICENSE
generated
vendored
Executable file
21
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/@types/yauzl/LICENSE
generated
vendored
Executable file
@@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) Microsoft Corporation.
|
||||||
|
|
||||||
|
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
|
||||||
16
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/@types/yauzl/README.md
generated
vendored
Executable file
16
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/@types/yauzl/README.md
generated
vendored
Executable file
@@ -0,0 +1,16 @@
|
|||||||
|
# Installation
|
||||||
|
> `npm install --save @types/yauzl`
|
||||||
|
|
||||||
|
# Summary
|
||||||
|
This package contains type definitions for yauzl (https://github.com/thejoshwolfe/yauzl).
|
||||||
|
|
||||||
|
# Details
|
||||||
|
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/yauzl.
|
||||||
|
|
||||||
|
### Additional Details
|
||||||
|
* Last updated: Fri, 02 Jul 2021 16:32:08 GMT
|
||||||
|
* Dependencies: [@types/node](https://npmjs.com/package/@types/node)
|
||||||
|
* Global values: none
|
||||||
|
|
||||||
|
# Credits
|
||||||
|
These definitions were written by [Florian Keller](https://github.com/ffflorian).
|
||||||
59
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/@types/yauzl/package.json
generated
vendored
Executable file
59
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/@types/yauzl/package.json
generated
vendored
Executable file
@@ -0,0 +1,59 @@
|
|||||||
|
{
|
||||||
|
"_args": [
|
||||||
|
[
|
||||||
|
"@types/yauzl@2.9.2",
|
||||||
|
"/tmp/repository/main"
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"_from": "@types/yauzl@2.9.2",
|
||||||
|
"_id": "@types/yauzl@2.9.2",
|
||||||
|
"_inBundle": false,
|
||||||
|
"_integrity": "sha512-8uALY5LTvSuHgloDVUvWP3pIauILm+8/0pDMokuDYIoNsOkSwd5AiHBTSEJjKTDcZr5z8UpgOWZkxBF4iJftoA==",
|
||||||
|
"_location": "/@types/yauzl",
|
||||||
|
"_optional": true,
|
||||||
|
"_phantomChildren": {},
|
||||||
|
"_requested": {
|
||||||
|
"type": "version",
|
||||||
|
"registry": true,
|
||||||
|
"raw": "@types/yauzl@2.9.2",
|
||||||
|
"name": "@types/yauzl",
|
||||||
|
"escapedName": "@types%2fyauzl",
|
||||||
|
"scope": "@types",
|
||||||
|
"rawSpec": "2.9.2",
|
||||||
|
"saveSpec": null,
|
||||||
|
"fetchSpec": "2.9.2"
|
||||||
|
},
|
||||||
|
"_requiredBy": [
|
||||||
|
"/extract-zip"
|
||||||
|
],
|
||||||
|
"_resolved": "https://registry.npmjs.org/@types/yauzl/-/yauzl-2.9.2.tgz",
|
||||||
|
"_spec": "2.9.2",
|
||||||
|
"_where": "/tmp/repository/main",
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped/issues"
|
||||||
|
},
|
||||||
|
"contributors": [
|
||||||
|
{
|
||||||
|
"name": "Florian Keller",
|
||||||
|
"url": "https://github.com/ffflorian"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"dependencies": {
|
||||||
|
"@types/node": "*"
|
||||||
|
},
|
||||||
|
"description": "TypeScript definitions for yauzl",
|
||||||
|
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/yauzl",
|
||||||
|
"license": "MIT",
|
||||||
|
"main": "",
|
||||||
|
"name": "@types/yauzl",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/DefinitelyTyped/DefinitelyTyped.git",
|
||||||
|
"directory": "types/yauzl"
|
||||||
|
},
|
||||||
|
"scripts": {},
|
||||||
|
"typeScriptVersion": "3.6",
|
||||||
|
"types": "index.d.ts",
|
||||||
|
"typesPublisherContentHash": "66e9dbfe16bce3e314bf2f77c0f250a6ef6a082062b3dc253fbaa9451e1de452",
|
||||||
|
"version": "2.9.2"
|
||||||
|
}
|
||||||
7
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/@vscode/test-web/CHANGELOG.md
generated
vendored
Normal file
7
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/@vscode/test-web/CHANGELOG.md
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
# Changelog
|
||||||
|
|
||||||
|
### 0.0.1 |
|
||||||
|
|
||||||
|
- Initial version
|
||||||
|
|
||||||
|
|
||||||
21
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/@vscode/test-web/LICENSE
generated
vendored
Normal file
21
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/@vscode/test-web/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
|
||||||
|
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
|
||||||
90
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/@vscode/test-web/README.md
generated
vendored
Normal file
90
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/@vscode/test-web/README.md
generated
vendored
Normal file
@@ -0,0 +1,90 @@
|
|||||||
|
# @vscode/test-web
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
This module helps testing VS Code web extensions locally.
|
||||||
|
|
||||||
|
The node module runs a local web server that serves VS Code Browser including the extensions located at the given local path. Additionally the extension tests are automatically run.
|
||||||
|
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
Via command line:
|
||||||
|
|
||||||
|
Test web extension in browser:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
vscode-test-web --browserType=webkit --extensionDevelopmentPath=$extensionLocation
|
||||||
|
```
|
||||||
|
|
||||||
|
Run web extension tests:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
vscode-test-web --browserType=webkit --extensionDevelopmentPath=$extensionLocation --extensionTestsPath=$extensionLocation/dist/web/test/suite/index.js
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
Via API:
|
||||||
|
|
||||||
|
```ts
|
||||||
|
async function go() {
|
||||||
|
try {
|
||||||
|
// The folder containing the Extension Manifest package.json
|
||||||
|
const extensionDevelopmentPath = path.resolve(__dirname, '../../../');
|
||||||
|
|
||||||
|
// The path to module with the test runner and tests
|
||||||
|
const extensionTestsPath = path.resolve(__dirname, './suite/index');
|
||||||
|
|
||||||
|
// Start a web server that serves VSCode in a browser, run the tests
|
||||||
|
await runTests({ browserType: 'chromium', extensionDevelopmentPath, extensionTestsPath });
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Failed to run tests');
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
go()
|
||||||
|
```
|
||||||
|
|
||||||
|
CLI options:
|
||||||
|
```
|
||||||
|
--browserType 'chromium' | 'firefox' | 'webkit': The browser to launch
|
||||||
|
--extensionDevelopmentPath path. [Optional]: A path pointing to a extension to include.
|
||||||
|
--extensionTestsPath path. [Optional]: A path to a test module to run
|
||||||
|
--folder-uri. [Optional]: The folder to open VS Code on
|
||||||
|
--version. 'insiders' (Default) | 'stable' | 'sources' [Optional]
|
||||||
|
--open-devtools. Opens the dev tools [Optional]
|
||||||
|
--headless. Whether to show the browser. Defaults to true when an extensionTestsPath is provided, otherwise false. [Optional]
|
||||||
|
```
|
||||||
|
|
||||||
|
Corrsponding options are available in the API.
|
||||||
|
|
||||||
|
|
||||||
|
## Development
|
||||||
|
|
||||||
|
- `yarn install`
|
||||||
|
- Make necessary changes in [`src`](./src)
|
||||||
|
- `yarn compile` (or `yarn watch`)
|
||||||
|
|
||||||
|
- run `yarn sample` to launch VS Code Browser with the `sample` extension bundled in this repo.
|
||||||
|
|
||||||
|
- run `yarn sample-tests` to launch VS Code Browser running the extension tests of the `sample` extension bundled in this repo.
|
||||||
|
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
[MIT](LICENSE)
|
||||||
|
|
||||||
|
## Contributing
|
||||||
|
|
||||||
|
This project welcomes contributions and suggestions. Most contributions require you to agree to a
|
||||||
|
Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
|
||||||
|
the rights to use your contribution. For details, visit https://cla.microsoft.com.
|
||||||
|
|
||||||
|
When you submit a pull request, a CLA-bot will automatically determine whether you need to provide
|
||||||
|
a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions
|
||||||
|
provided by the bot. You will only need to do this once across all repos using our CLA.
|
||||||
|
|
||||||
|
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
|
||||||
|
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or
|
||||||
|
contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
|
||||||
163
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/@vscode/test-web/out/index.js
generated
vendored
Executable file
163
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/@vscode/test-web/out/index.js
generated
vendored
Executable file
@@ -0,0 +1,163 @@
|
|||||||
|
#!/usr/bin/env node
|
||||||
|
"use strict";
|
||||||
|
/* eslint-disable header/header */
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
exports.open = exports.runTests = 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 main_1 = require("./server/main");
|
||||||
|
const download_1 = require("./server/download");
|
||||||
|
const playwright = require("playwright");
|
||||||
|
const minimist = require("minimist");
|
||||||
|
const path = require("path");
|
||||||
|
/**
|
||||||
|
* Runs the tests in a browser.
|
||||||
|
*
|
||||||
|
* @param options The options defining browser type, extension and test location.
|
||||||
|
*/
|
||||||
|
async function runTests(options) {
|
||||||
|
var _a;
|
||||||
|
const config = {
|
||||||
|
extensionDevelopmentPath: options.extensionDevelopmentPath,
|
||||||
|
extensionTestsPath: options.extensionTestsPath,
|
||||||
|
build: await getBuild(options.version),
|
||||||
|
folderUri: options.folderUri
|
||||||
|
};
|
||||||
|
const port = 3000;
|
||||||
|
const server = await main_1.runServer(port, config);
|
||||||
|
const endpoint = `http://localhost:${port}`;
|
||||||
|
const result = await openInBrowser({
|
||||||
|
browserType: options.browserType,
|
||||||
|
endpoint,
|
||||||
|
headless: (_a = options.headless) !== null && _a !== void 0 ? _a : true,
|
||||||
|
devTools: options.devTools,
|
||||||
|
waitForDebugger: options.waitForDebugger,
|
||||||
|
});
|
||||||
|
server.close();
|
||||||
|
if (result) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
throw new Error('Test failed');
|
||||||
|
}
|
||||||
|
exports.runTests = runTests;
|
||||||
|
async function getBuild(version) {
|
||||||
|
if (version === 'sources') {
|
||||||
|
return { type: 'sources' };
|
||||||
|
}
|
||||||
|
return await download_1.downloadAndUnzipVSCode(version === 'stable' ? 'stable' : 'insider');
|
||||||
|
}
|
||||||
|
async function open(options) {
|
||||||
|
var _a;
|
||||||
|
const config = {
|
||||||
|
extensionDevelopmentPath: options.extensionDevelopmentPath,
|
||||||
|
build: await getBuild(options.version),
|
||||||
|
folderUri: options.folderUri
|
||||||
|
};
|
||||||
|
const port = 3000;
|
||||||
|
await main_1.runServer(port, config);
|
||||||
|
const endpoint = `http://localhost:${port}`;
|
||||||
|
await openInBrowser({
|
||||||
|
browserType: options.browserType,
|
||||||
|
endpoint,
|
||||||
|
headless: (_a = options.headless) !== null && _a !== void 0 ? _a : false,
|
||||||
|
devTools: options.devTools
|
||||||
|
});
|
||||||
|
}
|
||||||
|
exports.open = open;
|
||||||
|
const width = 1200;
|
||||||
|
const height = 800;
|
||||||
|
function openInBrowser(options) {
|
||||||
|
return new Promise(async (s) => {
|
||||||
|
var _a;
|
||||||
|
const args = [];
|
||||||
|
if (process.platform === 'linux' && options.browserType === 'chromium') {
|
||||||
|
args.push('--no-sandbox');
|
||||||
|
}
|
||||||
|
if (options.waitForDebugger) {
|
||||||
|
args.push(`--remote-debugging-port=${options.waitForDebugger}`);
|
||||||
|
}
|
||||||
|
const browser = await playwright[options.browserType].launch({ headless: options.headless, args, devtools: options.devTools });
|
||||||
|
const context = await browser.newContext();
|
||||||
|
const page = (_a = context.pages()[0]) !== null && _a !== void 0 ? _a : await context.newPage();
|
||||||
|
if (options.waitForDebugger) {
|
||||||
|
await page.waitForFunction(() => '__jsDebugIsReady' in globalThis);
|
||||||
|
}
|
||||||
|
await page.setViewportSize({ width, height });
|
||||||
|
await page.goto(options.endpoint);
|
||||||
|
await page.exposeFunction('codeAutomationLog', (type, args) => {
|
||||||
|
console[type](...args);
|
||||||
|
});
|
||||||
|
await page.exposeFunction('codeAutomationExit', async (code) => {
|
||||||
|
try {
|
||||||
|
await browser.close();
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
console.error(`Error when closing browser: ${error}`);
|
||||||
|
}
|
||||||
|
s(code === 0);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function isStringOrUndefined(value) {
|
||||||
|
return value === undefined || (typeof value === 'string');
|
||||||
|
}
|
||||||
|
function isBooleanOrUndefined(value) {
|
||||||
|
return value === undefined || (typeof value === 'boolean');
|
||||||
|
}
|
||||||
|
function isBrowserType(browserType) {
|
||||||
|
return (typeof browserType === 'string') && ['chromium', 'firefox', 'webkit'].includes(browserType);
|
||||||
|
}
|
||||||
|
function isValidVersion(version) {
|
||||||
|
return version === undefined || ((typeof version === 'string') && ['insiders', 'stable', 'sources'].includes(version));
|
||||||
|
}
|
||||||
|
function getPortNumber(port) {
|
||||||
|
if (typeof port === 'string') {
|
||||||
|
const number = Number.parseInt(port);
|
||||||
|
if (!Number.isNaN(number) && number >= 0) {
|
||||||
|
return number;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
if (require.main === module) {
|
||||||
|
const options = { string: ['extensionDevelopmentPath', 'extensionTestsPath', 'browserType', 'version', 'waitForDebugger', 'folder-uri'], boolean: ['open-devtools', 'headless'] };
|
||||||
|
const args = minimist(process.argv.slice(2), options);
|
||||||
|
const { browserType, extensionDevelopmentPath, extensionTestsPath, version, waitForDebugger, headless } = args;
|
||||||
|
const port = getPortNumber(waitForDebugger);
|
||||||
|
if (!isBrowserType(browserType) || !isStringOrUndefined(extensionDevelopmentPath) || !isStringOrUndefined(extensionTestsPath) || !isValidVersion(version) || !isStringOrUndefined(args['folder-uri']) || !isBooleanOrUndefined(args['open-devtools']) || !isBooleanOrUndefined(headless)) {
|
||||||
|
console.log('Usage:');
|
||||||
|
console.log(` --browserType 'chromium' | 'firefox' | 'webkit': The browser to launch`);
|
||||||
|
console.log(` --extensionDevelopmentPath path. [Optional]: A path pointing to a extension to include.`);
|
||||||
|
console.log(` --extensionTestsPath path. [Optional]: A path to a test module to run`);
|
||||||
|
console.log(` --folder-uri. [Optional]: The folder to open VS Code on`);
|
||||||
|
console.log(` --version. 'insiders' (Default) | 'stable' | 'sources' [Optional]`);
|
||||||
|
console.log(` --open-devtools. Opens the dev tools [Optional]`);
|
||||||
|
console.log(` --headless. Whether to show the browser. Defaults to true when an extensionTestsPath is provided, otherwise false. [Optional]`);
|
||||||
|
process.exit(-1);
|
||||||
|
}
|
||||||
|
if (extensionTestsPath) {
|
||||||
|
runTests({
|
||||||
|
extensionTestsPath: extensionTestsPath && path.resolve(extensionTestsPath),
|
||||||
|
extensionDevelopmentPath: extensionDevelopmentPath && path.resolve(extensionDevelopmentPath),
|
||||||
|
browserType,
|
||||||
|
version,
|
||||||
|
devTools: args['open-devtools'],
|
||||||
|
waitForDebugger: port,
|
||||||
|
folderUri: args['folder-uri'],
|
||||||
|
headless
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
open({
|
||||||
|
extensionDevelopmentPath: extensionDevelopmentPath && path.resolve(extensionDevelopmentPath),
|
||||||
|
browserType,
|
||||||
|
version,
|
||||||
|
devTools: args['open-devtools'],
|
||||||
|
waitForDebugger: port,
|
||||||
|
folderUri: args['folder-uri'],
|
||||||
|
headless
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
36
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/@vscode/test-web/out/server/app.js
generated
vendored
Normal file
36
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/@vscode/test-web/out/server/app.js
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
"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 Koa = require("koa");
|
||||||
|
const morgan = require("koa-morgan");
|
||||||
|
const kstatic = require("koa-static");
|
||||||
|
const kmount = require("koa-mount");
|
||||||
|
const workbench_1 = require("./workbench");
|
||||||
|
const path = require("path");
|
||||||
|
async function createApp(config) {
|
||||||
|
const app = new Koa();
|
||||||
|
app.use(morgan('dev'));
|
||||||
|
// this is here such that the iframe worker can fetch the extension files
|
||||||
|
app.use((ctx, next) => {
|
||||||
|
ctx.set('Access-Control-Allow-Origin', '*');
|
||||||
|
return next();
|
||||||
|
});
|
||||||
|
app.use(kmount('/static', kstatic(path.join(__dirname, '../static'))));
|
||||||
|
if (config.extensionPath) {
|
||||||
|
console.log('Serving extensions from ' + config.extensionPath);
|
||||||
|
app.use(kmount('/static/extensions', kstatic(config.extensionPath)));
|
||||||
|
}
|
||||||
|
if (config.extensionDevelopmentPath) {
|
||||||
|
console.log('Serving dev extensions from ' + config.extensionDevelopmentPath);
|
||||||
|
app.use(kmount('/static/devextensions', kstatic(config.extensionDevelopmentPath)));
|
||||||
|
}
|
||||||
|
if (config.build.type === 'static') {
|
||||||
|
app.use(kmount('/static/build', kstatic(config.build.location)));
|
||||||
|
}
|
||||||
|
app.use(workbench_1.default(config));
|
||||||
|
return app;
|
||||||
|
}
|
||||||
|
exports.default = createApp;
|
||||||
151
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/@vscode/test-web/out/server/download.js
generated
vendored
Normal file
151
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/@vscode/test-web/out/server/download.js
generated
vendored
Normal file
@@ -0,0 +1,151 @@
|
|||||||
|
"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.fetchJSON = exports.fetch = exports.downloadAndUnzipVSCode = void 0;
|
||||||
|
const fs_1 = require("fs");
|
||||||
|
const path = require("path");
|
||||||
|
const https = require("https");
|
||||||
|
const http = require("http");
|
||||||
|
const createHttpsProxyAgent = require("https-proxy-agent");
|
||||||
|
const createHttpProxyAgent = require("http-proxy-agent");
|
||||||
|
const url_1 = require("url");
|
||||||
|
const decompress = require("decompress");
|
||||||
|
const decompressTargz = require("decompress-targz");
|
||||||
|
const extensionRoot = process.cwd();
|
||||||
|
const vscodeTestDir = path.resolve(extensionRoot, '.vscode-test-web');
|
||||||
|
async function getLatestVersion(quality) {
|
||||||
|
const update = await fetchJSON(`https://update.code.visualstudio.com/api/update/web-standalone/${quality}/latest`);
|
||||||
|
return update;
|
||||||
|
}
|
||||||
|
const reset = '\x1b[G\x1b[0K';
|
||||||
|
async function download(downloadUrl, destination, message) {
|
||||||
|
process.stdout.write(message);
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
const httpLibrary = downloadUrl.startsWith('https') ? https : http;
|
||||||
|
httpLibrary.get(downloadUrl, getAgent(downloadUrl), res => {
|
||||||
|
const total = Number(res.headers['content-length']);
|
||||||
|
let received = 0;
|
||||||
|
let timeout;
|
||||||
|
const outStream = fs_1.createWriteStream(destination);
|
||||||
|
outStream.on('close', () => resolve(destination));
|
||||||
|
outStream.on('error', reject);
|
||||||
|
res.on('data', chunk => {
|
||||||
|
if (!timeout) {
|
||||||
|
timeout = setTimeout(() => {
|
||||||
|
process.stdout.write(`${reset}${message}: ${received}/${total} (${(received / total * 100).toFixed()}%)`);
|
||||||
|
timeout = undefined;
|
||||||
|
}, 100);
|
||||||
|
}
|
||||||
|
received += chunk.length;
|
||||||
|
});
|
||||||
|
res.on('end', () => {
|
||||||
|
if (timeout) {
|
||||||
|
clearTimeout(timeout);
|
||||||
|
}
|
||||||
|
process.stdout.write(`${reset}${message}: complete\n`);
|
||||||
|
});
|
||||||
|
res.on('error', reject);
|
||||||
|
res.pipe(outStream);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
async function unzip(source, destination, message) {
|
||||||
|
process.stdout.write(message);
|
||||||
|
if (!fs_1.existsSync(destination)) {
|
||||||
|
await fs_1.promises.mkdir(destination, { recursive: true });
|
||||||
|
}
|
||||||
|
await decompress(source, destination, {
|
||||||
|
plugins: [
|
||||||
|
decompressTargz()
|
||||||
|
],
|
||||||
|
strip: 1
|
||||||
|
});
|
||||||
|
process.stdout.write(`${reset}${message}: complete\n`);
|
||||||
|
}
|
||||||
|
async function downloadAndUnzipVSCode(quality) {
|
||||||
|
const info = await getLatestVersion(quality);
|
||||||
|
const folderName = `vscode-web-${quality}-${info.version}`;
|
||||||
|
const downloadedPath = path.resolve(vscodeTestDir, folderName);
|
||||||
|
if (fs_1.existsSync(downloadedPath) && fs_1.existsSync(path.join(downloadedPath, 'version'))) {
|
||||||
|
return { type: 'static', location: downloadedPath };
|
||||||
|
}
|
||||||
|
if (fs_1.existsSync(vscodeTestDir)) {
|
||||||
|
await fs_1.promises.rmdir(vscodeTestDir, { recursive: true, maxRetries: 5 });
|
||||||
|
}
|
||||||
|
await fs_1.promises.mkdir(vscodeTestDir, { recursive: true });
|
||||||
|
const productName = `VS Code ${quality === 'stable' ? 'Stable' : 'Insiders'}`;
|
||||||
|
const tmpArchiveName = `vscode-web-${quality}-${info.version}-tmp`;
|
||||||
|
try {
|
||||||
|
await download(info.url, tmpArchiveName, `Downloading ${productName}`);
|
||||||
|
await unzip(tmpArchiveName, downloadedPath, `Unpacking ${productName}`);
|
||||||
|
await fs_1.promises.writeFile(path.join(downloadedPath, 'version'), folderName);
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
console.error(err);
|
||||||
|
throw Error(`Failed to download and unpack ${productName}`);
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
try {
|
||||||
|
fs_1.promises.unlink(tmpArchiveName);
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
// ignore
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return { type: 'static', location: downloadedPath };
|
||||||
|
}
|
||||||
|
exports.downloadAndUnzipVSCode = downloadAndUnzipVSCode;
|
||||||
|
async function fetch(api) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
const httpLibrary = api.startsWith('https') ? https : http;
|
||||||
|
httpLibrary.get(api, getAgent(api), res => {
|
||||||
|
if (res.statusCode !== 200) {
|
||||||
|
reject('Failed to get content from ');
|
||||||
|
}
|
||||||
|
let data = '';
|
||||||
|
res.on('data', chunk => {
|
||||||
|
data += chunk;
|
||||||
|
});
|
||||||
|
res.on('end', () => {
|
||||||
|
resolve(data);
|
||||||
|
});
|
||||||
|
res.on('error', err => {
|
||||||
|
reject(err);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
exports.fetch = fetch;
|
||||||
|
async function fetchJSON(api) {
|
||||||
|
const data = await fetch(api);
|
||||||
|
try {
|
||||||
|
return JSON.parse(data);
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
throw new Error(`Failed to parse response from ${api}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.fetchJSON = fetchJSON;
|
||||||
|
let PROXY_AGENT = undefined;
|
||||||
|
let HTTPS_PROXY_AGENT = undefined;
|
||||||
|
if (process.env.npm_config_proxy) {
|
||||||
|
PROXY_AGENT = createHttpProxyAgent(process.env.npm_config_proxy);
|
||||||
|
HTTPS_PROXY_AGENT = createHttpsProxyAgent(process.env.npm_config_proxy);
|
||||||
|
}
|
||||||
|
if (process.env.npm_config_https_proxy) {
|
||||||
|
HTTPS_PROXY_AGENT = createHttpsProxyAgent(process.env.npm_config_https_proxy);
|
||||||
|
}
|
||||||
|
function getAgent(url) {
|
||||||
|
const parsed = new url_1.URL(url);
|
||||||
|
const options = {};
|
||||||
|
if (PROXY_AGENT && parsed.protocol.startsWith('http:')) {
|
||||||
|
options.agent = PROXY_AGENT;
|
||||||
|
}
|
||||||
|
if (HTTPS_PROXY_AGENT && parsed.protocol.startsWith('https:')) {
|
||||||
|
options.agent = HTTPS_PROXY_AGENT;
|
||||||
|
}
|
||||||
|
return options;
|
||||||
|
}
|
||||||
45
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/@vscode/test-web/out/server/extensions.js
generated
vendored
Normal file
45
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/@vscode/test-web/out/server/extensions.js
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
"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.scanForExtensions = void 0;
|
||||||
|
const fs_1 = require("fs");
|
||||||
|
const path = require("path");
|
||||||
|
async function scanForExtensions(rootPath, serverURI) {
|
||||||
|
const result = [];
|
||||||
|
async function getExtension(relativePosixFolderPath) {
|
||||||
|
try {
|
||||||
|
const packageJSONPath = path.join(rootPath, relativePosixFolderPath, 'package.json');
|
||||||
|
if ((await fs_1.promises.stat(packageJSONPath)).isFile()) {
|
||||||
|
return {
|
||||||
|
scheme: serverURI.scheme,
|
||||||
|
authority: serverURI.authority,
|
||||||
|
path: path.posix.join(serverURI.path, relativePosixFolderPath),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
async function processFolder(relativePosixFolderPath) {
|
||||||
|
const extension = await getExtension(relativePosixFolderPath);
|
||||||
|
if (extension) {
|
||||||
|
result.push(extension);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
const folderPath = path.join(rootPath, relativePosixFolderPath);
|
||||||
|
const entries = await fs_1.promises.readdir(folderPath, { withFileTypes: true });
|
||||||
|
for (const entry of entries) {
|
||||||
|
if (entry.isDirectory() && entry.name.charAt(0) !== '.') {
|
||||||
|
await processFolder(path.posix.join(relativePosixFolderPath, entry.name));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
await processFolder('');
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
exports.scanForExtensions = scanForExtensions;
|
||||||
15
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/@vscode/test-web/out/server/main.js
generated
vendored
Normal file
15
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/@vscode/test-web/out/server/main.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
"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.runServer = void 0;
|
||||||
|
const app_1 = require("./app");
|
||||||
|
async function runServer(port, config) {
|
||||||
|
const app = await app_1.default(config);
|
||||||
|
const server = app.listen(port);
|
||||||
|
console.log(`Listening on http://localhost:${port}`);
|
||||||
|
return server;
|
||||||
|
}
|
||||||
|
exports.runServer = runServer;
|
||||||
138
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/@vscode/test-web/out/server/workbench.js
generated
vendored
Normal file
138
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/@vscode/test-web/out/server/workbench.js
generated
vendored
Normal file
@@ -0,0 +1,138 @@
|
|||||||
|
"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 path = require("path");
|
||||||
|
const fs_1 = require("fs");
|
||||||
|
const vscode_uri_1 = require("vscode-uri");
|
||||||
|
const Router = require("@koa/router");
|
||||||
|
const extensions_1 = require("./extensions");
|
||||||
|
const download_1 = require("./download");
|
||||||
|
function asJSON(value) {
|
||||||
|
return JSON.stringify(value).replace(/"/g, '"');
|
||||||
|
}
|
||||||
|
class Workbench {
|
||||||
|
constructor(baseUrl, dev, builtInExtensions = []) {
|
||||||
|
this.baseUrl = baseUrl;
|
||||||
|
this.dev = dev;
|
||||||
|
this.builtInExtensions = builtInExtensions;
|
||||||
|
}
|
||||||
|
async render(workbenchWebConfiguration) {
|
||||||
|
const values = {
|
||||||
|
WORKBENCH_WEB_CONFIGURATION: asJSON(workbenchWebConfiguration),
|
||||||
|
WORKBENCH_AUTH_SESSION: '',
|
||||||
|
WORKBENCH_WEB_BASE_URL: this.baseUrl,
|
||||||
|
WORKBENCH_BUILTIN_EXTENSIONS: asJSON(this.builtInExtensions),
|
||||||
|
WORKBENCH_MAIN: this.getMain()
|
||||||
|
};
|
||||||
|
try {
|
||||||
|
const workbenchTemplate = (await fs_1.promises.readFile(path.resolve(__dirname, '../../views/workbench.html'))).toString();
|
||||||
|
return workbenchTemplate.replace(/\{\{([^}]+)\}\}/g, (_, key) => { var _a; return (_a = values[key]) !== null && _a !== void 0 ? _a : 'undefined'; });
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
return e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
getMain() {
|
||||||
|
return this.dev
|
||||||
|
? `<script> require(['vs/code/browser/workbench/workbench'], function() {}); </script>`
|
||||||
|
: `<script src="${this.baseUrl}/out/vs/workbench/workbench.web.api.nls.js"></script>`
|
||||||
|
+ `<script src="${this.baseUrl}/out/vs/workbench/workbench.web.api.js"></script>`
|
||||||
|
+ `<script src="${this.baseUrl}/out/vs/code/browser/workbench/workbench.js"></script>`;
|
||||||
|
}
|
||||||
|
async renderCallback() {
|
||||||
|
return await download_1.fetch(`${this.baseUrl}/out/vs/code/browser/workbench/callback.html`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function valueOrFirst(value) {
|
||||||
|
return Array.isArray(value) ? value[0] : value;
|
||||||
|
}
|
||||||
|
async function getWorkbenchOptions(ctx, config) {
|
||||||
|
const options = {};
|
||||||
|
if (config.extensionPath) {
|
||||||
|
options.additionalBuiltinExtensions = await extensions_1.scanForExtensions(config.extensionPath, {
|
||||||
|
scheme: ctx.protocol,
|
||||||
|
authority: ctx.host,
|
||||||
|
path: '/static/extensions',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (config.extensionDevelopmentPath) {
|
||||||
|
const developmentOptions = options.developmentOptions = {};
|
||||||
|
developmentOptions.extensions = await extensions_1.scanForExtensions(config.extensionDevelopmentPath, { scheme: ctx.protocol, authority: ctx.host, path: '/static/devextensions' });
|
||||||
|
if (config.extensionTestsPath) {
|
||||||
|
let relativePath = path.relative(config.extensionDevelopmentPath, config.extensionTestsPath);
|
||||||
|
if (process.platform === 'win32') {
|
||||||
|
relativePath = relativePath.replace(/\\/g, '/');
|
||||||
|
}
|
||||||
|
developmentOptions.extensionTestsPath = {
|
||||||
|
scheme: ctx.protocol,
|
||||||
|
authority: ctx.host,
|
||||||
|
path: path.posix.join('/static/devextensions', relativePath),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (config.folderUri) {
|
||||||
|
options.folderUri = vscode_uri_1.URI.parse(config.folderUri);
|
||||||
|
}
|
||||||
|
return options;
|
||||||
|
}
|
||||||
|
function default_1(config) {
|
||||||
|
const router = new Router();
|
||||||
|
router.use(async (ctx, next) => {
|
||||||
|
if (ctx.query['dev'] || config.build.type === 'sources') {
|
||||||
|
try {
|
||||||
|
const builtInExtensions = await download_1.fetchJSON('http://localhost:8080/builtin');
|
||||||
|
ctx.state.workbench = new Workbench('http://localhost:8080/static', true, builtInExtensions);
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
console.log(err);
|
||||||
|
ctx.throw('Could not connect to localhost:8080, make sure you start `yarn web`', 400);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (config.build.type === 'static') {
|
||||||
|
ctx.state.workbench = new Workbench(`${ctx.protocol}://${ctx.host}/static/build`, false);
|
||||||
|
}
|
||||||
|
else if (config.build.type === 'cdn') {
|
||||||
|
ctx.state.workbench = new Workbench(config.build.uri, false);
|
||||||
|
}
|
||||||
|
await next();
|
||||||
|
});
|
||||||
|
const callbacks = new Map();
|
||||||
|
router.get('/callback', async (ctx) => {
|
||||||
|
const { 'vscode-requestId': vscodeRequestId, 'vscode-scheme': vscodeScheme, 'vscode-authority': vscodeAuthority, 'vscode-path': vscodePath, 'vscode-query': vscodeQuery, 'vscode-fragment': vscodeFragment, } = ctx.query;
|
||||||
|
if (!vscodeRequestId || !vscodeScheme || !vscodeAuthority) {
|
||||||
|
return ctx.throw(400);
|
||||||
|
}
|
||||||
|
const requestId = valueOrFirst(vscodeRequestId);
|
||||||
|
const uri = vscode_uri_1.URI.from({
|
||||||
|
scheme: valueOrFirst(vscodeScheme),
|
||||||
|
authority: valueOrFirst(vscodeAuthority),
|
||||||
|
path: valueOrFirst(vscodePath),
|
||||||
|
query: valueOrFirst(vscodeQuery),
|
||||||
|
fragment: valueOrFirst(vscodeFragment),
|
||||||
|
});
|
||||||
|
callbacks.set(requestId, uri);
|
||||||
|
ctx.body = await ctx.state.workbench.renderCallback();
|
||||||
|
});
|
||||||
|
router.get('/fetch-callback', async (ctx) => {
|
||||||
|
const { 'vscode-requestId': vscodeRequestId } = ctx.query;
|
||||||
|
if (!vscodeRequestId) {
|
||||||
|
return ctx.throw(400);
|
||||||
|
}
|
||||||
|
const requestId = valueOrFirst(vscodeRequestId);
|
||||||
|
const uri = callbacks.get(requestId);
|
||||||
|
if (!uri) {
|
||||||
|
return ctx.throw(400);
|
||||||
|
}
|
||||||
|
callbacks.delete(requestId);
|
||||||
|
ctx.body = uri.toJSON();
|
||||||
|
});
|
||||||
|
router.get('/', async (ctx) => {
|
||||||
|
const options = await getWorkbenchOptions(ctx, config);
|
||||||
|
ctx.body = await ctx.state.workbench.render(options);
|
||||||
|
});
|
||||||
|
return router.routes();
|
||||||
|
}
|
||||||
|
exports.default = default_1;
|
||||||
93
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/@vscode/test-web/package.json
generated
vendored
Normal file
93
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/@vscode/test-web/package.json
generated
vendored
Normal file
@@ -0,0 +1,93 @@
|
|||||||
|
{
|
||||||
|
"_args": [
|
||||||
|
[
|
||||||
|
"@vscode/test-web@0.0.8",
|
||||||
|
"/tmp/repository/main"
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"_from": "@vscode/test-web@0.0.8",
|
||||||
|
"_id": "@vscode/test-web@0.0.8",
|
||||||
|
"_inBundle": false,
|
||||||
|
"_integrity": "sha512-8VEKJ1s8Fo0oRFV/yLrgMv1bFuhS4PGodMR73FnTn6dzlNrV9g7mFrUsm+YyqqzdTUdo+7fahWS/qw0l/64e+w==",
|
||||||
|
"_location": "/@vscode/test-web",
|
||||||
|
"_phantomChildren": {},
|
||||||
|
"_requested": {
|
||||||
|
"type": "version",
|
||||||
|
"registry": true,
|
||||||
|
"raw": "@vscode/test-web@0.0.8",
|
||||||
|
"name": "@vscode/test-web",
|
||||||
|
"escapedName": "@vscode%2ftest-web",
|
||||||
|
"scope": "@vscode",
|
||||||
|
"rawSpec": "0.0.8",
|
||||||
|
"saveSpec": null,
|
||||||
|
"fetchSpec": "0.0.8"
|
||||||
|
},
|
||||||
|
"_requiredBy": [
|
||||||
|
"/"
|
||||||
|
],
|
||||||
|
"_resolved": "https://registry.npmjs.org/@vscode/test-web/-/test-web-0.0.8.tgz",
|
||||||
|
"_spec": "0.0.8",
|
||||||
|
"_where": "/tmp/repository/main",
|
||||||
|
"author": {
|
||||||
|
"name": "Visual Studio Code Team"
|
||||||
|
},
|
||||||
|
"bin": {
|
||||||
|
"vscode-test-web": "out/index.js"
|
||||||
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/Microsoft/vscode-test-web/issues"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@koa/router": "^10.0.0",
|
||||||
|
"decompress": "^4.2.1",
|
||||||
|
"decompress-targz": "^4.1.1",
|
||||||
|
"http-proxy-agent": "^4.0.1",
|
||||||
|
"https-proxy-agent": "^5.0.0",
|
||||||
|
"koa": "^2.13.1",
|
||||||
|
"koa-morgan": "^1.0.1",
|
||||||
|
"koa-mount": "^4.0.0",
|
||||||
|
"koa-static": "^5.0.0",
|
||||||
|
"minimist": "^1.2.5",
|
||||||
|
"playwright": "^1.12.2",
|
||||||
|
"vscode-uri": "^3.0.2"
|
||||||
|
},
|
||||||
|
"description": "",
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/decompress": "^4.2.3",
|
||||||
|
"@types/koa": "^2.13.1",
|
||||||
|
"@types/koa-morgan": "^1.0.4",
|
||||||
|
"@types/koa-mount": "^4.0.0",
|
||||||
|
"@types/koa-static": "^4.0.1",
|
||||||
|
"@types/koa__router": "^8.0.4",
|
||||||
|
"@types/minimist": "^1.2.1",
|
||||||
|
"@types/node": "^12.19.9",
|
||||||
|
"@typescript-eslint/eslint-plugin": "^4.13.0",
|
||||||
|
"@typescript-eslint/parser": "^4.13.0",
|
||||||
|
"eslint": "^7.17.0",
|
||||||
|
"eslint-plugin-header": "^3.1.0",
|
||||||
|
"typescript": "^4.1.3"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8.9.3"
|
||||||
|
},
|
||||||
|
"homepage": "https://github.com/Microsoft/vscode-test-web#readme",
|
||||||
|
"license": "MIT",
|
||||||
|
"main": "./out/index.js",
|
||||||
|
"name": "@vscode/test-web",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/Microsoft/vscode-test-web.git"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"compile": "tsc -p ./",
|
||||||
|
"compile-sample": "yarn --cwd=sample compile-web",
|
||||||
|
"postversion": "git push && git push --tags",
|
||||||
|
"prepublishOnly": "tsc -p ./",
|
||||||
|
"preversion": "npm test",
|
||||||
|
"sample": "npm run compile && npm run compile-sample && node . --extensionDevelopmentPath=sample --browserType=chromium",
|
||||||
|
"sample-tests": "npm run compile && npm run compile-sample && node . --extensionDevelopmentPath=sample --extensionTestsPath=sample/dist/web/test/suite/index.js --browserType=chromium",
|
||||||
|
"test": "eslint src --ext ts && tsc --noEmit",
|
||||||
|
"watch": "tsc -w -p ./"
|
||||||
|
},
|
||||||
|
"version": "0.0.8"
|
||||||
|
}
|
||||||
57
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/@vscode/test-web/views/workbench.html
generated
vendored
Normal file
57
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/@vscode/test-web/views/workbench.html
generated
vendored
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
<!-- Copyright (C) Microsoft Corporation. All rights reserved. -->
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<script>
|
||||||
|
performance.mark('code/didStartRenderer')
|
||||||
|
</script>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
|
||||||
|
<!-- Disable pinch zooming -->
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
|
||||||
|
|
||||||
|
<!-- Workbench Configuration -->
|
||||||
|
<meta id="vscode-workbench-web-configuration" data-settings="{{WORKBENCH_WEB_CONFIGURATION}}">
|
||||||
|
|
||||||
|
<!-- Workbench Auth Session -->
|
||||||
|
<meta id="vscode-workbench-auth-session" data-settings="{{WORKBENCH_AUTH_SESSION}}">
|
||||||
|
|
||||||
|
<!-- Builtin Extensions (running out of sources) -->
|
||||||
|
<meta id="vscode-workbench-builtin-extensions" data-settings="{{WORKBENCH_BUILTIN_EXTENSIONS}}">
|
||||||
|
|
||||||
|
<!-- Workbench Icon/Manifest/CSS -->
|
||||||
|
<link rel="icon" href="{{WORKBENCH_WEB_BASE_URL}}/favicon.ico" type="image/x-icon" />
|
||||||
|
<link rel="manifest" href="{{WORKBENCH_WEB_BASE_URL}}/manifest.json">
|
||||||
|
<link data-name="vs/workbench/workbench.web.api" rel="stylesheet" href="{{WORKBENCH_WEB_BASE_URL}}/out/vs/workbench/workbench.web.api.css" />
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body aria-label="">
|
||||||
|
</body>
|
||||||
|
|
||||||
|
<!-- Startup (do not modify order of script tags!) -->
|
||||||
|
<script src="{{WORKBENCH_WEB_BASE_URL}}/out/vs/loader.js"></script>
|
||||||
|
<script src="{{WORKBENCH_WEB_BASE_URL}}/out/vs/webPackagePaths.js"></script>
|
||||||
|
<script>
|
||||||
|
let baseUrl = '{{WORKBENCH_WEB_BASE_URL}}';
|
||||||
|
Object.keys(self.webPackagePaths).map(function (key, index) {
|
||||||
|
self.webPackagePaths[key] = `${baseUrl}/node_modules/${key}/${self.webPackagePaths[key]}`;
|
||||||
|
});
|
||||||
|
require.config({
|
||||||
|
baseUrl: `${baseUrl}/out`,
|
||||||
|
recordStats: true,
|
||||||
|
trustedTypesPolicy: window.trustedTypes?.createPolicy('amdLoader', {
|
||||||
|
createScriptURL(value) {
|
||||||
|
if (value.startsWith(baseUrl)) {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
throw new Error(`Invalid script url: ${value}`)
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
paths: self.webPackagePaths
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<script>
|
||||||
|
performance.mark('code/willLoadWorkbenchMain');
|
||||||
|
</script>
|
||||||
|
{{WORKBENCH_MAIN}}
|
||||||
|
</html>
|
||||||
236
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/accepts/HISTORY.md
generated
vendored
Normal file
236
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/accepts/HISTORY.md
generated
vendored
Normal file
@@ -0,0 +1,236 @@
|
|||||||
|
1.3.7 / 2019-04-29
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: negotiator@0.6.2
|
||||||
|
- Fix sorting charset, encoding, and language with extra parameters
|
||||||
|
|
||||||
|
1.3.6 / 2019-04-28
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: mime-types@~2.1.24
|
||||||
|
- deps: mime-db@~1.40.0
|
||||||
|
|
||||||
|
1.3.5 / 2018-02-28
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: mime-types@~2.1.18
|
||||||
|
- deps: mime-db@~1.33.0
|
||||||
|
|
||||||
|
1.3.4 / 2017-08-22
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: mime-types@~2.1.16
|
||||||
|
- deps: mime-db@~1.29.0
|
||||||
|
|
||||||
|
1.3.3 / 2016-05-02
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: mime-types@~2.1.11
|
||||||
|
- deps: mime-db@~1.23.0
|
||||||
|
* deps: negotiator@0.6.1
|
||||||
|
- perf: improve `Accept` parsing speed
|
||||||
|
- perf: improve `Accept-Charset` parsing speed
|
||||||
|
- perf: improve `Accept-Encoding` parsing speed
|
||||||
|
- perf: improve `Accept-Language` parsing speed
|
||||||
|
|
||||||
|
1.3.2 / 2016-03-08
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: mime-types@~2.1.10
|
||||||
|
- Fix extension of `application/dash+xml`
|
||||||
|
- Update primary extension for `audio/mp4`
|
||||||
|
- deps: mime-db@~1.22.0
|
||||||
|
|
||||||
|
1.3.1 / 2016-01-19
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: mime-types@~2.1.9
|
||||||
|
- deps: mime-db@~1.21.0
|
||||||
|
|
||||||
|
1.3.0 / 2015-09-29
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: mime-types@~2.1.7
|
||||||
|
- deps: mime-db@~1.19.0
|
||||||
|
* deps: negotiator@0.6.0
|
||||||
|
- Fix including type extensions in parameters in `Accept` parsing
|
||||||
|
- Fix parsing `Accept` parameters with quoted equals
|
||||||
|
- Fix parsing `Accept` parameters with quoted semicolons
|
||||||
|
- Lazy-load modules from main entry point
|
||||||
|
- perf: delay type concatenation until needed
|
||||||
|
- perf: enable strict mode
|
||||||
|
- perf: hoist regular expressions
|
||||||
|
- perf: remove closures getting spec properties
|
||||||
|
- perf: remove a closure from media type parsing
|
||||||
|
- perf: remove property delete from media type parsing
|
||||||
|
|
||||||
|
1.2.13 / 2015-09-06
|
||||||
|
===================
|
||||||
|
|
||||||
|
* deps: mime-types@~2.1.6
|
||||||
|
- deps: mime-db@~1.18.0
|
||||||
|
|
||||||
|
1.2.12 / 2015-07-30
|
||||||
|
===================
|
||||||
|
|
||||||
|
* deps: mime-types@~2.1.4
|
||||||
|
- deps: mime-db@~1.16.0
|
||||||
|
|
||||||
|
1.2.11 / 2015-07-16
|
||||||
|
===================
|
||||||
|
|
||||||
|
* deps: mime-types@~2.1.3
|
||||||
|
- deps: mime-db@~1.15.0
|
||||||
|
|
||||||
|
1.2.10 / 2015-07-01
|
||||||
|
===================
|
||||||
|
|
||||||
|
* deps: mime-types@~2.1.2
|
||||||
|
- deps: mime-db@~1.14.0
|
||||||
|
|
||||||
|
1.2.9 / 2015-06-08
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: mime-types@~2.1.1
|
||||||
|
- perf: fix deopt during mapping
|
||||||
|
|
||||||
|
1.2.8 / 2015-06-07
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: mime-types@~2.1.0
|
||||||
|
- deps: mime-db@~1.13.0
|
||||||
|
* perf: avoid argument reassignment & argument slice
|
||||||
|
* perf: avoid negotiator recursive construction
|
||||||
|
* perf: enable strict mode
|
||||||
|
* perf: remove unnecessary bitwise operator
|
||||||
|
|
||||||
|
1.2.7 / 2015-05-10
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: negotiator@0.5.3
|
||||||
|
- Fix media type parameter matching to be case-insensitive
|
||||||
|
|
||||||
|
1.2.6 / 2015-05-07
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: mime-types@~2.0.11
|
||||||
|
- deps: mime-db@~1.9.1
|
||||||
|
* deps: negotiator@0.5.2
|
||||||
|
- Fix comparing media types with quoted values
|
||||||
|
- Fix splitting media types with quoted commas
|
||||||
|
|
||||||
|
1.2.5 / 2015-03-13
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: mime-types@~2.0.10
|
||||||
|
- deps: mime-db@~1.8.0
|
||||||
|
|
||||||
|
1.2.4 / 2015-02-14
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Support Node.js 0.6
|
||||||
|
* deps: mime-types@~2.0.9
|
||||||
|
- deps: mime-db@~1.7.0
|
||||||
|
* deps: negotiator@0.5.1
|
||||||
|
- Fix preference sorting to be stable for long acceptable lists
|
||||||
|
|
||||||
|
1.2.3 / 2015-01-31
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: mime-types@~2.0.8
|
||||||
|
- deps: mime-db@~1.6.0
|
||||||
|
|
||||||
|
1.2.2 / 2014-12-30
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: mime-types@~2.0.7
|
||||||
|
- deps: mime-db@~1.5.0
|
||||||
|
|
||||||
|
1.2.1 / 2014-12-30
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: mime-types@~2.0.5
|
||||||
|
- deps: mime-db@~1.3.1
|
||||||
|
|
||||||
|
1.2.0 / 2014-12-19
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: negotiator@0.5.0
|
||||||
|
- Fix list return order when large accepted list
|
||||||
|
- Fix missing identity encoding when q=0 exists
|
||||||
|
- Remove dynamic building of Negotiator class
|
||||||
|
|
||||||
|
1.1.4 / 2014-12-10
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: mime-types@~2.0.4
|
||||||
|
- deps: mime-db@~1.3.0
|
||||||
|
|
||||||
|
1.1.3 / 2014-11-09
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: mime-types@~2.0.3
|
||||||
|
- deps: mime-db@~1.2.0
|
||||||
|
|
||||||
|
1.1.2 / 2014-10-14
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: negotiator@0.4.9
|
||||||
|
- Fix error when media type has invalid parameter
|
||||||
|
|
||||||
|
1.1.1 / 2014-09-28
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: mime-types@~2.0.2
|
||||||
|
- deps: mime-db@~1.1.0
|
||||||
|
* deps: negotiator@0.4.8
|
||||||
|
- Fix all negotiations to be case-insensitive
|
||||||
|
- Stable sort preferences of same quality according to client order
|
||||||
|
|
||||||
|
1.1.0 / 2014-09-02
|
||||||
|
==================
|
||||||
|
|
||||||
|
* update `mime-types`
|
||||||
|
|
||||||
|
1.0.7 / 2014-07-04
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Fix wrong type returned from `type` when match after unknown extension
|
||||||
|
|
||||||
|
1.0.6 / 2014-06-24
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: negotiator@0.4.7
|
||||||
|
|
||||||
|
1.0.5 / 2014-06-20
|
||||||
|
==================
|
||||||
|
|
||||||
|
* fix crash when unknown extension given
|
||||||
|
|
||||||
|
1.0.4 / 2014-06-19
|
||||||
|
==================
|
||||||
|
|
||||||
|
* use `mime-types`
|
||||||
|
|
||||||
|
1.0.3 / 2014-06-11
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: negotiator@0.4.6
|
||||||
|
- Order by specificity when quality is the same
|
||||||
|
|
||||||
|
1.0.2 / 2014-05-29
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Fix interpretation when header not in request
|
||||||
|
* deps: pin negotiator@0.4.5
|
||||||
|
|
||||||
|
1.0.1 / 2014-01-18
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Identity encoding isn't always acceptable
|
||||||
|
* deps: negotiator@~0.4.0
|
||||||
|
|
||||||
|
1.0.0 / 2013-12-27
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Genesis
|
||||||
23
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/accepts/LICENSE
generated
vendored
Normal file
23
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/accepts/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
(The MIT License)
|
||||||
|
|
||||||
|
Copyright (c) 2014 Jonathan Ong <me@jongleberry.com>
|
||||||
|
Copyright (c) 2015 Douglas Christopher Wilson <doug@somethingdoug.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.
|
||||||
142
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/accepts/README.md
generated
vendored
Normal file
142
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/accepts/README.md
generated
vendored
Normal file
@@ -0,0 +1,142 @@
|
|||||||
|
# accepts
|
||||||
|
|
||||||
|
[![NPM Version][npm-version-image]][npm-url]
|
||||||
|
[![NPM Downloads][npm-downloads-image]][npm-url]
|
||||||
|
[![Node.js Version][node-version-image]][node-version-url]
|
||||||
|
[![Build Status][travis-image]][travis-url]
|
||||||
|
[![Test Coverage][coveralls-image]][coveralls-url]
|
||||||
|
|
||||||
|
Higher level content negotiation based on [negotiator](https://www.npmjs.com/package/negotiator).
|
||||||
|
Extracted from [koa](https://www.npmjs.com/package/koa) for general use.
|
||||||
|
|
||||||
|
In addition to negotiator, it allows:
|
||||||
|
|
||||||
|
- Allows types as an array or arguments list, ie `(['text/html', 'application/json'])`
|
||||||
|
as well as `('text/html', 'application/json')`.
|
||||||
|
- Allows type shorthands such as `json`.
|
||||||
|
- Returns `false` when no types match
|
||||||
|
- Treats non-existent headers as `*`
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
This is a [Node.js](https://nodejs.org/en/) module available through the
|
||||||
|
[npm registry](https://www.npmjs.com/). Installation is done using the
|
||||||
|
[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):
|
||||||
|
|
||||||
|
```sh
|
||||||
|
$ npm install accepts
|
||||||
|
```
|
||||||
|
|
||||||
|
## API
|
||||||
|
|
||||||
|
<!-- eslint-disable no-unused-vars -->
|
||||||
|
|
||||||
|
```js
|
||||||
|
var accepts = require('accepts')
|
||||||
|
```
|
||||||
|
|
||||||
|
### accepts(req)
|
||||||
|
|
||||||
|
Create a new `Accepts` object for the given `req`.
|
||||||
|
|
||||||
|
#### .charset(charsets)
|
||||||
|
|
||||||
|
Return the first accepted charset. If nothing in `charsets` is accepted,
|
||||||
|
then `false` is returned.
|
||||||
|
|
||||||
|
#### .charsets()
|
||||||
|
|
||||||
|
Return the charsets that the request accepts, in the order of the client's
|
||||||
|
preference (most preferred first).
|
||||||
|
|
||||||
|
#### .encoding(encodings)
|
||||||
|
|
||||||
|
Return the first accepted encoding. If nothing in `encodings` is accepted,
|
||||||
|
then `false` is returned.
|
||||||
|
|
||||||
|
#### .encodings()
|
||||||
|
|
||||||
|
Return the encodings that the request accepts, in the order of the client's
|
||||||
|
preference (most preferred first).
|
||||||
|
|
||||||
|
#### .language(languages)
|
||||||
|
|
||||||
|
Return the first accepted language. If nothing in `languages` is accepted,
|
||||||
|
then `false` is returned.
|
||||||
|
|
||||||
|
#### .languages()
|
||||||
|
|
||||||
|
Return the languages that the request accepts, in the order of the client's
|
||||||
|
preference (most preferred first).
|
||||||
|
|
||||||
|
#### .type(types)
|
||||||
|
|
||||||
|
Return the first accepted type (and it is returned as the same text as what
|
||||||
|
appears in the `types` array). If nothing in `types` is accepted, then `false`
|
||||||
|
is returned.
|
||||||
|
|
||||||
|
The `types` array can contain full MIME types or file extensions. Any value
|
||||||
|
that is not a full MIME types is passed to `require('mime-types').lookup`.
|
||||||
|
|
||||||
|
#### .types()
|
||||||
|
|
||||||
|
Return the types that the request accepts, in the order of the client's
|
||||||
|
preference (most preferred first).
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
### Simple type negotiation
|
||||||
|
|
||||||
|
This simple example shows how to use `accepts` to return a different typed
|
||||||
|
respond body based on what the client wants to accept. The server lists it's
|
||||||
|
preferences in order and will get back the best match between the client and
|
||||||
|
server.
|
||||||
|
|
||||||
|
```js
|
||||||
|
var accepts = require('accepts')
|
||||||
|
var http = require('http')
|
||||||
|
|
||||||
|
function app (req, res) {
|
||||||
|
var accept = accepts(req)
|
||||||
|
|
||||||
|
// the order of this list is significant; should be server preferred order
|
||||||
|
switch (accept.type(['json', 'html'])) {
|
||||||
|
case 'json':
|
||||||
|
res.setHeader('Content-Type', 'application/json')
|
||||||
|
res.write('{"hello":"world!"}')
|
||||||
|
break
|
||||||
|
case 'html':
|
||||||
|
res.setHeader('Content-Type', 'text/html')
|
||||||
|
res.write('<b>hello, world!</b>')
|
||||||
|
break
|
||||||
|
default:
|
||||||
|
// the fallback is text/plain, so no need to specify it above
|
||||||
|
res.setHeader('Content-Type', 'text/plain')
|
||||||
|
res.write('hello, world!')
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
res.end()
|
||||||
|
}
|
||||||
|
|
||||||
|
http.createServer(app).listen(3000)
|
||||||
|
```
|
||||||
|
|
||||||
|
You can test this out with the cURL program:
|
||||||
|
```sh
|
||||||
|
curl -I -H'Accept: text/html' http://localhost:3000/
|
||||||
|
```
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
[MIT](LICENSE)
|
||||||
|
|
||||||
|
[coveralls-image]: https://badgen.net/coveralls/c/github/jshttp/accepts/master
|
||||||
|
[coveralls-url]: https://coveralls.io/r/jshttp/accepts?branch=master
|
||||||
|
[node-version-image]: https://badgen.net/npm/node/accepts
|
||||||
|
[node-version-url]: https://nodejs.org/en/download
|
||||||
|
[npm-downloads-image]: https://badgen.net/npm/dm/accepts
|
||||||
|
[npm-url]: https://npmjs.org/package/accepts
|
||||||
|
[npm-version-image]: https://badgen.net/npm/v/accepts
|
||||||
|
[travis-image]: https://badgen.net/travis/jshttp/accepts/master
|
||||||
|
[travis-url]: https://travis-ci.org/jshttp/accepts
|
||||||
238
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/accepts/index.js
generated
vendored
Normal file
238
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/accepts/index.js
generated
vendored
Normal file
@@ -0,0 +1,238 @@
|
|||||||
|
/*!
|
||||||
|
* accepts
|
||||||
|
* Copyright(c) 2014 Jonathan Ong
|
||||||
|
* Copyright(c) 2015 Douglas Christopher Wilson
|
||||||
|
* MIT Licensed
|
||||||
|
*/
|
||||||
|
|
||||||
|
'use strict'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Module dependencies.
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
|
||||||
|
var Negotiator = require('negotiator')
|
||||||
|
var mime = require('mime-types')
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Module exports.
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
|
||||||
|
module.exports = Accepts
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new Accepts object for the given req.
|
||||||
|
*
|
||||||
|
* @param {object} req
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
|
||||||
|
function Accepts (req) {
|
||||||
|
if (!(this instanceof Accepts)) {
|
||||||
|
return new Accepts(req)
|
||||||
|
}
|
||||||
|
|
||||||
|
this.headers = req.headers
|
||||||
|
this.negotiator = new Negotiator(req)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if the given `type(s)` is acceptable, returning
|
||||||
|
* the best match when true, otherwise `undefined`, in which
|
||||||
|
* case you should respond with 406 "Not Acceptable".
|
||||||
|
*
|
||||||
|
* The `type` value may be a single mime type string
|
||||||
|
* such as "application/json", the extension name
|
||||||
|
* such as "json" or an array `["json", "html", "text/plain"]`. When a list
|
||||||
|
* or array is given the _best_ match, if any is returned.
|
||||||
|
*
|
||||||
|
* Examples:
|
||||||
|
*
|
||||||
|
* // Accept: text/html
|
||||||
|
* this.types('html');
|
||||||
|
* // => "html"
|
||||||
|
*
|
||||||
|
* // Accept: text/*, application/json
|
||||||
|
* this.types('html');
|
||||||
|
* // => "html"
|
||||||
|
* this.types('text/html');
|
||||||
|
* // => "text/html"
|
||||||
|
* this.types('json', 'text');
|
||||||
|
* // => "json"
|
||||||
|
* this.types('application/json');
|
||||||
|
* // => "application/json"
|
||||||
|
*
|
||||||
|
* // Accept: text/*, application/json
|
||||||
|
* this.types('image/png');
|
||||||
|
* this.types('png');
|
||||||
|
* // => undefined
|
||||||
|
*
|
||||||
|
* // Accept: text/*;q=.5, application/json
|
||||||
|
* this.types(['html', 'json']);
|
||||||
|
* this.types('html', 'json');
|
||||||
|
* // => "json"
|
||||||
|
*
|
||||||
|
* @param {String|Array} types...
|
||||||
|
* @return {String|Array|Boolean}
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
|
||||||
|
Accepts.prototype.type =
|
||||||
|
Accepts.prototype.types = function (types_) {
|
||||||
|
var types = types_
|
||||||
|
|
||||||
|
// support flattened arguments
|
||||||
|
if (types && !Array.isArray(types)) {
|
||||||
|
types = new Array(arguments.length)
|
||||||
|
for (var i = 0; i < types.length; i++) {
|
||||||
|
types[i] = arguments[i]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// no types, return all requested types
|
||||||
|
if (!types || types.length === 0) {
|
||||||
|
return this.negotiator.mediaTypes()
|
||||||
|
}
|
||||||
|
|
||||||
|
// no accept header, return first given type
|
||||||
|
if (!this.headers.accept) {
|
||||||
|
return types[0]
|
||||||
|
}
|
||||||
|
|
||||||
|
var mimes = types.map(extToMime)
|
||||||
|
var accepts = this.negotiator.mediaTypes(mimes.filter(validMime))
|
||||||
|
var first = accepts[0]
|
||||||
|
|
||||||
|
return first
|
||||||
|
? types[mimes.indexOf(first)]
|
||||||
|
: false
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return accepted encodings or best fit based on `encodings`.
|
||||||
|
*
|
||||||
|
* Given `Accept-Encoding: gzip, deflate`
|
||||||
|
* an array sorted by quality is returned:
|
||||||
|
*
|
||||||
|
* ['gzip', 'deflate']
|
||||||
|
*
|
||||||
|
* @param {String|Array} encodings...
|
||||||
|
* @return {String|Array}
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
|
||||||
|
Accepts.prototype.encoding =
|
||||||
|
Accepts.prototype.encodings = function (encodings_) {
|
||||||
|
var encodings = encodings_
|
||||||
|
|
||||||
|
// support flattened arguments
|
||||||
|
if (encodings && !Array.isArray(encodings)) {
|
||||||
|
encodings = new Array(arguments.length)
|
||||||
|
for (var i = 0; i < encodings.length; i++) {
|
||||||
|
encodings[i] = arguments[i]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// no encodings, return all requested encodings
|
||||||
|
if (!encodings || encodings.length === 0) {
|
||||||
|
return this.negotiator.encodings()
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.negotiator.encodings(encodings)[0] || false
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return accepted charsets or best fit based on `charsets`.
|
||||||
|
*
|
||||||
|
* Given `Accept-Charset: utf-8, iso-8859-1;q=0.2, utf-7;q=0.5`
|
||||||
|
* an array sorted by quality is returned:
|
||||||
|
*
|
||||||
|
* ['utf-8', 'utf-7', 'iso-8859-1']
|
||||||
|
*
|
||||||
|
* @param {String|Array} charsets...
|
||||||
|
* @return {String|Array}
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
|
||||||
|
Accepts.prototype.charset =
|
||||||
|
Accepts.prototype.charsets = function (charsets_) {
|
||||||
|
var charsets = charsets_
|
||||||
|
|
||||||
|
// support flattened arguments
|
||||||
|
if (charsets && !Array.isArray(charsets)) {
|
||||||
|
charsets = new Array(arguments.length)
|
||||||
|
for (var i = 0; i < charsets.length; i++) {
|
||||||
|
charsets[i] = arguments[i]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// no charsets, return all requested charsets
|
||||||
|
if (!charsets || charsets.length === 0) {
|
||||||
|
return this.negotiator.charsets()
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.negotiator.charsets(charsets)[0] || false
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return accepted languages or best fit based on `langs`.
|
||||||
|
*
|
||||||
|
* Given `Accept-Language: en;q=0.8, es, pt`
|
||||||
|
* an array sorted by quality is returned:
|
||||||
|
*
|
||||||
|
* ['es', 'pt', 'en']
|
||||||
|
*
|
||||||
|
* @param {String|Array} langs...
|
||||||
|
* @return {Array|String}
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
|
||||||
|
Accepts.prototype.lang =
|
||||||
|
Accepts.prototype.langs =
|
||||||
|
Accepts.prototype.language =
|
||||||
|
Accepts.prototype.languages = function (languages_) {
|
||||||
|
var languages = languages_
|
||||||
|
|
||||||
|
// support flattened arguments
|
||||||
|
if (languages && !Array.isArray(languages)) {
|
||||||
|
languages = new Array(arguments.length)
|
||||||
|
for (var i = 0; i < languages.length; i++) {
|
||||||
|
languages[i] = arguments[i]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// no languages, return all requested languages
|
||||||
|
if (!languages || languages.length === 0) {
|
||||||
|
return this.negotiator.languages()
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.negotiator.languages(languages)[0] || false
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert extnames to mime.
|
||||||
|
*
|
||||||
|
* @param {String} type
|
||||||
|
* @return {String}
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
|
||||||
|
function extToMime (type) {
|
||||||
|
return type.indexOf('/') === -1
|
||||||
|
? mime.lookup(type)
|
||||||
|
: type
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if mime is valid.
|
||||||
|
*
|
||||||
|
* @param {String} type
|
||||||
|
* @return {String}
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
|
||||||
|
function validMime (type) {
|
||||||
|
return typeof type === 'string'
|
||||||
|
}
|
||||||
89
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/accepts/package.json
generated
vendored
Normal file
89
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/accepts/package.json
generated
vendored
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
{
|
||||||
|
"_args": [
|
||||||
|
[
|
||||||
|
"accepts@1.3.7",
|
||||||
|
"/tmp/repository/main"
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"_from": "accepts@1.3.7",
|
||||||
|
"_id": "accepts@1.3.7",
|
||||||
|
"_inBundle": false,
|
||||||
|
"_integrity": "sha512-Il80Qs2WjYlJIBNzNkK6KYqlVMTbZLXgHx2oT0pU/fjRHyEp+PEfEPY0R3WCwAGVOtauxh1hOxNgIf5bv7dQpA==",
|
||||||
|
"_location": "/accepts",
|
||||||
|
"_phantomChildren": {},
|
||||||
|
"_requested": {
|
||||||
|
"type": "version",
|
||||||
|
"registry": true,
|
||||||
|
"raw": "accepts@1.3.7",
|
||||||
|
"name": "accepts",
|
||||||
|
"escapedName": "accepts",
|
||||||
|
"rawSpec": "1.3.7",
|
||||||
|
"saveSpec": null,
|
||||||
|
"fetchSpec": "1.3.7"
|
||||||
|
},
|
||||||
|
"_requiredBy": [
|
||||||
|
"/koa"
|
||||||
|
],
|
||||||
|
"_resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz",
|
||||||
|
"_spec": "1.3.7",
|
||||||
|
"_where": "/tmp/repository/main",
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/jshttp/accepts/issues"
|
||||||
|
},
|
||||||
|
"contributors": [
|
||||||
|
{
|
||||||
|
"name": "Douglas Christopher Wilson",
|
||||||
|
"email": "doug@somethingdoug.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Jonathan Ong",
|
||||||
|
"email": "me@jongleberry.com",
|
||||||
|
"url": "http://jongleberry.com"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"dependencies": {
|
||||||
|
"mime-types": "~2.1.24",
|
||||||
|
"negotiator": "0.6.2"
|
||||||
|
},
|
||||||
|
"description": "Higher-level content negotiation",
|
||||||
|
"devDependencies": {
|
||||||
|
"deep-equal": "1.0.1",
|
||||||
|
"eslint": "5.16.0",
|
||||||
|
"eslint-config-standard": "12.0.0",
|
||||||
|
"eslint-plugin-import": "2.17.2",
|
||||||
|
"eslint-plugin-markdown": "1.0.0",
|
||||||
|
"eslint-plugin-node": "8.0.1",
|
||||||
|
"eslint-plugin-promise": "4.1.1",
|
||||||
|
"eslint-plugin-standard": "4.0.0",
|
||||||
|
"mocha": "6.1.4",
|
||||||
|
"nyc": "14.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.6"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"LICENSE",
|
||||||
|
"HISTORY.md",
|
||||||
|
"index.js"
|
||||||
|
],
|
||||||
|
"homepage": "https://github.com/jshttp/accepts#readme",
|
||||||
|
"keywords": [
|
||||||
|
"content",
|
||||||
|
"negotiation",
|
||||||
|
"accept",
|
||||||
|
"accepts"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"name": "accepts",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/jshttp/accepts.git"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"lint": "eslint --plugin markdown --ext js,md .",
|
||||||
|
"test": "mocha --reporter spec --check-leaks --bail test/",
|
||||||
|
"test-cov": "nyc --reporter=html --reporter=text npm test",
|
||||||
|
"test-travis": "nyc --reporter=text npm test"
|
||||||
|
},
|
||||||
|
"version": "1.3.7"
|
||||||
|
}
|
||||||
145
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/agent-base/README.md
generated
vendored
Normal file
145
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/agent-base/README.md
generated
vendored
Normal file
@@ -0,0 +1,145 @@
|
|||||||
|
agent-base
|
||||||
|
==========
|
||||||
|
### Turn a function into an [`http.Agent`][http.Agent] instance
|
||||||
|
[](https://github.com/TooTallNate/node-agent-base/actions?workflow=Node+CI)
|
||||||
|
|
||||||
|
This module provides an `http.Agent` generator. That is, you pass it an async
|
||||||
|
callback function, and it returns a new `http.Agent` instance that will invoke the
|
||||||
|
given callback function when sending outbound HTTP requests.
|
||||||
|
|
||||||
|
#### Some subclasses:
|
||||||
|
|
||||||
|
Here's some more interesting uses of `agent-base`.
|
||||||
|
Send a pull request to list yours!
|
||||||
|
|
||||||
|
* [`http-proxy-agent`][http-proxy-agent]: An HTTP(s) proxy `http.Agent` implementation for HTTP endpoints
|
||||||
|
* [`https-proxy-agent`][https-proxy-agent]: An HTTP(s) proxy `http.Agent` implementation for HTTPS endpoints
|
||||||
|
* [`pac-proxy-agent`][pac-proxy-agent]: A PAC file proxy `http.Agent` implementation for HTTP and HTTPS
|
||||||
|
* [`socks-proxy-agent`][socks-proxy-agent]: A SOCKS proxy `http.Agent` implementation for HTTP and HTTPS
|
||||||
|
|
||||||
|
|
||||||
|
Installation
|
||||||
|
------------
|
||||||
|
|
||||||
|
Install with `npm`:
|
||||||
|
|
||||||
|
``` bash
|
||||||
|
$ npm install agent-base
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
Example
|
||||||
|
-------
|
||||||
|
|
||||||
|
Here's a minimal example that creates a new `net.Socket` connection to the server
|
||||||
|
for every HTTP request (i.e. the equivalent of `agent: false` option):
|
||||||
|
|
||||||
|
```js
|
||||||
|
var net = require('net');
|
||||||
|
var tls = require('tls');
|
||||||
|
var url = require('url');
|
||||||
|
var http = require('http');
|
||||||
|
var agent = require('agent-base');
|
||||||
|
|
||||||
|
var endpoint = 'http://nodejs.org/api/';
|
||||||
|
var parsed = url.parse(endpoint);
|
||||||
|
|
||||||
|
// This is the important part!
|
||||||
|
parsed.agent = agent(function (req, opts) {
|
||||||
|
var socket;
|
||||||
|
// `secureEndpoint` is true when using the https module
|
||||||
|
if (opts.secureEndpoint) {
|
||||||
|
socket = tls.connect(opts);
|
||||||
|
} else {
|
||||||
|
socket = net.connect(opts);
|
||||||
|
}
|
||||||
|
return socket;
|
||||||
|
});
|
||||||
|
|
||||||
|
// Everything else works just like normal...
|
||||||
|
http.get(parsed, function (res) {
|
||||||
|
console.log('"response" event!', res.headers);
|
||||||
|
res.pipe(process.stdout);
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
Returning a Promise or using an `async` function is also supported:
|
||||||
|
|
||||||
|
```js
|
||||||
|
agent(async function (req, opts) {
|
||||||
|
await sleep(1000);
|
||||||
|
// etc…
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
Return another `http.Agent` instance to "pass through" the responsibility
|
||||||
|
for that HTTP request to that agent:
|
||||||
|
|
||||||
|
```js
|
||||||
|
agent(function (req, opts) {
|
||||||
|
return opts.secureEndpoint ? https.globalAgent : http.globalAgent;
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
API
|
||||||
|
---
|
||||||
|
|
||||||
|
## Agent(Function callback[, Object options]) → [http.Agent][]
|
||||||
|
|
||||||
|
Creates a base `http.Agent` that will execute the callback function `callback`
|
||||||
|
for every HTTP request that it is used as the `agent` for. The callback function
|
||||||
|
is responsible for creating a `stream.Duplex` instance of some kind that will be
|
||||||
|
used as the underlying socket in the HTTP request.
|
||||||
|
|
||||||
|
The `options` object accepts the following properties:
|
||||||
|
|
||||||
|
* `timeout` - Number - Timeout for the `callback()` function in milliseconds. Defaults to Infinity (optional).
|
||||||
|
|
||||||
|
The callback function should have the following signature:
|
||||||
|
|
||||||
|
### callback(http.ClientRequest req, Object options, Function cb) → undefined
|
||||||
|
|
||||||
|
The ClientRequest `req` can be accessed to read request headers and
|
||||||
|
and the path, etc. The `options` object contains the options passed
|
||||||
|
to the `http.request()`/`https.request()` function call, and is formatted
|
||||||
|
to be directly passed to `net.connect()`/`tls.connect()`, or however
|
||||||
|
else you want a Socket to be created. Pass the created socket to
|
||||||
|
the callback function `cb` once created, and the HTTP request will
|
||||||
|
continue to proceed.
|
||||||
|
|
||||||
|
If the `https` module is used to invoke the HTTP request, then the
|
||||||
|
`secureEndpoint` property on `options` _will be set to `true`_.
|
||||||
|
|
||||||
|
|
||||||
|
License
|
||||||
|
-------
|
||||||
|
|
||||||
|
(The MIT License)
|
||||||
|
|
||||||
|
Copyright (c) 2013 Nathan Rajlich <nathan@tootallnate.net>
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
[http-proxy-agent]: https://github.com/TooTallNate/node-http-proxy-agent
|
||||||
|
[https-proxy-agent]: https://github.com/TooTallNate/node-https-proxy-agent
|
||||||
|
[pac-proxy-agent]: https://github.com/TooTallNate/node-pac-proxy-agent
|
||||||
|
[socks-proxy-agent]: https://github.com/TooTallNate/node-socks-proxy-agent
|
||||||
|
[http.Agent]: https://nodejs.org/api/http.html#http_class_http_agent
|
||||||
203
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/agent-base/dist/src/index.js
generated
vendored
Normal file
203
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/agent-base/dist/src/index.js
generated
vendored
Normal file
@@ -0,0 +1,203 @@
|
|||||||
|
"use strict";
|
||||||
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||||
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||||
|
};
|
||||||
|
const events_1 = require("events");
|
||||||
|
const debug_1 = __importDefault(require("debug"));
|
||||||
|
const promisify_1 = __importDefault(require("./promisify"));
|
||||||
|
const debug = debug_1.default('agent-base');
|
||||||
|
function isAgent(v) {
|
||||||
|
return Boolean(v) && typeof v.addRequest === 'function';
|
||||||
|
}
|
||||||
|
function isSecureEndpoint() {
|
||||||
|
const { stack } = new Error();
|
||||||
|
if (typeof stack !== 'string')
|
||||||
|
return false;
|
||||||
|
return stack.split('\n').some(l => l.indexOf('(https.js:') !== -1 || l.indexOf('node:https:') !== -1);
|
||||||
|
}
|
||||||
|
function createAgent(callback, opts) {
|
||||||
|
return new createAgent.Agent(callback, opts);
|
||||||
|
}
|
||||||
|
(function (createAgent) {
|
||||||
|
/**
|
||||||
|
* Base `http.Agent` implementation.
|
||||||
|
* No pooling/keep-alive is implemented by default.
|
||||||
|
*
|
||||||
|
* @param {Function} callback
|
||||||
|
* @api public
|
||||||
|
*/
|
||||||
|
class Agent extends events_1.EventEmitter {
|
||||||
|
constructor(callback, _opts) {
|
||||||
|
super();
|
||||||
|
let opts = _opts;
|
||||||
|
if (typeof callback === 'function') {
|
||||||
|
this.callback = callback;
|
||||||
|
}
|
||||||
|
else if (callback) {
|
||||||
|
opts = callback;
|
||||||
|
}
|
||||||
|
// Timeout for the socket to be returned from the callback
|
||||||
|
this.timeout = null;
|
||||||
|
if (opts && typeof opts.timeout === 'number') {
|
||||||
|
this.timeout = opts.timeout;
|
||||||
|
}
|
||||||
|
// These aren't actually used by `agent-base`, but are required
|
||||||
|
// for the TypeScript definition files in `@types/node` :/
|
||||||
|
this.maxFreeSockets = 1;
|
||||||
|
this.maxSockets = 1;
|
||||||
|
this.maxTotalSockets = Infinity;
|
||||||
|
this.sockets = {};
|
||||||
|
this.freeSockets = {};
|
||||||
|
this.requests = {};
|
||||||
|
this.options = {};
|
||||||
|
}
|
||||||
|
get defaultPort() {
|
||||||
|
if (typeof this.explicitDefaultPort === 'number') {
|
||||||
|
return this.explicitDefaultPort;
|
||||||
|
}
|
||||||
|
return isSecureEndpoint() ? 443 : 80;
|
||||||
|
}
|
||||||
|
set defaultPort(v) {
|
||||||
|
this.explicitDefaultPort = v;
|
||||||
|
}
|
||||||
|
get protocol() {
|
||||||
|
if (typeof this.explicitProtocol === 'string') {
|
||||||
|
return this.explicitProtocol;
|
||||||
|
}
|
||||||
|
return isSecureEndpoint() ? 'https:' : 'http:';
|
||||||
|
}
|
||||||
|
set protocol(v) {
|
||||||
|
this.explicitProtocol = v;
|
||||||
|
}
|
||||||
|
callback(req, opts, fn) {
|
||||||
|
throw new Error('"agent-base" has no default implementation, you must subclass and override `callback()`');
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Called by node-core's "_http_client.js" module when creating
|
||||||
|
* a new HTTP request with this Agent instance.
|
||||||
|
*
|
||||||
|
* @api public
|
||||||
|
*/
|
||||||
|
addRequest(req, _opts) {
|
||||||
|
const opts = Object.assign({}, _opts);
|
||||||
|
if (typeof opts.secureEndpoint !== 'boolean') {
|
||||||
|
opts.secureEndpoint = isSecureEndpoint();
|
||||||
|
}
|
||||||
|
if (opts.host == null) {
|
||||||
|
opts.host = 'localhost';
|
||||||
|
}
|
||||||
|
if (opts.port == null) {
|
||||||
|
opts.port = opts.secureEndpoint ? 443 : 80;
|
||||||
|
}
|
||||||
|
if (opts.protocol == null) {
|
||||||
|
opts.protocol = opts.secureEndpoint ? 'https:' : 'http:';
|
||||||
|
}
|
||||||
|
if (opts.host && opts.path) {
|
||||||
|
// If both a `host` and `path` are specified then it's most
|
||||||
|
// likely the result of a `url.parse()` call... we need to
|
||||||
|
// remove the `path` portion so that `net.connect()` doesn't
|
||||||
|
// attempt to open that as a unix socket file.
|
||||||
|
delete opts.path;
|
||||||
|
}
|
||||||
|
delete opts.agent;
|
||||||
|
delete opts.hostname;
|
||||||
|
delete opts._defaultAgent;
|
||||||
|
delete opts.defaultPort;
|
||||||
|
delete opts.createConnection;
|
||||||
|
// Hint to use "Connection: close"
|
||||||
|
// XXX: non-documented `http` module API :(
|
||||||
|
req._last = true;
|
||||||
|
req.shouldKeepAlive = false;
|
||||||
|
let timedOut = false;
|
||||||
|
let timeoutId = null;
|
||||||
|
const timeoutMs = opts.timeout || this.timeout;
|
||||||
|
const onerror = (err) => {
|
||||||
|
if (req._hadError)
|
||||||
|
return;
|
||||||
|
req.emit('error', err);
|
||||||
|
// For Safety. Some additional errors might fire later on
|
||||||
|
// and we need to make sure we don't double-fire the error event.
|
||||||
|
req._hadError = true;
|
||||||
|
};
|
||||||
|
const ontimeout = () => {
|
||||||
|
timeoutId = null;
|
||||||
|
timedOut = true;
|
||||||
|
const err = new Error(`A "socket" was not created for HTTP request before ${timeoutMs}ms`);
|
||||||
|
err.code = 'ETIMEOUT';
|
||||||
|
onerror(err);
|
||||||
|
};
|
||||||
|
const callbackError = (err) => {
|
||||||
|
if (timedOut)
|
||||||
|
return;
|
||||||
|
if (timeoutId !== null) {
|
||||||
|
clearTimeout(timeoutId);
|
||||||
|
timeoutId = null;
|
||||||
|
}
|
||||||
|
onerror(err);
|
||||||
|
};
|
||||||
|
const onsocket = (socket) => {
|
||||||
|
if (timedOut)
|
||||||
|
return;
|
||||||
|
if (timeoutId != null) {
|
||||||
|
clearTimeout(timeoutId);
|
||||||
|
timeoutId = null;
|
||||||
|
}
|
||||||
|
if (isAgent(socket)) {
|
||||||
|
// `socket` is actually an `http.Agent` instance, so
|
||||||
|
// relinquish responsibility for this `req` to the Agent
|
||||||
|
// from here on
|
||||||
|
debug('Callback returned another Agent instance %o', socket.constructor.name);
|
||||||
|
socket.addRequest(req, opts);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (socket) {
|
||||||
|
socket.once('free', () => {
|
||||||
|
this.freeSocket(socket, opts);
|
||||||
|
});
|
||||||
|
req.onSocket(socket);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const err = new Error(`no Duplex stream was returned to agent-base for \`${req.method} ${req.path}\``);
|
||||||
|
onerror(err);
|
||||||
|
};
|
||||||
|
if (typeof this.callback !== 'function') {
|
||||||
|
onerror(new Error('`callback` is not defined'));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!this.promisifiedCallback) {
|
||||||
|
if (this.callback.length >= 3) {
|
||||||
|
debug('Converting legacy callback function to promise');
|
||||||
|
this.promisifiedCallback = promisify_1.default(this.callback);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.promisifiedCallback = this.callback;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (typeof timeoutMs === 'number' && timeoutMs > 0) {
|
||||||
|
timeoutId = setTimeout(ontimeout, timeoutMs);
|
||||||
|
}
|
||||||
|
if ('port' in opts && typeof opts.port !== 'number') {
|
||||||
|
opts.port = Number(opts.port);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
debug('Resolving socket for %o request: %o', opts.protocol, `${req.method} ${req.path}`);
|
||||||
|
Promise.resolve(this.promisifiedCallback(req, opts)).then(onsocket, callbackError);
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
Promise.reject(err).catch(callbackError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
freeSocket(socket, opts) {
|
||||||
|
debug('Freeing socket %o %o', socket.constructor.name, opts);
|
||||||
|
socket.destroy();
|
||||||
|
}
|
||||||
|
destroy() {
|
||||||
|
debug('Destroying agent %o', this.constructor.name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
createAgent.Agent = Agent;
|
||||||
|
// So that `instanceof` works correctly
|
||||||
|
createAgent.prototype = createAgent.Agent.prototype;
|
||||||
|
})(createAgent || (createAgent = {}));
|
||||||
|
module.exports = createAgent;
|
||||||
|
//# sourceMappingURL=index.js.map
|
||||||
18
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/agent-base/dist/src/promisify.js
generated
vendored
Normal file
18
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/agent-base/dist/src/promisify.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
"use strict";
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
function promisify(fn) {
|
||||||
|
return function (req, opts) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
fn.call(this, req, opts, (err, rtn) => {
|
||||||
|
if (err) {
|
||||||
|
reject(err);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
resolve(rtn);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
}
|
||||||
|
exports.default = promisify;
|
||||||
|
//# sourceMappingURL=promisify.js.map
|
||||||
98
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/agent-base/package.json
generated
vendored
Normal file
98
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/agent-base/package.json
generated
vendored
Normal file
@@ -0,0 +1,98 @@
|
|||||||
|
{
|
||||||
|
"_args": [
|
||||||
|
[
|
||||||
|
"agent-base@6.0.2",
|
||||||
|
"/tmp/repository/main"
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"_from": "agent-base@6.0.2",
|
||||||
|
"_id": "agent-base@6.0.2",
|
||||||
|
"_inBundle": false,
|
||||||
|
"_integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==",
|
||||||
|
"_location": "/agent-base",
|
||||||
|
"_phantomChildren": {},
|
||||||
|
"_requested": {
|
||||||
|
"type": "version",
|
||||||
|
"registry": true,
|
||||||
|
"raw": "agent-base@6.0.2",
|
||||||
|
"name": "agent-base",
|
||||||
|
"escapedName": "agent-base",
|
||||||
|
"rawSpec": "6.0.2",
|
||||||
|
"saveSpec": null,
|
||||||
|
"fetchSpec": "6.0.2"
|
||||||
|
},
|
||||||
|
"_requiredBy": [
|
||||||
|
"/http-proxy-agent",
|
||||||
|
"/https-proxy-agent"
|
||||||
|
],
|
||||||
|
"_resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz",
|
||||||
|
"_spec": "6.0.2",
|
||||||
|
"_where": "/tmp/repository/main",
|
||||||
|
"author": {
|
||||||
|
"name": "Nathan Rajlich",
|
||||||
|
"email": "nathan@tootallnate.net",
|
||||||
|
"url": "http://n8.io/"
|
||||||
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/TooTallNate/node-agent-base/issues"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"debug": "4"
|
||||||
|
},
|
||||||
|
"description": "Turn a function into an `http.Agent` instance",
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/debug": "4",
|
||||||
|
"@types/mocha": "^5.2.7",
|
||||||
|
"@types/node": "^14.0.20",
|
||||||
|
"@types/semver": "^7.1.0",
|
||||||
|
"@types/ws": "^6.0.3",
|
||||||
|
"@typescript-eslint/eslint-plugin": "1.6.0",
|
||||||
|
"@typescript-eslint/parser": "1.1.0",
|
||||||
|
"async-listen": "^1.2.0",
|
||||||
|
"cpy-cli": "^2.0.0",
|
||||||
|
"eslint": "5.16.0",
|
||||||
|
"eslint-config-airbnb": "17.1.0",
|
||||||
|
"eslint-config-prettier": "4.1.0",
|
||||||
|
"eslint-import-resolver-typescript": "1.1.1",
|
||||||
|
"eslint-plugin-import": "2.16.0",
|
||||||
|
"eslint-plugin-jsx-a11y": "6.2.1",
|
||||||
|
"eslint-plugin-react": "7.12.4",
|
||||||
|
"mocha": "^6.2.0",
|
||||||
|
"rimraf": "^3.0.0",
|
||||||
|
"semver": "^7.1.2",
|
||||||
|
"typescript": "^3.5.3",
|
||||||
|
"ws": "^3.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 6.0.0"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"dist/src",
|
||||||
|
"src"
|
||||||
|
],
|
||||||
|
"homepage": "https://github.com/TooTallNate/node-agent-base#readme",
|
||||||
|
"keywords": [
|
||||||
|
"http",
|
||||||
|
"agent",
|
||||||
|
"base",
|
||||||
|
"barebones",
|
||||||
|
"https"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"main": "dist/src/index",
|
||||||
|
"name": "agent-base",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git://github.com/TooTallNate/node-agent-base.git"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"build": "tsc",
|
||||||
|
"postbuild": "cpy --parents src test '!**/*.ts' dist",
|
||||||
|
"prebuild": "rimraf dist",
|
||||||
|
"prepublishOnly": "npm run build",
|
||||||
|
"test": "mocha --reporter spec dist/test/*.js",
|
||||||
|
"test-lint": "eslint src --ext .js,.ts"
|
||||||
|
},
|
||||||
|
"typings": "dist/src/index",
|
||||||
|
"version": "6.0.2"
|
||||||
|
}
|
||||||
4
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/any-promise/.jshintrc
generated
vendored
Normal file
4
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/any-promise/.jshintrc
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"node":true,
|
||||||
|
"strict":true
|
||||||
|
}
|
||||||
7
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/any-promise/.npmignore
generated
vendored
Normal file
7
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/any-promise/.npmignore
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
.git*
|
||||||
|
test/
|
||||||
|
test-browser/
|
||||||
|
build/
|
||||||
|
.travis.yml
|
||||||
|
*.swp
|
||||||
|
Makefile
|
||||||
19
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/any-promise/LICENSE
generated
vendored
Normal file
19
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/any-promise/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
Copyright (C) 2014-2016 Kevin Beaty
|
||||||
|
|
||||||
|
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.
|
||||||
161
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/any-promise/README.md
generated
vendored
Normal file
161
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/any-promise/README.md
generated
vendored
Normal file
@@ -0,0 +1,161 @@
|
|||||||
|
## Any Promise
|
||||||
|
|
||||||
|
[](http://travis-ci.org/kevinbeaty/any-promise)
|
||||||
|
|
||||||
|
Let your library support any ES 2015 (ES6) compatible `Promise` and leave the choice to application authors. The application can *optionally* register its preferred `Promise` implementation and it will be exported when requiring `any-promise` from library code.
|
||||||
|
|
||||||
|
If no preference is registered, defaults to the global `Promise` for newer Node.js versions. The browser version defaults to the window `Promise`, so polyfill or register as necessary.
|
||||||
|
|
||||||
|
### Usage with global Promise:
|
||||||
|
|
||||||
|
Assuming the global `Promise` is the desired implementation:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Install any libraries depending on any-promise
|
||||||
|
$ npm install mz
|
||||||
|
```
|
||||||
|
|
||||||
|
The installed libraries will use global Promise by default.
|
||||||
|
|
||||||
|
```js
|
||||||
|
// in library
|
||||||
|
var Promise = require('any-promise') // the global Promise
|
||||||
|
|
||||||
|
function promiseReturningFunction(){
|
||||||
|
return new Promise(function(resolve, reject){...})
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Usage with registration:
|
||||||
|
|
||||||
|
Assuming `bluebird` is the desired Promise implementation:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Install preferred promise library
|
||||||
|
$ npm install bluebird
|
||||||
|
# Install any-promise to allow registration
|
||||||
|
$ npm install any-promise
|
||||||
|
# Install any libraries you would like to use depending on any-promise
|
||||||
|
$ npm install mz
|
||||||
|
```
|
||||||
|
|
||||||
|
Register your preference in the application entry point before any other `require` of packages that load `any-promise`:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
// top of application index.js or other entry point
|
||||||
|
require('any-promise/register/bluebird')
|
||||||
|
|
||||||
|
// -or- Equivalent to above, but allows customization of Promise library
|
||||||
|
require('any-promise/register')('bluebird', {Promise: require('bluebird')})
|
||||||
|
```
|
||||||
|
|
||||||
|
Now that the implementation is registered, you can use any package depending on `any-promise`:
|
||||||
|
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var fsp = require('mz/fs') // mz/fs will use registered bluebird promises
|
||||||
|
var Promise = require('any-promise') // the registered bluebird promise
|
||||||
|
```
|
||||||
|
|
||||||
|
It is safe to call `register` multiple times, but it must always be with the same implementation.
|
||||||
|
|
||||||
|
Again, registration is *optional*. It should only be called by the application user if overriding the global `Promise` implementation is desired.
|
||||||
|
|
||||||
|
### Optional Application Registration
|
||||||
|
|
||||||
|
As an application author, you can *optionally* register a preferred `Promise` implementation on application startup (before any call to `require('any-promise')`:
|
||||||
|
|
||||||
|
You must register your preference before any call to `require('any-promise')` (by you or required packages), and only one implementation can be registered. Typically, this registration would occur at the top of the application entry point.
|
||||||
|
|
||||||
|
|
||||||
|
#### Registration shortcuts
|
||||||
|
|
||||||
|
If you are using a known `Promise` implementation, you can register your preference with a shortcut:
|
||||||
|
|
||||||
|
|
||||||
|
```js
|
||||||
|
require('any-promise/register/bluebird')
|
||||||
|
// -or-
|
||||||
|
import 'any-promise/register/q';
|
||||||
|
```
|
||||||
|
|
||||||
|
Shortcut registration is the preferred registration method as it works in the browser and Node.js. It is also convenient for using with `import` and many test runners, that offer a `--require` flag:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ ava --require=any-promise/register/bluebird test.js
|
||||||
|
```
|
||||||
|
|
||||||
|
Current known implementations include `bluebird`, `q`, `when`, `rsvp`, `es6-promise`, `promise`, `native-promise-only`, `pinkie`, `vow` and `lie`. If you are not using a known implementation, you can use another registration method described below.
|
||||||
|
|
||||||
|
|
||||||
|
#### Basic Registration
|
||||||
|
|
||||||
|
As an alternative to registration shortcuts, you can call the `register` function with the preferred `Promise` implementation. The benefit of this approach is that a `Promise` library can be required by name without being a known implementation. This approach does NOT work in the browser. To use `any-promise` in the browser use either registration shortcuts or specify the `Promise` constructor using advanced registration (see below).
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
require('any-promise/register')('when')
|
||||||
|
// -or- require('any-promise/register')('any other ES6 compatible library (known or otherwise)')
|
||||||
|
```
|
||||||
|
|
||||||
|
This registration method will try to detect the `Promise` constructor from requiring the specified implementation. If you would like to specify your own constructor, see advanced registration.
|
||||||
|
|
||||||
|
|
||||||
|
#### Advanced Registration
|
||||||
|
|
||||||
|
To use the browser version, you should either install a polyfill or explicitly register the `Promise` constructor:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
require('any-promise/register')('bluebird', {Promise: require('bluebird')})
|
||||||
|
```
|
||||||
|
|
||||||
|
This could also be used for registering a custom `Promise` implementation or subclass.
|
||||||
|
|
||||||
|
Your preference will be registered globally, allowing a single registration even if multiple versions of `any-promise` are installed in the NPM dependency tree or are using multiple bundled JavaScript files in the browser. You can bypass this global registration in options:
|
||||||
|
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
require('../register')('es6-promise', {Promise: require('es6-promise').Promise, global: false})
|
||||||
|
```
|
||||||
|
|
||||||
|
### Library Usage
|
||||||
|
|
||||||
|
To use any `Promise` constructor, simply require it:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var Promise = require('any-promise');
|
||||||
|
|
||||||
|
return Promise
|
||||||
|
.all([xf, f, init, coll])
|
||||||
|
.then(fn);
|
||||||
|
|
||||||
|
|
||||||
|
return new Promise(function(resolve, reject){
|
||||||
|
try {
|
||||||
|
resolve(item);
|
||||||
|
} catch(e){
|
||||||
|
reject(e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
Except noted below, libraries using `any-promise` should only use [documented](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) functions as there is no guarantee which implementation will be chosen by the application author. Libraries should never call `register`, only the application user should call if desired.
|
||||||
|
|
||||||
|
|
||||||
|
#### Advanced Library Usage
|
||||||
|
|
||||||
|
If your library needs to branch code based on the registered implementation, you can retrieve it using `var impl = require('any-promise/implementation')`, where `impl` will be the package name (`"bluebird"`, `"when"`, etc.) if registered, `"global.Promise"` if using the global version on Node.js, or `"window.Promise"` if using the browser version. You should always include a default case, as there is no guarantee what package may be registered.
|
||||||
|
|
||||||
|
|
||||||
|
### Support for old Node.js versions
|
||||||
|
|
||||||
|
Node.js versions prior to `v0.12` may have contained buggy versions of the global `Promise`. For this reason, the global `Promise` is not loaded automatically for these old versions. If using `any-promise` in Node.js versions versions `<= v0.12`, the user should register a desired implementation.
|
||||||
|
|
||||||
|
If an implementation is not registered, `any-promise` will attempt to discover an installed `Promise` implementation. If no implementation can be found, an error will be thrown on `require('any-promise')`. While the auto-discovery usually avoids errors, it is non-deterministic. It is recommended that the user always register a preferred implementation for older Node.js versions.
|
||||||
|
|
||||||
|
This auto-discovery is only available for Node.jS versions prior to `v0.12`. Any newer versions will always default to the global `Promise` implementation.
|
||||||
|
|
||||||
|
### Related
|
||||||
|
|
||||||
|
- [any-observable](https://github.com/sindresorhus/any-observable) - `any-promise` for Observables.
|
||||||
|
|
||||||
1
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/any-promise/implementation.js
generated
vendored
Normal file
1
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/any-promise/implementation.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
module.exports = require('./register')().implementation
|
||||||
1
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/any-promise/index.js
generated
vendored
Normal file
1
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/any-promise/index.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
module.exports = require('./register')().Promise
|
||||||
78
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/any-promise/loader.js
generated
vendored
Normal file
78
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/any-promise/loader.js
generated
vendored
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
"use strict"
|
||||||
|
// global key for user preferred registration
|
||||||
|
var REGISTRATION_KEY = '@@any-promise/REGISTRATION',
|
||||||
|
// Prior registration (preferred or detected)
|
||||||
|
registered = null
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers the given implementation. An implementation must
|
||||||
|
* be registered prior to any call to `require("any-promise")`,
|
||||||
|
* typically on application load.
|
||||||
|
*
|
||||||
|
* If called with no arguments, will return registration in
|
||||||
|
* following priority:
|
||||||
|
*
|
||||||
|
* For Node.js:
|
||||||
|
*
|
||||||
|
* 1. Previous registration
|
||||||
|
* 2. global.Promise if node.js version >= 0.12
|
||||||
|
* 3. Auto detected promise based on first sucessful require of
|
||||||
|
* known promise libraries. Note this is a last resort, as the
|
||||||
|
* loaded library is non-deterministic. node.js >= 0.12 will
|
||||||
|
* always use global.Promise over this priority list.
|
||||||
|
* 4. Throws error.
|
||||||
|
*
|
||||||
|
* For Browser:
|
||||||
|
*
|
||||||
|
* 1. Previous registration
|
||||||
|
* 2. window.Promise
|
||||||
|
* 3. Throws error.
|
||||||
|
*
|
||||||
|
* Options:
|
||||||
|
*
|
||||||
|
* Promise: Desired Promise constructor
|
||||||
|
* global: Boolean - Should the registration be cached in a global variable to
|
||||||
|
* allow cross dependency/bundle registration? (default true)
|
||||||
|
*/
|
||||||
|
module.exports = function(root, loadImplementation){
|
||||||
|
return function register(implementation, opts){
|
||||||
|
implementation = implementation || null
|
||||||
|
opts = opts || {}
|
||||||
|
// global registration unless explicitly {global: false} in options (default true)
|
||||||
|
var registerGlobal = opts.global !== false;
|
||||||
|
|
||||||
|
// load any previous global registration
|
||||||
|
if(registered === null && registerGlobal){
|
||||||
|
registered = root[REGISTRATION_KEY] || null
|
||||||
|
}
|
||||||
|
|
||||||
|
if(registered !== null
|
||||||
|
&& implementation !== null
|
||||||
|
&& registered.implementation !== implementation){
|
||||||
|
// Throw error if attempting to redefine implementation
|
||||||
|
throw new Error('any-promise already defined as "'+registered.implementation+
|
||||||
|
'". You can only register an implementation before the first '+
|
||||||
|
' call to require("any-promise") and an implementation cannot be changed')
|
||||||
|
}
|
||||||
|
|
||||||
|
if(registered === null){
|
||||||
|
// use provided implementation
|
||||||
|
if(implementation !== null && typeof opts.Promise !== 'undefined'){
|
||||||
|
registered = {
|
||||||
|
Promise: opts.Promise,
|
||||||
|
implementation: implementation
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// require implementation if implementation is specified but not provided
|
||||||
|
registered = loadImplementation(implementation)
|
||||||
|
}
|
||||||
|
|
||||||
|
if(registerGlobal){
|
||||||
|
// register preference globally in case multiple installations
|
||||||
|
root[REGISTRATION_KEY] = registered
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return registered
|
||||||
|
}
|
||||||
|
}
|
||||||
6
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/any-promise/optional.js
generated
vendored
Normal file
6
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/any-promise/optional.js
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
"use strict";
|
||||||
|
try {
|
||||||
|
module.exports = require('./register')().Promise || null
|
||||||
|
} catch(e) {
|
||||||
|
module.exports = null
|
||||||
|
}
|
||||||
75
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/any-promise/package.json
generated
vendored
Normal file
75
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/any-promise/package.json
generated
vendored
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
{
|
||||||
|
"_args": [
|
||||||
|
[
|
||||||
|
"any-promise@1.3.0",
|
||||||
|
"/tmp/repository/main"
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"_from": "any-promise@1.3.0",
|
||||||
|
"_id": "any-promise@1.3.0",
|
||||||
|
"_inBundle": false,
|
||||||
|
"_integrity": "sha1-q8av7tzqUugJzcA3au0845Y10X8=",
|
||||||
|
"_location": "/any-promise",
|
||||||
|
"_phantomChildren": {},
|
||||||
|
"_requested": {
|
||||||
|
"type": "version",
|
||||||
|
"registry": true,
|
||||||
|
"raw": "any-promise@1.3.0",
|
||||||
|
"name": "any-promise",
|
||||||
|
"escapedName": "any-promise",
|
||||||
|
"rawSpec": "1.3.0",
|
||||||
|
"saveSpec": null,
|
||||||
|
"fetchSpec": "1.3.0"
|
||||||
|
},
|
||||||
|
"_requiredBy": [
|
||||||
|
"/koa-convert/koa-compose"
|
||||||
|
],
|
||||||
|
"_resolved": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz",
|
||||||
|
"_spec": "1.3.0",
|
||||||
|
"_where": "/tmp/repository/main",
|
||||||
|
"author": {
|
||||||
|
"name": "Kevin Beaty"
|
||||||
|
},
|
||||||
|
"browser": {
|
||||||
|
"./register.js": "./register-shim.js"
|
||||||
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/kevinbeaty/any-promise/issues"
|
||||||
|
},
|
||||||
|
"dependencies": {},
|
||||||
|
"description": "Resolve any installed ES6 compatible promise",
|
||||||
|
"devDependencies": {
|
||||||
|
"ava": "^0.14.0",
|
||||||
|
"bluebird": "^3.0.0",
|
||||||
|
"es6-promise": "^3.0.0",
|
||||||
|
"is-promise": "^2.0.0",
|
||||||
|
"lie": "^3.0.0",
|
||||||
|
"mocha": "^2.0.0",
|
||||||
|
"native-promise-only": "^0.8.0",
|
||||||
|
"phantomjs-prebuilt": "^2.0.0",
|
||||||
|
"pinkie": "^2.0.0",
|
||||||
|
"promise": "^7.0.0",
|
||||||
|
"q": "^1.0.0",
|
||||||
|
"rsvp": "^3.0.0",
|
||||||
|
"vow": "^0.4.0",
|
||||||
|
"when": "^3.0.0",
|
||||||
|
"zuul": "^3.0.0"
|
||||||
|
},
|
||||||
|
"homepage": "http://github.com/kevinbeaty/any-promise",
|
||||||
|
"keywords": [
|
||||||
|
"promise",
|
||||||
|
"es6"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"main": "index.js",
|
||||||
|
"name": "any-promise",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/kevinbeaty/any-promise.git"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"test": "ava"
|
||||||
|
},
|
||||||
|
"typings": "index.d.ts",
|
||||||
|
"version": "1.3.0"
|
||||||
|
}
|
||||||
18
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/any-promise/register-shim.js
generated
vendored
Normal file
18
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/any-promise/register-shim.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
"use strict";
|
||||||
|
module.exports = require('./loader')(window, loadImplementation)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Browser specific loadImplementation. Always uses `window.Promise`
|
||||||
|
*
|
||||||
|
* To register a custom implementation, must register with `Promise` option.
|
||||||
|
*/
|
||||||
|
function loadImplementation(){
|
||||||
|
if(typeof window.Promise === 'undefined'){
|
||||||
|
throw new Error("any-promise browser requires a polyfill or explicit registration"+
|
||||||
|
" e.g: require('any-promise/register/bluebird')")
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
Promise: window.Promise,
|
||||||
|
implementation: 'window.Promise'
|
||||||
|
}
|
||||||
|
}
|
||||||
94
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/any-promise/register.js
generated
vendored
Normal file
94
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/any-promise/register.js
generated
vendored
Normal file
@@ -0,0 +1,94 @@
|
|||||||
|
"use strict"
|
||||||
|
module.exports = require('./loader')(global, loadImplementation);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Node.js version of loadImplementation.
|
||||||
|
*
|
||||||
|
* Requires the given implementation and returns the registration
|
||||||
|
* containing {Promise, implementation}
|
||||||
|
*
|
||||||
|
* If implementation is undefined or global.Promise, loads it
|
||||||
|
* Otherwise uses require
|
||||||
|
*/
|
||||||
|
function loadImplementation(implementation){
|
||||||
|
var impl = null
|
||||||
|
|
||||||
|
if(shouldPreferGlobalPromise(implementation)){
|
||||||
|
// if no implementation or env specified use global.Promise
|
||||||
|
impl = {
|
||||||
|
Promise: global.Promise,
|
||||||
|
implementation: 'global.Promise'
|
||||||
|
}
|
||||||
|
} else if(implementation){
|
||||||
|
// if implementation specified, require it
|
||||||
|
var lib = require(implementation)
|
||||||
|
impl = {
|
||||||
|
Promise: lib.Promise || lib,
|
||||||
|
implementation: implementation
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// try to auto detect implementation. This is non-deterministic
|
||||||
|
// and should prefer other branches, but this is our last chance
|
||||||
|
// to load something without throwing error
|
||||||
|
impl = tryAutoDetect()
|
||||||
|
}
|
||||||
|
|
||||||
|
if(impl === null){
|
||||||
|
throw new Error('Cannot find any-promise implementation nor'+
|
||||||
|
' global.Promise. You must install polyfill or call'+
|
||||||
|
' require("any-promise/register") with your preferred'+
|
||||||
|
' implementation, e.g. require("any-promise/register/bluebird")'+
|
||||||
|
' on application load prior to any require("any-promise").')
|
||||||
|
}
|
||||||
|
|
||||||
|
return impl
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determines if the global.Promise should be preferred if an implementation
|
||||||
|
* has not been registered.
|
||||||
|
*/
|
||||||
|
function shouldPreferGlobalPromise(implementation){
|
||||||
|
if(implementation){
|
||||||
|
return implementation === 'global.Promise'
|
||||||
|
} else if(typeof global.Promise !== 'undefined'){
|
||||||
|
// Load global promise if implementation not specified
|
||||||
|
// Versions < 0.11 did not have global Promise
|
||||||
|
// Do not use for version < 0.12 as version 0.11 contained buggy versions
|
||||||
|
var version = (/v(\d+)\.(\d+)\.(\d+)/).exec(process.version)
|
||||||
|
return !(version && +version[1] == 0 && +version[2] < 12)
|
||||||
|
}
|
||||||
|
|
||||||
|
// do not have global.Promise or another implementation was specified
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Look for common libs as last resort there is no guarantee that
|
||||||
|
* this will return a desired implementation or even be deterministic.
|
||||||
|
* The priority is also nearly arbitrary. We are only doing this
|
||||||
|
* for older versions of Node.js <0.12 that do not have a reasonable
|
||||||
|
* global.Promise implementation and we the user has not registered
|
||||||
|
* the preference. This preserves the behavior of any-promise <= 0.1
|
||||||
|
* and may be deprecated or removed in the future
|
||||||
|
*/
|
||||||
|
function tryAutoDetect(){
|
||||||
|
var libs = [
|
||||||
|
"es6-promise",
|
||||||
|
"promise",
|
||||||
|
"native-promise-only",
|
||||||
|
"bluebird",
|
||||||
|
"rsvp",
|
||||||
|
"when",
|
||||||
|
"q",
|
||||||
|
"pinkie",
|
||||||
|
"lie",
|
||||||
|
"vow"]
|
||||||
|
var i = 0, len = libs.length
|
||||||
|
for(; i < len; i++){
|
||||||
|
try {
|
||||||
|
return loadImplementation(libs[i])
|
||||||
|
} catch(e){}
|
||||||
|
}
|
||||||
|
return null
|
||||||
|
}
|
||||||
2
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/any-promise/register/bluebird.js
generated
vendored
Normal file
2
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/any-promise/register/bluebird.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
'use strict';
|
||||||
|
require('../register')('bluebird', {Promise: require('bluebird')})
|
||||||
2
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/any-promise/register/es6-promise.js
generated
vendored
Normal file
2
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/any-promise/register/es6-promise.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
'use strict';
|
||||||
|
require('../register')('es6-promise', {Promise: require('es6-promise').Promise})
|
||||||
2
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/any-promise/register/lie.js
generated
vendored
Normal file
2
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/any-promise/register/lie.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
'use strict';
|
||||||
|
require('../register')('lie', {Promise: require('lie')})
|
||||||
2
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/any-promise/register/native-promise-only.js
generated
vendored
Normal file
2
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/any-promise/register/native-promise-only.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
'use strict';
|
||||||
|
require('../register')('native-promise-only', {Promise: require('native-promise-only')})
|
||||||
2
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/any-promise/register/pinkie.js
generated
vendored
Normal file
2
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/any-promise/register/pinkie.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
'use strict';
|
||||||
|
require('../register')('pinkie', {Promise: require('pinkie')})
|
||||||
2
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/any-promise/register/promise.js
generated
vendored
Normal file
2
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/any-promise/register/promise.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
'use strict';
|
||||||
|
require('../register')('promise', {Promise: require('promise')})
|
||||||
2
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/any-promise/register/q.js
generated
vendored
Normal file
2
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/any-promise/register/q.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
'use strict';
|
||||||
|
require('../register')('q', {Promise: require('q').Promise})
|
||||||
2
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/any-promise/register/rsvp.js
generated
vendored
Normal file
2
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/any-promise/register/rsvp.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
'use strict';
|
||||||
|
require('../register')('rsvp', {Promise: require('rsvp').Promise})
|
||||||
2
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/any-promise/register/vow.js
generated
vendored
Normal file
2
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/any-promise/register/vow.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
'use strict';
|
||||||
|
require('../register')('vow', {Promise: require('vow').Promise})
|
||||||
2
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/any-promise/register/when.js
generated
vendored
Normal file
2
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/any-promise/register/when.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
'use strict';
|
||||||
|
require('../register')('when', {Promise: require('when').Promise})
|
||||||
2
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/balanced-match/.github/FUNDING.yml
generated
vendored
Normal file
2
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/balanced-match/.github/FUNDING.yml
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
tidelift: "npm/balanced-match"
|
||||||
|
patreon: juliangruber
|
||||||
21
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/balanced-match/LICENSE.md
generated
vendored
Normal file
21
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/balanced-match/LICENSE.md
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
(MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2013 Julian Gruber <julian@juliangruber.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.
|
||||||
97
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/balanced-match/README.md
generated
vendored
Normal file
97
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/balanced-match/README.md
generated
vendored
Normal file
@@ -0,0 +1,97 @@
|
|||||||
|
# balanced-match
|
||||||
|
|
||||||
|
Match balanced string pairs, like `{` and `}` or `<b>` and `</b>`. Supports regular expressions as well!
|
||||||
|
|
||||||
|
[](http://travis-ci.org/juliangruber/balanced-match)
|
||||||
|
[](https://www.npmjs.org/package/balanced-match)
|
||||||
|
|
||||||
|
[](https://ci.testling.com/juliangruber/balanced-match)
|
||||||
|
|
||||||
|
## Example
|
||||||
|
|
||||||
|
Get the first matching pair of braces:
|
||||||
|
|
||||||
|
```js
|
||||||
|
var balanced = require('balanced-match');
|
||||||
|
|
||||||
|
console.log(balanced('{', '}', 'pre{in{nested}}post'));
|
||||||
|
console.log(balanced('{', '}', 'pre{first}between{second}post'));
|
||||||
|
console.log(balanced(/\s+\{\s+/, /\s+\}\s+/, 'pre { in{nest} } post'));
|
||||||
|
```
|
||||||
|
|
||||||
|
The matches are:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ node example.js
|
||||||
|
{ start: 3, end: 14, pre: 'pre', body: 'in{nested}', post: 'post' }
|
||||||
|
{ start: 3,
|
||||||
|
end: 9,
|
||||||
|
pre: 'pre',
|
||||||
|
body: 'first',
|
||||||
|
post: 'between{second}post' }
|
||||||
|
{ start: 3, end: 17, pre: 'pre', body: 'in{nest}', post: 'post' }
|
||||||
|
```
|
||||||
|
|
||||||
|
## API
|
||||||
|
|
||||||
|
### var m = balanced(a, b, str)
|
||||||
|
|
||||||
|
For the first non-nested matching pair of `a` and `b` in `str`, return an
|
||||||
|
object with those keys:
|
||||||
|
|
||||||
|
* **start** the index of the first match of `a`
|
||||||
|
* **end** the index of the matching `b`
|
||||||
|
* **pre** the preamble, `a` and `b` not included
|
||||||
|
* **body** the match, `a` and `b` not included
|
||||||
|
* **post** the postscript, `a` and `b` not included
|
||||||
|
|
||||||
|
If there's no match, `undefined` will be returned.
|
||||||
|
|
||||||
|
If the `str` contains more `a` than `b` / there are unmatched pairs, the first match that was closed will be used. For example, `{{a}` will match `['{', 'a', '']` and `{a}}` will match `['', 'a', '}']`.
|
||||||
|
|
||||||
|
### var r = balanced.range(a, b, str)
|
||||||
|
|
||||||
|
For the first non-nested matching pair of `a` and `b` in `str`, return an
|
||||||
|
array with indexes: `[ <a index>, <b index> ]`.
|
||||||
|
|
||||||
|
If there's no match, `undefined` will be returned.
|
||||||
|
|
||||||
|
If the `str` contains more `a` than `b` / there are unmatched pairs, the first match that was closed will be used. For example, `{{a}` will match `[ 1, 3 ]` and `{a}}` will match `[0, 2]`.
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
With [npm](https://npmjs.org) do:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npm install balanced-match
|
||||||
|
```
|
||||||
|
|
||||||
|
## Security contact information
|
||||||
|
|
||||||
|
To report a security vulnerability, please use the
|
||||||
|
[Tidelift security contact](https://tidelift.com/security).
|
||||||
|
Tidelift will coordinate the fix and disclosure.
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
(MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2013 Julian Gruber <julian@juliangruber.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.
|
||||||
62
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/balanced-match/index.js
generated
vendored
Normal file
62
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/balanced-match/index.js
generated
vendored
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
'use strict';
|
||||||
|
module.exports = balanced;
|
||||||
|
function balanced(a, b, str) {
|
||||||
|
if (a instanceof RegExp) a = maybeMatch(a, str);
|
||||||
|
if (b instanceof RegExp) b = maybeMatch(b, str);
|
||||||
|
|
||||||
|
var r = range(a, b, str);
|
||||||
|
|
||||||
|
return r && {
|
||||||
|
start: r[0],
|
||||||
|
end: r[1],
|
||||||
|
pre: str.slice(0, r[0]),
|
||||||
|
body: str.slice(r[0] + a.length, r[1]),
|
||||||
|
post: str.slice(r[1] + b.length)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function maybeMatch(reg, str) {
|
||||||
|
var m = str.match(reg);
|
||||||
|
return m ? m[0] : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
balanced.range = range;
|
||||||
|
function range(a, b, str) {
|
||||||
|
var begs, beg, left, right, result;
|
||||||
|
var ai = str.indexOf(a);
|
||||||
|
var bi = str.indexOf(b, ai + 1);
|
||||||
|
var i = ai;
|
||||||
|
|
||||||
|
if (ai >= 0 && bi > 0) {
|
||||||
|
if(a===b) {
|
||||||
|
return [ai, bi];
|
||||||
|
}
|
||||||
|
begs = [];
|
||||||
|
left = str.length;
|
||||||
|
|
||||||
|
while (i >= 0 && !result) {
|
||||||
|
if (i == ai) {
|
||||||
|
begs.push(i);
|
||||||
|
ai = str.indexOf(a, i + 1);
|
||||||
|
} else if (begs.length == 1) {
|
||||||
|
result = [ begs.pop(), bi ];
|
||||||
|
} else {
|
||||||
|
beg = begs.pop();
|
||||||
|
if (beg < left) {
|
||||||
|
left = beg;
|
||||||
|
right = bi;
|
||||||
|
}
|
||||||
|
|
||||||
|
bi = str.indexOf(b, i + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
i = ai < bi && ai >= 0 ? ai : bi;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (begs.length) {
|
||||||
|
result = [ left, right ];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
79
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/balanced-match/package.json
generated
vendored
Normal file
79
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/balanced-match/package.json
generated
vendored
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
{
|
||||||
|
"_args": [
|
||||||
|
[
|
||||||
|
"balanced-match@1.0.2",
|
||||||
|
"/tmp/repository/main"
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"_from": "balanced-match@1.0.2",
|
||||||
|
"_id": "balanced-match@1.0.2",
|
||||||
|
"_inBundle": false,
|
||||||
|
"_integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==",
|
||||||
|
"_location": "/balanced-match",
|
||||||
|
"_phantomChildren": {},
|
||||||
|
"_requested": {
|
||||||
|
"type": "version",
|
||||||
|
"registry": true,
|
||||||
|
"raw": "balanced-match@1.0.2",
|
||||||
|
"name": "balanced-match",
|
||||||
|
"escapedName": "balanced-match",
|
||||||
|
"rawSpec": "1.0.2",
|
||||||
|
"saveSpec": null,
|
||||||
|
"fetchSpec": "1.0.2"
|
||||||
|
},
|
||||||
|
"_requiredBy": [
|
||||||
|
"/brace-expansion"
|
||||||
|
],
|
||||||
|
"_resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
|
||||||
|
"_spec": "1.0.2",
|
||||||
|
"_where": "/tmp/repository/main",
|
||||||
|
"author": {
|
||||||
|
"name": "Julian Gruber",
|
||||||
|
"email": "mail@juliangruber.com",
|
||||||
|
"url": "http://juliangruber.com"
|
||||||
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/juliangruber/balanced-match/issues"
|
||||||
|
},
|
||||||
|
"description": "Match balanced character pairs, like \"{\" and \"}\"",
|
||||||
|
"devDependencies": {
|
||||||
|
"matcha": "^0.7.0",
|
||||||
|
"tape": "^4.6.0"
|
||||||
|
},
|
||||||
|
"homepage": "https://github.com/juliangruber/balanced-match",
|
||||||
|
"keywords": [
|
||||||
|
"match",
|
||||||
|
"regexp",
|
||||||
|
"test",
|
||||||
|
"balanced",
|
||||||
|
"parse"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"main": "index.js",
|
||||||
|
"name": "balanced-match",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git://github.com/juliangruber/balanced-match.git"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"bench": "matcha test/bench.js",
|
||||||
|
"test": "tape test/test.js"
|
||||||
|
},
|
||||||
|
"testling": {
|
||||||
|
"files": "test/*.js",
|
||||||
|
"browsers": [
|
||||||
|
"ie/8..latest",
|
||||||
|
"firefox/20..latest",
|
||||||
|
"firefox/nightly",
|
||||||
|
"chrome/25..latest",
|
||||||
|
"chrome/canary",
|
||||||
|
"opera/12..latest",
|
||||||
|
"opera/next",
|
||||||
|
"safari/5.1..latest",
|
||||||
|
"ipad/6.0..latest",
|
||||||
|
"iphone/6.0..latest",
|
||||||
|
"android-browser/4.2..latest"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"version": "1.0.2"
|
||||||
|
}
|
||||||
21
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/base64-js/LICENSE
generated
vendored
Normal file
21
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/base64-js/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2014 Jameson Little
|
||||||
|
|
||||||
|
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.
|
||||||
34
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/base64-js/README.md
generated
vendored
Normal file
34
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/base64-js/README.md
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
base64-js
|
||||||
|
=========
|
||||||
|
|
||||||
|
`base64-js` does basic base64 encoding/decoding in pure JS.
|
||||||
|
|
||||||
|
[](http://travis-ci.org/beatgammit/base64-js)
|
||||||
|
|
||||||
|
Many browsers already have base64 encoding/decoding functionality, but it is for text data, not all-purpose binary data.
|
||||||
|
|
||||||
|
Sometimes encoding/decoding binary data in the browser is useful, and that is what this module does.
|
||||||
|
|
||||||
|
## install
|
||||||
|
|
||||||
|
With [npm](https://npmjs.org) do:
|
||||||
|
|
||||||
|
`npm install base64-js` and `var base64js = require('base64-js')`
|
||||||
|
|
||||||
|
For use in web browsers do:
|
||||||
|
|
||||||
|
`<script src="base64js.min.js"></script>`
|
||||||
|
|
||||||
|
[Get supported base64-js with the Tidelift Subscription](https://tidelift.com/subscription/pkg/npm-base64-js?utm_source=npm-base64-js&utm_medium=referral&utm_campaign=readme)
|
||||||
|
|
||||||
|
## methods
|
||||||
|
|
||||||
|
`base64js` has three exposed functions, `byteLength`, `toByteArray` and `fromByteArray`, which both take a single argument.
|
||||||
|
|
||||||
|
* `byteLength` - Takes a base64 string and returns length of byte array
|
||||||
|
* `toByteArray` - Takes a base64 string and returns a byte array
|
||||||
|
* `fromByteArray` - Takes a byte array and returns a base64 string
|
||||||
|
|
||||||
|
## license
|
||||||
|
|
||||||
|
MIT
|
||||||
1
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/base64-js/base64js.min.js
generated
vendored
Normal file
1
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/base64-js/base64js.min.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
(function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var b;b="undefined"==typeof window?"undefined"==typeof global?"undefined"==typeof self?this:self:global:window,b.base64js=a()}})(function(){return function(){function b(d,e,g){function a(j,i){if(!e[j]){if(!d[j]){var f="function"==typeof require&&require;if(!i&&f)return f(j,!0);if(h)return h(j,!0);var c=new Error("Cannot find module '"+j+"'");throw c.code="MODULE_NOT_FOUND",c}var k=e[j]={exports:{}};d[j][0].call(k.exports,function(b){var c=d[j][1][b];return a(c||b)},k,k.exports,b,d,e,g)}return e[j].exports}for(var h="function"==typeof require&&require,c=0;c<g.length;c++)a(g[c]);return a}return b}()({"/":[function(a,b,c){'use strict';function d(a){var b=a.length;if(0<b%4)throw new Error("Invalid string. Length must be a multiple of 4");var c=a.indexOf("=");-1===c&&(c=b);var d=c===b?0:4-c%4;return[c,d]}function e(a,b,c){return 3*(b+c)/4-c}function f(a){var b,c,f=d(a),g=f[0],h=f[1],j=new m(e(a,g,h)),k=0,n=0<h?g-4:g;for(c=0;c<n;c+=4)b=l[a.charCodeAt(c)]<<18|l[a.charCodeAt(c+1)]<<12|l[a.charCodeAt(c+2)]<<6|l[a.charCodeAt(c+3)],j[k++]=255&b>>16,j[k++]=255&b>>8,j[k++]=255&b;return 2===h&&(b=l[a.charCodeAt(c)]<<2|l[a.charCodeAt(c+1)]>>4,j[k++]=255&b),1===h&&(b=l[a.charCodeAt(c)]<<10|l[a.charCodeAt(c+1)]<<4|l[a.charCodeAt(c+2)]>>2,j[k++]=255&b>>8,j[k++]=255&b),j}function g(a){return k[63&a>>18]+k[63&a>>12]+k[63&a>>6]+k[63&a]}function h(a,b,c){for(var d,e=[],f=b;f<c;f+=3)d=(16711680&a[f]<<16)+(65280&a[f+1]<<8)+(255&a[f+2]),e.push(g(d));return e.join("")}function j(a){for(var b,c=a.length,d=c%3,e=[],f=16383,g=0,j=c-d;g<j;g+=f)e.push(h(a,g,g+f>j?j:g+f));return 1===d?(b=a[c-1],e.push(k[b>>2]+k[63&b<<4]+"==")):2===d&&(b=(a[c-2]<<8)+a[c-1],e.push(k[b>>10]+k[63&b>>4]+k[63&b<<2]+"=")),e.join("")}c.byteLength=function(a){var b=d(a),c=b[0],e=b[1];return 3*(c+e)/4-e},c.toByteArray=f,c.fromByteArray=j;for(var k=[],l=[],m="undefined"==typeof Uint8Array?Array:Uint8Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,p=n.length;o<p;++o)k[o]=n[o],l[n.charCodeAt(o)]=o;l[45]=62,l[95]=63},{}]},{},[])("/")});
|
||||||
150
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/base64-js/index.js
generated
vendored
Normal file
150
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/base64-js/index.js
generated
vendored
Normal file
@@ -0,0 +1,150 @@
|
|||||||
|
'use strict'
|
||||||
|
|
||||||
|
exports.byteLength = byteLength
|
||||||
|
exports.toByteArray = toByteArray
|
||||||
|
exports.fromByteArray = fromByteArray
|
||||||
|
|
||||||
|
var lookup = []
|
||||||
|
var revLookup = []
|
||||||
|
var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
|
||||||
|
|
||||||
|
var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
|
||||||
|
for (var i = 0, len = code.length; i < len; ++i) {
|
||||||
|
lookup[i] = code[i]
|
||||||
|
revLookup[code.charCodeAt(i)] = i
|
||||||
|
}
|
||||||
|
|
||||||
|
// Support decoding URL-safe base64 strings, as Node.js does.
|
||||||
|
// See: https://en.wikipedia.org/wiki/Base64#URL_applications
|
||||||
|
revLookup['-'.charCodeAt(0)] = 62
|
||||||
|
revLookup['_'.charCodeAt(0)] = 63
|
||||||
|
|
||||||
|
function getLens (b64) {
|
||||||
|
var len = b64.length
|
||||||
|
|
||||||
|
if (len % 4 > 0) {
|
||||||
|
throw new Error('Invalid string. Length must be a multiple of 4')
|
||||||
|
}
|
||||||
|
|
||||||
|
// Trim off extra bytes after placeholder bytes are found
|
||||||
|
// See: https://github.com/beatgammit/base64-js/issues/42
|
||||||
|
var validLen = b64.indexOf('=')
|
||||||
|
if (validLen === -1) validLen = len
|
||||||
|
|
||||||
|
var placeHoldersLen = validLen === len
|
||||||
|
? 0
|
||||||
|
: 4 - (validLen % 4)
|
||||||
|
|
||||||
|
return [validLen, placeHoldersLen]
|
||||||
|
}
|
||||||
|
|
||||||
|
// base64 is 4/3 + up to two characters of the original data
|
||||||
|
function byteLength (b64) {
|
||||||
|
var lens = getLens(b64)
|
||||||
|
var validLen = lens[0]
|
||||||
|
var placeHoldersLen = lens[1]
|
||||||
|
return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
|
||||||
|
}
|
||||||
|
|
||||||
|
function _byteLength (b64, validLen, placeHoldersLen) {
|
||||||
|
return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
|
||||||
|
}
|
||||||
|
|
||||||
|
function toByteArray (b64) {
|
||||||
|
var tmp
|
||||||
|
var lens = getLens(b64)
|
||||||
|
var validLen = lens[0]
|
||||||
|
var placeHoldersLen = lens[1]
|
||||||
|
|
||||||
|
var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))
|
||||||
|
|
||||||
|
var curByte = 0
|
||||||
|
|
||||||
|
// if there are placeholders, only get up to the last complete 4 chars
|
||||||
|
var len = placeHoldersLen > 0
|
||||||
|
? validLen - 4
|
||||||
|
: validLen
|
||||||
|
|
||||||
|
var i
|
||||||
|
for (i = 0; i < len; i += 4) {
|
||||||
|
tmp =
|
||||||
|
(revLookup[b64.charCodeAt(i)] << 18) |
|
||||||
|
(revLookup[b64.charCodeAt(i + 1)] << 12) |
|
||||||
|
(revLookup[b64.charCodeAt(i + 2)] << 6) |
|
||||||
|
revLookup[b64.charCodeAt(i + 3)]
|
||||||
|
arr[curByte++] = (tmp >> 16) & 0xFF
|
||||||
|
arr[curByte++] = (tmp >> 8) & 0xFF
|
||||||
|
arr[curByte++] = tmp & 0xFF
|
||||||
|
}
|
||||||
|
|
||||||
|
if (placeHoldersLen === 2) {
|
||||||
|
tmp =
|
||||||
|
(revLookup[b64.charCodeAt(i)] << 2) |
|
||||||
|
(revLookup[b64.charCodeAt(i + 1)] >> 4)
|
||||||
|
arr[curByte++] = tmp & 0xFF
|
||||||
|
}
|
||||||
|
|
||||||
|
if (placeHoldersLen === 1) {
|
||||||
|
tmp =
|
||||||
|
(revLookup[b64.charCodeAt(i)] << 10) |
|
||||||
|
(revLookup[b64.charCodeAt(i + 1)] << 4) |
|
||||||
|
(revLookup[b64.charCodeAt(i + 2)] >> 2)
|
||||||
|
arr[curByte++] = (tmp >> 8) & 0xFF
|
||||||
|
arr[curByte++] = tmp & 0xFF
|
||||||
|
}
|
||||||
|
|
||||||
|
return arr
|
||||||
|
}
|
||||||
|
|
||||||
|
function tripletToBase64 (num) {
|
||||||
|
return lookup[num >> 18 & 0x3F] +
|
||||||
|
lookup[num >> 12 & 0x3F] +
|
||||||
|
lookup[num >> 6 & 0x3F] +
|
||||||
|
lookup[num & 0x3F]
|
||||||
|
}
|
||||||
|
|
||||||
|
function encodeChunk (uint8, start, end) {
|
||||||
|
var tmp
|
||||||
|
var output = []
|
||||||
|
for (var i = start; i < end; i += 3) {
|
||||||
|
tmp =
|
||||||
|
((uint8[i] << 16) & 0xFF0000) +
|
||||||
|
((uint8[i + 1] << 8) & 0xFF00) +
|
||||||
|
(uint8[i + 2] & 0xFF)
|
||||||
|
output.push(tripletToBase64(tmp))
|
||||||
|
}
|
||||||
|
return output.join('')
|
||||||
|
}
|
||||||
|
|
||||||
|
function fromByteArray (uint8) {
|
||||||
|
var tmp
|
||||||
|
var len = uint8.length
|
||||||
|
var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
|
||||||
|
var parts = []
|
||||||
|
var maxChunkLength = 16383 // must be multiple of 3
|
||||||
|
|
||||||
|
// go through the array every three bytes, we'll deal with trailing stuff later
|
||||||
|
for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
|
||||||
|
parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)))
|
||||||
|
}
|
||||||
|
|
||||||
|
// pad the end with zeros, but make sure to not forget the extra bytes
|
||||||
|
if (extraBytes === 1) {
|
||||||
|
tmp = uint8[len - 1]
|
||||||
|
parts.push(
|
||||||
|
lookup[tmp >> 2] +
|
||||||
|
lookup[(tmp << 4) & 0x3F] +
|
||||||
|
'=='
|
||||||
|
)
|
||||||
|
} else if (extraBytes === 2) {
|
||||||
|
tmp = (uint8[len - 2] << 8) + uint8[len - 1]
|
||||||
|
parts.push(
|
||||||
|
lookup[tmp >> 10] +
|
||||||
|
lookup[(tmp >> 4) & 0x3F] +
|
||||||
|
lookup[(tmp << 2) & 0x3F] +
|
||||||
|
'='
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
return parts.join('')
|
||||||
|
}
|
||||||
78
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/base64-js/package.json
generated
vendored
Normal file
78
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/base64-js/package.json
generated
vendored
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
{
|
||||||
|
"_args": [
|
||||||
|
[
|
||||||
|
"base64-js@1.5.1",
|
||||||
|
"/tmp/repository/main"
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"_from": "base64-js@1.5.1",
|
||||||
|
"_id": "base64-js@1.5.1",
|
||||||
|
"_inBundle": false,
|
||||||
|
"_integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==",
|
||||||
|
"_location": "/base64-js",
|
||||||
|
"_phantomChildren": {},
|
||||||
|
"_requested": {
|
||||||
|
"type": "version",
|
||||||
|
"registry": true,
|
||||||
|
"raw": "base64-js@1.5.1",
|
||||||
|
"name": "base64-js",
|
||||||
|
"escapedName": "base64-js",
|
||||||
|
"rawSpec": "1.5.1",
|
||||||
|
"saveSpec": null,
|
||||||
|
"fetchSpec": "1.5.1"
|
||||||
|
},
|
||||||
|
"_requiredBy": [
|
||||||
|
"/buffer"
|
||||||
|
],
|
||||||
|
"_resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",
|
||||||
|
"_spec": "1.5.1",
|
||||||
|
"_where": "/tmp/repository/main",
|
||||||
|
"author": {
|
||||||
|
"name": "T. Jameson Little",
|
||||||
|
"email": "t.jameson.little@gmail.com"
|
||||||
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/beatgammit/base64-js/issues"
|
||||||
|
},
|
||||||
|
"description": "Base64 encoding/decoding in pure JS",
|
||||||
|
"devDependencies": {
|
||||||
|
"babel-minify": "^0.5.1",
|
||||||
|
"benchmark": "^2.1.4",
|
||||||
|
"browserify": "^16.3.0",
|
||||||
|
"standard": "*",
|
||||||
|
"tape": "4.x"
|
||||||
|
},
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"type": "github",
|
||||||
|
"url": "https://github.com/sponsors/feross"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "patreon",
|
||||||
|
"url": "https://www.patreon.com/feross"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "consulting",
|
||||||
|
"url": "https://feross.org/support"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"homepage": "https://github.com/beatgammit/base64-js",
|
||||||
|
"keywords": [
|
||||||
|
"base64"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"main": "index.js",
|
||||||
|
"name": "base64-js",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git://github.com/beatgammit/base64-js.git"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"build": "browserify -s base64js -r ./ | minify > base64js.min.js",
|
||||||
|
"lint": "standard",
|
||||||
|
"test": "npm run lint && npm run unit",
|
||||||
|
"unit": "tape test/*.js"
|
||||||
|
},
|
||||||
|
"typings": "index.d.ts",
|
||||||
|
"version": "1.5.1"
|
||||||
|
}
|
||||||
52
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/basic-auth/HISTORY.md
generated
vendored
Normal file
52
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/basic-auth/HISTORY.md
generated
vendored
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
2.0.1 / 2018-09-19
|
||||||
|
==================
|
||||||
|
|
||||||
|
* deps: safe-buffer@5.1.2
|
||||||
|
|
||||||
|
2.0.0 / 2017-09-12
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Drop support for Node.js below 0.8
|
||||||
|
* Remove `auth(ctx)` signature -- pass in header or `auth(ctx.req)`
|
||||||
|
* Use `safe-buffer` for improved Buffer API
|
||||||
|
|
||||||
|
1.1.0 / 2016-11-18
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Add `auth.parse` for low-level string parsing
|
||||||
|
|
||||||
|
1.0.4 / 2016-05-10
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Improve error message when `req` argument is not an object
|
||||||
|
* Improve error message when `req` missing `headers` property
|
||||||
|
|
||||||
|
1.0.3 / 2015-07-01
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Fix regression accepting a Koa context
|
||||||
|
|
||||||
|
1.0.2 / 2015-06-12
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Improve error message when `req` argument missing
|
||||||
|
* perf: enable strict mode
|
||||||
|
* perf: hoist regular expression
|
||||||
|
* perf: parse with regular expressions
|
||||||
|
* perf: remove argument reassignment
|
||||||
|
|
||||||
|
1.0.1 / 2015-05-04
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Update readme
|
||||||
|
|
||||||
|
1.0.0 / 2014-07-01
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Support empty password
|
||||||
|
* Support empty username
|
||||||
|
|
||||||
|
0.0.1 / 2013-11-30
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Initial release
|
||||||
24
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/basic-auth/LICENSE
generated
vendored
Normal file
24
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/basic-auth/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
(The MIT License)
|
||||||
|
|
||||||
|
Copyright (c) 2013 TJ Holowaychuk
|
||||||
|
Copyright (c) 2014 Jonathan Ong <me@jongleberry.com>
|
||||||
|
Copyright (c) 2015-2016 Douglas Christopher Wilson <doug@somethingdoug.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.
|
||||||
113
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/basic-auth/README.md
generated
vendored
Normal file
113
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/basic-auth/README.md
generated
vendored
Normal file
@@ -0,0 +1,113 @@
|
|||||||
|
# basic-auth
|
||||||
|
|
||||||
|
[![NPM Version][npm-image]][npm-url]
|
||||||
|
[![NPM Downloads][downloads-image]][downloads-url]
|
||||||
|
[![Node.js Version][node-version-image]][node-version-url]
|
||||||
|
[![Build Status][travis-image]][travis-url]
|
||||||
|
[![Test Coverage][coveralls-image]][coveralls-url]
|
||||||
|
|
||||||
|
Generic basic auth Authorization header field parser for whatever.
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
This is a [Node.js](https://nodejs.org/en/) module available through the
|
||||||
|
[npm registry](https://www.npmjs.com/). Installation is done using the
|
||||||
|
[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):
|
||||||
|
|
||||||
|
```
|
||||||
|
$ npm install basic-auth
|
||||||
|
```
|
||||||
|
|
||||||
|
## API
|
||||||
|
|
||||||
|
<!-- eslint-disable no-unused-vars -->
|
||||||
|
|
||||||
|
```js
|
||||||
|
var auth = require('basic-auth')
|
||||||
|
```
|
||||||
|
|
||||||
|
### auth(req)
|
||||||
|
|
||||||
|
Get the basic auth credentials from the given request. The `Authorization`
|
||||||
|
header is parsed and if the header is invalid, `undefined` is returned,
|
||||||
|
otherwise an object with `name` and `pass` properties.
|
||||||
|
|
||||||
|
### auth.parse(string)
|
||||||
|
|
||||||
|
Parse a basic auth authorization header string. This will return an object
|
||||||
|
with `name` and `pass` properties, or `undefined` if the string is invalid.
|
||||||
|
|
||||||
|
## Example
|
||||||
|
|
||||||
|
Pass a Node.js request object to the module export. If parsing fails
|
||||||
|
`undefined` is returned, otherwise an object with `.name` and `.pass`.
|
||||||
|
|
||||||
|
<!-- eslint-disable no-unused-vars, no-undef -->
|
||||||
|
|
||||||
|
```js
|
||||||
|
var auth = require('basic-auth')
|
||||||
|
var user = auth(req)
|
||||||
|
// => { name: 'something', pass: 'whatever' }
|
||||||
|
```
|
||||||
|
|
||||||
|
A header string from any other location can also be parsed with
|
||||||
|
`auth.parse`, for example a `Proxy-Authorization` header:
|
||||||
|
|
||||||
|
<!-- eslint-disable no-unused-vars, no-undef -->
|
||||||
|
|
||||||
|
```js
|
||||||
|
var auth = require('basic-auth')
|
||||||
|
var user = auth.parse(req.getHeader('Proxy-Authorization'))
|
||||||
|
```
|
||||||
|
|
||||||
|
### With vanilla node.js http server
|
||||||
|
|
||||||
|
```js
|
||||||
|
var http = require('http')
|
||||||
|
var auth = require('basic-auth')
|
||||||
|
var compare = require('tsscmp')
|
||||||
|
|
||||||
|
// Create server
|
||||||
|
var server = http.createServer(function (req, res) {
|
||||||
|
var credentials = auth(req)
|
||||||
|
|
||||||
|
// Check credentials
|
||||||
|
// The "check" function will typically be against your user store
|
||||||
|
if (!credentials || !check(credentials.name, credentials.pass)) {
|
||||||
|
res.statusCode = 401
|
||||||
|
res.setHeader('WWW-Authenticate', 'Basic realm="example"')
|
||||||
|
res.end('Access denied')
|
||||||
|
} else {
|
||||||
|
res.end('Access granted')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
// Basic function to validate credentials for example
|
||||||
|
function check (name, pass) {
|
||||||
|
var valid = true
|
||||||
|
|
||||||
|
// Simple method to prevent short-circut and use timing-safe compare
|
||||||
|
valid = compare(name, 'john') && valid
|
||||||
|
valid = compare(pass, 'secret') && valid
|
||||||
|
|
||||||
|
return valid
|
||||||
|
}
|
||||||
|
|
||||||
|
// Listen
|
||||||
|
server.listen(3000)
|
||||||
|
```
|
||||||
|
|
||||||
|
# License
|
||||||
|
|
||||||
|
[MIT](LICENSE)
|
||||||
|
|
||||||
|
[coveralls-image]: https://badgen.net/coveralls/c/github/jshttp/basic-auth/master
|
||||||
|
[coveralls-url]: https://coveralls.io/r/jshttp/basic-auth?branch=master
|
||||||
|
[downloads-image]: https://badgen.net/npm/dm/basic-auth
|
||||||
|
[downloads-url]: https://npmjs.org/package/basic-auth
|
||||||
|
[node-version-image]: https://badgen.net/npm/node/basic-auth
|
||||||
|
[node-version-url]: https://nodejs.org/en/download
|
||||||
|
[npm-image]: https://badgen.net/npm/v/basic-auth
|
||||||
|
[npm-url]: https://npmjs.org/package/basic-auth
|
||||||
|
[travis-image]: https://badgen.net/travis/jshttp/basic-auth/master
|
||||||
|
[travis-url]: https://travis-ci.org/jshttp/basic-auth
|
||||||
133
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/basic-auth/index.js
generated
vendored
Normal file
133
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/basic-auth/index.js
generated
vendored
Normal file
@@ -0,0 +1,133 @@
|
|||||||
|
/*!
|
||||||
|
* basic-auth
|
||||||
|
* Copyright(c) 2013 TJ Holowaychuk
|
||||||
|
* Copyright(c) 2014 Jonathan Ong
|
||||||
|
* Copyright(c) 2015-2016 Douglas Christopher Wilson
|
||||||
|
* MIT Licensed
|
||||||
|
*/
|
||||||
|
|
||||||
|
'use strict'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Module dependencies.
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
|
||||||
|
var Buffer = require('safe-buffer').Buffer
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Module exports.
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
|
||||||
|
module.exports = auth
|
||||||
|
module.exports.parse = parse
|
||||||
|
|
||||||
|
/**
|
||||||
|
* RegExp for basic auth credentials
|
||||||
|
*
|
||||||
|
* credentials = auth-scheme 1*SP token68
|
||||||
|
* auth-scheme = "Basic" ; case insensitive
|
||||||
|
* token68 = 1*( ALPHA / DIGIT / "-" / "." / "_" / "~" / "+" / "/" ) *"="
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
|
||||||
|
var CREDENTIALS_REGEXP = /^ *(?:[Bb][Aa][Ss][Ii][Cc]) +([A-Za-z0-9._~+/-]+=*) *$/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* RegExp for basic auth user/pass
|
||||||
|
*
|
||||||
|
* user-pass = userid ":" password
|
||||||
|
* userid = *<TEXT excluding ":">
|
||||||
|
* password = *TEXT
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
|
||||||
|
var USER_PASS_REGEXP = /^([^:]*):(.*)$/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse the Authorization header field of a request.
|
||||||
|
*
|
||||||
|
* @param {object} req
|
||||||
|
* @return {object} with .name and .pass
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
|
||||||
|
function auth (req) {
|
||||||
|
if (!req) {
|
||||||
|
throw new TypeError('argument req is required')
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof req !== 'object') {
|
||||||
|
throw new TypeError('argument req is required to be an object')
|
||||||
|
}
|
||||||
|
|
||||||
|
// get header
|
||||||
|
var header = getAuthorization(req)
|
||||||
|
|
||||||
|
// parse header
|
||||||
|
return parse(header)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Decode base64 string.
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
|
||||||
|
function decodeBase64 (str) {
|
||||||
|
return Buffer.from(str, 'base64').toString()
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the Authorization header from request object.
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
|
||||||
|
function getAuthorization (req) {
|
||||||
|
if (!req.headers || typeof req.headers !== 'object') {
|
||||||
|
throw new TypeError('argument req is required to have headers property')
|
||||||
|
}
|
||||||
|
|
||||||
|
return req.headers.authorization
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse basic auth to object.
|
||||||
|
*
|
||||||
|
* @param {string} string
|
||||||
|
* @return {object}
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
|
||||||
|
function parse (string) {
|
||||||
|
if (typeof string !== 'string') {
|
||||||
|
return undefined
|
||||||
|
}
|
||||||
|
|
||||||
|
// parse header
|
||||||
|
var match = CREDENTIALS_REGEXP.exec(string)
|
||||||
|
|
||||||
|
if (!match) {
|
||||||
|
return undefined
|
||||||
|
}
|
||||||
|
|
||||||
|
// decode user pass
|
||||||
|
var userPass = USER_PASS_REGEXP.exec(decodeBase64(match[1]))
|
||||||
|
|
||||||
|
if (!userPass) {
|
||||||
|
return undefined
|
||||||
|
}
|
||||||
|
|
||||||
|
// return credentials object
|
||||||
|
return new Credentials(userPass[1], userPass[2])
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Object to represent user credentials.
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
|
||||||
|
function Credentials (name, pass) {
|
||||||
|
this.name = name
|
||||||
|
this.pass = pass
|
||||||
|
}
|
||||||
76
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/basic-auth/package.json
generated
vendored
Normal file
76
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/basic-auth/package.json
generated
vendored
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
{
|
||||||
|
"_args": [
|
||||||
|
[
|
||||||
|
"basic-auth@2.0.1",
|
||||||
|
"/tmp/repository/main"
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"_from": "basic-auth@2.0.1",
|
||||||
|
"_id": "basic-auth@2.0.1",
|
||||||
|
"_inBundle": false,
|
||||||
|
"_integrity": "sha512-NF+epuEdnUYVlGuhaxbbq+dvJttwLnGY+YixlXlME5KpQ5W3CnXA5cVTneY3SPbPDRkcjMbifrwmFYcClgOZeg==",
|
||||||
|
"_location": "/basic-auth",
|
||||||
|
"_phantomChildren": {},
|
||||||
|
"_requested": {
|
||||||
|
"type": "version",
|
||||||
|
"registry": true,
|
||||||
|
"raw": "basic-auth@2.0.1",
|
||||||
|
"name": "basic-auth",
|
||||||
|
"escapedName": "basic-auth",
|
||||||
|
"rawSpec": "2.0.1",
|
||||||
|
"saveSpec": null,
|
||||||
|
"fetchSpec": "2.0.1"
|
||||||
|
},
|
||||||
|
"_requiredBy": [
|
||||||
|
"/morgan"
|
||||||
|
],
|
||||||
|
"_resolved": "https://registry.npmjs.org/basic-auth/-/basic-auth-2.0.1.tgz",
|
||||||
|
"_spec": "2.0.1",
|
||||||
|
"_where": "/tmp/repository/main",
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/jshttp/basic-auth/issues"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"safe-buffer": "5.1.2"
|
||||||
|
},
|
||||||
|
"description": "node.js basic auth parser",
|
||||||
|
"devDependencies": {
|
||||||
|
"eslint": "5.6.0",
|
||||||
|
"eslint-config-standard": "12.0.0",
|
||||||
|
"eslint-plugin-import": "2.14.0",
|
||||||
|
"eslint-plugin-markdown": "1.0.0-beta.6",
|
||||||
|
"eslint-plugin-node": "7.0.1",
|
||||||
|
"eslint-plugin-promise": "4.0.1",
|
||||||
|
"eslint-plugin-standard": "4.0.0",
|
||||||
|
"istanbul": "0.4.5",
|
||||||
|
"mocha": "5.2.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.8"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"HISTORY.md",
|
||||||
|
"LICENSE",
|
||||||
|
"index.js"
|
||||||
|
],
|
||||||
|
"homepage": "https://github.com/jshttp/basic-auth#readme",
|
||||||
|
"keywords": [
|
||||||
|
"basic",
|
||||||
|
"auth",
|
||||||
|
"authorization",
|
||||||
|
"basicauth"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"name": "basic-auth",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/jshttp/basic-auth.git"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"lint": "eslint --plugin markdown --ext js,md .",
|
||||||
|
"test": "mocha --check-leaks --reporter spec --bail",
|
||||||
|
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/",
|
||||||
|
"test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/"
|
||||||
|
},
|
||||||
|
"version": "2.0.1"
|
||||||
|
}
|
||||||
59
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/bl/.jshintrc
generated
vendored
Normal file
59
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/bl/.jshintrc
generated
vendored
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
{
|
||||||
|
"predef": [ ]
|
||||||
|
, "bitwise": false
|
||||||
|
, "camelcase": false
|
||||||
|
, "curly": false
|
||||||
|
, "eqeqeq": false
|
||||||
|
, "forin": false
|
||||||
|
, "immed": false
|
||||||
|
, "latedef": false
|
||||||
|
, "noarg": true
|
||||||
|
, "noempty": true
|
||||||
|
, "nonew": true
|
||||||
|
, "plusplus": false
|
||||||
|
, "quotmark": true
|
||||||
|
, "regexp": false
|
||||||
|
, "undef": true
|
||||||
|
, "unused": true
|
||||||
|
, "strict": false
|
||||||
|
, "trailing": true
|
||||||
|
, "maxlen": 120
|
||||||
|
, "asi": true
|
||||||
|
, "boss": true
|
||||||
|
, "debug": true
|
||||||
|
, "eqnull": true
|
||||||
|
, "esnext": true
|
||||||
|
, "evil": true
|
||||||
|
, "expr": true
|
||||||
|
, "funcscope": false
|
||||||
|
, "globalstrict": false
|
||||||
|
, "iterator": false
|
||||||
|
, "lastsemic": true
|
||||||
|
, "laxbreak": true
|
||||||
|
, "laxcomma": true
|
||||||
|
, "loopfunc": true
|
||||||
|
, "multistr": false
|
||||||
|
, "onecase": false
|
||||||
|
, "proto": false
|
||||||
|
, "regexdash": false
|
||||||
|
, "scripturl": true
|
||||||
|
, "smarttabs": false
|
||||||
|
, "shadow": false
|
||||||
|
, "sub": true
|
||||||
|
, "supernew": false
|
||||||
|
, "validthis": true
|
||||||
|
, "browser": true
|
||||||
|
, "couch": false
|
||||||
|
, "devel": false
|
||||||
|
, "dojo": false
|
||||||
|
, "mootools": false
|
||||||
|
, "node": true
|
||||||
|
, "nonstandard": true
|
||||||
|
, "prototypejs": false
|
||||||
|
, "rhino": false
|
||||||
|
, "worker": true
|
||||||
|
, "wsh": false
|
||||||
|
, "nomen": false
|
||||||
|
, "onevar": false
|
||||||
|
, "passfail": false
|
||||||
|
}
|
||||||
13
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/bl/.travis.yml
generated
vendored
Normal file
13
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/bl/.travis.yml
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
sudo: false
|
||||||
|
language: node_js
|
||||||
|
node_js:
|
||||||
|
- '6'
|
||||||
|
- '8'
|
||||||
|
- '10'
|
||||||
|
- '12'
|
||||||
|
- '14'
|
||||||
|
- lts/*
|
||||||
|
notifications:
|
||||||
|
email:
|
||||||
|
- rod@vagg.org
|
||||||
|
- matteo.collina@gmail.com
|
||||||
13
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/bl/LICENSE.md
generated
vendored
Normal file
13
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/bl/LICENSE.md
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
The MIT License (MIT)
|
||||||
|
=====================
|
||||||
|
|
||||||
|
Copyright (c) 2013-2016 bl contributors
|
||||||
|
----------------------------------
|
||||||
|
|
||||||
|
*bl contributors listed at <https://github.com/rvagg/bl#contributors>*
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
208
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/bl/README.md
generated
vendored
Normal file
208
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/bl/README.md
generated
vendored
Normal file
@@ -0,0 +1,208 @@
|
|||||||
|
# bl *(BufferList)*
|
||||||
|
|
||||||
|
[](https://travis-ci.org/rvagg/bl)
|
||||||
|
|
||||||
|
**A Node.js Buffer list collector, reader and streamer thingy.**
|
||||||
|
|
||||||
|
[](https://nodei.co/npm/bl/)
|
||||||
|
[](https://nodei.co/npm/bl/)
|
||||||
|
|
||||||
|
**bl** is a storage object for collections of Node Buffers, exposing them with the main Buffer readable API. Also works as a duplex stream so you can collect buffers from a stream that emits them and emit buffers to a stream that consumes them!
|
||||||
|
|
||||||
|
The original buffers are kept intact and copies are only done as necessary. Any reads that require the use of a single original buffer will return a slice of that buffer only (which references the same memory as the original buffer). Reads that span buffers perform concatenation as required and return the results transparently.
|
||||||
|
|
||||||
|
```js
|
||||||
|
const BufferList = require('bl')
|
||||||
|
|
||||||
|
var bl = new BufferList()
|
||||||
|
bl.append(new Buffer('abcd'))
|
||||||
|
bl.append(new Buffer('efg'))
|
||||||
|
bl.append('hi') // bl will also accept & convert Strings
|
||||||
|
bl.append(new Buffer('j'))
|
||||||
|
bl.append(new Buffer([ 0x3, 0x4 ]))
|
||||||
|
|
||||||
|
console.log(bl.length) // 12
|
||||||
|
|
||||||
|
console.log(bl.slice(0, 10).toString('ascii')) // 'abcdefghij'
|
||||||
|
console.log(bl.slice(3, 10).toString('ascii')) // 'defghij'
|
||||||
|
console.log(bl.slice(3, 6).toString('ascii')) // 'def'
|
||||||
|
console.log(bl.slice(3, 8).toString('ascii')) // 'defgh'
|
||||||
|
console.log(bl.slice(5, 10).toString('ascii')) // 'fghij'
|
||||||
|
|
||||||
|
// or just use toString!
|
||||||
|
console.log(bl.toString()) // 'abcdefghij\u0003\u0004'
|
||||||
|
console.log(bl.toString('ascii', 3, 8)) // 'defgh'
|
||||||
|
console.log(bl.toString('ascii', 5, 10)) // 'fghij'
|
||||||
|
|
||||||
|
// other standard Buffer readables
|
||||||
|
console.log(bl.readUInt16BE(10)) // 0x0304
|
||||||
|
console.log(bl.readUInt16LE(10)) // 0x0403
|
||||||
|
```
|
||||||
|
|
||||||
|
Give it a callback in the constructor and use it just like **[concat-stream](https://github.com/maxogden/node-concat-stream)**:
|
||||||
|
|
||||||
|
```js
|
||||||
|
const bl = require('bl')
|
||||||
|
, fs = require('fs')
|
||||||
|
|
||||||
|
fs.createReadStream('README.md')
|
||||||
|
.pipe(bl(function (err, data) { // note 'new' isn't strictly required
|
||||||
|
// `data` is a complete Buffer object containing the full data
|
||||||
|
console.log(data.toString())
|
||||||
|
}))
|
||||||
|
```
|
||||||
|
|
||||||
|
Note that when you use the *callback* method like this, the resulting `data` parameter is a concatenation of all `Buffer` objects in the list. If you want to avoid the overhead of this concatenation (in cases of extreme performance consciousness), then avoid the *callback* method and just listen to `'end'` instead, like a standard Stream.
|
||||||
|
|
||||||
|
Or to fetch a URL using [hyperquest](https://github.com/substack/hyperquest) (should work with [request](http://github.com/mikeal/request) and even plain Node http too!):
|
||||||
|
```js
|
||||||
|
const hyperquest = require('hyperquest')
|
||||||
|
, bl = require('bl')
|
||||||
|
, url = 'https://raw.github.com/rvagg/bl/master/README.md'
|
||||||
|
|
||||||
|
hyperquest(url).pipe(bl(function (err, data) {
|
||||||
|
console.log(data.toString())
|
||||||
|
}))
|
||||||
|
```
|
||||||
|
|
||||||
|
Or, use it as a readable stream to recompose a list of Buffers to an output source:
|
||||||
|
|
||||||
|
```js
|
||||||
|
const BufferList = require('bl')
|
||||||
|
, fs = require('fs')
|
||||||
|
|
||||||
|
var bl = new BufferList()
|
||||||
|
bl.append(new Buffer('abcd'))
|
||||||
|
bl.append(new Buffer('efg'))
|
||||||
|
bl.append(new Buffer('hi'))
|
||||||
|
bl.append(new Buffer('j'))
|
||||||
|
|
||||||
|
bl.pipe(fs.createWriteStream('gibberish.txt'))
|
||||||
|
```
|
||||||
|
|
||||||
|
## API
|
||||||
|
|
||||||
|
* <a href="#ctor"><code><b>new BufferList([ callback ])</b></code></a>
|
||||||
|
* <a href="#length"><code>bl.<b>length</b></code></a>
|
||||||
|
* <a href="#append"><code>bl.<b>append(buffer)</b></code></a>
|
||||||
|
* <a href="#get"><code>bl.<b>get(index)</b></code></a>
|
||||||
|
* <a href="#slice"><code>bl.<b>slice([ start[, end ] ])</b></code></a>
|
||||||
|
* <a href="#shallowSlice"><code>bl.<b>shallowSlice([ start[, end ] ])</b></code></a>
|
||||||
|
* <a href="#copy"><code>bl.<b>copy(dest, [ destStart, [ srcStart [, srcEnd ] ] ])</b></code></a>
|
||||||
|
* <a href="#duplicate"><code>bl.<b>duplicate()</b></code></a>
|
||||||
|
* <a href="#consume"><code>bl.<b>consume(bytes)</b></code></a>
|
||||||
|
* <a href="#toString"><code>bl.<b>toString([encoding, [ start, [ end ]]])</b></code></a>
|
||||||
|
* <a href="#readXX"><code>bl.<b>readDoubleBE()</b></code>, <code>bl.<b>readDoubleLE()</b></code>, <code>bl.<b>readFloatBE()</b></code>, <code>bl.<b>readFloatLE()</b></code>, <code>bl.<b>readInt32BE()</b></code>, <code>bl.<b>readInt32LE()</b></code>, <code>bl.<b>readUInt32BE()</b></code>, <code>bl.<b>readUInt32LE()</b></code>, <code>bl.<b>readInt16BE()</b></code>, <code>bl.<b>readInt16LE()</b></code>, <code>bl.<b>readUInt16BE()</b></code>, <code>bl.<b>readUInt16LE()</b></code>, <code>bl.<b>readInt8()</b></code>, <code>bl.<b>readUInt8()</b></code></a>
|
||||||
|
* <a href="#streams">Streams</a>
|
||||||
|
|
||||||
|
--------------------------------------------------------
|
||||||
|
<a name="ctor"></a>
|
||||||
|
### new BufferList([ callback | Buffer | Buffer array | BufferList | BufferList array | String ])
|
||||||
|
The constructor takes an optional callback, if supplied, the callback will be called with an error argument followed by a reference to the **bl** instance, when `bl.end()` is called (i.e. from a piped stream). This is a convenient method of collecting the entire contents of a stream, particularly when the stream is *chunky*, such as a network stream.
|
||||||
|
|
||||||
|
Normally, no arguments are required for the constructor, but you can initialise the list by passing in a single `Buffer` object or an array of `Buffer` object.
|
||||||
|
|
||||||
|
`new` is not strictly required, if you don't instantiate a new object, it will be done automatically for you so you can create a new instance simply with:
|
||||||
|
|
||||||
|
```js
|
||||||
|
var bl = require('bl')
|
||||||
|
var myinstance = bl()
|
||||||
|
|
||||||
|
// equivalent to:
|
||||||
|
|
||||||
|
var BufferList = require('bl')
|
||||||
|
var myinstance = new BufferList()
|
||||||
|
```
|
||||||
|
|
||||||
|
--------------------------------------------------------
|
||||||
|
<a name="length"></a>
|
||||||
|
### bl.length
|
||||||
|
Get the length of the list in bytes. This is the sum of the lengths of all of the buffers contained in the list, minus any initial offset for a semi-consumed buffer at the beginning. Should accurately represent the total number of bytes that can be read from the list.
|
||||||
|
|
||||||
|
--------------------------------------------------------
|
||||||
|
<a name="append"></a>
|
||||||
|
### bl.append(Buffer | Buffer array | BufferList | BufferList array | String)
|
||||||
|
`append(buffer)` adds an additional buffer or BufferList to the internal list. `this` is returned so it can be chained.
|
||||||
|
|
||||||
|
--------------------------------------------------------
|
||||||
|
<a name="get"></a>
|
||||||
|
### bl.get(index)
|
||||||
|
`get()` will return the byte at the specified index.
|
||||||
|
|
||||||
|
--------------------------------------------------------
|
||||||
|
<a name="slice"></a>
|
||||||
|
### bl.slice([ start, [ end ] ])
|
||||||
|
`slice()` returns a new `Buffer` object containing the bytes within the range specified. Both `start` and `end` are optional and will default to the beginning and end of the list respectively.
|
||||||
|
|
||||||
|
If the requested range spans a single internal buffer then a slice of that buffer will be returned which shares the original memory range of that Buffer. If the range spans multiple buffers then copy operations will likely occur to give you a uniform Buffer.
|
||||||
|
|
||||||
|
--------------------------------------------------------
|
||||||
|
<a name="shallowSlice"></a>
|
||||||
|
### bl.shallowSlice([ start, [ end ] ])
|
||||||
|
`shallowSlice()` returns a new `BufferList` object containing the bytes within the range specified. Both `start` and `end` are optional and will default to the beginning and end of the list respectively.
|
||||||
|
|
||||||
|
No copies will be performed. All buffers in the result share memory with the original list.
|
||||||
|
|
||||||
|
--------------------------------------------------------
|
||||||
|
<a name="copy"></a>
|
||||||
|
### bl.copy(dest, [ destStart, [ srcStart [, srcEnd ] ] ])
|
||||||
|
`copy()` copies the content of the list in the `dest` buffer, starting from `destStart` and containing the bytes within the range specified with `srcStart` to `srcEnd`. `destStart`, `start` and `end` are optional and will default to the beginning of the `dest` buffer, and the beginning and end of the list respectively.
|
||||||
|
|
||||||
|
--------------------------------------------------------
|
||||||
|
<a name="duplicate"></a>
|
||||||
|
### bl.duplicate()
|
||||||
|
`duplicate()` performs a **shallow-copy** of the list. The internal Buffers remains the same, so if you change the underlying Buffers, the change will be reflected in both the original and the duplicate. This method is needed if you want to call `consume()` or `pipe()` and still keep the original list.Example:
|
||||||
|
|
||||||
|
```js
|
||||||
|
var bl = new BufferList()
|
||||||
|
|
||||||
|
bl.append('hello')
|
||||||
|
bl.append(' world')
|
||||||
|
bl.append('\n')
|
||||||
|
|
||||||
|
bl.duplicate().pipe(process.stdout, { end: false })
|
||||||
|
|
||||||
|
console.log(bl.toString())
|
||||||
|
```
|
||||||
|
|
||||||
|
--------------------------------------------------------
|
||||||
|
<a name="consume"></a>
|
||||||
|
### bl.consume(bytes)
|
||||||
|
`consume()` will shift bytes *off the start of the list*. The number of bytes consumed don't need to line up with the sizes of the internal Buffers—initial offsets will be calculated accordingly in order to give you a consistent view of the data.
|
||||||
|
|
||||||
|
--------------------------------------------------------
|
||||||
|
<a name="toString"></a>
|
||||||
|
### bl.toString([encoding, [ start, [ end ]]])
|
||||||
|
`toString()` will return a string representation of the buffer. The optional `start` and `end` arguments are passed on to `slice()`, while the `encoding` is passed on to `toString()` of the resulting Buffer. See the [Buffer#toString()](http://nodejs.org/docs/latest/api/buffer.html#buffer_buf_tostring_encoding_start_end) documentation for more information.
|
||||||
|
|
||||||
|
--------------------------------------------------------
|
||||||
|
<a name="readXX"></a>
|
||||||
|
### bl.readDoubleBE(), bl.readDoubleLE(), bl.readFloatBE(), bl.readFloatLE(), bl.readInt32BE(), bl.readInt32LE(), bl.readUInt32BE(), bl.readUInt32LE(), bl.readInt16BE(), bl.readInt16LE(), bl.readUInt16BE(), bl.readUInt16LE(), bl.readInt8(), bl.readUInt8()
|
||||||
|
|
||||||
|
All of the standard byte-reading methods of the `Buffer` interface are implemented and will operate across internal Buffer boundaries transparently.
|
||||||
|
|
||||||
|
See the <b><code>[Buffer](http://nodejs.org/docs/latest/api/buffer.html)</code></b> documentation for how these work.
|
||||||
|
|
||||||
|
--------------------------------------------------------
|
||||||
|
<a name="streams"></a>
|
||||||
|
### Streams
|
||||||
|
**bl** is a Node **[Duplex Stream](http://nodejs.org/docs/latest/api/stream.html#stream_class_stream_duplex)**, so it can be read from and written to like a standard Node stream. You can also `pipe()` to and from a **bl** instance.
|
||||||
|
|
||||||
|
--------------------------------------------------------
|
||||||
|
|
||||||
|
## Contributors
|
||||||
|
|
||||||
|
**bl** is brought to you by the following hackers:
|
||||||
|
|
||||||
|
* [Rod Vagg](https://github.com/rvagg)
|
||||||
|
* [Matteo Collina](https://github.com/mcollina)
|
||||||
|
* [Jarett Cruger](https://github.com/jcrugzz)
|
||||||
|
|
||||||
|
=======
|
||||||
|
|
||||||
|
<a name="license"></a>
|
||||||
|
## License & copyright
|
||||||
|
|
||||||
|
Copyright (c) 2013-2016 bl contributors (listed above).
|
||||||
|
|
||||||
|
bl is licensed under the MIT license. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE.md file for more details.
|
||||||
290
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/bl/bl.js
generated
vendored
Normal file
290
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/bl/bl.js
generated
vendored
Normal file
@@ -0,0 +1,290 @@
|
|||||||
|
var DuplexStream = require('readable-stream/duplex')
|
||||||
|
, util = require('util')
|
||||||
|
, Buffer = require('safe-buffer').Buffer
|
||||||
|
|
||||||
|
|
||||||
|
function BufferList (callback) {
|
||||||
|
if (!(this instanceof BufferList))
|
||||||
|
return new BufferList(callback)
|
||||||
|
|
||||||
|
this._bufs = []
|
||||||
|
this.length = 0
|
||||||
|
|
||||||
|
if (typeof callback == 'function') {
|
||||||
|
this._callback = callback
|
||||||
|
|
||||||
|
var piper = function piper (err) {
|
||||||
|
if (this._callback) {
|
||||||
|
this._callback(err)
|
||||||
|
this._callback = null
|
||||||
|
}
|
||||||
|
}.bind(this)
|
||||||
|
|
||||||
|
this.on('pipe', function onPipe (src) {
|
||||||
|
src.on('error', piper)
|
||||||
|
})
|
||||||
|
this.on('unpipe', function onUnpipe (src) {
|
||||||
|
src.removeListener('error', piper)
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.append(callback)
|
||||||
|
}
|
||||||
|
|
||||||
|
DuplexStream.call(this)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
util.inherits(BufferList, DuplexStream)
|
||||||
|
|
||||||
|
|
||||||
|
BufferList.prototype._offset = function _offset (offset) {
|
||||||
|
var tot = 0, i = 0, _t
|
||||||
|
if (offset === 0) return [ 0, 0 ]
|
||||||
|
for (; i < this._bufs.length; i++) {
|
||||||
|
_t = tot + this._bufs[i].length
|
||||||
|
if (offset < _t || i == this._bufs.length - 1)
|
||||||
|
return [ i, offset - tot ]
|
||||||
|
tot = _t
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BufferList.prototype.append = function append (buf) {
|
||||||
|
var i = 0
|
||||||
|
|
||||||
|
if (Buffer.isBuffer(buf)) {
|
||||||
|
this._appendBuffer(buf);
|
||||||
|
} else if (Array.isArray(buf)) {
|
||||||
|
for (; i < buf.length; i++)
|
||||||
|
this.append(buf[i])
|
||||||
|
} else if (buf instanceof BufferList) {
|
||||||
|
// unwrap argument into individual BufferLists
|
||||||
|
for (; i < buf._bufs.length; i++)
|
||||||
|
this.append(buf._bufs[i])
|
||||||
|
} else if (buf != null) {
|
||||||
|
// coerce number arguments to strings, since Buffer(number) does
|
||||||
|
// uninitialized memory allocation
|
||||||
|
if (typeof buf == 'number')
|
||||||
|
buf = buf.toString()
|
||||||
|
|
||||||
|
this._appendBuffer(Buffer.from(buf));
|
||||||
|
}
|
||||||
|
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BufferList.prototype._appendBuffer = function appendBuffer (buf) {
|
||||||
|
this._bufs.push(buf)
|
||||||
|
this.length += buf.length
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BufferList.prototype._write = function _write (buf, encoding, callback) {
|
||||||
|
this._appendBuffer(buf)
|
||||||
|
|
||||||
|
if (typeof callback == 'function')
|
||||||
|
callback()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BufferList.prototype._read = function _read (size) {
|
||||||
|
if (!this.length)
|
||||||
|
return this.push(null)
|
||||||
|
|
||||||
|
size = Math.min(size, this.length)
|
||||||
|
this.push(this.slice(0, size))
|
||||||
|
this.consume(size)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BufferList.prototype.end = function end (chunk) {
|
||||||
|
DuplexStream.prototype.end.call(this, chunk)
|
||||||
|
|
||||||
|
if (this._callback) {
|
||||||
|
this._callback(null, this.slice())
|
||||||
|
this._callback = null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BufferList.prototype.get = function get (index) {
|
||||||
|
return this.slice(index, index + 1)[0]
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BufferList.prototype.slice = function slice (start, end) {
|
||||||
|
if (typeof start == 'number' && start < 0)
|
||||||
|
start += this.length
|
||||||
|
if (typeof end == 'number' && end < 0)
|
||||||
|
end += this.length
|
||||||
|
return this.copy(null, 0, start, end)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BufferList.prototype.copy = function copy (dst, dstStart, srcStart, srcEnd) {
|
||||||
|
if (typeof srcStart != 'number' || srcStart < 0)
|
||||||
|
srcStart = 0
|
||||||
|
if (typeof srcEnd != 'number' || srcEnd > this.length)
|
||||||
|
srcEnd = this.length
|
||||||
|
if (srcStart >= this.length)
|
||||||
|
return dst || Buffer.alloc(0)
|
||||||
|
if (srcEnd <= 0)
|
||||||
|
return dst || Buffer.alloc(0)
|
||||||
|
|
||||||
|
var copy = !!dst
|
||||||
|
, off = this._offset(srcStart)
|
||||||
|
, len = srcEnd - srcStart
|
||||||
|
, bytes = len
|
||||||
|
, bufoff = (copy && dstStart) || 0
|
||||||
|
, start = off[1]
|
||||||
|
, l
|
||||||
|
, i
|
||||||
|
|
||||||
|
// copy/slice everything
|
||||||
|
if (srcStart === 0 && srcEnd == this.length) {
|
||||||
|
if (!copy) { // slice, but full concat if multiple buffers
|
||||||
|
return this._bufs.length === 1
|
||||||
|
? this._bufs[0]
|
||||||
|
: Buffer.concat(this._bufs, this.length)
|
||||||
|
}
|
||||||
|
|
||||||
|
// copy, need to copy individual buffers
|
||||||
|
for (i = 0; i < this._bufs.length; i++) {
|
||||||
|
this._bufs[i].copy(dst, bufoff)
|
||||||
|
bufoff += this._bufs[i].length
|
||||||
|
}
|
||||||
|
|
||||||
|
return dst
|
||||||
|
}
|
||||||
|
|
||||||
|
// easy, cheap case where it's a subset of one of the buffers
|
||||||
|
if (bytes <= this._bufs[off[0]].length - start) {
|
||||||
|
return copy
|
||||||
|
? this._bufs[off[0]].copy(dst, dstStart, start, start + bytes)
|
||||||
|
: this._bufs[off[0]].slice(start, start + bytes)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!copy) // a slice, we need something to copy in to
|
||||||
|
dst = Buffer.allocUnsafe(len)
|
||||||
|
|
||||||
|
for (i = off[0]; i < this._bufs.length; i++) {
|
||||||
|
l = this._bufs[i].length - start
|
||||||
|
|
||||||
|
if (bytes > l) {
|
||||||
|
this._bufs[i].copy(dst, bufoff, start)
|
||||||
|
bufoff += l
|
||||||
|
} else {
|
||||||
|
this._bufs[i].copy(dst, bufoff, start, start + bytes)
|
||||||
|
bufoff += l
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
bytes -= l
|
||||||
|
|
||||||
|
if (start)
|
||||||
|
start = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
// safeguard so that we don't return uninitialized memory
|
||||||
|
if (dst.length > bufoff) return dst.slice(0, bufoff)
|
||||||
|
|
||||||
|
return dst
|
||||||
|
}
|
||||||
|
|
||||||
|
BufferList.prototype.shallowSlice = function shallowSlice (start, end) {
|
||||||
|
start = start || 0
|
||||||
|
end = end || this.length
|
||||||
|
|
||||||
|
if (start < 0)
|
||||||
|
start += this.length
|
||||||
|
if (end < 0)
|
||||||
|
end += this.length
|
||||||
|
|
||||||
|
var startOffset = this._offset(start)
|
||||||
|
, endOffset = this._offset(end)
|
||||||
|
, buffers = this._bufs.slice(startOffset[0], endOffset[0] + 1)
|
||||||
|
|
||||||
|
if (endOffset[1] == 0)
|
||||||
|
buffers.pop()
|
||||||
|
else
|
||||||
|
buffers[buffers.length-1] = buffers[buffers.length-1].slice(0, endOffset[1])
|
||||||
|
|
||||||
|
if (startOffset[1] != 0)
|
||||||
|
buffers[0] = buffers[0].slice(startOffset[1])
|
||||||
|
|
||||||
|
return new BufferList(buffers)
|
||||||
|
}
|
||||||
|
|
||||||
|
BufferList.prototype.toString = function toString (encoding, start, end) {
|
||||||
|
return this.slice(start, end).toString(encoding)
|
||||||
|
}
|
||||||
|
|
||||||
|
BufferList.prototype.consume = function consume (bytes) {
|
||||||
|
// first, normalize the argument, in accordance with how Buffer does it
|
||||||
|
bytes = Math.trunc(bytes)
|
||||||
|
// do nothing if not a positive number
|
||||||
|
if (Number.isNaN(bytes) || bytes <= 0) return this
|
||||||
|
|
||||||
|
while (this._bufs.length) {
|
||||||
|
if (bytes >= this._bufs[0].length) {
|
||||||
|
bytes -= this._bufs[0].length
|
||||||
|
this.length -= this._bufs[0].length
|
||||||
|
this._bufs.shift()
|
||||||
|
} else {
|
||||||
|
this._bufs[0] = this._bufs[0].slice(bytes)
|
||||||
|
this.length -= bytes
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BufferList.prototype.duplicate = function duplicate () {
|
||||||
|
var i = 0
|
||||||
|
, copy = new BufferList()
|
||||||
|
|
||||||
|
for (; i < this._bufs.length; i++)
|
||||||
|
copy.append(this._bufs[i])
|
||||||
|
|
||||||
|
return copy
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BufferList.prototype.destroy = function destroy () {
|
||||||
|
this._bufs.length = 0
|
||||||
|
this.length = 0
|
||||||
|
this.push(null)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
;(function () {
|
||||||
|
var methods = {
|
||||||
|
'readDoubleBE' : 8
|
||||||
|
, 'readDoubleLE' : 8
|
||||||
|
, 'readFloatBE' : 4
|
||||||
|
, 'readFloatLE' : 4
|
||||||
|
, 'readInt32BE' : 4
|
||||||
|
, 'readInt32LE' : 4
|
||||||
|
, 'readUInt32BE' : 4
|
||||||
|
, 'readUInt32LE' : 4
|
||||||
|
, 'readInt16BE' : 2
|
||||||
|
, 'readInt16LE' : 2
|
||||||
|
, 'readUInt16BE' : 2
|
||||||
|
, 'readUInt16LE' : 2
|
||||||
|
, 'readInt8' : 1
|
||||||
|
, 'readUInt8' : 1
|
||||||
|
}
|
||||||
|
|
||||||
|
for (var m in methods) {
|
||||||
|
(function (m) {
|
||||||
|
BufferList.prototype[m] = function (offset) {
|
||||||
|
return this.slice(offset, offset + methods[m])[m](0)
|
||||||
|
}
|
||||||
|
}(m))
|
||||||
|
}
|
||||||
|
}())
|
||||||
|
|
||||||
|
|
||||||
|
module.exports = BufferList
|
||||||
66
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/bl/package.json
generated
vendored
Normal file
66
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/bl/package.json
generated
vendored
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
{
|
||||||
|
"_args": [
|
||||||
|
[
|
||||||
|
"bl@1.2.3",
|
||||||
|
"/tmp/repository/main"
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"_from": "bl@1.2.3",
|
||||||
|
"_id": "bl@1.2.3",
|
||||||
|
"_inBundle": false,
|
||||||
|
"_integrity": "sha512-pvcNpa0UU69UT341rO6AYy4FVAIkUHuZXRIWbq+zHnsVcRzDDjIAhGuuYoi0d//cwIwtt4pkpKycWEfjdV+vww==",
|
||||||
|
"_location": "/bl",
|
||||||
|
"_phantomChildren": {},
|
||||||
|
"_requested": {
|
||||||
|
"type": "version",
|
||||||
|
"registry": true,
|
||||||
|
"raw": "bl@1.2.3",
|
||||||
|
"name": "bl",
|
||||||
|
"escapedName": "bl",
|
||||||
|
"rawSpec": "1.2.3",
|
||||||
|
"saveSpec": null,
|
||||||
|
"fetchSpec": "1.2.3"
|
||||||
|
},
|
||||||
|
"_requiredBy": [
|
||||||
|
"/tar-stream"
|
||||||
|
],
|
||||||
|
"_resolved": "https://registry.npmjs.org/bl/-/bl-1.2.3.tgz",
|
||||||
|
"_spec": "1.2.3",
|
||||||
|
"_where": "/tmp/repository/main",
|
||||||
|
"authors": [
|
||||||
|
"Rod Vagg <rod@vagg.org> (https://github.com/rvagg)",
|
||||||
|
"Matteo Collina <matteo.collina@gmail.com> (https://github.com/mcollina)",
|
||||||
|
"Jarett Cruger <jcrugzz@gmail.com> (https://github.com/jcrugzz)"
|
||||||
|
],
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/rvagg/bl/issues"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"readable-stream": "^2.3.5",
|
||||||
|
"safe-buffer": "^5.1.1"
|
||||||
|
},
|
||||||
|
"description": "Buffer List: collect buffers and access with a standard readable Buffer interface, streamable too!",
|
||||||
|
"devDependencies": {
|
||||||
|
"faucet": "0.0.1",
|
||||||
|
"hash_file": "~0.1.1",
|
||||||
|
"tape": "~4.9.0"
|
||||||
|
},
|
||||||
|
"homepage": "https://github.com/rvagg/bl",
|
||||||
|
"keywords": [
|
||||||
|
"buffer",
|
||||||
|
"buffers",
|
||||||
|
"stream",
|
||||||
|
"awesomesauce"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"main": "bl.js",
|
||||||
|
"name": "bl",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/rvagg/bl.git"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"test": "node test/test.js | faucet"
|
||||||
|
},
|
||||||
|
"version": "1.2.3"
|
||||||
|
}
|
||||||
718
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/bl/test/test.js
generated
vendored
Normal file
718
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/bl/test/test.js
generated
vendored
Normal file
@@ -0,0 +1,718 @@
|
|||||||
|
var tape = require('tape')
|
||||||
|
, crypto = require('crypto')
|
||||||
|
, fs = require('fs')
|
||||||
|
, hash = require('hash_file')
|
||||||
|
, BufferList = require('../')
|
||||||
|
, Buffer = require('safe-buffer').Buffer
|
||||||
|
|
||||||
|
, encodings =
|
||||||
|
('hex utf8 utf-8 ascii binary base64'
|
||||||
|
+ (process.browser ? '' : ' ucs2 ucs-2 utf16le utf-16le')).split(' ')
|
||||||
|
|
||||||
|
tape('single bytes from single buffer', function (t) {
|
||||||
|
var bl = new BufferList()
|
||||||
|
bl.append(Buffer.from('abcd'))
|
||||||
|
|
||||||
|
t.equal(bl.length, 4)
|
||||||
|
|
||||||
|
t.equal(bl.get(0), 97)
|
||||||
|
t.equal(bl.get(1), 98)
|
||||||
|
t.equal(bl.get(2), 99)
|
||||||
|
t.equal(bl.get(3), 100)
|
||||||
|
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
tape('single bytes from multiple buffers', function (t) {
|
||||||
|
var bl = new BufferList()
|
||||||
|
bl.append(Buffer.from('abcd'))
|
||||||
|
bl.append(Buffer.from('efg'))
|
||||||
|
bl.append(Buffer.from('hi'))
|
||||||
|
bl.append(Buffer.from('j'))
|
||||||
|
|
||||||
|
t.equal(bl.length, 10)
|
||||||
|
|
||||||
|
t.equal(bl.get(0), 97)
|
||||||
|
t.equal(bl.get(1), 98)
|
||||||
|
t.equal(bl.get(2), 99)
|
||||||
|
t.equal(bl.get(3), 100)
|
||||||
|
t.equal(bl.get(4), 101)
|
||||||
|
t.equal(bl.get(5), 102)
|
||||||
|
t.equal(bl.get(6), 103)
|
||||||
|
t.equal(bl.get(7), 104)
|
||||||
|
t.equal(bl.get(8), 105)
|
||||||
|
t.equal(bl.get(9), 106)
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
tape('multi bytes from single buffer', function (t) {
|
||||||
|
var bl = new BufferList()
|
||||||
|
bl.append(Buffer.from('abcd'))
|
||||||
|
|
||||||
|
t.equal(bl.length, 4)
|
||||||
|
|
||||||
|
t.equal(bl.slice(0, 4).toString('ascii'), 'abcd')
|
||||||
|
t.equal(bl.slice(0, 3).toString('ascii'), 'abc')
|
||||||
|
t.equal(bl.slice(1, 4).toString('ascii'), 'bcd')
|
||||||
|
t.equal(bl.slice(-4, -1).toString('ascii'), 'abc')
|
||||||
|
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
tape('multi bytes from single buffer (negative indexes)', function (t) {
|
||||||
|
var bl = new BufferList()
|
||||||
|
bl.append(Buffer.from('buffer'))
|
||||||
|
|
||||||
|
t.equal(bl.length, 6)
|
||||||
|
|
||||||
|
t.equal(bl.slice(-6, -1).toString('ascii'), 'buffe')
|
||||||
|
t.equal(bl.slice(-6, -2).toString('ascii'), 'buff')
|
||||||
|
t.equal(bl.slice(-5, -2).toString('ascii'), 'uff')
|
||||||
|
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
tape('multiple bytes from multiple buffers', function (t) {
|
||||||
|
var bl = new BufferList()
|
||||||
|
|
||||||
|
bl.append(Buffer.from('abcd'))
|
||||||
|
bl.append(Buffer.from('efg'))
|
||||||
|
bl.append(Buffer.from('hi'))
|
||||||
|
bl.append(Buffer.from('j'))
|
||||||
|
|
||||||
|
t.equal(bl.length, 10)
|
||||||
|
|
||||||
|
t.equal(bl.slice(0, 10).toString('ascii'), 'abcdefghij')
|
||||||
|
t.equal(bl.slice(3, 10).toString('ascii'), 'defghij')
|
||||||
|
t.equal(bl.slice(3, 6).toString('ascii'), 'def')
|
||||||
|
t.equal(bl.slice(3, 8).toString('ascii'), 'defgh')
|
||||||
|
t.equal(bl.slice(5, 10).toString('ascii'), 'fghij')
|
||||||
|
t.equal(bl.slice(-7, -4).toString('ascii'), 'def')
|
||||||
|
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
tape('multiple bytes from multiple buffer lists', function (t) {
|
||||||
|
var bl = new BufferList()
|
||||||
|
|
||||||
|
bl.append(new BufferList([ Buffer.from('abcd'), Buffer.from('efg') ]))
|
||||||
|
bl.append(new BufferList([ Buffer.from('hi'), Buffer.from('j') ]))
|
||||||
|
|
||||||
|
t.equal(bl.length, 10)
|
||||||
|
|
||||||
|
t.equal(bl.slice(0, 10).toString('ascii'), 'abcdefghij')
|
||||||
|
|
||||||
|
t.equal(bl.slice(3, 10).toString('ascii'), 'defghij')
|
||||||
|
t.equal(bl.slice(3, 6).toString('ascii'), 'def')
|
||||||
|
t.equal(bl.slice(3, 8).toString('ascii'), 'defgh')
|
||||||
|
t.equal(bl.slice(5, 10).toString('ascii'), 'fghij')
|
||||||
|
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
// same data as previous test, just using nested constructors
|
||||||
|
tape('multiple bytes from crazy nested buffer lists', function (t) {
|
||||||
|
var bl = new BufferList()
|
||||||
|
|
||||||
|
bl.append(new BufferList([
|
||||||
|
new BufferList([
|
||||||
|
new BufferList(Buffer.from('abc'))
|
||||||
|
, Buffer.from('d')
|
||||||
|
, new BufferList(Buffer.from('efg'))
|
||||||
|
])
|
||||||
|
, new BufferList([ Buffer.from('hi') ])
|
||||||
|
, new BufferList(Buffer.from('j'))
|
||||||
|
]))
|
||||||
|
|
||||||
|
t.equal(bl.length, 10)
|
||||||
|
|
||||||
|
t.equal(bl.slice(0, 10).toString('ascii'), 'abcdefghij')
|
||||||
|
|
||||||
|
t.equal(bl.slice(3, 10).toString('ascii'), 'defghij')
|
||||||
|
t.equal(bl.slice(3, 6).toString('ascii'), 'def')
|
||||||
|
t.equal(bl.slice(3, 8).toString('ascii'), 'defgh')
|
||||||
|
t.equal(bl.slice(5, 10).toString('ascii'), 'fghij')
|
||||||
|
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
tape('append accepts arrays of Buffers', function (t) {
|
||||||
|
var bl = new BufferList()
|
||||||
|
bl.append(Buffer.from('abc'))
|
||||||
|
bl.append([ Buffer.from('def') ])
|
||||||
|
bl.append([ Buffer.from('ghi'), Buffer.from('jkl') ])
|
||||||
|
bl.append([ Buffer.from('mnop'), Buffer.from('qrstu'), Buffer.from('vwxyz') ])
|
||||||
|
t.equal(bl.length, 26)
|
||||||
|
t.equal(bl.slice().toString('ascii'), 'abcdefghijklmnopqrstuvwxyz')
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
tape('append accepts arrays of BufferLists', function (t) {
|
||||||
|
var bl = new BufferList()
|
||||||
|
bl.append(Buffer.from('abc'))
|
||||||
|
bl.append([ new BufferList('def') ])
|
||||||
|
bl.append(new BufferList([ Buffer.from('ghi'), new BufferList('jkl') ]))
|
||||||
|
bl.append([ Buffer.from('mnop'), new BufferList([ Buffer.from('qrstu'), Buffer.from('vwxyz') ]) ])
|
||||||
|
t.equal(bl.length, 26)
|
||||||
|
t.equal(bl.slice().toString('ascii'), 'abcdefghijklmnopqrstuvwxyz')
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
tape('append chainable', function (t) {
|
||||||
|
var bl = new BufferList()
|
||||||
|
t.ok(bl.append(Buffer.from('abcd')) === bl)
|
||||||
|
t.ok(bl.append([ Buffer.from('abcd') ]) === bl)
|
||||||
|
t.ok(bl.append(new BufferList(Buffer.from('abcd'))) === bl)
|
||||||
|
t.ok(bl.append([ new BufferList(Buffer.from('abcd')) ]) === bl)
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
tape('append chainable (test results)', function (t) {
|
||||||
|
var bl = new BufferList('abc')
|
||||||
|
.append([ new BufferList('def') ])
|
||||||
|
.append(new BufferList([ Buffer.from('ghi'), new BufferList('jkl') ]))
|
||||||
|
.append([ Buffer.from('mnop'), new BufferList([ Buffer.from('qrstu'), Buffer.from('vwxyz') ]) ])
|
||||||
|
|
||||||
|
t.equal(bl.length, 26)
|
||||||
|
t.equal(bl.slice().toString('ascii'), 'abcdefghijklmnopqrstuvwxyz')
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
tape('consuming from multiple buffers', function (t) {
|
||||||
|
var bl = new BufferList()
|
||||||
|
|
||||||
|
bl.append(Buffer.from('abcd'))
|
||||||
|
bl.append(Buffer.from('efg'))
|
||||||
|
bl.append(Buffer.from('hi'))
|
||||||
|
bl.append(Buffer.from('j'))
|
||||||
|
|
||||||
|
t.equal(bl.length, 10)
|
||||||
|
|
||||||
|
t.equal(bl.slice(0, 10).toString('ascii'), 'abcdefghij')
|
||||||
|
|
||||||
|
bl.consume(3)
|
||||||
|
t.equal(bl.length, 7)
|
||||||
|
t.equal(bl.slice(0, 7).toString('ascii'), 'defghij')
|
||||||
|
|
||||||
|
bl.consume(2)
|
||||||
|
t.equal(bl.length, 5)
|
||||||
|
t.equal(bl.slice(0, 5).toString('ascii'), 'fghij')
|
||||||
|
|
||||||
|
bl.consume(1)
|
||||||
|
t.equal(bl.length, 4)
|
||||||
|
t.equal(bl.slice(0, 4).toString('ascii'), 'ghij')
|
||||||
|
|
||||||
|
bl.consume(1)
|
||||||
|
t.equal(bl.length, 3)
|
||||||
|
t.equal(bl.slice(0, 3).toString('ascii'), 'hij')
|
||||||
|
|
||||||
|
bl.consume(2)
|
||||||
|
t.equal(bl.length, 1)
|
||||||
|
t.equal(bl.slice(0, 1).toString('ascii'), 'j')
|
||||||
|
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
tape('complete consumption', function (t) {
|
||||||
|
var bl = new BufferList()
|
||||||
|
|
||||||
|
bl.append(Buffer.from('a'))
|
||||||
|
bl.append(Buffer.from('b'))
|
||||||
|
|
||||||
|
bl.consume(2)
|
||||||
|
|
||||||
|
t.equal(bl.length, 0)
|
||||||
|
t.equal(bl._bufs.length, 0)
|
||||||
|
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
tape('test readUInt8 / readInt8', function (t) {
|
||||||
|
var buf1 = Buffer.alloc(1)
|
||||||
|
, buf2 = Buffer.alloc(3)
|
||||||
|
, buf3 = Buffer.alloc(3)
|
||||||
|
, bl = new BufferList()
|
||||||
|
|
||||||
|
buf2[1] = 0x3
|
||||||
|
buf2[2] = 0x4
|
||||||
|
buf3[0] = 0x23
|
||||||
|
buf3[1] = 0x42
|
||||||
|
|
||||||
|
bl.append(buf1)
|
||||||
|
bl.append(buf2)
|
||||||
|
bl.append(buf3)
|
||||||
|
|
||||||
|
t.equal(bl.readUInt8(2), 0x3)
|
||||||
|
t.equal(bl.readInt8(2), 0x3)
|
||||||
|
t.equal(bl.readUInt8(3), 0x4)
|
||||||
|
t.equal(bl.readInt8(3), 0x4)
|
||||||
|
t.equal(bl.readUInt8(4), 0x23)
|
||||||
|
t.equal(bl.readInt8(4), 0x23)
|
||||||
|
t.equal(bl.readUInt8(5), 0x42)
|
||||||
|
t.equal(bl.readInt8(5), 0x42)
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
tape('test readUInt16LE / readUInt16BE / readInt16LE / readInt16BE', function (t) {
|
||||||
|
var buf1 = Buffer.alloc(1)
|
||||||
|
, buf2 = Buffer.alloc(3)
|
||||||
|
, buf3 = Buffer.alloc(3)
|
||||||
|
, bl = new BufferList()
|
||||||
|
|
||||||
|
buf2[1] = 0x3
|
||||||
|
buf2[2] = 0x4
|
||||||
|
buf3[0] = 0x23
|
||||||
|
buf3[1] = 0x42
|
||||||
|
|
||||||
|
bl.append(buf1)
|
||||||
|
bl.append(buf2)
|
||||||
|
bl.append(buf3)
|
||||||
|
|
||||||
|
t.equal(bl.readUInt16BE(2), 0x0304)
|
||||||
|
t.equal(bl.readUInt16LE(2), 0x0403)
|
||||||
|
t.equal(bl.readInt16BE(2), 0x0304)
|
||||||
|
t.equal(bl.readInt16LE(2), 0x0403)
|
||||||
|
t.equal(bl.readUInt16BE(3), 0x0423)
|
||||||
|
t.equal(bl.readUInt16LE(3), 0x2304)
|
||||||
|
t.equal(bl.readInt16BE(3), 0x0423)
|
||||||
|
t.equal(bl.readInt16LE(3), 0x2304)
|
||||||
|
t.equal(bl.readUInt16BE(4), 0x2342)
|
||||||
|
t.equal(bl.readUInt16LE(4), 0x4223)
|
||||||
|
t.equal(bl.readInt16BE(4), 0x2342)
|
||||||
|
t.equal(bl.readInt16LE(4), 0x4223)
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
tape('test readUInt32LE / readUInt32BE / readInt32LE / readInt32BE', function (t) {
|
||||||
|
var buf1 = Buffer.alloc(1)
|
||||||
|
, buf2 = Buffer.alloc(3)
|
||||||
|
, buf3 = Buffer.alloc(3)
|
||||||
|
, bl = new BufferList()
|
||||||
|
|
||||||
|
buf2[1] = 0x3
|
||||||
|
buf2[2] = 0x4
|
||||||
|
buf3[0] = 0x23
|
||||||
|
buf3[1] = 0x42
|
||||||
|
|
||||||
|
bl.append(buf1)
|
||||||
|
bl.append(buf2)
|
||||||
|
bl.append(buf3)
|
||||||
|
|
||||||
|
t.equal(bl.readUInt32BE(2), 0x03042342)
|
||||||
|
t.equal(bl.readUInt32LE(2), 0x42230403)
|
||||||
|
t.equal(bl.readInt32BE(2), 0x03042342)
|
||||||
|
t.equal(bl.readInt32LE(2), 0x42230403)
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
tape('test readFloatLE / readFloatBE', function (t) {
|
||||||
|
var buf1 = Buffer.alloc(1)
|
||||||
|
, buf2 = Buffer.alloc(3)
|
||||||
|
, buf3 = Buffer.alloc(3)
|
||||||
|
, bl = new BufferList()
|
||||||
|
|
||||||
|
buf2[1] = 0x00
|
||||||
|
buf2[2] = 0x00
|
||||||
|
buf3[0] = 0x80
|
||||||
|
buf3[1] = 0x3f
|
||||||
|
|
||||||
|
bl.append(buf1)
|
||||||
|
bl.append(buf2)
|
||||||
|
bl.append(buf3)
|
||||||
|
|
||||||
|
t.equal(bl.readFloatLE(2), 0x01)
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
tape('test readDoubleLE / readDoubleBE', function (t) {
|
||||||
|
var buf1 = Buffer.alloc(1)
|
||||||
|
, buf2 = Buffer.alloc(3)
|
||||||
|
, buf3 = Buffer.alloc(10)
|
||||||
|
, bl = new BufferList()
|
||||||
|
|
||||||
|
buf2[1] = 0x55
|
||||||
|
buf2[2] = 0x55
|
||||||
|
buf3[0] = 0x55
|
||||||
|
buf3[1] = 0x55
|
||||||
|
buf3[2] = 0x55
|
||||||
|
buf3[3] = 0x55
|
||||||
|
buf3[4] = 0xd5
|
||||||
|
buf3[5] = 0x3f
|
||||||
|
|
||||||
|
bl.append(buf1)
|
||||||
|
bl.append(buf2)
|
||||||
|
bl.append(buf3)
|
||||||
|
|
||||||
|
t.equal(bl.readDoubleLE(2), 0.3333333333333333)
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
tape('test toString', function (t) {
|
||||||
|
var bl = new BufferList()
|
||||||
|
|
||||||
|
bl.append(Buffer.from('abcd'))
|
||||||
|
bl.append(Buffer.from('efg'))
|
||||||
|
bl.append(Buffer.from('hi'))
|
||||||
|
bl.append(Buffer.from('j'))
|
||||||
|
|
||||||
|
t.equal(bl.toString('ascii', 0, 10), 'abcdefghij')
|
||||||
|
t.equal(bl.toString('ascii', 3, 10), 'defghij')
|
||||||
|
t.equal(bl.toString('ascii', 3, 6), 'def')
|
||||||
|
t.equal(bl.toString('ascii', 3, 8), 'defgh')
|
||||||
|
t.equal(bl.toString('ascii', 5, 10), 'fghij')
|
||||||
|
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
tape('test toString encoding', function (t) {
|
||||||
|
var bl = new BufferList()
|
||||||
|
, b = Buffer.from('abcdefghij\xff\x00')
|
||||||
|
|
||||||
|
bl.append(Buffer.from('abcd'))
|
||||||
|
bl.append(Buffer.from('efg'))
|
||||||
|
bl.append(Buffer.from('hi'))
|
||||||
|
bl.append(Buffer.from('j'))
|
||||||
|
bl.append(Buffer.from('\xff\x00'))
|
||||||
|
|
||||||
|
encodings.forEach(function (enc) {
|
||||||
|
t.equal(bl.toString(enc), b.toString(enc), enc)
|
||||||
|
})
|
||||||
|
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
tape('uninitialized memory', function (t) {
|
||||||
|
const secret = crypto.randomBytes(256)
|
||||||
|
for (let i = 0; i < 1e6; i++) {
|
||||||
|
const clone = Buffer.from(secret)
|
||||||
|
const bl = new BufferList()
|
||||||
|
bl.append(Buffer.from('a'))
|
||||||
|
bl.consume(-1024)
|
||||||
|
const buf = bl.slice(1)
|
||||||
|
if (buf.indexOf(clone) !== -1) {
|
||||||
|
t.fail(`Match (at ${i})`)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
!process.browser && tape('test stream', function (t) {
|
||||||
|
var random = crypto.randomBytes(65534)
|
||||||
|
, rndhash = hash(random, 'md5')
|
||||||
|
, md5sum = crypto.createHash('md5')
|
||||||
|
, bl = new BufferList(function (err, buf) {
|
||||||
|
t.ok(Buffer.isBuffer(buf))
|
||||||
|
t.ok(err === null)
|
||||||
|
t.equal(rndhash, hash(bl.slice(), 'md5'))
|
||||||
|
t.equal(rndhash, hash(buf, 'md5'))
|
||||||
|
|
||||||
|
bl.pipe(fs.createWriteStream('/tmp/bl_test_rnd_out.dat'))
|
||||||
|
.on('close', function () {
|
||||||
|
var s = fs.createReadStream('/tmp/bl_test_rnd_out.dat')
|
||||||
|
s.on('data', md5sum.update.bind(md5sum))
|
||||||
|
s.on('end', function() {
|
||||||
|
t.equal(rndhash, md5sum.digest('hex'), 'woohoo! correct hash!')
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
fs.writeFileSync('/tmp/bl_test_rnd.dat', random)
|
||||||
|
fs.createReadStream('/tmp/bl_test_rnd.dat').pipe(bl)
|
||||||
|
})
|
||||||
|
|
||||||
|
tape('instantiation with Buffer', function (t) {
|
||||||
|
var buf = crypto.randomBytes(1024)
|
||||||
|
, buf2 = crypto.randomBytes(1024)
|
||||||
|
, b = BufferList(buf)
|
||||||
|
|
||||||
|
t.equal(buf.toString('hex'), b.slice().toString('hex'), 'same buffer')
|
||||||
|
b = BufferList([ buf, buf2 ])
|
||||||
|
t.equal(b.slice().toString('hex'), Buffer.concat([ buf, buf2 ]).toString('hex'), 'same buffer')
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
tape('test String appendage', function (t) {
|
||||||
|
var bl = new BufferList()
|
||||||
|
, b = Buffer.from('abcdefghij\xff\x00')
|
||||||
|
|
||||||
|
bl.append('abcd')
|
||||||
|
bl.append('efg')
|
||||||
|
bl.append('hi')
|
||||||
|
bl.append('j')
|
||||||
|
bl.append('\xff\x00')
|
||||||
|
|
||||||
|
encodings.forEach(function (enc) {
|
||||||
|
t.equal(bl.toString(enc), b.toString(enc))
|
||||||
|
})
|
||||||
|
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
tape('test Number appendage', function (t) {
|
||||||
|
var bl = new BufferList()
|
||||||
|
, b = Buffer.from('1234567890')
|
||||||
|
|
||||||
|
bl.append(1234)
|
||||||
|
bl.append(567)
|
||||||
|
bl.append(89)
|
||||||
|
bl.append(0)
|
||||||
|
|
||||||
|
encodings.forEach(function (enc) {
|
||||||
|
t.equal(bl.toString(enc), b.toString(enc))
|
||||||
|
})
|
||||||
|
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
tape('write nothing, should get empty buffer', function (t) {
|
||||||
|
t.plan(3)
|
||||||
|
BufferList(function (err, data) {
|
||||||
|
t.notOk(err, 'no error')
|
||||||
|
t.ok(Buffer.isBuffer(data), 'got a buffer')
|
||||||
|
t.equal(0, data.length, 'got a zero-length buffer')
|
||||||
|
t.end()
|
||||||
|
}).end()
|
||||||
|
})
|
||||||
|
|
||||||
|
tape('unicode string', function (t) {
|
||||||
|
t.plan(2)
|
||||||
|
var inp1 = '\u2600'
|
||||||
|
, inp2 = '\u2603'
|
||||||
|
, exp = inp1 + ' and ' + inp2
|
||||||
|
, bl = BufferList()
|
||||||
|
bl.write(inp1)
|
||||||
|
bl.write(' and ')
|
||||||
|
bl.write(inp2)
|
||||||
|
t.equal(exp, bl.toString())
|
||||||
|
t.equal(Buffer.from(exp).toString('hex'), bl.toString('hex'))
|
||||||
|
})
|
||||||
|
|
||||||
|
tape('should emit finish', function (t) {
|
||||||
|
var source = BufferList()
|
||||||
|
, dest = BufferList()
|
||||||
|
|
||||||
|
source.write('hello')
|
||||||
|
source.pipe(dest)
|
||||||
|
|
||||||
|
dest.on('finish', function () {
|
||||||
|
t.equal(dest.toString('utf8'), 'hello')
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
tape('basic copy', function (t) {
|
||||||
|
var buf = crypto.randomBytes(1024)
|
||||||
|
, buf2 = Buffer.alloc(1024)
|
||||||
|
, b = BufferList(buf)
|
||||||
|
|
||||||
|
b.copy(buf2)
|
||||||
|
t.equal(b.slice().toString('hex'), buf2.toString('hex'), 'same buffer')
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
tape('copy after many appends', function (t) {
|
||||||
|
var buf = crypto.randomBytes(512)
|
||||||
|
, buf2 = Buffer.alloc(1024)
|
||||||
|
, b = BufferList(buf)
|
||||||
|
|
||||||
|
b.append(buf)
|
||||||
|
b.copy(buf2)
|
||||||
|
t.equal(b.slice().toString('hex'), buf2.toString('hex'), 'same buffer')
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
tape('copy at a precise position', function (t) {
|
||||||
|
var buf = crypto.randomBytes(1004)
|
||||||
|
, buf2 = Buffer.alloc(1024)
|
||||||
|
, b = BufferList(buf)
|
||||||
|
|
||||||
|
b.copy(buf2, 20)
|
||||||
|
t.equal(b.slice().toString('hex'), buf2.slice(20).toString('hex'), 'same buffer')
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
tape('copy starting from a precise location', function (t) {
|
||||||
|
var buf = crypto.randomBytes(10)
|
||||||
|
, buf2 = Buffer.alloc(5)
|
||||||
|
, b = BufferList(buf)
|
||||||
|
|
||||||
|
b.copy(buf2, 0, 5)
|
||||||
|
t.equal(b.slice(5).toString('hex'), buf2.toString('hex'), 'same buffer')
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
tape('copy in an interval', function (t) {
|
||||||
|
var rnd = crypto.randomBytes(10)
|
||||||
|
, b = BufferList(rnd) // put the random bytes there
|
||||||
|
, actual = Buffer.alloc(3)
|
||||||
|
, expected = Buffer.alloc(3)
|
||||||
|
|
||||||
|
rnd.copy(expected, 0, 5, 8)
|
||||||
|
b.copy(actual, 0, 5, 8)
|
||||||
|
|
||||||
|
t.equal(actual.toString('hex'), expected.toString('hex'), 'same buffer')
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
tape('copy an interval between two buffers', function (t) {
|
||||||
|
var buf = crypto.randomBytes(10)
|
||||||
|
, buf2 = Buffer.alloc(10)
|
||||||
|
, b = BufferList(buf)
|
||||||
|
|
||||||
|
b.append(buf)
|
||||||
|
b.copy(buf2, 0, 5, 15)
|
||||||
|
|
||||||
|
t.equal(b.slice(5, 15).toString('hex'), buf2.toString('hex'), 'same buffer')
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
tape('shallow slice across buffer boundaries', function (t) {
|
||||||
|
var bl = new BufferList(['First', 'Second', 'Third'])
|
||||||
|
|
||||||
|
t.equal(bl.shallowSlice(3, 13).toString(), 'stSecondTh')
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
tape('shallow slice within single buffer', function (t) {
|
||||||
|
t.plan(2)
|
||||||
|
var bl = new BufferList(['First', 'Second', 'Third'])
|
||||||
|
|
||||||
|
t.equal(bl.shallowSlice(5, 10).toString(), 'Secon')
|
||||||
|
t.equal(bl.shallowSlice(7, 10).toString(), 'con')
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
tape('shallow slice single buffer', function (t) {
|
||||||
|
t.plan(3)
|
||||||
|
var bl = new BufferList(['First', 'Second', 'Third'])
|
||||||
|
|
||||||
|
t.equal(bl.shallowSlice(0, 5).toString(), 'First')
|
||||||
|
t.equal(bl.shallowSlice(5, 11).toString(), 'Second')
|
||||||
|
t.equal(bl.shallowSlice(11, 16).toString(), 'Third')
|
||||||
|
})
|
||||||
|
|
||||||
|
tape('shallow slice with negative or omitted indices', function (t) {
|
||||||
|
t.plan(4)
|
||||||
|
var bl = new BufferList(['First', 'Second', 'Third'])
|
||||||
|
|
||||||
|
t.equal(bl.shallowSlice().toString(), 'FirstSecondThird')
|
||||||
|
t.equal(bl.shallowSlice(5).toString(), 'SecondThird')
|
||||||
|
t.equal(bl.shallowSlice(5, -3).toString(), 'SecondTh')
|
||||||
|
t.equal(bl.shallowSlice(-8).toString(), 'ondThird')
|
||||||
|
})
|
||||||
|
|
||||||
|
tape('shallow slice does not make a copy', function (t) {
|
||||||
|
t.plan(1)
|
||||||
|
var buffers = [Buffer.from('First'), Buffer.from('Second'), Buffer.from('Third')]
|
||||||
|
var bl = (new BufferList(buffers)).shallowSlice(5, -3)
|
||||||
|
|
||||||
|
buffers[1].fill('h')
|
||||||
|
buffers[2].fill('h')
|
||||||
|
|
||||||
|
t.equal(bl.toString(), 'hhhhhhhh')
|
||||||
|
})
|
||||||
|
|
||||||
|
tape('duplicate', function (t) {
|
||||||
|
t.plan(2)
|
||||||
|
|
||||||
|
var bl = new BufferList('abcdefghij\xff\x00')
|
||||||
|
, dup = bl.duplicate()
|
||||||
|
|
||||||
|
t.equal(bl.prototype, dup.prototype)
|
||||||
|
t.equal(bl.toString('hex'), dup.toString('hex'))
|
||||||
|
})
|
||||||
|
|
||||||
|
tape('destroy no pipe', function (t) {
|
||||||
|
t.plan(2)
|
||||||
|
|
||||||
|
var bl = new BufferList('alsdkfja;lsdkfja;lsdk')
|
||||||
|
bl.destroy()
|
||||||
|
|
||||||
|
t.equal(bl._bufs.length, 0)
|
||||||
|
t.equal(bl.length, 0)
|
||||||
|
})
|
||||||
|
|
||||||
|
!process.browser && tape('destroy with pipe before read end', function (t) {
|
||||||
|
t.plan(2)
|
||||||
|
|
||||||
|
var bl = new BufferList()
|
||||||
|
fs.createReadStream(__dirname + '/test.js')
|
||||||
|
.pipe(bl)
|
||||||
|
|
||||||
|
bl.destroy()
|
||||||
|
|
||||||
|
t.equal(bl._bufs.length, 0)
|
||||||
|
t.equal(bl.length, 0)
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
!process.browser && tape('destroy with pipe before read end with race', function (t) {
|
||||||
|
t.plan(2)
|
||||||
|
|
||||||
|
var bl = new BufferList()
|
||||||
|
fs.createReadStream(__dirname + '/test.js')
|
||||||
|
.pipe(bl)
|
||||||
|
|
||||||
|
setTimeout(function () {
|
||||||
|
bl.destroy()
|
||||||
|
setTimeout(function () {
|
||||||
|
t.equal(bl._bufs.length, 0)
|
||||||
|
t.equal(bl.length, 0)
|
||||||
|
}, 500)
|
||||||
|
}, 500)
|
||||||
|
})
|
||||||
|
|
||||||
|
!process.browser && tape('destroy with pipe after read end', function (t) {
|
||||||
|
t.plan(2)
|
||||||
|
|
||||||
|
var bl = new BufferList()
|
||||||
|
fs.createReadStream(__dirname + '/test.js')
|
||||||
|
.on('end', onEnd)
|
||||||
|
.pipe(bl)
|
||||||
|
|
||||||
|
function onEnd () {
|
||||||
|
bl.destroy()
|
||||||
|
|
||||||
|
t.equal(bl._bufs.length, 0)
|
||||||
|
t.equal(bl.length, 0)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
!process.browser && tape('destroy with pipe while writing to a destination', function (t) {
|
||||||
|
t.plan(4)
|
||||||
|
|
||||||
|
var bl = new BufferList()
|
||||||
|
, ds = new BufferList()
|
||||||
|
|
||||||
|
fs.createReadStream(__dirname + '/test.js')
|
||||||
|
.on('end', onEnd)
|
||||||
|
.pipe(bl)
|
||||||
|
|
||||||
|
function onEnd () {
|
||||||
|
bl.pipe(ds)
|
||||||
|
|
||||||
|
setTimeout(function () {
|
||||||
|
bl.destroy()
|
||||||
|
|
||||||
|
t.equals(bl._bufs.length, 0)
|
||||||
|
t.equals(bl.length, 0)
|
||||||
|
|
||||||
|
ds.destroy()
|
||||||
|
|
||||||
|
t.equals(bl._bufs.length, 0)
|
||||||
|
t.equals(bl.length, 0)
|
||||||
|
|
||||||
|
}, 100)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
!process.browser && tape('handle error', function (t) {
|
||||||
|
t.plan(2)
|
||||||
|
fs.createReadStream('/does/not/exist').pipe(BufferList(function (err, data) {
|
||||||
|
t.ok(err instanceof Error, 'has error')
|
||||||
|
t.notOk(data, 'no data')
|
||||||
|
}))
|
||||||
|
})
|
||||||
21
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/brace-expansion/LICENSE
generated
vendored
Normal file
21
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/brace-expansion/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2013 Julian Gruber <julian@juliangruber.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.
|
||||||
129
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/brace-expansion/README.md
generated
vendored
Normal file
129
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/brace-expansion/README.md
generated
vendored
Normal file
@@ -0,0 +1,129 @@
|
|||||||
|
# brace-expansion
|
||||||
|
|
||||||
|
[Brace expansion](https://www.gnu.org/software/bash/manual/html_node/Brace-Expansion.html),
|
||||||
|
as known from sh/bash, in JavaScript.
|
||||||
|
|
||||||
|
[](http://travis-ci.org/juliangruber/brace-expansion)
|
||||||
|
[](https://www.npmjs.org/package/brace-expansion)
|
||||||
|
[](https://greenkeeper.io/)
|
||||||
|
|
||||||
|
[](https://ci.testling.com/juliangruber/brace-expansion)
|
||||||
|
|
||||||
|
## Example
|
||||||
|
|
||||||
|
```js
|
||||||
|
var expand = require('brace-expansion');
|
||||||
|
|
||||||
|
expand('file-{a,b,c}.jpg')
|
||||||
|
// => ['file-a.jpg', 'file-b.jpg', 'file-c.jpg']
|
||||||
|
|
||||||
|
expand('-v{,,}')
|
||||||
|
// => ['-v', '-v', '-v']
|
||||||
|
|
||||||
|
expand('file{0..2}.jpg')
|
||||||
|
// => ['file0.jpg', 'file1.jpg', 'file2.jpg']
|
||||||
|
|
||||||
|
expand('file-{a..c}.jpg')
|
||||||
|
// => ['file-a.jpg', 'file-b.jpg', 'file-c.jpg']
|
||||||
|
|
||||||
|
expand('file{2..0}.jpg')
|
||||||
|
// => ['file2.jpg', 'file1.jpg', 'file0.jpg']
|
||||||
|
|
||||||
|
expand('file{0..4..2}.jpg')
|
||||||
|
// => ['file0.jpg', 'file2.jpg', 'file4.jpg']
|
||||||
|
|
||||||
|
expand('file-{a..e..2}.jpg')
|
||||||
|
// => ['file-a.jpg', 'file-c.jpg', 'file-e.jpg']
|
||||||
|
|
||||||
|
expand('file{00..10..5}.jpg')
|
||||||
|
// => ['file00.jpg', 'file05.jpg', 'file10.jpg']
|
||||||
|
|
||||||
|
expand('{{A..C},{a..c}}')
|
||||||
|
// => ['A', 'B', 'C', 'a', 'b', 'c']
|
||||||
|
|
||||||
|
expand('ppp{,config,oe{,conf}}')
|
||||||
|
// => ['ppp', 'pppconfig', 'pppoe', 'pppoeconf']
|
||||||
|
```
|
||||||
|
|
||||||
|
## API
|
||||||
|
|
||||||
|
```js
|
||||||
|
var expand = require('brace-expansion');
|
||||||
|
```
|
||||||
|
|
||||||
|
### var expanded = expand(str)
|
||||||
|
|
||||||
|
Return an array of all possible and valid expansions of `str`. If none are
|
||||||
|
found, `[str]` is returned.
|
||||||
|
|
||||||
|
Valid expansions are:
|
||||||
|
|
||||||
|
```js
|
||||||
|
/^(.*,)+(.+)?$/
|
||||||
|
// {a,b,...}
|
||||||
|
```
|
||||||
|
|
||||||
|
A comma separated list of options, like `{a,b}` or `{a,{b,c}}` or `{,a,}`.
|
||||||
|
|
||||||
|
```js
|
||||||
|
/^-?\d+\.\.-?\d+(\.\.-?\d+)?$/
|
||||||
|
// {x..y[..incr]}
|
||||||
|
```
|
||||||
|
|
||||||
|
A numeric sequence from `x` to `y` inclusive, with optional increment.
|
||||||
|
If `x` or `y` start with a leading `0`, all the numbers will be padded
|
||||||
|
to have equal length. Negative numbers and backwards iteration work too.
|
||||||
|
|
||||||
|
```js
|
||||||
|
/^-?\d+\.\.-?\d+(\.\.-?\d+)?$/
|
||||||
|
// {x..y[..incr]}
|
||||||
|
```
|
||||||
|
|
||||||
|
An alphabetic sequence from `x` to `y` inclusive, with optional increment.
|
||||||
|
`x` and `y` must be exactly one character, and if given, `incr` must be a
|
||||||
|
number.
|
||||||
|
|
||||||
|
For compatibility reasons, the string `${` is not eligible for brace expansion.
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
With [npm](https://npmjs.org) do:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npm install brace-expansion
|
||||||
|
```
|
||||||
|
|
||||||
|
## Contributors
|
||||||
|
|
||||||
|
- [Julian Gruber](https://github.com/juliangruber)
|
||||||
|
- [Isaac Z. Schlueter](https://github.com/isaacs)
|
||||||
|
|
||||||
|
## Sponsors
|
||||||
|
|
||||||
|
This module is proudly supported by my [Sponsors](https://github.com/juliangruber/sponsors)!
|
||||||
|
|
||||||
|
Do you want to support modules like this to improve their quality, stability and weigh in on new features? Then please consider donating to my [Patreon](https://www.patreon.com/juliangruber). Not sure how much of my modules you're using? Try [feross/thanks](https://github.com/feross/thanks)!
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
(MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2013 Julian Gruber <julian@juliangruber.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.
|
||||||
201
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/brace-expansion/index.js
generated
vendored
Normal file
201
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/brace-expansion/index.js
generated
vendored
Normal file
@@ -0,0 +1,201 @@
|
|||||||
|
var concatMap = require('concat-map');
|
||||||
|
var balanced = require('balanced-match');
|
||||||
|
|
||||||
|
module.exports = expandTop;
|
||||||
|
|
||||||
|
var escSlash = '\0SLASH'+Math.random()+'\0';
|
||||||
|
var escOpen = '\0OPEN'+Math.random()+'\0';
|
||||||
|
var escClose = '\0CLOSE'+Math.random()+'\0';
|
||||||
|
var escComma = '\0COMMA'+Math.random()+'\0';
|
||||||
|
var escPeriod = '\0PERIOD'+Math.random()+'\0';
|
||||||
|
|
||||||
|
function numeric(str) {
|
||||||
|
return parseInt(str, 10) == str
|
||||||
|
? parseInt(str, 10)
|
||||||
|
: str.charCodeAt(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
function escapeBraces(str) {
|
||||||
|
return str.split('\\\\').join(escSlash)
|
||||||
|
.split('\\{').join(escOpen)
|
||||||
|
.split('\\}').join(escClose)
|
||||||
|
.split('\\,').join(escComma)
|
||||||
|
.split('\\.').join(escPeriod);
|
||||||
|
}
|
||||||
|
|
||||||
|
function unescapeBraces(str) {
|
||||||
|
return str.split(escSlash).join('\\')
|
||||||
|
.split(escOpen).join('{')
|
||||||
|
.split(escClose).join('}')
|
||||||
|
.split(escComma).join(',')
|
||||||
|
.split(escPeriod).join('.');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Basically just str.split(","), but handling cases
|
||||||
|
// where we have nested braced sections, which should be
|
||||||
|
// treated as individual members, like {a,{b,c},d}
|
||||||
|
function parseCommaParts(str) {
|
||||||
|
if (!str)
|
||||||
|
return [''];
|
||||||
|
|
||||||
|
var parts = [];
|
||||||
|
var m = balanced('{', '}', str);
|
||||||
|
|
||||||
|
if (!m)
|
||||||
|
return str.split(',');
|
||||||
|
|
||||||
|
var pre = m.pre;
|
||||||
|
var body = m.body;
|
||||||
|
var post = m.post;
|
||||||
|
var p = pre.split(',');
|
||||||
|
|
||||||
|
p[p.length-1] += '{' + body + '}';
|
||||||
|
var postParts = parseCommaParts(post);
|
||||||
|
if (post.length) {
|
||||||
|
p[p.length-1] += postParts.shift();
|
||||||
|
p.push.apply(p, postParts);
|
||||||
|
}
|
||||||
|
|
||||||
|
parts.push.apply(parts, p);
|
||||||
|
|
||||||
|
return parts;
|
||||||
|
}
|
||||||
|
|
||||||
|
function expandTop(str) {
|
||||||
|
if (!str)
|
||||||
|
return [];
|
||||||
|
|
||||||
|
// I don't know why Bash 4.3 does this, but it does.
|
||||||
|
// Anything starting with {} will have the first two bytes preserved
|
||||||
|
// but *only* at the top level, so {},a}b will not expand to anything,
|
||||||
|
// but a{},b}c will be expanded to [a}c,abc].
|
||||||
|
// One could argue that this is a bug in Bash, but since the goal of
|
||||||
|
// this module is to match Bash's rules, we escape a leading {}
|
||||||
|
if (str.substr(0, 2) === '{}') {
|
||||||
|
str = '\\{\\}' + str.substr(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
return expand(escapeBraces(str), true).map(unescapeBraces);
|
||||||
|
}
|
||||||
|
|
||||||
|
function identity(e) {
|
||||||
|
return e;
|
||||||
|
}
|
||||||
|
|
||||||
|
function embrace(str) {
|
||||||
|
return '{' + str + '}';
|
||||||
|
}
|
||||||
|
function isPadded(el) {
|
||||||
|
return /^-?0\d/.test(el);
|
||||||
|
}
|
||||||
|
|
||||||
|
function lte(i, y) {
|
||||||
|
return i <= y;
|
||||||
|
}
|
||||||
|
function gte(i, y) {
|
||||||
|
return i >= y;
|
||||||
|
}
|
||||||
|
|
||||||
|
function expand(str, isTop) {
|
||||||
|
var expansions = [];
|
||||||
|
|
||||||
|
var m = balanced('{', '}', str);
|
||||||
|
if (!m || /\$$/.test(m.pre)) return [str];
|
||||||
|
|
||||||
|
var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
|
||||||
|
var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
|
||||||
|
var isSequence = isNumericSequence || isAlphaSequence;
|
||||||
|
var isOptions = m.body.indexOf(',') >= 0;
|
||||||
|
if (!isSequence && !isOptions) {
|
||||||
|
// {a},b}
|
||||||
|
if (m.post.match(/,.*\}/)) {
|
||||||
|
str = m.pre + '{' + m.body + escClose + m.post;
|
||||||
|
return expand(str);
|
||||||
|
}
|
||||||
|
return [str];
|
||||||
|
}
|
||||||
|
|
||||||
|
var n;
|
||||||
|
if (isSequence) {
|
||||||
|
n = m.body.split(/\.\./);
|
||||||
|
} else {
|
||||||
|
n = parseCommaParts(m.body);
|
||||||
|
if (n.length === 1) {
|
||||||
|
// x{{a,b}}y ==> x{a}y x{b}y
|
||||||
|
n = expand(n[0], false).map(embrace);
|
||||||
|
if (n.length === 1) {
|
||||||
|
var post = m.post.length
|
||||||
|
? expand(m.post, false)
|
||||||
|
: [''];
|
||||||
|
return post.map(function(p) {
|
||||||
|
return m.pre + n[0] + p;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// at this point, n is the parts, and we know it's not a comma set
|
||||||
|
// with a single entry.
|
||||||
|
|
||||||
|
// no need to expand pre, since it is guaranteed to be free of brace-sets
|
||||||
|
var pre = m.pre;
|
||||||
|
var post = m.post.length
|
||||||
|
? expand(m.post, false)
|
||||||
|
: [''];
|
||||||
|
|
||||||
|
var N;
|
||||||
|
|
||||||
|
if (isSequence) {
|
||||||
|
var x = numeric(n[0]);
|
||||||
|
var y = numeric(n[1]);
|
||||||
|
var width = Math.max(n[0].length, n[1].length)
|
||||||
|
var incr = n.length == 3
|
||||||
|
? Math.abs(numeric(n[2]))
|
||||||
|
: 1;
|
||||||
|
var test = lte;
|
||||||
|
var reverse = y < x;
|
||||||
|
if (reverse) {
|
||||||
|
incr *= -1;
|
||||||
|
test = gte;
|
||||||
|
}
|
||||||
|
var pad = n.some(isPadded);
|
||||||
|
|
||||||
|
N = [];
|
||||||
|
|
||||||
|
for (var i = x; test(i, y); i += incr) {
|
||||||
|
var c;
|
||||||
|
if (isAlphaSequence) {
|
||||||
|
c = String.fromCharCode(i);
|
||||||
|
if (c === '\\')
|
||||||
|
c = '';
|
||||||
|
} else {
|
||||||
|
c = String(i);
|
||||||
|
if (pad) {
|
||||||
|
var need = width - c.length;
|
||||||
|
if (need > 0) {
|
||||||
|
var z = new Array(need + 1).join('0');
|
||||||
|
if (i < 0)
|
||||||
|
c = '-' + z + c.slice(1);
|
||||||
|
else
|
||||||
|
c = z + c;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
N.push(c);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
N = concatMap(n, function(el) { return expand(el, false) });
|
||||||
|
}
|
||||||
|
|
||||||
|
for (var j = 0; j < N.length; j++) {
|
||||||
|
for (var k = 0; k < post.length; k++) {
|
||||||
|
var expansion = pre + N[j] + post[k];
|
||||||
|
if (!isTop || isSequence || expansion)
|
||||||
|
expansions.push(expansion);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return expansions;
|
||||||
|
}
|
||||||
|
|
||||||
79
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/brace-expansion/package.json
generated
vendored
Normal file
79
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/brace-expansion/package.json
generated
vendored
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
{
|
||||||
|
"_args": [
|
||||||
|
[
|
||||||
|
"brace-expansion@1.1.11",
|
||||||
|
"/tmp/repository/main"
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"_from": "brace-expansion@1.1.11",
|
||||||
|
"_id": "brace-expansion@1.1.11",
|
||||||
|
"_inBundle": false,
|
||||||
|
"_integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
|
||||||
|
"_location": "/brace-expansion",
|
||||||
|
"_phantomChildren": {},
|
||||||
|
"_requested": {
|
||||||
|
"type": "version",
|
||||||
|
"registry": true,
|
||||||
|
"raw": "brace-expansion@1.1.11",
|
||||||
|
"name": "brace-expansion",
|
||||||
|
"escapedName": "brace-expansion",
|
||||||
|
"rawSpec": "1.1.11",
|
||||||
|
"saveSpec": null,
|
||||||
|
"fetchSpec": "1.1.11"
|
||||||
|
},
|
||||||
|
"_requiredBy": [
|
||||||
|
"/minimatch",
|
||||||
|
"/mocha/minimatch"
|
||||||
|
],
|
||||||
|
"_resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
|
||||||
|
"_spec": "1.1.11",
|
||||||
|
"_where": "/tmp/repository/main",
|
||||||
|
"author": {
|
||||||
|
"name": "Julian Gruber",
|
||||||
|
"email": "mail@juliangruber.com",
|
||||||
|
"url": "http://juliangruber.com"
|
||||||
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/juliangruber/brace-expansion/issues"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"balanced-match": "^1.0.0",
|
||||||
|
"concat-map": "0.0.1"
|
||||||
|
},
|
||||||
|
"description": "Brace expansion as known from sh/bash",
|
||||||
|
"devDependencies": {
|
||||||
|
"matcha": "^0.7.0",
|
||||||
|
"tape": "^4.6.0"
|
||||||
|
},
|
||||||
|
"homepage": "https://github.com/juliangruber/brace-expansion",
|
||||||
|
"keywords": [],
|
||||||
|
"license": "MIT",
|
||||||
|
"main": "index.js",
|
||||||
|
"name": "brace-expansion",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git://github.com/juliangruber/brace-expansion.git"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"bench": "matcha test/perf/bench.js",
|
||||||
|
"gentest": "bash test/generate.sh",
|
||||||
|
"test": "tape test/*.js"
|
||||||
|
},
|
||||||
|
"testling": {
|
||||||
|
"files": "test/*.js",
|
||||||
|
"browsers": [
|
||||||
|
"ie/8..latest",
|
||||||
|
"firefox/20..latest",
|
||||||
|
"firefox/nightly",
|
||||||
|
"chrome/25..latest",
|
||||||
|
"chrome/canary",
|
||||||
|
"opera/12..latest",
|
||||||
|
"opera/next",
|
||||||
|
"safari/5.1..latest",
|
||||||
|
"ipad/6.0..latest",
|
||||||
|
"iphone/6.0..latest",
|
||||||
|
"android-browser/4.2..latest"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"version": "1.1.11"
|
||||||
|
}
|
||||||
17
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/buffer-alloc-unsafe/index.js
generated
vendored
Normal file
17
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/buffer-alloc-unsafe/index.js
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
function allocUnsafe (size) {
|
||||||
|
if (typeof size !== 'number') {
|
||||||
|
throw new TypeError('"size" argument must be a number')
|
||||||
|
}
|
||||||
|
|
||||||
|
if (size < 0) {
|
||||||
|
throw new RangeError('"size" argument must not be negative')
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Buffer.allocUnsafe) {
|
||||||
|
return Buffer.allocUnsafe(size)
|
||||||
|
} else {
|
||||||
|
return new Buffer(size)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = allocUnsafe
|
||||||
60
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/buffer-alloc-unsafe/package.json
generated
vendored
Normal file
60
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/buffer-alloc-unsafe/package.json
generated
vendored
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
{
|
||||||
|
"_args": [
|
||||||
|
[
|
||||||
|
"buffer-alloc-unsafe@1.1.0",
|
||||||
|
"/tmp/repository/main"
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"_from": "buffer-alloc-unsafe@1.1.0",
|
||||||
|
"_id": "buffer-alloc-unsafe@1.1.0",
|
||||||
|
"_inBundle": false,
|
||||||
|
"_integrity": "sha512-TEM2iMIEQdJ2yjPJoSIsldnleVaAk1oW3DBVUykyOLsEsFmEc9kn+SFFPz+gl54KQNxlDnAwCXosOS9Okx2xAg==",
|
||||||
|
"_location": "/buffer-alloc-unsafe",
|
||||||
|
"_phantomChildren": {},
|
||||||
|
"_requested": {
|
||||||
|
"type": "version",
|
||||||
|
"registry": true,
|
||||||
|
"raw": "buffer-alloc-unsafe@1.1.0",
|
||||||
|
"name": "buffer-alloc-unsafe",
|
||||||
|
"escapedName": "buffer-alloc-unsafe",
|
||||||
|
"rawSpec": "1.1.0",
|
||||||
|
"saveSpec": null,
|
||||||
|
"fetchSpec": "1.1.0"
|
||||||
|
},
|
||||||
|
"_requiredBy": [
|
||||||
|
"/buffer-alloc"
|
||||||
|
],
|
||||||
|
"_resolved": "https://registry.npmjs.org/buffer-alloc-unsafe/-/buffer-alloc-unsafe-1.1.0.tgz",
|
||||||
|
"_spec": "1.1.0",
|
||||||
|
"_where": "/tmp/repository/main",
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/LinusU/buffer-alloc-unsafe/issues"
|
||||||
|
},
|
||||||
|
"description": "A [ponyfill](https://ponyfill.com) for `Buffer.allocUnsafe`.",
|
||||||
|
"devDependencies": {
|
||||||
|
"standard": "^7.1.2"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"index.js"
|
||||||
|
],
|
||||||
|
"homepage": "https://github.com/LinusU/buffer-alloc-unsafe#readme",
|
||||||
|
"keywords": [
|
||||||
|
"allocUnsafe",
|
||||||
|
"allocate",
|
||||||
|
"buffer allocUnsafe",
|
||||||
|
"buffer unsafe allocate",
|
||||||
|
"buffer",
|
||||||
|
"ponyfill",
|
||||||
|
"unsafe allocate"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"name": "buffer-alloc-unsafe",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/LinusU/buffer-alloc-unsafe.git"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"test": "standard && node test"
|
||||||
|
},
|
||||||
|
"version": "1.1.0"
|
||||||
|
}
|
||||||
46
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/buffer-alloc-unsafe/readme.md
generated
vendored
Normal file
46
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/buffer-alloc-unsafe/readme.md
generated
vendored
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
# Buffer Alloc Unsafe
|
||||||
|
|
||||||
|
A [ponyfill](https://ponyfill.com) for `Buffer.allocUnsafe`.
|
||||||
|
|
||||||
|
Works as Node.js: `v7.0.0` <br>
|
||||||
|
Works on Node.js: `v0.10.0`
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
```sh
|
||||||
|
npm install --save buffer-alloc-unsafe
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```js
|
||||||
|
const allocUnsafe = require('buffer-alloc-unsafe')
|
||||||
|
|
||||||
|
console.log(allocUnsafe(10))
|
||||||
|
//=> <Buffer 78 0c 80 03 01 00 00 00 05 00>
|
||||||
|
|
||||||
|
console.log(allocUnsafe(10))
|
||||||
|
//=> <Buffer 58 ed bf 5f ff 7f 00 00 01 00>
|
||||||
|
|
||||||
|
console.log(allocUnsafe(10))
|
||||||
|
//=> <Buffer 50 0c 80 03 01 00 00 00 0a 00>
|
||||||
|
|
||||||
|
allocUnsafe(-10)
|
||||||
|
//=> RangeError: "size" argument must not be negative
|
||||||
|
```
|
||||||
|
|
||||||
|
## API
|
||||||
|
|
||||||
|
### allocUnsafe(size)
|
||||||
|
|
||||||
|
- `size` <Integer> The desired length of the new `Buffer`
|
||||||
|
|
||||||
|
Allocates a new *non-zero-filled* `Buffer` of `size` bytes. The `size` must be
|
||||||
|
less than or equal to the value of `buffer.kMaxLength` and greater than or equal
|
||||||
|
to zero. Otherwise, a `RangeError` is thrown.
|
||||||
|
|
||||||
|
## See also
|
||||||
|
|
||||||
|
- [buffer-alloc](https://github.com/LinusU/buffer-alloc) A ponyfill for `Buffer.alloc`
|
||||||
|
- [buffer-fill](https://github.com/LinusU/buffer-fill) A ponyfill for `Buffer.fill`
|
||||||
|
- [buffer-from](https://github.com/LinusU/buffer-from) A ponyfill for `Buffer.from`
|
||||||
32
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/buffer-alloc/index.js
generated
vendored
Normal file
32
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/buffer-alloc/index.js
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
var bufferFill = require('buffer-fill')
|
||||||
|
var allocUnsafe = require('buffer-alloc-unsafe')
|
||||||
|
|
||||||
|
module.exports = function alloc (size, fill, encoding) {
|
||||||
|
if (typeof size !== 'number') {
|
||||||
|
throw new TypeError('"size" argument must be a number')
|
||||||
|
}
|
||||||
|
|
||||||
|
if (size < 0) {
|
||||||
|
throw new RangeError('"size" argument must not be negative')
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Buffer.alloc) {
|
||||||
|
return Buffer.alloc(size, fill, encoding)
|
||||||
|
}
|
||||||
|
|
||||||
|
var buffer = allocUnsafe(size)
|
||||||
|
|
||||||
|
if (size === 0) {
|
||||||
|
return buffer
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fill === undefined) {
|
||||||
|
return bufferFill(buffer, 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof encoding !== 'string') {
|
||||||
|
encoding = undefined
|
||||||
|
}
|
||||||
|
|
||||||
|
return bufferFill(buffer, fill, encoding)
|
||||||
|
}
|
||||||
62
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/buffer-alloc/package.json
generated
vendored
Normal file
62
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/buffer-alloc/package.json
generated
vendored
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
{
|
||||||
|
"_args": [
|
||||||
|
[
|
||||||
|
"buffer-alloc@1.2.0",
|
||||||
|
"/tmp/repository/main"
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"_from": "buffer-alloc@1.2.0",
|
||||||
|
"_id": "buffer-alloc@1.2.0",
|
||||||
|
"_inBundle": false,
|
||||||
|
"_integrity": "sha512-CFsHQgjtW1UChdXgbyJGtnm+O/uLQeZdtbDo8mfUgYXCHSM1wgrVxXm6bSyrUuErEb+4sYVGCzASBRot7zyrow==",
|
||||||
|
"_location": "/buffer-alloc",
|
||||||
|
"_phantomChildren": {},
|
||||||
|
"_requested": {
|
||||||
|
"type": "version",
|
||||||
|
"registry": true,
|
||||||
|
"raw": "buffer-alloc@1.2.0",
|
||||||
|
"name": "buffer-alloc",
|
||||||
|
"escapedName": "buffer-alloc",
|
||||||
|
"rawSpec": "1.2.0",
|
||||||
|
"saveSpec": null,
|
||||||
|
"fetchSpec": "1.2.0"
|
||||||
|
},
|
||||||
|
"_requiredBy": [
|
||||||
|
"/tar-stream"
|
||||||
|
],
|
||||||
|
"_resolved": "https://registry.npmjs.org/buffer-alloc/-/buffer-alloc-1.2.0.tgz",
|
||||||
|
"_spec": "1.2.0",
|
||||||
|
"_where": "/tmp/repository/main",
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/LinusU/buffer-alloc/issues"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"buffer-alloc-unsafe": "^1.1.0",
|
||||||
|
"buffer-fill": "^1.0.0"
|
||||||
|
},
|
||||||
|
"description": "A [ponyfill](https://ponyfill.com) for `Buffer.alloc`.",
|
||||||
|
"devDependencies": {
|
||||||
|
"standard": "^7.1.2"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"index.js"
|
||||||
|
],
|
||||||
|
"homepage": "https://github.com/LinusU/buffer-alloc#readme",
|
||||||
|
"keywords": [
|
||||||
|
"alloc",
|
||||||
|
"allocate",
|
||||||
|
"buffer alloc",
|
||||||
|
"buffer allocate",
|
||||||
|
"buffer"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"name": "buffer-alloc",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/LinusU/buffer-alloc.git"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"test": "standard && node test"
|
||||||
|
},
|
||||||
|
"version": "1.2.0"
|
||||||
|
}
|
||||||
43
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/buffer-alloc/readme.md
generated
vendored
Normal file
43
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/buffer-alloc/readme.md
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
# Buffer Alloc
|
||||||
|
|
||||||
|
A [ponyfill](https://ponyfill.com) for `Buffer.alloc`.
|
||||||
|
|
||||||
|
Works as Node.js: `v7.0.0` <br>
|
||||||
|
Works on Node.js: `v0.10.0`
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
```sh
|
||||||
|
npm install --save buffer-alloc
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```js
|
||||||
|
const alloc = require('buffer-alloc')
|
||||||
|
|
||||||
|
console.log(alloc(4))
|
||||||
|
//=> <Buffer 00 00 00 00>
|
||||||
|
|
||||||
|
console.log(alloc(6, 0x41))
|
||||||
|
//=> <Buffer 41 41 41 41 41 41>
|
||||||
|
|
||||||
|
console.log(alloc(10, 'linus', 'utf8'))
|
||||||
|
//=> <Buffer 6c 69 6e 75 73 6c 69 6e 75 73>
|
||||||
|
```
|
||||||
|
|
||||||
|
## API
|
||||||
|
|
||||||
|
### alloc(size[, fill[, encoding]])
|
||||||
|
|
||||||
|
- `size` <Integer> The desired length of the new `Buffer`
|
||||||
|
- `fill` <String> | <Buffer> | <Integer> A value to pre-fill the new `Buffer` with. **Default:** `0`
|
||||||
|
- `encoding` <String> If `fill` is a string, this is its encoding. **Default:** `'utf8'`
|
||||||
|
|
||||||
|
Allocates a new `Buffer` of `size` bytes. If `fill` is `undefined`, the `Buffer` will be zero-filled.
|
||||||
|
|
||||||
|
## See also
|
||||||
|
|
||||||
|
- [buffer-alloc-unsafe](https://github.com/LinusU/buffer-alloc-unsafe) A ponyfill for `Buffer.allocUnsafe`
|
||||||
|
- [buffer-fill](https://github.com/LinusU/buffer-fill) A ponyfill for `Buffer.fill`
|
||||||
|
- [buffer-from](https://github.com/LinusU/buffer-from) A ponyfill for `Buffer.from`
|
||||||
19
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/buffer-crc32/LICENSE
generated
vendored
Normal file
19
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/buffer-crc32/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
The MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2013 Brian J. Brennan
|
||||||
|
|
||||||
|
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.
|
||||||
47
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/buffer-crc32/README.md
generated
vendored
Normal file
47
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/buffer-crc32/README.md
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
# buffer-crc32
|
||||||
|
|
||||||
|
[](http://travis-ci.org/brianloveswords/buffer-crc32)
|
||||||
|
|
||||||
|
crc32 that works with binary data and fancy character sets, outputs
|
||||||
|
buffer, signed or unsigned data and has tests.
|
||||||
|
|
||||||
|
Derived from the sample CRC implementation in the PNG specification: http://www.w3.org/TR/PNG/#D-CRCAppendix
|
||||||
|
|
||||||
|
# install
|
||||||
|
```
|
||||||
|
npm install buffer-crc32
|
||||||
|
```
|
||||||
|
|
||||||
|
# example
|
||||||
|
```js
|
||||||
|
var crc32 = require('buffer-crc32');
|
||||||
|
// works with buffers
|
||||||
|
var buf = Buffer([0x00, 0x73, 0x75, 0x70, 0x20, 0x62, 0x72, 0x6f, 0x00])
|
||||||
|
crc32(buf) // -> <Buffer 94 5a ab 4a>
|
||||||
|
|
||||||
|
// has convenience methods for getting signed or unsigned ints
|
||||||
|
crc32.signed(buf) // -> -1805997238
|
||||||
|
crc32.unsigned(buf) // -> 2488970058
|
||||||
|
|
||||||
|
// will cast to buffer if given a string, so you can
|
||||||
|
// directly use foreign characters safely
|
||||||
|
crc32('自動販売機') // -> <Buffer cb 03 1a c5>
|
||||||
|
|
||||||
|
// and works in append mode too
|
||||||
|
var partialCrc = crc32('hey');
|
||||||
|
var partialCrc = crc32(' ', partialCrc);
|
||||||
|
var partialCrc = crc32('sup', partialCrc);
|
||||||
|
var partialCrc = crc32(' ', partialCrc);
|
||||||
|
var finalCrc = crc32('bros', partialCrc); // -> <Buffer 47 fa 55 70>
|
||||||
|
```
|
||||||
|
|
||||||
|
# tests
|
||||||
|
This was tested against the output of zlib's crc32 method. You can run
|
||||||
|
the tests with`npm test` (requires tap)
|
||||||
|
|
||||||
|
# see also
|
||||||
|
https://github.com/alexgorbatchev/node-crc, `crc.buffer.crc32` also
|
||||||
|
supports buffer inputs and return unsigned ints (thanks @tjholowaychuk).
|
||||||
|
|
||||||
|
# license
|
||||||
|
MIT/X11
|
||||||
111
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/buffer-crc32/index.js
generated
vendored
Normal file
111
dotfiles/.vscode-oss/extensions/oderwat.indent-rainbow-8.3.1-universal/node_modules/buffer-crc32/index.js
generated
vendored
Normal file
@@ -0,0 +1,111 @@
|
|||||||
|
var Buffer = require('buffer').Buffer;
|
||||||
|
|
||||||
|
var CRC_TABLE = [
|
||||||
|
0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419,
|
||||||
|
0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4,
|
||||||
|
0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07,
|
||||||
|
0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de,
|
||||||
|
0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856,
|
||||||
|
0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9,
|
||||||
|
0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4,
|
||||||
|
0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b,
|
||||||
|
0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3,
|
||||||
|
0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a,
|
||||||
|
0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599,
|
||||||
|
0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924,
|
||||||
|
0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190,
|
||||||
|
0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f,
|
||||||
|
0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e,
|
||||||
|
0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01,
|
||||||
|
0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed,
|
||||||
|
0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950,
|
||||||
|
0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3,
|
||||||
|
0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2,
|
||||||
|
0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a,
|
||||||
|
0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5,
|
||||||
|
0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010,
|
||||||
|
0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
|
||||||
|
0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17,
|
||||||
|
0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6,
|
||||||
|
0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615,
|
||||||
|
0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8,
|
||||||
|
0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344,
|
||||||
|
0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb,
|
||||||
|
0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a,
|
||||||
|
0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5,
|
||||||
|
0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1,
|
||||||
|
0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c,
|
||||||
|
0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef,
|
||||||
|
0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,
|
||||||
|
0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe,
|
||||||
|
0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31,
|
||||||
|
0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c,
|
||||||
|
0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713,
|
||||||
|
0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b,
|
||||||
|
0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242,
|
||||||
|
0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1,
|
||||||
|
0x18b74777, 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c,
|
||||||
|
0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278,
|
||||||
|
0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7,
|
||||||
|
0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66,
|
||||||
|
0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
|
||||||
|
0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605,
|
||||||
|
0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8,
|
||||||
|
0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b,
|
||||||
|
0x2d02ef8d
|
||||||
|
];
|
||||||
|
|
||||||
|
if (typeof Int32Array !== 'undefined') {
|
||||||
|
CRC_TABLE = new Int32Array(CRC_TABLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
function ensureBuffer(input) {
|
||||||
|
if (Buffer.isBuffer(input)) {
|
||||||
|
return input;
|
||||||
|
}
|
||||||
|
|
||||||
|
var hasNewBufferAPI =
|
||||||
|
typeof Buffer.alloc === "function" &&
|
||||||
|
typeof Buffer.from === "function";
|
||||||
|
|
||||||
|
if (typeof input === "number") {
|
||||||
|
return hasNewBufferAPI ? Buffer.alloc(input) : new Buffer(input);
|
||||||
|
}
|
||||||
|
else if (typeof input === "string") {
|
||||||
|
return hasNewBufferAPI ? Buffer.from(input) : new Buffer(input);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
throw new Error("input must be buffer, number, or string, received " +
|
||||||
|
typeof input);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function bufferizeInt(num) {
|
||||||
|
var tmp = ensureBuffer(4);
|
||||||
|
tmp.writeInt32BE(num, 0);
|
||||||
|
return tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
function _crc32(buf, previous) {
|
||||||
|
buf = ensureBuffer(buf);
|
||||||
|
if (Buffer.isBuffer(previous)) {
|
||||||
|
previous = previous.readUInt32BE(0);
|
||||||
|
}
|
||||||
|
var crc = ~~previous ^ -1;
|
||||||
|
for (var n = 0; n < buf.length; n++) {
|
||||||
|
crc = CRC_TABLE[(crc ^ buf[n]) & 0xff] ^ (crc >>> 8);
|
||||||
|
}
|
||||||
|
return (crc ^ -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
function crc32() {
|
||||||
|
return bufferizeInt(_crc32.apply(null, arguments));
|
||||||
|
}
|
||||||
|
crc32.signed = function () {
|
||||||
|
return _crc32.apply(null, arguments);
|
||||||
|
};
|
||||||
|
crc32.unsigned = function () {
|
||||||
|
return _crc32.apply(null, arguments) >>> 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = crc32;
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user