cdk-common 2.0.862 → 2.0.863

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.
Files changed (90) hide show
  1. package/.jsii +3 -3
  2. package/lib/main.js +1 -1
  3. package/node_modules/@types/node/README.md +1 -1
  4. package/node_modules/@types/node/crypto.d.ts +3 -3
  5. package/node_modules/@types/node/fs.d.ts +2 -2
  6. package/node_modules/@types/node/net.d.ts +1 -1
  7. package/node_modules/@types/node/package.json +2 -2
  8. package/node_modules/fast-uri/.gitattributes +2 -0
  9. package/node_modules/fast-uri/.github/.stale.yml +21 -0
  10. package/node_modules/fast-uri/.github/dependabot.yml +13 -0
  11. package/node_modules/fast-uri/.github/tests_checker.yml +8 -0
  12. package/node_modules/fast-uri/.github/workflows/ci.yml +22 -0
  13. package/node_modules/fast-uri/.github/workflows/package-manager-ci.yml +20 -0
  14. package/node_modules/fast-uri/LICENSE +30 -0
  15. package/node_modules/fast-uri/README.md +125 -0
  16. package/node_modules/fast-uri/benchmark.js +105 -0
  17. package/node_modules/fast-uri/index.js +305 -0
  18. package/node_modules/fast-uri/lib/schemes.js +188 -0
  19. package/node_modules/fast-uri/lib/scopedChars.js +30 -0
  20. package/node_modules/fast-uri/lib/utils.js +236 -0
  21. package/node_modules/fast-uri/package.json +41 -0
  22. package/node_modules/fast-uri/test/.gitkeep +0 -0
  23. package/node_modules/fast-uri/test/compatibility.test.js +129 -0
  24. package/node_modules/fast-uri/test/equal.test.js +104 -0
  25. package/node_modules/fast-uri/test/parse.test.js +310 -0
  26. package/node_modules/fast-uri/test/resolve.test.js +76 -0
  27. package/node_modules/fast-uri/test/serialize.test.js +144 -0
  28. package/node_modules/fast-uri/types/index.d.ts +53 -0
  29. package/node_modules/fast-uri/types/index.test-d.ts +17 -0
  30. package/node_modules/table/node_modules/ajv/dist/compile/resolve.d.ts +1 -1
  31. package/node_modules/table/node_modules/ajv/dist/runtime/uri.d.ts +1 -1
  32. package/node_modules/table/node_modules/ajv/dist/runtime/uri.js +1 -1
  33. package/node_modules/table/node_modules/ajv/dist/runtime/uri.js.map +1 -1
  34. package/node_modules/table/node_modules/ajv/dist/types/index.d.ts +1 -1
  35. package/node_modules/table/node_modules/ajv/lib/compile/index.ts +1 -1
  36. package/node_modules/table/node_modules/ajv/lib/compile/resolve.ts +1 -1
  37. package/node_modules/table/node_modules/ajv/lib/runtime/uri.ts +1 -1
  38. package/node_modules/table/node_modules/ajv/lib/types/index.ts +1 -1
  39. package/node_modules/table/node_modules/ajv/package.json +4 -4
  40. package/package.json +3 -3
  41. package/node_modules/punycode/LICENSE-MIT.txt +0 -20
  42. package/node_modules/punycode/README.md +0 -148
  43. package/node_modules/punycode/package.json +0 -58
  44. package/node_modules/punycode/punycode.es6.js +0 -444
  45. package/node_modules/punycode/punycode.js +0 -443
  46. package/node_modules/uri-js/LICENSE +0 -11
  47. package/node_modules/uri-js/README.md +0 -203
  48. package/node_modules/uri-js/dist/es5/uri.all.d.ts +0 -59
  49. package/node_modules/uri-js/dist/es5/uri.all.js +0 -1443
  50. package/node_modules/uri-js/dist/es5/uri.all.js.map +0 -1
  51. package/node_modules/uri-js/dist/es5/uri.all.min.d.ts +0 -59
  52. package/node_modules/uri-js/dist/es5/uri.all.min.js +0 -3
  53. package/node_modules/uri-js/dist/es5/uri.all.min.js.map +0 -1
  54. package/node_modules/uri-js/dist/esnext/index.d.ts +0 -1
  55. package/node_modules/uri-js/dist/esnext/index.js +0 -17
  56. package/node_modules/uri-js/dist/esnext/index.js.map +0 -1
  57. package/node_modules/uri-js/dist/esnext/regexps-iri.d.ts +0 -3
  58. package/node_modules/uri-js/dist/esnext/regexps-iri.js +0 -3
  59. package/node_modules/uri-js/dist/esnext/regexps-iri.js.map +0 -1
  60. package/node_modules/uri-js/dist/esnext/regexps-uri.d.ts +0 -4
  61. package/node_modules/uri-js/dist/esnext/regexps-uri.js +0 -42
  62. package/node_modules/uri-js/dist/esnext/regexps-uri.js.map +0 -1
  63. package/node_modules/uri-js/dist/esnext/schemes/http.d.ts +0 -3
  64. package/node_modules/uri-js/dist/esnext/schemes/http.js +0 -28
  65. package/node_modules/uri-js/dist/esnext/schemes/http.js.map +0 -1
  66. package/node_modules/uri-js/dist/esnext/schemes/https.d.ts +0 -3
  67. package/node_modules/uri-js/dist/esnext/schemes/https.js +0 -9
  68. package/node_modules/uri-js/dist/esnext/schemes/https.js.map +0 -1
  69. package/node_modules/uri-js/dist/esnext/schemes/mailto.d.ts +0 -12
  70. package/node_modules/uri-js/dist/esnext/schemes/mailto.js +0 -148
  71. package/node_modules/uri-js/dist/esnext/schemes/mailto.js.map +0 -1
  72. package/node_modules/uri-js/dist/esnext/schemes/urn-uuid.d.ts +0 -7
  73. package/node_modules/uri-js/dist/esnext/schemes/urn-uuid.js +0 -23
  74. package/node_modules/uri-js/dist/esnext/schemes/urn-uuid.js.map +0 -1
  75. package/node_modules/uri-js/dist/esnext/schemes/urn.d.ts +0 -10
  76. package/node_modules/uri-js/dist/esnext/schemes/urn.js +0 -49
  77. package/node_modules/uri-js/dist/esnext/schemes/urn.js.map +0 -1
  78. package/node_modules/uri-js/dist/esnext/schemes/ws.d.ts +0 -7
  79. package/node_modules/uri-js/dist/esnext/schemes/ws.js +0 -41
  80. package/node_modules/uri-js/dist/esnext/schemes/ws.js.map +0 -1
  81. package/node_modules/uri-js/dist/esnext/schemes/wss.d.ts +0 -3
  82. package/node_modules/uri-js/dist/esnext/schemes/wss.js +0 -9
  83. package/node_modules/uri-js/dist/esnext/schemes/wss.js.map +0 -1
  84. package/node_modules/uri-js/dist/esnext/uri.d.ts +0 -59
  85. package/node_modules/uri-js/dist/esnext/uri.js +0 -480
  86. package/node_modules/uri-js/dist/esnext/uri.js.map +0 -1
  87. package/node_modules/uri-js/dist/esnext/util.d.ts +0 -6
  88. package/node_modules/uri-js/dist/esnext/util.js +0 -36
  89. package/node_modules/uri-js/dist/esnext/util.js.map +0 -1
  90. package/node_modules/uri-js/package.json +0 -77
@@ -1,443 +0,0 @@
1
- 'use strict';
2
-
3
- /** Highest positive signed 32-bit float value */
4
- const maxInt = 2147483647; // aka. 0x7FFFFFFF or 2^31-1
5
-
6
- /** Bootstring parameters */
7
- const base = 36;
8
- const tMin = 1;
9
- const tMax = 26;
10
- const skew = 38;
11
- const damp = 700;
12
- const initialBias = 72;
13
- const initialN = 128; // 0x80
14
- const delimiter = '-'; // '\x2D'
15
-
16
- /** Regular expressions */
17
- const regexPunycode = /^xn--/;
18
- const regexNonASCII = /[^\0-\x7F]/; // Note: U+007F DEL is excluded too.
19
- const regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g; // RFC 3490 separators
20
-
21
- /** Error messages */
22
- const errors = {
23
- 'overflow': 'Overflow: input needs wider integers to process',
24
- 'not-basic': 'Illegal input >= 0x80 (not a basic code point)',
25
- 'invalid-input': 'Invalid input'
26
- };
27
-
28
- /** Convenience shortcuts */
29
- const baseMinusTMin = base - tMin;
30
- const floor = Math.floor;
31
- const stringFromCharCode = String.fromCharCode;
32
-
33
- /*--------------------------------------------------------------------------*/
34
-
35
- /**
36
- * A generic error utility function.
37
- * @private
38
- * @param {String} type The error type.
39
- * @returns {Error} Throws a `RangeError` with the applicable error message.
40
- */
41
- function error(type) {
42
- throw new RangeError(errors[type]);
43
- }
44
-
45
- /**
46
- * A generic `Array#map` utility function.
47
- * @private
48
- * @param {Array} array The array to iterate over.
49
- * @param {Function} callback The function that gets called for every array
50
- * item.
51
- * @returns {Array} A new array of values returned by the callback function.
52
- */
53
- function map(array, callback) {
54
- const result = [];
55
- let length = array.length;
56
- while (length--) {
57
- result[length] = callback(array[length]);
58
- }
59
- return result;
60
- }
61
-
62
- /**
63
- * A simple `Array#map`-like wrapper to work with domain name strings or email
64
- * addresses.
65
- * @private
66
- * @param {String} domain The domain name or email address.
67
- * @param {Function} callback The function that gets called for every
68
- * character.
69
- * @returns {String} A new string of characters returned by the callback
70
- * function.
71
- */
72
- function mapDomain(domain, callback) {
73
- const parts = domain.split('@');
74
- let result = '';
75
- if (parts.length > 1) {
76
- // In email addresses, only the domain name should be punycoded. Leave
77
- // the local part (i.e. everything up to `@`) intact.
78
- result = parts[0] + '@';
79
- domain = parts[1];
80
- }
81
- // Avoid `split(regex)` for IE8 compatibility. See #17.
82
- domain = domain.replace(regexSeparators, '\x2E');
83
- const labels = domain.split('.');
84
- const encoded = map(labels, callback).join('.');
85
- return result + encoded;
86
- }
87
-
88
- /**
89
- * Creates an array containing the numeric code points of each Unicode
90
- * character in the string. While JavaScript uses UCS-2 internally,
91
- * this function will convert a pair of surrogate halves (each of which
92
- * UCS-2 exposes as separate characters) into a single code point,
93
- * matching UTF-16.
94
- * @see `punycode.ucs2.encode`
95
- * @see <https://mathiasbynens.be/notes/javascript-encoding>
96
- * @memberOf punycode.ucs2
97
- * @name decode
98
- * @param {String} string The Unicode input string (UCS-2).
99
- * @returns {Array} The new array of code points.
100
- */
101
- function ucs2decode(string) {
102
- const output = [];
103
- let counter = 0;
104
- const length = string.length;
105
- while (counter < length) {
106
- const value = string.charCodeAt(counter++);
107
- if (value >= 0xD800 && value <= 0xDBFF && counter < length) {
108
- // It's a high surrogate, and there is a next character.
109
- const extra = string.charCodeAt(counter++);
110
- if ((extra & 0xFC00) == 0xDC00) { // Low surrogate.
111
- output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);
112
- } else {
113
- // It's an unmatched surrogate; only append this code unit, in case the
114
- // next code unit is the high surrogate of a surrogate pair.
115
- output.push(value);
116
- counter--;
117
- }
118
- } else {
119
- output.push(value);
120
- }
121
- }
122
- return output;
123
- }
124
-
125
- /**
126
- * Creates a string based on an array of numeric code points.
127
- * @see `punycode.ucs2.decode`
128
- * @memberOf punycode.ucs2
129
- * @name encode
130
- * @param {Array} codePoints The array of numeric code points.
131
- * @returns {String} The new Unicode string (UCS-2).
132
- */
133
- const ucs2encode = codePoints => String.fromCodePoint(...codePoints);
134
-
135
- /**
136
- * Converts a basic code point into a digit/integer.
137
- * @see `digitToBasic()`
138
- * @private
139
- * @param {Number} codePoint The basic numeric code point value.
140
- * @returns {Number} The numeric value of a basic code point (for use in
141
- * representing integers) in the range `0` to `base - 1`, or `base` if
142
- * the code point does not represent a value.
143
- */
144
- const basicToDigit = function(codePoint) {
145
- if (codePoint >= 0x30 && codePoint < 0x3A) {
146
- return 26 + (codePoint - 0x30);
147
- }
148
- if (codePoint >= 0x41 && codePoint < 0x5B) {
149
- return codePoint - 0x41;
150
- }
151
- if (codePoint >= 0x61 && codePoint < 0x7B) {
152
- return codePoint - 0x61;
153
- }
154
- return base;
155
- };
156
-
157
- /**
158
- * Converts a digit/integer into a basic code point.
159
- * @see `basicToDigit()`
160
- * @private
161
- * @param {Number} digit The numeric value of a basic code point.
162
- * @returns {Number} The basic code point whose value (when used for
163
- * representing integers) is `digit`, which needs to be in the range
164
- * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is
165
- * used; else, the lowercase form is used. The behavior is undefined
166
- * if `flag` is non-zero and `digit` has no uppercase form.
167
- */
168
- const digitToBasic = function(digit, flag) {
169
- // 0..25 map to ASCII a..z or A..Z
170
- // 26..35 map to ASCII 0..9
171
- return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);
172
- };
173
-
174
- /**
175
- * Bias adaptation function as per section 3.4 of RFC 3492.
176
- * https://tools.ietf.org/html/rfc3492#section-3.4
177
- * @private
178
- */
179
- const adapt = function(delta, numPoints, firstTime) {
180
- let k = 0;
181
- delta = firstTime ? floor(delta / damp) : delta >> 1;
182
- delta += floor(delta / numPoints);
183
- for (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) {
184
- delta = floor(delta / baseMinusTMin);
185
- }
186
- return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));
187
- };
188
-
189
- /**
190
- * Converts a Punycode string of ASCII-only symbols to a string of Unicode
191
- * symbols.
192
- * @memberOf punycode
193
- * @param {String} input The Punycode string of ASCII-only symbols.
194
- * @returns {String} The resulting string of Unicode symbols.
195
- */
196
- const decode = function(input) {
197
- // Don't use UCS-2.
198
- const output = [];
199
- const inputLength = input.length;
200
- let i = 0;
201
- let n = initialN;
202
- let bias = initialBias;
203
-
204
- // Handle the basic code points: let `basic` be the number of input code
205
- // points before the last delimiter, or `0` if there is none, then copy
206
- // the first basic code points to the output.
207
-
208
- let basic = input.lastIndexOf(delimiter);
209
- if (basic < 0) {
210
- basic = 0;
211
- }
212
-
213
- for (let j = 0; j < basic; ++j) {
214
- // if it's not a basic code point
215
- if (input.charCodeAt(j) >= 0x80) {
216
- error('not-basic');
217
- }
218
- output.push(input.charCodeAt(j));
219
- }
220
-
221
- // Main decoding loop: start just after the last delimiter if any basic code
222
- // points were copied; start at the beginning otherwise.
223
-
224
- for (let index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) {
225
-
226
- // `index` is the index of the next character to be consumed.
227
- // Decode a generalized variable-length integer into `delta`,
228
- // which gets added to `i`. The overflow checking is easier
229
- // if we increase `i` as we go, then subtract off its starting
230
- // value at the end to obtain `delta`.
231
- const oldi = i;
232
- for (let w = 1, k = base; /* no condition */; k += base) {
233
-
234
- if (index >= inputLength) {
235
- error('invalid-input');
236
- }
237
-
238
- const digit = basicToDigit(input.charCodeAt(index++));
239
-
240
- if (digit >= base) {
241
- error('invalid-input');
242
- }
243
- if (digit > floor((maxInt - i) / w)) {
244
- error('overflow');
245
- }
246
-
247
- i += digit * w;
248
- const t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);
249
-
250
- if (digit < t) {
251
- break;
252
- }
253
-
254
- const baseMinusT = base - t;
255
- if (w > floor(maxInt / baseMinusT)) {
256
- error('overflow');
257
- }
258
-
259
- w *= baseMinusT;
260
-
261
- }
262
-
263
- const out = output.length + 1;
264
- bias = adapt(i - oldi, out, oldi == 0);
265
-
266
- // `i` was supposed to wrap around from `out` to `0`,
267
- // incrementing `n` each time, so we'll fix that now:
268
- if (floor(i / out) > maxInt - n) {
269
- error('overflow');
270
- }
271
-
272
- n += floor(i / out);
273
- i %= out;
274
-
275
- // Insert `n` at position `i` of the output.
276
- output.splice(i++, 0, n);
277
-
278
- }
279
-
280
- return String.fromCodePoint(...output);
281
- };
282
-
283
- /**
284
- * Converts a string of Unicode symbols (e.g. a domain name label) to a
285
- * Punycode string of ASCII-only symbols.
286
- * @memberOf punycode
287
- * @param {String} input The string of Unicode symbols.
288
- * @returns {String} The resulting Punycode string of ASCII-only symbols.
289
- */
290
- const encode = function(input) {
291
- const output = [];
292
-
293
- // Convert the input in UCS-2 to an array of Unicode code points.
294
- input = ucs2decode(input);
295
-
296
- // Cache the length.
297
- const inputLength = input.length;
298
-
299
- // Initialize the state.
300
- let n = initialN;
301
- let delta = 0;
302
- let bias = initialBias;
303
-
304
- // Handle the basic code points.
305
- for (const currentValue of input) {
306
- if (currentValue < 0x80) {
307
- output.push(stringFromCharCode(currentValue));
308
- }
309
- }
310
-
311
- const basicLength = output.length;
312
- let handledCPCount = basicLength;
313
-
314
- // `handledCPCount` is the number of code points that have been handled;
315
- // `basicLength` is the number of basic code points.
316
-
317
- // Finish the basic string with a delimiter unless it's empty.
318
- if (basicLength) {
319
- output.push(delimiter);
320
- }
321
-
322
- // Main encoding loop:
323
- while (handledCPCount < inputLength) {
324
-
325
- // All non-basic code points < n have been handled already. Find the next
326
- // larger one:
327
- let m = maxInt;
328
- for (const currentValue of input) {
329
- if (currentValue >= n && currentValue < m) {
330
- m = currentValue;
331
- }
332
- }
333
-
334
- // Increase `delta` enough to advance the decoder's <n,i> state to <m,0>,
335
- // but guard against overflow.
336
- const handledCPCountPlusOne = handledCPCount + 1;
337
- if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {
338
- error('overflow');
339
- }
340
-
341
- delta += (m - n) * handledCPCountPlusOne;
342
- n = m;
343
-
344
- for (const currentValue of input) {
345
- if (currentValue < n && ++delta > maxInt) {
346
- error('overflow');
347
- }
348
- if (currentValue === n) {
349
- // Represent delta as a generalized variable-length integer.
350
- let q = delta;
351
- for (let k = base; /* no condition */; k += base) {
352
- const t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);
353
- if (q < t) {
354
- break;
355
- }
356
- const qMinusT = q - t;
357
- const baseMinusT = base - t;
358
- output.push(
359
- stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0))
360
- );
361
- q = floor(qMinusT / baseMinusT);
362
- }
363
-
364
- output.push(stringFromCharCode(digitToBasic(q, 0)));
365
- bias = adapt(delta, handledCPCountPlusOne, handledCPCount === basicLength);
366
- delta = 0;
367
- ++handledCPCount;
368
- }
369
- }
370
-
371
- ++delta;
372
- ++n;
373
-
374
- }
375
- return output.join('');
376
- };
377
-
378
- /**
379
- * Converts a Punycode string representing a domain name or an email address
380
- * to Unicode. Only the Punycoded parts of the input will be converted, i.e.
381
- * it doesn't matter if you call it on a string that has already been
382
- * converted to Unicode.
383
- * @memberOf punycode
384
- * @param {String} input The Punycoded domain name or email address to
385
- * convert to Unicode.
386
- * @returns {String} The Unicode representation of the given Punycode
387
- * string.
388
- */
389
- const toUnicode = function(input) {
390
- return mapDomain(input, function(string) {
391
- return regexPunycode.test(string)
392
- ? decode(string.slice(4).toLowerCase())
393
- : string;
394
- });
395
- };
396
-
397
- /**
398
- * Converts a Unicode string representing a domain name or an email address to
399
- * Punycode. Only the non-ASCII parts of the domain name will be converted,
400
- * i.e. it doesn't matter if you call it with a domain that's already in
401
- * ASCII.
402
- * @memberOf punycode
403
- * @param {String} input The domain name or email address to convert, as a
404
- * Unicode string.
405
- * @returns {String} The Punycode representation of the given domain name or
406
- * email address.
407
- */
408
- const toASCII = function(input) {
409
- return mapDomain(input, function(string) {
410
- return regexNonASCII.test(string)
411
- ? 'xn--' + encode(string)
412
- : string;
413
- });
414
- };
415
-
416
- /*--------------------------------------------------------------------------*/
417
-
418
- /** Define the public API */
419
- const punycode = {
420
- /**
421
- * A string representing the current Punycode.js version number.
422
- * @memberOf punycode
423
- * @type String
424
- */
425
- 'version': '2.3.1',
426
- /**
427
- * An object of methods to convert from JavaScript's internal character
428
- * representation (UCS-2) to Unicode code points, and back.
429
- * @see <https://mathiasbynens.be/notes/javascript-encoding>
430
- * @memberOf punycode
431
- * @type Object
432
- */
433
- 'ucs2': {
434
- 'decode': ucs2decode,
435
- 'encode': ucs2encode
436
- },
437
- 'decode': decode,
438
- 'encode': encode,
439
- 'toASCII': toASCII,
440
- 'toUnicode': toUnicode
441
- };
442
-
443
- module.exports = punycode;
@@ -1,11 +0,0 @@
1
- Copyright 2011 Gary Court. All rights reserved.
2
-
3
- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
4
-
5
- 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
6
-
7
- 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
8
-
9
- THIS SOFTWARE IS PROVIDED BY GARY COURT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GARY COURT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
10
-
11
- The views and conclusions contained in the software and documentation are those of the authors and should not be interpreted as representing official policies, either expressed or implied, of Gary Court.
@@ -1,203 +0,0 @@
1
- # URI.js
2
-
3
- URI.js is an [RFC 3986](http://www.ietf.org/rfc/rfc3986.txt) compliant, scheme extendable URI parsing/validating/resolving library for all JavaScript environments (browsers, Node.js, etc).
4
- It is also compliant with the IRI ([RFC 3987](http://www.ietf.org/rfc/rfc3987.txt)), IDNA ([RFC 5890](http://www.ietf.org/rfc/rfc5890.txt)), IPv6 Address ([RFC 5952](http://www.ietf.org/rfc/rfc5952.txt)), IPv6 Zone Identifier ([RFC 6874](http://www.ietf.org/rfc/rfc6874.txt)) specifications.
5
-
6
- URI.js has an extensive test suite, and works in all (Node.js, web) environments. It weighs in at 6.4kb (gzipped, 17kb deflated).
7
-
8
- ## API
9
-
10
- ### Parsing
11
-
12
- URI.parse("uri://user:pass@example.com:123/one/two.three?q1=a1&q2=a2#body");
13
- //returns:
14
- //{
15
- // scheme : "uri",
16
- // userinfo : "user:pass",
17
- // host : "example.com",
18
- // port : 123,
19
- // path : "/one/two.three",
20
- // query : "q1=a1&q2=a2",
21
- // fragment : "body"
22
- //}
23
-
24
- ### Serializing
25
-
26
- URI.serialize({scheme : "http", host : "example.com", fragment : "footer"}) === "http://example.com/#footer"
27
-
28
- ### Resolving
29
-
30
- URI.resolve("uri://a/b/c/d?q", "../../g") === "uri://a/g"
31
-
32
- ### Normalizing
33
-
34
- URI.normalize("HTTP://ABC.com:80/%7Esmith/home.html") === "http://abc.com/~smith/home.html"
35
-
36
- ### Comparison
37
-
38
- URI.equal("example://a/b/c/%7Bfoo%7D", "eXAMPLE://a/./b/../b/%63/%7bfoo%7d") === true
39
-
40
- ### IP Support
41
-
42
- //IPv4 normalization
43
- URI.normalize("//192.068.001.000") === "//192.68.1.0"
44
-
45
- //IPv6 normalization
46
- URI.normalize("//[2001:0:0DB8::0:0001]") === "//[2001:0:db8::1]"
47
-
48
- //IPv6 zone identifier support
49
- URI.parse("//[2001:db8::7%25en1]");
50
- //returns:
51
- //{
52
- // host : "2001:db8::7%en1"
53
- //}
54
-
55
- ### IRI Support
56
-
57
- //convert IRI to URI
58
- URI.serialize(URI.parse("http://examplé.org/rosé")) === "http://xn--exampl-gva.org/ros%C3%A9"
59
- //convert URI to IRI
60
- URI.serialize(URI.parse("http://xn--exampl-gva.org/ros%C3%A9"), {iri:true}) === "http://examplé.org/rosé"
61
-
62
- ### Options
63
-
64
- All of the above functions can accept an additional options argument that is an object that can contain one or more of the following properties:
65
-
66
- * `scheme` (string)
67
-
68
- Indicates the scheme that the URI should be treated as, overriding the URI's normal scheme parsing behavior.
69
-
70
- * `reference` (string)
71
-
72
- If set to `"suffix"`, it indicates that the URI is in the suffix format, and the validator will use the option's `scheme` property to determine the URI's scheme.
73
-
74
- * `tolerant` (boolean, false)
75
-
76
- If set to `true`, the parser will relax URI resolving rules.
77
-
78
- * `absolutePath` (boolean, false)
79
-
80
- If set to `true`, the serializer will not resolve a relative `path` component.
81
-
82
- * `iri` (boolean, false)
83
-
84
- If set to `true`, the serializer will unescape non-ASCII characters as per [RFC 3987](http://www.ietf.org/rfc/rfc3987.txt).
85
-
86
- * `unicodeSupport` (boolean, false)
87
-
88
- If set to `true`, the parser will unescape non-ASCII characters in the parsed output as per [RFC 3987](http://www.ietf.org/rfc/rfc3987.txt).
89
-
90
- * `domainHost` (boolean, false)
91
-
92
- If set to `true`, the library will treat the `host` component as a domain name, and convert IDNs (International Domain Names) as per [RFC 5891](http://www.ietf.org/rfc/rfc5891.txt).
93
-
94
- ## Scheme Extendable
95
-
96
- URI.js supports inserting custom [scheme](http://en.wikipedia.org/wiki/URI_scheme) dependent processing rules. Currently, URI.js has built in support for the following schemes:
97
-
98
- * http \[[RFC 2616](http://www.ietf.org/rfc/rfc2616.txt)\]
99
- * https \[[RFC 2818](http://www.ietf.org/rfc/rfc2818.txt)\]
100
- * ws \[[RFC 6455](http://www.ietf.org/rfc/rfc6455.txt)\]
101
- * wss \[[RFC 6455](http://www.ietf.org/rfc/rfc6455.txt)\]
102
- * mailto \[[RFC 6068](http://www.ietf.org/rfc/rfc6068.txt)\]
103
- * urn \[[RFC 2141](http://www.ietf.org/rfc/rfc2141.txt)\]
104
- * urn:uuid \[[RFC 4122](http://www.ietf.org/rfc/rfc4122.txt)\]
105
-
106
- ### HTTP/HTTPS Support
107
-
108
- URI.equal("HTTP://ABC.COM:80", "http://abc.com/") === true
109
- URI.equal("https://abc.com", "HTTPS://ABC.COM:443/") === true
110
-
111
- ### WS/WSS Support
112
-
113
- URI.parse("wss://example.com/foo?bar=baz");
114
- //returns:
115
- //{
116
- // scheme : "wss",
117
- // host: "example.com",
118
- // resourceName: "/foo?bar=baz",
119
- // secure: true,
120
- //}
121
-
122
- URI.equal("WS://ABC.COM:80/chat#one", "ws://abc.com/chat") === true
123
-
124
- ### Mailto Support
125
-
126
- URI.parse("mailto:alpha@example.com,bravo@example.com?subject=SUBSCRIBE&body=Sign%20me%20up!");
127
- //returns:
128
- //{
129
- // scheme : "mailto",
130
- // to : ["alpha@example.com", "bravo@example.com"],
131
- // subject : "SUBSCRIBE",
132
- // body : "Sign me up!"
133
- //}
134
-
135
- URI.serialize({
136
- scheme : "mailto",
137
- to : ["alpha@example.com"],
138
- subject : "REMOVE",
139
- body : "Please remove me",
140
- headers : {
141
- cc : "charlie@example.com"
142
- }
143
- }) === "mailto:alpha@example.com?cc=charlie@example.com&subject=REMOVE&body=Please%20remove%20me"
144
-
145
- ### URN Support
146
-
147
- URI.parse("urn:example:foo");
148
- //returns:
149
- //{
150
- // scheme : "urn",
151
- // nid : "example",
152
- // nss : "foo",
153
- //}
154
-
155
- #### URN UUID Support
156
-
157
- URI.parse("urn:uuid:f81d4fae-7dec-11d0-a765-00a0c91e6bf6");
158
- //returns:
159
- //{
160
- // scheme : "urn",
161
- // nid : "uuid",
162
- // uuid : "f81d4fae-7dec-11d0-a765-00a0c91e6bf6",
163
- //}
164
-
165
- ## Usage
166
-
167
- To load in a browser, use the following tag:
168
-
169
- <script type="text/javascript" src="uri-js/dist/es5/uri.all.min.js"></script>
170
-
171
- To load in a CommonJS/Module environment, first install with npm/yarn by running on the command line:
172
-
173
- npm install uri-js
174
- # OR
175
- yarn add uri-js
176
-
177
- Then, in your code, load it using:
178
-
179
- const URI = require("uri-js");
180
-
181
- If you are writing your code in ES6+ (ESNEXT) or TypeScript, you would load it using:
182
-
183
- import * as URI from "uri-js";
184
-
185
- Or you can load just what you need using named exports:
186
-
187
- import { parse, serialize, resolve, resolveComponents, normalize, equal, removeDotSegments, pctEncChar, pctDecChars, escapeComponent, unescapeComponent } from "uri-js";
188
-
189
- ## Breaking changes
190
-
191
- ### Breaking changes from 3.x
192
-
193
- URN parsing has been completely changed to better align with the specification. Scheme is now always `urn`, but has two new properties: `nid` which contains the Namspace Identifier, and `nss` which contains the Namespace Specific String. The `nss` property will be removed by higher order scheme handlers, such as the UUID URN scheme handler.
194
-
195
- The UUID of a URN can now be found in the `uuid` property.
196
-
197
- ### Breaking changes from 2.x
198
-
199
- URI validation has been removed as it was slow, exposed a vulnerabilty, and was generally not useful.
200
-
201
- ### Breaking changes from 1.x
202
-
203
- The `errors` array on parsed components is now an `error` string.