angular-slickgrid 4.1.4 → 4.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +182 -180
- package/app/modules/angular-slickgrid/components/angular-slickgrid.component.d.ts +2 -2
- package/app/modules/angular-slickgrid/extensions/slickRowDetailView.d.ts +0 -2
- package/esm2020/app/modules/angular-slickgrid/components/angular-slickgrid.component.mjs +15 -12
- package/esm2020/app/modules/angular-slickgrid/extensions/slickRowDetailView.mjs +1 -3
- package/esm2020/app/modules/angular-slickgrid/modules/angular-slickgrid.module.mjs +7 -10
- package/esm2020/app/modules/angular-slickgrid/services/angularUtil.service.mjs +3 -3
- package/esm2020/app/modules/angular-slickgrid/services/bsDropdown.service.mjs +3 -3
- package/esm2020/app/modules/angular-slickgrid/services/container.service.mjs +3 -3
- package/esm2020/app/modules/angular-slickgrid/services/translater.service.mjs +3 -3
- package/fesm2015/angular-slickgrid.mjs +32 -34
- package/fesm2015/angular-slickgrid.mjs.map +1 -1
- package/fesm2020/angular-slickgrid.mjs +32 -34
- package/fesm2020/angular-slickgrid.mjs.map +1 -1
- package/{angular-slickgrid.d.ts → index.d.ts} +0 -0
- package/package.json +14 -15
- package/test/cypress/node_modules/@cypress/request/README.md +1038 -0
- package/test/cypress/node_modules/@cypress/xvfb/README.md +48 -0
- package/test/cypress/node_modules/@cypress/xvfb/node_modules/debug/README.md +437 -0
- package/test/cypress/node_modules/@types/node/README.md +16 -0
- package/test/cypress/node_modules/@types/sinonjs__fake-timers/README.md +16 -0
- package/test/cypress/node_modules/@types/sizzle/README.md +16 -0
- package/test/cypress/node_modules/@types/yauzl/README.md +16 -0
- package/test/cypress/node_modules/@types/yauzl/node_modules/@types/node/README.md +16 -0
- package/test/cypress/node_modules/aggregate-error/README.md +61 -0
- package/test/cypress/node_modules/ansi-colors/README.md +315 -0
- package/test/cypress/node_modules/ansi-escapes/README.md +245 -0
- package/test/cypress/node_modules/ansi-regex/README.md +78 -0
- package/test/cypress/node_modules/ansi-styles/README.md +152 -0
- package/test/cypress/node_modules/arch/README.md +71 -0
- package/test/cypress/node_modules/asn1/README.md +50 -0
- package/test/cypress/node_modules/assert-plus/README.md +162 -0
- package/test/cypress/node_modules/astral-regex/README.md +46 -0
- package/test/cypress/node_modules/async/README.md +60 -0
- package/test/cypress/node_modules/asynckit/README.md +233 -0
- package/test/cypress/node_modules/at-least-node/README.md +25 -0
- package/test/cypress/node_modules/aws-sign2/README.md +4 -0
- package/test/cypress/node_modules/aws4/README.md +183 -0
- package/test/cypress/node_modules/balanced-match/README.md +91 -0
- package/test/cypress/node_modules/base64-js/README.md +34 -0
- package/test/cypress/node_modules/bcrypt-pbkdf/README.md +45 -0
- package/test/cypress/node_modules/blob-util/README.md +623 -0
- package/test/cypress/node_modules/bluebird/README.md +57 -0
- package/test/cypress/node_modules/brace-expansion/README.md +129 -0
- package/test/cypress/node_modules/buffer/README.md +410 -0
- package/test/cypress/node_modules/buffer-crc32/README.md +47 -0
- package/test/cypress/node_modules/cachedir/README.md +27 -0
- package/test/cypress/node_modules/caseless/README.md +45 -0
- package/test/cypress/node_modules/chalk/README.md +293 -0
- package/test/cypress/node_modules/chalk/node_modules/supports-color/README.md +76 -0
- package/test/cypress/node_modules/check-more-types/README.md +952 -0
- package/test/cypress/node_modules/ci-info/README.md +114 -0
- package/test/cypress/node_modules/clean-stack/README.md +76 -0
- package/test/cypress/node_modules/cli-cursor/README.md +55 -0
- package/test/cypress/node_modules/cli-table3/README.md +218 -0
- package/test/cypress/node_modules/cli-truncate/README.md +139 -0
- package/test/cypress/node_modules/color-convert/README.md +68 -0
- package/test/cypress/node_modules/color-name/README.md +11 -0
- package/test/cypress/node_modules/colorette/README.md +102 -0
- package/test/cypress/node_modules/colors/README.md +221 -0
- package/test/cypress/node_modules/combined-stream/README.md +138 -0
- package/test/cypress/node_modules/commander/README.md +737 -0
- package/test/cypress/node_modules/common-tags/README.md +687 -0
- package/test/cypress/node_modules/core-util-is/README.md +3 -0
- package/test/cypress/node_modules/cross-spawn/README.md +96 -0
- package/test/cypress/node_modules/cypress/README.md +25 -0
- package/test/cypress/node_modules/cypress/mount-utils/README.md +14 -0
- package/test/cypress/node_modules/cypress/react/README.md +414 -0
- package/test/cypress/node_modules/cypress/vue/README.md +678 -0
- package/test/cypress/node_modules/cypress/vue2/README.md +693 -0
- package/test/cypress/node_modules/dashdash/README.md +574 -0
- package/test/cypress/node_modules/dayjs/README.md +128 -0
- package/test/cypress/node_modules/debug/README.md +455 -0
- package/test/cypress/node_modules/delayed-stream/README.md +141 -0
- package/test/cypress/node_modules/ecc-jsbn/README.md +8 -0
- package/test/cypress/node_modules/emoji-regex/README.md +73 -0
- package/test/cypress/node_modules/end-of-stream/README.md +54 -0
- package/test/cypress/node_modules/enquirer/README.md +1752 -0
- package/test/cypress/node_modules/escape-string-regexp/README.md +27 -0
- package/test/cypress/node_modules/eventemitter2/README.md +809 -0
- package/test/cypress/node_modules/execa/README.md +656 -0
- package/test/cypress/node_modules/executable/README.md +64 -0
- package/test/cypress/node_modules/extend/README.md +81 -0
- package/test/cypress/node_modules/extract-zip/README.md +57 -0
- package/test/cypress/node_modules/extract-zip/node_modules/debug/README.md +455 -0
- package/test/cypress/node_modules/extsprintf/README.md +46 -0
- package/test/cypress/node_modules/fd-slicer/README.md +199 -0
- package/test/cypress/node_modules/figures/README.md +139 -0
- package/test/cypress/node_modules/forever-agent/README.md +4 -0
- package/test/cypress/node_modules/form-data/README.md +234 -0
- package/test/cypress/node_modules/fs-extra/README.md +264 -0
- package/test/cypress/node_modules/fs.realpath/README.md +33 -0
- package/test/cypress/node_modules/get-stream/README.md +124 -0
- package/test/cypress/node_modules/getos/README.md +79 -0
- package/test/cypress/node_modules/getpass/README.md +32 -0
- package/test/cypress/node_modules/glob/README.md +375 -0
- package/test/cypress/node_modules/global-dirs/README.md +72 -0
- package/test/cypress/node_modules/graceful-fs/README.md +133 -0
- package/test/cypress/node_modules/has-flag/README.md +89 -0
- package/test/cypress/node_modules/http-signature/README.md +80 -0
- package/test/cypress/node_modules/human-signals/README.md +155 -0
- package/test/cypress/node_modules/ieee754/README.md +51 -0
- package/test/cypress/node_modules/indent-string/README.md +70 -0
- package/test/cypress/node_modules/inflight/README.md +37 -0
- package/test/cypress/node_modules/inherits/README.md +42 -0
- package/test/cypress/node_modules/ini/README.md +102 -0
- package/test/cypress/node_modules/is-ci/README.md +50 -0
- package/test/cypress/node_modules/is-fullwidth-code-point/README.md +39 -0
- package/test/cypress/node_modules/is-installed-globally/README.md +31 -0
- package/test/cypress/node_modules/is-path-inside/README.md +63 -0
- package/test/cypress/node_modules/is-stream/README.md +57 -0
- package/test/cypress/node_modules/is-typedarray/README.md +16 -0
- package/test/cypress/node_modules/isexe/README.md +51 -0
- package/test/cypress/node_modules/isstream/README.md +66 -0
- package/test/cypress/node_modules/jsbn/README.md +175 -0
- package/test/cypress/node_modules/json-schema/README.md +3 -0
- package/test/cypress/node_modules/json-stringify-safe/README.md +52 -0
- package/test/cypress/node_modules/jsonfile/README.md +205 -0
- package/test/cypress/node_modules/jsonfile/node_modules/universalify/README.md +76 -0
- package/test/cypress/node_modules/jsprim/README.md +287 -0
- package/test/cypress/node_modules/lazy-ass/README.md +269 -0
- package/test/cypress/node_modules/listr2/README.md +17 -0
- package/test/cypress/node_modules/lodash/README.md +39 -0
- package/test/cypress/node_modules/lodash.once/README.md +18 -0
- package/test/cypress/node_modules/log-symbols/README.md +51 -0
- package/test/cypress/node_modules/log-update/README.md +97 -0
- package/test/cypress/node_modules/log-update/node_modules/slice-ansi/README.md +66 -0
- package/test/cypress/node_modules/log-update/node_modules/wrap-ansi/README.md +97 -0
- package/test/cypress/node_modules/lru-cache/README.md +166 -0
- package/test/cypress/node_modules/merge-stream/README.md +78 -0
- package/test/cypress/node_modules/mime-db/README.md +102 -0
- package/test/cypress/node_modules/mime-types/README.md +123 -0
- package/test/cypress/node_modules/mimic-fn/README.md +69 -0
- package/test/cypress/node_modules/minimatch/README.md +209 -0
- package/test/cypress/node_modules/ms/README.md +60 -0
- package/test/cypress/node_modules/npm-run-path/README.md +115 -0
- package/test/cypress/node_modules/once/README.md +79 -0
- package/test/cypress/node_modules/onetime/README.md +94 -0
- package/test/cypress/node_modules/ospath/README.md +53 -0
- package/test/cypress/node_modules/p-map/README.md +89 -0
- package/test/cypress/node_modules/path-is-absolute/README.md +59 -0
- package/test/cypress/node_modules/path-key/README.md +61 -0
- package/test/cypress/node_modules/pend/README.md +41 -0
- package/test/cypress/node_modules/performance-now/README.md +30 -0
- package/test/cypress/node_modules/pify/README.md +119 -0
- package/test/cypress/node_modules/pretty-bytes/README.md +131 -0
- package/test/cypress/node_modules/proxy-from-env/README.md +131 -0
- package/test/cypress/node_modules/psl/README.md +215 -0
- package/test/cypress/node_modules/pump/README.md +65 -0
- package/test/cypress/node_modules/punycode/README.md +122 -0
- package/test/cypress/node_modules/qs/README.md +475 -0
- package/test/cypress/node_modules/request-progress/README.md +78 -0
- package/test/cypress/node_modules/restore-cursor/README.md +26 -0
- package/test/cypress/node_modules/rimraf/README.md +101 -0
- package/test/cypress/node_modules/rxjs/README.md +147 -0
- package/test/cypress/node_modules/rxjs/_esm2015/README.md +147 -0
- package/test/cypress/node_modules/rxjs/_esm5/README.md +147 -0
- package/test/cypress/node_modules/rxjs/src/README.md +147 -0
- package/test/cypress/node_modules/safe-buffer/README.md +584 -0
- package/test/cypress/node_modules/safer-buffer/README.md +156 -0
- package/test/cypress/node_modules/semver/README.md +566 -0
- package/test/cypress/node_modules/shebang-command/README.md +34 -0
- package/test/cypress/node_modules/shebang-regex/README.md +33 -0
- package/test/cypress/node_modules/signal-exit/README.md +39 -0
- package/test/cypress/node_modules/slice-ansi/README.md +72 -0
- package/test/cypress/node_modules/sshpk/README.md +804 -0
- package/test/cypress/node_modules/string-width/README.md +50 -0
- package/test/cypress/node_modules/strip-ansi/README.md +46 -0
- package/test/cypress/node_modules/strip-final-newline/README.md +30 -0
- package/test/cypress/node_modules/supports-color/README.md +77 -0
- package/test/cypress/node_modules/throttleit/README.md +32 -0
- package/test/cypress/node_modules/tmp/README.md +365 -0
- package/test/cypress/node_modules/tough-cookie/README.md +527 -0
- package/test/cypress/node_modules/tslib/README.md +142 -0
- package/test/cypress/node_modules/tunnel-agent/README.md +4 -0
- package/test/cypress/node_modules/tweetnacl/README.md +459 -0
- package/test/cypress/node_modules/type-fest/README.md +760 -0
- package/test/cypress/node_modules/universalify/README.md +76 -0
- package/test/cypress/node_modules/untildify/README.md +30 -0
- package/test/cypress/node_modules/uuid/README.md +505 -0
- package/test/cypress/node_modules/verror/README.md +528 -0
- package/test/cypress/node_modules/verror/node_modules/extsprintf/README.md +46 -0
- package/test/cypress/node_modules/which/README.md +54 -0
- package/test/cypress/node_modules/wrap-ansi/README.md +91 -0
- package/test/cypress/node_modules/wrappy/README.md +36 -0
- package/test/cypress/node_modules/yallist/README.md +204 -0
- package/test/cypress/node_modules/yauzl/README.md +658 -0
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
# proxy-from-env
|
|
2
|
+
|
|
3
|
+
[](https://travis-ci.org/Rob--W/proxy-from-env)
|
|
4
|
+
[](https://coveralls.io/github/Rob--W/proxy-from-env?branch=master)
|
|
5
|
+
|
|
6
|
+
`proxy-from-env` is a Node.js package that exports a function (`getProxyForUrl`)
|
|
7
|
+
that takes an input URL (a string or
|
|
8
|
+
[`url.parse`](https://nodejs.org/docs/latest/api/url.html#url_url_parsing)'s
|
|
9
|
+
return value) and returns the desired proxy URL (also a string) based on
|
|
10
|
+
standard proxy environment variables. If no proxy is set, an empty string is
|
|
11
|
+
returned.
|
|
12
|
+
|
|
13
|
+
It is your responsibility to actually proxy the request using the given URL.
|
|
14
|
+
|
|
15
|
+
Installation:
|
|
16
|
+
|
|
17
|
+
```sh
|
|
18
|
+
npm install proxy-from-env
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Example
|
|
22
|
+
This example shows how the data for a URL can be fetched via the
|
|
23
|
+
[`http` module](https://nodejs.org/api/http.html), in a proxy-aware way.
|
|
24
|
+
|
|
25
|
+
```javascript
|
|
26
|
+
var http = require('http');
|
|
27
|
+
var parseUrl = require('url').parse;
|
|
28
|
+
var getProxyForUrl = require('proxy-from-env').getProxyForUrl;
|
|
29
|
+
|
|
30
|
+
var some_url = 'http://example.com/something';
|
|
31
|
+
|
|
32
|
+
// // Example, if there is a proxy server at 10.0.0.1:1234, then setting the
|
|
33
|
+
// // http_proxy environment variable causes the request to go through a proxy.
|
|
34
|
+
// process.env.http_proxy = 'http://10.0.0.1:1234';
|
|
35
|
+
//
|
|
36
|
+
// // But if the host to be proxied is listed in NO_PROXY, then the request is
|
|
37
|
+
// // not proxied (but a direct request is made).
|
|
38
|
+
// process.env.no_proxy = 'example.com';
|
|
39
|
+
|
|
40
|
+
var proxy_url = getProxyForUrl(some_url); // <-- Our magic.
|
|
41
|
+
if (proxy_url) {
|
|
42
|
+
// Should be proxied through proxy_url.
|
|
43
|
+
var parsed_some_url = parseUrl(some_url);
|
|
44
|
+
var parsed_proxy_url = parseUrl(proxy_url);
|
|
45
|
+
// A HTTP proxy is quite simple. It is similar to a normal request, except the
|
|
46
|
+
// path is an absolute URL, and the proxied URL's host is put in the header
|
|
47
|
+
// instead of the server's actual host.
|
|
48
|
+
httpOptions = {
|
|
49
|
+
protocol: parsed_proxy_url.protocol,
|
|
50
|
+
hostname: parsed_proxy_url.hostname,
|
|
51
|
+
port: parsed_proxy_url.port,
|
|
52
|
+
path: parsed_some_url.href,
|
|
53
|
+
headers: {
|
|
54
|
+
Host: parsed_some_url.host, // = host name + optional port.
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
} else {
|
|
58
|
+
// Direct request.
|
|
59
|
+
httpOptions = some_url;
|
|
60
|
+
}
|
|
61
|
+
http.get(httpOptions, function(res) {
|
|
62
|
+
var responses = [];
|
|
63
|
+
res.on('data', function(chunk) { responses.push(chunk); });
|
|
64
|
+
res.on('end', function() { console.log(responses.join('')); });
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Environment variables
|
|
70
|
+
The environment variables can be specified in lowercase or uppercase, with the
|
|
71
|
+
lowercase name having precedence over the uppercase variant. A variable that is
|
|
72
|
+
not set has the same meaning as a variable that is set but has no value.
|
|
73
|
+
|
|
74
|
+
### NO\_PROXY
|
|
75
|
+
|
|
76
|
+
`NO_PROXY` is a list of host names (optionally with a port). If the input URL
|
|
77
|
+
matches any of the entries in `NO_PROXY`, then the input URL should be fetched
|
|
78
|
+
by a direct request (i.e. without a proxy).
|
|
79
|
+
|
|
80
|
+
Matching follows the following rules:
|
|
81
|
+
|
|
82
|
+
- `NO_PROXY=*` disables all proxies.
|
|
83
|
+
- Space and commas may be used to separate the entries in the `NO_PROXY` list.
|
|
84
|
+
- If `NO_PROXY` does not contain any entries, then proxies are never disabled.
|
|
85
|
+
- If a port is added after the host name, then the ports must match. If the URL
|
|
86
|
+
does not have an explicit port name, the protocol's default port is used.
|
|
87
|
+
- Generally, the proxy is only disabled if the host name is an exact match for
|
|
88
|
+
an entry in the `NO_PROXY` list. The only exceptions are entries that start
|
|
89
|
+
with a dot or with a wildcard; then the proxy is disabled if the host name
|
|
90
|
+
ends with the entry.
|
|
91
|
+
|
|
92
|
+
See `test.js` for examples of what should match and what does not.
|
|
93
|
+
|
|
94
|
+
### \*\_PROXY
|
|
95
|
+
|
|
96
|
+
The environment variable used for the proxy depends on the protocol of the URL.
|
|
97
|
+
For example, `https://example.com` uses the "https" protocol, and therefore the
|
|
98
|
+
proxy to be used is `HTTPS_PROXY` (_NOT_ `HTTP_PROXY`, which is _only_ used for
|
|
99
|
+
http:-URLs).
|
|
100
|
+
|
|
101
|
+
The library is not limited to http(s), other schemes such as
|
|
102
|
+
`FTP_PROXY` (ftp:),
|
|
103
|
+
`WSS_PROXY` (wss:),
|
|
104
|
+
`WS_PROXY` (ws:)
|
|
105
|
+
are also supported.
|
|
106
|
+
|
|
107
|
+
If present, `ALL_PROXY` is used as fallback if there is no other match.
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
## External resources
|
|
111
|
+
The exact way of parsing the environment variables is not codified in any
|
|
112
|
+
standard. This library is designed to be compatible with formats as expected by
|
|
113
|
+
existing software.
|
|
114
|
+
The following resources were used to determine the desired behavior:
|
|
115
|
+
|
|
116
|
+
- cURL:
|
|
117
|
+
https://curl.haxx.se/docs/manpage.html#ENVIRONMENT
|
|
118
|
+
https://github.com/curl/curl/blob/4af40b3646d3b09f68e419f7ca866ff395d1f897/lib/url.c#L4446-L4514
|
|
119
|
+
https://github.com/curl/curl/blob/4af40b3646d3b09f68e419f7ca866ff395d1f897/lib/url.c#L4608-L4638
|
|
120
|
+
|
|
121
|
+
- wget:
|
|
122
|
+
https://www.gnu.org/software/wget/manual/wget.html#Proxies
|
|
123
|
+
http://git.savannah.gnu.org/cgit/wget.git/tree/src/init.c?id=636a5f9a1c508aa39e35a3a8e9e54520a284d93d#n383
|
|
124
|
+
http://git.savannah.gnu.org/cgit/wget.git/tree/src/retr.c?id=93c1517c4071c4288ba5a4b038e7634e4c6b5482#n1278
|
|
125
|
+
|
|
126
|
+
- W3:
|
|
127
|
+
https://www.w3.org/Daemon/User/Proxies/ProxyClients.html
|
|
128
|
+
|
|
129
|
+
- Python's urllib:
|
|
130
|
+
https://github.com/python/cpython/blob/936135bb97fe04223aa30ca6e98eac8f3ed6b349/Lib/urllib/request.py#L755-L782
|
|
131
|
+
https://github.com/python/cpython/blob/936135bb97fe04223aa30ca6e98eac8f3ed6b349/Lib/urllib/request.py#L2444-L2479
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
# psl (Public Suffix List)
|
|
2
|
+
|
|
3
|
+
[](https://nodei.co/npm/psl/)
|
|
4
|
+
|
|
5
|
+
[](https://greenkeeper.io/)
|
|
6
|
+
[](https://travis-ci.org/lupomontero/psl)
|
|
7
|
+
[](https://david-dm.org/lupomontero/psl#info=devDependencies)
|
|
8
|
+
|
|
9
|
+
`psl` is a `JavaScript` domain name parser based on the
|
|
10
|
+
[Public Suffix List](https://publicsuffix.org/).
|
|
11
|
+
|
|
12
|
+
This implementation is tested against the
|
|
13
|
+
[test data hosted by Mozilla](http://mxr.mozilla.org/mozilla-central/source/netwerk/test/unit/data/test_psl.txt?raw=1)
|
|
14
|
+
and kindly provided by [Comodo](https://www.comodo.com/).
|
|
15
|
+
|
|
16
|
+
Cross browser testing provided by
|
|
17
|
+
[<img alt="BrowserStack" width="160" src="./browserstack-logo.svg" />](https://www.browserstack.com/)
|
|
18
|
+
|
|
19
|
+
## What is the Public Suffix List?
|
|
20
|
+
|
|
21
|
+
The Public Suffix List is a cross-vendor initiative to provide an accurate list
|
|
22
|
+
of domain name suffixes.
|
|
23
|
+
|
|
24
|
+
The Public Suffix List is an initiative of the Mozilla Project, but is
|
|
25
|
+
maintained as a community resource. It is available for use in any software,
|
|
26
|
+
but was originally created to meet the needs of browser manufacturers.
|
|
27
|
+
|
|
28
|
+
A "public suffix" is one under which Internet users can directly register names.
|
|
29
|
+
Some examples of public suffixes are ".com", ".co.uk" and "pvt.k12.wy.us". The
|
|
30
|
+
Public Suffix List is a list of all known public suffixes.
|
|
31
|
+
|
|
32
|
+
Source: http://publicsuffix.org
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
## Installation
|
|
36
|
+
|
|
37
|
+
### Node.js
|
|
38
|
+
|
|
39
|
+
```sh
|
|
40
|
+
npm install --save psl
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Browser
|
|
44
|
+
|
|
45
|
+
Download [psl.min.js](https://raw.githubusercontent.com/lupomontero/psl/master/dist/psl.min.js)
|
|
46
|
+
and include it in a script tag.
|
|
47
|
+
|
|
48
|
+
```html
|
|
49
|
+
<script src="psl.min.js"></script>
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
This script is browserified and wrapped in a [umd](https://github.com/umdjs/umd)
|
|
53
|
+
wrapper so you should be able to use it standalone or together with a module
|
|
54
|
+
loader.
|
|
55
|
+
|
|
56
|
+
## API
|
|
57
|
+
|
|
58
|
+
### `psl.parse(domain)`
|
|
59
|
+
|
|
60
|
+
Parse domain based on Public Suffix List. Returns an `Object` with the following
|
|
61
|
+
properties:
|
|
62
|
+
|
|
63
|
+
* `tld`: Top level domain (this is the _public suffix_).
|
|
64
|
+
* `sld`: Second level domain (the first private part of the domain name).
|
|
65
|
+
* `domain`: The domain name is the `sld` + `tld`.
|
|
66
|
+
* `subdomain`: Optional parts left of the domain.
|
|
67
|
+
|
|
68
|
+
#### Example:
|
|
69
|
+
|
|
70
|
+
```js
|
|
71
|
+
var psl = require('psl');
|
|
72
|
+
|
|
73
|
+
// Parse domain without subdomain
|
|
74
|
+
var parsed = psl.parse('google.com');
|
|
75
|
+
console.log(parsed.tld); // 'com'
|
|
76
|
+
console.log(parsed.sld); // 'google'
|
|
77
|
+
console.log(parsed.domain); // 'google.com'
|
|
78
|
+
console.log(parsed.subdomain); // null
|
|
79
|
+
|
|
80
|
+
// Parse domain with subdomain
|
|
81
|
+
var parsed = psl.parse('www.google.com');
|
|
82
|
+
console.log(parsed.tld); // 'com'
|
|
83
|
+
console.log(parsed.sld); // 'google'
|
|
84
|
+
console.log(parsed.domain); // 'google.com'
|
|
85
|
+
console.log(parsed.subdomain); // 'www'
|
|
86
|
+
|
|
87
|
+
// Parse domain with nested subdomains
|
|
88
|
+
var parsed = psl.parse('a.b.c.d.foo.com');
|
|
89
|
+
console.log(parsed.tld); // 'com'
|
|
90
|
+
console.log(parsed.sld); // 'foo'
|
|
91
|
+
console.log(parsed.domain); // 'foo.com'
|
|
92
|
+
console.log(parsed.subdomain); // 'a.b.c.d'
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### `psl.get(domain)`
|
|
96
|
+
|
|
97
|
+
Get domain name, `sld` + `tld`. Returns `null` if not valid.
|
|
98
|
+
|
|
99
|
+
#### Example:
|
|
100
|
+
|
|
101
|
+
```js
|
|
102
|
+
var psl = require('psl');
|
|
103
|
+
|
|
104
|
+
// null input.
|
|
105
|
+
psl.get(null); // null
|
|
106
|
+
|
|
107
|
+
// Mixed case.
|
|
108
|
+
psl.get('COM'); // null
|
|
109
|
+
psl.get('example.COM'); // 'example.com'
|
|
110
|
+
psl.get('WwW.example.COM'); // 'example.com'
|
|
111
|
+
|
|
112
|
+
// Unlisted TLD.
|
|
113
|
+
psl.get('example'); // null
|
|
114
|
+
psl.get('example.example'); // 'example.example'
|
|
115
|
+
psl.get('b.example.example'); // 'example.example'
|
|
116
|
+
psl.get('a.b.example.example'); // 'example.example'
|
|
117
|
+
|
|
118
|
+
// TLD with only 1 rule.
|
|
119
|
+
psl.get('biz'); // null
|
|
120
|
+
psl.get('domain.biz'); // 'domain.biz'
|
|
121
|
+
psl.get('b.domain.biz'); // 'domain.biz'
|
|
122
|
+
psl.get('a.b.domain.biz'); // 'domain.biz'
|
|
123
|
+
|
|
124
|
+
// TLD with some 2-level rules.
|
|
125
|
+
psl.get('uk.com'); // null);
|
|
126
|
+
psl.get('example.uk.com'); // 'example.uk.com');
|
|
127
|
+
psl.get('b.example.uk.com'); // 'example.uk.com');
|
|
128
|
+
|
|
129
|
+
// More complex TLD.
|
|
130
|
+
psl.get('c.kobe.jp'); // null
|
|
131
|
+
psl.get('b.c.kobe.jp'); // 'b.c.kobe.jp'
|
|
132
|
+
psl.get('a.b.c.kobe.jp'); // 'b.c.kobe.jp'
|
|
133
|
+
psl.get('city.kobe.jp'); // 'city.kobe.jp'
|
|
134
|
+
psl.get('www.city.kobe.jp'); // 'city.kobe.jp'
|
|
135
|
+
|
|
136
|
+
// IDN labels.
|
|
137
|
+
psl.get('食狮.com.cn'); // '食狮.com.cn'
|
|
138
|
+
psl.get('食狮.公司.cn'); // '食狮.公司.cn'
|
|
139
|
+
psl.get('www.食狮.公司.cn'); // '食狮.公司.cn'
|
|
140
|
+
|
|
141
|
+
// Same as above, but punycoded.
|
|
142
|
+
psl.get('xn--85x722f.com.cn'); // 'xn--85x722f.com.cn'
|
|
143
|
+
psl.get('xn--85x722f.xn--55qx5d.cn'); // 'xn--85x722f.xn--55qx5d.cn'
|
|
144
|
+
psl.get('www.xn--85x722f.xn--55qx5d.cn'); // 'xn--85x722f.xn--55qx5d.cn'
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### `psl.isValid(domain)`
|
|
148
|
+
|
|
149
|
+
Check whether a domain has a valid Public Suffix. Returns a `Boolean` indicating
|
|
150
|
+
whether the domain has a valid Public Suffix.
|
|
151
|
+
|
|
152
|
+
#### Example
|
|
153
|
+
|
|
154
|
+
```js
|
|
155
|
+
var psl = require('psl');
|
|
156
|
+
|
|
157
|
+
psl.isValid('google.com'); // true
|
|
158
|
+
psl.isValid('www.google.com'); // true
|
|
159
|
+
psl.isValid('x.yz'); // false
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
## Testing and Building
|
|
164
|
+
|
|
165
|
+
Test are written using [`mocha`](https://mochajs.org/) and can be
|
|
166
|
+
run in two different environments: `node` and `phantomjs`.
|
|
167
|
+
|
|
168
|
+
```sh
|
|
169
|
+
# This will run `eslint`, `mocha` and `karma`.
|
|
170
|
+
npm test
|
|
171
|
+
|
|
172
|
+
# Individual test environments
|
|
173
|
+
# Run tests in node only.
|
|
174
|
+
./node_modules/.bin/mocha test
|
|
175
|
+
# Run tests in phantomjs only.
|
|
176
|
+
./node_modules/.bin/karma start ./karma.conf.js --single-run
|
|
177
|
+
|
|
178
|
+
# Build data (parse raw list) and create dist files
|
|
179
|
+
npm run build
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
Feel free to fork if you see possible improvements!
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
## Acknowledgements
|
|
186
|
+
|
|
187
|
+
* Mozilla Foundation's [Public Suffix List](https://publicsuffix.org/)
|
|
188
|
+
* Thanks to Rob Stradling of [Comodo](https://www.comodo.com/) for providing
|
|
189
|
+
test data.
|
|
190
|
+
* Inspired by [weppos/publicsuffix-ruby](https://github.com/weppos/publicsuffix-ruby)
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
## License
|
|
194
|
+
|
|
195
|
+
The MIT License (MIT)
|
|
196
|
+
|
|
197
|
+
Copyright (c) 2017 Lupo Montero <lupomontero@gmail.com>
|
|
198
|
+
|
|
199
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
200
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
201
|
+
in the Software without restriction, including without limitation the rights
|
|
202
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
203
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
204
|
+
furnished to do so, subject to the following conditions:
|
|
205
|
+
|
|
206
|
+
The above copyright notice and this permission notice shall be included in
|
|
207
|
+
all copies or substantial portions of the Software.
|
|
208
|
+
|
|
209
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
210
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
211
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
212
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
213
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
214
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
215
|
+
THE SOFTWARE.
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# pump
|
|
2
|
+
|
|
3
|
+
pump is a small node module that pipes streams together and destroys all of them if one of them closes.
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
npm install pump
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
[](http://travis-ci.org/mafintosh/pump)
|
|
10
|
+
|
|
11
|
+
## What problem does it solve?
|
|
12
|
+
|
|
13
|
+
When using standard `source.pipe(dest)` source will _not_ be destroyed if dest emits close or an error.
|
|
14
|
+
You are also not able to provide a callback to tell when then pipe has finished.
|
|
15
|
+
|
|
16
|
+
pump does these two things for you
|
|
17
|
+
|
|
18
|
+
## Usage
|
|
19
|
+
|
|
20
|
+
Simply pass the streams you want to pipe together to pump and add an optional callback
|
|
21
|
+
|
|
22
|
+
``` js
|
|
23
|
+
var pump = require('pump')
|
|
24
|
+
var fs = require('fs')
|
|
25
|
+
|
|
26
|
+
var source = fs.createReadStream('/dev/random')
|
|
27
|
+
var dest = fs.createWriteStream('/dev/null')
|
|
28
|
+
|
|
29
|
+
pump(source, dest, function(err) {
|
|
30
|
+
console.log('pipe finished', err)
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
setTimeout(function() {
|
|
34
|
+
dest.destroy() // when dest is closed pump will destroy source
|
|
35
|
+
}, 1000)
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
You can use pump to pipe more than two streams together as well
|
|
39
|
+
|
|
40
|
+
``` js
|
|
41
|
+
var transform = someTransformStream()
|
|
42
|
+
|
|
43
|
+
pump(source, transform, anotherTransform, dest, function(err) {
|
|
44
|
+
console.log('pipe finished', err)
|
|
45
|
+
})
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
If `source`, `transform`, `anotherTransform` or `dest` closes all of them will be destroyed.
|
|
49
|
+
|
|
50
|
+
Similarly to `stream.pipe()`, `pump()` returns the last stream passed in, so you can do:
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
return pump(s1, s2) // returns s2
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
If you want to return a stream that combines *both* s1 and s2 to a single stream use
|
|
57
|
+
[pumpify](https://github.com/mafintosh/pumpify) instead.
|
|
58
|
+
|
|
59
|
+
## License
|
|
60
|
+
|
|
61
|
+
MIT
|
|
62
|
+
|
|
63
|
+
## Related
|
|
64
|
+
|
|
65
|
+
`pump` is part of the [mississippi stream utility collection](https://github.com/maxogden/mississippi) which includes more useful stream modules similar to this one.
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
# Punycode.js [](https://travis-ci.org/bestiejs/punycode.js) [](https://codecov.io/gh/bestiejs/punycode.js) [](https://gemnasium.com/bestiejs/punycode.js)
|
|
2
|
+
|
|
3
|
+
Punycode.js is a robust Punycode converter that fully complies to [RFC 3492](https://tools.ietf.org/html/rfc3492) and [RFC 5891](https://tools.ietf.org/html/rfc5891).
|
|
4
|
+
|
|
5
|
+
This JavaScript library is the result of comparing, optimizing and documenting different open-source implementations of the Punycode algorithm:
|
|
6
|
+
|
|
7
|
+
* [The C example code from RFC 3492](https://tools.ietf.org/html/rfc3492#appendix-C)
|
|
8
|
+
* [`punycode.c` by _Markus W. Scherer_ (IBM)](http://opensource.apple.com/source/ICU/ICU-400.42/icuSources/common/punycode.c)
|
|
9
|
+
* [`punycode.c` by _Ben Noordhuis_](https://github.com/bnoordhuis/punycode/blob/master/punycode.c)
|
|
10
|
+
* [JavaScript implementation by _some_](http://stackoverflow.com/questions/183485/can-anyone-recommend-a-good-free-javascript-for-punycode-to-unicode-conversion/301287#301287)
|
|
11
|
+
* [`punycode.js` by _Ben Noordhuis_](https://github.com/joyent/node/blob/426298c8c1c0d5b5224ac3658c41e7c2a3fe9377/lib/punycode.js) (note: [not fully compliant](https://github.com/joyent/node/issues/2072))
|
|
12
|
+
|
|
13
|
+
This project was [bundled](https://github.com/joyent/node/blob/master/lib/punycode.js) with Node.js from [v0.6.2+](https://github.com/joyent/node/compare/975f1930b1...61e796decc) until [v7](https://github.com/nodejs/node/pull/7941) (soft-deprecated).
|
|
14
|
+
|
|
15
|
+
The current version supports recent versions of Node.js only. It provides a CommonJS module and an ES6 module. For the old version that offers the same functionality with broader support, including Rhino, Ringo, Narwhal, and web browsers, see [v1.4.1](https://github.com/bestiejs/punycode.js/releases/tag/v1.4.1).
|
|
16
|
+
|
|
17
|
+
## Installation
|
|
18
|
+
|
|
19
|
+
Via [npm](https://www.npmjs.com/):
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npm install punycode --save
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
In [Node.js](https://nodejs.org/):
|
|
26
|
+
|
|
27
|
+
```js
|
|
28
|
+
const punycode = require('punycode');
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## API
|
|
32
|
+
|
|
33
|
+
### `punycode.decode(string)`
|
|
34
|
+
|
|
35
|
+
Converts a Punycode string of ASCII symbols to a string of Unicode symbols.
|
|
36
|
+
|
|
37
|
+
```js
|
|
38
|
+
// decode domain name parts
|
|
39
|
+
punycode.decode('maana-pta'); // 'mañana'
|
|
40
|
+
punycode.decode('--dqo34k'); // '☃-⌘'
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### `punycode.encode(string)`
|
|
44
|
+
|
|
45
|
+
Converts a string of Unicode symbols to a Punycode string of ASCII symbols.
|
|
46
|
+
|
|
47
|
+
```js
|
|
48
|
+
// encode domain name parts
|
|
49
|
+
punycode.encode('mañana'); // 'maana-pta'
|
|
50
|
+
punycode.encode('☃-⌘'); // '--dqo34k'
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### `punycode.toUnicode(input)`
|
|
54
|
+
|
|
55
|
+
Converts a Punycode string representing a domain name or an email address to Unicode. Only the Punycoded parts of the input will be converted, i.e. it doesn’t matter if you call it on a string that has already been converted to Unicode.
|
|
56
|
+
|
|
57
|
+
```js
|
|
58
|
+
// decode domain names
|
|
59
|
+
punycode.toUnicode('xn--maana-pta.com');
|
|
60
|
+
// → 'mañana.com'
|
|
61
|
+
punycode.toUnicode('xn----dqo34k.com');
|
|
62
|
+
// → '☃-⌘.com'
|
|
63
|
+
|
|
64
|
+
// decode email addresses
|
|
65
|
+
punycode.toUnicode('джумла@xn--p-8sbkgc5ag7bhce.xn--ba-lmcq');
|
|
66
|
+
// → 'джумла@джpумлатест.bрфa'
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### `punycode.toASCII(input)`
|
|
70
|
+
|
|
71
|
+
Converts a lowercased Unicode string representing a domain name or an email address to Punycode. Only the non-ASCII parts of the input will be converted, i.e. it doesn’t matter if you call it with a domain that’s already in ASCII.
|
|
72
|
+
|
|
73
|
+
```js
|
|
74
|
+
// encode domain names
|
|
75
|
+
punycode.toASCII('mañana.com');
|
|
76
|
+
// → 'xn--maana-pta.com'
|
|
77
|
+
punycode.toASCII('☃-⌘.com');
|
|
78
|
+
// → 'xn----dqo34k.com'
|
|
79
|
+
|
|
80
|
+
// encode email addresses
|
|
81
|
+
punycode.toASCII('джумла@джpумлатест.bрфa');
|
|
82
|
+
// → 'джумла@xn--p-8sbkgc5ag7bhce.xn--ba-lmcq'
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### `punycode.ucs2`
|
|
86
|
+
|
|
87
|
+
#### `punycode.ucs2.decode(string)`
|
|
88
|
+
|
|
89
|
+
Creates an array containing the numeric code point values of each Unicode symbol in the string. While [JavaScript uses UCS-2 internally](https://mathiasbynens.be/notes/javascript-encoding), this function will convert a pair of surrogate halves (each of which UCS-2 exposes as separate characters) into a single code point, matching UTF-16.
|
|
90
|
+
|
|
91
|
+
```js
|
|
92
|
+
punycode.ucs2.decode('abc');
|
|
93
|
+
// → [0x61, 0x62, 0x63]
|
|
94
|
+
// surrogate pair for U+1D306 TETRAGRAM FOR CENTRE:
|
|
95
|
+
punycode.ucs2.decode('\uD834\uDF06');
|
|
96
|
+
// → [0x1D306]
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
#### `punycode.ucs2.encode(codePoints)`
|
|
100
|
+
|
|
101
|
+
Creates a string based on an array of numeric code point values.
|
|
102
|
+
|
|
103
|
+
```js
|
|
104
|
+
punycode.ucs2.encode([0x61, 0x62, 0x63]);
|
|
105
|
+
// → 'abc'
|
|
106
|
+
punycode.ucs2.encode([0x1D306]);
|
|
107
|
+
// → '\uD834\uDF06'
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### `punycode.version`
|
|
111
|
+
|
|
112
|
+
A string representing the current Punycode.js version number.
|
|
113
|
+
|
|
114
|
+
## Author
|
|
115
|
+
|
|
116
|
+
| [](https://twitter.com/mathias "Follow @mathias on Twitter") |
|
|
117
|
+
|---|
|
|
118
|
+
| [Mathias Bynens](https://mathiasbynens.be/) |
|
|
119
|
+
|
|
120
|
+
## License
|
|
121
|
+
|
|
122
|
+
Punycode.js is available under the [MIT](https://mths.be/mit) license.
|